@milehimikey/em 1.11.0 → 1.12.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.
Files changed (92) hide show
  1. package/.claude/skills/event-modeling/SKILL.md +1 -1
  2. package/.claude/skills/event-modeling-conform/SKILL.md +1 -1
  3. package/.claude/skills/event-modeling-design/SKILL.md +13 -5
  4. package/.claude/skills/event-modeling-discover/SKILL.md +1 -1
  5. package/.claude/skills/event-modeling-implement/SKILL.md +12 -6
  6. package/.claude/skills/event-modeling-implement/reference/implement.md +159 -18
  7. package/.claude/skills/event-modeling-review/SKILL.md +1 -1
  8. package/.claude/skills/event-modeling-shared/reference/em-dsl.md +17 -6
  9. package/.claude/skills/event-modeling-shared/reference/slice-doc-schema.md +39 -0
  10. package/.claude/skills/event-modeling-shared/templates/constitution.md +8 -1
  11. package/dist/catalog/build.js +42 -1
  12. package/dist/catalog/build.js.map +1 -1
  13. package/dist/catalog/coverage.d.ts +15 -0
  14. package/dist/catalog/coverage.js +34 -0
  15. package/dist/catalog/coverage.js.map +1 -0
  16. package/dist/catalog/docJoin.d.ts +11 -2
  17. package/dist/catalog/docJoin.js +26 -4
  18. package/dist/catalog/docJoin.js.map +1 -1
  19. package/dist/catalog/docModelConsistencyValidate.js +1 -1
  20. package/dist/catalog/docModelConsistencyValidate.js.map +1 -1
  21. package/dist/catalog/noteBindingValidate.js +18 -0
  22. package/dist/catalog/noteBindingValidate.js.map +1 -1
  23. package/dist/catalog/orphanedSliceDocValidate.d.ts +8 -1
  24. package/dist/catalog/orphanedSliceDocValidate.js +33 -6
  25. package/dist/catalog/orphanedSliceDocValidate.js.map +1 -1
  26. package/dist/catalog/pages.d.ts +16 -1
  27. package/dist/catalog/pages.js +16 -4
  28. package/dist/catalog/pages.js.map +1 -1
  29. package/dist/catalog/sliceReadyValidate.d.ts +12 -1
  30. package/dist/catalog/sliceReadyValidate.js +4 -4
  31. package/dist/catalog/sliceReadyValidate.js.map +1 -1
  32. package/dist/cli/agentsMd.js +9 -3
  33. package/dist/cli/agentsMd.js.map +1 -1
  34. package/dist/cli/ciInit.js +3 -0
  35. package/dist/cli/ciInit.js.map +1 -1
  36. package/dist/cli/conformScope.js +10 -3
  37. package/dist/cli/conformScope.js.map +1 -1
  38. package/dist/cli/coverage.d.ts +34 -9
  39. package/dist/cli/coverage.js +61 -24
  40. package/dist/cli/coverage.js.map +1 -1
  41. package/dist/cli/markImplemented.js +12 -1
  42. package/dist/cli/markImplemented.js.map +1 -1
  43. package/dist/cli/ratify.js +17 -1
  44. package/dist/cli/ratify.js.map +1 -1
  45. package/dist/cli/reratify.js +12 -1
  46. package/dist/cli/reratify.js.map +1 -1
  47. package/dist/cli/review.js +12 -1
  48. package/dist/cli/review.js.map +1 -1
  49. package/dist/cli/sliceIndex.js +9 -4
  50. package/dist/cli/sliceIndex.js.map +1 -1
  51. package/dist/cli/sliceLink.js +16 -0
  52. package/dist/cli/sliceLink.js.map +1 -1
  53. package/dist/cli/status.d.ts +11 -0
  54. package/dist/cli/status.js +17 -1
  55. package/dist/cli/status.js.map +1 -1
  56. package/dist/cli.js +63 -31
  57. package/dist/cli.js.map +1 -1
  58. package/dist/emit/coverageJson.d.ts +2 -2
  59. package/dist/emit/coverageJson.js +6 -2
  60. package/dist/emit/coverageJson.js.map +1 -1
  61. package/dist/emit/json.d.ts +24 -1
  62. package/dist/emit/json.js +50 -2
  63. package/dist/emit/json.js.map +1 -1
  64. package/dist/emit/statusJson.d.ts +1 -1
  65. package/dist/emit/statusJson.js +6 -1
  66. package/dist/emit/statusJson.js.map +1 -1
  67. package/dist/emit/validateJson.d.ts +4 -3
  68. package/dist/emit/validateJson.js +10 -3
  69. package/dist/emit/validateJson.js.map +1 -1
  70. package/dist/mcp/server.js +37 -19
  71. package/dist/mcp/server.js.map +1 -1
  72. package/dist/model/continuation.d.ts +23 -0
  73. package/dist/model/continuation.js +49 -0
  74. package/dist/model/continuation.js.map +1 -0
  75. package/dist/model/queryIndex.js +1 -1
  76. package/dist/model/queryIndex.js.map +1 -1
  77. package/dist/model/rules.d.ts +6 -0
  78. package/dist/model/rules.js +6 -0
  79. package/dist/model/rules.js.map +1 -1
  80. package/dist/model/sliceDocIndex.d.ts +12 -5
  81. package/dist/model/sliceDocIndex.js +18 -7
  82. package/dist/model/sliceDocIndex.js.map +1 -1
  83. package/dist/render/sliceStatus.d.ts +3 -3
  84. package/dist/render/sliceStatus.js +27 -29
  85. package/dist/render/sliceStatus.js.map +1 -1
  86. package/dist/templates.d.ts +1 -1
  87. package/dist/templates.js +8 -1
  88. package/dist/templates.js.map +1 -1
  89. package/dist/util/localDate.d.ts +2 -0
  90. package/dist/util/localDate.js +17 -0
  91. package/dist/util/localDate.js.map +1 -0
  92. package/package.json +1 -1
