Repository navigation
docs: generate the command reference from the cobra tree - #71
Merged
Merged
Conversation
yutkin
marked this pull request as draft
November 5, 2026 14:40
yutkin
force-pushed
the
docs/generated-command-reference
branch
3 times, most recently
from
November 9, 2026 14:19
20076a2 to
b0dacc9
Compare
docs/commands.md was hand-written and had drifted from the CLI: container, registry, object-storage, template, mcp, skills, status, doctor, version, the vm shortcuts and volume delete were missing. Instead of copying more text from --help and the per-command READMEs, render it from the command definitions themselves. - cmd/gen-docs + internal/verda-cli/docgen write docs/commands.md (index grouped as in verda --help, with beta tags) and docs/reference/<cmd>.md (usage, aliases, flags, examples). Hidden and deprecated commands are skipped; output is deterministic (no dates, VERDA_* env stripped). - CommandGroups.Add also registers native cobra groups and a declaration rank, so the index keeps the group order, titles and command order of verda --help (cobra sorts Commands() in place). verda --help output is unchanged. - make docs regenerates; make docs.check fails when stale. A new Docs workflow (no paths-ignore) and the pre-commit hook run the check. - .gitattributes marks the generated files linguist-generated. - The env-var table moves to docs/guides/authentication.md and the scripting sections to docs/guides/scripting.md. The credential order stays only in verda auth --help, which docs/reference/auth.md renders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- gen-docs builds the command tree under a throwaway HOME and VERDA_HOME that is removed after the run, instead of a fixed /home/user path. - docgen filters inherited flags by identity, so a group flag that shadows a global flag of the same name is listed, not dropped. - cmdutil.TagSuffix builds the " (beta)" suffix for both the root help and the generated docs. - The pre-commit hook runs make docs.check once, before the Go checks. - docgen uses one textLang constant for text fences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The docs on main described unreleased commands and flags, because every PR had to regenerate them. The release job now runs `make docs VERSION=vX.Y.Z` before it commits the changelog and tags, so each tag carries docs that match its code. docs/commands.md names the release it matches. - release.yml: generate docs, commit them with the changelog (`git add -A` on docs/reference drops pages of removed commands) - gen-docs: -version flag (vX.Y.Z), stamped into the index intro - drop the docs.yml workflow, `make docs.check` and the pre-commit docs gate - TestRun builds the docs from the real command tree in `make test`, twice, so a generator failure or environment-derived help text shows up in CI - contributor docs: generated files stay out of PRs; `make docs` is a preview Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Committed command docs come only from the release job, which always has a version, so the version is now required: gen-docs rejects a missing or malformed -version and `make docs` requires VERSION, like `make changelog`. Every page carries the version under its title, since readers often land on a reference page directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- auth guide: the published auth page is the v1.10.0 text, which lists a shorter order without config.yaml; say so instead of claiming the guide and the page match - scripting guide: point "reference page" at the index that links them - gen-docs: drop the -out flag; only `docs` was ever passed - tests: reuse IndexFile/ReferenceDir, let generate() take a root, merge the two determinism tests, drop an ANSI check Generate already does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Output of `make docs VERSION=v1.10.0` with this branch's generator run on the v1.10.0 sources (generator files copied onto `git archive v1.10.0`). The pages describe the installed v1.10.0, not main. Help-text changes made on main since v1.10.0 appear at the next release. No hand edits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yutkin
force-pushed
the
docs/generated-command-reference
branch
from
November 10, 2026 08:53
c6ff905 to
1648d4d
Compare
yutkin
marked this pull request as ready for review
November 10, 2026 08:54
jaakkovarjo
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
How to review
Review the commits in order. Commits 1–5 change code, tests and CI (+998 −13). Commit 6 contains only generated docs (+3,426 −174).
release.ymldiff. Check that the docs step runs before the commit and tag step.docgen.gotogether withdocgen_test.go. The tests show the expected output.isolateEnvincmd/gen-docs/main.go. It isolates the generator from the real config directory.docs/reference/vm.md. Compare it withverda vm --helpfrom v1.10.0.Summary
docs/commands.mdwas hand-written and did not match the CLI. Nine top-level commands had no entry:container,doctor,mcp,object-storage,registry,skills,status,templateandversion. This PR generates the command reference from the cobra command tree, and regenerates it at each release, so the docs on GitHub match the released binary, not unreleased code onmain.--helpUse,Short,Long,Exampleand flags of each commanddocs/matches its codeCommandGroups.Addalso registers cobra groups and a declaration rank, so the index keeps theverda --helporder. Theverda --helpoutput does not change. Hidden and deprecated commands are not in the docs.The generator stays exercised between releases:
TestRun(inmake test, so in CI) builds the docs from the real command tree twice, each with a fresh temp home, and fails on generator errors (including ANSI escapes) or help text derived from the home directory.Evidence
Every generated page starts like this (
docs/reference/vm.md):make docswithoutVERSION→VERSION is required. Usage: make docs VERSION=v1.0.0. A malformed version (latest,1.2.3) fails and writes nothing.The committed docs are generated from the
v1.10.0sources with this generator (the generator files copied ontogit archive v1.10.0), so they describe the binary users have installed. Help-text changes onmainsincev1.10.0, such as theauthprecedence text, appear at the next release.TestRun,TestRun_RejectsBadVersion,TestGenerate_EveryPageNamesVersionandTestGenerate_RejectsBadVersionpass.verda --helpon this branch and onmaingives the same bytes.make build,make test,make lintandmake fix.checkpass.The release workflow change cannot run outside a real release. Reviewed by hand: the docs step runs before the commit/tag step, and the rulesets on
mainhave no path rules, so the release commit can carrydocs/as it already carriesCHANGELOG.md.Merge Danger
Door: two-way
A revert removes the generator and the release step and puts back the hand-written file.
Blast Radius: release
The release job gains one step before tagging. If
make docsfails, the release stops before anything is committed, tagged or pushed. Between releases the docs lagmainon purpose: they describe the latest release, which their version line names.🤖 Generated with Claude Code