@milehimikey/em 1.3.0 → 1.4.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.
@@ -5,11 +5,13 @@ description: >-
5
5
  the 7 steps of Event Modeling and the 4 patterns (State Change, State View, Automation,
6
6
  Translation), and produce implementation-ready slice design documents. Use when the user wants
7
7
  to event-model a business process or system, do event modeling / event storming, design slices,
8
- build or edit an `.em` model, run the em tool, or extract / reverse-engineer a current-state
9
- event model from an existing system or codebase (event-driven or legacy/procedural). Works in
10
- resumable phases via an argument: `discover` (steps 1-4, greenfield), `extract` (current-state
11
- model of an existing system), `model` (steps 5-7), `slice` (deep slice specs), plus `watch` and
12
- `validate`. With no argument it resumes from the saved state file.
8
+ build or edit an `.em` model, run the em tool, extract / reverse-engineer a current-state
9
+ event model from an existing system or codebase (event-driven or legacy/procedural), or check
10
+ a ratified model for drift against the codebase that implements it. Works in resumable phases
11
+ via an argument: `discover` (steps 1-4, greenfield), `extract` (current-state model of an
12
+ existing system), `model` (steps 5-7), `slice` (deep slice specs), `conform` (drift check
13
+ against the codebase), plus `watch` and `validate`. With no argument it resumes from the saved
14
+ state file.
13
15
  ---
14
16
 
15
17
  # Event Modeling with `em`
@@ -78,13 +80,19 @@ validation rules) before doing real work — they are the source of truth. Templ
78
80
  README.md # overview + slice index (from templates/model-readme.md)
79
81
  .event-modeling.md # resumable state (from templates/state.md)
80
82
  slices/<slice-name>.md # one rich slice doc per slice (from templates/slice.md)
