Repository navigation
fix(cli): name .mts, DESIGN.md and inspect --format in --help, and reject an unknown inspect format - #261
Merged
dgesteves merged 1 commit intoOct 30, 2026
Conversation
…ject an unknown inspect format `--help` was behind the code in three places: `--config` left out onsystem.config.mts, `--tokens` left out a DESIGN.md, and `--format` listed values for check and export only, though `inspect --format json` works and docs/cli.md documents it. `inspect` also took any format: `--format xml` printed the pretty output and exited 0, where check and export exit 2. It is checked before the project is loaded, so a monorepo root is covered too. With inspect named in `--help`, no option is beyond it any more, so BEYOND_HELP and the assertion it skipped are gone from the docs test. Closes dgesteves#222
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #222.
What
Three help lines were behind the code, and
inspectaccepted any--format.--help--configonsystem.config.{json,ts,mjs,js}onsystem.config.{json,ts,mts,js,mjs}--tokensToken file (DTCG .json or CSS)Token file (DTCG .json, CSS or DESIGN.md)--formatcheck:andexport:onlyinspect: pretty | json (default: pretty)addedAll three were already right in
docs/cli.md;--helpwas the one lagging.inspect --formatinspectonly looked forjson, so--format xml(or a typo) printed the pretty output and exited 0, wherecheckandexportexit 2. A script that asked for JSON and got text read it as a design system with nothing in it. It now exits 2 with one line incheck's style:The check sits at the top of
inspect(), beforeloadTarget, as the issue's hint suggests, so the monorepo root thatinspectWorkspacehandles is covered by the same four lines.Tests
test/cli.test.ts:--helpnames every extension inCONFIG_FILES(compared as a set, parsed out of the brace list, sojscannot pass by being a substring ofjson); the usage-error test coversinspect --format xml; and a new case asserts exit 2, the one-line message and empty stdout both in a project and at a monorepo root (pnpm-workspace.yaml+appIn). Reverted against the fix, all three fail.test/cli-docs.test.ts:--format's commands are nowcheck, inspect, export. Withinspectnamed in--help,BEYOND_HELP— the escape hatch for an option--helpdoes not name for a command — had no entries left, so it and the assertion it skipped are gone; that assertion now runs for theinspect --formatrow. The test that runsinspect --format jsonkeeps doing so, under a title that no longer says--helpomits it.Docs
docs/cli.mdneeded one row:inspect's--formatnow namesprettyas the default alongsidejsonand says another value exits 2, since that behaviour is new.docs/configuration.mdis untouched, as the issue asks.Checks
pnpm lint,pnpm format:check,pnpm typecheck,pnpm build,pnpm smokeandpnpm test(1428 passed, 3 skipped) all pass locally.pnpm buildleftschema.jsonunchanged. Patch changeset included.