feat(gen-docs): prune and remove deprecated command pages

Description

make gen-docs never deleted pages for commands that went away, so stale Markdown lingered under docs/source/ and stayed reachable by URL — for example docs/source/duo/ask.md, orphaned when glab duo ask was deprecated.

Following the discussion on the issue and this MR, cmd/gen-docs/docs.go now:

  • Prunes removed and deprecated pages: Before regenerating, every marker-bearing .md file under the docs source is deleted, the tree is regenerated, then emptied directories are cleaned up. A page whose command was removed from the code — or that has become deprecated — is no longer regenerated, so it is deleted. Images and hand-maintained files (no marker) are never touched.
  • Excludes deprecated commands: Deprecated commands are dropped from the generated pages, navigation, and parent listings, the same as hidden commands (using cobra's IsAvailableCommand). Publishing a deprecated command creates discoverable surface that encourages new adoption; instead, existing users get the migration path from the cobra deprecation banner printed at invocation, and every deprecated command's Deprecated message names its replacement.

Resolves #8341 (closed)

How has this been tested?

  • go test ./cmd/gen-docs/...: Unit tests cover the full generate + prune flow (deprecated and hidden commands excluded; orphaned .md and its empty directory pruned; images and marker-less files preserved) and navigation visibility.
  • make gen-docs: docs/source/duo/ask.md is deleted and glab duo ask, glab ci artifact, and glab mr for no longer appear in docs/navigation-glab.yaml; regeneration is idempotent.
  • gofmt and golangci-lint are clean on the changed files.
  • Remaining pre-push checks (Vale, markdownlint, and the generated-doc drift check) run via lefthook on push.
Edited by Brendan Lynch

Merge request reports

Loading