Uh oh!
There was an error while loading. Please reload this page.
feat(cli): redesign help output with Devsy purple accent - #806
Conversation
Replace cobra's default help with a renderer that reads top-down: uppercase section headers, grouped subcommand listings, and flags shown above their wrapped descriptions rather than crammed into a single column. Flag names and environment variables carry the Devsy purple accent so the two things a reader scans for stand out. This moves the env var out of the usage string and onto a pflag annotation, letting it be styled independently of the description text.
List every subcommand in one alphabetical SUBCOMMANDS section. At 14 top-level commands the grouped variant spent four headers and three blank lines on a list that fits on one screen either way. This retires the cobra command groups, which existed only to drive those headers, collapsing registerSubcommands to a single AddCommand call. Also rewrite the "Devsy X commands" descriptions as verb phrases. The binary name is already on every line the reader is scanning, so the prefix crowded out the part that distinguishes one command from another.
The `self` parent held exactly one subcommand, so it added a level of nesting without grouping anything. Moving update to the top level makes it reachable as `devsy update`. BREAKING CHANGE: `devsy self update` is no longer recognized. Use `devsy update`.
Drop the doc comments that restated their own function names and the per-style comments in theme, keeping only the ones a reader can't recover from the code: the colorprofile nil-environ bug, why Accent is a single tone, and why persistent flags count as global. Help output is byte-identical.
✅ Deploy Preview for images-devsy-sh canceled.
|
✅ Deploy Preview for devsydev canceled.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (17)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe CLI adds custom formatted help output with themed sections, environment-variable annotations, wrapping, filtering, and tests. Root command registration is simplified, ChangesCLI help and command restructuring
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant User
participant BuildRoot
participant Cobra
participant clihelp
User->>BuildRoot: request CLI help
BuildRoot->>Cobra: register commands and help handlers
Cobra->>clihelp: render command metadata and flags
clihelp-->>User: formatted help output
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Replaces cobra's default
--helpwith a renderer modeled applied across the whole command tree.SUBCOMMANDSlist, and flags rendered above their wrapped descriptions instead of crammed into one column. The old single-column form got cramped on flag-heavy commands likedevsy workspace up(~40 flags).#7C5CFF, the desktop app's.theme-purpleprimary) on flag names and environment variables — the two things a reader scans for. Env vars moved from the usage string onto a pflag annotation so they can be styled independently.devsy self update→devsy update. Theselfparent held exactly one subcommand, so it added nesting without grouping anything.Devsyprefix from command descriptions ("Devsy Machine commands"→"Manage provider-hosted machines"). The binary name is already on every line being scanned.Breaking change
devsy self updateis no longer recognized — usedevsy update. No back-compat alias. The only in-repo caller was one e2e test, updated here; no docs, desktop, or scripts referenced the old path.Notes for review
registerSubcommandsto a singleAddCommandcall and incidentally cleared a pre-existingfunlenwarning on it.colorprofilev0.4.3 gotcha —NewWriter(w, nil)documents a nil environ as meaningos.Environ(), but it builds an empty map, soTERMreads as unset and every profile collapses toNoTTY, silently stripping all color.pkg/clihelp/help.gopassesos.Environ()explicitly with a comment, since reverting tonillooks harmless and isn't.theme.Accentis a single tone, not a lipgloss light/dark pair: resolving a pair needs terminal raw mode, too costly for a--helprender. It clears 4.3:1 contrast on both black and white.Verified on a real pty at root, group, and leaf level, plus the gated
protree: color renders,NO_COLORdrops color while keeping bold, and piped output is plain.devsy update --dry-runexercised end-to-end. New tests inpkg/clihelp; touched packages lint clean.Two pre-existing failures are unrelated and untouched: a podman test in
pkg/composeand the e2e suite (needs Docker).Summary by CodeRabbit
New Features
updatecommand.Changes
self update --dry-runwithupdate --dry-run.