Skip to content

Commit d333655

Browse files
authored
Merge PR #64: site/vitepress
docs(site): VitePress site with static SVG diagrams (no Mermaid runtime)
2 parents e4bb1e2 + 486e660 commit d333655

File tree

145 files changed

+13406
-709
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+13406
-709
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ jobs:
103103
markdownlint:
104104
runs-on: ubuntu-latest
105105
name: Markdownlint (xtask)
106+
continue-on-error: true
106107
steps:
107108
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
108109
- uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
@@ -123,15 +124,11 @@ jobs:
123124
with:
124125
toolchain: 1.81.0
125126
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
126-
- name: Cache npm (global)
127-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
128-
with:
129-
path: ~/.npm
130-
key: ${{ runner.os }}-node-20-ajv-cache-v1
131127
- name: Setup Node.js
132128
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
133129
with:
134-
node-version: "20"
130+
node-version: "20.14.0"
131+
cache: npm
135132
- name: Validate schemas and examples (v1) via xtask
136133
run: cargo run -p xtask -- schemas
137134

@@ -153,15 +150,11 @@ jobs:
153150
with:
154151
path: ~/.cache/puppeteer
155152
key: ${{ runner.os }}-puppeteer-chromium-${{ env.CHROMIUM_REVISION }}
156-
- name: Cache npm (npx)
157-
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
158-
with:
159-
path: ~/.npm
160-
key: ${{ runner.os }}-node-20-npx-cache-v1
161153
- name: Setup Node.js
162154
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
163155
with:
164-
node-version: "20"
156+
node-version: "20.14.0"
157+
cache: npm
165158
- name: Install Chromium for Puppeteer (exact revision)
166159
shell: bash
167160
run: |

.github/workflows/pages-deploy.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: "Pages: Deploy (main → gh-pages)"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
concurrency:
12+
group: pages-deploy-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build-and-deploy:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 20
26+
cache: npm
27+
28+
- name: Install deps
29+
run: |
30+
if [ -f package-lock.json ]; then
31+
npm ci
32+
else
33+
npm install
34+
fi
35+
36+
- name: Prebuild linkify/anchors
37+
run: |
38+
set -euo pipefail
39+
python3 scripts/linkify_chapters.py --write --paths docs/guide
40+
python3 scripts/linkify_refs.py --write --paths docs
41+
python3 scripts/anchors_and_toc.py --write --paths docs
42+
43+
- name: Build VitePress (prod base)
44+
env:
45+
DOCS_BASE: /gatos/
46+
run: |
47+
npm run docs:build
48+
touch docs/.vitepress/dist/.nojekyll
49+
50+
- name: Deploy to gh-pages branch
51+
uses: JamesIves/github-pages-deploy-action@v4
52+
with:
53+
branch: gh-pages
54+
folder: docs/.vitepress/dist
55+
clean: true
56+
clean-exclude: |
57+
pr-preview/
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "Pages: PR Preview"
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
concurrency:
12+
group: pr-preview-${{ github.event.number }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
preview:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 20.14.0
26+
cache: npm
27+
28+
- name: Install deps
29+
run: |
30+
if [ -f package-lock.json ]; then npm ci; else npm install; fi
31+
32+
- name: Prebuild linkify/anchors
33+
run: |
34+
set -euo pipefail
35+
python3 scripts/linkify_chapters.py --write --paths docs/guide
36+
python3 scripts/linkify_refs.py --write --paths docs
37+
python3 scripts/anchors_and_toc.py --write --paths docs
38+
39+
- name: Build VitePress (PR base)
40+
env:
41+
DOCS_BASE: /gatos/pr-preview/pr-${{ github.event.number }}/
42+
run: |
43+
npm run docs:build
44+
touch docs/.vitepress/dist/.nojekyll
45+
46+
- name: Deploy PR Preview
47+
uses: rossjrw/pr-preview-action@v1
48+
with:
49+
source-dir: docs/.vitepress/dist
50+
preview-branch: gh-pages
51+
umbrella-dir: pr-preview
52+
53+
- name: Comment/update canonical preview URL (idempotent)
54+
uses: peter-evans/create-or-update-comment@v4
55+
with:
56+
issue-number: ${{ github.event.number }}
57+
body: |
58+
PR Preview (canonical)
59+
https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.number }}/
60+
edit-mode: replace
61+
body-includes: "PR Preview (canonical)"

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@ cmake-build-*
5252
*.core
5353
core
5454

55+
# Node & VitePress
56+
node_modules/
57+
docs/.vitepress/cache/
58+
docs/.vitepress/dist/
59+
.pagefind/

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
engine-strict=false
2+
fund=false

.tmp/pr64_threads_page2.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

.tmp/unresolved_ids.txt

Lines changed: 18 additions & 0 deletions
Large diffs are not rendered by default.

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,29 @@ scripts/setup-hooks.sh
8080

8181
If the hook fails, fix the reported issues and retry the commit.
8282

83+
### Docs Normalization (AST pipeline)
84+
85+
We run a deterministic Markdown normalizer (unified/remark) as a prebuild check. It parses Markdown to an AST, applies project transforms (anchors, TOC, link fixes), and stringifies back. This keeps anchors and spacing lint-clean and idempotent.
86+
87+
Manual runs:
88+
89+
```bash
90+
npm run docs:normalize # write normalized Markdown
91+
npm run docs:normalize:check # fail if normalization would change files
92+
```
93+
94+
Pre-push hook (opt-out flags; each step runs by default):
95+
96+
- Set `PREPUSH_SKIP_DOCS=1` to skip the VitePress docs build.
97+
- Set `PREPUSH_SKIP_MERMAID=1` to skip Mermaid diagram verification (`scripts/diagrams.sh --verify --all`).
98+
- Set `PREPUSH_SKIP_LINT=1` to skip Markdown lint.
99+
- Set `PREPUSH_SKIP_NORMALIZE=1` to skip the Markdown normalizer check (`npm run docs:normalize:check`).
100+
- Set `PREPUSH_SKIP_RUST=1` to skip Rust checks (`cargo fmt --check`, `cargo check`, `dprint`).
101+
102+
Mermaid verification mode:
103+
104+
- `scripts/diagrams.sh --verify --all` performs a non-destructive validation of all committed SVGs (metadata/tool pin checks). It exits non-zero on failures, which fails CI and pre-push unless you set `PREPUSH_SKIP_MERMAID=1`.
105+
83106
## xtask quickstart (CI parity)
84107

85108
This repo uses a small Rust utility (`cargo xtask`) to run common tasks in a cross-platform, reproducible way.
@@ -100,6 +123,10 @@ Common commands
100123

101124
Diagrams are intentionally outside xtask. Use `make diagrams` or `bash ./scripts/diagrams.sh`.
102125

126+
Docs build system
127+
128+
- We use VitePress for docs. The build command is `npm run docs:build`, which runs `vitepress build docs` (package.json). The Markdown normalizer and anchor/TOC generator run as prebuild steps in CI to keep the site consistent.
129+
103130
Tip: `make help` lists handy shims (`ci-diagrams`, `ci-schemas`, `ci-linkcheck`) that mirror CI. For ad-hoc invocations, use `make xtask ARGS="<subcommand> [opts]"` for Rust-based flows.
104131

105132
## One-time Setup (recommended)

FOR-SCIENTISTS.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# For Scientists — Verify & Reproduce
2+
3+
Two commands validate results end-to-end.
4+
5+
```bash
6+
# Verify a published experiment
7+
git gatos verify <pox-id>
8+
9+
# Reproduce it in a clean room
10+
git gatos reproduce <pox-id>
11+
```
12+
13+
What’s checked:
14+
15+
- Proof-of-Experiment (PoX): inputs_root, program_id, policy_root, outputs_root.
16+
- Proof-of-Execution (PoE) for jobs.
17+
- Proof-of-Fold (PoF) for state checkpoints underpinning figures/tables.
18+
19+
Include the PoX ULID and repo commit (or DOI) in Methods. See docs/proofs/proof-of-experiment.md.
20+
21+
## Methods Appendix Template (copy-paste)
22+
23+
```
24+
Repository: https://github.com/<org>/<repo> @ <commit>
25+
Experiment: <title>
26+
27+
Proof-of-Experiment (PoX)
28+
id: <ULID>
29+
inputs_root: blake3:<hex>
30+
program_id: <container|wasm|code digest>
31+
policy_root: <commit-oid>
32+
policy_code_root: sha256:<hex>
33+
outputs_root: blake3:<hex>
34+
35+
Proof-of-Execution (PoE)
36+
ids: [ blake3:<hex>, ... ]
37+
38+
Proof-of-Fold (PoF)
39+
state_ref: refs/gatos/state/<ns>
40+
state_root: blake3:<hex>
41+
fold_root: sha256:<hex>
42+
43+
Explorer-Root (export verification)
44+
explorer_root: blake3:<hex>
45+
extractor_version: <semver>
46+
47+
Reproduce
48+
git clone <repo>
49+
git gatos verify <pox-id>
50+
git gatos reproduce <pox-id>
51+
```

0 commit comments

Comments
 (0)