fix(docs): link multi-word commands to their real source files - #845
Conversation
`usage complete-word` is implemented by `complete_word.rs`, but the source code link template interpolated the command path verbatim, so every hyphenated command linked at a file that does not exist and 404'd on GitHub. The command-name-to-file mapping is project-specific — a Node CLI may well ship `complete-word.js` — so the hyphen-to-underscore step belongs in the template rather than in the markdown generator. mise's spec already does exactly this. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughSource-code link templates now convert hyphenated CLI command paths to underscored Rust filenames. Reference links were updated, and an integration test verifies that generated Markdown links resolve to existing files. ChangesCLI source-link normalization
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to This localized change corrects generated links for multi-word CLI commands and adds regression coverage; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Greptile SummaryThe PR updates the repository-specific source-link template so hyphenated CLI command paths resolve to snake_case Rust source files and regenerates the affected reference documentation.
Confidence Score: 5/5The PR appears safe to merge, with the corrected links matching the current source tree and regression coverage validating both affected commands. The template preserves nested path separators while mapping the two current hyphenated command names to existing snake_case Rust files, and no blocking or independently actionable issue remains. Important Files Changed
Reviews (1): Last reviewed commit: "fix(docs): link multi-word commands to t..." | Re-trigger Greptile |
Instruction counts
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 comparisonParsing
|
What
Every hyphenated command in the generated CLI reference linked at a source file that does not exist, and 404'd on GitHub:
docs/cli/reference/complete-word.md→cli/src/cli/complete-word.rs, but the file iscomplete_word.rsdocs/cli/reference/generate/completion-init.md→generate/completion-init.rs, but the file iscompletion_init.rsThe command path was interpolated into
source_code_link_templateverbatim, socomplete-wordnever becamecomplete_word.Why here
The link is not derived in
lib/src/docs/. Thesource_code_linktera function inlib/src/docs/markdown/tera.rsonly exposespath— the full command path joined by/— and theblob/mainURL itself lives in the spec,cli/assets/usage-extra.usage.kdl. The fix goes in the template:Underscoring
pathinside the generator would have been wrong: command-name → file-name is project-specific. usage's files are Rust snake_case, but a Node CLI could legitimately shipcomplete-word.js, and the change would have silently altered output for every downstream consumer. mise's own spec already does this same replacement in its template (examples/mise.usage.kdl), so this follows the established idiom.Test
test_source_code_links_for_multi_word_commands_existincli/tests/markdown.rsgenerates markdown from the checked-in spec, pairs each command heading with its source-code link, and asserts the file exists on disk for every hyphenated command. It asserts a floor of ≥2 commands checked, so a parsing regression can't make it pass vacuously.Verified it catches the bug — reverting the template gives:
For the reviewer
Some source-code links still 404, for a different reason, and are deliberately out of scope here:
bash.md/zsh.md/fish.md/powershell.mdlink atbash.rsetc., but all four commands are implemented incli/src/cli/shell.rsgenerate.mdlinks atgenerate.rsrather thangenerate/mod.rs(mise's template handles this parent-command case with{% if cmd.subcommands | length > 0 %})That is why the new test is scoped to multi-word commands rather than asserting every link. It should be widened once those resolve.
Docs regenerated with
mise run render.cargo test --workspace --all-features,cargo clippy --workspace --all-features --all-targets -- -D warnings, andcargo fmt --allall pass.This PR description was generated by Claude Code.
🤖 Generated with Claude Code
Note
Low Risk
Documentation and spec-template changes only; no runtime CLI or generator logic changes beyond regenerated markdown/JSON.
Overview
Generated CLI reference source code links for hyphenated commands (e.g.
complete-word,generate completion-init) were built from the command path as-is, so they pointed at non-existent paths likecomplete-word.rsinstead ofcomplete_word.rsand 404’d on GitHub.The fix updates
source_code_link_templatein the usage specs (cli/assets/usage-extra.usage.kdl,cli/usage.usage.kdl) to apply{{ path | replace(from='-', to='_') }}before appending.rs, keeping command-name → file-name mapping in the spec rather than hard-coding it in the markdown generator. Regenerated reference output (docs/cli/reference/*,commands.json) reflects the corrected links.A new integration test in
cli/tests/markdown.rsgenerates markdown from the checked-in spec and asserts that every multi-word command’s source link resolves to a real file on disk (with a minimum of two commands checked so the test can’t pass vacuously).Reviewed by Cursor Bugbot for commit 3c53cc5. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
Documentation
Tests