83
+ conformance/<date>-report.md
84
+ # conform-phase reports (from templates/conformance-report.md)
85
+ <model-name>-asis.em # conform-phase scratch model, regenerated per run — git-ignore this
81
86
  ```
82
87
 
83
88
  When creating a new model, scaffold the directory and copy the templates in (filling the
84
89
  placeholders). Copy `live.html` **verbatim** — it takes the SVG name from its URL query
85
90
  (`live.html?svg=<model-name>.svg`), so there's nothing to edit. You may use `em init` for a
86
91
  starter `.em`, but usually you'll build it up from the discovery conversation instead. Fill
87
- template placeholders — never leave `{{...}}` in delivered files.
92
+ template placeholders — never leave `{{...}}` in delivered files. The `conformance/` directory
93
+ and `<model-name>-asis.em` only appear once the `conform` phase runs; add the pattern `*-asis.em`
94
+ to the repository's `.gitignore` the first time one is created (see `reference/conform.md`) —
95
+ it's scratch, never committed.
88
96
 
89
97
  ---
90
98
 
@@ -194,6 +202,29 @@ For each slice:
194
202
  `ready-to-implement`, later `implemented` once shipped, with `Implemented in:` filled in).
195
203
  5. Re-render and `em validate`.
196
204
 
205
+ ## Phase: `conform` — drift check against the codebase
206
+
207
+ Goal: check a **ratified** model (and its slice docs) against the codebase that implements it,
208
+ and report where they've drifted — advisory only, never a gate, never an unprompted edit.
209
+
210
+ **Read `reference/conform.md` before doing any conform work** — it carries the full flow
211
+ (scope, evidence-first verification, `em diff --json`, classification, report) and the
212
+ stance guardrails (evidence-first, uncertainty is never drift, propose-don't-edit). It reuses
213
+ `extract`'s sourcing/mode rules for reading the target codebase rather than duplicating them.
214
+
215
+ In short: for each in-scope slice, gather code evidence *before* comparing to the model or doc;
216
+ write the as-is picture into a scratch model (`<model-name>-asis.em`, reusing the canonical
217
+ model's names wherever the code matches them); run `em diff <model-name>.em
218
+ <model-name>-asis.em --json` and let `em` decide the structural deltas; classify every finding
219
+ (real drift / model gap / internal inconsistency / uncertainty) with cited evidence; write
220
+ `conformance/<date>-report.md` with proposed `issue "conformance: …"` red notes; apply only the
221
+ proposals the user ratifies, then re-render and validate; update the state file's
222
+ `Last conformance:` marker.
223
+
224
+ End of phase: state file's `Last conformance:` marker updated, Decisions log entry if any
225
+ proposals were applied. Conform doesn't chain to another phase — it's a recurring loop, run
226
+ again whenever the codebase has moved.
227
+
197
228
  ## Phase: `watch` — live team view
198
229
 
199
230
  **Recommended (instant push, no polling):** start the watcher with `--serve` in the background:
@@ -0,0 +1,228 @@
1
+ # Conform Phase — Drift Detection Against the Codebase
2
+
3
+ Read this **before doing any conform work**. It governs the `conform` phase: checking a
4
+ **ratified** model (and its slice docs) against the codebase that is supposed to implement it,
5
+ and reporting where they've drifted apart. Conform reuses `extract`'s sourcing/mode rules
6
+ (`reference/extract.md`) for reading the target codebase rather than duplicating them — the
7
+ difference is what you do with what you find: extract *builds* a model from the code; conform
8
+ *compares* code evidence against a model that already exists.
9
+
10
+ ## Stance — advisory-only, evidence-first
11
+
12
+ - **Advisory-only.** Conform never gates anything and never edits the canonical model or a
13
+ slice doc on its own initiative. It proposes; the user ratifies. There is no such thing as
14
+ an auto-applied conformance fix.
15
+ - **Evidence-first, not model-first.** For every slice you check, gather code evidence —
16
+ handler/event/projection/endpoint sites, invariant-enforcement sites, scenario-test sites —
17
+ **before** you compare anything to the model or doc. Read the doc and model first to know
18
+ *what to look for*, but write down what the code actually shows before you judge whether it
19
+ matches. Anchoring bias is the failure mode this rule exists to block: "the model says X" is
20
+ never allowed to substitute for "the code shows X at `path/to/File.kt:42`".
21
+ - **Uncertainty is never drift.** If you can't find evidence either way — the code path is
22
+ unclear, the test is ambiguous, you ran out of budget — that's an **uncertainty**, reported
23
+ in its own section, never folded into a drift or gap finding. A false positive here is worse
24
+ than a missed one; it's what burns the loop's credibility.
25
+ - **Anchored, not blind.** You read the canonical model's vocabulary before walking the code,
26
+ and you reuse its slice/element names wherever the code genuinely matches them. This trades
27
+ some independence for precision: naming a scratch model's elements from scratch (blind
28
+ extraction) would report wholesale slice add/remove noise from naming alone the moment your
29
+ synonym for an existing element doesn't match the model's — the exact false-drift failure
30
+ mode this phase exists to avoid. The guardrail against anchoring bias is the evidence-first
31
+ rule above, not independence from the model's vocabulary.
32
+
33
+ ## Preconditions
34
+
35
+ 1. A canonical `.em` model with a state file (`.event-modeling.md`), reachable the same way the
36
+ SKILL.md preconditions locate it.
37
+ 2. The model should be ratified for the slices you're about to check — `slice` docs at
38
+ `implemented` (or the status the user says corresponds to shipped code) for whichever slices
39
+ are in scope. Checking a `draft` or `ready-to-implement` slice against code is a wasted walk;
40
+ tell the user and skip it rather than reporting "drift" against a doc nobody built to yet.
41
+ 3. The codebase to check: the state file's **Existing system refs** (populated during
42
+ `extract`, if this model came from one) or ask the user for the repo path if not set. Record
43
+ it if missing. In a headless/scheduled run with no user to ask, default to the repository
44
+ the model lives in (if it contains the implementation) and state that assumption in the
45
+ report's run metadata.
46
+ 4. Confirm `em --version` works (same check as every other phase) — you'll run `em diff`. The
47
+ phase needs `em diff --json`; if the flag errors as unknown, the installed `em` predates it
48
+ — say so and stop rather than falling back to eyeballing the two models.
49
+
50
+ ## The three conformance surfaces
51
+
52
+ The model isn't just the `.em` — slice docs carry the detailed spec (field tables with rules,
53
+ named invariants, Given/When/Then scenarios). Conform checks all three surfaces that can drift:
54
+
55
+ | Surface | What drifts | Who checks | How |
56
+ |---|---|---|---|
57
+ | **Structural** — `.em` ↔ code | slices/elements/fields/flow | `em` (deterministic) | `em diff --json` on canonical vs. an as-is scratch model |
58
+ | **Spec** — slice doc ↔ code | field rules not enforced, named invariants (`INV-*`) without enforcement/test sites, GWT scenarios without test sites | you (judgment) | per-slice evidence walk: each checkable claim in the doc mapped to a code/test site by name (`INV-CHK-4` → its enforcement site + its test) |
59
+ | **Internal** — slice doc ↔ `.em` | the doc's header metadata (Pattern, Status) or its Command/Event/Read Model sections and field tables disagreeing with the model's own elements/fields | you (judgment, v1) | cross-check the doc's structured sections against the slice's model elements |
60
+
61
+ The internal surface is deterministically checkable in principle (structured doc sections +
62
+ `{ fields }` blocks) — promoting it to an `em validate` rule is a natural follow-up; file it as
63
+ its own issue rather than growing this phase's scope. For now it's agent judgment, same as spec.
64
+
65
+ **Internal inconsistency is its own class, not drift.** When a doc and the `.em` disagree with
66
+ each other, neither one is "the code" — you don't know which is stale. Report it as internal
67
+ inconsistency and let the user decide which side is right; don't guess by treating one as
68
+ authoritative.
69
+
70
+ ## Flow
71
+
72
+ ### 1. Scope
73
+
74
+ Default: **diff-scoped.** Read the state file's `Last conformance:` marker (date + target-repo
75
+ revision). If it's set, run `git diff --name-only <recorded-revision>..HEAD` from the target
76
+ repo's root to list the changed paths (`git log` alone prints commit subjects, not paths), then
77
+ map those paths to slices (via each slice doc's known code locations, `Implemented in:` links,
78
+ or a quick Grep if those are stale) — that's your in-scope set. If the marker reads `never`
79
+ (first run) or the user passes `--full`, scope is every `implemented` slice.
80
+
81
+ Cost containment here is cadence, not a trigger condition — diff-scoped-by-default is what
82
+ keeps a recurring conform run cheap; don't invent a smarter trigger.
83
+
84
+ ### 2. Anchored, evidence-first verification (per in-scope slice)
85
+
86
+ For each slice in scope:
87
+
88
+ 1. Read the slice's **doc** (`slices/<slice-name>.md`) alongside its elements in the `.em`.
89
+ This tells you the vocabulary to anchor on and the claims to check — not the answer.
90
+ 2. Walk the code and **record evidence before comparing**:
91
+ - **Structural:** the handler, event class(es), projection(s), endpoint(s) that implement
92
+ this slice.
93
+ - **Spec:** for every named invariant (`INV-*`) in the doc, its enforcement site and its
94
+ test site (by name/path, both or neither — a half-found invariant is an uncertainty, not
95
+ a pass). Scenarios are budgeted: map Given/When/Then scenarios to individual test sites
96
+ when the in-scope slice count is small (roughly ≤5) or the user asks for that depth;
97
+ otherwise record slice-level scenario-test presence and say so in the report — per-scenario
98
+ mapping across a full model roughly doubles the walk. Where the doc doesn't name
99
+ invariants/scenarios individually, fall back to slice-level test presence (some vs. none)
100
+ rather than inventing IDs the doc never gave you.
101
+ - **Legitimate non-materialized views:** an automation's watched view may have no
102
+ materialized projection in code — a direct event handler with criteria-sourced state is
103
+ the same pattern expressed in the code idiom (extract.md's R5 reaction rules). That is
104
+ NOT structural drift; note the idiom in the evidence log instead of reporting the view
105
+ as missing.
106
+ 3. Write what you found into the scratch model (`<model-name>-asis.em`, see below). **Seed the
107
+ scratch model as a copy of the canonical `.em` and replace only the in-scope slices** with
108
+ the as-is picture, leaving out-of-scope slices byte-identical. This is not an optimization:
109
+ `em diff` matches slices by name, so a scratch model containing *only* the in-scope slices
110
+ reports every other canonical slice as `slice-removed` plus one `element-removed` per
111
+ element — a phantom-removal flood on every diff-scoped run, which is the exact false drift
112
+ this phase exists to avoid. It also keeps the scratch model compilable (see step 3). Within
113
+ the slices you do rewrite, **reuse the canonical model's slice and element names wherever
114
+ the code genuinely matches them** — the canonical model is the vocabulary anchor. Give a
115
+ new name only to code behavior the model doesn't cover at all. Record the mapping decision
116
+ for every element you name this way (e.g. `CartItemAdded` code class ↔ `"Cart Item Added"`
117
+ model event) so it's auditable, not a silent judgment call. **Match the canonical model's field granularity:** declare `{ fields }`
118
+ in the scratch model only where the canonical model declares them (if the canonical model
119
+ puts fields on commands but not events, so does the scratch model — writing code-derived
120
+ event fields there would flood the diff with `field-added` noise). Schema claims at finer
121
+ granularity than the `.em` declares — e.g. event fields documented only in a slice doc's
122
+ table — are checked on the **spec surface** against the doc, not smuggled into the
123
+ structural diff.
124
+ 4. Cross-check the doc's header metadata and Command/Event/Read Model sections against the
125
+ slice's actual `.em` elements and fields for the internal surface — this doesn't need code
126
+ evidence, just doc-vs-`.em` reading. Narrative sections (Intent, Open Questions, notes)
127
+ count too when the contradiction is unambiguous — a stale sentence that flatly contradicts
128
+ the `.em` is an internal inconsistency; a vague or interpretable one is not a finding.
129
+
130
+ Do this for every in-scope slice before moving on to diffing. The evidence you record here is
131
+ what every finding in the report will cite — file paths, not vibes.
132
+
133
+ ### 3. Deterministic diff
134
+
135
+ First `em validate <model-name>-asis.em`. `em diff` refuses when either side has validation
136
+ *errors* (warnings are fine), so a scratch model that doesn't compile stops the run cold. The
137
+ usual cause is a slice that depends on one you rewrote incompletely — a `view X again` whose
138
+ first declaration you dropped, or an automation `from` a read model that no longer exists.
139
+ Seeding from the canonical model (step 2) prevents this; if it still fails, **fix the scratch
140
+ model and report the failure as a tooling problem in the run metadata — never as drift.** A
141
+ model you couldn't compile is an uncertainty about your own scratch file, not a finding
142
+ against the codebase.
143
+
144
+ Then run `em diff <model-name>.em <model-name>-asis.em --json`. `em`, not you, decides what
145
+ structurally differs — don't re-derive by eye what the tool already computed. Parse the JSON
146
+ (`docs/cli.md`'s diff section documents the envelope: `diffSchemaVersion`, `counts`, `changes`,
147
+ `removals`, every optional `ChangeEntry` field explicit-`null` when unused) and use it as the
148
+ structural-surface findings directly.
149
+
150
+ ### 4. Classify
151
+
152
+ Every finding — structural deltas from step 3, plus spec- and internal-surface findings from
153
+ step 2 — sorts into exactly one class:
154
+
155
+ - **Real drift** — code evidence contradicts the model or doc.
156
+ - **Model gap** — code evidence shows behavior neither the model nor the doc covers.
157
+ - **Internal inconsistency** — the doc and the `.em` disagree with each other (surface 3 only).
158
+ - **Extraction uncertainty** — no evidence either way. Never reported as drift or a gap.
159
+
160
+ Every classification must cite the evidence recorded in step 2 (or the `em diff` entry, for
161
+ structural findings) — a finding with no citation isn't ready to report.
162
+
163
+ ### 5. Report + proposals
164
+
165
+ Write `conformance/<YYYY-MM-DD>-report.md` in the model directory, from
166
+ `templates/conformance-report.md`. For a real-drift or model-gap finding, propose a
167
+ ready-to-apply red note — `issue "conformance: <text>"` on the right element, written out in
168
+ the report exactly as it should be pasted into the `.em` — when a model-side marker is the
169
+ right fix; when the fix is purely doc wording (or the finding is an internal inconsistency
170
+ with no clear side to flag), omit the red note and say why instead. **You never edit the
171
+ canonical model or a slice doc unprompted** — walk the report with the user, apply only the
172
+ proposals they approve, then re-render and `em validate`.
173
+
174
+ End of run: update the state file's `Last conformance:` marker, exact format:
175
+
176
+ ```
177
+ - **Last conformance:** YYYY-MM-DD @ <target-repo revision> — report: conformance/YYYY-MM-DD-report.md
178
+ ```
179
+
180
+ The revision is the one you just diffed against, so the next run's scope starts from here —
181
+ step 1 parses this line, so keep the format exact. If any proposals were ratified and applied,
182
+ log a Decisions entry noting what changed and why.
183
+
184
+ ## Conventions
185
+
186
+ - **Scratch model:** `<model-name>-asis.em`, written **next to** the canonical model (same
187
+ directory as `.event-modeling.md`). Always seeded as a copy of the canonical model with only
188
+ the in-scope slices rewritten (step 2), never built up from nothing. It's regenerated every
189
+ conform run — add the pattern `*-asis.em` to the repository's `.gitignore` (create the entry
190
+ if there isn't one) so it never gets committed.
191
+ - **Report location:** `conformance/<YYYY-MM-DD>-report.md` in the model directory. One file
192
+ per run; don't overwrite a prior date's report.
193
+ - **Red note wording:** `issue "conformance: <what's wrong, plainly>"` — plain enough that
194
+ whoever ratifies it later understands the claim without re-reading the report.
195
+ - **Naming/matching rules:** same past-tense-event / imperative-command / thing-shown-view
196
+ naming discipline as the rest of the skill (`methodology.md`'s Socratic stance) — you're
197
+ matching code to existing names here, not inventing new ones except for genuinely uncovered
198
+ behavior.
199
+
200
+ ## Completion & handoff
201
+
202
+ Conform is complete when: every in-scope slice has been walked (step 2), the scratch model has
203
+ been diffed (step 3), every finding is classified with cited evidence (step 4), the report is
204
+ written (step 5), the state file's `Last conformance:` marker is updated, and the user has seen
205
+ the report and said which proposals (if any) to apply. Applied proposals get re-rendered and
206
+ re-validated before you call the run done.
207
+
208
+ Conform doesn't chain to another phase automatically — it's a recurring loop, not a step in
209
+ building the model. Suggest running it again next time the target codebase has moved, at
210
+ whatever cadence the user wants (see `docs/ci.md` for a scheduled-run recipe).
211
+
212
+ ## Anti-patterns
213
+
214
+ - **Blind extraction** — deriving the as-is scratch model with no sight of the canonical
215
+ model's vocabulary. Loses the anchor and produces naming-driven false drift.
216
+ - **A scratch model holding only the in-scope slices** — `em diff` reads every omitted
217
+ canonical slice as removed, so a diff-scoped run drowns in phantom removals. Seed from the
218
+ canonical model and rewrite only the slices you walked.
219
+ - **Reporting uncertainty as drift** — "I couldn't find the enforcement site" is an
220
+ uncertainty, never a finding against the model.
221
+ - **Editing the model or a slice doc without ratification** — conform proposes; the user
222
+ applies. No exceptions, even for an "obviously correct" fix.
223
+ - **Treating scenario/test absence as a build failure** — a missing test site is a spec-surface
224
+ finding to report and classify, not a reason to stop the run or block anything. Conform is
225
+ advisory; there's no gate here.
226
+ - **Re-deriving what `em diff` already decided** — once you have the JSON, use it; don't
227
+ eyeball the two `.em` files yourself looking for structural differences the tool already
228
+ computed for you.
@@ -0,0 +1,69 @@
1
+ <!--
2
+ Conformance report skeleton. One per conform run, stored at
3
+ <model-name>/conformance/<YYYY-MM-DD>-report.md (see reference/conform.md).
4
+ Fill every section; leave "none" rather than deleting a section with nothing to report.
5
+ Replace bracketed placeholders; delete guidance comments before finishing.
6
+ -->
7
+
8
+ # Conformance Report — {{Model Name}} — {{YYYY-MM-DD}}
9
+
10
+ - **Model:** `{{model-name}}.em`
11
+ - **Target repo:** {{repo path or URL}} @ `{{revision}}`
12
+ - **Previous conformance revision:** {{prior target-repo revision, or "never (first run)"}}
13
+ - **Scope:** {{full | diff-scoped since <prior revision>}}
14
+ - **Slices checked:** {{comma-separated slice names, or "all implemented slices"}}
15
+ - **Slices skipped (not yet implemented):** {{list, or "none"}}
16
+
17
+ ## Summary
18
+
19
+ | Surface | Real drift | Model gap | Internal inconsistency | Uncertainty |
20
+ |---|---|---|---|---|
21
+ | Structural | {{n}} | {{n}} | — | {{n}} |
22
+ | Spec | {{n}} | {{n}} | — | {{n}} |
23
+ | Internal | — | — | {{n}} | {{n}} |
24
+
25
+ {{One or two sentences: overall read — clean, mostly clean with N items, or notably drifted.}}
26
+
27
+ ## Findings
28
+
29
+ <!-- One subsection per finding. Group however reads clearest (by slice, or by surface) but keep
30
+ every field below for every finding. Order doesn't matter; classification does. -->
31
+
32
+ ### {{n}}. {{Short finding title}}
33
+
34
+ - **Surface:** {{structural | spec | internal}}
35
+ - **Classification:** {{real drift | model gap | internal inconsistency}}
36
+ - **Slice:** {{slice name}}
37
+ - **Evidence:** {{file path(s) and line/symbol, or the `em diff --json` entry (type + name)}}
38
+ - **Claim:** {{what the model/doc says vs. what the code/doc shows — the actual disagreement}}
39
+ - **Proposed red note:** `issue "conformance: {{text}}"` on {{element}} (slice "{{slice}}")
40
+ <!-- Omit this line entirely for internal-inconsistency findings with no clear side to flag,
41
+ or when the finding doesn't warrant a red note (say why instead). -->
42
+
43
+ ## Scenario / invariant coverage
44
+
45
+ <!-- Per in-scope slice: every named invariant and every GWT scenario the doc claims, mapped to
46
+ its enforcement/test site. Leave a cell explicitly blank/"none found" rather than omitting
47
+ the row — gaps are the point of this table. -->
48
+
49
+ ### {{Slice Name}}
50
+
51
+ | Claim | Type | Enforcement site | Test site | Status |
52
+ |---|---|---|---|---|
53
+ | {{INV-XXX-1 or scenario title}} | {{invariant \| scenario}} | {{file path / symbol, or "none found"}} | {{file path / symbol, or "none found"}} | {{covered \| gap \| uncertain}} |
54
+
55
+ ## Uncertainties
56
+
57
+ <!-- Listed separately from Findings — these are NOT drift. No evidence either way; say what was
58
+ missing (time, clarity, an ambiguous test) so a follow-up run can pick it up. -->
59
+
60
+ - **{{structural | spec | internal}}** — {{what's uncertain}} — {{slice}} — {{why: e.g. "couldn't locate the test for INV-CHK-3, only its enforcement site"}}
61
+
62
+ <!-- Tag each with its surface so these reconcile against the Summary table's Uncertainty column. -->
63
+
64
+ ## Applied this run
65
+
66
+ <!-- Filled in AFTER the user reviews Findings and says what to apply. Leave "none yet — awaiting
67
+ ratification" until that conversation happens. -->
68
+
69
+ {{List of ratified proposals actually applied to the `.em`/slice docs, or "none yet — awaiting ratification".}}
@@ -10,6 +10,7 @@ Keep it current at the end of every working session.
10
10
  - **Current phase:** {{extract | discover | model | slice}}
11
11
  - **Current step:** {{1–7, see methodology; or extraction round R1–R7}}
12
12
  - **Last updated:** {{YYYY-MM-DD}}
13
+ - **Last conformance:** {{YYYY-MM-DD @ <target-repo revision> — report: conformance/<date>-report.md | never}}
13
14
 
14
15
  ## Session inputs
15
16
  - **Scope line:** {{one-line description of what's in/out of bounds for this model}}
package/README.md CHANGED
@@ -28,6 +28,14 @@ em watch model.em --serve # live browser view, re-renders on every save
28
28
  em validate model.em # check event-modeling rules
29
29
  ```
