Skip to content

Commit c7d299a

Browse files
authored
Merge pull request #921 from quarto-dev/feature/bd-x248xpyh-q2-docs-serve
q2 docs serve / open: browse the embedded docs site offline
2 parents a776b46 + 874ed16 commit c7d299a

21 files changed

Lines changed: 2119 additions & 248 deletions

File tree

‎.github/workflows/release-pipeline.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,28 @@ jobs:
792792
*"(dirty)") echo "::warning::embedded docs were staged from a dirty tree at $EXPECTED_SHA" ;;
793793
esac
794794
795+
# `q2 docs serve` (bd-x248xpyh) reads the same embed; prove the
796+
# binary can decode it and serve the site's home page. Skipped
797+
# on Windows, where backgrounding and killing a native process
798+
# from Git Bash is unreliable; the embed-info gate above still
799+
# covers the Windows embed.
800+
if [ "$RUNNER_OS" != "Windows" ]; then
801+
"$BIN" docs serve --no-browser --port 0 > docs-serve.out 2>&1 &
802+
SERVE_PID=$!
803+
DOCS_URL=""
804+
for _ in $(seq 1 50); do
805+
DOCS_URL=$(grep -o 'http://127\.0\.0\.1:[0-9]*/' docs-serve.out | head -n 1 || true)
806+
[ -n "$DOCS_URL" ] && break
807+
sleep 0.2
808+
done
809+
if [ -z "$DOCS_URL" ] || ! curl -fsS "$DOCS_URL" | grep -q 'Quarto 2'; then
810+
echo "::error::\`q2 docs serve\` did not serve the embedded docs home page"
811+
cat docs-serve.out
812+
FAIL=1
813+
fi
814+
kill "$SERVE_PID" 2>/dev/null || true
815+
fi
816+
795817
# Embedded bundler: build a tiny extension with the release binary.
796818
# It runs the embedded rollup driver under the runner's Node 24 (the
797819
# same Node TS engine extensions need), so this is where the musl and

‎AGENTS.md‎

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -505,33 +505,41 @@ with a cargo warning); `q2 mcp` then fails at runtime pointing at the
505505
xtask. Design: `claude-notes/plans/2026-06-11-q2-mcp-hub-auth.md`
506506
(bd-81cfshmw).
507507

508-
## Refreshing the embedded docs for `q2 docs llms`
508+
## Refreshing the embedded docs for `q2 docs llms` / `q2 docs serve`
509509

510510
The same trap once more, with one twist. `q2 docs llms` (aliased as `q2
511511
agents-info`) serves the docs site's llms.txt mirror — the index, the
512-
per-page `.md` companions, and `llms-full.txt` — embedded from
513-
`agents-docs-dist/` via `include_dir!`. After changing anything under
514-
`docs/`, the embed is stale until you run:
512+
per-page `.md` companions, and `llms-full.txt` — and `q2 docs serve`
513+
(aliased as `q2 docs open`) serves the whole rendered HTML site offline.
514+
Both read one embed: `agents-docs-dist/` (the rendered site plus the llms
515+
ledger), archived as a tar.zst by `crates/quarto/build.rs` and stored
516+
llms-first so `docs llms` decodes only its prefix. After changing
517+
anything under `docs/`, the embed is stale until you run:
515518

516519
```bash
517520
cargo xtask build-agents-docs # render docs/, stage agents-docs-dist/
518-
cargo build --bin q2 # re-embed via include_dir!
521+
cargo build --bin q2 # re-embed (build.rs re-archives)
519522
```
520523

521524
The twist: staging *renders the docs with `q2` itself*, so unlike every
522525
other embed artifact this step runs **after** a Rust build, not before.
523526
`cargo xtask build-all` reflects that — its docs step comes last and
524527
ends with its own `cargo build --bin q2` (skip it with
525-
`--skip-agents-docs`).
528+
`--skip-agents-docs`). Staging also fails if the site loads a remote
529+
subresource (a CDN script, stylesheet, iframe, …): the embedded docs
530+
must work offline. The allowlist lives in
531+
`crates/xtask/src/docs_offline_check.rs`.
526532

527533
Diagnose staleness with `q2 docs llms --embed-info`, which prints the
528534
source commit, a `(dirty)` marker, and the page count. Fresh clones
529535
build fine without the staged tree (a placeholder is embedded, with a
530-
cargo warning); `q2 docs llms` then fails at runtime pointing at the
531-
xtask. `agents-docs-dist/` is generated and gitignored — never commit
532-
it. The release workflow stages it once in `web-payloads` and fails any
533-
leg whose binary reports a placeholder or a foreign commit. Design:
534-
`claude-notes/plans/2026-08-24-agents-info-command.md` (bd-hwop1zii).
536+
cargo warning); `q2 docs llms` and `q2 docs serve` then fail at runtime
537+
pointing at the xtask. `agents-docs-dist/` is generated and gitignored —
538+
never commit it. The release workflow stages it once in `web-payloads`
539+
and fails any leg whose binary reports a placeholder or a foreign
540+
commit. Design: `claude-notes/plans/2026-08-24-agents-info-command.md`
541+
(bd-hwop1zii), `claude-notes/plans/2026-10-26-q2-docs-serve.md`
542+
(bd-x248xpyh).
535543

536544
## Build Commands
537545

‎Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)