feat(cli): adopt @outfitter/cli with createCLI() entry point#169
Open
galligan wants to merge 1 commit into
Open
feat(cli): adopt @outfitter/cli with createCLI() entry point#169galligan wants to merge 1 commit into
galligan wants to merge 1 commit into
Conversation
This was referenced Feb 22, 2026
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Replace raw Commander setup with createCLI() from @outfitter/cli: - Global --json flag with OUTFITTER_JSON env var bridge - exitOverride() for structured error handling - cli.register() for subcommand registration - Upgrade Commander from v13 to v14 (required by @outfitter/cli) Update shouldOutputJson() to check OUTFITTER_JSON env var and only treat options.json === true as explicit (not false default). 🤘🏻 In-collaboration-with: [Claude Code](https://claude.com/claude-code)
e19b65d to
abcf1dd
Compare
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
new Command()withcreateCLI()from@outfitter/cli--jsonflag withOUTFITTER_JSONenv var bridge (no per-command--jsonneeded)cli.register()(chainable)@outfitter/clitypes)shouldOutputJson()to checkOUTFITTER_JSONenv var (FIRE-9)Test plan
bun run checkpassesbun testpasses (298 tests)bun apps/cli/bin/fw.ts status --shortsmoke test🤘🏻 In-collaboration-with: Claude Code
Greptile Summary
This PR successfully migrates the CLI from raw Commander.js to the
@outfitter/cliwrapper withcreateCLI(). The changes introduce a global--jsonflag that setsOUTFITTER_JSONenv var, eliminating the need for per-command--jsonoptions on the root command. The implementation correctly updatesshouldOutputJson()to check this new env var while maintaining backwards compatibility with legacyFIREWATCH_JSONLandFIREWATCH_JSONvariables.Key changes:
createCLI()entry point with chainablecli.register()for subcommands@outfitter/clitypes)--jsonoption from root command (now provided globally bycreateCLI)shouldOutputJson()with proper precedence: explicit flags →OUTFITTER_JSON→ legacy env vars → TTY detectionprogram.parseAsync()tocli.parse()The refactoring is clean, maintains API compatibility, and follows the described migration plan.
Confidence Score: 5/5
Important Files Changed
@outfitter/cliand upgraded Commander v13 -> v14, plus supporting packages (@outfitter/config,@outfitter/schema,@outfitter/types,zod)new Command()withcreateCLI(), removed hidden--jsonfrom root (now global), chainablecli.register()for subcommands, updated tocli.parse()shouldOutputJson()to checkOUTFITTER_JSONenv var (set bycreateCLIglobal--json), with proper precedence and backwards compatibility for legacy env varsFlowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[User runs: fw --json query] --> B[createCLI preAction hook] B --> C[Sets OUTFITTER_JSON=1] C --> D[cli.parse executes command] D --> E[Command calls shouldOutputJson] E --> F{Check precedence} F -->|1. Explicit flag| G[--jsonl or --no-jsonl?] G -->|Yes| H[Return true/false] G -->|No| I{Check options.json === true?} I -->|Yes| J[Return true] I -->|No| K{Check OUTFITTER_JSON?} K -->|=1| L[Return true] K -->|=0| M[Return false] K -->|Not set| N{Check legacy env vars} N -->|FIREWATCH_JSONL/JSON| O[Return based on value] N -->|Not set| P{Check TTY} P -->|Is TTY| Q[Return false - human] P -->|Not TTY| R[Return true - JSONL]Last reviewed commit: abcf1dd