@zero2webmaster/starter-kit 0.7.0 → 0.8.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # z2w-starter-kit
2
2
 
3
- **Version:** 0.7.0 | **Framework:** 2.13.0
3
+ **Version:** 0.8.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.7.0 | Last Updated: 2026-07-30*
102
+ *Version: 0.8.0 | Last Updated: 2026-07-30*
@@ -9,6 +9,8 @@ export interface ScaffolderOptions extends SubstitutionOptions {
9
9
  }
10
10
  export declare const STANDARDS_BLOCK_MARKER = "<!-- STANDARDS_BLOCK -->";
11
11
  export declare const AGENT_COORDINATION_BLOCK_MARKER = "<!-- AGENT_COORDINATION_BLOCK -->";
12
+ /** Always-on, unlike the coordination marker — every project gets this one. */
13
+ export declare const CAPTURE_LEARNINGS_BLOCK_MARKER = "<!-- CAPTURE_LEARNINGS_BLOCK -->";
12
14
  export declare const AGENTS_BODY_MARKER = "<!-- AGENTS_BODY -->";
13
15
  export declare function resolveBrandSpec(inputs: ScaffoldInputs): BrandPresetSpec;
14
16
  export declare function sub(template: string, inputs: ScaffoldInputs, opts: ScaffolderOptions | undefined, spec: BrandPresetSpec): string;
@@ -16,6 +16,8 @@ import { buildFirstSessionPrompt, FIRST_SESSION_PROMPT_HEADING, } from "../first
16
16
  import { applySubstitutions } from "../substitute.js";
17
17
  export const STANDARDS_BLOCK_MARKER = "<!-- STANDARDS_BLOCK -->";
18
18
  export const AGENT_COORDINATION_BLOCK_MARKER = "<!-- AGENT_COORDINATION_BLOCK -->";
19
+ /** Always-on, unlike the coordination marker — every project gets this one. */
20
+ export const CAPTURE_LEARNINGS_BLOCK_MARKER = "<!-- CAPTURE_LEARNINGS_BLOCK -->";
19
21
  export const AGENTS_BODY_MARKER = "<!-- AGENTS_BODY -->";
