@zero2webmaster/starter-kit 0.9.4 → 0.11.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # z2w-starter-kit
2
2
 
3
- **Version:** 0.9.4 | **Framework:** 2.13.0
3
+ **Version:** 0.11.0 | **Framework:** 2.13.0
4
4
 
5
5
  > Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.
6
6
 
@@ -83,7 +83,8 @@ The Claude Code skill at `~/.claude/skills/instantiate-z2w-project/SKILL.md` and
83
83
 
84
84
  ## Status
85
85
 
86
- - **v0.9.4 (current)** corrects a **privacy understatement in the emitted Sentry standard**. It had told every scaffolded web app to set `sendDefaultPii: true` and described the consequence as *"user IP + request headers"*. Verified against `@sentry/core` 10.69.0's own `defaultPiiToCollectionOptions()`, that flag resolves **ten** axes on — including `httpBodies` in all four directions, `databaseQueryData`, `stackFrameVariables` (local variable values), and `genAI: { inputs: true, outputs: true }`, which is the user's prompt and the model's completion. The standard now prescribes one complete `dataCollection` block, carries both counter-intuitive traps (a partial block flips the baseline to all-on; `stackFrameVariables` is on in *both* branches so `sendDefaultPii: false` cannot reach it), and makes the **resolver** the binding check rather than any list in a doc. Also retires the registry's `project_type` column in favour of `stack` + `audience`.
86
+ - **v0.9.5 (current)** gives the Project Registry a **write path for the events it describes**. `z2w-agent-command-center` reported two stale `production_status` rows and asked for a writer; investigating found two different causes wearing one face. `site-control`'s row would have been fixed by the reconciler that already exists — nothing ever ran it. `email-engine`'s row **could not** be fixed, because `scripts/rollup-integrations.mjs` allowed a backtick before the status value but not an asterisk, so every project that **bolded** its Live status parsed as null and vanished from the report — indistinguishable from a row already in sync. That was 3 of the 15 sections declaring a status (20%), two of which said LIVE. The parser now reads the forms agents actually write, and reports declared-but-unreadable separately from never-declared, at zero as well as non-zero. Six rows reconciled. Also: the `command_center` role (scoped to the two approval columns), a CHECK that makes `summary_state = 'approved'` unreachable without them, and `status_qualifier` for the projects that kept writing a sixth value into a five-value enum.
87
+ - **v0.9.4** corrects a **privacy understatement in the emitted Sentry standard**. It had told every scaffolded web app to set `sendDefaultPii: true` and described the consequence as *"user IP + request headers"*. Verified against `@sentry/core` 10.69.0's own `defaultPiiToCollectionOptions()`, that flag resolves **ten** axes on — including `httpBodies` in all four directions, `databaseQueryData`, `stackFrameVariables` (local variable values), and `genAI: { inputs: true, outputs: true }`, which is the user's prompt and the model's completion. The standard now prescribes one complete `dataCollection` block, carries both counter-intuitive traps (a partial block flips the baseline to all-on; `stackFrameVariables` is on in *both* branches so `sendDefaultPii: false` cannot reach it), and makes the **resolver** the binding check rather than any list in a doc. Also retires the registry's `project_type` column in favour of `stack` + `audience`.
87
88
  - **v0.9.3** fixes a scaffold-corrupting splice bug and the "GitHub org" wording. The canonical Agent Coordination block contains the anchor `` (`^## Current focus$`) ``, whose `$` and closing backtick form `` $` `` — a `String.replace()` special pattern meaning *"everything before the match"*. Because the block was passed as a replacement **string**, every scaffold emitted since 2026-07-30 pasted its own entire document head into the middle of that sentence. All four canonical-body splices now use a replacer **function**, whose return value is never pattern-interpreted. Separately, the brand block now reads `- **GitHub owner:**` and states the account type: `zero2webmaster` is a GitHub **User**, not an Organization, so `/organizations/...` URLs 404 — wording that had sent two agents to those 404s.
88
89
  - **v0.9.2** re-syncs the emitted Capture Learnings block to canonical **v1.1.0** (the `AGENTS.md`/`GEMINI.md` mirror is now conditional). **v0.9.1** republishes v0.9.0 with the corrected LICENSE + README. The 0.9.0 tarball shipped the old text by accident — see CHANGELOG. **v0.9.0** gives every Next.js scaffold accessible form primitives — `components/FormBits.tsx` (`<Field>` / `<Required>` / `<InfoHint>`), the `app/globals.css` they need, a vitest runner, and an *emitted* `test/form-standards.test.ts` that fails on the next hand-rolled form which labels a field "(optional)", hides help text in a placeholder, or marks required with a bare `*`.
89
90
  - **v0.8.0 (published)** emits the canonical Capture Learnings block into every scaffolded `CLAUDE.md`, so the session-end "should this become a skill?" step actually reaches the agent working in the new project.
@@ -111,4 +112,4 @@ Inquiries: kerry@zero2webmaster.com.
111
112
  ---
112
113
 
113
114
  *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.*
114
- *Version: 0.9.4 | Last Updated: 2026-08-03*
115
+ *Version: 0.11.0 | Last Updated: 2026-08-03*
@@ -47,8 +47,13 @@ export interface AirtableConfig {
47
47
  export declare function resolveAirtableConfig(env?: NodeJS.ProcessEnv): AirtableConfig | null;
48
48
  /**
49
49
  * Derive a human-friendly project display name from a slug.
50
- * `z2w-crowdcommerce` → "Z2W Crowdcommerce". Best-effort — Kerry can refine
51
- * the row's `Project` field by hand afterward.
50
+ * `z2w-crowdcommerce` → "Z2W Crowdcommerce"; `org-hq` → "Org HQ".
51
+ *
52
+ * Best-effort and intentionally so: this is the SEED for a new row's
53
+ * `project_name`, not an attempt to reproduce a curated one. 43 of the 96
54
+ * registry names carry editorial content no slug contains — "Femperium Web
55
+ * Scraping / Lead Gen", "Static Sites For Small Businesses" — which is why
56
+ * `project_name` is insert-only rather than better-computed.
52
57
  */
53
58
  export declare function displayNameFromSlug(slug: string): string;
54
59
  export type AirtableFields = Record<string, string>;
package/dist/airtable.js CHANGED
@@ -84,17 +84,50 @@ export function resolveAirtableConfig(env = process.env) {
84
84
  const table = (env["AIRTABLE_INVENTORY_TABLE"] ?? "").trim() || DEFAULT_INVENTORY_TABLE;
85
85
  return { pat, baseId, table };
86
86
  }
87
+ /**
88
+ * Slug segments that are acronyms, not words — upper-cased whole rather than
89
+ * title-cased. A slug cannot carry capitalisation, so `org-hq` and `ai-studio`
90
+ * title-case to "Org Hq" and "Ai Studio", which read as typos in the registry
91
+ * and on the `agents.z2w.us` dashboard. ("Org Hq" is exactly what `audit-engine`
92
+ * reported on 2026-07-31.)
93
+ *
94
+ * Deliberately a SHORT list of segments that are unambiguously acronyms in Z2W
95
+ * slugs — not a general English dictionary. A wrong entry here is worse than a
96
+ * missing one: it would upper-case a real word somewhere down the line, and the
97
+ * name is only a seed a human can improve (see `INSERT_ONLY_COLUMNS` — it is
98
+ * never overwritten once curated).
99
+ */
100
+ const SLUG_ACRONYMS = new Set([
101
+ "z2w",
102
+ "ai",
103
+ "api",
104
+ "cli",
105
+ "cms",
106
+ "crm",
107
+ "db",
108
+ "hq",
109
+ "pwa",
110
+ "sdk",
111
+ "seo",
112
+ "ui",
113
+ "wp",
114
+ ]);
87
115
  /**
88
116
  * Derive a human-friendly project display name from a slug.
89
- * `z2w-crowdcommerce` → "Z2W Crowdcommerce". Best-effort — Kerry can refine
90
- * the row's `Project` field by hand afterward.
117
+ * `z2w-crowdcommerce` → "Z2W Crowdcommerce"; `org-hq` → "Org HQ".
118
+ *
119
+ * Best-effort and intentionally so: this is the SEED for a new row's
120
+ * `project_name`, not an attempt to reproduce a curated one. 43 of the 96
121
+ * registry names carry editorial content no slug contains — "Femperium Web
122
+ * Scraping / Lead Gen", "Static Sites For Small Businesses" — which is why
123
+ * `project_name` is insert-only rather than better-computed.
91
124
  */
92
125
  export function displayNameFromSlug(slug) {
93
126
  return slug
94
127
  .split("-")
95
128
  .filter(Boolean)
96
- .map((part) => part.toLowerCase() === "z2w"
97
- ? "Z2W"
129
+ .map((part) => SLUG_ACRONYMS.has(part.toLowerCase())
130
+ ? part.toUpperCase()
98
131
  : part.charAt(0).toUpperCase() + part.slice(1))
99
132
  .join(" ");
100
133
  }
@@ -3,6 +3,58 @@ import { type ScaffoldInputs } from "./index.js";
3
3
  export declare const INVENTORY_TABLE = "projects";
4
4
  /** The conflict key — the `projects/{slug}.md` filename the cron keys on. */
5
5
  export declare const INVENTORY_CONFLICT_KEY = "slug";
6
+ /**
7
+ * The 8 projects Kerry ruled `ecosystem_role = 'ecosystem'` on 2026-08-02, when
8
+ * he CLOSED the set. Mirrored here from the registry's
9
+ * `projects_ecosystem_set_closed_chk` so this CLI can assert it never scaffolds
10
+ * a 9th member; the database is the enforcement point, this is the local copy.
11
+ *
12
+ * An `ecosystem` project's subject matter IS the other projects — it has no
13
+ * purpose outside the portfolio. Everything else, including the shared
14
+ * capability engines Kerry explicitly ruled on (`z2w-ai-engine`,
15
+ * `crawl-engine`, `backup-engine`, `dashboard-engine`), is `domain`.
16
+ */
17
+ export declare const ECOSYSTEM_PROJECTS: readonly string[];
18
+ /**
19
+ * The `ecosystem_role` a given slug must hold, derived from the closed set.
20
+ *
21
+ * This is deliberately a LOOKUP and not the constant `"domain"`, because
22
+ * `buildUpsert` emits `ON CONFLICT (slug) DO UPDATE SET ecosystem_role =
23
+ * EXCLUDED.ecosystem_role`. A flat `"domain"` would be correct for every new
24
+ * project and silently WRONG on any re-registration of one of the 8 — it would
25
+ * demote a real `ecosystem` row, and the database CHECK could not catch it,
26
+ * because `domain` is a legal value for every slug. The constraint guards
27
+ * against wrongly ADDING a 9th member; only this lookup guards against wrongly
28
+ * REMOVING one.
29
+ */
30
+ export declare function ecosystemRoleFor(slug: string): string;
31
+ /**
32
+ * Columns this CLI may SEED on a brand-new row but must never OVERWRITE on an
33
+ * existing one — excluded from the UPSERT's `DO UPDATE SET` list.
34
+ *
35
+ * This closes a hole in the principle stated at the top of `buildProjectRow`:
36
+ * *"manually-curated columns are intentionally omitted so the UPSERT's DO UPDATE
37
+ * never clobbers Kerry's hand-entered values."* That was enforced by leaving a
38
+ * column out of the row entirely — which works for columns the CLI never knows
39
+ * (`technology`, `licensing`, `notes`), but NOT for `project_name`, which the
40
+ * CLI both derives and Kerry curates.
41
+ *
42
+ * Measured 2026-08-03 against all 96 registry rows: a re-registration would have
43
+ * rewritten **43 of them (45%)**, and most of those names could not be derived
44
+ * from a slug by any algorithm — `Femperium Web Scraping / Lead Gen`,
45
+ * `Financial | Investing`, `Static Sites For Small Businesses`,
46
+ * `Docker for Z2W Multi-Lingual`, `Ente Photos & Locker`,
47
+ * `Grantor (off-WP rebuild)`. Those are editorial, not mechanical. A slug-derived
48
+ * guess is the right SEED for a new project and the wrong answer for every
49
+ * curated one, so the fix is about WHEN the column is written, not how well it
50
+ * is computed.
51
+ *
52
+ * `audit-engine` reported this on 2026-07-31 as two bad rows
53
+ * (`org-hq.project_name` = "Org Hq", plus a `videomigrator-engine.github_url`).
54
+ * Both rows were repaired by hand before this session; the EMITTER was not, so
55
+ * the next re-registration would have reintroduced one of them and 42 others.
56
+ */
57
+ export declare const INSERT_ONLY_COLUMNS: readonly string[];
6
58
  export interface InventoryConfig {
7
59
  /** Postgres connection string (Neon pooled "Connection String"). */
8
60
  databaseUrl: string;
@@ -57,6 +109,26 @@ export interface BuildProjectRowOptions {
57
109
  * value is a judgement about who the project serves, and a scaffolder guessing
58
110
  * `internal` for every new repo would recreate exactly the unvalidated
59
111
  * categorisation Kerry just retired. It stays a human/agent field.
112
+ *
113
+ * `ecosystem_role` IS written, and the contrast with `audience` is the whole
114
+ * argument for it. It looks like the same kind of judgement call, but it is not
115
+ * one, because **Kerry CLOSED the ecosystem set at 8 on 2026-08-02** (his list
116
+ * matched `audit-engine`'s three proposals exactly; all 9 abstains cleared to
117
+ * `domain`; the shared-capability class — `z2w-ai-engine`, `crawl-engine`,
118
+ * `backup-engine`, `dashboard-engine` — upheld as `domain`). A closed set means
119
+ * every row outside it is `domain` **by construction**, so a scaffolder writing
120
+ * `domain` is not guessing — it is applying the only value a new row can hold.
121
+ * A 9th `ecosystem` project is a REOPENING that needs Kerry, not a
122
+ * classification, which is exactly why this is safe to automate and `audience`
123
+ * is not.
124
+ *
125
+ * Enforced in the database rather than trusted here: the registry carries
126
+ * `projects_ecosystem_set_closed_chk`, which rejects `ecosystem` on any slug
127
+ * outside the 8. If this constant ever drifts to `ecosystem`, the write fails
128
+ * loudly instead of quietly seating a 9th member. (Adopted from `audit-engine`'s
129
+ * 2026-08-02 ACTION — *"the set being CLOSED is the part to encode"* — whose own
130
+ * `assert_ecosystem_set_is_closed()` guards its Python; the CHECK is the durable
131
+ * version that binds all three registry writers.)
60
132
  */
61
133
  export declare function buildProjectRow(inputs: ScaffoldInputs, opts?: BuildProjectRowOptions): ProjectRow;
62
134
  /**
@@ -97,6 +169,8 @@ export interface UpsertStatement {
97
169
  * interpolation of column names is injection-safe; all VALUES are parameterized.
98
170
  * The DO UPDATE set list excludes `slug` (the conflict key) and touches only the
99
171
  * columns present in `row`, so columns the CLI doesn't manage are never altered.
172
+ * It also excludes `INSERT_ONLY_COLUMNS` — seeded on a new row, never overwritten
173
+ * on an existing one, so a re-registration cannot clobber a curated value.
100
174
  * `updated_at` is left to the table's auto-touch trigger.
101
175
  */
102
176
  export declare function buildUpsert(row: ProjectRow): UpsertStatement;
package/dist/inventory.js CHANGED
@@ -33,6 +33,69 @@ import { scaffoldCarriesCoordinationBlock, displayNameFromSlug } from "./airtabl
33
33
  export const INVENTORY_TABLE = "projects";
34
34
  /** The conflict key — the `projects/{slug}.md` filename the cron keys on. */
35
35
  export const INVENTORY_CONFLICT_KEY = "slug";
36
+ /**
37
+ * The 8 projects Kerry ruled `ecosystem_role = 'ecosystem'` on 2026-08-02, when
38
+ * he CLOSED the set. Mirrored here from the registry's
39
+ * `projects_ecosystem_set_closed_chk` so this CLI can assert it never scaffolds
40
+ * a 9th member; the database is the enforcement point, this is the local copy.
41
+ *
42
+ * An `ecosystem` project's subject matter IS the other projects — it has no
43
+ * purpose outside the portfolio. Everything else, including the shared
44
+ * capability engines Kerry explicitly ruled on (`z2w-ai-engine`,
45
+ * `crawl-engine`, `backup-engine`, `dashboard-engine`), is `domain`.
46
+ */
47
+ export const ECOSYSTEM_PROJECTS = [
48
+ "audit-engine",
49
+ "cursor-project-templates",
50
+ "kuma-watchdog",
51
+ "z2w-agent-command-center",
52
+ "z2w-agent-coordination",
53
+ "z2w-observability-bridge",
54
+ "z2w-skill-vault",
55
+ "z2w-starter-kit",
56
+ ];
57
+ /**
58
+ * The `ecosystem_role` a given slug must hold, derived from the closed set.
59
+ *
60
+ * This is deliberately a LOOKUP and not the constant `"domain"`, because
61
+ * `buildUpsert` emits `ON CONFLICT (slug) DO UPDATE SET ecosystem_role =
62
+ * EXCLUDED.ecosystem_role`. A flat `"domain"` would be correct for every new
63
+ * project and silently WRONG on any re-registration of one of the 8 — it would
64
+ * demote a real `ecosystem` row, and the database CHECK could not catch it,
65
+ * because `domain` is a legal value for every slug. The constraint guards
66
+ * against wrongly ADDING a 9th member; only this lookup guards against wrongly
67
+ * REMOVING one.
68
+ */
69
+ export function ecosystemRoleFor(slug) {
70
+ return ECOSYSTEM_PROJECTS.includes(slug) ? "ecosystem" : "domain";
71
+ }
72
+ /**
73
+ * Columns this CLI may SEED on a brand-new row but must never OVERWRITE on an
74
+ * existing one — excluded from the UPSERT's `DO UPDATE SET` list.
75
+ *
76
+ * This closes a hole in the principle stated at the top of `buildProjectRow`:
77
+ * *"manually-curated columns are intentionally omitted so the UPSERT's DO UPDATE
78
+ * never clobbers Kerry's hand-entered values."* That was enforced by leaving a
79
+ * column out of the row entirely — which works for columns the CLI never knows
80
+ * (`technology`, `licensing`, `notes`), but NOT for `project_name`, which the
81
+ * CLI both derives and Kerry curates.
82
+ *
83
+ * Measured 2026-08-03 against all 96 registry rows: a re-registration would have
84
+ * rewritten **43 of them (45%)**, and most of those names could not be derived
85
+ * from a slug by any algorithm — `Femperium Web Scraping / Lead Gen`,
86
+ * `Financial | Investing`, `Static Sites For Small Businesses`,
87
+ * `Docker for Z2W Multi-Lingual`, `Ente Photos & Locker`,
88
+ * `Grantor (off-WP rebuild)`. Those are editorial, not mechanical. A slug-derived
89
+ * guess is the right SEED for a new project and the wrong answer for every
90
+ * curated one, so the fix is about WHEN the column is written, not how well it
91
+ * is computed.
92
+ *
93
+ * `audit-engine` reported this on 2026-07-31 as two bad rows
94
+ * (`org-hq.project_name` = "Org Hq", plus a `videomigrator-engine.github_url`).
95
+ * Both rows were repaired by hand before this session; the EMITTER was not, so
96
+ * the next re-registration would have reintroduced one of them and 42 others.
97
+ */
98
+ export const INSERT_ONLY_COLUMNS = ["project_name"];
36
99
  /**
37
100
  * Resolve the Neon inventory config from the environment. Returns null when no
38
101
  * Z2W_INVENTORY_DATABASE_URL is set — the signal that the Neon write is disabled
@@ -74,6 +137,26 @@ export function resolveInventoryConfig(env = process.env) {
74
137
  * value is a judgement about who the project serves, and a scaffolder guessing
75
138
  * `internal` for every new repo would recreate exactly the unvalidated
76
139
  * categorisation Kerry just retired. It stays a human/agent field.
140
+ *
141
+ * `ecosystem_role` IS written, and the contrast with `audience` is the whole
142
+ * argument for it. It looks like the same kind of judgement call, but it is not
143
+ * one, because **Kerry CLOSED the ecosystem set at 8 on 2026-08-02** (his list
144
+ * matched `audit-engine`'s three proposals exactly; all 9 abstains cleared to
145
+ * `domain`; the shared-capability class — `z2w-ai-engine`, `crawl-engine`,
146
+ * `backup-engine`, `dashboard-engine` — upheld as `domain`). A closed set means
147
+ * every row outside it is `domain` **by construction**, so a scaffolder writing
148
+ * `domain` is not guessing — it is applying the only value a new row can hold.
149
+ * A 9th `ecosystem` project is a REOPENING that needs Kerry, not a
150
+ * classification, which is exactly why this is safe to automate and `audience`
151
+ * is not.
152
+ *
153
+ * Enforced in the database rather than trusted here: the registry carries
154
+ * `projects_ecosystem_set_closed_chk`, which rejects `ecosystem` on any slug
155
+ * outside the 8. If this constant ever drifts to `ecosystem`, the write fails
156
+ * loudly instead of quietly seating a 9th member. (Adopted from `audit-engine`'s
157
+ * 2026-08-02 ACTION — *"the set being CLOSED is the part to encode"* — whose own
158
+ * `assert_ecosystem_set_is_closed()` guards its Python; the CHECK is the durable
159
+ * version that binds all three registry writers.)
77
160
  */
78
161
  export function buildProjectRow(inputs, opts = {}) {
79
162
  const row = {
@@ -88,6 +171,11 @@ export function buildProjectRow(inputs, opts = {}) {
88
171
  // skill-vault is an always-on standard in every scaffold (ROADMAP Step 15);
89
172
  // the Neon column is a real boolean.
90
173
  skill_vault_aware: true,
174
+ // The ecosystem set is CLOSED at 8 (Kerry, 2026-08-02), so a newly
175
+ // scaffolded project is `domain` by construction — see the doc comment.
176
+ // Derived rather than hardcoded so a re-registration of one of the 8 cannot
177
+ // demote it through the UPSERT's DO UPDATE (see `ecosystemRoleFor`).
178
+ ecosystem_role: ecosystemRoleFor(inputs.slug),
91
179
  };
92
180
  // Only assert agent_coordination = Registered when the scaffold actually
93
181
  // carries the coordination block; otherwise leave it unset for Kerry. When the
@@ -149,13 +237,15 @@ export function validateProjectRow(row) {
149
237
  * interpolation of column names is injection-safe; all VALUES are parameterized.
150
238
  * The DO UPDATE set list excludes `slug` (the conflict key) and touches only the
151
239
  * columns present in `row`, so columns the CLI doesn't manage are never altered.
240
+ * It also excludes `INSERT_ONLY_COLUMNS` — seeded on a new row, never overwritten
241
+ * on an existing one, so a re-registration cannot clobber a curated value.
152
242
  * `updated_at` is left to the table's auto-touch trigger.
153
243
  */
154
244
  export function buildUpsert(row) {
155
245
  const columns = Object.keys(row);
156
246
  const placeholders = columns.map((_, i) => `$${i + 1}`);
157
247
  const updates = columns
158
- .filter((col) => col !== INVENTORY_CONFLICT_KEY)
248
+ .filter((col) => col !== INVENTORY_CONFLICT_KEY && !INSERT_ONLY_COLUMNS.includes(col))
159
249
  .map((col) => `${col} = EXCLUDED.${col}`);
160
250
  // A row may carry only `slug` in pathological cases; guard the empty SET.
161
251
  const conflictClause = updates.length > 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zero2webmaster/starter-kit",
3
- "version": "0.9.4",
3
+ "version": "0.11.0",
4
4
  "description": "Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.",
5
5
  "author": {
6
6
  "name": "Dr. Kerry Kriger",