@milehimikey/em 1.13.1 → 1.14.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 (232) hide show
  1. package/.claude/agents/em-critic.md +26 -0
  2. package/.claude/agents/em-implementer.md +34 -0
  3. package/.claude/agents/em-reviewer.md +31 -0
  4. package/.claude/agents/em-validator.md +27 -0
  5. package/.claude/skills/event-modeling/SKILL.md +50 -11
  6. package/.claude/skills/event-modeling-conform/SKILL.md +1 -1
  7. package/.claude/skills/event-modeling-design/SKILL.md +126 -18
  8. package/.claude/skills/event-modeling-discover/SKILL.md +1 -1
  9. package/.claude/skills/event-modeling-engagement/SKILL.md +192 -0
  10. package/.claude/skills/event-modeling-engagement/reference/engagement.md +143 -0
  11. package/.claude/skills/event-modeling-implement/SKILL.md +1 -1
  12. package/.claude/skills/event-modeling-implement/reference/implement.md +38 -11
  13. package/.claude/skills/event-modeling-review/SKILL.md +1 -1
  14. package/.claude/skills/event-modeling-shared/reference/em-dsl.md +274 -189
  15. package/.claude/skills/event-modeling-shared/reference/operating-principles.md +61 -0
  16. package/.claude/skills/event-modeling-shared/reference/slice-doc-schema.md +108 -5
  17. package/.claude/skills/event-modeling-shared/templates/constitution.md +18 -1
  18. package/.claude/skills/event-modeling-shared/templates/slice.md +64 -39
  19. package/.claude/skills/event-modeling-shared/templates/state.md +5 -1
  20. package/.claude-plugin/marketplace.json +14 -0
  21. package/README.md +25 -11
  22. package/dist/catalog/apiFirst.d.ts +28 -0
  23. package/dist/catalog/apiFirst.js +49 -0
  24. package/dist/catalog/apiFirst.js.map +1 -0
  25. package/dist/catalog/docJoin.d.ts +13 -0
  26. package/dist/catalog/docJoin.js +11 -0
  27. package/dist/catalog/docJoin.js.map +1 -1
  28. package/dist/catalog/docModelConsistencyValidate.js +44 -4
  29. package/dist/catalog/docModelConsistencyValidate.js.map +1 -1
  30. package/dist/catalog/invariantsValidate.d.ts +4 -0
  31. package/dist/catalog/invariantsValidate.js +102 -0
  32. package/dist/catalog/invariantsValidate.js.map +1 -0
  33. package/dist/catalog/scenarios.d.ts +15 -0
  34. package/dist/catalog/scenarios.js +97 -0
  35. package/dist/catalog/scenarios.js.map +1 -0
  36. package/dist/catalog/sliceDoc.d.ts +8 -0
  37. package/dist/catalog/sliceDoc.js +9 -0
  38. package/dist/catalog/sliceDoc.js.map +1 -1
  39. package/dist/catalog/sliceReadyValidate.d.ts +31 -4
  40. package/dist/catalog/sliceReadyValidate.js +66 -8
  41. package/dist/catalog/sliceReadyValidate.js.map +1 -1
  42. package/dist/catalog/sliceSections.d.ts +55 -0
  43. package/dist/catalog/sliceSections.js +317 -0
  44. package/dist/catalog/sliceSections.js.map +1 -0
  45. package/dist/cli/agentsMd.js +7 -1
  46. package/dist/cli/agentsMd.js.map +1 -1
  47. package/dist/cli/api.d.ts +90 -0
  48. package/dist/cli/api.js +318 -0
  49. package/dist/cli/api.js.map +1 -0
  50. package/dist/cli/ciInit.d.ts +82 -21
  51. package/dist/cli/ciInit.js +468 -64
  52. package/dist/cli/ciInit.js.map +1 -1
  53. package/dist/cli/conformScope.d.ts +28 -0
  54. package/dist/cli/conformScope.js +67 -0
  55. package/dist/cli/conformScope.js.map +1 -1
  56. package/dist/cli/coverage.d.ts +9 -0
  57. package/dist/cli/coverage.js +60 -8
  58. package/dist/cli/coverage.js.map +1 -1
  59. package/dist/cli/engagement.d.ts +210 -0
  60. package/dist/cli/engagement.js +444 -0
  61. package/dist/cli/engagement.js.map +1 -0
  62. package/dist/cli/engagementFile.d.ts +86 -0
  63. package/dist/cli/engagementFile.js +255 -0
  64. package/dist/cli/engagementFile.js.map +1 -0
  65. package/dist/cli/metrics.d.ts +10 -0
  66. package/dist/cli/metrics.js +49 -1
  67. package/dist/cli/metrics.js.map +1 -1
  68. package/dist/cli/pluginPin.d.ts +55 -0
  69. package/dist/cli/pluginPin.js +188 -0
  70. package/dist/cli/pluginPin.js.map +1 -0
  71. package/dist/cli/ratify.d.ts +27 -2
  72. package/dist/cli/ratify.js +112 -13
  73. package/dist/cli/ratify.js.map +1 -1
  74. package/dist/cli/reratify.d.ts +3 -2
  75. package/dist/cli/reratify.js +36 -14
  76. package/dist/cli/reratify.js.map +1 -1
  77. package/dist/cli/scopeInputs.d.ts +48 -0
  78. package/dist/cli/scopeInputs.js +176 -0
  79. package/dist/cli/scopeInputs.js.map +1 -0
  80. package/dist/cli/skillCheck.d.ts +15 -1
  81. package/dist/cli/skillCheck.js +22 -1
  82. package/dist/cli/skillCheck.js.map +1 -1
  83. package/dist/cli/skillDirs.d.ts +5 -0
  84. package/dist/cli/skillDirs.js +13 -1
  85. package/dist/cli/skillDirs.js.map +1 -1
  86. package/dist/cli/skillSync.d.ts +4 -0
  87. package/dist/cli/skillSync.js +23 -0
  88. package/dist/cli/skillSync.js.map +1 -1
  89. package/dist/cli/sliceNew.d.ts +11 -7
  90. package/dist/cli/sliceNew.js +91 -18
  91. package/dist/cli/sliceNew.js.map +1 -1
  92. package/dist/cli/sliceSync.d.ts +50 -0
  93. package/dist/cli/sliceSync.js +170 -0
  94. package/dist/cli/sliceSync.js.map +1 -0
  95. package/dist/cli/status.d.ts +24 -1
  96. package/dist/cli/status.js +20 -1
  97. package/dist/cli/status.js.map +1 -1
  98. package/dist/cli/systemInputs.d.ts +53 -10
  99. package/dist/cli/systemInputs.js +186 -11
  100. package/dist/cli/systemInputs.js.map +1 -1
  101. package/dist/cli/upgrade.d.ts +16 -3
  102. package/dist/cli/upgrade.js +366 -30
  103. package/dist/cli/upgrade.js.map +1 -1
  104. package/dist/cli/usageLog.d.ts +4 -2
  105. package/dist/cli/usageLog.js +4 -2
  106. package/dist/cli/usageLog.js.map +1 -1
  107. package/dist/cli.js +554 -94
  108. package/dist/cli.js.map +1 -1
  109. package/dist/emit/api.d.ts +29 -0
  110. package/dist/emit/api.js +220 -0
  111. package/dist/emit/api.js.map +1 -0
  112. package/dist/emit/apiCheckJson.d.ts +3 -0
  113. package/dist/emit/apiCheckJson.js +21 -0
  114. package/dist/emit/apiCheckJson.js.map +1 -0
  115. package/dist/emit/codeownersJson.d.ts +3 -0
  116. package/dist/emit/codeownersJson.js +19 -0
  117. package/dist/emit/codeownersJson.js.map +1 -0
  118. package/dist/emit/diffJson.d.ts +1 -1
  119. package/dist/emit/diffJson.js +8 -1
  120. package/dist/emit/diffJson.js.map +1 -1
  121. package/dist/emit/engagementJson.d.ts +8 -0
  122. package/dist/emit/engagementJson.js +46 -0
  123. package/dist/emit/engagementJson.js.map +1 -0
  124. package/dist/emit/glossaryJson.d.ts +1 -1
  125. package/dist/emit/glossaryJson.js +4 -1
  126. package/dist/emit/glossaryJson.js.map +1 -1
  127. package/dist/emit/json.d.ts +17 -1
  128. package/dist/emit/json.js +30 -1
  129. package/dist/emit/json.js.map +1 -1
  130. package/dist/emit/metricsJson.d.ts +1 -1
  131. package/dist/emit/metricsJson.js +4 -1
  132. package/dist/emit/metricsJson.js.map +1 -1
  133. package/dist/emit/queryJson.d.ts +1 -1
  134. package/dist/emit/queryJson.js +7 -1
  135. package/dist/emit/queryJson.js.map +1 -1
  136. package/dist/emit/scopeJson.d.ts +12 -0
  137. package/dist/emit/scopeJson.js +26 -0
  138. package/dist/emit/scopeJson.js.map +1 -0
  139. package/dist/emit/skillCheckJson.d.ts +3 -2
  140. package/dist/emit/skillCheckJson.js +10 -2
  141. package/dist/emit/skillCheckJson.js.map +1 -1
  142. package/dist/emit/statusJson.d.ts +1 -1
  143. package/dist/emit/statusJson.js +15 -1
  144. package/dist/emit/statusJson.js.map +1 -1
  145. package/dist/emit/systemJson.d.ts +15 -8
  146. package/dist/emit/systemJson.js +28 -13
  147. package/dist/emit/systemJson.js.map +1 -1
  148. package/dist/emit/validateJson.d.ts +3 -3
  149. package/dist/emit/validateJson.js +10 -4
  150. package/dist/emit/validateJson.js.map +1 -1
  151. package/dist/mcp/server.d.ts +1 -1
  152. package/dist/mcp/server.js +163 -31
  153. package/dist/mcp/server.js.map +1 -1
  154. package/dist/model/diff.d.ts +4 -1
  155. package/dist/model/diff.js +44 -8
  156. package/dist/model/diff.js.map +1 -1
  157. package/dist/model/glossary.d.ts +2 -0
  158. package/dist/model/glossary.js +1 -0
  159. package/dist/model/glossary.js.map +1 -1
  160. package/dist/model/model.d.ts +55 -2
  161. package/dist/model/model.js +57 -0
  162. package/dist/model/model.js.map +1 -1
  163. package/dist/model/qualifiedRef.d.ts +18 -0
  164. package/dist/model/qualifiedRef.js +26 -0
  165. package/dist/model/qualifiedRef.js.map +1 -1
  166. package/dist/model/queryIndex.d.ts +9 -1
  167. package/dist/model/queryIndex.js +18 -2
  168. package/dist/model/queryIndex.js.map +1 -1
  169. package/dist/model/rules.d.ts +143 -2
  170. package/dist/model/rules.js +162 -3
  171. package/dist/model/rules.js.map +1 -1
  172. package/dist/model/validate.d.ts +40 -0
  173. package/dist/model/validate.js +147 -1
  174. package/dist/model/validate.js.map +1 -1
  175. package/dist/parser/ast.d.ts +31 -3
  176. package/dist/parser/parser.js +148 -14
  177. package/dist/parser/parser.js.map +1 -1
  178. package/dist/query/format.js +1 -1
  179. package/dist/query/format.js.map +1 -1
  180. package/dist/query/verbs.d.ts +6 -0
  181. package/dist/query/verbs.js +6 -2
  182. package/dist/query/verbs.js.map +1 -1
  183. package/dist/system/adaptation.d.ts +14 -0
  184. package/dist/system/adaptation.js +49 -0
  185. package/dist/system/adaptation.js.map +1 -0
  186. package/dist/system/codeowners.d.ts +77 -0
  187. package/dist/system/codeowners.js +242 -0
  188. package/dist/system/codeowners.js.map +1 -0
  189. package/dist/system/manifest.d.ts +10 -5
  190. package/dist/system/manifest.js +54 -26
  191. package/dist/system/manifest.js.map +1 -1
  192. package/dist/system/migrateManifest.d.ts +28 -0
  193. package/dist/system/migrateManifest.js +155 -0
  194. package/dist/system/migrateManifest.js.map +1 -0
  195. package/dist/system/scope.d.ts +46 -0
  196. package/dist/system/scope.js +132 -0
  197. package/dist/system/scope.js.map +1 -0
  198. package/dist/system/verify.d.ts +50 -13
  199. package/dist/system/verify.js +179 -58
  200. package/dist/system/verify.js.map +1 -1
  201. package/dist/templates.d.ts +2 -2
  202. package/dist/templates.js +23 -2
  203. package/dist/templates.js.map +1 -1
  204. package/package.json +5 -2
  205. package/plugin/.claude-plugin/plugin.json +18 -0
  206. package/plugin/agents/em-critic.md +27 -0
  207. package/plugin/agents/em-implementer.md +35 -0
  208. package/plugin/agents/em-reviewer.md +32 -0
  209. package/plugin/agents/em-validator.md +28 -0
  210. package/plugin/shared/reference/em-dsl.md +866 -0
  211. package/plugin/shared/reference/methodology.md +329 -0
  212. package/plugin/shared/reference/operating-principles.md +222 -0
  213. package/plugin/shared/reference/slice-doc-schema.md +566 -0
  214. package/plugin/shared/templates/conformance-report.md +85 -0
  215. package/plugin/shared/templates/constitution.md +136 -0
  216. package/plugin/shared/templates/model-readme.md +46 -0
  217. package/plugin/shared/templates/slice.md +251 -0
  218. package/plugin/shared/templates/state.md +77 -0
  219. package/plugin/skills/conform/SKILL.md +93 -0
  220. package/plugin/skills/conform/reference/conform.md +428 -0
  221. package/plugin/skills/design/SKILL.md +297 -0
  222. package/plugin/skills/discover/SKILL.md +90 -0
  223. package/plugin/skills/discover/reference/extract.md +147 -0
  224. package/plugin/skills/engagement/SKILL.md +193 -0
  225. package/plugin/skills/engagement/reference/engagement.md +144 -0
  226. package/plugin/skills/event-modeling/SKILL.md +132 -0
  227. package/plugin/skills/implement/SKILL.md +61 -0
  228. package/plugin/skills/implement/reference/implement.md +439 -0
  229. package/plugin/skills/review/SKILL.md +74 -0
  230. package/dist/emit/typespec.d.ts +0 -26
  231. package/dist/emit/typespec.js +0 -356
  232. package/dist/emit/typespec.js.map +0 -1