@@ -19,6 +19,7 @@ import { join } from "node:path";
19
19
  import { parseSliceDoc, hasUsableFrontmatter } from "../catalog/sliceDoc.js";
20
20
  import { classifyImplementationDrift } from "../catalog/driftSignal.js";
21
21
  import { NOTE_SLICE_PATH } from "../catalog/docJoin.js";
22
+ import { continuationOf } from "./continuation.js";
22
23
  /** Matches a slice-doc filename (`slices/<key>.md`) — same kebab-slug grammar
23
24
  * `catalog/sliceDoc.ts`'s SLICE_REF and `docJoin.ts`'s NOTE_SLICE_PATH use for the key itself. */
24
25
  const SLICE_DOC_FILENAME_RE = /^([a-z0-9]+(?:-[a-z0-9]+)*)\.md$/i;
@@ -65,10 +66,11 @@ export function loadSliceDocsOnce(baseDir) {
65
66
  return docs;
66
67
  }
67
68
  /** Same resolution semantics as `docJoin.ts`'s resolveSliceDocJoin() — canonical `note` binding
68
- * first, then a ratified MIL-121 cross-binding naming this slice in its `covers:` list — but
69
- * reading from the in-memory map `loadSliceDocsOnce()` built once for the whole model, instead
70
- * of one `readSliceDoc()` fs call per slice/candidate. */
71
- export function joinSliceDocFast(slice, sliceKey, docsByKey) {
69
+ * first, then a ratified MIL-121 cross-binding naming this slice in its `covers:` list, then
70
+ * (MIL-208) an automatic continuation fallback for an again-view-only slice with no doc of its
71
+ * own — but reading from the in-memory map `loadSliceDocsOnce()` built once for the whole
72
+ * model, instead of one `readSliceDoc()` fs call per slice/candidate. */
73
+ export function joinSliceDocFast(model, refs, slice, sliceKey, docsByKey) {
72
74
  const path = `slices/${sliceKey}.md`;
73
75
  const boundEls = slice.elements.filter((el) => el.note === path);
74
76
  if (boundEls.length === 0) {
@@ -86,13 +88,21 @@ export function joinSliceDocFast(slice, sliceKey, docsByKey) {
86
88
  continue;
87
89
  return foundDoc(`slices/${otherKey}.md`, doc);
88
90
  }
89
- return { found: false, path, reason: "no-doc-bound", status: null, implementedIn: null, driftSignal: null, body: null };
91
+ // MIL-208 — see docJoin.ts's own comment: "legacy own doc wins" is satisfied automatically
92
+ // by `boundEls.length === 0` (no note of its own) plus no ratified cross-binding above.
93
+ const continuation = continuationOf(model, refs, slice.index);
94
+ if (continuation) {
95
+ const originatingSlice = model.slices[continuation.sliceIndex];
96
+ const originatingDoc = joinSliceDocFast(model, refs, originatingSlice, continuation.sliceKey, docsByKey);
97
+ return { ...originatingDoc, continuationOf: continuation.sliceKey };
98
+ }
99
+ return { found: false, path, reason: "no-doc-bound", status: null, implementedIn: null, driftSignal: null, body: null, continuationOf: null };
90
100
  }
91
101
  const doc = docsByKey.get(sliceKey);
92
102
  if (!doc)
93
- return { found: false, path, reason: "binding-missing-file", status: null, implementedIn: null, driftSignal: null, body: null };
103
+ return { found: false, path, reason: "binding-missing-file", status: null, implementedIn: null, driftSignal: null, body: null, continuationOf: null };
94
104
  if (!hasUsableFrontmatter(doc)) {
95
- return { found: true, path, reason: "frontmatter-invalid", status: null, implementedIn: null, driftSignal: null, body: null };
105
+ return { found: true, path, reason: "frontmatter-invalid", status: null, implementedIn: null, driftSignal: null, body: null, continuationOf: null };
96
106
  }
97
107
  return foundDoc(path, doc);
98
108
  }
@@ -105,6 +115,7 @@ function foundDoc(path, doc) {
105
115
  implementedIn: doc.implementedIn,
106
116
  driftSignal: classifyImplementationDrift(doc),
107
117
  body: doc.body,
118
+ continuationOf: null,
108
119
  };
109
120
  }
