@milehimikey/em 1.13.1 → 1.14.1
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 +50 -11
- package/.claude/skills/event-modeling-conform/SKILL.md +1 -1
- package/.claude/skills/event-modeling-design/SKILL.md +127 -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 +1 -1
- package/.claude/skills/event-modeling-implement/reference/implement.md +38 -11
- package/.claude/skills/event-modeling-review/SKILL.md +2 -2
- package/.claude/skills/event-modeling-shared/reference/em-dsl.md +279 -189
- package/.claude/skills/event-modeling-shared/reference/operating-principles.md +61 -0
- package/.claude/skills/event-modeling-shared/reference/slice-doc-schema.md +116 -5
- 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 +82 -21
- package/dist/cli/ciInit.js +468 -64
- 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 +9 -0
- package/dist/cli/coverage.js +60 -8
- package/dist/cli/coverage.js.map +1 -1
- package/dist/cli/defer.d.ts +55 -0
- package/dist/cli/defer.js +244 -0
- package/dist/cli/defer.js.map +1 -0
- 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 +4 -2
- package/dist/cli/reratify.js +41 -16
- 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 +16 -3
- package/dist/cli/upgrade.js +366 -30
- 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 +599 -94
- 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/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/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 +163 -31
- 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 +5 -2
- 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 +871 -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 +574 -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 +298 -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
|
@@ -57,12 +57,20 @@
|
|
|
57
57
|
// conform sweep ever ran — so this is advisory only, printed by the CLI layer, never gating the
|
|
58
58
|
// bump itself. MIL-258: the advisory is about superseding a SHIPPED version, so the unshipped
|
|
59
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.
|
|
60
65
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
61
66
|
import { join } from "node:path";
|
|
62
67
|
import { continuationOf } from "../model/continuation.js";
|
|
63
68
|
import { resolveSliceDocJoin } from "../catalog/docJoin.js";
|
|
64
69
|
import { fieldLineRegex, fieldLineWithEolRegex, locateFrontmatterInner, normalizeFieldValue } from "./frontmatterSurgery.js";
|
|
65
70
|
import { listAllFindingsFiles, unruledFindingsInScope } from "./findings.js";
|
|
71
|
+
import { MEANING_CONFIRMATION_KEYS, meaningConfirmationLine, meaningConfirmationRequiredMessage, } from "./ratify.js";
|
|
72
|
+
import { isPublicTouchingSlice } from "../catalog/apiFirst.js";
|
|
73
|
+
import { reopenDeferred } from "./defer.js";
|
|
66
74
|
/** The status a doc must already be in for `reratify` to apply — mirrors `RATIFIED_STATUS` in
|
|
67
75
|
* ratify.ts (the status this command flips TO), named separately since it's the precondition
|
|
68
76
|
* here, not the target. */
|
|
@@ -76,7 +84,7 @@ const TARGET_STATUS = "ready-to-implement";
|
|
|
76
84
|
* see module header for why this precondition (not idempotent-no-op) is the right refusal
|
|
77
85
|
* shape here. No fs access — the caller reads/writes; see `runReratify` below.
|
|
78
86
|
*/
|
|
79
|
-
export function applyReratifyFrontmatter(raw) {
|
|
87
|
+
export function applyReratifyFrontmatter(raw, confirmation = null) {
|
|
80
88
|
const range = locateFrontmatterInner(raw);
|
|
81
89
|
if (!range)
|
|
82
90
|
return { ok: false, message: "no frontmatter block found" };
|
|
@@ -122,27 +130,37 @@ export function applyReratifyFrontmatter(raw) {
|
|
|
122
130
|
};
|
|
123
131
|
}
|
|
124
132
|
const newVersion = currentVersion + 1;
|
|
133
|
+
// Clear stale ratifiedBy:/ratifiedOn:/reviewedBy:/reviewedOn: — see module header — and
|
|
134
|
+
// (MIL-238) the prior version's meaningConfirmed:/contractChange:. Done FIRST, on the original
|
|
135
|
+
// text, so the fresh confirmation line spliced in after `version:` below is never swept away.
|
|
136
|
+
// These keys are disjoint from `status:`/`version:` by construction (fieldLineRegex matches one
|
|
137
|
+
// key at a time), so the two lines are re-located on the cleared text unchanged.
|
|
138
|
+
let cleared = inner;
|
|
139
|
+
for (const key of ["ratifiedBy", "ratifiedOn", "reviewedBy", "reviewedOn", ...MEANING_CONFIRMATION_KEYS]) {
|
|
140
|
+
cleared = cleared.replace(fieldLineWithEolRegex(key), "");
|
|
141
|
+
}
|
|
142
|
+
const clearedStatus = fieldLineRegex("status").exec(cleared);
|
|
143
|
+
const clearedVersion = fieldLineRegex("version").exec(cleared);
|
|
144
|
+
const afterVersion = cleared.slice(clearedVersion.index + clearedVersion[0].length);
|
|
145
|
+
const eol = afterVersion.startsWith("\r\n") ? "\r\n" : "\n";
|
|
146
|
+
const versionNext = `${clearedVersion[1]}${newVersion}`;
|
|
125
147
|
// Apply from the highest index first so an earlier edit's index stays valid — same convention
|
|
126
148
|
// markImplemented.ts/ratify.ts use.
|
|
127
149
|
const edits = [
|
|
128
150
|
// MIL-258: the unshipped path is already at the target status — nothing to flip.
|
|
129
151
|
...(kind === "shipped"
|
|
130
|
-
? [{ index:
|
|
152
|
+
? [{ index: clearedStatus.index, oldLen: clearedStatus[0].length, next: `${clearedStatus[1]}${TARGET_STATUS}` }]
|
|
131
153
|
: []),
|
|
132
|
-
{
|
|
154
|
+
{
|
|
155
|
+
index: clearedVersion.index,
|
|
156
|
+
oldLen: clearedVersion[0].length,
|
|
157
|
+
next: confirmation ? `${versionNext}${eol}${meaningConfirmationLine(confirmation)}` : versionNext,
|
|
158
|
+
},
|
|
133
159
|
].sort((a, b) => b.index - a.index);
|
|
134
|
-
let updatedInner =
|
|
160
|
+
let updatedInner = cleared;
|
|
135
161
|
for (const edit of edits) {
|
|
136
162
|
updatedInner = updatedInner.slice(0, edit.index) + edit.next + updatedInner.slice(edit.index + edit.oldLen);
|
|
137
163
|
}
|
|
138
|
-
// Clear stale ratifiedBy:/ratifiedOn:/reviewedBy:/reviewedOn: — see module header. A plain
|
|
139
|
-
// `.replace()` (not index-spliced alongside the edits above) is safe here: these four keys are
|
|
140
|
-
// disjoint from `status:`/`version:` and from each other by construction (fieldLineRegex matches
|
|
141
|
-
// one key at a time), so removing them from the ALREADY-updated text can't disturb the edits
|
|
142
|
-
// just applied.
|
|
143
|
-
for (const key of ["ratifiedBy", "ratifiedOn", "reviewedBy", "reviewedOn"]) {
|
|
144
|
-
updatedInner = updatedInner.replace(fieldLineWithEolRegex(key), "");
|
|
145
|
-
}
|
|
146
164
|
const content = raw.slice(0, range.innerStart) + updatedInner + raw.slice(range.innerEnd);
|
|
147
165
|
return { ok: true, content, newVersion, kind };
|
|
148
166
|
}
|
|
@@ -164,7 +182,7 @@ export function reratifyAdvisory(baseDir, sliceKey, currentVersion, conformedVer
|
|
|
164
182
|
* writes it. `baseDir` is the `.em` file's directory, same convention every doc/note path in
|
|
165
183
|
* `em` uses.
|
|
166
184
|
*/
|
|
167
|
-
export function runReratify(model, refs, baseDir, sliceKey) {
|
|
185
|
+
export function runReratify(model, refs, baseDir, sliceKey, confirmation = null) {
|
|
168
186
|
const sliceIndex = refs.sliceKeys.indexOf(sliceKey);
|
|
169
187
|
if (sliceIndex === -1) {
|
|
170
188
|
return { ok: false, message: `no slice with export key "${sliceKey}" in this model` };
|
|
@@ -198,16 +216,23 @@ export function runReratify(model, refs, baseDir, sliceKey) {
|
|
|
198
216
|
}
|
|
199
217
|
const absPath = join(baseDir, doc.path);
|
|
200
218
|
const raw = readFileSync(absPath, "utf8");
|
|
201
|
-
const result = applyReratifyFrontmatter(raw);
|
|
219
|
+
const result = applyReratifyFrontmatter(raw, confirmation);
|
|
202
220
|
if (!result.ok) {
|
|
203
221
|
return { ok: false, message: `${doc.path}: ${result.message}` };
|
|
204
222
|
}
|
|
223
|
+
// MIL-238: the API-first gate — after the doc's own preconditions, before any write: a
|
|
224
|
+
// public-touching slice's new version needs a meaning confirmation.
|
|
225
|
+
if (confirmation === null && isPublicTouchingSlice(model, refs, sliceKey)) {
|
|
226
|
+
return { ok: false, message: meaningConfirmationRequiredMessage(sliceKey) };
|
|
227
|
+
}
|
|
205
228
|
// MIL-214: computed from the doc's PRE-BUMP version/certification (`doc` was resolved before
|
|
206
229
|
// the write below changes `version`) — "was the version we're about to supersede ever fully
|
|
207
230
|
// certified". MIL-258: only meaningful for a SHIPPED version; an unshipped one has no
|
|
208
231
|
// certification to lack, so that path carries no advisory at all.
|
|
209
232
|
const advisory = result.kind === "shipped" ? reratifyAdvisory(baseDir, sliceKey, doc.version, doc.conformedVersion) : null;
|
|
210
|
-
|
|
211
|
-
|
|
233
|
+
// MIL-275: questions deferred to the version this bump reaches come back as `- [ ]`.
|
|
234
|
+
const reopened = reopenDeferred(result.content, result.newVersion);
|
|
235
|
+
writeFileSync(absPath, reopened.content, "utf8");
|
|
236
|
+
return { ok: true, path: doc.path, newVersion: result.newVersion, kind: result.kind, advisory, reopened: reopened.count };
|
|
212
237
|
}
|
|
213
238
|
//# 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,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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AAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC1E,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,kCAAkC,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC9E,CAAC;IACD,6FAA6F;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,qFAAqF;IACrF,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IACnE,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjD,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,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC5H,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","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M,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,qBA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,OAAO,sBAAsB,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,8CAA8C;YAC9H,YAAY,EAAE,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;SACtC;QACH,CAAC,CAAC;YACE,IAAI,EAAE,qBAA8B;YACpC,OAAO,EAAE,YAAY,CAAC,CAAC,OAAO,0GAA0G;YACxI,YAAY,EAAE,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;SACtC,CACN,CAAC;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;
|
package/dist/cli/skillSync.js
CHANGED
|
@@ -81,4 +81,27 @@ export function applySkillSyncBundle(bundlePlan, packagedRoot, vendoredRoot) {
|
|
|
81
81
|
applySkillSync(plan, join(packagedRoot, dirName), join(vendoredRoot, dirName));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
// ---- Agent files (MIL-269, R32) — `.claude/agents/` is shared with the consumer's own agents, so
|
|
85
|
+
// unlike planSkillSync these walk a FIXED list of file names and never report anything as
|
|
86
|
+
// `removed`: a file that is not on the list is not em's to list, touch or delete.
|
|
87
|
+
/** Pure: per listed file, `added` (absent in vendoredDir), `modified` (hash differs) or unchanged.
|
|
88
|
+
* A listed file missing from packagedDir is skipped. Never lists, reads or removes anything else
|
|
89
|
+
* in vendoredDir. Apply with `applySkillSync(plan, packagedDir, vendoredDir)`. */
|
|
90
|
+
export function planAgentSync(packagedDir, vendoredDir, fileNames) {
|
|
91
|
+
const changes = [];
|
|
92
|
+
let unchangedCount = 0;
|
|
93
|
+
for (const relPath of [...fileNames].sort()) {
|
|
94
|
+
const src = join(packagedDir, relPath);
|
|
95
|
+
if (!existsSync(src))
|
|
96
|
+
continue;
|
|
97
|
+
const dest = join(vendoredDir, relPath);
|
|
98
|
+
if (!existsSync(dest))
|
|
99
|
+
changes.push({ relPath, kind: "added" });
|
|
100
|
+
else if (sha256(src) !== sha256(dest))
|
|
101
|
+
changes.push({ relPath, kind: "modified" });
|
|
102
|
+
else
|
|
103
|
+
unchangedCount++;
|
|
104
|
+
}
|
|
105
|
+
return { changes, unchangedCount };
|
|
106
|
+
}
|
|
84
107
|
//# sourceMappingURL=skillSync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillSync.js","sourceRoot":"","sources":["../../src/cli/skillSync.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,yFAAyF;AACzF,mFAAmF;AACnF,yFAAyF;AACzF,0FAA0F;AAC1F,0EAA0E;AAC1E,EAAE;AACF,0FAA0F;AAC1F,4FA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,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;IACjF,CAAC;AACH,CAAC;AAED,mGAAmG;AACnG,0FAA0F;AAC1F,kFAAkF;AAElF;;mFAEmF;AACnF,MAAM,UAAU,aAAa,CAAC,WAAmB,EAAE,WAAmB,EAAE,SAA4B;IAClG,MAAM,OAAO,GAA0B,EAAE,CAAC;IAC1C,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,KAAK,MAAM,OAAO,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;aAC3D,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;;YAC9E,cAAc,EAAE,CAAC;IACxB,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;AACrC,CAAC"}
|
package/dist/cli/sliceNew.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GeneratedRegion } from "../catalog/sliceSections.js";
|
|
1
2
|
/** `pattern`'s exact 4-value enum — docs/slice-doc-schema.md's "Canonical keys" table. */
|
|
2
3
|
export declare const SLICE_PATTERNS: readonly ["state-change", "state-view", "automation", "translation"];
|
|
3
4
|
export type SlicePattern = (typeof SLICE_PATTERNS)[number];
|
|
@@ -8,14 +9,17 @@ export declare function isSlicePattern(value: string): value is SlicePattern;
|
|
|
8
9
|
* pass a pre-slugged key of their own, so the two can never drift apart. */
|
|
9
10
|
export declare function sliceDocKey(displayName: string): string;
|
|
10
11
|
/**
|
|
11
|
-
* Build the full contents of a fresh `slices/<key>.md
|
|
12
|
-
* required at `status: draft`, in the same order
|
|
13
|
-
* uses. Body: the `# Slice: <name>` heading
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* Build the full contents of a fresh `slices/<key>.md` (MIL-266: the whole template skeleton).
|
|
13
|
+
* Frontmatter: exactly the 5 keys required at `status: draft`, in the same order
|
|
14
|
+
* templates/slice.md's own frontmatter block uses. Body: the `# Slice: <name>` heading, the
|
|
15
|
+
* diagram-image stub, then every template section in template order (`## Delta` excepted — a
|
|
16
|
+
* version-1 doc has no delta yet). The GENERATED regions (command/event/view field tables, the
|
|
17
|
+
* Invariants list — catalog/sliceSections.ts) are filled from `regions`: the model's own regions
|
|
18
|
+
* when `em slice new --wire` compiled one, else the template's placeholder regions, which
|
|
19
|
+
* `em slice sync` fills once the doc is bound. Authored sections carry the template's
|
|
20
|
+
* placeholder bullets and stay hand-written.
|
|
17
21
|
*/
|
|
18
|
-
export declare function buildSliceDocContent(displayName: string, key: string, pattern: SlicePattern, swimlane: string): string;
|
|
22
|
+
export declare function buildSliceDocContent(displayName: string, key: string, pattern: SlicePattern, swimlane: string, regions?: GeneratedRegion[]): string;
|
|
19
23
|
/**
|
|
20
24
|
* Build the full contents of a fresh, near-free `slices/<key>.md` STUB (MIL-184: `em slice new
|
|
21
25
|
* --stub` / `em slice stub-all`) — the same 5 frontmatter keys `buildSliceDocContent` writes
|