@mnaimfaizy/agent-kit 1.0.0-alpha.12 → 1.0.0-beta.10

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 (43) hide show
  1. package/README.md +14 -6
  2. package/bin/agent-kit.mjs +3 -1
  3. package/package.json +1 -1
  4. package/src/callers.mjs +73 -10
  5. package/src/checks/kit-owned-trees.mjs +47 -4
  6. package/src/checks/result.mjs +8 -2
  7. package/src/checks/review-response.mjs +205 -0
  8. package/src/checks/rulesets.mjs +7 -2
  9. package/src/checks/scan-recipe.mjs +56 -0
  10. package/src/checks/secrets-and-variables.mjs +65 -15
  11. package/src/cli.mjs +306 -19
  12. package/src/deep-scan/agent.mjs +410 -0
  13. package/src/deep-scan/claude-code.mjs +25 -0
  14. package/src/deep-scan/credential.mjs +215 -0
  15. package/src/deep-scan/docker-driver.mjs +696 -0
  16. package/src/deep-scan/egress.mjs +150 -0
  17. package/src/deep-scan/lifecycle.mjs +703 -0
  18. package/src/deep-scan/limits.mjs +126 -0
  19. package/src/deep-scan/model-proxy.mjs +378 -0
  20. package/src/deep-scan/preflight.mjs +78 -0
  21. package/src/deep-scan/recipe.mjs +447 -0
  22. package/src/deep-scan/relay-script.mjs +98 -0
  23. package/src/deep-scan/relay.mjs +130 -0
  24. package/src/deep-scan/runtime.mjs +181 -0
  25. package/src/deep-scan/sbx-driver.mjs +501 -0
  26. package/src/deep-scan/steps.mjs +47 -0
  27. package/src/deep-scan/tar.mjs +84 -0
  28. package/src/deep-scan/verify.mjs +272 -0
  29. package/src/deep-scan.mjs +474 -0
  30. package/src/doctor.mjs +57 -16
  31. package/src/exec.mjs +225 -23
  32. package/src/init.mjs +653 -0
  33. package/src/kit-owned-paths.mjs +5 -3
  34. package/src/kit-tag.mjs +175 -28
  35. package/src/local-tree.mjs +142 -27
  36. package/src/local-writes.mjs +278 -0
  37. package/src/prompt.mjs +42 -0
  38. package/src/safe-paths.mjs +68 -0
  39. package/src/tags.mjs +15 -5
  40. package/src/templates.mjs +137 -0
  41. package/src/upgrade.mjs +288 -0
  42. package/src/workflow-call.mjs +3 -5
  43. package/src/yaml-subset.mjs +134 -24
@@ -218,6 +218,21 @@ export function checkSecrets({ github, repo, ownerType, requirements }) {
218
218
  );
219
219
  }
220
220
 
