@zero2webmaster/starter-kit 0.3.1 → 0.5.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 +2 -2
- package/dist/airtable.d.ts +7 -6
- package/dist/airtable.js +8 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/scaffolders/cf-worker.js +56 -1
- package/dist/scaffolders/common.d.ts +1 -0
- package/dist/scaffolders/common.js +3 -1
- package/dist/standards.d.ts +19 -0
- package/dist/standards.js +99 -35
- package/dist/writer.js +11 -3
- 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.5.0 | **Framework:** 2.13.0
|
|
4
4
|
|
|
5
5
|
> Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.
|
|
6
6
|
|
|
@@ -99,4 +99,4 @@ For licensing inquiries: kerry@zero2webmaster.com.
|
|
|
99
99
|
---
|
|
100
100
|
|
|
101
101
|
*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.*
|
|
102
|
-
*Version: 0.
|
|
102
|
+
*Version: 0.5.0 | Last Updated: 2026-07-19*
|
package/dist/airtable.d.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { type ScaffoldInputs } from "./index.js";
|
|
|
3
3
|
export declare const AIRTABLE_API_BASE = "https://api.airtable.com/v0";
|
|
4
4
|
/**
|
|
5
5
|
* The marker the scaffolder actually writes when the agent-coordination
|
|
6
|
-
* standard applies
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* standard applies. As of the verbatim-canonical-block change (v0.4.0), a
|
|
7
|
+
* scaffolded project DOES carry the real `<!-- z2w-agent-coordination
|
|
8
|
+
* canonical-block vX.Y.Z -->` HTML fingerprint — the same token cross-project
|
|
9
|
+
* drift detection (Signal A) greps for — so a fresh scaffold passes drift
|
|
10
|
+
* detection with no manual first-session re-sync. We grep-verify against that
|
|
11
|
+
* fingerprint, with the block's lead sentence retained as a fallback for older
|
|
12
|
+
* scaffolds that predate the fingerprint emission.
|
|
12
13
|
*/
|
|
13
14
|
export declare const COORDINATION_BLOCK_MARKER: RegExp;
|
|
14
15
|
/**
|
package/dist/airtable.js
CHANGED
|
@@ -28,14 +28,15 @@ import { version } from "./index.js";
|
|
|
28
28
|
export const AIRTABLE_API_BASE = "https://api.airtable.com/v0";
|
|
29
29
|
/**
|
|
30
30
|
* The marker the scaffolder actually writes when the agent-coordination
|
|
31
|
-
* standard applies
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
31
|
+
* standard applies. As of the verbatim-canonical-block change (v0.4.0), a
|
|
32
|
+
* scaffolded project DOES carry the real `<!-- z2w-agent-coordination
|
|
33
|
+
* canonical-block vX.Y.Z -->` HTML fingerprint — the same token cross-project
|
|
34
|
+
* drift detection (Signal A) greps for — so a fresh scaffold passes drift
|
|
35
|
+
* detection with no manual first-session re-sync. We grep-verify against that
|
|
36
|
+
* fingerprint, with the block's lead sentence retained as a fallback for older
|
|
37
|
+
* scaffolds that predate the fingerprint emission.
|
|
37
38
|
*/
|
|
38
|
-
export const COORDINATION_BLOCK_MARKER =
|
|
39
|
+
export const COORDINATION_BLOCK_MARKER = /<!-- z2w-agent-coordination canonical-block v\d+\.\d+\.\d+ -->|participates in the Z2W cross-project coordination bulletin/;
|
|
39
40
|
/**
|
|
40
41
|
* "Verify, don't assert" (mirrors [[github-readme-and-version-integrity]]).
|
|
41
42
|
* Read the freshly-written scaffold and report whether it actually carries the
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeScaffold } from "./writer.js";
|
|
2
2
|
import type { ScaffoldFile } from "./scaffolders/common.js";
|
|
3
3
|
import type { StandardDecision } from "./standards.js";
|
|
4
|
-
export declare const version = "0.
|
|
4
|
+
export declare const version = "0.5.0";
|
|
5
5
|
export type ProjectType = "wp-plugin" | "cf-worker" | "cf-pages" | "nextjs" | "python-service" | "node-service" | "library" | "protocol-repo";
|
|
6
6
|
export type BrandPreset = "save-the-frogs" | "bansuri-bliss" | "zero2webmaster" | "custom";
|
|
7
7
|
export type DbStrategy = "none" | "neon-postgres" | "supabase" | "sqlite" | "mysql-wp" | "other";
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import * as path from "node:path";
|
|
|
21
21
|
import { Writable } from "node:stream";
|
|
22
22
|
import { isValidSlug } from "./parse-brief.js";
|
|
23
23
|
import { writeScaffold } from "./writer.js";
|
|
24
|
-
export const version = "0.
|
|
24
|
+
export const version = "0.5.0";
|
|
25
25
|
// Canonical enum value-arrays. These live here, next to the type unions they
|
|
26
26
|
// enumerate, so both the CLI's confirm/wizard flows (which re-export them) and
|
|
27
27
|
// the programmatic `validateScaffoldInputs` share one source of truth. Keep
|
|
@@ -22,6 +22,8 @@ npx wrangler deploy # deploy to Cloudflare
|
|
|
22
22
|
**Secrets:** local secrets live in \`.dev.vars\` (gitignored). Production secrets via \`wrangler secret put\`.
|
|
23
23
|
|
|
24
24
|
**Observability:** enabled in \`wrangler.jsonc\`.
|
|
25
|
+
|
|
26
|
+
**Tests:** \`npm test\` runs vitest against the Worker's fetch handler (a sample test in \`src/index.test.ts\` asserts the DB-free \`/health\` contract + a 404 fallback). These are **plain vitest** unit tests over the handler — they run on Node's global \`Request\`/\`Response\`, no \`workerd\` runtime needed. Once the Worker binds KV / Durable Objects / D1 / R2 that must be exercised in the real runtime, graduate to \`@cloudflare/vitest-pool-workers\`.
|
|
25
27
|
`;
|
|
26
28
|
const WRANGLER_TEMPLATE = `{
|
|
27
29
|
"$schema": "node_modules/wrangler/config-schema.json",
|
|
@@ -64,15 +66,66 @@ const PACKAGE_JSON_TEMPLATE = `{
|
|
|
64
66
|
"scripts": {
|
|
65
67
|
"dev": "wrangler dev",
|
|
66
68
|
"deploy": "wrangler deploy",
|
|
67
|
-
"typecheck": "tsc --noEmit"
|
|
69
|
+
"typecheck": "tsc --noEmit",
|
|
70
|
+
"test": "vitest run",
|
|
71
|
+
"test:watch": "vitest"
|
|
68
72
|
},
|
|
69
73
|
"devDependencies": {
|
|
70
74
|
"@cloudflare/workers-types": "^5.20260714.1",
|
|
71
75
|
"typescript": "^5.4.0",
|
|
76
|
+
"vitest": "^4.1.0",
|
|
72
77
|
"wrangler": "^4.112.0"
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
`;
|
|
81
|
+
// Plain vitest over the fetch handler (NOT @cloudflare/vitest-pool-workers).
|
|
82
|
+
// The Worker's routing + DB-free /health logic is pure Request→Response and runs
|
|
83
|
+
// on Node 20+'s global Request/Response/URL, so it needs no workerd runtime — the
|
|
84
|
+
// lightest thing that lets a fresh scaffold pass `npm test` out of the box,
|
|
85
|
+
// matching the node-service / library pattern. Include only src test files; the
|
|
86
|
+
// deployed bundle (main = src/index.ts) never imports them, so they're excluded
|
|
87
|
+
// from `wrangler deploy` automatically.
|
|
88
|
+
const VITEST_CONFIG_TEMPLATE = `import { defineConfig } from "vitest/config";
|
|
89
|
+
|
|
90
|
+
export default defineConfig({
|
|
91
|
+
test: {
|
|
92
|
+
include: ["src/**/*.test.ts"],
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
`;
|
|
96
|
+
// Sample test proving a brand-new cf-worker scaffold is green on first `npm test`.
|
|
97
|
+
// tsconfig already sets skipLibCheck, so vitest's own types resolve without
|
|
98
|
+
// pulling in @types/node (which would collide with @cloudflare/workers-types on
|
|
99
|
+
// the global Request/Response). The handler is imported and driven directly.
|
|
100
|
+
const SRC_INDEX_TEST_TEMPLATE = `// Smoke test for the {{slug}} Worker fetch handler.
|
|
101
|
+
//
|
|
102
|
+
// Plain vitest (Node), not @cloudflare/vitest-pool-workers: the /health and 404
|
|
103
|
+
// paths are pure Request→Response and read neither bindings nor the execution
|
|
104
|
+
// context, so Node's global Request/Response is enough. If this Worker later
|
|
105
|
+
// binds KV / Durable Objects / D1 / R2 (or reads \`cf\` request properties) that
|
|
106
|
+
// must run in the real runtime, graduate to @cloudflare/vitest-pool-workers.
|
|
107
|
+
|
|
108
|
+
import { describe, expect, it } from "vitest";
|
|
109
|
+
|
|
110
|
+
import worker, { type Env } from "./index";
|
|
111
|
+
|
|
112
|
+
// Minimal stand-ins — the routes under test touch neither.
|
|
113
|
+
const env = {} as Env;
|
|
114
|
+
const ctx = {} as ExecutionContext;
|
|
115
|
+
|
|
116
|
+
describe("{{slug}} Worker fetch handler", () => {
|
|
117
|
+
it("GET /health returns 200 {status: ok} without touching the database", async () => {
|
|
118
|
+
const res = await worker.fetch(new Request("https://example.com/health"), env, ctx);
|
|
119
|
+
expect(res.status).toBe(200);
|
|
120
|
+
expect(await res.json()).toEqual({ status: "ok" });
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("unknown routes return 404", async () => {
|
|
124
|
+
const res = await worker.fetch(new Request("https://example.com/nope"), env, ctx);
|
|
125
|
+
expect(res.status).toBe(404);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
`;
|
|
76
129
|
const TSCONFIG_TEMPLATE = `{
|
|
77
130
|
"compilerOptions": {
|
|
78
131
|
"target": "ES2022",
|
|
@@ -103,8 +156,10 @@ export function scaffoldCfWorker(inputs, opts) {
|
|
|
103
156
|
const typeSpecific = [
|
|
104
157
|
{ path: "wrangler.jsonc", content: sub(WRANGLER_TEMPLATE, inputs, opts, spec) },
|
|
105
158
|
{ path: "src/index.ts", content: sub(SRC_INDEX_TEMPLATE, inputs, opts, spec) },
|
|
159
|
+
{ path: "src/index.test.ts", content: sub(SRC_INDEX_TEST_TEMPLATE, inputs, opts, spec) },
|
|
106
160
|
{ path: "package.json", content: sub(PACKAGE_JSON_TEMPLATE, inputs, opts, spec) },
|
|
107
161
|
{ path: "tsconfig.json", content: sub(TSCONFIG_TEMPLATE, inputs, opts, spec) },
|
|
162
|
+
{ path: "vitest.config.ts", content: sub(VITEST_CONFIG_TEMPLATE, inputs, opts, spec) },
|
|
108
163
|
{ path: ".dev.vars", content: sub(DEV_VARS_TEMPLATE, inputs, opts, spec) },
|
|
109
164
|
];
|
|
110
165
|
return [...base, ...typeSpecific];
|
|
@@ -8,6 +8,7 @@ export interface ScaffoldFile {
|
|
|
8
8
|
export interface ScaffolderOptions extends SubstitutionOptions {
|
|
9
9
|
}
|
|
10
10
|
export declare const STANDARDS_BLOCK_MARKER = "<!-- STANDARDS_BLOCK -->";
|
|
11
|
+
export declare const AGENT_COORDINATION_BLOCK_MARKER = "<!-- AGENT_COORDINATION_BLOCK -->";
|
|
11
12
|
export declare const AGENTS_BODY_MARKER = "<!-- AGENTS_BODY -->";
|
|
12
13
|
export declare function resolveBrandSpec(inputs: ScaffoldInputs): BrandPresetSpec;
|
|
13
14
|
export declare function sub(template: string, inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): string;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { getBrandSpec, renderBrandBlock } from "../brand.js";
|
|
15
15
|
import { applySubstitutions } from "../substitute.js";
|
|
16
16
|
export const STANDARDS_BLOCK_MARKER = "<!-- STANDARDS_BLOCK -->";
|
|
17
|
+
export const AGENT_COORDINATION_BLOCK_MARKER = "<!-- AGENT_COORDINATION_BLOCK -->";
|
|
17
18
|
export const AGENTS_BODY_MARKER = "<!-- AGENTS_BODY -->";
|
|
18
19
|
export function resolveBrandSpec(inputs) {
|
|
19
20
|
return getBrandSpec(inputs.brand, inputs.customBrand, inputs.githubOrg);
|
|
@@ -70,6 +71,7 @@ function quickStartFor(inputs) {
|
|
|
70
71
|
"```bash",
|
|
71
72
|
"npm install",
|
|
72
73
|
"npm run dev # local wrangler dev server",
|
|
74
|
+
"npm test # vitest (fetch-handler unit tests)",
|
|
73
75
|
"npm run deploy # wrangler deploy",
|
|
74
76
|
"```",
|
|
75
77
|
].join("\n");
|
|
@@ -470,7 +472,7 @@ ${STANDARDS_BLOCK_MARKER}
|
|
|
470
472
|
|
|
471
473
|
---
|
|
472
474
|
|
|
473
|
-
## Generic AGENTS — 3-layer system reference
|
|
475
|
+
${AGENT_COORDINATION_BLOCK_MARKER}## Generic AGENTS — 3-layer system reference
|
|
474
476
|
|
|
475
477
|
The canonical AGENTS body for framework v{{framework_version}} is embedded below by the writer at scaffold time. The project-specific guidance above takes precedence on conflict.
|
|
476
478
|
|
package/dist/standards.d.ts
CHANGED
|
@@ -28,6 +28,14 @@ export interface StandardsResolution {
|
|
|
28
28
|
* inside CLAUDE.md. Already includes substitutions; ready to write.
|
|
29
29
|
*/
|
|
30
30
|
body: string;
|
|
31
|
+
/**
|
|
32
|
+
* The verbatim canonical Agent Coordination section, ready to `.replace()`
|
|
33
|
+
* into the `<!-- AGENT_COORDINATION_BLOCK -->` marker (a TOP-LEVEL `## Agent
|
|
34
|
+
* Coordination` section, kept OUT of the `## Standards block` so it can carry
|
|
35
|
+
* the canonical heading + fingerprint comment verbatim). Empty string when
|
|
36
|
+
* the project does not participate in the bulletin.
|
|
37
|
+
*/
|
|
38
|
+
agentCoordinationBody: string;
|
|
31
39
|
/** One entry per standard the resolver considered (applicable or not). */
|
|
32
40
|
decisions: StandardDecision[];
|
|
33
41
|
/**
|
|
@@ -43,6 +51,7 @@ export interface StandardsResolution {
|
|
|
43
51
|
* family — the safe default for anything else with `has_web_ui=true`.
|
|
44
52
|
*/
|
|
45
53
|
export declare function fathomEnvVarFor(projectType: ProjectType): string;
|
|
54
|
+
export declare const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.13";
|
|
46
55
|
/**
|
|
47
56
|
* Resolve which standards apply to `inputs` and render the standards markdown
|
|
48
57
|
* body suitable for `.replace()`-ing into the `<!-- STANDARDS_BLOCK -->`
|
|
@@ -62,3 +71,13 @@ export declare function resolveStandards(inputs: ScaffoldInputs, opts?: ResolveS
|
|
|
62
71
|
* call on any file).
|
|
63
72
|
*/
|
|
64
73
|
export declare function applyStandardsBlock(claudeMd: string, resolution: StandardsResolution): string;
|
|
74
|
+
/**
|
|
75
|
+
* Fill the `<!-- AGENT_COORDINATION_BLOCK -->` marker with the verbatim
|
|
76
|
+
* canonical Agent Coordination section (or remove it, leaving a clean seam,
|
|
77
|
+
* when the project does not participate in the bulletin). Kept separate from
|
|
78
|
+
* {@link applyStandardsBlock} because the section is a TOP-LEVEL `## Agent
|
|
79
|
+
* Coordination` block that must sit outside `## Standards block`.
|
|
80
|
+
*
|
|
81
|
+
* Returns the input verbatim if the marker isn't present (safe on any file).
|
|
82
|
+
*/
|
|
83
|
+
export declare function applyAgentCoordinationBlock(claudeMd: string, resolution: StandardsResolution): string;
|
package/dist/standards.js
CHANGED
|
@@ -307,41 +307,78 @@ const NEON_CAREFUL_BODY = `### Neon-careful (Neon Postgres)
|
|
|
307
307
|
> **Queue/outbox drain — inline, never a frequent poll:** if a queue or outbox is fed by this app's OWN writes, drain it INLINE on the compute the write already woke (Cloudflare Workers: \`ctx.waitUntil(drain())\` after the response is sent; a Node/long-running service: a fire-and-forget drain after the write commits) — a DB-touching cron's cost is its WAKE-UPS, not its row volume, so riding an existing wake costs zero extra CU-hours and ships the row in seconds. Any cron drainer stays a LOW-frequency backstop (daily, not minutes) that only sweeps rows whose send failed; keep per-row claims under \`FOR UPDATE SKIP LOCKED\` so an inline drain and a backstop tick can't double-send. (financial-engine cut an outbox from ~15 → ~0.6 CU-hr/mo/tenant — ~25× — this way.)
|
|
308
308
|
>
|
|
309
309
|
> See [[neon-postgres]] for the full discipline (§4.4 covers the inline-drain pattern).`;
|
|
310
|
-
|
|
310
|
+
// The current canonical-block fingerprint version. Bumped in lockstep with
|
|
311
|
+
// `zero2webmaster/z2w-agent-coordination`'s AGENT_PROTOCOL.md when the embedded
|
|
312
|
+
// block's mechanics change (drift-detection Signal A greps for this exact token).
|
|
313
|
+
// When you sync a newer canonical block below, bump this to match its comment.
|
|
314
|
+
export const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.13";
|
|
315
|
+
/**
|
|
316
|
+
* The Agent Coordination section, emitted as its own TOP-LEVEL `## Agent
|
|
317
|
+
* Coordination` section (NOT a `###` standards subsection). The bulk is the
|
|
318
|
+
* VERBATIM canonical block from `AGENT_PROTOCOL.md` — heading, the
|
|
319
|
+
* `<!-- ... canonical-block vX.Y.Z -->` fingerprint comment, and the exact
|
|
320
|
+
* protocol body — so a freshly scaffolded project passes cross-project
|
|
321
|
+
* drift-detection (Signal A) with no manual first-session re-sync, AND carries
|
|
322
|
+
* the MANDATORY/never-ask session-end rule verbatim (the paraphrase this
|
|
323
|
+
* replaced silently dropped it — filed 2026-07-15 after two independent
|
|
324
|
+
* projects reported hand-fixing it; root cause of Kerry's 2026-07-18 "agents
|
|
325
|
+
* still ask" inbox item). Single-brace placeholders (`{this-project-slug}`,
|
|
326
|
+
* `{their-project}`, `{summary}`) are LITERAL canonical template syntax and
|
|
327
|
+
* pass through substitution untouched; only the `{{slug}}` tokens in the
|
|
328
|
+
* project-specific notes below are substituted at scaffold time.
|
|
329
|
+
*/
|
|
330
|
+
const AGENT_COORDINATION_BODY = `## Agent Coordination
|
|
311
331
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
332
|
+
<!-- z2w-agent-coordination canonical-block ${CANONICAL_COORDINATION_BLOCK_VERSION} -->
|
|
333
|
+
|
|
334
|
+
*(↓ copy this section, including this heading AND the HTML fingerprint comment above, into each participating project's \`CLAUDE.md\` and \`AGENTS.md\`. The fingerprint lets \`grep\` detect drift across projects.)*
|
|
335
|
+
|
|
336
|
+
This project participates in the Z2W cross-project coordination bulletin.
|
|
337
|
+
|
|
338
|
+
**At session start:**
|
|
339
|
+
1. If a workspace clone exists at \`~/.cache/z2w-coordination\` OR at \`~/Desktop/Zero2Webmaster/AI/Cursor Projects/z2w-agent-coordination/\`, use it (\`cd\` there + \`git pull --ff-only\`). Otherwise: \`git clone --depth 1 git@github.com:zero2webmaster/z2w-agent-coordination.git ~/.cache/z2w-coordination\`. (See §8.3.) **Then set the bot commit identity for the clone (v0.1.12):** \`bash scripts/set-bulletin-commit-identity.sh\` — idempotent, sets \`user.name\`/\`user.email\` **locally for this clone only** (global identity untouched) so your bulletin commits author as \`Z2W Bulletin Bot\`, not Kerry. The bulletin is coordination traffic (~40 agents push here); attributing it to Kerry's personal GitHub contribution graph skews his real-work count. Existing shared clones already have this set; run it after any FRESH clone.
|
|
340
|
+
2. Read \`projects/{this-project-slug}.md\` IN THIS ORDER:
|
|
341
|
+
a. **\`## Incidents\`** FIRST, if the section exists (v0.1.13). Any incident whose latest status line is \`open\` (i.e. no \`↳ resolved\` under it) means something is broken in production RIGHT NOW. Surface every open incident to Kerry before anything else, and prefer triaging it over new feature work — **a production incident outranks Kerry's inbox.** If the section is absent, there are no incidents; move on. (Incidents are written by the observability bridge or by an agent that spots a live problem — see §8.8 for the schema, dedup key, status lifecycle, and PII-strip rule.)
|
|
342
|
+
b. Then **\`## Inbox from Kerry\`**. Any entry without a \`↳ received\` line is unread. For each unread entry: surface it to Kerry, ACK by appending \`↳ received {YYYY-MM-DD HH:MM}, session {id}\` immediately, and move the work into \`## Open follow-ups owned by this project\` so it survives this session.
|
|
343
|
+
c. Then \`## Open questions\` — surface any \`[→ this-project]\` asks AND your OWN un-replied \`[→ Kerry]\` items. **Proactively open the session WITH your pending \`[→ Kerry]\` decisions, in plain English** (v0.1.9): e.g. *"I'm up to speed. Pending your input: (1) {one-line ask}, (2) {one-line ask}. Want to handle any now?"* A \`[→ Kerry]\` item is a genuine "blocked on you" flag — don't let it sit silently on the dashboard while Kerry is right here in the session.
|
|
344
|
+
d. Then \`## Heads-ups for other agents\` (un-ACK'd) and other-session entries in \`## Active sessions\`.
|
|
345
|
+
3. Read \`global.md\` — surface cross-project heads-ups (and any \`## Inbox from Kerry\` entries in \`global.md\` addressed to all agents).
|
|
346
|
+
|
|
347
|
+
**During session:**
|
|
348
|
+
- If a coordination need surfaces (cross-project question, important heads-up), append to the relevant section in memory and persist on session end.
|
|
349
|
+
- If a question to another project's agent surfaces, append to THEIR project file's \`## Open questions\` section with \`[→ {their-project}]\` prefix.
|
|
350
|
+
- If a decision is genuinely waiting on Kerry, append a \`[→ Kerry]\` entry to your OWN file's \`## Open questions\` section — same syntax as cross-agent asks. Do NOT bury "waiting on Kerry" items in Heads-ups; the dashboard reads \`[→ Kerry]\` entries to show Kerry what's blocked on him.
|
|
351
|
+
- **\`[→ Kerry]\` entries MUST be human-readable to Kerry, not agent jargon (v0.1.9).** Lead every \`[→ Kerry]\` entry with a short **bold plain-English title** + a one-sentence "what Kerry needs to decide or do," then any detail below (a \`<details>\` block is fine for depth). The dashboard at \`agents.z2w.us\` surfaces these to Kerry directly; if the title buries the ask, the dashboard has to guess. Optionally add a machine-readable \`<!-- ask: {one-line ask} -->\` marker (the dashboard prefers it over derived text) and a blocking/non-blocking hint.
|
|
352
|
+
- **A cross-agent question AND all its replies live in the askee's (target's) project file** — the same file you just filed the \`[→ {their-project}]\` question in. Do NOT mirror-and-reply in your own file, and do NOT park the question in your own file first (that fragments discovery). The asker may keep a lightweight pointer in their own file if they want one, but the canonical thread (question + every \`↳\` reply) stays in the askee's file.
|
|
353
|
+
- **"Posted to the bulletin" is ambiguous — name the FILE + SECTION, and route to a specific agent if a specific agent must see it (v0.1.12).** \`global.md\` is the ONLY file every agent reads at session start. A reply/entry under a project's section in \`projects/{x}.md\` is seen by that project's agent + anyone who opens that file — NOT automatically by other agents. To guarantee a specific other agent sees something, append a \`[→ {their-project}]\` entry to THEIR file's \`## Open questions\`. So when you say you "posted" something, say which file and section.
|
|
354
|
+
|
|
355
|
+
**At session end (or when the end is near):**
|
|
356
|
+
- **Re-read \`## Inbox from Kerry\` (v0.1.9).** A dispatch from Kerry can land *mid-session* — invisible to an agent that only checked at boot. Re-read the inbox; ACK and handle any entry that arrived since session start.
|
|
357
|
+
- **Re-check your OWN un-replied \`[→ Kerry]\` items (v0.1.9).** If any are still pending and Kerry is reachable, raise them one more time before closing.
|
|
358
|
+
- **Re-check \`## Open questions\` for new \`[→ this-project]\` entries that arrived since session start (v0.1.10).** A dedicated message from another agent lands here. Reply (\`↳\` under the question) and, if it needs more than this session has room for, move it into \`## Open follow-ups owned by this project\` so it survives. (You do NOT need to re-read \`global.md\` at session end.)
|
|
359
|
+
- **Updating the bulletin at session end is a MANDATORY standing wrap step — never a question you put to Kerry (v0.1.11).** It ranks with committing your code, not with optional extras. Do NOT end a session by asking *"want me to update the bulletin too?"* or *"that wasn't in your wrap list — say the word"* — decide with the two tiers below and just do it. The one and only time you skip is a purely read-only / conversational session that changed no files and no project state — and even then you **skip silently, you do not ask**. (Kerry, 2026-07-05: *"they should know to either do it or not do it"* — this rule is that decision, made once, so no agent defers it back to him.)
|
|
360
|
+
- **Tier 1 — ALWAYS (any session that did real work on this project):** rewrite \`## Current focus\` in place — one short paragraph (or 1–3 bullets) of what this project is working on right now, stamped with the current date + session id — and add/close your \`## Active sessions\` entry. It is the field the \`agents.z2w.us\` dashboard reads: a stale timestamp signals "agent ran but said nothing."
|
|
361
|
+
- **Tier 2 — ADDITIONALLY, only if the session shipped code or changed project state:** add a \`## Recent commits\` entry and append any new heads-ups / \`[→ {project}]\` / \`[→ Kerry]\` items.
|
|
362
|
+
- **Size discipline (v0.1.11):** before appending, if \`projects/{this-project}.md\` is approaching ~200 KB, trim FIRST — archive old \`## Active sessions\` and \`## Recent commits\` entries and resolved \`## Open questions\` threads into \`projects/{this-project}-archive.md\` (a separate, commit-flagged operation). \`## Current focus\` is rewritten in place (never appended).
|
|
363
|
+
- \`git commit -m "{this-project}: {summary}"\` (see §8.2 for agent-identifier format) and \`git push\`.
|
|
364
|
+
- If push fails due to concurrent write from another session: \`git pull --rebase\`, resolve any conflicts, retry push.
|
|
365
|
+
- **Local auto-push hooks:** if your project has a post-commit hook that auto-pushes, expect it to race your explicit \`git push\` and grab the ref lock first. The commit still lands — verify with \`git log origin/main\` rather than re-pushing.
|
|
366
|
+
|
|
367
|
+
**Inbox-section authority (v0.1.8):** Only the orchestrator identity \`kerry-phone\` (the phone-first command center at \`agents.z2w.us\`) writes to \`## Inbox from Kerry\`. Project agents only READ and ACK there — never write. Never edit another project's \`## Inbox from Kerry\` section.
|
|
368
|
+
|
|
369
|
+
**Hard rules (read first):**
|
|
370
|
+
- **No secrets, ever.** Operational metadata only. Detect-and-redact on \`sk_*\`, \`pk_*\`, \`rk_*\`, \`whsec_*\`, \`xoxb-*\`, \`tbl[A-Za-z0-9]{14}\`, \`pat_*\`, etc.
|
|
371
|
+
- **Private repo only.** The bulletin must remain \`--visibility private\`.
|
|
372
|
+
- **Never edit another project's file directly.** Cross-project signaling goes through \`[→ {their-project}]\` prefixes in the target's \`## Open questions\` section.
|
|
373
|
+
- **Append-only within sections.** Trimming expired entries is a separate operation flagged in the commit message.
|
|
374
|
+
|
|
375
|
+
See \`~/Desktop/Zero2Webmaster/AI/Cursor Projects/z2w-agent-coordination/AGENT_PROTOCOL.md\` for the canonical protocol body — read it at session start for the current version and section list. Reference conventions by NAME; the §-numbers above are parenthetical breadcrumbs that may renumber upstream.
|
|
376
|
+
|
|
377
|
+
### Project-specific notes for {{slug}}
|
|
378
|
+
|
|
379
|
+
- **Agent identifier:** \`{{slug}}\` (per §8.2). Optional \` #{N}\` chat-number suffix when Kerry has labeled the chat.
|
|
380
|
+
- **Commit message format:** \`{{slug}}: {summary}\` (per §8.2).
|
|
381
|
+
- **Inter-agent courier header:** every message Kerry relays chat-to-chat starts with a \`To:\` / \`From:\` / \`Re:\` block (§8.4). Bulletin-posted replies use the inline \`↳ (..., {{slug}}):\` marker without the header.`;
|
|
345
382
|
const SEO_BASELINE_BODY = `### SEO baseline (non-WP web UI)
|
|
346
383
|
|
|
347
384
|
> **SEO is non-negotiable from v1 (standing org requirement 2026-05-30).** WordPress sites get SEO from RankMath; non-WP web apps have no equivalent — every element must be built in deliberately at instantiation. SEO is NOT a later task.
|
|
@@ -451,6 +488,7 @@ function renderPreamble(inputs, opts) {
|
|
|
451
488
|
export function resolveStandards(inputs, opts = {}) {
|
|
452
489
|
const decisions = [];
|
|
453
490
|
const inserted = [];
|
|
491
|
+
let agentCoordinationBody = "";
|
|
454
492
|
for (const key of STANDARD_ORDER) {
|
|
455
493
|
const result = APPLICABILITY[key](inputs);
|
|
456
494
|
if (result.applies) {
|
|
@@ -460,7 +498,15 @@ export function resolveStandards(inputs, opts = {}) {
|
|
|
460
498
|
state: "inserted-inline",
|
|
461
499
|
reason: result.reason,
|
|
462
500
|
});
|
|
463
|
-
|
|
501
|
+
// agent-coordination is emitted as its own top-level section (verbatim
|
|
502
|
+
// canonical block + fingerprint) via a separate marker, NOT inline in the
|
|
503
|
+
// standards block — so it never lands mid-`## Standards block`.
|
|
504
|
+
if (key === "agent-coordination") {
|
|
505
|
+
agentCoordinationBody = renderStandardBody(key, inputs, opts);
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
inserted.push(renderStandardBody(key, inputs, opts));
|
|
509
|
+
}
|
|
464
510
|
}
|
|
465
511
|
else {
|
|
466
512
|
decisions.push({
|
|
@@ -475,6 +521,7 @@ export function resolveStandards(inputs, opts = {}) {
|
|
|
475
521
|
const body = `${renderPreamble(inputs, opts)}\n\n${sections}\n`;
|
|
476
522
|
return {
|
|
477
523
|
body,
|
|
524
|
+
agentCoordinationBody,
|
|
478
525
|
decisions,
|
|
479
526
|
promotePending: opts.promoteStandards === true,
|
|
480
527
|
};
|
|
@@ -491,3 +538,20 @@ export function resolveStandards(inputs, opts = {}) {
|
|
|
491
538
|
export function applyStandardsBlock(claudeMd, resolution) {
|
|
492
539
|
return claudeMd.replace(/<!-- STANDARDS_BLOCK -->/g, resolution.body.trimEnd());
|
|
493
540
|
}
|
|
541
|
+
/**
|
|
542
|
+
* Fill the `<!-- AGENT_COORDINATION_BLOCK -->` marker with the verbatim
|
|
543
|
+
* canonical Agent Coordination section (or remove it, leaving a clean seam,
|
|
544
|
+
* when the project does not participate in the bulletin). Kept separate from
|
|
545
|
+
* {@link applyStandardsBlock} because the section is a TOP-LEVEL `## Agent
|
|
546
|
+
* Coordination` block that must sit outside `## Standards block`.
|
|
547
|
+
*
|
|
548
|
+
* Returns the input verbatim if the marker isn't present (safe on any file).
|
|
549
|
+
*/
|
|
550
|
+
export function applyAgentCoordinationBlock(claudeMd, resolution) {
|
|
551
|
+
const marker = /<!-- AGENT_COORDINATION_BLOCK -->/g;
|
|
552
|
+
const section = resolution.agentCoordinationBody.trimEnd();
|
|
553
|
+
if (section === "") {
|
|
554
|
+
return claudeMd.replace(marker, "");
|
|
555
|
+
}
|
|
556
|
+
return claudeMd.replace(marker, `${section}\n\n---\n\n`);
|
|
557
|
+
}
|
package/dist/writer.js
CHANGED
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
import { promises as fs } from "node:fs";
|
|
24
24
|
import * as path from "node:path";
|
|
25
25
|
import fsExtra from "fs-extra";
|
|
26
|
-
import { AGENTS_BODY_MARKER, STANDARDS_BLOCK_MARKER, } from "./scaffolders/common.js";
|
|
26
|
+
import { AGENT_COORDINATION_BLOCK_MARKER, AGENTS_BODY_MARKER, STANDARDS_BLOCK_MARKER, } from "./scaffolders/common.js";
|
|
27
27
|
import { buildProSeoExtension, proSeoApplies, } from "./scaffolders/pro-seo-extension.js";
|
|
28
28
|
import { scaffoldByType } from "./scaffolders/index.js";
|
|
29
|
-
import { applyStandardsBlock, resolveStandards, } from "./standards.js";
|
|
29
|
+
import { applyAgentCoordinationBlock, applyStandardsBlock, resolveStandards, } from "./standards.js";
|
|
30
30
|
import { resolveAgentsTemplate, } from "./templates.js";
|
|
31
31
|
export class WriterError extends Error {
|
|
32
32
|
constructor(message) {
|
|
@@ -59,7 +59,11 @@ function reassembleStandardsBody(preamble, sections) {
|
|
|
59
59
|
return `${preamble}\n\n${sections.map((s) => s.markdown).join("\n\n")}\n`;
|
|
60
60
|
}
|
|
61
61
|
async function runPromotionDialog(resolution, prompter, output) {
|
|
62
|
-
|
|
62
|
+
// agent-coordination is inserted as its own top-level `## Agent Coordination`
|
|
63
|
+
// section (a verbatim canonical block, never promotable into Templates), NOT
|
|
64
|
+
// as a `### ` section inside `resolution.body` — so it is deliberately absent
|
|
65
|
+
// from the promotion dialog and from the section/decision count match below.
|
|
66
|
+
const inlineDecisions = resolution.decisions.filter((d) => d.state === "inserted-inline" && d.key !== "agent-coordination");
|
|
63
67
|
// No applicable standards — pass through unchanged.
|
|
64
68
|
if (inlineDecisions.length === 0) {
|
|
65
69
|
return { resolution, promotions: [] };
|
|
@@ -124,6 +128,9 @@ function checkNoUnfilledMarkers(content, file) {
|
|
|
124
128
|
if (content.includes(STANDARDS_BLOCK_MARKER)) {
|
|
125
129
|
throw new WriterError(`Internal error: ${file} still contains ${STANDARDS_BLOCK_MARKER} after standards substitution.`);
|
|
126
130
|
}
|
|
131
|
+
if (content.includes(AGENT_COORDINATION_BLOCK_MARKER)) {
|
|
132
|
+
throw new WriterError(`Internal error: ${file} still contains ${AGENT_COORDINATION_BLOCK_MARKER} after agent-coordination substitution.`);
|
|
133
|
+
}
|
|
127
134
|
if (content.includes(AGENTS_BODY_MARKER)) {
|
|
128
135
|
throw new WriterError(`Internal error: ${file} still contains ${AGENTS_BODY_MARKER} after AGENTS body substitution.`);
|
|
129
136
|
}
|
|
@@ -216,6 +223,7 @@ export async function writeScaffold(inputs, targetPath, opts = {}) {
|
|
|
216
223
|
}
|
|
217
224
|
const claudeFile = files[claudeIdx];
|
|
218
225
|
let claudeContent = applyStandardsBlock(claudeFile.content, resolution);
|
|
226
|
+
claudeContent = applyAgentCoordinationBlock(claudeContent, resolution);
|
|
219
227
|
claudeContent = claudeContent.replace(AGENTS_BODY_MARKER, agentsBody);
|
|
220
228
|
checkNoUnfilledMarkers(claudeContent, "CLAUDE.md");
|
|
221
229
|
files[claudeIdx] = { path: claudeFile.path, content: claudeContent };
|