@milehimikey/em 1.14.2 → 1.16.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-implementer.md +12 -2
- package/.claude/agents/em-validator.md +2 -1
- package/.claude/skills/event-modeling/SKILL.md +3 -3
- package/.claude/skills/event-modeling-conform/SKILL.md +1 -1
- package/.claude/skills/event-modeling-design/SKILL.md +29 -18
- package/.claude/skills/event-modeling-discover/SKILL.md +1 -1
- package/.claude/skills/event-modeling-engagement/SKILL.md +60 -56
- package/.claude/skills/event-modeling-engagement/reference/engagement.md +13 -19
- package/.claude/skills/event-modeling-implement/SKILL.md +3 -3
- package/.claude/skills/event-modeling-implement/reference/implement.md +40 -27
- package/.claude/skills/event-modeling-review/SKILL.md +13 -3
- package/.claude/skills/event-modeling-shared/reference/em-dsl.md +234 -228
- package/.claude/skills/event-modeling-shared/reference/operating-principles.md +3 -3
- package/.claude/skills/event-modeling-shared/reference/slice-doc-schema.md +69 -27
- package/.claude/skills/event-modeling-shared/templates/constitution.md +5 -7
- package/.claude-plugin/marketplace.json +2 -2
- package/dist/catalog/deferQueue.d.ts +20 -0
- package/dist/catalog/deferQueue.js +63 -0
- package/dist/catalog/deferQueue.js.map +1 -0
- package/dist/catalog/docJoin.d.ts +22 -1
- package/dist/catalog/docJoin.js +13 -4
- package/dist/catalog/docJoin.js.map +1 -1
- package/dist/catalog/docModelConsistencyValidate.js +4 -8
- package/dist/catalog/docModelConsistencyValidate.js.map +1 -1
- package/dist/catalog/driftSignal.d.ts +16 -12
- package/dist/catalog/driftSignal.js +14 -9
- package/dist/catalog/driftSignal.js.map +1 -1
- package/dist/catalog/sliceDoc.d.ts +51 -0
- package/dist/catalog/sliceDoc.js +47 -0
- package/dist/catalog/sliceDoc.js.map +1 -1
- package/dist/catalog/sliceReadyValidate.js +19 -1
- package/dist/catalog/sliceReadyValidate.js.map +1 -1
- package/dist/catalog/sliceSections.d.ts +5 -0
- package/dist/catalog/sliceSections.js +11 -2
- package/dist/catalog/sliceSections.js.map +1 -1
- package/dist/cli/conformScope.d.ts +4 -0
- package/dist/cli/conformScope.js +2 -2
- package/dist/cli/conformScope.js.map +1 -1
- package/dist/cli/coverage.js +7 -3
- package/dist/cli/coverage.js.map +1 -1
- package/dist/cli/defer.d.ts +106 -2
- package/dist/cli/defer.js +357 -24
- package/dist/cli/defer.js.map +1 -1
- package/dist/cli/engagement.d.ts +26 -5
- package/dist/cli/engagement.js +55 -28
- package/dist/cli/engagement.js.map +1 -1
- package/dist/cli/engagementFile.d.ts +2 -0
- package/dist/cli/engagementFile.js +5 -3
- package/dist/cli/engagementFile.js.map +1 -1
- package/dist/cli/findings.d.ts +2 -2
- package/dist/cli/findings.js +2 -2
- package/dist/cli/frontmatterSurgery.d.ts +3 -3
- package/dist/cli/frontmatterSurgery.js +3 -3
- package/dist/cli/frontmatterSurgery.js.map +1 -1
- package/dist/cli/markImplemented.d.ts +23 -18
- package/dist/cli/markImplemented.js +99 -15
- package/dist/cli/markImplemented.js.map +1 -1
- package/dist/cli/ratify.d.ts +36 -6
- package/dist/cli/ratify.js +130 -35
- package/dist/cli/ratify.js.map +1 -1
- package/dist/cli/review.js +3 -3
- package/dist/cli/review.js.map +1 -1
- package/dist/cli/revise.d.ts +67 -0
- package/dist/cli/revise.js +229 -0
- package/dist/cli/revise.js.map +1 -0
- package/dist/cli/sliceConform.d.ts +4 -3
- package/dist/cli/sliceConform.js +29 -12
- package/dist/cli/sliceConform.js.map +1 -1
- package/dist/cli/status.d.ts +30 -6
- package/dist/cli/status.js +59 -19
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/upgrade.js +17 -12
- package/dist/cli/upgrade.js.map +1 -1
- package/dist/cli.js +173 -85
- package/dist/cli.js.map +1 -1
- package/dist/emit/engagementJson.d.ts +7 -4
- package/dist/emit/engagementJson.js +11 -4
- package/dist/emit/engagementJson.js.map +1 -1
- package/dist/emit/json.d.ts +1 -1
- package/dist/emit/json.js +18 -5
- package/dist/emit/json.js.map +1 -1
- package/dist/emit/statusJson.d.ts +1 -1
- package/dist/emit/statusJson.js +6 -1
- package/dist/emit/statusJson.js.map +1 -1
- package/dist/mcp/server.js +5 -5
- package/dist/mcp/server.js.map +1 -1
- package/dist/model/continuation.d.ts +11 -1
- package/dist/model/continuation.js +29 -0
- package/dist/model/continuation.js.map +1 -1
- package/dist/model/resolveSlice.d.ts +19 -0
- package/dist/model/resolveSlice.js +69 -0
- package/dist/model/resolveSlice.js.map +1 -0
- package/dist/model/rules.d.ts +8 -0
- package/dist/model/rules.js +8 -0
- package/dist/model/rules.js.map +1 -1
- package/dist/model/sliceDocIndex.d.ts +5 -0
- package/dist/model/sliceDocIndex.js +6 -4
- package/dist/model/sliceDocIndex.js.map +1 -1
- package/dist/model/validate.js +5 -2
- package/dist/model/validate.js.map +1 -1
- package/dist/parser/parser.js +55 -1
- package/dist/parser/parser.js.map +1 -1
- package/dist/templates.d.ts +1 -1
- package/dist/templates.js +5 -7
- package/dist/templates.js.map +1 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +2 -2
- package/plugin/agents/em-implementer.md +12 -2
- package/plugin/agents/em-validator.md +2 -1
- package/plugin/shared/reference/em-dsl.md +234 -228
- package/plugin/shared/reference/operating-principles.md +3 -3
- package/plugin/shared/reference/slice-doc-schema.md +69 -27
- package/plugin/shared/templates/constitution.md +5 -7
- package/plugin/skills/conform/SKILL.md +1 -1
- package/plugin/skills/design/SKILL.md +29 -18
- package/plugin/skills/discover/SKILL.md +1 -1
- package/plugin/skills/engagement/SKILL.md +60 -56
- package/plugin/skills/engagement/reference/engagement.md +13 -19
- package/plugin/skills/event-modeling/SKILL.md +3 -3
- package/plugin/skills/implement/SKILL.md +3 -3
- package/plugin/skills/implement/reference/implement.md +40 -27
- package/plugin/skills/review/SKILL.md +13 -3
- package/dist/cli/reratify.d.ts +0 -58
- package/dist/cli/reratify.js +0 -238
- package/dist/cli/reratify.js.map +0 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// `em slice revise` (MIL-283): open the next version of a slice doc as a real `draft`. This is
|
|
3
|
+
// what `em slice reratify` (MIL-161/258, now a deprecated alias) always meant but never did: it
|
|
4
|
+
// bumped `version:` and left the doc at `status: ready-to-implement` with the sign-off cleared —
|
|
5
|
+
// a status that lied (unsigned), which MIL-258/259 then had to special-case everywhere. Since
|
|
6
|
+
// 1.15.0 the shipped version lives in the shipped record (`shippedVersion:`/`shippedRef:`/
|
|
7
|
+
// `shippedOn:` + `implementedIn:`, MIL-284 — `shippedRecordOf` in catalog/sliceDoc.ts), so
|
|
8
|
+
// `status` is free to say what the WORKING copy is: a draft of v<N+1>, which then takes the same
|
|
9
|
+
// two human gates v1 took (`em slice review --by`, `em slice ratify --by`). The MIL-201 carve-out
|
|
10
|
+
// that a reratified doc "needs no fresh review session" is gone with the state that needed it.
|
|
11
|
+
//
|
|
12
|
+
// Three starting states, one target (`status: draft`):
|
|
13
|
+
// - `shipped` — `status: implemented` (or any status with a shipped record): bump `version:`,
|
|
14
|
+
// materialise the shipped record if the doc predates 1.15 (so flipping the status
|
|
15
|
+
// away from `implemented` does not lose the fact that v<N> shipped), clear the
|
|
16
|
+
// sign-off, re-open the questions deferred to the new version.
|
|
17
|
+
// - `unshipped` — `status: ready-to-implement` WITH `ratifiedBy:` (ratified, never shipped — the
|
|
18
|
+
// implementer hit a gap, the doc must change): bump `version:`, clear the
|
|
19
|
+
// sign-off. The ratification of v<N> is withdrawn; v<N> never shipped.
|
|
20
|
+
// - `unsigned` — `status: ready-to-implement` with NO `ratifiedBy:`: the 1.13.1–1.14.x reratify
|
|
21
|
+
// leftover. Nothing was signed at this version, so `version:` stays and only the
|
|
22
|
+
// status moves — the exit path for a doc stuck in a state that no longer exists.
|
|
23
|
+
// - `draft`/`reviewed` refuse: the next version is already open; just edit it.
|
|
24
|
+
//
|
|
25
|
+
// Sign-off keys cleared: `ratifiedBy`/`ratifiedOn`/`ratifiedRef`/`ratifiedHash` (MIL-165/284),
|
|
26
|
+
// `reviewedBy`/`reviewedOn` (MIL-201), `meaningConfirmed`/`contractChange` (MIL-238) — every one
|
|
27
|
+
// describes the version being left behind. `implementedIn:`, the `shipped*` keys and the
|
|
28
|
+
// `conformed*` keys stay: they describe the version that shipped, which is still the version in
|
|
29
|
+
// production. The API-first confirmation (MIL-238) is no longer taken here — it belongs to the
|
|
30
|
+
// ratification of the new version, where `em slice ratify` already requires it on a
|
|
31
|
+
// public-touching slice. Never touches the body except to re-open deferred questions (MIL-275).
|
|
32
|
+
//
|
|
33
|
+
// `em slice mark-implemented` reuses `openNextDraft` to open v<N+1> at merge time when a question
|
|
34
|
+
// is deferred to it (MIL-283's "the draft is ready for continued work"), and only then — a
|
|
35
|
+
// merged slice with nothing deferred stays `implemented` until someone runs this command.
|
|
36
|
+
//
|
|
37
|
+
// GH #236: `unshipped` refuses without `--withdraw` — it ends the ratification of the only
|
|
38
|
+
// implementable version. A question found mid-build is queued by `em slice defer` instead
|
|
39
|
+
// (cli/defer.ts), and every queued question for v<N+1> is injected into the draft this opens
|
|
40
|
+
// (here and in `mark-implemented`'s auto-open), then cleared from the state file.
|
|
41
|
+
//
|
|
42
|
+
// Write strategy: surgical splices over the frontmatter text (frontmatterSurgery.ts), same as
|
|
43
|
+
// every other lifecycle writer; the body is copied through verbatim.
|
|
44
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
45
|
+
import { join } from "node:path";
|
|
46
|
+
import { continuationOf } from "../model/continuation.js";
|
|
47
|
+
import { resolveSliceDocJoin } from "../catalog/docJoin.js";
|
|
48
|
+
import { fieldLineRegex, fieldLineWithEolRegex, locateFrontmatterInner, normalizeFieldValue } from "./frontmatterSurgery.js";
|
|
49
|
+
import { listAllFindingsFiles, unruledFindingsInScope } from "./findings.js";
|
|
50
|
+
import { MEANING_CONFIRMATION_KEYS } from "./ratify.js";
|
|
51
|
+
import { clearQueue, injectQueuedQuestions, readQueue, reopenDeferred } from "./defer.js";
|
|
52
|
+
const DRAFT_STATUS = "draft";
|
|
53
|
+
const RATIFIED_STATUS = "ready-to-implement";
|
|
54
|
+
const IMPLEMENTED_STATUS = "implemented";
|
|
55
|
+
/** Every key that describes the version being left behind — cleared on every path that bumps. */
|
|
56
|
+
export const SIGN_OFF_KEYS = [
|
|
57
|
+
"ratifiedBy",
|
|
58
|
+
"ratifiedOn",
|
|
59
|
+
"ratifiedRef",
|
|
60
|
+
"ratifiedHash",
|
|
61
|
+
"reviewedBy",
|
|
62
|
+
"reviewedOn",
|
|
63
|
+
...MEANING_CONFIRMATION_KEYS,
|
|
64
|
+
];
|
|
65
|
+
/**
|
|
66
|
+
* Pure: the shipped → draft transition shared by `revise` and `mark-implemented`'s auto-open.
|
|
67
|
+
* Bumps `version:`, writes `shippedVersion:` (and `shippedRef:` from `ratifiedRef:`) when the
|
|
68
|
+
* doc has none yet, flips `status:` to `draft`, clears the sign-off keys and re-opens the
|
|
69
|
+
* questions deferred to the new version. Refuses a doc whose `version:` is not a positive
|
|
70
|
+
* integer. `raw` is the whole doc.
|
|
71
|
+
*/
|
|
72
|
+
export function openNextDraft(raw, opts = {}) {
|
|
73
|
+
return applyRevise(raw, "shipped", opts);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Pure: classifies the doc's starting state (see module header) and applies the matching
|
|
77
|
+
* transition. Refuses `draft`/`reviewed` (already open) and anything unrecognised.
|
|
78
|
+
*/
|
|
79
|
+
export function applyReviseFrontmatter(raw, opts = {}) {
|
|
80
|
+
const range = locateFrontmatterInner(raw);
|
|
81
|
+
if (!range)
|
|
82
|
+
return { ok: false, message: "no frontmatter block found" };
|
|
83
|
+
const inner = raw.slice(range.innerStart, range.innerEnd);
|
|
84
|
+
const statusMatch = fieldLineRegex("status").exec(inner);
|
|
85
|
+
if (!statusMatch)
|
|
86
|
+
return { ok: false, message: "no `status:` field found in frontmatter" };
|
|
87
|
+
const currentStatus = normalizeFieldValue(statusMatch[2])?.toLowerCase() ?? null;
|
|
88
|
+
const shippedVersionMatch = fieldLineRegex("shippedVersion").exec(inner);
|
|
89
|
+
const hasShipped = currentStatus === IMPLEMENTED_STATUS || (shippedVersionMatch !== null && normalizeFieldValue(shippedVersionMatch[2]) !== null);
|
|
90
|
+
const ratifiedByMatch = fieldLineRegex("ratifiedBy").exec(inner);
|
|
91
|
+
const hasRatifiedBy = ratifiedByMatch !== null && normalizeFieldValue(ratifiedByMatch[2]) !== null;
|
|
92
|
+
if (currentStatus === IMPLEMENTED_STATUS)
|
|
93
|
+
return applyRevise(raw, "shipped", opts);
|
|
94
|
+
if (currentStatus === RATIFIED_STATUS && hasRatifiedBy && !hasShipped && !opts.withdraw) {
|
|
95
|
+
// GH #236: a ratified, never-shipped doc is the ONLY implementable version of the slice;
|
|
96
|
+
// revising it withdraws that. A question found mid-build does not need this — it is queued.
|
|
97
|
+
return {
|
|
98
|
+
ok: false,
|
|
99
|
+
message: "doc is ratified and has never shipped — revising it would withdraw the ratification of the only implementable " +
|
|
100
|
+
"version. To record a question found mid-build, queue it instead (the ratification stays valid): " +
|
|
101
|
+
'`em slice defer <model> <key> "<question>" --until v<n> --decision "<what this version does>"`. ' +
|
|
102
|
+
"If the spec itself must change, pass --withdraw to open the next version as a draft",
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (currentStatus === RATIFIED_STATUS)
|
|
106
|
+
return applyRevise(raw, hasRatifiedBy ? "unshipped" : "unsigned", opts);
|
|
107
|
+
if (currentStatus === DRAFT_STATUS || currentStatus === "reviewed") {
|
|
108
|
+
return {
|
|
109
|
+
ok: false,
|
|
110
|
+
message: `doc is \`status: ${currentStatus}\` — the next version is already open${hasShipped ? " over the shipped one" : ""}; ` +
|
|
111
|
+
"edit it, then `em slice review --by` and `em slice ratify --by` when it is ready",
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
ok: false,
|
|
116
|
+
message: `doc is \`status: ${currentStatus ?? "(empty)"}\` — revise applies to a shipped slice doc (\`status: implemented\`) ` +
|
|
117
|
+
"or a ratified `ready-to-implement` doc (see docs/slice-doc-schema.md#status-under-re-ratification)",
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function applyRevise(raw, kind, opts = {}) {
|
|
121
|
+
const range = locateFrontmatterInner(raw);
|
|
122
|
+
if (!range)
|
|
123
|
+
return { ok: false, message: "no frontmatter block found" };
|
|
124
|
+
const inner = raw.slice(range.innerStart, range.innerEnd);
|
|
125
|
+
const versionMatch = fieldLineRegex("version").exec(inner);
|
|
126
|
+
if (!versionMatch)
|
|
127
|
+
return { ok: false, message: "no `version:` field found in frontmatter" };
|
|
128
|
+
const currentVersionRaw = normalizeFieldValue(versionMatch[2]);
|
|
129
|
+
const currentVersion = currentVersionRaw !== null ? Number(currentVersionRaw) : NaN;
|
|
130
|
+
if (!Number.isInteger(currentVersion) || currentVersion < 1) {
|
|
131
|
+
return {
|
|
132
|
+
ok: false,
|
|
133
|
+
message: `doc's \`version:\` value "${currentVersionRaw ?? ""}" isn't a positive integer — refusing to guess a bump`,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const newVersion = kind === "unsigned" ? currentVersion : currentVersion + 1;
|
|
137
|
+
// Materialise the shipped record on a pre-1.15 doc BEFORE the status leaves `implemented`,
|
|
138
|
+
// otherwise `shippedRecordOf`'s read-both rule would forget that v<N> shipped. Inserted right
|
|
139
|
+
// after `implementedIn:` when present (where mark-implemented puts it), else after `version:`.
|
|
140
|
+
let working = inner;
|
|
141
|
+
if (kind === "shipped" && !fieldLineRegex("shippedVersion").exec(working)) {
|
|
142
|
+
const refMatch = fieldLineRegex("ratifiedRef").exec(working);
|
|
143
|
+
const ref = refMatch ? normalizeFieldValue(refMatch[2]) : null;
|
|
144
|
+
const lines = [`shippedVersion: ${currentVersion}`, ...(ref !== null ? [`shippedRef: ${ref}`] : [])];
|
|
145
|
+
const anchor = fieldLineRegex("implementedIn").exec(working) ?? fieldLineRegex("version").exec(working);
|
|
146
|
+
const after = working.slice(anchor.index + anchor[0].length);
|
|
147
|
+
const eol = after.startsWith("\r\n") ? "\r\n" : "\n";
|
|
148
|
+
working = working.slice(0, anchor.index) + anchor[0] + eol + lines.join(eol) + after;
|
|
149
|
+
}
|
|
150
|
+
// Clear the sign-off keys (nothing to clear on the unsigned path, but harmless). Done before
|
|
151
|
+
// re-locating `status:`/`version:`, which these keys are disjoint from by construction.
|
|
152
|
+
let cleared = working;
|
|
153
|
+
if (kind !== "unsigned") {
|
|
154
|
+
for (const key of SIGN_OFF_KEYS)
|
|
155
|
+
cleared = cleared.replace(fieldLineWithEolRegex(key), "");
|
|
156
|
+
}
|
|
157
|
+
const clearedStatus = fieldLineRegex("status").exec(cleared);
|
|
158
|
+
const clearedVersion = fieldLineRegex("version").exec(cleared);
|
|
159
|
+
const edits = [
|
|
160
|
+
{ index: clearedStatus.index, oldLen: clearedStatus[0].length, next: `${clearedStatus[1]}${DRAFT_STATUS}` },
|
|
161
|
+
{ index: clearedVersion.index, oldLen: clearedVersion[0].length, next: `${clearedVersion[1]}${newVersion}` },
|
|
162
|
+
].sort((a, b) => b.index - a.index);
|
|
163
|
+
let updatedInner = cleared;
|
|
164
|
+
for (const edit of edits) {
|
|
165
|
+
updatedInner = updatedInner.slice(0, edit.index) + edit.next + updatedInner.slice(edit.index + edit.oldLen);
|
|
166
|
+
}
|
|
167
|
+
const content = raw.slice(0, range.innerStart) + updatedInner + raw.slice(range.innerEnd);
|
|
168
|
+
// MIL-275: questions deferred to the version this opens come back as `- [ ]`.
|
|
169
|
+
const reopened = kind === "unsigned" ? { content, count: 0 } : reopenDeferred(content, newVersion);
|
|
170
|
+
// GH #236: questions queued while the old version was ratified/shipped join the new draft.
|
|
171
|
+
const injected = kind === "unsigned" || !opts.queuedFor
|
|
172
|
+
? { content: reopened.content, count: 0 }
|
|
173
|
+
: injectQueuedQuestions(reopened.content, opts.queuedFor(newVersion));
|
|
174
|
+
return { ok: true, content: injected.content, newVersion, kind, reopened: reopened.count, injected: injected.count };
|
|
175
|
+
}
|
|
176
|
+
export function reviseAdvisory(baseDir, sliceKey, shippedVersion, conformedVersion) {
|
|
177
|
+
const neverCertified = conformedVersion === null || conformedVersion !== shippedVersion;
|
|
178
|
+
let unruledFindingsCount = 0;
|
|
179
|
+
for (const { doc } of listAllFindingsFiles(baseDir)) {
|
|
180
|
+
unruledFindingsCount += unruledFindingsInScope(doc.findings, new Set([sliceKey])).length;
|
|
181
|
+
}
|
|
182
|
+
return { neverCertified, unruledFindingsCount };
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Resolves `sliceKey` to its bound doc via the same note-binding join `mark-implemented`/
|
|
186
|
+
* `ratify`/`--slice-ready`/`em export` use (MIL-121 cross-binding included), then reads/applies/
|
|
187
|
+
* writes it. `baseDir` is the `.em` file's directory.
|
|
188
|
+
*/
|
|
189
|
+
export function runRevise(model, refs, baseDir, sliceKey, withdraw = false) {
|
|
190
|
+
const sliceIndex = refs.sliceKeys.indexOf(sliceKey);
|
|
191
|
+
if (sliceIndex === -1)
|
|
192
|
+
return { ok: false, message: `no slice with export key "${sliceKey}" in this model` };
|
|
193
|
+
const slice = model.slices[sliceIndex];
|
|
194
|
+
const { doc, continuationOf: continuationOfKey } = resolveSliceDocJoin(model, refs, slice, sliceKey, baseDir, (id) => refs.refById.get(id));
|
|
195
|
+
if (continuationOfKey) {
|
|
196
|
+
const continuation = continuationOf(model, refs, sliceIndex);
|
|
197
|
+
const viewName = model.byId.get(continuation.viewLogicalId).name;
|
|
198
|
+
return {
|
|
199
|
+
ok: false,
|
|
200
|
+
message: `"${sliceKey}" is a continuation of "${continuationOfKey}" (view "${viewName}" again) — ` +
|
|
201
|
+
`it has no doc of its own; revise "${continuationOfKey}" instead`,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
if (doc.reason === "no-doc-bound") {
|
|
205
|
+
return {
|
|
206
|
+
ok: false,
|
|
207
|
+
message: `slice "${sliceKey}" has no doc bound via \`note "slices/${sliceKey}.md"\` — bind a slice doc before revising it`,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
if (doc.reason === "binding-missing-file") {
|
|
211
|
+
return { ok: false, message: `slice "${sliceKey}" notes "${doc.path}" but no such file exists` };
|
|
212
|
+
}
|
|
213
|
+
if (doc.reason === "frontmatter-invalid") {
|
|
214
|
+
return { ok: false, message: `slice doc "${doc.path}" has missing or invalid frontmatter — run \`em validate\` for details` };
|
|
215
|
+
}
|
|
216
|
+
const absPath = join(baseDir, doc.path);
|
|
217
|
+
const raw = readFileSync(absPath, "utf8");
|
|
218
|
+
const result = applyReviseFrontmatter(raw, { withdraw, queuedFor: (v) => readQueue(baseDir, sliceKey, v).items });
|
|
219
|
+
if (!result.ok)
|
|
220
|
+
return { ok: false, message: `${doc.path}: ${result.message}` };
|
|
221
|
+
// MIL-214: "was the version we are leaving behind ever certified" — only meaningful when one
|
|
222
|
+
// shipped. Computed from the pre-write join.
|
|
223
|
+
const advisory = result.kind === "shipped" ? reviseAdvisory(baseDir, sliceKey, doc.shipped?.version ?? doc.version, doc.conformedVersion) : null;
|
|
224
|
+
writeFileSync(absPath, result.content, "utf8");
|
|
225
|
+
if (result.injected > 0)
|
|
226
|
+
clearQueue(baseDir, sliceKey, result.newVersion);
|
|
227
|
+
return { ok: true, path: doc.path, newVersion: result.newVersion, kind: result.kind, advisory, reopened: result.reopened, injected: result.injected };
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=revise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revise.js","sourceRoot":"","sources":["../../src/cli/revise.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,+FAA+F;AAC/F,gGAAgG;AAChG,iGAAiG;AACjG,8FAA8F;AAC9F,2FAA2F;AAC3F,2FAA2F;AAC3F,iGAAiG;AACjG,kGAAkG;AAClG,+FAA+F;AAC/F,EAAE;AACF,uDAAuD;AACvD,iGAAiG;AACjG,mGAAmG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E,OAAO,EAAE,GAAG,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;IAChF,6FAA6F;IAC7F,6CAA6C;IAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,IAAI,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjJ,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/C,IAAI,MAAM,CAAC,QAAQ,GAAG,CAAC;QAAE,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAC1E,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,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;AACxJ,CAAC"}
|
|
@@ -11,8 +11,9 @@ export type ApplyConformResult = {
|
|
|
11
11
|
message: string;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
* Pure text transform: reads the
|
|
15
|
-
*
|
|
14
|
+
* Pure text transform: reads the SHIPPED version (`shippedVersion:`, else the doc's `version:`
|
|
15
|
+
* for a pre-1.15 `implemented` doc — the same read-both rule as `shippedRecordOf`; never writes
|
|
16
|
+
* either) and writes `conformedVersion:`/`conformedAt:`/`conformedOn:` in `raw`'s frontmatter block. See module
|
|
16
17
|
* header for the full precondition/idempotency contract. No fs access — the caller reads/writes;
|
|
17
18
|
* see `runSliceConform` below.
|
|
18
19
|
*/
|
|
@@ -42,7 +43,7 @@ export type RunSliceConformResult = {
|
|
|
42
43
|
message: string;
|
|
43
44
|
};
|
|
44
45
|
/**
|
|
45
|
-
* Resolves `sliceKey` to its bound doc via the same note-binding join `ratify`/`
|
|
46
|
+
* Resolves `sliceKey` to its bound doc via the same note-binding join `ratify`/`revise`/
|
|
46
47
|
* `mark-implemented`/`em export` use (MIL-121 cross-binding included), runs the findings-check
|
|
47
48
|
* gate, then reads/applies/writes it. `baseDir` is the `.em` file's directory, same convention
|
|
48
49
|
* every doc/note path in `em` uses.
|
package/dist/cli/sliceConform.js
CHANGED
|
@@ -6,18 +6,22 @@
|
|
|
6
6
|
// of this doc" — the gap the whole engagement (MIL-214) exists to close. Sets exactly three
|
|
7
7
|
// frontmatter fields — `conformedVersion: <doc.version>`, `conformedAt: <rev>`,
|
|
8
8
|
// `conformedOn: <local date>` — on the slice doc resolved from the key via the SAME note-binding
|
|
9
|
-
// resolution `ratify`/`
|
|
9
|
+
// resolution `ratify`/`revise`/`mark-implemented`/`em export` use (catalog/docJoin.ts's
|
|
10
10
|
// resolveSliceDocJoin).
|
|
11
11
|
//
|
|
12
12
|
// Write strategy: the same surgical index-math splicing ratify.ts/markImplemented.ts use, via
|
|
13
13
|
// the shared primitives in ./frontmatterSurgery.js — never a parse+re-serialize. New fields are
|
|
14
14
|
// inserted directly after `implementedIn:` (the anchor this ticket's ruling names) when none of
|
|
15
15
|
// the three exist yet; an existing triple is edited in place. Everything else — the body,
|
|
16
|
-
// `version:`
|
|
16
|
+
// `version:`/`shippedVersion:` themselves (read, never written), `status:`, lineage/`covers` keys, and (best-effort)
|
|
17
17
|
// the file's own line-ending style — is copied through verbatim.
|
|
18
18
|
//
|
|
19
19
|
// Preconditions (the owner's ruling, MIL-214):
|
|
20
|
-
// - Legal only for
|
|
20
|
+
// - Legal only for a SHIPPED slice — a slice that hasn't shipped has no code to certify. Since
|
|
21
|
+
// MIL-283 "shipped" is the shipped record, not `status`: `status: implemented`, or any status
|
|
22
|
+
// with a `shippedVersion:` (a `draft` of v<N+1> opened over a shipped v<N> still has v<N>'s
|
|
23
|
+
// code to certify — the auto-open at merge would otherwise leave it in conformance scope but
|
|
24
|
+
// uncertifiable). `conformedVersion:` is the SHIPPED version, never the open draft's.
|
|
21
25
|
// - Refuses when there's no `implementedIn:` link at all (the OLD, pre-MIL-214
|
|
22
26
|
// driftSignal-would-be-"in-sync" precondition, computed directly from status+implementedIn
|
|
23
27
|
// here rather than via classifyImplementationDrift — that function is now conformedVersion-
|
|
@@ -43,8 +47,9 @@ import { fieldLineRegex, locateFrontmatterInner, normalizeFieldValue } from "./f
|
|
|
43
47
|
import { isValidDateString } from "./stateFile.js";
|
|
44
48
|
import { listAllFindingsFiles, unruledFindingsInScope } from "./findings.js";
|
|
45
49
|
/**
|
|
46
|
-
* Pure text transform: reads the
|
|
47
|
-
*
|
|
50
|
+
* Pure text transform: reads the SHIPPED version (`shippedVersion:`, else the doc's `version:`
|
|
51
|
+
* for a pre-1.15 `implemented` doc — the same read-both rule as `shippedRecordOf`; never writes
|
|
52
|
+
* either) and writes `conformedVersion:`/`conformedAt:`/`conformedOn:` in `raw`'s frontmatter block. See module
|
|
48
53
|
* header for the full precondition/idempotency contract. No fs access — the caller reads/writes;
|
|
49
54
|
* see `runSliceConform` below.
|
|
50
55
|
*/
|
|
@@ -66,26 +71,33 @@ export function applyConformFrontmatter(raw, sliceKey, at, on) {
|
|
|
66
71
|
if (!statusMatch)
|
|
67
72
|
return { ok: false, message: "no `status:` field found in frontmatter" };
|
|
68
73
|
const currentStatus = normalizeFieldValue(statusMatch[2])?.toLowerCase() ?? null;
|
|
69
|
-
|
|
74
|
+
const shippedVersionMatch = fieldLineRegex("shippedVersion").exec(inner);
|
|
75
|
+
const shippedVersionRaw = shippedVersionMatch ? normalizeFieldValue(shippedVersionMatch[2]) : null;
|
|
76
|
+
const isImplemented = currentStatus === "implemented";
|
|
77
|
+
if (!isImplemented && shippedVersionRaw === null) {
|
|
70
78
|
return {
|
|
71
79
|
ok: false,
|
|
72
|
-
message: `slice "${sliceKey}" is \`status: ${currentStatus ?? "(empty)"}\` — only a
|
|
73
|
-
"`status: implemented` can be certified; run `em slice mark-implemented` first",
|
|
80
|
+
message: `slice "${sliceKey}" is \`status: ${currentStatus ?? "(empty)"}\` with no shipped record — only a shipped ` +
|
|
81
|
+
"slice (`status: implemented`, or any status with `shippedVersion:`) can be certified; run `em slice mark-implemented` first",
|
|
74
82
|
};
|
|
75
83
|
}
|
|
84
|
+
const shippedAs = isImplemented ? "`status: implemented`" : `\`shippedVersion: ${shippedVersionRaw}\``;
|
|
76
85
|
const implMatch = fieldLineRegex("implementedIn").exec(inner);
|
|
77
86
|
const currentImplementedIn = implMatch ? normalizeFieldValue(implMatch[2]) : null;
|
|
78
87
|
if (currentImplementedIn === null) {
|
|
79
88
|
return {
|
|
80
89
|
ok: false,
|
|
81
|
-
message: `slice "${sliceKey}" has
|
|
90
|
+
message: `slice "${sliceKey}" has ${shippedAs} but no \`implementedIn:\` link — nothing to certify against`,
|
|
82
91
|
};
|
|
83
92
|
}
|
|
93
|
+
// The shipped version: `shippedVersion:` when the record exists, else (a doc shipped before
|
|
94
|
+
// em 1.15) the doc's own `version:` — what `status: implemented` meant then.
|
|
84
95
|
const versionMatch = fieldLineRegex("version").exec(inner);
|
|
85
|
-
const
|
|
96
|
+
const versionKey = shippedVersionRaw !== null ? "shippedVersion" : "version";
|
|
97
|
+
const currentVersionRaw = shippedVersionRaw ?? (versionMatch ? normalizeFieldValue(versionMatch[2]) : null);
|
|
86
98
|
const version = currentVersionRaw !== null ? Number(currentVersionRaw) : NaN;
|
|
87
99
|
if (!Number.isInteger(version) || version < 1) {
|
|
88
|
-
return { ok: false, message: `doc's
|
|
100
|
+
return { ok: false, message: `doc's \`${versionKey}:\` value "${currentVersionRaw ?? ""}" isn't a positive integer — refusing to certify` };
|
|
89
101
|
}
|
|
90
102
|
const cvMatch = fieldLineRegex("conformedVersion").exec(inner);
|
|
91
103
|
const caMatch = fieldLineRegex("conformedAt").exec(inner);
|
|
@@ -139,7 +151,7 @@ export function findLatestFindingsForRevision(baseDir, at) {
|
|
|
139
151
|
return listAllFindingsFiles(baseDir).find((f) => f.doc.revision === at) ?? null;
|
|
140
152
|
}
|
|
141
153
|
/**
|
|
142
|
-
* Resolves `sliceKey` to its bound doc via the same note-binding join `ratify`/`
|
|
154
|
+
* Resolves `sliceKey` to its bound doc via the same note-binding join `ratify`/`revise`/
|
|
143
155
|
* `mark-implemented`/`em export` use (MIL-121 cross-binding included), runs the findings-check
|
|
144
156
|
* gate, then reads/applies/writes it. `baseDir` is the `.em` file's directory, same convention
|
|
145
157
|
* every doc/note path in `em` uses.
|
|
@@ -176,6 +188,11 @@ export function runSliceConform(model, refs, baseDir, sliceKey, at, on, skipFind
|
|
|
176
188
|
message: `slice doc "${doc.path}" has missing or invalid frontmatter — run \`em validate\` for details`,
|
|
177
189
|
};
|
|
178
190
|
}
|
|
191
|
+
// `--at` stays required (MIL-284 review): it is the TARGET repo's revision the sweep diffed
|
|
192
|
+
// against — the findings-check gate below keys on it — while `ratifiedRef`/`shippedRef` are
|
|
193
|
+
// the MODEL repo's commit at sign-off, before any implementation existed. Defaulting one to
|
|
194
|
+
// the other would certify against a tree holding no code for the slice and let the gate pass
|
|
195
|
+
// vacuously (no findings file for that revision).
|
|
179
196
|
const found = findLatestFindingsForRevision(baseDir, at);
|
|
180
197
|
let skippedFindingsCheck = null;
|
|
181
198
|
if (found) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliceConform.js","sourceRoot":"","sources":["../../src/cli/sliceConform.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,+FAA+F;AAC/F,8FAA8F;AAC9F,4FAA4F;AAC5F,iGAAiG;AACjG,4FAA4F;AAC5F,gFAAgF;AAChF,iGAAiG;AACjG,
|
|
1
|
+
{"version":3,"file":"sliceConform.js","sourceRoot":"","sources":["../../src/cli/sliceConform.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,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KAAK,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;IAClE,CAAC;IACD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAC9G,CAAC"}
|
package/dist/cli/status.d.ts
CHANGED
|
@@ -35,6 +35,9 @@ export interface SliceStatusFact {
|
|
|
35
35
|
* covered slice. */
|
|
36
36
|
docPath: string | null;
|
|
37
37
|
rawStatus: string | null;
|
|
38
|
+
/** MIL-283: a version of this slice has shipped (`doc.shipped`, the shipped record) — the fact
|
|
39
|
+
* conformance scope and `byStatus.shipped` read; `rawStatus`/`bucket` stay the WORKING status. */
|
|
40
|
+
shipped: boolean;
|
|
38
41
|
/** The doc's own `implementedIn:` value verbatim (or null) — carried through from the same
|
|
39
42
|
* `resolveSliceDocJoin` call this fact set already makes, so `resolveSlicePRsBehindHead`
|
|
40
43
|
* (MIL-164) can build its `SliceDocFacts[]` input from these facts directly rather than
|
|
@@ -48,6 +51,8 @@ export interface SliceStatusFact {
|
|
|
48
51
|
driftSignal: DriftSignalKind | null;
|
|
49
52
|
openQuestionsTotal: number;
|
|
50
53
|
openQuestionsUnchecked: number;
|
|
54
|
+
/** GH #236: questions `em slice defer` queued for this slice's next version (0 when none). */
|
|
55
|
+
queuedForNext: number;
|
|
51
56
|
/** MIL-208: non-null when this slice is a continuation (an again-view-only slice with no
|
|
52
57
|
* legacy doc of its own) — the originating slice's export key. `buildStatusReport` excludes
|
|
53
58
|
* a continuation fact from every `byStatus`/`driftSignal` bucket (the originating slice's own
|
|
@@ -141,13 +146,23 @@ export interface ConstitutionEntry {
|
|
|
141
146
|
* root. Directory existence only; nothing inside `.specify/` is read. */
|
|
142
147
|
export declare function findSpecifyRoot(startDir: string): string | null;
|
|
143
148
|
/**
|
|
144
|
-
*
|
|
145
|
-
* em
|
|
149
|
+
* Every place a model's implementation constitution may live, in precedence order (MIL-202,
|
|
150
|
+
* MIL-287). The one locator for `em status`, `em upgrade` and anything else asking "where is it":
|
|
146
151
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
152
|
+
* 1. **spec-kit slot**, when a `.specify/` directory exists at or above `modelDir`:
|
|
153
|
+
* `<root>/.specify/memory/constitution.md`. It wins whenever it exists — em never keeps a
|
|
154
|
+
* second copy beside it.
|
|
155
|
+
* 2. **beside the model**: `<modelDir>/constitution.md` — what `em scaffold` writes, and the
|
|
156
|
+
* fallback in a spec-kit repo whose own slot is empty (a repo-root constitution symlinked
|
|
157
|
+
* next to the model, say).
|
|
158
|
+
*/
|
|
159
|
+
export declare function constitutionCandidates(modelDir: string): string[];
|
|
160
|
+
/** The absolute path of the model's constitution, or null when no candidate exists. */
|
|
161
|
+
export declare function locateConstitution(modelDir: string): string | null;
|
|
162
|
+
/**
|
|
163
|
+
* Resolve one model's implementation constitution (MIL-202, MIL-287) — see
|
|
164
|
+
* `constitutionCandidates` for where it looks. `path` is where it was found, else the first
|
|
165
|
+
* (primary) location tried; relative to `modelDir`.
|
|
151
166
|
*
|
|
152
167
|
* Existence only: this never opens the file, so a blank stock template and a fully answered,
|
|
153
168
|
* ratified constitution are indistinguishable here by design (content judgment is a human's, and
|
|
@@ -255,7 +270,12 @@ export interface StatusSliceCounts {
|
|
|
255
270
|
draft: number;
|
|
256
271
|
reviewed: number;
|
|
257
272
|
readyToImplement: number;
|
|
273
|
+
/** Working status `implemented` — the doc's current version is the shipped one. */
|
|
258
274
|
implemented: number;
|
|
275
|
+
/** MIL-283: slices with a shipped record (any working status) — `implemented` plus every slice
|
|
276
|
+
* whose next version is open as `draft`/`reviewed`/`ready-to-implement` over a shipped one.
|
|
277
|
+
* Added in status schema 1.9; always >= `implemented`. */
|
|
278
|
+
shipped: number;
|
|
259
279
|
noDoc: number;
|
|
260
280
|
/** A doc IS bound (a `note` names it) but its frontmatter is missing/malformed — see
|
|
261
281
|
* `StatusBucket`'s `"frontmatter-invalid"` doc comment. Kept apart from `noDoc` (nothing
|
|
@@ -296,6 +316,10 @@ export interface StatusIssueTotals {
|
|
|
296
316
|
openIssues: number;
|
|
297
317
|
openQuestionsTotal: number;
|
|
298
318
|
openQuestionsUnchecked: number;
|
|
319
|
+
/** GH #236 (status schema 1.10): questions queued by `em slice defer` on ratified/shipped docs
|
|
320
|
+
* for their next version — known work the docs themselves cannot show without breaking their
|
|
321
|
+
* sign-off. */
|
|
322
|
+
queuedQuestions: number;
|
|
299
323
|
}
|
|
300
324
|
/** One doc-join diagnostic, tagged with the input file it came from — `em status` can aggregate
|
|
301
325
|
* several models in one run, so (unlike `em export`'s single-model diagnostics) each entry
|