@zero2webmaster/starter-kit 0.25.0 → 0.27.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/confirm.d.ts +1 -0
- package/dist/confirm.js +16 -6
- package/dist/index.d.ts +39 -0
- package/dist/parse-brief.d.ts +13 -0
- package/dist/parse-brief.js +76 -0
- package/dist/scaffolders/cf-pages.js +62 -7
- package/dist/scaffolders/cf-worker.js +17 -3
- package/dist/scaffolders/nextjs.js +120 -16
- package/dist/scaffolders/node-service.js +16 -3
- package/dist/scaffolders/python-service.js +14 -3
- package/dist/standards.js +30 -2
- package/dist/substitute.d.ts +31 -0
- package/dist/substitute.js +44 -0
- package/dist/summary.js +19 -0
- package/dist/wizard.js +15 -0
- package/dist/writer.js +17 -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.27.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.27.0 (current)** answers `org-hq`'s two scaffold defects, ten days after they were filed. The headline: **`app/robots.ts` was asking the wrong question.** Its gate required a production deployment AND a real custom domain — and an internal admin console satisfies **both** while still being wrong to index, so `org-hq` served `Allow: /` on a branded public subdomain for a month with every check it had passing, because none of them asked. Indexability now takes a third condition, `hasPublicSurface`, baked in at scaffold time rather than read from the environment, because it is a fact about what an app IS and not about where a copy of it is running. **It fails CLOSED** — omitted reads as "no public surface" — which is the opposite default from every other optional input here and is deliberate: a public site wrongly withheld is one field and a redeploy with nothing having escaped, while an internal console wrongly published is silent, slow to undo, and has already happened by the time anyone notices. The wizard and brief-first flows ask, and the CLI's final summary now **states the posture out loud in both directions**, since a silent default is how the original defect survived. `cf-pages` is fixed in the same release — it published `Allow: /` unconditionally — because shipping the fix only in the type that was reported would have left its sibling quietly broken. The second defect: the `*.vercel.app` alias redirect now **excludes `/api/*`**, whose SEO rationale never applied and whose 308 breaks every server-to-server caller that does not follow redirects. **And re-measuring the report changed it:** the companion claim — that adding the exclusion would silently stop redirecting `/`, because a `:path` param cannot match the empty string — **did not reproduce.** On Next.js 15.5.23 a CUSTOM param pattern supplies its own `.*`, which matches empty, so the wildcard alone still redirected the root; the explicit root rule ships anyway as insurance against a path-to-regexp detail that is not a documented guarantee, described as insurance rather than as a repair. Verified per tier 1 on two real scaffolds from the built `dist/` — `npm install`, a real `next build`, and `curl` with forged `Host` headers against both the shipped form and a control build with the root rule removed. **1241 of 1241 passing.**
|
|
87
|
+
- **v0.26.0** 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.**
|
|
88
|
+
- **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.**
|
|
87
89
|
- **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.
|
|
88
90
|
- **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.
|
|
89
91
|
- **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.
|
|
@@ -133,4 +135,4 @@ Inquiries: kerry@zero2webmaster.com.
|
|
|
133
135
|
---
|
|
134
136
|
|
|
135
137
|
*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.*
|
|
136
|
-
*Version: 0.
|
|
138
|
+
*Version: 0.27.0 | Last Updated: 2026-08-25*
|
package/dist/confirm.d.ts
CHANGED
package/dist/confirm.js
CHANGED
|
@@ -54,7 +54,7 @@ export function renderDraft(draft) {
|
|
|
54
54
|
const cb = draft.customBrand;
|
|
55
55
|
lines.push(` 4a. Brand name ................ ${fmtCustom(cb?.brandName)}`, ` 4b. Capitalization rule ....... ${fmtCustom(cb?.brandNameRule)}`, ` 4c. Primary hex color ......... ${fmtCustom(cb?.primaryColor)}`, ` 4d. Accent hex color .......... ${fmtCustom(cb?.accentColor)}`);
|
|
56
56
|
}
|
|
57
|
-
lines.push(` 5. GitHub owner ................... ${fmt(draft.githubOrg)}`, ` 6. Target path .................... ${fmt(draft.targetPath)}`, ` 7. Database strategy .............. ${fmt(draft.dbStrategy)}`, ` 8. Has web UI ..................... ${fmt(draft.hasWebUi)}`, ` 9. Has cron / scheduled jobs ...... ${fmt(draft.hasCron)}`, ` 10. Participate in agent bulletin .. ${fmt(draft.participateInBulletin)}`, ` 11. Sends transactional/auth email . ${fmt(draft.sendsEmail)}`, ` 12. Accepts user-generated content ${fmt(draft.hasUserContent)}`, ` 13. Wire Sentry error tracking ..... ${fmt(draft.hasObservability)}`, ` 14. Will accept credit cards ....... ${fmt(draft.acceptsCards)}`);
|
|
57
|
+
lines.push(` 5. GitHub owner ................... ${fmt(draft.githubOrg)}`, ` 6. Target path .................... ${fmt(draft.targetPath)}`, ` 7. Database strategy .............. ${fmt(draft.dbStrategy)}`, ` 8. Has web UI ..................... ${fmt(draft.hasWebUi)}`, ` 9. Has cron / scheduled jobs ...... ${fmt(draft.hasCron)}`, ` 10. Participate in agent bulletin .. ${fmt(draft.participateInBulletin)}`, ` 11. Sends transactional/auth email . ${fmt(draft.sendsEmail)}`, ` 12. Accepts user-generated content ${fmt(draft.hasUserContent)}`, ` 13. Wire Sentry error tracking ..... ${fmt(draft.hasObservability)}`, ` 14. Will accept credit cards ....... ${fmt(draft.acceptsCards)}`, ` 15. Public surface (search-indexable) ${fmt(draft.hasPublicSurface)}`);
|
|
58
58
|
return lines.join("\n");
|
|
59
59
|
}
|
|
60
60
|
export function parseSlug(raw) {
|
|
@@ -336,8 +336,16 @@ async function editField(draft, fieldNumber, opts) {
|
|
|
336
336
|
draft.acceptsCards = result.value;
|
|
337
337
|
return null;
|
|
338
338
|
}
|
|
339
|
+
case 15: {
|
|
340
|
+
const raw = await opts.prompter("Public surface — should search engines index this (yes/no):", draft.hasPublicSurface ? "yes" : "no");
|
|
341
|
+
const result = parseBoolean(raw, "Public surface");
|
|
342
|
+
if (!result.ok)
|
|
343
|
+
return result.error;
|
|
344
|
+
draft.hasPublicSurface = result.value;
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
339
347
|
default:
|
|
340
|
-
return `Field number must be between 1 and
|
|
348
|
+
return `Field number must be between 1 and 15. Got: ${fieldNumber}.`;
|
|
341
349
|
}
|
|
342
350
|
}
|
|
343
351
|
/**
|
|
@@ -364,14 +372,15 @@ export async function confirmInputs(parsed, opts) {
|
|
|
364
372
|
hasUserContent: parsed.hasUserContent,
|
|
365
373
|
hasObservability: parsed.hasObservability,
|
|
366
374
|
acceptsCards: parsed.acceptsCards,
|
|
375
|
+
hasPublicSurface: parsed.hasPublicSurface,
|
|
367
376
|
customBrand: null,
|
|
368
377
|
};
|
|
369
378
|
while (true) {
|
|
370
379
|
output.write(`\nInferred inputs from your brief:\n\n${renderDraft(draft)}\n\n`);
|
|
371
380
|
const complete = isComplete(draft);
|
|
372
381
|
const prompt = complete
|
|
373
|
-
? "Press Enter to accept, a line number (1-
|
|
374
|
-
: "Type a line number (1-
|
|
382
|
+
? "Press Enter to accept, a line number (1-15) to edit, or 'cancel' to exit (Ctrl+C also works):"
|
|
383
|
+
: "Type a line number (1-15) to fill or edit, or 'cancel' to exit (Ctrl+C also works). Every field must be set before accepting.";
|
|
375
384
|
const reply = (await opts.prompter(prompt)).trim();
|
|
376
385
|
if (CONFIRM_CANCEL_KEYWORDS.includes(reply.toLowerCase())) {
|
|
377
386
|
throw new ConfirmCancelledError();
|
|
@@ -388,8 +397,8 @@ export async function confirmInputs(parsed, opts) {
|
|
|
388
397
|
continue;
|
|
389
398
|
}
|
|
390
399
|
const fieldNumber = Number(reply);
|
|
391
|
-
if (!Number.isInteger(fieldNumber) || fieldNumber < 1 || fieldNumber >
|
|
392
|
-
output.write(`\n ✗ "${reply}" is not a line number (1-
|
|
400
|
+
if (!Number.isInteger(fieldNumber) || fieldNumber < 1 || fieldNumber > 15) {
|
|
401
|
+
output.write(`\n ✗ "${reply}" is not a line number (1-15).\n`);
|
|
393
402
|
continue;
|
|
394
403
|
}
|
|
395
404
|
const error = await editField(draft, fieldNumber, opts);
|
|
@@ -412,6 +421,7 @@ export async function confirmInputs(parsed, opts) {
|
|
|
412
421
|
hasUserContent: draft.hasUserContent,
|
|
413
422
|
hasObservability: draft.hasObservability,
|
|
414
423
|
acceptsCards: draft.acceptsCards,
|
|
424
|
+
hasPublicSurface: draft.hasPublicSurface,
|
|
415
425
|
};
|
|
416
426
|
if (draft.brand === "custom" && draft.customBrand !== null) {
|
|
417
427
|
result.customBrand = draft.customBrand;
|
package/dist/index.d.ts
CHANGED
|
@@ -164,6 +164,45 @@ export interface ScaffoldInputs {
|
|
|
164
164
|
* failed silently" surface.
|
|
165
165
|
*/
|
|
166
166
|
hasObservability?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Whether this project has a PUBLIC SURFACE — pages meant for the general
|
|
169
|
+
* public and therefore for search engines — as opposed to an internal
|
|
170
|
+
* console, staff tool, or admin dashboard whose entire audience arrives
|
|
171
|
+
* already knowing the URL.
|
|
172
|
+
*
|
|
173
|
+
* This is the question `app/robots.ts` actually needs answered, and it is NOT
|
|
174
|
+
* the question the indexability gate asked before v0.27.0. That gate asked
|
|
175
|
+
* *"is this a production deployment on a real custom domain?"* — and an
|
|
176
|
+
* internal admin console satisfies **both** conditions while still being
|
|
177
|
+
* wrong to index. The two facts come apart for every console this CLI emits.
|
|
178
|
+
* Reported by `org-hq` on 2026-08-14 after serving `Allow: /` on a branded
|
|
179
|
+
* public subdomain for a month.
|
|
180
|
+
*
|
|
181
|
+
* When `false`, the emitted `isIndexableDeployment()` returns `false` in every
|
|
182
|
+
* environment, so `robots.txt` is `Disallow: /` permanently rather than
|
|
183
|
+
* conditionally. The rest of the SEO baseline (metadata, canonical host,
|
|
184
|
+
* sitemap, OG image, the alias redirect) is untouched — an internal tool still
|
|
185
|
+
* wants a canonical domain and a working share card; it just does not want a
|
|
186
|
+
* crawler.
|
|
187
|
+
*
|
|
188
|
+
* 🔴 **Optional, and OMITTED READS AS `false` — this fails CLOSED**, which is
|
|
189
|
+
* the opposite default from every other optional boolean here and is
|
|
190
|
+
* deliberate. The two errors are not symmetric:
|
|
191
|
+
*
|
|
192
|
+
* - Wrongly non-indexable public app: one field, one redeploy, and the crawler
|
|
193
|
+
* comes back. Nothing has escaped.
|
|
194
|
+
* - Wrongly indexable internal console: admin URLs, staff names and internal
|
|
195
|
+
* tooling are crawled and cached. Getting them back out is slow, awkward,
|
|
196
|
+
* and the exposure has already happened.
|
|
197
|
+
*
|
|
198
|
+
* That asymmetry is the same argument the two-condition gate was built on in
|
|
199
|
+
* the first place — fail toward the visible error ([[unknown-means-denied]]).
|
|
200
|
+
* The wizard and brief-first flows ASK, so an interactive run never relies on
|
|
201
|
+
* the default; the `--input` and programmatic paths must pass it explicitly.
|
|
202
|
+
* Honored by the `nextjs` and `cf-pages` types, which are the two that emit a
|
|
203
|
+
* robots document.
|
|
204
|
+
*/
|
|
205
|
+
hasPublicSurface?: boolean;
|
|
167
206
|
/**
|
|
168
207
|
* Whether the incoming `Host` header selects the tenant — a HOST-ROUTED
|
|
169
208
|
* multi-tenant app, where each tenant has its own front door (its own custom
|
package/dist/parse-brief.d.ts
CHANGED
|
@@ -36,6 +36,19 @@ export interface ParsedBrief {
|
|
|
36
36
|
* bot-protection standard and, for `nextjs`, the protected-endpoint shape.
|
|
37
37
|
*/
|
|
38
38
|
acceptsCards: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the project has a PUBLIC SURFACE — pages meant for the general
|
|
41
|
+
* public and therefore for search engines. Not nullable; absent signal means
|
|
42
|
+
* `false`.
|
|
43
|
+
*
|
|
44
|
+
* 🔴 Unlike every other inference here, "no signal" resolves to the
|
|
45
|
+
* RESTRICTIVE answer rather than the common one. A brief for a public site
|
|
46
|
+
* nearly always says so (marketing, landing page, visitors, SEO, blog), while
|
|
47
|
+
* a brief for an internal console often just describes the work without ever
|
|
48
|
+
* using the word "internal" — so absence of evidence is far weaker evidence of
|
|
49
|
+
* "public" than it looks. A human confirms on line 15 either way.
|
|
50
|
+
*/
|
|
51
|
+
hasPublicSurface: boolean;
|
|
39
52
|
/** Free-text planning sections lifted verbatim from the brief, if any. */
|
|
40
53
|
briefSections: BriefSections | undefined;
|
|
41
54
|
raw: string;
|
package/dist/parse-brief.js
CHANGED
|
@@ -481,6 +481,80 @@ function inferHasObservability(brief, projectType, hasWebUi) {
|
|
|
481
481
|
const isWebAppType = projectType === "nextjs" || projectType === "cf-pages";
|
|
482
482
|
return isWebAppType && hasWebUi === true;
|
|
483
483
|
}
|
|
484
|
+
/**
|
|
485
|
+
* Infer whether the project has a PUBLIC SURFACE — pages meant for the general
|
|
486
|
+
* public, and therefore for search engines.
|
|
487
|
+
*
|
|
488
|
+
* This is NOT "does it have a web UI". Every internal console has a web UI. The
|
|
489
|
+
* question is who the pages are for, and it is the question `app/robots.ts`
|
|
490
|
+
* actually needs answered — `org-hq` (2026-08-14) served `Allow: /` on a
|
|
491
|
+
* branded production subdomain for a month because the gate it had asked "is
|
|
492
|
+
* this deployment live and configured?", which an internal console answers yes.
|
|
493
|
+
*
|
|
494
|
+
* 🔴 Defaults to `false`, which is the opposite of how the other inferences
|
|
495
|
+
* here resolve an absent signal, and the asymmetry is the whole reason: a
|
|
496
|
+
* public site wrongly withheld from crawlers is one toggle and a redeploy, with
|
|
497
|
+
* nothing having escaped; an internal console wrongly published is silent, slow
|
|
498
|
+
* to undo, and has already happened by the time anyone notices
|
|
499
|
+
* ([[unknown-means-denied]]). The operator confirms on line 15.
|
|
500
|
+
*
|
|
501
|
+
* The NEGATIVE signals are listed first and win, because a brief that says both
|
|
502
|
+
* "admin dashboard" and "landing page" is describing a tool with a marketing
|
|
503
|
+
* page in front of it — and the tool is the thing being scaffolded here.
|
|
504
|
+
*/
|
|
505
|
+
function inferHasPublicSurface(brief, projectType) {
|
|
506
|
+
const explicit = explicitBoolean(brief, [
|
|
507
|
+
"public surface",
|
|
508
|
+
"search engine",
|
|
509
|
+
"search-indexable",
|
|
510
|
+
"indexable",
|
|
511
|
+
"seo",
|
|
512
|
+
]);
|
|
513
|
+
if (explicit !== null)
|
|
514
|
+
return explicit;
|
|
515
|
+
const lower = brief.toLowerCase();
|
|
516
|
+
// Only the two types that emit a robots document can have a public surface in
|
|
517
|
+
// the sense this flag governs; everything else is moot and stays false.
|
|
518
|
+
if (projectType !== "nextjs" && projectType !== "cf-pages")
|
|
519
|
+
return false;
|
|
520
|
+
const internalSignals = [
|
|
521
|
+
"internal tool",
|
|
522
|
+
"internal console",
|
|
523
|
+
"internal dashboard",
|
|
524
|
+
"internal app",
|
|
525
|
+
"admin console",
|
|
526
|
+
"admin dashboard",
|
|
527
|
+
"admin panel",
|
|
528
|
+
"staff tool",
|
|
529
|
+
"staff console",
|
|
530
|
+
"back office",
|
|
531
|
+
"back-office",
|
|
532
|
+
"not public",
|
|
533
|
+
"behind a login",
|
|
534
|
+
"login-only",
|
|
535
|
+
"logged-in only",
|
|
536
|
+
];
|
|
537
|
+
if (internalSignals.some((s) => lower.includes(s)))
|
|
538
|
+
return false;
|
|
539
|
+
const publicSignals = [
|
|
540
|
+
"marketing site",
|
|
541
|
+
"marketing page",
|
|
542
|
+
"landing page",
|
|
543
|
+
"public site",
|
|
544
|
+
"public website",
|
|
545
|
+
"public-facing",
|
|
546
|
+
"public facing",
|
|
547
|
+
"brochure site",
|
|
548
|
+
"static site",
|
|
549
|
+
"blog",
|
|
550
|
+
"documentation site",
|
|
551
|
+
"docs site",
|
|
552
|
+
"visitors",
|
|
553
|
+
"search traffic",
|
|
554
|
+
"organic traffic",
|
|
555
|
+
];
|
|
556
|
+
return publicSignals.some((s) => lower.includes(s));
|
|
557
|
+
}
|
|
484
558
|
/**
|
|
485
559
|
* Infer whether the project will accept credit cards. Defaults OFF like
|
|
486
560
|
* {@link inferSendsEmail} — emitting a Turnstile verifier, a widget and an
|
|
@@ -631,6 +705,7 @@ export function parseBrief(brief) {
|
|
|
631
705
|
hasUserContent: false,
|
|
632
706
|
hasObservability: false,
|
|
633
707
|
acceptsCards: false,
|
|
708
|
+
hasPublicSurface: false,
|
|
634
709
|
briefSections: undefined,
|
|
635
710
|
raw: brief,
|
|
636
711
|
};
|
|
@@ -653,6 +728,7 @@ export function parseBrief(brief) {
|
|
|
653
728
|
hasUserContent: inferHasUserContent(trimmed),
|
|
654
729
|
hasObservability: inferHasObservability(trimmed, projectType, hasWebUi),
|
|
655
730
|
acceptsCards: inferAcceptsCards(trimmed),
|
|
731
|
+
hasPublicSurface: inferHasPublicSurface(trimmed, projectType),
|
|
656
732
|
briefSections: extractBriefSections(trimmed),
|
|
657
733
|
raw: brief,
|
|
658
734
|
};
|
|
@@ -135,7 +135,14 @@ const INDEX_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
135
135
|
</body>
|
|
136
136
|
</html>
|
|
137
137
|
`;
|
|
138
|
+
/**
|
|
139
|
+
* The `robots.txt` for a site that HAS a public surface.
|
|
140
|
+
*
|
|
141
|
+
* Chosen by `hasPublicSurface`, not by deployment environment — see
|
|
142
|
+
* ROBOTS_TXT_INTERNAL_TEMPLATE for why those are different questions.
|
|
143
|
+
*/
|
|
138
144
|
const ROBOTS_TXT_TEMPLATE = `# robots.txt for {{slug}}.
|
|
145
|
+
# This site HAS a public surface, so the production deploy is crawlable.
|
|
139
146
|
# Preview deploys are blocked via the \`X-Robots-Tag: noindex\` header rule
|
|
140
147
|
# in \`_headers\` (gated to non-production CF Pages branches). This file
|
|
141
148
|
# applies to the production deploy.
|
|
@@ -145,6 +152,38 @@ Allow: /
|
|
|
145
152
|
|
|
146
153
|
Sitemap: __SITE_URL__/sitemap.xml
|
|
147
154
|
`;
|
|
155
|
+
/**
|
|
156
|
+
* The `robots.txt` for a site with NO public surface — an internal console,
|
|
157
|
+
* staff tool or admin dashboard.
|
|
158
|
+
*
|
|
159
|
+
* 🔴 This exists because "is this deploy live and configured?" and "is this for
|
|
160
|
+
* the public?" are different questions that every console scaffold makes come
|
|
161
|
+
* apart. The previous single template published `Allow: /` unconditionally, so
|
|
162
|
+
* an internal tool on a branded production domain advertised itself to every
|
|
163
|
+
* crawler and passed every check it had — none of them asked. Reported against
|
|
164
|
+
* the `nextjs` sibling by `org-hq` on 2026-08-14 after a month of exposure;
|
|
165
|
+
* fixed here at the same time because emitting the fix in one of the two types
|
|
166
|
+
* that serve a robots document would leave the other quietly broken.
|
|
167
|
+
*
|
|
168
|
+
* Deliberately NOT gated on the CF Pages branch: there is no deployment of an
|
|
169
|
+
* internal console that should be crawled, so this is unconditional.
|
|
170
|
+
*/
|
|
171
|
+
const ROBOTS_TXT_INTERNAL_TEMPLATE = `# robots.txt for {{slug}}.
|
|
172
|
+
# This site has NO public surface — it is an internal tool, so nothing here is
|
|
173
|
+
# meant for a search engine. Scaffolded with hasPublicSurface=false.
|
|
174
|
+
#
|
|
175
|
+
# Unconditional on purpose. An internal console in production on its own real
|
|
176
|
+
# domain satisfies every "is this live?" test and is still wrong to index.
|
|
177
|
+
#
|
|
178
|
+
# ⚠️ robots.txt is ADVISORY, never access control. It asks well-behaved crawlers
|
|
179
|
+
# not to index; it stops nobody from reading a page. Anything that must not be
|
|
180
|
+
# read by a stranger needs authentication.
|
|
181
|
+
#
|
|
182
|
+
# There is no Sitemap: line here on purpose — a sitemap is an invitation.
|
|
183
|
+
|
|
184
|
+
User-agent: *
|
|
185
|
+
Disallow: /
|
|
186
|
+
`;
|
|
148
187
|
const SITEMAP_XML_TEMPLATE = `<?xml version="1.0" encoding="UTF-8"?>
|
|
149
188
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
150
189
|
<url>
|
|
@@ -293,13 +332,18 @@ export function scaffoldCfPages(inputs, opts) {
|
|
|
293
332
|
const base = commonBaseFiles(inputs, opts, NARRATIVE);
|
|
294
333
|
const typeSpecific = [
|
|
295
334
|
{ path: "index.html", content: sub(INDEX_HTML_TEMPLATE, inputs, opts, spec) },
|
|
296
|
-
{
|
|
335
|
+
{
|
|
336
|
+
path: "robots.txt",
|
|
337
|
+
content: sub(inputs.hasPublicSurface === true
|
|
338
|
+
? ROBOTS_TXT_TEMPLATE
|
|
339
|
+
: ROBOTS_TXT_INTERNAL_TEMPLATE, inputs, opts, spec),
|
|
340
|
+
},
|
|
297
341
|
{ path: "sitemap.xml", content: sub(SITEMAP_XML_TEMPLATE, inputs, opts, spec) },
|
|
298
342
|
{ path: "_headers", content: sub(HEADERS_TEMPLATE, inputs, opts, spec) },
|
|
299
343
|
{ path: "_redirects", content: sub(REDIRECTS_TEMPLATE, inputs, opts, spec) },
|
|
300
344
|
{ path: "public/og-image.txt", content: OG_IMAGE_PLACEHOLDER },
|
|
301
345
|
{ path: "icon.svg", content: sub(ICON_SVG_TEMPLATE, inputs, opts, spec) },
|
|
302
|
-
{ path: "health.json", content: HEALTH_JSON_TEMPLATE },
|
|
346
|
+
{ path: "health.json", content: sub(HEALTH_JSON_TEMPLATE, inputs, opts, spec) },
|
|
303
347
|
{
|
|
304
348
|
path: "SEO-CHECKLIST.md",
|
|
305
349
|
content: sub(SEO_CHECKLIST_TEMPLATE, inputs, opts, spec),
|
|
@@ -319,20 +363,31 @@ export function scaffoldCfPages(inputs, opts) {
|
|
|
319
363
|
* page. Shipping the document makes the standard's keyword (`"status":"ok"`)
|
|
320
364
|
* true for all five deploy targets instead of four.
|
|
321
365
|
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
* the keyword
|
|
366
|
+
* 🔴 NOW SUBSTITUTED, REVERSING THIS FILE'S FORMER "deliberately NOT
|
|
367
|
+
* substituted, the body must be byte-stable" RULE (2026-08-20). That rule was
|
|
368
|
+
* written when the keyword was the portfolio-wide constant `"status":"ok"`, and
|
|
369
|
+
* byte-stability is exactly what made that keyword worthless: a token identical
|
|
370
|
+
* across every service cannot detect that the monitor is pointed at the WRONG
|
|
371
|
+
* service, so a mis-typed or copy-pasted URL stays green. The approved
|
|
372
|
+
* [[uptime-kuma-monitor]] §1 standard requires a UNIQUE-PER-SERVICE token,
|
|
373
|
+
* which a byte-stable body cannot carry by definition. The value is derived
|
|
374
|
+
* from the slug via `healthKeyword()` so it can never be hardcoded.
|
|
375
|
+
*
|
|
376
|
+
* 🔴 Do NOT add configuration or state to this document (`"analytics":"configured"`,
|
|
377
|
+
* a build id, a timestamp). The keyable surface must be an IDENTITY claim only:
|
|
378
|
+
* a monitor keyed on a STATE field goes red when that thing is misconfigured on
|
|
379
|
+
* a perfectly healthy site.
|
|
325
380
|
*
|
|
326
381
|
* ⚠️ COMPACT JSON, no space after the colon — this is load-bearing and looks
|
|
327
382
|
* like a formatting nit. Kuma's keyword check is a literal case-sensitive
|
|
328
|
-
* substring match
|
|
383
|
+
* substring match. Every OTHER
|
|
329
384
|
* project type gets this for free because it serializes at runtime
|
|
330
385
|
* (`NextResponse.json` / `c.json` / `Response.json` / FastAPI all emit compact
|
|
331
386
|
* JSON), but a static file is served byte-for-byte as written. Prettifying this
|
|
332
387
|
* to `{ "status": "ok" }` would break every monitor pointed at it — and only at
|
|
333
388
|
* the moment the monitor was supposed to help.
|
|
334
389
|
*/
|
|
335
|
-
const HEALTH_JSON_TEMPLATE = `{"status":"ok"}
|
|
390
|
+
const HEALTH_JSON_TEMPLATE = `{"status":"ok","service":"{{slug}}","keyword":"{{health_keyword}}"}
|
|
336
391
|
`;
|
|
337
392
|
/**
|
|
338
393
|
* 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 () => {
|
|
@@ -132,6 +132,11 @@ const PACKAGE_JSON_TEMPLATE = `{
|
|
|
132
132
|
const CANONICAL_HOST_MODULE_TEMPLATE = `// Shared canonical-host predicate. Imported by BOTH next.config.mjs (alias
|
|
133
133
|
// redirect) and app/robots.ts (indexability gate) so the two can never disagree.
|
|
134
134
|
//
|
|
135
|
+
// isIndexableDeployment() adds ONE further condition that the redirect does not
|
|
136
|
+
// read: HAS_PUBLIC_SURFACE. That cannot reintroduce the drift this shared module
|
|
137
|
+
// exists to prevent, because the extra condition only ever makes robots MORE
|
|
138
|
+
// restrictive — it can turn "index me" into "do not", never the reverse.
|
|
139
|
+
//
|
|
135
140
|
// Emitted as .mjs deliberately: next.config.mjs is plain ESM loaded before any
|
|
136
141
|
// TypeScript exists and cannot import a .ts module. tsconfig.json sets
|
|
137
142
|
// \`allowJs: true\`, so app/robots.ts type-checks this file too.
|
|
@@ -167,21 +172,56 @@ export function canonicalHost(rawSiteUrl) {
|
|
|
167
172
|
}
|
|
168
173
|
}
|
|
169
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Whether this app has a PUBLIC SURFACE at all — pages meant for the general
|
|
177
|
+
* public, and therefore for search engines — as opposed to an internal console,
|
|
178
|
+
* staff tool or admin dashboard whose entire audience arrives already knowing
|
|
179
|
+
* the URL.
|
|
180
|
+
*
|
|
181
|
+
* Baked in at scaffold time from the \`hasPublicSurface\` answer, NOT read from
|
|
182
|
+
* the environment, because it is a fact about what this app IS rather than about
|
|
183
|
+
* where this copy of it is running. There is no deployment of an internal
|
|
184
|
+
* console that should be crawled.
|
|
185
|
+
*
|
|
186
|
+
* ⚠️ Changing this to \`true\` is a deliberate act with a consequence: it
|
|
187
|
+
* publishes this app to search engines the moment it is on a real domain in
|
|
188
|
+
* production. Change it when the app grows a genuinely public surface, not to
|
|
189
|
+
* quiet a robots.txt that looks wrong.
|
|
190
|
+
*/
|
|
191
|
+
export const HAS_PUBLIC_SURFACE = {{has_public_surface}};
|
|
192
|
+
|
|
170
193
|
/**
|
|
171
194
|
* Whether this deployment may be indexed by search engines.
|
|
172
195
|
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
196
|
+
* THREE conditions, and the first one is the one people leave out.
|
|
197
|
+
*
|
|
198
|
+
* 1. **The app has a public surface at all.** An internal admin console in
|
|
199
|
+
* production on its own branded domain satisfies conditions 2 and 3
|
|
200
|
+
* completely and is still wrong to index. "Is this live?" and "is this for
|
|
201
|
+
* the public?" are different questions, and every console scaffold is where
|
|
202
|
+
* they come apart. (Reported by \`org-hq\` 2026-08-14, which served
|
|
203
|
+
* \`Allow: /\` on a branded public subdomain for a month — every check it had
|
|
204
|
+
* was passing, because none of them asked this.)
|
|
205
|
+
* 2. **A production deployment**, and
|
|
206
|
+
* 3. **a real canonical domain.** Gating on VERCEL_ENV alone means the FIRST
|
|
207
|
+
* production deploy publishes \`Allow: /\` plus a sitemap of placeholder URLs,
|
|
208
|
+
* because NEXT_PUBLIC_SITE_URL is unset on day one and the fallback is a
|
|
209
|
+
* domain this project does not own.
|
|
210
|
+
*
|
|
211
|
+
* All three fail toward the VISIBLE error: a misconfigured deploy stays
|
|
212
|
+
* \`Disallow: /\`, which one \`curl\` reveals and one env var fixes. The opposite
|
|
213
|
+
* error — indexed when it should not be — is silent, slow to undo, and has
|
|
214
|
+
* already happened by the time anyone notices.
|
|
215
|
+
*
|
|
216
|
+
* 🔴 \`Disallow: /\` IS NOT ACCESS CONTROL. It asks well-behaved crawlers not to
|
|
217
|
+
* index; it stops nobody from reading the page. Anything that must not be read
|
|
218
|
+
* by a stranger needs authentication, not a robots rule.
|
|
180
219
|
*
|
|
181
220
|
* @param {Record<string, string | undefined>} [env] defaults to process.env
|
|
182
221
|
* @returns {boolean}
|
|
183
222
|
*/
|
|
184
223
|
export function isIndexableDeployment(env = process.env) {
|
|
224
|
+
if (!HAS_PUBLIC_SURFACE) return false;
|
|
185
225
|
return env.VERCEL_ENV === "production" && canonicalHost(env.NEXT_PUBLIC_SITE_URL) !== "";
|
|
186
226
|
}
|
|
187
227
|
`;
|
|
@@ -702,12 +742,48 @@ const nextConfig = {
|
|
|
702
742
|
const host = canonicalHost(process.env.NEXT_PUBLIC_SITE_URL);
|
|
703
743
|
// Only in production, and only once a real custom domain is configured.
|
|
704
744
|
if (!host || !isVercelProduction) return [];
|
|
745
|
+
// Match ANY *.vercel.app host — covers every production alias at once.
|
|
746
|
+
const onAliasHost = [{ type: "host", value: "(?<alias>.*\\\\.vercel\\\\.app)" }];
|
|
705
747
|
return [
|
|
748
|
+
// An EXPLICIT rule for the root, kept deliberately even though it is
|
|
749
|
+
// redundant today — and the honest reason is worth the four lines.
|
|
750
|
+
//
|
|
751
|
+
// \`org-hq\` reported (2026-08-14) that adding the /api/ exclusion below
|
|
752
|
+
// would silently stop redirecting \`/\`, because a \`:path\` param cannot
|
|
753
|
+
// match the empty string. That is true of a BARE \`:path\` (whose default
|
|
754
|
+
// pattern is one-or-more), and it did NOT reproduce for the form used
|
|
755
|
+
// here: measured on Next.js 15.5.23, \`/:path((?!api/).*)\` compiles to
|
|
756
|
+
// \`^(?!/_next)(?:/((?!api\\/).*))(?:/)?\$\`, and \`.*\` inside a CUSTOM
|
|
757
|
+
// pattern happily matches empty — so the wildcard alone did redirect the
|
|
758
|
+
// root. Verified by building both forms and curling them with forged Host
|
|
759
|
+
// headers, not by reading either config.
|
|
760
|
+
//
|
|
761
|
+
// It stays because that behaviour is an artifact of how path-to-regexp
|
|
762
|
+
// compiles a custom param pattern, not a documented Next.js guarantee,
|
|
763
|
+
// and \`/\` is the most-linked URL this site has. One extra rule object
|
|
764
|
+
// pins it. If you remove it, re-measure — do not reason about it.
|
|
706
765
|
{
|
|
707
|
-
source: "
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
766
|
+
source: "/",
|
|
767
|
+
has: onAliasHost,
|
|
768
|
+
destination: \`https://\${host}/\`,
|
|
769
|
+
permanent: true,
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
// Everything EXCEPT /api/*. This redirect exists for SEO — so an alias
|
|
773
|
+
// is not crawled as a duplicate of the whole site — and that rationale
|
|
774
|
+
// does not reach API routes, which no crawler indexes. What it DOES
|
|
775
|
+
// reach is every server-to-server caller that was handed an alias URL:
|
|
776
|
+
// a bare \`curl\` without \`-L\`, a \`fetch\` with \`redirect: "error"\`, a
|
|
777
|
+
// webhook sender that treats 3xx as failure. Those break, and a
|
|
778
|
+
// redirect in a network log looks like it worked, so the diagnosis is
|
|
779
|
+
// slow. Excluding them costs no SEO and removes the whole class.
|
|
780
|
+
//
|
|
781
|
+
// (The right long-term fix is still not to hand out an alias URL as an
|
|
782
|
+
// API endpoint. But a config that silently breaks the caller is the
|
|
783
|
+
// worse half of that mistake, and it is the half this file owns.)
|
|
784
|
+
source: "/:path((?!api/).*)",
|
|
785
|
+
has: onAliasHost,
|
|
786
|
+
destination: \`https://\${host}/:path\`,
|
|
711
787
|
permanent: true,
|
|
712
788
|
},
|
|
713
789
|
];
|
|
@@ -4277,7 +4353,21 @@ export const runtime = "nodejs";
|
|
|
4277
4353
|
export const dynamic = "force-dynamic";
|
|
4278
4354
|
|
|
4279
4355
|
export function GET() {
|
|
4280
|
-
|
|
4356
|
+
// \`keyword\` is a dedicated, UNIQUE-PER-SERVICE identity token that exists
|
|
4357
|
+
// only to be grepped by the uptime monitor (per [[uptime-kuma-monitor]] §1).
|
|
4358
|
+
// It is deliberately separate from \`service\` so that renaming or re-slugging
|
|
4359
|
+
// this project cannot silently disarm its monitor.
|
|
4360
|
+
//
|
|
4361
|
+
// 🔴 Do NOT add configuration or state to this body (\`"analytics":"configured"\`,
|
|
4362
|
+
// \`"database":"connected"\`, a build id, a timestamp). A monitor keyed on a
|
|
4363
|
+
// STATE field goes red when that thing is misconfigured on a perfectly healthy
|
|
4364
|
+
// app, and one keyed on a value that changes per release goes red on the next
|
|
4365
|
+
// deploy. The keyable surface must be an IDENTITY claim only.
|
|
4366
|
+
return NextResponse.json({
|
|
4367
|
+
status: "ok",
|
|
4368
|
+
service: "{{slug}}",
|
|
4369
|
+
keyword: "{{health_keyword}}",
|
|
4370
|
+
});
|
|
4281
4371
|
}
|
|
4282
4372
|
`;
|
|
4283
4373
|
const APP_SITEMAP_TEMPLATE = `// Sitemap generator — lists every indexable page. Add new entries here when
|
|
@@ -4304,11 +4394,25 @@ export default function sitemap(): MetadataRoute.Sitemap {
|
|
|
4304
4394
|
];
|
|
4305
4395
|
}
|
|
4306
4396
|
`;
|
|
4307
|
-
const APP_ROBOTS_TEMPLATE = `// Robots generator — indexable ONLY
|
|
4308
|
-
// real canonical domain. Everything else
|
|
4309
|
-
//
|
|
4397
|
+
const APP_ROBOTS_TEMPLATE = `// Robots generator — indexable ONLY when this app HAS A PUBLIC SURFACE and is on
|
|
4398
|
+
// a production deployment that also has a real canonical domain. Everything else
|
|
4399
|
+
// (an internal console, a preview, a staging deploy, and a production deploy
|
|
4400
|
+
// still on the placeholder domain) emits \`Disallow: /\`.
|
|
4401
|
+
//
|
|
4402
|
+
// 🔴 THE FIRST CONDITION IS THE ONE THAT GETS LEFT OUT, and it is not an
|
|
4403
|
+
// environment fact. An internal admin console running in production on its own
|
|
4404
|
+
// branded domain passes every "is this live and configured?" check and is still
|
|
4405
|
+
// wrong to index. It is set by \`HAS_PUBLIC_SURFACE\` in
|
|
4406
|
+
// lib/seo/canonical-host.mjs — baked in from the scaffold answer, deliberately
|
|
4407
|
+
// NOT an env var, because it is a property of what this app IS rather than of
|
|
4408
|
+
// where this copy of it is running. (\`org-hq\` served \`Allow: /\` on a branded
|
|
4409
|
+
// public subdomain for a month before anyone looked, 2026-08-14.)
|
|
4410
|
+
//
|
|
4411
|
+
// ⚠️ And \`Disallow: /\` is ADVISORY, never access control — it asks well-behaved
|
|
4412
|
+
// crawlers not to index, and stops nobody at all from reading the page. Anything
|
|
4413
|
+
// that must not be read by a stranger needs authentication.
|
|
4310
4414
|
//
|
|
4311
|
-
//
|
|
4415
|
+
// Three conditions, not one. Gating on \`VERCEL_ENV\` ALONE means the very first
|
|
4312
4416
|
// \`vercel --prod\` — or the first push after connecting the repo, since
|
|
4313
4417
|
// auto-deploy is on by default — publishes \`Allow: /\` advertising a sitemap of
|
|
4314
4418
|
// \`{{slug}}.example.com\` URLs, a domain this project does not own.
|
|
@@ -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.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.**
|
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,17 @@ 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),
|
|
134
|
+
// The `HAS_PUBLIC_SURFACE` constant baked into the emitted
|
|
135
|
+
// lib/seo/canonical-host.mjs. A STRING here because it is interpolated into
|
|
136
|
+
// a source file as a JS literal, not used as a condition in this process.
|
|
137
|
+
//
|
|
138
|
+
// 🔴 Omitted reads as FALSE (see `hasPublicSurface` in src/index.ts): an
|
|
139
|
+
// internal console wrongly indexed is a slow, awkward, already-happened
|
|
140
|
+
// exposure, while a public app wrongly non-indexable is one field and a
|
|
141
|
+
// redeploy. The wizard and brief-first flows always ask, so this default
|
|
142
|
+
// only governs the `--input` / programmatic paths.
|
|
143
|
+
has_public_surface: inputs.hasPublicSurface === true ? "true" : "false",
|
|
100
144
|
description: inputs.description,
|
|
101
145
|
brand_name: spec.brandName,
|
|
102
146
|
brand_name_rule: spec.brandNameRule,
|
package/dist/summary.js
CHANGED
|
@@ -133,6 +133,25 @@ function buildNextActions(inputs, result, repoAutoCreated) {
|
|
|
133
133
|
note: "battle-tested across z2w-social + event-engine — do not hand-roll per-content-type; see [[moderation-system]] for the data model + verification checklist",
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
+
// 🔴 STATE THE INDEXABILITY POSTURE OUT LOUD, both ways.
|
|
137
|
+
//
|
|
138
|
+
// `hasPublicSurface` fails closed, which is the right default and a silent
|
|
139
|
+
// one — and a silent default is how the defect this fixes survived a month in
|
|
140
|
+
// the first place. So the summary names the answer that was applied rather
|
|
141
|
+
// than leaving the operator to discover it from a robots.txt nobody curls.
|
|
142
|
+
// Both branches print: "not indexable" needs saying because it is surprising,
|
|
143
|
+
// and "indexable" needs saying because it is the consequential one.
|
|
144
|
+
if (inputs.projectType === "nextjs" || inputs.projectType === "cf-pages") {
|
|
145
|
+
actions.push(inputs.hasPublicSurface === true
|
|
146
|
+
? {
|
|
147
|
+
label: `Search engines WILL index this once it is in production on a real custom domain (hasPublicSurface=true)`,
|
|
148
|
+
note: "robots.txt serves `Allow: /` plus a sitemap. If this is an internal console or staff tool, re-scaffold with hasPublicSurface=false — an internal app that gets crawled is slow and awkward to pull back out of a search index.",
|
|
149
|
+
}
|
|
150
|
+
: {
|
|
151
|
+
label: `Search engines will NOT index this in any environment (hasPublicSurface=false — the default)`,
|
|
152
|
+
note: "robots.txt serves `Disallow: /` unconditionally. If this app IS meant for the public, set hasPublicSurface=true (nextjs: also flip HAS_PUBLIC_SURFACE in lib/seo/canonical-host.mjs) and redeploy — robots.txt is prerendered at build time, so an env change alone does nothing. And note robots.txt is advisory, never access control: anything that must stay unread needs authentication.",
|
|
153
|
+
});
|
|
154
|
+
}
|
|
136
155
|
if (inputs.projectType === "wp-plugin") {
|
|
137
156
|
actions.push({
|
|
138
157
|
label: `Symlink the plugin folder into Local by Flywheel (ln -s ...)`,
|
package/dist/wizard.js
CHANGED
|
@@ -162,6 +162,20 @@ export async function runWizard(opts) {
|
|
|
162
162
|
// card-path shape rather than leaving the first payment route bare — which is
|
|
163
163
|
// only cheap BEFORE the code exists ([[stripe-elements-confirm-path]] §8).
|
|
164
164
|
const acceptsCards = await askValidated(prompter, "8g. Will this project accept credit cards — checkout, donations, save-a-card (yes/no):", parseYesNo, "no", out);
|
|
165
|
+
// 🔴 Default NO, and this is the one question here where the default is
|
|
166
|
+
// deliberately not the common answer.
|
|
167
|
+
//
|
|
168
|
+
// It is NOT "does this have a web UI" — every internal console has one. It is
|
|
169
|
+
// "are these pages for the general public", which is what app/robots.ts needs
|
|
170
|
+
// and what the old gate never asked: an internal admin console in production
|
|
171
|
+
// on its own branded domain satisfied every "is this live and configured?"
|
|
172
|
+
// condition and shipped `Allow: /` (`org-hq`, 2026-08-14, a month of it).
|
|
173
|
+
//
|
|
174
|
+
// Answering NO costs a public site one redeploy once someone notices it is
|
|
175
|
+
// not in Google. Answering YES wrongly puts an internal tool's URLs into a
|
|
176
|
+
// search index, which is slow to undo and has already happened by then. So
|
|
177
|
+
// the operator must say yes on purpose.
|
|
178
|
+
const hasPublicSurface = await askValidated(prompter, "8h. Public surface — should search engines index this, or is it an internal/staff tool (yes/no):", parseYesNo, "no", out);
|
|
165
179
|
const result = {
|
|
166
180
|
slug,
|
|
167
181
|
description,
|
|
@@ -177,6 +191,7 @@ export async function runWizard(opts) {
|
|
|
177
191
|
hasUserContent,
|
|
178
192
|
hasObservability,
|
|
179
193
|
acceptsCards,
|
|
194
|
+
hasPublicSurface,
|
|
180
195
|
};
|
|
181
196
|
if (customBrand) {
|
|
182
197
|
result.customBrand = customBrand;
|
package/dist/writer.js
CHANGED
|
@@ -561,6 +561,23 @@ export function parseScaffoldInputs(json) {
|
|
|
561
561
|
}
|
|
562
562
|
inputs.hasObservability = obj["hasObservability"];
|
|
563
563
|
}
|
|
564
|
+
// Optional: whether this project has a PUBLIC SURFACE — pages meant for the
|
|
565
|
+
// general public and therefore for search engines — as opposed to an internal
|
|
566
|
+
// console or staff tool.
|
|
567
|
+
//
|
|
568
|
+
// 🔴 Defaults to FALSE, i.e. NOT indexable, which is the opposite default from
|
|
569
|
+
// every other optional boolean on this path and is deliberate. A programmatic
|
|
570
|
+
// caller that forgets this field gets a site that is not crawled — one field
|
|
571
|
+
// and a redeploy to fix, nothing escaped. The other error, an internal console
|
|
572
|
+
// published to search engines, is silent and already-happened by the time
|
|
573
|
+
// anyone notices ([[unknown-means-denied]]). The interactive flows ask, so
|
|
574
|
+
// this default only governs --input and the programmatic API.
|
|
575
|
+
if (obj["hasPublicSurface"] !== undefined) {
|
|
576
|
+
if (typeof obj["hasPublicSurface"] !== "boolean") {
|
|
577
|
+
throw new WriterError(`--input field "hasPublicSurface" must be a boolean, got ${typeof obj["hasPublicSurface"]}.`);
|
|
578
|
+
}
|
|
579
|
+
inputs.hasPublicSurface = obj["hasPublicSurface"];
|
|
580
|
+
}
|
|
564
581
|
// Optional: whether the incoming Host selects the tenant (a HOST-ROUTED
|
|
565
582
|
// multi-tenant app). Defaults to false (single-tenant). When true, the nextjs
|
|
566
583
|
// scaffolder omits the single-destination *.vercel.app alias redirect — wrong
|
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).`);
|