@milehimikey/em 1.13.0 → 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.
- package/.claude/agents/em-critic.md +26 -0
- package/.claude/agents/em-implementer.md +34 -0
- package/.claude/agents/em-reviewer.md +31 -0
- package/.claude/agents/em-validator.md +27 -0
- package/.claude/skills/event-modeling/SKILL.md +52 -12
- package/.claude/skills/event-modeling-conform/SKILL.md +1 -1
- package/.claude/skills/event-modeling-conform/reference/conform.md +1 -1
- package/.claude/skills/event-modeling-design/SKILL.md +140 -18
- package/.claude/skills/event-modeling-discover/SKILL.md +1 -1
- package/.claude/skills/event-modeling-engagement/SKILL.md +192 -0
- package/.claude/skills/event-modeling-engagement/reference/engagement.md +143 -0
- package/.claude/skills/event-modeling-implement/SKILL.md +7 -4
- package/.claude/skills/event-modeling-implement/reference/implement.md +51 -12
- package/.claude/skills/event-modeling-review/SKILL.md +1 -1
- package/.claude/skills/event-modeling-shared/reference/em-dsl.md +274 -188
- package/.claude/skills/event-modeling-shared/reference/operating-principles.md +61 -0
- package/.claude/skills/event-modeling-shared/reference/slice-doc-schema.md +116 -4
- package/.claude/skills/event-modeling-shared/templates/constitution.md +18 -1
- package/.claude/skills/event-modeling-shared/templates/slice.md +64 -39
- package/.claude/skills/event-modeling-shared/templates/state.md +5 -1
- package/.claude-plugin/marketplace.json +14 -0
- package/README.md +25 -11
- package/dist/catalog/apiFirst.d.ts +28 -0
- package/dist/catalog/apiFirst.js +49 -0
- package/dist/catalog/apiFirst.js.map +1 -0
- package/dist/catalog/docJoin.d.ts +13 -0
- package/dist/catalog/docJoin.js +11 -0
- package/dist/catalog/docJoin.js.map +1 -1
- package/dist/catalog/docModelConsistencyValidate.js +44 -4
- package/dist/catalog/docModelConsistencyValidate.js.map +1 -1
- package/dist/catalog/invariantsValidate.d.ts +4 -0
- package/dist/catalog/invariantsValidate.js +102 -0
- package/dist/catalog/invariantsValidate.js.map +1 -0
- package/dist/catalog/scenarios.d.ts +15 -0
- package/dist/catalog/scenarios.js +97 -0
- package/dist/catalog/scenarios.js.map +1 -0
- package/dist/catalog/sliceDoc.d.ts +8 -0
- package/dist/catalog/sliceDoc.js +9 -0
- package/dist/catalog/sliceDoc.js.map +1 -1
- package/dist/catalog/sliceReadyValidate.d.ts +31 -4
- package/dist/catalog/sliceReadyValidate.js +66 -8
- package/dist/catalog/sliceReadyValidate.js.map +1 -1
- package/dist/catalog/sliceSections.d.ts +55 -0
- package/dist/catalog/sliceSections.js +317 -0
- package/dist/catalog/sliceSections.js.map +1 -0
- package/dist/cli/agentsMd.js +7 -1
- package/dist/cli/agentsMd.js.map +1 -1
- package/dist/cli/api.d.ts +90 -0
- package/dist/cli/api.js +318 -0
- package/dist/cli/api.js.map +1 -0
- package/dist/cli/ciInit.d.ts +88 -3
- package/dist/cli/ciInit.js +507 -50
- package/dist/cli/ciInit.js.map +1 -1
- package/dist/cli/conformScope.d.ts +28 -0
- package/dist/cli/conformScope.js +67 -0
- package/dist/cli/conformScope.js.map +1 -1
- package/dist/cli/coverage.d.ts +25 -2
- package/dist/cli/coverage.js +86 -12
- package/dist/cli/coverage.js.map +1 -1
- package/dist/cli/engagement.d.ts +210 -0
- package/dist/cli/engagement.js +444 -0
- package/dist/cli/engagement.js.map +1 -0
- package/dist/cli/engagementFile.d.ts +86 -0
- package/dist/cli/engagementFile.js +255 -0
- package/dist/cli/engagementFile.js.map +1 -0
- package/dist/cli/metrics.d.ts +10 -0
- package/dist/cli/metrics.js +49 -1
- package/dist/cli/metrics.js.map +1 -1
- package/dist/cli/pluginPin.d.ts +55 -0
- package/dist/cli/pluginPin.js +188 -0
- package/dist/cli/pluginPin.js.map +1 -0
- package/dist/cli/ratify.d.ts +27 -2
- package/dist/cli/ratify.js +112 -13
- package/dist/cli/ratify.js.map +1 -1
- package/dist/cli/reratify.d.ts +11 -4
- package/dist/cli/reratify.js +89 -35
- package/dist/cli/reratify.js.map +1 -1
- package/dist/cli/scopeInputs.d.ts +48 -0
- package/dist/cli/scopeInputs.js +176 -0
- package/dist/cli/scopeInputs.js.map +1 -0
- package/dist/cli/skillCheck.d.ts +15 -1
- package/dist/cli/skillCheck.js +22 -1
- package/dist/cli/skillCheck.js.map +1 -1
- package/dist/cli/skillDirs.d.ts +5 -0
- package/dist/cli/skillDirs.js +13 -1
- package/dist/cli/skillDirs.js.map +1 -1
- package/dist/cli/skillSync.d.ts +4 -0
- package/dist/cli/skillSync.js +23 -0
- package/dist/cli/skillSync.js.map +1 -1
- package/dist/cli/sliceNew.d.ts +11 -7
- package/dist/cli/sliceNew.js +91 -18
- package/dist/cli/sliceNew.js.map +1 -1
- package/dist/cli/sliceSync.d.ts +50 -0
- package/dist/cli/sliceSync.js +170 -0
- package/dist/cli/sliceSync.js.map +1 -0
- package/dist/cli/status.d.ts +24 -1
- package/dist/cli/status.js +20 -1
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/systemInputs.d.ts +53 -10
- package/dist/cli/systemInputs.js +186 -11
- package/dist/cli/systemInputs.js.map +1 -1
- package/dist/cli/upgrade.d.ts +30 -7
- package/dist/cli/upgrade.js +434 -50
- package/dist/cli/upgrade.js.map +1 -1
- package/dist/cli/usageLog.d.ts +4 -2
- package/dist/cli/usageLog.js +4 -2
- package/dist/cli/usageLog.js.map +1 -1
- package/dist/cli.js +631 -100
- package/dist/cli.js.map +1 -1
- package/dist/emit/api.d.ts +29 -0
- package/dist/emit/api.js +220 -0
- package/dist/emit/api.js.map +1 -0
- package/dist/emit/apiCheckJson.d.ts +3 -0
- package/dist/emit/apiCheckJson.js +21 -0
- package/dist/emit/apiCheckJson.js.map +1 -0
- package/dist/emit/codeownersJson.d.ts +3 -0
- package/dist/emit/codeownersJson.js +19 -0
- package/dist/emit/codeownersJson.js.map +1 -0
- package/dist/emit/coverageJson.d.ts +5 -2
- package/dist/emit/coverageJson.js +6 -2
- package/dist/emit/coverageJson.js.map +1 -1
- package/dist/emit/diffJson.d.ts +1 -1
- package/dist/emit/diffJson.js +8 -1
- package/dist/emit/diffJson.js.map +1 -1
- package/dist/emit/engagementJson.d.ts +8 -0
- package/dist/emit/engagementJson.js +46 -0
- package/dist/emit/engagementJson.js.map +1 -0
- package/dist/emit/glossaryJson.d.ts +1 -1
- package/dist/emit/glossaryJson.js +4 -1
- package/dist/emit/glossaryJson.js.map +1 -1
- package/dist/emit/json.d.ts +17 -1
- package/dist/emit/json.js +30 -1
- package/dist/emit/json.js.map +1 -1
- package/dist/emit/metricsJson.d.ts +1 -1
- package/dist/emit/metricsJson.js +4 -1
- package/dist/emit/metricsJson.js.map +1 -1
- package/dist/emit/queryJson.d.ts +1 -1
- package/dist/emit/queryJson.js +7 -1
- package/dist/emit/queryJson.js.map +1 -1
- package/dist/emit/scopeJson.d.ts +12 -0
- package/dist/emit/scopeJson.js +26 -0
- package/dist/emit/scopeJson.js.map +1 -0
- package/dist/emit/skillCheckJson.d.ts +3 -2
- package/dist/emit/skillCheckJson.js +10 -2
- package/dist/emit/skillCheckJson.js.map +1 -1
- package/dist/emit/statusJson.d.ts +1 -1
- package/dist/emit/statusJson.js +15 -1
- package/dist/emit/statusJson.js.map +1 -1
- package/dist/emit/systemJson.d.ts +15 -8
- package/dist/emit/systemJson.js +28 -13
- package/dist/emit/systemJson.js.map +1 -1
- package/dist/emit/upgradeJson.d.ts +1 -1
- package/dist/emit/upgradeJson.js +4 -1
- package/dist/emit/upgradeJson.js.map +1 -1
- package/dist/emit/validateJson.d.ts +3 -3
- package/dist/emit/validateJson.js +10 -4
- package/dist/emit/validateJson.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +186 -37
- package/dist/mcp/server.js.map +1 -1
- package/dist/model/diff.d.ts +4 -1
- package/dist/model/diff.js +44 -8
- package/dist/model/diff.js.map +1 -1
- package/dist/model/glossary.d.ts +2 -0
- package/dist/model/glossary.js +1 -0
- package/dist/model/glossary.js.map +1 -1
- package/dist/model/model.d.ts +55 -2
- package/dist/model/model.js +57 -0
- package/dist/model/model.js.map +1 -1
- package/dist/model/qualifiedRef.d.ts +18 -0
- package/dist/model/qualifiedRef.js +26 -0
- package/dist/model/qualifiedRef.js.map +1 -1
- package/dist/model/queryIndex.d.ts +9 -1
- package/dist/model/queryIndex.js +18 -2
- package/dist/model/queryIndex.js.map +1 -1
- package/dist/model/rules.d.ts +143 -2
- package/dist/model/rules.js +162 -3
- package/dist/model/rules.js.map +1 -1
- package/dist/model/validate.d.ts +40 -0
- package/dist/model/validate.js +147 -1
- package/dist/model/validate.js.map +1 -1
- package/dist/parser/ast.d.ts +31 -3
- package/dist/parser/parser.js +148 -14
- package/dist/parser/parser.js.map +1 -1
- package/dist/query/format.js +1 -1
- package/dist/query/format.js.map +1 -1
- package/dist/query/verbs.d.ts +6 -0
- package/dist/query/verbs.js +6 -2
- package/dist/query/verbs.js.map +1 -1
- package/dist/system/adaptation.d.ts +14 -0
- package/dist/system/adaptation.js +49 -0
- package/dist/system/adaptation.js.map +1 -0
- package/dist/system/codeowners.d.ts +77 -0
- package/dist/system/codeowners.js +242 -0
- package/dist/system/codeowners.js.map +1 -0
- package/dist/system/manifest.d.ts +10 -5
- package/dist/system/manifest.js +54 -26
- package/dist/system/manifest.js.map +1 -1
- package/dist/system/migrateManifest.d.ts +28 -0
- package/dist/system/migrateManifest.js +155 -0
- package/dist/system/migrateManifest.js.map +1 -0
- package/dist/system/scope.d.ts +46 -0
- package/dist/system/scope.js +132 -0
- package/dist/system/scope.js.map +1 -0
- package/dist/system/verify.d.ts +50 -13
- package/dist/system/verify.js +179 -58
- package/dist/system/verify.js.map +1 -1
- package/dist/templates.d.ts +2 -2
- package/dist/templates.js +23 -2
- package/dist/templates.js.map +1 -1
- package/package.json +6 -3
- package/plugin/.claude-plugin/plugin.json +18 -0
- package/plugin/agents/em-critic.md +27 -0
- package/plugin/agents/em-implementer.md +35 -0
- package/plugin/agents/em-reviewer.md +32 -0
- package/plugin/agents/em-validator.md +28 -0
- package/plugin/shared/reference/em-dsl.md +866 -0
- package/plugin/shared/reference/methodology.md +329 -0
- package/plugin/shared/reference/operating-principles.md +222 -0
- package/plugin/shared/reference/slice-doc-schema.md +566 -0
- package/plugin/shared/templates/conformance-report.md +85 -0
- package/plugin/shared/templates/constitution.md +136 -0
- package/plugin/shared/templates/model-readme.md +46 -0
- package/plugin/shared/templates/slice.md +251 -0
- package/plugin/shared/templates/state.md +77 -0
- package/plugin/skills/conform/SKILL.md +93 -0
- package/plugin/skills/conform/reference/conform.md +428 -0
- package/plugin/skills/design/SKILL.md +297 -0
- package/plugin/skills/discover/SKILL.md +90 -0
- package/plugin/skills/discover/reference/extract.md +147 -0
- package/plugin/skills/engagement/SKILL.md +193 -0
- package/plugin/skills/engagement/reference/engagement.md +144 -0
- package/plugin/skills/event-modeling/SKILL.md +132 -0
- package/plugin/skills/implement/SKILL.md +61 -0
- package/plugin/skills/implement/reference/implement.md +439 -0
- package/plugin/skills/review/SKILL.md +74 -0
- package/dist/emit/typespec.d.ts +0 -26
- package/dist/emit/typespec.js +0 -356
- package/dist/emit/typespec.js.map +0 -1
package/dist/cli/reratify.js
CHANGED
|
@@ -10,15 +10,25 @@
|
|
|
10
10
|
// version: <current + 1>
|
|
11
11
|
// status: ready-to-implement
|
|
12
12
|
//
|
|
13
|
-
//
|
|
13
|
+
// MIL-258: that is the SHIPPED path. A second path covers a doc at `status: ready-to-implement`
|
|
14
|
+
// that still carries `ratifiedBy:` — a ratified version that has not shipped (the most common
|
|
15
|
+
// change during delivery: an implementer hits a gap, a human answers it, the doc changes before
|
|
16
|
+
// the build resumes). It bumps `version:` and clears the same four sign-off fields but leaves
|
|
17
|
+
// `status:` (and any `implementedIn:`) alone, since there is nothing to flip back. A
|
|
18
|
+
// `ready-to-implement` doc with NO `ratifiedBy:` still refuses: that is the exact state a
|
|
19
|
+
// reratify leaves a doc in, so refusing keeps the double-bump guard — the doc is awaiting
|
|
20
|
+
// `em slice ratify --by`, not another bump. `draft`/`reviewed` docs are not ratified and refuse
|
|
21
|
+
// too; they can simply be edited.
|
|
22
|
+
//
|
|
23
|
+
// Shipped path precondition (original, MIL-161) — a doc currently `status: implemented`, the precondition
|
|
14
24
|
// docs/slice-doc-schema.md#status-under-re-ratification describes ("a new version is ratified
|
|
15
25
|
// for a slice whose previous version already shipped"). Refuses (never guesses) otherwise: a
|
|
16
26
|
// `draft`/`reviewed` doc hasn't shipped yet, so there's no prior version to bump FROM, and a
|
|
17
|
-
// doc already `ready-to-implement` means either first-time authoring (never
|
|
18
|
-
// reratify at all — `em slice new` is what scaffolds those) or a reratify
|
|
19
|
-
// second bump would silently double-increment `version`, which this command
|
|
20
|
-
// does — bumping isn't naturally idempotent the way ratify/mark-implemented's
|
|
21
|
-
// writes are).
|
|
27
|
+
// doc already `ready-to-implement` WITHOUT `ratifiedBy:` means either first-time authoring (never
|
|
28
|
+
// touch this doc with reratify at all — `em slice new` is what scaffolds those) or a reratify
|
|
29
|
+
// that already ran (a second bump would silently double-increment `version`, which this command
|
|
30
|
+
// deliberately never does — bumping isn't naturally idempotent the way ratify/mark-implemented's
|
|
31
|
+
// absolute-value writes are).
|
|
22
32
|
//
|
|
23
33
|
// Also clears `ratifiedBy:`/`ratifiedOn:` if either is present: those fields record who signed
|
|
24
34
|
// off the PRIOR version (`em slice ratify`, MIL-165) and describing the brand-new, not-yet-
|
|
@@ -45,13 +55,21 @@
|
|
|
45
55
|
// never-refuses stance. Bumping a version whose CURRENT one was never certified (or still has
|
|
46
56
|
// unruled conformance findings) isn't wrong — the team may have good reason to move on before a
|
|
47
57
|
// conform sweep ever ran — so this is advisory only, printed by the CLI layer, never gating the
|
|
48
|
-
// bump itself.
|
|
58
|
+
// bump itself. MIL-258: the advisory is about superseding a SHIPPED version, so the unshipped
|
|
59
|
+
// path skips it entirely (`advisory: null`) — an unshipped version has no certification to lack.
|
|
60
|
+
//
|
|
61
|
+
// MIL-238: `meaningConfirmed:`/`contractChange:` describe the PRIOR version too, so they are
|
|
62
|
+
// cleared in the same sweep as the sign-off keys. On a public-touching slice the bump itself
|
|
63
|
+
// requires a fresh confirmation (`--meaning-unchanged` or `--contract-change "<why>"`), written
|
|
64
|
+
// directly after the new `version:` line; on any other slice either flag is accepted and recorded.
|
|
49
65
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
50
66
|
import { join } from "node:path";
|
|
51
67
|
import { continuationOf } from "../model/continuation.js";
|
|
52
68
|
import { resolveSliceDocJoin } from "../catalog/docJoin.js";
|
|
53
69
|
import { fieldLineRegex, fieldLineWithEolRegex, locateFrontmatterInner, normalizeFieldValue } from "./frontmatterSurgery.js";
|
|
54
70
|
import { listAllFindingsFiles, unruledFindingsInScope } from "./findings.js";
|
|
71
|
+
import { MEANING_CONFIRMATION_KEYS, meaningConfirmationLine, meaningConfirmationRequiredMessage, } from "./ratify.js";
|
|
72
|
+
import { isPublicTouchingSlice } from "../catalog/apiFirst.js";
|
|
55
73
|
/** The status a doc must already be in for `reratify` to apply — mirrors `RATIFIED_STATUS` in
|
|
56
74
|
* ratify.ts (the status this command flips TO), named separately since it's the precondition
|
|
57
75
|
* here, not the target. */
|
|
@@ -60,11 +78,12 @@ const TARGET_STATUS = "ready-to-implement";
|
|
|
60
78
|
/**
|
|
61
79
|
* Pure text transform: bumps `version:` by 1 and flips `status:` to `ready-to-implement` in
|
|
62
80
|
* `raw`'s frontmatter block, clearing any `ratifiedBy:`/`ratifiedOn:` lines found (see module
|
|
63
|
-
* header). Refuses (`ok: false`) unless the doc's CURRENT `status:` is
|
|
81
|
+
* header). Refuses (`ok: false`) unless the doc's CURRENT `status:` is `implemented`, or
|
|
82
|
+
* `ready-to-implement` with `ratifiedBy:` set (MIL-258, `kind: "unshipped"`, status left alone) —
|
|
64
83
|
* see module header for why this precondition (not idempotent-no-op) is the right refusal
|
|
65
84
|
* shape here. No fs access — the caller reads/writes; see `runReratify` below.
|
|
66
85
|
*/
|
|
67
|
-
export function applyReratifyFrontmatter(raw) {
|
|
86
|
+
export function applyReratifyFrontmatter(raw, confirmation = null) {
|
|
68
87
|
const range = locateFrontmatterInner(raw);
|
|
69
88
|
if (!range)
|
|
70
89
|
return { ok: false, message: "no frontmatter block found" };
|
|
@@ -73,14 +92,30 @@ export function applyReratifyFrontmatter(raw) {
|
|
|
73
92
|
if (!statusMatch)
|
|
74
93
|
return { ok: false, message: "no `status:` field found in frontmatter" };
|
|
75
94
|
const currentStatus = normalizeFieldValue(statusMatch[2])?.toLowerCase() ?? null;
|
|
95
|
+
let kind = "shipped";
|
|
76
96
|
if (currentStatus !== IMPLEMENTED_STATUS) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
97
|
+
const ratifiedByMatch = fieldLineRegex("ratifiedBy").exec(inner);
|
|
98
|
+
const hasRatifiedBy = ratifiedByMatch !== null && normalizeFieldValue(ratifiedByMatch[2]) !== null;
|
|
99
|
+
if (currentStatus === TARGET_STATUS && hasRatifiedBy) {
|
|
100
|
+
kind = "unshipped";
|
|
101
|
+
}
|
|
102
|
+
else if (currentStatus === TARGET_STATUS) {
|
|
103
|
+
return {
|
|
104
|
+
ok: false,
|
|
105
|
+
message: "doc is `status: ready-to-implement` with no `ratifiedBy:` — it is awaiting ratification " +
|
|
106
|
+
"(a reratify already ran, or it was never signed off), so another version bump would " +
|
|
107
|
+
"double-increment `version:`; record the sign-off with `em slice ratify --by <name>`",
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
return {
|
|
112
|
+
ok: false,
|
|
113
|
+
message: `doc is \`status: ${currentStatus ?? "(empty)"}\` — reratify only applies to a slice doc that has ` +
|
|
114
|
+
"shipped (`status: implemented`) or to a ratified `ready-to-implement` doc that has not (see " +
|
|
115
|
+
"docs/slice-doc-schema.md#status-under-re-ratification); a `draft`/`reviewed` doc is not ratified " +
|
|
116
|
+
"and can simply be edited, and first-time authoring uses `em slice new`",
|
|
117
|
+
};
|
|
118
|
+
}
|
|
84
119
|
}
|
|
85
120
|
const versionMatch = fieldLineRegex("version").exec(inner);
|
|
86
121
|
if (!versionMatch)
|
|
@@ -94,26 +129,39 @@ export function applyReratifyFrontmatter(raw) {
|
|
|
94
129
|
};
|
|
95
130
|
}
|
|
96
131
|
const newVersion = currentVersion + 1;
|
|
132
|
+
// Clear stale ratifiedBy:/ratifiedOn:/reviewedBy:/reviewedOn: — see module header — and
|
|
133
|
+
// (MIL-238) the prior version's meaningConfirmed:/contractChange:. Done FIRST, on the original
|
|
134
|
+
// text, so the fresh confirmation line spliced in after `version:` below is never swept away.
|
|
135
|
+
// These keys are disjoint from `status:`/`version:` by construction (fieldLineRegex matches one
|
|
136
|
+
// key at a time), so the two lines are re-located on the cleared text unchanged.
|
|
137
|
+
let cleared = inner;
|
|
138
|
+
for (const key of ["ratifiedBy", "ratifiedOn", "reviewedBy", "reviewedOn", ...MEANING_CONFIRMATION_KEYS]) {
|
|
139
|
+
cleared = cleared.replace(fieldLineWithEolRegex(key), "");
|
|
140
|
+
}
|
|
141
|
+
const clearedStatus = fieldLineRegex("status").exec(cleared);
|
|
142
|
+
const clearedVersion = fieldLineRegex("version").exec(cleared);
|
|
143
|
+
const afterVersion = cleared.slice(clearedVersion.index + clearedVersion[0].length);
|
|
144
|
+
const eol = afterVersion.startsWith("\r\n") ? "\r\n" : "\n";
|
|
145
|
+
const versionNext = `${clearedVersion[1]}${newVersion}`;
|
|
97
146
|
// Apply from the highest index first so an earlier edit's index stays valid — same convention
|
|
98
147
|
// markImplemented.ts/ratify.ts use.
|
|
99
148
|
const edits = [
|
|
100
|
-
|
|
101
|
-
|
|
149
|
+
// MIL-258: the unshipped path is already at the target status — nothing to flip.
|
|
150
|
+
...(kind === "shipped"
|
|
151
|
+
? [{ index: clearedStatus.index, oldLen: clearedStatus[0].length, next: `${clearedStatus[1]}${TARGET_STATUS}` }]
|
|
152
|
+
: []),
|
|
153
|
+
{
|
|
154
|
+
index: clearedVersion.index,
|
|
155
|
+
oldLen: clearedVersion[0].length,
|
|
156
|
+
next: confirmation ? `${versionNext}${eol}${meaningConfirmationLine(confirmation)}` : versionNext,
|
|
157
|
+
},
|
|
102
158
|
].sort((a, b) => b.index - a.index);
|
|
103
|
-
let updatedInner =
|
|
159
|
+
let updatedInner = cleared;
|
|
104
160
|
for (const edit of edits) {
|
|
105
161
|
updatedInner = updatedInner.slice(0, edit.index) + edit.next + updatedInner.slice(edit.index + edit.oldLen);
|
|
106
162
|
}
|
|
107
|
-
// Clear stale ratifiedBy:/ratifiedOn:/reviewedBy:/reviewedOn: — see module header. A plain
|
|
108
|
-
// `.replace()` (not index-spliced alongside the edits above) is safe here: these four keys are
|
|
109
|
-
// disjoint from `status:`/`version:` and from each other by construction (fieldLineRegex matches
|
|
110
|
-
// one key at a time), so removing them from the ALREADY-updated text can't disturb the edits
|
|
111
|
-
// just applied.
|
|
112
|
-
for (const key of ["ratifiedBy", "ratifiedOn", "reviewedBy", "reviewedOn"]) {
|
|
113
|
-
updatedInner = updatedInner.replace(fieldLineWithEolRegex(key), "");
|
|
114
|
-
}
|
|
115
163
|
const content = raw.slice(0, range.innerStart) + updatedInner + raw.slice(range.innerEnd);
|
|
116
|
-
return { ok: true, content, newVersion };
|
|
164
|
+
return { ok: true, content, newVersion, kind };
|
|
117
165
|
}
|
|
118
166
|
/** Pure: the two facts `runReratify`'s advisory reports, from the doc's own pre-bump
|
|
119
167
|
* `version`/`conformedVersion` plus a scan of every findings file beside the model — see
|
|
@@ -133,7 +181,7 @@ export function reratifyAdvisory(baseDir, sliceKey, currentVersion, conformedVer
|
|
|
133
181
|
* writes it. `baseDir` is the `.em` file's directory, same convention every doc/note path in
|
|
134
182
|
* `em` uses.
|
|
135
183
|
*/
|
|
136
|
-
export function runReratify(model, refs, baseDir, sliceKey) {
|
|
184
|
+
export function runReratify(model, refs, baseDir, sliceKey, confirmation = null) {
|
|
137
185
|
const sliceIndex = refs.sliceKeys.indexOf(sliceKey);
|
|
138
186
|
if (sliceIndex === -1) {
|
|
139
187
|
return { ok: false, message: `no slice with export key "${sliceKey}" in this model` };
|
|
@@ -165,17 +213,23 @@ export function runReratify(model, refs, baseDir, sliceKey) {
|
|
|
165
213
|
message: `slice doc "${doc.path}" has missing or invalid frontmatter — run \`em validate\` for details`,
|
|
166
214
|
};
|
|
167
215
|
}
|
|
168
|
-
// MIL-214: computed from the doc's PRE-BUMP version/certification — the question is "was the
|
|
169
|
-
// version we're about to supersede ever fully certified," which is only answerable before the
|
|
170
|
-
// write below changes `version`.
|
|
171
|
-
const advisory = reratifyAdvisory(baseDir, sliceKey, doc.version, doc.conformedVersion);
|
|
172
216
|
const absPath = join(baseDir, doc.path);
|
|
173
217
|
const raw = readFileSync(absPath, "utf8");
|
|
174
|
-
const result = applyReratifyFrontmatter(raw);
|
|
218
|
+
const result = applyReratifyFrontmatter(raw, confirmation);
|
|
175
219
|
if (!result.ok) {
|
|
176
220
|
return { ok: false, message: `${doc.path}: ${result.message}` };
|
|
177
221
|
}
|
|
222
|
+
// MIL-238: the API-first gate — after the doc's own preconditions, before any write: a
|
|
223
|
+
// public-touching slice's new version needs a meaning confirmation.
|
|
224
|
+
if (confirmation === null && isPublicTouchingSlice(model, refs, sliceKey)) {
|
|
225
|
+
return { ok: false, message: meaningConfirmationRequiredMessage(sliceKey) };
|
|
226
|
+
}
|
|
227
|
+
// MIL-214: computed from the doc's PRE-BUMP version/certification (`doc` was resolved before
|
|
228
|
+
// the write below changes `version`) — "was the version we're about to supersede ever fully
|
|
229
|
+
// certified". MIL-258: only meaningful for a SHIPPED version; an unshipped one has no
|
|
230
|
+
// certification to lack, so that path carries no advisory at all.
|
|
231
|
+
const advisory = result.kind === "shipped" ? reratifyAdvisory(baseDir, sliceKey, doc.version, doc.conformedVersion) : null;
|
|
178
232
|
writeFileSync(absPath, result.content, "utf8");
|
|
179
|
-
return { ok: true, path: doc.path, newVersion: result.newVersion, advisory };
|
|
233
|
+
return { ok: true, path: doc.path, newVersion: result.newVersion, kind: result.kind, advisory };
|
|
180
234
|
}
|
|
181
235
|
//# sourceMappingURL=reratify.js.map
|
package/dist/cli/reratify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reratify.js","sourceRoot":"","sources":["../../src/cli/reratify.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,2FAA2F;AAC3F,+FAA+F;AAC/F,qFAAqF;AACrF,+FAA+F;AAC/F,gGAAgG;AAChG,sFAAsF;AACtF,8CAA8C;AAC9C,EAAE;AACF,2BAA2B;AAC3B,+BAA+B;AAC/B,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"reratify.js","sourceRoot":"","sources":["../../src/cli/reratify.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,2FAA2F;AAC3F,+FAA+F;AAC/F,qFAAqF;AACrF,+FAA+F;AAC/F,gGAAgG;AAChG,sFAAsF;AACtF,8CAA8C;AAC9C,EAAE;AACF,2BAA2B;AAC3B,+BAA+B;AAC/B,EAAE;AACF,gGAAgG;AAChG,8FAA8F;AAC9F,gGAAgG;AAChG,8FAA8F;AAC9F,qFAAqF;AACrF,0FAA0F;AAC1F,0FAA0F;AAC1F,gGAAgG;AAChG,kCAAkC;AAClC,EAAE;AACF,0GAA0G;AAC1G,8FAA8F;AAC9F,6FAA6F;AAC7F,6FAA6F;AAC7F,kGAAkG;AAClG,8FAA8F;AAC9F,gGAAgG;AAChG,iGAAiG;AACjG,8BAA8B;AAC9B,EAAE;AACF,+FAA+F;AAC/F,4FAA4F;AAC5F,gGAAgG;AAChG,6FAA6F;AAC7F,+FAA+F;AAC/F,6FAA6F;AAC7F,EAAE;AACF,kGAAkG;AAClG,kGAAkG;AAClG,mGAAmG;AACnG,kGAAkG;AAClG,cAAc;AACd,EAAE;AACF,8FAA8F;AAC9F,4FAA4F;AAC5F,8FAA8F;AAC9F,8FAA8F;AAC9F,gGAAgG;AAChG,gGAAgG;AAChG,EAAE;AACF,wFAAwF;AACxF,yFAAyF;AACzF,8FAA8F;AAC9F,gGAAgG;A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FAA6F;IAC7F,4FAA4F;IAC5F,sFAAsF;IACtF,kEAAkE;IAClE,MAAM,QAAQ,GACZ,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5G,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ExportDoc } from "../emit/json.js";
|
|
2
|
+
import { ScopeJsonFacts } from "../emit/scopeJson.js";
|
|
3
|
+
import { ScopeModel, ScopeReport } from "../system/scope.js";
|
|
4
|
+
import type { SystemDiagnostic } from "../system/verify.js";
|
|
5
|
+
import { GitRunner } from "./diff-inputs.js";
|
|
6
|
+
/** One model as the scope check sees it at HEAD (or at the commit being measured). */
|
|
7
|
+
export interface HeadModel {
|
|
8
|
+
key: string;
|
|
9
|
+
/** Repo-root-relative model file. */
|
|
10
|
+
rel: string;
|
|
11
|
+
doc: ExportDoc;
|
|
12
|
+
}
|
|
13
|
+
export interface ChangeSetFacts {
|
|
14
|
+
/** Every raw changed path (both sides of a rename), before the exemption. */
|
|
15
|
+
raw: Set<string>;
|
|
16
|
+
/** Raw minus the `Em-Upgrade:`-only files. */
|
|
17
|
+
changed: Set<string>;
|
|
18
|
+
/** new path -> old path for renames. */
|
|
19
|
+
renames: Map<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/** A model file's text as an export document: `.em` is compiled (validation errors tolerated -
|
|
22
|
+
* this reads shapes, not strictness), anything else is read as an `em export --json` document.
|
|
23
|
+
* `null` when it cannot be read at all. */
|
|
24
|
+
export declare function docFromText(text: string, rel: string): ExportDoc | null;
|
|
25
|
+
/**
|
|
26
|
+
* Build the pure evaluator's per-model input. `readBase(relPath)` returns the file text at the
|
|
27
|
+
* base revision (`null` when absent there); `readState(dirRel)` returns a model dir's
|
|
28
|
+
* `.event-modeling.md` text (`null` when none).
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildScopeModels(heads: HeadModel[], change: ChangeSetFacts, readBase: (rel: string) => string | null, readState: (dirRel: string) => string | null): ScopeModel[];
|
|
31
|
+
/** Paths in `paths` whose every commit in `<since>..HEAD` carries an `Em-Upgrade:` trailer (R2).
|
|
32
|
+
* A path with no commit in the range (nothing to vouch for it) is never exempt. */
|
|
33
|
+
export declare function emUpgradeOnlyPaths(repoRoot: string, since: string, paths: string[], runGit?: GitRunner): Set<string>;
|
|
34
|
+
export interface ScopeOptions {
|
|
35
|
+
base?: string;
|
|
36
|
+
staged?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export type ScopeRun = {
|
|
39
|
+
ok: true;
|
|
40
|
+
facts: ScopeJsonFacts;
|
|
41
|
+
report: ScopeReport;
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
message: string;
|
|
45
|
+
diagnostics: SystemDiagnostic[];
|
|
46
|
+
};
|
|
47
|
+
/** `em system scope [<target>] [--base <rev>] [--staged]`: shared by the CLI and the MCP tool. */
|
|
48
|
+
export declare function runSystemScope(target: string, opts: ScopeOptions, runGit?: GitRunner): ScopeRun;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// The git/fs half of `em system scope` (MIL-240): gather the change set (committed since the
|
|
3
|
+
// base, and/or staged), apply the `Em-Upgrade:` exemption, build each model's base-vs-HEAD
|
|
4
|
+
// public-surface changes and `consumes` bindings, and hand the lot to the pure
|
|
5
|
+
// `evaluateScope` (src/system/scope.ts). `buildScopeModels` is shared with `em metrics`' per-
|
|
6
|
+
// commit `seamCrossings`, which feeds it the models as committed instead of as checked out.
|
|
7
|
+
//
|
|
8
|
+
// Compile isolation (MIL-194) holds: each model is compiled on its own, to its own export
|
|
9
|
+
// document; only export-shaped facts reach `src/system/*`.
|
|
10
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
11
|
+
import { dirname, relative, resolve } from "node:path";
|
|
12
|
+
import { compile } from "../pipeline.js";
|
|
13
|
+
import { ParseError } from "../parser/parser.js";
|
|
14
|
+
import { buildExportDoc } from "../emit/json.js";
|
|
15
|
+
import { evaluateScope, parseCodeRoots } from "../system/scope.js";
|
|
16
|
+
import { surfaceOf, diffSurfaces } from "./api.js";
|
|
17
|
+
import { changedEntriesSince, changedEntriesStaged, entryPaths } from "./conformScope.js";
|
|
18
|
+
import { realGit } from "./diff-inputs.js";
|
|
19
|
+
import { loadSystem, readExportDoc } from "./systemInputs.js";
|
|
20
|
+
import { STATE_FILE_NAME } from "./stateFile.js";
|
|
21
|
+
import { EM_UPGRADE_TRAILER } from "./upgrade.js";
|
|
22
|
+
const LABEL = "em system scope";
|
|
23
|
+
const posix = (p) => p.split("\\").join("/");
|
|
24
|
+
function collectConsumes(doc) {
|
|
25
|
+
const out = [];
|
|
26
|
+
for (const s of doc.model.slices)
|
|
27
|
+
for (const e of s.elements)
|
|
28
|
+
for (const c of e.consumes ?? [])
|
|
29
|
+
out.push(c);
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
/** A model file's text as an export document: `.em` is compiled (validation errors tolerated -
|
|
33
|
+
* this reads shapes, not strictness), anything else is read as an `em export --json` document.
|
|
34
|
+
* `null` when it cannot be read at all. */
|
|
35
|
+
export function docFromText(text, rel) {
|
|
36
|
+
if (rel.toLowerCase().endsWith(".em")) {
|
|
37
|
+
try {
|
|
38
|
+
const c = compile(text);
|
|
39
|
+
return buildExportDoc(c.model, c.refs, c.diagnostics, text, rel).doc;
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
if (e instanceof ParseError)
|
|
43
|
+
return null;
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const r = readExportDoc(text, rel);
|
|
48
|
+
return "error" in r ? null : r.doc;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build the pure evaluator's per-model input. `readBase(relPath)` returns the file text at the
|
|
52
|
+
* base revision (`null` when absent there); `readState(dirRel)` returns a model dir's
|
|
53
|
+
* `.event-modeling.md` text (`null` when none).
|
|
54
|
+
*/
|
|
55
|
+
export function buildScopeModels(heads, change, readBase, readState) {
|
|
56
|
+
return heads.map((h) => {
|
|
57
|
+
const dirRaw = posix(dirname(h.rel));
|
|
58
|
+
const dir = dirRaw === "." ? "" : dirRaw;
|
|
59
|
+
const headConsumes = collectConsumes(h.doc);
|
|
60
|
+
const touchedRaw = change.raw.has(h.rel);
|
|
61
|
+
let baseConsumes = headConsumes;
|
|
62
|
+
let surfaceChanges = null;
|
|
63
|
+
if (touchedRaw) {
|
|
64
|
+
const baseRel = change.renames.get(h.rel) ?? h.rel;
|
|
65
|
+
const text = readBase(baseRel);
|
|
66
|
+
const baseDoc = text === null ? null : docFromText(text, baseRel);
|
|
67
|
+
baseConsumes = baseDoc === null ? [] : collectConsumes(baseDoc);
|
|
68
|
+
if (change.changed.has(h.rel) || change.changed.has(baseRel)) {
|
|
69
|
+
const headSurface = surfaceOf(h.doc.model.slices, h.doc.model.types);
|
|
70
|
+
const baseSurface = baseDoc === null ? null : surfaceOf(baseDoc.model.slices, baseDoc.model.types);
|
|
71
|
+
surfaceChanges = diffSurfaces(baseSurface, headSurface);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const stateText = readState(dir);
|
|
75
|
+
return {
|
|
76
|
+
key: h.key,
|
|
77
|
+
file: h.rel,
|
|
78
|
+
dir,
|
|
79
|
+
contract: dir === "" ? `contracts/${h.key}.tsp` : `${dir}/contracts/${h.key}.tsp`,
|
|
80
|
+
codeRoots: stateText === null ? [] : parseCodeRoots(stateText),
|
|
81
|
+
surfaceChanges,
|
|
82
|
+
headConsumes,
|
|
83
|
+
baseConsumes,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/** Paths in `paths` whose every commit in `<since>..HEAD` carries an `Em-Upgrade:` trailer (R2).
|
|
88
|
+
* A path with no commit in the range (nothing to vouch for it) is never exempt. */
|
|
89
|
+
export function emUpgradeOnlyPaths(repoRoot, since, paths, runGit = realGit) {
|
|
90
|
+
const out = new Set();
|
|
91
|
+
for (const p of paths) {
|
|
92
|
+
const log = runGit([
|
|
93
|
+
"-C",
|
|
94
|
+
repoRoot,
|
|
95
|
+
"log",
|
|
96
|
+
`--format=%x02%H%x00%(trailers:key=${EM_UPGRADE_TRAILER},valueonly)`,
|
|
97
|
+
`${since}..HEAD`,
|
|
98
|
+
"--",
|
|
99
|
+
p,
|
|
100
|
+
]);
|
|
101
|
+
if (log.status !== 0)
|
|
102
|
+
continue;
|
|
103
|
+
const records = log.stdout.split("\x02").filter((r) => r.trim() !== "");
|
|
104
|
+
if (records.length > 0 && records.every((r) => (r.split("\0")[1] ?? "").trim() !== ""))
|
|
105
|
+
out.add(p);
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
/** `em system scope [<target>] [--base <rev>] [--staged]`: shared by the CLI and the MCP tool. */
|
|
110
|
+
export function runSystemScope(target, opts, runGit = realGit) {
|
|
111
|
+
const staged = opts.staged === true;
|
|
112
|
+
if (opts.base === undefined && !staged) {
|
|
113
|
+
return { ok: false, message: `${LABEL}: pass --base <rev> (the change set since that revision), --staged (what is staged now), or both`, diagnostics: [] };
|
|
114
|
+
}
|
|
115
|
+
const loaded = loadSystem(target, runGit);
|
|
116
|
+
if (!loaded.ok) {
|
|
117
|
+
return { ok: false, message: `${LABEL}: not checking - ${target} could not be loaded; fix the above first`, diagnostics: loaded.diagnostics };
|
|
118
|
+
}
|
|
119
|
+
const anchor = dirname(resolve(loaded.models[0].file));
|
|
120
|
+
const top = runGit(["-C", anchor, "rev-parse", "--show-toplevel"]);
|
|
121
|
+
if (top.status !== 0)
|
|
122
|
+
return { ok: false, message: `${LABEL}: ${target} is not inside a git repository`, diagnostics: [] };
|
|
123
|
+
const repoRoot = top.stdout.trim();
|
|
124
|
+
const baseRev = opts.base ?? "HEAD";
|
|
125
|
+
const verify = runGit(["-C", repoRoot, "rev-parse", "--verify", "--quiet", `${baseRev}^{commit}`]);
|
|
126
|
+
if (verify.status !== 0)
|
|
127
|
+
return { ok: false, message: `${LABEL}: unknown revision "${baseRev}"`, diagnostics: [] };
|
|
128
|
+
const mb = runGit(["-C", repoRoot, "merge-base", baseRev, "HEAD"]);
|
|
129
|
+
const mergeBase = mb.status === 0 && mb.stdout.trim() !== "" ? mb.stdout.trim() : baseRev;
|
|
130
|
+
let committed = [];
|
|
131
|
+
if (opts.base !== undefined) {
|
|
132
|
+
const r = changedEntriesSince(repoRoot, opts.base, runGit, LABEL);
|
|
133
|
+
if (!r.ok)
|
|
134
|
+
return { ok: false, message: r.message, diagnostics: [] };
|
|
135
|
+
committed = r.entries;
|
|
136
|
+
}
|
|
137
|
+
let stagedEntries = [];
|
|
138
|
+
if (staged) {
|
|
139
|
+
const r = changedEntriesStaged(repoRoot, runGit, LABEL);
|
|
140
|
+
if (!r.ok)
|
|
141
|
+
return { ok: false, message: r.message, diagnostics: [] };
|
|
142
|
+
stagedEntries = r.entries;
|
|
143
|
+
}
|
|
144
|
+
const raw = new Set([...entryPaths(committed), ...entryPaths(stagedEntries)]);
|
|
145
|
+
const stagedPaths = new Set(entryPaths(stagedEntries));
|
|
146
|
+
const renames = new Map();
|
|
147
|
+
for (const e of [...stagedEntries, ...committed])
|
|
148
|
+
if (e.oldPath !== null)
|
|
149
|
+
renames.set(e.path, e.oldPath);
|
|
150
|
+
// Staged changes have no commit yet, so they are never exempt.
|
|
151
|
+
const candidates = [...raw].filter((p) => !stagedPaths.has(p));
|
|
152
|
+
const exempt = opts.base === undefined ? new Set() : emUpgradeOnlyPaths(repoRoot, mergeBase, candidates, runGit);
|
|
153
|
+
const changed = new Set([...raw].filter((p) => !exempt.has(p)));
|
|
154
|
+
const topReal = realpathSync(repoRoot);
|
|
155
|
+
const heads = [];
|
|
156
|
+
for (const m of loaded.models) {
|
|
157
|
+
const rel = posix(relative(topReal, realpathSync(resolve(m.file))));
|
|
158
|
+
if (rel.startsWith(".."))
|
|
159
|
+
continue;
|
|
160
|
+
heads.push({ key: m.key, rel, doc: m.doc });
|
|
161
|
+
}
|
|
162
|
+
const models = buildScopeModels(heads, { raw, changed, renames }, (rel) => {
|
|
163
|
+
const show = runGit(["-C", repoRoot, "show", `${mergeBase}:${rel}`]);
|
|
164
|
+
return show.status === 0 ? show.stdout : null;
|
|
165
|
+
}, (dirRel) => {
|
|
166
|
+
const f = resolve(repoRoot, dirRel, STATE_FILE_NAME);
|
|
167
|
+
return existsSync(f) ? readFileSync(f, "utf8") : null;
|
|
168
|
+
});
|
|
169
|
+
const report = evaluateScope({ models, changed: [...changed] });
|
|
170
|
+
return {
|
|
171
|
+
ok: true,
|
|
172
|
+
facts: { base: opts.base ?? null, staged, changedPaths: [...changed].sort(), exemptPaths: [...exempt].sort() },
|
|
173
|
+
report,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=scopeInputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopeInputs.js","sourceRoot":"","sources":["../../src/cli/scopeInputs.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,6FAA6F;AAC7F,2FAA2F;AAC3F,+EAA+E;AAC/E,8FAA8F;AAC9F,4FAA4F;AAC5F,EAAE;AACF,0FAA0F;AAC1F,2DAA2D;AAE3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,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AM,MAAM,GAAG,gBAAgB,CAC7B,KAAK,EACL,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,EACzB,CAAC,GAAG,EAAE,EAAE;QACN,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAChD,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;QACT,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QACrD,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxD,CAAC,CACF,CAAC;IACF,MAAM,MAAM,GAAG,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;IAChE,OAAO;QACL,EAAE,EAAE,IAAI;QACR,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC9G,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/dist/cli/skillCheck.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
export type SkillCheckFindingCode = "skill-check-not-installed" | "skill-check-stamp-missing" | "skill-check-stamp-mismatch" | "skill-check-content-drift";
|
|
1
|
+
export type SkillCheckFindingCode = "skill-check-not-installed" | "skill-check-stamp-missing" | "skill-check-stamp-mismatch" | "skill-check-content-drift" | "agent-not-installed" | "agent-content-drift" | "plugin-pin-mismatch" | "plugin-not-enabled" | "plugin-registered-at-different-ref" | "plugin-not-installed-locally";
|
|
2
2
|
export interface SkillCheckFinding {
|
|
3
3
|
code: SkillCheckFindingCode;
|
|
4
4
|
message: string;
|
|
5
5
|
vendoredStamp?: string | null;
|
|
6
6
|
installedVersion?: string;
|
|
7
7
|
driftedFiles?: string[];
|
|
8
|
+
/** Plugin findings only (MIL-231): the marketplace name the repo's settings declare. */
|
|
9
|
+
pluginName?: string;
|
|
10
|
+
/** Plugin findings only: the `source.ref` the settings (or, for `plugin-registered-at-different-ref`,
|
|
11
|
+
* the machine registry) carry. */
|
|
12
|
+
pluginRef?: string | null;
|
|
13
|
+
/** Plugin findings only: the commands that fix it (the two-command install snippet). */
|
|
14
|
+
installCommands?: string[];
|
|
8
15
|
}
|
|
9
16
|
export interface SkillCheckResult {
|
|
10
17
|
findings: SkillCheckFinding[];
|
|
@@ -22,3 +29,10 @@ export declare function checkSkillSync(packagedDir: string, vendoredDir: string,
|
|
|
22
29
|
* itself — a bundle check is just several single-directory checks with prefixed findings.
|
|
23
30
|
*/
|
|
24
31
|
export declare function checkSkillSyncBundle(packagedRoot: string, vendoredRoot: string, installedVersion: string, skillDirNames: readonly string[], sharedDirNames: readonly string[]): SkillCheckResult;
|
|
32
|
+
/**
|
|
33
|
+
* Pure (MIL-269, R32): checks exactly the listed agent files under `.claude/agents/` and nothing
|
|
34
|
+
* else in that shared directory. A missing file is `agent-not-installed`, an edited/stale one
|
|
35
|
+
* `agent-content-drift`; messages carry the `[agents]` prefix and the file name. No stamp (the
|
|
36
|
+
* files have no `em-version:` line - the frontmatter is Claude Code's).
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkAgentFiles(packagedDir: string, vendoredDir: string, fileNames: readonly string[]): SkillCheckResult;
|
package/dist/cli/skillCheck.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { existsSync, readFileSync } from "node:fs";
|
|
15
15
|
import { join } from "node:path";
|
|
16
16
|
import { extractEmVersionStamp } from "./skillVersionCheck.js";
|
|
17
|
-
import { planSkillSync } from "./skillSync.js";
|
|
17
|
+
import { planAgentSync, planSkillSync } from "./skillSync.js";
|
|
18
18
|
/**
|
|
19
19
|
* Pure: compares vendoredDir against packagedDir (content) and installedVersion (em --version
|
|
20
20
|
* — injected, never re-derived; see src/cli.ts's PKG_VERSION) against the vendored SKILL.md's
|
|
@@ -106,4 +106,25 @@ export function checkSkillSyncBundle(packagedRoot, vendoredRoot, installedVersio
|
|
|
106
106
|
}
|
|
107
107
|
return { findings, ok: findings.length === 0 };
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Pure (MIL-269, R32): checks exactly the listed agent files under `.claude/agents/` and nothing
|
|
111
|
+
* else in that shared directory. A missing file is `agent-not-installed`, an edited/stale one
|
|
112
|
+
* `agent-content-drift`; messages carry the `[agents]` prefix and the file name. No stamp (the
|
|
113
|
+
* files have no `em-version:` line - the frontmatter is Claude Code's).
|
|
114
|
+
*/
|
|
115
|
+
export function checkAgentFiles(packagedDir, vendoredDir, fileNames) {
|
|
116
|
+
const plan = planAgentSync(packagedDir, vendoredDir, fileNames);
|
|
117
|
+
const findings = plan.changes.map((c) => c.kind === "added"
|
|
118
|
+
? {
|
|
119
|
+
code: "agent-not-installed",
|
|
120
|
+
message: `[agents] ${c.relPath}: not installed at ${join(vendoredDir, c.relPath)} - run \`em skill sync\` (or \`em upgrade\`)`,
|
|
121
|
+
driftedFiles: [`agents/${c.relPath}`],
|
|
122
|
+
}
|
|
123
|
+
: {
|
|
124
|
+
code: "agent-content-drift",
|
|
125
|
+
message: `[agents] ${c.relPath}: content drift - differs from the packaged agent definition - run \`em skill sync\` (or \`em upgrade\`)`,
|
|
126
|
+
driftedFiles: [`agents/${c.relPath}`],
|
|
127
|
+
});
|
|
128
|
+
return { findings, ok: findings.length === 0 };
|
|
129
|
+
}
|
|
109
130
|
//# sourceMappingURL=skillCheck.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillCheck.js","sourceRoot":"","sources":["../../src/cli/skillCheck.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,6FAA6F;AAC7F,0FAA0F;AAC1F,6FAA6F;AAC7F,6FAA6F;AAC7F,kFAAkF;AAClF,uDAAuD;AACvD,EAAE;AACF,+EAA+E;AAC/E,kFAAkF;AAClF,+FAA+F;AAC/F,0FAA0F;AAC1F,iEAAiE;AAEjE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"skillCheck.js","sourceRoot":"","sources":["../../src/cli/skillCheck.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,6FAA6F;AAC7F,0FAA0F;AAC1F,6FAA6F;AAC7F,6FAA6F;AAC7F,kFAAkF;AAClF,uDAAuD;AACvD,EAAE;AACF,+EAA+E;AAC/E,kFAAkF;AAClF,+FAA+F;AAC/F,0FAA0F;AAC1F,iEAAiE;AAEjE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAoC9D;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,WAAmB,EAAE,WAAmB,EAAE,gBAAwB;IAC/F,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,OAAO;YACL,EAAE,EAAE,KAAK;YACT,QAAQ,EAAE;gBACR;oBACE,IAAI,EAA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;IACF,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;AACjD,CAAC"}
|
package/dist/cli/skillDirs.d.ts
CHANGED
|
@@ -13,3 +13,8 @@ export declare const EM_ALL_SKILL_BUNDLE_DIRS: readonly string[];
|
|
|
13
13
|
* since it's the fixed entry point every consumer's `/event-modeling` resolves to regardless of
|
|
14
14
|
* which other skills in the bundle they've actually used. */
|
|
15
15
|
export declare const EM_SKILL_ANCHOR_DIR = "event-modeling";
|
|
16
|
+
/** MIL-269 (R32): the four Claude Code sub-agent definitions em ships under `.claude/agents/`.
|
|
17
|
+
* Unlike the skill bundle this is a FIXED FILE list, not a directory: `.claude/agents/` is
|
|
18
|
+
* shared with the consumer's own agents, so install/sync/check and the upgrade steps only ever
|
|
19
|
+
* read, write or delete exactly these names and never walk the directory. */
|
|
20
|
+
export declare const EM_AGENT_FILES: readonly string[];
|
package/dist/cli/skillDirs.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
// The set of directories under `.claude/skills/` that together make up the em-bundled
|
|
3
|
-
// event-modeling skill (MIL-157): five focused, SDLC-stage skills
|
|
3
|
+
// event-modeling skill (MIL-157): five focused, SDLC-stage skills, the `event-modeling-engagement`
|
|
4
|
+
// lead-session skill (MIL-270), plus the thin `event-modeling`
|
|
4
5
|
// router skill that preserves `/event-modeling` as a single resumable entry point, and one
|
|
5
6
|
// non-skill directory (`event-modeling-shared`, no SKILL.md) holding reference/template material
|
|
6
7
|
// every skill points back to instead of duplicating. `em skill install`/`sync`/`check` treat this
|
|
@@ -18,6 +19,7 @@ export const EM_SKILL_DIR_NAMES = [
|
|
|
18
19
|
"event-modeling-implement",
|
|
19
20
|
"event-modeling-conform",
|
|
20
21
|
"event-modeling-review",
|
|
22
|
+
"event-modeling-engagement",
|
|
21
23
|
];
|
|
22
24
|
/** Directories with no SKILL.md of their own — shared reference/template material every skill
|
|
23
25
|
* above points back to instead of duplicating. Still part of the sync/check bundle (content
|
|
@@ -31,4 +33,14 @@ export const EM_ALL_SKILL_BUNDLE_DIRS = [...EM_SKILL_DIR_NAMES, ...EM_SHARED_DIR
|
|
|
31
33
|
* since it's the fixed entry point every consumer's `/event-modeling` resolves to regardless of
|
|
32
34
|
* which other skills in the bundle they've actually used. */
|
|
33
35
|
export const EM_SKILL_ANCHOR_DIR = "event-modeling";
|
|
36
|
+
/** MIL-269 (R32): the four Claude Code sub-agent definitions em ships under `.claude/agents/`.
|
|
37
|
+
* Unlike the skill bundle this is a FIXED FILE list, not a directory: `.claude/agents/` is
|
|
38
|
+
* shared with the consumer's own agents, so install/sync/check and the upgrade steps only ever
|
|
39
|
+
* read, write or delete exactly these names and never walk the directory. */
|
|
40
|
+
export const EM_AGENT_FILES = [
|
|
41
|
+
"em-implementer.md",
|
|
42
|
+
"em-validator.md",
|
|
43
|
+
"em-reviewer.md",
|
|
44
|
+
"em-critic.md",
|
|
45
|
+
];
|
|
34
46
|
//# sourceMappingURL=skillDirs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillDirs.js","sourceRoot":"","sources":["../../src/cli/skillDirs.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,sFAAsF;AACtF,
|
|
1
|
+
{"version":3,"file":"skillDirs.js","sourceRoot":"","sources":["../../src/cli/skillDirs.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,sFAAsF;AACtF,mGAAmG;AACnG,+DAA+D;AAC/D,2FAA2F;AAC3F,iGAAiG;AACjG,kGAAkG;AAClG,iGAAiG;AACjG,gGAAgG;AAChG,kGAAkG;AAClG,kGAAkG;AAClG,+BAA+B;AAE/B;+EAC+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAsB;IACnD,gBAAgB;IAChB,yBAAyB;IACzB,uBAAuB;IACvB,0BAA0B;IAC1B,wBAAwB;IACxB,uBAAuB;IACvB,2BAA2B;CAC5B,CAAC;AAEF;;;qBAGqB;AACrB,MAAM,CAAC,MAAM,mBAAmB,GAAsB,CAAC,uBAAuB,CAAC,CAAC;AAEhF,yFAAyF;AACzF,MAAM,CAAC,MAAM,wBAAwB,GAAsB,CAAC,GAAG,kBAAkB,EAAE,GAAG,mBAAmB,CAAC,CAAC;AAE3G;;;8DAG8D;AAC9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAEpD;;;8EAG8E;AAC9E,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC/C,mBAAmB;IACnB,iBAAiB;IACjB,gBAAgB;IAChB,cAAc;CACf,CAAC"}
|
package/dist/cli/skillSync.d.ts
CHANGED
|
@@ -30,3 +30,7 @@ export declare function planSkillSyncBundle(packagedRoot: string, vendoredRoot:
|
|
|
30
30
|
/** Shell: applies every directory's plan from planSkillSyncBundle. Same idempotency/no-merge
|
|
31
31
|
* contract as applySkillSync, just looped. */
|
|
32
32
|
export declare function applySkillSyncBundle(bundlePlan: SkillSyncBundleDirPlan[], packagedRoot: string, vendoredRoot: string): void;
|
|
33
|
+
/** Pure: per listed file, `added` (absent in vendoredDir), `modified` (hash differs) or unchanged.
|
|
34
|
+
* A listed file missing from packagedDir is skipped. Never lists, reads or removes anything else
|
|
35
|
+
* in vendoredDir. Apply with `applySkillSync(plan, packagedDir, vendoredDir)`. */
|
|
36
|
+
export declare function planAgentSync(packagedDir: string, vendoredDir: string, fileNames: readonly string[]): SkillSyncPlan;
|