@zero2webmaster/starter-kit 0.43.2 → 0.44.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/nextjs.js +94 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# z2w-starter-kit
|
|
2
2
|
|
|
3
|
-
**Version:** 0.
|
|
3
|
+
**Version:** 0.44.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.44.0 (current)** stops the PWA service worker from storing pages. Since v0.19.0 it cached every page it loaded, including signed-in ones, which then stayed readable offline after sign-out. Page loads now go to the network, with a built-in "You're offline" page when that fails, and only content-hashed `/_next/static/` files are cached. Verified in Chromium against a dynamic page, with the old worker as a control. Full detail in [CHANGELOG.md](CHANGELOG.md).
|
|
87
|
+
|
|
88
|
+
- **v0.27.0** 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
89
|
- **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
90
|
- **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.**
|
|
89
91
|
- **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.
|
|
@@ -135,4 +137,4 @@ Inquiries: kerry@zero2webmaster.com.
|
|
|
135
137
|
---
|
|
136
138
|
|
|
137
139
|
*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.*
|
|
138
|
-
*Version: 0.
|
|
140
|
+
*Version: 0.44.0 | Last Updated: 2026-10-26*
|
|
@@ -4120,11 +4120,23 @@ const PWA_ICON_SVG_TEMPLATE = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="
|
|
|
4120
4120
|
`;
|
|
4121
4121
|
const PWA_SERVICE_WORKER_TEMPLATE = `// Service worker for {{brand_name}} — {{slug}}.
|
|
4122
4122
|
//
|
|
4123
|
-
//
|
|
4124
|
-
//
|
|
4125
|
-
//
|
|
4126
|
-
//
|
|
4127
|
-
//
|
|
4123
|
+
// 🔴 IT NEVER STORES A PAGE. Most Z2W apps show something personal once a
|
|
4124
|
+
// person signs in (their records, their organization's data, their name in the
|
|
4125
|
+
// header). A cached copy of such a page stays in the browser after sign-out,
|
|
4126
|
+
// readable offline by whoever picks the phone up next, and it shows yesterday's
|
|
4127
|
+
// data as if it were today's. Until CLI v0.44.0 this worker cached every page
|
|
4128
|
+
// it loaded; \`pharmies\` (health data) found the hole and this is its design:
|
|
4129
|
+
//
|
|
4130
|
+
// - Page loads (navigations) always go to the network. If the network fails,
|
|
4131
|
+
// the person sees a small built-in "You're offline" page with no data on it.
|
|
4132
|
+
// - Only Next's build files under /_next/static/ are stored. Their names are
|
|
4133
|
+
// content-hashed, so a stored copy can never be stale and holds no data.
|
|
4134
|
+
// - Everything else (/api/, Next's in-app data fetches, images, form posts,
|
|
4135
|
+
// other sites) passes straight through, untouched.
|
|
4136
|
+
//
|
|
4137
|
+
// An app that genuinely needs data offline keeps it in its own data layer,
|
|
4138
|
+
// ids only where it can, and clears it at sign-out (the \`mobile-apps\` skill,
|
|
4139
|
+
// references/offline-sync.md). Not here.
|
|
4128
4140
|
//
|
|
4129
4141
|
// The cache name is namespaced per app because two Z2W apps can share an
|
|
4130
4142
|
// origin (rootdomain.com/app-a, rootdomain.com/app-b — see
|
|
@@ -4132,9 +4144,16 @@ const PWA_SERVICE_WORKER_TEMPLATE = `// Service worker for {{brand_name}} — {{
|
|
|
4132
4144
|
// evicting each other's entries on every activate.
|
|
4133
4145
|
//
|
|
4134
4146
|
// To ship a breaking change to the caching rules, bump the version suffix. The
|
|
4135
|
-
// activate handler deletes this app's OTHER versions and nothing else.
|
|
4147
|
+
// activate handler deletes this app's OTHER versions and nothing else. (v2
|
|
4148
|
+
// exists so that an app moving off the old page-caching worker deletes the
|
|
4149
|
+
// pages that worker stored.)
|
|
4136
4150
|
const CACHE_PREFIX = "{{slug}}-";
|
|
4137
|
-
const CACHE = CACHE_PREFIX + "
|
|
4151
|
+
const CACHE = CACHE_PREFIX + "v2";
|
|
4152
|
+
|
|
4153
|
+
// Shown when a page load fails offline. Built in, so it needs no route (an auth
|
|
4154
|
+
// middleware could redirect a /offline page to /login, which also fails), and
|
|
4155
|
+
// carries nothing about the signed-in person.
|
|
4156
|
+
const OFFLINE_HTML = __OFFLINE_PAGE_HTML__;
|
|
4138
4157
|
|
|
4139
4158
|
self.addEventListener("install", () => {
|
|
4140
4159
|
// Take over immediately rather than waiting for every tab to close. Paired
|
|
@@ -4175,41 +4194,80 @@ self.addEventListener("fetch", (event) => {
|
|
|
4175
4194
|
|
|
4176
4195
|
const url = new URL(request.url);
|
|
4177
4196
|
|
|
4178
|
-
// Cross-origin (fonts, Fathom, Sentry) belongs to whoever serves it.
|
|
4179
|
-
// no way to know their freshness rules, so we do not hold their bytes.
|
|
4197
|
+
// Cross-origin (fonts, Fathom, Sentry) belongs to whoever serves it.
|
|
4180
4198
|
if (url.origin !== self.location.origin) return;
|
|
4181
4199
|
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
// about per endpoint.
|
|
4187
|
-
if (url.pathname === "/api" || url.pathname.startsWith("/api/")) return;
|
|
4200
|
+
if (request.mode === "navigate") {
|
|
4201
|
+
event.respondWith(networkOrOfflinePage(request));
|
|
4202
|
+
return;
|
|
4203
|
+
}
|
|
4188
4204
|
|
|
4189
|
-
|
|
4205
|
+
if (url.pathname.startsWith("/_next/static/")) {
|
|
4206
|
+
event.respondWith(cacheFirst(request));
|
|
4207
|
+
}
|
|
4208
|
+
|
|
4209
|
+
// Everything else: not intercepted. That includes /api/ (per-user and often
|
|
4210
|
+
// per-second; a stale copy is wrong data presented as current) and Next's
|
|
4211
|
+
// in-app page data, which carries the same personal content as the page.
|
|
4190
4212
|
});
|
|
4191
4213
|
|
|
4192
|
-
|
|
4193
|
-
|
|
4214
|
+
/** Network only; the built-in offline page when the network fails. Never cached. */
|
|
4215
|
+
async function networkOrOfflinePage(request) {
|
|
4194
4216
|
try {
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
}
|
|
4202
|
-
return response;
|
|
4203
|
-
} catch (networkError) {
|
|
4204
|
-
const cached = await cache.match(request);
|
|
4205
|
-
if (cached) return cached;
|
|
4206
|
-
// Nothing cached and no network: let the browser show its own offline
|
|
4207
|
-
// error rather than inventing one. Swallowing this would present an empty
|
|
4208
|
-
// page as a successful load.
|
|
4209
|
-
throw networkError;
|
|
4217
|
+
return await fetch(request);
|
|
4218
|
+
} catch {
|
|
4219
|
+
return new Response(OFFLINE_HTML, {
|
|
4220
|
+
status: 503,
|
|
4221
|
+
headers: { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store" },
|
|
4222
|
+
});
|
|
4210
4223
|
}
|
|
4211
4224
|
}
|
|
4225
|
+
|
|
4226
|
+
/** Content-hashed build files: a stored copy is always right. */
|
|
4227
|
+
async function cacheFirst(request) {
|
|
4228
|
+
const cache = await caches.open(CACHE);
|
|
4229
|
+
const cached = await cache.match(request);
|
|
4230
|
+
if (cached) return cached;
|
|
4231
|
+
const response = await fetch(request);
|
|
4232
|
+
// Only same-origin, genuinely-successful responses are stored. Caching a 404
|
|
4233
|
+
// or a redirect would make the failure sticky, which is worse than the failure.
|
|
4234
|
+
if (response && response.ok && response.type === "basic") {
|
|
4235
|
+
await cache.put(request, response.clone());
|
|
4236
|
+
}
|
|
4237
|
+
return response;
|
|
4238
|
+
}
|
|
4212
4239
|
`;
|
|
4240
|
+
/** Escape text for an HTML text node. */
|
|
4241
|
+
function escapeHtmlText(value) {
|
|
4242
|
+
return value.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
4243
|
+
}
|
|
4244
|
+
/**
|
|
4245
|
+
* The service worker's built-in offline page. Large, plain type per the org
|
|
4246
|
+
* readability rule; no script, so it works under any CSP; "Try again" is a link
|
|
4247
|
+
* to the same address, which reloads it.
|
|
4248
|
+
*/
|
|
4249
|
+
function offlinePageHtml(brandName) {
|
|
4250
|
+
const name = escapeHtmlText(brandName);
|
|
4251
|
+
return [
|
|
4252
|
+
"<!doctype html>",
|
|
4253
|
+
'<html lang="en"><head><meta charset="utf-8">',
|
|
4254
|
+
'<meta name="viewport" content="width=device-width, initial-scale=1">',
|
|
4255
|
+
`<title>You're offline · ${name}</title>`,
|
|
4256
|
+
"<style>body{font-family:system-ui,sans-serif;font-size:18px;line-height:1.6;margin:0;padding:48px 16px;color:#1a1a1a;background:#fff}",
|
|
4257
|
+
"main{max-width:32rem;margin:0 auto}h1{font-size:1.6rem;line-height:1.3}a{color:#1a1a1a;font-weight:600}</style>",
|
|
4258
|
+
"</head><body><main>",
|
|
4259
|
+
`<h1>You're offline</h1>`,
|
|
4260
|
+
`<p>${name} needs an internet connection to show this page.</p>`,
|
|
4261
|
+
'<p><a href="">Try again</a></p>',
|
|
4262
|
+
"</main></body></html>",
|
|
4263
|
+
].join("");
|
|
4264
|
+
}
|
|
4265
|
+
/** The emitted `public/sw.js`, with the offline page embedded as a JS string. */
|
|
4266
|
+
function pwaServiceWorker(inputs, opts, spec) {
|
|
4267
|
+
const html = JSON.stringify(offlinePageHtml(spec.brandName));
|
|
4268
|
+
// A replacer FUNCTION: a replacement string would interpret `$&`-style patterns.
|
|
4269
|
+
return sub(PWA_SERVICE_WORKER_TEMPLATE, inputs, opts, spec).replace("__OFFLINE_PAGE_HTML__", () => html);
|
|
4270
|
+
}
|
|
4213
4271
|
const PWA_REGISTER_TEMPLATE = `"use client";
|
|
4214
4272
|
|
|
4215
4273
|
// Registers public/sw.js. Mounted once from app/layout.tsx; renders nothing.
|
|
@@ -4256,10 +4314,10 @@ Not SEO, but it is a pre-launch check and this is the pre-launch file.
|
|
|
4256
4314
|
|
|
4257
4315
|
- ✅ \`public/manifest.json\` — \`display: "standalone"\`, \`start_url: "/"\`, \`theme_color\` matching \`viewport.themeColor\` in \`app/layout.tsx\`
|
|
4258
4316
|
- ✅ \`public/icon.svg\` — 512×512, listed twice in the manifest (\`purpose: "any"\` **and** \`purpose: "maskable"\`)
|
|
4259
|
-
- ✅ \`public/sw.js\` —
|
|
4317
|
+
- ✅ \`public/sw.js\` — never stores a page (signed-in pages would stay readable offline after sign-out); page loads go to the network with a built-in offline page; only \`/_next/static/\` build files are cached
|
|
4260
4318
|
- ✅ \`components/ServiceWorker.tsx\` — registers the worker in **production only**, mounted from \`app/layout.tsx\`
|
|
4261
4319
|
- [ ] **Verify installability on the deployed site, not locally** — the worker does not register under \`next dev\` by design. Chrome DevTools → Application → Manifest should list the manifest with no errors and both icon purposes; Application → Service Workers should show \`sw.js\` activated
|
|
4262
|
-
- [ ] **Confirm
|
|
4320
|
+
- [ ] **Confirm no page or API response is cached** — DevTools → Application → Cache Storage → \`{{slug}}-v2\` should list only \`/_next/static/\` files
|
|
4263
4321
|
- [ ] Replace \`public/icon.svg\` with real artwork; keep the 512×512 frame and keep the mark inside the central ~80% (Android crops the rest)
|
|
4264
4322
|
- [ ] Shorten \`short_name\` if \`{{slug}}\` is over ~12 characters — longer names are truncated under the home-screen icon
|
|
4265
4323
|
`;
|
|
@@ -5857,7 +5915,7 @@ export function scaffoldNextjs(inputs, opts) {
|
|
|
5857
5915
|
typeSpecific.push({
|
|
5858
5916
|
path: "public/manifest.json",
|
|
5859
5917
|
content: sub(PWA_MANIFEST_TEMPLATE, inputs, opts, spec),
|
|
5860
|
-
}, { path: "public/icon.svg", content: sub(PWA_ICON_SVG_TEMPLATE, inputs, opts, spec) }, { path: "public/sw.js", content:
|
|
5918
|
+
}, { path: "public/icon.svg", content: sub(PWA_ICON_SVG_TEMPLATE, inputs, opts, spec) }, { path: "public/sw.js", content: pwaServiceWorker(inputs, opts, spec) }, {
|
|
5861
5919
|
path: "components/ServiceWorker.tsx",
|
|
5862
5920
|
content: sub(PWA_REGISTER_TEMPLATE, inputs, opts, spec),
|
|
5863
5921
|
});
|