diff --git a/.cursor/rules/coding-style.mdc b/.cursor/rules/coding-style.mdc index 7fda7a28..0e26fb66 100644 --- a/.cursor/rules/coding-style.mdc +++ b/.cursor/rules/coding-style.mdc @@ -3,6 +3,7 @@ description: globs: alwaysApply: true --- + Coding style: - Favor `async run() {` over `run = async () => {` inside ES6 classes @@ -11,9 +12,20 @@ Coding style: - Favor using real paths (`../lib/schemas.ts`) over aliases (`@/app/lib/schemas`). - Favor `for (const comment of comments) {` over `comments.forEach((comment) => {` - Favor named exports over default exports, with the exception of Next.js pages -- Do not wrap each function body and function call in `try`/`catch` blocks. It pollutes the code. Assume we will always have an e.g. `main().catch((err) => { console.error(err); process.exit(1) })` to catch us. I repeat: Avoid over-use of try-catch such as `try { // foo } catch (err) { console.error('error while foo'); throw err }`, assume we catch errors on a higher level and do not need the extra explananation. -- Before creating new files and new code, see if we can leverage existing work, maybe slighty adapt that without breaking BC, to keep things DRY. -- Favor early exits, so quickly `continue`, `return false` (or `throw` if needed), over nesting everything in positive conditions, creating christmas trees. +- Do not wrap each function body and function call in `try`/`catch` blocks. It pollutes the code. + Assume we will always have an e.g. + `main().catch((err) => { console.error(err); process.exit(1) })` to catch us. I repeat: Avoid + over-use of try-catch such as + `try { // foo } catch (err) { console.error('error while foo'); throw err }`, assume we catch + errors on a higher level and do not need the extra explananation. +- If you must use try/catch, for simple cases, favor `alphalib/tryCatch.ts` + (`const [err, data] = await tryCatch(promise)`) over + `let data; try { data = await promise } catch (err) { }` +- Before creating new files and new code, see if we can leverage existing work, maybe slighty adapt + that without breaking BC, to keep things DRY. +- Favor early exits, so quickly `continue`, `return false` (or `throw` if needed), over nesting + everything in positive conditions, creating christmas trees. - Use Prettier with 100 char line width, single quotes for JS/TS, semi: false - Use descriptive names: PascalCase for components/types, camelCase for variables/methods/schemas - Alphabetize imports, group by source type (built-in/external/internal) +- Favor US English over UK English, so `summarizeError` over `summarise Error` diff --git a/src/alphalib/types/robots/file-decompress.ts b/src/alphalib/types/robots/file-decompress.ts index 33592aac..b1c47c7f 100644 --- a/src/alphalib/types/robots/file-decompress.ts +++ b/src/alphalib/types/robots/file-decompress.ts @@ -87,15 +87,6 @@ A possible array member is only \`"meta"\`. You might see an error when trying to extract metadata from the files inside your archive. This happens, for example, for files with a size of zero bytes. Setting this to \`true\` will cause the Robot to not stop the file decompression (and the entire Assembly) when that happens. To keep backwards compatibility, setting this parameter to \`true\` will set it to \`["meta"]\` internally. -`), - stack: z - .enum(['v1', 'v2']) - .default('v1') - .describe(` -Temporary parameter for backwards compatibility while we roll out new underlying tooling for the robot. - -- \`v1\` uses the old decompression. -- \`v2\` uses the new decompression with better support for unicode and nested archives. `), }) .strict() diff --git a/src/alphalib/types/robots/image-generate.ts b/src/alphalib/types/robots/image-generate.ts index d6c5e2c2..1a81d3c5 100644 --- a/src/alphalib/types/robots/image-generate.ts +++ b/src/alphalib/types/robots/image-generate.ts @@ -44,6 +44,13 @@ export const robotImageGenerateInstructionsSchema = robotBase height: z.number().optional().describe('Height of the generated image.'), width: z.number().optional().describe('Width of the generated image.'), style: z.string().optional().describe('Style of the generated image.'), + num_outputs: z + .number() + .int() + .min(1) + .max(10) + .optional() + .describe('Number of image variants to generate.'), }) .strict() diff --git a/src/alphalib/types/robots/image-resize.ts b/src/alphalib/types/robots/image-resize.ts index f8e01ace..0945b5ec 100644 --- a/src/alphalib/types/robots/image-resize.ts +++ b/src/alphalib/types/robots/image-resize.ts @@ -416,6 +416,14 @@ Increases or decreases the saturation of the image by using a multiplier. For ex .default(100) .describe(` Changes the hue by rotating the color of the image. The value \`100\` would produce no change whereas \`0\` and \`200\` will negate the colors in the image. +`), + contrast: z + .number() + .min(0) + .max(2) + .default(1) + .describe(` +Adjusts the contrast of the image. A value of \`1\` produces no change. Values below \`1\` decrease contrast (with \`0\` being minimum contrast), and values above \`1\` increase contrast (with \`2\` being maximum contrast). This works like the \`brightness\` parameter. `), watermark_url: z .string() diff --git a/src/alphalib/types/robots/s3-store.ts b/src/alphalib/types/robots/s3-store.ts index 850def64..5228a573 100644 --- a/src/alphalib/types/robots/s3-store.ts +++ b/src/alphalib/types/robots/s3-store.ts @@ -28,13 +28,13 @@ export const meta: RobotMetaInput = { purpose_word: 'Amazon S3', purpose_words: 'Export files to Amazon S3', service_slug: 'file-exporting', - slot_count: 10, + slot_count: 2, title: 'Export files to Amazon S3', typical_file_size_mb: 1.2, typical_file_type: 'file', name: 'S3StoreRobot', priceFactor: 10, - queueSlotCount: 10, + queueSlotCount: 2, isAllowedForUrlTransform: true, trackOutputFileSize: false, isInternal: false,