@milehimikey/em 1.19.7 → 1.20.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 (93) 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-conform/reference/conform.md +29 -1
  4. package/.claude/skills/event-modeling-design/SKILL.md +14 -3
  5. package/.claude/skills/event-modeling-discover/SKILL.md +1 -1
  6. package/.claude/skills/event-modeling-discover/reference/extract.md +8 -0
  7. package/.claude/skills/event-modeling-engagement/SKILL.md +1 -1
  8. package/.claude/skills/event-modeling-implement/SKILL.md +7 -2
  9. package/.claude/skills/event-modeling-implement/reference/implement.md +73 -6
  10. package/.claude/skills/event-modeling-review/SKILL.md +1 -1
  11. package/.claude/skills/event-modeling-shared/reference/em-dsl.md +22 -2
  12. package/.claude/skills/event-modeling-shared/reference/methodology.md +16 -0
  13. package/.claude/skills/event-modeling-shared/templates/slice.md +6 -1
  14. package/.claude-plugin/marketplace.json +2 -2
  15. package/dist/catalog/docBadge.d.ts +16 -0
  16. package/dist/catalog/docBadge.js +50 -0
  17. package/dist/catalog/docBadge.js.map +1 -0
  18. package/dist/catalog/docModelConsistencyValidate.js +9 -2
  19. package/dist/catalog/docModelConsistencyValidate.js.map +1 -1
  20. package/dist/catalog/invTokens.d.ts +49 -0
  21. package/dist/catalog/invTokens.js +94 -0
  22. package/dist/catalog/invTokens.js.map +1 -0
  23. package/dist/catalog/pages.js +48 -1
  24. package/dist/catalog/pages.js.map +1 -1
  25. package/dist/catalog/scenarios.d.ts +4 -0
  26. package/dist/catalog/scenarios.js +4 -1
  27. package/dist/catalog/scenarios.js.map +1 -1
  28. package/dist/catalog/sliceDoc.d.ts +46 -1
  29. package/dist/catalog/sliceDoc.js +90 -2
  30. package/dist/catalog/sliceDoc.js.map +1 -1
  31. package/dist/catalog/sliceDocRender.d.ts +3 -0
  32. package/dist/catalog/sliceDocRender.js +295 -0
  33. package/dist/catalog/sliceDocRender.js.map +1 -0
  34. package/dist/cli/coverage.d.ts +13 -23
  35. package/dist/cli/coverage.js +51 -91
  36. package/dist/cli/coverage.js.map +1 -1
  37. package/dist/cli/refsCheck.d.ts +52 -0
  38. package/dist/cli/refsCheck.js +127 -1
  39. package/dist/cli/refsCheck.js.map +1 -1
  40. package/dist/cli/sliceConform.d.ts +57 -1
  41. package/dist/cli/sliceConform.js +109 -9
  42. package/dist/cli/sliceConform.js.map +1 -1
  43. package/dist/cli/watchStoryline.d.ts +27 -0
  44. package/dist/cli/watchStoryline.js +55 -0
  45. package/dist/cli/watchStoryline.js.map +1 -0
  46. package/dist/cli.js +161 -7
  47. package/dist/cli.js.map +1 -1
  48. package/dist/emit/docJson.d.ts +99 -0
  49. package/dist/emit/docJson.js +197 -0
  50. package/dist/emit/docJson.js.map +1 -0
  51. package/dist/emit/refsJson.d.ts +5 -3
  52. package/dist/emit/refsJson.js +5 -2
  53. package/dist/emit/refsJson.js.map +1 -1
  54. package/dist/mcp/server.js +23 -3
  55. package/dist/mcp/server.js.map +1 -1
  56. package/dist/model/continuation.d.ts +9 -0
  57. package/dist/model/continuation.js +30 -0
  58. package/dist/model/continuation.js.map +1 -1
  59. package/dist/model/rules.d.ts +8 -0
  60. package/dist/model/rules.js +8 -0
  61. package/dist/model/rules.js.map +1 -1
  62. package/dist/model/shapeLint.js +48 -0
  63. package/dist/model/shapeLint.js.map +1 -1
  64. package/dist/model/validate.js +119 -0
  65. package/dist/model/validate.js.map +1 -1
  66. package/dist/parser/ast.d.ts +8 -0
  67. package/dist/parser/parser.js +51 -1
  68. package/dist/parser/parser.js.map +1 -1
  69. package/dist/render/render.js +1 -1
  70. package/dist/render/render.js.map +1 -1
  71. package/dist/render/sliceOverlay.d.ts +7 -2
  72. package/dist/render/sliceOverlay.js +28 -3
  73. package/dist/render/sliceOverlay.js.map +1 -1
  74. package/dist/render/storylinePicker.d.ts +9 -0
  75. package/dist/render/storylinePicker.js +17 -0
  76. package/dist/render/storylinePicker.js.map +1 -0
  77. package/dist/render/viewerHtml.js +1 -1
  78. package/dist/render/viewerHtml.js.map +1 -1
  79. package/package.json +1 -1
  80. package/plugin/.claude-plugin/plugin.json +2 -2
  81. package/plugin/shared/reference/em-dsl.md +22 -2
  82. package/plugin/shared/reference/methodology.md +16 -0
  83. package/plugin/shared/templates/slice.md +6 -1
  84. package/plugin/skills/conform/SKILL.md +1 -1
  85. package/plugin/skills/conform/reference/conform.md +29 -1
  86. package/plugin/skills/design/SKILL.md +14 -3
  87. package/plugin/skills/discover/SKILL.md +1 -1
  88. package/plugin/skills/discover/reference/extract.md +8 -0
  89. package/plugin/skills/engagement/SKILL.md +1 -1
  90. package/plugin/skills/event-modeling/SKILL.md +1 -1
  91. package/plugin/skills/implement/SKILL.md +7 -2
  92. package/plugin/skills/implement/reference/implement.md +73 -6
  93. package/plugin/skills/review/SKILL.md +1 -1
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: design
3
- em-version: 1.19.7
3
+ em-version: 1.20.0
4
4
  description: >-
