@fluidgrids/cli 2026.1114.2 → 2026.1114.3

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.
Files changed (3) hide show
  1. package/README.md +37 -0
  2. package/dist/cli.js +429 -150
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1187,6 +1187,51 @@ var init_test_suite_operations = __esm(() => {
1187
1187
  `;
1188
1188
  });
1189
1189
 
1190
+ // src/code-first/environment-operations.ts
1191
+ var PROMOTION_FIELDS = `
1192
+ id workflowKey version fromEnvironment toEnvironment status autoApplied note reviewNote
1193
+ requestedAt requestedById reviewedAt reviewedById appliedAt
1194
+ `, ENVIRONMENTS_FIELDS, CF_WORKFLOW_ENVIRONMENTS, CF_DEPLOY_WORKFLOW_VERSION_TO_DEV, CF_REQUEST_WORKFLOW_PROMOTION, CF_WORKFLOW_PROMOTION_REQUESTS;
1195
+ var init_environment_operations = __esm(() => {
1196
+ ENVIRONMENTS_FIELDS = `
1197
+ workflowKey
1198
+ environments {
1199
+ environment version workflowDefinitionId available deployedAt deployedById promotedFrom
1200
+ promotionRequestId outOfBand
1201
+ }
1202
+ pendingPromotions { ${PROMOTION_FIELDS} }
1203
+ policy { requireStagingApproval requireProdApproval allowSelfApproval lockDirectActivation }
1204
+ `;
1205
+ CF_WORKFLOW_ENVIRONMENTS = `
1206
+ query FluidgridsCodeWorkflowEnvironments($workflowKey: String!) {
1207
+ workflowEnvironments(workflowKey: $workflowKey) { ${ENVIRONMENTS_FIELDS} }
1208
+ }
1209
+ `;
1210
+ CF_DEPLOY_WORKFLOW_VERSION_TO_DEV = `
1211
+ mutation FluidgridsCodeDeployWorkflowVersionToDev($workflowKey: String!, $version: String!) {
1212
+ deployWorkflowVersionToDev(workflowKey: $workflowKey, version: $version) {
1213
+ ${ENVIRONMENTS_FIELDS}
1214
+ }
1215
+ }
1216
+ `;
1217
+ CF_REQUEST_WORKFLOW_PROMOTION = `
1218
+ mutation FluidgridsCodeRequestWorkflowPromotion($input: RequestWorkflowPromotionInput!) {
1219
+ requestWorkflowPromotion(input: $input) { ${PROMOTION_FIELDS} }
1220
+ }
1221
+ `;
1222
+ CF_WORKFLOW_PROMOTION_REQUESTS = `
1223
+ query FluidgridsCodeWorkflowPromotionRequests(
1224
+ $workflowKey: String!
1225
+ $status: WorkflowPromotionStatus
1226
+ $limit: Int
1227
+ ) {
1228
+ workflowPromotionRequests(workflowKey: $workflowKey, status: $status, limit: $limit) {
1229
+ ${PROMOTION_FIELDS}
1230
+ }
1231
+ }
1232
+ `;
1233
+ });
1234
+
1190
1235
  // src/code-first/api.ts
1191
1236
  import { CliAuthError as CliAuthError3, CliUserError as CliUserError8 } from "@burdenoff/cli-sdk/core";
1192
1237
  function isParityStart(input) {
@@ -1572,6 +1617,22 @@ function createCodeFirstApi(ctx) {
1572
1617
  reason: reason ?? null
1573
1618
  });
1574
1619
  return data.setWorkflowRunVersioningOverride;
1620
+ },
1621
+ async workflowEnvironments(workflowKey) {
1622
+ const data = await request(CF_WORKFLOW_ENVIRONMENTS, { workflowKey });
1623
+ return data.workflowEnvironments;
1624
+ },
1625
+ async deployVersionToDev(workflowKey, version) {
1626
+ const data = await request(CF_DEPLOY_WORKFLOW_VERSION_TO_DEV, { workflowKey, version });
1627
+ return data.deployWorkflowVersionToDev;
1628
+ },
1629
+ async requestPromotion(workflowKey, toEnvironment, note) {
1630
+ const data = await request(CF_REQUEST_WORKFLOW_PROMOTION, { input: { workflowKey, toEnvironment, ...note !== undefined ? { note } : {} } });
1631
+ return data.requestWorkflowPromotion;
1632
+ },
1633
+ async promotionRequests(workflowKey, limit) {
1634
+ const data = await request(CF_WORKFLOW_PROMOTION_REQUESTS, { workflowKey, status: null, limit });
1635
+ return data.workflowPromotionRequests;
1575
1636
  }
1576
1637
  };
1577
1638
  }
@@ -1583,6 +1644,7 @@ var init_api = __esm(() => {
1583
1644
  init_durable_operations();
1584
1645
  init_parity_operations();
1585
1646
  init_test_suite_operations();
1647
+ init_environment_operations();
1586
1648
  PARITY_START_FIELDS = [
1587
1649
  "workflowId",
1588
1650
  "idReusePolicy",
@@ -7040,6 +7102,214 @@ var init_versions = __esm(() => {
7040
7102
  ENVIRONMENTS = ["PROD", "STAGING", "DEV"];
7041
7103
  });
7042
7104
 
7105
+ // src/code-first/commands/deploy.ts
7106
+ import { CliUserError as CliUserError36 } from "@burdenoff/cli-sdk/core";
7107
+ function parseEnvironment(raw) {
7108
+ const value = raw?.trim().toUpperCase();
7109
+ const match = ENVIRONMENTS2.find((environment) => environment === value);
7110
+ if (match === undefined) {
7111
+ throw new CliUserError36(raw === undefined ? "deploy needs --env dev, staging or prod." : `Invalid value '${raw}' for --env. Allowed: dev, staging, prod`);
7112
+ }
7113
+ return match;
7114
+ }
7115
+ function parseRamp(raw) {
7116
+ if (raw === undefined)
7117
+ return;
7118
+ const trimmed = raw.trim();
7119
+ if (!/^\d{1,3}$/.test(trimmed) || Number(trimmed) > 100) {
7120
+ throw new CliUserError36(`Invalid value '${raw}' for --ramp: expected 0 to 100.`);
7121
+ }
7122
+ return Number(trimmed);
7123
+ }
7124
+ function stateOf(view, environment) {
7125
+ return view.environments.find((state) => state.environment === environment);
7126
+ }
7127
+ function holds(state, version) {
7128
+ return state !== undefined && state.available && state.version === version;
7129
+ }
7130
+ function promotionRows(promotion) {
7131
+ return [
7132
+ ["Request", promotion.id],
7133
+ ["From", promotion.fromEnvironment],
7134
+ ["Status", promotion.status],
7135
+ ["Requested", promotion.requestedAt],
7136
+ ...promotion.reviewedAt ? [["Reviewed", promotion.reviewedAt]] : [],
7137
+ ...promotion.reviewNote ? [["Review note", promotion.reviewNote]] : []
7138
+ ];
7139
+ }
7140
+ function notice(env, options, level, message) {
7141
+ const { output } = env.ctx;
7142
+ if (output.getFormat(options) !== "table") {
7143
+ console.error(message);
7144
+ } else if (level === "warning") {
7145
+ output.printWarning(message);
7146
+ } else {
7147
+ output.printInfo(message);
7148
+ }
7149
+ }
7150
+ function report(env, options, result, details) {
7151
+ const rows = [
7152
+ ["Workflow", result.workflowKey],
7153
+ ["Environment", result.environment],
7154
+ ["Version", result.version],
7155
+ ["Result", result.action],
7156
+ ...result.promotion ? promotionRows(result.promotion) : [],
7157
+ ...result.rollout ? [
7158
+ ["Rollout", `${result.rollout.fromVersion} -> ${result.rollout.toVersion}`],
7159
+ ["Percent", `${result.rollout.percent}%`],
7160
+ ["Verified", `${result.rollout.verifiedPercent}%`]
7161
+ ] : []
7162
+ ];
7163
+ emit(env, options, result, { headers: ["Field", "Value"], rows }, details);
7164
+ return result;
7165
+ }
7166
+ async function runDeploy(env, workflowKey, options) {
7167
+ const environment = parseEnvironment(options.env);
7168
+ const ramp = parseRamp(options.ramp);
7169
+ if (ramp !== undefined && environment !== "PROD") {
7170
+ throw new CliUserError36("--ramp applies to --env prod only (rollouts split PROD starts).");
7171
+ }
7172
+ if (options.note !== undefined && environment === "DEV") {
7173
+ throw new CliUserError36("--note is for promotion requests (--env staging or prod).");
7174
+ }
7175
+ const timeoutMs = parsePositiveInt(options.timeout, "--timeout") ?? DEFAULT_DEPLOY_TIMEOUT_MS;
7176
+ const intervalMs = parsePositiveInt(options.pollInterval, "--poll-interval") ?? DEFAULT_DEPLOY_POLL_INTERVAL_MS;
7177
+ if (environment === "DEV")
7178
+ return deployToDev(env, workflowKey, options);
7179
+ return promote(env, workflowKey, environment, {
7180
+ ...options,
7181
+ ramp,
7182
+ timeoutMs,
7183
+ intervalMs
7184
+ });
7185
+ }
7186
+ async function deployToDev(env, workflowKey, options) {
7187
+ const wanted = options.wfVersion ?? "latest";
7188
+ const versions = await env.api.workflowVersions(workflowKey);
7189
+ const picked = pickVersion(versions, wanted);
7190
+ if (!picked) {
7191
+ throw new CliUserError36(versions.length === 0 ? `${workflowKey} has no stored version.` : `${workflowKey} has no version ${wanted}.`, versions.length === 0 ? { hint: "Push one first: fluidgrids push " + workflowKey } : { hint: `Stored: ${versions.map((version) => version.version).join(", ")}` });
7192
+ }
7193
+ const before = await env.api.workflowEnvironments(workflowKey);
7194
+ const base = { workflowKey, environment: "DEV", version: picked.version };
7195
+ const next = `Promote it with: fluidgrids deploy ${workflowKey} --env staging`;
7196
+ if (holds(stateOf(before, "DEV"), picked.version)) {
7197
+ return report(env, options, { ...base, action: "UNCHANGED", promotion: null, rollout: null }, [
7198
+ `DEV already runs ${picked.version} of ${workflowKey}; nothing changed.`,
7199
+ next
7200
+ ]);
7201
+ }
7202
+ await env.api.deployVersionToDev(workflowKey, picked.version);
7203
+ return report(env, options, { ...base, action: "DEPLOYED", promotion: null, rollout: null }, [
7204
+ `${picked.version} of ${workflowKey} is deployed to DEV.`,
7205
+ next
7206
+ ]);
7207
+ }
7208
+ async function promote(env, workflowKey, target, options) {
7209
+ const sourceName = PROMOTION_SOURCE[target];
7210
+ const view = await env.api.workflowEnvironments(workflowKey);
7211
+ const source = stateOf(view, sourceName);
7212
+ if (!source?.version) {
7213
+ throw new CliUserError36(`Nothing is deployed to ${sourceName} for ${workflowKey}.`, {
7214
+ hint: `Deploy there first: fluidgrids deploy ${workflowKey} --env ${sourceName.toLowerCase()}${sourceName === "DEV" ? " --wf-version <version>" : ""}`
7215
+ });
7216
+ }
7217
+ if (!source.available) {
7218
+ throw new CliUserError36(`${sourceName} holds ${source.version} of ${workflowKey}, which has since been deleted.`, { hint: `Deploy another version to ${sourceName} first.` });
7219
+ }
7220
+ if (options.wfVersion !== undefined && options.wfVersion !== source.version) {
7221
+ throw new CliUserError36(`${sourceName} holds ${source.version} of ${workflowKey}, not ${options.wfVersion}; ${target} is promoted from ${sourceName}.`, {
7222
+ hint: `Deploy ${options.wfVersion} to ${sourceName} first: fluidgrids deploy ${workflowKey} --env ${sourceName.toLowerCase()} --wf-version ${options.wfVersion}`
7223
+ });
7224
+ }
7225
+ const version = source.version;
7226
+ const base = { workflowKey, environment: target, version };
7227
+ if (holds(stateOf(view, target), version)) {
7228
+ return report(env, options, { ...base, action: "UNCHANGED", promotion: null, rollout: null }, [
7229
+ `${target} already runs ${version} of ${workflowKey}; nothing changed.`
7230
+ ]);
7231
+ }
7232
+ if (options.ramp !== undefined && options.ramp < 100) {
7233
+ if (view.policy.lockDirectActivation) {
7234
+ throw new CliUserError36(`The workspace locks PROD to approved promotions, so ${workflowKey} cannot be ramped.`, { hint: `Promote it in full instead: fluidgrids deploy ${workflowKey} --env prod` });
7235
+ }
7236
+ const rollout = await env.api.setWorkflowRollout(workflowKey, {
7237
+ toVersion: version,
7238
+ percent: options.ramp,
7239
+ environment: "PROD"
7240
+ });
7241
+ const check = rollout.activationCheck;
7242
+ return report(env, options, { ...base, action: "RAMPED", promotion: null, rollout }, [
7243
+ `${rollout.percent}% of new automatic starts of ${workflowKey} run ${version}; the rest run ${rollout.fromVersion}.`,
7244
+ ...check && check.status !== "REPLACED" && check.status !== "REJECTED" ? [
7245
+ `Open auto-upgrade runs move only after replay check ${check.id} (${check.status}) passes.`
7246
+ ] : [],
7247
+ `Finish with: fluidgrids deploy ${workflowKey} --env prod --ramp 100`
7248
+ ]);
7249
+ }
7250
+ const pending = view.pendingPromotions.find((request) => request.toEnvironment === target);
7251
+ if (pending && pending.version !== version) {
7252
+ throw new CliUserError36(`A promotion of ${pending.version} to ${target} (request ${pending.id}) is already waiting for an approver.`, { hint: "An approver decides it, or its requester cancels it, before another can be made." });
7253
+ }
7254
+ if (pending && options.note !== undefined) {
7255
+ notice(env, options, "warning", `Request ${pending.id} for ${version} is already open; --note was not added to it.`);
7256
+ }
7257
+ let promotion = pending ?? await env.api.requestPromotion(workflowKey, target, options.note);
7258
+ if (promotion.status === "PENDING" && options.wait !== false) {
7259
+ notice(env, options, "info", `Promotion ${promotion.id} of ${version} to ${target} waits for an approver (Environments panel of the workflow).`);
7260
+ promotion = await waitForPromotion(env, promotion, options);
7261
+ }
7262
+ return finish(env, options, base, promotion);
7263
+ }
7264
+ function finish(env, options, base, promotion) {
7265
+ const { workflowKey, environment, version } = base;
7266
+ switch (promotion.status) {
7267
+ case "APPLIED":
7268
+ return report(env, options, { ...base, action: "APPLIED", promotion, rollout: null }, [
7269
+ `${version} of ${workflowKey} is deployed to ${environment}${promotion.autoApplied ? " (no approval was required)" : ""}.`,
7270
+ ...environment === "PROD" ? [] : [`Next: fluidgrids deploy ${workflowKey} --env prod`]
7271
+ ]);
7272
+ case "PENDING":
7273
+ return report(env, options, { ...base, action: "PENDING", promotion, rollout: null }, [
7274
+ `Promotion ${promotion.id} waits for an approver. Run the same command to wait for it.`
7275
+ ]);
7276
+ case "REJECTED":
7277
+ case "CANCELED":
7278
+ throw new CliUserError36(`The promotion of ${version} of ${workflowKey} to ${environment} was ${promotion.status === "REJECTED" ? "rejected" : "canceled"}${promotion.reviewNote ? `: ${promotion.reviewNote}` : "."}`, { hint: `Request ${promotion.id}; ${environment} is unchanged.` });
7279
+ }
7280
+ }
7281
+ async function waitForPromotion(env, promotion, options) {
7282
+ const deadline = Date.now() + options.timeoutMs;
7283
+ let slept = 0;
7284
+ let current = promotion;
7285
+ while (current.status === "PENDING") {
7286
+ if (slept >= options.timeoutMs || Date.now() >= deadline) {
7287
+ throw new CliUserError36(`Promotion ${current.id} of ${current.version} to ${current.toEnvironment} still waits for an approver after ${Math.round(options.timeoutMs / 1000)} s.`, {
7288
+ hint: "The request stays open; run the same command again to keep waiting, or pass --no-wait."
7289
+ });
7290
+ }
7291
+ await env.sleep(options.intervalMs);
7292
+ slept += options.intervalMs;
7293
+ const history = await env.api.promotionRequests(current.workflowKey, PROMOTION_HISTORY_LIMIT);
7294
+ const found = history.find((request) => request.id === current.id);
7295
+ if (!found) {
7296
+ throw new CliUserError36(`Promotion ${current.id} is no longer in the promotion history of ${current.workflowKey}.`);
7297
+ }
7298
+ current = found;
7299
+ }
7300
+ return current;
7301
+ }
7302
+ var DEFAULT_DEPLOY_TIMEOUT_MS = 900000, DEFAULT_DEPLOY_POLL_INTERVAL_MS = 5000, PROMOTION_HISTORY_LIMIT = 200, ENVIRONMENTS2, PROMOTION_SOURCE;
7303
+ var init_deploy = __esm(() => {
7304
+ init_remote();
7305
+ init_shared();
7306
+ ENVIRONMENTS2 = ["DEV", "STAGING", "PROD"];
7307
+ PROMOTION_SOURCE = {
7308
+ STAGING: "DEV",
7309
+ PROD: "STAGING"
7310
+ };
7311
+ });
7312
+
7043
7313
  // src/phase-c/operations.ts
7044
7314
  function hierarchyChildren(depth) {
7045
7315
  if (depth === 0)
@@ -7544,7 +7814,7 @@ var init_operations3 = __esm(() => {
7544
7814
  });
7545
7815
 
7546
7816
  // src/phase-c/api.ts
7547
- import { CliAuthError as CliAuthError6, CliUserError as CliUserError37 } from "@burdenoff/cli-sdk/core";
7817
+ import { CliAuthError as CliAuthError6, CliUserError as CliUserError38 } from "@burdenoff/cli-sdk/core";
7548
7818
  function runVariables(run) {
7549
7819
  return run.runId !== undefined ? { runId: run.runId } : { target: run.target };
7550
7820
  }
@@ -7564,7 +7834,7 @@ function createPhaseCApi(ctx) {
7564
7834
  function context() {
7565
7835
  const workspaceId = ctx.auth.read()?.workspaceId;
7566
7836
  if (!workspaceId) {
7567
- throw new CliUserError37("No workspace is selected.", {
7837
+ throw new CliUserError38("No workspace is selected.", {
7568
7838
  hint: `Run \`${ctx.productName} workspace set <id>\` or set FLUIDGRIDS_WORKSPACE_ID.`
7569
7839
  });