110
121
  //# sourceMappingURL=sliceDocIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sliceDocIndex.js","sourceRoot":"","sources":["../../src/model/sliceDocIndex.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,qFAAqF;AACrF,8FAA8F;AAC9F,4EAA4E;AAC5E,4FAA4F;AAC5F,gGAAgG;AAChG,+FAA+F;AAC/F,0FAA0F;AAC1F,4FAA4F;AAC5F,gGAAgG;AAChG,2CAA2C;AAC3C,EAAE;AACF,0FAA0F;AAC1F,2FAA2F;AAC3F,+FAA+F;AAC/F,cAAc;AAEd,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAY,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,2BAA2B,EAAmB,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD;mGACmG;AACnG,MAAM,qBAAqB,GAAG,mCAAmC,CAAC;AAElE;;;;;4EAK4E;AAC5E,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAoB,CAAC;IACzC,IAAI,OAAiB,CAAC;IACtB,IAAI,CAAC;QACH,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC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doc (own `slices/<key>.md`, or the MIL-121 covering doc, or
4
- * null), same order as model.slices (and so the same order as the header row's columns —
5
- * see layout/grid.ts's sliceNames). */
3
+ /** Each slice's resolved design doc (own `slices/<key>.md`, the MIL-121 covering doc, the
4
+ * MIL-208 originating slice's own file, or null), same order as model.slices (and so the same
5
+ * order as the header row's columns — see layout/grid.ts's sliceNames). */
6
6
  export declare function readSliceDocs(model: NormalizedModel, baseDir: string): (SliceDoc | null)[];
7
7
  /** One status per slice, same order/resolution as readSliceDocs. null means no doc was found
8
8
  * (own or covering), or the doc has no `- **Status:** ...` line. */
@@ -11,20 +11,27 @@
11
11
  // docs for them (first one gets the real file, the second honestly gets null).
12
12
  //
13
13
  // MIL-121 fallback: when a slice has no own `slices/<key>.md`, scan the `slices/` directory for
14
- // a sibling doc whose frontmatter `covers:` names this slice's key, and borrow IT. This
15
- // is filename+frontmatter discovery only — same convention as the direct lookup above, and
16
- // still never reads `note` (the tested invariant test/catalog.e2e.test.ts pins for `em catalog`'s
17
- // parallel doc discovery) — a slice's `note "slices/<other>.md"` cross-binding declaration is
18
- // docJoin.ts's concern (`em export`/`em validate --slice-ready`), not this module's.
19
- import { existsSync, readdirSync, readFileSync } from "node:fs";
14
+ // a sibling doc whose frontmatter `covers:` names this slice's key, and borrow IT. The scan
15
+ // itself (readCoverageDocs) is shared with `em catalog`'s own covered-slice handling (MIL-137,
16
+ // src/catalog/coverage.ts) so the two never disagree about which doc covers a slice.
17
+ //
18
+ // MIL-208 fallback (checked last, after own file and the covers: scan both come up empty): a
19
+ // continuation slice (an again-view-only slice) borrows the ORIGINATING slice's own file
20
+ // directly — same predicate/resolution as catalog/docJoin.ts's note-gated join, model/
21
+ // continuation.ts, just applied to this module's filename-convention resolution instead of
22
+ // notes.
23
+ import { existsSync, readFileSync } from "node:fs";
20
24
  import { join } from "node:path";
21
25
  import { computeRefs } from "../model/refs.js";
26
+ import { continuationOf } from "../model/continuation.js";
27
+ import { readCoverageDocs } from "../catalog/coverage.js";
22
28
  import { parseSliceDoc } from "../catalog/sliceDoc.js";
23
- /** Each slice's resolved design doc (own `slices/<key>.md`, or the MIL-121 covering doc, or
24
- * null), same order as model.slices (and so the same order as the header row's columns —
25
- * see layout/grid.ts's sliceNames). */
29
+ /** Each slice's resolved design doc (own `slices/<key>.md`, the MIL-121 covering doc, the
30
+ * MIL-208 originating slice's own file, or null), same order as model.slices (and so the same
31
+ * order as the header row's columns — see layout/grid.ts's sliceNames). */
26
32
  export function readSliceDocs(model, baseDir) {
27
- const { sliceKeys } = computeRefs(model);
33
+ const refs = computeRefs(model);
34
+ const { sliceKeys } = refs;
28
35
  const slicesDir = join(baseDir, "slices");
29
36
  let coverage = null; // built lazily, only if ever needed
30
37
  return model.slices.map((_slice, i) => {
@@ -33,7 +40,16 @@ export function readSliceDocs(model, baseDir) {
33
40
  if (existsSync(docPath))
34
41
  return parseSliceDoc(readFileSync(docPath, "utf8"));
35
42
  coverage ??= readCoverageDocs(slicesDir);
36
- return coverage.get(sliceKey) ?? null;
43
+ const covering = coverage.get(sliceKey)?.doc;
44
+ if (covering)
45
+ return covering;
46
+ const continuation = continuationOf(model, refs, i);
47
+ if (continuation) {
48
+ const originatingPath = join(slicesDir, `${continuation.sliceKey}.md`);
49
+ if (existsSync(originatingPath))
50
+ return parseSliceDoc(readFileSync(originatingPath, "utf8"));
51
+ }
52
+ return null;
37
53
  });
38
54
  }
39
55
  /** One status per slice, same order/resolution as readSliceDocs. null means no doc was found
@@ -41,22 +57,4 @@ export function readSliceDocs(model, baseDir) {
41
57
  export function readSliceStatuses(model, baseDir) {
42
58
  return readSliceDocs(model, baseDir).map((doc) => doc?.status ?? null);
43
59
  }
44
- /** Scans every `slices/*.md` file (sorted, for deterministic first-wins on an overlapping
45
- * `covers:` claim) and maps each covered slice key to that doc. Directory-scan, not
46
- * the single-file existsSync check every other doc lookup in em uses — the one precedent for
47
- * it is `em ledger`'s (src/cli/ledgerCheck.ts) own `readdirSync(slicesDir)` sweep. */
48
- function readCoverageDocs(slicesDir) {
49
- const coverage = new Map();
50
- if (!existsSync(slicesDir))
51
- return coverage;
52
- const files = readdirSync(slicesDir).filter((f) => f.endsWith(".md")).sort();
53
- for (const file of files) {
54
- const doc = parseSliceDoc(readFileSync(join(slicesDir, file), "utf8"));
55
- for (const coveredKey of doc.covers) {
56
- if (!coverage.has(coveredKey))
57
- coverage.set(coveredKey, doc);
58
- }
59
- }
60
- return coverage;
61
- }
62
60
  //# sourceMappingURL=sliceStatus.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sliceStatus.js","sourceRoot":"","sources":["../../src/render/sliceStatus.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,qEAAqE;AACrE,kFAAkF;AAClF,kFAAkF;AAClF,iFAAiF;AACjF,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,EAAE;AACF,gGAAgG;AAChG,wFAAwF;AACxF,2FAA2F;AAC3F,kGAAkG;AAClG,8FAA8F;AAC9F,qFAAqF;AAErF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAY,MAAM,wBAAwB,CAAC;AAEjE;;wCAEwC;AACxC,MAAM,UAAU,aAAa,CAAC,KAAsB,EAAE,OAAe;IACnE,MAAM,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC1C,IAAI,QAAQ,GAAiC,IAAI,CAAC,CAAC,oCAAoC;IAEvF,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,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AAC,CAAC,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,QAAQ,KAAK,CAAC,CAAC;QAClD,IAAI,UAAU,CAAC,OAAO,CAAC;YAAE,OAAO,aAAa,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QAC7E,QAAQ,KAAK,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACzC,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC;QAC7C,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAC9B,MAAM,YAAY,GAAG,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACpD,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,YAAY,CAAC,QAAQ,KAAK,CAAC,CAAC;YACvE,IAAI,UAAU,CAAC,eAAe,CAAC;gBAAE,OAAO,aAAa,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;qEACqE;AACrE,MAAM,UAAU,iBAAiB,CAAC,KAAsB,EAAE,OAAe;IACvE,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC;AACzE,CAAC"}
@@ -5,7 +5,7 @@ export declare const MODEL_README_TEMPLATE = "# {{Model Name}}\n\n{{One-paragrap
5
5
  export declare const STATE_TEMPLATE = "<!--\nResumable progress state for an event model. Stored as <model>/.event-modeling.md\nThe skill reads this on `/event-modeling` (no arg) to resume where you left off.\nKeep it current at the end of every working session.\n-->\n\n# Event Modeling Progress \u2014 {{Model Name}}\n\n- **Model file:** `{{model-name}}.em`\n- **Current phase:** {{discover | extract | model | slice | implement | conform | review | validate}}\n- **Current step:** {{1\u20137, see methodology; or extraction round R1\u2013R7}}\n- **Last updated:** {{YYYY-MM-DD}}\n- **Last conformance:** {{YYYY-MM-DD @ <target-repo revision> \u2014 report: conformance/<date>-report.md | never}}\n- **Last stakeholder review:** {{YYYY-MM-DD \u2014 attendees: see Participants | never}}\n\n## Session inputs\n- **Scope line:** {{one-line description of what's in/out of bounds for this model}}\n- **PRD / spec reference:** {{path, link, or \"none\"}}\n- **Headless/API model:** {{yes | no}}\n- **Source mode:** {{greenfield | extract-event-driven | extract-procedural}}\n- **Existing system refs:** {{repo paths, event-schema/topic locations, docs \u2014 or \"n/a\"}}\n\n## Participants\n<!-- Populate at session start. Live workshop: one human proxy relays questions to the room;\n attribute every answer/decision in the Decisions log to a named participant here. -->\n- {{Name}} \u2014 {{role}} \u2014 {{domain area}}\n\n## Extraction progress (existing-system models only \u2014 delete for greenfield)\n- [ ] R1. Candidate events (extracted/synthesized, filtered, confirmed)\n- [ ] R2. Timeline order (as-is narrative, actors/callers, first render)\n- [ ] R3. Commands / inputs\n- [ ] R4. Read models / outputs (validate from here)\n- [ ] R5. Boundaries & reactions (reaction shares its slice with the command it triggers)\n- [ ] R6. Gap & TBD reconciliation\n- [ ] R7. Convergence (render + validate clean, user confirmed as-is)\n\n## Steps completed\n- [ ] 1. Brainstorm events\n- [ ] 2. Plot / storyboard (personas + UI)\n- [ ] 3. Inputs (commands)\n- [ ] 4. Outputs (read models)\n- [ ] 5. Swimlanes & apply patterns\n- [ ] 6. Elaborate scenarios\n- [ ] 7. Evaluate completeness (`em validate` clean)\n\n## Decisions log\n<!-- Resolved choices, with the reasoning, so they aren't re-litigated. In a live workshop,\n attribute each entry to the participant who made the call (see Participants above). -->\n- {{YYYY-MM-DD}}: {{decision}} \u2014 {{why}} \u2014 by {{participant, if a live workshop}}\n\n## Usage log\n<!-- The team's only usage signal today (see docs/usage-data.md) \u2014 cheap and coarse on purpose.\n One line per session: phase(s) touched, and validate diagnostic *categories* hit (one of\n the exact fixed strings in docs/usage-data.md#categories, e.g. \"read model has no\n consumer\" \u2014 never the full instance message or any domain content). Append, never edit\n past entries. -->\n- {{YYYY-MM-DD}}: phases: {{discover | extract | model | slice | implement | conform | review | validate | watch, ...}} \u2014 validate: {{diagnostic category (docs/usage-data.md#categories), ... | none}}\n\n## Open questions / parking lot\n<!-- Unresolved items to bring back to the user. Never guess these. Metadata is optional and\n flat \u2014 add only what's known: source (ticket/conversation that spawned it), blocked on\n (who/what), revisit (when). -->\n- [ ] {{question}} \u2014 source: {{ticket/conversation link, optional}} \u2014 blocked on: {{who/what, optional}} \u2014 revisit: {{when, optional}}\n\n## Slice inventory\n<!-- Deliberately NOT a table: the canonical slice index (slice, pattern, status, doc link)\n lives in README.md's \"Slices\" section \u2014 one source of truth, updated there. This file\n only tracks resumable session state. -->\nSee `README.md` \u2192 **Slices** for the slice index and per-slice doc status.\n";
6
6
  /** Raw copy of templates/constitution.md, \`{{...}}\` placeholders intact — see
7
7
  * scaffoldConstitution(). */
8
- export declare const CONSTITUTION_TEMPLATE = "<!--\nThe implementation constitution: the house rules an implementing agent follows on EVERY slice \u2014\nstack, code style, testing norms, NFR baselines, review norms. It answers \"how do we build things\nhere\" once, so no slice doc has to repeat it and no agent has to invent it. Slice docs say WHAT to\nbuild; this says HOW it gets built here.\n\nWhere this document lives:\n - No SDD tool: `constitution.md` beside the model \u2014 `em scaffold` writes it there.\n - spec-kit project (a `.specify/` directory exists anywhere above the model): the document IS\n `.specify/memory/constitution.md`. em writes no second copy; the sections below merge into\n that file under these same headings, never overwriting text already there, and ratification is\n recorded in spec-kit's own `**Ratified**:` footer line instead of the frontmatter below.\n\nHow it gets filled: not by an agent guessing. Each section opens with the question a short\nfacilitated conversation asks before the first slice is implemented \u2014 the procedure is \"Before the\nfirst slice: the constitution\" in the `event-modeling-implement` skill's `reference/implement.md`\n(`em contract` prints it). Replace each `{{...}}` block with the real answers; delete the guidance\ncomments and any row that doesn't apply.\n\nRatification: `ratifiedBy:`/`ratifiedOn:` are the same identity discipline slice docs use \u2014 a\nNAMED human and an ISO date, hand-filled at sign-off (no `em` command writes this file).\n**A constitution with an empty `ratifiedBy:` is a draft**: an implementing agent treats it as\nunratified, says so, and does not proceed on unilateral style or stack decisions for a first slice.\n\n`em status` reports this document as present or absent per model \u2014 existence only. em never reads\nor validates its content, and nothing here is machine-parsed.\n-->\n\n---\nschemaVersion: 1\nratifiedBy:\nratifiedOn:\n---\n# {{Project Name}} \u2014 implementation constitution\n\nThe house rules for how implementation happens in this project. They bound every \"purely\ntechnical choice\" an implementing agent would otherwise make alone.\n\n## Stack and architectural shape\n\n> **What do we build on, what shape does the code take, and which implementation skill or\n> approach does each slice pattern route to?**\n\n- **Languages / runtimes:** {{e.g. Kotlin 2.x on JVM 21; TypeScript 5 on Node 24}}\n- **Frameworks / platform:** {{web framework, persistence, messaging, build tool}}\n- **Architectural pattern:** {{e.g. event-sourced CQRS with vertical slices; layered service over\n a relational store; functional core / imperative shell}}\n- **Where a slice's code lives:** {{one package per slice, per context, ...}}\n\nRouting \u2014 which implementation skill or approach each of the four slice patterns uses:\n\n| Pattern | Skill / approach |\n|---|---|\n| State Change | {{e.g. the `axon-*` skill set \u2014 axon-entity-patterns, then axon-entity-testing}} |\n| State View | {{e.g. the `axon-*` skill set \u2014 axon-projection-patterns, then axon-projection-testing}} |\n| Automation | {{e.g. the `axon-*` skill set \u2014 axon-policy-patterns, then axon-policy-testing}} |\n| Translation | {{e.g. the `axon-*` skill set \u2014 axon-translation-patterns}} |\n\nAn agent implementing a slice reads the doc's `pattern:` frontmatter and follows that row \u2014 this\ntable is the only routing rule.\n\n## Code style\n\n> **What does \"idiomatic\" mean in this codebase \u2014 formatting, naming, module layout?**\n\n- **Formatter / linter:** {{the tool and the command that runs it \u2014 never hand-format against it}}\n- **Naming:** {{commands, events, handlers, files, test names}}\n- **Module layout:** {{what lives in which file/package, and what may not import what}}\n- **Idiomatic here means:** {{the two or three habits a new contributor most often gets wrong}}\n\n## Testing norms\n\n> **What must be tested for each slice pattern, where do those tests live, and how are they named\n> so `em coverage` can trace invariant IDs?**\n\n- **Levels required per pattern:** {{e.g. State Change \u2014 decider unit tests plus a\n given/when/then fixture test; State View \u2014 projection tests; Automation / Translation \u2014\n reaction tests, including a negative case}}\n- **Invariant tests:** {{where they live}} \u2014 every `INV-<MNEMONIC>-n` in a slice doc needs at least\n one test **citing that exact ID** in its name or a comment, so\n `em coverage <model>.em --tests <dir>` can trace it.\n- **Scenario tests:** {{where they live}} \u2014 one per `## Scenarios (Given / When / Then)` entry,\n with rejection scenarios asserting the doc's named rejection reason.\n- **Test naming convention:** {{the exact pattern, e.g. `INV-ORD-3: rejects a second submit`}}\n- **What \"green\" means:** {{the command CI runs}}\n\n## NFR baselines\n\n> **What standing non-functional defaults does every slice inherit \u2014 authz, PII, performance,\n> observability?**\n\n- **Authorization model:** {{who may issue which commands, how it's enforced, and where}}\n- **PII / data handling:** {{what is sensitive, what may be logged, retention}}\n- **Performance defaults:** {{latency / throughput budgets that apply unless a slice says otherwise}}\n- **Observability:** {{logging, metrics, tracing every slice is expected to emit}}\n\nA slice doc's own `## Non-Functional Requirements` section overrides these for that slice; where\nit is silent, these apply.\n\n## Review and merge norms\n\n> **Who reviews an implementation PR, what blocks a merge, and how does the slice doc's status\n> flip fit in?**\n\n- **Reviewers:** {{who \u2014 a team, a CODEOWNERS rule, the slice's ratifier}}\n- **What blocks a merge:** {{e.g. a failing suite, an uncovered invariant, a gap that belongs back\n at the model}}\n- **Branch / commit conventions:** {{...}}\n- **At merge:** run `em slice mark-implemented <model>.em <slice-key> <pr-url>` \u2014 the one edit an\n implementing agent makes to a ratified slice doc, run by {{the PR author | CI}}. Never bump\n `version:`; that moves only when a delta is ratified.\n";
8
+ export declare const CONSTITUTION_TEMPLATE = "<!--\nThe implementation constitution: the house rules an implementing agent follows on EVERY slice \u2014\nstack, code style, testing norms, NFR baselines, review norms. It answers \"how do we build things\nhere\" once, so no slice doc has to repeat it and no agent has to invent it. Slice docs say WHAT to\nbuild; this says HOW it gets built here.\n\nWhere this document lives:\n - No SDD tool: `constitution.md` beside the model \u2014 `em scaffold` writes it there.\n - spec-kit project (a `.specify/` directory exists anywhere above the model): the document IS\n `.specify/memory/constitution.md`. em writes no second copy; the sections below merge into\n that file under these same headings, never overwriting text already there, and ratification is\n recorded in spec-kit's own `**Ratified**:` footer line instead of the frontmatter below.\n\nHow it gets filled: not by an agent guessing. Each section opens with the question a short\nfacilitated conversation asks before the first slice is implemented \u2014 the procedure is \"Before the\nfirst slice: the constitution\" in the `event-modeling-implement` skill's `reference/implement.md`\n(`em contract` prints it). Replace each `{{...}}` block with the real answers; delete the guidance\ncomments and any row that doesn't apply.\n\nRatification: `ratifiedBy:`/`ratifiedOn:` are the same identity discipline slice docs use \u2014 a\nNAMED human and an ISO date, hand-filled at sign-off (no `em` command writes this file).\n**A constitution with an empty `ratifiedBy:` is a draft**: an implementing agent treats it as\nunratified, says so, and does not proceed on unilateral style or stack decisions for a first slice.\n\n`em status` reports this document as present or absent per model \u2014 existence only. em never reads\nor validates its content, and nothing here is machine-parsed.\n-->\n\n---\nschemaVersion: 1\nratifiedBy:\nratifiedOn:\n---\n# {{Project Name}} \u2014 implementation constitution\n\nThe house rules for how implementation happens in this project. They bound every \"purely\ntechnical choice\" an implementing agent would otherwise make alone.\n\n## Stack and architectural shape\n\n> **What do we build on, what shape does the code take, and which implementation skill or\n> approach does each slice pattern route to?**\n\n- **Languages / runtimes:** {{e.g. Kotlin 2.x on JVM 21; TypeScript 5 on Node 24}}\n- **Frameworks / platform:** {{web framework, persistence, messaging, build tool}}\n- **Architectural pattern:** {{e.g. event-sourced CQRS with vertical slices; layered service over\n a relational store; functional core / imperative shell}}\n- **Where a slice's code lives:** {{one package per slice, per context, ...}}\n- **Interface conventions:** {{resource style \u2014 REST/RPC/GraphQL, etc.; error/rejection mapping;\n versioning; auth at the edge \u2014 the shape every `ui`-triggered command or `ui`-consumed view's\n endpoint follows, decided once here rather than invented per slice}}\n\nRouting \u2014 which implementation skill or approach each of the four slice patterns uses:\n\n| Pattern | Skill / approach |\n|---|---|\n| State Change | {{e.g. the `axon-*` skill set \u2014 axon-entity-patterns, then axon-entity-testing}} |\n| State View | {{e.g. the `axon-*` skill set \u2014 axon-projection-patterns, then axon-projection-testing}} |\n| Automation | {{e.g. the `axon-*` skill set \u2014 axon-policy-patterns, then axon-policy-testing}} |\n| Translation | {{e.g. the `axon-*` skill set \u2014 axon-translation-patterns}} |\n\nAn agent implementing a slice reads the doc's `pattern:` frontmatter and follows that row \u2014 this\ntable is the only routing rule.\n\n## Code style\n\n> **What does \"idiomatic\" mean in this codebase \u2014 formatting, naming, module layout?**\n\n- **Formatter / linter:** {{the tool and the command that runs it \u2014 never hand-format against it}}\n- **Naming:** {{commands, events, handlers, files, test names}}\n- **Module layout:** {{what lives in which file/package, and what may not import what}}\n- **Idiomatic here means:** {{the two or three habits a new contributor most often gets wrong}}\n\n## Testing norms\n\n> **What must be tested for each slice pattern, where do those tests live, and how are they named\n> so `em coverage` can trace invariant IDs?**\n\n- **Levels required per pattern:** {{e.g. State Change \u2014 decider unit tests plus a\n given/when/then fixture test; State View \u2014 projection tests; Automation / Translation \u2014\n reaction tests, including a negative case}}\n- **Invariant tests:** {{where they live}} \u2014 every `INV-<MNEMONIC>-n` in a slice doc needs at least\n one test **citing that exact ID** in its name or a comment, so\n `em coverage <model>.em --tests <dir>` can trace it.\n- **Scenario tests:** {{where they live}} \u2014 one per `## Scenarios (Given / When / Then)` entry,\n with rejection scenarios asserting the doc's named rejection reason.\n- **Test naming convention:** {{the exact pattern, e.g. `INV-ORD-3: rejects a second submit`}}\n- **What \"green\" means:** {{the command CI runs}}\n\n## NFR baselines\n\n> **What standing non-functional defaults does every slice inherit \u2014 authz, PII, performance,\n> observability?**\n\n- **Authorization model:** {{who may issue which commands, how it's enforced, and where}}\n- **PII / data handling:** {{what is sensitive, what may be logged, retention}}\n- **Performance defaults:** {{latency / throughput budgets that apply unless a slice says otherwise}}\n- **Observability:** {{logging, metrics, tracing every slice is expected to emit}}\n\nA slice doc's own `## Non-Functional Requirements` section overrides these for that slice; where\nit is silent, these apply.\n\n## Review and merge norms\n\n> **Who reviews an implementation PR, what blocks a merge, and how does the slice doc's status\n> flip fit in?**\n\n- **Reviewers:** {{who \u2014 a team, a CODEOWNERS rule, the slice's ratifier}}\n- **What blocks a merge:** {{e.g. a failing suite, an uncovered invariant, a gap that belongs back\n at the model}}\n- **Branch / commit conventions:** {{...}} \u2014 name only branch naming and commit-message style\n here. **One slice doc = one PR is the implement contract's rule, not this document's to\n amend** \u2014 a `covers:` doc ships as one PR for both keys; a read model is one doc, so a later\n `again` instance is a continuation of the doc that first declared it, not a PR of its own. See\n the agent guide's \u00A75/\u00A710.\n- **At merge:** run `em slice mark-implemented <model>.em <slice-key> <pr-url>` \u2014 the one edit an\n implementing agent makes to a ratified slice doc, run by {{the PR author | CI}}. Never bump\n `version:`; that moves only when a delta is ratified.\n";
9
9
  /** Same STARTER_EM content `em init` writes, titled from an arbitrary display name — used by
10
10
  * `em scaffold`, which (unlike `em init`) knows a name to title the model with. */
11
11
  export declare function starterEmFor(title: string): string;
package/dist/templates.js CHANGED
@@ -227,6 +227,9 @@ technical choice" an implementing agent would otherwise make alone.
227
227
  - **Architectural pattern:** {{e.g. event-sourced CQRS with vertical slices; layered service over
228
228
  a relational store; functional core / imperative shell}}
229
229
  - **Where a slice's code lives:** {{one package per slice, per context, ...}}
230
+ - **Interface conventions:** {{resource style — REST/RPC/GraphQL, etc.; error/rejection mapping;
231
+ versioning; auth at the edge — the shape every \`ui\`-triggered command or \`ui\`-consumed view's
232
+ endpoint follows, decided once here rather than invented per slice}}
230
233
 
231
234
  Routing — which implementation skill or approach each of the four slice patterns uses:
232
235
 
@@ -286,7 +289,11 @@ it is silent, these apply.
286
289
  - **Reviewers:** {{who — a team, a CODEOWNERS rule, the slice's ratifier}}
287
290
  - **What blocks a merge:** {{e.g. a failing suite, an uncovered invariant, a gap that belongs back
288
291
  at the model}}
289
- - **Branch / commit conventions:** {{...}}
292
+ - **Branch / commit conventions:** {{...}} — name only branch naming and commit-message style
293
+ here. **One slice doc = one PR is the implement contract's rule, not this document's to
294
+ amend** — a \`covers:\` doc ships as one PR for both keys; a read model is one doc, so a later
295
+ \`again\` instance is a continuation of the doc that first declared it, not a PR of its own. See
296
+ the agent guide's §5/§10.
290
297
  - **At merge:** run \`em slice mark-implemented <model>.em <slice-key> <pr-url>\` — the one edit an
291
298
  implementing agent makes to a ratified slice doc, run by {{the PR author | CI}}. Never bump
292
299
  \`version:\`; that moves only when a delta is ratified.
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,mCAAmC;AAEnC,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDzB,CAAC;AAEF,wDAAwD;AACxD,EAAE;AACF,2FAA2F;AAC3F,0FAA0F;AAC1F,2FAA2F;AAC3F,2FAA2F;AAC3F,+FAA+F;AAC/F,2FAA2F;AAC3F,2CAA2C;AAE3C,qGAAqG;AACrG,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CpC,CAAC;AAEF,iGAAiG;AACjG,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE7B,CAAC;AAEF;8BAC8B;AAC9B,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GpC,C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kB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,2 @@
1
+ /** `YYYY-MM-DD` for `d`'s local calendar date (default: now). Zero-pads month/day. */
2
+ export declare function localIsoDate(d?: Date): string;
@@ -0,0 +1,17 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Shared "what calendar date is it" helper for every date-defaulting command (MIL-206).
3
+ //
4
+ // `new Date().toISOString().slice(0, 10)` reads the UTC calendar date, not the caller's. After
5
+ // ~17:00 in the Americas (any zone west of UTC), that's already tomorrow: someone ratifying a
6
+ // slice at 6pm local time on the 6th got `ratifiedOn: 2026-09-07` stamped instead. Build the
7
+ // string from the local getters instead, so the default always matches what the caller's own
8
+ // clock and calendar say "today" is. A caller who wants UTC (or any other zone) can still pass
9
+ // an explicit date through `--on`.
10
+ /** `YYYY-MM-DD` for `d`'s local calendar date (default: now). Zero-pads month/day. */
11
+ export function localIsoDate(d = new Date()) {
12
+ const year = d.getFullYear();
13
+ const month = String(d.getMonth() + 1).padStart(2, "0");
14
+ const day = String(d.getDate()).padStart(2, "0");
15
+ return `${year}-${month}-${day}`;
16
+ }
17
+ //# sourceMappingURL=localDate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localDate.js","sourceRoot":"","sources":["../../src/util/localDate.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,wFAAwF;AACxF,EAAE;AACF,+FAA+F;AAC/F,8FAA8F;AAC9F,6FAA6F;AAC7F,6FAA6F;AAC7F,+FAA+F;AAC/F,mCAAmC;AAEnC,sFAAsF;AACtF,MAAM,UAAU,YAAY,CAAC,IAAU,IAAI,IAAI,EAAE;IAC/C,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACjD,OAAO,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;AACnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milehimikey/em",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "AI-friendly Event Modeling — a slice-first text DSL rendered to a strict, self-contained Graphviz grid (SVG/PNG)",
5
5
  "type": "module",
6
6
  "bin": {