feat: generate GitLab Docs navigation block for glab
What
Makes the GitLab CLI (glab) navigation submenu in docs-gitlab-com's data/en-us/navigation.yaml generated from the glab cobra command tree instead of hand-maintained.
Generation lives in the existing cmd/gen-docs binary: alongside the web docs, make gen-docs now also walks the command tree and writes the nav submenu to a checked-in artifact, docs/navigation-glab.yaml. The GitLab Docs site (docs-gitlab-com) splices this block into navigation.yaml.
cmd/gen-docs/docs.gogains awalk()/genNav()step and a--nav-pathflag (default./docs/navigation-glab.yaml); the nav is emitted for web docs only, not man pages.make gen-docsnow generates both the docs pages and the nav artifact — no separate target or binary.- The existing pre-commit (
check-docs) and pre-push (check-generated) lefthook checks, plus thecheck_docs_updateCI job, already runmake gen-docsand diffdocs/, so they now guard the nav artifact too — it can't silently drift from the command definitions, locally or in CI. - For each available command it emits
title= the command path (e.g.glab ci cancel job) andurl= the docs path (e.g.cli/ci/cancel/job/), with asubmenufor commands that have subcommands. Help, hidden, and deprecated commands are skipped, matching the generated docs pages.
Why
Today the glab entries in docs-gitlab-com's navigation.yaml are hand-maintained and drift from the command tree (missing glab prefixes, title typos, ordering). They're fully derivable from cobra, so this makes them generated and guarded instead.
Tracking
Tracked in gitlab-org/technical-writing/docs-gitlab-com#671 (POC), part of the broader effort in gitlab-org/technical-writing/docs-gitlab-com#669.
Companion MR
This is the generator half. The consuming half (sentinels + splicer + synced navigation.yaml) is a companion MR in docs-gitlab-com (branch 669-glab-nav-poc). Recommended merge order: this MR first, so the artifact exists on main for the docs side to consume.
Test
make gen-docs # regenerate docs + nav
git diff --exit-code docs/navigation-glab.yaml # exit 0 == in sync with the command treeThe pre-push check-generated hook and the check_docs_update CI job exercise the same guard automatically.
Scope note
This is V1 (generator + drift guard). Cross-repo MR automation is intentionally out of scope — see the Stage 3 design sketch on gitlab-org/technical-writing/docs-gitlab-com#669.