@@ -1,5 +1,10 @@
1
+ import type { NormalizedModel } from "../model/model.js";
2
+ import { GitRunner } from "./diff-inputs.js";
1
3
  import { SystemManifest } from "../system/manifest.js";
2
- import { SystemDiagnostic, SystemExportDoc, SystemModelInput } from "../system/verify.js";
4
+ import { SystemDiagnostic, SystemDiscovery, SystemExportDoc, SystemModelInput } from "../system/verify.js";
5
+ export type { SystemDiscovery };
6
+ /** The manifest file name `em system` looks for in a directory before falling back to discovery. */
7
+ export declare const SYSTEM_MANIFEST_FILE = "system.yaml";
3
8
  /** The oldest `em export` schema whose document carries what the verifier reads (`model.key`
4
9
  * from MIL-193, `model.edges` from MIL-191 — both schema 1.10). */
5
10
  export declare const MIN_EXPORT_SCHEMA: {
@@ -8,27 +13,65 @@ export declare const MIN_EXPORT_SCHEMA: {
8
13
  };
9
14
  export type LoadSystemResult = {
10
15
  ok: true;
11
- manifest: SystemManifest;
12
- manifestText: string;
16
+ /** `null` in discovery mode. */
17
+ manifest: SystemManifest | null;
18
+ /** The manifest path as given (or found in the given directory); `null` in discovery mode. */
19
+ manifestPath: string | null;
20
+ manifestText: string | null;
21
+ /** Non-null exactly when `manifest` is null. */
22
+ discovery: SystemDiscovery | null;
13
23
  models: SystemModelInput[];
24
+ /** Load-time findings that are not refusals (discovery's `duplicate-model-key` warnings);
25
+ * hand them to `verifySystem` as `preDiagnostics`. */
26
+ diagnostics: SystemDiagnostic[];
14
27
  } | {
15
28
  ok: false;
16
29
  diagnostics: SystemDiagnostic[];
17
30
  };
18
- /** Read + parse the manifest at `manifestPath` and load every model it declares. `ok: false`
19
- * means the system can't be verified at all (unreadable/invalid manifest, or a source that
20
- * can't be read, parsed, or has compile errors) — the caller refuses, the same way `em export`
21
- * refuses a model with errors, rather than verifying a partial system. */
22
- export declare function loadSystem(manifestPath: string): LoadSystemResult;
23
- type LoadedSource = {
31
+ /** `em system [<target>]`'s loader. `target` is a manifest file (loaded as before), a directory
32
+ * (its `system.yaml` if it has one, else discovery from it), or omitted (= `"."`, the working
33
+ * directory). `ok: false` means the system can't be verified at all (unreadable/invalid
34
+ * manifest, or a source that can't be read, parsed, or has compile errors) — the caller
35
+ * refuses, the same way `em export` refuses a model with errors, rather than verifying a
36
+ * partial system. */
37
+ export declare function loadSystem(target?: string, runGit?: GitRunner): LoadSystemResult;
38
+ /** The discovery file list (R4). Inside a git work tree: `git ls-files -z -- '*.em'` run at the
39
+ * repo root (tracked files only — what CI sees), skipping any listed file missing from the
40
+ * working tree. Outside git: a sorted walk of `startDir` pruning `node_modules` and `.git`.
41
+ * Either way `*-asis.em` is dropped. `root` is the repo root as reached from `startDir`
42
+ * (`startDir` itself, or e.g. `../..` joined onto it), never an absolute path the caller
43
+ * didn't give. Exported for tests. */
44
+ export declare function discoverModelFiles(startDir: string, runGit?: GitRunner): SystemDiscovery;
45
+ export type LoadedSource = {
24
46
  sourceKind: "em" | "export";
25
47
  doc: SystemExportDoc;
48
+ model?: NormalizedModel;
26
49
  } | {
27
50
  error: string;
28
51
  };
52
+ /** One source path to an export document. `.em` compiles (refusing on parse/validation
53
+ * errors, same gate as `em export`); anything else is read as an `em export --json` document
54
+ * and shape-checked for the fields the verifier needs. */
55
+ export declare function loadSource(file: string): LoadedSource;
29
56
  /** Shape-check an `em export --json` document: `schemaVersion` >= 1.10 and the `model.key`/
30
57
  * `model.slices`/`model.edges` fields present. Deliberately shallow — this is a guard against
31
58
  * handing the verifier a file that isn't an export at all (or one from an older em), not a
32
59
  * full schema validation; an export em itself wrote is trusted past this point. */
33
60
  export declare function readExportDoc(text: string, file: string): LoadedSource;
34
- export {};
61
+ /** The `producerCommit` resolver `verifySystem` takes (MIL-239): the short sha of the last
62
+ * commit touching the model's `.em` source, via `git log -n1`. `null` — never an error — for an
63
+ * export-document source, a path outside git, or a file with no history. */
64
+ export declare function gitProducerCommit(runGit?: GitRunner): (model: SystemModelInput) => string | null;
65
+ /** R11: the nearest `system.yaml` walking up from the directory of `file` (the first input of
66
+ * `em status`), stopping after the repo root (the first directory holding `.git`) or at the
67
+ * filesystem root. The path is joined from `file`'s own directory ("as given", never absolutized)
68
+ * and normalized to `/` separators. `null` when none is found. */
69
+ export declare function findSystemManifestAbove(file: string): string | null;
70
+ /** `em status`'s `system` block (R11), shared with the MCP `status` tool: auto-discover the
71
+ * manifest above `firstFile`, run the full system verification, count `consumer-not-adapted`.
72
+ * `null` when there is no manifest above, or when it cannot be loaded (an invalid manifest is
73
+ * `em system`'s to report; `warn` receives the reason for the CLI to print). */
74
+ export declare function statusSystemBlock(firstFile: string, runGit?: GitRunner, warn?: (message: string) => void): {
75
+ manifest: string;
76
+ consumerNotAdapted: number;
77
+ } | null;
@@ -10,22 +10,52 @@
10
10
  // Shared by the CLI action (src/cli.ts) and the MCP `system` tool (src/mcp/server.ts) so the two
11
11
  // surfaces load a system identically — the parity requirement. Every failure is a returned
12
12
  // diagnostic, never a throw or a process exit: the CLI prints and exits, MCP returns a tool error.
13
- import { readFileSync } from "node:fs";
14
- import { dirname, extname, isAbsolute, join } from "node:path";
13
+ //
14
+ // Discovery (MIL-235, ruling R4): with no manifest, the system is every `*.em` file in the
15
+ // repository — `git ls-files -z -- '*.em'` from the repo root (honours `.gitignore` and matches
16
+ // what the generated CI lints), or, outside git, a walk of the start directory pruning
17
+ // `node_modules`/`.git`. `*-asis.em` (em conform-scope's seeded as-is models) is always skipped.
18
+ // Model keys are `computeModelKeys`'s (first file wins the bare key, later ones get `~2` …).
19
+ import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
20
+ import { basename, dirname, extname, isAbsolute, join, normalize, relative, sep } from "node:path";
15
21
  import { compile } from "../pipeline.js";
16
22
  import { ParseError } from "../parser/parser.js";
17
23
  import { hasErrors } from "../model/validate.js";
18
24
  import { buildExportDoc } from "../emit/json.js";
19
25
  import { makeDiag } from "../model/rules.js";
26
+ import { computeModelKeys } from "../model/qualifiedRef.js";
27
+ import { walkDir } from "../util/walkDir.js";
28
+ import { realGit } from "./diff-inputs.js";
20
29
  import { parseManifest } from "../system/manifest.js";
30
+ import { verifySystem } from "../system/verify.js";
31
+ /** The manifest file name `em system` looks for in a directory before falling back to discovery. */
32
+ export const SYSTEM_MANIFEST_FILE = "system.yaml";
21
33
  /** The oldest `em export` schema whose document carries what the verifier reads (`model.key`
22
34
  * from MIL-193, `model.edges` from MIL-191 — both schema 1.10). */
23
35
  export const MIN_EXPORT_SCHEMA = { major: 1, minor: 10 };
24
- /** Read + parse the manifest at `manifestPath` and load every model it declares. `ok: false`
25
- * means the system can't be verified at all (unreadable/invalid manifest, or a source that
26
- * can't be read, parsed, or has compile errors) — the caller refuses, the same way `em export`
27
- * refuses a model with errors, rather than verifying a partial system. */
28
- export function loadSystem(manifestPath) {
36
+ /** `em system [<target>]`'s loader. `target` is a manifest file (loaded as before), a directory
37
+ * (its `system.yaml` if it has one, else discovery from it), or omitted (= `"."`, the working
38
+ * directory). `ok: false` means the system can't be verified at all (unreadable/invalid
39
+ * manifest, or a source that can't be read, parsed, or has compile errors) — the caller
40
+ * refuses, the same way `em export` refuses a model with errors, rather than verifying a
41
+ * partial system. */
42
+ export function loadSystem(target = ".", runGit = realGit) {
43
+ let isDir = false;
44
+ try {
45
+ isDir = statSync(target).isDirectory();
46
+ }
47
+ catch {
48
+ // missing path: fall through to the manifest reader, which reports "cannot read"
49
+ }
50
+ if (!isDir)
51
+ return loadManifestSystem(target);
52
+ const candidate = target === "." ? SYSTEM_MANIFEST_FILE : join(target, SYSTEM_MANIFEST_FILE);
53
+ if (existsSync(candidate))
54
+ return loadManifestSystem(candidate);
55
+ return loadDiscoveredSystem(target, runGit);
56
+ }
57
+ /** Read + parse the manifest at `manifestPath` and load every model it declares. */
58
+ function loadManifestSystem(manifestPath) {
29
59
  let manifestText;
30
60
  try {
31
61
  manifestText = readFileSync(manifestPath, "utf8");
@@ -53,16 +83,105 @@ export function loadSystem(manifestPath) {
53
83
  });
54
84
  continue;
55
85
  }
56
- models.push({ key: entry.key, source: entry.source, sourceKind: loaded.sourceKind, owner: entry.owner, file, doc: loaded.doc });
86
+ models.push({
87
+ key: entry.key,
88
+ source: entry.source,
89
+ sourceKind: loaded.sourceKind,
90
+ owner: ownerOf(loaded.doc, entry.owner),
91
+ file,
92
+ doc: loaded.doc,
93
+ });
57
94
  }
58
95
  if (diagnostics.length > 0)
59
96
  return { ok: false, diagnostics };
60
- return { ok: true, manifest: parsed.manifest, manifestText, models };
97
+ return { ok: true, manifest: parsed.manifest, manifestPath, manifestText, discovery: null, models, diagnostics: [] };
98
+ }
99
+ /** The header's owners (export schema >= 1.15); a legacy 1.0 manifest's `owner:` only fills in
100
+ * when the header names none — so a half-migrated estate still shows who owns what. */
101
+ function ownerOf(doc, manifestOwner) {
102
+ const header = Array.isArray(doc.model.owner) ? doc.model.owner : [];
103
+ if (header.length > 0)
104
+ return [...header];
105
+ return manifestOwner === null ? [] : [manifestOwner];
106
+ }
107
+ /** Discovery (R4): find every model, compile each, key them with `computeModelKeys`. */
108
+ function loadDiscoveredSystem(startDir, runGit) {
109
+ const found = discoverModelFiles(startDir, runGit);
110
+ const diagnostics = [];
111
+ const loaded = [];
112
+ for (const source of found.files) {
113
+ const file = join(found.root, source);
114
+ const result = loadSource(file);
115
+ if ("error" in result) {
116
+ diagnostics.push({ file, ...makeDiag("system-manifest-invalid", { message: `discovered model ${source}: ${result.error}` }) });
117
+ continue;
118
+ }
119
+ loaded.push({ source, file, model: result.model, doc: result.doc });
120
+ }
121
+ if (diagnostics.length > 0)
122
+ return { ok: false, diagnostics };
123
+ if (loaded.length === 0) {
124
+ return {
125
+ ok: false,
126
+ diagnostics: [
127
+ {
128
+ file: found.root,
129
+ ...makeDiag("system-manifest-invalid", {
130
+ message: `no ${SYSTEM_MANIFEST_FILE} and no .em models found under ${found.root} — pass a manifest, or run from the repository that holds the models`,
131
+ }),
132
+ },
133
+ ],
134
+ };
135
+ }
136
+ const keyed = computeModelKeys(loaded.map((l) => ({ model: l.model, file: l.source })));
137
+ const pre = keyed.diagnostics.map((d) => ({ file: found.root, ...d }));
138
+ const models = loaded.map((l, i) => ({
139
+ key: keyed.keys[i],
140
+ source: l.source,
141
+ sourceKind: "em",
142
+ owner: ownerOf(l.doc, null),
143
+ file: l.file,
144
+ doc: l.doc,
145
+ }));
146
+ return { ok: true, manifest: null, manifestPath: null, manifestText: null, discovery: found, models, diagnostics: pre };
147
+ }
148
+ /** The discovery file list (R4). Inside a git work tree: `git ls-files -z -- '*.em'` run at the
149
+ * repo root (tracked files only — what CI sees), skipping any listed file missing from the
150
+ * working tree. Outside git: a sorted walk of `startDir` pruning `node_modules` and `.git`.
151
+ * Either way `*-asis.em` is dropped. `root` is the repo root as reached from `startDir`
152
+ * (`startDir` itself, or e.g. `../..` joined onto it), never an absolute path the caller
153
+ * didn't give. Exported for tests. */
154
+ export function discoverModelFiles(startDir, runGit = realGit) {
155
+ const keep = (f) => f.endsWith(".em") && !f.endsWith("-asis.em");
156
+ const top = runGit(["-C", startDir, "rev-parse", "--show-toplevel"]);
157
+ if (top.status === 0 && top.stdout.trim() !== "") {
158
+ const topDir = top.stdout.trim();
159
+ let up = "";
160
+ try {
161
+ up = relative(realpathSync(startDir), realpathSync(topDir));
162
+ }
163
+ catch {
164
+ up = "";
165
+ }
166
+ const root = up === "" ? startDir : join(startDir, up);
167
+ const listed = runGit(["-C", topDir, "ls-files", "-z", "--", "*.em"]);
168
+ if (listed.status === 0) {
169
+ const files = listed.stdout
170
+ .split("\0")
171
+ .filter((f) => f !== "" && keep(f) && existsSync(join(topDir, f)))
172
+ .sort();
173
+ return { root, files };
174
+ }
175
+ }
176
+ const files = walkDir(startDir, { skipDir: (name) => name === "node_modules" || name === ".git" })
177
+ .filter(keep)
178
+ .map((f) => f.split(sep).join("/"));
179
+ return { root: startDir, files };
61
180
  }
62
181
  /** One source path to an export document. `.em` compiles (refusing on parse/validation
63
182
  * errors, same gate as `em export`); anything else is read as an `em export --json` document
64
183
  * and shape-checked for the fields the verifier needs. */
65
- function loadSource(file) {
184
+ export function loadSource(file) {
66
185
  let text;
67
186
  try {
68
187
  text = readFileSync(file, "utf8");
@@ -79,7 +198,7 @@ function loadSource(file) {
79
198
  // The document's own `model.key` (MIL-193, schema 1.10) is the key the manifest must match —
80
199
  // never recomputed here, so `em system` and `em export` can't disagree about it.
81
200
  const { doc } = buildExportDoc(model, refs, diagnostics, text, file);
82
- return { sourceKind: "em", doc };
201
+ return { sourceKind: "em", doc, model };
83
202
  }
84
203
  catch (e) {
85
204
  if (e instanceof ParseError)
@@ -126,4 +245,60 @@ export function readExportDoc(text, file) {
126
245
  return { error: `${file}: export document has no \`model.edges\` — regenerate it with a current \`em export --json\`` };
127
246
  return { sourceKind: "export", doc: raw };
128
247
  }
248
+ /** The `producerCommit` resolver `verifySystem` takes (MIL-239): the short sha of the last
249
+ * commit touching the model's `.em` source, via `git log -n1`. `null` — never an error — for an
250
+ * export-document source, a path outside git, or a file with no history. */
251
+ export function gitProducerCommit(runGit = realGit) {
252
+ return (model) => {
253
+ if (model.sourceKind !== "em")
254
+ return null;
255
+ const log = runGit(["-C", dirname(model.file), "log", "-n1", "--format=%H", "--", basename(model.file)]);
256
+ const sha = log.status === 0 ? log.stdout.trim() : "";
257
+ return sha === "" ? null : sha.slice(0, 12);
258
+ };
259
+ }
260
+ /** R11: the nearest `system.yaml` walking up from the directory of `file` (the first input of
261
+ * `em status`), stopping after the repo root (the first directory holding `.git`) or at the
262
+ * filesystem root. The path is joined from `file`'s own directory ("as given", never absolutized)
263
+ * and normalized to `/` separators. `null` when none is found. */
264
+ export function findSystemManifestAbove(file) {
265
+ let dir = dirname(file);
266
+ let abs = realpathOrResolve(dir);
267
+ for (;;) {
268
+ const candidate = join(dir, SYSTEM_MANIFEST_FILE);
269
+ if (existsSync(candidate))
270
+ return normalize(candidate).split(sep).join("/");
271
+ if (existsSync(join(abs, ".git")))
272
+ return null;
273
+ const parent = dirname(abs);
274
+ if (parent === abs)
275
+ return null;
276
+ abs = parent;
277
+ dir = join(dir, "..");
278
+ }
279
+ }
280
+ function realpathOrResolve(p) {
281
+ try {
282
+ return realpathSync(p);
283
+ }
284
+ catch {
285
+ return p;
286
+ }
287
+ }
288
+ /** `em status`'s `system` block (R11), shared with the MCP `status` tool: auto-discover the
289
+ * manifest above `firstFile`, run the full system verification, count `consumer-not-adapted`.
290
+ * `null` when there is no manifest above, or when it cannot be loaded (an invalid manifest is
291
+ * `em system`'s to report; `warn` receives the reason for the CLI to print). */
292
+ export function statusSystemBlock(firstFile, runGit = realGit, warn = () => { }) {
293
+ const manifest = findSystemManifestAbove(firstFile);
294
+ if (manifest === null)
295
+ return null;
296
+ const loaded = loadSystem(manifest, runGit);
297
+ if (!loaded.ok) {
298
+ warn(`system ${manifest} not checked — ${loaded.diagnostics[0]?.message ?? "cannot be loaded"}`);
299
+ return null;
300
+ }
301
+ const report = verifySystem(loaded.manifest, loaded.models, loaded.manifestPath, loaded.diagnostics, { producerCommit: gitProducerCommit(runGit) });
302
+ return { manifest, consumerNotAdapted: report.consumerAdaptation.notAdapted };
303
+ }
129
304
  //# sourceMappingURL=systemInputs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"systemInputs.js","sourceRoot":"","sources":["../../src/cli/systemInputs.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,wFAAwF;AACxF,+FAA+F;AAC/F,0FAA0F;AAC1F,+FAA+F;AAC/F,8FAA8F;AAC9F,kGAAkG;AAClG,8FAA8F;AAC9F,EAAE;AACF,iGAAiG;AACjG,2FAA2F;AAC3F,mGAAmG;AAEnG,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAkB,MAAM,uBAAuB,CAAC;AAGtE;oEACoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EA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CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAS;IAClC,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED;;;iFAGiF;AACjF,MAAM,UAAU,iBAAiB,CAC/B,SAAiB,EACjB,SAAoB,OAAO,EAC3B,OAAkC,GAAG,EAAE,GAAE,CAAC;IAE1C,MAAM,QAAQ,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IACpD,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnC,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,IAAI,CAAC,UAAU,QAAQ,kBAAkB,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,kBAAkB,EAAE,CAAC,CAAC;QACjG,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,cAAc,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpJ,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAC;AAChF,CAAC"}
@@ -8,6 +8,9 @@ export interface UpgradeContext {
8
8
  repoRoot: string;
9
9
  installedVersion: string;
10
10
  packagedSkillsRoot: string;
11
+ /** MIL-269: the packaged `.claude/agents/` root (only the fixed EM_AGENT_FILES are ever read from
12
+ * it). Defaults to the sibling of `packagedSkillsRoot` (both live under the package's `.claude/`). */
13
+ packagedAgentsRoot?: string;
11
14
  model: NormalizedModel;
12
15
  refs: RefsResult;
13
16
  }
@@ -26,7 +29,7 @@ export type StepApplyOutcome = {
26
29
  ok: false;
27
30
  message: string;
28
31
  };
29
- export type UpgradeStepId = "skill-bundle" | "reaction-shape" | "state-file" | "ci-block" | "constitution";
32
+ export type UpgradeStepId = "skill-bundle" | "skill-plugin" | "reaction-shape" | "state-file" | "ci-block" | "constitution" | "ratified-signoff" | "system-manifest";
30
33
  export interface UpgradeStepDef {
31
34
  id: UpgradeStepId;
32
35
  /** The em release that introduced the feature this step brings a repo up to date with —
@@ -41,8 +44,13 @@ export interface UpgradeStepDef {
41
44
  * `parseState`'s "missing bullet line(s): ..." reads as `is missing ...`; its format-mismatch
42
45
  * messages (`"- **X:**" doesn't match ...`) follow a colon instead. */
43
46
  export declare function describeStateFileFailure(path: string, parseMessage: string): string;
47
+ export declare const GRANDFATHERED_RATIFIER = "grandfathered (unsigned before em 1.14)";
48
+ /** Pure text transform: inserts the grandfather sign-off after the `status:` line, using only
49
+ * the key lines that are missing (a stray `ratifiedOn:` is kept as-is), in the file's own EOL.
50
+ * `null` when the doc isn't a candidate (no frontmatter/status, or `ratifiedBy` already set). */
51
+ export declare function applyGrandfatherSignoff(raw: string, ratifiedOn: string): string | null;
44
52
  export declare const UPGRADE_STEPS: readonly UpgradeStepDef[];
45
- export type HumanItemId = "no-model-version" | "continuation-has-own-doc" | "ready-to-implement-no-ratifiedby" | "coverage-scope-default" | "unratified-constitution" | "predates-1.6";
53
+ export type HumanItemId = "no-model-version" | "continuation-has-own-doc" | "ready-to-implement-no-ratifiedby" | "coverage-scope-default" | "unratified-constitution" | "predates-1.6" | "public-field-types-unresolved" | "plugin-install-locally";
46
54
  export interface HumanItem {
47
55
  id: HumanItemId;
48
56
  reason: string;
@@ -73,6 +81,11 @@ export declare function isWorkingTreeClean(repoRoot: string, runGit?: GitRunner)
73
81
  * a CI runner (unlike a developer's own machine) routinely has no git identity configured at
74
82
  * all. */
75
83
  export declare function hasGitIdentity(repoRoot: string, runGit?: GitRunner): boolean;
84
+ /** The commit trailer key every `em upgrade --apply` commit carries (MIL-235, R2):
85
+ * `Em-Upgrade: <step-id>` (or `em-version` for the final stamp commit). Readers use
86
+ * `git log --format=%(trailers:key=Em-Upgrade,valueonly)` — MIL-240's scope gate exempts files
87
+ * changed only by such commits, since a mechanical migration may legitimately span models. */
88
+ export declare const EM_UPGRADE_TRAILER = "Em-Upgrade";
76
89
  export interface StepReport {
77
90
  id: UpgradeStepId;
78
91
  sinceVersion: string;
@@ -109,7 +122,7 @@ export type ApplyUpgradeResult = {
109
122
  };
110
123
  /**
111
124
  * `--apply`: detect, then apply every applicable mechanical step in fixed order, one commit
112
- * each (`em upgrade: <step-id> (<from> → <to>)`), stopping at the first failure with every
125
+ * each (`em upgrade: <step-id> (<from> → <to>)`, trailer `Em-Upgrade: <step-id>`), stopping at the first failure with every
113
126
  * prior commit intact and the failed step's own partial writes discarded. On full success,
114
127
  * writes `Em version: <to>` as one final commit — always, even when every step above was a
115
128
  * no-op, UNLESS the bullet already reads `<to>` (idempotent second run makes zero commits).