@zero2webmaster/starter-kit 0.49.0 → 0.51.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 +7 -1
- package/dist/index.d.ts +1 -1
- package/dist/portfolio.d.ts +8 -0
- package/dist/portfolio.js +26 -3
- package/dist/scaffolders/common.d.ts +1 -1
- package/dist/scaffolders/common.js +3 -2
- package/dist/standards.d.ts +1 -1
- package/dist/standards.js +1 -1
- package/dist/templates.d.ts +19 -3
- package/dist/templates.js +81 -30
- package/dist/writer.js +3 -2
- package/package.json +1 -1
- package/scripts/rollup-integrations.mjs +1 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# z2w-starter-kit
|
|
2
2
|
|
|
3
|
-
**Version:** 0.
|
|
3
|
+
**Version:** 0.51.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/Projects/agent-framework/` (where it lives once the portfolio folder is renamed from `Cursor Projects` to `Projects`).
|
|
74
|
+
3. **The two older locations**, `~/Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework/` and then `~/Desktop/Zero2Webmaster/AI/Templates/`, kept as fallbacks. 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 all three 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.51.0 (current)** gets ready for the portfolio folder `~/Desktop/Zero2Webmaster/AI/Cursor Projects/` to be renamed `~/Desktop/Zero2Webmaster/AI/Projects/`. It looks for the Templates folder at `AI/Projects/agent-framework/` first, then at `AI/Cursor Projects/agent-framework/`, then at the old `AI/Templates/`. The portfolio sweeps and the bulletin lookups follow the rename too, and never count the same folder twice once the old name is a symlink.
|
|
88
|
+
- **v0.50.0** 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.
|
|
89
|
+
- **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.
|
|
87
90
|
- **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.
|
|
88
91
|
- **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.
|
|
89
92
|
- **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.
|
|
@@ -149,4 +152,4 @@ Inquiries: kerry@zero2webmaster.com.
|
|
|
149
152
|
---
|
|
150
153
|
|
|
151
154
|
*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.*
|
|
152
|
-
*Version: 0.
|
|
155
|
+
*Version: 0.51.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/Projects/agent-framework, then ~/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
|
@@ -57,7 +57,9 @@ const SPECS = {
|
|
|
57
57
|
relPath: "AGENT_PROTOCOL.md",
|
|
58
58
|
localCandidates: () => [
|
|
59
59
|
// Since 2026-08-29 these are ONE clone (the Desktop path is a symlink),
|
|
60
|
-
// but
|
|
60
|
+
// but every spelling is kept so a machine that predates that still works.
|
|
61
|
+
// AI/Projects is the portfolio folder's name after ROADMAP Step 59.
|
|
62
|
+
join(homedir(), "Desktop/Zero2Webmaster/AI/Projects/z2w-agent-coordination/AGENT_PROTOCOL.md"),
|
|
61
63
|
join(homedir(), "Desktop/Zero2Webmaster/AI/Cursor Projects/z2w-agent-coordination/AGENT_PROTOCOL.md"),
|
|
62
64
|
join(homedir(), ".cache/z2w-coordination/AGENT_PROTOCOL.md"),
|
|
63
65
|
],
|
|
@@ -68,6 +70,10 @@ const SPECS = {
|
|
|
68
70
|
repo: "agent-framework",
|
|
69
71
|
relPath: "Resources/CAPTURE_LEARNINGS_BLOCK.md",
|
|
70
72
|
localCandidates: () => [
|
|
73
|
+
// Newest location first (AI/Projects after ROADMAP Step 59), older ones
|
|
74
|
+
// kept as fallbacks so the byte-diff test does not quietly start skipping.
|
|
75
|
+
join(homedir(), "Desktop/Zero2Webmaster/AI/Projects/agent-framework/Resources/CAPTURE_LEARNINGS_BLOCK.md"),
|
|
76
|
+
join(homedir(), "Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework/Resources/CAPTURE_LEARNINGS_BLOCK.md"),
|
|
71
77
|
join(homedir(), "Desktop/Zero2Webmaster/AI/Templates/Resources/CAPTURE_LEARNINGS_BLOCK.md"),
|
|
72
78
|
],
|
|
73
79
|
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/Projects/agent-framework/`, falling back to `AI/Cursor Projects/agent-framework/` and then `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
|
*/
|
package/dist/portfolio.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/** Top-level folders that hold Z2W project repos, in scan order. */
|
|
2
2
|
export declare function portfolioRoots(env?: NodeJS.ProcessEnv): string[];
|
|
3
|
+
/**
|
|
4
|
+
* The Zero2Webmaster root across the `AI/Cursor Projects` -> `AI/Projects`
|
|
5
|
+
* rename. `AI/Projects` when it exists; `AI/Cursor Projects` as well only when
|
|
6
|
+
* it is a SEPARATE real folder (not the symlink the rename leaves behind); and
|
|
7
|
+
* `AI/Projects` alone when neither exists, so the absent root is reported under
|
|
8
|
+
* its current name rather than the retired one.
|
|
9
|
+
*/
|
|
10
|
+
export declare function zero2webmasterRoots(desktop: string): string[];
|
|
3
11
|
export interface PortfolioRepo {
|
|
4
12
|
/** The path as found under its root (what a caller should pass on). */
|
|
5
13
|
path: string;
|
package/dist/portfolio.js
CHANGED
|
@@ -13,8 +13,13 @@
|
|
|
13
13
|
//
|
|
14
14
|
// `z2w-agent-coordination` hit the same thing on 2026-09-18 and fixed its drift
|
|
15
15
|
// sweep with this same three-root list (`scripts/check-fingerprint-drift.sh`).
|
|
16
|
-
// Keep the two in step: when Kerry starts a new top-level
|
|
17
|
-
//
|
|
16
|
+
// Keep the two in step: when Kerry starts a new top-level projects folder, add
|
|
17
|
+
// it HERE and THERE. [[zero-is-not-a-pass]]
|
|
18
|
+
//
|
|
19
|
+
// v0.51.0 (ROADMAP Step 59): the Zero2Webmaster root is being renamed from
|
|
20
|
+
// `AI/Cursor Projects` to `AI/Projects`, with a symlink left at the old name.
|
|
21
|
+
// `zero2webmasterRoots()` picks whichever is real, so the same folder is never
|
|
22
|
+
// listed twice and the sweep works before, during and after the `mv`.
|
|
18
23
|
import { existsSync, lstatSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
19
24
|
import { homedir } from "node:os";
|
|
20
25
|
import { join } from "node:path";
|
|
@@ -26,11 +31,29 @@ export function portfolioRoots(env = process.env) {
|
|
|
26
31
|
return [env.Z2W_PORTFOLIO_DIR];
|
|
27
32
|
const desktop = join(env.HOME ?? homedir(), "Desktop");
|
|
28
33
|
return [
|
|
29
|
-
|
|
34
|
+
...zero2webmasterRoots(desktop),
|
|
30
35
|
join(desktop, "VideoMigrator", "Cursor Projects"),
|
|
31
36
|
join(desktop, "KERRY KRIGER", "Cursor Projects"),
|
|
32
37
|
];
|
|
33
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* The Zero2Webmaster root across the `AI/Cursor Projects` -> `AI/Projects`
|
|
41
|
+
* rename. `AI/Projects` when it exists; `AI/Cursor Projects` as well only when
|
|
42
|
+
* it is a SEPARATE real folder (not the symlink the rename leaves behind); and
|
|
43
|
+
* `AI/Projects` alone when neither exists, so the absent root is reported under
|
|
44
|
+
* its current name rather than the retired one.
|
|
45
|
+
*/
|
|
46
|
+
export function zero2webmasterRoots(desktop) {
|
|
47
|
+
const renamed = join(desktop, "Zero2Webmaster", "AI", "Projects");
|
|
48
|
+
const preRename = join(desktop, "Zero2Webmaster", "AI", "Cursor Projects");
|
|
49
|
+
const roots = [];
|
|
50
|
+
if (isDir(renamed))
|
|
51
|
+
roots.push(renamed);
|
|
52
|
+
if (isDir(preRename) && (!isDir(renamed) || realpathSync(preRename) !== realpathSync(renamed))) {
|
|
53
|
+
roots.push(preRename);
|
|
54
|
+
}
|
|
55
|
+
return roots.length > 0 ? roots : [renamed];
|
|
56
|
+
}
|
|
34
57
|
/**
|
|
35
58
|
* Every git repo directly under every present root, deduplicated by real path.
|
|
36
59
|
* Missing roots are REPORTED in `roots`, never silently dropped — a machine
|
|
@@ -75,7 +75,7 @@ export declare function commonHandoff(inputs: ScaffoldInputs, opts: ScaffolderOp
|
|
|
75
75
|
* CLAUDE.md is validated for leftover markers — see writer.ts).
|
|
76
76
|
*/
|
|
77
77
|
export declare function commonProjectBrief(inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): ScaffoldFile | null;
|
|
78
|
-
export declare const COORDINATION_ONBOARDING_TEMPLATE = "# Coordination Onboarding \u2014 {{slug}}\n\n> **Read this first if you're a fresh agent on `{{slug}}`.** This is a short\n> pointer, not the full guide. `{{slug}}` participates in the Z2W cross-project\n> coordination bulletin, and the canonical, always-current onboarding primer lives\n> in the bulletin repo \u2014 **not here** \u2014 so there is a single source of truth.\n\n## Where the canonical primer lives\n\nRead **`COORDINATION_ONBOARDING.md`** at the root of the coordination bulletin repo\n(`zero2webmaster/z2w-agent-coordination`). There is ONE local clone, at\n`~/.cache/z2w-coordination` \u2014 the Desktop path\n`~/Desktop/Zero2Webmaster/AI/
|
|
78
|
+
export declare const COORDINATION_ONBOARDING_TEMPLATE = "# Coordination Onboarding \u2014 {{slug}}\n\n> **Read this first if you're a fresh agent on `{{slug}}`.** This is a short\n> pointer, not the full guide. `{{slug}}` participates in the Z2W cross-project\n> coordination bulletin, and the canonical, always-current onboarding primer lives\n> in the bulletin repo \u2014 **not here** \u2014 so there is a single source of truth.\n\n## Where the canonical primer lives\n\nRead **`COORDINATION_ONBOARDING.md`** at the root of the coordination bulletin repo\n(`zero2webmaster/z2w-agent-coordination`). There is ONE local clone, at\n`~/.cache/z2w-coordination` \u2014 the Desktop path\n`~/Desktop/Zero2Webmaster/AI/Projects/z2w-agent-coordination/` (formerly\n`AI/Cursor Projects/`) is a symlink to it.\n\n\uD83D\uDD34 **Never `git pull` or edit in that shared clone.** Take a private workspace\nfirst \u2014 from the clone, `WS=\"$(bash scripts/agent-workspace.sh {{slug}})\"` then\n`cd \"$WS\"` \u2014 and read and write only there. The `## Agent Coordination` section of\nthis project's `CLAUDE.md` has the exact steps; where it and the primer disagree,\nthe live `AGENT_PROTOCOL.md` wins.\n\nThe primer orients you to the three core Z2W systems (the coordination bulletin,\nthe Skill Vault, and the starter-kit + Templates) and walks you through joining\nthe bulletin as `{{slug}}`.\n\n## The one rule that must not drift\n\nThe `## Agent Coordination` section of this project's `CLAUDE.md` / `AGENTS.md` is\neither a short **pointer** to the live `AGENT_PROTOCOL.md` (preferred) or a\n**verbatim** copy of it carrying the current\n`<!-- z2w-agent-coordination canonical-block vX.Y.Z -->` fingerprint. **Never\nparaphrase it**, and never copy a version-frozen block from another project or\nfrom a primer snapshot \u2014 that is exactly how canonical-block drift happens.\n\n## Your bulletin file\n\nThis project's bulletin file is `projects/{{slug}}.md`. Read it in protocol order at\nsession start (`## Incidents` \u2192 `## Inbox from Kerry` \u2192 `## Open questions` \u2192\n`## Heads-ups`), then `global.md`. Rewrite `## Current focus` at session end.\n\n---\n\n*Pointer emitted at scaffold time by `@zero2webmaster/starter-kit` (mirrors\n[[instantiate-z2w-project]]). The canonical primer it links is owned by\n`z2w-agent-coordination` \u2014 improve it THERE, never fork a per-project copy.*\n";
|
|
79
79
|
/**
|
|
80
80
|
* Emit the short coordination-onboarding pointer — but ONLY for a project that
|
|
81
81
|
* participates in the bulletin. Returns null otherwise (a non-participating
|
|
@@ -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/Projects/agent-framework/`, formerly `AI/Cursor Projects/agent-framework/` and `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";
|
|
@@ -841,7 +841,8 @@ export const COORDINATION_ONBOARDING_TEMPLATE = `# Coordination Onboarding — {
|
|
|
841
841
|
Read **\`COORDINATION_ONBOARDING.md\`** at the root of the coordination bulletin repo
|
|
842
842
|
(\`zero2webmaster/z2w-agent-coordination\`). There is ONE local clone, at
|
|
843
843
|
\`~/.cache/z2w-coordination\` — the Desktop path
|
|
844
|
-
\`~/Desktop/Zero2Webmaster/AI/
|
|
844
|
+
\`~/Desktop/Zero2Webmaster/AI/Projects/z2w-agent-coordination/\` (formerly
|
|
845
|
+
\`AI/Cursor Projects/\`) is a symlink to it.
|
|
845
846
|
|
|
846
847
|
🔴 **Never \`git pull\` or edit in that shared clone.** Take a private workspace
|
|
847
848
|
first — from the clone, \`WS="$(bash scripts/agent-workspace.sh {{slug}})"\` then
|
package/dist/standards.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export interface StandardsResolution {
|
|
|
79
79
|
*/
|
|
80
80
|
export declare function fathomEnvVarFor(projectType: ProjectType): string;
|
|
81
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.
|
|
82
|
+
export declare const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.37";
|
|
83
83
|
/**
|
|
84
84
|
* The canonical **Capture Learnings** block, emitted VERBATIM into every
|
|
85
85
|
* scaffolded `CLAUDE.md`.
|
package/dist/standards.js
CHANGED
|
@@ -491,7 +491,7 @@ const NEON_CAREFUL_BODY = `### Neon-careful (Neon Postgres)
|
|
|
491
491
|
// Two consecutive handoffs compared this constant against the DOCUMENT version
|
|
492
492
|
// and reported a "15-version gap" that did not exist — the real gap was 4. Read
|
|
493
493
|
// the `<!-- ... canonical-block vX.Y.Z -->` comment, never the `**Version:**` line.
|
|
494
|
-
export const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.
|
|
494
|
+
export const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.37";
|
|
495
495
|
/**
|
|
496
496
|
* The canonical **Capture Learnings** block, emitted VERBATIM into every
|
|
497
497
|
* scaffolded `CLAUDE.md`.
|
package/dist/templates.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
/** Where the Templates folder lives once `AI/Cursor Projects` is renamed `AI/Projects` (preferred). */
|
|
1
2
|
export declare const DEFAULT_TEMPLATES_PATH: string;
|
|
3
|
+
/** Where the Templates folder lived from the 2026-11-02 move until the portfolio-folder rename. */
|
|
4
|
+
export declare const PRE_RENAME_TEMPLATES_PATH: string;
|
|
5
|
+
/** Where the Templates folder lived before 2026-11-02. Kept as a fallback. */
|
|
6
|
+
export declare const LEGACY_TEMPLATES_PATH: string;
|
|
7
|
+
/** The default locations, in the order they are tried. */
|
|
8
|
+
export declare const DEFAULT_TEMPLATES_CANDIDATES: readonly string[];
|
|
2
9
|
export declare const REQUIRED_DIRECTORIES: readonly string[];
|
|
3
10
|
/** Which canonical AGENTS body: the general framework vs the WordPress edition. */
|
|
4
11
|
export type AgentsKind = "general" | "wp";
|
|
@@ -19,13 +26,22 @@ export declare class TemplatesError extends Error {
|
|
|
19
26
|
/**
|
|
20
27
|
* Resolves the Templates folder path and verifies required entries are present.
|
|
21
28
|
*
|
|
29
|
+
* Without an override, the default locations are tried in order
|
|
30
|
+
* (`DEFAULT_TEMPLATES_CANDIDATES`: `AI/Projects/agent-framework`, then
|
|
31
|
+
* `AI/Cursor Projects/agent-framework`, then the legacy `AI/Templates`) and the
|
|
32
|
+
* first COMPLETE one wins. After the rename, the second path is normally a
|
|
33
|
+
* symlink to the first, so both name the same folder; that is harmless. A folder that
|
|
34
|
+
* exists but is incomplete never shadows a complete one further down the list.
|
|
35
|
+
*
|
|
22
36
|
* @param override - optional explicit Templates path (e.g. from --templates-path).
|
|
23
37
|
* Tildes are NOT expanded; pass an already-absolute path.
|
|
38
|
+
* An override always wins and is never silently replaced.
|
|
39
|
+
* @param defaults - the default candidates, in order (injectable for tests).
|
|
24
40
|
* @returns the absolute, verified Templates path.
|
|
25
|
-
* @throws TemplatesError when
|
|
26
|
-
*
|
|
41
|
+
* @throws TemplatesError when no usable folder is found; the message names
|
|
42
|
+
* every location that was tried.
|
|
27
43
|
*/
|
|
28
|
-
export declare function resolveTemplatesPath(override?: string): Promise<string>;
|
|
44
|
+
export declare function resolveTemplatesPath(override?: string, defaults?: readonly string[]): Promise<string>;
|
|
29
45
|
/**
|
|
30
46
|
* Reads a single template file fresh from disk. No caching.
|
|
31
47
|
*
|
package/dist/templates.js
CHANGED
|
@@ -10,8 +10,14 @@
|
|
|
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 moved from
|
|
15
|
+
// ~/Desktop/Zero2Webmaster/AI/Templates to
|
|
16
|
+
// ~/Desktop/Zero2Webmaster/AI/Cursor Projects/agent-framework (Kerry approved
|
|
17
|
+
// 2026-11-02). v0.51.0: the portfolio folder itself is being renamed from
|
|
18
|
+
// `AI/Cursor Projects` to `AI/Projects` (Kerry confirmed the name 2026-11-02,
|
|
19
|
+
// ROADMAP Step 59), so the newest path is tried first and each older one is
|
|
20
|
+
// kept as a fallback for at least one release after its move. The v0.2.0 hosted-mirror fallback
|
|
15
21
|
// (templates.z2w.us + a 24h local cache) was RETIRED 2026-06-23 to protect
|
|
16
22
|
// the framework IP: the public mirror was taken down, so when no local
|
|
17
23
|
// Templates folder is present the CLI now hard-fails with a --templates-path
|
|
@@ -19,7 +25,18 @@
|
|
|
19
25
|
import { promises as fs } from "node:fs";
|
|
20
26
|
import * as path from "node:path";
|
|
21
27
|
import * as os from "node:os";
|
|
22
|
-
|
|
28
|
+
/** Where the Templates folder lives once `AI/Cursor Projects` is renamed `AI/Projects` (preferred). */
|
|
29
|
+
export const DEFAULT_TEMPLATES_PATH = path.join(os.homedir(), "Desktop", "Zero2Webmaster", "AI", "Projects", "agent-framework");
|
|
30
|
+
/** Where the Templates folder lived from the 2026-11-02 move until the portfolio-folder rename. */
|
|
31
|
+
export const PRE_RENAME_TEMPLATES_PATH = path.join(os.homedir(), "Desktop", "Zero2Webmaster", "AI", "Cursor Projects", "agent-framework");
|
|
32
|
+
/** Where the Templates folder lived before 2026-11-02. Kept as a fallback. */
|
|
33
|
+
export const LEGACY_TEMPLATES_PATH = path.join(os.homedir(), "Desktop", "Zero2Webmaster", "AI", "Templates");
|
|
34
|
+
/** The default locations, in the order they are tried. */
|
|
35
|
+
export const DEFAULT_TEMPLATES_CANDIDATES = [
|
|
36
|
+
DEFAULT_TEMPLATES_PATH,
|
|
37
|
+
PRE_RENAME_TEMPLATES_PATH,
|
|
38
|
+
LEGACY_TEMPLATES_PATH,
|
|
39
|
+
];
|
|
23
40
|
export const REQUIRED_DIRECTORIES = ["Resources"];
|
|
24
41
|
/**
|
|
25
42
|
* Glob patterns for the two canonical AGENTS bodies in the Templates root.
|
|
@@ -51,28 +68,12 @@ async function isDirectory(p) {
|
|
|
51
68
|
}
|
|
52
69
|
}
|
|
53
70
|
/**
|
|
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.
|
|
71
|
+
* Returns the list of problems with a candidate Templates folder, or an empty
|
|
72
|
+
* list when it is complete. Never throws.
|
|
61
73
|
*/
|
|
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
|
-
}
|
|
74
|
+
async function templatesFolderProblems(candidate) {
|
|
75
|
+
if (!(await isDirectory(candidate)))
|
|
76
|
+
return ["(folder does not exist)"];
|
|
76
77
|
const missing = [];
|
|
77
78
|
for (const dir of REQUIRED_DIRECTORIES) {
|
|
78
79
|
if (!(await isDirectory(path.join(candidate, dir)))) {
|
|
@@ -93,13 +94,63 @@ export async function resolveTemplatesPath(override) {
|
|
|
93
94
|
missing.push(`${AGENTS_FILE_RE[kind].source} (no match)`);
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
return missing;
|
|
98
|
+
}
|
|
99
|
+
function incompleteError(candidate, missing) {
|
|
100
|
+
return new TemplatesError(`Templates folder at ${candidate} is incomplete. Missing required ` +
|
|
101
|
+
`${missing.length === 1 ? "entry" : "entries"}: ${missing.join(", ")}.\n` +
|
|
102
|
+
`Expected: a general AGENTS body (AGENTS_v*.md), a WordPress AGENTS body ` +
|
|
103
|
+
`(AGENTS_WP_v*.md), and the ${REQUIRED_DIRECTORIES.map((d) => `${d}/`).join(", ")} directory.`);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Resolves the Templates folder path and verifies required entries are present.
|
|
107
|
+
*
|
|
108
|
+
* Without an override, the default locations are tried in order
|
|
109
|
+
* (`DEFAULT_TEMPLATES_CANDIDATES`: `AI/Projects/agent-framework`, then
|
|
110
|
+
* `AI/Cursor Projects/agent-framework`, then the legacy `AI/Templates`) and the
|
|
111
|
+
* first COMPLETE one wins. After the rename, the second path is normally a
|
|
112
|
+
* symlink to the first, so both name the same folder; that is harmless. A folder that
|
|
113
|
+
* exists but is incomplete never shadows a complete one further down the list.
|
|
114
|
+
*
|
|
115
|
+
* @param override - optional explicit Templates path (e.g. from --templates-path).
|
|
116
|
+
* Tildes are NOT expanded; pass an already-absolute path.
|
|
117
|
+
* An override always wins and is never silently replaced.
|
|
118
|
+
* @param defaults - the default candidates, in order (injectable for tests).
|
|
119
|
+
* @returns the absolute, verified Templates path.
|
|
120
|
+
* @throws TemplatesError when no usable folder is found; the message names
|
|
121
|
+
* every location that was tried.
|
|
122
|
+
*/
|
|
123
|
+
export async function resolveTemplatesPath(override, defaults = DEFAULT_TEMPLATES_CANDIDATES) {
|
|
124
|
+
if (override) {
|
|
125
|
+
const candidate = path.resolve(override);
|
|
126
|
+
if (!(await isDirectory(candidate))) {
|
|
127
|
+
throw new TemplatesError(`Templates folder not found at the supplied path: ${candidate}\n` +
|
|
128
|
+
`Either the path does not exist, is not a directory, or is not readable. ` +
|
|
129
|
+
`Pass an absolute path with --templates-path, or omit the flag to use the ` +
|
|
130
|
+
`default locations (${defaults.join(", then ")}).`);
|
|
131
|
+
}
|
|
132
|
+
const missing = await templatesFolderProblems(candidate);
|
|
133
|
+
if (missing.length > 0)
|
|
134
|
+
throw incompleteError(candidate, missing);
|
|
135
|
+
return candidate;
|
|
136
|
+
}
|
|
137
|
+
let firstIncomplete;
|
|
138
|
+
for (const candidate of defaults) {
|
|
139
|
+
if (!(await isDirectory(candidate)))
|
|
140
|
+
continue;
|
|
141
|
+
const missing = await templatesFolderProblems(candidate);
|
|
142
|
+
if (missing.length === 0)
|
|
143
|
+
return candidate;
|
|
144
|
+
firstIncomplete ??= { candidate, missing };
|
|
145
|
+
}
|
|
146
|
+
if (firstIncomplete) {
|
|
147
|
+
throw incompleteError(firstIncomplete.candidate, firstIncomplete.missing);
|
|
101
148
|
}
|
|
102
|
-
|
|
149
|
+
throw new TemplatesError(`Default Templates folder not found. Looked in:\n` +
|
|
150
|
+
defaults.map((d) => ` - ${d}`).join("\n") +
|
|
151
|
+
`\nTemplates is the canonical source for AGENTS bodies and Resources boilerplate. ` +
|
|
152
|
+
`Either put the Templates folder at one of those locations, or pass ` +
|
|
153
|
+
`--templates-path <absolute-path> to point the CLI at an alternative location.`);
|
|
103
154
|
}
|
|
104
155
|
/**
|
|
105
156
|
* 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/Projects/agent-framework/` (formerly AI/Cursor Projects/agent-framework, and before that 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/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`,
|
package/package.json
CHANGED
|
@@ -110,6 +110,7 @@ import { neon } from "@neondatabase/serverless";
|
|
|
110
110
|
const VALID_STATUS = new Set(["Planning", "Scaffolded", "Live", "Dormant", "Retired"]);
|
|
111
111
|
|
|
112
112
|
const DEFAULT_BULLETIN_DIRS = [
|
|
113
|
+
join(process.env.HOME ?? "", "Desktop/Zero2Webmaster/AI/Projects/z2w-agent-coordination"),
|
|
113
114
|
join(process.env.HOME ?? "", "Desktop/Zero2Webmaster/AI/Cursor Projects/z2w-agent-coordination"),
|
|
114
115
|
join(process.env.HOME ?? "", ".cache/z2w-coordination"),
|
|
115
116
|
];
|