@zero2webmaster/starter-kit 0.48.1 → 0.50.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/README.md +9 -6
- package/dist/cli.js +1 -1
- package/dist/drift-sources.js +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/scaffolders/common.js +1 -1
- package/dist/standards.d.ts +2 -1
- package/dist/standards.js +14 -2
- package/dist/summary.js +18 -3
- package/dist/templates.d.ts +15 -3
- package/dist/templates.js +74 -30
- package/dist/writer.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# z2w-starter-kit
|
|
2
2
|
|
|
3
|
-
**Version:** 0.
|
|
3
|
+
**Version:** 0.50.0 | **Framework:** 2.19.0
|
|
4
4
|
|
|
5
5
|
> Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.
|
|
6
6
|
|
|
@@ -50,7 +50,7 @@ Brand presets: `save-the-frogs`, `bansuri-bliss`, `zero2webmaster`, `custom`.
|
|
|
50
50
|
| `--input <source>` | Non-interactive mode. `--input <path>` reads `ScaffoldInputs` JSON from a file; `--input -` reads from stdin. Bypasses brief / confirm / wizard entirely. For CI use |
|
|
51
51
|
| `--dry-run` | Print the file list + contents that would be written, without touching disk |
|
|
52
52
|
| `--target-path <path>` | Override the target path from inputs |
|
|
53
|
-
| `--templates-path <path>` | Point at a Templates folder other than
|
|
53
|
+
| `--templates-path <path>` | Point at a Templates folder other than the default locations (below). Strict — only that exact folder is consulted |
|
|
54
54
|
| `--promote-standards` | Run the interactive (a) inline / (b) promote-into-Templates dialog per applicable standard. Promoted standards are captured in `STANDARDS_PROMOTIONS.md` alongside the scaffold (the Templates-folder write itself is a v0.3.x concern) |
|
|
55
55
|
| `--allow-non-empty` | Write into a non-empty target directory. Off by default — the CLI refuses to scaffold over existing content unless explicitly opted in |
|
|
56
56
|
| `--no-color` | Suppress ANSI color in the final summary output. Honored regardless of terminal capability, per POSIX `NO_COLOR` convention |
|
|
@@ -70,8 +70,9 @@ For non-WP web apps (`nextjs`, `cf-pages` with `hasWebUi`), the CLI emits the fu
|
|
|
70
70
|
The CLI resolves canonical template content (AGENTS bodies + Resources/) from the **local Templates folder only**:
|
|
71
71
|
|
|
72
72
|
1. **`--templates-path <path>`** if set — strict use of that exact location.
|
|
73
|
-
2. **Local Templates folder** at `~/Desktop/Zero2Webmaster/AI/
|
|
74
|
-
3.
|
|
73
|
+
2. **Local Templates folder** at `~/Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework/` (where it lives after the 2026-11 move).
|
|
74
|
+
3. **The old location**, `~/Desktop/Zero2Webmaster/AI/Templates/`, kept as a fallback. The first folder that holds `Resources/` plus both AGENTS bodies wins, so an empty or half-copied new folder never hides a complete old one.
|
|
75
|
+
4. Otherwise, hard fail with an error that names both locations and the `--templates-path <path>` hint.
|
|
75
76
|
|
|
76
77
|
The CLI reads the folder fresh on every run (nothing is cached or embedded), so an upstream Templates edit is picked up the next time you run `init`.
|
|
77
78
|
|
|
@@ -83,7 +84,9 @@ The Claude Code skill at `~/.claude/skills/instantiate-z2w-project/SKILL.md` and
|
|
|
83
84
|
|
|
84
85
|
## Status
|
|
85
86
|
|
|
86
|
-
- **v0.
|
|
87
|
+
- **v0.50.0 (current)** looks for the Templates folder at `~/Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework/` first and falls back to the old `~/Desktop/Zero2Webmaster/AI/Templates/`, so the folder can move without breaking project creation. If neither folder is usable, the error names both.
|
|
88
|
+
- **v0.49.0** gives the Uptime Kuma next-action the project's own keyword (it still said `"status":"ok"`), tells bulletin projects to report each new monitor to `kuma-watchdog` and to notify `audit-engine` when a project is scaffolded, and extends the American English rule to internal labels such as form and database names.
|
|
89
|
+
- **v0.48.1** fixes the Python install line in `python-service` scaffolds (it failed in zsh), tells you to create Neon projects with autoscaling compute, and keeps the Project Registry's older `status` column from calling a retired project Active.
|
|
87
90
|
- **v0.48.0** stops writing the Airtable inventory mirror by default; the Project Registry in Neon is the only record. Pass `--airtable-row` to write the mirror anyway.
|
|
88
91
|
- **v0.47.2** records a newly scaffolded project as `Scaffolded` in the Project Registry. An existing `Planning` row is promoted; a later stage such as `Live` is never changed.
|
|
89
92
|
- **v0.47.1** reads pasted briefs more accurately. A multi-tenant product now reads as Zero2Webmaster even when it names SAVE THE FROGS! as a tenant. Card payments are no longer switched on by a sentence about another app's checkout, or by a "donate" button. The slug is read from the `# slug — Project Brief` title line.
|
|
@@ -148,4 +151,4 @@ Inquiries: kerry@zero2webmaster.com.
|
|
|
148
151
|
---
|
|
149
152
|
|
|
150
153
|
*Scaffolded 2026-05-28 via the [[instantiate-z2w-project]] Claude Code skill v1; reconciled against the consolidated skill v1.1.0 (brief-first + Agent Coordination block) on 2026-05-29.*
|
|
151
|
-
*Version: 0.
|
|
154
|
+
*Version: 0.50.0 | Last Updated: 2026-11-02*
|
package/dist/cli.js
CHANGED
|
@@ -198,7 +198,7 @@ program
|
|
|
198
198
|
.option("--show-contents", "in --dry-run mode, also print every file's full content")
|
|
199
199
|
.option("--input <source>", "load ScaffoldInputs JSON from a file path, or '-' for stdin (bypasses brief/wizard)")
|
|
200
200
|
.option("--target-path <path>", "absolute path to scaffold into (defaults to inputs.targetPath)")
|
|
201
|
-
.option("--templates-path <path>", "absolute path to the Templates folder (default: ~/Desktop/Zero2Webmaster/AI/Templates)")
|
|
201
|
+
.option("--templates-path <path>", "absolute path to the Templates folder (default: ~/Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework, then ~/Desktop/Zero2Webmaster/AI/Templates)")
|
|
202
202
|
.option("--promote-standards", "run the (a) inline / (b) promote-into-Templates dialog per applicable standard")
|
|
203
203
|
.option("--allow-non-empty", "allow writes into a non-empty target directory (default: refuse)")
|
|
204
204
|
.option("--no-color", "disable colored output (default: auto-detect TTY)")
|
package/dist/drift-sources.js
CHANGED
|
@@ -68,6 +68,9 @@ const SPECS = {
|
|
|
68
68
|
repo: "agent-framework",
|
|
69
69
|
relPath: "Resources/CAPTURE_LEARNINGS_BLOCK.md",
|
|
70
70
|
localCandidates: () => [
|
|
71
|
+
// New location first (the folder moves in 2026-11), legacy kept as a
|
|
72
|
+
// fallback so the byte-diff test does not quietly start skipping.
|
|
73
|
+
join(homedir(), "Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework/Resources/CAPTURE_LEARNINGS_BLOCK.md"),
|
|
71
74
|
join(homedir(), "Desktop/Zero2Webmaster/AI/Templates/Resources/CAPTURE_LEARNINGS_BLOCK.md"),
|
|
72
75
|
],
|
|
73
76
|
guards: "the emitted Capture Learnings block is byte-identical to the canonical source",
|
package/dist/index.d.ts
CHANGED
|
@@ -344,7 +344,7 @@ export interface ScaffoldOptions {
|
|
|
344
344
|
date?: string;
|
|
345
345
|
/**
|
|
346
346
|
* Override the canonical Templates folder location. Defaults to the standard
|
|
347
|
-
* local resolution (`~/Desktop/Zero2Webmaster/AI/Templates/`). A server
|
|
347
|
+
* local resolution (`~/Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework/`, falling back to `AI/Templates/`). A server
|
|
348
348
|
* consumer bundles/mounts Templates and points this at it — the folder is
|
|
349
349
|
* read server-side and never delivered to the client.
|
|
350
350
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// CLAUDE.md uses two marker comments for layering by later ROADMAP steps:
|
|
9
9
|
// - `<!-- STANDARDS_BLOCK -->` is replaced by Step 5 (standards resolver).
|
|
10
10
|
// - `<!-- AGENTS_BODY -->` is replaced by Step 6 (writer) with the
|
|
11
|
-
// canonical AGENTS body read from
|
|
11
|
+
// canonical AGENTS body read from the Templates folder (`AI/Cursor Projects/agent-framework/`, formerly `AI/Templates/`).
|
|
12
12
|
// Step 4 scaffolders emit the markers verbatim so they're easy to grep and
|
|
13
13
|
// trivially testable without a Templates dependency.
|
|
14
14
|
import { getBrandSpec, renderBrandBlock } from "../brand.js";
|
package/dist/standards.d.ts
CHANGED
|
@@ -78,7 +78,8 @@ export interface StandardsResolution {
|
|
|
78
78
|
* family — the safe default for anything else with `has_web_ui=true`.
|
|
79
79
|
*/
|
|
80
80
|
export declare function fathomEnvVarFor(projectType: ProjectType): string;
|
|
81
|
-
export declare const
|
|
81
|
+
export declare const KUMA_WATCHDOG_REPORT = "> \uD83D\uDD34 **After creating any Uptime Kuma monitor** (HTTP keyword or Push), **report it to `kuma-watchdog` in the same session:** a `[\u2192 kuma-watchdog]` item in `projects/kuma-watchdog.md` \u00A7Open questions plus a `## \uD83D\uDCE5 Needs attention` line, carrying `monitor_id,project_slug,mapping_basis,monitor_name,note` (`mapping_basis` is `health_url` or `push_owner`; `note` is the URL and keyword, or the job and its interval). Format and the CRLF trap: [[uptime-kuma-monitor]] \u00A73b. A monitor nobody reported still records heartbeats, but its uptime cannot be credited to this project.";
|
|
82
|
+
export declare const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.37";
|
|
82
83
|
/**
|
|
83
84
|
* The canonical **Capture Learnings** block, emitted VERBATIM into every
|
|
84
85
|
* scaffolded `CLAUDE.md`.
|
package/dist/standards.js
CHANGED
|
@@ -375,6 +375,11 @@ const SKILL_VAULT_BODY = `### Skill Vault awareness (always — read first)
|
|
|
375
375
|
const PORTABLE_STACK_BODY = `### Portable-stack defaults (non-WP)
|
|
376
376
|
|
|
377
377
|
> **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.`;
|
|
378
|
+
// Kerry, 2026-10-29, via `kuma-watchdog`: 4 of 9 monitors made since 10-16 were
|
|
379
|
+
// never reported, because the rule lived only in `uptime-kuma-monitor` §3b and
|
|
380
|
+
// agents create monitors without loading that skill. It has to sit where they
|
|
381
|
+
// already read. Exported so the next-action and the test use the same words.
|
|
382
|
+
export const KUMA_WATCHDOG_REPORT = `> 🔴 **After creating any Uptime Kuma monitor** (HTTP keyword or Push), **report it to \`kuma-watchdog\` in the same session:** a \`[→ kuma-watchdog]\` item in \`projects/kuma-watchdog.md\` §Open questions plus a \`## 📥 Needs attention\` line, carrying \`monitor_id,project_slug,mapping_basis,monitor_name,note\` (\`mapping_basis\` is \`health_url\` or \`push_owner\`; \`note\` is the URL and keyword, or the job and its interval). Format and the CRLF trap: [[uptime-kuma-monitor]] §3b. A monitor nobody reported still records heartbeats, but its uptime cannot be credited to this project.`;
|
|
378
383
|
const FATHOM_BODY = `### Fathom analytics (web UI)
|
|
379
384
|
|
|
380
385
|
> **Analytics:** Fathom Analytics is the single source of truth for this project. Env var name: {{fathom_env_var}}. SPA pattern: \`data-auto="false"\` on the Fathom script, then manual \`trackPageview()\` on route change. One Fathom site = one deployment. See [[fathom-analytics]] for details.`;
|
|
@@ -486,7 +491,7 @@ const NEON_CAREFUL_BODY = `### Neon-careful (Neon Postgres)
|
|
|
486
491
|
// Two consecutive handoffs compared this constant against the DOCUMENT version
|
|
487
492
|
// and reported a "15-version gap" that did not exist — the real gap was 4. Read
|
|
488
493
|
// the `<!-- ... canonical-block vX.Y.Z -->` comment, never the `**Version:**` line.
|
|
489
|
-
export const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.
|
|
494
|
+
export const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.37";
|
|
490
495
|
/**
|
|
491
496
|
* The canonical **Capture Learnings** block, emitted VERBATIM into every
|
|
492
497
|
* scaffolded `CLAUDE.md`.
|
|
@@ -715,7 +720,9 @@ const TEXT_SIZE_BODY = `### Text size (always)
|
|
|
715
720
|
// someone other than Kerry.
|
|
716
721
|
const LANGUAGE_BODY = `### Language (always — en-US)
|
|
717
722
|
|
|
718
|
-
> **Write in American English (en-US) everywhere** — replies, docs, code comments, commit messages, emails, UI copy and bulletin entries — unless the project owner asks otherwise. For example: *installment*, *organization*, *color*, *check*, *canceled* (not *instalment*, *organisation*, *colour*, *cheque*, *cancelled*)
|
|
723
|
+
> **Write in American English (en-US) everywhere** — replies, docs, code comments, commit messages, emails, UI copy and bulletin entries — unless the project owner asks otherwise. For example: *installment*, *organization*, *color*, *check*, *canceled* (not *instalment*, *organisation*, *colour*, *cheque*, *cancelled*).
|
|
724
|
+
>
|
|
725
|
+
> **This includes internal labels nobody reads as prose:** form names, database values, file names, analytics events and ad-conversion names. Formal or business writing is where a model drifts British, so check these words before handing anything over: *inquiry* (not *enquiry*), *program* (not *programme*), *while* (not *whilst*), *catalog*, *center*, *favorite*, *traveled*.`;
|
|
719
726
|
const TEST_COUNT_BODY = `### Test-count reporting (always — at session end)
|
|
720
727
|
|
|
721
728
|
> **Report your test count at session end.** Per Zero2Webmaster standing org rule (2026-06-20), every session that touches code states how many tests pass on a stable, machine-greppable line: \`Tests: {n} passing\` — use the literal word \`Tests:\`, the running total your suite reports, and the word \`passing\`. Put that line in your session-end recap AND, if this project participates in the cross-project bulletin, in the \`## Recent commits\` entry you append (e.g. **\`Tests: 534 passing\`**). The phone-first command center greps this line across every project to display a portfolio-wide tally ("we've run N tests across the portfolio") — a real sales asset, and the uniform one-line format is what makes the total cheap to compute. If this project has no test suite yet, say so explicitly with \`Tests: none yet\` rather than omitting the line.
|
|
@@ -796,6 +803,11 @@ function renderStandardBody(key, inputs, opts) {
|
|
|
796
803
|
if (key === "fathom") {
|
|
797
804
|
body = body.replace(/\{\{fathom_env_var\}\}/g, fathomEnvVarFor(inputs.projectType));
|
|
798
805
|
}
|
|
806
|
+
// Only on the bulletin: `kuma-watchdog` is a Z2W project, and an outside
|
|
807
|
+
// customer's scaffold has no bulletin to report through.
|
|
808
|
+
if (key === "uptime-kuma" && inputs.participateInBulletin) {
|
|
809
|
+
body += "\n>\n" + KUMA_WATCHDOG_REPORT;
|
|
810
|
+
}
|
|
799
811
|
return body;
|
|
800
812
|
}
|
|
801
813
|
function renderPreamble(inputs, opts) {
|
package/dist/summary.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import { Chalk } from "chalk";
|
|
27
27
|
import { buildFirstSessionPrompt, FIRST_SESSION_PROMPT_HEADING, } from "./first-session-prompt.js";
|
|
28
28
|
import { fathomEnvVarFor } from "./standards.js";
|
|
29
|
-
import { applySubstitutions } from "./substitute.js";
|
|
29
|
+
import { applySubstitutions, healthKeyword, todayISODate } from "./substitute.js";
|
|
30
30
|
const Z2W_GREEN = "#82C92B";
|
|
31
31
|
const Z2W_GOLD = "#FFD700";
|
|
32
32
|
const PROMOTIONS_FILE = "STANDARDS_PROMOTIONS.md";
|
|
@@ -119,6 +119,12 @@ function buildNextActions(inputs, result, repoAutoCreated) {
|
|
|
119
119
|
label: `Bootstrap projects/${inputs.slug}.md in zero2webmaster/z2w-agent-coordination`,
|
|
120
120
|
note: "see [[instantiate-z2w-project]] SKILL.md Step 7 + AGENT_PROTOCOL.md §8.3 for the bulletin clone-location 3-step rule",
|
|
121
121
|
});
|
|
122
|
+
// audit-engine, 2026-10-28: its sweep cannot see a row CREATED already
|
|
123
|
+
// `Scaffolded` (a first observation never fires), so the scaffolder says so.
|
|
124
|
+
actions.push({
|
|
125
|
+
label: `In the same bulletin commit, add one line to projects/audit-engine.md §📥 Needs attention: "- ${todayISODate()} · z2w-starter-kit · FYI · **New project scaffolded: \`${inputs.slug}\` (Registry row N, repo ${inputs.githubOrg}/${inputs.slug})** · projects/${inputs.slug}.md"`,
|
|
126
|
+
note: "no thread body needed; replace N with the Project Registry row id",
|
|
127
|
+
});
|
|
122
128
|
}
|
|
123
129
|
if (isDecisionInserted(result.decisions, "fathom")) {
|
|
124
130
|
const envVar = fathomEnvVarFor(inputs.projectType);
|
|
@@ -135,9 +141,18 @@ function buildNextActions(inputs, result, repoAutoCreated) {
|
|
|
135
141
|
}
|
|
136
142
|
if (isDecisionInserted(result.decisions, "uptime-kuma")) {
|
|
137
143
|
actions.push({
|
|
138
|
-
|
|
139
|
-
|
|
144
|
+
// The keyword is the project's own identity token. This line said
|
|
145
|
+
// "status":"ok" until v0.49.0, the exact form the emitted Kuma standard
|
|
146
|
+
// forbids (byte-identical across every service, so a mistyped URL still goes green).
|
|
147
|
+
label: `After first deploy, add an HTTP(s)-Keyword monitor in Uptime Kuma pointing at ${healthPathFor(inputs.projectType)}, keyword "keyword":"${healthKeyword(inputs.slug)}"`,
|
|
148
|
+
note: "see [[uptime-kuma-monitor]] — 60s heartbeat, 2 retries, 60s retry interval, 48s timeout, accepted 200-299; never \"status\":\"ok\" or the bare keyword ok; curl the endpoint and see the keyword before saving",
|
|
140
149
|
});
|
|
150
|
+
if (inputs.participateInBulletin) {
|
|
151
|
+
actions.push({
|
|
152
|
+
label: `In the same session as creating that monitor, report it to kuma-watchdog (a [→ kuma-watchdog] item plus a 📥 line in projects/kuma-watchdog.md, carrying monitor_id,project_slug,mapping_basis,monitor_name,note)`,
|
|
153
|
+
note: "format: [[uptime-kuma-monitor]] §3b; the same rule is in this project's CLAUDE.md under Uptime Kuma",
|
|
154
|
+
});
|
|
155
|
+
}
|
|
141
156
|
}
|
|
142
157
|
if (isDecisionInserted(result.decisions, "sentry")) {
|
|
143
158
|
actions.push({
|
package/dist/templates.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
/** Where the Templates folder lives after the 2026-11 move (preferred). */
|
|
1
2
|
export declare const DEFAULT_TEMPLATES_PATH: string;
|
|
3
|
+
/** Where the Templates folder lived before the move. Kept as a fallback. */
|
|
4
|
+
export declare const LEGACY_TEMPLATES_PATH: string;
|
|
5
|
+
/** The default locations, in the order they are tried. */
|
|
6
|
+
export declare const DEFAULT_TEMPLATES_CANDIDATES: readonly string[];
|
|
2
7
|
export declare const REQUIRED_DIRECTORIES: readonly string[];
|
|
3
8
|
/** Which canonical AGENTS body: the general framework vs the WordPress edition. */
|
|
4
9
|
export type AgentsKind = "general" | "wp";
|
|
@@ -19,13 +24,20 @@ export declare class TemplatesError extends Error {
|
|
|
19
24
|
/**
|
|
20
25
|
* Resolves the Templates folder path and verifies required entries are present.
|
|
21
26
|
*
|
|
27
|
+
* Without an override, the default locations are tried in order
|
|
28
|
+
* (`DEFAULT_TEMPLATES_CANDIDATES`: the new agent-framework folder, then the
|
|
29
|
+
* legacy AI/Templates folder) and the first COMPLETE one wins. A folder that
|
|
30
|
+
* exists but is incomplete never shadows a complete one further down the list.
|
|
31
|
+
*
|
|
22
32
|
* @param override - optional explicit Templates path (e.g. from --templates-path).
|
|
23
33
|
* Tildes are NOT expanded; pass an already-absolute path.
|
|
34
|
+
* An override always wins and is never silently replaced.
|
|
35
|
+
* @param defaults - the default candidates, in order (injectable for tests).
|
|
24
36
|
* @returns the absolute, verified Templates path.
|
|
25
|
-
* @throws TemplatesError when
|
|
26
|
-
*
|
|
37
|
+
* @throws TemplatesError when no usable folder is found; the message names
|
|
38
|
+
* every location that was tried.
|
|
27
39
|
*/
|
|
28
|
-
export declare function resolveTemplatesPath(override?: string): Promise<string>;
|
|
40
|
+
export declare function resolveTemplatesPath(override?: string, defaults?: readonly string[]): Promise<string>;
|
|
29
41
|
/**
|
|
30
42
|
* Reads a single template file fresh from disk. No caching.
|
|
31
43
|
*
|
package/dist/templates.js
CHANGED
|
@@ -10,8 +10,12 @@
|
|
|
10
10
|
// picked up automatically.
|
|
11
11
|
//
|
|
12
12
|
// The CLI resolves Templates from the local folder ONLY — the default
|
|
13
|
-
// location
|
|
14
|
-
//
|
|
13
|
+
// location or an explicit --templates-path override. The default is an
|
|
14
|
+
// ORDERED list (v0.50.0): the folder is moving from
|
|
15
|
+
// ~/Desktop/Zero2Webmaster/AI/Templates to
|
|
16
|
+
// ~/Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework (Kerry approved
|
|
17
|
+
// 2026-11-02), so the new path is tried first and the old one is kept as a
|
|
18
|
+
// fallback for at least one release after the move. The v0.2.0 hosted-mirror fallback
|
|
15
19
|
// (templates.z2w.us + a 24h local cache) was RETIRED 2026-06-23 to protect
|
|
16
20
|
// the framework IP: the public mirror was taken down, so when no local
|
|
17
21
|
// Templates folder is present the CLI now hard-fails with a --templates-path
|
|
@@ -19,7 +23,15 @@
|
|
|
19
23
|
import { promises as fs } from "node:fs";
|
|
20
24
|
import * as path from "node:path";
|
|
21
25
|
import * as os from "node:os";
|
|
22
|
-
|
|
26
|
+
/** Where the Templates folder lives after the 2026-11 move (preferred). */
|
|
27
|
+
export const DEFAULT_TEMPLATES_PATH = path.join(os.homedir(), "Desktop", "Zero2Webmaster", "AI", "Cursor Projects", "agent-framework");
|
|
28
|
+
/** Where the Templates folder lived before the move. Kept as a fallback. */
|
|
29
|
+
export const LEGACY_TEMPLATES_PATH = path.join(os.homedir(), "Desktop", "Zero2Webmaster", "AI", "Templates");
|
|
30
|
+
/** The default locations, in the order they are tried. */
|
|
31
|
+
export const DEFAULT_TEMPLATES_CANDIDATES = [
|
|
32
|
+
DEFAULT_TEMPLATES_PATH,
|
|
33
|
+
LEGACY_TEMPLATES_PATH,
|
|
34
|
+
];
|
|
23
35
|
export const REQUIRED_DIRECTORIES = ["Resources"];
|
|
24
36
|
/**
|
|
25
37
|
* Glob patterns for the two canonical AGENTS bodies in the Templates root.
|
|
@@ -51,28 +63,12 @@ async function isDirectory(p) {
|
|
|
51
63
|
}
|
|
52
64
|
}
|
|
53
65
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @param override - optional explicit Templates path (e.g. from --templates-path).
|
|
57
|
-
* Tildes are NOT expanded; pass an already-absolute path.
|
|
58
|
-
* @returns the absolute, verified Templates path.
|
|
59
|
-
* @throws TemplatesError when the folder is missing, not a directory, or is
|
|
60
|
-
* missing any required file/subdirectory.
|
|
66
|
+
* Returns the list of problems with a candidate Templates folder, or an empty
|
|
67
|
+
* list when it is complete. Never throws.
|
|
61
68
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (override) {
|
|
66
|
-
throw new TemplatesError(`Templates folder not found at the supplied path: ${candidate}\n` +
|
|
67
|
-
`Either the path does not exist, is not a directory, or is not readable. ` +
|
|
68
|
-
`Pass an absolute path with --templates-path, or omit the flag to use the ` +
|
|
69
|
-
`default location (${DEFAULT_TEMPLATES_PATH}).`);
|
|
70
|
-
}
|
|
71
|
-
throw new TemplatesError(`Default Templates folder not found at: ${candidate}\n` +
|
|
72
|
-
`Templates is the canonical source for AGENTS bodies and Resources boilerplate. ` +
|
|
73
|
-
`Either restore the Templates folder at the default location, or pass ` +
|
|
74
|
-
`--templates-path <absolute-path> to point the CLI at an alternative location.`);
|
|
75
|
-
}
|
|
69
|
+
async function templatesFolderProblems(candidate) {
|
|
70
|
+
if (!(await isDirectory(candidate)))
|
|
71
|
+
return ["(folder does not exist)"];
|
|
76
72
|
const missing = [];
|
|
77
73
|
for (const dir of REQUIRED_DIRECTORIES) {
|
|
78
74
|
if (!(await isDirectory(path.join(candidate, dir)))) {
|
|
@@ -93,13 +89,61 @@ export async function resolveTemplatesPath(override) {
|
|
|
93
89
|
missing.push(`${AGENTS_FILE_RE[kind].source} (no match)`);
|
|
94
90
|
}
|
|
95
91
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
return missing;
|
|
93
|
+
}
|
|
94
|
+
function incompleteError(candidate, missing) {
|
|
95
|
+
return new TemplatesError(`Templates folder at ${candidate} is incomplete. Missing required ` +
|
|
96
|
+
`${missing.length === 1 ? "entry" : "entries"}: ${missing.join(", ")}.\n` +
|
|
97
|
+
`Expected: a general AGENTS body (AGENTS_v*.md), a WordPress AGENTS body ` +
|
|
98
|
+
`(AGENTS_WP_v*.md), and the ${REQUIRED_DIRECTORIES.map((d) => `${d}/`).join(", ")} directory.`);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Resolves the Templates folder path and verifies required entries are present.
|
|
102
|
+
*
|
|
103
|
+
* Without an override, the default locations are tried in order
|
|
104
|
+
* (`DEFAULT_TEMPLATES_CANDIDATES`: the new agent-framework folder, then the
|
|
105
|
+
* legacy AI/Templates folder) and the first COMPLETE one wins. A folder that
|
|
106
|
+
* exists but is incomplete never shadows a complete one further down the list.
|
|
107
|
+
*
|
|
108
|
+
* @param override - optional explicit Templates path (e.g. from --templates-path).
|
|
109
|
+
* Tildes are NOT expanded; pass an already-absolute path.
|
|
110
|
+
* An override always wins and is never silently replaced.
|
|
111
|
+
* @param defaults - the default candidates, in order (injectable for tests).
|
|
112
|
+
* @returns the absolute, verified Templates path.
|
|
113
|
+
* @throws TemplatesError when no usable folder is found; the message names
|
|
114
|
+
* every location that was tried.
|
|
115
|
+
*/
|
|
116
|
+
export async function resolveTemplatesPath(override, defaults = DEFAULT_TEMPLATES_CANDIDATES) {
|
|
117
|
+
if (override) {
|
|
118
|
+
const candidate = path.resolve(override);
|
|
119
|
+
if (!(await isDirectory(candidate))) {
|
|
120
|
+
throw new TemplatesError(`Templates folder not found at the supplied path: ${candidate}\n` +
|
|
121
|
+
`Either the path does not exist, is not a directory, or is not readable. ` +
|
|
122
|
+
`Pass an absolute path with --templates-path, or omit the flag to use the ` +
|
|
123
|
+
`default locations (${defaults.join(", then ")}).`);
|
|
124
|
+
}
|
|
125
|
+
const missing = await templatesFolderProblems(candidate);
|
|
126
|
+
if (missing.length > 0)
|
|
127
|
+
throw incompleteError(candidate, missing);
|
|
128
|
+
return candidate;
|
|
129
|
+
}
|
|
130
|
+
let firstIncomplete;
|
|
131
|
+
for (const candidate of defaults) {
|
|
132
|
+
if (!(await isDirectory(candidate)))
|
|
133
|
+
continue;
|
|
134
|
+
const missing = await templatesFolderProblems(candidate);
|
|
135
|
+
if (missing.length === 0)
|
|
136
|
+
return candidate;
|
|
137
|
+
firstIncomplete ??= { candidate, missing };
|
|
138
|
+
}
|
|
139
|
+
if (firstIncomplete) {
|
|
140
|
+
throw incompleteError(firstIncomplete.candidate, firstIncomplete.missing);
|
|
101
141
|
}
|
|
102
|
-
|
|
142
|
+
throw new TemplatesError(`Default Templates folder not found. Looked in:\n` +
|
|
143
|
+
defaults.map((d) => ` - ${d}`).join("\n") +
|
|
144
|
+
`\nTemplates is the canonical source for AGENTS bodies and Resources boilerplate. ` +
|
|
145
|
+
`Either put the Templates folder at one of those locations, or pass ` +
|
|
146
|
+
`--templates-path <absolute-path> to point the CLI at an alternative location.`);
|
|
103
147
|
}
|
|
104
148
|
/**
|
|
105
149
|
* Reads a single template file fresh from disk. No caching.
|
package/dist/writer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// z2w-starter-kit writer — composes the Step 4 scaffolder output, the Step 5
|
|
2
2
|
// standards resolver output, and the canonical AGENTS body read fresh from
|
|
3
|
-
// `~/Desktop/Zero2Webmaster/AI/
|
|
3
|
+
// `~/Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework/` (formerly AI/Templates) into a final file list, then writes
|
|
4
4
|
// the files atomically into the user's target path.
|
|
5
5
|
//
|
|
6
6
|
// Pipeline (in order):
|
|
@@ -108,7 +108,8 @@ function buildPromotionsFile(inputs, promotions, date) {
|
|
|
108
108
|
`**Generated:** ${date}`,
|
|
109
109
|
``,
|
|
110
110
|
`During scaffold the following standards were marked for promotion into`,
|
|
111
|
-
`\`~/Desktop/Zero2Webmaster/AI/
|
|
111
|
+
`\`~/Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework/\` (the Templates`,
|
|
112
|
+
`folder) rather than inlined in CLAUDE.md.`,
|
|
112
113
|
``,
|
|
113
114
|
`v0.1.x of \`@zero2webmaster/starter-kit\` captures the intent only — the`,
|
|
114
115
|
`actual Templates write is a separate follow-up. For each entry below, copy`,
|