Independently buildable Astro/Starlight site for OpenSpec documentation. English docs are imported at build time from a pinned upstream submodule; the locale homes and reviewed translations (nine non-English locales under src/content/docs/<locale>/) are site-owned. Read this before editing or building.
- Package
@hagicode/openspec-docs(private). Built with Astro + Starlight; shared shell from@hagicode/hagilight/@hagicode/hagilight-starlightpinned to an exact published version inpackage.json(the current compatibility boundary).
git submodule update --init --recursive # required before first build (upstream/openspec)
npm install
npm run dev # import:english + astro dev
npm run build # import:english + astro build
npm run preview # serve the production build
npm run check # import:english + check:translation-baselines + astro check
npm run test:fast # no-build first pass; delegates to npm run check
npm run check:translation-baselines # audit reviewed translations
npm test # node --test test/*.test.mjsBefore a pull request: npm run check, npm run build, npm test.
upstream/openspec/— git submodule (Fission-AI/openspec) pinned to an exact source revision; builds never fetch the latest branch.scripts/import-upstream-docs.mjs→upstream-docs.mjs(importdocs/**/*.md, mapdocs/README.mdto English home, preserve tree, resolve links/assets, fail on missing/unsupported input),english-fallbacks.mjs(tracks generated fallbacks insrc/content/docs/.generated-english-fallbacks.json),check-translation-baselines.mjs.src/— site-owned Starlight config (content.config.ts),components/,content/(generateddocs/en-US/+translation-baselines.json),i18n/,lib/,pages/,styles/. Generated content undersrc/content/docs/en-US/is Git-ignored and replaced every run.test/—built-pages.test.mjs,upstream-docs.test.mjs,hagilight-discovery.test.mjs(robots, sitemap and RSS indist/),locale-navigation.test.mjs,workflows.test.mjs.
- Do not edit generated
src/content/docs/en-US/pages; change upstream and review a new pinned revision. Generated pages are never used as a fallback when the submodule is unavailable. - Reviewed translation topics use the same paths as their English sources; keep them under the site-owned locale path.
src/content/translation-baselines.jsonrecords each reviewed translation: source path, SHA-256, and reviewed upstream revision. Compute the source hash withsha256sum upstream/openspec/docs/<source-file>.npm run check:translation-baselinesreports changed/removed sources and authored translations without a baseline (generated fallbacks are excluded). Locale homes are shell content, not topic translations, and need no baseline.- AI-disclosure frontmatter: omit
isAITranslationto keep the notice enabled; setisAITranslation: falsefor human-authored pages. English pages are not labeled as translations. - To convert a generated English fallback into an authored translation: remove its
isEnglishFallbackflag, edit, add a reviewed baseline, then re-runnpm run import:english. - Canonical URL
https://openspec.hagicode.com(publishing the branch does not configure a host or DNS). Hagilight Starlight provides/rss.xmland per-language feeds at/rss.<locale>.xmlusing package defaults; there is no site-owned all-language feed. - Hagilight owns header, locale chooser, footer, content-width control, site links, article-end promotion, analytics (GA
G-EN03FMT2Q4, 51LAL6b88a5yK4h2Xnciwith screen recording), and the campaign banner. Review privacy/consent before publishing.
npm run test:fastdoes not validate built pages or production output; runnpm testafter a build (npm run buildfirst) since suites assert on built output.
- CI (
.github/workflows/docs-ci.yml) runs for PRs targetingmain, pushes tomain, and a weekly schedule, usingnpm ci+ check/build/test on Node.js 24 (the deploy workflow also uses 24). docs-deploy-gh-pages.ymlruns on pushes tomain(and manually formainonly) and publishes the verified build:esa.jsonc,wrangler.jsonc, anddist/at thegh-pagesbranch root. The build job is read-only; only the publisher needscontents: write. Deploy configs live in.github/gh-pages/. Enable ActionsGITHUB_TOKENwrite in repo settings.- Commit a new submodule pointer only after reviewing source changes and the generated site; publication remains gated on successful verification.