@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.
Files changed (43) hide show
  1. package/README.md +14 -15
  2. package/dist/airtable.d.ts +119 -0
  3. package/dist/airtable.js +273 -0
  4. package/dist/brief.d.ts +2 -2
  5. package/dist/brief.js +11 -4
  6. package/dist/cli.js +290 -17
  7. package/dist/confirm.d.ts +16 -4
  8. package/dist/confirm.js +66 -32
  9. package/dist/index.d.ts +195 -3
  10. package/dist/index.js +155 -6
  11. package/dist/inventory.d.ts +137 -0
  12. package/dist/inventory.js +258 -0
  13. package/dist/license.d.ts +97 -0
  14. package/dist/license.js +474 -0
  15. package/dist/parse-brief.d.ts +45 -1
  16. package/dist/parse-brief.js +349 -21
  17. package/dist/scaffolders/common.d.ts +42 -1
  18. package/dist/scaffolders/common.js +753 -30
  19. package/dist/scaffolders/index.d.ts +1 -0
  20. package/dist/scaffolders/index.js +3 -0
  21. package/dist/scaffolders/library.js +26 -2
  22. package/dist/scaffolders/nextjs.d.ts +1 -1
  23. package/dist/scaffolders/nextjs.js +254 -24
  24. package/dist/scaffolders/node-service.d.ts +3 -0
  25. package/dist/scaffolders/node-service.js +320 -0
  26. package/dist/scaffolders/pro-seo-extension.d.ts +11 -0
  27. package/dist/scaffolders/pro-seo-extension.js +782 -0
  28. package/dist/scaffolders/python-service.js +10 -2
  29. package/dist/scaffolders/wp-plugin.js +8 -8
  30. package/dist/standards.d.ts +1 -1
  31. package/dist/standards.js +164 -5
  32. package/dist/substitute.d.ts +22 -3
  33. package/dist/substitute.js +19 -5
  34. package/dist/summary.d.ts +9 -0
  35. package/dist/summary.js +31 -13
  36. package/dist/templates.d.ts +43 -57
  37. package/dist/templates.js +108 -175
  38. package/dist/with-init.d.ts +32 -0
  39. package/dist/with-init.js +171 -0
  40. package/dist/wizard.js +21 -0
  41. package/dist/writer.d.ts +13 -6
  42. package/dist/writer.js +119 -21
  43. package/package.json +2 -1
@@ -8,6 +8,8 @@
8
8
  // The parser is intentionally conservative — it only sets a field when the
9
9
  // signal is unambiguous. False-positive inferences erode trust in the
10
10
  // confirmation screen; false-negatives merely require the user to type.
