@zero2webmaster/starter-kit 0.2.1 → 0.3.1
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 +12 -14
- package/dist/airtable.d.ts +119 -0
- package/dist/airtable.js +273 -0
- package/dist/cli.js +116 -18
- package/dist/confirm.d.ts +5 -4
- package/dist/confirm.js +41 -29
- package/dist/index.d.ts +179 -6
- package/dist/index.js +155 -6
- package/dist/inventory.d.ts +137 -0
- package/dist/inventory.js +258 -0
- package/dist/license.js +8 -6
- package/dist/parse-brief.d.ts +28 -2
- package/dist/parse-brief.js +151 -16
- package/dist/scaffolders/cf-worker.js +2 -2
- package/dist/scaffolders/common.d.ts +30 -1
- package/dist/scaffolders/common.js +538 -21
- package/dist/scaffolders/index.d.ts +1 -0
- package/dist/scaffolders/index.js +3 -0
- package/dist/scaffolders/library.js +26 -2
- package/dist/scaffolders/nextjs.d.ts +1 -1
- package/dist/scaffolders/nextjs.js +250 -24
- package/dist/scaffolders/node-service.d.ts +3 -0
- package/dist/scaffolders/node-service.js +320 -0
- package/dist/scaffolders/pro-seo-extension.js +1 -1
- package/dist/scaffolders/python-service.js +5 -2
- package/dist/standards.d.ts +1 -1
- package/dist/standards.js +123 -3
- package/dist/substitute.d.ts +14 -3
- package/dist/substitute.js +8 -5
- package/dist/summary.d.ts +9 -0
- package/dist/summary.js +27 -10
- package/dist/templates.d.ts +43 -57
- package/dist/templates.js +108 -175
- package/dist/with-init.d.ts +18 -2
- package/dist/with-init.js +105 -16
- package/dist/wizard.js +21 -0
- package/dist/writer.d.ts +3 -5
- package/dist/writer.js +88 -15
- package/package.json +2 -1
package/dist/with-init.js
CHANGED
|
@@ -1,26 +1,78 @@
|
|
|
1
|
-
// z2w-starter-kit
|
|
1
|
+
// z2w-starter-kit automatic GitHub-repo setup.
|
|
2
2
|
//
|
|
3
3
|
// After a successful scaffold, runs:
|
|
4
|
-
// git init
|
|
4
|
+
// git init -b main
|
|
5
|
+
// git config user.email "kerry@zero2webmaster.com" (repo-local)
|
|
5
6
|
// git add .
|
|
6
|
-
// git commit -m "Initial scaffold via @zero2webmaster/starter-kit"
|
|
7
|
-
// gh repo create {githubOrg}/{slug} --private --source=. --remote=origin
|
|
8
|
-
//
|
|
7
|
+
// git commit -m "Initial scaffold via @zero2webmaster/starter-kit (<slug>)"
|
|
8
|
+
// gh repo create {githubOrg}/{slug} --private --source=. --remote=origin --push [--description "…"]
|
|
9
|
+
// gh repo edit {githubOrg}/{slug} --add-topic … (non-fatal — cosmetic)
|
|
9
10
|
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
11
|
+
// As of the 2026-06-16 Track D decision (STATUS.md → Decisions), this is a
|
|
12
|
+
// DEFAULT side-effect of `init`, not a paid opt-in. It runs for the interactive
|
|
13
|
+
// brief-first / --wizard flows unless `--no-repo` is passed; it is SKIPPED for
|
|
14
|
+
// --dry-run and for the non-interactive --input (CI) path, which only print the
|
|
15
|
+
// would-be commands. This OVERRIDES CLAUDE.md Operating Principle #3 for repo
|
|
16
|
+
// creation specifically; every other side-effect (npm install, composer
|
|
17
|
+
// install, ln -s, …) stays surfaced-only. The exported names retain the
|
|
18
|
+
// `WithInit` prefix from when repo creation was the body of the retired paid
|
|
19
|
+
// `--with-init` flag — the chain is the same, only the gating changed.
|
|
20
|
+
//
|
|
21
|
+
// `runWithInit` THROWS on a hard failure (git/gh missing, non-zero exit). The
|
|
22
|
+
// caller (src/cli.ts) wraps it in warn-and-proceed so a failed repo setup never
|
|
23
|
+
// fails the scaffold — the files are already written; the manual fallback
|
|
24
|
+
// commands are surfaced instead (mirrors the Airtable-row warn-and-proceed
|
|
25
|
+
// posture). The repo-local `user.email` is the Vercel-Hobby commit-author
|
|
26
|
+
// workaround per [[z2w-magic-link-auth]] §8.
|
|
13
27
|
//
|
|
14
28
|
// `gh` is invoked, not the GitHub REST API, so the user's existing
|
|
15
|
-
// `gh auth login` credentials are honored (no token plumbing required).
|
|
16
|
-
// CLI surfaces clear errors when `gh` is missing or unauthenticated.
|
|
29
|
+
// `gh auth login` credentials are honored (no token plumbing required).
|
|
17
30
|
import { spawn } from "node:child_process";
|
|
31
|
+
const REPO_COMMIT_AUTHOR_EMAIL = "kerry@zero2webmaster.com";
|
|
32
|
+
const MAX_DESCRIPTION_LENGTH = 140;
|
|
18
33
|
export class WithInitError extends Error {
|
|
19
34
|
constructor(message) {
|
|
20
35
|
super(message);
|
|
21
36
|
this.name = "WithInitError";
|
|
22
37
|
}
|
|
23
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Build the repo's GitHub `--description` (the "About" blurb). Prefers the
|
|
41
|
+
* brief's Purpose section when scaffolding from a brief, else the project
|
|
42
|
+
* description. Collapses whitespace/newlines to a single line and caps the
|
|
43
|
+
* length so a multi-paragraph Purpose doesn't become an unwieldy blurb.
|
|
44
|
+
* Returns `null` when there's nothing meaningful to set.
|
|
45
|
+
*/
|
|
46
|
+
export function repoDescription(inputs) {
|
|
47
|
+
const source = inputs.briefSections?.purpose?.trim() || inputs.description?.trim() || "";
|
|
48
|
+
const collapsed = source.replace(/\s+/g, " ").trim();
|
|
49
|
+
if (collapsed.length === 0)
|
|
50
|
+
return null;
|
|
51
|
+
if (collapsed.length <= MAX_DESCRIPTION_LENGTH)
|
|
52
|
+
return collapsed;
|
|
53
|
+
return collapsed.slice(0, MAX_DESCRIPTION_LENGTH - 1).trimEnd() + "…";
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build the repo's GitHub topics: the project type plus the brand preset
|
|
57
|
+
* (skipping `custom`, which isn't a meaningful public topic). Lowercased,
|
|
58
|
+
* de-duplicated, and order-stable. Topic strings from the enums are already
|
|
59
|
+
* GitHub-legal (lowercase, hyphenated).
|
|
60
|
+
*/
|
|
61
|
+
export function repoTopics(inputs) {
|
|
62
|
+
const candidates = [inputs.projectType, inputs.brand === "custom" ? null : inputs.brand];
|
|
63
|
+
const seen = new Set();
|
|
64
|
+
const topics = [];
|
|
65
|
+
for (const c of candidates) {
|
|
66
|
+
if (c === null)
|
|
67
|
+
continue;
|
|
68
|
+
const t = c.toLowerCase();
|
|
69
|
+
if (seen.has(t))
|
|
70
|
+
continue;
|
|
71
|
+
seen.add(t);
|
|
72
|
+
topics.push(t);
|
|
73
|
+
}
|
|
74
|
+
return topics;
|
|
75
|
+
}
|
|
24
76
|
function runCommand(command, args, cwd, spawnImpl) {
|
|
25
77
|
return new Promise((resolve, reject) => {
|
|
26
78
|
const child = spawnImpl(command, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
@@ -55,8 +107,31 @@ async function step(label, command, args, cwd, spawnImpl, stdout) {
|
|
|
55
107
|
return result;
|
|
56
108
|
}
|
|
57
109
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
110
|
+
* Like {@link step}, but a failure (missing binary or non-zero exit) is
|
|
111
|
+
* surfaced as a warning and swallowed rather than thrown. Used for the
|
|
112
|
+
* topics step — the repo + push already succeeded by then, so a topic-edit
|
|
113
|
+
* hiccup must not unwind the whole setup.
|
|
114
|
+
*/
|
|
115
|
+
async function stepNonFatal(label, command, args, cwd, spawnImpl, stdout) {
|
|
116
|
+
stdout.write(`\n ${label}: ${command} ${args.join(" ")}\n`);
|
|
117
|
+
try {
|
|
118
|
+
const result = await runCommand(command, args, cwd, spawnImpl);
|
|
119
|
+
if (result.code !== 0) {
|
|
120
|
+
const detail = (result.stderr || result.stdout || "").trim();
|
|
121
|
+
stdout.write(` (skipped: ${label} exited ${result.code}${detail ? ` — ${detail}` : ""})\n`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
const message = err.code === "ENOENT"
|
|
126
|
+
? `${command} not on PATH`
|
|
127
|
+
: err.message;
|
|
128
|
+
stdout.write(` (skipped: ${label} — ${message})\n`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Runs the post-scaffold git + gh chain that creates the private GitHub repo.
|
|
133
|
+
* THROWS {@link WithInitError} on a hard failure; the caller decides whether to
|
|
134
|
+
* warn-and-proceed (it does — see src/cli.ts).
|
|
60
135
|
*/
|
|
61
136
|
export async function runWithInit(inputs, targetPath, opts = {}) {
|
|
62
137
|
const stdout = opts.stdout ?? process.stdout;
|
|
@@ -64,11 +139,14 @@ export async function runWithInit(inputs, targetPath, opts = {}) {
|
|
|
64
139
|
const spawnImpl = opts.spawnImpl ?? spawn;
|
|
65
140
|
const repoRef = `${inputs.githubOrg}/${inputs.slug}`;
|
|
66
141
|
const commitMessage = `Initial scaffold via @zero2webmaster/starter-kit (${inputs.slug})`;
|
|
67
|
-
|
|
142
|
+
const description = repoDescription(inputs);
|
|
143
|
+
const topics = repoTopics(inputs);
|
|
144
|
+
stdout.write(`\nSetting up the private GitHub repo ${repoRef} ...\n`);
|
|
68
145
|
await step("git init", "git", ["init", "-b", "main"], targetPath, spawnImpl, stdout);
|
|
146
|
+
await step("git config user.email", "git", ["config", "user.email", REPO_COMMIT_AUTHOR_EMAIL], targetPath, spawnImpl, stdout);
|
|
69
147
|
await step("git add", "git", ["add", "."], targetPath, spawnImpl, stdout);
|
|
70
148
|
await step("git commit", "git", ["commit", "-m", commitMessage], targetPath, spawnImpl, stdout);
|
|
71
|
-
|
|
149
|
+
const createArgs = [
|
|
72
150
|
"repo",
|
|
73
151
|
"create",
|
|
74
152
|
repoRef,
|
|
@@ -76,7 +154,18 @@ export async function runWithInit(inputs, targetPath, opts = {}) {
|
|
|
76
154
|
"--source=.",
|
|
77
155
|
"--remote=origin",
|
|
78
156
|
"--push",
|
|
79
|
-
]
|
|
80
|
-
|
|
157
|
+
];
|
|
158
|
+
if (description !== null) {
|
|
159
|
+
createArgs.push("--description", description);
|
|
160
|
+
}
|
|
161
|
+
await step("gh repo create", "gh", createArgs, targetPath, spawnImpl, stdout);
|
|
162
|
+
if (topics.length > 0) {
|
|
163
|
+
const editArgs = ["repo", "edit", repoRef];
|
|
164
|
+
for (const t of topics) {
|
|
165
|
+
editArgs.push("--add-topic", t);
|
|
166
|
+
}
|
|
167
|
+
await stepNonFatal("gh repo edit (topics)", "gh", editArgs, targetPath, spawnImpl, stdout);
|
|
168
|
+
}
|
|
169
|
+
stdout.write(`\nRepo ready: https://github.com/${repoRef} (private) — scaffold committed and pushed.\n`);
|
|
81
170
|
stderr; // (touch: stderr is reserved for future surfacing)
|
|
82
171
|
}
|
package/dist/wizard.js
CHANGED
|
@@ -138,6 +138,24 @@ export async function runWizard(opts) {
|
|
|
138
138
|
const hasWebUi = await askValidated(prompter, "8a. Has web UI (yes/no):", parseYesNo, undefined, out);
|
|
139
139
|
const hasCron = await askValidated(prompter, "8b. Has cron / scheduled jobs (yes/no):", parseYesNo, undefined, out);
|
|
140
140
|
const participateInBulletin = await askValidated(prompter, "8c. Participate in agent bulletin (yes/no):", parseYesNo, brand === "zero2webmaster" ? "yes" : "no", out);
|
|
141
|
+
// Only nextjs / node-service honor this; other types use FluentSMTP (WP) or
|
|
142
|
+
// the Cloudflare Email Service (Workers). Default no — the mailer pulls in the
|
|
143
|
+
// AWS/Resend SDKs, so we only emit it when the app actually sends email.
|
|
144
|
+
const sendsEmail = await askValidated(prompter, "8d. Sends transactional / auth email (yes/no):", parseYesNo, "no", out);
|
|
145
|
+
// Gates the [[moderation-system]] standard. Default no — only relevant for
|
|
146
|
+
// apps whose users post content others see (community, events, marketplace,
|
|
147
|
+
// profiles, DMs). Skipped downstream for wp-plugin / library / protocol-repo.
|
|
148
|
+
const hasUserContent = await askValidated(prompter, "8e. Accepts user-generated content (yes/no):", parseYesNo, "no", out);
|
|
149
|
+
// Gates the [[sentry-runtime-errors]] standard. Default YES for customer-facing
|
|
150
|
+
// web apps (nextjs / cf-pages + web UI) — Sentry's free tier covers Z2W-scale
|
|
151
|
+
// projects and the org default is "wire runtime-error tracking at instantiation
|
|
152
|
+
// for apps with real users." Default NO otherwise (Workers / services / CLI /
|
|
153
|
+
// WP have no per-user request surface the Next.js wizard fits). Downstream the
|
|
154
|
+
// standard only inserts for nextjs / cf-pages regardless.
|
|
155
|
+
const observabilityDefault = (projectType === "nextjs" || projectType === "cf-pages") && hasWebUi
|
|
156
|
+
? "yes"
|
|
157
|
+
: "no";
|
|
158
|
+
const hasObservability = await askValidated(prompter, "8f. Wire Sentry runtime-error tracking (yes/no):", parseYesNo, observabilityDefault, out);
|
|
141
159
|
const result = {
|
|
142
160
|
slug,
|
|
143
161
|
description,
|
|
@@ -149,6 +167,9 @@ export async function runWizard(opts) {
|
|
|
149
167
|
hasWebUi,
|
|
150
168
|
hasCron,
|
|
151
169
|
participateInBulletin,
|
|
170
|
+
sendsEmail,
|
|
171
|
+
hasUserContent,
|
|
172
|
+
hasObservability,
|
|
152
173
|
};
|
|
153
174
|
if (customBrand) {
|
|
154
175
|
result.customBrand = customBrand;
|
package/dist/writer.d.ts
CHANGED
|
@@ -15,12 +15,10 @@ export interface WriteScaffoldOptions {
|
|
|
15
15
|
showContents?: boolean;
|
|
16
16
|
/** When true (default), refuse to write into a non-empty target directory. */
|
|
17
17
|
refuseNonEmpty?: boolean;
|
|
18
|
-
/** Forwarded to {@link
|
|
18
|
+
/** Forwarded to {@link resolveAgentsTemplate}; tests pin this at a sandbox. */
|
|
19
19
|
templatesPath?: string;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/** Overrides for the Templates resolver (mirror URL, cache dir, fetch, clock, onWarn). Tests. */
|
|
23
|
-
templatesOverrides?: Omit<ReadTemplateOptions, "templatesPath" | "refreshTemplates">;
|
|
20
|
+
/** Overrides for the Templates resolver (onWarn). Tests. */
|
|
21
|
+
templatesOverrides?: Omit<ReadTemplateOptions, "templatesPath">;
|
|
24
22
|
/** When true, run the interactive (a) inline / (b) promote dialog per standard. */
|
|
25
23
|
promoteStandards?: boolean;
|
|
26
24
|
/** Forwarded to {@link resolveStandards} + {@link scaffoldByType}; date pin. */
|
package/dist/writer.js
CHANGED
|
@@ -27,7 +27,7 @@ import { AGENTS_BODY_MARKER, STANDARDS_BLOCK_MARKER, } from "./scaffolders/commo
|
|
|
27
27
|
import { buildProSeoExtension, proSeoApplies, } from "./scaffolders/pro-seo-extension.js";
|
|
28
28
|
import { scaffoldByType } from "./scaffolders/index.js";
|
|
29
29
|
import { applyStandardsBlock, resolveStandards, } from "./standards.js";
|
|
30
|
-
import {
|
|
30
|
+
import { resolveAgentsTemplate, } from "./templates.js";
|
|
31
31
|
export class WriterError extends Error {
|
|
32
32
|
constructor(message) {
|
|
33
33
|
super(message);
|
|
@@ -35,11 +35,6 @@ export class WriterError extends Error {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
const PROMOTIONS_FILE = "STANDARDS_PROMOTIONS.md";
|
|
38
|
-
function agentsTemplateNameFor(inputs) {
|
|
39
|
-
return inputs.projectType === "wp-plugin"
|
|
40
|
-
? "AGENTS_WP_v3.1.0.md"
|
|
41
|
-
: "AGENTS_v2.13.0.md";
|
|
42
|
-
}
|
|
43
38
|
/**
|
|
44
39
|
* Split a standards body into preamble + per-standard sections so the writer
|
|
45
40
|
* can drop sections the user picked (b) for during the promotion dialog.
|
|
@@ -189,8 +184,17 @@ export async function writeScaffold(inputs, targetPath, opts = {}) {
|
|
|
189
184
|
throw new WriterError(`targetPath must be absolute. Got: ${JSON.stringify(targetPath)}.`);
|
|
190
185
|
}
|
|
191
186
|
const resolvedTarget = path.resolve(targetPath);
|
|
187
|
+
// Resolve the canonical AGENTS body FIRST — its filename is the single source
|
|
188
|
+
// of truth for {{framework_version}}, which Layer 1 substitutes into the
|
|
189
|
+
// scaffolded files. Discovered by glob on the local path so a canonical
|
|
190
|
+
// filename bump flows through with no code change.
|
|
191
|
+
const agentsKind = inputs.projectType === "wp-plugin" ? "wp" : "general";
|
|
192
|
+
const { content: agentsBody, version: frameworkVersion, } = await resolveAgentsTemplate(agentsKind, {
|
|
193
|
+
templatesPath: opts.templatesPath,
|
|
194
|
+
...(opts.templatesOverrides ?? {}),
|
|
195
|
+
});
|
|
192
196
|
// Layer 1 — per-type scaffolder output.
|
|
193
|
-
const files = scaffoldByType(inputs, { date: opts.date });
|
|
197
|
+
const files = scaffoldByType(inputs, { date: opts.date, frameworkVersion });
|
|
194
198
|
// Layer 2 — standards resolver.
|
|
195
199
|
let resolution = resolveStandards(inputs, {
|
|
196
200
|
promoteStandards,
|
|
@@ -205,14 +209,7 @@ export async function writeScaffold(inputs, targetPath, opts = {}) {
|
|
|
205
209
|
resolution = dialog.resolution;
|
|
206
210
|
promotions = dialog.promotions;
|
|
207
211
|
}
|
|
208
|
-
//
|
|
209
|
-
const agentsName = agentsTemplateNameFor(inputs);
|
|
210
|
-
const { content: agentsBody } = await readTemplateWithFallback(agentsName, {
|
|
211
|
-
templatesPath: opts.templatesPath,
|
|
212
|
-
refreshTemplates: opts.refreshTemplates,
|
|
213
|
-
...(opts.templatesOverrides ?? {}),
|
|
214
|
-
});
|
|
215
|
-
// Compose CLAUDE.md by filling both markers.
|
|
212
|
+
// Compose CLAUDE.md by filling both markers (AGENTS body resolved up top).
|
|
216
213
|
const claudeIdx = files.findIndex((f) => f.path === "CLAUDE.md");
|
|
217
214
|
if (claudeIdx === -1) {
|
|
218
215
|
throw new WriterError(`Internal error: scaffoldByType output for projectType=${inputs.projectType} did not include CLAUDE.md.`);
|
|
@@ -373,6 +370,82 @@ export function parseScaffoldInputs(json) {
|
|
|
373
370
|
accentColor: cbo["accentColor"],
|
|
374
371
|
};
|
|
375
372
|
}
|
|
373
|
+
// Optional: whether this project sends transactional / auth email. Defaults
|
|
374
|
+
// to false (no mailer). Honored only by nextjs / node-service scaffolders.
|
|
375
|
+
if (obj["sendsEmail"] !== undefined) {
|
|
376
|
+
if (typeof obj["sendsEmail"] !== "boolean") {
|
|
377
|
+
throw new WriterError(`--input field "sendsEmail" must be a boolean, got ${typeof obj["sendsEmail"]}.`);
|
|
378
|
+
}
|
|
379
|
+
inputs.sendsEmail = obj["sendsEmail"];
|
|
380
|
+
}
|
|
381
|
+
// Optional: whether this project accepts user-generated content. Defaults to
|
|
382
|
+
// false (no moderation standard). Gates the [[moderation-system]] standard for
|
|
383
|
+
// non-WP app types (skipped for wp-plugin / library / protocol-repo).
|
|
384
|
+
if (obj["hasUserContent"] !== undefined) {
|
|
385
|
+
if (typeof obj["hasUserContent"] !== "boolean") {
|
|
386
|
+
throw new WriterError(`--input field "hasUserContent" must be a boolean, got ${typeof obj["hasUserContent"]}.`);
|
|
387
|
+
}
|
|
388
|
+
inputs.hasUserContent = obj["hasUserContent"];
|
|
389
|
+
}
|
|
390
|
+
// Optional: whether to wire Sentry runtime-error/APM observability. Defaults
|
|
391
|
+
// to false on the --input path (opt-in / explicit for CI + programmatic
|
|
392
|
+
// callers; the interactive flows apply the customer-facing smart default
|
|
393
|
+
// instead). Gates the [[sentry-runtime-errors]] standard for nextjs / cf-pages.
|
|
394
|
+
if (obj["hasObservability"] !== undefined) {
|
|
395
|
+
if (typeof obj["hasObservability"] !== "boolean") {
|
|
396
|
+
throw new WriterError(`--input field "hasObservability" must be a boolean, got ${typeof obj["hasObservability"]}.`);
|
|
397
|
+
}
|
|
398
|
+
inputs.hasObservability = obj["hasObservability"];
|
|
399
|
+
}
|
|
400
|
+
// Optional: the verbatim instantiation prompt, recorded on the Airtable row.
|
|
401
|
+
// The --input path has no brief to capture, so callers may supply it here;
|
|
402
|
+
// when omitted, the Airtable write reminds the agent to add it by hand.
|
|
403
|
+
if (obj["instantiationPrompt"] !== undefined) {
|
|
404
|
+
if (typeof obj["instantiationPrompt"] !== "string") {
|
|
405
|
+
throw new WriterError(`--input field "instantiationPrompt" must be a string, got ${typeof obj["instantiationPrompt"]}.`);
|
|
406
|
+
}
|
|
407
|
+
inputs.instantiationPrompt = obj["instantiationPrompt"];
|
|
408
|
+
}
|
|
409
|
+
// Optional: brief planning sections (purpose / roadmap / future improvements /
|
|
410
|
+
// …). The interactive brief-first flow populates these via
|
|
411
|
+
// `extractBriefSections`; the `--input` path has no brief to parse, so a
|
|
412
|
+
// caller that HAS the brief content (e.g. a bootstrap builder that embedded
|
|
413
|
+
// the brief as `instantiationPrompt`) may pass the pre-sliced sections here.
|
|
414
|
+
// Without this, every `--input`-scaffolded project falls to a placeholder
|
|
415
|
+
// ROADMAP even when the brief content is available (see STATUS Tech Debt,
|
|
416
|
+
// found 2026-07-01 during the home-systems bootstrap).
|
|
417
|
+
if (obj["briefSections"] !== undefined) {
|
|
418
|
+
const bs = obj["briefSections"];
|
|
419
|
+
if (bs === null || typeof bs !== "object" || Array.isArray(bs)) {
|
|
420
|
+
throw new WriterError(`--input field "briefSections" must be an object, got ${Array.isArray(bs) ? "array" : typeof bs}.`);
|
|
421
|
+
}
|
|
422
|
+
const bso = bs;
|
|
423
|
+
const BRIEF_SECTION_KEYS = [
|
|
424
|
+
"purpose",
|
|
425
|
+
"keyApis",
|
|
426
|
+
"dataSources",
|
|
427
|
+
"expectedOutputs",
|
|
428
|
+
"edgeCases",
|
|
429
|
+
"roadmap",
|
|
430
|
+
"futureImprovements",
|
|
431
|
+
];
|
|
432
|
+
const sections = {};
|
|
433
|
+
for (const key of BRIEF_SECTION_KEYS) {
|
|
434
|
+
const v = bso[key];
|
|
435
|
+
if (v === undefined)
|
|
436
|
+
continue;
|
|
437
|
+
if (typeof v !== "string") {
|
|
438
|
+
throw new WriterError(`--input briefSections.${key} must be a string, got ${typeof v}.`);
|
|
439
|
+
}
|
|
440
|
+
sections[key] = v;
|
|
441
|
+
}
|
|
442
|
+
// Only attach when at least one known section was supplied — an empty or
|
|
443
|
+
// unknown-keys-only object stays undefined so the scaffolder's
|
|
444
|
+
// placeholder-vs-concrete branch behaves exactly as the no-brief path.
|
|
445
|
+
if (Object.keys(sections).length > 0) {
|
|
446
|
+
inputs.briefSections = sections;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
376
449
|
return inputs;
|
|
377
450
|
}
|
|
378
451
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zero2webmaster/starter-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Dr. Kerry Kriger",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@inquirer/prompts": "^7.0.0",
|
|
44
|
+
"@neondatabase/serverless": "^1.1.0",
|
|
44
45
|
"chalk": "^5.3.0",
|
|
45
46
|
"commander": "^15.0.0",
|
|
46
47
|
"fs-extra": "^11.2.0"
|