5
5
  Use when structuring a draft event model into swimlanes and the four patterns (State Change,
6
6
  State View, Automation, Translation), evaluating a model's structural completeness, or writing
@@ -89,10 +89,14 @@ Goal: a structurally complete, **validated** model with correct patterns and swi
89
89
  shape — reshape it with the "Reshaping an existing model" checklist. Then the **intent test**
90
90
  per command (would a business person say this name at this step in the story? an endpoint-shaped
91
91
  name fails), the **question test** per view (write the question it answers; no question, no
92
- read model; a child view only when its query needs what the parent view lacks), and the
92
+ read model; a child view only when its query needs what the parent view lacks), the
93
+ **views-as-lookups check** per `from "E"` on a view (does E add, change or remove a row here? if
94
+ it only fills a column, put the column on the event that creates the row and drop E — see
95
+ `${CLAUDE_PLUGIN_ROOT}/shared/reference/methodology.md`, "Views as lookups"), and the
93
96
  **conditional-invariant signal** (invariants or fields that apply only "if `<field>` is set"
94
97
  mean two intents in one command: split it). The `timeline-entity-clustered`,
95
- `command-second-intent` and `automation-split-by-outcome` lints are the mechanical half; the
98
+ `command-second-intent`, `automation-split-by-outcome` and `view-lookup-source` lints are the
99
+ mechanical half (the last one only catches the cross-context cases — do the check by eye too); the
96
100
  1.18.0 design exit gate is `em validate --shape`. Shape the model first, scaffold docs after: a rename,
97
101
  split or merge from the reshape would orphan docs already wired with `--wire`. The `slice` phase is unchanged (timeline order).
98
102
  3. **Elaborate scenarios — first pass (step 6).** Scaffold every slice's doc now, one per
@@ -131,6 +135,13 @@ Goal: a structurally complete, **validated** model with correct patterns and swi
131
135
  that reads it; another model/system reads it → mark it `public`; only an automation reads
132
136
  it → nothing, it's internal by design. No new keyword — reachability is already what `ui` and
