Repository navigation
q2 docs serve / open: browse the embedded docs site offline - #921
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pyh) Embed the whole rendered docs site, not just the llms.txt artifacts, and serve it from memory with `q2 docs serve` (visible alias `q2 docs open`). An optional page argument deep-links, resolved with the same normalization and near-miss suggestions as `q2 docs llms <href>`. One embed now feeds both commands: - `cargo xtask build-agents-docs` clears and re-renders docs/_site, stages it whole under agents-docs-dist/site/ plus the llms ledger, and fails if the site loads any remote subresource (new docs_offline_check; only the theme's Google Fonts import is allowlisted). - crates/quarto/build.rs archives the dist as a deterministic tar.zst, ordered llms-first (73 MB site -> 3.6 MB archive). - commands/docs_embed.rs decodes it: `docs llms` stream-decodes only the metadata + ledger prefix (+1.1 ms per call, release, measured with hyperfine), `docs serve` decodes everything once (~19 ms to first response). include_dir is gone from the quarto crate. - quarto_preview::static_mode::embedded_site is a small read-only router over in-memory files (no reload client, SSE, or pdf.js). Also: docs page + AGENTS.md updates, and a release-workflow smoke check that the binary serves the docs home page (non-Windows legs). Plan: claude-notes/plans/2026-10-26-q2-docs-serve.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Summary
Adds
q2 docs serve(visible aliasq2 docs open). It starts a local web server for the Quarto 2 documentation site embedded in the binary, which is the documentation for exactly the running version. It opens the site in the browser and serves it until Ctrl-C. Nothing is fetched from the network and nothing is written to disk.An unknown page fails before the server starts, with the same near-miss suggestions as
q2 docs llms.One embed for both
docs serveanddocs llmscargo xtask build-agents-docs): clears and re-rendersdocs/_site(q2 renderdoesn't remove output for deleted pages), then stages the whole site underagents-docs-dist/site/plus the llms ledger. It now fails if the site loads any remote subresource (newdocs_offline_check: HTML subresource tags,<style>blocks, CSS@import/url()). The only allowlisted remote resource is the theme's Google Fonts import; offline, text falls back to the system sans-serif.crates/quarto/build.rs): a deterministic tar.zst ordered llms-first (metadata, ledger-listed files, then the rest). The 73 MB / 1454-file site compresses to 3.6 MB.commands/docs_embed.rs):docs llmsstream-decodes only the llms prefix;docs servedecodes everything once.include_diris gone from thequartocrate.quarto_preview::static_mode::embedded_site): a small read-only router over in-memory files. It reuses the static server's path-decoding, 404, and redirect helpers but has no reload client, SSE, or pdf.js.Measured (release build, M-series)
q2 docs llms <page>(hyperfine)q2 docs servelaunch → first 200Also
docs/guides/embedded-docs.qmd: new "Reading the docs in a browser" section (retitled "Embedded documentation"); AGENTS.md § embedded docs updated.docs serveserves the home page (non-Windows legs, since backgrounding and killing a native process from Git Bash is unreliable; the existing--embed-infogate still covers Windows).agents-docs-dist//build-agents-docsdeferred to bd-7tkifpnh.Plan with the design assessment and measurements:
claude-notes/plans/2026-10-26-q2-docs-serve.md. Braid: bd-x248xpyh.Test plan
DocsEmbedported to the decoded map (existing suite unchanged in behaviour; non-ledger site files invisible todocs llms), page → URL mapping,serve/openparse equivalence, router (index, dir redirect, MIME, percent-decoding, traversal 404, HEAD, 405), staging (whole site + ledger, dotfiles skipped, stale clearing), offline scanner fixturesdocs_serve_cli.rs) pass in both embed states, real and placeholder (verified locally in each)cargo xtask verifygreen (all 14 steps; 17,346 Rust tests) before the rebase onto Rewire hub from samod access-policy fork to upstream samod 0.16.0 #917; after the rebase, thequartodocs tests andquarto-previewrouter tests were rerun greencargo xtask check-noop-rebuildgreenxtask;quarto/quarto-previewcan't cross-check from macOS (ring), so they rely on the CIwindows-latestclippy legfonts.googleapis.com/fonts.gstatic.com🤖 Generated with Claude Code