@zero2webmaster/starter-kit 0.9.3 → 0.10.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/airtable.d.ts +7 -2
- package/dist/airtable.js +37 -4
- package/dist/inventory.d.ts +90 -1
- package/dist/inventory.js +108 -3
- package/dist/standards.js +14 -4
- 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.10.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,9 @@ The Claude Code skill at `~/.claude/skills/instantiate-z2w-project/SKILL.md` and
|
|
|
83
83
|
|
|
84
84
|
## Status
|
|
85
85
|
|
|
86
|
-
- **v0.9.
|
|
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`.
|
|
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.
|
|
87
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 `*`.
|
|
88
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.
|
|
89
91
|
- **v0.7.0** added `lib/seo/page-metadata.ts` — a `pageMetadata()` helper that returns a complete `openGraph` + `twitter` object every time. Next.js merges metadata *shallowly per top-level key*, so a page that hand-writes a partial `openGraph` silently drops `og:type`, `og:site_name` and `og:image` and downgrades its Twitter card.
|
|
@@ -110,4 +112,4 @@ Inquiries: kerry@zero2webmaster.com.
|
|
|
110
112
|
---
|
|
111
113
|
|
|
112
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.*
|
|
113
|
-
*Version: 0.
|
|
115
|
+
*Version: 0.10.0 | Last Updated: 2026-08-03*
|
package/dist/airtable.d.ts
CHANGED
|
@@ -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"
|
|
51
|
-
*
|
|
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"
|
|
90
|
-
*
|
|
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()
|
|
97
|
-
?
|
|
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
|
}
|
package/dist/inventory.d.ts
CHANGED
|
@@ -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;
|
|
@@ -36,12 +88,47 @@ export interface BuildProjectRowOptions {
|
|
|
36
88
|
* licensing, notes, research_url, …) are intentionally omitted so the UPSERT's
|
|
37
89
|
* DO UPDATE never clobbers Kerry's hand-entered values.
|
|
38
90
|
*
|
|
39
|
-
* Difference from the Airtable mapper:
|
|
91
|
+
* Difference from the Airtable mapper: the scaffold type IS written here (the Neon
|
|
40
92
|
* column is plain text and the CLI knows the value, so it earns its place per the
|
|
41
93
|
* column-audit principle "a column earns its place only if the CLI can auto-fill
|
|
42
94
|
* it"). The Airtable mapper omitted it only because that base's Project Type is a
|
|
43
95
|
* single-select whose option names could 422 on first use. `skill_vault_aware` is
|
|
44
96
|
* a real boolean here (Neon column type), not the Airtable "Yes" string.
|
|
97
|
+
*
|
|
98
|
+
* 🛑 **`project_type` is SUPERSEDED as of 2026-08-02 and this mapper no longer
|
|
99
|
+
* writes it.** It had been carrying three questions in one column: an audience
|
|
100
|
+
* label a human typed into Airtable years ago, a stack slug THIS function
|
|
101
|
+
* emitted, and 20 NULLs — so `GROUP BY project_type` returned a clean-looking
|
|
102
|
+
* result that meant nothing. This CLI was the source of the second vocabulary,
|
|
103
|
+
* which makes the split ours to perform. Kerry ruled the field "out of date,
|
|
104
|
+
* needs a review and/or should be replaced" (2026-07-30) and ratified the
|
|
105
|
+
* replacement on 2026-08-02: `stack` (how it is built — this enum) and
|
|
106
|
+
* `audience` (who it is for — internal | client | personal).
|
|
107
|
+
*
|
|
108
|
+
* `audience` is deliberately NOT written here. The CLI cannot know it: every
|
|
109
|
+
* value is a judgement about who the project serves, and a scaffolder guessing
|
|
110
|
+
* `internal` for every new repo would recreate exactly the unvalidated
|
|
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.)
|
|
45
132
|
*/
|
|
46
133
|
export declare function buildProjectRow(inputs: ScaffoldInputs, opts?: BuildProjectRowOptions): ProjectRow;
|
|
47
134
|
/**
|
|
@@ -82,6 +169,8 @@ export interface UpsertStatement {
|
|
|
82
169
|
* interpolation of column names is injection-safe; all VALUES are parameterized.
|
|
83
170
|
* The DO UPDATE set list excludes `slug` (the conflict key) and touches only the
|
|
84
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.
|
|
85
174
|
* `updated_at` is left to the table's auto-touch trigger.
|
|
86
175
|
*/
|
|
87
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
|
|
@@ -53,12 +116,47 @@ export function resolveInventoryConfig(env = process.env) {
|
|
|
53
116
|
* licensing, notes, research_url, …) are intentionally omitted so the UPSERT's
|
|
54
117
|
* DO UPDATE never clobbers Kerry's hand-entered values.
|
|
55
118
|
*
|
|
56
|
-
* Difference from the Airtable mapper:
|
|
119
|
+
* Difference from the Airtable mapper: the scaffold type IS written here (the Neon
|
|
57
120
|
* column is plain text and the CLI knows the value, so it earns its place per the
|
|
58
121
|
* column-audit principle "a column earns its place only if the CLI can auto-fill
|
|
59
122
|
* it"). The Airtable mapper omitted it only because that base's Project Type is a
|
|
60
123
|
* single-select whose option names could 422 on first use. `skill_vault_aware` is
|
|
61
124
|
* a real boolean here (Neon column type), not the Airtable "Yes" string.
|
|
125
|
+
*
|
|
126
|
+
* 🛑 **`project_type` is SUPERSEDED as of 2026-08-02 and this mapper no longer
|
|
127
|
+
* writes it.** It had been carrying three questions in one column: an audience
|
|
128
|
+
* label a human typed into Airtable years ago, a stack slug THIS function
|
|
129
|
+
* emitted, and 20 NULLs — so `GROUP BY project_type` returned a clean-looking
|
|
130
|
+
* result that meant nothing. This CLI was the source of the second vocabulary,
|
|
131
|
+
* which makes the split ours to perform. Kerry ruled the field "out of date,
|
|
132
|
+
* needs a review and/or should be replaced" (2026-07-30) and ratified the
|
|
133
|
+
* replacement on 2026-08-02: `stack` (how it is built — this enum) and
|
|
134
|
+
* `audience` (who it is for — internal | client | personal).
|
|
135
|
+
*
|
|
136
|
+
* `audience` is deliberately NOT written here. The CLI cannot know it: every
|
|
137
|
+
* value is a judgement about who the project serves, and a scaffolder guessing
|
|
138
|
+
* `internal` for every new repo would recreate exactly the unvalidated
|
|
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.)
|
|
62
160
|
*/
|
|
63
161
|
export function buildProjectRow(inputs, opts = {}) {
|
|
64
162
|
const row = {
|
|
@@ -66,13 +164,18 @@ export function buildProjectRow(inputs, opts = {}) {
|
|
|
66
164
|
project_name: displayNameFromSlug(inputs.slug),
|
|
67
165
|
status: "Active",
|
|
68
166
|
creation_method: "Z2W Starter Kit",
|
|
69
|
-
|
|
167
|
+
stack: inputs.projectType,
|
|
70
168
|
// Write the conventional URL even if `gh repo create` is deferred — the
|
|
71
169
|
// inventory's slug-resolution needs it.
|
|
72
170
|
github_url: `https://github.com/${inputs.githubOrg}/${inputs.slug}`,
|
|
73
171
|
// skill-vault is an always-on standard in every scaffold (ROADMAP Step 15);
|
|
74
172
|
// the Neon column is a real boolean.
|
|
75
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),
|
|
76
179
|
};
|
|
77
180
|
// Only assert agent_coordination = Registered when the scaffold actually
|
|
78
181
|
// carries the coordination block; otherwise leave it unset for Kerry. When the
|
|
@@ -134,13 +237,15 @@ export function validateProjectRow(row) {
|
|
|
134
237
|
* interpolation of column names is injection-safe; all VALUES are parameterized.
|
|
135
238
|
* The DO UPDATE set list excludes `slug` (the conflict key) and touches only the
|
|
136
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.
|
|
137
242
|
* `updated_at` is left to the table's auto-touch trigger.
|
|
138
243
|
*/
|
|
139
244
|
export function buildUpsert(row) {
|
|
140
245
|
const columns = Object.keys(row);
|
|
141
246
|
const placeholders = columns.map((_, i) => `$${i + 1}`);
|
|
142
247
|
const updates = columns
|
|
143
|
-
.filter((col) => col !== INVENTORY_CONFLICT_KEY)
|
|
248
|
+
.filter((col) => col !== INVENTORY_CONFLICT_KEY && !INSERT_ONLY_COLUMNS.includes(col))
|
|
144
249
|
.map((col) => `${col} = EXCLUDED.${col}`);
|
|
145
250
|
// A row may carry only `slug` in pathological cases; guard the empty SET.
|
|
146
251
|
const conflictClause = updates.length > 0
|
package/dist/standards.js
CHANGED
|
@@ -307,10 +307,20 @@ const SENTRY_BODY = `### Sentry runtime-error tracking (customer-facing web app)
|
|
|
307
307
|
>
|
|
308
308
|
> 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.
|
|
309
309
|
> 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.
|
|
310
|
-
> 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
|
|
311
|
-
>
|
|
312
|
-
>
|
|
313
|
-
>
|
|
310
|
+
> 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.
|
|
311
|
+
>
|
|
312
|
+
> 4. **🔴 PII: do NOT set \`sendDefaultPii: true\`, and do NOT write a PARTIAL \`dataCollection\` block. Name every axis.** This bullet replaces a shorter one that said \`sendDefaultPii: true\` was fine because it "carries user IP + request headers." **That was a serious understatement and it shipped in this standard.** Verified 2026-08-02 by reading \`@sentry/core\` 10.69.0's own \`defaultPiiToCollectionOptions()\` rather than the docs — \`sendDefaultPii: true\` resolves **ten** axes on, including **\`httpBodies\` in all four directions** (incoming/outgoing request *and* response), **\`genAI: { inputs: true, outputs: true }\` — the user's PROMPT and the model's COMPLETION**, \`databaseQueryData: true\`, \`graphQL.variables: true\`, and \`stackFrameVariables: true\` (local variable values captured off the stack).
|
|
313
|
+
>
|
|
314
|
+
> **Two traps, both counter-intuitive, both measured:**
|
|
315
|
+
> - **Writing a \`dataCollection\` block AT ALL flips the baseline to all-on**, so every axis you do not name is enabled. \`{ httpBodies: [] }\` alone turns four other axes ON. An omitted key is not "leave as default" — it is an opt-in.
|
|
316
|
+
> - **\`stackFrameVariables: true\` is on in BOTH branches**, so \`sendDefaultPii: false\` does not turn it off. Only an explicit \`dataCollection\` block can. Local variables on an error path can hold a token, a decrypted payload, or a whole user record.
|
|
317
|
+
>
|
|
318
|
+
> **So: write ONE complete \`dataCollection\` block naming every axis, and pin it with a test that asserts what \`resolveDataCollectionOptions()\` RESOLVED — not what you typed.** A test that reads your own config object back to itself proves you typed what you meant and nothing about what the SDK did with it; that is exactly the gap that let a partial block sit unnoticed in three Z2W repos. \`[[sentry-runtime-errors]]\` carries the current block, the resolver one-liner, and the per-repo audit — **and because a hardcoded axis list in any doc goes stale silently and in the unsafe direction every time the SDK adds a collector, the binding instruction is the resolver check, not the snippet.** Re-run it on every SDK upgrade.
|
|
319
|
+
>
|
|
320
|
+
> Whatever you end up collecting, never forward a Sentry payload verbatim into a shared surface (the bulletin \`## Incidents\` pipe strips to summary + link + timestamp).
|
|
321
|
+
> 5. **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.
|
|
322
|
+
> 6. **The wizard writes \`silent: !process.env.CI\`, so a missing \`SENTRY_AUTH_TOKEN\` is SILENT LOCALLY and LOUD ON CI.** Quiet on your machine is by configuration, not by design — \`CI\` is unset locally and Vercel sets \`CI=1\`, where the plugin warns **three times, once per runtime**. So do NOT conclude from a clean local build that source-map upload emits nothing: **grep the deployed build log for \`No auth token provided\`** — a free check that beats a manual dashboard visit. (Reported by \`site-control\` 2026-07-30 after documenting the opposite in five places from a local measurement. The general shape, which is worth more than the Sentry detail: **a fact established under one configuration silently changes meaning under another** — so print or fetch what actually resolved, in the environment that will run it.)
|
|
323
|
+
> 7. **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.
|
|
314
324
|
>
|
|
315
325
|
> **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.
|
|
316
326
|
>
|