Skip to content

docs: automate OpenShell CLI reference markdown generation into two places#270

Closed
miyoungc wants to merge 3 commits intomainfrom
miyoungc/automate-cli-markdowns
Closed

docs: automate OpenShell CLI reference markdown generation into two places#270
miyoungc wants to merge 3 commits intomainfrom
miyoungc/automate-cli-markdowns

Conversation

@miyoungc
Copy link
Copy Markdown
Collaborator

@miyoungc miyoungc commented Mar 13, 2026

Summary

Preview: https://cuddly-tribble-p3evl8k.pages.github.io/pr-preview/pr-270/reference/cli-generated.html

Automates CLI reference markdown generation from source /// doc comments, eliminating manual documentation maintenance and ensuring CLI docs stay in sync with code.

What this adds

  • cli_reference.rs — A new module that introspects the clap Command tree at runtime and generates a complete markdown reference (command tree, flag tables with defaults, env vars, grouped sections).
  • openshell docs cli-reference — A hidden subcommand that runs the generator and prints markdown to stdout.
  • Mise tasksdocs:cli-reference (regenerate) and docs:cli-reference:check (staleness check wired into pre-commit).
  • Generated output deployed to two locations:
    • .agents/skills/openshell-cli/cli-reference-generated.md (agent skills)
    • docs/reference/cli-generated.md (user-facing docs site)
  • Agent skill (.agents/skills/generate-cli-reference/SKILL.md) documenting the regeneration workflow.
  • CONTRIBUTING.md updated with the new task and a "Generated Documentation" section.

Why

The CLI reference was previously maintained by hand across multiple locations, leading to staleness and inconsistency. Now the /// doc comments on commands and flags in main.rs are the single source of truth. The pre-commit hook catches drift automatically.

Notable details

  • Clap's derive macro strips trailing periods from single-line doc comments. The generator restores them via ensure_period() so the output has consistent punctuation.
  • The hidden subcommand approach avoids a separate binary while keeping generator code isolated in its own module.

Changed files

File Change
crates/navigator-cli/src/cli_reference.rs New module: markdown generator
crates/navigator-cli/src/lib.rs Expose cli_reference module
crates/navigator-cli/src/main.rs Add hidden docs cli-reference subcommand; fix one missing trailing period
tasks/docs.toml Add docs:cli-reference and docs:cli-reference:check tasks
tasks/ci.toml Wire staleness check into pre-commit
CONTRIBUTING.md Document docs:cli-reference task and generated docs workflow
docs/index.md Add reference/cli-generated to docs toctree
.agents/skills/generate-cli-reference/SKILL.md New agent skill for the regeneration workflow
.agents/skills/openshell-cli/cli-reference-generated.md Generated output (agent skills)
docs/reference/cli-generated.md Generated output (user-facing docs)

Test plan

  • cargo test -p navigator-cli cli_reference — unit tests pass
  • mise run docs:cli-reference — regenerates successfully
  • mise run docs:cli-reference:check — passes when docs are current
  • mise run docs:cli-reference:check — fails with clear error when docs are stale
  • mise run pre-commit — full CI suite including staleness check

@miyoungc miyoungc self-assigned this Mar 13, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 13, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://NVIDIA.github.io/OpenShell/pr-preview/pr-270/

Built to branch gh-pages at 2026-03-13 02:30 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@miyoungc miyoungc marked this pull request as draft March 13, 2026 02:27
@miyoungc miyoungc marked this pull request as ready for review March 13, 2026 02:34
@miyoungc miyoungc requested review from drew, kirit93 and pimlock March 13, 2026 02:34
@miyoungc miyoungc added the area:docs Documentation and examples label Mar 13, 2026
@miyoungc miyoungc added this to the gtc milestone Mar 13, 2026
@drew
Copy link
Copy Markdown
Collaborator

drew commented Mar 13, 2026

image

Remove one, prefer CLI Reference

@drew drew force-pushed the miyoungc/automate-cli-markdowns branch from c5e6db4 to f1600e4 Compare March 16, 2026 13:55
@drew drew removed this from the gtc milestone Mar 18, 2026
@johntmyers johntmyers added the wontfix This will not be worked on label Mar 23, 2026
@drew
Copy link
Copy Markdown
Collaborator

drew commented Apr 1, 2026

Closing for now- we won't provide a CLI reference.

@drew drew closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation and examples wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants