Skip to content

Claude Code guide in three levels, Beginner to Advanced: hands-on lessons with checked exercises, every volatile fact cited to its source. Independent community guide.

ci: check page stamps on pull requests and gate releases on them (#51)

Wesam Abousaidde5943b892f3
diff --git a/.github/scripts/check.mjs b/.github/scripts/check.mjs
index 7834816..58b2dc9 100644
--- a/.github/scripts/check.mjs
+++ b/.github/scripts/check.mjs
@@ -51,6 +51,11 @@ for (const rule of rules) {
const label = result.status.toUpperCase();
console.log(`${label} ${rule.id}${result.summary ? `: ${result.summary}` : ''}`);
for (const problem of result.problems ?? []) console.log(` ${problem}`);
+ // In GitHub Actions, also surface each problem as an annotation on the run.
+ const level = { fail: 'error', warn: 'warning' }[result.status];
+ if (process.env.GITHUB_ACTIONS === 'true' && level) {
+ for (const problem of result.problems ?? []) console.log(`::${level} title=${rule.id}::${problem.replace(/%/g, '%25').replace(/\r?\n/g, '%0A')}`);
+ }
if (result.status === 'fail') failed = true;
}
process.exit(failed ? 1 : 0);
diff --git a/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/base/CHANGELOG.md b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/base/CHANGELOG.md
new file mode 100644
index 0000000..deb3814
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/base/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Changelog
+
+## v2026.10 - 2026-10-20
+
+Verified against Claude Code v2.1.290 (stable).
diff --git a/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/base/docs/beginner/01-install.md b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/base/docs/beginner/01-install.md
new file mode 100644
index 0000000..b9133a4
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/base/docs/beginner/01-install.md
@@ -0,0 +1,5 @@
+# Install, sign in and look around
+
+<sub>**Beginner** · Lesson 1 of 5 · about 15 minutes · Verified against Claude Code v2.1.290 (stable) on 2026-10-19</sub>
+
+Old install step.
diff --git a/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/base/docs/beginner/02-permission-modes.md b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/base/docs/beginner/02-permission-modes.md
new file mode 100644
index 0000000..824a5e2
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/base/docs/beginner/02-permission-modes.md
@@ -0,0 +1,5 @@
+# Permission modes and plan mode
+
+<sub>**Beginner** · Lesson 2 of 5 · about 15 minutes · Verified against Claude Code v2.1.290 (stable) on 2026-10-19</sub>
+
+Unchanged.
diff --git a/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/fixture.json b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/fixture.json
new file mode 100644
index 0000000..ff0e129
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/fixture.json
@@ -0,0 +1,9 @@
+{
+ "rule": "edition-gate",
+ "expect": "fail",
+ "mode": "release",
+ "tag": "v2026.10.1",
+ "tags": { "v2026.10": "base", "v2026.10.1": "head" },
+ "today": "2026-10-23",
+ "about": "A correction changes a page but leaves its Stamp dated before the previous tag."
+}
diff --git a/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/tree/CHANGELOG.md b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/tree/CHANGELOG.md
new file mode 100644
index 0000000..f470252
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/tree/CHANGELOG.md
@@ -0,0 +1,9 @@
+# Changelog
+
+## v2026.10.1 - 2026-10-23
+
+- Fixed the install step for WSL2.
+
+## v2026.10 - 2026-10-20
+
+Verified against Claude Code v2.1.290 (stable).
diff --git a/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/tree/docs/beginner/01-install.md b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/tree/docs/beginner/01-install.md
new file mode 100644
index 0000000..b7d2c80
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/tree/docs/beginner/01-install.md
@@ -0,0 +1,5 @@
+# Install, sign in and look around
+
+<sub>**Beginner** · Lesson 1 of 5 · about 15 minutes · Verified against Claude Code v2.1.290 (stable) on 2026-10-19</sub>
+
+Fixed install step.
diff --git a/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/tree/docs/beginner/02-permission-modes.md b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/tree/docs/beginner/02-permission-modes.md
new file mode 100644
index 0000000..824a5e2
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-changed-page-not-restamped/tree/docs/beginner/02-permission-modes.md
@@ -0,0 +1,5 @@
+# Permission modes and plan mode
+
+<sub>**Beginner** · Lesson 2 of 5 · about 15 minutes · Verified against Claude Code v2.1.290 (stable) on 2026-10-19</sub>
+
+Unchanged.
diff --git a/.github/scripts/fixtures/correction-tag-restamps-changed-pages/base/CHANGELOG.md b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/base/CHANGELOG.md
new file mode 100644
index 0000000..deb3814
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/base/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Changelog
+
+## v2026.10 - 2026-10-20
+
+Verified against Claude Code v2.1.290 (stable).
diff --git a/.github/scripts/fixtures/correction-tag-restamps-changed-pages/base/docs/beginner/01-install.md b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/base/docs/beginner/01-install.md
new file mode 100644
index 0000000..b9133a4
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/base/docs/beginner/01-install.md
@@ -0,0 +1,5 @@
+# Install, sign in and look around
+
+<sub>**Beginner** · Lesson 1 of 5 · about 15 minutes · Verified against Claude Code v2.1.290 (stable) on 2026-10-19</sub>
+
+Old install step.
diff --git a/.github/scripts/fixtures/correction-tag-restamps-changed-pages/base/docs/beginner/02-permission-modes.md b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/base/docs/beginner/02-permission-modes.md
new file mode 100644
index 0000000..824a5e2
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/base/docs/beginner/02-permission-modes.md
@@ -0,0 +1,5 @@
+# Permission modes and plan mode
+
+<sub>**Beginner** · Lesson 2 of 5 · about 15 minutes · Verified against Claude Code v2.1.290 (stable) on 2026-10-19</sub>
+
+Unchanged.
diff --git a/.github/scripts/fixtures/correction-tag-restamps-changed-pages/fixture.json b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/fixture.json
new file mode 100644
index 0000000..faad4c9
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/fixture.json
@@ -0,0 +1,9 @@
+{
+ "rule": "edition-gate",
+ "expect": "pass",
+ "mode": "release",
+ "tag": "v2026.10.1",
+ "tags": { "v2026.10": "base", "v2026.10.1": "head" },
+ "today": "2026-10-23",
+ "about": "A correction re-stamps only the page it changed; the unchanged page keeps the edition's Stamp."
+}
diff --git a/.github/scripts/fixtures/correction-tag-restamps-changed-pages/tree/CHANGELOG.md b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/tree/CHANGELOG.md
new file mode 100644
index 0000000..f470252
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/tree/CHANGELOG.md
@@ -0,0 +1,9 @@
+# Changelog
+
+## v2026.10.1 - 2026-10-23
+
+- Fixed the install step for WSL2.
+
+## v2026.10 - 2026-10-20
+
+Verified against Claude Code v2.1.290 (stable).
diff --git a/.github/scripts/fixtures/correction-tag-restamps-changed-pages/tree/docs/beginner/01-install.md b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/tree/docs/beginner/01-install.md
new file mode 100644
index 0000000..5097855
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/tree/docs/beginner/01-install.md
@@ -0,0 +1,5 @@
+# Install, sign in and look around
+
+<sub>**Beginner** · Lesson 1 of 5 · about 15 minutes · Verified against Claude Code v2.1.290 (stable) on 2026-10-23</sub>
+
+Fixed install step.
diff --git a/.github/scripts/fixtures/correction-tag-restamps-changed-pages/tree/docs/beginner/02-permission-modes.md b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/tree/docs/beginner/02-permission-modes.md
new file mode 100644
index 0000000..824a5e2
--- /dev/null
+++ b/.github/scripts/fixtures/correction-tag-restamps-changed-pages/tree/docs/beginner/02-permission-modes.md
@@ -0,0 +1,5 @@
+# Permission modes and plan mode
+
+<sub>**Beginner** · Lesson 2 of 5 · about 15 minutes · Verified against Claude Code v2.1.290 (stable) on 2026-10-19</sub>
+
+Unchanged.
diff --git a/.github/scripts/fixtures/expiry-due-soon/fixture.json b/.github/scripts/fixtures/expiry-due-soon/fixture.json
new file mode 100644
index 0000000..b5accfb
--- /dev/null
+++ b/.github/scripts/fixtures/expiry-due-soon/fixture.json
@@ -0,0 +1,6 @@
+{
+ "rule": "expiry",
+ "expect": "warn",
+ "today": "2026-10-05",
+ "about": "An expiry marker due within 30 days warns on a pull request without failing it."
+}
diff --git a/.github/scripts/fixtures/expiry-due-soon/tree/README.md b/.github/scripts/fixtures/expiry-due-soon/tree/README.md
new file mode 100644
index 0000000..cce9635
--- /dev/null
+++ b/.github/scripts/fixtures/expiry-due-soon/tree/README.md
@@ -0,0 +1,9 @@
+# Fixture
+
+The offer ends on 2026-10-20 ([Pricing](https://claude.com/pricing)). <!-- expires: 2026-10-20 -->
+
+Write markers as `<!-- expires: YYYY-MM-DD -->`.
+
+```markdown
+<!-- expires: 2026-01-01 -->
+```
diff --git a/.github/scripts/fixtures/expiry-marker-after-mixed-fences/fixture.json b/.github/scripts/fixtures/expiry-marker-after-mixed-fences/fixture.json
new file mode 100644
index 0000000..bea2d70
--- /dev/null
+++ b/.github/scripts/fixtures/expiry-marker-after-mixed-fences/fixture.json
@@ -0,0 +1,7 @@
+{
+ "rule": "expiry",
+ "expect": "fail",
+ "mode": "scheduled",
+ "today": "2026-10-21",
+ "about": "A backtick line inside a tilde-fenced block doesn't close it, so a past-due marker after the block is still found."
+}
diff --git a/.github/scripts/fixtures/expiry-marker-after-mixed-fences/tree/README.md b/.github/scripts/fixtures/expiry-marker-after-mixed-fences/tree/README.md
new file mode 100644
index 0000000..352dcb8
--- /dev/null
+++ b/.github/scripts/fixtures/expiry-marker-after-mixed-fences/tree/README.md
@@ -0,0 +1,9 @@
+# Fixture
+
+An unclosed fence, shown as an example:
+
+~~~text
+```
+~~~
+
+A dated fact. <!-- expires: 2026-01-01 -->
diff --git a/.github/scripts/fixtures/expiry-marker-in-code-ignored/fixture.json b/.github/scripts/fixtures/expiry-marker-in-code-ignored/fixture.json
new file mode 100644
index 0000000..fd4488b
--- /dev/null
+++ b/.github/scripts/fixtures/expiry-marker-in-code-ignored/fixture.json
@@ -0,0 +1,7 @@
+{
+ "rule": "expiry",
+ "expect": "pass",
+ "mode": "scheduled",
+ "today": "2026-10-21",
+ "about": "A marker shown as an example inside code is not a marker, even when its date has passed."
+}
diff --git a/.github/scripts/fixtures/expiry-marker-in-code-ignored/tree/README.md b/.github/scripts/fixtures/expiry-marker-in-code-ignored/tree/README.md
new file mode 100644
index 0000000..ea86ad6
--- /dev/null
+++ b/.github/scripts/fixtures/expiry-marker-in-code-ignored/tree/README.md
@@ -0,0 +1,7 @@
+# Fixture
+
+Write markers as `<!-- expires: 2026-01-01 -->`.
+
+```markdown
+<!-- expires: 2026-01-01 -->
+```
diff --git a/.github/scripts/fixtures/expiry-past-due-scheduled/fixture.json b/.github/scripts/fixtures/expiry-past-due-scheduled/fixture.json
new file mode 100644
index 0000000..bb7decc
--- /dev/null
+++ b/.github/scripts/fixtures/expiry-past-due-scheduled/fixture.json
@@ -0,0 +1,7 @@
+{
+ "rule": "expiry",
+ "expect": "fail",
+ "mode": "scheduled",
+ "today": "2026-10-21",
+ "about": "In the daily scheduled run, a marker past its date fails, which opens or updates the tracking issue."
+}
diff --git a/.github/scripts/fixtures/expiry-past-due-scheduled/tree/README.md b/.github/scripts/fixtures/expiry-past-due-scheduled/tree/README.md
new file mode 100644
index 0000000..61ecd23
--- /dev/null
+++ b/.github/scripts/fixtures/expiry-past-due-scheduled/tree/README.md
@@ -0,0 +1,3 @@
+# Fixture
+
+The offer ends on 2026-10-20 ([Pricing](https://claude.com/pricing)). <!-- expires: 2026-10-20 -->
diff --git a/.github/scripts/fixtures/feature-map-without-stamp/fixture.json b/.github/scripts/fixtures/feature-map-without-stamp/fixture.json
new file mode 100644
index 0000000..aa29d66
--- /dev/null
+++ b/.github/scripts/fixtures/feature-map-without-stamp/fixture.json
@@ -0,0 +1,5 @@
+{
+ "rule": "stamps",
+ "expect": "fail",
+ "about": "The Feature map is never exempt from the Stamp, even while the other reference pages are."
+}
diff --git a/.github/scripts/fixtures/feature-map-without-stamp/tree/docs/reference/feature-map.md b/.github/scripts/fixtures/feature-map-without-stamp/tree/docs/reference/feature-map.md
new file mode 100644
index 0000000..64fe7af
--- /dev/null
+++ b/.github/scripts/fixtures/feature-map-without-stamp/tree/docs/reference/feature-map.md
@@ -0,0 +1,3 @@
+# Feature map
+
+Labels and plan gates.
diff --git a/.github/scripts/fixtures/malformed-stamp/fixture.json b/.github/scripts/fixtures/malformed-stamp/fixture.json
new file mode 100644
index 0000000..d8b0b4b
--- /dev/null
+++ b/.github/scripts/fixtures/malformed-stamp/fixture.json
@@ -0,0 +1,5 @@
+{
+ "rule": "stamps",
+ "expect": "fail",
+ "about": "A lesson's header line carries a Stamp without the v prefix and the (stable) channel."
+}
diff --git a/.github/scripts/fixtures/malformed-stamp/tree/docs/beginner/01-install.md b/.github/scripts/fixtures/malformed-stamp/tree/docs/beginner/01-install.md
new file mode 100644
index 0000000..d331384
--- /dev/null
+++ b/.github/scripts/fixtures/malformed-stamp/tree/docs/beginner/01-install.md
@@ -0,0 +1,7 @@
+# Install, sign in and look around
+
+<sub>**Beginner** · Lesson 1 of 5 · about 15 minutes · Verified against Claude Code 2.1.285 on 2026-10-05</sub>
+
+## Goal
+
+Text.
diff --git a/.github/scripts/fixtures/readme-without-trust-strip/fixture.json b/.github/scripts/fixtures/readme-without-trust-strip/fixture.json
new file mode 100644
index 0000000..374995a
--- /dev/null
+++ b/.github/scripts/fixtures/readme-without-trust-strip/fixture.json
@@ -0,0 +1,5 @@
+{
+ "rule": "stamps",
+ "expect": "pass",
+ "about": "Before the front-door switch README has no trust strip, so the strip half of the rule is skipped; exempt reference pages need no Stamp."
+}
diff --git a/.github/scripts/fixtures/readme-without-trust-strip/tree/CHANGELOG.md b/.github/scripts/fixtures/readme-without-trust-strip/tree/CHANGELOG.md
new file mode 100644
index 0000000..c4349f6
--- /dev/null
+++ b/.github/scripts/fixtures/readme-without-trust-strip/tree/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Changelog
+
+## Unreleased
+
+Baseline: Claude Code v2.1.285 (stable), frozen on 2026-10-05.
diff --git a/.github/scripts/fixtures/readme-without-trust-strip/tree/README.md b/.github/scripts/fixtures/readme-without-trust-strip/tree/README.md
new file mode 100644
index 0000000..4db7a79
--- /dev/null
+++ b/.github/scripts/fixtures/readme-without-trust-strip/tree/README.md
@@ -0,0 +1,3 @@
+# Claude Code guide
+
+A guide.
diff --git a/.github/scripts/fixtures/readme-without-trust-strip/tree/docs/reference/faq.md b/.github/scripts/fixtures/readme-without-trust-strip/tree/docs/reference/faq.md
new file mode 100644
index 0000000..596671e
--- /dev/null
+++ b/.github/scripts/fixtures/readme-without-trust-strip/tree/docs/reference/faq.md
@@ -0,0 +1,4 @@
+# FAQ
+
+> [!NOTE]
+> From the previous edition, not yet re-verified.
diff --git a/.github/scripts/fixtures/readme-without-trust-strip/tree/docs/reference/models.md b/.github/scripts/fixtures/readme-without-trust-strip/tree/docs/reference/models.md
new file mode 100644
index 0000000..9d61231
--- /dev/null
+++ b/.github/scripts/fixtures/readme-without-trust-strip/tree/docs/reference/models.md
@@ -0,0 +1,3 @@
+# Models
+
+No Stamp until the reference layer is rewritten.
diff --git a/.github/scripts/fixtures/stale-stamp-on-edition-tag/fixture.json b/.github/scripts/fixtures/stale-stamp-on-edition-tag/fixture.json
new file mode 100644
index 0000000..c29e42b
--- /dev/null
+++ b/.github/scripts/fixtures/stale-stamp-on-edition-tag/fixture.json
@@ -0,0 +1,9 @@
+{
+ "rule": "edition-gate",
+ "expect": "fail",
+ "mode": "release",
+ "tag": "v2026.10",
+ "tags": { "v2026.10": "head" },
+ "today": "2026-10-20",
+ "about": "On an edition tag one stamped page still carries the frozen baseline's Stamp instead of the edition's version."
+}
diff --git a/.github/scripts/fixtures/stale-stamp-on-edition-tag/tree/CHANGELOG.md b/.github/scripts/fixtures/stale-stamp-on-edition-tag/tree/CHANGELOG.md
new file mode 100644
index 0000000..deb3814
--- /dev/null
+++ b/.github/scripts/fixtures/stale-stamp-on-edition-tag/tree/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Changelog
+
+## v2026.10 - 2026-10-20
+
+Verified against Claude Code v2.1.290 (stable).
diff --git a/.github/scripts/fixtures/stale-stamp-on-edition-tag/tree/docs/beginner/01-install.md b/.github/scripts/fixtures/stale-stamp-on-edition-tag/tree/docs/beginner/01-install.md
new file mode 100644
index 0000000..ba485ee
--- /dev/null
+++ b/.github/scripts/fixtures/stale-stamp-on-edition-tag/tree/docs/beginner/01-install.md
@@ -0,0 +1,3 @@
+# Install, sign in and look around
+
+<sub>**Beginner** · Lesson 1 of 5 · about 15 minutes · Verified against Claude Code v2.1.285 (stable) on 2026-10-06</sub>
diff --git a/.github/scripts/fixtures/stale-stamp-on-edition-tag/tree/docs/beginner/README.md b/.github/scripts/fixtures/stale-stamp-on-edition-tag/tree/docs/beginner/README.md
new file mode 100644
index 0000000..907dd27
--- /dev/null
+++ b/.github/scripts/fixtures/stale-stamp-on-edition-tag/tree/docs/beginner/README.md
@@ -0,0 +1,3 @@
+# Beginner
+
+<sub>Verified against Claude Code v2.1.290 (stable) on 2026-10-19</sub>
diff --git a/.github/scripts/fixtures/trust-strip-mismatch/fixture.json b/.github/scripts/fixtures/trust-strip-mismatch/fixture.json
new file mode 100644
index 0000000..3447f27
--- /dev/null
+++ b/.github/scripts/fixtures/trust-strip-mismatch/fixture.json
@@ -0,0 +1,5 @@
+{
+ "rule": "stamps",
+ "expect": "fail",
+ "about": "README's trust strip names a different version from the latest edition entry in CHANGELOG.md."
+}
diff --git a/.github/scripts/fixtures/trust-strip-mismatch/tree/CHANGELOG.md b/.github/scripts/fixtures/trust-strip-mismatch/tree/CHANGELOG.md
new file mode 100644
index 0000000..a51cf40
--- /dev/null
+++ b/.github/scripts/fixtures/trust-strip-mismatch/tree/CHANGELOG.md
@@ -0,0 +1,7 @@
+# Changelog
+
+## Unreleased
+
+## v2026.10 - 2026-10-20
+
+Verified against Claude Code v2.1.290 (stable).
diff --git a/.github/scripts/fixtures/trust-strip-mismatch/tree/README.md b/.github/scripts/fixtures/trust-strip-mismatch/tree/README.md
new file mode 100644
index 0000000..8072760
--- /dev/null
+++ b/.github/scripts/fixtures/trust-strip-mismatch/tree/README.md
@@ -0,0 +1,3 @@
+# Claude Code guide
+
+Verified against Claude Code v2.1.285 (stable) for edition v2026.10.
diff --git a/.github/scripts/lib/git.mjs b/.github/scripts/lib/git.mjs
index 0e76db5..f6a6f99 100644
--- a/.github/scripts/lib/git.mjs
+++ b/.github/scripts/lib/git.mjs
@@ -38,3 +38,17 @@ export function readAt(root, sha, path) {
return null;
}
}
+
+// The nearest tag matching v[0-9]* that git describe finds from the first
+// parent of `tag`, or null for the first one.
+export function previousTag(root, tag) {
+ try {
+ return git(root, ['describe', '--tags', '--abbrev=0', '--match', 'v[0-9]*', `${tag}^`]).trim();
+ } catch {
+ return null;
+ }
+}
+
+export function changedBetween(root, from, to) {
+ return git(root, ['diff', '--name-only', from, to]).split('\n').filter((f) => f && !isExcluded(f));
+}
diff --git a/.github/scripts/lib/markdown.mjs b/.github/scripts/lib/markdown.mjs
index 0590542..6562dce 100644
--- a/.github/scripts/lib/markdown.mjs
+++ b/.github/scripts/lib/markdown.mjs
@@ -37,6 +37,24 @@ export function slug(text) {
// Every id on the page, in document order. Heading slugs come first in their
// own line; explicit anchors are listed where they appear.
+// The lines outside fenced code blocks, each with its 1-based number. A fence
+// closes only on a line of the same character, at least as long, as
+// CommonMark has it, so a ``` line inside a ~~~ block stays code.
+export function outsideFences(markdown) {
+ const out = [];
+ let fence = null;
+ markdown.split(/\r?\n/).forEach((line, i) => {
+ const f = line.match(FENCE);
+ if (fence) {
+ if (f && f[1][0] === fence[0] && f[1].length >= fence.length && /^\s*[`~]+\s*$/.test(line)) fence = null;
+ return;
+ }
+ if (f) { fence = f[1]; return; }
+ out.push({ n: i + 1, line });
+ });
+ return out;
+}
+
export function pageIds(markdown) {
const ids = [];
const seen = new Map();
diff --git a/.github/scripts/lib/stamps.mjs b/.github/scripts/lib/stamps.mjs
new file mode 100644
index 0000000..850e936
--- /dev/null
+++ b/.github/scripts/lib/stamps.mjs
@@ -0,0 +1,92 @@
+// The Stamp, the stamped set and the CHANGELOG's edition entries.
+
+// `Verified against Claude Code vX.Y.Z (stable) on YYYY-MM-DD`
+export const STAMP = /Verified against Claude Code v(\d+)\.(\d+)\.(\d+) \(stable\) on (\d{4}-\d{2}-\d{2})/;
+
+// Pages from before the rework that are not yet split. They carry a
+// "From the previous edition, not yet re-verified" note instead of a Stamp.
+export const PRE_REWORK = [
+ 'docs/reference/effort-levels.md',
+ 'docs/reference/faq.md',
+];
+
+// Exempt until the reference layer rewrites them; that pull request removes
+// the three rewritten pages from this list and moves changelog.md to STUBS.
+export const AWAITING_REWRITE = [
+ 'docs/reference/models.md',
+ 'docs/reference/commands.md',
+ 'docs/reference/further-reading.md',
+ 'docs/reference/changelog.md',
+];
+
+// Stub pages inside the stamped folders.
+export const STUBS = [];
+
+const STAMPED = /^docs\/(beginner|intermediate|advanced)\/.+\.md$|^docs\/topics\/[^/]+\.md$|^docs\/reference\/[^/]+\.md$/;
+
+export function isStamped(path) {
+ if (!STAMPED.test(path)) return false;
+ return ![...PRE_REWORK, ...AWAITING_REWRITE, ...STUBS].includes(path);
+}
+
+export function today() {
+ return process.env.CHECKS_TODAY ?? new Date().toISOString().slice(0, 10);
+}
+
+export function isRealDate(date) {
+ const d = new Date(`${date}T00:00:00Z`);
+ return !Number.isNaN(d.getTime()) && d.toISOString().slice(0, 10) === date;
+}
+
+export function compareVersions(a, b) {
+ const pa = a.split('.').map(Number);
+ const pb = b.split('.').map(Number);
+ for (let i = 0; i < 3; i++) if (pa[i] !== pb[i]) return pa[i] - pb[i];
+ return 0;
+}
+
+// The line under the H1, where a page's Stamp lives.
+export function headerLine(markdown) {
+ const lines = markdown.split(/\r?\n/);
+ const h1 = lines.findIndex((l) => /^# \S/.test(l));
+ if (h1 === -1) return null;
+ return lines.slice(h1 + 1).find((l) => l.trim() !== '') ?? '';
+}
+
+// Parses a page's Stamp: { version, date } or { error }.
+export function readStamp(markdown) {
+ const line = headerLine(markdown);
+ if (line === null) return { error: 'no H1, so no header line to hold the Stamp' };
+ const m = line.match(STAMP);
+ if (!m) {
+ return /Verified against/i.test(line)
+ ? { error: `malformed Stamp in the header line; expected "Verified against Claude Code vX.Y.Z (stable) on YYYY-MM-DD": ${line.trim()}` }
+ : { error: 'no Stamp in the line under the H1' };
+ }
+ const [, major, minor, patch, date] = m;
+ if (!isRealDate(date)) return { error: `Stamp date ${date} is not a real date` };
+ if (date > today()) return { error: `Stamp date ${date} is in the future` };
+ return { version: `${major}.${minor}.${patch}`, date };
+}
+
+// Edition entries in CHANGELOG.md, newest first:
+// ## vYYYY.MM - YYYY-MM-DD (an edition)
+// ## vYYYY.MM.N - YYYY-MM-DD (a correction)
+// followed by a line "Verified against Claude Code vX.Y.Z (stable)."
+export function editions(changelog) {
+ const out = [];
+ let current = null;
+ for (const line of (changelog ?? '').split(/\r?\n/)) {
+ const h = line.match(/^## (v\d{4}\.\d{2}(?:\.\d+)?) - (\d{4}-\d{2}-\d{2})\s*$/);
+ if (h) {
+ current = { tag: h[1], date: h[2], correction: /\.\d+\.\d+$/.test(h[1]), version: null };
+ out.push(current);
+ } else if (/^## /.test(line)) {
+ current = null;
+ } else if (current && !current.version) {
+ const v = line.match(/Verified against Claude Code v(\d+\.\d+\.\d+) \(stable\)/);
+ if (v) current.version = v[1];
+ }
+ }
+ return out;
+}
diff --git a/.github/scripts/rules/edition-gate.mjs b/.github/scripts/rules/edition-gate.mjs
new file mode 100644
index 0000000..fbe441b
--- /dev/null
+++ b/.github/scripts/rules/edition-gate.mjs
@@ -0,0 +1,47 @@
+// On a release tag, the stamped pages match the release.
+// - Edition tag vYYYY.MM: every stamped page's Stamp names the version that
+// the tag's CHANGELOG entry was verified against.
+// - Correction tag vYYYY.MM.N: every stamped page changed since the previous
+// tag carries a Stamp dated after that tag's CHANGELOG entry.
+import { existsSync } from 'node:fs';
+import { join } from 'node:path';
+import { readText } from '../lib/tree.mjs';
+import { changedBetween, previousTag } from '../lib/git.mjs';
+import { editions, isStamped, readStamp } from '../lib/stamps.mjs';
+
+export const id = 'edition-gate';
+export const modes = ['release'];
+
+export function run(ctx) {
+ const fail = (...problems) => ({ status: 'fail', problems });
+ if (!ctx.tag) return fail('release mode needs --tag');
+ const shape = ctx.tag.match(/^v\d{4}\.\d{2}(\.\d+)?$/);
+ if (!shape) return fail(`${ctx.tag} is neither an edition tag (vYYYY.MM) nor a correction tag (vYYYY.MM.N)`);
+ const entries = editions(existsSync(join(ctx.root, 'CHANGELOG.md')) ? readText(ctx.root, 'CHANGELOG.md') : '');
+ const entry = entries.find((e) => e.tag === ctx.tag);
+ if (!entry) return fail(`CHANGELOG.md has no "## ${ctx.tag} - YYYY-MM-DD" entry`);
+
+ const problems = [];
+ if (!shape[1]) {
+ if (!entry.version) return fail(`CHANGELOG.md's ${ctx.tag} entry has no "Verified against Claude Code vX.Y.Z (stable)" line`);
+ const pages = ctx.files.filter(isStamped);
+ for (const page of pages) {
+ const stamp = readStamp(readText(ctx.root, page));
+ if (stamp.error) problems.push(`${page}: ${stamp.error}`);
+ else if (stamp.version !== entry.version) problems.push(`${page}: stamped v${stamp.version}, but edition ${ctx.tag} is verified against v${entry.version}; re-verify and re-stamp it`);
+ }
+ return problems.length ? fail(...problems) : { status: 'pass', summary: `${pages.length} stamped pages carry v${entry.version}` };
+ }
+
+ const prev = previousTag(ctx.root, ctx.tag);
+ if (!prev) return fail(`no release tag before ${ctx.tag} to compare against`);
+ const prevEntry = entries.find((e) => e.tag === prev);
+ if (!prevEntry) return fail(`CHANGELOG.md has no entry for the previous tag, ${prev}`);
+ const changed = changedBetween(ctx.root, prev, ctx.tag).filter((p) => isStamped(p) && existsSync(join(ctx.root, p)));
+ for (const page of changed) {
+ const stamp = readStamp(readText(ctx.root, page));
+ if (stamp.error) problems.push(`${page}: ${stamp.error}`);
+ else if (!(stamp.date > prevEntry.date)) problems.push(`${page}: changed since ${prev} but its Stamp (${stamp.date}) is not dated after ${prev} (${prevEntry.date}); re-verify and re-stamp it`);
+ }
+ return problems.length ? fail(...problems) : { status: 'pass', summary: `${changed.length} stamped pages changed since ${prev}, all re-stamped` };
+}
diff --git a/.github/scripts/rules/expiry.mjs b/.github/scripts/rules/expiry.mjs
new file mode 100644
index 0000000..6a45121
--- /dev/null
+++ b/.github/scripts/rules/expiry.mjs
@@ -0,0 +1,44 @@
+// Expiry markers, <!-- expires: YYYY-MM-DD -->, flag a dated fact before it
+// goes stale. On pull requests a marker due within 30 days, or past due, only
+// warns. The daily scheduled run fails on a past-due marker, which opens or
+// updates the tracking issue.
+import { readText } from '../lib/tree.mjs';
+import { outsideFences } from '../lib/markdown.mjs';
+import { isRealDate, today } from '../lib/stamps.mjs';
+
+export const id = 'expiry';
+export const modes = ['pr', 'scheduled'];
+
+const MARKER = /<!--\s*expires:\s*(\S+?)\s*-->/g;
+const WINDOW_DAYS = 30;
+
+function addDays(date, days) {
+ const d = new Date(`${date}T00:00:00Z`);
+ d.setUTCDate(d.getUTCDate() + days);
+ return d.toISOString().slice(0, 10);
+}
+
+export function run(ctx) {
+ const now = today();
+ const soon = addDays(now, WINDOW_DAYS);
+ const due = [];
+ const pastDue = [];
+ const malformed = [];
+ let count = 0;
+ for (const page of ctx.files.filter((f) => f.endsWith('.md'))) {
+ // A marker shown in code is an example of the syntax, not a marker.
+ for (const { n, line } of outsideFences(readText(ctx.root, page))) {
+ for (const m of line.replace(/`[^`]*`/g, '').matchAll(MARKER)) {
+ count += 1;
+ const where = `${page}:${n}`;
+ if (!isRealDate(m[1])) malformed.push(`${where}: "${m[1]}" is not a YYYY-MM-DD date`);
+ else if (m[1] < now) pastDue.push(`${where}: expired on ${m[1]}; re-verify the fact and update or remove the marker`);
+ else if (m[1] <= soon) due.push(`${where}: expires on ${m[1]}, within ${WINDOW_DAYS} days`);
+ }
+ }
+ }
+ if (malformed.length) return { status: 'fail', problems: malformed };
+ if (ctx.mode === 'scheduled' && pastDue.length) return { status: 'fail', problems: pastDue };
+ if (pastDue.length || due.length) return { status: 'warn', problems: [...pastDue, ...due] };
+ return { status: 'pass', summary: `${count} expiry markers, none due within ${WINDOW_DAYS} days` };
+}
diff --git a/.github/scripts/rules/index.mjs b/.github/scripts/rules/index.mjs
index d1b5a34..3ab9bf3 100644
--- a/.github/scripts/rules/index.mjs
+++ b/.github/scripts/rules/index.mjs
@@ -2,5 +2,8 @@
import * as internalLinks from './internal-links.mjs';
import * as anchorDiff from './anchor-diff.mjs';
import * as stubPaths from './stub-paths.mjs';
+import * as stamps from './stamps.mjs';
+import * as editionGate from './edition-gate.mjs';
+import * as expiry from './expiry.mjs';
-export const rules = [internalLinks, anchorDiff, stubPaths];
+export const rules = [internalLinks, anchorDiff, stubPaths, stamps, editionGate, expiry];
diff --git a/.github/scripts/rules/stamps.mjs b/.github/scripts/rules/stamps.mjs
new file mode 100644
index 0000000..f518e62
--- /dev/null
+++ b/.github/scripts/rules/stamps.mjs
@@ -0,0 +1,34 @@
+// Every page in the stamped set carries a well-formed Stamp, and README's
+// trust strip, once it exists, names the latest edition's verified version.
+import { existsSync } from 'node:fs';
+import { join } from 'node:path';
+import { readText } from '../lib/tree.mjs';
+import { editions, isStamped, readStamp } from '../lib/stamps.mjs';
+
+export const id = 'stamps';
+export const modes = ['pr', 'release'];
+
+const TRUST_STRIP = /Verified against Claude Code v(\d+\.\d+\.\d+) \(stable\)/;
+
+export function run(ctx) {
+ const problems = [];
+ const pages = ctx.files.filter(isStamped);
+ for (const page of pages) {
+ const stamp = readStamp(readText(ctx.root, page));
+ if (stamp.error) problems.push(`${page}: ${stamp.error}`);
+ }
+
+ let strip = 'README has no trust strip yet, so the strip check is skipped';
+ const readme = existsSync(join(ctx.root, 'README.md')) ? readText(ctx.root, 'README.md') : '';
+ const m = readme.match(TRUST_STRIP);
+ if (m) {
+ const changelog = existsSync(join(ctx.root, 'CHANGELOG.md')) ? readText(ctx.root, 'CHANGELOG.md') : '';
+ const latest = editions(changelog).find((e) => !e.correction);
+ if (!latest) problems.push(`README.md: the trust strip says v${m[1]}, but CHANGELOG.md has no edition entry`);
+ else if (latest.version !== m[1]) problems.push(`README.md: the trust strip says v${m[1]}, but the latest edition, ${latest.tag}, was verified against v${latest.version}`);
+ strip = `trust strip matches v${m[1]}`;
+ }
+
+ if (problems.length) return { status: 'fail', problems };
+ return { status: 'pass', summary: `${pages.length} stamped pages; ${strip}` };
+}
diff --git a/.github/scripts/test/checks.test.mjs b/.github/scripts/test/checks.test.mjs
index 739b313..b2159fe 100644
--- a/.github/scripts/test/checks.test.mjs
+++ b/.github/scripts/test/checks.test.mjs
@@ -22,10 +22,14 @@ for (const name of readdirSync(fixturesDir).sort()) {
mode: spec.mode ?? 'pr',
base: tree.base,
tag: spec.tag,
+ today: spec.today,
});
if (spec.expect === 'fail') {
assert.notEqual(code, 0, output);
assert.match(output, new RegExp(`^FAIL ${spec.rule}\\b`, 'm'), output);
+ } else if (spec.expect === 'warn') {
+ assert.equal(code, 0, output);
+ assert.match(output, new RegExp(`^WARN ${spec.rule}\\b`, 'm'), output);
} else {
assert.equal(code, 0, output);
assert.doesNotMatch(output, /^FAIL /m, output);
diff --git a/.github/scripts/test/harness.mjs b/.github/scripts/test/harness.mjs
index fea3d5e..9051780 100644
--- a/.github/scripts/test/harness.mjs
+++ b/.github/scripts/test/harness.mjs
@@ -59,11 +59,15 @@ export async function materialize(fixtureDir, spec) {
return { root, base, cleanup: () => rmSync(root, { recursive: true, force: true }) };
}
-export function runChecks(root, { only, mode = 'pr', base, tag } = {}) {
+// `today` pins the date that date-based rules compare against, so fixtures
+// keep their verdict as time passes.
+export function runChecks(root, { only, mode = 'pr', base, tag, today } = {}) {
const args = [checkScript, '--root', root, '--mode', mode];
if (only) args.push('--only', only);
if (base) args.push('--base', base);
if (tag) args.push('--tag', tag);
- const result = spawnSync(process.execPath, args, { encoding: 'utf8' });
+ const env = { ...process.env };
+ if (today) env.CHECKS_TODAY = today;
+ const result = spawnSync(process.execPath, args, { encoding: 'utf8', env });
return { code: result.status, output: `${result.stdout}${result.stderr}` };
}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..6cedfc0
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,26 @@
+name: Edition gate
+
+# Fails when a pushed v* tag's stamped pages do not match it: on vYYYY.MM every
+# stamped page carries the edition's version, and on vYYYY.MM.N every stamped
+# page changed since the previous tag is re-stamped.
+on:
+ push:
+ tags: ["v*"]
+
+permissions:
+ contents: read
+
+jobs:
+ gate:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - uses: actions/setup-node@v4
+ with:
+ node-version: lts/*
+ - name: Install lychee
+ run: .github/scripts/install-lychee.sh
+ - name: Run the checks in release mode
+ run: node .github/scripts/check.mjs --mode release --tag "$GITHUB_REF_NAME"
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5cf82fc..92fb692 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -84,7 +84,7 @@ Sources: [Skills](https://code.claude.com/docs/en/skills), [Permissions](https:/
- No prices, promos, plan limits, retirement dates, model spec tables or "as of" prose. A page's stamp carries the date for everything on it. Any other figure a lesson truly needs is written with the full date in the sentence (`on <full date>, ...`) plus its link.
- Stability labels are quoted word for word in a `> [!NOTE]` alert under the heading, never in the heading text.
-- A future date is rare. It gets a full date, a Tier 1 link, and an expiry marker after the sentence: `<!-- expires: YYYY-MM-DD -->`.
+- A future date is rare. It gets a full date, a Tier 1 link, and an expiry marker after the sentence: `<!-- expires: YYYY-MM-DD -->`. The pull request checks warn, without failing, once a marker is due within 30 days.
### The stamp
@@ -96,6 +96,17 @@ Verified against Claude Code vX.Y.Z (stable) on YYYY-MM-DD
It certifies that on that date every volatile claim on the page was checked against its Tier 1 source at that `stable` version, and that the page's exercise and check, if any, were dry-run there. It does not certify third-party items beyond the [listing bar](#the-listing-bar), or behavior on other release channels and surfaces. The README, the community files, stubs and pages from the previous edition carry no stamp.
+The `stamps` rule in the [checks](#checks) fails on a stamped page whose Stamp is missing or malformed. Once README carries a trust strip, it also fails if the strip's version differs from the latest edition entry in [CHANGELOG.md](CHANGELOG.md).
+
+### Editions and corrections
+
+Each release has an entry in [CHANGELOG.md](CHANGELOG.md), newest first:
+
+- an edition: `## vYYYY.MM - YYYY-MM-DD`, with the line `Verified against Claude Code vX.Y.Z (stable).` under it;
+- a correction: `## vYYYY.MM.N - YYYY-MM-DD`.
+
+Pushing a `v*` tag runs the edition gate. On an edition tag, every stamped page's Stamp must name the edition's version. On a correction tag, every stamped page changed since the previous tag must carry a Stamp dated after that tag's entry.
+
### Numbers, benchmarks and estimates
| Kind | Rule |