30
30
 
31
+ Once a model is real and committed, `em` keeps working on it over time:
32
+
33
+ ```bash
34
+ em export model.em # versioned JSON, for agents and tooling
35
+ em diff model.em --from HEAD~1 # what this change did to the model
36
+ em changelog model.em # the model's git history as a business ledger
37
+ ```
38
+
31
39
  A model is a list of slices — vertical time steps, read left to right — whose elements land
32
40
  in swimlane rows:
33
41
 
@@ -50,7 +58,9 @@ slice "View Open Orders" {
50
58
  ```
51
59
 
52
60
  The [tutorial](docs/tutorial.md) builds a complete model from an empty file in about twenty
53
- minutes.
61
+ minutes, and [docs/workflow.md](docs/workflow.md) picks up where it leaves off: how a model
62
+ gets specified, gated in CI, handed to implementation, and checked against the code that
63
+ implements it.
54
64
 
55
65
  ## Model with AI
56
66
 
@@ -61,8 +71,10 @@ the questions, you supply the domain, and the model renders live as it grows.
61
71
  em skill install # copy the skill into .claude/skills/event-modeling/
62
72
  ```
63
73
 
64
- Then run `/event-modeling` in Claude Code. See [docs/ai-workflow.md](docs/ai-workflow.md)
65
- for the phases and what a session produces, and the
74
+ Then run `/event-modeling` in Claude Code. The same skill also runs the reverse direction:
75
+ `extract` derives a model from a system that already exists, and `conform` checks a model
76
+ against the code implementing it and reports where they've drifted. See
77
+ [docs/ai-workflow.md](docs/ai-workflow.md) for the phases and what a session produces, and the
66
78
  [em-with-ai repository](https://github.com/milehimikey/em-with-ai) for a ~50-slice model
67
79
  built this way.
68
80
 
@@ -71,11 +83,12 @@ built this way.
71
83
  | Doc | What it answers |
72
84
  |---|---|
73
85
  | [docs/tutorial.md](docs/tutorial.md) | Learn the tool by building a model from scratch |
86
+ | [docs/workflow.md](docs/workflow.md) | The model lifecycle: specify, gate, hand off, track change, detect drift |
74
87
  | [docs/patterns.md](docs/patterns.md) | The four Event Modeling patterns and their DSL shapes |
75
88
  | [docs/dsl.md](docs/dsl.md) | Full DSL reference: keywords, `from`, `again`, fields, notes |
76
89
  | [docs/cli.md](docs/cli.md) | Every command and flag |
77
90
  | [docs/validation.md](docs/validation.md) | Every rule `em validate` checks, and the fixes |
78
- | [docs/ci.md](docs/ci.md) | Copy-paste GitHub Actions recipe: validate `.em` changes in CI |
91
+ | [docs/ci.md](docs/ci.md) | Copy-paste CI recipes: validate `.em` changes, run conformance on a schedule |
79
92
  | [docs/timeline.md](docs/timeline.md) | The Two Laws of the Timeline |
80
93
  | [docs/ai-workflow.md](docs/ai-workflow.md) | The Claude Code skill: install, phases, artifacts |
81
94
  | [docs/dependencies.md](docs/dependencies.md) | What's bundled vs. what needs a system install |
@@ -0,0 +1,53 @@
1
+ import { GitRunner } from "./diff-inputs.js";
2
+ export interface CommitInfo {
3
+ /** Full commit hash — what `readFileAtCommit`/`git show` reads content at. */
4
+ hash: string;
5
+ shortHash: string;
6
+ /** YYYY-MM-DD author date (`--date=short`). */
7
+ date: string;
8
+ subject: string;
9
+ /**
10
+ * Repo-relative path of the file AS OF this commit, taken from the same
11
+ * `git log --follow --name-only` walk — pre-rename commits carry the old
12
+ * path, the one `git show <hash>:<path>` can actually read.
13
+ */
14
+ path: string;
15
+ }
16
+ export type CommitsResult = {
17
+ ok: true;
18
+ repoRoot: string;
19
+ commits: CommitInfo[];
20
+ } | {
21
+ ok: false;
22
+ message: string;
23
+ };
24
+ /**
25
+ * List every commit that touched `file` (rename-following via `--follow`),
26
+ * oldest -> newest, each carrying the file's path as of that commit.
27
+ *
28
+ * `--from`/`--to` bound the walk **inclusive of both boundary commits**: the
29
+ * range compiles to `<from>^..<to>` (git's standard idiom for an
30
+ * inclusive-from range), so `--from` itself is the oldest commit in the
31
+ * output and `--to` the newest. `--to` defaults to `HEAD`. `--from` on a
32
+ * root commit (no parent to exclude) falls back to an unbounded walk up to
33
+ * `<to>`, which is equivalent — there's nothing before a root commit to
34
+ * exclude anyway.
35
+ */
36
+ export declare function listModelCommits(file: string, opts?: {
37
+ from?: string;
38
+ to?: string;
39
+ }, runGit?: GitRunner): CommitsResult;
40
+ /** File content at a commit, or a note-ready `message` (no command prefix — it lands inside a changelog section). */
41
+ export type FileAtCommitResult = {
42
+ ok: true;
43
+ content: string;
44
+ } | {
45
+ ok: false;
46
+ message: string;
47
+ };
48
+ /**
49
+ * Read the model's content at `commit`, using `commit.path` — the path the
50
+ * file had AT that commit — so reads keep working across renames, where the
51
+ * current path doesn't exist in older revisions.
52
+ */
53
+ export declare function readFileAtCommit(repoRoot: string, commit: CommitInfo, runGit?: GitRunner): FileAtCommitResult;
@@ -0,0 +1,112 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Git interaction for `em changelog`, isolated like diff-inputs.ts: listing
3
+ // the commits that touched a model file and reading a revision's content
4
+ // (`readFileAtCommit`) are the only impure operations here — everything
5
+ // formattable/parseable (markdown assembly, decisions parsing) lives in
6
+ // ../emit/changelog.ts, unit-tested without git.
7
+ import { dirname, resolve } from "node:path";
8
+ import { realGit } from "./diff-inputs.js";
9
+ // A control character, not a valid character in a commit subject — safe as a
10
+ // field separator in `git log --format`.
11
+ const FS = "\x01";
12
+ /**
13
+ * List every commit that touched `file` (rename-following via `--follow`),
14
+ * oldest -> newest, each carrying the file's path as of that commit.
15
+ *
16
+ * `--from`/`--to` bound the walk **inclusive of both boundary commits**: the
17
+ * range compiles to `<from>^..<to>` (git's standard idiom for an
18
+ * inclusive-from range), so `--from` itself is the oldest commit in the
19
+ * output and `--to` the newest. `--to` defaults to `HEAD`. `--from` on a
20
+ * root commit (no parent to exclude) falls back to an unbounded walk up to
21
+ * `<to>`, which is equivalent — there's nothing before a root commit to
22
+ * exclude anyway.
23
+ */
24
+ export function listModelCommits(file, opts = {}, runGit = realGit) {
25
+ const abs = resolve(file);
26
+ const toplevel = runGit(["-C", dirname(abs), "rev-parse", "--show-toplevel"]);
27
+ if (toplevel.status !== 0) {
28
+ return { ok: false, message: `em changelog: ${file} is not inside a git repository` };
29
+ }
30
+ const repoRoot = toplevel.stdout.trim();
31
+ const lsFiles = runGit(["-C", repoRoot, "ls-files", "--full-name", "--", abs]);
32
+ const relPath = lsFiles.stdout.trim().split("\n")[0];
33
+ if (!relPath) {
34
+ return { ok: false, message: `em changelog: ${file} is not tracked by git in ${repoRoot}` };
35
+ }
36
+ const upRev = opts.to ?? "HEAD";
37
+ if (opts.to) {
38
+ const verifyTo = runGit(["-C", repoRoot, "rev-parse", "--verify", "--end-of-options", opts.to]);
39
+ if (verifyTo.status !== 0) {
40
+ return { ok: false, message: `em changelog: unknown revision "${opts.to}" for --to` };
41
+ }
42
+ }
43
+ let range = upRev;
44
+ if (opts.from) {
45
+ const verifyFrom = runGit(["-C", repoRoot, "rev-parse", "--verify", "--end-of-options", opts.from]);
46
+ if (verifyFrom.status !== 0) {
47
+ return { ok: false, message: `em changelog: unknown revision "${opts.from}" for --from` };
48
+ }
49
+ const verifyParent = runGit(["-C", repoRoot, "rev-parse", "--verify", "--end-of-options", `${opts.from}^`]);
50
+ range = verifyParent.status === 0 ? `${opts.from}^..${upRev}` : upRev;
51
+ }
52
+ // --name-only prints, after each commit's format line, the file's path as
53
+ // of that commit (--follow makes that the historical, pre-rename path when
54
+ // applicable). core.quotepath=false keeps non-ASCII paths literal instead
55
+ // of octal-escaped, so the printed path is usable in `git show`.
56
+ const log = runGit([
57
+ "-C",
58
+ repoRoot,
59
+ "-c",
60
+ "core.quotepath=false",
61
+ "log",
62
+ "--follow",
63
+ "--name-only",
64
+ `--format=%H${FS}%h${FS}%ad${FS}%s`,
65
+ "--date=short",
66
+ range,
67
+ "--",
68
+ relPath,
69
+ ]);
70
+ if (log.status !== 0) {
71
+ return {
72
+ ok: false,
73
+ message: `em changelog: git log failed: ${(log.stderr || "").trim() || "unknown git error"}`,
74
+ };
75
+ }
76
+ // Output alternates: a format line (contains FS), a blank line, then the
77
+ // path line for that commit. A commit with no path line (e.g. a merge,
78
+ // whose file list git omits by default) falls back to the current path.
79
+ const commits = [];
80
+ for (const line of log.stdout.split("\n")) {
81
+ if (line.length === 0)
82
+ continue;
83
+ if (line.includes(FS)) {
84
+ const [hash, shortHash, date, ...subjectParts] = line.split(FS);
85
+ commits.push({ hash, shortHash, date, subject: subjectParts.join(FS), path: relPath });
86
+ }
87
+ else if (commits.length > 0) {
88
+ commits[commits.length - 1].path = line;
89
+ }
90
+ }
91
+ commits.reverse(); // git log is newest-first; changelog building wants oldest->newest
92
+ if (commits.length === 0) {
93
+ return { ok: false, message: `em changelog: no commits found for ${relPath} in the given range` };
94
+ }
95
+ return { ok: true, repoRoot, commits };
96
+ }
97
+ /**
98
+ * Read the model's content at `commit`, using `commit.path` — the path the
99
+ * file had AT that commit — so reads keep working across renames, where the
100
+ * current path doesn't exist in older revisions.
101
+ */
102
+ export function readFileAtCommit(repoRoot, commit, runGit = realGit) {
103
+ const show = runGit(["-C", repoRoot, "show", `${commit.hash}:${commit.path}`]);
104
+ if (show.status !== 0) {
105
+ return {
106
+ ok: false,
107
+ message: `cannot read ${commit.path} at ${commit.shortHash}: ${(show.stderr || "").trim() || "unknown git error"}`,
108
+ };
109
+ }
110
+ return { ok: true, content: show.stdout };
111
+ }
112
+ //# sourceMappingURL=changelog-git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changelog-git.js","sourceRoot":"","sources":["../../src/cli/changelog-git.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,4EAA4E;AAC5E,yEAAyE;AACzE,wEAAwE;AACxE,wEAAwE;AACxE,iDAAiD;AAEjD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAa,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAqBtD,6EAA6E;AAC7E,yCAAyC;AACzC,MAAM,EAAE,GAAG,MAAM,CAAC;AAElB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,OAAuC,EAAE,EACzC,SAAoB,OAAO;IAE3B,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAC9E,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,iBAAiB,IAAI,iCAAiC,EAAE,CAAC;IACxF,CAAC;IACD,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AAC;AAC5C,CAAC"}
package/dist/cli.js CHANGED
@@ -12,8 +12,11 @@ import { watchFile } from "./render/watch.js";
12
12
  import { startLiveServer } from "./render/serve.js";
13
13
  import { formatDiagnostic, hasErrors } from "./model/validate.js";
14
14
  import { buildExport } from "./emit/json.js";
15
+ import { buildDiffJson } from "./emit/diffJson.js";
15
16
  import { diffModels, formatModelDiff, hasChanges } from "./model/diff.js";
16
17
  import { planDiffArgs, resolveRevision } from "./cli/diff-inputs.js";
18
+ import { listModelCommits, readFileAtCommit } from "./cli/changelog-git.js";
19
+ import { buildChangelog, parseDecisionsLog } from "./emit/changelog.js";
17
20
  import { STARTER_EM } from "./templates.js";
18
21
  const program = new Command();
19
22
  // Single source of truth for the version (also read by src/emit/json.ts for
@@ -100,6 +103,7 @@ program
100
103
  .option("--from <rev>", "diff <old> against this git revision instead of a second file")
101
104
  .option("--to <rev>", "diff against this git revision instead of the current file (requires --from)")
102
105
  .option("--exit-code", "exit 1 if the models differ, 0 if identical (git-diff convention)")
106
+ .option("--json", "print a JSON document instead of the text report (see docs/cli.md)")
103
107
  .action((oldFile, newFile, opts) => {
104
108
  const plan = planDiffArgs(oldFile, newFile, opts);
105
109
  if ("error" in plan) {
@@ -109,14 +113,36 @@ program
109
113
  if (plan.form === "files") {
110
114
  const oldSource = readFileOrExit(plan.oldFile);
111
115
  const newSource = readFileOrExit(plan.newFile);
112
- runDiff(oldSource, plan.oldFile, newSource, plan.newFile, opts.exitCode);
116
+ runDiff(oldSource, plan.oldFile, newSource, plan.newFile, opts.exitCode, opts.json);
113
117
  return;
114
118
  }
115
119
  const oldSource = readAtRevision(plan.file, plan.from);
116
120
  const oldLabel = `${plan.file}@${plan.from}`;
117
121
  const newSource = plan.to ? readAtRevision(plan.file, plan.to) : readFileOrExit(plan.file);
118
122
  const newLabel = plan.to ? `${plan.file}@${plan.to}` : plan.file;
119
- runDiff(oldSource, oldLabel, newSource, newLabel, opts.exitCode);
123
+ runDiff(oldSource, oldLabel, newSource, newLabel, opts.exitCode, opts.json);
124
+ });
125
+ program
126
+ .command("changelog")
127
+ .description("render a model's git history as a business-readable ledger (see docs/cli.md)")
128
+ .argument("<file>", "input .em file (must be tracked in git)")
129
+ .option("--from <rev>", "start the walk at this revision (inclusive)")
130
+ .option("--to <rev>", "end the walk at this revision (inclusive; default HEAD)")
131
+ .option("-o, --out <path>", "write to a file instead of stdout")
132
+ .action((file, opts) => {
133
+ const commitsResult = listModelCommits(file, { from: opts.from, to: opts.to });
134
+ if (!commitsResult.ok) {
135
+ console.error(commitsResult.message);
136
+ process.exit(1);
137
+ }
138
+ const markdown = buildChangelogDoc(file, commitsResult.repoRoot, commitsResult.commits);
139
+ if (opts.out) {
140
+ writeFileSync(opts.out, markdown + "\n");
141
+ console.log(`wrote ${opts.out}`);
142
+ }
143
+ else {
144
+ process.stdout.write(markdown + "\n");
145
+ }
120
146
  });
121
147
  program
122
148
  .command("watch")
@@ -269,8 +295,70 @@ function readAtRevision(file, rev) {
269
295
  }
270
296
  return result.content;
271
297
  }
298
+ /**
299
+ * Build the `em changelog` markdown document for an already-resolved commit
300
+ * list (oldest -> newest). Compiles every revision once; per-revision
301
+ * warnings are deliberately never printed (historical revisions can be noisy)
302
+ * — only a compile *failure* (parse error or validation error, same
303
+ * threshold `em diff` uses) surfaces, as that entry's error note, never a
304
+ * crash. Diffs are computed against the previous *parseable* revision, so a
305
+ * single bad revision in the middle of the walk doesn't break every entry
306
+ * after it. Content is read at each commit's own path (`readFileAtCommit`),
307
+ * so the walk survives renames.
308
+ */
309
+ function buildChangelogDoc(file, repoRoot, commits) {
310
+ const models = [];
311
+ const errors = [];
312
+ for (const c of commits) {
313
+ const rev = readFileAtCommit(repoRoot, c);
314
+ if (!rev.ok) {
315
+ models.push(null);
316
+ errors.push(rev.message);
317
+ continue;
318
+ }
319
+ try {
320
+ const { model, diagnostics } = compile(rev.content);
321
+ if (hasErrors(diagnostics)) {
322
+ models.push(null);
323
+ errors.push(`validation errors at ${c.shortHash} — fix with \`em validate\` at that revision`);
324
+ }
325
+ else {
326
+ models.push(model);
327
+ errors.push(null);
328
+ }
329
+ }
330
+ catch (e) {
331
+ models.push(null);
332
+ errors.push(e instanceof ParseError ? `parse error: ${e.message}` : e instanceof Error ? e.message : String(e));
333
+ }
334
+ }
335
+ const entries = [];
336
+ let prevParseable = -1;
337
+ commits.forEach((c, i) => {
338
+ const base = { shortHash: c.shortHash, date: c.date, subject: c.subject };
339
+ if (i === 0) {
340
+ entries.push({ ...base, diff: null });
341
+ }
342
+ else if (!models[i]) {
343
+ entries.push({ ...base, diff: null, error: errors[i] });
344
+ }
345
+ else if (prevParseable === -1) {
346
+ entries.push({ ...base, diff: null, error: `no earlier parseable revision to diff against (${commits[0].shortHash}: ${errors[0]})` });
347
+ }
348
+ else {
349
+ entries.push({ ...base, diff: diffModels(models[prevParseable], models[i]) });
350
+ }
351
+ if (models[i])
352
+ prevParseable = i;
353
+ });
354
+ const intro = models[0] ? { slices: models[0].slices.length, elements: models[0].elements.length } : null;
355
+ const introError = models[0] ? undefined : (errors[0] ?? undefined);
356
+ const stateFile = join(dirname(file), ".event-modeling.md");
357
+ const decisions = existsSync(stateFile) ? parseDecisionsLog(readFileSync(stateFile, "utf8")) : [];
358
+ return buildChangelog(entries, decisions, { file, intro, introError });
359
+ }
272
360
  /** Shared body for both `em diff` forms: compile both sides, gate on errors, print, exit-code. */
273
- function runDiff(oldSource, oldLabel, newSource, newLabel, exitCode) {
361
+ function runDiff(oldSource, oldLabel, newSource, newLabel, exitCode, json) {
274
362
  const oldResult = compileSource(oldSource, oldLabel);
275
363
  const newResult = compileSource(newSource, newLabel);
276
364
  printDiagnostics(oldResult.diagnostics);
@@ -280,9 +368,19 @@ function runDiff(oldSource, oldLabel, newSource, newLabel, exitCode) {
280
368
  process.exit(1);
281
369
  }
282
370
  const diff = diffModels(oldResult.model, newResult.model);
283
- console.log(formatModelDiff(diff));
371
+ if (json) {
372
+ const oldSide = { label: oldLabel, source: oldSource, diagnostics: oldResult.diagnostics };
373
+ const newSide = { label: newLabel, source: newSource, diagnostics: newResult.diagnostics };
374
+ process.stdout.write(buildDiffJson(diff, oldSide, newSide) + "\n");
375
+ }
376
+ else {
377
+ console.log(formatModelDiff(diff));
378
+ }
379
+ // Set the code rather than process.exit(): stdout to a pipe is asynchronous
380
+ // on POSIX, so exiting here would truncate a JSON document larger than the
381
+ // pipe buffer — exactly the `--json --exit-code | ...` case in CI.
284
382
  if (exitCode && hasChanges(diff))
285
- process.exit(1);
383
+ process.exitCode = 1;
286
384
  }
287
385
  function defaultOut(file, fmt) {
288
386
  const base = basename(file, extname(file));
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,+BAA+B;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAiC,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAc,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAc,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU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ACT,CAAC;IACD,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,IAAI,WAAW,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;IAChG,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAmB;IAC3C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC/B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,CAAC,CAAC,QAAQ,KAAK,OAAO;YAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;;YAC3C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,CAAU;IAC7B,OAAO,CAAC,KAAK,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { ModelDiff } from "../model/diff.js";
2
+ /** One dated bullet parsed from a state file's `## Decisions log` section. */
3
+ export interface DecisionEntry {
4
+ /** YYYY-MM-DD, as written in the bullet. */
5
+ date: string;
6
+ /** Bullet text plus any continuation lines, joined with a space. Markdown (e.g. `**bold**`) passes through untouched. */
7
+ text: string;
8
+ }
9
+ /**
10
+ * Parse the dated bullets (`- YYYY-MM-DD: …`) out of a state file's
11
+ * `## Decisions log` section, including continuation lines (any non-bullet,
12
+ * non-heading line following a dated bullet) up to the next bullet or the
13
+ * next heading. Returns `[]` when there's no such section — callers treat a
14
+ * missing/absent state file the same way, by never calling this at all.
15
+ */
16
+ export declare function parseDecisionsLog(stateText: string): DecisionEntry[];
17
+ /** One commit's worth of changelog content, oldest -> newest (matches `listModelCommits`). */
18
+ export interface ChangelogEntry {
19
+ shortHash: string;
20
+ /** YYYY-MM-DD author date. */
21
+ date: string;
22
+ subject: string;
23
+ /**
24
+ * Structural diff against the previous *parseable* revision. `null` for
25
+ * the oldest entry (no predecessor — see `ChangelogOptions.intro`) or when
26
+ * this revision itself failed to compile (see `error`).
27
+ */
28
+ diff: ModelDiff | null;
29
+ /** Set when this revision couldn't be compiled; `diff` is null in that case. */
30
+ error?: string;
31
+ }
32
+ /** Rollup of the oldest commit's model itself — computed by compiling that revision, not diffing. */
33
+ export interface ChangelogIntro {
34
+ slices: number;
35
+ elements: number;
36
+ }
37
+ export interface ChangelogOptions {
38
+ /** The file path/label to put in the document header. */
39
+ file: string;
40
+ /** Oldest-commit rollup, or `null` when that revision failed to compile (see `introError`). */
41
+ intro: ChangelogIntro | null;
42
+ /** Set when the oldest revision couldn't be compiled; `intro` is null in that case. */
43
+ introError?: string;
44
+ }
45
+ /**
46
+ * Assemble the full `em changelog` markdown document: header, then sections
47
+ * newest-first, then a trailing "Decisions not tied to a model commit"
48
+ * section for any decision whose date matches no commit. A date's decisions
49
+ * attach once, to the newest commit of that date. `entries` must be
50
+ * oldest -> newest (matches `listModelCommits`); `entries[0]` is the model's
51
+ * introduction (no predecessor to diff against — see `opts.intro`).
52
+ *
53
+ * A section is omitted when it has no structural change AND no matching
54
+ * decision. The introduction and any error section always render — they're
55
+ * never silently dropped.
56
+ */
57
+ export declare function buildChangelog(entries: ChangelogEntry[], decisions: DecisionEntry[], opts: ChangelogOptions): string;
@@ -0,0 +1,143 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Builds the `em changelog` markdown document: a business-readable ledger of
3
+ // a model's git history, newest-first, with structural deltas (via
4
+ // ../model/diff.ts) and dated Decisions-log entries from the adjacent
5
+ // `.event-modeling.md` woven in by date. Pure — no git, no fs; the CLI
6
+ // (src/cli.ts) and src/cli/changelog-git.ts own all I/O so this module is
7
+ // unit-testable with plain data (see test/changelog.test.ts).
8
+ import { formatModelDiff, hasChanges } from "../model/diff.js";
9
+ const HEADING_RE = /^#{1,6}\s+\S/;
10
+ const DECISIONS_HEADING_RE = /^##\s+Decisions log\s*$/;
11
+ const DATED_BULLET_RE = /^-\s+(\d{4}-\d{2}-\d{2}):\s?(.*)$/;
12
+ const BULLET_RE = /^-\s+/;
13
+ /**
14
+ * Parse the dated bullets (`- YYYY-MM-DD: …`) out of a state file's
15
+ * `## Decisions log` section, including continuation lines (any non-bullet,
16
+ * non-heading line following a dated bullet) up to the next bullet or the
17
+ * next heading. Returns `[]` when there's no such section — callers treat a
18
+ * missing/absent state file the same way, by never calling this at all.
19
+ */
20
+ export function parseDecisionsLog(stateText) {
21
+ const lines = stateText.split(/\r?\n/);
22
+ const entries = [];
23
+ let inSection = false;
24
+ let current = null;
25
+ const flush = () => {
26
+ if (current) {
27
+ entries.push({ date: current.date, text: current.text.trim() });
28
+ current = null;
29
+ }
30
+ };
31
+ for (const line of lines) {
32
+ if (!inSection) {
33
+ if (DECISIONS_HEADING_RE.test(line))
34
+ inSection = true;
35
+ continue;
36
+ }
37
+ if (HEADING_RE.test(line))
38
+ break; // next section — Decisions log is over
39
+ const dated = DATED_BULLET_RE.exec(line);
40
+ if (dated) {
41
+ flush();
42
+ current = { date: dated[1], text: dated[2] };
43
+ continue;
44
+ }
45
+ if (BULLET_RE.test(line)) {
46
+ // A non-dated bullet (e.g. the template's `{{YYYY-MM-DD}}` placeholder)
47
+ // — not a decision, but it still ends any open continuation.
48
+ flush();
49
+ continue;
50
+ }
51
+ if (line.trim() === "")
52
+ continue; // blank line: neither ends nor extends a continuation
53
+ if (current)
54
+ current.text += " " + line.trim();
55
+ // else: a stray line before any bullet (e.g. the template's HTML comment) — ignore.
56
+ }
57
+ flush();
58
+ return entries;
59
+ }
60
+ function heading(entry) {
61
+ return `## ${entry.date} — ${entry.subject} (${entry.shortHash})`;
62
+ }
63
+ function decisionsBlock(decisions) {
64
+ if (decisions.length === 0)
65
+ return null;
66
+ return ["Decisions:", ...decisions.map((d) => `- ${d.text}`)].join("\n");
67
+ }
68
+ function assembleSection(parts) {
69
+ return parts.filter((p) => p !== null).join("\n\n");
70
+ }
71
+ function renderIntroSection(entry, opts, decisions) {
72
+ const body = opts.introError
73
+ ? `_could not compile this revision: ${opts.introError}_`
74
+ : opts.intro
75
+ ? `Model introduced: ${opts.intro.slices} slice${opts.intro.slices === 1 ? "" : "s"}, ${opts.intro.elements} element${opts.intro.elements === 1 ? "" : "s"}.`
76
+ : "_model introduced._";
77
+ return assembleSection([heading(entry), body, decisionsBlock(decisions)]);
78
+ }
79
+ function renderErrorSection(entry, decisions) {
80
+ return assembleSection([heading(entry), `_could not compile this revision: ${entry.error}_`, decisionsBlock(decisions)]);
81
+ }
82
+ function renderDiffSection(entry, diff, decisions) {
83
+ return assembleSection([heading(entry), formatModelDiff(diff), decisionsBlock(decisions)]);
84
+ }
85
+ function renderUnmatchedSection(decisions) {
86
+ const list = decisions.map((d) => `- ${d.date}: ${d.text}`).join("\n");
87
+ return assembleSection(["## Decisions not tied to a model commit", list]);
88
+ }
89
+ /**
90
+ * Assemble the full `em changelog` markdown document: header, then sections
91
+ * newest-first, then a trailing "Decisions not tied to a model commit"
92
+ * section for any decision whose date matches no commit. A date's decisions
93
+ * attach once, to the newest commit of that date. `entries` must be
94
+ * oldest -> newest (matches `listModelCommits`); `entries[0]` is the model's
95
+ * introduction (no predecessor to diff against — see `opts.intro`).
96
+ *
97
+ * A section is omitted when it has no structural change AND no matching
98
+ * decision. The introduction and any error section always render — they're
99
+ * never silently dropped.
100
+ */
101
+ export function buildChangelog(entries, decisions, opts) {
102
+ const decisionsByDate = new Map();
103
+ for (const d of decisions) {
104
+ const bucket = decisionsByDate.get(d.date);
105
+ if (bucket)
106
+ bucket.push(d);
107
+ else
108
+ decisionsByDate.set(d.date, [d]);
109
+ }
110
+ const entryDates = new Set(entries.map((e) => e.date));
111
+ // Each decision attaches to exactly ONE section: the newest commit of its
112
+ // date. Attaching to every same-date section duplicates the whole day's
113
+ // decisions block per commit — on a real history with many commits in a
114
+ // day, that duplication drowns the ledger. The map is consumed on first
115
+ // (i.e. newest, given the reverse walk below) use.
116
+ const takeDecisions = (date) => {
117
+ const bucket = decisionsByDate.get(date) ?? [];
118
+ decisionsByDate.delete(date);
119
+ return bucket;
120
+ };
121
+ const sections = [];
122
+ for (let i = entries.length - 1; i >= 0; i--) {
123
+ const entry = entries[i];
124
+ const matching = takeDecisions(entry.date);
125
+ if (i === 0) {
126
+ sections.push(renderIntroSection(entry, opts, matching));
127
+ continue;
128
+ }
129
+ if (entry.error) {
130
+ sections.push(renderErrorSection(entry, matching));
131
+ continue;
132
+ }
133
+ const diff = entry.diff; // non-intro, non-error entries always carry a diff
134
+ if (!hasChanges(diff) && matching.length === 0)
135
+ continue; // skip: nothing to report
136
+ sections.push(renderDiffSection(entry, diff, matching));
137
+ }
138
+ const unmatched = decisions.filter((d) => !entryDates.has(d.date));
139
+ if (unmatched.length > 0)
140
+ sections.push(renderUnmatchedSection(unmatched));
141
+ return [`# Model changelog — ${opts.file}`, ...sections].join("\n\n");
142
+ }
143
+ //# sourceMappingURL=changelog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/emit/changelog.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,6EAA6E;AAC7E,mEAAmE;AACnE,sEAAsE;AACtE,uEAAuE;AACvE,0EAA0E;AAC1E,8DAA8D;AAE9D,OAAO,EAAa,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAU1E,MAAM,UAAU,GAAG,cAAc,CAAC;AAClC,MAAM,oBAAoB,GAAG,yBAAyB,CAAC;AACvD,MAAM,eAAe,GAAG,mCAAmC,CAAC;AAC5D,M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AK,CAAC;YAAE,SAAS,CAAC,0BAA0B;QACpF,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACnE,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC;IAE3E,OAAO,CAAC,uBAAuB,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { ModelDiff } from "../model/diff.js";
2
+ import { Diagnostic } from "../model/validate.js";
3
+ export declare const DIFF_SCHEMA_VERSION = "1.0";
4
+ /** One side of the diff: what it was called, its source text, and its warnings. */
5
+ export interface DiffSide {
6
+ /** A file path, or `path@rev` for the `--from`/`--to` form. */
7
+ label: string;
8
+ /** Source text, hashed into the envelope so a consumer can pin what was diffed. */
9
+ source: string;
10
+ /** This side's validate() diagnostics — warnings only; `em diff` refuses on errors. */
11
+ diagnostics: Diagnostic[];
12
+ }
13
+ /**
14
+ * Build the `em diff --json` document for an already-computed `ModelDiff`.
15
+ * Pretty-printed (2-space), no trailing newline — the caller adds it.
16
+ */
17
+ export declare function buildDiffJson(diff: ModelDiff, oldSide: DiffSide, newSide: DiffSide): string;
@@ -0,0 +1,74 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Builds the `em diff --json` document: a versioned, deterministic envelope
3
+ // around `ModelDiff` (see ../model/diff.ts). Follows `em export`'s
4
+ // conventions (src/emit/json.ts): a schema field versioned independently of
5
+ // the npm package, explicit `null` for every optional field so consumers can
6
+ // destructure without sniffing, and byte-deterministic output.
7
+ import { createHash } from "node:crypto";
8
+ import { hasChanges } from "../model/diff.js";
9
+ import { GENERATOR_NAME, GENERATOR_VERSION } from "./json.js";
10
+ export const DIFF_SCHEMA_VERSION = "1.0";
11
+ /** `ChangeEntry` with every optional field present, explicit `null` when unused by `type`. */
12
+ function serializeEntry(e) {
13
+ return {
14
+ type: e.type,
15
+ kind: e.kind ?? null,
16
+ name: e.name ?? null,
17
+ sliceName: e.sliceName ?? null,
18
+ fromSlice: e.fromSlice ?? null,
19
+ toSlice: e.toSlice ?? null,
20
+ field: e.field ?? null,
21
+ fieldType: e.fieldType ?? null,
22
+ oldType: e.oldType ?? null,
23
+ newType: e.newType ?? null,
24
+ source: e.source ?? null,
25
+ oldNote: e.oldNote ?? null,
26
+ newNote: e.newNote ?? null,
27
+ oldText: e.oldText ?? null,
28
+ newText: e.newText ?? null,
29
+ from: e.from ?? null,
30
+ to: e.to ?? null,
31
+ };
32
+ }
33
+ /**
34
+ * `em export`'s `{ severity, message, line }` shape plus the `side` it came
35
+ * from. Flat and side-tagged rather than `{ old: [...], new: [...] }` so the
36
+ * array stays filterable and no key is a reserved word (see `oldModel`/
37
+ * `newModel` below).
38
+ */
39
+ function serializeDiagnostic(side) {
40
+ return (d) => ({
41
+ side,
42
+ severity: d.severity,
43
+ message: d.message,
44
+ line: d.line ?? null,
45
+ });
46
+ }
47
+ function serializeSide(side) {
48
+ return {
49
+ label: side.label,
50
+ sha256: createHash("sha256").update(side.source, "utf8").digest("hex"),
51
+ };
52
+ }
53
+ /**
54
+ * Build the `em diff --json` document for an already-computed `ModelDiff`.
55
+ * Pretty-printed (2-space), no trailing newline — the caller adds it.
56
+ */
57
+ export function buildDiffJson(diff, oldSide, newSide) {
58
+ const doc = {
59
+ diffSchemaVersion: DIFF_SCHEMA_VERSION,
60
+ generator: { name: GENERATOR_NAME, version: GENERATOR_VERSION },
61
+ oldModel: serializeSide(oldSide),
62
+ newModel: serializeSide(newSide),
63
+ identical: !hasChanges(diff),
64
+ counts: diff.counts,
65
+ changes: diff.changes.map(serializeEntry),
66
+ removals: diff.removals.map(serializeEntry),
67
+ diagnostics: [
68
+ ...oldSide.diagnostics.map(serializeDiagnostic("old")),
69
+ ...newSide.diagnostics.map(serializeDiagnostic("new")),
70
+ ],
71
+ };
72
+ return JSON.stringify(doc, null, 2);
73
+ }
74
+ //# sourceMappingURL=diffJson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diffJson.js","sourceRoot":"","sources":["../../src/emit/diffJson.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,4EAA4E;AAC5E,mEAAmE;AACnE,4EAA4E;AAC5E,6EAA6E;AAC7E,+DAA+D;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAsC,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAElF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAqBzC,8FAA8F;AAC9F,SAAS,cAAc,CAAC,CAAc;IACpC,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI;QACpB,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI;QACpB,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;QAC9B,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;QAC9B,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,IAAI;QAC1B,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI;QACtB,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;QAC9B,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,IAAI;QAC1B,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,IAAI;QAC1B,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,IAAI;Q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,cAAc,CAAC;QACzC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC;QAC3C,WAAW,EAAE;YACX,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACtD,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;SACvD;KACF,CAAC;IACF,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACtC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { NormalizedModel } from "../model/model.js";
2
2
  import { Diagnostic } from "../model/validate.js";
3
+ export declare const GENERATOR_NAME = "@milehimikey/em";
3
4
  export declare const GENERATOR_VERSION: string;
4
5
  export declare const SCHEMA_VERSION = "1.0";
5
6
  export interface ExportResult {
package/dist/emit/json.js CHANGED
@@ -16,7 +16,7 @@ import { dedupe, kebabSlug } from "../util/slug.js";
16
16
  // Read once from package.json (two levels up from src/emit/ and dist/emit/
17
17
  // alike) so `generator.version` can never drift from the released version.
18
18
  // tsconfig targets NodeNext without resolveJsonModule, hence fs over import.
19
- const GENERATOR_NAME = "@milehimikey/em";
19
+ export const GENERATOR_NAME = "@milehimikey/em";
20
20
  export const GENERATOR_VERSION = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "..", "package.json"), "utf8")).version;
21
21
  export const SCHEMA_VERSION = "1.0";
22
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/emit/json.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,EAAE;AACF,gFAAgF;AAChF,yEAAyE;AACzE,4EAA4E;AAC5E,iDAAiD;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAA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;SACrB,CAAC,CAAC;KACJ,CAAC;IAEF,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AACzF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milehimikey/em",
3
- "version": "1.3.0",
3
+ "version": "1.4.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": {
@@ -15,11 +15,12 @@
15
15
  ],
16
16
  "scripts": {
17
17
  "build": "tsc -p tsconfig.json",
18
+ "typecheck": "tsc -p tsconfig.test.json",
18
19
  "dev": "tsx src/cli.ts",
19
20
  "em": "tsx src/cli.ts",
20
21
  "test": "vitest run",
21
22
  "test:watch": "vitest",
22
- "prepublishOnly": "npm run build && npm test"
23
+ "prepublishOnly": "npm run build && npm run typecheck && npm test"
23
24
  },
24
25
  "engines": {
25
26
  "node": ">=18"