@zero2webmaster/starter-kit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +38 -0
- package/README.md +89 -0
- package/dist/brand.d.ts +72 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +198 -0
- package/dist/brand.js.map +1 -0
- package/dist/brief.d.ts +14 -0
- package/dist/brief.d.ts.map +1 -0
- package/dist/brief.js +47 -0
- package/dist/brief.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +82 -0
- package/dist/cli.js.map +1 -0
- package/dist/confirm.d.ts +45 -0
- package/dist/confirm.d.ts.map +1 -0
- package/dist/confirm.js +382 -0
- package/dist/confirm.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/parse-brief.d.ts +32 -0
- package/dist/parse-brief.d.ts.map +1 -0
- package/dist/parse-brief.js +298 -0
- package/dist/parse-brief.js.map +1 -0
- package/dist/scaffolders/cf-pages.d.ts +9 -0
- package/dist/scaffolders/cf-pages.d.ts.map +1 -0
- package/dist/scaffolders/cf-pages.js +259 -0
- package/dist/scaffolders/cf-pages.js.map +1 -0
- package/dist/scaffolders/cf-worker.d.ts +4 -0
- package/dist/scaffolders/cf-worker.d.ts.map +1 -0
- package/dist/scaffolders/cf-worker.js +112 -0
- package/dist/scaffolders/cf-worker.js.map +1 -0
- package/dist/scaffolders/common.d.ts +39 -0
- package/dist/scaffolders/common.d.ts.map +1 -0
- package/dist/scaffolders/common.js +441 -0
- package/dist/scaffolders/common.js.map +1 -0
- package/dist/scaffolders/index.d.ts +18 -0
- package/dist/scaffolders/index.d.ts.map +1 -0
- package/dist/scaffolders/index.js +40 -0
- package/dist/scaffolders/index.js.map +1 -0
- package/dist/scaffolders/library.d.ts +4 -0
- package/dist/scaffolders/library.d.ts.map +1 -0
- package/dist/scaffolders/library.js +122 -0
- package/dist/scaffolders/library.js.map +1 -0
- package/dist/scaffolders/nextjs.d.ts +10 -0
- package/dist/scaffolders/nextjs.d.ts.map +1 -0
- package/dist/scaffolders/nextjs.js +395 -0
- package/dist/scaffolders/nextjs.js.map +1 -0
- package/dist/scaffolders/protocol-repo.d.ts +4 -0
- package/dist/scaffolders/protocol-repo.d.ts.map +1 -0
- package/dist/scaffolders/protocol-repo.js +162 -0
- package/dist/scaffolders/protocol-repo.js.map +1 -0
- package/dist/scaffolders/python-service.d.ts +4 -0
- package/dist/scaffolders/python-service.d.ts.map +1 -0
- package/dist/scaffolders/python-service.js +144 -0
- package/dist/scaffolders/python-service.js.map +1 -0
- package/dist/scaffolders/wp-plugin.d.ts +4 -0
- package/dist/scaffolders/wp-plugin.d.ts.map +1 -0
- package/dist/scaffolders/wp-plugin.js +268 -0
- package/dist/scaffolders/wp-plugin.js.map +1 -0
- package/dist/standards.d.ts +65 -0
- package/dist/standards.d.ts.map +1 -0
- package/dist/standards.js +335 -0
- package/dist/standards.js.map +1 -0
- package/dist/substitute.d.ts +37 -0
- package/dist/substitute.d.ts.map +1 -0
- package/dist/substitute.js +98 -0
- package/dist/substitute.js.map +1 -0
- package/dist/summary.d.ts +20 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/summary.js +191 -0
- package/dist/summary.js.map +1 -0
- package/dist/templates.d.ts +30 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +123 -0
- package/dist/templates.js.map +1 -0
- package/dist/wizard.d.ts +12 -0
- package/dist/wizard.d.ts.map +1 -0
- package/dist/wizard.js +158 -0
- package/dist/wizard.js.map +1 -0
- package/dist/writer.d.ts +62 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +367 -0
- package/dist/writer.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
// z2w-starter-kit brief parser.
|
|
2
|
+
//
|
|
3
|
+
// Deterministic, regex-based parser for pasted project-instantiation briefs.
|
|
4
|
+
// Per ROADMAP Step 2 / refinement A: every field that cannot be inferred is
|
|
5
|
+
// returned as `null`. The confirmation layer renders nulls as
|
|
6
|
+
// `[unset — please type]` and refuses to accept until they are filled.
|
|
7
|
+
//
|
|
8
|
+
// The parser is intentionally conservative — it only sets a field when the
|
|
9
|
+
// signal is unambiguous. False-positive inferences erode trust in the
|
|
10
|
+
// confirmation screen; false-negatives merely require the user to type.
|
|
11
|
+
const SECTION_NAMES = [
|
|
12
|
+
"purpose",
|
|
13
|
+
"key apis",
|
|
14
|
+
"data sources",
|
|
15
|
+
"expected outputs",
|
|
16
|
+
"edge cases",
|
|
17
|
+
"roadmap",
|
|
18
|
+
"future improvements",
|
|
19
|
+
"project name",
|
|
20
|
+
"slug",
|
|
21
|
+
"brand",
|
|
22
|
+
"github org",
|
|
23
|
+
"target path",
|
|
24
|
+
];
|
|
25
|
+
function escapeRegExp(s) {
|
|
26
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Build the alternation regex that matches a section heading for `name`.
|
|
30
|
+
* Supports four common styles:
|
|
31
|
+
* - `## Purpose` / `### Purpose` (any heading level)
|
|
32
|
+
* - `**Purpose**` (bold, no colon)
|
|
33
|
+
* - `**Purpose:**` (bold, colon inside the asterisks — inline-value form)
|
|
34
|
+
* - `Purpose:` at the start of a line (bare-label form)
|
|
35
|
+
*/
|
|
36
|
+
function headingRegex(escapedName) {
|
|
37
|
+
return new RegExp(`(?:^|\\n)[ \\t]*(?:` +
|
|
38
|
+
`#{1,6}[ \\t]+${escapedName}\\s*:?[ \\t]*` +
|
|
39
|
+
`|\\*\\*${escapedName}\\*\\*\\s*:?[ \\t]*` +
|
|
40
|
+
`|\\*\\*${escapedName}:\\*\\*[ \\t]*` +
|
|
41
|
+
`|${escapedName}[ \\t]*:[ \\t]*` +
|
|
42
|
+
`)`, "i");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Extract the body of a labelled section. Body extends to the next recognized
|
|
46
|
+
* section heading (any style) or end of brief.
|
|
47
|
+
*/
|
|
48
|
+
export function extractSection(brief, name) {
|
|
49
|
+
const target = name.toLowerCase();
|
|
50
|
+
const escaped = escapeRegExp(target);
|
|
51
|
+
const headingMatch = headingRegex(escaped).exec(brief);
|
|
52
|
+
if (!headingMatch)
|
|
53
|
+
return null;
|
|
54
|
+
const bodyStart = headingMatch.index + headingMatch[0].length;
|
|
55
|
+
let bodyEnd = brief.length;
|
|
56
|
+
for (const other of SECTION_NAMES) {
|
|
57
|
+
if (other === target)
|
|
58
|
+
continue;
|
|
59
|
+
const otherRe = headingRegex(escapeRegExp(other));
|
|
60
|
+
const otherMatch = otherRe.exec(brief.slice(bodyStart));
|
|
61
|
+
if (otherMatch) {
|
|
62
|
+
const candidateEnd = bodyStart + otherMatch.index;
|
|
63
|
+
if (candidateEnd < bodyEnd)
|
|
64
|
+
bodyEnd = candidateEnd;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const body = brief.slice(bodyStart, bodyEnd).trim();
|
|
68
|
+
return body.length > 0 ? body : null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Find a single-line `Key: Value` field anywhere in the brief.
|
|
72
|
+
* Tolerates `**Key:** value`, `Key: value`, and `- Key: value` list items.
|
|
73
|
+
*/
|
|
74
|
+
function findInlineField(brief, key) {
|
|
75
|
+
const escaped = escapeRegExp(key);
|
|
76
|
+
const re = new RegExp(`(?:^|\\n)\\s*(?:[-*]\\s+)?(?:\\*\\*)?${escaped}(?:\\*\\*)?\\s*:\\s*([^\\n]+)`, "i");
|
|
77
|
+
const match = re.exec(brief);
|
|
78
|
+
if (!match)
|
|
79
|
+
return null;
|
|
80
|
+
const value = match[1].trim().replace(/^\*\*|\*\*$/g, "").trim();
|
|
81
|
+
return value.length > 0 ? value : null;
|
|
82
|
+
}
|
|
83
|
+
const SLUG_RE = /^[a-z][a-z0-9-]{2,49}$/;
|
|
84
|
+
const SLUG_VERSION_SUFFIX_RE = /-v\d+$/;
|
|
85
|
+
export function kebabCase(input) {
|
|
86
|
+
return input
|
|
87
|
+
.toLowerCase()
|
|
88
|
+
.replace(/['"]/g, "")
|
|
89
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
90
|
+
.replace(/^-+|-+$/g, "")
|
|
91
|
+
.replace(/-{2,}/g, "-");
|
|
92
|
+
}
|
|
93
|
+
export function isValidSlug(slug) {
|
|
94
|
+
return SLUG_RE.test(slug) && !SLUG_VERSION_SUFFIX_RE.test(slug);
|
|
95
|
+
}
|
|
96
|
+
function inferSlug(brief) {
|
|
97
|
+
const explicit = findInlineField(brief, "project slug") ??
|
|
98
|
+
findInlineField(brief, "slug") ??
|
|
99
|
+
findInlineField(brief, "project name") ??
|
|
100
|
+
findInlineField(brief, "name");
|
|
101
|
+
if (explicit) {
|
|
102
|
+
const candidate = kebabCase(explicit);
|
|
103
|
+
if (isValidSlug(candidate))
|
|
104
|
+
return candidate;
|
|
105
|
+
}
|
|
106
|
+
const purpose = extractSection(brief, "purpose");
|
|
107
|
+
if (purpose) {
|
|
108
|
+
const firstSentence = purpose.split(/[.\n]/)[0] ?? "";
|
|
109
|
+
const words = firstSentence.split(/\s+/).filter(Boolean).slice(0, 6);
|
|
110
|
+
if (words.length >= 2) {
|
|
111
|
+
const candidate = kebabCase(words.join(" "));
|
|
112
|
+
if (isValidSlug(candidate))
|
|
113
|
+
return candidate;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
function inferDescription(brief) {
|
|
119
|
+
const explicit = findInlineField(brief, "description") ??
|
|
120
|
+
findInlineField(brief, "summary");
|
|
121
|
+
if (explicit)
|
|
122
|
+
return explicit;
|
|
123
|
+
const purpose = extractSection(brief, "purpose");
|
|
124
|
+
if (purpose) {
|
|
125
|
+
const firstSentence = purpose.split(/(?<=[.?!])\s+/)[0] ?? purpose;
|
|
126
|
+
const trimmed = firstSentence.trim();
|
|
127
|
+
if (trimmed.length > 0)
|
|
128
|
+
return trimmed.slice(0, 280);
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
function inferProjectType(brief) {
|
|
133
|
+
const text = brief.toLowerCase();
|
|
134
|
+
const rules = [
|
|
135
|
+
{ pattern: /\b(wordpress|wp)\s+plugin\b/, type: "wp-plugin" },
|
|
136
|
+
{ pattern: /\bcloudflare\s+pages\b|\bcf[-\s]?pages\b/, type: "cf-pages" },
|
|
137
|
+
{
|
|
138
|
+
pattern: /\bcloudflare\s+workers?\b|\bcf[-\s]?workers?\b/,
|
|
139
|
+
type: "cf-worker",
|
|
140
|
+
},
|
|
141
|
+
{ pattern: /\bnext\.?js\b/, type: "nextjs" },
|
|
142
|
+
{ pattern: /\b(fastapi|flask|django)\b/, type: "python-service" },
|
|
143
|
+
{ pattern: /\bpython\s+(service|app|api|backend)\b/, type: "python-service" },
|
|
144
|
+
{ pattern: /\bprotocol\s+repo\b/, type: "protocol-repo" },
|
|
145
|
+
{ pattern: /\bnpm\s+package\b/, type: "library" },
|
|
146
|
+
{ pattern: /\bnode\s+cli\b/, type: "library" },
|
|
147
|
+
{ pattern: /\bcli\s+tool\b/, type: "library" },
|
|
148
|
+
{ pattern: /\blibrary\b/, type: "library" },
|
|
149
|
+
];
|
|
150
|
+
for (const { pattern, type } of rules) {
|
|
151
|
+
if (pattern.test(text))
|
|
152
|
+
return type;
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
function inferBrand(brief) {
|
|
157
|
+
const text = brief.toLowerCase();
|
|
158
|
+
if (/\bsave\s*the\s*frogs\b|\bstf\b/.test(text))
|
|
159
|
+
return "save-the-frogs";
|
|
160
|
+
if (/\bbansuri\s*bliss\b/.test(text))
|
|
161
|
+
return "bansuri-bliss";
|
|
162
|
+
if (/\bzero2webmaster\b|\bz2w\b/.test(text))
|
|
163
|
+
return "zero2webmaster";
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
export function githubOrgForBrand(brand) {
|
|
167
|
+
switch (brand) {
|
|
168
|
+
case "zero2webmaster":
|
|
169
|
+
return "zero2webmaster";
|
|
170
|
+
case "save-the-frogs":
|
|
171
|
+
return "savethefrogs";
|
|
172
|
+
case "bansuri-bliss":
|
|
173
|
+
return "bansuribliss";
|
|
174
|
+
case "custom":
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function inferGithubOrg(brief, brand) {
|
|
179
|
+
const explicit = findInlineField(brief, "github org") ??
|
|
180
|
+
findInlineField(brief, "github organization") ??
|
|
181
|
+
findInlineField(brief, "org");
|
|
182
|
+
if (explicit) {
|
|
183
|
+
const cleaned = explicit.replace(/^@/, "").trim();
|
|
184
|
+
if (cleaned.length > 0)
|
|
185
|
+
return cleaned;
|
|
186
|
+
}
|
|
187
|
+
if (brand)
|
|
188
|
+
return githubOrgForBrand(brand);
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
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;
|
|
198
|
+
}
|
|
199
|
+
function inferDbStrategy(brief) {
|
|
200
|
+
const dataSources = extractSection(brief, "data sources") ?? "";
|
|
201
|
+
const haystack = (dataSources + "\n" + brief).toLowerCase();
|
|
202
|
+
if (/\bneon\b/.test(haystack))
|
|
203
|
+
return "neon-postgres";
|
|
204
|
+
if (/\bsupabase\b/.test(haystack))
|
|
205
|
+
return "supabase";
|
|
206
|
+
if (/\bsqlite\b/.test(haystack))
|
|
207
|
+
return "sqlite";
|
|
208
|
+
if (/\bmysql\b/.test(haystack) || /\bmariadb\b/.test(haystack)) {
|
|
209
|
+
return "mysql-wp";
|
|
210
|
+
}
|
|
211
|
+
if (/\bpostgres(ql)?\b/.test(haystack))
|
|
212
|
+
return "other";
|
|
213
|
+
if (/\bno\s+database\b|\bno\s+db\b/.test(haystack))
|
|
214
|
+
return "none";
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
function inferHasWebUi(brief, projectType) {
|
|
218
|
+
const text = brief.toLowerCase();
|
|
219
|
+
if (/\bno\s+(web\s+)?ui\b|\bno\s+frontend\b/.test(text))
|
|
220
|
+
return false;
|
|
221
|
+
if (/\bweb\s+ui\b|\bdashboard\b|\bfrontend\b|\badmin\s+ui\b/.test(text)) {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
if (/\bhtml\b|\breact\b|\bvue\b|\bsvelte\b/.test(text))
|
|
225
|
+
return true;
|
|
226
|
+
if (projectType === "nextjs" || projectType === "cf-pages")
|
|
227
|
+
return true;
|
|
228
|
+
if (projectType === "library" ||
|
|
229
|
+
projectType === "cf-worker" ||
|
|
230
|
+
projectType === "protocol-repo") {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
function inferHasCron(brief) {
|
|
236
|
+
const text = brief.toLowerCase();
|
|
237
|
+
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
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
if (/\bno\s+(scheduled|cron)\b/.test(text))
|
|
241
|
+
return false;
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
function inferParticipateInBulletin(brief, brand) {
|
|
245
|
+
const text = brief.toLowerCase();
|
|
246
|
+
if (/\bagent\s+coordination\b|\bbulletin\b/.test(text))
|
|
247
|
+
return true;
|
|
248
|
+
if (brand === "zero2webmaster")
|
|
249
|
+
return true;
|
|
250
|
+
if (brand !== null)
|
|
251
|
+
return false;
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Parse a pasted project-instantiation brief into a ParsedBrief. Every field
|
|
256
|
+
* that cannot be inferred deterministically is left as `null` — the
|
|
257
|
+
* confirmation layer is responsible for prompting the user to fill blanks.
|
|
258
|
+
*
|
|
259
|
+
* This function never throws on parse-failure; it only throws on an empty
|
|
260
|
+
* or non-string input, which is a programmer error.
|
|
261
|
+
*/
|
|
262
|
+
export function parseBrief(brief) {
|
|
263
|
+
if (typeof brief !== "string") {
|
|
264
|
+
throw new TypeError(`parseBrief expected a string; got ${typeof brief}`);
|
|
265
|
+
}
|
|
266
|
+
const trimmed = brief.trim();
|
|
267
|
+
if (trimmed.length === 0) {
|
|
268
|
+
return {
|
|
269
|
+
slug: null,
|
|
270
|
+
description: null,
|
|
271
|
+
projectType: null,
|
|
272
|
+
brand: null,
|
|
273
|
+
githubOrg: null,
|
|
274
|
+
targetPath: null,
|
|
275
|
+
dbStrategy: null,
|
|
276
|
+
hasWebUi: null,
|
|
277
|
+
hasCron: null,
|
|
278
|
+
participateInBulletin: null,
|
|
279
|
+
raw: brief,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const brand = inferBrand(trimmed);
|
|
283
|
+
const projectType = inferProjectType(trimmed);
|
|
284
|
+
return {
|
|
285
|
+
slug: inferSlug(trimmed),
|
|
286
|
+
description: inferDescription(trimmed),
|
|
287
|
+
projectType,
|
|
288
|
+
brand,
|
|
289
|
+
githubOrg: inferGithubOrg(trimmed, brand),
|
|
290
|
+
targetPath: inferTargetPath(trimmed),
|
|
291
|
+
dbStrategy: inferDbStrategy(trimmed),
|
|
292
|
+
hasWebUi: inferHasWebUi(trimmed, projectType),
|
|
293
|
+
hasCron: inferHasCron(trimmed),
|
|
294
|
+
participateInBulletin: inferParticipateInBulletin(trimmed, brand),
|
|
295
|
+
raw: brief,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
//# sourceMappingURL=parse-brief.js.map
|
|
@@ -0,0 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AAO,CAAC;QAC9B,qBAAqB,EAAE,0BAA0B,CAAC,OAAO,EAAE,KAAK,CAAC;QACjE,GAAG,EAAE,KAAK;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ScaffoldInputs } from "../index.js";
|
|
2
|
+
import { type ScaffoldFile, type ScaffolderOptions } from "./common.js";
|
|
3
|
+
export declare function scaffoldCfPages(inputs: ScaffoldInputs, opts?: ScaffolderOptions): ScaffoldFile[];
|
|
4
|
+
/**
|
|
5
|
+
* Canonical SEO baseline file list for cf-pages. Exported for tests + the
|
|
6
|
+
* Step 5 standards resolver.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CF_PAGES_SEO_BASELINE_PATHS: readonly ["index.html", "robots.txt", "sitemap.xml", "_headers", "SEO-CHECKLIST.md"];
|
|
9
|
+
//# sourceMappingURL=cf-pages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cf-pages.d.ts","sourceRoot":"","sources":["../../src/scaffolders/cf-pages.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AA6NrB,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,iBAAiB,GACvB,YAAY,EAAE,CAgBhB;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,sFAM9B,CAAC"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
// Scaffolder: `cf-pages` — Cloudflare Pages static site with the full SEO
|
|
2
|
+
// baseline wired in at instantiation (per standing org requirement
|
|
3
|
+
// 2026-05-30).
|
|
4
|
+
//
|
|
5
|
+
// SEO baseline emitted by THIS scaffolder:
|
|
6
|
+
// 1. SSR/SSG — static HTML (the most server-rendered form possible).
|
|
7
|
+
// 2. Per-page metadata — `index.html` has intentional <title>, meta
|
|
8
|
+
// description, canonical link, OG, Twitter Card.
|
|
9
|
+
// 3. Exactly one <h1> + semantic HTML — `index.html` uses <main>, <nav>,
|
|
10
|
+
// <article>, <header>, <footer>.
|
|
11
|
+
// 4. Image alt text — no images at scaffold time; the SEO-CHECKLIST.md
|
|
12
|
+
// reminds the author to add descriptive alt text.
|
|
13
|
+
// 5. JSON-LD — `Organization` schema in `index.html`.
|
|
14
|
+
// 6. sitemap.xml + robots.txt — both files emitted; `_headers` adds
|
|
15
|
+
// `X-Robots-Tag: noindex, nofollow` on preview deploys.
|
|
16
|
+
// 7. Fathom — inline script tag wired via `data-site` (CF Pages doesn't
|
|
17
|
+
// have a build-time env var substitution as ergonomic as Next.js;
|
|
18
|
+
// author replaces the placeholder ID before deploy).
|
|
19
|
+
import { commonBaseFiles, resolveBrandSpec, sub, } from "./common.js";
|
|
20
|
+
const NARRATIVE = `## What this is
|
|
21
|
+
|
|
22
|
+
\`{{slug}}\` is a Cloudflare Pages static site scaffolded under the {{brand_name}} brand. The 7-item SEO baseline (per Z2W standing org requirement 2026-05-30) is wired in at instantiation.
|
|
23
|
+
|
|
24
|
+
**Quick start for contributors:**
|
|
25
|
+
|
|
26
|
+
\`\`\`bash
|
|
27
|
+
# Preview locally:
|
|
28
|
+
npx wrangler pages dev .
|
|
29
|
+
|
|
30
|
+
# Deploy:
|
|
31
|
+
npx wrangler pages deploy .
|
|
32
|
+
\`\`\`
|
|
33
|
+
|
|
34
|
+
**SEO baseline (wired in):**
|
|
35
|
+
|
|
36
|
+
- \`index.html\` — intentional \`<title>\`, \`<meta name="description">\`, canonical link, Open Graph + Twitter Card tags; exactly one \`<h1>\`; semantic HTML (\`<main>\`, \`<nav>\`, \`<header>\`, \`<footer>\`); JSON-LD Organization schema; Fathom analytics snippet.
|
|
37
|
+
- \`robots.txt\` — references the sitemap.
|
|
38
|
+
- \`sitemap.xml\` — lists indexable pages.
|
|
39
|
+
- \`_headers\` — preview deploys emit \`X-Robots-Tag: noindex, nofollow\` so non-production environments are NOT indexed (gated via CF Pages branch routing; see file comments).
|
|
40
|
+
- \`SEO-CHECKLIST.md\` — per-page checklist; consult before adding new pages.
|
|
41
|
+
|
|
42
|
+
**Before launch:**
|
|
43
|
+
|
|
44
|
+
1. Replace \`__FATHOM_SITE_ID__\` in \`index.html\` with your real Fathom site ID (per [[fathom-analytics]]).
|
|
45
|
+
2. Replace \`__SITE_URL__\` in all places (index.html, sitemap.xml) with your live domain.
|
|
46
|
+
3. Replace \`public/og-image.txt\` with a real 1200x630 PNG at \`public/og-image.png\`.
|
|
47
|
+
4. Run the SEO baseline pre-launch audit from CLAUDE.md.
|
|
48
|
+
`;
|
|
49
|
+
const INDEX_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
50
|
+
<html lang="en">
|
|
51
|
+
<head>
|
|
52
|
+
<meta charset="utf-8" />
|
|
53
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
54
|
+
|
|
55
|
+
<!-- SEO baseline (per Z2W standing org requirement 2026-05-30). Replace
|
|
56
|
+
__SITE_URL__ and __FATHOM_SITE_ID__ before deploy. -->
|
|
57
|
+
<title>{{brand_name}} — {{slug}}</title>
|
|
58
|
+
<meta name="description" content="{{description}}" />
|
|
59
|
+
<link rel="canonical" href="__SITE_URL__/" />
|
|
60
|
+
|
|
61
|
+
<!-- Open Graph -->
|
|
62
|
+
<meta property="og:title" content="{{brand_name}} — {{slug}}" />
|
|
63
|
+
<meta property="og:description" content="{{description}}" />
|
|
64
|
+
<meta property="og:type" content="website" />
|
|
65
|
+
<meta property="og:url" content="__SITE_URL__/" />
|
|
66
|
+
<meta property="og:image" content="__SITE_URL__/og-image.png" />
|
|
67
|
+
|
|
68
|
+
<!-- Twitter Card -->
|
|
69
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
70
|
+
<meta name="twitter:title" content="{{brand_name}} — {{slug}}" />
|
|
71
|
+
<meta name="twitter:description" content="{{description}}" />
|
|
72
|
+
<meta name="twitter:image" content="__SITE_URL__/og-image.png" />
|
|
73
|
+
|
|
74
|
+
<!-- JSON-LD: Organization (per SEO baseline) -->
|
|
75
|
+
<script type="application/ld+json">
|
|
76
|
+
{
|
|
77
|
+
"@context": "https://schema.org",
|
|
78
|
+
"@type": "Organization",
|
|
79
|
+
"name": "{{brand_name}}",
|
|
80
|
+
"url": "__SITE_URL__/"
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<!-- Fathom Analytics (per [[fathom-analytics]]). Replace __FATHOM_SITE_ID__
|
|
85
|
+
before deploy. -->
|
|
86
|
+
<script src="https://cdn.usefathom.com/script.js" data-site="__FATHOM_SITE_ID__" defer></script>
|
|
87
|
+
|
|
88
|
+
<style>
|
|
89
|
+
:root {
|
|
90
|
+
--color-primary: {{primary_color}};
|
|
91
|
+
--color-accent: {{accent_color}};
|
|
92
|
+
}
|
|
93
|
+
body {
|
|
94
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
95
|
+
font-size: 18px;
|
|
96
|
+
line-height: 1.5;
|
|
97
|
+
margin: 0;
|
|
98
|
+
color: #1a1a1a;
|
|
99
|
+
}
|
|
100
|
+
main {
|
|
101
|
+
max-width: 960px;
|
|
102
|
+
margin: 0 auto;
|
|
103
|
+
padding: 2rem 1rem;
|
|
104
|
+
}
|
|
105
|
+
h1 {
|
|
106
|
+
color: var(--color-primary);
|
|
107
|
+
font-size: 2.5rem;
|
|
108
|
+
}
|
|
109
|
+
a {
|
|
110
|
+
color: var(--color-accent);
|
|
111
|
+
}
|
|
112
|
+
</style>
|
|
113
|
+
</head>
|
|
114
|
+
<body>
|
|
115
|
+
<main>
|
|
116
|
+
<header>
|
|
117
|
+
<h1>{{brand_name}} — {{slug}}</h1>
|
|
118
|
+
</header>
|
|
119
|
+
<article>
|
|
120
|
+
<p>{{description}}</p>
|
|
121
|
+
<p>
|
|
122
|
+
This page is fully server-rendered static HTML. Replace this
|
|
123
|
+
placeholder copy with your real homepage content.
|
|
124
|
+
</p>
|
|
125
|
+
</article>
|
|
126
|
+
<footer>
|
|
127
|
+
<p>© {{year}} {{author}}.</p>
|
|
128
|
+
</footer>
|
|
129
|
+
</main>
|
|
130
|
+
</body>
|
|
131
|
+
</html>
|
|
132
|
+
`;
|
|
133
|
+
const ROBOTS_TXT_TEMPLATE = `# robots.txt for {{slug}}.
|
|
134
|
+
# Preview deploys are blocked via the \`X-Robots-Tag: noindex\` header rule
|
|
135
|
+
# in \`_headers\` (gated to non-production CF Pages branches). This file
|
|
136
|
+
# applies to the production deploy.
|
|
137
|
+
|
|
138
|
+
User-agent: *
|
|
139
|
+
Allow: /
|
|
140
|
+
|
|
141
|
+
Sitemap: __SITE_URL__/sitemap.xml
|
|
142
|
+
`;
|
|
143
|
+
const SITEMAP_XML_TEMPLATE = `<?xml version="1.0" encoding="UTF-8"?>
|
|
144
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
145
|
+
<url>
|
|
146
|
+
<loc>__SITE_URL__/</loc>
|
|
147
|
+
<lastmod>{{date}}</lastmod>
|
|
148
|
+
<changefreq>weekly</changefreq>
|
|
149
|
+
<priority>1.0</priority>
|
|
150
|
+
</url>
|
|
151
|
+
</urlset>
|
|
152
|
+
`;
|
|
153
|
+
const HEADERS_TEMPLATE = `# Cloudflare Pages headers for {{slug}}.
|
|
154
|
+
#
|
|
155
|
+
# Preview / non-production deploys MUST be noindex per the Z2W SEO baseline
|
|
156
|
+
# standing requirement (2026-05-30). On Cloudflare Pages, the simplest
|
|
157
|
+
# approach is to set a header for the preview URL pattern. Pages also
|
|
158
|
+
# supports \`!\` patterns for any non-default branch. Adjust the pattern below
|
|
159
|
+
# to match your project's domain layout.
|
|
160
|
+
#
|
|
161
|
+
# Production (live domain): no special header — sitemap + robots.txt govern.
|
|
162
|
+
# Preview deploys (*.pages.dev): noindex.
|
|
163
|
+
|
|
164
|
+
/*
|
|
165
|
+
X-Frame-Options: SAMEORIGIN
|
|
166
|
+
Referrer-Policy: strict-origin-when-cross-origin
|
|
167
|
+
|
|
168
|
+
https://*.pages.dev/*
|
|
169
|
+
X-Robots-Tag: noindex, nofollow
|
|
170
|
+
`;
|
|
171
|
+
const REDIRECTS_TEMPLATE = `# Cloudflare Pages redirects for {{slug}}.
|
|
172
|
+
# Format: /from /to [status]
|
|
173
|
+
# Default 200 for proxies, 301/302 for redirects.
|
|
174
|
+
#
|
|
175
|
+
# Example:
|
|
176
|
+
# /old-path /new-path 301
|
|
177
|
+
`;
|
|
178
|
+
const OG_IMAGE_PLACEHOLDER = `# OG image placeholder
|
|
179
|
+
|
|
180
|
+
Replace this file with \`og-image.png\` (1200x630) before launch. Until then,
|
|
181
|
+
social previews fall back to whichever default the platform chooses, which
|
|
182
|
+
is almost always undesirable.
|
|
183
|
+
|
|
184
|
+
Per SEO baseline standing requirement 2026-05-30.
|
|
185
|
+
`;
|
|
186
|
+
const SEO_CHECKLIST_TEMPLATE = `# SEO Checklist — {{slug}}
|
|
187
|
+
|
|
188
|
+
Per Z2W standing org requirement 2026-05-30. Run before adding a new page AND before launch.
|
|
189
|
+
|
|
190
|
+
## Per-page checklist (every new HTML file)
|
|
191
|
+
|
|
192
|
+
- [ ] \`<title>\` is unique and intentional (not just brand name)
|
|
193
|
+
- [ ] \`<meta name="description">\` is unique and intentional
|
|
194
|
+
- [ ] \`<link rel="canonical">\` set
|
|
195
|
+
- [ ] OG + Twitter Card tags present; \`og:image\` resolves
|
|
196
|
+
- [ ] Exactly one \`<h1>\` stating the page's primary topic
|
|
197
|
+
- [ ] Heading hierarchy logical (H1 → H2 → H3, no skipped levels)
|
|
198
|
+
- [ ] Semantic HTML (\`<main>\`, \`<nav>\`, \`<article>\`, \`<header>\`, \`<footer>\`)
|
|
199
|
+
- [ ] Every meaningful image has descriptive alt text; decorative images use \`alt=""\`
|
|
200
|
+
- [ ] Page added to \`sitemap.xml\` if indexable
|
|
201
|
+
- [ ] JSON-LD added where content type warrants (Article / Event / Product / BreadcrumbList)
|
|
202
|
+
|
|
203
|
+
## Pre-launch audit
|
|
204
|
+
|
|
205
|
+
- [ ] Every indexable page renders primary content in raw HTML (\`curl <url>\`)
|
|
206
|
+
- [ ] Every page has unique intentional title + meta description
|
|
207
|
+
- [ ] Exactly one \`<h1>\` per page; heading hierarchy logical
|
|
208
|
+
- [ ] Canonical URL set on every page
|
|
209
|
+
- [ ] OG + Twitter Card tags present; OG image resolves
|
|
210
|
+
- [ ] Meaningful images have descriptive alt text; decorative images have \`alt=""\`
|
|
211
|
+
- [ ] JSON-LD present where warranted; validates in Google Rich Results test
|
|
212
|
+
- [ ] \`sitemap.xml\` generates correctly; \`robots.txt\` references it
|
|
213
|
+
- [ ] Production is indexable; preview/staging is NOT indexable (\`curl -I https://*.pages.dev/\` shows \`X-Robots-Tag: noindex\`)
|
|
214
|
+
- [ ] Fathom snippet firing (verify in Fathom dashboard with a test pageview)
|
|
215
|
+
- [ ] Core Web Vitals reasonable
|
|
216
|
+
|
|
217
|
+
## Wired at instantiation by \`@zero2webmaster/starter-kit\`
|
|
218
|
+
|
|
219
|
+
- ✅ \`index.html\` — title / description / canonical / OG / Twitter / JSON-LD / Fathom snippet
|
|
220
|
+
- ✅ \`sitemap.xml\`
|
|
221
|
+
- ✅ \`robots.txt\` (references sitemap)
|
|
222
|
+
- ✅ \`_headers\` — preview deploys emit \`X-Robots-Tag: noindex, nofollow\`
|
|
223
|
+
|
|
224
|
+
## Still author-driven (you fill these in)
|
|
225
|
+
|
|
226
|
+
- ⏳ Replace \`__SITE_URL__\` with the real live URL everywhere (index.html, sitemap.xml, robots.txt)
|
|
227
|
+
- ⏳ Replace \`__FATHOM_SITE_ID__\` in index.html with the real Fathom site ID
|
|
228
|
+
- ⏳ Drop a real 1200x630 \`public/og-image.png\` in place of the placeholder
|
|
229
|
+
- ⏳ Tune the \`_headers\` preview-URL pattern if your domain layout differs from the default \`*.pages.dev\` pattern
|
|
230
|
+
`;
|
|
231
|
+
export function scaffoldCfPages(inputs, opts) {
|
|
232
|
+
const spec = resolveBrandSpec(inputs);
|
|
233
|
+
const base = commonBaseFiles(inputs, opts, NARRATIVE);
|
|
234
|
+
const typeSpecific = [
|
|
235
|
+
{ path: "index.html", content: sub(INDEX_HTML_TEMPLATE, inputs, opts, spec) },
|
|
236
|
+
{ path: "robots.txt", content: sub(ROBOTS_TXT_TEMPLATE, inputs, opts, spec) },
|
|
237
|
+
{ path: "sitemap.xml", content: sub(SITEMAP_XML_TEMPLATE, inputs, opts, spec) },
|
|
238
|
+
{ path: "_headers", content: sub(HEADERS_TEMPLATE, inputs, opts, spec) },
|
|
239
|
+
{ path: "_redirects", content: sub(REDIRECTS_TEMPLATE, inputs, opts, spec) },
|
|
240
|
+
{ path: "public/og-image.txt", content: OG_IMAGE_PLACEHOLDER },
|
|
241
|
+
{
|
|
242
|
+
path: "SEO-CHECKLIST.md",
|
|
243
|
+
content: sub(SEO_CHECKLIST_TEMPLATE, inputs, opts, spec),
|
|
244
|
+
},
|
|
245
|
+
];
|
|
246
|
+
return [...base, ...typeSpecific];
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Canonical SEO baseline file list for cf-pages. Exported for tests + the
|
|
250
|
+
* Step 5 standards resolver.
|
|
251
|
+
*/
|
|
252
|
+
export const CF_PAGES_SEO_BASELINE_PATHS = [
|
|
253
|
+
"index.html",
|
|
254
|
+
"robots.txt",
|
|
255
|
+
"sitemap.xml",
|
|
256
|
+
"_headers",
|
|
257
|
+
"SEO-CHECKLIST.md",
|
|
258
|
+
];
|
|
259
|
+
//# sourceMappingURL=cf-pages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cf-pages.js","sourceRoot":"","sources":["../../src/scaffolders/cf-pages.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mEAAmE;AACnE,eAAe;AACf,EAAE;AACF,2CAA2C;AAC3C,uEAAuE;AACvE,sEAAsE;AACtE,sDAAsD;AACtD,2EAA2E;AAC3E,sCAAsC;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AAO,EAAE,GAAG,CAAC,oBAAoB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;QAC/E,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,CAAC,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;QACxE,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,CAAC,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;QAC5E,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,oBAAoB,EAAE;QAC9D;YACE,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,GAAG,CAAC,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;SACzD;KACF,CAAC;IACF,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,YAAY,CAAC,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,UAAU;IACV,kBAAkB;CACV,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ScaffoldInputs } from "../index.js";
|
|
2
|
+
import { type ScaffoldFile, type ScaffolderOptions } from "./common.js";
|
|
3
|
+
export declare function scaffoldCfWorker(inputs: ScaffoldInputs, opts?: ScaffolderOptions): ScaffoldFile[];
|
|
4
|
+
//# sourceMappingURL=cf-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cf-worker.d.ts","sourceRoot":"","sources":["../../src/scaffolders/cf-worker.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAoGrB,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,iBAAiB,GACvB,YAAY,EAAE,CAWhB"}
|