diff --git a/.gitignore b/.gitignore index 7843de9..a6d25ed 100644 --- a/.gitignore +++ b/.gitignore @@ -161,8 +161,6 @@ venv.bak/ # Rope project settings .ropeproject -# mkdocs documentation -/site # mypy .mypy_cache/ @@ -188,8 +186,13 @@ cython_debug/ # Generated documentation astro-site/node_modules/ astro-site/.astro/ -astro-site/src/content/docs/ astro-site/src/data/ -astro-site/public/ astro-site/test-results/ astro-site/playwright-report/ + +astro-site/src/content/docs/reference/ +astro-site/public/reference/ +astro-site/public/notebooks/ +astro-site/public/examples/ +astro-site/src/content/docs/guides/train-detect-model.md +astro-site/public/evidence/ diff --git a/HANDOFF.md b/HANDOFF.md new file mode 100644 index 0000000..1256f95 --- /dev/null +++ b/HANDOFF.md @@ -0,0 +1,9 @@ +# Canonical Astro documentation + +Goal: retire the MkDocs compatibility layer while preserving public content and routes. + +PR: https://github.com/AmbiqAI/sleepkit/pull/49. Authored Markdown/MDX, navigation, redirects and static assets now belong to Astro. API pages, notebooks and downloads remain generated. MkDocs configuration and unused dependencies are removed. + +Review: notebook source links, download command examples and generation regression coverage corrected. Local build, type checks, content checks and browser tests pass. Independent final review and CI on the fix commit gate merging. CompressionKIT follows this cleanup. + +Ownership: edit astro-site/src/content/docs for authored pages, src/navigation.mjs for navigation and notebooks/ for notebook sources. See astro-site/README.md for generated paths and validation commands. diff --git a/README.md b/README.md index 3e3ba42..c814a90 100644 --- a/README.md +++ b/README.md @@ -115,26 +115,26 @@ Checkout the [Guides](https://ambiqai.github.io/sleepkit/guides) to see detailed ### Hugging Face baseline artifacts -See [the artifact publishing guide](docs/huggingface-artifacts.md) for the additive +See [the artifact publishing guide](astro-site/src/content/docs/huggingface-artifacts.mdx) for the additive `python -m sleepkit.artifacts` workflow, starting with the historical SD-2-TCN-SM TFLite baseline. Staging and publication dry runs require no training runtime. ### Python detection recipe -See [the detection recipe guide](docs/detection-recipe.md) for a sensor-to-artifact +See [the detection recipe guide](astro-site/src/content/docs/detection-recipe.mdx) for a sensor-to-artifact pipeline with built-in feature generation, fitted preprocessing, held-out evaluation, and unlabeled inference. It is additive to the legacy task CLI. -The [first golden experiment](docs/detection-golden.md) pins the membership -baseline's config and dataset evidence. The [profiling harness](docs/detection-profiling.md) +The [first golden experiment](astro-site/src/content/docs/detection-golden.mdx) pins the membership +baseline's config and dataset evidence. The [profiling harness](astro-site/src/content/docs/detection-profiling.mdx) measures preparation, loading and training while preserving its finite sampling contract. ### Saved-feature sleep staging -The [staging baseline guide](docs/staging-baseline.md) provides an explicit +The [staging baseline guide](astro-site/src/content/docs/staging-baseline.mdx) provides an explicit read → preprocess → window → evaluate path for the historical SS-3 Keras model. It records cohort/input hashes and coverage while keeping historical provenance -limitations visible. The [staging training recipe](docs/staging-training.md) adds +limitations visible. The [staging training recipe](astro-site/src/content/docs/staging-training.mdx) adds explicit subject splits, Keras training, and prospective golden declarations. ### Licensing @@ -142,13 +142,13 @@ explicit subject splits, Keras training, and prospective golden declarations. The code and Ambiq-authored documentation/site content use [BSD-3-Clause](LICENSE), except material with a separate notice. Model weights and datasets have their own terms; public availability does not imply commercial-use permission. See the -[model licensing policy](docs/model-licensing-policy.md) for per-model choices, +[model licensing policy](astro-site/src/content/docs/model-licensing-policy.mdx) for per-model choices, research restrictions and proposed optional Ambiq device terms. ### Shared foundation direction -The [cross-KIT architecture proposal](docs/shared-foundation.md) describes the path +The [cross-KIT architecture proposal](docs-maintainers/shared-foundation.md) describes the path toward reusable heliaEDGE blocks, first-class TensorFlow/PyTorch workflows, measured input-pipeline improvements, and traceable golden releases across the KITs. -The [reusable-block candidates](docs/reusable-blocks.md) and synthetic signal recipe +The [reusable-block candidates](docs-maintainers/reusable-blocks.md) and synthetic signal recipe exercise the first local interfaces with Git-pinned heliaEDGE backend profiles. diff --git a/astro-site/MIGRATION.md b/astro-site/MIGRATION.md index 8f0039f..45a4186 100644 --- a/astro-site/MIGRATION.md +++ b/astro-site/MIGRATION.md @@ -45,3 +45,7 @@ Landing installation examples are copyable Bash commands with no Termynal progre ## Public documentation boundary Private implementation API modules and their redirects are excluded. Shared architecture proposals, reusable-component experiments, feature-preparation implementation notes and unadopted draft license terms stay in the repository and are not published. Public task workflows and model licensing guidance remain. The public site now contains 55 authored Markdown pages, one notebook and 110 API modules (216 catalog symbols). Output checks reject internal routes and private modules in the catalog/reference model. + +## Canonical sources + +The one-time MkDocs adapter has been retired. Authored pages are now in `src/content/docs/`, navigation in `src/navigation.mjs`, and static assets in `public/`. API and notebook generation remain. See README.md for source ownership. diff --git a/astro-site/README.md b/astro-site/README.md index 6fa3f59..196e7a1 100644 --- a/astro-site/README.md +++ b/astro-site/README.md @@ -1,6 +1,6 @@ # sleepKIT documentation site -The Astro/Starlight site reads the authored Markdown in `../docs` and the saved notebook in `../notebooks` and generates Python reference pages with Griffe. The Python package is inspected statically; no training dependencies or notebook execution are required. +The Astro/Starlight site reads the authored Markdown/MDX in `src/content/docs/` and the saved notebook in `../notebooks` and generates Python reference pages with Griffe. The Python package is inspected statically; no training dependencies or notebook execution are required. Use Node 24, Python 3.12 and uv: @@ -19,10 +19,14 @@ npm run check:output npm test ``` -`prepare:docs` regenerates `src/content/docs`, `src/data` and `public`. Do not edit those directories. Edit Markdown under `../docs`, Python docstrings, or the owning scripts. `mkdocs.yml` supplies the existing navigation during migration. `.cache/conversion.json` records syntax conversions and items requiring visual inspection. +Edit authored Markdown/MDX in `src/content/docs/`, navigation in `src/navigation.mjs`, static redirects in `src/redirects.json`, and static assets in `public/`. These are canonical sources and are never replaced by the build. -The notebook page uses `notebooks/train-detect-model.ipynb`, preserving its saved outputs, three figures and downloadable original. The earlier `docs/guides/` copy is retained as an archive download. Neither source is overwritten. Historical notebook outputs do not establish validation against the latest package. +`prepare:docs` generates only downloadable configuration examples, notebook guides/assets, and Python API pages/data. API output under `src/content/docs/reference/`, notebook `.md` pages under `guides/`, `src/data/`, and `public/{reference,notebooks,examples}/` are ignored. Edit Python docstrings or the notebooks in `../notebooks/` for those outputs. There is no MkDocs configuration or Markdown conversion step. + +The notebook page uses `notebooks/train-detect-model.ipynb`, preserving its saved outputs, three figures and downloadable original. The earlier documentation copy is retained in `notebooks/archive/` as an archive download. Neither source is overwritten. Historical notebook outputs do not establish validation against the latest package. The documentation workflow checks pull requests and publishes main to GitHub Pages. It can also be dispatched manually on main. It does not publish Python packages. Package publishing remains in the release workflows; documentation no longer depends on a package release. Public reference generation excludes underscore-prefixed implementation modules before rendering, so they do not appear in pages, catalog, search or machine-readable exports. `scripts/public-docs.mjs` lists repository-only maintainer/proposal pages omitted from publication. Their sources remain in the repository. + +Golden-contract evidence remains canonical under `../docs/evidence/` because experiment declarations reference those paths. The build copies it to `public/evidence/`; do not edit the generated copy. diff --git a/astro-site/package.json b/astro-site/package.json index 1400e45..415b2a0 100644 --- a/astro-site/package.json +++ b/astro-site/package.json @@ -9,7 +9,7 @@ "npm": ">=11" }, "scripts": { - "prepare:docs": "node scripts/build-content.mjs && python3 scripts/build-notebooks.py && node scripts/build-reference.mjs", + "prepare:docs": "node scripts/build-examples.mjs && python3 scripts/build-notebooks.py && node scripts/build-reference.mjs", "predev": "npm run prepare:docs", "dev": "astro dev", "prebuild": "npm run prepare:docs", @@ -17,7 +17,7 @@ "postbuild": "node scripts/publish-reference.mjs", "precheck": "npm run prepare:docs", "check": "astro check", - "check:output": "python3 scripts/check-doc-examples.py && node --test scripts/normalize-markdown.test.mjs && node scripts/check-output.mjs", + "check:output": "node --test scripts/canonical-content.test.mjs && python3 scripts/check-doc-examples.py && node scripts/check-output.mjs", "test": "playwright test" }, "dependencies": { diff --git a/docs/assets/favicon.png b/astro-site/public/assets/favicon.png similarity index 100% rename from docs/assets/favicon.png rename to astro-site/public/assets/favicon.png diff --git a/docs/assets/guides/stage/ablation-dilation.html b/astro-site/public/assets/guides/stage/ablation-dilation.html similarity index 100% rename from docs/assets/guides/stage/ablation-dilation.html rename to astro-site/public/assets/guides/stage/ablation-dilation.html diff --git a/docs/assets/guides/stage/ablation-kernelsize.html b/astro-site/public/assets/guides/stage/ablation-kernelsize.html similarity index 100% rename from docs/assets/guides/stage/ablation-kernelsize.html rename to astro-site/public/assets/guides/stage/ablation-kernelsize.html diff --git a/docs/assets/guides/stage/ablation-se-ratio.html b/astro-site/public/assets/guides/stage/ablation-se-ratio.html similarity index 100% rename from docs/assets/guides/stage/ablation-se-ratio.html rename to astro-site/public/assets/guides/stage/ablation-se-ratio.html diff --git a/docs/assets/guides/stage/ablation-temporal.html b/astro-site/public/assets/guides/stage/ablation-temporal.html similarity index 100% rename from docs/assets/guides/stage/ablation-temporal.html rename to astro-site/public/assets/guides/stage/ablation-temporal.html diff --git a/docs/assets/guides/stage/ablation-width.html b/astro-site/public/assets/guides/stage/ablation-width.html similarity index 100% rename from docs/assets/guides/stage/ablation-width.html rename to astro-site/public/assets/guides/stage/ablation-width.html diff --git a/docs/assets/guides/stage/sleep-cycle-pie.html b/astro-site/public/assets/guides/stage/sleep-cycle-pie.html similarity index 100% rename from docs/assets/guides/stage/sleep-cycle-pie.html rename to astro-site/public/assets/guides/stage/sleep-cycle-pie.html diff --git a/docs/assets/logo-white.png b/astro-site/public/assets/logo-white.png similarity index 100% rename from docs/assets/logo-white.png rename to astro-site/public/assets/logo-white.png diff --git a/docs/assets/logo.png b/astro-site/public/assets/logo.png similarity index 100% rename from docs/assets/logo.png rename to astro-site/public/assets/logo.png diff --git a/docs/assets/sleepkit-banner.png b/astro-site/public/assets/sleepkit-banner.png similarity index 100% rename from docs/assets/sleepkit-banner.png rename to astro-site/public/assets/sleepkit-banner.png diff --git a/docs/assets/sleepkit-logo-dark.png b/astro-site/public/assets/sleepkit-logo-dark.png similarity index 100% rename from docs/assets/sleepkit-logo-dark.png rename to astro-site/public/assets/sleepkit-logo-dark.png diff --git a/docs/assets/sleepkit-logo-light.png b/astro-site/public/assets/sleepkit-logo-light.png similarity index 100% rename from docs/assets/sleepkit-logo-light.png rename to astro-site/public/assets/sleepkit-logo-light.png diff --git a/docs/assets/tasks/detect/ambiq-watch.webp b/astro-site/public/assets/tasks/detect/ambiq-watch.webp similarity index 100% rename from docs/assets/tasks/detect/ambiq-watch.webp rename to astro-site/public/assets/tasks/detect/ambiq-watch.webp diff --git a/docs/assets/tasks/detect/demo-sleep-cycle-pie.html b/astro-site/public/assets/tasks/detect/demo-sleep-cycle-pie.html similarity index 100% rename from docs/assets/tasks/detect/demo-sleep-cycle-pie.html rename to astro-site/public/assets/tasks/detect/demo-sleep-cycle-pie.html diff --git a/docs/assets/tasks/sleepkit-task-diagram.svg b/astro-site/public/assets/tasks/sleepkit-task-diagram.svg similarity index 100% rename from docs/assets/tasks/sleepkit-task-diagram.svg rename to astro-site/public/assets/tasks/sleepkit-task-diagram.svg diff --git a/docs/assets/tasks/stage/ambiq-watch.webp b/astro-site/public/assets/tasks/stage/ambiq-watch.webp similarity index 100% rename from docs/assets/tasks/stage/ambiq-watch.webp rename to astro-site/public/assets/tasks/stage/ambiq-watch.webp diff --git a/docs/assets/tasks/stage/demo-sleep-cycle-pie.html b/astro-site/public/assets/tasks/stage/demo-sleep-cycle-pie.html similarity index 100% rename from docs/assets/tasks/stage/demo-sleep-cycle-pie.html rename to astro-site/public/assets/tasks/stage/demo-sleep-cycle-pie.html diff --git a/docs/assets/tasks/stage/sleep-cycle-pie.html b/astro-site/public/assets/tasks/stage/sleep-cycle-pie.html similarity index 100% rename from docs/assets/tasks/stage/sleep-cycle-pie.html rename to astro-site/public/assets/tasks/stage/sleep-cycle-pie.html diff --git a/docs/assets/tasks/stage/sleep-stage.svg b/astro-site/public/assets/tasks/stage/sleep-stage.svg similarity index 100% rename from docs/assets/tasks/stage/sleep-stage.svg rename to astro-site/public/assets/tasks/stage/sleep-stage.svg diff --git a/docs/assets/tcn.svg b/astro-site/public/assets/tcn.svg similarity index 100% rename from docs/assets/tcn.svg rename to astro-site/public/assets/tcn.svg diff --git a/docs/assets/zoo/apnea/sa-2-tcn-lg-cm.html b/astro-site/public/assets/zoo/apnea/sa-2-tcn-lg-cm.html similarity index 100% rename from docs/assets/zoo/apnea/sa-2-tcn-lg-cm.html rename to astro-site/public/assets/zoo/apnea/sa-2-tcn-lg-cm.html diff --git a/docs/assets/zoo/apnea/sa-2-tcn-sm-ahi-cm.html b/astro-site/public/assets/zoo/apnea/sa-2-tcn-sm-ahi-cm.html similarity index 100% rename from docs/assets/zoo/apnea/sa-2-tcn-sm-ahi-cm.html rename to astro-site/public/assets/zoo/apnea/sa-2-tcn-sm-ahi-cm.html diff --git a/docs/assets/zoo/apnea/sa-2-tcn-sm-ahi-scatter.html b/astro-site/public/assets/zoo/apnea/sa-2-tcn-sm-ahi-scatter.html similarity index 100% rename from docs/assets/zoo/apnea/sa-2-tcn-sm-ahi-scatter.html rename to astro-site/public/assets/zoo/apnea/sa-2-tcn-sm-ahi-scatter.html diff --git a/docs/assets/zoo/apnea/sa-2-tcn-sm-cm.html b/astro-site/public/assets/zoo/apnea/sa-2-tcn-sm-cm.html similarity index 100% rename from docs/assets/zoo/apnea/sa-2-tcn-sm-cm.html rename to astro-site/public/assets/zoo/apnea/sa-2-tcn-sm-cm.html diff --git a/docs/assets/zoo/detect/detect-2-cm.html b/astro-site/public/assets/zoo/detect/detect-2-cm.html similarity index 100% rename from docs/assets/zoo/detect/detect-2-cm.html rename to astro-site/public/assets/zoo/detect/detect-2-cm.html diff --git a/docs/assets/zoo/detect/detect-2-eff.html b/astro-site/public/assets/zoo/detect/detect-2-eff.html similarity index 100% rename from docs/assets/zoo/detect/detect-2-eff.html rename to astro-site/public/assets/zoo/detect/detect-2-eff.html diff --git a/docs/assets/zoo/detect/detect-2-eff.json b/astro-site/public/assets/zoo/detect/detect-2-eff.json similarity index 100% rename from docs/assets/zoo/detect/detect-2-eff.json rename to astro-site/public/assets/zoo/detect/detect-2-eff.json diff --git a/docs/assets/zoo/detect/detect-2-tst.html b/astro-site/public/assets/zoo/detect/detect-2-tst.html similarity index 100% rename from docs/assets/zoo/detect/detect-2-tst.html rename to astro-site/public/assets/zoo/detect/detect-2-tst.html diff --git a/docs/assets/zoo/detect/detect-2-tst.json b/astro-site/public/assets/zoo/detect/detect-2-tst.json similarity index 100% rename from docs/assets/zoo/detect/detect-2-tst.json rename to astro-site/public/assets/zoo/detect/detect-2-tst.json diff --git a/docs/assets/zoo/detect/sleep-detect-2-cm.png b/astro-site/public/assets/zoo/detect/sleep-detect-2-cm.png similarity index 100% rename from docs/assets/zoo/detect/sleep-detect-2-cm.png rename to astro-site/public/assets/zoo/detect/sleep-detect-2-cm.png diff --git a/docs/assets/zoo/detect/sleep-detect-demo.html b/astro-site/public/assets/zoo/detect/sleep-detect-demo.html similarity index 100% rename from docs/assets/zoo/detect/sleep-detect-demo.html rename to astro-site/public/assets/zoo/detect/sleep-detect-demo.html diff --git a/docs/assets/zoo/stage/block-latency.html b/astro-site/public/assets/zoo/stage/block-latency.html similarity index 100% rename from docs/assets/zoo/stage/block-latency.html rename to astro-site/public/assets/zoo/stage/block-latency.html diff --git a/docs/assets/zoo/stage/sleep-stage-4-cm.png b/astro-site/public/assets/zoo/stage/sleep-stage-4-cm.png similarity index 100% rename from docs/assets/zoo/stage/sleep-stage-4-cm.png rename to astro-site/public/assets/zoo/stage/sleep-stage-4-cm.png diff --git a/docs/assets/zoo/stage/sleep-stage-5-cm.png b/astro-site/public/assets/zoo/stage/sleep-stage-5-cm.png similarity index 100% rename from docs/assets/zoo/stage/sleep-stage-5-cm.png rename to astro-site/public/assets/zoo/stage/sleep-stage-5-cm.png diff --git a/docs/assets/zoo/stage/sleep-stage-demo-example.html b/astro-site/public/assets/zoo/stage/sleep-stage-demo-example.html similarity index 100% rename from docs/assets/zoo/stage/sleep-stage-demo-example.html rename to astro-site/public/assets/zoo/stage/sleep-stage-demo-example.html diff --git a/docs/assets/zoo/stage/sleep-stage-demo.html b/astro-site/public/assets/zoo/stage/sleep-stage-demo.html similarity index 100% rename from docs/assets/zoo/stage/sleep-stage-demo.html rename to astro-site/public/assets/zoo/stage/sleep-stage-demo.html diff --git a/docs/assets/zoo/stage/ss-2-tcn-sm-cm.html b/astro-site/public/assets/zoo/stage/ss-2-tcn-sm-cm.html similarity index 100% rename from docs/assets/zoo/stage/ss-2-tcn-sm-cm.html rename to astro-site/public/assets/zoo/stage/ss-2-tcn-sm-cm.html diff --git a/docs/assets/zoo/stage/ss-2-tcn-sm-eff.html b/astro-site/public/assets/zoo/stage/ss-2-tcn-sm-eff.html similarity index 100% rename from docs/assets/zoo/stage/ss-2-tcn-sm-eff.html rename to astro-site/public/assets/zoo/stage/ss-2-tcn-sm-eff.html diff --git a/docs/assets/zoo/stage/ss-2-tcn-sm-tst.html b/astro-site/public/assets/zoo/stage/ss-2-tcn-sm-tst.html similarity index 100% rename from docs/assets/zoo/stage/ss-2-tcn-sm-tst.html rename to astro-site/public/assets/zoo/stage/ss-2-tcn-sm-tst.html diff --git a/docs/assets/zoo/stage/ss-3-tcn-sm-cm.html b/astro-site/public/assets/zoo/stage/ss-3-tcn-sm-cm.html similarity index 100% rename from docs/assets/zoo/stage/ss-3-tcn-sm-cm.html rename to astro-site/public/assets/zoo/stage/ss-3-tcn-sm-cm.html diff --git a/docs/assets/zoo/stage/ss-3-tcn-sm-eff.html b/astro-site/public/assets/zoo/stage/ss-3-tcn-sm-eff.html similarity index 100% rename from docs/assets/zoo/stage/ss-3-tcn-sm-eff.html rename to astro-site/public/assets/zoo/stage/ss-3-tcn-sm-eff.html diff --git a/docs/assets/zoo/stage/ss-3-tcn-sm-tst.html b/astro-site/public/assets/zoo/stage/ss-3-tcn-sm-tst.html similarity index 100% rename from docs/assets/zoo/stage/ss-3-tcn-sm-tst.html rename to astro-site/public/assets/zoo/stage/ss-3-tcn-sm-tst.html diff --git a/docs/assets/zoo/stage/ss-4-tcn-sm-cm.html b/astro-site/public/assets/zoo/stage/ss-4-tcn-sm-cm.html similarity index 100% rename from docs/assets/zoo/stage/ss-4-tcn-sm-cm.html rename to astro-site/public/assets/zoo/stage/ss-4-tcn-sm-cm.html diff --git a/docs/assets/zoo/stage/ss-4-tcn-sm-eff.html b/astro-site/public/assets/zoo/stage/ss-4-tcn-sm-eff.html similarity index 100% rename from docs/assets/zoo/stage/ss-4-tcn-sm-eff.html rename to astro-site/public/assets/zoo/stage/ss-4-tcn-sm-eff.html diff --git a/docs/assets/zoo/stage/ss-4-tcn-sm-tst.html b/astro-site/public/assets/zoo/stage/ss-4-tcn-sm-tst.html similarity index 100% rename from docs/assets/zoo/stage/ss-4-tcn-sm-tst.html rename to astro-site/public/assets/zoo/stage/ss-4-tcn-sm-tst.html diff --git a/docs/assets/zoo/stage/ss-5-tcn-sm-cm.html b/astro-site/public/assets/zoo/stage/ss-5-tcn-sm-cm.html similarity index 100% rename from docs/assets/zoo/stage/ss-5-tcn-sm-cm.html rename to astro-site/public/assets/zoo/stage/ss-5-tcn-sm-cm.html diff --git a/docs/assets/zoo/stage/ss-5-tcn-sm-eff.html b/astro-site/public/assets/zoo/stage/ss-5-tcn-sm-eff.html similarity index 100% rename from docs/assets/zoo/stage/ss-5-tcn-sm-eff.html rename to astro-site/public/assets/zoo/stage/ss-5-tcn-sm-eff.html diff --git a/docs/assets/zoo/stage/ss-5-tcn-sm-tst.html b/astro-site/public/assets/zoo/stage/ss-5-tcn-sm-tst.html similarity index 100% rename from docs/assets/zoo/stage/ss-5-tcn-sm-tst.html rename to astro-site/public/assets/zoo/stage/ss-5-tcn-sm-tst.html diff --git a/astro-site/scripts/build-content.mjs b/astro-site/scripts/build-content.mjs deleted file mode 100644 index 21e8fe3..0000000 --- a/astro-site/scripts/build-content.mjs +++ /dev/null @@ -1,175 +0,0 @@ -import { internalPages } from "./public-docs.mjs"; -import { - existsSync, - readFileSync, - writeFileSync, - mkdirSync, - readdirSync, - cpSync, - rmSync, -} from "node:fs"; -import { dirname, resolve, relative } from "node:path"; -import { - convertPage, - createState, - parseNav, - buildSidebar, -} from "../node_modules/@ambiqai/helia-ui/scripts/lib/mkdocs-convert-render.mjs"; -import { normalizeMarkdown, expandSnippets } from "./normalize-markdown.mjs"; -const source = resolve("../docs"); -const out = resolve("src/content/docs"); -const walk = (dir) => - readdirSync(dir, { withFileTypes: true }).flatMap((e) => - e.isDirectory() ? walk(resolve(dir, e.name)) : [resolve(dir, e.name)], - ); -const state = createState(); -const titles = {}; -rmSync(out, { recursive: true, force: true }); -mkdirSync(out, { recursive: true }); -rmSync("public/examples", { recursive: true, force: true }); -mkdirSync("src/data", { recursive: true }); -function readSnippet(file) { - const path = resolve(source, file); - if (!path.startsWith(source + "/")) - throw Error(`Snippet outside docs: ${file}`); - if (!existsSync(path)) { - if (file !== "assets/segmentation_example.html") - throw Error(`Missing snippet: ${file}`); - state.handPass.push(`Missing source snippet: ${file}`); - return "> The source repository does not include this example asset."; - } - if (file.endsWith(".html")) - return `