221
+ /**
222
+ * Variables ADR 0009 renamed, old name to new. The Callers have no fallback to
223
+ * an old name, so one still set does nothing once the Caller reads the new one.
224
+ */
225
+ export const RENAMED_VARIABLES = {
226
+ CLAUDE_PIPELINE_ENABLED: "CLAUDE_AGENT_FLOW_ENABLED",
227
+ CLAUDE_MODEL_PLAN: "CLAUDE_PLAN_MODEL",
228
+ CLAUDE_MODEL_IMPLEMENT: "CLAUDE_IMPLEMENT_MODEL",
229
+ CLAUDE_MODEL_REVIEW: "CLAUDE_REVIEW_MODEL",
230
+ CLAUDE_MODEL_REVIEW_RESPONSE: "CLAUDE_REVIEW_RESPONSE_MODEL",
231
+ CLAUDE_MODEL_AUDIT: "CLAUDE_SECURITY_AUDIT_MODEL",
232
+ };
233
+
234
+ const killSwitch = (name) => /_ENABLED$/.test(name);
235
+
221
236
  export function checkVariables({ github, repo, ownerType, requirements }) {
222
237
  const ID = "variables";
223
238
  const TITLE = "Repository variables the Callers read are set";
@@ -227,26 +242,61 @@ export function checkVariables({ github, repo, ownerType, requirements }) {
227
242
  } catch (err) {
228
243
  return result(ID, TITLE, "skip", `Could not list repository variables: ${err.message}`);
229
244
  }
245
+ const isSet = (name) => listed.names.has(name.toUpperCase());
230
246
  const required = requirements.variables.filter((v) => !v.optional && !isProvided(v.name));
231
- const missing = required.filter((v) => !listed.names.has(v.name.toUpperCase()));
232
- if (missing.length === 0) {
247
+ const missing = required.filter((v) => !isSet(v.name));
248
+ // An old name still set while a Caller reads its replacement: the value is ignored.
249
+ const read = new Map(requirements.variables.map((v) => [v.name.toUpperCase(), v]));
250
+ const renamed = Object.entries(RENAMED_VARIABLES)
251
+ .filter(([oldName, newName]) => isSet(oldName) && read.has(newName))
252
+ .map(([oldName, newName]) => ({ oldName, newName, v: read.get(newName) }));
253
+ if (missing.length === 0 && renamed.length === 0) {
233
254
  return result(ID, TITLE, "pass", `All ${required.length} required variable(s) are set.`);
234
255
  }
235
- const killSwitch = (name) => /_ENABLED$/.test(name);
236
- const details = missing.map(
237
- (v) =>
238
- `not set: ${v.name} (${v.where.join(", ")})` +
239
- (killSwitch(v.name) ? " — the Kill switch: the flow never runs until it is set to true" : ""),
240
- );
241
- if (listed.orgNote) details.push(listed.orgNote);
256
+ const details = [
257
+ ...missing.map(
258
+ (v) =>
259
+ `not set: ${v.name} (${v.where.join(", ")})` +
260
+ (killSwitch(v.name)
261
+ ? " — the Kill switch: the flow never runs until it is set to true"
262
+ : ""),
263
+ ),
264
+ ...renamed.map(
265
+ ({ oldName, newName, v }) =>
266
+ `renamed: ${oldName} is still set, but the Callers read ${newName} (${v.where.join(", ")}). ` +
267
+ `${oldName} is ignored: ` +
268
+ (isSet(newName)
269
+ ? `${newName} is set too, so delete ${oldName}.`
270
+ : `set ${newName} to its value, then delete ${oldName}.`),
271
+ ),
272
+ ];
273
+ if (listed.orgNote && missing.length) details.push(listed.orgNote);
242
274
  // The Kill switch takes true; for anything else, gh prompts for the value.
275
+ const toSet = [
276
+ ...missing.map((v) => v.name),
277
+ ...renamed.filter((r) => !isSet(r.newName)).map((r) => r.newName),
278
+ ].filter((name, i, all) => all.indexOf(name) === i);
243
279
  const { fix, notes } = splitFixes(
244
- missing.map((v) =>
245
- setCommand("variable", v.name, repo, killSwitch(v.name) ? ["--body", "true"] : []),
280
+ toSet.map((name) =>
281
+ setCommand("variable", name, repo, killSwitch(name) ? ["--body", "true"] : []),
246
282
  ),
247
283
  );
248
- return result(ID, TITLE, "fail", `${missing.length} required variable(s) missing.`, {
249
- details: [...details, ...notes],
250
- fix,
251
- });
284
+ // Each old name goes last, once its replacement has a value: deleting first
285
+ // would lose the value before it is copied. The old names are the kit's own.
286
+ for (const { oldName } of renamed) {
287
+ fix.push(command("gh", "variable", "delete", oldName, "--repo", repo));
288
+ }
289
+ if (missing.length) {
290
+ return result(ID, TITLE, "fail", `${missing.length} required variable(s) missing.`, {
291
+ details: [...details, ...notes],
292
+ fix,
293
+ });
294
+ }
295
+ return result(
296
+ ID,
297
+ TITLE,
298
+ "warn",
299
+ `${renamed.length} renamed variable(s) still set under the old name.`,
300
+ { details: [...details, ...notes], fix },
301
+ );
252
302
  }
package/src/cli.mjs CHANGED
@@ -1,21 +1,48 @@
1
1
  // Argument parsing and dispatch. Exit codes: 0 ok, 1 a check failed (or a
2
- // warning under --strict, or the tag was refused), 2 usage error.
2
+ // warning under --strict, the tag or the change was refused, or deep-scan
3
+ // refused, or a sandbox step failed), 2 usage error (including a missing
4
+ // answer when there is no terminal to ask on), 3 a deep-scan limit stopped
5
+ // the run (after copying out any report and tearing the sandbox down), 130
6
+ // or 143 deep-scan was interrupted by SIGINT or SIGTERM (likewise).
3
7
 
4
- import { readFileSync } from "node:fs";
5
8
  import { parseArgs } from "node:util";
9
+ import { runDeepScan } from "./deep-scan.mjs";
6
10
  import { formatReport, runDoctor } from "./doctor.mjs";
7
11
  import { REPO_PATTERN, sanitizeLine } from "./checks/result.mjs";
8
- import { systemRunner } from "./exec.mjs";
12
+ import { runnerFor } from "./exec.mjs";
13
+ import { askYesNo } from "./prompt.mjs";
14
+ import { CLI_VERSION, isReleaseTag } from "./tags.mjs";
15
+ import { runInit } from "./init.mjs";
16
+ import { runUpgrade } from "./upgrade.mjs";
9
17
 
10
- export const VERSION = JSON.parse(
11
- readFileSync(new URL("../package.json", import.meta.url), "utf8"),
12
- ).version;
18
+ export const VERSION = CLI_VERSION;
13
19
 
14
20
  const USAGE = `Usage: agent-kit <command> [options]
15
21
 
16
22
  Commands:
23
+ init Adopt Agent-kit from a tag: copy the Kit-owned paths, write a
24
+ Caller per flow with your answers filled in, the Threat pack
25
+ skeleton and .github/dependabot.yml, then print the GitHub-side
26
+ steps as gh commands. Local files only.
17
27
  doctor Read-only checks of this repository against the Agent-kit tag
18
28
  its Callers pin. Never changes anything.
29
+ upgrade Move this repository to another Agent-kit tag: replace the
30
+ Kit-owned paths, rewrite the uses: pins, print the examples/
31
+ diff, then run doctor's file and pin checks. Local files only.
32
+ deep-scan Run a Deep scan of this repository's own code in a sandbox.
33
+ Reads the Scan recipe as committed on the default branch and
34
+ validates it, refuses a GitHub token in its environment or a
35
+ committed .env, reads the deep procedure and the Threat pack
36
+ from the same branch and the API key (--credential-from),
37
+ chooses a sandbox runtime from the host or refuses (no
38
+ override), then runs the sandbox: image, copy-in of the
39
+ default branch's tip, setup with egress only to the recipe's
40
+ registries, network cut, the real Claude Code behind a
41
+ key-injecting model proxy on this machine (its only route
42
+ out), copy-out of the report only, and teardown. Every run
43
+ is bounded by wall clocks, a turn limit and a token cap.
44
+ With --verify <file> --ref <ref>, a local-only
45
+ Verification run: does a fix hold for known findings?
19
46
 
20
47
  Options for doctor:
21
48
  --ci Check only Kit-owned paths and uses: pins (no gh needed).
@@ -24,19 +51,153 @@ Options for doctor:
24
51
  --repo <o/r> The GitHub repository to check (default: gh's choice for
25
52
  the current directory).
26
53
 
54
+ Options for init (each one is asked for when missing, on a terminal):
55
+ --tag <vX> The Agent-kit tag to adopt.
56
+ --flows <list> pipeline, audit and/or review-response
57
+ (comma-separated).
58
+ --actors <logins> GitHub logins allowed to trigger runs.
59
+ --default-branch <b> Default branch (default: origin's HEAD, else main).
60
+ --verify <commands> verify_commands (pipeline: implement's checks;
61
+ review-response: the agent's checks). In a
62
+ prompt, \\n separates commands.
63
+ --preset <name|none> Inline examples/setup-presets/<name>.sh as
64
+ setup_commands (pipeline, review-response;
65
+ default none).
66
+ --threat-pack-dir <d> Where the Threat pack goes (audit; default .security).
67
+ --yes Ask nothing; every answer comes from flags.
68
+ --force Overwrite existing Callers, Threat pack files and
69
+ Kit-owned paths (use upgrade to change tags).
70
+
71
+ Options for deep-scan:
72
+ --recipe <path> The Scan recipe, relative to the repository root
73
+ (default .security/scan-recipe.yml).
74
+ --default-branch <b> The branch whose tip the recipe is read from
75
+ (default: origin's HEAD, else main).
76
+ --credential <kind> The model credential's kind: api-key (default),
77
+ an Anthropic API key, or subscription, a Claude
78
+ subscription token from claude setup-token, an
79
+ opt-in at your own risk: it relies on
80
+ undocumented Claude Code behaviour, has no
81
+ refresh, and the token cap is its only spend
82
+ lever (see docs/security-audit.md#credentials).
83
+ --credential-from <s> Where the credential is read from: env:<NAME>
84
+ (default env:ANTHROPIC_API_KEY, or
85
+ env:CLAUDE_CODE_OAUTH_TOKEN with --credential
86
+ subscription; op run can fill either) or an
87
+ op:// reference, read with op read. Never the
88
+ credential itself. It stays outside the
89
+ sandbox, in the model proxy.
90
+ --setup-minutes <n> The setup wall clock: image to agent step
91
+ (default 20).
92
+ --scan-minutes <n> The scan wall clock: the agent step (default 60).
93
+ --max-turns <n> Claude Code's turn limit (default 200).
94
+ --max-tokens <n> The model proxy's token cap for the run, counting
95
+ input, output and cache tokens (default 5000000).
96
+ A limit that fires stops the run, copies out its
97
+ report with a Stopped: line, and exits 3.
98
+ --model <id> The Claude model the agent runs on, a plain id
99
+ such as claude-opus-5-5 (default: Claude Code's).
100
+ --effort <level> The effort level Claude Code runs at: low,
101
+ medium, high, xhigh or max (default: Claude
102
+ Code's). The Agent step line names the model
103
+ and effort asked for, and the Model proxy line
104
+ the model the API answered with.
105
+ --report <path> Write the report to this new file, in a folder
106
+ that exists (default: report.md in a new private
107
+ folder under your temporary folder). The CI
108
+ workflow's delivery steps read it from there.
109
+ --verify <file> A Verification run instead: re-attempt the
110
+ Reproduction of the findings in <file> (each a
111
+ ### section with Concept id, Location and
112
+ Observation, as a deep report gives them) to
113
+ check whether a fix holds. Confirm-only: no full
114
+ walk, no exploration, no new findings. Local
115
+ only (refused in CI), with no --report: the
116
+ report goes to a new private folder, and nothing
117
+ is filed or posted. Its defaults: scan 15 min,
118
+ 50 turns, the same token cap.
119
+ --ref <ref> With --verify, and needed by it: the local
120
+ branch, tag or commit to export and verify on,
121
+ such as your fix branch. The recipe, the skill
122
+ and the Threat pack still come from the default
123
+ branch.
124
+ In GitHub Actions (GITHUB_ACTIONS=true) deep-scan keeps the Public-log
125
+ rule: it prints nothing the scan shaped (Claude Code's error output, the
126
+ model proxy's refusals), since the Actions log is world-readable.
127
+
128
+ Options for upgrade:
129
+ --tag <vY> The Agent-kit tag to move to (asked for when missing).
130
+ --from <vX> The tag you are leaving, when the pins already name <vY>
131
+ (after a Dependabot bump): deletes paths only <vX> listed
132
+ and prints the examples/ diff.
133
+ --yes Do not ask before changing files.
134
+ --force Replace Kit-owned paths even when they have uncommitted
135
+ changes (those changes are lost).
136
+
27
137
  -h, --help Show this help.
28
- -v, --version Show the version.
138
+ -v, --version Show the version.`;
29
139
 
30
- init and upgrade are not available yet.`;
140
+ const COMMAND_OPTIONS = {
141
+ doctor: ["ci", "strict", "repo"],
142
+ init: [
143
+ "tag",
144
+ "flows",
145
+ "actors",
146
+ "default-branch",
147
+ "verify",
148
+ "preset",
149
+ "threat-pack-dir",
150
+ "yes",
151
+ "force",
152
+ ],
153
+ upgrade: ["tag", "from", "yes", "force"],
154
+ "deep-scan": [
155
+ "recipe",
156
+ "default-branch",
157
+ "credential",
158
+ "credential-from",
159
+ "setup-minutes",
160
+ "scan-minutes",
161
+ "max-turns",
162
+ "max-tokens",
163
+ "model",
164
+ "effort",
165
+ "report",
166
+ "verify",
167
+ "ref",
168
+ ],
169
+ };
31
170
 
32
171
  /**
33
172
  * @param {string[]} argv
34
- * @param {{ cwd: string, stdout: (s: string) => void, stderr: (s: string) => void, runner?: import("./exec.mjs").Runner, openTag?: Function }} io
35
- * @returns {number} exit code
173
+ * @param {{
174
+ * cwd: string,
175
+ * stdout: (s: string) => void,
176
+ * stderr: (s: string) => void,
177
+ * runner?: import("./exec.mjs").Runner,
178
+ * spawn?: Function,
179
+ * spawnAsync?: Function,
180
+ * platform?: string,
181
+ * env?: Record<string, string | undefined>,
182
+ * fetch?: typeof globalThis.fetch,
183
+ * signals?: { on: Function, off: Function },
184
+ * reportDir?: string,
185
+ * modelApi?: string,
186
+ * timers?: { setTimeout: Function, clearTimeout: Function },
187
+ * openTag?: Function,
188
+ * openRepo?: Function,
189
+ * prompt?: ((question: string) => Promise<string>) | null,
190
+ * }} io `prompt` is null (or absent) when there is no terminal to ask on.
191
+ * Without `runner`, each command runs through its own allowlist
192
+ * (`runnerFor`); `spawn` and `spawnAsync` replace only the process
193
+ * boundary behind it. `platform`, `env`, `fetch`, `signals`, `reportDir`,
194
+ * `modelApi` and `timers` (default the host's, the real model API and
195
+ * the real clock) are for tests, never flags.
196
+ * @returns {Promise<number>} exit code
36
197
  */
37
- export function main(argv, io) {
38
- const { cwd, runner = systemRunner, openTag } = io;
39
- // Anything doctor prints can echo its arguments or file contents: sanitize every line.
198
+ export async function main(argv, io) {
199
+ const { cwd, openTag, openRepo, prompt = null } = io;
200
+ // Anything printed can echo arguments or file contents: sanitize every line.
40
201
  const clean = (text) => String(text).split("\n").map(sanitizeLine).join("\n");
41
202
  const stdout = (text) => io.stdout(clean(text));
42
203
  const stderr = (text) => io.stderr(clean(text));
@@ -50,6 +211,27 @@ export function main(argv, io) {
50
211
  ci: { type: "boolean" },
51
212
  strict: { type: "boolean" },
52
213
  repo: { type: "string" },
214
+ tag: { type: "string" },
215
+ from: { type: "string" },
216
+ flows: { type: "string" },
217
+ actors: { type: "string" },
218
+ "default-branch": { type: "string" },
219
+ verify: { type: "string" },
220
+ preset: { type: "string" },
221
+ "threat-pack-dir": { type: "string" },
222
+ recipe: { type: "string" },
223
+ credential: { type: "string" },
224
+ "credential-from": { type: "string" },
225
+ "setup-minutes": { type: "string" },
226
+ "scan-minutes": { type: "string" },
227
+ "max-turns": { type: "string" },
228
+ "max-tokens": { type: "string" },
229
+ model: { type: "string" },
230
+ effort: { type: "string" },
231
+ report: { type: "string" },
232
+ ref: { type: "string" },
233
+ yes: { type: "boolean", short: "y" },
234
+ force: { type: "boolean" },
53
235
  help: { type: "boolean", short: "h" },
54
236
  version: { type: "boolean", short: "v" },
55
237
  },
@@ -68,18 +250,86 @@ export function main(argv, io) {
68
250
  (command || values.help ? stdout : stderr)(USAGE);
69
251
  return values.help ? 0 : 2;
70
252
  }
71
- if (command === "init" || command === "upgrade") {
72
- stderr(`agent-kit ${command} is not available in ${VERSION} yet; it ships in a later release.`);
73
- return 2;
74
- }
75
- if (command !== "doctor") {
253
+ if (!Object.hasOwn(COMMAND_OPTIONS, command)) {
76
254
  stderr(`Unknown command: ${command}\n\n${USAGE}`);
77
255
  return 2;
78
256
  }
79
257
  if (rest.length) {
80
- stderr(`doctor takes no arguments, got: ${rest.join(" ")}`);
258
+ stderr(`${command} takes no arguments, got: ${rest.join(" ")}`);
259
+ return 2;
260
+ }
261
+ const foreign = Object.keys(values).filter(
262
+ (k) => k !== "help" && k !== "version" && !COMMAND_OPTIONS[command].includes(k),
263
+ );
264
+ if (foreign.length) {
265
+ stderr(`${command} does not take ${foreign.map((k) => `--${k}`).join(", ")}\n\n${USAGE}`);
81
266
  return 2;
82
267
  }
268
+ const runner =
269
+ io.runner ??
270
+ runnerFor(command, {
271
+ ...(io.spawn ? { spawn: io.spawn } : {}),
272
+ ...(io.spawnAsync ? { spawnAsync: io.spawnAsync } : {}),
273
+ });
274
+
275
+ if (command === "init") {
276
+ stdout(`agent-kit init ${VERSION}`);
277
+ return runInit({
278
+ cwd,
279
+ runner,
280
+ flags: {
281
+ tag: values.tag,
282
+ flows: values.flows,
283
+ actors: values.actors,
284
+ defaultBranch: values["default-branch"],
285
+ verify: values.verify,
286
+ preset: values.preset,
287
+ threatPackDir: values["threat-pack-dir"],
288
+ },
289
+ force: Boolean(values.force),
290
+ yes: Boolean(values.yes),
291
+ prompt,
292
+ confirm: prompt ? (q) => askYesNo(prompt, q) : null,
293
+ out: stdout,
294
+ err: stderr,
295
+ ...(openTag ? { openTag } : {}),
296
+ });
297
+ }
298
+ if (command === "deep-scan") {
299
+ stdout(`agent-kit deep-scan ${VERSION}`);
300
+ return runDeepScan({
301
+ cwd,
302
+ runner,
303
+ recipePath: values.recipe,
304
+ defaultBranch: values["default-branch"],
305
+ credential: values.credential,
306
+ credentialFrom: values["credential-from"],
307
+ model: values.model,
308
+ effort: values.effort,
309
+ reportPath: values.report,
310
+ verifyPath: values.verify,
311
+ ref: values.ref,
312
+ limitFlags: {
313
+ "setup-minutes": values["setup-minutes"],
314
+ "scan-minutes": values["scan-minutes"],
315
+ "max-turns": values["max-turns"],
316
+ "max-tokens": values["max-tokens"],
317
+ },
318
+ ...(io.platform !== undefined ? { platform: io.platform } : {}),
319
+ ...(io.env !== undefined ? { env: io.env } : {}),
320
+ ...(io.fetch !== undefined ? { fetch: io.fetch } : {}),
321
+ ...(io.signals !== undefined ? { signals: io.signals } : {}),
322
+ ...(io.reportDir !== undefined ? { reportDir: io.reportDir } : {}),
323
+ ...(io.modelApi !== undefined ? { modelApi: io.modelApi } : {}),
324
+ ...(io.timers !== undefined ? { timers: io.timers } : {}),
325
+ out: stdout,
326
+ err: stderr,
327
+ });
328
+ }
329
+ if (command === "upgrade") {
330
+ return upgrade(values, { cwd, runner, openRepo, prompt, stdout, stderr });
331
+ }
332
+
83
333
  if (values.repo !== undefined && !REPO_PATTERN.test(values.repo)) {
84
334
  stderr(`--repo must be owner/name, got: ${JSON.stringify(values.repo)}`);
85
335
  return 2;
@@ -95,3 +345,40 @@ export function main(argv, io) {
95
345
  stdout(formatReport(report, { version: VERSION }));
96
346
  return report.exitCode;
97
347
  }
348
+
349
+ async function upgrade(values, { cwd, runner, openRepo, prompt, stdout, stderr }) {
350
+ if (!prompt) {
351
+ // No terminal: every answer must come from a flag.
352
+ const needed = [];
353
+ if (values.tag === undefined) needed.push("--tag <vY>");
354
+ if (!values.yes) needed.push("--yes");
355
+ if (needed.length) {
356
+ stderr(`agent-kit upgrade: there is no terminal to ask on, so pass ${needed.join(" and ")}.`);
357
+ return 2;
358
+ }
359
+ }
360
+ let tag = values.tag;
361
+ if (tag === undefined) tag = await prompt("Agent-kit tag to upgrade to (for example v1.0.0): ");
362
+ if (values.from !== undefined && !isReleaseTag(values.from)) {
363
+ stderr(`--from must be a Release-line tag, got: ${JSON.stringify(values.from)}`);
364
+ return 2;
365
+ }
366
+ if (!isReleaseTag(tag)) {
367
+ stderr(
368
+ `--tag must be a Release-line tag (vX.Y.Z or vX.Y.Z-stage.N), got: ${JSON.stringify(tag)}`,
369
+ );
370
+ return 2;
371
+ }
372
+ stdout(`agent-kit upgrade ${VERSION}`);
373
+ return runUpgrade({
374
+ cwd,
375
+ runner,
376
+ tag,
377
+ from: values.from,
378
+ force: Boolean(values.force),
379
+ yes: Boolean(values.yes),
380
+ confirm: prompt ? (q) => askYesNo(prompt, q) : null,
381
+ out: stdout,
382
+ ...(openRepo ? { openRepo } : {}),
383
+ });
384
+ }