Skip to content

fix(cli): trim citty's padding from --help and name db subcommands in full - #176

Merged
drakulavich merged 3 commits into
mainfrom
fix/help-width
Oct 25, 2026
Merged

drakulavich merged 3 commits into
mainfrom
fix/help-width

Conversation

@drakulavich

Copy link
Copy Markdown
Owner

Closes #147.

#153 (fixed-width rows at 60 columns, the sync grid reflowing) was planned for this PR and is left out: the issue names no target width, and nothing in the README or CHANGELOG promises 60 columns, so picking one is a product decision.

What

  • --help goes through a showUsage of our own, passed to runMain. It renders with citty's renderUsage, then strips trailing whitespace from every line, including whitespace sitting before the colour codes that close a line.
  • A db subcommand's screen names it in full: USAGE oura-cli db rows [OPTIONS] <COLLECTION>, banner (oura-cli db rows v0.9.1). citty names a nested command after its immediate parent only, so showUsage passes a stand-in parent called oura-cli db.
  • db stats and db rows have shorter descriptions, so the longer banner still fits 80 columns. db rows keeps "twin of fetch", which the manifest test pins. The describe snapshot moves with them.

Why

Reproduced on main on an 80-column pty (script with stty cols 80):

  • Every OPTIONS row was 87 characters, padded with spaces, because citty's column formatter counts colour codes as width. Each row wrapped although its text fitted.
  • db today --help printed USAGE db today [OPTIONS] without oura-cli.
  • The db rows banner was 77 characters as (db rows). With the full name it would have been 93, hence the shorter descriptions.
  • The root USAGE line is still 88 (it lists every command), the known exception that the Prose lines overhang an 80-column terminal: hints, notes, help descriptions #130 test already allows.

After the change, the widest line of every help screen except the root is at most 80 on that pty.

How checked

  • New tests in src/index.test.ts: no line of any help screen ends in spaces; the db rows USAGE line is exact. The existing Prose lines overhang an 80-column terminal: hints, notes, help descriptions #130 test, which holds every help line to 80 columns except the root USAGE line, now covers the longer banners too. Both new tests fail on main's sources.
  • Mutation, reverted after one run of src/index.test.ts: const usage = (await renderUsage(cmd, named)).split('\n').map(l => l.replace(TRAILING_SPACE, '$1')).join('\n'); → const usage = await renderUsage(cmd, named);: 1 of 42 fails (the padding test).
  • bun run check: typecheck, Biome, Knip clean; 713 tests pass. The first push had one failure, manifest.test.ts expecting "twin of fetch"; the second commit restores the phrase.
  • Codex review: Approve, no findings (report in the first comment).

Overlap: src/index.test.ts is also touched by #173 (different blocks), and src/commands/db.ts descriptions may meet the db description change planned for #152.

🤖 Generated with Claude Code

https://claude.ai/code/session_018qh9xqviBHYmzVtmQWSKqA

drakulavich and others added 2 commits October 25, 2026 14:16
…mmands in full

citty pads OPTIONS rows to the widest row plus its colour codes, so each
row wrapped an 80-column terminal, and it names a nested command after its
immediate parent only (USAGE db rows). runMain now gets a showUsage that
trims the padding and passes `oura-cli db` as the parent's name. The db
stats and db rows descriptions are shorter so the longer banner fits.

Closes #147

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018qh9xqviBHYmzVtmQWSKqA
The manifest test pins that phrase for agents discovering db rows; the
shortened description from the previous commit dropped it.

Refs #147

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018qh9xqviBHYmzVtmQWSKqA
@drakulavich

Copy link
Copy Markdown
Owner Author

Codex review (gpt-6-luna, final, ebcf1cc..409db7f):

Simplification: not needed

No Critical, Required, Optional, Nit, or FYI findings.

Ran bun test src/index.test.ts: 42 passed, 0 failed.

Verdict: Approve

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the remaining concern is a non-blocking gap in the colored-help test.

Findings

  1. P2 Colored padding goes untested ▶

Summary

The PR removes trailing padding from help output and gives nested db commands their full names.

  • CLI help lines fit better, and database commands show their full names.

Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

Comment thread src/index.test.ts
Comment on lines +257 to +260
it('ends no help line in spaces, which wrap an 80-column terminal though the text fits (#147)', async () => {
for (const cmd of COMMANDS) {
const { stdout } = await run(...cmd, '--help');
expect({ cmd, padded: stdout.split('\n').filter(l => / $/.test(l.replace(ANSI, ''))) }).toEqual({ cmd, padded: [] });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Colored padding goes untested

The new test pipes help output without forcing color, so it normally checks only plain output. Removing ANSI codes in the assertion does not make the child emit them. A change that breaks TRAILING_SPACE for spaces before closing color codes could therefore pass.

Add a forced-color case that clears NO_COLOR, CI, and TEST, confirms ANSI codes are present, and checks for trailing spaces after removing them.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@drakulavich
drakulavich merged commit b7e79c7 into main Oct 25, 2026
3 checks passed
@drakulavich
drakulavich deleted the fix/help-width branch October 25, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--help still overflows 80 columns: option rows padded to column 87, db rows banner 81, subcommand USAGE lacks oura-cli

1 participant