Repository navigation
feat(cli): wrap cobra with charmbracelet/fang - #9
Merged
Merged
Conversation
Drops fang.Execute(ctx, rootCmd, fang.WithVersion(version)) in for plain rootCmd.Execute(). Net effect: - --help and subcommand --help render with structured sections (USAGE / COMMANDS / FLAGS), aligned columns, subdued styling. - Errors get a styled prefix on stderr. - man and completion subcommands ship for free. - --version still reports the build-time-injected `version` var via fang.WithVersion (fang otherwise reports "unknown" since it doesn't read cobra's Version field by default). Transitive dep bump: charmbracelet/log (PR #8) brought in an older x/cellbuf that's incompatible with x/ansi v0.11.x — fang requires the newer ansi. go get github.com/charmbracelet/x/cellbuf@latest pulls both onto a coherent set (cellbuf v0.0.15, ansi v0.11.5). No source change needed. Tests still green; no behavior change to any RunE. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
Stacking
This PR is stacked on #8 (logger), which is stacked on #7 (refactor split). Base = `feat/cli-leveled-logger`. GitHub will auto-retarget as #7 → #8 → #9 merge in order.
Before / after (root --help)
Before (cobra default):
```
A portable, multi-directional memory system for AI.
...
Available Commands:
add Create a new memory
...
Flags:
-h, --help help for rememberize
```
After (fang):
```
A portable, multi-directional memory system for AI.
USAGE
rememberize [command] [--flags]
COMMANDS
add [--flags] Create a new memory
...
FLAGS
-h --help Help for rememberize
--json Output raw JSON (for scripting/piping)
-v --verbose Increase log verbosity (-v info, -vv debug)
```
Why `fang.WithVersion(version)`
Fang doesn't read cobra's `Version` field by default — without the option, `--version` reports `unknown (built from source)`. Passing the package-level `version` var (which goreleaser sets via `-ldflags`) wires it up.
Transitive dep skew
PR #8 brought in `charmbracelet/log v1.0.0`, which transitively pulled an older `x/cellbuf v0.0.13-...`. Fang needs `x/ansi v0.11.x`, but the older `cellbuf` was built against `x/ansi v0.8.x` and won't compile against the newer ansi.
Resolution: `go get github.com/charmbracelet/x/cellbuf@latest` brings both onto a coherent set (`cellbuf v0.0.15`, `ansi v0.11.5`). No source change required.
Verification
Test plan
Out of scope
No changes to any RunE. No flag renames. No behavior change.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.