Let me read the key files I need to reference directly.
73 files total. Some of those are pre-existing files (like bisect.md, ci-cd.md, notes.md, README.md etc. from an existing docs/ directory). Let me check what was already there.
The CLI repo already has a docs/ directory with hand-written files. I should write to a separate directory to avoid mixing. Let me fix the script.
Now update the workflow to match.
Now let me clean up the previously generated files in docs/ and regenerate into the right place.
64 files, exactly as expected. Let me verify the frontmatter and content of a couple files.
Frontmatter and links look correct. Now copy the generated files to the website and test the Hugo build.
65 files (64 generated + _index.md). Now test the Hugo build.
Build is clean. Let me check if llms.txt was generated and verify the reference pages are in the output.
All there. Let me verify the llms.txt content and that inter-command links work.
Reference pages are in llms.txt. Let me check that the inter-command links resolve correctly in the built HTML.
Lines are too long to see the actual links. Let me extract them more precisely.
Links are resolving correctly. The vulns page links to https://git-pkgs.dev/docs/reference/git-pkgs_vulns_blame/ and all its subcommands, and back up to the root git-pkgs page. Everything works.
Now let me clean up the generated files from the CLI repo (since they shouldn't be committed there) and the website's public directory.
Also remove the copied reference docs from the website's content dir (those will come from the workflow in practice).
Let me also make sure the CLI repo's docs/reference/ dir gets gitignored so generated output doesn't accidentally get committed there.
Let me start the hugo server. First I need to regenerate the reference docs so there's content to browse.
Hugo server is running at http://localhost:1313/. The reference section should be at http://localhost:1313/docs/reference/.
Here's a summary of everything that was done:
CLI repo (git-pkgs/git-pkgs):
scripts/generate-docs.go -- mirrors generate-man.go, uses doc.GenMarkdownTreeCustom() with Hugo frontmatter and ref shortcode linksgo run scripts/generate-docs.go to .goreleaser.yaml before hooksdocs/reference/ to .gitignoreWebsite repo (git-pkgs/website):
.github/workflows/generate-docs.yml -- weekly + manual, clones CLI at latest tag, generates docs, opens PR via peter-evans/create-pull-requestcontent/docs/reference/_index.md -- section landing page with weight 90content/docs/_index.mdoutputs.home with llms format to hugo.yamlVerified:
hugo --minify builds clean (106 pages)/llms.txt includes all reference pagesTwo things to fix: remove the redundant SEE ALSO sections (sidebar handles navigation), and add a command listing to the landing page. Let me handle both.
I'll replace the Cobra GenMarkdownTreeCustom call with a custom writer that skips the SEE ALSO section entirely (the sidebar handles navigation). I'll also create a shortcode for the landing page listing.
Now create the shortcode for listing commands on the landing page.
Wait, the description won't be set from the generated pages. Let me check what we have in the frontmatter -- we only have title and weight. The short description is in the body. Let me pull it from the page summary or content instead. Actually, let me look at what Cobra gives us in the body.
The old generated files are still there. Let me regenerate and copy.
No SEE ALSO. Now I need the short description available for the listing. The first line after frontmatter is the short description. Hugo's .Summary will pick that up, but it might include more. Let me add a description field to the frontmatter instead.
Also clean up the unused name variable.
Good, that diagnostic is gone. Now update the shortcode to use .Description.
That looks right. Now regenerate, copy, and see the result.
Now copy to website and update the landing page.
Hugo server should have live-reloaded. Let me check for any build errors.
Rebuilt cleanly. The reference page at http://localhost:1313/docs/reference/ should now show the command list, and individual pages no longer have the SEE ALSO section. Have a look.
I'm on the purl-package-args branch. I need to create a new branch from main for this work.
PR created: https://github.com/git-pkgs/git-pkgs/pull/120
It's already targeting main. Did you mean fetch/pull main in this website repo, or something else?
Already up to date -- the branch was created from the latest main after the fast-forward pull. PR #120 is clean.