20
22
  export function resolveBrandSpec(inputs) {
21
23
  return getBrandSpec(inputs.brand, inputs.customBrand, inputs.githubOrg);
@@ -473,7 +475,7 @@ ${STANDARDS_BLOCK_MARKER}
473
475
 
474
476
  ---
475
477
 
476
- ${AGENT_COORDINATION_BLOCK_MARKER}## Generic AGENTS — 3-layer system reference
478
+ ${AGENT_COORDINATION_BLOCK_MARKER}${CAPTURE_LEARNINGS_BLOCK_MARKER}## Generic AGENTS — 3-layer system reference
477
479
 
478
480
  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.
479
481
 
@@ -52,6 +52,23 @@ export interface StandardsResolution {
52
52
  */
53
53
  export declare function fathomEnvVarFor(projectType: ProjectType): string;
54
54
  export declare const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.16";
55
+ /**
56
+ * The canonical **Capture Learnings** block, emitted VERBATIM into every
57
+ * scaffolded `CLAUDE.md`.
58
+ *
59
+ * Owned by `zero2webmaster/cursor-project-templates`; canonical source is
60
+ * `Resources/CAPTURE_LEARNINGS_BLOCK.md` in the Templates folder this CLI
61
+ * already reads (OP #1). Do NOT paraphrase it here — the paraphrase is the
62
+ * failure mode this block exists to prevent, exactly as it was for the Agent
63
+ * Coordination block, and `capture-learnings.test.ts` byte-diffs the two.
64
+ *
65
+ * Why it must be emitted into CLAUDE.md rather than left in the framework body:
66
+ * the step was canonical from framework v2.13.0 but lived only in `AGENTS_v*.md`,
67
+ * which is NOT loaded into agent context. 25 of 41 Z2W projects were measured
68
+ * missing it on 2026-07-27 — including every project this CLI has scaffolded.
69
+ * Reported as an ACTION by `z2w-observability-bridge` (2026-07-27); closed here.
70
+ */
71
+ export declare const CAPTURE_LEARNINGS_BLOCK_VERSION = "v1.0.0";
55
72
  /**
56
73
  * Resolve which standards apply to `inputs` and render the standards markdown
57
74
  * body suitable for `.replace()`-ing into the `<!-- STANDARDS_BLOCK -->`
@@ -81,3 +98,12 @@ export declare function applyStandardsBlock(claudeMd: string, resolution: Standa
81
98
  * Returns the input verbatim if the marker isn't present (safe on any file).
82
99
  */
83
100
  export declare function applyAgentCoordinationBlock(claudeMd: string, resolution: StandardsResolution): string;
101
+ /**
102
+ * Fill the `<!-- CAPTURE_LEARNINGS_BLOCK -->` marker with the verbatim canonical
103
+ * Capture Learnings block.
104
+ *
105
+ * UNCONDITIONAL, unlike {@link applyAgentCoordinationBlock} — the step applies to
106
+ * every Z2W project regardless of bulletin participation, DB, or web UI. It is a
107
+ * top-level `##` section, so it sits outside `## Standards block`.
108
+ */
109
+ export declare function applyCaptureLearningsBlock(claudeMd: string): string;
package/dist/standards.js CHANGED
@@ -327,6 +327,47 @@ const NEON_CAREFUL_BODY = `### Neon-careful (Neon Postgres)
327
327
  // block's mechanics change (drift-detection Signal A greps for this exact token).
328
328
  // When you sync a newer canonical block below, bump this to match its comment.
329
329
  export const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.16";
330
+ /**
331
+ * The canonical **Capture Learnings** block, emitted VERBATIM into every
332
+ * scaffolded `CLAUDE.md`.
333
+ *
334
+ * Owned by `zero2webmaster/cursor-project-templates`; canonical source is
335
+ * `Resources/CAPTURE_LEARNINGS_BLOCK.md` in the Templates folder this CLI
336
+ * already reads (OP #1). Do NOT paraphrase it here — the paraphrase is the
337
+ * failure mode this block exists to prevent, exactly as it was for the Agent
338
+ * Coordination block, and `capture-learnings.test.ts` byte-diffs the two.
339
+ *
340
+ * Why it must be emitted into CLAUDE.md rather than left in the framework body:
341
+ * the step was canonical from framework v2.13.0 but lived only in `AGENTS_v*.md`,
342
+ * which is NOT loaded into agent context. 25 of 41 Z2W projects were measured
343
+ * missing it on 2026-07-27 — including every project this CLI has scaffolded.
344
+ * Reported as an ACTION by `z2w-observability-bridge` (2026-07-27); closed here.
345
+ */
346
+ export const CAPTURE_LEARNINGS_BLOCK_VERSION = "v1.0.0";
347
+ const CAPTURE_LEARNINGS_BODY = `## Capture Learnings (session end)
348
+
349
+ <!-- cursor-project-templates capture-learnings-block ${CAPTURE_LEARNINGS_BLOCK_VERSION} -->
350
+
351
+ *(↓ copy this section, including this heading AND the HTML fingerprint comment above, verbatim into each project's \`CLAUDE.md\` and \`AGENTS.md\`. The fingerprint lets \`grep\` detect drift across projects. Canonical source: \`Resources/CAPTURE_LEARNINGS_BLOCK.md\` in \`zero2webmaster/cursor-project-templates\`.)*
352
+
353
+ **At the end of every session, decide whether anything you learned this session should become a skill — and state the verdict in your recap.** This fires by default, unasked. It is **never** a question you put to the project owner ("want me to make a skill?"); it is a decision you make and report.
354
+
355
+ **The bar is high.** One fix or gotcha that cost more than ~15 minutes, or that was non-obvious enough that the next agent would re-derive it from scratch. Don't capture the obvious or the already-documented.
356
+
357
+ **Route it:**
358
+
359
+ | The learning is… | Where it goes |
360
+ |---|---|
361
+ | one-off, this project only | a \`TROUBLESHOOTING.md\` line — or nothing |
362
+ | recurring, this project only | a directive / this \`CLAUDE.md\` (self-anneal) |
363
+ | recurring **and** portfolio-general | the **Skill Vault** — extend an existing skill before creating a new one |
364
+
365
+ **Report the verdict even when it's negative.** "Nothing worth capturing this session" is a valid and expected outcome, and saying it out loud is the point: a reflex nobody can see is indistinguishable from a reflex nobody ran.
366
+
367
+ **If you notice this step missing from another project, do not just fix that one file.** Two or more projects missing it means the *enrollment* step is the bug, not the rows. File it with \`cursor-project-templates\` (owns the canonical block), \`z2w-starter-kit\` (owns the scaffold/\`init\` path), and \`z2w-agent-coordination\` (owns \`scripts/check-fingerprint-drift.sh\`, the only propagation checker in this ecosystem that has demonstrably worked).
368
+
369
+ Full routing rubric, worked examples, and the Skill Vault's own commit conventions: the **\`capture-learning\`** skill.
370
+ `;
330
371
  /**
331
372
  * The Agent Coordination section, emitted as its own TOP-LEVEL `## Agent
332
373
  * Coordination` section (NOT a `###` standards subsection). The bulk is the
@@ -626,3 +667,51 @@ export function applyAgentCoordinationBlock(claudeMd, resolution) {
626
667
  }
627
668
  return claudeMd.replace(marker, `${section}\n\n---\n\n`);
628
669
  }
670
+ /**
671
+ * Fill the `<!-- CAPTURE_LEARNINGS_BLOCK -->` marker with the verbatim canonical
672
+ * Capture Learnings block.
673
+ *
674
+ * UNCONDITIONAL, unlike {@link applyAgentCoordinationBlock} — the step applies to
675
+ * every Z2W project regardless of bulletin participation, DB, or web UI. It is a
676
+ * top-level `##` section, so it sits outside `## Standards block`.
677
+ */
678
+ export function applyCaptureLearningsBlock(claudeMd) {
679
+ const filled = claudeMd.replace(/<!-- CAPTURE_LEARNINGS_BLOCK -->/g, `${CAPTURE_LEARNINGS_BODY.trimEnd()}\n\n---\n\n`);
680
+ // DEDUPE, and this is why the call happens AFTER the AGENTS body is spliced
681
+ // in: the canonical framework body (AGENTS_v2.17.0+) carries this same block,
682
+ // which would leave the scaffold with TWO copies. Two is a real failure, not
683
+ // cosmetic — the capture-learning skill's own check is
684
+ // `grep -c "capture-learnings-block v1.0.0" CLAUDE.md` expecting exactly 1,
685
+ // so a duplicate reads as drift to every sweep that looks for it.
686
+ //
687
+ // Keep the FIRST occurrence (the marker position, near the session-end
688
+ // material where the canonical source says it belongs) and drop the rest —
689
+ // the later one is buried deep in the "Generic AGENTS" reference, which the
690
+ // scaffolded CLAUDE.md itself labels as framework guidance that the
691
+ // project-specific sections above override.
692
+ const lines = filled.split("\n");
693
+ const heads = [];
694
+ for (let i = 0; i < lines.length; i++) {
695
+ if (/^## Capture Learnings \(session end\)\s*$/.test(lines[i]))
696
+ heads.push(i);
697
+ }
698
+ if (heads.length < 2)
699
+ return filled;
700
+ const drop = new Set();
701
+ for (const head of heads.slice(1)) {
702
+ let end = lines.length;
703
+ for (let i = head + 1; i < lines.length; i++) {
704
+ if (/^## /.test(lines[i])) {
705
+ end = i;
706
+ break;
707
+ }
708
+ }
709
+ // Also swallow a trailing `---` separator + blank lines the block leaves behind.
710
+ while (end > head + 1 && (lines[end - 1].trim() === "" || lines[end - 1].trim() === "---")) {
711
+ end--;
712
+ }
713
+ for (let i = head; i < end; i++)
714
+ drop.add(i);
715
+ }
716
+ return lines.filter((_, i) => !drop.has(i)).join("\n");
717
+ }
package/dist/writer.js CHANGED
@@ -26,7 +26,7 @@ import fsExtra from "fs-extra";
26
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 { applyAgentCoordinationBlock, applyStandardsBlock, resolveStandards, } from "./standards.js";
29
+ import { applyAgentCoordinationBlock, applyCaptureLearningsBlock, applyStandardsBlock, resolveStandards, } from "./standards.js";
30
30
  import { resolveAgentsTemplate, } from "./templates.js";
31
31
  export class WriterError extends Error {
32
32
  constructor(message) {
@@ -225,6 +225,10 @@ export async function writeScaffold(inputs, targetPath, opts = {}) {
225
225
  let claudeContent = applyStandardsBlock(claudeFile.content, resolution);
226
226
  claudeContent = applyAgentCoordinationBlock(claudeContent, resolution);
227
227
  claudeContent = claudeContent.replace(AGENTS_BODY_MARKER, agentsBody);
228
+ // Always-on: applies to every project type, bulletin participant or not.
229
+ // MUST run AFTER the AGENTS body splice — the canonical framework body carries
230
+ // this same block, and this call is what dedupes it down to one.
231
+ claudeContent = applyCaptureLearningsBlock(claudeContent);
228
232
  checkNoUnfilledMarkers(claudeContent, "CLAUDE.md");
229
233
  files[claudeIdx] = { path: claudeFile.path, content: claudeContent };
230
234
  // Append promotions follow-up file if any standard was promoted.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zero2webmaster/starter-kit",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.",
5
5
  "author": {
6
6
  "name": "Dr. Kerry Kriger",