@intentset/core 0.1.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/artifact.d.ts +28 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +621 -0
- package/dist/artifact.js.map +1 -0
- package/dist/carrier.d.ts +21 -0
- package/dist/carrier.d.ts.map +1 -0
- package/dist/carrier.js +70 -0
- package/dist/carrier.js.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +74 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +28 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +223 -0
- package/dist/context.js.map +1 -0
- package/dist/diagnostics.d.ts +37 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +22 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/export.d.ts +23 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +144 -0
- package/dist/export.js.map +1 -0
- package/dist/graph.d.ts +17 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +51 -0
- package/dist/graph.js.map +1 -0
- package/dist/hash.d.ts +16 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +55 -0
- package/dist/hash.js.map +1 -0
- package/dist/impact.d.ts +6 -0
- package/dist/impact.d.ts.map +1 -0
- package/dist/impact.js +89 -0
- package/dist/impact.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/registries.d.ts +19 -0
- package/dist/registries.d.ts.map +1 -0
- package/dist/registries.js +137 -0
- package/dist/registries.js.map +1 -0
- package/dist/report.d.ts +34 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +58 -0
- package/dist/report.js.map +1 -0
- package/dist/types.d.ts +266 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +90 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.d.ts +6 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +573 -0
- package/dist/validate.js.map +1 -0
- package/dist/yaml.d.ts +48 -0
- package/dist/yaml.d.ts.map +1 -0
- package/dist/yaml.js +413 -0
- package/dist/yaml.js.map +1 -0
- package/package.json +36 -0
- package/src/artifact.ts +835 -0
- package/src/carrier.ts +81 -0
- package/src/config.ts +96 -0
- package/src/context.ts +240 -0
- package/src/diagnostics.ts +60 -0
- package/src/export.ts +173 -0
- package/src/graph.ts +49 -0
- package/src/hash.ts +53 -0
- package/src/impact.ts +90 -0
- package/src/index.ts +14 -0
- package/src/registries.ts +171 -0
- package/src/report.ts +84 -0
- package/src/types.ts +357 -0
- package/src/validate.ts +655 -0
- package/src/yaml.ts +406 -0
package/dist/validate.js
ADDED
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The L1 pipeline (Core §4, §5, §7, §11; VSA §3): read every document, hold
|
|
3
|
+
* IDs unique, build the graph, check relationships, decomposition, lifecycle
|
|
4
|
+
* claims against the registries, attachment, slice metadata, and at L2 and
|
|
5
|
+
* above ownership. Diagnostics come back sorted by `compareDiagnostics`.
|
|
6
|
+
*
|
|
7
|
+
* Two choices keep diagnostics at their cause. A record that could not be
|
|
8
|
+
* read is remembered by the ID it declared, and references to that ID are not
|
|
9
|
+
* reported as unresolved: the CORE001 on the record already says what to fix.
|
|
10
|
+
* Of two records with one ID, the first by path stays in the graph and both
|
|
11
|
+
* are reported as CORE002; neither is merged with the other.
|
|
12
|
+
*/
|
|
13
|
+
import { readDocument } from "./artifact.js";
|
|
14
|
+
import { hasErrors, sortDiagnostics } from "./diagnostics.js";
|
|
15
|
+
import { buildGraph, incomingEdges, outgoing } from "./graph.js";
|
|
16
|
+
import { aType, capitalize, compareStrings, describeTypes, makeDiagnostic } from "./report.js";
|
|
17
|
+
import { LEVELS, LINK_ENDPOINTS, LINK_KINDS, PARENT_TARGETS, } from "./types.js";
|
|
18
|
+
/**
|
|
19
|
+
* Core §5 pairs `supports` sources with targets (outcome → intent,
|
|
20
|
+
* capability → outcome), which LINK_ENDPOINTS cannot say; this narrows it.
|
|
21
|
+
*/
|
|
22
|
+
const SUPPORTS_TARGETS = {
|
|
23
|
+
outcome: ["intent"],
|
|
24
|
+
capability: ["outcome"],
|
|
25
|
+
};
|
|
26
|
+
/** Core §11: validate a repository scope at a conformance level. The whole L1 pipeline; CORE006 joins at L2. */
|
|
27
|
+
export function validate(inputs, registries, options = {}) {
|
|
28
|
+
const level = options.level ?? "L1";
|
|
29
|
+
const diagnostics = [];
|
|
30
|
+
const sorted = [...inputs].sort((a, b) => compareStrings(a.path, b.path));
|
|
31
|
+
const read = [];
|
|
32
|
+
for (const input of sorted) {
|
|
33
|
+
diagnostics.push(...input.syntax);
|
|
34
|
+
const doc = readDocument(input);
|
|
35
|
+
diagnostics.push(...doc.diagnostics);
|
|
36
|
+
read.push(doc);
|
|
37
|
+
}
|
|
38
|
+
const unreadable = new Set();
|
|
39
|
+
const byId = new Map();
|
|
40
|
+
for (const doc of read) {
|
|
41
|
+
if (doc.artifact === null) {
|
|
42
|
+
if (doc.id !== null)
|
|
43
|
+
unreadable.add(doc.id);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const id = doc.artifact.meta.id;
|
|
47
|
+
const list = byId.get(id);
|
|
48
|
+
if (list === undefined)
|
|
49
|
+
byId.set(id, [doc]);
|
|
50
|
+
else
|
|
51
|
+
list.push(doc);
|
|
52
|
+
}
|
|
53
|
+
const kept = new Set();
|
|
54
|
+
const locators = new Map();
|
|
55
|
+
for (const id of [...byId.keys()].sort(compareStrings)) {
|
|
56
|
+
const docs = byId.get(id) ?? [];
|
|
57
|
+
kept.add(docs[0]);
|
|
58
|
+
locators.set(id, docs[0].locate);
|
|
59
|
+
if (docs.length < 2)
|
|
60
|
+
continue;
|
|
61
|
+
for (const doc of docs) {
|
|
62
|
+
diagnostics.push(makeDiagnostic({
|
|
63
|
+
code: "CORE002",
|
|
64
|
+
origin: "graph",
|
|
65
|
+
artifact: id,
|
|
66
|
+
path: doc.artifact?.path ?? null,
|
|
67
|
+
location: doc.locate("/intentset/id"),
|
|
68
|
+
field: "/intentset/id",
|
|
69
|
+
message: `${id} is declared by ${docs.length} documents: ${docs.map((d) => d.artifact?.path).join(", ")}.`,
|
|
70
|
+
remediation: "Give each artifact its own ID; an ID is never reused, and tools never merge duplicate records.",
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const artifacts = [];
|
|
75
|
+
for (const doc of read) {
|
|
76
|
+
if (doc.artifact !== null && kept.has(doc))
|
|
77
|
+
artifacts.push(doc.artifact);
|
|
78
|
+
}
|
|
79
|
+
for (const id of unreadable) {
|
|
80
|
+
if (byId.has(id))
|
|
81
|
+
unreadable.delete(id);
|
|
82
|
+
}
|
|
83
|
+
const graph = buildGraph(artifacts);
|
|
84
|
+
const context = { graph, registries, unreadable, locators, diagnostics, levelIndex: LEVELS.indexOf(level) };
|
|
85
|
+
checkRelationships(context);
|
|
86
|
+
checkCycles(context);
|
|
87
|
+
checkLifecycle(context);
|
|
88
|
+
checkAttachment(context);
|
|
89
|
+
checkSlices(context);
|
|
90
|
+
if (context.levelIndex >= 1)
|
|
91
|
+
checkOwnership(context);
|
|
92
|
+
const all = sortDiagnostics(diagnostics);
|
|
93
|
+
return { graph, diagnostics: all, ok: !hasErrors(all) };
|
|
94
|
+
}
|
|
95
|
+
function reportOn(context, artifact, fields) {
|
|
96
|
+
const locate = context.locators.get(artifact.meta.id);
|
|
97
|
+
context.diagnostics.push(makeDiagnostic({
|
|
98
|
+
code: fields.code,
|
|
99
|
+
severity: fields.severity,
|
|
100
|
+
origin: fields.origin ?? "graph",
|
|
101
|
+
artifact: artifact.meta.id,
|
|
102
|
+
path: artifact.path,
|
|
103
|
+
location: fields.field !== undefined && locate !== undefined ? locate(fields.field) : undefined,
|
|
104
|
+
field: fields.field,
|
|
105
|
+
message: fields.message,
|
|
106
|
+
remediation: fields.remediation,
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
function sortedArtifacts(graph) {
|
|
110
|
+
return [...graph.artifacts.keys()].sort(compareStrings).map((id) => graph.artifacts.get(id));
|
|
111
|
+
}
|
|
112
|
+
/** Core §5: every reference resolves, endpoint types match the table, no self-edge, `replacedBy` keeps the type. */
|
|
113
|
+
function checkRelationships(context) {
|
|
114
|
+
const { graph, unreadable } = context;
|
|
115
|
+
for (const artifact of sortedArtifacts(graph)) {
|
|
116
|
+
const { meta } = artifact;
|
|
117
|
+
const id = meta.id;
|
|
118
|
+
const resolve = (target, field, kind) => {
|
|
119
|
+
const found = graph.artifacts.get(target);
|
|
120
|
+
if (found !== undefined)
|
|
121
|
+
return found;
|
|
122
|
+
if (!unreadable.has(target)) {
|
|
123
|
+
reportOn(context, artifact, {
|
|
124
|
+
code: "CORE003",
|
|
125
|
+
field,
|
|
126
|
+
message: `${kind} names ${target}, which is not in the graph.`,
|
|
127
|
+
remediation: `Create ${target}, or correct the ID to an artifact in the same snapshot.`,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
};
|
|
132
|
+
if (meta.parent !== undefined) {
|
|
133
|
+
const targets = PARENT_TARGETS[meta.type];
|
|
134
|
+
if (targets === undefined) {
|
|
135
|
+
reportOn(context, artifact, {
|
|
136
|
+
code: meta.type === "product" ? "CORE004" : "CORE003",
|
|
137
|
+
field: "/intentset/parent",
|
|
138
|
+
message: meta.type === "product"
|
|
139
|
+
? `${id} is a product and has a parent; a product is the root of the navigation spine.`
|
|
140
|
+
: `${id} is ${aType(meta.type)} and has a parent; ${aType(meta.type)} is reached through its typed relationships, not a navigation parent.`,
|
|
141
|
+
remediation: "Remove `parent` (Core §5).",
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else if (meta.parent !== id) {
|
|
145
|
+
const target = resolve(meta.parent, "/intentset/parent", "parent");
|
|
146
|
+
if (target !== null && !targets.includes(target.meta.type)) {
|
|
147
|
+
reportOn(context, artifact, {
|
|
148
|
+
code: "CORE003",
|
|
149
|
+
field: "/intentset/parent",
|
|
150
|
+
message: `The parent of ${aType(meta.type)} must be ${describeTypes(targets)}, but ${meta.parent} is ${aType(target.meta.type)}.`,
|
|
151
|
+
remediation: `Point parent at the ${targets.join(" or ")} ${id} belongs to.`,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
for (const kind of LINK_KINDS) {
|
|
157
|
+
if (kind === "parent")
|
|
158
|
+
continue;
|
|
159
|
+
const list = meta.links[kind];
|
|
160
|
+
if (list === undefined)
|
|
161
|
+
continue;
|
|
162
|
+
const field = `/intentset/links/${kind}`;
|
|
163
|
+
if (kind === "replacedBy") {
|
|
164
|
+
if (meta.status !== "retired") {
|
|
165
|
+
reportOn(context, artifact, {
|
|
166
|
+
code: "CORE005",
|
|
167
|
+
field,
|
|
168
|
+
message: `${id} names successors in replacedBy while its status is ${meta.status}; only a retired artifact is replaced.`,
|
|
169
|
+
remediation: "Set status to retired, or remove replacedBy until it is.",
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
list.forEach((target, i) => {
|
|
173
|
+
if (target === id)
|
|
174
|
+
return;
|
|
175
|
+
const found = resolve(target, `${field}/${i}`, "replacedBy");
|
|
176
|
+
if (found !== null && found.meta.type !== meta.type) {
|
|
177
|
+
reportOn(context, artifact, {
|
|
178
|
+
code: "CORE003",
|
|
179
|
+
field: `${field}/${i}`,
|
|
180
|
+
message: `replacedBy must name a successor of the same type, ${meta.type}, but ${target} is ${aType(found.meta.type)}.`,
|
|
181
|
+
remediation: "Name the successor of the same type; a change of type is a new artifact, not a replacement.",
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
const endpoints = LINK_ENDPOINTS[kind];
|
|
188
|
+
if (!endpoints.from.includes(meta.type)) {
|
|
189
|
+
reportOn(context, artifact, {
|
|
190
|
+
code: "CORE003",
|
|
191
|
+
field,
|
|
192
|
+
message: `${kind} is written on ${aType(meta.type)}; only ${describeTypes(endpoints.from)} has ${kind}.`,
|
|
193
|
+
remediation: `Remove the link, or author the relationship from the ${endpoints.from.join(" or ")} side; inverses are derived (Core §5).`,
|
|
194
|
+
});
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const allowed = kind === "supports" ? (SUPPORTS_TARGETS[meta.type] ?? endpoints.to) : endpoints.to;
|
|
198
|
+
list.forEach((target, i) => {
|
|
199
|
+
if (target === id) {
|
|
200
|
+
if (kind === "requires")
|
|
201
|
+
return;
|
|
202
|
+
reportOn(context, artifact, {
|
|
203
|
+
code: "CORE003",
|
|
204
|
+
field: `${field}/${i}`,
|
|
205
|
+
message: `${id} names itself in ${kind}.`,
|
|
206
|
+
remediation: "Remove the self-reference; an artifact cannot relate to itself.",
|
|
207
|
+
});
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const found = resolve(target, `${field}/${i}`, kind);
|
|
211
|
+
if (found !== null && !allowed.includes(found.meta.type)) {
|
|
212
|
+
reportOn(context, artifact, {
|
|
213
|
+
code: "CORE003",
|
|
214
|
+
field: `${field}/${i}`,
|
|
215
|
+
message: `${kind} on ${aType(meta.type)} must target ${describeTypes(allowed)}, but ${target} is ${aType(found.meta.type)}.`,
|
|
216
|
+
remediation: `Point ${kind} at ${describeTypes(allowed)}, or use the relationship that fits.`,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/** Core §5: cycles in `parent`, `replacedBy` and `requires`, a self-reference being the shortest. */
|
|
224
|
+
function checkCycles(context) {
|
|
225
|
+
const { graph } = context;
|
|
226
|
+
for (const kind of ["parent", "replacedBy", "requires"]) {
|
|
227
|
+
const ids = [...graph.artifacts.keys()].sort(compareStrings);
|
|
228
|
+
const successors = new Map();
|
|
229
|
+
for (const id of ids) {
|
|
230
|
+
successors.set(id, outgoing(graph, id, kind)
|
|
231
|
+
.map((edge) => edge.to)
|
|
232
|
+
.filter((to) => graph.artifacts.has(to))
|
|
233
|
+
.sort(compareStrings));
|
|
234
|
+
}
|
|
235
|
+
for (const component of stronglyConnected(ids, successors)) {
|
|
236
|
+
const members = [...component].sort(compareStrings);
|
|
237
|
+
const cyclic = members.length > 1 || (successors.get(members[0]) ?? []).includes(members[0]);
|
|
238
|
+
if (!cyclic)
|
|
239
|
+
continue;
|
|
240
|
+
const field = kind === "parent" ? "/intentset/parent" : `/intentset/links/${kind}`;
|
|
241
|
+
for (const id of members) {
|
|
242
|
+
const artifact = graph.artifacts.get(id);
|
|
243
|
+
reportOn(context, artifact, {
|
|
244
|
+
code: "CORE004",
|
|
245
|
+
field,
|
|
246
|
+
message: members.length === 1
|
|
247
|
+
? `${id} names itself in ${kind}.`
|
|
248
|
+
: `${id} is in a ${kind} cycle: ${[...members, members[0]].join(" -> ")}.`,
|
|
249
|
+
remediation: kind === "parent"
|
|
250
|
+
? "Break the cycle so every navigation chain ends at a product (Core §5)."
|
|
251
|
+
: `Break the ${kind} cycle; ${kind === "requires" ? "a prerequisite cannot depend on what it enables" : "a replacement chain must end at a current artifact"}.`,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/** Tarjan's strongly connected components, iterated in the given order so the result is deterministic. */
|
|
258
|
+
function stronglyConnected(ids, successors) {
|
|
259
|
+
const index = new Map();
|
|
260
|
+
const low = new Map();
|
|
261
|
+
const onStack = new Set();
|
|
262
|
+
const stack = [];
|
|
263
|
+
const components = [];
|
|
264
|
+
let counter = 0;
|
|
265
|
+
const visit = (id) => {
|
|
266
|
+
index.set(id, counter);
|
|
267
|
+
low.set(id, counter);
|
|
268
|
+
counter++;
|
|
269
|
+
stack.push(id);
|
|
270
|
+
onStack.add(id);
|
|
271
|
+
for (const next of successors.get(id) ?? []) {
|
|
272
|
+
if (!index.has(next)) {
|
|
273
|
+
visit(next);
|
|
274
|
+
low.set(id, Math.min(low.get(id), low.get(next)));
|
|
275
|
+
}
|
|
276
|
+
else if (onStack.has(next)) {
|
|
277
|
+
low.set(id, Math.min(low.get(id), index.get(next)));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (low.get(id) === index.get(id)) {
|
|
281
|
+
const component = [];
|
|
282
|
+
let member;
|
|
283
|
+
do {
|
|
284
|
+
member = stack.pop();
|
|
285
|
+
onStack.delete(member);
|
|
286
|
+
component.push(member);
|
|
287
|
+
} while (member !== id);
|
|
288
|
+
components.push(component);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
for (const id of ids)
|
|
292
|
+
if (!index.has(id))
|
|
293
|
+
visit(id);
|
|
294
|
+
return components;
|
|
295
|
+
}
|
|
296
|
+
/** Core §4 and §7: owners, audiences and availability values come from the registries and the graph; retirement names successors. */
|
|
297
|
+
function checkLifecycle(context) {
|
|
298
|
+
const { graph, registries, unreadable } = context;
|
|
299
|
+
const undeclared = new Map();
|
|
300
|
+
const use = (dimension) => undeclared.set(dimension, (undeclared.get(dimension) ?? 0) + 1);
|
|
301
|
+
const resourceIds = new Set(registries.resources.map((resource) => resource.id));
|
|
302
|
+
for (const artifact of sortedArtifacts(graph)) {
|
|
303
|
+
const { meta } = artifact;
|
|
304
|
+
if (registries.owners.length === 0)
|
|
305
|
+
use("owners");
|
|
306
|
+
else if (!registries.owners.includes(meta.owner)) {
|
|
307
|
+
reportOn(context, artifact, {
|
|
308
|
+
code: "CORE005",
|
|
309
|
+
field: "/intentset/owner",
|
|
310
|
+
message: `owner ${meta.owner} is not in the owner registry.`,
|
|
311
|
+
remediation: "Add the team or role to registries.yaml owners, or name a registered owner.",
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
meta.audiences.forEach((audience, i) => {
|
|
315
|
+
if (registries.audiences.length === 0)
|
|
316
|
+
use("audiences");
|
|
317
|
+
else if (!registries.audiences.includes(audience)) {
|
|
318
|
+
reportOn(context, artifact, {
|
|
319
|
+
code: "CORE005",
|
|
320
|
+
field: `/intentset/audiences/${i}`,
|
|
321
|
+
message: `audience ${audience} is not in the audience registry.`,
|
|
322
|
+
remediation: "Add it to registries.yaml audiences, or use a registered audience.",
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
const availability = meta.availability;
|
|
327
|
+
if (availability !== undefined) {
|
|
328
|
+
availability.products.forEach((product, i) => {
|
|
329
|
+
const found = graph.artifacts.get(product);
|
|
330
|
+
if (found === undefined && unreadable.has(product))
|
|
331
|
+
return;
|
|
332
|
+
if (found === undefined || found.meta.type !== "product") {
|
|
333
|
+
reportOn(context, artifact, {
|
|
334
|
+
code: "CORE005",
|
|
335
|
+
field: `/intentset/availability/products/${i}`,
|
|
336
|
+
message: `availability names ${product}, which is not a product in the graph.`,
|
|
337
|
+
remediation: "Name the product artifact's ID, such as PRD-LANTERN.",
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
for (const dimension of ["releases", "roles", "editions", "flags"]) {
|
|
342
|
+
availability[dimension].forEach((value, i) => {
|
|
343
|
+
if (registries[dimension].length === 0)
|
|
344
|
+
use(dimension);
|
|
345
|
+
else if (!registries[dimension].includes(value)) {
|
|
346
|
+
reportOn(context, artifact, {
|
|
347
|
+
code: "CORE005",
|
|
348
|
+
field: `/intentset/availability/${dimension}/${i}`,
|
|
349
|
+
message: `${dimension} value ${value} is not in the registries.`,
|
|
350
|
+
remediation: `Add it to registries.yaml ${dimension}, or use a declared value; release labels match exactly (Core §7).`,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
meta.slice?.usesResources.forEach((resource, i) => {
|
|
357
|
+
if (registries.resources.length === 0)
|
|
358
|
+
use("resources");
|
|
359
|
+
else if (!resourceIds.has(resource)) {
|
|
360
|
+
reportOn(context, artifact, {
|
|
361
|
+
code: "CORE003",
|
|
362
|
+
field: `/intentset/slice/usesResources/${i}`,
|
|
363
|
+
message: `usesResources names ${resource}, which is not a resource in the registries.`,
|
|
364
|
+
remediation: "Declare the resource under registries.yaml resources with its technical owner, or remove the reference.",
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
if (meta.status === "retired" && (meta.links.replacedBy ?? []).length === 0) {
|
|
369
|
+
reportOn(context, artifact, {
|
|
370
|
+
code: "CORE005",
|
|
371
|
+
severity: "warning",
|
|
372
|
+
field: "/intentset/status",
|
|
373
|
+
message: `${meta.id} is retired and names no successor in replacedBy.`,
|
|
374
|
+
remediation: "Add replacedBy with the successor IDs when the artifact was split, merged or superseded.",
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (undeclared.size > 0) {
|
|
379
|
+
const dimensions = [...undeclared.keys()].sort(compareStrings);
|
|
380
|
+
const count = [...undeclared.values()].reduce((sum, n) => sum + n, 0);
|
|
381
|
+
const named = dimensions.length === 1
|
|
382
|
+
? dimensions[0]
|
|
383
|
+
: `${dimensions.slice(0, -1).join(", ")} or ${dimensions[dimensions.length - 1]}`;
|
|
384
|
+
context.diagnostics.push(makeDiagnostic({
|
|
385
|
+
code: "CORE005",
|
|
386
|
+
severity: "warning",
|
|
387
|
+
origin: "graph",
|
|
388
|
+
artifact: null,
|
|
389
|
+
path: null,
|
|
390
|
+
message: `The registries declare no ${named}, so ${count} value${count === 1 ? "" : "s"} in the documents could not be checked.`,
|
|
391
|
+
remediation: `List the valid ${dimensions.join(", ")} in registries.yaml; an empty registry reads as not declared.`,
|
|
392
|
+
}));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
function requirement(artifact) {
|
|
396
|
+
const { meta } = artifact;
|
|
397
|
+
const id = meta.id;
|
|
398
|
+
switch (meta.type) {
|
|
399
|
+
case "rule":
|
|
400
|
+
return {
|
|
401
|
+
kinds: ["governedBy"],
|
|
402
|
+
direction: "in",
|
|
403
|
+
message: "no behavior names it in governedBy",
|
|
404
|
+
remediation: `Add ${id} to the governedBy of the behavior it constrains; a rule is attached from the behavior side.`,
|
|
405
|
+
};
|
|
406
|
+
case "scenario":
|
|
407
|
+
return {
|
|
408
|
+
kinds: ["illustrates"],
|
|
409
|
+
direction: "out",
|
|
410
|
+
message: "it illustrates no behavior",
|
|
411
|
+
remediation: "Add the behavior IDs it exemplifies to links.illustrates.",
|
|
412
|
+
};
|
|
413
|
+
case "verification":
|
|
414
|
+
return {
|
|
415
|
+
kinds: ["verifies"],
|
|
416
|
+
direction: "out",
|
|
417
|
+
message: "it verifies no behavior, rule or scenario",
|
|
418
|
+
remediation: "Add the claims it assesses to links.verifies.",
|
|
419
|
+
};
|
|
420
|
+
case "knowledge":
|
|
421
|
+
return {
|
|
422
|
+
kinds: ["explains"],
|
|
423
|
+
direction: "out",
|
|
424
|
+
message: "it explains no behavior, rule or capability",
|
|
425
|
+
remediation: "Add the sources it is grounded in to links.explains.",
|
|
426
|
+
};
|
|
427
|
+
case "slice":
|
|
428
|
+
if (meta.slice?.kind !== "product")
|
|
429
|
+
return null;
|
|
430
|
+
return {
|
|
431
|
+
kinds: ["implements"],
|
|
432
|
+
direction: "out",
|
|
433
|
+
message: "it is a product slice and implements no behavior",
|
|
434
|
+
remediation: "Add the behaviors it owns to links.implements, or make the slice technical with a rationale.",
|
|
435
|
+
};
|
|
436
|
+
case "contract":
|
|
437
|
+
return {
|
|
438
|
+
kinds: ["exposes", "consumes"],
|
|
439
|
+
direction: "in",
|
|
440
|
+
message: "no slice exposes or consumes it",
|
|
441
|
+
remediation: `Add ${id} to the exposes of the slice that maintains it, or to the consumes of one that relies on it.`,
|
|
442
|
+
draftOnly: true,
|
|
443
|
+
};
|
|
444
|
+
case "decision":
|
|
445
|
+
return {
|
|
446
|
+
kinds: ["informedBy"],
|
|
447
|
+
direction: "in",
|
|
448
|
+
message: "no slice, contract or behavior names it in informedBy",
|
|
449
|
+
remediation: `Add ${id} to the informedBy of the artifacts the decision shaped.`,
|
|
450
|
+
draftOnly: true,
|
|
451
|
+
};
|
|
452
|
+
default:
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Core §5 and VSA §3: active rules, scenarios, verifications, knowledge and
|
|
458
|
+
* product slices are attached (CORE003). Their drafts, and draft contracts
|
|
459
|
+
* and decisions nothing refers to, are unattached drafts (CORE009, warning).
|
|
460
|
+
*/
|
|
461
|
+
function checkAttachment(context) {
|
|
462
|
+
const { graph } = context;
|
|
463
|
+
for (const artifact of sortedArtifacts(graph)) {
|
|
464
|
+
const need = requirement(artifact);
|
|
465
|
+
if (need === null || artifact.meta.status === "retired")
|
|
466
|
+
continue;
|
|
467
|
+
const edges = need.kinds.flatMap((kind) => need.direction === "in" ? incomingEdges(graph, artifact.meta.id, kind) : outgoing(graph, artifact.meta.id, kind));
|
|
468
|
+
if (edges.length > 0)
|
|
469
|
+
continue;
|
|
470
|
+
const field = need.direction === "out" ? `/intentset/links/${need.kinds[0]}` : undefined;
|
|
471
|
+
if (artifact.meta.status === "draft") {
|
|
472
|
+
reportOn(context, artifact, {
|
|
473
|
+
code: "CORE009",
|
|
474
|
+
severity: "warning",
|
|
475
|
+
field,
|
|
476
|
+
message: `Draft ${artifact.meta.type} ${artifact.meta.id} is unattached: ${need.message}.`,
|
|
477
|
+
remediation: need.remediation,
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
else if (need.draftOnly !== true) {
|
|
481
|
+
reportOn(context, artifact, {
|
|
482
|
+
code: "CORE003",
|
|
483
|
+
field,
|
|
484
|
+
message: `${capitalize(artifact.meta.status)} ${artifact.meta.type} ${artifact.meta.id} is unattached: ${need.message}.`,
|
|
485
|
+
remediation: need.remediation,
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
/** VSA §3: what a pattern may not be. Null when the pattern is acceptable. */
|
|
491
|
+
export function patternProblem(pattern) {
|
|
492
|
+
if (pattern.startsWith("/"))
|
|
493
|
+
return "is absolute";
|
|
494
|
+
if (pattern.split("/").includes(".."))
|
|
495
|
+
return "contains `..`";
|
|
496
|
+
if (/[{}]/.test(pattern))
|
|
497
|
+
return "uses brace expansion";
|
|
498
|
+
if (pattern.includes("!"))
|
|
499
|
+
return "uses negation";
|
|
500
|
+
if (pattern.includes("\\"))
|
|
501
|
+
return "uses a backslash; patterns are POSIX paths";
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
/** VSA §3 and Core §8: type-specific blocks on their own type only; technical slices give a rationale and implement nothing; patterns are plain. */
|
|
505
|
+
function checkSlices(context) {
|
|
506
|
+
const { graph } = context;
|
|
507
|
+
for (const artifact of sortedArtifacts(graph)) {
|
|
508
|
+
const id = artifact.meta.id;
|
|
509
|
+
const profile = (field, message, remediation, code = "CORE001") => reportOn(context, artifact, { code, origin: "profile", field, message, remediation });
|
|
510
|
+
if (artifact.meta.verification !== undefined && artifact.meta.type !== "verification") {
|
|
511
|
+
profile("/intentset/verification", `${id} is ${aType(artifact.meta.type)} and carries verification metadata, which only a verification has.`, "Remove the verification block, or change the type (Core §8).");
|
|
512
|
+
}
|
|
513
|
+
const slice = artifact.meta.slice;
|
|
514
|
+
if (slice === undefined)
|
|
515
|
+
continue;
|
|
516
|
+
if (artifact.meta.type !== "slice") {
|
|
517
|
+
profile("/intentset/slice", `${id} is ${aType(artifact.meta.type)} and carries slice metadata, which only a slice has.`, "Remove the slice block, or change the type (VSA §3).");
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
if (slice.kind === "technical") {
|
|
521
|
+
if ((artifact.meta.links.implements ?? []).length > 0) {
|
|
522
|
+
profile("/intentset/links/implements", `Technical slice ${id} implements behaviors; a technical slice owns mechanisms, not product behavior.`, "Remove implements, or set slice.kind to product (VSA §3).");
|
|
523
|
+
}
|
|
524
|
+
if (slice.rationale === undefined || slice.rationale.trim() === "") {
|
|
525
|
+
profile("/intentset/slice", `Technical slice ${id} gives no rationale.`, "Add slice.rationale saying why no product owner exists for what it does (VSA §3).");
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
slice.entrypoints.forEach((entrypoint, i) => {
|
|
529
|
+
const why = patternProblem(entrypoint);
|
|
530
|
+
if (why !== null)
|
|
531
|
+
profile(`/intentset/slice/entrypoints/${i}`, `Entrypoint ${entrypoint} ${why}.`, "Give the repository-relative POSIX path of a file inside the slice's source claims (VSA §3).");
|
|
532
|
+
});
|
|
533
|
+
for (const layer of Object.keys(slice.layers).sort(compareStrings)) {
|
|
534
|
+
slice.layers[layer].forEach((pattern, i) => {
|
|
535
|
+
const why = patternProblem(pattern);
|
|
536
|
+
if (why !== null)
|
|
537
|
+
profile(`/intentset/slice/layers/${layer}/${i}`, `Layer pattern ${pattern} ${why}.`, "Use literal segments, `*` within a segment and `**` across segments only (VSA §3).");
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
slice.claims.forEach((claim, i) => {
|
|
541
|
+
const why = patternProblem(claim.path);
|
|
542
|
+
if (why !== null)
|
|
543
|
+
profile(`/intentset/slice/claims/${i}/path`, `Claim pattern ${claim.path} ${why}.`, "Use literal segments, `*` within a segment and `**` across segments only (VSA §3).");
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
const OWNED_STATUSES = new Set(["approved", "implemented", "released", "deprecated"]);
|
|
548
|
+
/** Core §5 at L2 and above: an active behavior has exactly one accountable product slice through `implements`. */
|
|
549
|
+
function checkOwnership(context) {
|
|
550
|
+
const { graph } = context;
|
|
551
|
+
for (const artifact of sortedArtifacts(graph)) {
|
|
552
|
+
const { meta } = artifact;
|
|
553
|
+
if (meta.type !== "behavior" || !OWNED_STATUSES.has(meta.status))
|
|
554
|
+
continue;
|
|
555
|
+
const owners = incomingEdges(graph, meta.id, "implements")
|
|
556
|
+
.map((edge) => graph.artifacts.get(edge.from))
|
|
557
|
+
.filter((slice) => slice?.meta.slice?.kind === "product")
|
|
558
|
+
.map((slice) => slice.meta.id)
|
|
559
|
+
.sort(compareStrings);
|
|
560
|
+
if (owners.length === 1)
|
|
561
|
+
continue;
|
|
562
|
+
reportOn(context, artifact, {
|
|
563
|
+
code: "CORE006",
|
|
564
|
+
message: owners.length === 0
|
|
565
|
+
? `${capitalize(meta.status)} behavior ${meta.id} has no product slice implementing it.`
|
|
566
|
+
: `${capitalize(meta.status)} behavior ${meta.id} is implemented by ${owners.length} product slices (${owners.join(", ")}); exactly one is accountable.`,
|
|
567
|
+
remediation: owners.length === 0
|
|
568
|
+
? "Add the behavior to the implements of the one product slice that owns it."
|
|
569
|
+
: "Keep implements on the accountable slice and express the collaborators through dependsOn and contracts (Core §5).",
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAqB,YAAY,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAmB,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAe,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5G,OAAO,EAKL,MAAM,EACN,cAAc,EACd,UAAU,EAEV,cAAc,GAIf,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,gBAAgB,GAA2D;IAC/E,OAAO,EAAE,CAAC,QAAQ,CAAC;IACnB,UAAU,EAAE,CAAC,SAAS,CAAC;CACxB,CAAC;AAYF,gHAAgH;AAChH,MAAM,UAAU,QAAQ,CACtB,MAAgC,EAChC,U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E,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC7C,MAAM,CAAC,CAAC,KAAK,EAAqB,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,KAAK,SAAS,CAAC;aAC3E,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;aAC7B,IAAI,CAAC,cAAc,CAAC,CAAC;QACxB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAClC,QAAQ,CAAC,OAAO,EAAE,QAAQ,EAAE;YAC1B,IAAI,EAAE,SAAS;YACf,OAAO,EACL,MAAM,CAAC,MAAM,KAAK,CAAC;gBACjB,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,EAAE,wCAAwC;gBACxF,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,EAAE,sBAAsB,MAAM,CAAC,MAAM,oBAAoB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gCAAgC;YAC5J,WAAW,EACT,MAAM,CAAC,MAAM,KAAK,CAAC;gBACjB,CAAC,CAAC,2EAA2E;gBAC7E,CAAC,CAAC,mHAAmH;SAC1H,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/yaml.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The strict frontmatter reader (Core §3, ADR 0001).
|
|
3
|
+
*
|
|
4
|
+
* It reads the subset the carrier uses: block mappings, block and flow
|
|
5
|
+
* sequences, plain and quoted scalars, integers, finite floats, booleans,
|
|
6
|
+
* null, and comments. Everything outside that subset is an error with a line
|
|
7
|
+
* number: duplicate keys, anchors, aliases, tags, merge keys, flow mappings
|
|
8
|
+
* (the empty `{}` excepted, so an empty `layers` can be written), block
|
|
9
|
+
* scalars, multi-document markers, directives, tabs as indentation, nesting
|
|
10
|
+
* deeper than 16, more than 4096 lines, more than 256 KiB. Values are
|
|
11
|
+
* JSON-compatible and quote-aware: `'0.1'` is a string, `0.1` is a number.
|
|
12
|
+
*/
|
|
13
|
+
export interface YamlError {
|
|
14
|
+
message: string;
|
|
15
|
+
/** 1-based line within the text handed to the reader. */
|
|
16
|
+
line: number;
|
|
17
|
+
}
|
|
18
|
+
export type YamlResult = {
|
|
19
|
+
value: Record<string, unknown>;
|
|
20
|
+
error: null;
|
|
21
|
+
} | {
|
|
22
|
+
value: null;
|
|
23
|
+
error: YamlError;
|
|
24
|
+
};
|
|
25
|
+
/** `parseYaml` plus the line each key and sequence item starts on, keyed by JSON pointer. */
|
|
26
|
+
export type YamlDetail = {
|
|
27
|
+
value: Record<string, unknown>;
|
|
28
|
+
lines: Map<string, number>;
|
|
29
|
+
error: null;
|
|
30
|
+
} | {
|
|
31
|
+
value: null;
|
|
32
|
+
lines: Map<string, number>;
|
|
33
|
+
error: YamlError;
|
|
34
|
+
};
|
|
35
|
+
export declare const YAML_MAX_BYTES: number;
|
|
36
|
+
export declare const YAML_MAX_LINES = 4096;
|
|
37
|
+
export declare const YAML_MAX_DEPTH = 16;
|
|
38
|
+
/** Core §3 and ADR 0001: the strict reader. Returns the mapping or the first error with its line. */
|
|
39
|
+
export declare function parseYaml(text: string): YamlResult;
|
|
40
|
+
/**
|
|
41
|
+
* Core §3 and ADR 0001, with positions: the same reader, also returning the
|
|
42
|
+
* 1-based line of every key and sequence item by JSON pointer, which is what
|
|
43
|
+
* lets a diagnostic about `/intentset/links/governedBy/1` point at its line.
|
|
44
|
+
*/
|
|
45
|
+
export declare function parseYamlDetailed(text: string): YamlDetail;
|
|
46
|
+
/** ADR 0004: RFC 6901 escaping of one reference token, for diagnostic field pointers. */
|
|
47
|
+
export declare function pointerToken(key: string | number): string;
|
|
48
|
+
//# sourceMappingURL=yaml.d.ts.map
|