7570
7840
  }
@@ -7697,7 +7967,7 @@ function createPhaseCApi(ctx) {
7697
7967
  });
7698
7968
  const found = data.workflowRunByWorkflowId;
7699
7969
  if (!found) {
7700
- throw new CliUserError37(`No run with workflow id ${run.target.workflowId} of ${run.target.workflowKey} (NOT_FOUND)`);
7970
+ throw new CliUserError38(`No run with workflow id ${run.target.workflowId} of ${run.target.workflowKey} (NOT_FOUND)`);
7701
7971
  }
7702
7972
  return found.id;
7703
7973
  },
@@ -7832,7 +8102,7 @@ function createPhaseCApi(ctx) {
7832
8102
  if (!pagination?.hasMore || jobs.length === 0)
7833
8103
  return all;
7834
8104
  }
7835
- throw new CliUserError37(`The schedule listing did not end after ${MAX_SCHEDULE_PAGES} pages; refusing to continue.`);
8105
+ throw new CliUserError38(`The schedule listing did not end after ${MAX_SCHEDULE_PAGES} pages; refusing to continue.`);
7836
8106
  },
7837
8107
  async describeSchedule(workflowKey, triggerNodeId) {
7838
8108
  const data = await request(PC_SCHEDULE_DESCRIBE, { workflowKey, triggerNodeId }, P);
@@ -7866,17 +8136,17 @@ var init_api3 = __esm(() => {
7866
8136
  });
7867
8137
 
7868
8138
  // src/phase-c/commands/queues.ts
7869
- import { CliUserError as CliUserError38 } from "@burdenoff/cli-sdk/core";
7870
- function parseEnvironment(raw) {
7871
- return parseEnumOption(raw, "--environment", ENVIRONMENTS2);
8139
+ import { CliUserError as CliUserError39 } from "@burdenoff/cli-sdk/core";
8140
+ function parseEnvironment2(raw) {
8141
+ return parseEnumOption(raw, "--environment", ENVIRONMENTS3);
7872
8142
  }
7873
8143
  function checkQueueName(name) {
7874
8144
  const value = name.trim();
7875
8145
  if (value === "managed") {
7876
- throw new CliUserError38("`managed` is the platform queue; it cannot be created or changed.");
8146
+ throw new CliUserError39("`managed` is the platform queue; it cannot be created or changed.");
7877
8147
  }
7878
8148
  if (!QUEUE_NAME.test(value)) {
7879
- throw new CliUserError38(`Invalid queue name '${name}': lower-case letters, digits and dashes, at most 63, starting with a letter or digit.`);
8149
+ throw new CliUserError39(`Invalid queue name '${name}': lower-case letters, digits and dashes, at most 63, starting with a letter or digit.`);
7880
8150
  }
7881
8151
  return value;
7882
8152
  }
@@ -7887,13 +8157,13 @@ function checkWorkerQueue(raw) {
7887
8157
  return checkQueueName(value);
7888
8158
  const name = checkQueueName(value.slice(0, at));
7889
8159
  const environment = value.slice(at + 1).toLowerCase();
7890
- if (!ENVIRONMENTS2.some((allowed) => allowed.toLowerCase() === environment)) {
7891
- throw new CliUserError38(`Invalid queue '${raw}': the environment after @ must be dev, staging or prod.`);
8160
+ if (!ENVIRONMENTS3.some((allowed) => allowed.toLowerCase() === environment)) {
8161
+ throw new CliUserError39(`Invalid queue '${raw}': the environment after @ must be dev, staging or prod.`);
7892
8162
  }
7893
8163
  return `${name}@${environment}`;
7894
8164
  }
7895
8165
  function bindWorkerQueues(queues, raw) {
7896
- const environment = parseEnvironment(raw)?.toLowerCase();
8166
+ const environment = parseEnvironment2(raw)?.toLowerCase();
7897
8167
  if (environment === undefined)
7898
8168
  return [...new Set(queues)];
7899
8169
  const out = queues.map((queue) => {
@@ -7901,7 +8171,7 @@ function bindWorkerQueues(queues, raw) {
7901
8171
  if (at < 0)
7902
8172
  return `${queue}@${environment}`;
7903
8173
  if (queue.slice(at + 1) !== environment) {
7904
- throw new CliUserError38(`Queue '${queue}' is bound to ${queue.slice(at + 1)}, but --environment is ${environment}.`);
8174
+ throw new CliUserError39(`Queue '${queue}' is bound to ${queue.slice(at + 1)}, but --environment is ${environment}.`);
7905
8175
  }
7906
8176
  return queue;
7907
8177
  });
@@ -7917,11 +8187,11 @@ async function findQueue(env, name, environment) {
7917
8187
  if (found)
7918
8188
  return found;
7919
8189
  if (environment === undefined && rows.length > 0) {
7920
- throw new CliUserError38(`Queue ${name} has only environment-scoped rows.`, {
8190
+ throw new CliUserError39(`Queue ${name} has only environment-scoped rows.`, {
7921
8191
  hint: `Pass --environment (one of ${rows.map((queue) => queue.environment ?? "-").join(", ")}).`
7922
8192
  });
7923
8193
  }
7924
- throw new CliUserError38(`The workspace has no task queue ${environment ? `${name}@${environment}` : name}.`, { hint: "List them with `fluidgrids queues list`." });
8194
+ throw new CliUserError39(`The workspace has no task queue ${environment ? `${name}@${environment}` : name}.`, { hint: "List them with `fluidgrids queues list`." });
7925
8195
  }
7926
8196
  async function runQueuesList(env, options) {
7927
8197
  const queues = await env.pc.taskQueues();
@@ -7939,7 +8209,7 @@ async function runQueuesList(env, options) {
7939
8209
  return queues;
7940
8210
  }
7941
8211
  async function runQueuesDescribe(env, name, options) {
7942
- const environment = parseEnvironment(options.environment);
8212
+ const environment = parseEnvironment2(options.environment);
7943
8213
  const stats = await env.pc.taskQueueStats(name, environment);
7944
8214
  const workers = name === "managed" ? [] : await env.pc.taskQueueWorkers(name);
7945
8215
  const result = { stats, workers };
@@ -7962,7 +8232,7 @@ async function runQueuesDescribe(env, name, options) {
7962
8232
  return result;
7963
8233
  }
7964
8234
  async function runQueuesCreate(env, name, options) {
7965
- const environment = parseEnvironment(options.environment);
8235
+ const environment = parseEnvironment2(options.environment);
7966
8236
  const maxTasksPerSecond = parseNumberOption(options.maxTasksPerSecond, "--max-tasks-per-second");
7967
8237
  const timeout = parseNonNegativeInt(options.workerUnavailableTimeout, "--worker-unavailable-timeout");
7968
8238
  const queue = await env.pc.createTaskQueue({
@@ -7979,10 +8249,10 @@ async function runQueuesCreate(env, name, options) {
7979
8249
  return queue;
7980
8250
  }
7981
8251
  async function runQueuesUpdate(env, name, options) {
7982
- const environment = parseEnvironment(options.environment);
8252
+ const environment = parseEnvironment2(options.environment);
7983
8253
  const maxTasksPerSecond = parseNumberOption(options.maxTasksPerSecond, "--max-tasks-per-second");
7984
8254
  if (maxTasksPerSecond !== undefined && options.clearMaxTasksPerSecond) {
7985
- throw new CliUserError38("Give --max-tasks-per-second or --clear-max-tasks-per-second, not both.");
8255
+ throw new CliUserError39("Give --max-tasks-per-second or --clear-max-tasks-per-second, not both.");
7986
8256
  }
7987
8257
  const timeout = parseNonNegativeInt(options.workerUnavailableTimeout, "--worker-unavailable-timeout");
7988
8258
  const input = {
@@ -7992,7 +8262,7 @@ async function runQueuesUpdate(env, name, options) {
7992
8262
  ...timeout !== undefined ? { workerUnavailableTimeoutSeconds: timeout } : {}
7993
8263
  };
7994
8264
  if (Object.keys(input).length === 0) {
7995
- throw new CliUserError38("Nothing to change.", {
8265
+ throw new CliUserError39("Nothing to change.", {
7996
8266
  hint: "Give --description, --max-tasks-per-second, --clear-max-tasks-per-second or --worker-unavailable-timeout."
7997
8267
  });
7998
8268
  }
@@ -8012,7 +8282,7 @@ async function runQueuesUpdate(env, name, options) {
8012
8282
  return updated;
8013
8283
  }
8014
8284
  async function runQueuesDelete(env, name, options) {
8015
- const environment = parseEnvironment(options.environment);
8285
+ const environment = parseEnvironment2(options.environment);
8016
8286
  const queue = await findQueue(env, checkQueueName(name), environment);
8017
8287
  await requireConfirmation(env, `Delete task queue ${queueLabel(queue)}?`, options.force);
8018
8288
  const deleted = await env.pc.deleteTaskQueue(queue.id);
@@ -8050,11 +8320,11 @@ async function runQueuesBuilds(env, name, options) {
8050
8320
  }, rows.length === 0 ? [`No worker serving ${name} reported a build id.`] : []);
8051
8321
  return rows;
8052
8322
  }
8053
- var ENVIRONMENTS2, QUEUE_NAME;
8323
+ var ENVIRONMENTS3, QUEUE_NAME;
8054
8324
  var init_queues = __esm(() => {
8055
8325
  init_shared();
8056
8326
  init_shared3();
8057
- ENVIRONMENTS2 = ["DEV", "STAGING", "PROD"];
8327
+ ENVIRONMENTS3 = ["DEV", "STAGING", "PROD"];
8058
8328
  QUEUE_NAME = /^[a-z0-9][a-z0-9-]{0,62}$/;
8059
8329
  });
8060
8330
 
@@ -8071,7 +8341,7 @@ import { existsSync as existsSync13 } from "fs";
8071
8341
  import { hostname } from "os";
8072
8342
  import { extname as extname3, isAbsolute as isAbsolute3, join as join11, resolve as resolve11 } from "path";
8073
8343
  import { pathToFileURL as pathToFileURL2 } from "url";
8074
- import { CliUserError as CliUserError39 } from "@burdenoff/cli-sdk/core";
8344
+ import { CliUserError as CliUserError40 } from "@burdenoff/cli-sdk/core";
8075
8345
  function isRecord18(value) {
8076
8346
  return typeof value === "object" && value !== null && !Array.isArray(value);
8077
8347
  }
@@ -8082,11 +8352,11 @@ function bridgeUrlFor(env, explicit, issued) {
8082
8352
  try {
8083
8353
  url = new URL(raw);
8084
8354
  } catch {
8085
- throw new CliUserError39(`Invalid bridge URL '${raw}'.`);
8355
+ throw new CliUserError40(`Invalid bridge URL '${raw}'.`);
8086
8356
  }
8087
8357
  const local = url.hostname === "localhost" || url.hostname === "127.0.0.1";
8088
8358
  if (url.protocol !== "wss:" && !(url.protocol === "ws:" && local)) {
8089
- throw new CliUserError39(`The bridge URL must be wss:// (ws:// only to this machine): ${raw}`);
8359
+ throw new CliUserError40(`The bridge URL must be wss:// (ws:// only to this machine): ${raw}`);
8090
8360
  }
8091
8361
  return url.toString();
8092
8362
  }
@@ -8102,18 +8372,18 @@ function bridgeHeaders(env) {
8102
8372
  const id = env.getEnv("FLUIDGRIDS_CF_ACCESS_CLIENT_ID")?.trim();
8103
8373
  const secret = env.getEnv("FLUIDGRIDS_CF_ACCESS_CLIENT_SECRET")?.trim();
8104
8374
  if ((id === undefined || id === "") !== (secret === undefined || secret === "")) {
8105
- throw new CliUserError39("Set both FLUIDGRIDS_CF_ACCESS_CLIENT_ID and FLUIDGRIDS_CF_ACCESS_CLIENT_SECRET, or neither.");
8375
+ throw new CliUserError40("Set both FLUIDGRIDS_CF_ACCESS_CLIENT_ID and FLUIDGRIDS_CF_ACCESS_CLIENT_SECRET, or neither.");
8106
8376
  }
8107
8377
  return id && secret ? { "CF-Access-Client-Id": id, "CF-Access-Client-Secret": secret } : {};
8108
8378
  }
8109
8379
  function workerToken(env, tokenEnv) {
8110
8380
  const variable = tokenEnv?.trim() || WORKER_TOKEN_ENV;
8111
8381
  if (!ENV_NAME2.test(variable)) {
8112
- throw new CliUserError39("Invalid environment variable name for --token-env.");
8382
+ throw new CliUserError40("Invalid environment variable name for --token-env.");
8113
8383
  }
8114
8384
  const token = env.getEnv(variable)?.trim() ?? "";
8115
8385
  if (!WORKER_TOKEN.test(token)) {
8116
- throw new CliUserError39(`${variable} must hold a worker token (fgr_ and 43 characters).`, {
8386
+ throw new CliUserError40(`${variable} must hold a worker token (fgr_ and 43 characters).`, {
8117
8387
  hint: "Issue one with `fluidgrids workers tokens create <name> --queue <queue>`."
8118
8388
  });
8119
8389
  }
@@ -8126,7 +8396,7 @@ async function buildWorkerBundle(project) {
8126
8396
  explainUnresolved: (names) => [...names]
8127
8397
  });
8128
8398
  if (!lowered.workflows.some((workflow) => workflow.durable)) {
8129
- throw new CliUserError39("The project defines no durable functions for a worker to serve.");
8399
+ throw new CliUserError40("The project defines no durable functions for a worker to serve.");
8130
8400
  }
8131
8401
  await prepareProjectBundle(project, lowered);
8132
8402
  return bundlePathOf(project);
@@ -8140,23 +8410,23 @@ function activitiesFor(project, raw) {
8140
8410
  return;
8141
8411
  const value = raw.trim();
8142
8412
  if (value === "")
8143
- throw new CliUserError39("--activities cannot be empty.");
8413
+ throw new CliUserError40("--activities cannot be empty.");
8144
8414
  if (project.config.language === "py") {
8145
8415
  if (!/^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/.test(value)) {
8146
- throw new CliUserError39(`--activities for a Python project is a module name importable from the project (for example activities), not '${raw}'.`);
8416
+ throw new CliUserError40(`--activities for a Python project is a module name importable from the project (for example activities), not '${raw}'.`);
8147
8417
  }
8148
8418
  return value;
8149
8419
  }
8150
8420
  const path = isAbsolute3(value) ? value : resolve11(project.root, value);
8151
8421
  if (!existsSync13(path))
8152
- throw new CliUserError39(`--activities: ${raw} not found.`);
8422
+ throw new CliUserError40(`--activities: ${raw} not found.`);
8153
8423
  return path;
8154
8424
  }
8155
8425
  function launchOf(settings) {
8156
8426
  const { project, options } = settings;
8157
8427
  const activities = activitiesFor(project, options.activities);
8158
8428
  if (!settings.bundlePath && !activities) {
8159
- throw new CliUserError39("The worker would serve nothing: give workflows, --activities or both.");
8429
+ throw new CliUserError40("The worker would serve nothing: give workflows, --activities or both.");
8160
8430
  }
8161
8431
  const maxActivities = parsePositiveInt(options.maxConcurrentActivities, "--max-concurrent-activities");
8162
8432
  const maxWorkflowTasks = parsePositiveInt(options.maxConcurrentWorkflowTasks, "--max-concurrent-workflow-tasks");
@@ -8189,7 +8459,7 @@ async function workflowBundle(project, options, build) {
8189
8459
  if (!existsSync13(path)) {
8190
8460
  if (options.activities !== undefined)
8191
8461
  return;
8192
- throw new CliUserError39(`No workflow bundle at ${path}.`, {
8462
+ throw new CliUserError40(`No workflow bundle at ${path}.`, {
8193
8463
  hint: "Run `fluidgrids push` first, or pass --build to build it now (or --no-workflows)."
8194
8464
  });
8195
8465
  }
@@ -8198,7 +8468,7 @@ async function workflowBundle(project, options, build) {
8198
8468
  async function runWorkerRun(env, options) {
8199
8469
  const queues = bindWorkerQueues(parseList(options.queue).map(checkWorkerQueue), options.environment);
8200
8470
  if (queues.length === 0)
8201
- throw new CliUserError39("Name the task queue(s) to serve with --queue.");
8471
+ throw new CliUserError40("Name the task queue(s) to serve with --queue.");
8202
8472
  const project = loadProject(options.project, env.cwd());
8203
8473
  const token = workerToken(env, options.tokenEnv);
8204
8474
  const launch = launchOf({
@@ -8221,7 +8491,7 @@ function devQueueName() {
8221
8491
  async function runDev(env, options) {
8222
8492
  const project = loadProject(options.project, env.cwd());
8223
8493
  if (options.lang !== undefined && options.lang !== project.config.language) {
8224
- throw new CliUserError39(`--lang ${options.lang} does not match the project language (${project.config.language}).`, { hint: "Run `fluidgrids dev` in a project of that language (`fluidgrids init --lang …`)." });
8494
+ throw new CliUserError40(`--lang ${options.lang} does not match the project language (${project.config.language}).`, { hint: "Run `fluidgrids dev` in a project of that language (`fluidgrids init --lang …`)." });
8225
8495
  }
8226
8496
  const bundlePath = await workflowBundle(project, options, options.workflows !== false);
8227
8497
  const queueName = devQueueName();
@@ -8324,7 +8594,7 @@ async function loadTypeScriptActivities(root, path) {
8324
8594
  }
8325
8595
  }
8326
8596
  if (found.length === 0) {
8327
- throw new CliUserError39(`${path} exports no activity implementations.`, {
8597
+ throw new CliUserError40(`${path} exports no activity implementations.`, {
8328
8598
  hint: "Export `implementActivity(...)` or `defineActivity(...)` values from it."
8329
8599
  });
8330
8600
  }
@@ -8350,21 +8620,21 @@ async function runTypeScriptWorker(launch) {
8350
8620
  }
8351
8621
  function pythonWorkerExitError(python, code, signal) {
8352
8622
  if (signal)
8353
- return new CliUserError39(`The Python worker was stopped by ${signal}.`);
8623
+ return new CliUserError40(`The Python worker was stopped by ${signal}.`);
8354
8624
  const status = String(code);
8355
8625
  switch (code) {
8356
8626
  case PYTHON_EXIT_NO_WORKER:
8357
- return new CliUserError39(`The Python worker could not import fluidgrids_workflows.worker (status ${status}).`, {
8627
+ return new CliUserError40(`The Python worker could not import fluidgrids_workflows.worker (status ${status}).`, {
8358
8628
  hint: `Install the worker extra: \`${python} -m pip install 'fluidgrids-workflows[worker]'\`.`
8359
8629
  });
8360
8630
  case PYTHON_EXIT_NO_ACTIVITIES:
8361
- return new CliUserError39(`The Python worker exited with status ${status}: the activities module defines no activities.`, {
8631
+ return new CliUserError40(`The Python worker exited with status ${status}: the activities module defines no activities.`, {
8362
8632
  hint: "Decorate the activities with @define_activity in the module --activities names, or pass the module that defines them."
8363
8633
  });
8364
8634
  case PYTHON_EXIT_BRIDGE_CLOSED:
8365
- return new CliUserError39(`The Python worker exited with status ${status}: the worker bridge closed the connection (the close code and its meaning are above).`);
8635
+ return new CliUserError40(`The Python worker exited with status ${status}: the worker bridge closed the connection (the close code and its meaning are above).`);
8366
8636
  default:
8367
- return new CliUserError39(`The Python worker exited with status ${status}.`);
8637
+ return new CliUserError40(`The Python worker exited with status ${status}.`);
8368
8638
  }
8369
8639
  }
8370
8640
  function pythonWorkerSpec(launch) {
@@ -8408,7 +8678,7 @@ function runPythonWorker(launch) {
8408
8678
  };
8409
8679
  child.on("error", (error) => {
8410
8680
  done();
8411
- reject(error.code === "ENOENT" ? new CliUserError39(`Python interpreter "${python}" was not found.`) : new CliUserError39(`Could not start ${python}: ${error.message}`));
8681
+ reject(error.code === "ENOENT" ? new CliUserError40(`Python interpreter "${python}" was not found.`) : new CliUserError40(`Could not start ${python}: ${error.message}`));
8412
8682
  });
8413
8683
  child.on("close", (code, signal) => {
8414
8684
  done();
@@ -8491,7 +8761,7 @@ except BridgeClosedError as error:
8491
8761
 
8492
8762
  // src/phase-c/shared.ts
8493
8763
  import { createInterface as createInterface3 } from "readline/promises";
8494
- import { CliUserError as CliUserError40 } from "@burdenoff/cli-sdk/core";
8764
+ import { CliUserError as CliUserError41 } from "@burdenoff/cli-sdk/core";
8495
8765
  async function confirmOnTerminal(question) {
8496
8766
  const rl = createInterface3({ input: process.stdin, output: process.stderr });
8497
8767
  try {
@@ -8513,32 +8783,32 @@ async function requireConfirmation(env, question, force) {
8513
8783
  if (force)
8514
8784
  return;
8515
8785
  if (!env.interactive()) {
8516
- throw new CliUserError40(`${question} needs confirmation.`, {
8786
+ throw new CliUserError41(`${question} needs confirmation.`, {
8517
8787
  hint: "Pass --force to go ahead without a prompt."
8518
8788
  });
8519
8789
  }
8520
8790
  if (!await env.confirm(question))
8521
- throw new CliUserError40("Aborted: nothing was changed.");
8791
+ throw new CliUserError41("Aborted: nothing was changed.");
8522
8792
  }
8523
8793
  function runSelectorOf(runId, flags) {
8524
8794
  const targeted = flags.workflowId !== undefined || flags.key !== undefined || flags.firstRunId !== undefined;
8525
8795
  if (!targeted) {
8526
8796
  if (runId === undefined || runId.trim() === "") {
8527
- throw new CliUserError40("Give a run id, or --workflow-id with --key.");
8797
+ throw new CliUserError41("Give a run id, or --workflow-id with --key.");
8528
8798
  }
8529
8799
  return { runId: runId.trim() };
8530
8800
  }
8531
8801
  if (runId !== undefined) {
8532
- throw new CliUserError40("Give a run id or --workflow-id with --key, not both.");
8802
+ throw new CliUserError41("Give a run id or --workflow-id with --key, not both.");
8533
8803
  }
8534
8804
  const workflowId = flags.workflowId?.trim() ?? "";
8535
8805
  const key = flags.key?.trim() ?? "";
8536
8806
  if (workflowId === "" || key === "") {
8537
- throw new CliUserError40("--workflow-id and --key go together (the workflow id of that key).");
8807
+ throw new CliUserError41("--workflow-id and --key go together (the workflow id of that key).");
8538
8808
  }
8539
8809
  const firstRunId = flags.firstRunId?.trim();
8540
8810
  if (flags.firstRunId !== undefined && !firstRunId) {
8541
- throw new CliUserError40("--first-run-id cannot be empty.");
8811
+ throw new CliUserError41("--first-run-id cannot be empty.");
8542
8812
  }
8543
8813
  return {
8544
8814
  target: { workflowKey: key, workflowId, ...firstRunId ? { firstRunId } : {} }
@@ -8554,7 +8824,7 @@ function parseEnumOption(raw, flag, allowed) {
8554
8824
  const match = allowed.find((value) => value === normal);
8555
8825
  if (match === undefined) {
8556
8826
  const shown = allowed.map((value) => value.toLowerCase().replace(/_/g, "-"));
8557
- throw new CliUserError40(`Invalid value '${raw}' for ${flag}. Allowed: ${shown.join(", ")}`);
8827
+ throw new CliUserError41(`Invalid value '${raw}' for ${flag}. Allowed: ${shown.join(", ")}`);
8558
8828
  }
8559
8829
  return match;
8560
8830
  }
@@ -8563,7 +8833,7 @@ function parseNonNegativeInt(raw, flag) {
8563
8833
  return;
8564
8834
  const value = raw.trim();
8565
8835
  if (!/^\d+$/.test(value) || !Number.isSafeInteger(Number(value))) {
8566
- throw new CliUserError40(`Invalid value '${raw}' for ${flag}: expected a whole number.`);
8836
+ throw new CliUserError41(`Invalid value '${raw}' for ${flag}: expected a whole number.`);
8567
8837
  }
8568
8838
  return Number(value);
8569
8839
  }
@@ -8572,14 +8842,14 @@ function parseNumberOption(raw, flag) {
8572
8842
  return;
8573
8843
  const value = Number(raw.trim());
8574
8844
  if (raw.trim() === "" || !Number.isFinite(value)) {
8575
- throw new CliUserError40(`Invalid value '${raw}' for ${flag}: expected a number.`);
8845
+ throw new CliUserError41(`Invalid value '${raw}' for ${flag}: expected a number.`);
8576
8846
  }
8577
8847
  return value;
8578
8848
  }
8579
8849
  function requireText(raw, flag) {
8580
8850
  const value = raw?.trim() ?? "";
8581
8851
  if (value === "")
8582
- throw new CliUserError40(`${flag} is required.`);
8852
+ throw new CliUserError41(`${flag} is required.`);
8583
8853
  return value;
8584
8854
  }
8585
8855
  function parseList(raw) {
@@ -8609,7 +8879,7 @@ function parseInstant(raw, flag) {
8609
8879
  const value = raw.trim();
8610
8880
  const ms = Date.parse(value);
8611
8881
  if (value === "" || !Number.isFinite(ms) || !/^\d{4}-\d{2}-\d{2}/.test(value)) {
8612
- throw new CliUserError40(`Invalid value '${raw}' for ${flag}: expected an ISO-8601 date and time such as 2026-10-01T00:00:00Z.`);
8882
+ throw new CliUserError41(`Invalid value '${raw}' for ${flag}: expected an ISO-8601 date and time such as 2026-10-01T00:00:00Z.`);
8613
8883
  }
8614
8884
  return new Date(ms).toISOString();
8615
8885
  }
@@ -8618,7 +8888,7 @@ var init_shared3 = __esm(() => {
8618
8888
  });
8619
8889
 
8620
8890
  // src/config/commands.ts
8621
- import { CliUserError as CliUserError41 } from "@burdenoff/cli-sdk/core";
8891
+ import { CliUserError as CliUserError42 } from "@burdenoff/cli-sdk/core";
8622
8892
  function output(env, options, data, rows, headers) {
8623
8893
  env.ctx.output.formatAndOutput(options, data, { headers, rows });
8624
8894
  }
@@ -8634,7 +8904,7 @@ function isLocal(url) {
8634
8904
  function checkProfileValue(key, value, profile) {
8635
8905
  const trimmed = value.trim();
8636
8906
  if (trimmed === "" || trimmed.length > 2048) {
8637
- throw new CliUserError41(`${key} must be 1 to 2048 characters.`);
8907
+ throw new CliUserError42(`${key} must be 1 to 2048 characters.`);
8638
8908
  }
8639
8909
  switch (key) {
8640
8910
  case "apiUrl":
@@ -8643,20 +8913,20 @@ function checkProfileValue(key, value, profile) {
8643
8913
  try {
8644
8914
  url = new URL(trimmed);
8645
8915
  } catch {
8646
- throw new CliUserError41(`${key} must be a URL.`);
8916
+ throw new CliUserError42(`${key} must be a URL.`);
8647
8917
  }
8648
8918
  if (url.protocol !== "https:" && !(url.protocol === "http:" && isLocal(url))) {
8649
- throw new CliUserError41(`${key} must use https (http only for localhost).`);
8919
+ throw new CliUserError42(`${key} must use https (http only for localhost).`);
8650
8920
  }
8651
8921
  if (url.username || url.password) {
8652
- throw new CliUserError41(`${key} must not carry credentials.`);
8922
+ throw new CliUserError42(`${key} must not carry credentials.`);
8653
8923
  }
8654
8924
  return trimmed;
8655
8925
  }
8656
8926
  case "environment": {
8657
8927
  const upper = trimmed.toUpperCase();
8658
- if (!ENVIRONMENTS3.includes(upper)) {
8659
- throw new CliUserError41(`environment must be one of ${ENVIRONMENTS3.join(", ")}.`);
8928
+ if (!ENVIRONMENTS4.includes(upper)) {
8929
+ throw new CliUserError42(`environment must be one of ${ENVIRONMENTS4.join(", ")}.`);
8660
8930
  }
8661
8931
  return upper;
8662
8932
  }
@@ -8670,15 +8940,15 @@ function checkProfileValue(key, value, profile) {
8670
8940
  async function readToken(env, fromEnv) {
8671
8941
  if (fromEnv !== undefined) {
8672
8942
  if (!ENV_NAME3.test(fromEnv))
8673
- throw new CliUserError41("Invalid environment variable name for --from-env.");
8943
+ throw new CliUserError42("Invalid environment variable name for --from-env.");
8674
8944
  const value = env.env[fromEnv]?.trim() ?? "";
8675
8945
  if (value === "")
8676
- throw new CliUserError41(`The environment variable ${fromEnv} is empty or unset.`);
8946
+ throw new CliUserError42(`The environment variable ${fromEnv} is empty or unset.`);
8677
8947
  return value;
8678
8948
  }
8679
8949
  const piped = (await env.readStdin()).trim();
8680
8950
  if (piped === "") {
8681
- throw new CliUserError41("Pipe the token on standard input, or pass --from-env <VAR>.", {
8951
+ throw new CliUserError42("Pipe the token on standard input, or pass --from-env <VAR>.", {
8682
8952
  hint: 'For example: `printf %s "$TOKEN" | fluidgrids config set token --profile prod`.'
8683
8953
  });
8684
8954
  }
@@ -8698,7 +8968,7 @@ async function runConfigSet(env, key, value, options) {
8698
8968
  const profile = profileName(env, options);
8699
8969
  if (key === "token") {
8700
8970
  if (value !== undefined) {
8701
- throw new CliUserError41("A token is never given on the command line.", {
8971
+ throw new CliUserError42("A token is never given on the command line.", {
8702
8972
  hint: "Pipe it on standard input, or pass --from-env <VAR>."
8703
8973
  });
8704
8974
  }
@@ -8715,12 +8985,12 @@ async function runConfigSet(env, key, value, options) {
8715
8985
  return out;
8716
8986
  }
8717
8987
  if (!isProfileKey(key)) {
8718
- throw new CliUserError41(`Unknown profile key ${key}.`, {
8988
+ throw new CliUserError42(`Unknown profile key ${key}.`, {
8719
8989
  hint: `Keys: ${PROFILE_KEYS.join(", ")}, token, defaultProfile.`
8720
8990
  });
8721
8991
  }
8722
8992
  if (value === undefined)
8723
- throw new CliUserError41(`Give a value for ${key}.`);
8993
+ throw new CliUserError42(`Give a value for ${key}.`);
8724
8994
  const checked = checkProfileValue(key, value, profile);
8725
8995
  updateConfig(file, (document) => {
8726
8996
  const table = profileTable(document, profile, true);
@@ -8736,7 +9006,7 @@ async function runConfigGet(env, key, options) {
8736
9006
  const config = readConfig(file);
8737
9007
  const resolved = resolveProfile(config, env.env, options.profile, file);
8738
9008
  if (key !== undefined && !isProfileKey(key)) {
8739
- throw new CliUserError41(`Unknown profile key ${key}.`, {
9009
+ throw new CliUserError42(`Unknown profile key ${key}.`, {
8740
9010
  hint: `Keys: ${PROFILE_KEYS.join(", ")}.`
8741
9011
  });
8742
9012
  }
@@ -8781,10 +9051,10 @@ async function runConfigDelete(env, key, options) {
8781
9051
  const profile = profileName(env, options);
8782
9052
  const existing = readConfig(file).profiles[profile];
8783
9053
  if (existing === undefined)
8784
- throw new CliUserError41(`There is no profile ${profile} in ${file}.`);
9054
+ throw new CliUserError42(`There is no profile ${profile} in ${file}.`);
8785
9055
  if (key !== undefined) {
8786
9056
  if (!isProfileKey(key))
8787
- throw new CliUserError41(`Unknown profile key ${key}.`);
9057
+ throw new CliUserError42(`Unknown profile key ${key}.`);
8788
9058
  updateConfig(file, (document) => {
8789
9059
  const table = profileTable(document, profile, false);
8790
9060
  if (table)
@@ -8821,7 +9091,7 @@ async function runConfigMigrate(env, options) {
8821
9091
  values.workspace = workspace;
8822
9092
  if (options.tokenEnv !== undefined) {
8823
9093
  if (!ENV_NAME3.test(options.tokenEnv))
8824
- throw new CliUserError41("Invalid environment variable name for --token-env.");
9094
+ throw new CliUserError42("Invalid environment variable name for --token-env.");
8825
9095
  values.tokenRef = `env:${options.tokenEnv}`;
8826
9096
  }
8827
9097
  updateConfig(file, (document) => {
@@ -8838,15 +9108,15 @@ async function runConfigMigrate(env, options) {
8838
9108
  }
8839
9109
  return out;
8840
9110
  }
8841
- var ENV_NAME3, ENVIRONMENTS3;
9111
+ var ENV_NAME3, ENVIRONMENTS4;
8842
9112
  var init_commands = __esm(() => {
8843
9113
  init_profiles();
8844
9114
  ENV_NAME3 = /^[A-Za-z_][A-Za-z0-9_]*$/;
8845
- ENVIRONMENTS3 = ["DEV", "STAGING", "PROD"];
9115
+ ENVIRONMENTS4 = ["DEV", "STAGING", "PROD"];
8846
9116
  });
8847
9117
 
8848
9118
  // src/phase-c/commands/workers.ts
8849
- import { CliUserError as CliUserError42 } from "@burdenoff/cli-sdk/core";
9119
+ import { CliUserError as CliUserError43 } from "@burdenoff/cli-sdk/core";
8850
9120
  function workerRows(workers) {
8851
9121
  return workers.map((worker) => [
8852
9122
  worker.identity,
@@ -8860,7 +9130,7 @@ function workerRows(workers) {
8860
9130
  }
8861
9131
  async function runWorkersList(env, options) {
8862
9132
  if (options.stale && options.notStale) {
8863
- throw new CliUserError42("Give --stale or --not-stale, not both.");
9133
+ throw new CliUserError43("Give --stale or --not-stale, not both.");
8864
9134
  }
8865
9135
  const filter = {
8866
9136
  ...options.queue ? { taskQueue: checkWorkerQueue(options.queue) } : {},
@@ -8903,7 +9173,7 @@ function connectionNames(raw) {
8903
9173
  const names = parseList(raw);
8904
9174
  for (const name of names) {
8905
9175
  if (!CONNECTION_NAME.test(name)) {
8906
- throw new CliUserError42(`Invalid connection name '${name}'.`);
9176
+ throw new CliUserError43(`Invalid connection name '${name}'.`);
8907
9177
  }
8908
9178
  }
8909
9179
  return names;
@@ -8918,10 +9188,10 @@ function issued(env, options, result) {
8918
9188
  async function runTokensCreate(env, name, options) {
8919
9189
  const tokenName = name.trim();
8920
9190
  if (tokenName === "")
8921
- throw new CliUserError42("A worker token needs a name.");
9191
+ throw new CliUserError43("A worker token needs a name.");
8922
9192
  const taskQueues = parseList(options.queue).map(checkWorkerQueue);
8923
9193
  if (taskQueues.length === 0) {
8924
- throw new CliUserError42("A worker token needs at least one --queue.", {
9194
+ throw new CliUserError43("A worker token needs at least one --queue.", {
8925
9195
  hint: "Create the queue first with `fluidgrids queues create <name>`."
8926
9196
  });
8927
9197
  }
@@ -8950,10 +9220,10 @@ async function runTokensDelete(env, id, options) {
8950
9220
  async function runTokensAllowConnections(env, id, names, options) {
8951
9221
  const list = connectionNames(names);
8952
9222
  if (list.length === 0 && !options.clear) {
8953
- throw new CliUserError42("Name the connections to allow, or pass --clear to allow none.");
9223
+ throw new CliUserError43("Name the connections to allow, or pass --clear to allow none.");
8954
9224
  }
8955
9225
  if (list.length > 0 && options.clear) {
8956
- throw new CliUserError42("Give connection names or --clear, not both.");
9226
+ throw new CliUserError43("Give connection names or --clear, not both.");
8957
9227
  }
8958
9228
  const token = await env.pc.setWorkerTokenConnectionAllowlist(id, list);
8959
9229
  emit(env, options, token, { headers: TOKEN_HEADERS, rows: [tokenRow(token)] }, [
@@ -8973,17 +9243,17 @@ var init_workers = __esm(() => {
8973
9243
 
8974
9244
  // src/phase-c/commands/run-control.ts
8975
9245
  import { randomUUID } from "crypto";
8976
- import { CliUserError as CliUserError43 } from "@burdenoff/cli-sdk/core";
9246
+ import { CliUserError as CliUserError44 } from "@burdenoff/cli-sdk/core";
8977
9247
  function runAndName(first, second, flags) {
8978
9248
  const targeted = flags.workflowId !== undefined || flags.key !== undefined;
8979
9249
  if (targeted) {
8980
9250
  if (second !== undefined) {
8981
- throw new CliUserError43("With --workflow-id, give only the name: `<name> --workflow-id <id> --key <key>`.");
9251
+ throw new CliUserError44("With --workflow-id, give only the name: `<name> --workflow-id <id> --key <key>`.");
8982
9252
  }
8983
9253
  return { run: runSelectorOf(undefined, flags), name: first };
8984
9254
  }
8985
9255
  if (second === undefined) {
8986
- throw new CliUserError43("Give the run id and the name: `<runId> <name>`.");
9256
+ throw new CliUserError44("Give the run id and the name: `<runId> <name>`.");
8987
9257
  }
8988
9258
  return { run: runSelectorOf(first, flags), name: second };
8989
9259
  }
@@ -8997,7 +9267,7 @@ async function runQuery(env, first, second, options) {
8997
9267
  rows: [[result.name, String(result.rejected), JSON.stringify(result.value ?? null)]]
8998
9268
  }, result.error ? [`error: ${result.error}`] : []);
8999
9269
  if (result.rejected) {
9000
- throw new CliUserError43(`The query ${name} was refused: ${result.error ?? "no reason given"}`);
9270
+ throw new CliUserError44(`The query ${name} was refused: ${result.error ?? "no reason given"}`);
9001
9271
  }
9002
9272
  return result;
9003
9273
  }
@@ -9039,13 +9309,13 @@ async function runUpdate(env, first, second, options) {
9039
9309
  rows: [[result.updateId, result.name, result.status, JSON.stringify(result.result ?? null)]]
9040
9310
  });
9041
9311
  if (!reached(result.status, waitFor)) {
9042
- throw new CliUserError43(`The update ${name} is still ${result.status} after ${timeoutMs} ms (waiting for ${waitFor}); check it later with \`fluidgrids runs update-status ${result.runId} ${updateId}\`.`);
9312
+ throw new CliUserError44(`The update ${name} is still ${result.status} after ${timeoutMs} ms (waiting for ${waitFor}); check it later with \`fluidgrids runs update-status ${result.runId} ${updateId}\`.`);
9043
9313
  }
9044
9314
  if (result.status === "REJECTED") {
9045
- throw new CliUserError43(`The update ${name} was rejected: ${failureMessage(result.failure)}`);
9315
+ throw new CliUserError44(`The update ${name} was rejected: ${failureMessage(result.failure)}`);
9046
9316
  }
9047
9317
  if (result.status === "COMPLETED" && result.failure !== null && result.failure !== undefined) {
9048
- throw new CliUserError43(`The update handler of ${name} failed: ${failureMessage(result.failure)}`);
9318
+ throw new CliUserError44(`The update handler of ${name} failed: ${failureMessage(result.failure)}`);
9049
9319
  }
9050
9320
  return result;
9051
9321
  }
@@ -9061,33 +9331,33 @@ async function runUpdateStatus(env, first, second, options) {
9061
9331
  function parseResetTo(raw, buildId) {
9062
9332
  const value = raw?.trim() ?? "";
9063
9333
  if (value === "") {
9064
- throw new CliUserError43("--to is required: a history seq, first-task, last-task, last-continue-as-new, build-id or last-clean-task.");
9334
+ throw new CliUserError44("--to is required: a history seq, first-task, last-task, last-continue-as-new, build-id or last-clean-task.");
9065
9335
  }
9066
9336
  if (/^\d+$/.test(value)) {
9067
9337
  if (buildId !== undefined)
9068
- throw new CliUserError43("--build-id goes with --to build-id only.");
9338
+ throw new CliUserError44("--build-id goes with --to build-id only.");
9069
9339
  const seq = Number(value);
9070
9340
  if (!Number.isSafeInteger(seq) || seq <= 0) {
9071
- throw new CliUserError43(`Invalid value '${raw}' for --to: a seq is a positive integer.`);
9341
+ throw new CliUserError44(`Invalid value '${raw}' for --to: a seq is a positive integer.`);
9072
9342
  }
9073
9343
  return { seq };
9074
9344
  }
9075
9345
  const normal = value.toUpperCase().replace(/-/g, "_");
9076
9346
  if (normal === "LAST_CLEAN_TASK") {
9077
9347
  if (buildId !== undefined)
9078
- throw new CliUserError43("--build-id goes with --to build-id only.");
9348
+ throw new CliUserError44("--build-id goes with --to build-id only.");
9079
9349
  return "LAST_CLEAN_TASK";
9080
9350
  }
9081
9351
  const type = parseEnumOption(normal === "LAST_CONTINUE_AS_NEW" ? "LAST_CONTINUED_AS_NEW" : normal, "--to", RESET_TYPES);
9082
9352
  if (type === "BUILD_ID") {
9083
9353
  const id = buildId?.trim() ?? "";
9084
9354
  if (!/^sha256:[0-9a-f]{64}$/.test(id)) {
9085
- throw new CliUserError43("--to build-id needs --build-id sha256:<64 hex>.");
9355
+ throw new CliUserError44("--to build-id needs --build-id sha256:<64 hex>.");
9086
9356
  }
9087
9357
  return { type, buildId: id };
9088
9358
  }
9089
9359
  if (buildId !== undefined)
9090
- throw new CliUserError43("--build-id goes with --to build-id only.");
9360
+ throw new CliUserError44("--build-id goes with --to build-id only.");
9091
9361
  return { type };
9092
9362
  }
9093
9363
  async function runReset(env, runId, options) {
@@ -9146,7 +9416,7 @@ async function runTrace(env, runIdArg, options) {
9146
9416
  const runId = await env.pc.runIdOf(runSelectorOf(runIdArg, options));
9147
9417
  const hierarchy = await env.pc.runHierarchy(runId);
9148
9418
  if (!hierarchy)
9149
- throw new CliUserError43(`Run ${runId} not found (NOT_FOUND)`);
9419
+ throw new CliUserError44(`Run ${runId} not found (NOT_FOUND)`);
9150
9420
  const entries = flatten(hierarchy);
9151
9421
  const open = entries.filter((entry) => OPEN_STATUSES.includes(entry.run.status));
9152
9422
  const read = new Map;
@@ -9186,32 +9456,32 @@ var init_run_control = __esm(() => {
9186
9456
  });
9187
9457
 
9188
9458
  // src/phase-c/commands/activities.ts
9189
- import { CliUserError as CliUserError44 } from "@burdenoff/cli-sdk/core";
9459
+ import { CliUserError as CliUserError45 } from "@burdenoff/cli-sdk/core";
9190
9460
  import { durationMs as durationMs2 } from "@fluidgrids/workflows/ir";
9191
9461
  function completionOf(env, first, second, options) {
9192
9462
  if (options.taskTokenEnv !== undefined) {
9193
9463
  if (first !== undefined || options.workflowId !== undefined || options.key !== undefined) {
9194
- throw new CliUserError44("Give --task-token-env, or the run and activity id, not both.");
9464
+ throw new CliUserError45("Give --task-token-env, or the run and activity id, not both.");
9195
9465
  }
9196
9466
  const variable = options.taskTokenEnv.trim();
9197
9467
  if (!ENV_NAME4.test(variable)) {
9198
- throw new CliUserError44("Invalid environment variable name for --task-token-env.");
9468
+ throw new CliUserError45("Invalid environment variable name for --task-token-env.");
9199
9469
  }
9200
9470
  const taskToken = env.getEnv(variable)?.trim() ?? "";
9201
9471
  if (taskToken === "") {
9202
- throw new CliUserError44(`The environment variable ${variable} (--task-token-env) is empty or unset.`);
9472
+ throw new CliUserError45(`The environment variable ${variable} (--task-token-env) is empty or unset.`);
9203
9473
  }
9204
9474
  return { kind: "token", taskToken };
9205
9475
  }
9206
9476
  const targeted = options.workflowId !== undefined || options.key !== undefined;
9207
9477
  if (targeted) {
9208
9478
  if (first === undefined || second !== undefined) {
9209
- throw new CliUserError44("With --workflow-id, give only the activity id.");
9479
+ throw new CliUserError45("With --workflow-id, give only the activity id.");
9210
9480
  }
9211
9481
  return { kind: "id", run: runSelectorOf(undefined, options), activityId: first };
9212
9482
  }
9213
9483
  if (first === undefined || second === undefined) {
9214
- throw new CliUserError44("Give `<runId> <activityId>`, `<activityId> --workflow-id <id> --key <key>`, or --task-token-env.");
9484
+ throw new CliUserError45("Give `<runId> <activityId>`, `<activityId> --workflow-id <id> --key <key>`, or --task-token-env.");
9215
9485
  }
9216
9486
  return { kind: "id", run: runSelectorOf(first, options), activityId: second };
9217
9487
  }
@@ -9269,7 +9539,7 @@ function selectorOf(options) {
9269
9539
  options.all === true
9270
9540
  ];
9271
9541
  if (given.filter(Boolean).length !== 1) {
9272
- throw new CliUserError44("Choose the activities with exactly one of --activity-id, --type or --all.");
9542
+ throw new CliUserError45("Choose the activities with exactly one of --activity-id, --type or --all.");
9273
9543
  }
9274
9544
  if (options.activityId !== undefined) {
9275
9545
  return { activityId: requireText(options.activityId, "--activity-id") };
@@ -9310,18 +9580,18 @@ function parseMs(raw, flag) {
9310
9580
  const value = raw.trim();
9311
9581
  const ms = /^\d+$/.test(value) ? Number(value) : value === "" ? undefined : durationMs2(value, "ms");
9312
9582
  if (ms === undefined || !Number.isFinite(ms) || ms <= 0 || !Number.isSafeInteger(Math.round(ms))) {
9313
- throw new CliUserError44(`Invalid value '${raw}' for ${flag}: expected milliseconds or a duration such as 1.5s, 5m or PT2H.`);
9583
+ throw new CliUserError45(`Invalid value '${raw}' for ${flag}: expected milliseconds or a duration such as 1.5s, 5m or PT2H.`);
9314
9584
  }
9315
9585
  return Math.round(ms);
9316
9586
  }
9317
9587
  function activityOptionsOf(options) {
9318
9588
  const maxRetries = options.maxRetries === undefined ? undefined : /^\d+$/.test(options.maxRetries.trim()) ? Number(options.maxRetries.trim()) : NaN;
9319
9589
  if (Number.isNaN(maxRetries)) {
9320
- throw new CliUserError44(`Invalid value '${options.maxRetries}' for --max-retries.`);
9590
+ throw new CliUserError45(`Invalid value '${options.maxRetries}' for --max-retries.`);
9321
9591
  }
9322
9592
  const backoff = options.backoff === undefined ? undefined : Number(options.backoff.trim());
9323
9593
  if (backoff !== undefined && (!Number.isFinite(backoff) || backoff < 1)) {
9324
- throw new CliUserError44(`Invalid value '${options.backoff}' for --backoff: at least 1.`);
9594
+ throw new CliUserError45(`Invalid value '${options.backoff}' for --backoff: at least 1.`);
9325
9595
  }
9326
9596
  const retryOn = [];
9327
9597
  for (const value of parseList(options.retryOn)) {
@@ -9345,7 +9615,7 @@ function activityOptionsOf(options) {
9345
9615
  };
9346
9616
  const out = { ...timeouts, ...Object.keys(retry).length > 0 ? { retry } : {} };
9347
9617
  if (Object.keys(out).length === 0) {
9348
- throw new CliUserError44("Nothing to change: give a retry option or a timeout.");
9618
+ throw new CliUserError45("Nothing to change: give a retry option or a timeout.");
9349
9619
  }
9350
9620
  return out;
9351
9621
  }
@@ -9372,10 +9642,10 @@ async function runPauseRulesList(env, options) {
9372
9642
  }
9373
9643
  async function runPauseRulesCreate(env, options) {
9374
9644
  if (options.activityType === undefined && options.nodeType === undefined && options.workflowKey === undefined) {
9375
- throw new CliUserError44("A pause rule needs --activity-type, --node-type or --workflow-key.");
9645
+ throw new CliUserError45("A pause rule needs --activity-type, --node-type or --workflow-key.");
9376
9646
  }
9377
9647
  if (options.expiresAt !== undefined && options.expiresIn !== undefined) {
9378
- throw new CliUserError44("Give --expires-at or --expires-in, not both.");
9648
+ throw new CliUserError45("Give --expires-at or --expires-in, not both.");
9379
9649
  }
9380
9650
  const expiresIn = parseMs(options.expiresIn, "--expires-in");
9381
9651
  const expiresAt = expiresIn !== undefined ? new Date(Date.now() + expiresIn).toISOString() : parseInstant(options.expiresAt, "--expires-at");
@@ -9413,7 +9683,7 @@ var init_activities = __esm(() => {
9413
9683
  });
9414
9684
 
9415
9685
  // src/phase-c/commands/batch.ts
9416
- import { CliUserError as CliUserError45 } from "@burdenoff/cli-sdk/core";
9686
+ import { CliUserError as CliUserError46 } from "@burdenoff/cli-sdk/core";
9417
9687
  function isBatchType(name) {
9418
9688
  return Object.hasOwn(BATCH_TYPES, name);
9419
9689
  }
@@ -9426,7 +9696,7 @@ function batchSelection(options) {
9426
9696
  if (options.filter !== undefined) {
9427
9697
  const raw = parseJsonOption(options.filter, "--filter");
9428
9698
  if (!isRecord19(raw))
9429
- throw new CliUserError45("--filter must be a JSON object (ListWorkflowRunsInput).");
9699
+ throw new CliUserError46("--filter must be a JSON object (ListWorkflowRunsInput).");
9430
9700
  Object.assign(filter, raw);
9431
9701
  delete filter["limit"];
9432
9702
  delete filter["offset"];
@@ -9446,19 +9716,19 @@ function batchSelection(options) {
9446
9716
  if (options.searchAttributes !== undefined) {
9447
9717
  const query = parseJsonOption(options.searchAttributes, "--search-attributes");
9448
9718
  if (!isRecord19(query)) {
9449
- throw new CliUserError45("--search-attributes must be a JSON object ({and, or, text}).");
9719
+ throw new CliUserError46("--search-attributes must be a JSON object ({and, or, text}).");
9450
9720
  }
9451
9721
  filter["searchAttributes"] = query;
9452
9722
  }
9453
9723
  const filtered = Object.keys(filter).length > 0;
9454
9724
  if (runIds.length > 0 && filtered) {
9455
- throw new CliUserError45("Choose the runs with --run-id or with filter options, not both.");
9725
+ throw new CliUserError46("Choose the runs with --run-id or with filter options, not both.");
9456
9726
  }
9457
9727
  if (runIds.length > MAX_BATCH_RUN_IDS) {
9458
- throw new CliUserError45(`At most ${MAX_BATCH_RUN_IDS} --run-id values; use a filter for more.`);
9728
+ throw new CliUserError46(`At most ${MAX_BATCH_RUN_IDS} --run-id values; use a filter for more.`);
9459
9729
  }
9460
9730
  if (runIds.length === 0 && !filtered) {
9461
- throw new CliUserError45("Choose the runs: --run-id, or a filter (--key, --status, --kind, --workflow-id, --search-attributes, --filter).");
9731
+ throw new CliUserError46("Choose the runs: --run-id, or a filter (--key, --status, --kind, --workflow-id, --search-attributes, --filter).");
9462
9732
  }
9463
9733
  const rate = parsePositiveInt(options.rate, "--rate");
9464
9734
  return {
@@ -9520,7 +9790,7 @@ function batchPayload(type, options) {
9520
9790
  options.clearOverride === true
9521
9791
  ];
9522
9792
  if (chosen.filter(Boolean).length !== 1) {
9523
- throw new CliUserError45("Give exactly one of --pin <version>, --auto-upgrade or --clear-override.");
9793
+ throw new CliUserError46("Give exactly one of --pin <version>, --auto-upgrade or --clear-override.");
9524
9794
  }
9525
9795
  if (options.clearOverride)
9526
9796
  return { clearVersioningOverride: true };
@@ -9554,7 +9824,7 @@ function refuseUnused(type, options) {
9554
9824
  unused.push("--activity-id/--type/--all");
9555
9825
  }
9556
9826
  if (unused.length > 0) {
9557
- throw new CliUserError45(`${unused.join(", ")} do not apply to a ${type} batch.`);
9827
+ throw new CliUserError46(`${unused.join(", ")} do not apply to a ${type} batch.`);
9558
9828
  }
9559
9829
  }
9560
9830
  function jobRow(job) {
@@ -9582,7 +9852,7 @@ function jobDetails(job) {
9582
9852
  }
9583
9853
  async function runBatchStart(env, typeName, options) {
9584
9854
  if (!isBatchType(typeName)) {
9585
- throw new CliUserError45(`Unknown batch type '${typeName}'. Allowed: ${Object.keys(BATCH_TYPES).join(", ")}`);
9855
+ throw new CliUserError46(`Unknown batch type '${typeName}'. Allowed: ${Object.keys(BATCH_TYPES).join(", ")}`);
9586
9856
  }
9587
9857
  const type = BATCH_TYPES[typeName];
9588
9858
  refuseUnused(type, options);
@@ -9632,10 +9902,10 @@ async function runBatchDescribe(env, id, options) {
9632
9902
  }
9633
9903
  emit(env, options, job, { headers: JOB_HEADERS, rows: [jobRow(job)] }, jobDetails(job));
9634
9904
  if (options.watch && !TERMINAL_JOB.includes(job.status)) {
9635
- throw new CliUserError45(`Batch job ${id} is still ${job.status} after ${timeout} ms.`);
9905
+ throw new CliUserError46(`Batch job ${id} is still ${job.status} after ${timeout} ms.`);
9636
9906
  }
9637
9907
  if (options.watch && (job.status === "FAILED" || job.status === "CANCELLED")) {
9638
- throw new CliUserError45(`Batch job ${id} ended ${job.status}${job.failureMessage ? `: ${job.failureMessage}` : ""}.`);
9908
+ throw new CliUserError46(`Batch job ${id} ended ${job.status}${job.failureMessage ? `: ${job.failureMessage}` : ""}.`);
9639
9909
  }
9640
9910
  return job;
9641
9911
  }
@@ -9679,7 +9949,7 @@ var init_batch = __esm(() => {
9679
9949
  });
9680
9950
 
9681
9951
  // src/phase-d/duration.ts
9682
- import { CliUserError as CliUserError46 } from "@burdenoff/cli-sdk/core";
9952
+ import { CliUserError as CliUserError47 } from "@burdenoff/cli-sdk/core";
9683
9953
  import { toMs } from "@fluidgrids/workflows";
9684
9954
  function parseDurationOption(raw, flag) {
9685
9955
  if (raw === undefined)
@@ -9689,7 +9959,7 @@ function parseDurationOption(raw, flag) {
9689
9959
  try {
9690
9960
  toMs(sent, flag);
9691
9961
  } catch {
9692
- throw new CliUserError46(`Invalid value '${raw}' for ${flag}: expected a duration such as 1500 (milliseconds), 30s, 5m, 2h or PT2H.`);
9962
+ throw new CliUserError47(`Invalid value '${raw}' for ${flag}: expected a duration such as 1500 (milliseconds), 30s, 5m, 2h or PT2H.`);
9693
9963
  }
9694
9964
  return sent;
9695
9965
  }
@@ -9698,14 +9968,14 @@ var init_duration = () => {};
9698
9968
  // src/phase-d/commands/activity-start.ts
9699
9969
  import { existsSync as existsSync14, readFileSync as readFileSync12 } from "fs";
9700
9970
  import { resolve as resolve12 } from "path";
9701
- import { CliUserError as CliUserError47 } from "@burdenoff/cli-sdk/core";
9971
+ import { CliUserError as CliUserError48 } from "@burdenoff/cli-sdk/core";
9702
9972
  function retryPolicy(raw, maxAttempts, readFile) {
9703
9973
  const parsed = parseJsonObjectArg(raw, "--retry", readFile);
9704
9974
  const policy = {};
9705
9975
  if (parsed !== undefined) {
9706
9976
  for (const key of Object.keys(parsed)) {
9707
9977
  if (!RETRY_KEYS.some((known) => known === key)) {
9708
- throw new CliUserError47(`--retry: unknown field ${key}. Allowed: ${RETRY_KEYS.join(", ")}`);
9978
+ throw new CliUserError48(`--retry: unknown field ${key}. Allowed: ${RETRY_KEYS.join(", ")}`);
9709
9979
  }
9710
9980
  }
9711
9981
  const text = (key) => {
@@ -9713,7 +9983,7 @@ function retryPolicy(raw, maxAttempts, readFile) {
9713
9983
  if (value === undefined)
9714
9984
  return;
9715
9985
  if (typeof value !== "string")
9716
- throw new CliUserError47(`--retry: ${key} must be a duration.`);
9986
+ throw new CliUserError48(`--retry: ${key} must be a duration.`);
9717
9987
  policy[key] = parseDurationOption(value, `--retry ${key}`);
9718
9988
  };
9719
9989
  text("initialInterval");
@@ -9721,21 +9991,21 @@ function retryPolicy(raw, maxAttempts, readFile) {
9721
9991
  const backoff = parsed["backoffCoefficient"];
9722
9992
  if (backoff !== undefined) {
9723
9993
  if (typeof backoff !== "number" || !Number.isFinite(backoff) || backoff < 1) {
9724
- throw new CliUserError47("--retry: backoffCoefficient must be a number of at least 1.");
9994
+ throw new CliUserError48("--retry: backoffCoefficient must be a number of at least 1.");
9725
9995
  }
9726
9996
  policy.backoffCoefficient = backoff;
9727
9997
  }
9728
9998
  const attempts = parsed["maximumAttempts"];
9729
9999
  if (attempts !== undefined) {
9730
10000
  if (typeof attempts !== "number" || !Number.isSafeInteger(attempts) || attempts < 0) {
9731
- throw new CliUserError47("--retry: maximumAttempts must be a whole number (0 = unlimited).");
10001
+ throw new CliUserError48("--retry: maximumAttempts must be a whole number (0 = unlimited).");
9732
10002
  }
9733
10003
  policy.maximumAttempts = attempts;
9734
10004
  }
9735
10005
  const types = parsed["nonRetryableErrorTypes"];
9736
10006
  if (types !== undefined) {
9737
10007
  if (!Array.isArray(types) || types.some((type) => typeof type !== "string")) {
9738
- throw new CliUserError47("--retry: nonRetryableErrorTypes must be a list of strings.");
10008
+ throw new CliUserError48("--retry: nonRetryableErrorTypes must be a list of strings.");
9739
10009
  }
9740
10010
  policy.nonRetryableErrorTypes = types.filter((type) => typeof type === "string");
9741
10011
  }
@@ -9743,7 +10013,7 @@ function retryPolicy(raw, maxAttempts, readFile) {
9743
10013
  if (maxAttempts !== undefined) {
9744
10014
  const value = maxAttempts.trim();
9745
10015
  if (!/^\d+$/.test(value) || !Number.isSafeInteger(Number(value))) {
9746
- throw new CliUserError47(`Invalid value '${maxAttempts}' for --max-attempts: expected a whole number (0 = unlimited).`);
10016
+ throw new CliUserError48(`Invalid value '${maxAttempts}' for --max-attempts: expected a whole number (0 = unlimited).`);
9747
10017
  }
9748
10018
  policy.maximumAttempts = Number(value);
9749
10019
  }
@@ -9752,29 +10022,29 @@ function retryPolicy(raw, maxAttempts, readFile) {
9752
10022
  function requireName(raw, what) {
9753
10023
  const value = raw.trim();
9754
10024
  if (value === "")
9755
- throw new CliUserError47(`The ${what} is empty.`);
10025
+ throw new CliUserError48(`The ${what} is empty.`);
9756
10026
  return value;
9757
10027
  }
9758
10028
  async function runActivityStart(env, nodeType, operation, options) {
9759
10029
  const readFile = (path) => {
9760
10030
  const absolute = resolve12(env.cwd(), path);
9761
10031
  if (!existsSync14(absolute))
9762
- throw new CliUserError47(`${path} does not exist.`);
10032
+ throw new CliUserError48(`${path} does not exist.`);
9763
10033
  return readFileSync12(absolute, "utf8");
9764
10034
  };
9765
10035
  if (options.args === undefined) {
9766
- throw new CliUserError47("--args is required: the operation arguments as a JSON object.", {
10036
+ throw new CliUserError48("--args is required: the operation arguments as a JSON object.", {
9767
10037
  hint: `For example --args '{"url":"https://example.com"}', or --args @args.json.`
9768
10038
  });
9769
10039
  }
9770
10040
  const args = parseJsonObjectArg(options.args, "--args", readFile) ?? {};
9771
10041
  const summary = options.summary?.trim();
9772
10042
  if (summary !== undefined && (summary === "" || summary.length > MAX_SUMMARY_CHARS)) {
9773
- throw new CliUserError47(`--summary is 1 to ${MAX_SUMMARY_CHARS} characters.`);
10043
+ throw new CliUserError48(`--summary is 1 to ${MAX_SUMMARY_CHARS} characters.`);
9774
10044
  }
9775
10045
  const key = options.idempotencyKey?.trim();
9776
10046
  if (key !== undefined && !IDEMPOTENCY_KEY.test(key)) {
9777
- throw new CliUserError47(`--idempotency-key is 1 to ${MAX_IDEMPOTENCY_KEY_CHARS} letters, digits, dots, underscores, colons or dashes.`);
10047
+ throw new CliUserError48(`--idempotency-key is 1 to ${MAX_IDEMPOTENCY_KEY_CHARS} letters, digits, dots, underscores, colons or dashes.`);
9778
10048
  }
9779
10049
  const retry = retryPolicy(options.retry, options.maxAttempts, readFile);
9780
10050
  const nodeVersion = options.nodeVersion?.trim();
@@ -9818,7 +10088,7 @@ async function runActivityStart(env, nodeType, operation, options) {
9818
10088
  rows: [[result.run.id, finalStatus, started.existing ? "yes" : "no"]]
9819
10089
  }, details);
9820
10090
  if (options.wait && finalStatus !== "COMPLETED") {
9821
- throw new CliUserError47(`Run ${started.run.id} ended ${finalStatus}.`);
10091
+ throw new CliUserError48(`Run ${started.run.id} ended ${finalStatus}.`);
9822
10092
  }
9823
10093
  return result;
9824
10094
  }
@@ -9839,7 +10109,7 @@ var init_activity_start = __esm(() => {
9839
10109
  });
9840
10110
 
9841
10111
  // src/phase-c/commands/signal-tokens.ts
9842
- import { CliUserError as CliUserError48 } from "@burdenoff/cli-sdk/core";
10112
+ import { CliUserError as CliUserError49 } from "@burdenoff/cli-sdk/core";
9843
10113
  function row(token) {
9844
10114
  return [
9845
10115
  token.id,
@@ -9856,12 +10126,12 @@ async function runSignalTokenCreate(env, runId, options) {
9856
10126
  const signalName = requireText(options.signal, "--signal");
9857
10127
  const ttlMs = parseMs(options.ttl, "--ttl");
9858
10128
  if (ttlMs !== undefined && ttlMs % 1000 !== 0) {
9859
- throw new CliUserError48("--ttl is counted in whole seconds.");
10129
+ throw new CliUserError49("--ttl is counted in whole seconds.");
9860
10130
  }
9861
10131
  const ipAllowlist = parseList(options.allowIp);
9862
10132
  for (const entry of ipAllowlist) {
9863
10133
  if (!IPV4_OR_CIDR.test(entry)) {
9864
- throw new CliUserError48(`Invalid --allow-ip '${entry}': an IPv4 address or CIDR range.`);
10134
+ throw new CliUserError49(`Invalid --allow-ip '${entry}': an IPv4 address or CIDR range.`);
9865
10135
  }
9866
10136
  }
9867
10137
  const created = await env.pc.createSignalToken({
@@ -9897,7 +10167,7 @@ var init_signal_tokens = __esm(() => {
9897
10167
  });
9898
10168
 
9899
10169
  // src/phase-c/commands/search-attributes.ts
9900
- import { CliUserError as CliUserError49 } from "@burdenoff/cli-sdk/core";
10170
+ import { CliUserError as CliUserError50 } from "@burdenoff/cli-sdk/core";
9901
10171
  function row2(attribute) {
9902
10172
  return [
9903
10173
  attribute.name,
@@ -9914,11 +10184,11 @@ async function runSearchAttributesList(env, options) {
9914
10184
  }
9915
10185
  async function runSearchAttributesCreate(env, name, options) {
9916
10186
  if (!NAME.test(name)) {
9917
- throw new CliUserError49(`Invalid search attribute name '${name}': a letter, then letters, digits and underscores (at most 64).`);
10187
+ throw new CliUserError50(`Invalid search attribute name '${name}': a letter, then letters, digits and underscores (at most 64).`);
9918
10188
  }
9919
10189
  const type = parseEnumOption(options.type, "--type", SEARCH_ATTRIBUTE_TYPES);
9920
10190
  if (type === undefined) {
9921
- throw new CliUserError49(`--type is required: ${SEARCH_ATTRIBUTE_TYPES.join(", ")}.`);
10191
+ throw new CliUserError50(`--type is required: ${SEARCH_ATTRIBUTE_TYPES.join(", ")}.`);
9922
10192
  }
9923
10193
  const attribute = await env.pc.createSearchAttribute({
9924
10194
  name,
@@ -9931,7 +10201,7 @@ async function runSearchAttributesCreate(env, name, options) {
9931
10201
  async function runSearchAttributesDelete(env, name, options) {
9932
10202
  const attribute = (await env.pc.searchAttributes()).find((entry) => entry.name === name);
9933
10203
  if (!attribute) {
9934
- throw new CliUserError49(`The workspace has no search attribute ${name}.`, {
10204
+ throw new CliUserError50(`The workspace has no search attribute ${name}.`, {
9935
10205
  hint: "List them with `fluidgrids search-attributes list`."
9936
10206
  });
9937
10207
  }
@@ -9959,7 +10229,7 @@ var init_search_attributes = __esm(() => {
9959
10229
  });
9960
10230
 
9961
10231
  // src/phase-c/commands/schedules.ts
9962
- import { CliUserError as CliUserError50 } from "@burdenoff/cli-sdk/core";
10232
+ import { CliUserError as CliUserError51 } from "@burdenoff/cli-sdk/core";
9963
10233
  function isRecord20(value) {
9964
10234
  return typeof value === "object" && value !== null && !Array.isArray(value);
9965
10235
  }
@@ -10084,9 +10354,9 @@ async function runSchedulesBackfill(env, workflowKey, triggerNodeId, options) {
10084
10354
  const from = parseInstant(requireText(options.from, "--from"), "--from") ?? "";
10085
10355
  const to = parseInstant(requireText(options.to, "--to"), "--to") ?? "";
10086
10356
  if (from >= to)
10087
- throw new CliUserError50("--from must be before --to.");
10357
+ throw new CliUserError51("--from must be before --to.");
10088
10358
  if (Date.parse(to) > Date.now())
10089
- throw new CliUserError50("--to must be in the past.");
10359
+ throw new CliUserError51("--to must be in the past.");
10090
10360
  await requireConfirmation(env, `Backfill ${workflowKey} ${triggerNodeId} from ${from} to ${to}? Each fire time starts a run (at most ${MAX_BACKFILL_FIRES}) and counts toward the monthly runs.`, options.force);
10091
10361
  const overlapPolicy = parseOverlap(options.overlapPolicy);
10092
10362
  const result = await env.pc.backfillSchedule({
@@ -10138,7 +10408,7 @@ init_json_contract();
10138
10408
  import { readFileSync as readFileSync13 } from "fs";
10139
10409
  import { join as join12, dirname as dirname6 } from "path";
10140
10410
  import { fileURLToPath } from "url";
10141
- import { CliUserError as CliUserError51, defaultOutputAdapter } from "@burdenoff/cli-sdk/core";
10411
+ import { CliUserError as CliUserError52, defaultOutputAdapter } from "@burdenoff/cli-sdk/core";
10142
10412
 
10143
10413
  // src/output/run-envelope.ts
10144
10414
  init_json_contract();
@@ -10567,7 +10837,7 @@ import healthModule from "@burdenoff/cli-sdk/modules/health";
10567
10837
 
10568
10838
  // src/code-first/register.ts
10569
10839
  init_shared();
10570
- import { CliUserError as CliUserError36 } from "@burdenoff/cli-sdk/core";
10840
+ import { CliUserError as CliUserError37 } from "@burdenoff/cli-sdk/core";
10571
10841
  var PROJECT_OPTION = [
10572
10842
  "--project <dir>",
10573
10843
  "Project directory (default: nearest fluidgrids.config.json)"
@@ -10625,7 +10895,7 @@ function registerImport(program, env) {
10625
10895
  return;
10626
10896
  }
10627
10897
  if (resolved.preview) {
10628
- throw new CliUserError36("--preview needs --from <tool>.");
10898
+ throw new CliUserError37("--preview needs --from <tool>.");
10629
10899
  }
10630
10900
  await Promise.resolve().then(() => init_import());
10631
10901
  await runImport(env, file, resolved);
@@ -10751,6 +11021,12 @@ function registerDurable(program, env) {
10751
11021
  await runOverride(env, runId, withGlobalFormat(options, command));
10752
11022
  });
10753
11023
  }
11024
+ function registerDeploy(program, env) {
11025
+ program.command("deploy <workflowKey>").description("Deploy a version to DEV, or promote it to STAGING or PROD (waits for an approver; --ramp sets a gradual PROD rollout)").option("--env <env>", "dev, staging or prod").option("--wf-version <version>", "dev: the version to deploy (default: the newest; `active` names the ACTIVE one). staging/prod: refuse unless the source environment holds it").option("--ramp <n>", "prod only: 0 to 99 sends n% of new automatic starts to the STAGING version (durable functions); 100 promotes it in full").option("--note <text>", "Context for the approver of a promotion request").option("--no-wait", "Return once the promotion request is made instead of waiting for it").option("--timeout <ms>", "Give up waiting for an approver after this many milliseconds (the request stays open)", "900000").option("--poll-interval <ms>", "Delay between polls of the request in milliseconds", "5000").option(...OUTPUT_OPTION).action(async (workflowKey, options, command) => {
11026
+ await Promise.resolve().then(() => init_deploy());
11027
+ await runDeploy(env, workflowKey, withGlobalFormat(options, command));
11028
+ });
11029
+ }
10754
11030
 
10755
11031
  // src/code-first/index.ts
10756
11032
  init_shared();
@@ -10771,6 +11047,7 @@ var codeFirstModule = {
10771
11047
  registerGenerate(program, env);
10772
11048
  registerInterface(program, env);
10773
11049
  registerDurable(program, env);
11050
+ registerDeploy(program, env);
10774
11051
  }
10775
11052
  };
10776
11053
  var code_first_default = codeFirstModule;
@@ -11159,6 +11436,8 @@ var HELP_EXAMPLES = [
11159
11436
  "$ fluidgrids push --dry-run # What a push would change",
11160
11437
  "$ FLUIDGRIDS_TOKEN=... fluidgrids diff --exit-code # CI: non-interactive auth",
11161
11438
  "$ fluidgrids test <key> --junit junit.xml # CI: run the saved test cases",
11439
+ "$ fluidgrids deploy <key> --env staging # Promote the DEV version (waits for approval)",
11440
+ "$ fluidgrids deploy <key> --env prod --ramp 10 # 10% of new PROD starts run the STAGING version",
11162
11441
  "",
11163
11442
  "$ fluidgrids config set apiUrl <url> --profile alpha # Client profile (~/.fluidgrids/config.toml)",
11164
11443
  "",
@@ -11224,7 +11503,7 @@ try {
11224
11503
  }
11225
11504
  } catch (error) {
11226
11505
  console.error(`✗ ${error instanceof Error ? error.message : String(error)}`);
11227
- if (error instanceof CliUserError51 && error.hint)
11506
+ if (error instanceof CliUserError52 && error.hint)
11228
11507
  console.error(`ℹ ${error.hint}`);
11229
- process.exitCode = error instanceof CliUserError51 ? error.exitCode : 1;
11508
+ process.exitCode = error instanceof CliUserError52 ? error.exitCode : 1;
11230
11509
  }