Skip to content

fix: Preserve custom doc sections across generated reference updates#22486

Merged
kodiakhq[bot] merged 2 commits intomainfrom
doc/cli/preserve-custom-content-in-generated-docs
Apr 6, 2026
Merged

fix: Preserve custom doc sections across generated reference updates#22486
kodiakhq[bot] merged 2 commits intomainfrom
doc/cli/preserve-custom-content-in-generated-docs

Conversation

@JoeKarlsson
Copy link
Copy Markdown
Contributor

Problem

cloudquery/frontend#4444 added several custom documentation sections to the auto-generated CLI reference pages in the frontend repo:

  • ### Modes section in cloudquery_init.md — explaining AI-assisted, Basic interactive, and Non-interactive modes
  • ### Flag Details section in cloudquery_sync.md — full --summary-location field table and --invocation-id explanation
  • ## See Also navigation links appended to all 16 CLI reference pages

Because the CLI release workflow copies cli/docs/reference/*.md directly into the frontend repo (overwriting files), any new CLI version release — including cloudquery/frontend#4442 — strips those custom sections out. This is a recurring problem: every release would silently remove the manually-added content.

Fix

Rather than maintaining the content manually in the frontend repo (where it gets overwritten), we move ownership of the content here so it survives regeneration:

  1. cmd/init.go — Added initLong constant containing the ### Modes section. Changed Long: initShortLong: initLong so cobra includes it in the generated markdown under ### Synopsis.

  2. cmd/sync.go — Added syncLong constant containing the ### Flag Details section (including the full --summary-location JSONL field table and --invocation-id usage). Changed Long: syncShortLong: syncLong.

  3. cmd/doc.go — Added seeAlsoSections map (filename → markdown content) and appendSeeAlsoSections() post-processor. After doc.GenMarkdownTreeCustom runs, the post-processor opens each generated file and appends its See Also section. This keeps the See Also content co-located with the generation logic rather than scattered in 16 separate markdown files.

  4. docs/reference/*.md — Regenerated via make gen-docs. All 16 reference files now include their See Also sections; cloudquery_init.md includes the Modes section; cloudquery_sync.md includes the Flag Details section.

Also corrects the publishing guide URL in cloudquery_plugin_publish.md See Also — old path (/cli/advanced/publishing-an-integration-to-the-hub) updated to new path (/cli/integrations/creating-new-integration/publishing) per the redirect added in cloudquery/frontend#4444.

Verification

# Build — no errors
cd cli && go build ./...

# Regenerate docs
make gen-docs

# Confirm Modes section in init doc
grep -A 3 "### Modes" docs/reference/cloudquery_init.md
# → "The `init` command operates in one of three modes..."

# Confirm Flag Details in sync doc
grep -A 3 "### Flag Details" docs/reference/cloudquery_sync.md
# → "#### --summary-location"

# Confirm See Also appended to all 16 files
grep -l "## See Also" docs/reference/*.md | wc -l
# → 16

# Confirm updated publishing URL
grep "publishing" docs/reference/cloudquery_plugin_publish.md
# → /cli/integrations/creating-new-integration/publishing

All checks passed locally. The generated docs/reference/ files in this PR are the proof — they are the output of make gen-docs with these changes applied.

Related

  • cloudquery/frontend#4444 — added the custom content to the frontend (merged)
  • cloudquery/frontend#4442 — CLI version update blocked because it would strip that content (unblocked once this merges and a new CLI release is cut)

…ates

Add See Also navigation links, Modes section (init), and Flag Details
section (sync) to the CLI doc generation so they survive future version
release syncs to the frontend repo.
@JoeKarlsson JoeKarlsson requested a review from a team as a code owner April 6, 2026 14:54
@JoeKarlsson JoeKarlsson requested a review from dcelasun April 6, 2026 14:54
@erezrokah erezrokah changed the title doc(cli): preserve custom doc sections across generated reference updates fix: preserve custom doc sections across generated reference updates Apr 6, 2026
@erezrokah erezrokah changed the title fix: preserve custom doc sections across generated reference updates fix: Preserve custom doc sections across generated reference updates Apr 6, 2026
@erezrokah erezrokah added the automerge Automatically merge once required checks pass label Apr 6, 2026
@JoeKarlsson JoeKarlsson self-assigned this Apr 6, 2026
@kodiakhq kodiakhq bot merged commit 046f37e into main Apr 6, 2026
11 checks passed
@kodiakhq kodiakhq bot deleted the doc/cli/preserve-custom-content-in-generated-docs branch April 6, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants