Skip to content

feat: CLI docs auto-generation with bd help --doc/--list/--all#2527

Closed
maphew wants to merge 5 commits intogastownhall:mainfrom
maphew:feat/help-doc-generator
Closed

feat: CLI docs auto-generation with bd help --doc/--list/--all#2527
maphew wants to merge 5 commits intogastownhall:mainfrom
maphew:feat/help-doc-generator

Conversation

@maphew
Copy link
Copy Markdown
Collaborator

@maphew maphew commented Mar 11, 2026

Summary

Adds three new flags to bd help that generate documentation directly from the live Cobra command tree, eliminating documentation drift at the source.

New Flags

  • bd help --list — Lists all 95 available commands (one per line), used by scripts
  • bd help --doc <command> — Generates individual markdown with Docusaurus frontmatter
  • bd help --all — Combined reference document for all commands

Infrastructure

  • scripts/generate-cli-docs.sh — Automates doc generation for all commands
  • CI job check-cli-docs-freshness — Validates generated docs match live CLI output on every PR
  • Pre-commit hook — Warns if CLI docs may be stale after Go source changes

Fixes from Review

  1. Fixed gofmt alignment violation in sidebarPositionMap (tab → space normalization)
  2. Fixed broken CI xargs redirect (xargs -I{} ... > /tmp/cli-docs/{}.md wrote everything to literal {}.md). Replaced with proper while-read loop.
  3. Deleted 6 stale website docs for removed commands (dependencies, essential, index, issues, labels, sync)

Commit Structure

  1. feat: add CLI docs auto-generation — Go code, scripts, CI config
  2. docs: regenerate CLI reference — Generated markdown output (95 command docs + combined reference)

Related

Amp and others added 4 commits March 11, 2026 13:28
Add three new flags to the help command:
- bd help --list: lists all available commands (one per line)
- bd help --doc <command>: generates individual markdown with Docusaurus frontmatter
- bd help --all: combined reference document

Infrastructure:
- scripts/generate-cli-docs.sh: automates doc generation for all commands
- CI job check-cli-docs-freshness: validates generated docs match live CLI
- Pre-commit hook: warns if CLI docs may be stale

Fixes gofmt alignment in sidebarPositionMap.
Fixes broken CI xargs redirect (replaced with while-read loop).

Amp-Thread-ID: https://ampcode.com/threads/T-019cde93-fbf9-7229-931c-805d79001f80
Co-authored-by: Amp <amp@ampcode.com>
Generated by ./scripts/generate-cli-docs.sh using bd help --doc.
- 95 individual command docs in website/docs/cli-reference/
- Combined reference in docs/CLI_REFERENCE.md
- Deleted 6 stale docs for removed commands (dependencies, essential,
  index, issues, labels, sync)

Amp-Thread-ID: https://ampcode.com/threads/T-019cde93-fbf9-7229-931c-805d79001f80
Co-authored-by: Amp <amp@ampcode.com>
@maphew maphew requested a review from steveyegge March 11, 2026 23:05
@steveyegge
Copy link
Copy Markdown
Collaborator

Thanks for tackling doc drift -- it is a real problem and your PR #2526 (which we just merged) addresses the cleanup side well.

For this PR, we are cherry-picking the bd help --list/--doc/--all Go code -- those flags are useful for scripting and doc generation. We are leaving behind the 95 committed generated docs and the CI freshness checking though. Generated output belongs in a build pipeline, not committed to the repo. Committing it means every help-text change requires regenerating and committing docs, which is ongoing maintenance burden.

We will get the Go code landed separately with attribution. Thanks for the thorough work on both PRs!

@steveyegge steveyegge closed this Mar 12, 2026
steveyegge added a commit that referenced this pull request Mar 12, 2026
…H#2527)

Cherry-pick Go code from community PR #2527 (maphew): adds --list flag to
enumerate all commands, --doc flag to generate per-command Docusaurus markdown,
and sidebar position mapping. Also includes lazy getGitContext() in hooks dir
resolution and test skip improvements for missing Dolt server.

Co-authored-by: matt wilkie <maphew@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maphew maphew deleted the feat/help-doc-generator branch March 12, 2026 02:36
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.

2 participants