@zero2webmaster/starter-kit 0.2.0 → 0.2.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 +4 -3
- package/dist/brief.d.ts +2 -2
- package/dist/brief.js +11 -4
- package/dist/cli.js +186 -11
- package/dist/confirm.d.ts +11 -0
- package/dist/confirm.js +27 -5
- package/dist/index.d.ts +20 -1
- package/dist/index.js +1 -1
- package/dist/license.d.ts +97 -0
- package/dist/license.js +472 -0
- package/dist/parse-brief.d.ts +19 -1
- package/dist/parse-brief.js +213 -20
- package/dist/scaffolders/common.d.ts +13 -1
- package/dist/scaffolders/common.js +217 -11
- package/dist/scaffolders/nextjs.js +6 -2
- package/dist/scaffolders/pro-seo-extension.d.ts +11 -0
- package/dist/scaffolders/pro-seo-extension.js +782 -0
- package/dist/scaffolders/python-service.js +6 -1
- package/dist/scaffolders/wp-plugin.js +8 -8
- package/dist/standards.d.ts +1 -1
- package/dist/standards.js +41 -2
- package/dist/substitute.d.ts +8 -0
- package/dist/substitute.js +11 -0
- package/dist/summary.js +4 -3
- package/dist/with-init.d.ts +16 -0
- package/dist/with-init.js +82 -0
- package/dist/writer.d.ts +10 -1
- package/dist/writer.js +31 -6
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// check is needed, add a `/health/deep` per the neon-careful pattern.
|
|
7
7
|
//
|
|
8
8
|
// NOT subject to SEO baseline (API-only service, no public HTML surface).
|
|
9
|
-
import { commonBaseFiles, resolveBrandSpec, sub, } from "./common.js";
|
|
9
|
+
import { commonBaseFiles, localEnvFrom, resolveBrandSpec, sub, } from "./common.js";
|
|
10
10
|
const NARRATIVE = `## What this is
|
|
11
11
|
|
|
12
12
|
\`{{slug}}\` is a Python FastAPI service scaffolded under the {{brand_name}} brand. API-only — no public HTML surface, no SEO baseline.
|
|
@@ -139,5 +139,10 @@ export function scaffoldPythonService(inputs, opts) {
|
|
|
139
139
|
},
|
|
140
140
|
{ path: ".env.example", content: sub(ENV_EXAMPLE_TEMPLATE, inputs, opts, spec) },
|
|
141
141
|
];
|
|
142
|
+
// Python's local-env convention is `.env` (gitignored), not `.env.local`.
|
|
143
|
+
typeSpecific.push({
|
|
144
|
+
path: ".env",
|
|
145
|
+
content: localEnvFrom(sub(ENV_EXAMPLE_TEMPLATE, inputs, opts, spec), ".env"),
|
|
146
|
+
});
|
|
142
147
|
return [...base, ...typeSpecific];
|
|
143
148
|
}
|
|
@@ -53,14 +53,14 @@ if (!defined('ABSPATH')) {
|
|
|
53
53
|
exit;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
define('{{
|
|
57
|
-
define('{{
|
|
58
|
-
define('{{
|
|
59
|
-
define('{{
|
|
60
|
-
define('{{
|
|
56
|
+
define('{{slug_const}}_VERSION', '{{version}}');
|
|
57
|
+
define('{{slug_const}}_FILE', __FILE__);
|
|
58
|
+
define('{{slug_const}}_PATH', plugin_dir_path(__FILE__));
|
|
59
|
+
define('{{slug_const}}_URL', plugin_dir_url(__FILE__));
|
|
60
|
+
define('{{slug_const}}_SLUG', '{{slug}}');
|
|
61
61
|
|
|
62
|
-
require_once {{
|
|
63
|
-
require_once {{
|
|
62
|
+
require_once {{slug_const}}_PATH . 'includes/class-{{slug}}-activator.php';
|
|
63
|
+
require_once {{slug_const}}_PATH . 'includes/class-{{slug}}-module-loader.php';
|
|
64
64
|
|
|
65
65
|
register_activation_hook(__FILE__, ['{{slug_camel}}_Activator', 'activate']);
|
|
66
66
|
|
|
@@ -185,7 +185,7 @@ class {{slug_camel}}_Activator {
|
|
|
185
185
|
// dbDelta($sql);
|
|
186
186
|
|
|
187
187
|
// Bump a version option so future activations can run migrations.
|
|
188
|
-
update_option('{{slug_under}}_version', {{
|
|
188
|
+
update_option('{{slug_under}}_version', {{slug_const}}_VERSION);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
`;
|
package/dist/standards.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProjectType, ScaffoldInputs } from "./index.js";
|
|
2
2
|
import { type SubstitutionOptions } from "./substitute.js";
|
|
3
|
-
export type StandardKey = "portable-stack" | "fathom" | "uptime-kuma" | "neon-careful" | "agent-coordination" | "seo-baseline" | "email-service" | "text-size";
|
|
3
|
+
export type StandardKey = "skill-vault" | "portable-stack" | "fathom" | "uptime-kuma" | "neon-careful" | "agent-coordination" | "seo-baseline" | "email-service" | "text-size";
|
|
4
4
|
export type StandardDecisionState = "inserted-inline" | "skipped-not-applicable";
|
|
5
5
|
export interface StandardDecision {
|
|
6
6
|
key: StandardKey;
|
package/dist/standards.js
CHANGED
|
@@ -7,8 +7,13 @@
|
|
|
7
7
|
// [[instantiate-z2w-project]] skill v1.1.0 Step 6.
|
|
8
8
|
//
|
|
9
9
|
// Standards covered (per skill v1.1.0, including the 2026-05-30 SEO baseline
|
|
10
|
-
// + email-service-router additions):
|
|
10
|
+
// + email-service-router additions, and the 2026-06-15 skill-vault addition):
|
|
11
11
|
//
|
|
12
|
+
// - skill-vault — always (Z2W standing org rule); rendered FIRST so
|
|
13
|
+
// every scaffolded project knows the Skill Vault path
|
|
14
|
+
// before any other standard (Kerry directive 2026-06-15:
|
|
15
|
+
// "skill vault awareness should always come first … unless
|
|
16
|
+
// more important issues exist")
|
|
12
17
|
// - portable-stack — always for non-WP types
|
|
13
18
|
// - fathom — if hasWebUi=true
|
|
14
19
|
// - uptime-kuma — any deploy target (cf-worker, cf-pages, nextjs, python-service)
|
|
@@ -22,8 +27,14 @@
|
|
|
22
27
|
// The Step 6 writer composes this resolver's output with the per-type scaffolder
|
|
23
28
|
// output by `.replace()`ing the marker.
|
|
24
29
|
import { applySubstitutions } from "./substitute.js";
|
|
25
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Order standards appear in the rendered body + the decisions log.
|
|
32
|
+
* `skill-vault` is intentionally FIRST (Kerry directive 2026-06-15): every
|
|
33
|
+
* scaffolded project should know the Skill Vault location before anything else,
|
|
34
|
+
* "unless more important issues exist" — which the body text defers to.
|
|
35
|
+
*/
|
|
26
36
|
const STANDARD_ORDER = [
|
|
37
|
+
"skill-vault",
|
|
27
38
|
"portable-stack",
|
|
28
39
|
"fathom",
|
|
29
40
|
"uptime-kuma",
|
|
@@ -34,6 +45,7 @@ const STANDARD_ORDER = [
|
|
|
34
45
|
"text-size",
|
|
35
46
|
];
|
|
36
47
|
const TITLES = {
|
|
48
|
+
"skill-vault": "Skill Vault awareness",
|
|
37
49
|
"portable-stack": "Portable-stack defaults (non-WP)",
|
|
38
50
|
fathom: "Fathom analytics",
|
|
39
51
|
"uptime-kuma": "Uptime Kuma monitor",
|
|
@@ -64,6 +76,16 @@ function checkPortableStack(inputs) {
|
|
|
64
76
|
};
|
|
65
77
|
}
|
|
66
78
|
function checkFathom(inputs) {
|
|
79
|
+
// WordPress sites get Fathom via the Fathom WP plugin, NOT the env-var
|
|
80
|
+
// client-script pattern this standards block describes. A wp-plugin with an
|
|
81
|
+
// admin UI sets hasWebUi=true, so gate on the type explicitly (2026-06-03
|
|
82
|
+
// dogfood finding #6 — Fathom was wrongly inserted for a wp-plugin scaffold).
|
|
83
|
+
if (inputs.projectType === "wp-plugin") {
|
|
84
|
+
return {
|
|
85
|
+
applies: false,
|
|
86
|
+
reason: "wp-plugin uses the Fathom WP plugin, not the env-var client script",
|
|
87
|
+
};
|
|
88
|
+
}
|
|
67
89
|
if (!inputs.hasWebUi) {
|
|
68
90
|
return { applies: false, reason: "hasWebUi=false — no analytics surface" };
|
|
69
91
|
}
|
|
@@ -141,6 +163,12 @@ function checkEmailService(inputs) {
|
|
|
141
163
|
function checkTextSize() {
|
|
142
164
|
return { applies: true, reason: "Z2W standing org rule — applies to every project" };
|
|
143
165
|
}
|
|
166
|
+
function checkSkillVault() {
|
|
167
|
+
return {
|
|
168
|
+
applies: true,
|
|
169
|
+
reason: "Z2W standing org rule — every project agent should know the Skill Vault path",
|
|
170
|
+
};
|
|
171
|
+
}
|
|
144
172
|
/**
|
|
145
173
|
* Fathom env var name per framework. Mirrors skill v1.1.0's Step 6 conditional
|
|
146
174
|
* wording: `NEXT_PUBLIC_FATHOM_SITE_ID` for Next.js, hard-coded inline for
|
|
@@ -160,6 +188,15 @@ export function fathomEnvVarFor(projectType) {
|
|
|
160
188
|
// [[instantiate-z2w-project]] skill v1.1.0 → "Standards block reference".
|
|
161
189
|
// Bodies use `{{placeholder}}` tokens where substitution is needed; everything
|
|
162
190
|
// else is verbatim from the skill.
|
|
191
|
+
// Canonical Skill Vault paragraph — the SINGLE SOURCE OF TRUTH for this text.
|
|
192
|
+
// The same wording is mirrored (by hand, kept in sync) into Kerry's global
|
|
193
|
+
// ~/.claude/CLAUDE.md and the [[instantiate-z2w-project]] SKILL.md standards
|
|
194
|
+
// resolver. If you edit this body, update those two sites in the same change.
|
|
195
|
+
const SKILL_VAULT_BODY = `### Skill Vault awareness (always — read first)
|
|
196
|
+
|
|
197
|
+
> **Skill Vault:** Kerry's portfolio-wide library of reusable Claude Code / Cursor skills lives at \`~/Desktop/Zero2Webmaster/AI/Skill Vault/\`. Each subfolder is the canonical source for one skill's \`SKILL.md\` body (api-key-field-standard, capture-learning, email-service-router, fathom-analytics, neon-postgres, portable-stack, symlink-safety, uptime-kuma-monitor, and more); \`~/.claude/skills/*\` and \`~/.cursor/skills/*\` symlink into it via the vault's \`sync.sh\`. **When Kerry says "we need a skill created or edited," look there first — you do not need to be given a path.** The skills usable in this session are listed by the harness (the available-skills reminder); the Vault is where their source bodies live and where new skills are authored. See [[capture-learning]] for the rule on when a learning becomes a new Vault skill versus a project-local note.
|
|
198
|
+
>
|
|
199
|
+
> This awareness is listed **first** among standards by deliberate org rule — *unless* a more urgent safety, secret-handling, or data-integrity concern takes precedence in the moment, that always wins.`;
|
|
163
200
|
const PORTABLE_STACK_BODY = `### Portable-stack defaults (non-WP)
|
|
164
201
|
|
|
165
202
|
> **Portability posture:** standard Postgres (not Neon Auth / Supabase Edge Functions / Vercel Postgres / Cloudflare D1 / branded SQL); S3-compatible storage (not Vercel Blob / Supabase Storage); Node runtime over Edge unless required; dotenv-style config (not UI-only secrets); written exit plan from day one. See [[portable-stack]] for the full posture.`;
|
|
@@ -244,6 +281,7 @@ const TEXT_SIZE_BODY = `### Text size (always)
|
|
|
244
281
|
|
|
245
282
|
> **Readability:** per Z2W standing org rule, all public-facing pages and documents use large, easy-to-read type. Body text 18px+ baseline; headings proportionally larger; line-height ≥ 1.5.`;
|
|
246
283
|
const BODIES = {
|
|
284
|
+
"skill-vault": SKILL_VAULT_BODY,
|
|
247
285
|
"portable-stack": PORTABLE_STACK_BODY,
|
|
248
286
|
fathom: FATHOM_BODY,
|
|
249
287
|
"uptime-kuma": UPTIME_KUMA_BODY,
|
|
@@ -254,6 +292,7 @@ const BODIES = {
|
|
|
254
292
|
"text-size": TEXT_SIZE_BODY,
|
|
255
293
|
};
|
|
256
294
|
const APPLICABILITY = {
|
|
295
|
+
"skill-vault": checkSkillVault,
|
|
257
296
|
"portable-stack": checkPortableStack,
|
|
258
297
|
fathom: checkFathom,
|
|
259
298
|
"uptime-kuma": checkUptimeKuma,
|
package/dist/substitute.d.ts
CHANGED
|
@@ -16,6 +16,14 @@ export declare function todayISODate(): string;
|
|
|
16
16
|
export declare function underscoredSlug(slug: string): string;
|
|
17
17
|
/** `my-tool` -> `MyTool` (for PHP class names). */
|
|
18
18
|
export declare function pascalCaseFromSlug(slug: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* `my-tool` -> `MY_TOOL` (for PHP/WordPress constant prefixes). WordPress
|
|
21
|
+
* convention is UPPER_SNAKE for `define()`d constants (`MY_TOOL_VERSION`),
|
|
22
|
+
* distinct from the PascalCase used for class names. Before v0.2.1 the
|
|
23
|
+
* wp-plugin scaffolder reused `slug_camel` for constants, producing
|
|
24
|
+
* `MyTool_VERSION` — the 2026-06-03 dogfood finding #7.
|
|
25
|
+
*/
|
|
26
|
+
export declare function upperSnakeFromSlug(slug: string): string;
|
|
19
27
|
/**
|
|
20
28
|
* Framework version embedded in the scaffolded CLAUDE.md header. WordPress
|
|
21
29
|
* plugins inherit from the WP AGENTS template (v3.1.0); everything else
|
package/dist/substitute.js
CHANGED
|
@@ -33,6 +33,16 @@ export function pascalCaseFromSlug(slug) {
|
|
|
33
33
|
.map((part) => part[0].toUpperCase() + part.slice(1))
|
|
34
34
|
.join("");
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* `my-tool` -> `MY_TOOL` (for PHP/WordPress constant prefixes). WordPress
|
|
38
|
+
* convention is UPPER_SNAKE for `define()`d constants (`MY_TOOL_VERSION`),
|
|
39
|
+
* distinct from the PascalCase used for class names. Before v0.2.1 the
|
|
40
|
+
* wp-plugin scaffolder reused `slug_camel` for constants, producing
|
|
41
|
+
* `MyTool_VERSION` — the 2026-06-03 dogfood finding #7.
|
|
42
|
+
*/
|
|
43
|
+
export function upperSnakeFromSlug(slug) {
|
|
44
|
+
return underscoredSlug(slug).toUpperCase();
|
|
45
|
+
}
|
|
36
46
|
/**
|
|
37
47
|
* Framework version embedded in the scaffolded CLAUDE.md header. WordPress
|
|
38
48
|
* plugins inherit from the WP AGENTS template (v3.1.0); everything else
|
|
@@ -67,6 +77,7 @@ export function buildSubstitutionMap(inputs, opts = {}) {
|
|
|
67
77
|
slug: inputs.slug,
|
|
68
78
|
slug_under: underscoredSlug(inputs.slug),
|
|
69
79
|
slug_camel: pascalCaseFromSlug(inputs.slug),
|
|
80
|
+
slug_const: upperSnakeFromSlug(inputs.slug),
|
|
70
81
|
description: inputs.description,
|
|
71
82
|
brand_name: spec.brandName,
|
|
72
83
|
brand_name_rule: spec.brandNameRule,
|
package/dist/summary.js
CHANGED
|
@@ -57,12 +57,13 @@ function isDecisionInserted(decisions, key) {
|
|
|
57
57
|
}
|
|
58
58
|
function buildNextActions(inputs, result) {
|
|
59
59
|
const actions = [
|
|
60
|
-
{ label: `cd ${result.targetPath}` },
|
|
61
60
|
{
|
|
62
|
-
label: `git init && git add . && git commit -m "
|
|
61
|
+
label: `cd ${result.targetPath} && git init -b main && git config user.email "kerry@zero2webmaster.com" && git add . && git commit -m "Initial scaffold"`,
|
|
62
|
+
note: "RUN THIS FROM INSIDE THE PROJECT DIRECTORY ABOVE — never run `git init`/`git add` from your home directory (a bare `git add -A` in ~ stages credentials, .ssh, and every .env). The cd is baked into this command so it's safe to paste as-is. The repo-local user.email is the Vercel-Hobby commit-author workaround per [[z2w-magic-link-auth]] §8.",
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
label: `gh repo create ${inputs.githubOrg}/${inputs.slug} --private`,
|
|
65
|
+
label: `gh repo create ${inputs.githubOrg}/${inputs.slug} --private --source=. --push`,
|
|
66
|
+
note: `run from inside ${result.targetPath}; add --description "…" and then \`gh repo edit --add-topic …\` to set the repo's About blurb + topics`,
|
|
66
67
|
},
|
|
67
68
|
];
|
|
68
69
|
const installCmd = installCommandFor(inputs.projectType);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import type { ScaffoldInputs } from "./index.js";
|
|
3
|
+
export interface WithInitOptions {
|
|
4
|
+
stdout?: NodeJS.WritableStream;
|
|
5
|
+
stderr?: NodeJS.WritableStream;
|
|
6
|
+
/** Override the spawner (tests). Default `node:child_process.spawn`. */
|
|
7
|
+
spawnImpl?: typeof spawn;
|
|
8
|
+
}
|
|
9
|
+
export declare class WithInitError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Runs the post-scaffold git + gh chain. Assumes the caller has already
|
|
14
|
+
* verified that paid features are allowed (cli.ts does this before calling).
|
|
15
|
+
*/
|
|
16
|
+
export declare function runWithInit(inputs: ScaffoldInputs, targetPath: string, opts?: WithInitOptions): Promise<void>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// z2w-starter-kit --with-init paid feature.
|
|
2
|
+
//
|
|
3
|
+
// After a successful scaffold, runs:
|
|
4
|
+
// git init
|
|
5
|
+
// git add .
|
|
6
|
+
// git commit -m "Initial scaffold via @zero2webmaster/starter-kit"
|
|
7
|
+
// gh repo create {githubOrg}/{slug} --private --source=. --remote=origin
|
|
8
|
+
// git push -u origin <default-branch>
|
|
9
|
+
//
|
|
10
|
+
// This is the side-effectful workflow CLAUDE.md OP #3 explicitly forbids by
|
|
11
|
+
// default in v0.1.x/v0.2.x. It is gated by a runtime license check in
|
|
12
|
+
// src/cli.ts before this module is invoked.
|
|
13
|
+
//
|
|
14
|
+
// `gh` is invoked, not the GitHub REST API, so the user's existing
|
|
15
|
+
// `gh auth login` credentials are honored (no token plumbing required). The
|
|
16
|
+
// CLI surfaces clear errors when `gh` is missing or unauthenticated.
|
|
17
|
+
import { spawn } from "node:child_process";
|
|
18
|
+
export class WithInitError extends Error {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = "WithInitError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function runCommand(command, args, cwd, spawnImpl) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const child = spawnImpl(command, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
27
|
+
let stdout = "";
|
|
28
|
+
let stderr = "";
|
|
29
|
+
child.stdout?.on("data", (chunk) => {
|
|
30
|
+
stdout += chunk.toString("utf8");
|
|
31
|
+
});
|
|
32
|
+
child.stderr?.on("data", (chunk) => {
|
|
33
|
+
stderr += chunk.toString("utf8");
|
|
34
|
+
});
|
|
35
|
+
child.on("error", (err) => reject(err));
|
|
36
|
+
child.on("close", (code) => resolve({ code: code ?? 1, stdout, stderr }));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function step(label, command, args, cwd, spawnImpl, stdout) {
|
|
40
|
+
stdout.write(`\n ${label}: ${command} ${args.join(" ")}\n`);
|
|
41
|
+
let result;
|
|
42
|
+
try {
|
|
43
|
+
result = await runCommand(command, args, cwd, spawnImpl);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
const message = err.code === "ENOENT"
|
|
47
|
+
? `${command} not found on PATH. Install it and re-run.`
|
|
48
|
+
: err.message;
|
|
49
|
+
throw new WithInitError(`${label} failed: ${message}`);
|
|
50
|
+
}
|
|
51
|
+
if (result.code !== 0) {
|
|
52
|
+
const detail = (result.stderr || result.stdout || "").trim();
|
|
53
|
+
throw new WithInitError(`${label} exited with code ${result.code}${detail ? `: ${detail}` : ""}`);
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Runs the post-scaffold git + gh chain. Assumes the caller has already
|
|
59
|
+
* verified that paid features are allowed (cli.ts does this before calling).
|
|
60
|
+
*/
|
|
61
|
+
export async function runWithInit(inputs, targetPath, opts = {}) {
|
|
62
|
+
const stdout = opts.stdout ?? process.stdout;
|
|
63
|
+
const stderr = opts.stderr ?? process.stderr;
|
|
64
|
+
const spawnImpl = opts.spawnImpl ?? spawn;
|
|
65
|
+
const repoRef = `${inputs.githubOrg}/${inputs.slug}`;
|
|
66
|
+
const commitMessage = `Initial scaffold via @zero2webmaster/starter-kit (${inputs.slug})`;
|
|
67
|
+
stdout.write(`\n--with-init: setting up ${repoRef} ...\n`);
|
|
68
|
+
await step("git init", "git", ["init", "-b", "main"], targetPath, spawnImpl, stdout);
|
|
69
|
+
await step("git add", "git", ["add", "."], targetPath, spawnImpl, stdout);
|
|
70
|
+
await step("git commit", "git", ["commit", "-m", commitMessage], targetPath, spawnImpl, stdout);
|
|
71
|
+
await step("gh repo create", "gh", [
|
|
72
|
+
"repo",
|
|
73
|
+
"create",
|
|
74
|
+
repoRef,
|
|
75
|
+
"--private",
|
|
76
|
+
"--source=.",
|
|
77
|
+
"--remote=origin",
|
|
78
|
+
"--push",
|
|
79
|
+
], targetPath, spawnImpl, stdout);
|
|
80
|
+
stdout.write(`\n--with-init: ${repoRef} is live at https://github.com/${repoRef} (private).\n`);
|
|
81
|
+
stderr; // (touch: stderr is reserved for future surfacing)
|
|
82
|
+
}
|
package/dist/writer.d.ts
CHANGED
|
@@ -4,8 +4,15 @@ import type { ScaffoldFile } from "./scaffolders/common.js";
|
|
|
4
4
|
import { type StandardDecision, type StandardKey } from "./standards.js";
|
|
5
5
|
import { type ReadTemplateOptions } from "./templates.js";
|
|
6
6
|
export interface WriteScaffoldOptions {
|
|
7
|
-
/** When true, print
|
|
7
|
+
/** When true, print a file list to stdout and skip disk writes. */
|
|
8
8
|
dryRun?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* In dry-run mode, also dump the full content of every file (the pre-v0.2.1
|
|
11
|
+
* default). When false (the new default), dry-run prints only the file list
|
|
12
|
+
* with byte sizes — the 2026-06-03 dogfood finding #5, where a full-content
|
|
13
|
+
* dump buried the standards summary + next-actions in hundreds of lines.
|
|
14
|
+
*/
|
|
15
|
+
showContents?: boolean;
|
|
9
16
|
/** When true (default), refuse to write into a non-empty target directory. */
|
|
10
17
|
refuseNonEmpty?: boolean;
|
|
11
18
|
/** Forwarded to {@link readTemplateWithFallback}; tests pin this at a sandbox. */
|
|
@@ -20,6 +27,8 @@ export interface WriteScaffoldOptions {
|
|
|
20
27
|
date?: string;
|
|
21
28
|
/** Required when `promoteStandards: true`; ignored otherwise. */
|
|
22
29
|
prompter?: Prompter;
|
|
30
|
+
/** When true, layer the Pro SEO baseline extension on top of nextjs/cf-pages scaffolds. v0.3.0 paid feature. */
|
|
31
|
+
withProSeo?: boolean;
|
|
23
32
|
/** Where dry-run output + promotion-dialog narration are written. */
|
|
24
33
|
output?: NodeJS.WritableStream;
|
|
25
34
|
}
|
package/dist/writer.js
CHANGED
|
@@ -24,6 +24,7 @@ import { promises as fs } from "node:fs";
|
|
|
24
24
|
import * as path from "node:path";
|
|
25
25
|
import fsExtra from "fs-extra";
|
|
26
26
|
import { AGENTS_BODY_MARKER, STANDARDS_BLOCK_MARKER, } from "./scaffolders/common.js";
|
|
27
|
+
import { buildProSeoExtension, proSeoApplies, } from "./scaffolders/pro-seo-extension.js";
|
|
27
28
|
import { scaffoldByType } from "./scaffolders/index.js";
|
|
28
29
|
import { applyStandardsBlock, resolveStandards, } from "./standards.js";
|
|
29
30
|
import { readTemplateWithFallback, } from "./templates.js";
|
|
@@ -226,16 +227,40 @@ export async function writeScaffold(inputs, targetPath, opts = {}) {
|
|
|
226
227
|
const dateForFile = opts.date ?? new Date().toISOString().slice(0, 10);
|
|
227
228
|
files.push(buildPromotionsFile(inputs, promotions, dateForFile));
|
|
228
229
|
}
|
|
230
|
+
// Layer 4 — Pro SEO baseline extension (paid feature; nextjs/cf-pages only).
|
|
231
|
+
if (opts.withProSeo === true) {
|
|
232
|
+
if (!proSeoApplies(inputs)) {
|
|
233
|
+
throw new WriterError(`--with-pro-seo applies only to nextjs + cf-pages projects with hasWebUi=true. ` +
|
|
234
|
+
`This scaffold is projectType=${inputs.projectType} (hasWebUi=${inputs.hasWebUi}).`);
|
|
235
|
+
}
|
|
236
|
+
for (const file of buildProSeoExtension(inputs)) {
|
|
237
|
+
files.push(file);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
229
240
|
for (const file of files) {
|
|
230
241
|
assertScaffoldedPathSafe(resolvedTarget, file);
|
|
231
242
|
}
|
|
232
243
|
if (dryRun) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
output.write(
|
|
244
|
+
const showContents = opts.showContents === true;
|
|
245
|
+
output.write(`\n# Dry run — would write ${files.length} files into ${resolvedTarget}\n\n`);
|
|
246
|
+
if (showContents) {
|
|
247
|
+
for (const file of files) {
|
|
248
|
+
output.write(`\n----- ${file.path} -----\n`);
|
|
249
|
+
output.write(file.content);
|
|
250
|
+
if (!file.content.endsWith("\n"))
|
|
251
|
+
output.write("\n");
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
// Default: a scannable file list with byte sizes. The full content dump
|
|
256
|
+
// is behind --show-contents so the standards summary + next-actions
|
|
257
|
+
// (rendered by renderSummary right after this) stay visible.
|
|
258
|
+
const width = String(Math.max(...files.map((f) => Buffer.byteLength(f.content, "utf8")))).length;
|
|
259
|
+
for (const file of files) {
|
|
260
|
+
const bytes = String(Buffer.byteLength(file.content, "utf8")).padStart(width);
|
|
261
|
+
output.write(` ${bytes} B ${file.path}\n`);
|
|
262
|
+
}
|
|
263
|
+
output.write(`\n# (run with --show-contents to print every file's full content)\n`);
|
|
239
264
|
}
|
|
240
265
|
output.write(`\n# End dry run — ${files.length} files, CLAUDE.md is ${claudeContent.length} bytes.\n`);
|
|
241
266
|
return {
|