fix/doc: Add missing commands to helper text - #1375
Open
marcleblanc2 wants to merge 1 commit into
Open
Conversation
…cy commands in root index `src doc` only expands legacy command groups that are registered in the `commanders` map. `search-jobs`, `debug` and `snapshot` were never added, so each rendered as a single leaf page with the group help text and their subcommands (19 pages) were never documented. The root index.md also only listed urfave/cli commands: since #1304, `maps.Copy(subcommands, rootSubcommands)` copied in the wrong direction (`maps.Copy(dst, src)`), dropping every legacy command from the landing page. `teams` is intentionally left as a single page: teams were removed in Sourcegraph 7.0 (#1257). Add cmd/src/doc_test.go so both regressions fail CI in future: a golden file list (mirrors OUTPUT_FILES in sourcegraph/sourcegraph doc/cli/references/BUILD.bazel), a check that no leaf page lists "The commands are:", and a check that the root index links every command. Part of https://linear.app/sourcegraph/issue/FE-502 Amp-Thread-ID: https://ampcode.com/threads/T-01a08410-86ca-72be-9928-2810e837fae1 Co-authored-by: Amp <amp@ampcode.com>
This was referenced Sep 9, 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.
Part of FE-502: src-cli docs broken.
src docgenerates the CLI reference pages on sourcegraph.com/docs/cli/references. Two bugs incmd/src/doc.goleave it incomplete:search-jobs,debug, andsnapshotare missing from thecommandersmap, so each renders as a single page and their 16 subcommands get no page at all.maps.Copy(subcommands, rootSubcommands)has its arguments backwards, so the rootindex.mdlists only the urfave/cli commands and dropsbatch,repos,search, etc.This PR adds the three map entries, fixes the
maps.Copyorder, and addscmd/src/doc_test.goso both regressions fail CI: a golden list of the generated files, a check that no leaf page lists subcommands, and a check that the root index links every command.teamsis left out on purpose; teams were removed in Sourcegraph 7.0, and #1376 (stacked on this) removes the command. #1377 then generatessrc helpfrom the same registrations.Test plan
go test ./cmd/src/...passes. Withdoc.goreverted tomain, all three new tests fail, naming the three leaf pages and the missing root-index commands.go run ./cmd/src doc -o /tmp/outvs 7.6.0:debug.md,search-jobs.md,snapshot.mdbecome directories (19 files); rootindex.mdgrows from 8 to 20 entries; nothing else changes. Thesearch-jobs/*content matches the hand-written pages currently in sourcegraph/docs.