Skip to content

fix(docs): generate CLI reference for Astro Starlight - #2096

Merged
ndimares merged 2 commits into
mainfrom
fix/cli-docs-astro-format
Jul 10, 2026
Merged

fix(docs): generate CLI reference for Astro Starlight#2096
ndimares merged 2 commits into
mainfrom
fix/cli-docs-astro-format

Conversation

@ndimares

@ndimares ndimares commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Problem

The Documentation workflow (.github/workflows/documentation.yml) regenerates the CLI reference docs into the marketing-site and opens a PR. The marketing-site has migrated from Nextra to Astro (Starlight), but the doc generator still emitted Nextra-style output. Running the action against the new site would have reverted the migration and broken the Astro build:

  • Missing title frontmatter — Starlight's docsSchema() requires a title on every page. The generator emitted no frontmatter for leaf pages and only asIndexPage: true for index pages, so regenerating would strip the hand-added titles → build failure.
  • Duplicate H1 — the generator wrote a # <name> body heading, but Starlight renders the frontmatter title as the page H1.
  • H1 inside command Long text — several commands' Long descriptions start with a # Heading, producing a second body H1. The migration had demoted these to ##.

Changes

internal/docs/docs.go:

  • Emit title: "<name>" frontmatter on every page; keep asIndexPage: true on index pages.
  • Drop the redundant # <name> body heading.
  • Add demoteHeadings() to demote # ## in Long/Details content, respecting fenced code blocks so # shell comments in usage examples are left intact.

cmd/docs/main.go:

  • Remove the dead _meta.tsx entry from the preserve-list (a Nextra sidebar file that no longer exists in the Astro structure).

The workflow YAML already targets the correct Astro path (src/content/docs/speakeasy-reference/cli) and sets CLI_RUNTIME: docs, so no change was needed there.

Verification

Running the generator in-place over the actual committed marketing-site docs now yields a byte-for-byte match — the only diff is pull.md's --output-dir default, which is the current working directory and resolves to the identical path on the CI runner. Static hand-authored files (getting-started.mdx, mise-toolkit.mdx, docker.mdx) are preserved. go build, go vet, and gofmt are clean.

🤖 Generated with Claude Code

The Documentation workflow regenerates the CLI reference into the
marketing-site, which has migrated from Nextra to Astro (Starlight).
The generator still emitted Nextra-style output, so running the action
would revert the migration and break the Astro build.

- Emit a required `title` frontmatter on every page (Starlight's
  docsSchema requires it); keep `asIndexPage: true` on index pages.
- Drop the redundant `# <name>` body heading, since Starlight renders
  the frontmatter title as the page's single H1.
- Demote `# ` headings in command Long descriptions to `## ` so they
  don't compete with the title H1, respecting fenced code blocks so
  shell comments in usage examples are left intact.
- Remove the dead `_meta.tsx` entry from the preserve-list (a Nextra
  sidebar file that no longer exists in the Astro structure).

Regenerating in-place over the committed docs now yields a byte-for-byte
match (aside from the env-specific --output-dir default in pull.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@AshGodfrey
AshGodfrey self-requested a review July 6, 2026 12:11
@ndimares
ndimares enabled auto-merge (squash) July 10, 2026 07:56
@ndimares
ndimares merged commit 778c04a into main Jul 10, 2026
5 of 6 checks passed
@ndimares
ndimares deleted the fix/cli-docs-astro-format branch July 10, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants