@zero2webmaster/starter-kit 0.2.0 → 0.3.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 +14 -15
- package/dist/airtable.d.ts +119 -0
- package/dist/airtable.js +273 -0
- package/dist/brief.d.ts +2 -2
- package/dist/brief.js +11 -4
- package/dist/cli.js +290 -17
- package/dist/confirm.d.ts +16 -4
- package/dist/confirm.js +66 -32
- package/dist/index.d.ts +195 -3
- package/dist/index.js +155 -6
- package/dist/inventory.d.ts +137 -0
- package/dist/inventory.js +258 -0
- package/dist/license.d.ts +97 -0
- package/dist/license.js +474 -0
- package/dist/parse-brief.d.ts +45 -1
- package/dist/parse-brief.js +349 -21
- package/dist/scaffolders/common.d.ts +42 -1
- package/dist/scaffolders/common.js +753 -30
- package/dist/scaffolders/index.d.ts +1 -0
- package/dist/scaffolders/index.js +3 -0
- package/dist/scaffolders/library.js +26 -2
- package/dist/scaffolders/nextjs.d.ts +1 -1
- package/dist/scaffolders/nextjs.js +254 -24
- package/dist/scaffolders/node-service.d.ts +3 -0
- package/dist/scaffolders/node-service.js +320 -0
- package/dist/scaffolders/pro-seo-extension.d.ts +11 -0
- package/dist/scaffolders/pro-seo-extension.js +782 -0
- package/dist/scaffolders/python-service.js +10 -2
- package/dist/scaffolders/wp-plugin.js +8 -8
- package/dist/standards.d.ts +1 -1
- package/dist/standards.js +164 -5
- package/dist/substitute.d.ts +22 -3
- package/dist/substitute.js +19 -5
- package/dist/summary.d.ts +9 -0
- package/dist/summary.js +31 -13
- package/dist/templates.d.ts +43 -57
- package/dist/templates.js +108 -175
- package/dist/with-init.d.ts +32 -0
- package/dist/with-init.js +171 -0
- package/dist/wizard.js +21 -0
- package/dist/writer.d.ts +13 -6
- package/dist/writer.js +119 -21
- package/package.json +2 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// check is needed, add a `/health/deep` per the neon-careful pattern.
|
|
7
7
|
//
|
|
8
8
|
// NOT subject to SEO baseline (API-only service, no public HTML surface).
|
|
9
|
-
import { commonBaseFiles, resolveBrandSpec, sub, } from "./common.js";
|
|
9
|
+
import { commonBaseFiles, localEnvFrom, resolveBrandSpec, sub, } from "./common.js";
|
|
10
10
|
const NARRATIVE = `## What this is
|
|
11
11
|
|
|
12
12
|
\`{{slug}}\` is a Python FastAPI service scaffolded under the {{brand_name}} brand. API-only — no public HTML surface, no SEO baseline.
|
|
@@ -29,7 +29,7 @@ name = "{{slug}}"
|
|
|
29
29
|
version = "{{version}}"
|
|
30
30
|
description = "{{description}}"
|
|
31
31
|
authors = [
|
|
32
|
-
{ name = "{{author}}"
|
|
32
|
+
{ name = "{{author}}" },
|
|
33
33
|
]
|
|
34
34
|
readme = "README.md"
|
|
35
35
|
requires-python = ">=3.11"
|
|
@@ -44,6 +44,9 @@ dev = [
|
|
|
44
44
|
"httpx>=0.27",
|
|
45
45
|
]
|
|
46
46
|
|
|
47
|
+
[project.urls]
|
|
48
|
+
Homepage = "{{author_url}}"
|
|
49
|
+
|
|
47
50
|
[build-system]
|
|
48
51
|
requires = ["setuptools>=68", "wheel"]
|
|
49
52
|
build-backend = "setuptools.build_meta"
|
|
@@ -139,5 +142,10 @@ export function scaffoldPythonService(inputs, opts) {
|
|
|
139
142
|
},
|
|
140
143
|
{ path: ".env.example", content: sub(ENV_EXAMPLE_TEMPLATE, inputs, opts, spec) },
|
|
141
144
|
];
|
|
145
|
+
// Python's local-env convention is `.env` (gitignored), not `.env.local`.
|
|
146
|
+
typeSpecific.push({
|
|
147
|
+
path: ".env",
|
|
148
|
+
content: localEnvFrom(sub(ENV_EXAMPLE_TEMPLATE, inputs, opts, spec), ".env", inputs.slug),
|
|
149
|
+
});
|
|
142
150
|
return [...base, ...typeSpecific];
|
|
143
151
|
}
|
|
@@ -53,14 +53,14 @@ if (!defined('ABSPATH')) {
|
|
|
53
53
|
exit;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
define('{{
|
|
57
|
-
define('{{
|
|
58
|
-
define('{{
|
|
59
|
-
define('{{
|
|
60
|
-
define('{{
|
|
56
|
+
define('{{slug_const}}_VERSION', '{{version}}');
|
|
57
|
+
define('{{slug_const}}_FILE', __FILE__);
|
|
58
|
+
define('{{slug_const}}_PATH', plugin_dir_path(__FILE__));
|
|
59
|
+
define('{{slug_const}}_URL', plugin_dir_url(__FILE__));
|
|
60
|
+
define('{{slug_const}}_SLUG', '{{slug}}');
|
|
61
61
|
|
|
62
|
-
require_once {{
|
|
63
|
-
require_once {{
|
|
62
|
+
require_once {{slug_const}}_PATH . 'includes/class-{{slug}}-activator.php';
|
|
63
|
+
require_once {{slug_const}}_PATH . 'includes/class-{{slug}}-module-loader.php';
|
|
64
64
|
|
|
65
65
|
register_activation_hook(__FILE__, ['{{slug_camel}}_Activator', 'activate']);
|
|
66
66
|
|
|
@@ -185,7 +185,7 @@ class {{slug_camel}}_Activator {
|
|
|
185
185
|
// dbDelta($sql);
|
|
186
186
|
|
|
187
187
|
// Bump a version option so future activations can run migrations.
|
|
188
|
-
update_option('{{slug_under}}_version', {{
|
|
188
|
+
update_option('{{slug_under}}_version', {{slug_const}}_VERSION);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
`;
|
package/dist/standards.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProjectType, ScaffoldInputs } from "./index.js";
|
|
2
2
|
import { type SubstitutionOptions } from "./substitute.js";
|
|
3
|
-
export type StandardKey = "portable-stack" | "fathom" | "uptime-kuma" | "neon-careful" | "agent-coordination" | "seo-baseline" | "email-service" | "text-size";
|
|
3
|
+
export type StandardKey = "skill-vault" | "portable-stack" | "fathom" | "uptime-kuma" | "sentry" | "neon-careful" | "agent-coordination" | "seo-baseline" | "email-service" | "moderation" | "text-size" | "test-count";
|
|
4
4
|
export type StandardDecisionState = "inserted-inline" | "skipped-not-applicable";
|
|
5
5
|
export interface StandardDecision {
|
|
6
6
|
key: StandardKey;
|
package/dist/standards.js
CHANGED
|
@@ -7,50 +7,96 @@
|
|
|
7
7
|
// [[instantiate-z2w-project]] skill v1.1.0 Step 6.
|
|
8
8
|
//
|
|
9
9
|
// Standards covered (per skill v1.1.0, including the 2026-05-30 SEO baseline
|
|
10
|
-
// + email-service-router additions):
|
|
10
|
+
// + email-service-router additions, and the 2026-06-15 skill-vault addition):
|
|
11
11
|
//
|
|
12
|
+
// - skill-vault — always (Z2W standing org rule); rendered FIRST so
|
|
13
|
+
// every scaffolded project knows the Skill Vault path
|
|
14
|
+
// before any other standard (Kerry directive 2026-06-15:
|
|
15
|
+
// "skill vault awareness should always come first … unless
|
|
16
|
+
// more important issues exist")
|
|
12
17
|
// - portable-stack — always for non-WP types
|
|
13
18
|
// - fathom — if hasWebUi=true
|
|
14
|
-
// - uptime-kuma — any deploy target (cf-worker, cf-pages, nextjs, python-service)
|
|
19
|
+
// - uptime-kuma — any deploy target (cf-worker, cf-pages, nextjs, python-service, node-service)
|
|
20
|
+
// - sentry — if hasObservability=true AND type is nextjs / cf-pages;
|
|
21
|
+
// the Sentry runtime-error/APM baseline per
|
|
22
|
+
// [[sentry-runtime-errors]] (requested by
|
|
23
|
+
// videomigrator-dashboard on the bulletin 2026-06-11)
|
|
15
24
|
// - neon-careful — if dbStrategy=neon-postgres
|
|
16
25
|
// - agent-coordination — if participateInBulletin=true
|
|
17
26
|
// - seo-baseline — non-WP web UI with indexable surface (nextjs, cf-pages)
|
|
18
27
|
// - email-service — every project that may send mail (skip library + protocol-repo)
|
|
28
|
+
// - moderation — if hasUserContent=true (skip wp-plugin + library + protocol-repo);
|
|
29
|
+
// the two-layer UGC-moderation baseline per [[moderation-system]]
|
|
30
|
+
// (requested by event-engine on the bulletin 2026-07-08)
|
|
19
31
|
// - text-size — always (Z2W standing org rule)
|
|
32
|
+
// - test-count — always (Z2W standing org rule, 2026-06-20): every
|
|
33
|
+
// session reports its test count at session end in a
|
|
34
|
+
// stable greppable `Tests: {n} passing` line so the
|
|
35
|
+
// command center can tally a portfolio-wide total
|
|
20
36
|
//
|
|
21
37
|
// Pure-functional: no filesystem reads, no template lookups, no side effects.
|
|
22
38
|
// The Step 6 writer composes this resolver's output with the per-type scaffolder
|
|
23
39
|
// output by `.replace()`ing the marker.
|
|
24
40
|
import { applySubstitutions } from "./substitute.js";
|
|
25
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Order standards appear in the rendered body + the decisions log.
|
|
43
|
+
* `skill-vault` is intentionally FIRST (Kerry directive 2026-06-15): every
|
|
44
|
+
* scaffolded project should know the Skill Vault location before anything else,
|
|
45
|
+
* "unless more important issues exist" — which the body text defers to.
|
|
46
|
+
*/
|
|
26
47
|
const STANDARD_ORDER = [
|
|
48
|
+
"skill-vault",
|
|
27
49
|
"portable-stack",
|
|
28
50
|
"fathom",
|
|
29
51
|
"uptime-kuma",
|
|
52
|
+
"sentry",
|
|
30
53
|
"neon-careful",
|
|
31
54
|
"agent-coordination",
|
|
32
55
|
"seo-baseline",
|
|
33
56
|
"email-service",
|
|
57
|
+
"moderation",
|
|
34
58
|
"text-size",
|
|
59
|
+
"test-count",
|
|
35
60
|
];
|
|
36
61
|
const TITLES = {
|
|
62
|
+
"skill-vault": "Skill Vault awareness",
|
|
37
63
|
"portable-stack": "Portable-stack defaults (non-WP)",
|
|
38
64
|
fathom: "Fathom analytics",
|
|
39
65
|
"uptime-kuma": "Uptime Kuma monitor",
|
|
66
|
+
sentry: "Sentry runtime-error tracking (web app)",
|
|
40
67
|
"neon-careful": "Neon-careful (Neon Postgres)",
|
|
41
68
|
"agent-coordination": "Agent Coordination (cross-project bulletin)",
|
|
42
69
|
"seo-baseline": "SEO baseline (non-WP web UI)",
|
|
43
70
|
"email-service": "Email service selection",
|
|
71
|
+
moderation: "Moderation baseline (user-generated content)",
|
|
44
72
|
"text-size": "Text size (readability)",
|
|
73
|
+
"test-count": "Test-count reporting (session end)",
|
|
45
74
|
};
|
|
46
75
|
const DEPLOY_TARGETS = [
|
|
47
76
|
"cf-worker",
|
|
48
77
|
"cf-pages",
|
|
49
78
|
"nextjs",
|
|
50
79
|
"python-service",
|
|
80
|
+
"node-service",
|
|
51
81
|
];
|
|
52
82
|
const SEO_BASELINE_TYPES = ["nextjs", "cf-pages"];
|
|
83
|
+
// Types that get the Sentry runtime-error/APM baseline. Same set as the SEO
|
|
84
|
+
// baseline — a public/customer-facing HTML app is exactly where a per-user 500
|
|
85
|
+
// can fail silently (uptime monitoring only proves `/health` is 200). WordPress
|
|
86
|
+
// uses Admin Suite Diagnostics; Workers / node-service / python-service are
|
|
87
|
+
// API-only or non-JS-runtime and out of scope for the Next.js Sentry wizard;
|
|
88
|
+
// CLI libraries and protocol repos have no runtime request surface.
|
|
89
|
+
const OBSERVABILITY_TYPES = ["nextjs", "cf-pages"];
|
|
53
90
|
const NO_EMAIL_TYPES = ["library", "protocol-repo"];
|
|
91
|
+
// Types with no user-generated-content surface to moderate. wp-plugin is
|
|
92
|
+
// excluded because WordPress moderates comments natively (and via Akismet), so
|
|
93
|
+
// the [[moderation-system]] pattern — a Next.js + Neon report→queue model —
|
|
94
|
+
// doesn't fit; library / protocol-repo have no content surface at all.
|
|
95
|
+
const NO_MODERATION_TYPES = [
|
|
96
|
+
"wp-plugin",
|
|
97
|
+
"library",
|
|
98
|
+
"protocol-repo",
|
|
99
|
+
];
|
|
54
100
|
function checkPortableStack(inputs) {
|
|
55
101
|
if (inputs.projectType === "wp-plugin") {
|
|
56
102
|
return {
|
|
@@ -64,6 +110,16 @@ function checkPortableStack(inputs) {
|
|
|
64
110
|
};
|
|
65
111
|
}
|
|
66
112
|
function checkFathom(inputs) {
|
|
113
|
+
// WordPress sites get Fathom via the Fathom WP plugin, NOT the env-var
|
|
114
|
+
// client-script pattern this standards block describes. A wp-plugin with an
|
|
115
|
+
// admin UI sets hasWebUi=true, so gate on the type explicitly (2026-06-03
|
|
116
|
+
// dogfood finding #6 — Fathom was wrongly inserted for a wp-plugin scaffold).
|
|
117
|
+
if (inputs.projectType === "wp-plugin") {
|
|
118
|
+
return {
|
|
119
|
+
applies: false,
|
|
120
|
+
reason: "wp-plugin uses the Fathom WP plugin, not the env-var client script",
|
|
121
|
+
};
|
|
122
|
+
}
|
|
67
123
|
if (!inputs.hasWebUi) {
|
|
68
124
|
return { applies: false, reason: "hasWebUi=false — no analytics surface" };
|
|
69
125
|
}
|
|
@@ -84,6 +140,27 @@ function checkUptimeKuma(inputs) {
|
|
|
84
140
|
reason: `${inputs.projectType} is a deploy target — Kuma monitor needed post-deploy`,
|
|
85
141
|
};
|
|
86
142
|
}
|
|
143
|
+
function checkSentry(inputs) {
|
|
144
|
+
// Explicit opt-in (or the interactive-flow smart default) gates the standard;
|
|
145
|
+
// an omitted flag reads as false so the programmatic API / --input path stay
|
|
146
|
+
// opt-in. Then narrow to the web-app types the Sentry wizard targets.
|
|
147
|
+
if (inputs.hasObservability !== true) {
|
|
148
|
+
return {
|
|
149
|
+
applies: false,
|
|
150
|
+
reason: "hasObservability=false — Sentry runtime-error tracking not wired at instantiation",
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (!OBSERVABILITY_TYPES.includes(inputs.projectType)) {
|
|
154
|
+
return {
|
|
155
|
+
applies: false,
|
|
156
|
+
reason: `${inputs.projectType} has no per-user request surface — Sentry runtime-error tracking N/A (WordPress uses Admin Suite Diagnostics)`,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
applies: true,
|
|
161
|
+
reason: `hasObservability=true on ${inputs.projectType} — Sentry runtime-error/APM baseline per [[sentry-runtime-errors]]`,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
87
164
|
function checkNeonCareful(inputs) {
|
|
88
165
|
if (inputs.dbStrategy !== "neon-postgres") {
|
|
89
166
|
return {
|
|
@@ -138,9 +215,39 @@ function checkEmailService(inputs) {
|
|
|
138
215
|
reason: "any type that may send mail — route through [[email-service-router]]",
|
|
139
216
|
};
|
|
140
217
|
}
|
|
218
|
+
function checkModeration(inputs) {
|
|
219
|
+
if (!inputs.hasUserContent) {
|
|
220
|
+
return {
|
|
221
|
+
applies: false,
|
|
222
|
+
reason: "hasUserContent=false — no user-generated-content surface to moderate",
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
if (NO_MODERATION_TYPES.includes(inputs.projectType)) {
|
|
226
|
+
return {
|
|
227
|
+
applies: false,
|
|
228
|
+
reason: `${inputs.projectType} moderates content natively / has no UGC surface — [[moderation-system]] N/A`,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
applies: true,
|
|
233
|
+
reason: `hasUserContent=true on ${inputs.projectType} — two-layer moderation baseline per [[moderation-system]]`,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
141
236
|
function checkTextSize() {
|
|
142
237
|
return { applies: true, reason: "Z2W standing org rule — applies to every project" };
|
|
143
238
|
}
|
|
239
|
+
function checkTestCount() {
|
|
240
|
+
return {
|
|
241
|
+
applies: true,
|
|
242
|
+
reason: "Z2W standing org rule (2026-06-20) — every session reports its test count for the portfolio-wide tally",
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function checkSkillVault() {
|
|
246
|
+
return {
|
|
247
|
+
applies: true,
|
|
248
|
+
reason: "Z2W standing org rule — every project agent should know the Skill Vault path",
|
|
249
|
+
};
|
|
250
|
+
}
|
|
144
251
|
/**
|
|
145
252
|
* Fathom env var name per framework. Mirrors skill v1.1.0's Step 6 conditional
|
|
146
253
|
* wording: `NEXT_PUBLIC_FATHOM_SITE_ID` for Next.js, hard-coded inline for
|
|
@@ -160,6 +267,15 @@ export function fathomEnvVarFor(projectType) {
|
|
|
160
267
|
// [[instantiate-z2w-project]] skill v1.1.0 → "Standards block reference".
|
|
161
268
|
// Bodies use `{{placeholder}}` tokens where substitution is needed; everything
|
|
162
269
|
// else is verbatim from the skill.
|
|
270
|
+
// Canonical Skill Vault paragraph — the SINGLE SOURCE OF TRUTH for this text.
|
|
271
|
+
// The same wording is mirrored (by hand, kept in sync) into Kerry's global
|
|
272
|
+
// ~/.claude/CLAUDE.md and the [[instantiate-z2w-project]] SKILL.md standards
|
|
273
|
+
// resolver. If you edit this body, update those two sites in the same change.
|
|
274
|
+
const SKILL_VAULT_BODY = `### Skill Vault awareness (always — read first)
|
|
275
|
+
|
|
276
|
+
> **Skill Vault:** Kerry's portfolio-wide library of reusable Claude Code / Cursor skills lives at \`~/Desktop/Zero2Webmaster/AI/Skill Vault/\`. Each subfolder is the canonical source for one skill's \`SKILL.md\` body (api-key-field-standard, capture-learning, email-service-router, fathom-analytics, neon-postgres, portable-stack, symlink-safety, uptime-kuma-monitor, and more); \`~/.claude/skills/*\` and \`~/.cursor/skills/*\` symlink into it via the vault's \`sync.sh\`. **When Kerry says "we need a skill created or edited," look there first — you do not need to be given a path.** The skills usable in this session are listed by the harness (the available-skills reminder); the Vault is where their source bodies live and where new skills are authored. See [[capture-learning]] for the rule on when a learning becomes a new Vault skill versus a project-local note.
|
|
277
|
+
>
|
|
278
|
+
> This awareness is listed **first** among standards by deliberate org rule — *unless* a more urgent safety, secret-handling, or data-integrity concern takes precedence in the moment, that always wins.`;
|
|
163
279
|
const PORTABLE_STACK_BODY = `### Portable-stack defaults (non-WP)
|
|
164
280
|
|
|
165
281
|
> **Portability posture:** standard Postgres (not Neon Auth / Supabase Edge Functions / Vercel Postgres / Cloudflare D1 / branded SQL); S3-compatible storage (not Vercel Blob / Supabase Storage); Node runtime over Edge unless required; dotenv-style config (not UI-only secrets); written exit plan from day one. See [[portable-stack]] for the full posture.`;
|
|
@@ -169,9 +285,28 @@ const FATHOM_BODY = `### Fathom analytics (web UI)
|
|
|
169
285
|
const UPTIME_KUMA_BODY = `### Uptime Kuma monitor (deploy target)
|
|
170
286
|
|
|
171
287
|
> **Uptime monitoring:** Add an HTTP(s)-Keyword monitor in Kerry's self-hosted Uptime Kuma after first deploy. Defaults: 60s heartbeat, 2 retries, 60s retry interval, 48s timeout, accepted status 200-299. Point at \`/health\` — never the main URL. See [[uptime-kuma-monitor]] for the form-by-form walkthrough.`;
|
|
288
|
+
const SENTRY_BODY = `### Sentry runtime-error tracking (customer-facing web app)
|
|
289
|
+
|
|
290
|
+
> **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.**
|
|
291
|
+
>
|
|
292
|
+
> **The load-bearing decisions (summary — [[sentry-runtime-errors]] is authoritative):**
|
|
293
|
+
>
|
|
294
|
+
> 1. **Wire via the wizard, once:** \`npx @sentry/wizard@latest -i nextjs\` (add \`--saas --org <z2w-org> --project {{slug}}\` to skip prompts). It writes the client/server/edge config, the \`instrumentation.ts\` hook, and the build-time source-map upload.
|
|
295
|
+
> 2. **DSN lives in config, NOT an env var.** The DSN is a publishable identifier (not a secret) — hard-code it in the Sentry config files the wizard generates; do NOT introduce a \`NEXT_PUBLIC_SENTRY_DSN\`. The one real secret is \`SENTRY_AUTH_TOKEN\` (build-time source-map upload) — scope it **Production-only** in Vercel and keep it out of the client bundle.
|
|
296
|
+
> 3. **Feature-flag defaults:** Tracing sample rate 1.0 (100%) at Z2W volume; Session Replay 10% of sessions / 100% of sessions-with-errors; Logs on; \`sendDefaultPii: true\` — with the caveat that a Sentry payload then carries user IP + request headers, so never forward it verbatim into a shared surface (e.g. the bulletin \`## Incidents\` pipe strips to summary + link + timestamp).
|
|
297
|
+
> 4. **Smoke it, then delete the smoke.** Add a throwaway auth-gated server-throw route (\`/api/boom\` style), confirm the error + replay land in Sentry and the alert email fires, then DELETE the route and the wizard's noisy example page (it's a honeypot that inflates your error count). Ship this cleanup as its own small commit.
|
|
298
|
+
> 5. **2025 Sentry-UI quirks that waste time:** issue **alert rules** live at \`/alerts/rules/\` (NOT \`/monitors/alerts/\`); the "Test Notification" button does NOT auto-save the rule (save explicitly or it evaporates); the wizard's example page throws on every load until you remove it.
|
|
299
|
+
>
|
|
300
|
+
> **When to SKIP (do not wire Sentry):** WordPress sites (error tracking via Z2W Admin Suite Diagnostics + FluentSMTP logs); CLI libraries and protocol repos (no request surface); Cloudflare Workers / node-service / python-service that are API-only (the \`-i nextjs\` wizard doesn't fit — revisit per-runtime later); internal-only admin tools with a single operator who sees errors directly. The rule of thumb: wire it for any public-or-customer-facing Next.js / CF-Pages app that will have real users.
|
|
301
|
+
>
|
|
302
|
+
> See [[sentry-runtime-errors]] for the wizard answers, the config-file layout, the alert-rule setup, and the smoke-route pattern. Companion: [[uptime-kuma-monitor]] (liveness — the other half of observability), [[fathom-analytics]] (analytics, not errors).`;
|
|
172
303
|
const NEON_CAREFUL_BODY = `### Neon-careful (Neon Postgres)
|
|
173
304
|
|
|
174
|
-
> **Neon discipline:** \`/health\` must NOT touch the database (Neon Free has a 100 CU-hour monthly quota; routine probes burn through it). Pool size 1 for monitoring contexts. No scheduled jobs querying DB more than absolutely necessary.
|
|
305
|
+
> **Neon discipline:** \`/health\` must NOT touch the database (Neon Free has a 100 CU-hour monthly quota; routine probes burn through it). Pool size 1 for monitoring contexts. No scheduled jobs querying DB more than absolutely necessary.
|
|
306
|
+
>
|
|
307
|
+
> **Queue/outbox drain — inline, never a frequent poll:** if a queue or outbox is fed by this app's OWN writes, drain it INLINE on the compute the write already woke (Cloudflare Workers: \`ctx.waitUntil(drain())\` after the response is sent; a Node/long-running service: a fire-and-forget drain after the write commits) — a DB-touching cron's cost is its WAKE-UPS, not its row volume, so riding an existing wake costs zero extra CU-hours and ships the row in seconds. Any cron drainer stays a LOW-frequency backstop (daily, not minutes) that only sweeps rows whose send failed; keep per-row claims under \`FOR UPDATE SKIP LOCKED\` so an inline drain and a backstop tick can't double-send. (financial-engine cut an outbox from ~15 → ~0.6 CU-hr/mo/tenant — ~25× — this way.)
|
|
308
|
+
>
|
|
309
|
+
> See [[neon-postgres]] for the full discipline (§4.4 covers the inline-drain pattern).`;
|
|
175
310
|
const AGENT_COORDINATION_BODY = `### Agent Coordination (cross-project bulletin participation)
|
|
176
311
|
|
|
177
312
|
> **Cross-project coordination:** This project participates in the Z2W cross-project coordination bulletin at \`zero2webmaster/z2w-agent-coordination\`. The canonical protocol body lives in that repo's \`AGENT_PROTOCOL.md\` — read it at session start for the current version and section list. Reference conventions by NAME — the §-numbers below are parenthetical breadcrumbs that may renumber upstream.
|
|
@@ -240,30 +375,54 @@ const SEO_BASELINE_BODY = `### SEO baseline (non-WP web UI)
|
|
|
240
375
|
const EMAIL_SERVICE_BODY = `### Email service selection (any project that will send mail)
|
|
241
376
|
|
|
242
377
|
> **Email service:** Kerry's portfolio has FOUR sanctioned email services covering distinct sweet spots — FluentCRM (WP marketing/CRM), Amazon SES (cheap high-volume transactional), Resend (developer-friendly transactional + NextAuth magic links + React Email), Cloudflare Email Service (Workers-native send/receive). Before wiring any email feature in this project — magic-link auth, transactional notification, marketing broadcast, anything — load [[email-service-router]] and walk the decision matrix. Do NOT introduce a fifth service (SendGrid, Mailgun, Postmark, Mailchimp, MailerSend, Brevo/Sendinblue, etc.) — the router skill explains why and routes to the right one of the four.`;
|
|
378
|
+
const MODERATION_BODY = `### Moderation baseline (user-generated content)
|
|
379
|
+
|
|
380
|
+
> **This project accepts user-generated content, so trust & safety is an at-instantiation decision — not a Phase-8 afterthought.** Before building the first surface where one user's input is shown to others (posts, comments, profiles, listings, direct messages), load [[moderation-system]] and follow its shape. It is battle-tested across two live Z2W apps (z2w-social shipped it Step 8; event-engine built the second reference implementation) — do NOT hand-roll a per-content-type moderation system.
|
|
381
|
+
>
|
|
382
|
+
> **The load-bearing decisions (summary — [[moderation-system]] is the binding contract):**
|
|
383
|
+
>
|
|
384
|
+
> 1. **One entity-agnostic queue, not per-type tables.** Key everything on \`{entity_type, entity_id}\`: a shared \`moderation_items\` queue (one row per flagged entity, \`UNIQUE (tenant_id, entity_type, entity_id)\`) plus a \`reports\` table where reports AND AI flags COALESCE into that one item (idempotent per reporter so nobody inflates the count). Adding a new content type is a CHECK edit, not a new set of tables + UI.
|
|
385
|
+
> 2. **Reporting is a SAFETY action, not tier-gated.** Any signed-in member may report (like blocking) regardless of membership tier; only the queue + staff actions are admin-only. **Public / anonymous UGC surface?** Use the public variant — no auth on the report action, resolve the tenant from the Host, key idempotency on \`reporter_email\` instead of a user id.
|
|
386
|
+
> 3. **Enforcement REUSES existing gates — don't invent new ones.** Hide = the soft-delete (\`deletedAt\`) already on your content tables; restrict (read-only) = the membership/tier resolver (make that check FAIL-OPEN so a DB blip never locks the community out of writing); ban = the existing \`is_active\` session gate.
|
|
387
|
+
> 4. **The AI content scan is a FAIL-OPEN SEAM.** Run it out-of-band (Next.js \`after()\`), never blocking or slowing a write; keep it DORMANT until an API key is set; make it one swappable call (the Anthropic SDK today, z2w-ai-engine's content-moderation capability later). A scan outage must never block posting.
|
|
388
|
+
> 5. **Optional pre-publish gate.** For content with a \`draft → published\` lifecycle, an unresolved flag blocks publish — turning the AI scan into a mandatory pre-publication gate.
|
|
389
|
+
>
|
|
390
|
+
> **Cross-app note:** for a future shared moderation package, map the tenant key at the boundary (event-engine keys on \`org_id\`, z2w-social on \`tenant_id\` — same idea, rename where they meet). See [[moderation-system]] for the data model, the coalescing pattern, the entity-resolver seam, and the verification checklist. Companion skills: [[async-action-feedback]] (the Report button + dashboard feedback), [[neon-postgres]] (run the scan out-of-band so it doesn't pin compute), [[per-tenant-credential-vault]] (where the scan API key lives long-term).`;
|
|
243
391
|
const TEXT_SIZE_BODY = `### Text size (always)
|
|
244
392
|
|
|
245
393
|
> **Readability:** per Z2W standing org rule, all public-facing pages and documents use large, easy-to-read type. Body text 18px+ baseline; headings proportionally larger; line-height ≥ 1.5.`;
|
|
394
|
+
const TEST_COUNT_BODY = `### Test-count reporting (always — at session end)
|
|
395
|
+
|
|
396
|
+
> **Report your test count at session end.** Per Zero2Webmaster standing org rule (2026-06-20), every session that touches code states how many tests pass on a stable, machine-greppable line: \`Tests: {n} passing\` — use the literal word \`Tests:\`, the running total your suite reports, and the word \`passing\`. Put that line in your session-end recap AND, if this project participates in the cross-project bulletin, in the \`## Recent commits\` entry you append (e.g. **\`Tests: 534 passing\`**). The phone-first command center greps this line across every project to display a portfolio-wide tally ("we've run N tests across the portfolio") — a real sales asset, and the uniform one-line format is what makes the total cheap to compute. If this project has no test suite yet, say so explicitly with \`Tests: none yet\` rather than omitting the line.`;
|
|
246
397
|
const BODIES = {
|
|
398
|
+
"skill-vault": SKILL_VAULT_BODY,
|
|
247
399
|
"portable-stack": PORTABLE_STACK_BODY,
|
|
248
400
|
fathom: FATHOM_BODY,
|
|
249
401
|
"uptime-kuma": UPTIME_KUMA_BODY,
|
|
402
|
+
sentry: SENTRY_BODY,
|
|
250
403
|
"neon-careful": NEON_CAREFUL_BODY,
|
|
251
404
|
"agent-coordination": AGENT_COORDINATION_BODY,
|
|
252
405
|
"seo-baseline": SEO_BASELINE_BODY,
|
|
253
406
|
"email-service": EMAIL_SERVICE_BODY,
|
|
407
|
+
moderation: MODERATION_BODY,
|
|
254
408
|
"text-size": TEXT_SIZE_BODY,
|
|
409
|
+
"test-count": TEST_COUNT_BODY,
|
|
255
410
|
};
|
|
256
411
|
const APPLICABILITY = {
|
|
412
|
+
"skill-vault": checkSkillVault,
|
|
257
413
|
"portable-stack": checkPortableStack,
|
|
258
414
|
fathom: checkFathom,
|
|
259
415
|
"uptime-kuma": checkUptimeKuma,
|
|
416
|
+
sentry: checkSentry,
|
|
260
417
|
"neon-careful": checkNeonCareful,
|
|
261
418
|
"agent-coordination": checkAgentCoordination,
|
|
262
419
|
"seo-baseline": checkSeoBaseline,
|
|
263
420
|
"email-service": checkEmailService,
|
|
421
|
+
moderation: checkModeration,
|
|
264
422
|
"text-size": checkTextSize,
|
|
423
|
+
"test-count": checkTestCount,
|
|
265
424
|
};
|
|
266
|
-
const PREAMBLE = `The following organization standards apply to {{slug}}. Each was selected at instantiation per the conditional rules in [[instantiate-z2w-project]]
|
|
425
|
+
const PREAMBLE = `The following organization standards apply to {{slug}}. Each was selected at instantiation per the conditional rules in the [[instantiate-z2w-project]] skill (Step 6). See each standard's wiki-style link for the full discipline; the inline summaries below are the binding contract for this project.`;
|
|
267
426
|
const NO_APPLICABLE_FALLBACK = `*(No conditional standards apply to this project.)*`;
|
|
268
427
|
/**
|
|
269
428
|
* Render one standard's body with substitutions applied. The `fathom_env_var`
|
package/dist/substitute.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ export interface SubstitutionOptions {
|
|
|
9
9
|
date?: string;
|
|
10
10
|
/** Override the brand spec resolution (used by tests + callers that already resolved it). */
|
|
11
11
|
brandSpec?: BrandPresetSpec;
|
|
12
|
+
/**
|
|
13
|
+
* Framework version to stamp into `{{framework_version}}`. The writer resolves
|
|
14
|
+
* this from the canonical AGENTS body's *filename* (the single source of truth)
|
|
15
|
+
* and passes it through. When omitted, falls back to
|
|
16
|
+
* {@link frameworkVersionForType} so callers that don't read a template (tests,
|
|
17
|
+
* standalone substitution) still get a sensible value.
|
|
18
|
+
*/
|
|
19
|
+
frameworkVersion?: string;
|
|
12
20
|
}
|
|
13
21
|
/** Today's date as `YYYY-MM-DD` in the local timezone. */
|
|
14
22
|
export declare function todayISODate(): string;
|
|
@@ -17,9 +25,20 @@ export declare function underscoredSlug(slug: string): string;
|
|
|
17
25
|
/** `my-tool` -> `MyTool` (for PHP class names). */
|
|
18
26
|
export declare function pascalCaseFromSlug(slug: string): string;
|
|
19
27
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
28
|
+
* `my-tool` -> `MY_TOOL` (for PHP/WordPress constant prefixes). WordPress
|
|
29
|
+
* convention is UPPER_SNAKE for `define()`d constants (`MY_TOOL_VERSION`),
|
|
30
|
+
* distinct from the PascalCase used for class names. Before v0.2.1 the
|
|
31
|
+
* wp-plugin scaffolder reused `slug_camel` for constants, producing
|
|
32
|
+
* `MyTool_VERSION` — the 2026-06-03 dogfood finding #7.
|
|
33
|
+
*/
|
|
34
|
+
export declare function upperSnakeFromSlug(slug: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Fallback framework version embedded in the scaffolded CLAUDE.md header when
|
|
37
|
+
* no `frameworkVersion` is supplied. The writer normally derives the real
|
|
38
|
+
* version from the resolved AGENTS body's filename and passes it via
|
|
39
|
+
* {@link SubstitutionOptions.frameworkVersion}; this hardcoded mapping only
|
|
40
|
+
* applies to callers that don't read a template (e.g. tests). WordPress plugins
|
|
41
|
+
* map to the WP AGENTS line; everything else to the generic line.
|
|
23
42
|
*/
|
|
24
43
|
export declare function frameworkVersionForType(projectType: ProjectType): string;
|
|
25
44
|
/**
|
package/dist/substitute.js
CHANGED
|
@@ -34,12 +34,25 @@ export function pascalCaseFromSlug(slug) {
|
|
|
34
34
|
.join("");
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* `my-tool` -> `MY_TOOL` (for PHP/WordPress constant prefixes). WordPress
|
|
38
|
+
* convention is UPPER_SNAKE for `define()`d constants (`MY_TOOL_VERSION`),
|
|
39
|
+
* distinct from the PascalCase used for class names. Before v0.2.1 the
|
|
40
|
+
* wp-plugin scaffolder reused `slug_camel` for constants, producing
|
|
41
|
+
* `MyTool_VERSION` — the 2026-06-03 dogfood finding #7.
|
|
42
|
+
*/
|
|
43
|
+
export function upperSnakeFromSlug(slug) {
|
|
44
|
+
return underscoredSlug(slug).toUpperCase();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Fallback framework version embedded in the scaffolded CLAUDE.md header when
|
|
48
|
+
* no `frameworkVersion` is supplied. The writer normally derives the real
|
|
49
|
+
* version from the resolved AGENTS body's filename and passes it via
|
|
50
|
+
* {@link SubstitutionOptions.frameworkVersion}; this hardcoded mapping only
|
|
51
|
+
* applies to callers that don't read a template (e.g. tests). WordPress plugins
|
|
52
|
+
* map to the WP AGENTS line; everything else to the generic line.
|
|
40
53
|
*/
|
|
41
54
|
export function frameworkVersionForType(projectType) {
|
|
42
|
-
return projectType === "wp-plugin" ? "3.
|
|
55
|
+
return projectType === "wp-plugin" ? "3.2.0" : "2.14.0";
|
|
43
56
|
}
|
|
44
57
|
function resolveDate(opts) {
|
|
45
58
|
const supplied = opts.date;
|
|
@@ -67,6 +80,7 @@ export function buildSubstitutionMap(inputs, opts = {}) {
|
|
|
67
80
|
slug: inputs.slug,
|
|
68
81
|
slug_under: underscoredSlug(inputs.slug),
|
|
69
82
|
slug_camel: pascalCaseFromSlug(inputs.slug),
|
|
83
|
+
slug_const: upperSnakeFromSlug(inputs.slug),
|
|
70
84
|
description: inputs.description,
|
|
71
85
|
brand_name: spec.brandName,
|
|
72
86
|
brand_name_rule: spec.brandNameRule,
|
|
@@ -78,7 +92,7 @@ export function buildSubstitutionMap(inputs, opts = {}) {
|
|
|
78
92
|
date,
|
|
79
93
|
year: date.slice(0, 4),
|
|
80
94
|
version: SCAFFOLD_VERSION,
|
|
81
|
-
framework_version: frameworkVersionForType(inputs.projectType),
|
|
95
|
+
framework_version: opts.frameworkVersion ?? frameworkVersionForType(inputs.projectType),
|
|
82
96
|
};
|
|
83
97
|
}
|
|
84
98
|
/**
|
package/dist/summary.d.ts
CHANGED
|
@@ -7,6 +7,15 @@ export interface SummaryOptions {
|
|
|
7
7
|
forceColor?: boolean;
|
|
8
8
|
/** Where to write the summary. Defaults to {@link process.stdout}. */
|
|
9
9
|
output?: NodeJS.WritableStream;
|
|
10
|
+
/**
|
|
11
|
+
* When true, the CLI is about to create the private GitHub repo itself
|
|
12
|
+
* (default-on for the interactive flows — Track D decision 2026-06-16), so
|
|
13
|
+
* the manual `git init` + `gh repo create` next-actions are omitted to avoid
|
|
14
|
+
* telling the user to redo what the CLI just did. Defaults to false, so
|
|
15
|
+
* direct callers (and the --dry-run / --input / --no-repo paths) still see
|
|
16
|
+
* the manual commands.
|
|
17
|
+
*/
|
|
18
|
+
repoAutoCreated?: boolean;
|
|
10
19
|
}
|
|
11
20
|
/**
|
|
12
21
|
* Render the post-scaffold summary block.
|
package/dist/summary.js
CHANGED
|
@@ -44,6 +44,7 @@ function installCommandFor(projectType) {
|
|
|
44
44
|
case "cf-worker":
|
|
45
45
|
case "cf-pages":
|
|
46
46
|
case "nextjs":
|
|
47
|
+
case "node-service":
|
|
47
48
|
case "library":
|
|
48
49
|
return "npm install";
|
|
49
50
|
case "python-service":
|
|
@@ -55,16 +56,21 @@ function installCommandFor(projectType) {
|
|
|
55
56
|
function isDecisionInserted(decisions, key) {
|
|
56
57
|
return decisions.some((d) => d.key === key && d.state === "inserted-inline");
|
|
57
58
|
}
|
|
58
|
-
function buildNextActions(inputs, result) {
|
|
59
|
-
const actions = [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
function buildNextActions(inputs, result, repoAutoCreated) {
|
|
60
|
+
const actions = [];
|
|
61
|
+
// The git init + gh repo create steps are only surfaced when the CLI is NOT
|
|
62
|
+
// creating the repo itself. In the default interactive flow the CLI does it
|
|
63
|
+
// (Track D decision 2026-06-16), so repeating the commands here would tell
|
|
64
|
+
// the user to redo work that's already done.
|
|
65
|
+
if (!repoAutoCreated) {
|
|
66
|
+
actions.push({
|
|
67
|
+
label: `cd ${result.targetPath} && git init -b main && git config user.email "kerry@zero2webmaster.com" && git add . && git commit -m "Initial scaffold"`,
|
|
68
|
+
note: "RUN THIS FROM INSIDE THE PROJECT DIRECTORY ABOVE — never run `git init`/`git add` from your home directory (a bare `git add -A` in ~ stages credentials, .ssh, and every .env). The cd is baked into this command so it's safe to paste as-is. The repo-local user.email is the Vercel-Hobby commit-author workaround per [[z2w-magic-link-auth]] §8.",
|
|
69
|
+
}, {
|
|
70
|
+
label: `gh repo create ${inputs.githubOrg}/${inputs.slug} --private --source=. --push`,
|
|
71
|
+
note: `run from inside ${result.targetPath}; add --description "…" and then \`gh repo edit --add-topic …\` to set the repo's About blurb + topics`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
68
74
|
const installCmd = installCommandFor(inputs.projectType);
|
|
69
75
|
if (installCmd !== null) {
|
|
70
76
|
actions.push({ label: installCmd });
|
|
@@ -94,6 +100,18 @@ function buildNextActions(inputs, result) {
|
|
|
94
100
|
note: "see [[uptime-kuma-monitor]] — 60s heartbeat, 2 retries, 60s retry interval, 48s timeout, accepted 200-299",
|
|
95
101
|
});
|
|
96
102
|
}
|
|
103
|
+
if (isDecisionInserted(result.decisions, "sentry")) {
|
|
104
|
+
actions.push({
|
|
105
|
+
label: `Wire Sentry: run \`npx @sentry/wizard@latest -i nextjs\`, smoke a throwaway /api/boom route, then delete it + the wizard's example page`,
|
|
106
|
+
note: "see [[sentry-runtime-errors]] — DSN in config (not an env var); SENTRY_AUTH_TOKEN Production-only in Vercel; alert rules live at /alerts/rules/ and Test Notification does NOT auto-save the rule",
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (isDecisionInserted(result.decisions, "moderation")) {
|
|
110
|
+
actions.push({
|
|
111
|
+
label: `Before the first UGC surface ships, build moderation per [[moderation-system]] (entity-agnostic report→queue; reporting is a safety action; enforcement reuses existing gates; the AI scan is a fail-open seam)`,
|
|
112
|
+
note: "battle-tested across z2w-social + event-engine — do not hand-roll per-content-type; see [[moderation-system]] for the data model + verification checklist",
|
|
113
|
+
});
|
|
114
|
+
}
|
|
97
115
|
if (inputs.projectType === "wp-plugin") {
|
|
98
116
|
actions.push({
|
|
99
117
|
label: `Symlink the plugin folder into Local by Flywheel (ln -s ...)`,
|
|
@@ -153,10 +171,10 @@ function renderPromotionsSection(chalk, result) {
|
|
|
153
171
|
}
|
|
154
172
|
return lines.join("\n");
|
|
155
173
|
}
|
|
156
|
-
function renderNextActionsSection(chalk, inputs, result) {
|
|
174
|
+
function renderNextActionsSection(chalk, inputs, result, repoAutoCreated) {
|
|
157
175
|
const heading = chalk.hex(Z2W_GREEN).bold;
|
|
158
176
|
const item = chalk.hex(Z2W_GOLD);
|
|
159
|
-
const actions = buildNextActions(inputs, result);
|
|
177
|
+
const actions = buildNextActions(inputs, result, repoAutoCreated);
|
|
160
178
|
const lines = [heading("Next actions (NOT done by the CLI — your call):")];
|
|
161
179
|
for (const action of actions) {
|
|
162
180
|
lines.push(` ${item("□")} ${item(action.label)}`);
|
|
@@ -185,6 +203,6 @@ export function renderSummary(inputs, result, opts = {}) {
|
|
|
185
203
|
const promotions = renderPromotionsSection(chalk, result);
|
|
186
204
|
if (promotions !== null)
|
|
187
205
|
sections.push(promotions);
|
|
188
|
-
sections.push(renderNextActionsSection(chalk, inputs, result));
|
|
206
|
+
sections.push(renderNextActionsSection(chalk, inputs, result, opts.repoAutoCreated === true));
|
|
189
207
|
output.write("\n" + sections.join("\n\n") + "\n");
|
|
190
208
|
}
|