Implement the following plan:
Generate command docs from Cobra
The command reference on the website is manually maintained and covers about 18 topics, but the CLI has 64 commands. Many commands have no docs at all. The manual docs contain good narrative content (tutorials, CI examples, use cases) that shouldn't be replaced, so generated reference docs go in a separate section.
Changes in the CLI repo (git-pkgs/git-pkgs)
New file: scripts/generate-docs.go
Mirrors the existing scripts/generate-man.go. Imports cmd.NewRootCmd(), calls doc.GenMarkdownTreeCustom() to write one markdown file per command into a docs/ directory. The filePrepender callback injects Hugo frontmatter (title, weight) at the top of each file. The linkHandler callback rewrites Cobra's git-pkgs_vulns_blame.md links into relative Hugo paths. Sets DisableAutoGenTag = true on the root command to suppress the auto-generated timestamp footer (it creates noisy diffs on every run).
Add to .goreleaser.yaml hooks (alongside the man page generator):
yaml
Changes in the website repo (git-pkgs/website)
New file: .github/workflows/generate-docs.yml
Runs on a schedule (weekly) and on workflow_dispatch for manual runs. Steps:
- Checkout website repo
- Setup Go
- Clone
git-pkgs/git-pkgs at latest tag
- Run
go run scripts/generate-docs.go inside the cloned CLI
- Copy generated
docs/ output into content/docs/reference/
- If files changed, open a PR using
peter-evans/create-pull-request
New file: content/docs/reference/_index.md
Section landing page with title "Command Reference" and a high weight (90) so it sorts near the bottom of the sidebar, after the narrative guides.
Edit: content/docs/_index.md
Add a card linking to the new reference section:
{{< card link="reference" title="Command Reference" subtitle="Every command and flag" >}}
Edit: hugo.yaml
Enable the llms.txt output format that hextra already supports:
yaml
Verification
- In the CLI repo, run
go run scripts/generate-docs.go and inspect the docs/ output -- should produce ~64 markdown files with Hugo frontmatter
- Copy the output into the website's
content/docs/reference/
- Run
hugo server and check the sidebar shows the reference section with all commands
- Check that links between parent/child commands work (e.g., vulns page links to vulns_blame)
- Check
/llms.txt is served and includes the reference pages
- Run
hugo --minify to confirm a clean build
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /Users/andrew/.claude/projects/-Users-andrew-code-git-pkgs-website/e2798a3a-05ca-4e41-8eda-e9df79186723.jsonl