@fargowealth/fargo-ai-cli 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ - Added Worker Cron Trigger and Queue Consumer deployment options, including
6
+ bounded batch, retry, delay, timeout, and concurrency settings.
7
+ - Deployment preparation now persists runtime topology so Cron and Queue
8
+ changes are applied only when the prepared Worker version is published.
9
+
3
10
  ## 0.8.0
4
11
 
5
12
  - Replaced regex-based D1 migration checks with token-structured parsing that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fargowealth/fargo-ai-cli",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Agent-neutral Fargo AI CLI, MCP client, and LEGO project tooling",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -75,6 +75,7 @@ export async function runCli(args, options = {}) {
75
75
  const versionName = requiredTextOption(args, "--name", 160);
76
76
  const releaseNotes = await requiredNotesOption(args);
77
77
  const workerFirstRoutes = optionValues(args, "--assets-run-worker-first-route").filter(Boolean);
78
+ const queueConsumer = queueConsumerOption(args);
78
79
  const result = await deployLocalLegoApp(store, {
79
80
  appId,
80
81
  assetsBinding: optionValue(args, "--assets-binding"),
@@ -82,10 +83,12 @@ export async function runCli(args, options = {}) {
82
83
  assetsHtmlHandling: optionValue(args, "--assets-html-handling"),
83
84
  assetsNotFoundHandling: optionValue(args, "--assets-not-found-handling"),
84
85
  assetsRunWorkerFirst: workerFirstRoutes.length > 0 ? workerFirstRoutes : args.includes("--assets-run-worker-first"),
86
+ cronSchedules: optionValues(args, "--cron").filter(Boolean),
85
87
  deployDir,
86
88
  dryRun: args.includes("--dry-run"),
87
89
  entrypoint: optionValue(args, "--entrypoint"),
88
90
  releaseNotes,
91
+ queueConsumer,
89
92
  skipSource: args.includes("--skip-source"),
90
93
  source: optionValue(args, "--source") ?? ".",
91
94
  sourceExcludes: optionValues(args, "--source-exclude"),
@@ -173,6 +176,15 @@ Worker Static Assets:
173
176
  --assets-run-worker-first-route <glob>
174
177
  Repeatable Worker-first route
175
178
 
179
+ Worker Runtime Topology:
180
+ --cron <expression> Repeatable Cron trigger; requires cron_trigger
181
+ --queue-consumer <binding> Configure this App Queue binding as a consumer
182
+ --queue-max-batch-size <n> Default: 10; range: 1-100
183
+ --queue-max-batch-timeout <s> Default: 5; range: 0-60 seconds
184
+ --queue-max-retries <n> Default: 3; range: 0-100
185
+ --queue-max-concurrency <n> Optional maximum concurrent consumers
186
+ --queue-retry-delay <s> Optional retry delay in seconds
187
+
176
188
  Example:
177
189
  fargo lego deploy --app app_xxx --source . \\
178
190
  --deploy-dir .build/worker --target worker --entrypoint index.js \\
@@ -220,6 +232,39 @@ function assertAssetsDirectoryProvided(args, assetsDirectory) {
220
232
  }
221
233
  }
222
234
 
235
+ function queueConsumerOption(args) {
236
+ const bindingName = optionValue(args, "--queue-consumer")?.trim();
237
+ const settingNames = [
238
+ "--queue-max-batch-size",
239
+ "--queue-max-batch-timeout",
240
+ "--queue-max-retries",
241
+ "--queue-max-concurrency",
242
+ "--queue-retry-delay"
243
+ ];
244
+ if (!bindingName) {
245
+ if (settingNames.some((name) => hasOption(args, name))) {
246
+ throw new Error("Queue consumer settings require --queue-consumer <binding>");
247
+ }
248
+ return undefined;
249
+ }
250
+ return {
251
+ bindingName,
252
+ ...integerOption(args, "--queue-max-batch-size", "maxBatchSize"),
253
+ ...integerOption(args, "--queue-max-batch-timeout", "maxBatchTimeout"),
254
+ ...integerOption(args, "--queue-max-retries", "maxRetries"),
255
+ ...integerOption(args, "--queue-max-concurrency", "maxConcurrency"),
256
+ ...integerOption(args, "--queue-retry-delay", "retryDelay")
257
+ };
258
+ }
259
+
260
+ function integerOption(args, optionName, propertyName) {
261
+ const value = optionValue(args, optionName);
262
+ if (value === undefined) return {};
263
+ const parsed = Number(value);
264
+ if (!Number.isInteger(parsed)) throw new Error(`${optionName} must be an integer`);
265
+ return { [propertyName]: parsed };
266
+ }
267
+
223
268
  function hasOption(args, name) {
224
269
  return args.some((value) => value === name || value.startsWith(`${name}=`));
225
270
  }
@@ -7,6 +7,9 @@ import { createSourceSnapshot } from "./source-snapshot.mjs";
7
7
 
8
8
  export async function deployLocalLegoApp(store, input, options = {}) {
9
9
  const target = requiredTarget(input.target);
10
+ if (target !== "worker" && (input.cronSchedules?.length || input.queueConsumer)) {
11
+ throw new Error("Cron and Queue consumer topology is supported only for Worker deployments");
12
+ }
10
13
  const entrypoint = input.entrypoint || (target === "pages" ? "index.html" : "index.js");
11
14
  const [snapshot, artifact] = await Promise.all([
12
15
  input.skipSource ? Promise.resolve(undefined) : createSourceSnapshot(input.source || ".", {
@@ -63,9 +66,11 @@ export async function deployLocalLegoApp(store, input, options = {}) {
63
66
  const deploymentInput = {
64
67
  action: target,
65
68
  appId: input.appId,
69
+ ...(input.cronSchedules?.length ? { cronSchedules: input.cronSchedules } : {}),
66
70
  deployArtifactId,
67
71
  entrypoint: artifact.entrypoint,
68
72
  releaseNotes: input.releaseNotes,
73
+ ...(input.queueConsumer ? { queueConsumer: input.queueConsumer } : {}),
69
74
  version: input.version,
70
75
  versionName: input.versionName,
71
76
  ...(sourceSnapshotId ? { sourceSnapshotId } : {})