@duyquangnvx/agent-cli 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +76 -0
- package/README.md +2 -2
- package/agents-section.md +5 -0
- package/dist/agent-cli.d.ts +69 -11
- package/dist/agent-cli.js +69 -10
- package/dist/agent-cli.js.map +1 -1
- package/dist/built-ins/agents-md.d.ts +9 -9
- package/dist/built-ins/agents-md.js +8 -8
- package/dist/built-ins/agents-md.js.map +1 -1
- package/dist/built-ins/doctor-rows.js +5 -3
- package/dist/built-ins/doctor-rows.js.map +1 -1
- package/dist/built-ins/doctor.d.ts +1 -1
- package/dist/built-ins/doctor.js +16 -15
- package/dist/built-ins/doctor.js.map +1 -1
- package/dist/built-ins/install/dependency.js +1 -1
- package/dist/built-ins/install/dependency.js.map +1 -1
- package/dist/built-ins/install/global-npm.js +6 -4
- package/dist/built-ins/install/global-npm.js.map +1 -1
- package/dist/built-ins/npm.d.ts +3 -2
- package/dist/built-ins/npm.js +16 -9
- package/dist/built-ins/npm.js.map +1 -1
- package/dist/{project-root.js → built-ins/project-root.js} +1 -1
- package/dist/built-ins/project-root.js.map +1 -0
- package/dist/built-ins/skill/hub.d.ts +3 -2
- package/dist/built-ins/skill/hub.js +43 -16
- package/dist/built-ins/skill/hub.js.map +1 -1
- package/dist/built-ins/skill/install-command.d.ts +3 -4
- package/dist/built-ins/skill/install-command.js +20 -21
- package/dist/built-ins/skill/install-command.js.map +1 -1
- package/dist/built-ins/skill/packaged.js +5 -2
- package/dist/built-ins/skill/packaged.js.map +1 -1
- package/dist/built-ins/skill/skill.d.ts +5 -2
- package/dist/built-ins/skill/skill.js +1 -1
- package/dist/built-ins/skill/skill.js.map +1 -1
- package/dist/built-ins/update.d.ts +1 -1
- package/dist/built-ins/update.js +4 -9
- package/dist/built-ins/update.js.map +1 -1
- package/dist/check-examples.d.ts +6 -0
- package/dist/check-examples.js +53 -0
- package/dist/check-examples.js.map +1 -0
- package/dist/check-next-steps.d.ts +10 -0
- package/dist/check-next-steps.js +47 -0
- package/dist/check-next-steps.js.map +1 -0
- package/dist/command-errors.d.ts +8 -0
- package/dist/command-errors.js +25 -0
- package/dist/command-errors.js.map +1 -0
- package/dist/{flags.d.ts → command-line/flags.d.ts} +7 -4
- package/dist/{flags.js → command-line/flags.js} +8 -10
- package/dist/command-line/flags.js.map +1 -0
- package/dist/{input.d.ts → command-line/input.d.ts} +1 -1
- package/dist/{input.js → command-line/input.js} +1 -1
- package/dist/command-line/input.js.map +1 -0
- package/dist/{invocation.d.ts → command-line/invocation.d.ts} +6 -3
- package/dist/{invocation.js → command-line/invocation.js} +9 -5
- package/dist/command-line/invocation.js.map +1 -0
- package/dist/{parse-input.d.ts → command-line/parse-input.d.ts} +2 -2
- package/dist/{parse-input.js → command-line/parse-input.js} +3 -3
- package/dist/command-line/parse-input.js.map +1 -0
- package/dist/command-line/route-line.d.ts +15 -0
- package/dist/command-line/route-line.js +18 -0
- package/dist/command-line/route-line.js.map +1 -0
- package/dist/{route.d.ts → command-line/route.d.ts} +2 -2
- package/dist/{route.js → command-line/route.js} +1 -1
- package/dist/command-line/route.js.map +1 -0
- package/dist/command-line/shell-words.d.ts +12 -0
- package/dist/command-line/shell-words.js +83 -0
- package/dist/command-line/shell-words.js.map +1 -0
- package/dist/command-line/suggest.js.map +1 -0
- package/dist/command-line/tokenize.js.map +1 -0
- package/dist/{usage.d.ts → command-line/usage.d.ts} +1 -1
- package/dist/{usage.js → command-line/usage.js} +2 -2
- package/dist/command-line/usage.js.map +1 -0
- package/dist/command-spec.d.ts +13 -4
- package/dist/command-spec.js +22 -11
- package/dist/command-spec.js.map +1 -1
- package/dist/{agent.d.ts → context/agent.d.ts} +1 -1
- package/dist/context/agent.js.map +1 -0
- package/dist/{confirm.d.ts → context/confirm.d.ts} +3 -3
- package/dist/{confirm.js → context/confirm.js} +9 -11
- package/dist/context/confirm.js.map +1 -0
- package/dist/{cost.d.ts → context/cost.d.ts} +3 -3
- package/dist/context/cost.js +16 -0
- package/dist/context/cost.js.map +1 -0
- package/dist/context/declared.d.ts +8 -0
- package/dist/context/declared.js +10 -0
- package/dist/context/declared.js.map +1 -0
- package/dist/{errno.d.ts → context/errno.d.ts} +4 -3
- package/dist/{errno.js → context/errno.js} +14 -7
- package/dist/context/errno.js.map +1 -0
- package/dist/{files.js → context/files.js} +1 -1
- package/dist/context/files.js.map +1 -0
- package/dist/{interrupts.d.ts → context/interrupts.d.ts} +14 -10
- package/dist/{interrupts.js → context/interrupts.js} +30 -27
- package/dist/context/interrupts.js.map +1 -0
- package/dist/{operator.d.ts → context/operator.d.ts} +4 -3
- package/dist/{operator.js → context/operator.js} +4 -3
- package/dist/context/operator.js.map +1 -0
- package/dist/{outputs.d.ts → context/outputs.d.ts} +6 -5
- package/dist/{outputs.js → context/outputs.js} +10 -9
- package/dist/context/outputs.js.map +1 -0
- package/dist/{project.d.ts → context/project.d.ts} +4 -3
- package/dist/{project.js → context/project.js} +8 -7
- package/dist/context/project.js.map +1 -0
- package/dist/{secrets.d.ts → context/secrets.d.ts} +8 -1
- package/dist/context/secrets.js +85 -0
- package/dist/context/secrets.js.map +1 -0
- package/dist/{side-task.d.ts → context/side-task.d.ts} +2 -2
- package/dist/{side-task.js → context/side-task.js} +1 -1
- package/dist/context/side-task.js.map +1 -0
- package/dist/{spawn.d.ts → context/spawn.d.ts} +4 -3
- package/dist/{spawn.js → context/spawn.js} +7 -6
- package/dist/context/spawn.js.map +1 -0
- package/dist/{spill.d.ts → context/spill.d.ts} +4 -3
- package/dist/{spill.js → context/spill.js} +4 -4
- package/dist/context/spill.js.map +1 -0
- package/dist/{stdin.d.ts → context/stdin.d.ts} +2 -2
- package/dist/{stdin.js → context/stdin.js} +2 -2
- package/dist/context/stdin.js.map +1 -0
- package/dist/{tools.d.ts → context/tools.d.ts} +4 -3
- package/dist/{tools.js → context/tools.js} +8 -10
- package/dist/context/tools.js.map +1 -0
- package/dist/context.d.ts +51 -27
- package/dist/define-command.d.ts +47 -0
- package/dist/define-command.js +25 -0
- package/dist/define-command.js.map +1 -0
- package/dist/define.d.ts +81 -61
- package/dist/define.js +0 -14
- package/dist/define.js.map +1 -1
- package/dist/error-table.d.ts +9 -6
- package/dist/error-table.js +6 -6
- package/dist/error-table.js.map +1 -1
- package/dist/errors.d.ts +15 -1
- package/dist/errors.js +24 -6
- package/dist/errors.js.map +1 -1
- package/dist/execute.d.ts +8 -7
- package/dist/execute.js +52 -23
- package/dist/execute.js.map +1 -1
- package/dist/exit-classes.d.ts +1 -2
- package/dist/exit-classes.js +41 -48
- package/dist/exit-classes.js.map +1 -1
- package/dist/help-json.d.ts +4 -3
- package/dist/help-json.js +33 -11
- package/dist/help-json.js.map +1 -1
- package/dist/help.js +1 -0
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts +19 -26
- package/dist/index.js +6 -18
- package/dist/index.js.map +1 -1
- package/dist/list.d.ts +6 -5
- package/dist/list.js +17 -11
- package/dist/list.js.map +1 -1
- package/dist/next-step.d.ts +23 -0
- package/dist/next-step.js +20 -0
- package/dist/next-step.js.map +1 -0
- package/dist/output.d.ts +11 -5
- package/dist/output.js +25 -11
- package/dist/output.js.map +1 -1
- package/dist/root-spec.d.ts +5 -0
- package/dist/root-spec.js +15 -0
- package/dist/root-spec.js.map +1 -0
- package/dist/run-cli.d.ts +2 -2
- package/dist/run-cli.js +12 -11
- package/dist/run-cli.js.map +1 -1
- package/dist/run-command.d.ts +4 -4
- package/dist/run-command.js +66 -37
- package/dist/run-command.js.map +1 -1
- package/dist/run-options.d.ts +11 -4
- package/dist/run-process.js +22 -7
- package/dist/run-process.js.map +1 -1
- package/dist/runtime-codes.d.ts +33 -0
- package/dist/runtime-codes.js +50 -0
- package/dist/runtime-codes.js.map +1 -0
- package/dist/style.js +1 -1
- package/dist/style.js.map +1 -1
- package/dist/testing.d.ts +27 -0
- package/dist/testing.js +66 -0
- package/dist/testing.js.map +1 -0
- package/dist/version.d.ts +4 -1
- package/dist/version.js +6 -1
- package/dist/version.js.map +1 -1
- package/docs/README.md +51 -0
- package/docs/example/archive.test.ts +280 -0
- package/docs/example/archive.ts +160 -0
- package/docs/example/bin.test.ts +118 -0
- package/docs/example/bin.ts +5 -0
- package/docs/example/bundle.test.ts +57 -0
- package/docs/example/bundle.ts +57 -0
- package/docs/example/cli.test.ts +428 -0
- package/docs/example/cli.ts +191 -0
- package/docs/example/commit.test.ts +78 -0
- package/docs/example/commit.ts +26 -0
- package/docs/example/define.ts +16 -0
- package/docs/example/errors.ts +17 -0
- package/docs/example/export.test.ts +64 -0
- package/docs/example/export.ts +32 -0
- package/docs/example/fake-ports.ts +14 -0
- package/docs/example/folder.ts +48 -0
- package/docs/example/import.test.ts +53 -0
- package/docs/example/import.ts +50 -0
- package/docs/example/package.json +21 -0
- package/docs/example/ports.ts +105 -0
- package/docs/example/serve.test.ts +49 -0
- package/docs/example/serve.ts +40 -0
- package/docs/example/store.ts +62 -0
- package/docs/example/tsdown.config.ts +33 -0
- package/docs/getting-started.md +19 -0
- package/docs/guides/commands.md +35 -0
- package/docs/guides/doctor.md +52 -0
- package/docs/guides/effects-and-plans.md +44 -0
- package/docs/guides/errors.md +57 -0
- package/docs/guides/lists.md +18 -0
- package/docs/guides/local-state.md +28 -0
- package/docs/guides/long-runs.md +109 -0
- package/docs/guides/remote-services.md +124 -0
- package/docs/guides/shipping.md +61 -0
- package/docs/guides/testing.md +69 -0
- package/docs/principles.md +39 -0
- package/docs/reference.md +25 -0
- package/package.json +12 -1
- package/dist/agent.js.map +0 -1
- package/dist/confirm.js.map +0 -1
- package/dist/cost.js +0 -16
- package/dist/cost.js.map +0 -1
- package/dist/errno.js.map +0 -1
- package/dist/files.js.map +0 -1
- package/dist/flags.js.map +0 -1
- package/dist/input.js.map +0 -1
- package/dist/interrupts.js.map +0 -1
- package/dist/invocation.js.map +0 -1
- package/dist/operator.js.map +0 -1
- package/dist/outputs.js.map +0 -1
- package/dist/parse-input.js.map +0 -1
- package/dist/project-root.js.map +0 -1
- package/dist/project.js.map +0 -1
- package/dist/route.js.map +0 -1
- package/dist/secrets.js +0 -31
- package/dist/secrets.js.map +0 -1
- package/dist/side-task.js.map +0 -1
- package/dist/spawn.js.map +0 -1
- package/dist/spill.js.map +0 -1
- package/dist/stdin.js.map +0 -1
- package/dist/suggest.js.map +0 -1
- package/dist/tokenize.js.map +0 -1
- package/dist/tools.js.map +0 -1
- package/dist/usage.js.map +0 -1
- /package/dist/{project-root.d.ts → built-ins/project-root.d.ts} +0 -0
- /package/dist/{suggest.d.ts → command-line/suggest.d.ts} +0 -0
- /package/dist/{suggest.js → command-line/suggest.js} +0 -0
- /package/dist/{tokenize.d.ts → command-line/tokenize.d.ts} +0 -0
- /package/dist/{tokenize.js → command-line/tokenize.js} +0 -0
- /package/dist/{agent.js → context/agent.js} +0 -0
- /package/dist/{files.d.ts → context/files.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,82 @@ What changed in each release of `@duyquangnvx/agent-cli` (the Runtime) and `@duy
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## v0.18.0 (2026-10-28)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `render` and `renderPlan` are optional on every Command. Without `render`, text prints the data as [TOON](https://github.com/toon-format/toon), or nothing when there is none, and a List Command prints `page.items` that way before the page footer; without `renderPlan`, `--dry-run` prints `Would run <command line>:` and under it the Plan as TOON, indented two spaces, then `outputs` and `cost` as before. `--json` and `--fields` output are unchanged. The Scaffolder's `greet` declares no `render`, so it prints `greeting: "Hello, Ana!"`.
|
|
12
|
+
- A `CliError` takes `next`, an ordered list of Next steps beside its `hint`: each is the words after the CLI's name, such as `["archive", "--yes"]`, or `ctx.rerun({ remove?, add? })`, the caller's own line with each flag in `remove` dropped along with its value and the words in `add` placed before any `--`, keeping its `< <name file>` redirect. The Runtime builds each into a shell-quoted line starting with the Run-as. Text prints each on its own `run:` line after the hint; `--json` adds `next: string[]` to the error, absent when there are none, and each `AggregateError` leaf keeps its own. Under `runCli`, a Next step that names no Command or an unknown flag fails the run as a bug (exit 70) naming it; the built CLI does not check. `NextStep`, `Rerun` and `CommandLineChange` are exported, and the docs' example `links` gives its lines as Next steps.
|
|
13
|
+
- A second entry, `@duyquangnvx/agent-cli/testing`, exports `fakeClock({ busy?, onWake? })` to pass as `runCli`'s `clock`: its time moves only when every task waits on it, and waits for file reads and writes, so deadlines, `ctx.poll` and waits finish at once and in order. `busy` holds time while work Node cannot see is running; `onWake` runs as each sleep ends. The docs' example imports it.
|
|
14
|
+
- A Command and a CLI with several Commands take `secrets: [{ name, get }]`, `get` saying where to obtain the key. After the `tools` check and before `plan`, `run` or `start`, `--dry-run` included, a run whose declared Secret is unset in the environment and in the CLI's `.env` fails with the new Runtime code `SECRET_MISSING` (exit 2), naming every missing one with its `get` and the `.env` path. `doctor` gains a `secrets` row over the CLI's and every Command's Secrets, naming where each came from and never its value, and failing `doctor` for a missing one. Help JSON gives each Command `secrets: { name, get }[]`. The type `SecretDeclaration` is exported. The docs' example `links check` declares `LINKS_TOKEN`, which replaces its `token` row.
|
|
15
|
+
- `@duyquangnvx/agent-cli/testing` exports `checkExamples(cli)`. It checks every example of every Command, nested, single-command and Built-in alike: the line tokenizes as a POSIX shell would (a `< file` redirect allowed), starts with the CLI's name, routes to a Command, and passes that Command's schemas. It throws one error listing each example that does not, with the reason. The Scaffolder's test and the docs' example `links` test call it.
|
|
16
|
+
- `defineCli({ skill })` takes `{ page: "<https URL>" }`, the page of a Skill Hub where each user copies their own install line. `doctor`'s `skill` row then gives no fix for a missing copy or one that states no version, and its message names the page; `update` names it as a Notice. A copy older than the CLI still gets `npx -y skills update <name>`. `defineCli` throws on a page that is not an `https` URL.
|
|
17
|
+
- The Scaffolder's `--skill-hub-api` with `--skill-page` scaffolds a CLI on an API Skill Hub: `skillHub: { api }`, `skill: { page }`, and a README line naming the page. Either flag without the other is a usage error, `SKILL_PAGE_MISSING` or `SKILL_HUB_API_MISSING`, and passing both hub kinds is `SKILL_HOMES_CONFLICT`.
|
|
18
|
+
- `@duyquangnvx/agent-cli` ships its docs in `docs/`: an index, principles, getting started, a guide per topic, a map from each export to the `.d.ts` file that documents it, and the example `links` with its tests. Beside them, `agents-section.md` is the Agents section that points a repo's `AGENTS.md` at those docs, between `<!-- BEGIN:@duyquangnvx/agent-cli -->` and `<!-- END:@duyquangnvx/agent-cli -->`.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **Breaking:** a Command that declares `output` must return the schema's input type from `run`, `apply` or `start`, and its `render` receives the schema's output. Before printing, the Runtime parses returned and delivered data with the schema: data it rejects fails the run as a bug (exit 70) and prints no data, even when the Command caught an error around `ctx.deliver`, and its defaults and transforms show in what prints, under `--json` and in text. A Command without `output`, and a List Command's `rows`, are unchanged.
|
|
23
|
+
- **Breaking:** a Command no longer declares `name`, and declaring it fails type checking. The Runtime labels a Command by its path in `commands`: a declaration error names `voices list`, and a spilled file ends in `-voices-list`. A single-command CLI's Command takes the CLI's name. The checks that named a Command (a Standard flag name, `force`, an array arg, `orStdin`, a boolean array option) now throw from `defineCli` rather than `defineCommand`. The scaffolded template drops `name`.
|
|
24
|
+
- **Breaking:** `agentCli({ ports?, project?, errors? })` takes the ports factory, the Project file and the Error table as values, and `defineCli` no longer accepts them. `ctx.ports` is the type the factory returns and `ctx.project.settings` the Project file schema's output, so `agentCli` takes no type parameters; without `ports`, `ctx.ports` is empty. `agentCli` returns `cliError(code, init, options?)`, typed by the table, and the package no longer exports `cliError(table, code, init)`. An Error table that redeclares a Runtime code makes `agentCli` throw rather than `defineCli`. The scaffolded template and the Runtime's docs use the new form.
|
|
25
|
+
- **Breaking:** `ctx.timeout` is gone: `ctx.deadline(ms, { ignoreStop: true })` does what it did, aborting once `ms` have passed whether or not Ctrl-C or the run deadline stopped the run. The docs teach it for a billed call inside `runToEnd`.
|
|
26
|
+
- **Breaking:** the Runtime codes are no longer exported as loose constants (`INTERRUPTED`, `DEADLINE_EXCEEDED`, `PERMISSION_DENIED` and the rest); each is on the exported `runtimeCodes` object, as `runtimeCodes.INTERRUPTED`. The docs and their example use it.
|
|
27
|
+
- **Breaking:** `defineCli` takes `manifest`, the parsed `package.json`, in place of `name`, `version`, `description` and `engines`. The CLI's name is the manifest's `bin` key when it has exactly one, else the unscoped package name. `install` is `"global"`, `"dependency"` or `{ mode: "dependency", lockstep }`, its package being `manifest.name` and a Global install's registry `manifest.publishConfig.registry`; `defineCli` throws when a Global install's manifest lacks that registry. The new `CliManifest` and `InstallDeclaration` types are exported.
|
|
28
|
+
- **Breaking:** `defineCli` no longer takes `build`. The Runtime reads the build stamp from the `__AGENT_CLI_BUILD__` global the bundler defines, and without it, as in an unbundled run, `--version` prints no stamp. The scaffolded template drops `src/build.ts`, and its `tsdown.config.ts` defines `__AGENT_CLI_BUILD__` in place of `__BUILD__`.
|
|
29
|
+
- **Breaking:** `ctx.secret(name)` accepts only the names in the running Command's `secrets` and returns a `Secret`, never `undefined`; reading a name a Command does not declare, or reading any from a `doctor` row's `ctx`, fails type checking, and one reached past the type fails the run as a bug (exit 70), set or not. `PortsBase.secret` still takes any name and may return `undefined`.
|
|
30
|
+
- **Breaking:** an example starts with the CLI's name, and help and `--help --json` print it with that name replaced by the Run-as, so under a Dependency install it reads `npx -q --no-install <bin> ...`. An example already written with the Run-as prints as written and fails `checkExamples`. The Built-in Commands' examples and the scaffolded template's start with the bare name.
|
|
31
|
+
- **Breaking:** a Command declares the Error table codes it throws as `errors: [...]`, and help JSON gives each Command `errors: { code, class }[]`; a single-Command CLI's root `errors` keeps the Error table's shape but holds only the codes its Command declares. A run ending in a table code the running Command does not declare, directly or as an `AggregateError` leaf, fails as a bug (exit 70) naming the code and the Command, so a Command without `errors` may throw none of the table's codes; Runtime codes are never listed, and failures of `doctor` and its rows are not checked. `defineCli` throws on an `errors` entry the table lacks. The new `ctx.fail(code, init, options?)` returns a `CliError` for a declared code, typed by its `details`, for the Command to throw as `throw ctx.fail(...)`; `cliError` builds the same error for helpers outside a Command. The scaffolded template's `card` and the docs' example `links` declare their codes.
|
|
32
|
+
- `Context` and `ServeContext` take a third type parameter, the Command's `Needs` (`{ secretName, errors }`), which types `ctx.secret` and `ctx.fail`; `Needs` is exported. A helper that takes a plain `Context<Ports>` gets a `ctx` whose `secret` and `fail` accept nothing.
|
|
33
|
+
- **Breaking:** a Secret's name typed `string`, as one held in a plain `const` object is, fails type checking in `secrets`, since it would let `ctx.secret` take any name; a Command written inline in `defineCli` keeps its names literal.
|
|
34
|
+
- **Breaking:** the Runtime's failures during a run give their lines as Next steps, and their hints say when to run them without naming a line: `INTERRUPTED`, `DEADLINE_EXCEEDED` (from `ctx.deadline` and from a Command's `deadline`), `OUTPUT_EXISTS` and a guarded output's `ALREADY_EXISTS` (adding `--force`), `NOT_CONFIRMED` (adding `--yes`), `CONFIRMATION_REQUIRED` and `CONFIRMATION_MISMATCH` (with the right `--confirm`), `TOOL_MISSING` (each missing tool's `install`, then the rerun), `SECRET_MISSING`, `PROJECT_INVALID`, `NEEDS_OPERATOR`, and `PERMISSION_DENIED` and `DISK_FULL` where they asked for a rerun. The hints of `INTERRUPTED` and of a billed call's deadline still warn against running it blindly. A Command's `deadline.resume(input, rerun)` takes `ctx.rerun` in place of `ctx.commandLine` and returns a Next step, which the run's `DEADLINE_EXCEEDED` gives under the hint `run the Next step to continue the work`; returning a string fails type checking.
|
|
35
|
+
- **Breaking:** the Built-in Commands, `doctor` and List Command pages give their lines as Next steps. `update`'s `REGISTRY_UNREACHABLE`, `REGISTRY_AUTH`, `INSTALL_FAILED` and `NPM_FAILED` give the caller's line, their hints ending `then run it again`; `INSTALL_FAILED` then gives the `npm install --global` line, and `NOT_GLOBAL_INSTALL` gives it alone. A `doctor` problem with a fix gives the fix, then `doctor` as typed, under the hint `run the Next steps in order`. A rendered page ends `N shown; run the Next step for the next page` and a `run:` line in place of ``next page: `<line>` ``; the `--json` page's `next` is unchanged. The scaffolded template's `LANGUAGE_UNSUPPORTED` gives the English card as a Next step.
|
|
36
|
+
- `runCli`'s `env` is optional: without it the run sees an empty env, never the shell's. `cwd` stays required.
|
|
37
|
+
- The Runtime's docs and both READMEs teach Next steps, `secrets`, `errors`, `ctx.fail` and `checkExamples`, and the docs' "A Command is done when" checks them.
|
|
38
|
+
- The Runtime's docs, the README and the scaffolded `AGENTS.md` teach `render` as optional, `defineCli({ manifest, install })` and `runCli` without `env`; the docs' example `links check` prints its data as TOON, and its tests and the scaffolded test drop `env: {}`.
|
|
39
|
+
- **Breaking:** the Scaffolder's `--skill-hub` is now `--skill-hub-git`, which writes `skillHub: { git }` in `scripts/release.ts`. The scaffolded template is on `@duyquangnvx/release` 0.5.0 and awaits `release()`.
|
|
40
|
+
- **Breaking:** the agent-cli skill is no longer published to the Skill Hub; the docs the Runtime ships replace it. The scaffolded `AGENTS.md` ends with the Runtime's Agents section, and its `## Coding standards` no longer restates how to declare Commands, which the docs cover.
|
|
41
|
+
- `skill install`, `doctor`'s `agents` row and `skill install --help` call a Packaged skill's part of `AGENTS.md` its Agents section instead of its block.
|
|
42
|
+
|
|
43
|
+
### Removed
|
|
44
|
+
|
|
45
|
+
- **Breaking:** `ctx.commandLine` is gone; `ctx.rerun(change)` gives the caller's line, as a Next step.
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- Under `--json`, a Command that returns no data prints `null`, which is valid JSON, rather than `undefined`.
|
|
50
|
+
- A reader that closes stdout or stderr early, as `| head` does, no longer crashes the CLI with Node's `Unhandled 'error' event` stack and exit 1. The rest of that stream's output is dropped, the Command runs to its end, and the CLI exits with the run's own exit code.
|
|
51
|
+
|
|
52
|
+
### Upgrade from v0.17.0
|
|
53
|
+
|
|
54
|
+
Take these steps in order; `pnpm typecheck` finds every site the first eight leave behind.
|
|
55
|
+
|
|
56
|
+
1. In the module that calls `agentCli`, move `ports`, `project` and `errors` out of `defineCli` into that call and delete its type parameters: `agentCli<Ports, Settings>()` becomes `agentCli({ ports, project, errors })`. Export the `cliError` it returns beside `defineCommand` and `defineCli`, as the template's `src/cli.ts` and the docs' `example/define.ts` do.
|
|
57
|
+
2. Import `cliError` from that module wherever a Command throws, and drop its first argument: `cliError(errors, "CODE", init)` becomes `cliError("CODE", init)`.
|
|
58
|
+
3. In `defineCli`, replace `name`, `version`, `description` and `engines` with `manifest` (`import manifest from "../package.json" with { type: "json" }`), and replace the install object with `install: "global"`, `install: "dependency"`, or `{ mode: "dependency", lockstep }` with lockstep packages. A Global install's `package.json` needs `publishConfig.registry`.
|
|
59
|
+
4. Delete `src/build.ts` and the `build` line of `defineCli`, and in `tsdown.config.ts` rename the `define` key `__BUILD__` to `__AGENT_CLI_BUILD__`.
|
|
60
|
+
5. Delete `name` from every Command.
|
|
61
|
+
6. Replace each `ctx.timeout(ms)` with `ctx.deadline(ms, { ignoreStop: true })`.
|
|
62
|
+
7. Import `runtimeCodes` in place of each Runtime code constant, and write `runtimeCodes.CODE` where `CODE` stood.
|
|
63
|
+
8. Make each Command's `deadline.resume` return a Next step: `(_input, commandLine) => commandLine(change)` becomes `(_input, rerun) => rerun(change)`, and a line written by hand becomes the words after the CLI's name, such as `["archive", "--yes"]`.
|
|
64
|
+
9. Correct each Command whose data does not match its `output` schema: `pnpm typecheck` names those it can see, and `pnpm test` the rest, which now exit 70. An object schema strips keys it does not declare, so declare every key the data should print, or make the schema `z.looseObject`.
|
|
65
|
+
10. Under a Dependency install, start each Command's `examples` with the bare CLI name instead of `npx -q --no-install <bin>`, then call `checkExamples(cli)` from `@duyquangnvx/agent-cli/testing` in a test and fix each example it lists.
|
|
66
|
+
11. For each Command that calls `ctx.secret(name)`, add `secrets: [{ name, get }]` with the name inline, or its object declared `as const`, and drop its `undefined` branch, since the Runtime now fails the run first. Move a `doctor` row that only reports a key into the CLI's `secrets`; the `secrets` row reports it.
|
|
67
|
+
12. List in each Command's `errors` every code of the Error table it throws, those its helpers and ports throw included (a shared store's `CORRUPT_DATA` goes on every Command that reads the store), then run `pnpm test`: a code left out now exits 70 and names the Command. Inside a Command, `throw ctx.fail(code, init)` in place of `throw cliError(code, init)` makes an undeclared code a type error.
|
|
68
|
+
13. Move each command line out of a hint into the error's `next`: a line naming a Command becomes the words after the CLI's name, such as `["archive", "--yes"]`, and `ctx.commandLine(change)` becomes `ctx.rerun(change)`. Reword the hint to say whether and when to run the Next steps rather than quote them.
|
|
69
|
+
14. Update each test that asserts a line in a hint of the Runtime's, `doctor`'s or a Built-in Command's, or a rendered page's ``next page:`` line, to read the Next step instead: the error's `next` under `--json`, or its `run:` line in text.
|
|
70
|
+
15. Remove the agent-cli skill: `npx skills remove agent-cli -g`. Then append `node_modules/@duyquangnvx/agent-cli/agents-section.md` to the CLI repo's `AGENTS.md`, markers included, so sessions there find the Runtime's docs.
|
|
71
|
+
|
|
72
|
+
## v0.17.0 (2026-10-27)
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
|
|
76
|
+
- A fifth Effect, `act`, for a Command that changes the state of a program already running, such as a page in a browser tab, rather than files or remote services. It is declared as a read Command is, with `run` and the new `ActCommand` type, and cannot declare a Plan or `rows`. Its help says so and that running it again may act again, its `--help --json` gives `"effect": "act"`, and of the Standard flags it gets only `--json`. The agent-cli skill says when to pick `act` over `read` and `write`.
|
|
77
|
+
- The Scaffolder's `AGENTS.md` names the `act` and `serve` Effects beside `read`, `write` and `destructive`.
|
|
78
|
+
|
|
79
|
+
### Upgrade from v0.16.0
|
|
80
|
+
|
|
81
|
+
- Nothing to do.
|
|
82
|
+
|
|
7
83
|
## v0.16.0 (2026-10-27)
|
|
8
84
|
|
|
9
85
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @duyquangnvx/agent-cli
|
|
2
2
|
|
|
3
|
-
The Runtime for Agent CLIs: command-line tools whose main caller is an LLM coding agent. You declare Commands with Zod schemas. The Runtime does the parsing, help (as text and as `--help --json`), output, errors with hints, exit codes, `--dry-run` and `--confirm`, pagination, Ctrl-C and deadlines, and the built-in `doctor` and `update`.
|
|
3
|
+
The Runtime for Agent CLIs: command-line tools whose main caller is an LLM coding agent. You declare Commands with Zod schemas. The Runtime does the parsing, help (as text and as `--help --json`), output, errors with hints and Next steps, per-Command error codes and Secrets, exit codes, `--dry-run` and `--confirm`, pagination, Ctrl-C and deadlines, and the built-in `doctor` and `update`.
|
|
4
4
|
|
|
5
5
|
An Agent CLI bundles the Runtime, so install it as a devDependency next to `zod`. The fastest start is the Scaffolder:
|
|
6
6
|
|
|
@@ -8,4 +8,4 @@ An Agent CLI bundles the Runtime, so install it as a devDependency next to `zod`
|
|
|
8
8
|
pnpm create @duyquangnvx/agent-cli <name> --description "One line saying what it does"
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The full guide ships in this package, under `docs/`: once the Runtime is installed, a Coding agent reads `node_modules/@duyquangnvx/agent-cli/docs/README.md`, which always describes the installed version. A scaffolded CLI's `AGENTS.md` already points there; in a repo created another way, append [`agents-section.md`](agents-section.md) to `AGENTS.md`. The [repository](https://github.com/duyquangnvx/cli-for-agent) has an overview.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<!-- BEGIN:@duyquangnvx/agent-cli -->
|
|
2
|
+
## agent-cli
|
|
3
|
+
|
|
4
|
+
This CLI is built on `@duyquangnvx/agent-cli`, the Runtime. Before you change a Command, a `doctor` row, a test or the release, read `node_modules/@duyquangnvx/agent-cli/docs/README.md` and the pages it names: they describe the installed version, which your training data likely predates.
|
|
5
|
+
<!-- END:@duyquangnvx/agent-cli -->
|
package/dist/agent-cli.d.ts
CHANGED
|
@@ -1,17 +1,75 @@
|
|
|
1
|
-
import { type Cli, type CommandTreeCli, type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
1
|
+
import { type Cli, type CommandTreeCli, type NoPorts, type SingleCommandCli } from "./define.js";
|
|
2
|
+
import { type DefineCommand } from "./define-command.js";
|
|
3
|
+
import { type CliErrorInit, type ErrorTable } from "./error-table.js";
|
|
4
|
+
import type { CliError } from "./errors.js";
|
|
5
|
+
type BoundField = "ports" | "project" | "errors";
|
|
6
|
+
type ManifestField = "name" | "version" | "description" | "engines" | "install";
|
|
7
|
+
/** The fields of the CLI's `package.json` that `defineCli` reads. */
|
|
8
|
+
export interface CliManifest {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly version: string;
|
|
11
|
+
/** One line saying what the CLI does, shown under the first line of its help and in help JSON. */
|
|
12
|
+
readonly description: string;
|
|
13
|
+
/** Its only key names the CLI; otherwise the unscoped package name does. */
|
|
14
|
+
readonly bin?: string | Readonly<Record<string, string>> | undefined;
|
|
15
|
+
/** `doctor` checks `node` when it is `>=X[.Y[.Z]]`. */
|
|
16
|
+
readonly engines?: {
|
|
17
|
+
readonly node?: string;
|
|
18
|
+
} | undefined;
|
|
19
|
+
readonly publishConfig?: {
|
|
20
|
+
readonly registry?: string;
|
|
21
|
+
} | undefined;
|
|
22
|
+
}
|
|
23
|
+
export type InstallDeclaration = "global" | "dependency" | {
|
|
24
|
+
readonly mode: "dependency";
|
|
25
|
+
readonly lockstep: readonly string[];
|
|
26
|
+
};
|
|
27
|
+
interface FromManifest {
|
|
28
|
+
/**
|
|
29
|
+
* The CLI's `package.json`, imported `with { type: "json" }`: it gives the CLI's name, version,
|
|
30
|
+
* description and, for a CLI with several Commands, the `engines` that `doctor` checks.
|
|
31
|
+
*/
|
|
32
|
+
readonly manifest: CliManifest;
|
|
33
|
+
}
|
|
34
|
+
type Unbound = {
|
|
35
|
+
readonly [Field in BoundField]?: never;
|
|
6
36
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
37
|
+
/** What `defineCli` takes for a CLI whose Commands are reached by name. */
|
|
38
|
+
interface CommandTreeCliDeclaration<Ports, Settings> extends Omit<CommandTreeCli<Ports, Settings>, BoundField | ManifestField>, FromManifest, Unbound {
|
|
39
|
+
/**
|
|
40
|
+
* How the CLI is installed, its package being `manifest.name`: `"global"` once per machine from
|
|
41
|
+
* `manifest.publishConfig.registry`, `"dependency"` per project, with `lockstep` naming packages
|
|
42
|
+
* released at the same version. Absent for a CLI that is not published.
|
|
43
|
+
*/
|
|
44
|
+
readonly install?: InstallDeclaration;
|
|
45
|
+
}
|
|
46
|
+
/** What `defineCli` takes for a CLI that is one Command. */
|
|
47
|
+
interface SingleCommandCliDeclaration<Ports, Settings> extends Omit<SingleCommandCli<Ports, Settings>, BoundField | ManifestField>, FromManifest, Unbound {
|
|
48
|
+
readonly install?: never;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* What `defineCli` takes: a Cli without what `agentCli` holds (`ports`, `project`, `errors`) or what
|
|
52
|
+
* the `manifest` gives.
|
|
53
|
+
*/
|
|
54
|
+
export type CliDeclaration<Ports, Settings> = CommandTreeCliDeclaration<Ports, Settings> | SingleCommandCliDeclaration<Ports, Settings>;
|
|
55
|
+
/** What `agentCli` takes once, so that every Command and the CLI are typed by it. */
|
|
56
|
+
export interface AgentCliValues<Ports, Settings, Table extends ErrorTable> extends Pick<CommandTreeCli<Ports, Settings>, BoundField> {
|
|
57
|
+
readonly errors?: Table;
|
|
58
|
+
}
|
|
59
|
+
export interface AgentCli<Ports, Settings, Table extends ErrorTable> {
|
|
60
|
+
readonly defineCommand: DefineCommand<Ports, Settings, Table>;
|
|
10
61
|
defineCli(cli: CliDeclaration<Ports, Settings>): Cli<Ports, Settings>;
|
|
62
|
+
/**
|
|
63
|
+
* A `CliError` for a code of the Error table, whose `details` must match the code's schema.
|
|
64
|
+
* `next` lists the Next steps in order, each the words after the CLI's name or `ctx.rerun()`; the
|
|
65
|
+
* `hint` says whether and when to run them. `retryAt` (ISO 8601) is allowed only on a wait-class
|
|
66
|
+
* code.
|
|
67
|
+
*/
|
|
68
|
+
cliError<Code extends keyof Table & string>(code: Code, init: CliErrorInit<Table[Code]>, options?: ErrorOptions): CliError;
|
|
11
69
|
}
|
|
12
70
|
/**
|
|
13
|
-
*
|
|
14
|
-
* `defineCli` it returns
|
|
71
|
+
* Takes the CLI's ports factory, Project file and Error table once; the `defineCommand`,
|
|
72
|
+
* `defineCli` and `cliError` it returns are typed by them.
|
|
15
73
|
*/
|
|
16
|
-
export declare function agentCli<Ports = NoPorts, Settings = unknown>
|
|
74
|
+
export declare function agentCli<Ports = NoPorts, Settings = unknown, const Table extends ErrorTable = Record<never, never>>(values?: AgentCliValues<Ports, Settings, Table>): AgentCli<Ports, Settings, Table>;
|
|
17
75
|
export {};
|
package/dist/agent-cli.js
CHANGED
|
@@ -1,34 +1,93 @@
|
|
|
1
1
|
import { builtInCommands } from "./built-ins/commands.js";
|
|
2
2
|
import { installOf } from "./built-ins/install/install.js";
|
|
3
3
|
import { skillOf } from "./built-ins/skill/skill.js";
|
|
4
|
-
import {
|
|
4
|
+
import { commandLabel } from "./command-spec.js";
|
|
5
|
+
import { isCommand, } from "./define.js";
|
|
6
|
+
import { checkCommand, defineCommandFor } from "./define-command.js";
|
|
7
|
+
import { cliErrorOf, errorTableOf } from "./error-table.js";
|
|
5
8
|
import { runtimeCodesIn } from "./exit-classes.js";
|
|
6
|
-
function checkOwnCodes(
|
|
7
|
-
const redeclared = runtimeCodesIn(
|
|
9
|
+
function checkOwnCodes(errors) {
|
|
10
|
+
const redeclared = runtimeCodesIn(errors);
|
|
8
11
|
if (redeclared.length > 0) {
|
|
9
|
-
throw new Error(
|
|
12
|
+
throw new Error(`The Error table declares ${redeclared.join(", ")}, an error code the Runtime already declares`);
|
|
10
13
|
}
|
|
11
14
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
15
|
+
function checkTree(commands, path, table) {
|
|
16
|
+
for (const [key, node] of Object.entries(commands)) {
|
|
17
|
+
const at = [...path, key];
|
|
18
|
+
if (isCommand(node))
|
|
19
|
+
checkCommand(node, at.join(" "), table);
|
|
20
|
+
else
|
|
21
|
+
checkTree(node, at, table);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function checkSkillPage({ name, skill }) {
|
|
25
|
+
if (skill === undefined || !("page" in skill))
|
|
26
|
+
return;
|
|
27
|
+
if (!URL.canParse(skill.page) || new URL(skill.page).protocol !== "https:") {
|
|
28
|
+
throw new Error(`${name} declares skill.page ${skill.page}, which is not an https URL`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function checkCli(cli) {
|
|
32
|
+
const table = errorTableOf(cli);
|
|
33
|
+
checkSkillPage(cli);
|
|
14
34
|
if (cli.commands === undefined) {
|
|
35
|
+
checkCommand(cli.command, commandLabel([], cli.name).join(" "), table);
|
|
15
36
|
if (skillOf(cli, installOf(cli)).kind === "packaged") {
|
|
16
37
|
throw new Error(`${cli.name} declares a Packaged skill, which only a CLI with several Commands can install`);
|
|
17
38
|
}
|
|
18
39
|
return cli;
|
|
19
40
|
}
|
|
20
41
|
const { commands } = cli;
|
|
42
|
+
checkTree(commands, [], table);
|
|
21
43
|
const taken = Object.keys(builtInCommands(cli, { bin: undefined, node: undefined })).filter((name) => commands[name] !== undefined);
|
|
22
44
|
if (taken.length > 0) {
|
|
23
45
|
throw new Error(`${cli.name} defines ${taken.join(", ")}, a built-in Command it cannot replace`);
|
|
24
46
|
}
|
|
25
47
|
return cli;
|
|
26
48
|
}
|
|
49
|
+
function nameOf({ name, bin }) {
|
|
50
|
+
const bins = typeof bin === "object" ? Object.keys(bin) : [];
|
|
51
|
+
const [only] = bins;
|
|
52
|
+
return bins.length === 1 && only !== undefined ? only : name.replace(/^@[^/]+\//, "");
|
|
53
|
+
}
|
|
54
|
+
function installFrom(name, manifest, install) {
|
|
55
|
+
if (install === "dependency")
|
|
56
|
+
return { mode: "dependency", package: manifest.name };
|
|
57
|
+
if (install !== "global") {
|
|
58
|
+
return { mode: "dependency", package: manifest.name, lockstep: install.lockstep };
|
|
59
|
+
}
|
|
60
|
+
const registry = manifest.publishConfig?.registry;
|
|
61
|
+
if (registry === undefined) {
|
|
62
|
+
throw new Error(`${name} declares a Global install, which needs publishConfig.registry in its package.json`);
|
|
63
|
+
}
|
|
64
|
+
return { mode: "global", package: manifest.name, registry };
|
|
65
|
+
}
|
|
66
|
+
function resolved(cli) {
|
|
67
|
+
const { manifest, ...declared } = cli;
|
|
68
|
+
const name = nameOf(manifest);
|
|
69
|
+
const about = { name, version: manifest.version, description: manifest.description };
|
|
70
|
+
if (declared.commands === undefined)
|
|
71
|
+
return { ...declared, ...about };
|
|
72
|
+
const { install, ...rest } = declared;
|
|
73
|
+
return {
|
|
74
|
+
...rest,
|
|
75
|
+
...about,
|
|
76
|
+
...(manifest.engines === undefined ? {} : { engines: manifest.engines }),
|
|
77
|
+
...(install === undefined ? {} : { install: installFrom(name, manifest, install) }),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
27
80
|
/**
|
|
28
|
-
*
|
|
29
|
-
* `defineCli` it returns
|
|
81
|
+
* Takes the CLI's ports factory, Project file and Error table once; the `defineCommand`,
|
|
82
|
+
* `defineCli` and `cliError` it returns are typed by them.
|
|
30
83
|
*/
|
|
31
|
-
export function agentCli() {
|
|
32
|
-
|
|
84
|
+
export function agentCli(values = {}) {
|
|
85
|
+
checkOwnCodes(errorTableOf(values));
|
|
86
|
+
return {
|
|
87
|
+
defineCommand: defineCommandFor(),
|
|
88
|
+
// The declaration's type has no bound fields, so spreading the values completes a Cli.
|
|
89
|
+
defineCli: (cli) => checkCli({ ...resolved(cli), ...values }),
|
|
90
|
+
cliError: cliErrorOf,
|
|
91
|
+
};
|
|
33
92
|
}
|
|
34
93
|
//# sourceMappingURL=agent-cli.js.map
|
package/dist/agent-cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-cli.js","sourceRoot":"","sources":["../src/agent-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4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;QAC7D,QAAQ,EAAE,UAAU;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { DoctorCheck } from "../define.js";
|
|
2
2
|
import type { Install } from "./install/install.js";
|
|
3
|
-
export interface
|
|
3
|
+
export interface AgentsSection {
|
|
4
4
|
readonly name: string;
|
|
5
5
|
readonly text: string;
|
|
6
6
|
}
|
|
7
|
-
export type
|
|
8
|
-
/** The CLI's
|
|
7
|
+
export type SectionChange = "create" | "add" | "rewrite";
|
|
8
|
+
/** The CLI's Agents section in the project root's AGENTS.md, and what `skill install` would do to it. */
|
|
9
9
|
export interface AgentsMd {
|
|
10
10
|
readonly path: string;
|
|
11
|
-
readonly agents:
|
|
12
|
-
readonly change:
|
|
11
|
+
readonly agents: AgentsSection;
|
|
12
|
+
readonly change: SectionChange | null;
|
|
13
13
|
}
|
|
14
|
-
/** `text` with the CLI's
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function agentsMdAt(agents:
|
|
14
|
+
/** `text` with the CLI's Agents section between its markers, appended when they are missing; nothing else changes. */
|
|
15
|
+
export declare function withSection({ name, text: section }: AgentsSection, text: string): string;
|
|
16
|
+
export declare function agentsMdAt(agents: AgentsSection, root: string): Promise<AgentsMd>;
|
|
17
17
|
export declare function handEditsAt(root: string): Promise<string[]>;
|
|
18
|
-
export declare function agentsRow(agents:
|
|
18
|
+
export declare function agentsRow(agents: AgentsSection, install: Install): DoctorCheck;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { orMissing } from "../errors.js";
|
|
4
|
-
import { projectRootOf } from "
|
|
4
|
+
import { projectRootOf } from "./project-root.js";
|
|
5
5
|
function markersOf(name) {
|
|
6
6
|
return { begin: `<!-- BEGIN:${name} -->`, end: `<!-- END:${name} -->` };
|
|
7
7
|
}
|
|
8
|
-
/** `text` with the CLI's
|
|
9
|
-
export function
|
|
8
|
+
/** `text` with the CLI's Agents section between its markers, appended when they are missing; nothing else changes. */
|
|
9
|
+
export function withSection({ name, text: section }, text) {
|
|
10
10
|
const { begin, end } = markersOf(name);
|
|
11
|
-
const whole = `${begin}\n${
|
|
11
|
+
const whole = `${begin}\n${section}\n${end}`;
|
|
12
12
|
const start = text.indexOf(begin);
|
|
13
13
|
const stop = start === -1 ? -1 : text.indexOf(end, start);
|
|
14
14
|
if (stop !== -1)
|
|
@@ -22,7 +22,7 @@ export async function agentsMdAt(agents, root) {
|
|
|
22
22
|
const existing = await orMissing(readFile(path, "utf8"));
|
|
23
23
|
if (existing === undefined)
|
|
24
24
|
return { path, agents, change: "create" };
|
|
25
|
-
if (
|
|
25
|
+
if (withSection(agents, existing) === existing)
|
|
26
26
|
return { path, agents, change: null };
|
|
27
27
|
return {
|
|
28
28
|
path,
|
|
@@ -52,18 +52,18 @@ export function agentsRow(agents, install) {
|
|
|
52
52
|
if (change === "rewrite") {
|
|
53
53
|
return {
|
|
54
54
|
state: "problem",
|
|
55
|
-
message: `${path} holds a ${name}
|
|
55
|
+
message: `${path} holds a ${name} Agents section other than the one ${fix} writes`,
|
|
56
56
|
fix,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
if (change !== null) {
|
|
60
60
|
return {
|
|
61
61
|
state: "problem",
|
|
62
|
-
message: `${path} holds no ${name}
|
|
62
|
+
message: `${path} holds no ${name} Agents section, so sessions in this repo do not know ${name}`,
|
|
63
63
|
fix,
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
const holds = `${path} holds the ${name}
|
|
66
|
+
const holds = `${path} holds the ${name} Agents section`;
|
|
67
67
|
const [edit] = await handEditsAt(root);
|
|
68
68
|
return edit === undefined
|
|
69
69
|
? { state: "ok", message: holds }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../../src/built-ins/agents-md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MA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AAO,EAAE,GAAG,KAAK,KAAK,IAAI,EAAE,EAAE,CAAC;QACzD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { projectOf } from "../context/project.js";
|
|
3
|
+
import { secretRows } from "../context/secrets.js";
|
|
4
|
+
import { toolRows } from "../context/tools.js";
|
|
2
5
|
import { CliError, messageOf } from "../errors.js";
|
|
3
|
-
import { projectOf } from "../project.js";
|
|
4
|
-
import { toolRows } from "../tools.js";
|
|
5
6
|
import { versionLine } from "../version.js";
|
|
6
7
|
import { installOf } from "./install/install.js";
|
|
7
8
|
import { latestVersion } from "./npm.js";
|
|
@@ -57,7 +58,7 @@ export function readProject(projectFile, ctx) {
|
|
|
57
58
|
ok: true,
|
|
58
59
|
project: projectOf(projectFile, ctx.cwd, {
|
|
59
60
|
fileError: ctx.fileError,
|
|
60
|
-
|
|
61
|
+
rerun: ctx.rerun(),
|
|
61
62
|
}),
|
|
62
63
|
};
|
|
63
64
|
}
|
|
@@ -114,6 +115,7 @@ export function doctorChecks(cli, launch, read) {
|
|
|
114
115
|
...(cli.project === undefined ? [] : [projectRow(cli.project, read)]),
|
|
115
116
|
...(cli.doctor ?? []),
|
|
116
117
|
...toolRows(cli.tools ?? [], cli.commands),
|
|
118
|
+
...secretRows(cli.secrets ?? [], cli.commands),
|
|
117
119
|
installRow(check),
|
|
118
120
|
registryRow(cli, check),
|
|
119
121
|
...skillOf(cli, install).rows,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor-rows.js","sourceRoot":"","sources":["../../src/built-ins/doctor-rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"doctor-rows.js","sourceRoot":"","sources":["../../src/built-ins/doctor-rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;A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U,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QACrE,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC;QACrB,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,EAAE,GAAG,CAAC,QAAQ,CAAC;QAC1C,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,GAAG,CAAC,QAAQ,CAAC;QAC9C,UAAU,CAAC,KAAK,CAAC;QACjB,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC;QACvB,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Command, CommandTreeCli } from "../define.js";
|
|
2
2
|
import type { Launch } from "./commands.js";
|
|
3
3
|
export declare const DOCTOR_PROBLEMS = "DOCTOR_PROBLEMS";
|
|
4
4
|
/** The built-in `doctor`: the fixed rows around the CLI's own, each under its own deadline. */
|
package/dist/built-ins/doctor.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { untilAborted } from "../abort.js";
|
|
3
|
-
import { defineCommand
|
|
4
|
-
import {
|
|
3
|
+
import { defineCommand } from "../define-command.js";
|
|
4
|
+
import { runtimeError } from "../errors.js";
|
|
5
|
+
import { wholeLine } from "../next-step.js";
|
|
5
6
|
import { doctorChecks, problemOfError, readProject } from "./doctor-rows.js";
|
|
6
|
-
import { runAsOf } from "./install/run-as.js";
|
|
7
7
|
import { packagedSkillDetailsSchema } from "./skill/packaged.js";
|
|
8
8
|
export const DOCTOR_PROBLEMS = "DOCTOR_PROBLEMS";
|
|
9
9
|
const DEFAULT_DEADLINE_MS = 10_000;
|
|
@@ -79,27 +79,28 @@ function render({ rows, next }, style) {
|
|
|
79
79
|
return [...lines, ...next.map((fix) => `${"next".padEnd(width)}${fix}`)].join("\n");
|
|
80
80
|
}
|
|
81
81
|
// One error per problem row, so the exit follows the class that must act first (ADR 0005).
|
|
82
|
-
function failure(cliName,
|
|
83
|
-
const errors = problems.map(({ check, message, fix, code }) =>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
function failure(cliName, rerun, problems) {
|
|
83
|
+
const errors = problems.map(({ check, message, fix, code }) => {
|
|
84
|
+
const head = {
|
|
85
|
+
code: code ?? DOCTOR_PROBLEMS,
|
|
86
|
+
message: `${cliName} doctor found a problem in ${check}: ${message}`,
|
|
87
|
+
};
|
|
88
|
+
return runtimeError(fix === undefined
|
|
89
|
+
? { ...head, hint: "the row says what is wrong", next: [] }
|
|
90
|
+
: { ...head, hint: "run the Next steps in order", next: [wholeLine(fix), rerun] });
|
|
91
|
+
});
|
|
90
92
|
return new AggregateError(errors);
|
|
91
93
|
}
|
|
92
94
|
/** The built-in `doctor`: the fixed rows around the CLI's own, each under its own deadline. */
|
|
93
95
|
export function doctorCommand(cli, launch) {
|
|
94
96
|
return defineCommand({
|
|
95
|
-
name: "doctor",
|
|
96
97
|
description: "check the setup and say what fixes each problem",
|
|
97
98
|
examples: [
|
|
98
99
|
{
|
|
99
|
-
command: `${
|
|
100
|
+
command: `${cli.name} doctor`,
|
|
100
101
|
note: "check the setup and list the commands that fix it",
|
|
101
102
|
},
|
|
102
|
-
{ command: `${
|
|
103
|
+
{ command: `${cli.name} doctor --json`, note: "get the rows and fixes as data" },
|
|
103
104
|
],
|
|
104
105
|
effect: "read",
|
|
105
106
|
output: reportSchema,
|
|
@@ -118,7 +119,7 @@ export function doctorCommand(cli, launch) {
|
|
|
118
119
|
.map(({ row }) => row);
|
|
119
120
|
if (problems.length > 0) {
|
|
120
121
|
ctx.deliver(report);
|
|
121
|
-
throw failure(cli.name, ctx.
|
|
122
|
+
throw failure(cli.name, ctx.rerun(), problems);
|
|
122
123
|
}
|
|
123
124
|
return report;
|
|
124
125
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/built-ins/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/built-ins/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAc,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAoB,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjE,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEjD,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,KAAK,EAAE,0BAA0B,CAAC,QAAQ,EAAE;CAC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AAC,CAAC;YAC3D,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5C,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACvB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACpB,GAAG,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YAC9B,CAAC;YACD,MAAM,QAAQ,GAAG,OAAO;iBACrB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC;iBACnE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;YACzB,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACpB,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC;YACjD,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -2,8 +2,8 @@ import { readFile, realpath } from "node:fs/promises";
|
|
|
2
2
|
import { join, sep } from "node:path";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { messageOf, orMissing } from "../../errors.js";
|
|
5
|
-
import { ancestorsOf, exists, isInside, lockfileRootOf, manifestIn, } from "../../project-root.js";
|
|
6
5
|
import { npmContext, scopeOf } from "../npm.js";
|
|
6
|
+
import { ancestorsOf, exists, isInside, lockfileRootOf, manifestIn, } from "../project-root.js";
|
|
7
7
|
import { runAsOf } from "./run-as.js";
|
|
8
8
|
// Both upgrades keep a devDependency under devDependencies (npm 12.2, pnpm 12.14). pnpm keeps the pin's style; npm writes the range its save-exact config asks for.
|
|
9
9
|
const LINES = {
|