JavaScript/TypeScript implementation of the CLI Schema specification — the open standard for describing command-line interfaces.
This monorepo publishes three packages:
| Package | Description |
|---|---|
@cli-schema/spec |
The format itself: TypeScript types, the vendored meta-schema, a validator, and shared pure helpers (e.g. inferIntentFromHttp). No CLI-framework dependency. |
@cli-schema/zod |
Derives CLI parameter definitions from Zod schemas — types, requiredness, defaults, descriptions, enum/validation constraints. |
@cli-schema/commander |
Generates a CLI Schema document from a live Commander command tree. Adds chainable .intent() / .input() / .cliMeta() to Command via an opt-in module augmentation, then discovers commands, options, and positionals dynamically by walking the tree. |
Draft — tracks specification v1 (draft). Breaking changes may occur before both the spec and these packages reach 1.0.0.
npm install
npm run build
npm test
npm run lintVersioning is lockstep across the three packages and lives entirely in git tags — there are no committed version-bump commits.
- Merged PRs update a draft GitHub Release automatically (
.github/workflows/release-drafter.yml), with the next version computed from PR labels (breaking→ major,feature/enhancement→ minor, else patch; see.github/release-drafter.yml). - Manually running the Release workflow (
.github/workflows/release.yml,workflow_dispatch) publishes that draft, which creates the tag, then publishes all three packages to npm.
Publishing uses npm's Trusted Publishers (OIDC via a
GitHub Actions environment) — no NPM_TOKEN secret. Before the first release, each of
@cli-schema/spec, @cli-schema/zod, and @cli-schema/commander must be configured on
npmjs.com to trust this repository, the release.yml workflow, and the npm-publish environment
(npmjs.com → package → Settings → Publishing access → Trusted Publisher). A package that
has never been published yet must be created with one manual npm publish first — npm has
nothing to attach the trust relationship to otherwise.
MIT