11
+ import * as os from "node:os";
12
+ import * as path from "node:path";
11
13
  const SECTION_NAMES = [
12
14
  "purpose",
13
15
  "key apis",
@@ -18,6 +20,7 @@ const SECTION_NAMES = [
18
20
  "future improvements",
19
21
  "project name",
20
22
  "slug",
23
+ "description",
21
24
  "brand",
22
25
  "github org",
23
26
  "target path",
@@ -80,6 +83,49 @@ function findInlineField(brief, key) {
80
83
  const value = match[1].trim().replace(/^\*\*|\*\*$/g, "").trim();
81
84
  return value.length > 0 ? value : null;
82
85
  }
86
+ /**
87
+ * Find an explicit value for a field. Tries the inline form first
88
+ * (`Key: Value` on one line), then the heading-style form
89
+ * (`## Key\nValue` with the value on the next line). The heading-style
90
+ * lookup takes the first non-empty line of the extracted section body —
91
+ * suitable for single-value fields like slug, brand, target path.
92
+ *
93
+ * Multi-line fields (Description, Purpose) should not use this; they need
94
+ * the full section body via `extractSection`.
95
+ */
96
+ function findExplicitField(brief, keys) {
97
+ for (const key of keys) {
98
+ const inline = findInlineField(brief, key);
99
+ if (inline)
100
+ return inline;
101
+ }
102
+ for (const key of keys) {
103
+ const body = extractSection(brief, key);
104
+ if (body) {
105
+ const firstLine = body
106
+ .split("\n")
107
+ .map((l) => l.trim())
108
+ .find((l) => l.length > 0);
109
+ if (firstLine)
110
+ return firstLine;
111
+ }
112
+ }
113
+ return null;
114
+ }
115
+ /**
116
+ * Expand a leading `~` / `~/` to the user's home directory. Briefs and
117
+ * confirm-screen entries routinely carry `~/Desktop/...` paths, which the
118
+ * shell would expand on a command line but which arrive literal here. Without
119
+ * this, `inferTargetPath` rejected every tilde path as non-absolute (a
120
+ * contributor to the 2026-06-03 "Target path [unset]" dogfood finding).
121
+ */
122
+ export function expandHome(p) {
123
+ if (p === "~")
124
+ return os.homedir();
125
+ if (p.startsWith("~/"))
126
+ return path.join(os.homedir(), p.slice(2));
127
+ return p;
128
+ }
83
129
  const SLUG_RE = /^[a-z][a-z0-9-]{2,49}$/;
84
130
  const SLUG_VERSION_SUFFIX_RE = /-v\d+$/;
85
131
  export function kebabCase(input) {
@@ -94,10 +140,12 @@ export function isValidSlug(slug) {
94
140
  return SLUG_RE.test(slug) && !SLUG_VERSION_SUFFIX_RE.test(slug);
95
141
  }
96
142
  function inferSlug(brief) {
97
- const explicit = findInlineField(brief, "project slug") ??
98
- findInlineField(brief, "slug") ??
99
- findInlineField(brief, "project name") ??
100
- findInlineField(brief, "name");
143
+ const explicit = findExplicitField(brief, [
144
+ "project slug",
145
+ "slug",
146
+ "project name",
147
+ "name",
148
+ ]);
101
149
  if (explicit) {
102
150
  const candidate = kebabCase(explicit);
103
151
  if (isValidSlug(candidate))
@@ -116,10 +164,19 @@ function inferSlug(brief) {
116
164
  return null;
117
165
  }
118
166
  function inferDescription(brief) {
119
- const explicit = findInlineField(brief, "description") ??
167
+ const inline = findInlineField(brief, "description") ??
120
168
  findInlineField(brief, "summary");
121
- if (explicit)
122
- return explicit;
169
+ if (inline)
170
+ return inline;
171
+ for (const key of ["description", "summary"]) {
172
+ const body = extractSection(brief, key);
173
+ if (body) {
174
+ const firstSentence = body.split(/(?<=[.?!])\s+/)[0] ?? body;
175
+ const trimmed = firstSentence.trim();
176
+ if (trimmed.length > 0)
177
+ return trimmed.slice(0, 280);
178
+ }
179
+ }
123
180
  const purpose = extractSection(brief, "purpose");
124
181
  if (purpose) {
125
182
  const firstSentence = purpose.split(/(?<=[.?!])\s+/)[0] ?? purpose;
@@ -129,8 +186,34 @@ function inferDescription(brief) {
129
186
  }
130
187
  return null;
131
188
  }
189
+ const PROJECT_TYPE_VALUES = [
190
+ "wp-plugin",
191
+ "cf-worker",
192
+ "cf-pages",
193
+ "nextjs",
194
+ "python-service",
195
+ "node-service",
196
+ "library",
197
+ "protocol-repo",
198
+ ];
132
199
  function inferProjectType(brief) {
133
- const text = brief.toLowerCase();
200
+ // An explicit `Project type:` / `- **Project type**: <value>` field is
201
+ // authoritative — match the canonical enum value directly first (catches
202
+ // hyphenated values like `protocol-repo` that the prose rules below miss),
203
+ // then fall back to running the prose rules against just the field value.
204
+ const explicit = findExplicitField(brief, ["project type", "type"]);
205
+ if (explicit) {
206
+ const normalized = explicit.toLowerCase().trim();
207
+ const exact = PROJECT_TYPE_VALUES.find((t) => t === normalized);
208
+ if (exact)
209
+ return exact;
210
+ const fromProse = matchProjectTypeProse(normalized);
211
+ if (fromProse)
212
+ return fromProse;
213
+ }
214
+ return matchProjectTypeProse(brief.toLowerCase());
215
+ }
216
+ function matchProjectTypeProse(text) {
134
217
  const rules = [
135
218
  { pattern: /\b(wordpress|wp)\s+plugin\b/, type: "wp-plugin" },
136
219
  { pattern: /\bcloudflare\s+pages\b|\bcf[-\s]?pages\b/, type: "cf-pages" },
@@ -141,6 +224,14 @@ function inferProjectType(brief) {
141
224
  { pattern: /\bnext\.?js\b/, type: "nextjs" },
142
225
  { pattern: /\b(fastapi|flask|django)\b/, type: "python-service" },
143
226
  { pattern: /\bpython\s+(service|app|api|backend)\b/, type: "python-service" },
227
+ // Node API services (Hono / Express / a plain Node backend on Cloud Run,
228
+ // Fly, Render, etc.). These run BEFORE the library rules so "Node service /
229
+ // API / backend" resolves to node-service, while "node cli" / "cli tool"
230
+ // still fall through to library (those require the cli wording, which the
231
+ // patterns here deliberately don't match). Hono is unambiguous.
232
+ { pattern: /\bhono\b/, type: "node-service" },
233
+ { pattern: /\bnode(\.?js)?\s+(service|api|backend|server|microservice)\b/, type: "node-service" },
234
+ { pattern: /\bexpress(\.?js)?\s+(service|api|app|backend|server)\b/, type: "node-service" },
144
235
  { pattern: /\bprotocol\s+repo\b/, type: "protocol-repo" },
145
236
  { pattern: /\bnpm\s+package\b/, type: "library" },
146
237
  { pattern: /\bnode\s+cli\b/, type: "library" },
@@ -154,6 +245,24 @@ function inferProjectType(brief) {
154
245
  return null;
155
246
  }
156
247
  function inferBrand(brief) {
248
+ const explicit = findExplicitField(brief, ["brand", "brand preset"]);
249
+ if (explicit) {
250
+ const value = explicit.toLowerCase().trim();
251
+ if (value === "zero2webmaster" || value === "z2w")
252
+ return "zero2webmaster";
253
+ if (value === "save-the-frogs" ||
254
+ value === "save the frogs" ||
255
+ value === "save the frogs!" ||
256
+ value === "savethefrogs" ||
257
+ value === "stf") {
258
+ return "save-the-frogs";
259
+ }
260
+ if (value === "bansuri-bliss" || value === "bansuri bliss") {
261
+ return "bansuri-bliss";
262
+ }
263
+ if (value === "custom")
264
+ return "custom";
265
+ }
157
266
  const text = brief.toLowerCase();
158
267
  if (/\bsave\s*the\s*frogs\b|\bstf\b/.test(text))
159
268
  return "save-the-frogs";
@@ -176,9 +285,11 @@ export function githubOrgForBrand(brand) {
176
285
  }
177
286
  }
178
287
  function inferGithubOrg(brief, brand) {
179
- const explicit = findInlineField(brief, "github org") ??
180
- findInlineField(brief, "github organization") ??
181
- findInlineField(brief, "org");
288
+ const explicit = findExplicitField(brief, [
289
+ "github org",
290
+ "github organization",
291
+ "org",
292
+ ]);
182
293
  if (explicit) {
183
294
  const cleaned = explicit.replace(/^@/, "").trim();
184
295
  if (cleaned.length > 0)
@@ -189,16 +300,25 @@ function inferGithubOrg(brief, brand) {
189
300
  return null;
190
301
  }
191
302
  function inferTargetPath(brief) {
192
- const explicit = findInlineField(brief, "target path") ??
193
- findInlineField(brief, "target") ??
194
- findInlineField(brief, "path");
195
- if (explicit && explicit.startsWith("/"))
196
- return explicit;
197
- return null;
303
+ const explicit = findExplicitField(brief, [
304
+ "target path",
305
+ "target",
306
+ "path",
307
+ ]);
308
+ if (!explicit)
309
+ return null;
310
+ const expanded = expandHome(explicit);
311
+ return path.isAbsolute(expanded) ? expanded : null;
198
312
  }
199
- function inferDbStrategy(brief) {
200
- const dataSources = extractSection(brief, "data sources") ?? "";
201
- const haystack = (dataSources + "\n" + brief).toLowerCase();
313
+ const DB_STRATEGY_VALUES = [
314
+ "none",
315
+ "neon-postgres",
316
+ "supabase",
317
+ "sqlite",
318
+ "mysql-wp",
319
+ "other",
320
+ ];
321
+ function matchDbProse(haystack) {
202
322
  if (/\bneon\b/.test(haystack))
203
323
  return "neon-postgres";
204
324
  if (/\bsupabase\b/.test(haystack))
@@ -214,7 +334,51 @@ function inferDbStrategy(brief) {
214
334
  return "none";
215
335
  return null;
216
336
  }
337
+ function inferDbStrategy(brief) {
338
+ // Explicit `DB strategy:` / `- **Database strategy**: <value>` wins — match
339
+ // the canonical enum value first, then prose-match the field value.
340
+ const explicit = findExplicitField(brief, [
341
+ "db strategy",
342
+ "database strategy",
343
+ "database",
344
+ "db",
345
+ ]);
346
+ if (explicit) {
347
+ const normalized = explicit.toLowerCase().trim();
348
+ const exact = DB_STRATEGY_VALUES.find((s) => s === normalized);
349
+ if (exact)
350
+ return exact;
351
+ const fromProse = matchDbProse(normalized);
352
+ if (fromProse)
353
+ return fromProse;
354
+ }
355
+ const dataSources = extractSection(brief, "data sources") ?? "";
356
+ return matchDbProse((dataSources + "\n" + brief).toLowerCase());
357
+ }
358
+ /**
359
+ * Read an explicit yes/no field value if present. Returns `null` when the
360
+ * field is absent or its value isn't a recognizable boolean — the caller then
361
+ * falls back to prose inference.
362
+ */
363
+ function explicitBoolean(brief, keys) {
364
+ const explicit = findExplicitField(brief, keys);
365
+ if (!explicit)
366
+ return null;
367
+ const v = explicit.toLowerCase().trim();
368
+ if (["yes", "y", "true", "1"].includes(v))
369
+ return true;
370
+ if (["no", "n", "false", "0"].includes(v))
371
+ return false;
372
+ return null;
373
+ }
217
374
  function inferHasWebUi(brief, projectType) {
375
+ const explicit = explicitBoolean(brief, [
376
+ "has web ui",
377
+ "web ui",
378
+ "has webui",
379
+ ]);
380
+ if (explicit !== null)
381
+ return explicit;
218
382
  const text = brief.toLowerCase();
219
383
  if (/\bno\s+(web\s+)?ui\b|\bno\s+frontend\b/.test(text))
220
384
  return false;
@@ -227,12 +391,21 @@ function inferHasWebUi(brief, projectType) {
227
391
  return true;
228
392
  if (projectType === "library" ||
229
393
  projectType === "cf-worker" ||
394
+ projectType === "node-service" ||
230
395
  projectType === "protocol-repo") {
231
396
  return false;
232
397
  }
233
398
  return null;
234
399
  }
235
400
  function inferHasCron(brief) {
401
+ const explicit = explicitBoolean(brief, [
402
+ "has cron",
403
+ "has cron / scheduled jobs",
404
+ "cron",
405
+ "scheduled jobs",
406
+ ]);
407
+ if (explicit !== null)
408
+ return explicit;
236
409
  const text = brief.toLowerCase();
237
410
  if (/\bcron\b|\bscheduled\b|\bdaily\b|\bweekly\b|\bhourly\b|\bnightly\b|\bevery\s+\d+\s+(minute|hour|day)s?\b/.test(text)) {
238
411
  return true;
@@ -241,6 +414,66 @@ function inferHasCron(brief) {
241
414
  return false;
242
415
  return null;
243
416
  }
417
+ /**
418
+ * Infer whether the project sends transactional / auth email. Returns `false`
419
+ * (not null) when there's no signal — the safe default, since the mailer pulls
420
+ * in the AWS/Resend SDKs. Conservative on keywords: bare "email" is far too
421
+ * common (an "email address" field, a contact email), so we require a phrase
422
+ * that actually implies *sending* mail.
423
+ */
424
+ function inferSendsEmail(brief) {
425
+ const explicit = explicitBoolean(brief, [
426
+ "sends transactional / auth email",
427
+ "sends transactional email",
428
+ "sends email",
429
+ "transactional email",
430
+ ]);
431
+ if (explicit !== null)
432
+ return explicit;
433
+ const text = brief.toLowerCase();
434
+ return /\bmagic[\s-]?link\b|\bpasswordless\b|\btransactional email\b|\bauth email\b|\bconfirmation email\b|\bemail (notification|confirmation|receipt|reminder|verification)\b|\bsends?\s+(an?\s+)?emails?\b|\bemails?\s+(the\s+)?(user|customer|applicant|donor|subscriber|author|admin|member|client|team|them)s?\b|\bamazon ses\b|\bresend\b/.test(text);
435
+ }
436
+ /**
437
+ * Infer whether the project accepts user-generated content (UGC). Returns
438
+ * `false` (not null) when there's no signal — the safe default, since the
439
+ * moderation standard is only relevant for apps whose users post content others
440
+ * see. Conservative on keywords: requires a phrase that actually implies a
441
+ * multi-user content surface, not just "user" or "content" in isolation.
442
+ */
443
+ function inferHasUserContent(brief) {
444
+ const explicit = explicitBoolean(brief, [
445
+ "accepts user-generated content",
446
+ "user-generated content",
447
+ "user generated content",
448
+ "has user content",
449
+ ]);
450
+ if (explicit !== null)
451
+ return explicit;
452
+ const text = brief.toLowerCase();
453
+ return /\bugc\b|\buser[\s-]generated\b|\buser[\s-]submitted\b|\b(community|forum|comments?|discussion|message board|social (network|platform|feed)|marketplace|listings?)\b|\bpost(s|ing|ed)?\b(?=.*\b(user|member|visitor|public|other)s?\b)|\bmembers?\s+(can\s+)?(post|comment|upload|submit|share|message)\b|\bdirect messag|\bprofiles?\s+(that\s+)?(others?|members?|users?)\b|\bmoderation\b/.test(text);
454
+ }
455
+ /**
456
+ * Infer whether to wire Sentry runtime-error/APM observability. Unlike
457
+ * {@link inferSendsEmail} / {@link inferHasUserContent} (which default OFF), this
458
+ * defaults ON for customer-facing web apps — Sentry's free tier is generous and
459
+ * the whole point of the ask is default-on for Next.js / CF-Pages apps with real
460
+ * users. An explicit mention flips it either way; absent any signal, ON iff the
461
+ * type is nextjs / cf-pages AND the app has a web UI (the same customer-facing
462
+ * proxy the SEO baseline uses). The confirm screen still lets a human veto it.
463
+ */
464
+ function inferHasObservability(brief, projectType, hasWebUi) {
465
+ const explicit = explicitBoolean(brief, [
466
+ "wire sentry",
467
+ "sentry",
468
+ "runtime error tracking",
469
+ "error tracking",
470
+ "observability",
471
+ ]);
472
+ if (explicit !== null)
473
+ return explicit;
474
+ const isWebAppType = projectType === "nextjs" || projectType === "cf-pages";
475
+ return isWebAppType && hasWebUi === true;
476
+ }
244
477
  function inferParticipateInBulletin(brief, brand) {
245
478
  const text = brief.toLowerCase();
246
479
  if (/\bagent\s+coordination\b|\bbulletin\b/.test(text))
@@ -251,6 +484,92 @@ function inferParticipateInBulletin(brief, brand) {
251
484
  return false;
252
485
  return null;
253
486
  }
487
+ /**
488
+ * Heading-text aliases for each planning section. A brief heading is classified
489
+ * to a canonical field when its normalized text contains any of these phrases
490
+ * as a whole-word substring (so "Governing purpose" → purpose and
491
+ * "Phasing & rough timeline" → roadmap).
492
+ *
493
+ * This is the fix for the silent-miss defect (found 2026-06-28 on backup-engine,
494
+ * whose richly-named brief headings — "Governing purpose", "Phasing & rough
495
+ * timeline" — matched NONE of the original exact-prefix vocabulary, so ROADMAP.md
496
+ * and the README overview silently fell back to placeholders). Order matters:
497
+ * the first matching field wins per heading, and the first heading wins per
498
+ * field. Kept deliberately conservative — a heading that matches nothing here is
499
+ * simply skipped (its text is still preserved verbatim in PROJECT_BRIEF.md).
500
+ */
501
+ const SECTION_ALIASES = [
502
+ ["purpose", ["purpose", "overview", "objective", "mission", "what this is"]],
503
+ ["keyApis", ["key apis", "apis", "integrations"]],
504
+ ["dataSources", ["data sources", "data source", "sources"]],
505
+ ["expectedOutputs", ["expected outputs", "outputs", "deliverables"]],
506
+ ["edgeCases", [
507
+ "edge cases",
508
+ "gotchas",
509
+ "critical design requirements",
510
+ "design requirements",
511
+ "constraints",
512
+ ]],
513
+ ["roadmap", ["roadmap", "phasing", "phases", "timeline", "milestones"]],
514
+ ["futureImprovements", ["future improvements", "future work", "out of scope", "beyond"]],
515
+ ];
516
+ /** True when `phrase` appears in `haystack` on whole-word boundaries. */
517
+ function headingContainsPhrase(haystack, phrase) {
518
+ const re = new RegExp(`(?:^|[^a-z0-9])${escapeRegExp(phrase)}(?:[^a-z0-9]|$)`, "i");
519
+ return re.test(haystack);
520
+ }
521
+ /** Map a raw heading text to a canonical section field, or null if none fit. */
522
+ function classifyHeading(headingText) {
523
+ const norm = headingText.toLowerCase();
524
+ for (const [field, phrases] of SECTION_ALIASES) {
525
+ for (const phrase of phrases) {
526
+ if (headingContainsPhrase(norm, phrase))
527
+ return field;
528
+ }
529
+ }
530
+ return null;
531
+ }
532
+ /**
533
+ * Lift the free-text planning sections out of the brief so they can flow into
534
+ * the scaffolded ROADMAP.md + README.md (per [[instantiate-z2w-project]]
535
+ * SKILL Step 1a.4) instead of being discarded after field inference.
536
+ *
537
+ * Scans EVERY markdown heading (ATX `## Foo` and standalone bold `**Foo**`),
538
+ * classifies each by alias keyword, and bounds a section's body at the next
539
+ * heading of ANY kind. This tolerates real-world brief heading vocabulary
540
+ * rather than demanding the exact canonical words, and prevents one section's
541
+ * body from bleeding into the next when an unrecognized heading sits between
542
+ * them. Only sections actually present appear in the result; returns
543
+ * `undefined` when none are found (the wizard/`--input` shape).
544
+ */
545
+ export function extractBriefSections(brief) {
546
+ const headingRe = /^[ \t]*(?:#{1,6}[ \t]+(.+?)|\*\*(.+?)\*\*[ \t]*:?)[ \t]*$/gm;
547
+ const headings = [];
548
+ let m;
549
+ while ((m = headingRe.exec(brief)) !== null) {
550
+ const text = (m[1] ?? m[2] ?? "").replace(/:\s*$/, "").trim();
551
+ headings.push({
552
+ matchStart: m.index,
553
+ bodyStart: m.index + m[0].length,
554
+ field: classifyHeading(text),
555
+ });
556
+ }
557
+ const sections = {};
558
+ let found = false;
559
+ for (let i = 0; i < headings.length; i++) {
560
+ const h = headings[i];
561
+ // First heading wins per field — skip a field already captured.
562
+ if (h.field === null || sections[h.field] !== undefined)
563
+ continue;
564
+ const end = i + 1 < headings.length ? headings[i + 1].matchStart : brief.length;
565
+ const body = brief.slice(h.bodyStart, end).trim();
566
+ if (body.length > 0) {
567
+ sections[h.field] = body;
568
+ found = true;
569
+ }
570
+ }
571
+ return found ? sections : undefined;
572
+ }
254
573
  /**
255
574
  * Parse a pasted project-instantiation brief into a ParsedBrief. Every field
256
575
  * that cannot be inferred deterministically is left as `null` — the
@@ -276,11 +595,16 @@ export function parseBrief(brief) {
276
595
  hasWebUi: null,
277
596
  hasCron: null,
278
597
  participateInBulletin: null,
598
+ sendsEmail: false,
599
+ hasUserContent: false,
600
+ hasObservability: false,
601
+ briefSections: undefined,
279
602
  raw: brief,
280
603
  };
281
604
  }
282
605
  const brand = inferBrand(trimmed);
283
606
  const projectType = inferProjectType(trimmed);
607
+ const hasWebUi = inferHasWebUi(trimmed, projectType);
284
608
  return {
285
609
  slug: inferSlug(trimmed),
286
610
  description: inferDescription(trimmed),
@@ -289,9 +613,13 @@ export function parseBrief(brief) {
289
613
  githubOrg: inferGithubOrg(trimmed, brand),
290
614
  targetPath: inferTargetPath(trimmed),
291
615
  dbStrategy: inferDbStrategy(trimmed),
292
- hasWebUi: inferHasWebUi(trimmed, projectType),
616
+ hasWebUi,
293
617
  hasCron: inferHasCron(trimmed),
294
618
  participateInBulletin: inferParticipateInBulletin(trimmed, brand),
619
+ sendsEmail: inferSendsEmail(trimmed),
620
+ hasUserContent: inferHasUserContent(trimmed),
621
+ hasObservability: inferHasObservability(trimmed, projectType, hasWebUi),
622
+ briefSections: extractBriefSections(trimmed),
295
623
  raw: brief,
296
624
  };
297
625
  }
@@ -16,16 +16,39 @@ export declare function commonReadme(inputs: ScaffoldInputs, opts: ScaffolderOpt
16
16
  export declare function commonRoadmap(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): ScaffoldFile;
17
17
  export declare function commonStatus(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): ScaffoldFile;
18
18
  export declare function commonHandoff(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): ScaffoldFile;
19
+ /**
20
+ * Persist the verbatim instantiation brief into the repo at
21
+ * directives/PROJECT_BRIEF.md. Returns null for the wizard / `--input` paths
22
+ * that carry no brief text (nothing to persist). The body is the raw brief and
23
+ * is intentionally NOT run through the placeholder substituter, so a brief that
24
+ * happens to contain `{{token}}`-looking text is preserved exactly (only
25
+ * CLAUDE.md is validated for leftover markers — see writer.ts).
26
+ */
27
+ export declare function commonProjectBrief(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): ScaffoldFile | null;
19
28
  export declare function commonTroubleshooting(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): ScaffoldFile;
20
29
  export declare function commonChangelog(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): ScaffoldFile;
30
+ export declare function commonMarketing(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): ScaffoldFile;
31
+ export declare function commonBackups(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): ScaffoldFile;
21
32
  export declare function commonVersion(): ScaffoldFile;
22
33
  export declare function commonCursorignore(): ScaffoldFile;
23
34
  export declare function commonDirective(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): ScaffoldFile;
24
35
  /**
25
36
  * Per-type `.gitignore` body. Sources: skill's "Inline mini-templates"
26
- * section. Each variant is the verbatim block from there.
37
+ * section. Each variant is the verbatim block from there, plus the shared
38
+ * `GITIGNORE_SECRET_SCRATCH_BLOCK` appended to every type (so `.tmp/` and
39
+ * `.specstory/` are guaranteed present — see that constant's doc comment).
27
40
  */
28
41
  export declare function gitignoreFor(projectType: ScaffoldInputs["projectType"]): ScaffoldFile;
42
+ /**
43
+ * Derive a gitignored local env file (`.env.local` for nextjs, `.env` for
44
+ * python-service) from an already-substituted `.env.example` body. Keeps every
45
+ * key and its inline doc comments, clears assigned values so the user fills
46
+ * real ones, and swaps the example banner for a local-file banner. Emitted
47
+ * alongside `.env.example` so a fresh clone has the local file ready to fill
48
+ * rather than requiring a manual `cp .env.example .env.local` — closes the
49
+ * z2w-agent-command-center 2026-06-01 Open question.
50
+ */
51
+ export declare function localEnvFrom(exampleContent: string, filename: string, slug: string): string;
29
52
  /**
30
53
  * Common base files every scaffolded project gets — CLAUDE.md, README.md,
31
54
  * ROADMAP.md, STATUS.md, HANDOFF.md, TROUBLESHOOTING.md, CHANGELOG.md,
@@ -36,3 +59,21 @@ export declare function gitignoreFor(projectType: ScaffoldInputs["projectType"])
36
59
  * etc.) are appended by the per-type scaffolder.
37
60
  */
38
61
  export declare function commonBaseFiles(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, perTypeNarrative: string): ScaffoldFile[];
62
+ /** npm deps the mailer requires; merged into the scaffolded package.json. */
63
+ export declare const EMAIL_DEPS: Readonly<Record<string, string>>;
64
+ /**
65
+ * The env-var block appended to a scaffolded `.env.example` when the project
66
+ * sends email. Both providers' vars are stubbed so switching is a one-line env
67
+ * change with no code edit.
68
+ */
69
+ export declare const EMAIL_ENV_BLOCK = "\n# \u2500\u2500 Transactional / auth email (lib/email/mailer.ts) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n# Provider router. Default: Amazon SES. Set to \"resend\" to use Resend instead \u2014\n# no code change. See directives/email-setup.md + [[email-service-router]].\nEMAIL_PROVIDER=ses\n\n# Amazon SES (default). Custom SES_ prefix + explicit creds is deliberate: on\n# Vercel/Lambda the platform injects its own AWS_* that would shadow the default\n# credential chain. SES_REGION MUST equal the region the sender domain is\n# verified in, or sends fail with \"Email address is not verified\".\nSES_REGION=\nSES_ACCESS_KEY_ID=\nSES_SECRET_ACCESS_KEY=\n# From address. A domain-verified identity can send from any local-part.\n# Format: \"Brand Name <sender@yourdomain.com>\". Never noreply@.\nAWS_SES_FROM=\n\n# Resend (swappable alternative \u2014 only read when EMAIL_PROVIDER=resend).\n# RESEND_FROM must be on a Resend-verified domain.\nRESEND_API_KEY=\nRESEND_FROM=\n";
70
+ /**
71
+ * Build the email-wiring files for a scaffold that sends email. \`layout\`
72
+ * selects the file paths + whether a vitest test is emitted:
73
+ * - "nextjs" → \`lib/email/mailer.ts\` (imported via the \`@/*\` alias); no
74
+ * test file (the nextjs scaffold ships no test runner).
75
+ * - "node-service" → \`src/lib/email/mailer.ts\` + \`src/lib/email/mailer.test.ts\`
76
+ * (vitest picks up \`src/**\/*.test.ts\`).
77
+ * The directive is emitted for both.
78
+ */
79
+ export declare function emailFiles(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec, layout: "nextjs" | "node-service"): ScaffoldFile[];