feat(cli): scriptable output, shell completion, and CLI refactor#52
Merged
Conversation
Extract shared formatError (errors.ts), terminal output/colors/icons (ui.ts, NO_COLOR/TTY-aware via styleText), and a runAction wrapper that gives every command uniform error UX. Removes duplicated catch blocks and ANSI magic strings; fixes list-style commands lacking error handling.
list/status gain --json for scriptable output (shared projection in profile-view.ts; null instead of the — placeholder). New ccm completion <bash|zsh|fish> derives the command list from the live registry so it never drifts. All new modules added to the Stryker mutate set.
ARCHITECTURE.md covers state reconciliation, the transactional stage/rollback protocol, the testability DI seam, and why error handling lives in runAction rather than index.ts. README documents --json and shell completion; CLAUDE.md captures the build/test/mutation invariants.
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.
Summary
Builds on the existing foundation (100% coverage + 100% mutation, multi-OS CI, release automation). Focus: scriptability, CLI craft, removing duplication — plus docs that surface the transactional design.
Changes
Refactor —
refactor(cli)src/lib/errors.ts— sharedformatError(was duplicated inprofile-store.ts+profile-config-copy.ts)src/lib/ui.ts— central output/colors/icons onnode:utilstyleText; NO_COLOR / non-TTY awaresrc/lib/run-action.ts— uniform CLI error handling (✗ message+ exit 1); removes ~9 duplicatedcatchblocks and fixeslistwhich previously had noneFeatures —
feat(cli)ccm list --json/ccm status --json— machine-readable output; shared projection inprofile-view.ts(emitsnull, not the—placeholder)ccm completion <bash|zsh|fish>— command list derived from the live registry, never driftsDocs —
docsARCHITECTURE.md— state reconciliation, transactional stage→mutate→finalize + rollback, the testability DI seam, why error handling lives inrunActionnotindex.tsCLAUDE.md,.editorconfig, README (--json+ completion), CONTRIBUTING linkQuality gates
mutate[];list.ts/status.tsnewly mutated and brought to 100%main(0.6.0 release, TypeScript 6.0.3) — gates re-verifiedVerify