Skip to content

feat(docs): color process-facing help - #1111

Merged
jdx merged 1 commit into
agent/value-enum-bindingfrom
agent/help-colour
Aug 20, 2026
Merged

jdx merged 1 commit into
agent/value-enum-bindingfrom
agent/help-colour

Conversation

@jdx

@jdx jdx commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • add automatic ANSI styling for process-facing help headings, usage literals, and flag names
  • honor NO_COLOR and CLICOLOR_FORCE while retaining explicit plain/colored rendering APIs
  • document the intentional boundary around clap custom style palettes and close the PLAN colour gap

Verification

  • cargo test -p usage-argv --features diagnostics style_tests -- --nocapture
  • cargo test -p usage-rs --test facade
  • cargo clippy -p usage-argv --all-features -- -D warnings
  • cargo clippy -p usage-rs --all-features -- -D warnings

This pull request was generated by Codex.


Note

Low Risk
Help-only presentation changes with explicit plain APIs preserved; behaviour is covered by new style tests and an extended missing-subcommand diagnostic test.

Overview
Process-facing help is now ANSI-coloured when stdout is a TTY, matching the existing diagnostic styling story: section headings, Usage: lines, synopsis literals, and flag spellings in option lists get selective colour while plain text stays byte-identical for pipes, tests, and generated docs via help::Style::PLAIN / COLOURED and Style::auto() (NO_COLOR, CLICOLOR_FORCE).

New render_styled / render_at_styled build the same page as before, then post-process with structure derived from the spec (help_structure, styled_flag_usage). usage-derive switches generated --help handling to Style::auto() instead of plain render / render_at. MissingSubcommand diagnostics use coloured short help when error rendering is coloured.

PLAN and clap-compatibility mark the colour gap closed and note that clap’s custom Command::styles palette is intentionally not reproduced.

Reviewed by Cursor Bugbot for commit f3ccb40. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: c83d56c2-b05a-4a54-a67c-9c3de6133eac

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread derive/src/codegen.rs
Comment thread argv/src/help.rs Outdated
@jdx
jdx force-pushed the agent/help-colour branch from c3d839c to 371a943 Compare August 20, 2026 06:46
Comment thread argv/src/help.rs
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Instruction counts

benchmark trend instructions Δ wall (min) Δ
markdown ▁██ 207,853,342 → 207,877,991 +0.01% 19.31 → 20.02ms +3.69%
startup ▃▁█ 1,216,618 → 1,221,817 +0.43% 1.48 → 1.70ms +15.28%

No instruction-count regression above 1%.

Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run.

Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.

Shadow comparison

Parsing mise use -g node@20 against a shadow of mise's committed spec.
Reported, not gated: the shadow grows as the derive learns to express more, so
what to watch is the ratio rather than either column.

framework instructions, cold parse vs usage
usage 4347
argh 6292 1.4x
clap 5895248 1356x
bpaf 21917778 5042x
                                              min       p01       p10    median
usage-rs: argv -> struct                      188       192       196       207  ns
argh: argv -> struct                          272       278       284       289  ns
clap: build tree + parse -> struct         475320    476708    479061    482982  ns
bpaf: build parser + parse -> struct      1579526   1579526   1586524   1597914  ns

usage: argv -> struct                             206 ns      0.21 µs
clap: build tree + parse -> struct             494103 ns    494.10 µs
clap: parse -> struct, tree reused              23536 ns     23.54 µs
clap: build tree only                          299066 ns    299.07 µs

f3ccb403720b vs d9ec8b579ada · measured on the runner, not pushed to the history.

@jdx
jdx force-pushed the agent/help-colour branch from 371a943 to c076276 Compare August 20, 2026 07:00
@jdx
jdx force-pushed the agent/help-colour branch from c076276 to e59d341 Compare August 20, 2026 07:03
@jdx
jdx force-pushed the agent/help-colour branch from e59d341 to d8e93ee Compare August 20, 2026 07:05
Comment thread argv/src/help.rs
Comment thread argv/src/help.rs
Comment thread derive/src/codegen.rs
@jdx
jdx force-pushed the agent/help-colour branch 2 times, most recently from 927b5b4 to c792d3e Compare August 20, 2026 07:20
@jdx
jdx force-pushed the agent/help-colour branch from c792d3e to 5e6e4b4 Compare August 20, 2026 07:25

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5e6e4b4. Configure here.

Comment thread argv/src/help.rs
@jdx
jdx force-pushed the agent/help-colour branch from 5e6e4b4 to 3057e1f Compare August 20, 2026 07:33
@jdx
jdx force-pushed the agent/help-colour branch from 3057e1f to c042f23 Compare August 20, 2026 07:53
@jdx
jdx force-pushed the agent/help-colour branch from c042f23 to 6a7475d Compare August 20, 2026 10:06
@jdx
jdx force-pushed the agent/help-colour branch from 6a7475d to b3b0250 Compare August 20, 2026 10:39
@jdx
jdx force-pushed the agent/help-colour branch from b3b0250 to 0dd6ce0 Compare August 20, 2026 10:50
@jdx
jdx force-pushed the agent/help-colour branch from 0dd6ce0 to f3ccb40 Compare August 20, 2026 11:51
@jdx
jdx merged commit e18bd1a into main Aug 20, 2026
10 checks passed
@jdx
jdx deleted the agent/help-colour branch August 20, 2026 14:50
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.

1 participant