133
137
  `public` mean.
138
+ **Per `view`, also ask whether each of its sources earns its place (GH #398):** for every
139
+ `from "E"` on the view, does E add, change or remove a row here — or only fill a column on a
140
+ row some other event already created? The latter is the views-as-lookups smell (methodology
141
+ reference, "Views as lookups"): drop E as a source and have the event that creates the row
142
+ carry the field instead. `view-lookup-source` flags the cross-context instances of this
143
+ mechanically; a lookup from the view's own context (no `@Context` mismatch to key on) only
144
+ this by-eye check catches.
134
145
  **Per translation fed from another model, declare what it consumes (MIL-235):** write
135
146
  `translation Order Intake consumes checkout:event.order-submitted`. The ref is
136
147
  `<modelKey>:<kind>.<slug>`, where kind is `event` or `view` and the target is marked `public`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: discover
3
- em-version: 1.19.7
3
+ em-version: 1.20.0
4
4
  description: >-
5
5
  Use when starting a brand-new event model from scratch — greenfield discovery: brainstorming
6
6
  past-tense events, storyboarding the happy path, finding the commands and read models — or when
@@ -97,6 +97,14 @@ it is fine to finish a round with `# TBD`s still parked.
97
97
  read model* warnings: real systems do record fire-and-forget events. In an as-is model that is
98
98
  a **finding about the system**, not a modelling mistake — never invent a reader to silence it
99
99
  (that would be desired state). Park it in the Decisions log and carry the warning.
100
+ **Expect lookup-style sources too.** A lifted model will faithfully reproduce the projection's
101
+ lookup joins — a view wired to `from "Order Created"` only because the current query joins the
102
+ orders table to get `customerName`, not because this view owns any row that event changes. Wire
103
+ it as-is (current-state-only stance: that join is how the system behaves today); don't fix it
104
+ here, that would be inventing desired state. Note it as a finding in the Decisions log the same
105
+ way as an unread event, and leave it for `model`/`slice` to apply the views-as-lookups rule
106
+ (`../../../shared/reference/methodology.md`, "Views as lookups") once the as-is
107
+ model is agreed.
100
108
  - **R5 — Boundaries & reactions.** Current automations and integrations as-is: schedulers,
101
109
  listeners, outbound syncs, inbound webhooks. Model each as a reaction sharing its slice with
102
110
  the `command` + `event` it triggers (`reaction → command → event`, per `em-dsl.md`) — the
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: engagement
3
- em-version: 1.19.7
3
+ em-version: 1.20.0
4
4
  description: >-
5
5
  Use when leading an engagement: building a named set of ratified event-modeling slices
6
6
  (`em engagement`) into one independent PR per slice, each against main, by dispatching the
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: event-modeling
3
- em-version: 1.19.7
3
+ em-version: 1.20.0
4
4
  description: >-
5
5
  Use when the user runs `/em:event-modeling` (with or without a phase name), or wants to resume an
6
6
  event-modeling session without specifying which part of the process applies. Reads the model's
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: implement
3
- em-version: 1.19.7
3
+ em-version: 1.20.0
4
4
  description: >-
5
5
  Use when building a single ratified event-modeling slice (status: ready-to-implement) into
6
6
  merged, tested code — the one phase where the agent builds rather than facilitates. Gates on
@@ -53,7 +53,12 @@ routing table (§7) is what names the skill set for each pattern.
53
53
  Preconditions (tool check, model location) are the same as every other phase — see
54
54
  `${CLAUDE_PLUGIN_ROOT}/shared/reference/operating-principles.md` — but this phase additionally
55
55
  requires the target slice to already be ratified; if it isn't, stop and say so rather than
56
- starting on unratified work.
56
+ starting on unratified work. The one documented exception is **inline ratification** (GH #399,
57
+ `reference/implement.md` §1a): for an internal (non-public-touching, non-engagement) slice whose
58
+ doc is already `reviewed`, drafting code on the same branch ahead of the human's `em slice
59
+ ratify` is sanctioned — provided you never flip the gate yourself and re-confirm
60
+ `--slice-ready` reads `true` before treating the slice as done. `em:engagement` is
61
+ unchanged by this: it still requires every dispatched slice ratified before its branch is cut.
57
62
 
58
63
  End of phase: PR merged, slice doc flipped to `status: implemented` with `implementedIn`
59
64
  filled, `em slice index <model-name>.em` run to refresh `README.md`'s Slices table. Implement
@@ -47,15 +47,82 @@ A warning whose code is in this list blocks; any other warning never does — `c
47
47
 
48
48
  Because of that list, `ready` can be `false` with every `gates` entry `true` (a `both-ends-of-a-flow/*` warning on one of the slice's own elements, say). Don't work it out from `gates`: read **`blockedBy`** (schema `1.5`, GH #377), the codes that flipped `ready`, `[]` exactly when it is `true`, and report those codes with the `false` gates when you hand the slice back.
49
49
 
50
- **`ready: false` means stop** — with one named exception: a slice already `status: implemented`
51
- with `driftSignal: in-sync` or `uncertified` (MIL-214) also reads `ready: false` (its
52
- `statusReady` gate fails because nothing is newly ratified), and that specific case is
53
- re-implementation/repair, not a blocker — see §3's third mode before treating it as one. For
50
+ **`ready: false` means stop** — with two named exceptions. First: a slice already `status:
51
+ implemented` with `driftSignal: in-sync` or `uncertified` (MIL-214) also reads `ready: false`
52
+ (its `statusReady` gate fails because nothing is newly ratified), and that specific case is
53
+ re-implementation/repair, not a blocker — see §3's third mode before treating it as one. Second:
54
+ under **inline ratification** (§1a) a slice doc that's only `status: reviewed` — not yet
55
+ `ready-to-implement` — is a sanctioned starting point for drafting code on the SAME branch, with
56
+ the explicit, non-negotiable condition that you treat nothing as actually ratified, and open
57
+ nothing for merge, until a human has run `em slice ratify` and `--slice-ready` reads `true` for
58
+ real; §1a names exactly which slices qualify and what that condition requires in practice. For
54
59
  every other `false`, report which `gates`
55
60
  entries are `false` and what `blockedBy` names (and any `diagnostics` entries concerning this
56
61
  slice) and hand the slice back to the humans. Never make the gate pass yourself — checking an open-question box, flipping
57
- `status`, or editing frontmatter are ratification decisions, and ratification happens in a
58
- facilitated session, not in an implementation branch.
62
+ `status`, or editing frontmatter are ratification decisions, made by a human in a ratification
63
+ session, never by you running `em slice ratify` on their behalf. That session is usually a
64
+ separate doc-only PR, merged before an implementation branch is even cut — but it doesn't have
65
+ to be: **inline ratification** (GH #399, §1a below) lets the session be the PR review of the
66
+ very branch you're implementing on, for internal slices. Either shape, the rule here is the
67
+ same: you never flip the gate yourself, whatever branch you're on.
68
+
69
+ ### 1a. The inline variant: ratifying on the implementation branch
70
+
71
+ Most of this document assumes the ordinary shape — a slice is already `ready-to-implement` when
72
+ you start, ratified in its own prior PR, and §1's gate reads `true` before you write a line of
73
+ code. **Inline ratification** is the documented alternative
74
+ (`docs/process.md`'s
75
+ ["Inline ratification" section](https://github.com/milehimikey/em/blob/main/docs/process.md#inline-ratification-approval-as-the-ratification-session)):
76
+ draft the slice doc *and* build it on the same branch, spec commits first, and let the human's
77
+ review of that one PR be the ratification session — which means you are, deliberately and
78
+ sanctioned, building for most of that branch's life against a doc that reads `ready: false`.
79
+ What doesn't change: you still never flip `status` yourself, never run `em slice ratify` on the
80
+ human's behalf, and never write a word of the ratification record — see §1's second named
81
+ exception for the precise condition this depends on. What's different is sequencing and tiering:
82
+
83
+ - **Draft the doc first, then build on the same branch.** Commit the slice doc (through the
84
+ normal `slice` phase), get it reviewed (`em slice review --by`, flipping it to `status:
85
+ reviewed` — a human has to do this part too, same as always) before any implementation code,
86
+ even though doc and code will both live on one branch and merge in one PR. Writing code before
87
+ the doc exists, or before a human has looked at it, is retrofit — the exact failure mode inline
88
+ mode is named after avoiding — whether or not anyone ever checks for it.
89
+ - **You may keep building past a `reviewed`-but-not-yet-`ready-to-implement` doc, but nothing is
90
+ ratified until `em slice ratify` actually runs.** `--slice-ready` keeps reading `false` the
91
+ whole time you're building — that's expected, not a signal to stop, as long as the doc's
92
+ `status` is `reviewed` (not `draft`: an un-reviewed doc is never a valid base, inline or not).
93
+ On an inline branch the human typically runs `em slice ratify --no-ref` as part of approving
94
+ the PR (`--no-ref` because the branch is headed for a squash/rebase merge) — not something you
95
+ do for them, and not something you should expect to have happened before the PR is up for
96
+ review. Before you report the slice done, or treat §6's merge-time flip as legitimate,
97
+ re-check `--slice-ready` yourself and confirm it now reads `true` with `ratifiedBy:` set — if
98
+ it still doesn't, the slice isn't ratified yet and you say so instead of proceeding.
99
+ - **A post-signature doc edit still trips the hash check.** `ratifiedHash` doesn't know or care
100
+ which branch it was computed on — if something changes the doc's body after the human has
101
+ signed it (a gap surfaces, §4), `--slice-ready` and `em slice ratify` both refuse the stale
102
+ signature exactly as they would across two PRs. Route it through `em slice revise --withdraw`,
103
+ review, re-ratify (§4) — inline doesn't shortcut that loop, it just means the re-sign happens
104
+ on the branch you're already on instead of a fresh one.
105
+ - **Not every slice is a candidate.** A slice owning a `public` command, event or view
106
+ (`isPublicTouchingSlice`) keeps the separate doc PR — the contract is a promise to consumers
107
+ who never see your implementation diff, and `em slice ratify` already refuses a public-touching
108
+ slice without `--meaning-unchanged`/`--contract-change` regardless of which branch it runs on.
109
+ An engagement-dispatched slice is never inline either — engagements structurally need every
110
+ contract frozen before any implementer branch is cut, so the engagement skill never offers you
111
+ this shape (it is explicitly unchanged by GH #399 — this is a note for your own judgment
112
+ outside an engagement, not something to apply inside one).
113
+ - **Pre-ship advisory conform is the loop's natural checkpoint.** Before the PR merges, a human
114
+ (or you, if asked) can run `em slice conform <model>.em <key> --at <rev> --preview` — the
115
+ pre-ship, non-certifying mode (GH #400): same doc-resolution and findings-check read as a real
116
+ certification, legal before the slice has shipped, never writes `conformedVersion:`/
117
+ `conformedAt:`/`conformedOn:`. It's advisory and ephemeral by default (nothing written unless
118
+ `--write-findings` is passed) — a cheap "did I just drift from the doc I signed" look before
119
+ asking for the PR review that will also be the ratification.
120
+ - **The ordering advisory is informational, not yours to act on.** `em refs --check-order`
121
+ (GH #399) can report whether a commit on this branch touched code before the doc's
122
+ `ratifiedRef` — a retrofit smoke signal for the human reviewing the PR. It's advisory, never a
123
+ gate, and nothing in this skill asks you to run it or react to its output; if a human shows you
124
+ a `code-before-ratification` result, treat it the same as any other gap raised against your
125
+ work (§4), not as something to silence.
59
126
 
60
127
  ## 2. Read the spec
61
128
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: review
3
- em-version: 1.19.7
3
+ em-version: 1.20.0
4
4
  description: >-
5
5
  Use when starting em's live browser viewer (`em watch --serve`) so a team can watch a model
6
6
  update in real time, or facilitating a SCHEDULED stakeholder walkthrough that steps through