Skip to content

refactor(cli): move argv parsing, help and groups onto @cutils/cli 0.9.0 - #36

Merged
espetro merged 2 commits into
mainfrom
feat/cli-help-dx-090
Dec 2, 2026
Merged

espetro merged 2 commits into
mainfrom
feat/cli-help-dx-090

Conversation

@espetro

@espetro espetro commented Dec 2, 2026

Copy link
Copy Markdown
Owner

What

The 0.6.0 help work kept three local seams because @cutils/cli 0.8.1 could not express them: a sectioned help renderer, an argparse-style REMAINDER pre-split, and hand-rolled dispatch for the group verbs. @cutils/cli 0.9.0 adds ArgSpec.remainder, the sectioned help renderer and unknown-command suggestions, so all three are gone.

  • enqueue and run use library remainder args. A dash-leading command no longer needs --, and src/remainder.ts is deleted.
  • lease, agent, cap, dead and service are nested commands: trees. Each sub-verb is a node with its own args, options, help screen and handler, so ~430 lines of hand-rolled sub-verb parsing collapse into per-sub-verb nodes.
  • daemon joins the tree, so daemon --help answers without touching the running daemon.
  • src/help.ts and src/cli-spec.ts are deleted. The library renderer is the only one.
  • Numeric options are declared as str() and parsed in the handlers with optInt/optCount. The library seeds an absent int() option to 0, and 0 is a meaningful filter value for events --job, so seeding it would silently filter every row out.
  • run and enqueue handlers now return their promises. A void handler drops the promise, so the async work never ran.

Behavior changes

  • Unknown option wording is now the library's error: unknown option '--x'.
  • Unknown verb exits 1 with a did-you-mean block (coordinate statu points at status and stats).
  • <verb> --help exits 0 and prints the library's sectioned screen.

Verification

  • pnpm exec tsc --noEmit clean.
  • pnpm test: 276 pass, 1 fail. The failure is budget-lanes: default when no config, which is pre-existing and environmental: it leaks the host ~/.config/coordinate/config.toml [lanes] section into a test that does not set COORDINATE_CONFIG. It fails the same way on pristine origin/main.
  • pnpm lint: 0 errors, warnings only.

Release

Minor bump to 0.7.0, changeset included.

The 0.6.0 help work kept a local sectioned renderer, an argparse-style
REMAINDER pre-split and hand-rolled dispatch for the group verbs because
@cutils/cli 0.8.1 could not express them. 0.9.0 adds ArgSpec.remainder,
the sectioned help renderer and unknown-command suggestions, so all three
local seams are gone:

- enqueue and run use library remainder args; src/remainder.ts is deleted
  and dash-leading commands need no --.
- lease, agent, cap, dead and service become nested commands: trees; the
  ~430 lines of hand-rolled sub-verb parsing collapse into per-sub-verb
  nodes with their own options and help screens.
- daemon joins the tree so --help answers without touching the live
  daemon; src/help.ts and src/cli-spec.ts are deleted, the library
  renderer is the only one.
- numeric options are declared as strings and parsed in the handlers,
  because the library seeds an absent int() option to 0 and 0 is a
  meaningful filter value for events --job.
- the unknown-option wording and the --help exit-0 behavior change, so
  the surface tests and docs follow.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying coordinated with  Cloudflare Pages  Cloudflare Pages

Latest commit: bb8e933
Status: ✅  Deploy successful!
Preview URL: https://c4780353.coordinated.pages.dev
Branch Preview URL: https://feat-cli-help-dx-090.coordinated.pages.dev

View logs

@espetro
espetro merged commit 25a0681 into main Dec 2, 2026
6 checks passed
@espetro
espetro deleted the feat/cli-help-dx-090 branch December 2, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant