@zero2webmaster/starter-kit 0.9.2 → 0.9.3

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.2 | **Framework:** 2.13.0
3
+ **Version:** 0.9.3 | **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.2 (current)** 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 `*`.
86
+ - **v0.9.3 (current)** 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
+ - **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 `*`.
87
88
  - **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.
88
89
  - **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.
89
90
  - **v0.6.0** shipped the magic-link `CANONICAL_HOSTS` seam, a shared `lib/seo/canonical-host.mjs` so `robots.ts` and the Vercel alias redirect cannot disagree, and a `404`-on-unmapped-Host guard for Host-routed multi-tenant apps.
@@ -109,4 +110,4 @@ Inquiries: kerry@zero2webmaster.com.
109
110
  ---
110
111
 
111
112
  *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.*
112
- *Version: 0.9.2 | Last Updated: 2026-08-02*
113
+ *Version: 0.9.3 | Last Updated: 2026-08-02*
package/dist/brand.d.ts CHANGED
@@ -16,11 +16,28 @@ export interface BrandPresetSpec {
16
16
  typographyRule: string;
17
17
  domains: readonly string[];
18
18
  /**
19
- * Default GitHub org for `gh repo create`. `null` for `custom` (caller must
20
- * supply explicitly). Internal Z2W brands map to `zero2webmaster`; STF maps
21
- * to `savethefrogs`; Bansuri Bliss maps to `bansuribliss`.
19
+ * Default GitHub repo OWNER for `gh repo create`. `null` for `custom` (caller
20
+ * must supply explicitly). Internal Z2W brands map to `zero2webmaster`; STF
21
+ * maps to `savethefrogs`; Bansuri Bliss maps to `bansuribliss`.
22
+ *
23
+ * Named `githubOrg` for backward compatibility with existing briefs and
24
+ * `--input` files, which spell the field `GitHub org:`. **The value is an
25
+ * account name, not necessarily an Organization** — see `accountType`.
22
26
  */
23
27
  githubOrg: string | null;
28
+ /**
29
+ * Whether `githubOrg` names a GitHub **User** account or an **Organization**.
30
+ *
31
+ * Load-bearing, not trivia. Every account in Kerry's portfolio is a `User`
32
+ * (verified 2026-08-02: `gh api users/<name> --jq .type` returns `User` for
33
+ * `zero2webmaster`, `savethefrogs`, `bansuribliss` and `kerrykriger`, and
34
+ * `gh api user/orgs` is empty — there is no Organization anywhere). The
35
+ * emitted brand block used to say "GitHub org default", which sent two
36
+ * different agents to `/organizations/...` 404s inside five days while
37
+ * setting up a GitHub App and a webhook. `"unknown"` is the honest answer
38
+ * for a caller-supplied owner we have not checked.
39
+ */
40
+ accountType: "user" | "organization" | "unknown";
24
41
  author: string;
25
42
  authorUrl: string;
26
43
  /** Additional brand colors beyond primary + accent (purple, gold, ...). */
@@ -50,8 +67,12 @@ export declare const BRAND_PRESETS: Readonly<Record<Exclude<BrandPreset, "custom
50
67
  *
51
68
  * Per [[instantiate-z2w-project]] SKILL.md, `custom` is never persisted back
52
69
  * into the skill — one-offs aren't presets. The typography rule defaults to
53
- * the Z2W standing org rule, and GitHub org defaults to `null` (caller must
54
- * set it explicitly via the GitHub org input).
70
+ * the Z2W standing org rule, and the GitHub owner defaults to `null` (caller
71
+ * must set it explicitly via the GitHub owner input).
72
+ *
73
+ * `accountType` is deliberately `"unknown"`: a caller-supplied owner has not
74
+ * been checked, and claiming either type would be a guess the emitted docs
75
+ * would then state as fact. The emitted block tells the reader how to check.
55
76
  */
56
77
  export declare function buildCustomBrandSpec(inputs: CustomBrandInputs, githubOrg?: string | null): BrandPresetSpec;
57
78
  /**
package/dist/brand.js CHANGED
@@ -32,6 +32,7 @@ export const SAVE_THE_FROGS_PRESET = {
32
32
  "amphibianweek.org",
33
33
  ],
34
34
  githubOrg: "savethefrogs",
35
+ accountType: "user",
35
36
  author: DEFAULT_AUTHOR,
36
37
  authorUrl: DEFAULT_AUTHOR_URL,
37
38
  extras: [
@@ -57,6 +58,7 @@ export const BANSURI_BLISS_PRESET = {
57
58
  typographyRule: "",
58
59
  domains: ["bansuribliss.com"],
59
60
  githubOrg: "bansuribliss",
61
+ accountType: "user",
60
62
  author: DEFAULT_AUTHOR,
61
63
  authorUrl: DEFAULT_AUTHOR_URL,
62
64
  extras: [],
@@ -74,6 +76,7 @@ export const ZERO2WEBMASTER_PRESET = {
74
76
  typographyRule: "Large, easy-to-read type per Z2W standing organization instruction (body 18px+, line-height >= 1.5).",
75
77
  domains: ["zero2webmaster.com"],
76
78
  githubOrg: "zero2webmaster",
79
+ accountType: "user",
77
80
  author: DEFAULT_AUTHOR,
78
81
  authorUrl: DEFAULT_AUTHOR_URL,
79
82
  extras: [
@@ -89,7 +92,7 @@ export const ZERO2WEBMASTER_PRESET = {
89
92
  },
90
93
  ],
91
94
  notes: [
92
- "Applies to Z2W internal tools, Z2W-branded WP plugins, Z2W cross-project infrastructure, and the Z2W product line. All ship under the zero2webmaster GitHub org, NEVER under kerrykriger personal.",
95
+ "Applies to Z2W internal tools, Z2W-branded WP plugins, Z2W cross-project infrastructure, and the Z2W product line. All ship under the `zero2webmaster` GitHub account, NEVER under `kerrykriger`. Both are GitHub **User** accounts, so the rule is about which account owns the repo — it is NOT a personal-vs-organization distinction.",
93
96
  ],
94
97
  isStub: false,
95
98
  };
@@ -103,8 +106,12 @@ export const BRAND_PRESETS = {
103
106
  *
104
107
  * Per [[instantiate-z2w-project]] SKILL.md, `custom` is never persisted back
105
108
  * into the skill — one-offs aren't presets. The typography rule defaults to
106
- * the Z2W standing org rule, and GitHub org defaults to `null` (caller must
107
- * set it explicitly via the GitHub org input).
109
+ * the Z2W standing org rule, and the GitHub owner defaults to `null` (caller
110
+ * must set it explicitly via the GitHub owner input).
111
+ *
112
+ * `accountType` is deliberately `"unknown"`: a caller-supplied owner has not
113
+ * been checked, and claiming either type would be a guess the emitted docs
114
+ * would then state as fact. The emitted block tells the reader how to check.
108
115
  */
109
116
  export function buildCustomBrandSpec(inputs, githubOrg = null) {
110
117
  return {
@@ -116,6 +123,7 @@ export function buildCustomBrandSpec(inputs, githubOrg = null) {
116
123
  typographyRule: DEFAULT_TYPOGRAPHY_RULE,
117
124
  domains: [],
118
125
  githubOrg,
126
+ accountType: "unknown",
119
127
  author: DEFAULT_AUTHOR,
120
128
  authorUrl: DEFAULT_AUTHOR_URL,
121
129
  extras: [],
@@ -140,6 +148,43 @@ function valueOrTodo(value) {
140
148
  const trimmed = value.trim();
141
149
  return trimmed.length > 0 ? trimmed : "_TODO — fill in_";
142
150
  }
151
+ /**
152
+ * The account-type clause that follows the GitHub owner in the brand block.
153
+ *
154
+ * This exists because the emitted wording was previously "GitHub org default",
155
+ * which is a factual claim and a false one: every account in the portfolio is
156
+ * a GitHub `User`. Two agents built org-scoped URLs from that line and hit
157
+ * `/organizations/...` 404s within five days (a GitHub App setup on
158
+ * 2026-07-26, a webhook on 2026-07-31 — the latter published into four docs
159
+ * before it was caught). So the clause names the type AND names the org-only
160
+ * surfaces that do not exist for a User account, because "owner" alone still
161
+ * leaves a reader free to assume Organization.
162
+ *
163
+ * For an unverified owner it states that it is unverified and gives the
164
+ * one-command check, rather than guessing a type the docs would then assert.
165
+ */
166
+ function renderAccountTypeNote(spec) {
167
+ const owner = spec.githubOrg ?? "";
168
+ if (spec.accountType === "user") {
169
+ return (`a GitHub **User** account, NOT an Organization. Repos live at ` +
170
+ `\`github.com/${owner}/{repo}\`. Organization-only URLs and APIs do ` +
171
+ `not exist for it — \`/organizations/...\`, \`gh api orgs/${owner}\`, ` +
172
+ `and Settings → Organizations all 404.`);
173
+ }
174
+ if (spec.accountType === "organization") {
175
+ return "a GitHub **Organization**, so organization-scoped URLs and APIs apply.";
176
+ }
177
+ // Deliberately NOT a `switch` with three cases and no default. `tsconfig`
178
+ // EXCLUDES `**/*.test.ts` from typecheck, so a spec literal missing
179
+ // `accountType` compiles and only shows up at run time — an exhaustive
180
+ // switch would return `undefined` and emit the literal text "undefined"
181
+ // into a scaffolded CLAUDE.md. Anything unrecognised falls through to the
182
+ // verify-first wording, which is never wrong for any account.
183
+ return (`account type NOT verified. Check it with \`gh api users/${owner} ` +
184
+ `--jq .type\` before using any Organization-only URL or API ` +
185
+ `(\`/organizations/...\`, \`gh api orgs/...\`), which 404 for a User ` +
186
+ `account.`);
187
+ }
143
188
  /**
144
189
  * Render a brand spec as a self-contained markdown block suitable for
145
190
  * prepending to a scaffolded project's CLAUDE.md (per the skill's Step 5).
@@ -155,7 +200,7 @@ export function renderBrandBlock(spec) {
155
200
  lines.push(`- **Brand name:** \`${spec.brandName}\` — ${spec.brandNameRule}`);
156
201
  lines.push(`- **Author:** ${spec.author} (${spec.authorUrl})`);
157
202
  if (spec.githubOrg) {
158
- lines.push(`- **GitHub org default:** \`${spec.githubOrg}\``);
203
+ lines.push(`- **GitHub owner:** \`${spec.githubOrg}\` — ${renderAccountTypeNote(spec)}`);
159
204
  }
160
205
  lines.push("");
161
206
  lines.push("**Color palette:**");
package/dist/confirm.js CHANGED
@@ -54,7 +54,7 @@ export function renderDraft(draft) {
54
54
  const cb = draft.customBrand;
55
55
  lines.push(` 4a. Brand name ................ ${fmtCustom(cb?.brandName)}`, ` 4b. Capitalization rule ....... ${fmtCustom(cb?.brandNameRule)}`, ` 4c. Primary hex color ......... ${fmtCustom(cb?.primaryColor)}`, ` 4d. Accent hex color .......... ${fmtCustom(cb?.accentColor)}`);
56
56
  }
57
- lines.push(` 5. GitHub org ..................... ${fmt(draft.githubOrg)}`, ` 6. Target path .................... ${fmt(draft.targetPath)}`, ` 7. Database strategy .............. ${fmt(draft.dbStrategy)}`, ` 8. Has web UI ..................... ${fmt(draft.hasWebUi)}`, ` 9. Has cron / scheduled jobs ...... ${fmt(draft.hasCron)}`, ` 10. Participate in agent bulletin .. ${fmt(draft.participateInBulletin)}`, ` 11. Sends transactional/auth email . ${fmt(draft.sendsEmail)}`, ` 12. Accepts user-generated content ${fmt(draft.hasUserContent)}`, ` 13. Wire Sentry error tracking ..... ${fmt(draft.hasObservability)}`);
57
+ lines.push(` 5. GitHub owner ................... ${fmt(draft.githubOrg)}`, ` 6. Target path .................... ${fmt(draft.targetPath)}`, ` 7. Database strategy .............. ${fmt(draft.dbStrategy)}`, ` 8. Has web UI ..................... ${fmt(draft.hasWebUi)}`, ` 9. Has cron / scheduled jobs ...... ${fmt(draft.hasCron)}`, ` 10. Participate in agent bulletin .. ${fmt(draft.participateInBulletin)}`, ` 11. Sends transactional/auth email . ${fmt(draft.sendsEmail)}`, ` 12. Accepts user-generated content ${fmt(draft.hasUserContent)}`, ` 13. Wire Sentry error tracking ..... ${fmt(draft.hasObservability)}`);
58
58
  return lines.join("\n");
59
59
  }
60
60
  export function parseSlug(raw) {
@@ -253,10 +253,10 @@ async function editField(draft, fieldNumber, opts) {
253
253
  return null;
254
254
  }
255
255
  case 5: {
256
- const raw = await opts.prompter("GitHub org:", draft.githubOrg ?? "");
256
+ const raw = await opts.prompter("GitHub owner (user or org account):", draft.githubOrg ?? "");
257
257
  const trimmed = raw.trim().replace(/^@/, "");
258
258
  if (trimmed.length === 0)
259
- return "GitHub org cannot be empty.";
259
+ return "GitHub owner cannot be empty.";
260
260
  draft.githubOrg = trimmed;
261
261
  return null;
262
262
  }
@@ -285,7 +285,14 @@ export function githubOrgForBrand(brand) {
285
285
  }
286
286
  }
287
287
  function inferGithubOrg(brief, brand) {
288
+ // "github owner"/"github account" are the accurate spellings (every Z2W
289
+ // account is a GitHub User, not an Organization). "github org"/"github
290
+ // organization"/"org" stay accepted for the many existing briefs and
291
+ // `--input` files that already use them — dropping them would silently fall
292
+ // back to the brand default instead of erroring.
288
293
  const explicit = findExplicitField(brief, [
294
+ "github owner",
295
+ "github account",
289
296
  "github org",
290
297
  "github organization",
291
298
  "org",
@@ -88,6 +88,32 @@ export declare function resolveStandards(inputs: ScaffoldInputs, opts?: ResolveS
88
88
  * call on any file).
89
89
  */
90
90
  export declare function applyStandardsBlock(claudeMd: string, resolution: StandardsResolution): string;
91
+ /**
92
+ * Wrap a replacement so `String.replace()` inserts it LITERALLY.
93
+ *
94
+ * 🔴 Never pass canonical prose to `.replace()` as a replacement *string*. JS
95
+ * interprets `$&`, `` $` ``, `$'`, `$1` and `$$` inside a replacement string as
96
+ * special patterns, and the bodies spliced by this module are hand-written
97
+ * markdown from upstream sources we do not control — so any of those sequences
98
+ * can appear at any time without warning.
99
+ *
100
+ * This is not hypothetical. Protocol v0.1.25 / block v0.1.18 (2026-07-30) added
101
+ * the sentence ``Anchor the rewrite on the heading as a whole LINE (`^## Current
102
+ * focus$`)`` — whose `$` + closing backtick form the two-byte sequence `` $` ``,
103
+ * meaning "everything in the subject string BEFORE the match". Every scaffold
104
+ * emitted after that date spliced its own ENTIRE document head back into the
105
+ * middle of the coordination block: `marketing-engine`'s committed `CLAUDE.md`
106
+ * came out at 1522 lines with two `# Agent Instructions` headings, and the
107
+ * sentence carrying the `$` was truncated mid-clause.
108
+ *
109
+ * It was silent in every channel that could have caught it. The byte-diff test
110
+ * compares the CONSTANT against `AGENT_PROTOCOL.md` and passed — the constant
111
+ * was always correct; the *emission* was corrupt. Nothing reads a scaffolded
112
+ * `CLAUDE.md` as part of a build, so there was no downstream error either. A
113
+ * replacer FUNCTION's return value is used verbatim, with no `$` interpretation
114
+ * at all, which is why this is the fix rather than escaping `$$`.
115
+ */
116
+ export declare function literalReplacement(text: string): () => string;
91
117
  /**
92
118
  * Fill the `<!-- AGENT_COORDINATION_BLOCK -->` marker with the verbatim
93
119
  * canonical Agent Coordination section (or remove it, leaving a clean seam,
package/dist/standards.js CHANGED
@@ -652,7 +652,35 @@ export function resolveStandards(inputs, opts = {}) {
652
652
  * call on any file).
653
653
  */
654
654
  export function applyStandardsBlock(claudeMd, resolution) {
655
- return claudeMd.replace(/<!-- STANDARDS_BLOCK -->/g, resolution.body.trimEnd());
655
+ return claudeMd.replace(/<!-- STANDARDS_BLOCK -->/g, literalReplacement(resolution.body.trimEnd()));
656
+ }
657
+ /**
658
+ * Wrap a replacement so `String.replace()` inserts it LITERALLY.
659
+ *
660
+ * 🔴 Never pass canonical prose to `.replace()` as a replacement *string*. JS
661
+ * interprets `$&`, `` $` ``, `$'`, `$1` and `$$` inside a replacement string as
662
+ * special patterns, and the bodies spliced by this module are hand-written
663
+ * markdown from upstream sources we do not control — so any of those sequences
664
+ * can appear at any time without warning.
665
+ *
666
+ * This is not hypothetical. Protocol v0.1.25 / block v0.1.18 (2026-07-30) added
667
+ * the sentence ``Anchor the rewrite on the heading as a whole LINE (`^## Current
668
+ * focus$`)`` — whose `$` + closing backtick form the two-byte sequence `` $` ``,
669
+ * meaning "everything in the subject string BEFORE the match". Every scaffold
670
+ * emitted after that date spliced its own ENTIRE document head back into the
671
+ * middle of the coordination block: `marketing-engine`'s committed `CLAUDE.md`
672
+ * came out at 1522 lines with two `# Agent Instructions` headings, and the
673
+ * sentence carrying the `$` was truncated mid-clause.
674
+ *
675
+ * It was silent in every channel that could have caught it. The byte-diff test
676
+ * compares the CONSTANT against `AGENT_PROTOCOL.md` and passed — the constant
677
+ * was always correct; the *emission* was corrupt. Nothing reads a scaffolded
678
+ * `CLAUDE.md` as part of a build, so there was no downstream error either. A
679
+ * replacer FUNCTION's return value is used verbatim, with no `$` interpretation
680
+ * at all, which is why this is the fix rather than escaping `$$`.
681
+ */
682
+ export function literalReplacement(text) {
683
+ return () => text;
656
684
  }
657
685
  /**
658
686
  * Fill the `<!-- AGENT_COORDINATION_BLOCK -->` marker with the verbatim
@@ -669,7 +697,7 @@ export function applyAgentCoordinationBlock(claudeMd, resolution) {
669
697
  if (section === "") {
670
698
  return claudeMd.replace(marker, "");
671
699
  }
672
- return claudeMd.replace(marker, `${section}\n\n---\n\n`);
700
+ return claudeMd.replace(marker, literalReplacement(`${section}\n\n---\n\n`));
673
701
  }
674
702
  /**
675
703
  * Fill the `<!-- CAPTURE_LEARNINGS_BLOCK -->` marker with the verbatim canonical
@@ -680,7 +708,7 @@ export function applyAgentCoordinationBlock(claudeMd, resolution) {
680
708
  * top-level `##` section, so it sits outside `## Standards block`.
681
709
  */
682
710
  export function applyCaptureLearningsBlock(claudeMd) {
683
- const filled = claudeMd.replace(/<!-- CAPTURE_LEARNINGS_BLOCK -->/g, `${CAPTURE_LEARNINGS_BODY.trimEnd()}\n\n---\n\n`);
711
+ const filled = claudeMd.replace(/<!-- CAPTURE_LEARNINGS_BLOCK -->/g, literalReplacement(`${CAPTURE_LEARNINGS_BODY.trimEnd()}\n\n---\n\n`));
684
712
  // DEDUPE, and this is why the call happens AFTER the AGENTS body is spliced
685
713
  // in: the canonical framework body (AGENTS_v2.17.0+) carries this same block,
686
714
  // which would leave the scaffold with TWO copies. Two is a real failure, not
package/dist/wizard.js CHANGED
@@ -122,7 +122,7 @@ export async function runWizard(opts) {
122
122
  const brand = await askValidated(prompter, `4. Brand preset (${BRANDS.join(" / ")}):`, parseEnumValue(BRANDS, "Brand preset"), undefined, out);
123
123
  const customBrand = brand === "custom" ? await askCustomBrand(prompter, out) : undefined;
124
124
  const githubOrgDefault = githubOrgForBrand(brand) ?? "";
125
- const githubOrg = await askValidated(prompter, "5. GitHub org:", parseNonEmpty("GitHub org"), githubOrgDefault, out);
125
+ const githubOrg = await askValidated(prompter, "5. GitHub owner (user or org account):", parseNonEmpty("GitHub owner"), githubOrgDefault, out);
126
126
  const targetPathParser = makeTargetPathParser(skipFs);
127
127
  let targetPath;
128
128
  while (true) {
package/dist/writer.js CHANGED
@@ -26,7 +26,7 @@ import fsExtra from "fs-extra";
26
26
  import { AGENT_COORDINATION_BLOCK_MARKER, AGENTS_BODY_MARKER, STANDARDS_BLOCK_MARKER, } from "./scaffolders/common.js";
27
27
  import { buildProSeoExtension, proSeoApplies, } from "./scaffolders/pro-seo-extension.js";
28
28
  import { scaffoldByType } from "./scaffolders/index.js";
29
- import { applyAgentCoordinationBlock, applyCaptureLearningsBlock, applyStandardsBlock, resolveStandards, } from "./standards.js";
29
+ import { applyAgentCoordinationBlock, applyCaptureLearningsBlock, applyStandardsBlock, literalReplacement, resolveStandards, } from "./standards.js";
30
30
  import { resolveAgentsTemplate, } from "./templates.js";
31
31
  export class WriterError extends Error {
32
32
  constructor(message) {
@@ -224,7 +224,13 @@ export async function writeScaffold(inputs, targetPath, opts = {}) {
224
224
  const claudeFile = files[claudeIdx];
225
225
  let claudeContent = applyStandardsBlock(claudeFile.content, resolution);
226
226
  claudeContent = applyAgentCoordinationBlock(claudeContent, resolution);
227
- claudeContent = claudeContent.replace(AGENTS_BODY_MARKER, agentsBody);
227
+ // `literalReplacement` is mandatory here, not defensive styling: `agentsBody`
228
+ // is the canonical `AGENTS_v*.md` framework body read fresh from Templates on
229
+ // every run, so it is prose this repo does not control and cannot review
230
+ // before splicing. A bare `$&`/`` $` ``/`$'` anywhere in it would silently
231
+ // duplicate or drop part of the emitted CLAUDE.md. See the helper's docblock
232
+ // for the 2026-07-30 incident that proved this is a live hazard.
233
+ claudeContent = claudeContent.replace(AGENTS_BODY_MARKER, literalReplacement(agentsBody));
228
234
  // Always-on: applies to every project type, bulletin participant or not.
229
235
  // MUST run AFTER the AGENTS body splice — the canonical framework body carries
230
236
  // this same block, and this call is what dedupes it down to one.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zero2webmaster/starter-kit",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.",
5
5
  "author": {
6
6
  "name": "Dr. Kerry Kriger",