fix(cli): piped --help no longer glues flag names to descriptions#8330
fix(cli): piped --help no longer glues flag names to descriptions#8330DavidWells wants to merge 1 commit into
Conversation
The help renderer separated terms from descriptions with only an ANSI color code, so piped output read '--dryDry run: ...'. Pad every row with real whitespace and type the noBaseOptions accessor properly.
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR adds a public Estimated code review effort: 2 (Simple) | ~12 minutes Changes
Related PRs: None identified. Suggested labels: type: bug, area: cli-help Suggested reviewers: None identified. 🐰 A rabbit tweaks the spacing, byte by byte, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/commands/base-command.ts (1)
374-376: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePadding fix looks correct; consider using the new getter consistently.
The
Math.max(termWidth + HELP_SEPARATOR_WIDTH - ..., term.length + 2)formula correctly guarantees a minimum 2-space gap even when the term exceeds the computed column width, fixing the concatenation bug (--dryDry...). Thehelper.wrapindent correctly compensates for thebangprefix length.One nit: line 406 (
if (command.#noBaseOptions === false)) still reads the private field directly, right next to the newcommand.noBaseOptionsgetter used at line 361. Since the getter now exists precisely to expose this state publicly, using it here too would be more consistent.♻️ Optional consistency tweak
- if (command.#noBaseOptions === false) { + if (command.noBaseOptions === false) {Also applies to: 406-406
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/commands/base-command.ts` around lines 374 - 376, Use the new command.noBaseOptions getter consistently instead of reading command.#noBaseOptions directly in base-command.ts. Update the conditional in the relevant command/help flow to reference the getter, matching the existing usage near the earlier check and keeping the encapsulation consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/commands/base-command.ts`:
- Around line 374-376: Use the new command.noBaseOptions getter consistently
instead of reading command.#noBaseOptions directly in base-command.ts. Update
the conditional in the relevant command/help flow to reference the getter,
matching the existing usage near the earlier check and keeping the encapsulation
consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f7007dc3-43f3-4636-9509-3bbc83e1d73e
📒 Files selected for processing (2)
src/commands/base-command.tstests/unit/commands/help-format.test.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
netlify/blueprints(manual)
Split from #8300 (2 of 9).
What
The help renderer separated flag names from descriptions with only an ANSI color code. Piped output —
netlify build --help | grep dry— read:Now every row is padded with real whitespace, in every terminal. Also replaces a
@ts-expect-errorwith a typednoBaseOptionsgetter.Why it helps agents
--helpis the CLI's primary self-documentation surface, and agents read it exclusively through pipes. Glued term+description corrupts the data they parse to learn flags.Testing