@deftai/directive-core 0.108.0 → 0.109.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/dist/cache/operations.js +1 -1
- package/dist/check/gate-lists.d.ts +14 -0
- package/dist/check/gate-lists.js +26 -3
- package/dist/check/session-completed-ac.d.ts +1 -1
- package/dist/check/session-completed-ac.js +1 -1
- package/dist/consumer-check-contract/evaluate.d.ts +47 -0
- package/dist/consumer-check-contract/evaluate.js +181 -15
- package/dist/delivery-attempt/evaluate.d.ts +9 -1
- package/dist/delivery-attempt/evaluate.js +69 -0
- package/dist/delivery-attempt/index.d.ts +1 -1
- package/dist/delivery-attempt/index.js +1 -1
- package/dist/deposit/live-procedure-exclusions.d.ts +18 -0
- package/dist/deposit/live-procedure-exclusions.js +110 -0
- package/dist/deposit/live-procedure-targets.d.ts +45 -0
- package/dist/deposit/live-procedure-targets.js +274 -0
- package/dist/deposit/python-free.d.ts +6 -0
- package/dist/deposit/python-free.js +15 -0
- package/dist/deposit/rewrite-deposit-links.d.ts +42 -0
- package/dist/deposit/rewrite-deposit-links.js +148 -0
- package/dist/deposit/run-stage-content-pack.d.ts +2 -0
- package/dist/deposit/run-stage-content-pack.js +3 -0
- package/dist/deposit/stage-content-pack.d.ts +17 -0
- package/dist/deposit/stage-content-pack.js +91 -0
- package/dist/design-critique/citation-grammar.d.ts +7 -0
- package/dist/design-critique/citation-grammar.js +1 -1
- package/dist/design-critique/completed-arc-record.d.ts +1 -1
- package/dist/design-critique/completed-arc-record.js +59 -14
- package/dist/hooks/classify/host-session-identity.d.ts +24 -11
- package/dist/hooks/classify/host-session-identity.js +46 -49
- package/dist/hooks/classify/index.d.ts +2 -2
- package/dist/hooks/classify/index.js +2 -2
- package/dist/hooks/classify/paths.d.ts +2 -0
- package/dist/hooks/classify/paths.js +8 -4
- package/dist/hooks/classify/stdin.js +69 -3
- package/dist/hooks/dest-form.d.ts +20 -1
- package/dist/hooks/dest-form.js +158 -21
- package/dist/hooks/dispatcher.d.ts +6 -2
- package/dist/hooks/dispatcher.js +258 -62
- package/dist/hooks/fixtures/cases.d.ts +6 -0
- package/dist/hooks/fixtures/cases.js +53 -0
- package/dist/hooks/git-destructive-log.d.ts +32 -0
- package/dist/hooks/git-destructive-log.js +46 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/shell-write-targets.d.ts +10 -0
- package/dist/hooks/shell-write-targets.js +274 -0
- package/dist/hooks/tools.d.ts +20 -2
- package/dist/hooks/tools.js +30 -1
- package/dist/init-deposit/gitignore.d.ts +7 -0
- package/dist/init-deposit/gitignore.js +24 -0
- package/dist/init-deposit/init-deposit.js +3 -0
- package/dist/init-deposit/refresh.js +7 -0
- package/dist/init-deposit/runtime-writers.d.ts +14 -0
- package/dist/init-deposit/runtime-writers.js +33 -0
- package/dist/intake/issue-ingest.d.ts +6 -1
- package/dist/intake/issue-ingest.js +21 -2
- package/dist/intake/reconcile-issues.js +13 -13
- package/dist/lifecycle/brief-envelope.d.ts +25 -0
- package/dist/lifecycle/brief-envelope.js +42 -0
- package/dist/lifecycle/index.d.ts +1 -0
- package/dist/lifecycle/index.js +1 -0
- package/dist/literal-acceptance/evaluate.js +14 -5
- package/dist/literal-acceptance/index.d.ts +1 -1
- package/dist/literal-acceptance/index.js +1 -1
- package/dist/literal-acceptance/run.d.ts +2 -0
- package/dist/literal-acceptance/run.js +19 -1
- package/dist/orphan-active/candidate-scope.d.ts +53 -0
- package/dist/orphan-active/candidate-scope.js +157 -0
- package/dist/orphan-active/evaluate.d.ts +27 -0
- package/dist/orphan-active/evaluate.js +63 -6
- package/dist/orphan-active/index.d.ts +1 -0
- package/dist/orphan-active/index.js +1 -0
- package/dist/policy/merge-approval-head.js +7 -6
- package/dist/pr-closing-keywords/gh.js +32 -9
- package/dist/pr-closing-keywords/main.d.ts +1 -0
- package/dist/pr-closing-keywords/main.js +68 -3
- package/dist/pr-closing-keywords/types.d.ts +2 -0
- package/dist/pr-merge-readiness/gh.js +32 -9
- package/dist/pr-protected-issues/gh.js +36 -9
- package/dist/pr-wait-mergeable/wrappers.js +3 -3
- package/dist/product-first-done-gate/evaluate.js +6 -2
- package/dist/product-first-done-gate/types.js +2 -0
- package/dist/release/consumer-hard-stops.d.ts +48 -0
- package/dist/release/consumer-hard-stops.js +140 -0
- package/dist/release/consumer-readiness-disclosure.d.ts +18 -0
- package/dist/release/consumer-readiness-disclosure.js +51 -0
- package/dist/release/index.d.ts +2 -0
- package/dist/release/index.js +2 -0
- package/dist/release/pipeline.js +55 -0
- package/dist/release/run-consumer-readiness.d.ts +15 -0
- package/dist/release/run-consumer-readiness.js +24 -0
- package/dist/release/types.d.ts +6 -0
- package/dist/review-monitor/github-lease.js +4 -3
- package/dist/run-summary/types.d.ts +2 -2
- package/dist/scm/build-command.d.ts +2 -2
- package/dist/scm/build-command.js +2 -2
- package/dist/scm/call-shape.d.ts +25 -0
- package/dist/scm/call-shape.js +59 -0
- package/dist/scm/call.d.ts +7 -4
- package/dist/scm/call.js +41 -11
- package/dist/scm/gh-rest.d.ts +25 -12
- package/dist/scm/gh-rest.js +65 -15
- package/dist/scm/index.d.ts +2 -0
- package/dist/scm/index.js +2 -0
- package/dist/scm/spawn-status.d.ts +33 -0
- package/dist/scm/spawn-status.js +53 -0
- package/dist/scope/acceptance-evidence.d.ts +1 -1
- package/dist/scope/transition.js +4 -14
- package/dist/session/ac-pass-banking.d.ts +2 -2
- package/dist/session/ac-pass-banking.js +2 -2
- package/dist/session/host-session-owner.d.ts +53 -0
- package/dist/session/host-session-owner.js +89 -0
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.js +1 -0
- package/dist/session/occupancy.d.ts +21 -1
- package/dist/session/occupancy.js +70 -12
- package/dist/session/verify-ac-session-cache.d.ts +2 -2
- package/dist/session/verify-ac-session-cache.js +2 -2
- package/dist/triage/evaluate/worktrees.js +153 -6
- package/dist/umbrella-current-shape/index.d.ts +51 -3
- package/dist/umbrella-current-shape/index.js +106 -18
- package/dist/validate-content/deposit-required.d.ts +39 -0
- package/dist/validate-content/deposit-required.js +147 -0
- package/dist/validate-content/index.d.ts +1 -0
- package/dist/validate-content/index.js +1 -0
- package/dist/validate-content/validate-links.d.ts +2 -3
- package/dist/validate-content/validate-links.js +29 -2
- package/dist/vbrief-activate/activate.d.ts +7 -2
- package/dist/vbrief-activate/activate.js +26 -13
- package/dist/verify-ac/evaluate.d.ts +9 -0
- package/dist/verify-ac/evaluate.js +32 -9
- package/dist/verify-source/deposit-closure.d.ts +23 -0
- package/dist/verify-source/deposit-closure.js +162 -0
- package/dist/verify-source/index.d.ts +2 -0
- package/dist/verify-source/index.js +2 -0
- package/dist/verify-source/semantic-single-source.d.ts +36 -0
- package/dist/verify-source/semantic-single-source.js +349 -0
- package/package.json +3 -3
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C2 — semantic single-source conformance (#3600 / #3899).
|
|
3
|
+
*
|
|
4
|
+
* Shipped guidance must name one value where the framework has one value.
|
|
5
|
+
* The 0.6-versus-0.8 defect lives inside a file that resolves perfectly, so
|
|
6
|
+
* pointer existence (C1) cannot see it. This oracle is not a link checker.
|
|
7
|
+
*
|
|
8
|
+
* Evaluates a staged pack root (flattened consumer deposit) or a source
|
|
9
|
+
* checkout (content/ prefix + root main.md). Three-state: 0 clean / 1 drift / 2 config.
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
12
|
+
import { join, resolve } from "node:path";
|
|
13
|
+
const EXIT_OK = 0;
|
|
14
|
+
const EXIT_DRIFT = 1;
|
|
15
|
+
const EXIT_CONFIG = 2;
|
|
16
|
+
/** Closed, typed current-authoring surfaces (#3600 AC / #3899 C2). */
|
|
17
|
+
export const C2_AUTHORING_SURFACES = [
|
|
18
|
+
"main.md",
|
|
19
|
+
"skills/deft-directive-setup/SKILL.md",
|
|
20
|
+
"skills/deft-directive-build/SKILL.md",
|
|
21
|
+
"skills/deft-directive-interview/SKILL.md",
|
|
22
|
+
"skills/deft-directive-refinement/SKILL.md",
|
|
23
|
+
"skills/deft-directive-sync/SKILL.md",
|
|
24
|
+
"templates/project.md.template",
|
|
25
|
+
"templates/make-spec.md",
|
|
26
|
+
"conventions/references.md",
|
|
27
|
+
"commands.md",
|
|
28
|
+
];
|
|
29
|
+
const REQUIRED_SURFACES = [
|
|
30
|
+
"main.md",
|
|
31
|
+
"skills/deft-directive-setup/SKILL.md",
|
|
32
|
+
"skills/deft-directive-build/SKILL.md",
|
|
33
|
+
];
|
|
34
|
+
const ENVELOPE_CONTEXT_RE = /xBRIEFInfo|vBRIEFInfo|schema version|envelope|new write|new xBRIEF|new vBRIEF|MUST emit|MUST use|MUST target|MUST write|version field equal|authoring format|write-path|write default|write-default/i;
|
|
35
|
+
const QUOTED_VERSION_RE = /["'](0\.\d+)["']/g;
|
|
36
|
+
const BARE_XBRIEF_VERSION_RE = /\b(?:xBRIEF|vBRIEF|xbrief)\s+`?(0\.\d+)`?/g;
|
|
37
|
+
const LEGACY_BOUND_RE = /legacy|read-accepted|read\/migration|migrate:xbrief|historical|until `?deft migrate|deprecated|compatibility only|read compatibility|obsolete 0\.5|migration\/read|read-only/i;
|
|
38
|
+
const MUST_NOT_RE = /^\s*(?:[-*]\s*)?⊗/;
|
|
39
|
+
const MUST_LINE_RE = /^\s*(?:[-*]\s*)?!|\bMUST\b/;
|
|
40
|
+
const CANONICAL_HEADING_RE = /schema version:\s*v?(0\.\d+)\s*\(canonical/i;
|
|
41
|
+
const ALL_BRIEFS_MUST_RE = /All (?:x|v)BRIEFs/i;
|
|
42
|
+
function normalizeText(text) {
|
|
43
|
+
return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a closed-list surface against a flattened pack root or a source
|
|
47
|
+
* checkout (content/ prefix for everything except root harness main.md).
|
|
48
|
+
*/
|
|
49
|
+
export function resolveAuthoringSurface(packRoot, rel) {
|
|
50
|
+
const root = resolve(packRoot);
|
|
51
|
+
const flat = join(root, rel);
|
|
52
|
+
if (existsSync(flat)) {
|
|
53
|
+
return flat;
|
|
54
|
+
}
|
|
55
|
+
if (rel !== "main.md") {
|
|
56
|
+
const underContent = join(root, "content", rel);
|
|
57
|
+
if (existsSync(underContent)) {
|
|
58
|
+
return underContent;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
export function extractQuotedVersions(line) {
|
|
64
|
+
const found = [];
|
|
65
|
+
QUOTED_VERSION_RE.lastIndex = 0;
|
|
66
|
+
for (const match of line.matchAll(QUOTED_VERSION_RE)) {
|
|
67
|
+
const v = match[1];
|
|
68
|
+
if (v !== undefined)
|
|
69
|
+
found.push(v);
|
|
70
|
+
}
|
|
71
|
+
BARE_XBRIEF_VERSION_RE.lastIndex = 0;
|
|
72
|
+
for (const match of line.matchAll(BARE_XBRIEF_VERSION_RE)) {
|
|
73
|
+
const v = match[1];
|
|
74
|
+
if (v !== undefined)
|
|
75
|
+
found.push(v);
|
|
76
|
+
}
|
|
77
|
+
const heading = CANONICAL_HEADING_RE.exec(line);
|
|
78
|
+
if (heading?.[1] !== undefined) {
|
|
79
|
+
found.push(heading[1]);
|
|
80
|
+
}
|
|
81
|
+
return found;
|
|
82
|
+
}
|
|
83
|
+
function isWriteMandateLine(line) {
|
|
84
|
+
if (MUST_NOT_RE.test(line))
|
|
85
|
+
return false;
|
|
86
|
+
if (CANONICAL_HEADING_RE.test(line))
|
|
87
|
+
return true;
|
|
88
|
+
if (ALL_BRIEFS_MUST_RE.test(line) && /MUST/i.test(line))
|
|
89
|
+
return true;
|
|
90
|
+
if (!MUST_LINE_RE.test(line))
|
|
91
|
+
return false;
|
|
92
|
+
return ENVELOPE_CONTEXT_RE.test(line) || CANONICAL_HEADING_RE.test(line);
|
|
93
|
+
}
|
|
94
|
+
const ENVELOPE_VERSION_RE = /(?:xBRIEFInfo|vBRIEFInfo)["']?\s*:\s*\{\s*["']version["']\s*:\s*["'](0\.\d+)["']/gi;
|
|
95
|
+
/** A version is legacy-bounded only from nearby clause text, not the whole line. */
|
|
96
|
+
function windowIsLegacyBound(line, index, length) {
|
|
97
|
+
const start = Math.max(0, index - 28);
|
|
98
|
+
const end = Math.min(line.length, index + length + 72);
|
|
99
|
+
return LEGACY_BOUND_RE.test(line.slice(start, end));
|
|
100
|
+
}
|
|
101
|
+
/** MUST use/emit/target/write with no open paren between the verb and the version. */
|
|
102
|
+
function isDirectMustVersion(line, index) {
|
|
103
|
+
return /MUST[ \t]+(?:use|emit|target|write)\b[^(]*$/i.test(line.slice(0, index));
|
|
104
|
+
}
|
|
105
|
+
function isInsideLegacyParen(line, index) {
|
|
106
|
+
const before = line.slice(0, index);
|
|
107
|
+
const lastOpen = before.lastIndexOf("(");
|
|
108
|
+
const lastClose = before.lastIndexOf(")");
|
|
109
|
+
if (lastOpen <= lastClose)
|
|
110
|
+
return false;
|
|
111
|
+
const closeRel = line.slice(index).indexOf(")");
|
|
112
|
+
const clause = line.slice(lastOpen, closeRel >= 0 ? index + closeRel : line.length);
|
|
113
|
+
return LEGACY_BOUND_RE.test(clause);
|
|
114
|
+
}
|
|
115
|
+
function isLegacyBoundedOccurrence(line, index, length) {
|
|
116
|
+
if (isDirectMustVersion(line, index))
|
|
117
|
+
return false;
|
|
118
|
+
if (isInsideLegacyParen(line, index))
|
|
119
|
+
return true;
|
|
120
|
+
return windowIsLegacyBound(line, index, length);
|
|
121
|
+
}
|
|
122
|
+
function versionsOnMandate(line) {
|
|
123
|
+
const current = [];
|
|
124
|
+
const boundedLegacy = [];
|
|
125
|
+
const envelopeSpans = [];
|
|
126
|
+
ENVELOPE_VERSION_RE.lastIndex = 0;
|
|
127
|
+
for (const match of line.matchAll(ENVELOPE_VERSION_RE)) {
|
|
128
|
+
const v = match[1];
|
|
129
|
+
const start = match.index ?? 0;
|
|
130
|
+
if (v === undefined)
|
|
131
|
+
continue;
|
|
132
|
+
envelopeSpans.push({ start, end: start + match[0].length });
|
|
133
|
+
current.push(v);
|
|
134
|
+
}
|
|
135
|
+
const heading = CANONICAL_HEADING_RE.exec(line);
|
|
136
|
+
if (heading?.[1] !== undefined) {
|
|
137
|
+
current.push(heading[1]);
|
|
138
|
+
}
|
|
139
|
+
const collect = (re) => {
|
|
140
|
+
re.lastIndex = 0;
|
|
141
|
+
for (const match of line.matchAll(re)) {
|
|
142
|
+
const v = match[1];
|
|
143
|
+
const start = match.index ?? 0;
|
|
144
|
+
if (v === undefined)
|
|
145
|
+
continue;
|
|
146
|
+
if (envelopeSpans.some((s) => start >= s.start && start < s.end))
|
|
147
|
+
continue;
|
|
148
|
+
if (isLegacyBoundedOccurrence(line, start, match[0].length)) {
|
|
149
|
+
boundedLegacy.push(v);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
current.push(v);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
collect(QUOTED_VERSION_RE);
|
|
157
|
+
collect(BARE_XBRIEF_VERSION_RE);
|
|
158
|
+
return { current, boundedLegacy };
|
|
159
|
+
}
|
|
160
|
+
const SETUP_TEMPLATE_VERSION_RE = /["']xBRIEFInfo["']\s*:\s*\{[\s\S]{0,160}?["']version["']\s*:\s*["'](0\.\d+)["']/;
|
|
161
|
+
const SETUP_MUST_VERSION_RE = /MUST use\s+`?"xBRIEFInfo":\s*\{\s*"version":\s*"(0\.\d+)"/;
|
|
162
|
+
export function extractSetupWriteVersion(setupText) {
|
|
163
|
+
const text = normalizeText(setupText);
|
|
164
|
+
const fromTemplate = SETUP_TEMPLATE_VERSION_RE.exec(text);
|
|
165
|
+
if (fromTemplate?.[1] !== undefined) {
|
|
166
|
+
return fromTemplate[1];
|
|
167
|
+
}
|
|
168
|
+
const fromMust = SETUP_MUST_VERSION_RE.exec(text);
|
|
169
|
+
if (fromMust?.[1] !== undefined) {
|
|
170
|
+
return fromMust[1];
|
|
171
|
+
}
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
function scanSurface(rel, text, setupWriteVersion) {
|
|
175
|
+
const violations = [];
|
|
176
|
+
const lines = normalizeText(text).split("\n");
|
|
177
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
178
|
+
const line = lines[i] ?? "";
|
|
179
|
+
if (!isWriteMandateLine(line))
|
|
180
|
+
continue;
|
|
181
|
+
const { current } = versionsOnMandate(line);
|
|
182
|
+
for (const version of current) {
|
|
183
|
+
if (version !== setupWriteVersion) {
|
|
184
|
+
violations.push({
|
|
185
|
+
path: rel,
|
|
186
|
+
line: i + 1,
|
|
187
|
+
version,
|
|
188
|
+
excerpt: line.trim().slice(0, 160),
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return violations;
|
|
194
|
+
}
|
|
195
|
+
function collectCurrentWriteVersions(text) {
|
|
196
|
+
const found = [];
|
|
197
|
+
const lines = normalizeText(text).split("\n");
|
|
198
|
+
for (const line of lines) {
|
|
199
|
+
if (!isWriteMandateLine(line))
|
|
200
|
+
continue;
|
|
201
|
+
const { current } = versionsOnMandate(line);
|
|
202
|
+
found.push(...current);
|
|
203
|
+
}
|
|
204
|
+
return found;
|
|
205
|
+
}
|
|
206
|
+
export function evaluateSemanticSingleSource(packRoot) {
|
|
207
|
+
const root = resolve(packRoot);
|
|
208
|
+
let isDir = false;
|
|
209
|
+
try {
|
|
210
|
+
isDir = statSync(root).isDirectory();
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
isDir = false;
|
|
214
|
+
}
|
|
215
|
+
if (!isDir) {
|
|
216
|
+
return {
|
|
217
|
+
code: EXIT_CONFIG,
|
|
218
|
+
message: `verify_semantic_single_source: --project-root is not a directory: ${root}\n` +
|
|
219
|
+
" Recovery: pass a staged pack root or framework checkout.",
|
|
220
|
+
stream: "stderr",
|
|
221
|
+
setupWriteVersion: null,
|
|
222
|
+
violations: [],
|
|
223
|
+
currentWriteVersions: [],
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
const missingRequired = [];
|
|
227
|
+
const resolved = new Map();
|
|
228
|
+
for (const rel of C2_AUTHORING_SURFACES) {
|
|
229
|
+
const full = resolveAuthoringSurface(root, rel);
|
|
230
|
+
if (full === null) {
|
|
231
|
+
if (REQUIRED_SURFACES.includes(rel)) {
|
|
232
|
+
missingRequired.push(rel);
|
|
233
|
+
}
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
resolved.set(rel, full);
|
|
237
|
+
}
|
|
238
|
+
if (missingRequired.length > 0) {
|
|
239
|
+
return {
|
|
240
|
+
code: EXIT_CONFIG,
|
|
241
|
+
message: `verify_semantic_single_source: required authoring surface(s) missing under ${root}: ` +
|
|
242
|
+
`${missingRequired.join(", ")}\n` +
|
|
243
|
+
" Recovery: stage the packed content (flattened) or pass the framework source root.",
|
|
244
|
+
stream: "stderr",
|
|
245
|
+
setupWriteVersion: null,
|
|
246
|
+
violations: [],
|
|
247
|
+
currentWriteVersions: [],
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
const setupPath = resolved.get("skills/deft-directive-setup/SKILL.md");
|
|
251
|
+
if (setupPath === undefined) {
|
|
252
|
+
return {
|
|
253
|
+
code: EXIT_CONFIG,
|
|
254
|
+
message: "verify_semantic_single_source: setup skill missing (cannot read the write version).",
|
|
255
|
+
stream: "stderr",
|
|
256
|
+
setupWriteVersion: null,
|
|
257
|
+
violations: [],
|
|
258
|
+
currentWriteVersions: [],
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
let setupText;
|
|
262
|
+
try {
|
|
263
|
+
setupText = readFileSync(setupPath, "utf8");
|
|
264
|
+
}
|
|
265
|
+
catch (err) {
|
|
266
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
267
|
+
return {
|
|
268
|
+
code: EXIT_CONFIG,
|
|
269
|
+
message: `verify_semantic_single_source: failed to read setup skill: ${msg}`,
|
|
270
|
+
stream: "stderr",
|
|
271
|
+
setupWriteVersion: null,
|
|
272
|
+
violations: [],
|
|
273
|
+
currentWriteVersions: [],
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
const setupWriteVersion = extractSetupWriteVersion(setupText);
|
|
277
|
+
if (setupWriteVersion === null) {
|
|
278
|
+
return {
|
|
279
|
+
code: EXIT_DRIFT,
|
|
280
|
+
message: "FAIL: C2 semantic single-source -- setup skill does not name a current xBRIEF write version.\n" +
|
|
281
|
+
" Expected a template or MUST using xBRIEFInfo.version (the version setup writes).",
|
|
282
|
+
stream: "stderr",
|
|
283
|
+
setupWriteVersion: null,
|
|
284
|
+
violations: [],
|
|
285
|
+
currentWriteVersions: [],
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
const violations = [];
|
|
289
|
+
const currentWriteVersions = [setupWriteVersion];
|
|
290
|
+
for (const [rel, full] of resolved) {
|
|
291
|
+
let text;
|
|
292
|
+
try {
|
|
293
|
+
text = readFileSync(full, "utf8");
|
|
294
|
+
}
|
|
295
|
+
catch (err) {
|
|
296
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
297
|
+
return {
|
|
298
|
+
code: EXIT_CONFIG,
|
|
299
|
+
message: `verify_semantic_single_source: failed to read ${rel}: ${msg}`,
|
|
300
|
+
stream: "stderr",
|
|
301
|
+
setupWriteVersion,
|
|
302
|
+
violations: [],
|
|
303
|
+
currentWriteVersions: [],
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
violations.push(...scanSurface(rel, text, setupWriteVersion));
|
|
307
|
+
currentWriteVersions.push(...collectCurrentWriteVersions(text));
|
|
308
|
+
}
|
|
309
|
+
const uniqueCurrent = [...new Set(currentWriteVersions)];
|
|
310
|
+
if (violations.length > 0 || uniqueCurrent.some((v) => v !== setupWriteVersion)) {
|
|
311
|
+
const lines = [
|
|
312
|
+
`FAIL: C2 semantic single-source -- shipped canon names more than one xBRIEF write version ` +
|
|
313
|
+
`(setup writes ${setupWriteVersion}):`,
|
|
314
|
+
...violations.map((v) => ` - ${v.path}:${v.line} names ${v.version}: ${v.excerpt.replace(/\r?\n/g, " ")}`),
|
|
315
|
+
" Recovery: current-authoring MUST lines must name only the version setup writes; " +
|
|
316
|
+
"bound 0.6 to legacy/read/migration guidance.",
|
|
317
|
+
];
|
|
318
|
+
return {
|
|
319
|
+
code: EXIT_DRIFT,
|
|
320
|
+
message: lines.join("\n"),
|
|
321
|
+
stream: "stderr",
|
|
322
|
+
setupWriteVersion,
|
|
323
|
+
violations,
|
|
324
|
+
currentWriteVersions: uniqueCurrent,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
const namedCurrent = uniqueCurrent.length === 1 && uniqueCurrent[0] === setupWriteVersion;
|
|
328
|
+
if (!namedCurrent) {
|
|
329
|
+
return {
|
|
330
|
+
code: EXIT_DRIFT,
|
|
331
|
+
message: "FAIL: C2 semantic single-source -- shipped canon does not name the version setup writes.\n" +
|
|
332
|
+
` Setup writes ${setupWriteVersion}; current-write MUST mandates found: [${uniqueCurrent.join(", ")}].`,
|
|
333
|
+
stream: "stderr",
|
|
334
|
+
setupWriteVersion,
|
|
335
|
+
violations: [],
|
|
336
|
+
currentWriteVersions: uniqueCurrent,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
return {
|
|
340
|
+
code: EXIT_OK,
|
|
341
|
+
message: `OK: C2 semantic single-source -- one xBRIEF write version ${setupWriteVersion.replace(/\r?\n/g, " ")} ` +
|
|
342
|
+
`(setup writes ${setupWriteVersion.replace(/\r?\n/g, " ")}; ${resolved.size} authoring surface(s) scanned).`,
|
|
343
|
+
stream: "stdout",
|
|
344
|
+
setupWriteVersion,
|
|
345
|
+
violations: [],
|
|
346
|
+
currentWriteVersions: uniqueCurrent,
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=semantic-single-source.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.109.0",
|
|
4
4
|
"description": "TypeScript engine core for the Directive framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -390,8 +390,8 @@
|
|
|
390
390
|
"provenance": true
|
|
391
391
|
},
|
|
392
392
|
"dependencies": {
|
|
393
|
-
"@deftai/directive-content": "^0.
|
|
394
|
-
"@deftai/directive-types": "^0.
|
|
393
|
+
"@deftai/directive-content": "^0.109.0",
|
|
394
|
+
"@deftai/directive-types": "^0.109.0",
|
|
395
395
|
"archiver": "^8.0.0"
|
|
396
396
|
},
|
|
397
397
|
"scripts": {
|