@zero2webmaster/starter-kit 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/scaffolders/cf-pages.js +17 -6
- package/dist/scaffolders/cf-worker.js +17 -3
- package/dist/scaffolders/nextjs.js +15 -1
- package/dist/scaffolders/node-service.js +16 -3
- package/dist/scaffolders/python-service.js +14 -3
- package/dist/standards.d.ts +1 -1
- package/dist/standards.js +31 -3
- package/dist/substitute.d.ts +31 -0
- package/dist/substitute.js +34 -0
- package/package.json +1 -1
- package/scripts/rollup-integrations.mjs +46 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# z2w-starter-kit
|
|
2
2
|
|
|
3
|
-
**Version:** 0.
|
|
3
|
+
**Version:** 0.26.0 | **Framework:** 2.19.0
|
|
4
4
|
|
|
5
5
|
> Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.
|
|
6
6
|
|
|
@@ -83,7 +83,9 @@ The Claude Code skill at `~/.claude/skills/instantiate-z2w-project/SKILL.md` and
|
|
|
83
83
|
|
|
84
84
|
## Status
|
|
85
85
|
|
|
86
|
-
- **v0.
|
|
86
|
+
- **v0.26.0 (current)** releases two things. First, the **per-service Uptime Kuma health keyword**, built on 2026-08-21 but never released or written down until now: every deploy target's health document serves `{"status":"ok","service":"<slug>","keyword":"<slug>-health-ok"}`, and the emitted standards block tells the reader to match the full keyword. **The old portfolio-wide `"status":"ok"` was worthless as a check** — byte-identical across every Z2W service, so a monitor with a mistyped URL, one copied from a sibling project, or one left pointing at a decommissioned host still went green, which is the exact failure a keyword exists to catch; a portfolio audit found **12 of 23 monitors** keyed on it. The value is DERIVED from the slug via `healthKeyword()`, which is the load-bearing half — a shared constant would rebuild the same trap with extra steps. Second, a fix in `rollup-integrations.mjs`: **a comma in an author's prose is not an edge separator.** Stripping parentheticals before splitting handled the `(why…)` note form and did nothing for the canonical form's `— why` note, which runs to end of line, so `- consumes: contact-registry — people, tags, entitlements.` was about to write **`tags`** into the Project Registry as a dependency of `commerce-engine`, and `audit-engine`'s trailing sentence was about to write **`live-status`**. Both had been PRINTED on every run under `ⓘ not registry slugs (external, or prose noise — check)` — a line that reports and does not filter, so **a reported artifact that is still written is not a caught one**. A comma-part is now an edge only when it is a known registry slug or carries a `:qualifier`, with the first part exempt because that is where the author names the edge and the only position a legitimate non-registry backend occupies. The same work uncovered the inverse defect — a MISS: prose left attached to the last inline item swallowed its slug, so `z2w-observability-bridge`'s section yielded **only `Vercel`**, an external its own sentence had just disclaimed, while its real edge went unread. **1233 of 1233 passing.**
|
|
87
|
+
- **v0.25.0** adds `scripts/reconcile-production-url.mjs`, which reconciles the Project Registry's `production_url` column against the Vercel API — and **measuring the real API showed the 2026-08-17 design sketch was wrong in three separate ways.** The sketch said "read `domains[]`, filter out `*.vercel.app`, never take `domains[0]`." Measured across all 23 Zero2Webmaster Vercel projects: **position carries no information at all** (`z2w-social`'s correct domain is the first survivor, `org-hq`'s is the second), so no positional rule can exist; **filtering the aliases out blanks five Live rows** whose only public surface *is* a `.vercel.app` alias, so aliases are a lower-priority tier rather than noise; and **multiple custom domains are the common case, not an edge** — 6 of 19 resolvable projects have more than one, `file-server` has four. The reconciler therefore returns a *verdict object* rather than a URL, so "there is one" and "I picked one of four" cannot print the same way, and it writes only into a NULL — a recorded value that disagrees is reported as drift and never overwritten, because it may be a human's deliberate choice. **It found a real one on its first live run:** the registry's `z2w-social` URL 308-redirects to `frogspace.savethefrogs.com`. Live redirect evidence is used only to *eliminate* a candidate that points at another candidate — both `leaderboard` domains 307 to `/bansuri`, a tenant path, so "follow redirects and take the final URL" would have written a tenant-scoped URL as a project's production URL. A coverage ledger accounts for every row asserting a public surface, and a completeness check makes an unexplained row loud instead of absent. Also re-syncs the canonical Agent Coordination block to **v0.1.27**, which brings the previously-red conformance test back to green — **1199 of 1199 passing.**
|
|
88
|
+
- **v0.24.0** makes contrast a measured property of a PAIR rather than a taste call about a swatch. Every `nextjs` scaffold now emits `lib/a11y/contrast.ts` and `test/contrast.test.ts`, a table of **SURFACE x TEXT-ROLE x THRESHOLD** rows measured against the stylesheet the project actually ships — thirteen pairs across six surfaces, with `--brand-ink` measured four separate times because it is painted on four different backgrounds. The candidate came from `static-sites` and its lesson is one line: *contrast is per-surface, not per-palette* — a validator that checks each swatch against white passes cleanly while shipping unreadable text, because the swatch is rendered on the tint panel three components down. **Writing that check found two real defects in this scaffold's own CSS, both invisible to every brand preset.** The keyboard focus ring was painted in `--brand-primary`, which measures 2.03:1 on white in Z2W green and 1.40:1 in Z2W gold — so focusing a field made its boundary *less* visible than at rest, in Zero2Webmaster's and Save The Frogs' own colors. And `readableInkOn()` picked the better of near-black and white without checking that the winner cleared anything, which put a 4.41:1 glyph on any mid-tone brand fill. Fixed with a derived `--brand-focus` (same hue, darkened only as far as 3:1 requires) and an escalation to pure black, which provably clears 4.5:1 on every possible background. **Verified by running the scaffold's own vitest, plus four canaries that each reproduce a defect on demand** — including the one that matters most: an ink that stays green on white and fails at 4.06:1 on the code tint.
|
|
87
89
|
- **v0.23.0** makes every scaffolded web app defend its own head. `audit-engine` measured 26 reachable Z2W surfaces on 2026-08-20: **22 carried none of the five baseline security headers**, while `leaderboard` carried five of five — so this was a lift from a passing in-house implementation rather than a design exercise. Every `nextjs` scaffold now emits `lib/security-headers.mjs`, applied to every route by a new `async headers()` in **both** `next.config.mjs` variants, and `cf-pages` goes from two of five to five of five. **The CSP is assembled from the origins the scaffold actually loads**, each gated on the input that ships the feature: Fathom unconditionally, Turnstile in `script-src` *and* `frame-src` when the project takes cards (the widget is an iframe, so allowing only the script leaves an uncompletable card path), Sentry in `connect-src` alone when observability is on. **It ships enforcing rather than Report-Only** — a considered deviation from the retrofit-oriented rule, reasoned in the emitted comments, because a scaffold has no live traffic to break and a header that blocks nothing is just a note asking someone to finish later. Alongside it, `lib/json-ld.ts` closes the `JSON.stringify`-into-a-`<script>` sink: not because the scaffold's own JSON-LD was exploitable (it holds a brand name and an env URL) but because the Pro-SEO extension's *documented example* fed a post title — database content — straight into it, which is the exact stored XSS found live in `z2w-social`. **A scaffold's examples are copied more often than its code is read.** Verified on the artifact: real `next build`, all six headers `curl`-confirmed on a home page, a child page and an API route, and headless Chrome reporting zero CSP violations — with a positive control proving the detector fires.
|
|
88
90
|
- **v0.22.0** reshapes every emitted `.env.example` / `.env.local` so the line you came to fill in is the one you see. Kerry, 2026-08-16: the `# ── Database (Neon Postgres) ─────…` ruler *"is usually too long and therefore doesn't look like anything useful"*, and eighteen lines of explanation sat between the header and `DATABASE_URL=`. Headers are now a plain `# Database (Neon Postgres)`, and each block leads with its assignments and carries its prose directly underneath. **Per block rather than per file, which was Kerry's call between two readings of his own note** — collecting every variable at the top of the file would put the pooled-connection warning a screen away from the person about to paste the wrong connection string, and that warning only works where it is read. **Not a trim: every explanatory sentence survives, reworded and moved**, and there is a control test that unwraps the comment prose and asserts the load-bearing warnings are all still present, because a layout change is exactly where a paragraph goes missing unnoticed. Verified by loading the emitted file with Node's real dotenv parser — all 13 variables read back — not by grepping the template.
|
|
89
91
|
- **v0.21.0** makes the external audience gate say what actually went wrong. Its refusal named exactly one cause — *"a heading was probably renamed upstream"* — for a state that has two, and `project-creator`, the only consumer that resolves Templates from a version-**pinned** package rather than from Kerry's disk, hits the other one every time: at AGENTS v2.15.0 the `## Keeping This Framework Current` section simply did not exist yet, so every outside-brand scaffold refused in their production while they hunted a rename that never happened. Each gated section now declares the Templates version that first shipped it, the gate derives a minimum from those declarations, and the error distinguishes **version skew** (upgrade Templates) from **unexplained** (fix the section list). The throw is deliberately not softened. Same release: the standards decision log is now gate-aware — a standard whose whole section the gate removed reports `removed-by-audience-gate` instead of `inserted-inline`, because the old log let a preview UI tell an outside customer it had "Skill Vault awareness" in a file that no longer mentioned it; and a new `privateReferences` finding separates a surviving line that *instructs* the reader into the private Skill Vault from one that merely points at a missing section — one hit at Templates v2.18.0 and zero at v2.19.0, which removed that sentence upstream during the same session, demoting the finding into the milder dangling-reference class rather than making the check inert. No emitted file changes by a byte.
|
|
@@ -132,4 +134,4 @@ Inquiries: kerry@zero2webmaster.com.
|
|
|
132
134
|
---
|
|
133
135
|
|
|
134
136
|
*Scaffolded 2026-05-28 via the [[instantiate-z2w-project]] Claude Code skill v1; reconciled against the consolidated skill v1.1.0 (brief-first + Agent Coordination block) on 2026-05-29.*
|
|
135
|
-
*Version: 0.
|
|
137
|
+
*Version: 0.26.0 | Last Updated: 2026-08-24*
|
|
@@ -299,7 +299,7 @@ export function scaffoldCfPages(inputs, opts) {
|
|
|
299
299
|
{ path: "_redirects", content: sub(REDIRECTS_TEMPLATE, inputs, opts, spec) },
|
|
300
300
|
{ path: "public/og-image.txt", content: OG_IMAGE_PLACEHOLDER },
|
|
301
301
|
{ path: "icon.svg", content: sub(ICON_SVG_TEMPLATE, inputs, opts, spec) },
|
|
302
|
-
{ path: "health.json", content: HEALTH_JSON_TEMPLATE },
|
|
302
|
+
{ path: "health.json", content: sub(HEALTH_JSON_TEMPLATE, inputs, opts, spec) },
|
|
303
303
|
{
|
|
304
304
|
path: "SEO-CHECKLIST.md",
|
|
305
305
|
content: sub(SEO_CHECKLIST_TEMPLATE, inputs, opts, spec),
|
|
@@ -319,20 +319,31 @@ export function scaffoldCfPages(inputs, opts) {
|
|
|
319
319
|
* page. Shipping the document makes the standard's keyword (`"status":"ok"`)
|
|
320
320
|
* true for all five deploy targets instead of four.
|
|
321
321
|
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
* the keyword
|
|
322
|
+
* 🔴 NOW SUBSTITUTED, REVERSING THIS FILE'S FORMER "deliberately NOT
|
|
323
|
+
* substituted, the body must be byte-stable" RULE (2026-08-20). That rule was
|
|
324
|
+
* written when the keyword was the portfolio-wide constant `"status":"ok"`, and
|
|
325
|
+
* byte-stability is exactly what made that keyword worthless: a token identical
|
|
326
|
+
* across every service cannot detect that the monitor is pointed at the WRONG
|
|
327
|
+
* service, so a mis-typed or copy-pasted URL stays green. The approved
|
|
328
|
+
* [[uptime-kuma-monitor]] §1 standard requires a UNIQUE-PER-SERVICE token,
|
|
329
|
+
* which a byte-stable body cannot carry by definition. The value is derived
|
|
330
|
+
* from the slug via `healthKeyword()` so it can never be hardcoded.
|
|
331
|
+
*
|
|
332
|
+
* 🔴 Do NOT add configuration or state to this document (`"analytics":"configured"`,
|
|
333
|
+
* a build id, a timestamp). The keyable surface must be an IDENTITY claim only:
|
|
334
|
+
* a monitor keyed on a STATE field goes red when that thing is misconfigured on
|
|
335
|
+
* a perfectly healthy site.
|
|
325
336
|
*
|
|
326
337
|
* ⚠️ COMPACT JSON, no space after the colon — this is load-bearing and looks
|
|
327
338
|
* like a formatting nit. Kuma's keyword check is a literal case-sensitive
|
|
328
|
-
* substring match
|
|
339
|
+
* substring match. Every OTHER
|
|
329
340
|
* project type gets this for free because it serializes at runtime
|
|
330
341
|
* (`NextResponse.json` / `c.json` / `Response.json` / FastAPI all emit compact
|
|
331
342
|
* JSON), but a static file is served byte-for-byte as written. Prettifying this
|
|
332
343
|
* to `{ "status": "ok" }` would break every monitor pointed at it — and only at
|
|
333
344
|
* the moment the monitor was supposed to help.
|
|
334
345
|
*/
|
|
335
|
-
const HEALTH_JSON_TEMPLATE = `{"status":"ok"}
|
|
346
|
+
const HEALTH_JSON_TEMPLATE = `{"status":"ok","service":"{{slug}}","keyword":"{{health_keyword}}"}
|
|
336
347
|
`;
|
|
337
348
|
/**
|
|
338
349
|
* Canonical SEO baseline file list for cf-pages. Exported for tests + the
|
|
@@ -17,7 +17,7 @@ npx wrangler dev # local dev server at http://localhost:8787
|
|
|
17
17
|
npx wrangler deploy # deploy to Cloudflare
|
|
18
18
|
\`\`\`
|
|
19
19
|
|
|
20
|
-
**Health endpoint:** \`GET /health\` returns \`{
|
|
20
|
+
**Health endpoint:** \`GET /health\` returns \`{"status":"ok","service":"{{slug}}","keyword":"{{health_keyword}}"}\`. **Do NOT** make this endpoint touch the database — even on Neon-careful projects (per [[neon-postgres]]). The \`keyword\` field is the UNIQUE-PER-SERVICE token the uptime monitor greps (per [[uptime-kuma-monitor]]); never couple it to another value, and never put configuration state in this body.
|
|
21
21
|
|
|
22
22
|
**Secrets:** local secrets live in \`.dev.vars\` (gitignored). Production secrets via \`wrangler secret put\`.
|
|
23
23
|
|
|
@@ -50,7 +50,17 @@ export default {
|
|
|
50
50
|
|
|
51
51
|
if (url.pathname === "/health") {
|
|
52
52
|
// DB-free health endpoint — do NOT add a DB roundtrip here.
|
|
53
|
-
|
|
53
|
+
//
|
|
54
|
+
// \`keyword\` is a dedicated, UNIQUE-PER-SERVICE identity token that exists
|
|
55
|
+
// only to be grepped by the uptime monitor (per [[uptime-kuma-monitor]]),
|
|
56
|
+
// kept separate from \`service\` so a rename cannot silently disarm it.
|
|
57
|
+
// 🔴 Do NOT add configuration or state to this body — a monitor keyed on a
|
|
58
|
+
// STATE field goes red when that thing is misconfigured on a healthy app.
|
|
59
|
+
return Response.json({
|
|
60
|
+
status: "ok",
|
|
61
|
+
service: "{{slug}}",
|
|
62
|
+
keyword: "{{health_keyword}}",
|
|
63
|
+
});
|
|
54
64
|
}
|
|
55
65
|
|
|
56
66
|
return new Response("Not Found", { status: 404 });
|
|
@@ -117,7 +127,11 @@ describe("{{slug}} Worker fetch handler", () => {
|
|
|
117
127
|
it("GET /health returns 200 {status: ok} without touching the database", async () => {
|
|
118
128
|
const res = await worker.fetch(new Request("https://example.com/health"), env, ctx);
|
|
119
129
|
expect(res.status).toBe(200);
|
|
120
|
-
expect(await res.json()).toEqual({
|
|
130
|
+
expect(await res.json()).toEqual({
|
|
131
|
+
status: "ok",
|
|
132
|
+
service: "{{slug}}",
|
|
133
|
+
keyword: "{{health_keyword}}",
|
|
134
|
+
});
|
|
121
135
|
});
|
|
122
136
|
|
|
123
137
|
it("unknown routes return 404", async () => {
|
|
@@ -4277,7 +4277,21 @@ export const runtime = "nodejs";
|
|
|
4277
4277
|
export const dynamic = "force-dynamic";
|
|
4278
4278
|
|
|
4279
4279
|
export function GET() {
|
|
4280
|
-
|
|
4280
|
+
// \`keyword\` is a dedicated, UNIQUE-PER-SERVICE identity token that exists
|
|
4281
|
+
// only to be grepped by the uptime monitor (per [[uptime-kuma-monitor]] §1).
|
|
4282
|
+
// It is deliberately separate from \`service\` so that renaming or re-slugging
|
|
4283
|
+
// this project cannot silently disarm its monitor.
|
|
4284
|
+
//
|
|
4285
|
+
// 🔴 Do NOT add configuration or state to this body (\`"analytics":"configured"\`,
|
|
4286
|
+
// \`"database":"connected"\`, a build id, a timestamp). A monitor keyed on a
|
|
4287
|
+
// STATE field goes red when that thing is misconfigured on a perfectly healthy
|
|
4288
|
+
// app, and one keyed on a value that changes per release goes red on the next
|
|
4289
|
+
// deploy. The keyable surface must be an IDENTITY claim only.
|
|
4290
|
+
return NextResponse.json({
|
|
4291
|
+
status: "ok",
|
|
4292
|
+
service: "{{slug}}",
|
|
4293
|
+
keyword: "{{health_keyword}}",
|
|
4294
|
+
});
|
|
4281
4295
|
}
|
|
4282
4296
|
`;
|
|
4283
4297
|
const APP_SITEMAP_TEMPLATE = `// Sitemap generator — lists every indexable page. Add new entries here when
|
|
@@ -36,7 +36,7 @@ npm run build # compile to dist/
|
|
|
36
36
|
npm start # node dist/index.js (what the container runs)
|
|
37
37
|
\`\`\`
|
|
38
38
|
|
|
39
|
-
**Health endpoint:** \`GET /health\` returns \`{
|
|
39
|
+
**Health endpoint:** \`GET /health\` returns \`{"status":"ok","service":"{{slug}}","keyword":"{{health_keyword}}"}\`. **Do NOT** make this endpoint touch the database — per [[neon-postgres]], routine uptime probes (per [[uptime-kuma-monitor]]) would burn Neon Free's CU-hour quota and break scale-to-zero. Add a separate \`/health/deep\` with an explicit budget if a real readiness check is ever needed. The \`keyword\` field is the UNIQUE-PER-SERVICE token the uptime monitor greps (per [[uptime-kuma-monitor]]); never couple it to another value, and never put configuration state in this body.
|
|
40
40
|
|
|
41
41
|
**Runtime:** Node 20+, listening on \`process.env.PORT\` (Cloud Run injects this; 8080 is the local default). The app is built in \`src/app.ts\` (importable by tests without starting a server) and served by \`src/index.ts\`.
|
|
42
42
|
|
|
@@ -167,7 +167,16 @@ import { Hono } from "hono";
|
|
|
167
167
|
|
|
168
168
|
export const health = new Hono();
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
// \`keyword\` is a dedicated, UNIQUE-PER-SERVICE identity token that exists only
|
|
171
|
+
// to be grepped by the uptime monitor (per [[uptime-kuma-monitor]] §1), kept
|
|
172
|
+
// separate from \`service\` so a rename cannot silently disarm the monitor.
|
|
173
|
+
//
|
|
174
|
+
// 🔴 Do NOT add configuration or state to this body. A monitor keyed on a STATE
|
|
175
|
+
// field goes red when that thing is misconfigured on a healthy app; one keyed on
|
|
176
|
+
// a per-release value goes red on the next deploy.
|
|
177
|
+
health.get("/", (c) =>
|
|
178
|
+
c.json({ status: "ok", service: "{{slug}}", keyword: "{{health_keyword}}" }),
|
|
179
|
+
);
|
|
171
180
|
`;
|
|
172
181
|
const SRC_ROUTES_HEALTH_TEST_TEMPLATE = `import { describe, expect, it } from "vitest";
|
|
173
182
|
|
|
@@ -177,7 +186,11 @@ describe("GET /health", () => {
|
|
|
177
186
|
it("returns 200 {status: ok} without touching the database", async () => {
|
|
178
187
|
const res = await app.request("/health");
|
|
179
188
|
expect(res.status).toBe(200);
|
|
180
|
-
expect(await res.json()).toEqual({
|
|
189
|
+
expect(await res.json()).toEqual({
|
|
190
|
+
status: "ok",
|
|
191
|
+
service: "{{slug}}",
|
|
192
|
+
keyword: "{{health_keyword}}",
|
|
193
|
+
});
|
|
181
194
|
});
|
|
182
195
|
});
|
|
183
196
|
`;
|
|
@@ -20,7 +20,7 @@ pip install -e .[dev] # or: pip install -r requirements.txt
|
|
|
20
20
|
uvicorn {{slug_under}}.main:app --reload
|
|
21
21
|
\`\`\`
|
|
22
22
|
|
|
23
|
-
**Health endpoint:** \`GET /health\` returns \`{"status":
|
|
23
|
+
**Health endpoint:** \`GET /health\` returns \`{"status":"ok","service":"{{slug}}","keyword":"{{health_keyword}}"}\`. **Do NOT** make this endpoint touch the database — per [[neon-postgres]], routine probes burn through Neon Free's CU-hour quota. The \`keyword\` field is the UNIQUE-PER-SERVICE token the uptime monitor greps (per [[uptime-kuma-monitor]]); never couple it to another value, and never put configuration state in this body.
|
|
24
24
|
|
|
25
25
|
**Deployment:** any Python WSGI/ASGI host (Cloud Run, Fly.io, Render, Railway). Per [[portable-stack]], avoid host-branded SDKs.
|
|
26
26
|
`;
|
|
@@ -79,8 +79,15 @@ def health() -> dict[str, str]:
|
|
|
79
79
|
probes from uptime monitors (per [[uptime-kuma-monitor]]) burn through
|
|
80
80
|
Neon Free's 100 CU-hour monthly quota. If a deeper readiness check is
|
|
81
81
|
needed, add a separate \`/health/deep\` endpoint with explicit budget.
|
|
82
|
+
|
|
83
|
+
\`keyword\` is a dedicated, UNIQUE-PER-SERVICE identity token that exists
|
|
84
|
+
only to be grepped by the uptime monitor (per [[uptime-kuma-monitor]]),
|
|
85
|
+
kept separate from \`service\` so a rename cannot silently disarm it.
|
|
86
|
+
|
|
87
|
+
Do NOT add configuration or state to this body — a monitor keyed on a
|
|
88
|
+
STATE field goes red when that thing is misconfigured on a healthy app.
|
|
82
89
|
"""
|
|
83
|
-
return {"status": "ok"}
|
|
90
|
+
return {"status": "ok", "service": "{{slug}}", "keyword": "{{health_keyword}}"}
|
|
84
91
|
`;
|
|
85
92
|
const INIT_PY_TEMPLATE = `"""{{slug}} — top-level package."""
|
|
86
93
|
|
|
@@ -106,7 +113,11 @@ from fastapi.testclient import TestClient
|
|
|
106
113
|
def test_health_returns_ok(client: TestClient) -> None:
|
|
107
114
|
response = client.get("/health")
|
|
108
115
|
assert response.status_code == 200
|
|
109
|
-
assert response.json() == {
|
|
116
|
+
assert response.json() == {
|
|
117
|
+
"status": "ok",
|
|
118
|
+
"service": "{{slug}}",
|
|
119
|
+
"keyword": "{{health_keyword}}",
|
|
120
|
+
}
|
|
110
121
|
`;
|
|
111
122
|
const ENV_EXAMPLE_TEMPLATE = `# {{slug}} — example environment variables.
|
|
112
123
|
# Copy to \`.env\` and fill in real values. Do NOT commit \`.env\`.
|
package/dist/standards.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export interface StandardsResolution {
|
|
|
78
78
|
* family — the safe default for anything else with `has_web_ui=true`.
|
|
79
79
|
*/
|
|
80
80
|
export declare function fathomEnvVarFor(projectType: ProjectType): string;
|
|
81
|
-
export declare const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.
|
|
81
|
+
export declare const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.27";
|
|
82
82
|
/**
|
|
83
83
|
* The canonical **Capture Learnings** block, emitted VERBATIM into every
|
|
84
84
|
* scaffolded `CLAUDE.md`.
|
package/dist/standards.js
CHANGED
|
@@ -376,14 +376,42 @@ const UPTIME_KUMA_BODY = `### Uptime Kuma monitor (deploy target)
|
|
|
376
376
|
> | Stack | Health path | Served by |
|
|
377
377
|
> |---|---|---|
|
|
378
378
|
> | Next.js | \`/api/health\` | \`app/api/health/route.ts\` — a bare \`/health\` **404s**, because the App Router serves route handlers under a path segment |
|
|
379
|
-
> | Python | \`/
|
|
379
|
+
> | Python | \`/health\` | the FastAPI health route |
|
|
380
380
|
> | CF Worker | \`/health\` | the Worker's fetch handler |
|
|
381
381
|
> | Node / Hono | \`/health\` | the mounted health router |
|
|
382
382
|
> | CF Pages (static) | \`/health.json\` | the scaffolded \`health.json\` — a static deploy has no server, so the document IS the endpoint |
|
|
383
383
|
>
|
|
384
384
|
> Use the SAME path in CLAUDE.md / README prose as the route actually serves.
|
|
385
385
|
>
|
|
386
|
-
> **Keyword
|
|
386
|
+
> **Keyword — use exactly this, and nothing shorter:**
|
|
387
|
+
>
|
|
388
|
+
> \`\`\`
|
|
389
|
+
> "keyword":"{{health_keyword}}"
|
|
390
|
+
> \`\`\`
|
|
391
|
+
>
|
|
392
|
+
> The health document this scaffold emits carries it already:
|
|
393
|
+
>
|
|
394
|
+
> \`\`\`json
|
|
395
|
+
> {"status":"ok","service":"{{slug}}","keyword":"{{health_keyword}}"}
|
|
396
|
+
> \`\`\`
|
|
397
|
+
>
|
|
398
|
+
> **A keyword must be three things, and only the first is obvious** (approved standard, Kerry 2026-08-20, after a portfolio audit found 12 of 23 monitors keyed on the bare \`"status":"ok"\`):
|
|
399
|
+
>
|
|
400
|
+
> | | property | what breaks without it |
|
|
401
|
+
> |---|---|---|
|
|
402
|
+
> | 1 | **UNIQUE** across the portfolio | a mis-pointed monitor stays GREEN — it proves *something* is alive, not that *this app* is |
|
|
403
|
+
> | 2 | **STABLE** across requests and releases | keyed on a version or timestamp, the monitor goes RED on the next deploy |
|
|
404
|
+
> | 3 | **AN IDENTITY claim, not a STATE claim** | keyed on \`"analytics":"configured"\`, the monitor goes RED when analytics is misconfigured on a perfectly healthy app |
|
|
405
|
+
>
|
|
406
|
+
> **Why not \`"status":"ok"\` (this scaffold's own former default):** it is byte-identical across every Z2W service, so a monitor whose URL was mistyped, copied from a sibling project, or left pointing at a decommissioned host still goes green. That is the failure it was supposed to catch. **Why not bare \`ok\`:** Kuma matches a case-sensitive substring over the WHOLE body, and \`ok\` is inside *cookie, lookup, token, booking, blocked, looking* — all of which appear in error pages that still return HTTP 200.
|
|
407
|
+
>
|
|
408
|
+
> 🔴 **Include the \`"keyword":"\` prefix in what you type into Kuma — do not shorten it to the bare token.** The prefix left-anchors the match, and the \`-health-ok\` suffix right-anchors it. Both matter in this portfolio, which is actively renaming \`z2w-foo\` to \`foo\`: during that transition a bare-slug keyword for \`foo\` would substring-match \`z2w-foo\`'s health body, and the two monitors could not tell each other apart.
|
|
409
|
+
>
|
|
410
|
+
> 🔴 **Never add configuration or state to the health body** — no \`"database":"connected"\`, no build id, no timestamp. Those turn a liveness probe into a deploy-fragile config check. The keyable surface is an identity claim only.
|
|
411
|
+
>
|
|
412
|
+
> ⚠️ **Compact JSON, no space after the colon.** Kuma matches literally. Runtime serializers (\`NextResponse.json\` / \`c.json\` / \`Response.json\` / FastAPI) all emit compact; the static \`cf-pages\` \`health.json\` is written compact by hand — prettifying it would break the monitor at exactly the moment it was supposed to help.
|
|
413
|
+
>
|
|
414
|
+
> ⚠️ **\`curl\` the endpoint and substring-match before you save the monitor** — never type a keyword you have not seen in a real response body, and prove the check can FAIL with a negative control against a path that does not exist. See [[uptime-kuma-monitor]] §1 for the three-curl recipe and the form-by-form walkthrough.`;
|
|
387
415
|
const SENTRY_BODY = `### Sentry runtime-error tracking (customer-facing web app)
|
|
388
416
|
|
|
389
417
|
> **Wire Sentry at instantiation — runtime error capture is the observability gap uptime monitoring can't cover.** Uptime Kuma proves \`/health\` returns 200; Sentry proves *actual user requests* are succeeding. A beta customer hits Submit, gets a 500, Kuma still sees \`/health\` 200 → no alert → nobody knows. Sentry emails + Session Replay within ~2 min. Vercel Hobby does NOT email on runtime errors (only build/deploy failures), so this is the only path to per-request error visibility. Free tier (5k errors + 10k transactions + 50 replays / mo) covers any Z2W-scale project at $0/mo. Same posture as [[fathom-analytics]] and [[uptime-kuma-monitor]]: the Z2W-sanctioned default tool for the runtime-error / APM category. **Load [[sentry-runtime-errors]] before wiring — it is the binding contract; the summary below is orientation.**
|
|
@@ -447,7 +475,7 @@ const NEON_CAREFUL_BODY = `### Neon-careful (Neon Postgres)
|
|
|
447
475
|
// Two consecutive handoffs compared this constant against the DOCUMENT version
|
|
448
476
|
// and reported a "15-version gap" that did not exist — the real gap was 4. Read
|
|
449
477
|
// the `<!-- ... canonical-block vX.Y.Z -->` comment, never the `**Version:**` line.
|
|
450
|
-
export const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.
|
|
478
|
+
export const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.27";
|
|
451
479
|
/**
|
|
452
480
|
* The canonical **Capture Learnings** block, emitted VERBATIM into every
|
|
453
481
|
* scaffolded `CLAUDE.md`.
|
package/dist/substitute.d.ts
CHANGED
|
@@ -54,6 +54,37 @@ export declare function frameworkVersionForType(projectType: ProjectType): strin
|
|
|
54
54
|
* against `^[a-z][a-z0-9-]{2,49}$`, so character 0 is always a letter.
|
|
55
55
|
*/
|
|
56
56
|
export declare function brandInitial(brandName: string, slug: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* The dedicated Uptime Kuma keyword this project's health document serves, per
|
|
59
|
+
* the approved [[uptime-kuma-monitor]] §1 standard (Kerry, 2026-08-20).
|
|
60
|
+
*
|
|
61
|
+
* A monitor keyword must be three things, and only the first is obvious:
|
|
62
|
+
* **UNIQUE** across the portfolio (otherwise a mis-pointed monitor stays
|
|
63
|
+
* green), **STABLE** across requests and releases (a keyword on a version or
|
|
64
|
+
* timestamp goes red on the next deploy), and **AN IDENTITY claim, not a STATE
|
|
65
|
+
* claim** (a keyword on `"analytics":"configured"` goes red when analytics is
|
|
66
|
+
* misconfigured on a perfectly healthy app).
|
|
67
|
+
*
|
|
68
|
+
* 🔴 DERIVED FROM THE SLUG, NEVER A LITERAL — this is the load-bearing half and
|
|
69
|
+
* it is the half that sounds optional. The decoupling from `service` is the
|
|
70
|
+
* part that sounds like the point; it is not. A shared constant value
|
|
71
|
+
* reintroduces the exact trap the field exists to prevent — it becomes
|
|
72
|
+
* `"status":"ok"` with extra steps, and it looks fine right up until the second
|
|
73
|
+
* project carries it. The cautionary case is real: `z2w-agent-command-center`
|
|
74
|
+
* serves `"keyword":"z2w-health-ok"`, unique today only by accident of adoption,
|
|
75
|
+
* whose *name* reads as a portfolio-wide constant — precisely the value a
|
|
76
|
+
* standardisation pass would copy everywhere. This function exists so that no
|
|
77
|
+
* scaffolder can ever hardcode one.
|
|
78
|
+
*
|
|
79
|
+
* The `-health-ok` suffix is not decoration. It anchors the RIGHT side of the
|
|
80
|
+
* token so the value cannot collide with a sibling project's, and the
|
|
81
|
+
* `"keyword":"` field prefix anchors the LEFT — see the substring-containment
|
|
82
|
+
* note in the emitted Uptime Kuma standards block. Both anchors matter in THIS
|
|
83
|
+
* portfolio, which is actively renaming `z2w-foo` to `foo`: during that
|
|
84
|
+
* transition a bare-slug keyword for `foo` would substring-match the body of
|
|
85
|
+
* `z2w-foo`.
|
|
86
|
+
*/
|
|
87
|
+
export declare function healthKeyword(slug: string): string;
|
|
57
88
|
/**
|
|
58
89
|
* Build the placeholder → value map for a set of inputs. Exposed (not just
|
|
59
90
|
* used internally by applySubstitutions) so callers can inspect or extend
|
package/dist/substitute.js
CHANGED
|
@@ -84,6 +84,39 @@ export function brandInitial(brandName, slug) {
|
|
|
84
84
|
const fromBrand = /[A-Za-z0-9]/.exec(brandName);
|
|
85
85
|
return (fromBrand ? fromBrand[0] : slug.charAt(0)).toUpperCase();
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* The dedicated Uptime Kuma keyword this project's health document serves, per
|
|
89
|
+
* the approved [[uptime-kuma-monitor]] §1 standard (Kerry, 2026-08-20).
|
|
90
|
+
*
|
|
91
|
+
* A monitor keyword must be three things, and only the first is obvious:
|
|
92
|
+
* **UNIQUE** across the portfolio (otherwise a mis-pointed monitor stays
|
|
93
|
+
* green), **STABLE** across requests and releases (a keyword on a version or
|
|
94
|
+
* timestamp goes red on the next deploy), and **AN IDENTITY claim, not a STATE
|
|
95
|
+
* claim** (a keyword on `"analytics":"configured"` goes red when analytics is
|
|
96
|
+
* misconfigured on a perfectly healthy app).
|
|
97
|
+
*
|
|
98
|
+
* 🔴 DERIVED FROM THE SLUG, NEVER A LITERAL — this is the load-bearing half and
|
|
99
|
+
* it is the half that sounds optional. The decoupling from `service` is the
|
|
100
|
+
* part that sounds like the point; it is not. A shared constant value
|
|
101
|
+
* reintroduces the exact trap the field exists to prevent — it becomes
|
|
102
|
+
* `"status":"ok"` with extra steps, and it looks fine right up until the second
|
|
103
|
+
* project carries it. The cautionary case is real: `z2w-agent-command-center`
|
|
104
|
+
* serves `"keyword":"z2w-health-ok"`, unique today only by accident of adoption,
|
|
105
|
+
* whose *name* reads as a portfolio-wide constant — precisely the value a
|
|
106
|
+
* standardisation pass would copy everywhere. This function exists so that no
|
|
107
|
+
* scaffolder can ever hardcode one.
|
|
108
|
+
*
|
|
109
|
+
* The `-health-ok` suffix is not decoration. It anchors the RIGHT side of the
|
|
110
|
+
* token so the value cannot collide with a sibling project's, and the
|
|
111
|
+
* `"keyword":"` field prefix anchors the LEFT — see the substring-containment
|
|
112
|
+
* note in the emitted Uptime Kuma standards block. Both anchors matter in THIS
|
|
113
|
+
* portfolio, which is actively renaming `z2w-foo` to `foo`: during that
|
|
114
|
+
* transition a bare-slug keyword for `foo` would substring-match the body of
|
|
115
|
+
* `z2w-foo`.
|
|
116
|
+
*/
|
|
117
|
+
export function healthKeyword(slug) {
|
|
118
|
+
return `${slug}-health-ok`;
|
|
119
|
+
}
|
|
87
120
|
/**
|
|
88
121
|
* Build the placeholder → value map for a set of inputs. Exposed (not just
|
|
89
122
|
* used internally by applySubstitutions) so callers can inspect or extend
|
|
@@ -97,6 +130,7 @@ export function buildSubstitutionMap(inputs, opts = {}) {
|
|
|
97
130
|
slug_under: underscoredSlug(inputs.slug),
|
|
98
131
|
slug_camel: pascalCaseFromSlug(inputs.slug),
|
|
99
132
|
slug_const: upperSnakeFromSlug(inputs.slug),
|
|
133
|
+
health_keyword: healthKeyword(inputs.slug),
|
|
100
134
|
description: inputs.description,
|
|
101
135
|
brand_name: spec.brandName,
|
|
102
136
|
brand_name_rule: spec.brandNameRule,
|
package/package.json
CHANGED
|
@@ -365,11 +365,39 @@ export function parseSection(section, knownSlugs = new Set()) {
|
|
|
365
365
|
const body = labelled[1]
|
|
366
366
|
.replace(/\([^)]*\)/g, "")
|
|
367
367
|
.split(/\bLater phases?\b\s*:?/i)[0];
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
// A COMMA IN THE PROSE IS NOT AN EDGE SEPARATOR (2026-08-24). Stripping
|
|
369
|
+
// parentheticals handled the `(why…)` note; it does nothing for the canonical
|
|
370
|
+
// form's `— why` note, which runs to end of line and may contain commas of its
|
|
371
|
+
// own. `- consumes: contact-registry — people, tags, entitlements.` therefore
|
|
372
|
+
// yielded THREE edges, and the registry recorded `tags` as a real dependency of
|
|
373
|
+
// `commerce-engine`. `audit-engine` produced `live-status` the same way, out of the
|
|
374
|
+
// trailing sentence "… as its project inventory, live-status, and audit-history
|
|
375
|
+
// input". Both were surfaced every run as `ⓘ not registry slugs` and neither was
|
|
376
|
+
// stopped, because that line REPORTS and does not FILTER.
|
|
377
|
+
//
|
|
378
|
+
// The fix is the conservatism the table branch (d) already states, applied here: a
|
|
379
|
+
// comma-part is an edge only when it is a known registry slug or carries an explicit
|
|
380
|
+
// `:qualifier`. The FIRST part is exempt — that is the position the author names
|
|
381
|
+
// the edge in, and it is the only one an external backend can legitimately occupy
|
|
382
|
+
// (`neon-postgres`, `Resend`, `Sentry` each own their own line). So the canonical
|
|
383
|
+
// one-edge-per-line form keeps working for targets that have no registry row, while
|
|
384
|
+
// the inline-list form stops inventing edges out of the sentence after the last one.
|
|
385
|
+
// [[zero-is-not-a-pass]] — a reported artifact that is still written is not a caught one.
|
|
386
|
+
const parts = body.split(",");
|
|
387
|
+
parts.forEach((part, i) => {
|
|
388
|
+
// Cut at the `— why` note AND at the first SENTENCE END. Stripping parentheticals
|
|
389
|
+
// leaves the prose that followed them attached to the last item, so
|
|
390
|
+
// `` `email-service-router:ses` (notification email). Also reads the registry … ``
|
|
391
|
+
// collapsed into one space-bearing blob and the slug was lost — a MISS that
|
|
392
|
+
// predates this guard and that additive-union had been quietly hiding behind a
|
|
393
|
+
// value written when the line read differently. `\.\s` cannot cut a slug: a dot
|
|
394
|
+
// inside one is never followed by whitespace (`crawl-engine:crawlapi.z2w.us`).
|
|
395
|
+
const head = part.split(/\s+[—–-]\s+/)[0].split(/\.\s/)[0];
|
|
370
396
|
const slug = cleanSlug(head);
|
|
371
|
-
if (slug)
|
|
372
|
-
|
|
397
|
+
if (!slug) return;
|
|
398
|
+
const trusted = i === 0 || slug.includes(":") || knownSlugs.has(slug.split(":")[0]);
|
|
399
|
+
if (trusted) result.consumes.push(slug);
|
|
400
|
+
});
|
|
373
401
|
continue;
|
|
374
402
|
}
|
|
375
403
|
|
|
@@ -661,13 +689,24 @@ async function main() {
|
|
|
661
689
|
// "GENUINELY EMPTY" IS A DECLARATION, NOT A SUBSTRING (2026-08-17). The old test was
|
|
662
690
|
// `!/\(none/i.test(section)` — the whole section, so ANY parenthetical starting "none"
|
|
663
691
|
// suppressed the warning, including `- provides: (none yet)`, which says nothing about
|
|
664
|
-
// consumes. It could not do the job it was there for either:
|
|
665
|
-
//
|
|
666
|
-
//
|
|
692
|
+
// consumes. It could not do the job it was there for either: a section with no Z2W
|
|
693
|
+
// coupling by design was reported as a parse failure every run, i.e. a false red under
|
|
694
|
+
// `--strict`. `declaredNoConsumes` is
|
|
667
695
|
// set only by a labelled CONSUMES line carrying the §8.10 empty marker, so the two
|
|
668
696
|
// cases the header's own NO SILENT ZERO rule conflates — "unreadable" and "deliberately
|
|
669
697
|
// empty" — are finally distinguishable. Absence is still never a value: a section that
|
|
670
698
|
// declares nothing at all remains a defect and still warns. [[zero-is-not-a-pass]]
|
|
699
|
+
//
|
|
700
|
+
// 🔴 THE WORKED EXAMPLE THIS FEATURE WAS BUILT ON WAS WRONG, corrected 2026-08-24 at
|
|
701
|
+
// `kuma-watchdog`'s own filing. v0.20.0's comment asserted they consume "only Uptime
|
|
702
|
+
// Kuma, Neon and Slack — no Z2W coupling BY DESIGN". Two of those three are Z2W
|
|
703
|
+
// -consumable and the Neon one is a registry edge; they have FOUR real edges, which the
|
|
704
|
+
// parser could not see because the section wrote them as prose inside bolded bullets,
|
|
705
|
+
// several systems per line. So the specimen chosen to prove "deliberately empty" was in
|
|
706
|
+
// fact the other case — UNREADABLE — which is the exact distinction this flag exists to
|
|
707
|
+
// draw. The MECHANISM stands; only its example was misread. Worth keeping visible: a
|
|
708
|
+
// guard justified by a specimen nobody re-measured is a guard that can be pointed at
|
|
709
|
+
// the wrong thing without anything going red.
|
|
671
710
|
if (consumes.length === 0 && !declaredNoConsumes) {
|
|
672
711
|
zeroEdges.push(slug);
|
|
673
712
|
console.warn(` ⚠ ${slug}: ## Integrations present but ZERO edges parsed — check the line form (expected \`- consumes: {slug} — {why}\`, or \`- consumes: (none — no Z2W edges)\` if that is deliberate).`);
|