@driftsys/markspec 0.12.0 → 0.13.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/esm/ast/build.d.ts.map +1 -1
- package/esm/ast/build.js +19 -5
- package/esm/ast/equivalence.js +14 -2
- package/esm/ast/nodes.d.ts +15 -3
- package/esm/ast/nodes.d.ts.map +1 -1
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +18 -3
- package/esm/compiler/mod.d.ts +34 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +112 -48
- package/esm/compiler/schema.d.ts +3 -2
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +6 -3
- package/esm/config/markspec.d.ts +2 -2
- package/esm/config/mod.d.ts.map +1 -1
- package/esm/config/mod.js +47 -5
- package/esm/criteria/scenarios.d.ts +55 -0
- package/esm/criteria/scenarios.d.ts.map +1 -0
- package/esm/criteria/scenarios.js +133 -0
- package/esm/discovery/mod.d.ts +20 -1
- package/esm/discovery/mod.d.ts.map +1 -1
- package/esm/discovery/mod.js +105 -17
- package/esm/discovery/projects.d.ts +6 -4
- package/esm/discovery/projects.d.ts.map +1 -1
- package/esm/discovery/projects.js +27 -17
- package/esm/formatter/entry_body.d.ts +13 -12
- package/esm/formatter/entry_body.d.ts.map +1 -1
- package/esm/formatter/entry_body.js +25 -17
- package/esm/formatter/feature_file.d.ts +40 -0
- package/esm/formatter/feature_file.d.ts.map +1 -0
- package/esm/formatter/feature_file.js +88 -0
- package/esm/formatter/md_equiv.d.ts +6 -5
- package/esm/formatter/md_equiv.d.ts.map +1 -1
- package/esm/formatter/md_equiv.js +6 -5
- package/esm/formatter/mod.d.ts +25 -3
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +267 -27
- package/esm/formatter/tab_markers.d.ts +15 -0
- package/esm/formatter/tab_markers.d.ts.map +1 -0
- package/esm/formatter/tab_markers.js +133 -0
- package/esm/gates/mod.d.ts +2 -2
- package/esm/gates/mod.d.ts.map +1 -1
- package/esm/gates/mod.js +18 -3
- package/esm/gherkin/load.d.ts +35 -0
- package/esm/gherkin/load.d.ts.map +1 -0
- package/esm/gherkin/load.js +39 -0
- package/esm/gherkin/parse.d.ts +11 -0
- package/esm/gherkin/parse.d.ts.map +1 -0
- package/esm/gherkin/parse.js +311 -0
- package/esm/gherkin/position.d.ts +23 -0
- package/esm/gherkin/position.d.ts.map +1 -0
- package/esm/gherkin/position.js +21 -0
- package/esm/gherkin/procedure.d.ts +76 -0
- package/esm/gherkin/procedure.d.ts.map +1 -0
- package/esm/gherkin/procedure.js +164 -0
- package/esm/gherkin/project.d.ts +35 -0
- package/esm/gherkin/project.d.ts.map +1 -0
- package/esm/gherkin/project.js +64 -0
- package/esm/gherkin/role.d.ts +23 -0
- package/esm/gherkin/role.d.ts.map +1 -0
- package/esm/gherkin/role.js +28 -0
- package/esm/gherkin/types.d.ts +118 -0
- package/esm/gherkin/types.d.ts.map +1 -0
- package/esm/gherkin/types.js +12 -0
- package/esm/lock/acquire_compile.d.ts +12 -4
- package/esm/lock/acquire_compile.d.ts.map +1 -1
- package/esm/lock/acquire_compile.js +15 -5
- package/esm/lock/canonical_edges.d.ts +6 -2
- package/esm/lock/canonical_edges.d.ts.map +1 -1
- package/esm/lock/canonical_edges.js +10 -3
- package/esm/lock/model.d.ts +5 -0
- package/esm/lock/model.d.ts.map +1 -1
- package/esm/lock/parser.d.ts.map +1 -1
- package/esm/lock/parser.js +2 -0
- package/esm/lock/resolve.d.ts +6 -2
- package/esm/lock/resolve.d.ts.map +1 -1
- package/esm/lock/resolve.js +36 -4
- package/esm/lock/serializer.d.ts.map +1 -1
- package/esm/lock/serializer.js +7 -1
- package/esm/lock/upstream_deps.js +1 -1
- package/esm/mod.d.ts +24 -6
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +19 -5
- package/esm/model/mod.d.ts +43 -2
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +1 -1
- package/esm/model/relations.d.ts +9 -0
- package/esm/model/relations.d.ts.map +1 -1
- package/esm/model/relations.js +16 -1
- package/esm/parser/attributes.d.ts +82 -3
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +199 -32
- package/esm/parser/body_tokens.d.ts +1 -1
- package/esm/parser/body_tokens.d.ts.map +1 -1
- package/esm/parser/body_tokens.js +49 -35
- package/esm/parser/feature_file.d.ts +116 -0
- package/esm/parser/feature_file.d.ts.map +1 -0
- package/esm/parser/feature_file.js +540 -0
- package/esm/parser/markdown.d.ts +7 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +129 -40
- package/esm/parser/mod.d.ts +18 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +51 -0
- package/esm/parser/translate.d.ts.map +1 -1
- package/esm/parser/translate.js +5 -0
- package/esm/refs/mod.d.ts +8 -3
- package/esm/refs/mod.d.ts.map +1 -1
- package/esm/refs/mod.js +20 -7
- package/esm/refs/split.d.ts +58 -0
- package/esm/refs/split.d.ts.map +1 -0
- package/esm/refs/split.js +137 -0
- package/esm/reporter/mod.d.ts +7 -0
- package/esm/reporter/mod.d.ts.map +1 -1
- package/esm/reporter/mod.js +113 -3
- package/esm/sync/mapping.d.ts +4 -3
- package/esm/sync/mapping.d.ts.map +1 -1
- package/esm/sync/mapping.js +52 -9
- package/esm/util/display_id.d.ts +20 -0
- package/esm/util/display_id.d.ts.map +1 -0
- package/esm/util/display_id.js +19 -0
- package/esm/validator/attributes.d.ts.map +1 -1
- package/esm/validator/attributes.js +4 -1
- package/esm/validator/block_role.d.ts +40 -0
- package/esm/validator/block_role.d.ts.map +1 -0
- package/esm/validator/block_role.js +109 -0
- package/esm/validator/feature_ac.d.ts.map +1 -1
- package/esm/validator/feature_ac.js +6 -1
- package/esm/validator/feature_parse.d.ts +35 -0
- package/esm/validator/feature_parse.d.ts.map +1 -0
- package/esm/validator/feature_parse.js +69 -0
- package/esm/validator/locators.d.ts +36 -0
- package/esm/validator/locators.d.ts.map +1 -0
- package/esm/validator/locators.js +184 -0
- package/esm/validator/mod.d.ts +10 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +38 -14
- package/esm/validator/normalize.d.ts.map +1 -1
- package/esm/validator/normalize.js +8 -3
- package/esm/validator/per_type_attrs.d.ts +3 -3
- package/esm/validator/per_type_attrs.js +3 -3
- package/esm/validator/pipeline.d.ts +10 -16
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +37 -16
- package/esm/validator/procedure.d.ts +22 -0
- package/esm/validator/procedure.d.ts.map +1 -0
- package/esm/validator/procedure.js +58 -0
- package/esm/validator/trace_types.d.ts.map +1 -1
- package/esm/validator/trace_types.js +4 -3
- package/esm/validator/traceability.d.ts.map +1 -1
- package/esm/validator/traceability.js +4 -1
- package/esm/validator/type_resolution.d.ts +5 -3
- package/esm/validator/type_resolution.d.ts.map +1 -1
- package/esm/validator/type_resolution.js +14 -2
- package/esm/validator/types.d.ts +11 -0
- package/esm/validator/types.d.ts.map +1 -1
- package/esm/validator/types.js +26 -4
- package/esm/validator/uxil_family.d.ts +1 -1
- package/package.json +3 -1
- package/script/ast/build.d.ts.map +1 -1
- package/script/ast/build.js +19 -5
- package/script/ast/equivalence.js +14 -2
- package/script/ast/nodes.d.ts +15 -3
- package/script/ast/nodes.d.ts.map +1 -1
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +18 -3
- package/script/compiler/mod.d.ts +34 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +110 -46
- package/script/compiler/schema.d.ts +3 -2
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +6 -3
- package/script/config/markspec.d.ts +2 -2
- package/script/config/mod.d.ts.map +1 -1
- package/script/config/mod.js +47 -5
- package/script/criteria/scenarios.d.ts +55 -0
- package/script/criteria/scenarios.d.ts.map +1 -0
- package/script/criteria/scenarios.js +139 -0
- package/script/discovery/mod.d.ts +20 -1
- package/script/discovery/mod.d.ts.map +1 -1
- package/script/discovery/mod.js +106 -17
- package/script/discovery/projects.d.ts +6 -4
- package/script/discovery/projects.d.ts.map +1 -1
- package/script/discovery/projects.js +27 -17
- package/script/formatter/entry_body.d.ts +13 -12
- package/script/formatter/entry_body.d.ts.map +1 -1
- package/script/formatter/entry_body.js +25 -17
- package/script/formatter/feature_file.d.ts +40 -0
- package/script/formatter/feature_file.d.ts.map +1 -0
- package/script/formatter/feature_file.js +92 -0
- package/script/formatter/md_equiv.d.ts +6 -5
- package/script/formatter/md_equiv.d.ts.map +1 -1
- package/script/formatter/md_equiv.js +6 -5
- package/script/formatter/mod.d.ts +25 -3
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +266 -26
- package/script/formatter/tab_markers.d.ts +15 -0
- package/script/formatter/tab_markers.d.ts.map +1 -0
- package/script/formatter/tab_markers.js +141 -0
- package/script/gates/mod.d.ts +2 -2
- package/script/gates/mod.d.ts.map +1 -1
- package/script/gates/mod.js +18 -3
- package/script/gherkin/load.d.ts +35 -0
- package/script/gherkin/load.d.ts.map +1 -0
- package/script/gherkin/load.js +76 -0
- package/script/gherkin/parse.d.ts +11 -0
- package/script/gherkin/parse.d.ts.map +1 -0
- package/script/gherkin/parse.js +314 -0
- package/script/gherkin/position.d.ts +23 -0
- package/script/gherkin/position.d.ts.map +1 -0
- package/script/gherkin/position.js +24 -0
- package/script/gherkin/procedure.d.ts +76 -0
- package/script/gherkin/procedure.d.ts.map +1 -0
- package/script/gherkin/procedure.js +169 -0
- package/script/gherkin/project.d.ts +35 -0
- package/script/gherkin/project.d.ts.map +1 -0
- package/script/gherkin/project.js +67 -0
- package/script/gherkin/role.d.ts +23 -0
- package/script/gherkin/role.d.ts.map +1 -0
- package/script/gherkin/role.js +31 -0
- package/script/gherkin/types.d.ts +118 -0
- package/script/gherkin/types.d.ts.map +1 -0
- package/script/gherkin/types.js +13 -0
- package/script/lock/acquire_compile.d.ts +12 -4
- package/script/lock/acquire_compile.d.ts.map +1 -1
- package/script/lock/acquire_compile.js +15 -5
- package/script/lock/canonical_edges.d.ts +6 -2
- package/script/lock/canonical_edges.d.ts.map +1 -1
- package/script/lock/canonical_edges.js +10 -3
- package/script/lock/model.d.ts +5 -0
- package/script/lock/model.d.ts.map +1 -1
- package/script/lock/parser.d.ts.map +1 -1
- package/script/lock/parser.js +2 -0
- package/script/lock/resolve.d.ts +6 -2
- package/script/lock/resolve.d.ts.map +1 -1
- package/script/lock/resolve.js +36 -4
- package/script/lock/serializer.d.ts.map +1 -1
- package/script/lock/serializer.js +7 -1
- package/script/lock/upstream_deps.js +1 -1
- package/script/mod.d.ts +24 -6
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +48 -6
- package/script/model/mod.d.ts +43 -2
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +2 -1
- package/script/model/relations.d.ts +9 -0
- package/script/model/relations.d.ts.map +1 -1
- package/script/model/relations.js +17 -1
- package/script/parser/attributes.d.ts +82 -3
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +205 -33
- package/script/parser/body_tokens.d.ts +1 -1
- package/script/parser/body_tokens.d.ts.map +1 -1
- package/script/parser/body_tokens.js +49 -35
- package/script/parser/feature_file.d.ts +116 -0
- package/script/parser/feature_file.d.ts.map +1 -0
- package/script/parser/feature_file.js +548 -0
- package/script/parser/markdown.d.ts +7 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +128 -39
- package/script/parser/mod.d.ts +18 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +52 -1
- package/script/parser/translate.d.ts.map +1 -1
- package/script/parser/translate.js +5 -0
- package/script/refs/mod.d.ts +8 -3
- package/script/refs/mod.d.ts.map +1 -1
- package/script/refs/mod.js +20 -7
- package/script/refs/split.d.ts +58 -0
- package/script/refs/split.d.ts.map +1 -0
- package/script/refs/split.js +145 -0
- package/script/reporter/mod.d.ts +7 -0
- package/script/reporter/mod.d.ts.map +1 -1
- package/script/reporter/mod.js +113 -3
- package/script/sync/mapping.d.ts +4 -3
- package/script/sync/mapping.d.ts.map +1 -1
- package/script/sync/mapping.js +52 -9
- package/script/util/display_id.d.ts +20 -0
- package/script/util/display_id.d.ts.map +1 -0
- package/script/util/display_id.js +22 -0
- package/script/validator/attributes.d.ts.map +1 -1
- package/script/validator/attributes.js +4 -1
- package/script/validator/block_role.d.ts +40 -0
- package/script/validator/block_role.d.ts.map +1 -0
- package/script/validator/block_role.js +112 -0
- package/script/validator/feature_ac.d.ts.map +1 -1
- package/script/validator/feature_ac.js +6 -1
- package/script/validator/feature_parse.d.ts +35 -0
- package/script/validator/feature_parse.d.ts.map +1 -0
- package/script/validator/feature_parse.js +73 -0
- package/script/validator/locators.d.ts +36 -0
- package/script/validator/locators.d.ts.map +1 -0
- package/script/validator/locators.js +188 -0
- package/script/validator/mod.d.ts +10 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +38 -14
- package/script/validator/normalize.d.ts.map +1 -1
- package/script/validator/normalize.js +8 -3
- package/script/validator/per_type_attrs.d.ts +3 -3
- package/script/validator/per_type_attrs.js +3 -3
- package/script/validator/pipeline.d.ts +10 -16
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +36 -16
- package/script/validator/procedure.d.ts +22 -0
- package/script/validator/procedure.d.ts.map +1 -0
- package/script/validator/procedure.js +61 -0
- package/script/validator/trace_types.d.ts.map +1 -1
- package/script/validator/trace_types.js +4 -3
- package/script/validator/traceability.d.ts.map +1 -1
- package/script/validator/traceability.js +4 -1
- package/script/validator/type_resolution.d.ts +5 -3
- package/script/validator/type_resolution.d.ts.map +1 -1
- package/script/validator/type_resolution.js +14 -2
- package/script/validator/types.d.ts +11 -0
- package/script/validator/types.d.ts.map +1 -1
- package/script/validator/types.js +27 -4
- package/script/validator/uxil_family.d.ts +1 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module refs/split
|
|
4
|
+
*
|
|
5
|
+
* Bracket-aware splitting of trace attribute values. A value is
|
|
6
|
+
* `target [ 1*WSP "[" locator "]" ]`. A locator can contain commas, so a
|
|
7
|
+
* plain split on commas is wrong for it. The escapes `\]` and `\\` are
|
|
8
|
+
* valid inside a locator only; any other backslash sequence (such as `\x`)
|
|
9
|
+
* is kept as written. A locator must follow whitespace after the target,
|
|
10
|
+
* so `A[x]` has no locator. A value without a closed locator is read
|
|
11
|
+
* exactly as before scenario locators existed.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.normalizeLocator = normalizeLocator;
|
|
15
|
+
exports.splitTraceValues = splitTraceValues;
|
|
16
|
+
exports.parseTraceValue = parseTraceValue;
|
|
17
|
+
exports.isUnterminatedLocator = isUnterminatedLocator;
|
|
18
|
+
exports.traceTarget = traceTarget;
|
|
19
|
+
exports.referenceTokens = referenceTokens;
|
|
20
|
+
/**
|
|
21
|
+
* Normalize locator text for comparison: Unicode NFC, trim, and collapse
|
|
22
|
+
* each whitespace run to one space.
|
|
23
|
+
*/
|
|
24
|
+
function normalizeLocator(text) {
|
|
25
|
+
return text.normalize("NFC").trim().replace(/\s+/g, " ");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Split a trace attribute value into its parts. When at least one part has
|
|
29
|
+
* a closed bracket locator after whitespace, commas inside a locator do not
|
|
30
|
+
* split. Otherwise the value is split on every comma, exactly as before
|
|
31
|
+
* scenario locators existed, so an unterminated `[` does not change how a
|
|
32
|
+
* value is read. Parts are trimmed and empty parts are dropped.
|
|
33
|
+
*/
|
|
34
|
+
function splitTraceValues(value) {
|
|
35
|
+
// An unclosed `[` never protects commas (see splitOutsideLocators).
|
|
36
|
+
const bracketParts = splitOutsideLocators(value);
|
|
37
|
+
if (bracketParts.some((p) => LOCATOR_VALUE_RE.test(p)))
|
|
38
|
+
return bracketParts;
|
|
39
|
+
return value.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
40
|
+
}
|
|
41
|
+
/** Split on commas outside a closed locator. A `[` opens a locator only
|
|
42
|
+
* after whitespace; an unclosed locator does not protect its commas. */
|
|
43
|
+
function splitOutsideLocators(value) {
|
|
44
|
+
const parts = [];
|
|
45
|
+
let current = "";
|
|
46
|
+
let inLocator = false;
|
|
47
|
+
for (let i = 0; i < value.length; i++) {
|
|
48
|
+
const ch = value[i];
|
|
49
|
+
if (inLocator) {
|
|
50
|
+
if (ch === "\\" && i + 1 < value.length) {
|
|
51
|
+
current += ch + value[++i];
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (ch === "]")
|
|
55
|
+
inLocator = false;
|
|
56
|
+
current += ch;
|
|
57
|
+
}
|
|
58
|
+
else if (ch === "[" && i > 0 && /\s/.test(value[i - 1])) {
|
|
59
|
+
inLocator = true;
|
|
60
|
+
current += ch;
|
|
61
|
+
}
|
|
62
|
+
else if (ch === ",") {
|
|
63
|
+
parts.push(current);
|
|
64
|
+
current = "";
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
current += ch;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// An unclosed `[` never swallows commas: the rest splits on each comma.
|
|
71
|
+
if (inLocator)
|
|
72
|
+
parts.push(...current.split(","));
|
|
73
|
+
else
|
|
74
|
+
parts.push(current);
|
|
75
|
+
return parts.map((p) => p.trim()).filter((p) => p.length > 0);
|
|
76
|
+
}
|
|
77
|
+
/** `target 1*WSP "[" locator "]"` with escapes inside the locator. The
|
|
78
|
+
* locator may be empty (`A []`); an empty locator names no scenario. */
|
|
79
|
+
const LOCATOR_VALUE_RE = /^(\S+)\s+\[((?:\\[\s\S]|[^\]\\])*)\]$/;
|
|
80
|
+
/**
|
|
81
|
+
* Parse one value from {@linkcode splitTraceValues} into target and
|
|
82
|
+
* optional locator. A value without a closed locator after whitespace is
|
|
83
|
+
* kept whole as the target, as before scenario locators existed.
|
|
84
|
+
*/
|
|
85
|
+
function parseTraceValue(raw) {
|
|
86
|
+
const value = raw.trim();
|
|
87
|
+
const match = LOCATOR_VALUE_RE.exec(value);
|
|
88
|
+
if (!match)
|
|
89
|
+
return { target: value };
|
|
90
|
+
const locatorRaw = match[2];
|
|
91
|
+
return {
|
|
92
|
+
target: match[1],
|
|
93
|
+
locator: normalizeLocator(locatorRaw.replace(/\\([\]\\])/g, "$1")),
|
|
94
|
+
locatorRaw,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* `true` when a trace value has a `[` after whitespace that no unescaped
|
|
99
|
+
* `]` closes. Such a value has no locator.
|
|
100
|
+
*/
|
|
101
|
+
function isUnterminatedLocator(raw) {
|
|
102
|
+
const value = raw.trim();
|
|
103
|
+
let inLocator = false;
|
|
104
|
+
for (let i = 0; i < value.length; i++) {
|
|
105
|
+
const ch = value[i];
|
|
106
|
+
if (inLocator) {
|
|
107
|
+
if (ch === "\\")
|
|
108
|
+
i++;
|
|
109
|
+
else if (ch === "]")
|
|
110
|
+
inLocator = false;
|
|
111
|
+
}
|
|
112
|
+
else if (ch === "[" && i > 0 && /\s/.test(value[i - 1])) {
|
|
113
|
+
inLocator = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return inLocator;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The target of a trace value for existence and value-type checks: the
|
|
120
|
+
* target before a closed bracket locator, else the trimmed value as
|
|
121
|
+
* written.
|
|
122
|
+
*/
|
|
123
|
+
function traceTarget(raw) {
|
|
124
|
+
return parseTraceValue(raw).target;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The tokens of a trace value that can name another entry, for reference
|
|
128
|
+
* scans (find references, dependent counts). A closed locator is dropped,
|
|
129
|
+
* so an ID written inside a locator is not a reference. Any other part is
|
|
130
|
+
* split on whitespace and commas, as before scenario locators existed.
|
|
131
|
+
*/
|
|
132
|
+
function referenceTokens(value) {
|
|
133
|
+
const out = [];
|
|
134
|
+
for (const part of splitTraceValues(value)) {
|
|
135
|
+
const parsed = parseTraceValue(part);
|
|
136
|
+
if (parsed.locator !== undefined) {
|
|
137
|
+
out.push(parsed.target);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
for (const t of part.split(/[\s,]+/))
|
|
141
|
+
if (t.length > 0)
|
|
142
|
+
out.push(t);
|
|
143
|
+
}
|
|
144
|
+
return out;
|
|
145
|
+
}
|
package/script/reporter/mod.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* traceability matrices and coverage reports in md, json, or csv format.
|
|
6
6
|
*/
|
|
7
7
|
import type { CompileResult } from "../compiler/mod.js";
|
|
8
|
+
import type { EffectiveProfile } from "../model/mod.js";
|
|
8
9
|
/** Supported report kinds. */
|
|
9
10
|
export type ReportKind = "traceability" | "coverage";
|
|
10
11
|
/** Supported output formats. */
|
|
@@ -30,6 +31,12 @@ export interface ReportOptions {
|
|
|
30
31
|
* reference leaf.
|
|
31
32
|
*/
|
|
32
33
|
readonly dependencyUpstreamIds?: ReadonlySet<string>;
|
|
34
|
+
/**
|
|
35
|
+
* The active profile. The criterion coverage section counts a verifier
|
|
36
|
+
* only when its type is, or extends, the core `Test` type; without a
|
|
37
|
+
* profile, only core types are resolved.
|
|
38
|
+
*/
|
|
39
|
+
readonly profile?: EffectiveProfile;
|
|
33
40
|
}
|
|
34
41
|
/**
|
|
35
42
|
* Generate a report from compiled traceability graph.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/reporter/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/reporter/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAa,gBAAgB,EAAS,MAAM,iBAAiB,CAAC;AAQ1E,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;AAErD,gCAAgC;AAChC,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjD,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,qBAAqB;IACrB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrD;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAa5E"}
|
package/script/reporter/mod.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.report = report;
|
|
10
|
+
const scenarios_js_1 = require("../criteria/scenarios.js");
|
|
10
11
|
const mod_js_1 = require("../model/mod.js");
|
|
11
12
|
/**
|
|
12
13
|
* Generate a report from compiled traceability graph.
|
|
@@ -20,7 +21,7 @@ function report(result, options) {
|
|
|
20
21
|
if (options.kind === "traceability") {
|
|
21
22
|
return formatTraceability(result, entries, options.format);
|
|
22
23
|
}
|
|
23
|
-
return formatCoverage(result, entries, options.format, options.dependencyUpstreamIds);
|
|
24
|
+
return formatCoverage(result, entries, options.format, options.dependencyUpstreamIds, options.profile);
|
|
24
25
|
}
|
|
25
26
|
// ---------------------------------------------------------------------------
|
|
26
27
|
// Filtering
|
|
@@ -146,10 +147,13 @@ function computeCoverage(result, entries, opts = {}) {
|
|
|
146
147
|
gaps: { orphans, unsatisfied },
|
|
147
148
|
};
|
|
148
149
|
}
|
|
149
|
-
function formatCoverage(result, entries, format, dependencyUpstreamIds) {
|
|
150
|
+
function formatCoverage(result, entries, format, dependencyUpstreamIds, profile) {
|
|
150
151
|
const stats = computeCoverage(result, entries, { dependencyUpstreamIds });
|
|
152
|
+
// Absent when no reported entry has criteria, so coverage output for a
|
|
153
|
+
// project without feature blocks stays unchanged.
|
|
154
|
+
const criteria = computeCriterionCoverage(result, entries, profile);
|
|
151
155
|
if (format === "json") {
|
|
152
|
-
return JSON.stringify(stats, null, 2);
|
|
156
|
+
return JSON.stringify(criteria ? { ...stats, criteria } : stats, null, 2);
|
|
153
157
|
}
|
|
154
158
|
if (format === "csv") {
|
|
155
159
|
const lines = [
|
|
@@ -161,6 +165,9 @@ function formatCoverage(result, entries, format, dependencyUpstreamIds) {
|
|
|
161
165
|
`Orphans,${stats.gaps.orphans.length}`,
|
|
162
166
|
`Unsatisfied parents,${stats.gaps.unsatisfied.length}`,
|
|
163
167
|
];
|
|
168
|
+
if (criteria) {
|
|
169
|
+
lines.push(`Criteria total,${criteria.total}`, `Criteria verified,${criteria.verified}`);
|
|
170
|
+
}
|
|
164
171
|
return lines.join("\n");
|
|
165
172
|
}
|
|
166
173
|
// Markdown
|
|
@@ -185,8 +192,111 @@ function formatCoverage(result, entries, format, dependencyUpstreamIds) {
|
|
|
185
192
|
if (stats.gaps.unsatisfied.length > 0) {
|
|
186
193
|
lines.push("## Unsatisfied parents (STK/SYS with no children)", "", ...stats.gaps.unsatisfied.map((id) => `- ${id}`), "");
|
|
187
194
|
}
|
|
195
|
+
if (criteria)
|
|
196
|
+
lines.push(...formatCriteriaMarkdown(criteria));
|
|
188
197
|
return lines.join("\n");
|
|
189
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Compute per-criterion verification for the reported entries that carry
|
|
201
|
+
* criteria. Returns `undefined` when none does.
|
|
202
|
+
*
|
|
203
|
+
* Only `verifies` links count, and only when the verifier's type is, or
|
|
204
|
+
* extends, the core `Test` type; an entry never verifies itself. A link
|
|
205
|
+
* without a locator verifies every criterion of its target. A link with a
|
|
206
|
+
* locator verifies the named criterion only when `locatorResolved` is
|
|
207
|
+
* `true`. A generated inverse runs from the target to the verifier; the
|
|
208
|
+
* verifier set removes the duplicate it makes of the authored link.
|
|
209
|
+
* Upstream (federated) entries are not reported.
|
|
210
|
+
*/
|
|
211
|
+
function computeCriterionCoverage(result, entries, profile) {
|
|
212
|
+
const withCriteria = entries.filter((e) => (e.criteria?.length ?? 0) > 0 && !(0, mod_js_1.isUpstreamEntry)(e));
|
|
213
|
+
if (withCriteria.length === 0)
|
|
214
|
+
return undefined;
|
|
215
|
+
// A link end may be written as a ULID; report display IDs.
|
|
216
|
+
const byUlid = new Map();
|
|
217
|
+
for (const e of result.entries.values())
|
|
218
|
+
if (e.id)
|
|
219
|
+
byUlid.set(e.id, e);
|
|
220
|
+
const resolve = (id) => result.entries.get(id) ?? byUlid.get(id);
|
|
221
|
+
// Target display ID → criterion name ("" for whole entry) → verifiers.
|
|
222
|
+
const verifiers = new Map();
|
|
223
|
+
for (const link of result.links) {
|
|
224
|
+
if (link.kind !== "verifies")
|
|
225
|
+
continue;
|
|
226
|
+
if (link.locator !== undefined && link.locatorResolved !== true)
|
|
227
|
+
continue;
|
|
228
|
+
const generated = link.origin === "generated";
|
|
229
|
+
const targetEntry = resolve(generated ? link.from : link.to);
|
|
230
|
+
const verifierEntry = resolve(generated ? link.to : link.from);
|
|
231
|
+
if (!targetEntry || !verifierEntry)
|
|
232
|
+
continue;
|
|
233
|
+
if (targetEntry.displayId === verifierEntry.displayId)
|
|
234
|
+
continue;
|
|
235
|
+
if (!(0, scenarios_js_1.isTestEntry)(verifierEntry, profile))
|
|
236
|
+
continue;
|
|
237
|
+
const target = targetEntry.displayId;
|
|
238
|
+
const verifier = verifierEntry.displayId;
|
|
239
|
+
let byName = verifiers.get(target);
|
|
240
|
+
if (!byName) {
|
|
241
|
+
byName = new Map();
|
|
242
|
+
verifiers.set(target, byName);
|
|
243
|
+
}
|
|
244
|
+
const key = link.locator ?? "";
|
|
245
|
+
let set = byName.get(key);
|
|
246
|
+
if (!set) {
|
|
247
|
+
set = new Set();
|
|
248
|
+
byName.set(key, set);
|
|
249
|
+
}
|
|
250
|
+
set.add(verifier);
|
|
251
|
+
}
|
|
252
|
+
let total = 0;
|
|
253
|
+
let verified = 0;
|
|
254
|
+
const rows = withCriteria.map((entry) => {
|
|
255
|
+
const byName = verifiers.get(entry.displayId);
|
|
256
|
+
const whole = byName?.get("") ?? new Set();
|
|
257
|
+
const criteria = entry.criteria.map((c) => {
|
|
258
|
+
const named = c.addressable ? byName?.get(c.name) : undefined;
|
|
259
|
+
const all = new Set([...whole, ...(named ?? [])]);
|
|
260
|
+
return {
|
|
261
|
+
name: c.name,
|
|
262
|
+
addressable: c.addressable,
|
|
263
|
+
verifiedBy: [...all].sort(),
|
|
264
|
+
};
|
|
265
|
+
});
|
|
266
|
+
const entryVerified = criteria.filter((c) => c.verifiedBy.length > 0)
|
|
267
|
+
.length;
|
|
268
|
+
total += criteria.length;
|
|
269
|
+
verified += entryVerified;
|
|
270
|
+
return {
|
|
271
|
+
displayId: entry.displayId,
|
|
272
|
+
title: entry.title,
|
|
273
|
+
state: entryVerified === criteria.length
|
|
274
|
+
? "full"
|
|
275
|
+
: entryVerified === 0
|
|
276
|
+
? "none"
|
|
277
|
+
: "partial",
|
|
278
|
+
verified: entryVerified,
|
|
279
|
+
total: criteria.length,
|
|
280
|
+
criteria,
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
return { total, verified, entries: rows };
|
|
284
|
+
}
|
|
285
|
+
/** Render the `## Criteria` Markdown section, one text block per entry. */
|
|
286
|
+
function formatCriteriaMarkdown(criteria) {
|
|
287
|
+
const lines = ["## Criteria", ""];
|
|
288
|
+
for (const entry of criteria.entries) {
|
|
289
|
+
const width = Math.max(...entry.criteria.map((c) => c.name.length));
|
|
290
|
+
lines.push("```text", `${entry.displayId} ${entry.title} ${entry.verified}/${entry.total} criteria verified`, ...entry.criteria.map((c) => {
|
|
291
|
+
const mark = c.verifiedBy.length > 0 ? "\u2713" : "\u2717";
|
|
292
|
+
const by = c.verifiedBy.length > 0
|
|
293
|
+
? c.verifiedBy.join(", ")
|
|
294
|
+
: "no verifier";
|
|
295
|
+
return ` ${mark} ${c.name.padEnd(width)} \u2190 ${by}`;
|
|
296
|
+
}), "```", "");
|
|
297
|
+
}
|
|
298
|
+
return lines;
|
|
299
|
+
}
|
|
190
300
|
// ---------------------------------------------------------------------------
|
|
191
301
|
// Helpers
|
|
192
302
|
// ---------------------------------------------------------------------------
|
package/script/sync/mapping.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* cache TTL.
|
|
8
8
|
*
|
|
9
9
|
* Diagnostic family is `MSL-S###`:
|
|
10
|
-
* - MSL-S001 — malformed YAML / unsupported schema
|
|
10
|
+
* - MSL-S001 — malformed YAML / invalid structure / unsupported schema
|
|
11
11
|
* - MSL-S002 — locked + outbound contradiction
|
|
12
12
|
* - MSL-S003 — unknown conflict policy (newest-wins removed pre-1.0)
|
|
13
13
|
* - MSL-S004 — system ≠ identity.external-id-scheme
|
|
@@ -52,8 +52,9 @@ export interface ParseMappingResult {
|
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Parse and validate one mapping.yaml. Returns the model when valid, or
|
|
55
|
-
* an MSL-S### diagnostic when not.
|
|
56
|
-
*
|
|
55
|
+
* an MSL-S### diagnostic when not. Never throws on invalid YAML or invalid
|
|
56
|
+
* field shapes. Single-shot — stops at the first integrity failure to keep
|
|
57
|
+
* the repair signal clear.
|
|
57
58
|
*/
|
|
58
59
|
export declare function parseMapping(yaml: string, sourcePath: string): ParseMappingResult;
|
|
59
60
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../src/sync/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,2BAA2B;AAC3B,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,eAAe,CAAC;AAEjE,yEAAyE;AACzE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,aAAa,CAAC;AAErE,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,sCAAsC;AACtC,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;KAAE,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AASD
|
|
1
|
+
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../src/sync/mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,2BAA2B;AAC3B,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,eAAe,CAAC;AAEjE,yEAAyE;AACzE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,YAAY,GAAG,aAAa,CAAC;AAErE,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,sCAAsC;AACtC,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;KAAE,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AASD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,kBAAkB,CAoLpB;AASD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,UAAU,EAAE,CA2B3E"}
|
package/script/sync/mapping.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* cache TTL.
|
|
9
9
|
*
|
|
10
10
|
* Diagnostic family is `MSL-S###`:
|
|
11
|
-
* - MSL-S001 — malformed YAML / unsupported schema
|
|
11
|
+
* - MSL-S001 — malformed YAML / invalid structure / unsupported schema
|
|
12
12
|
* - MSL-S002 — locked + outbound contradiction
|
|
13
13
|
* - MSL-S003 — unknown conflict policy (newest-wins removed pre-1.0)
|
|
14
14
|
* - MSL-S004 — system ≠ identity.external-id-scheme
|
|
@@ -27,8 +27,9 @@ const ALLOWED_POLICIES = new Set([
|
|
|
27
27
|
]);
|
|
28
28
|
/**
|
|
29
29
|
* Parse and validate one mapping.yaml. Returns the model when valid, or
|
|
30
|
-
* an MSL-S### diagnostic when not.
|
|
31
|
-
*
|
|
30
|
+
* an MSL-S### diagnostic when not. Never throws on invalid YAML or invalid
|
|
31
|
+
* field shapes. Single-shot — stops at the first integrity failure to keep
|
|
32
|
+
* the repair signal clear.
|
|
32
33
|
*/
|
|
33
34
|
function parseMapping(yaml, sourcePath) {
|
|
34
35
|
let raw;
|
|
@@ -38,7 +39,16 @@ function parseMapping(yaml, sourcePath) {
|
|
|
38
39
|
catch (e) {
|
|
39
40
|
return fail("MSL-S001", `Malformed mapping.yaml: ${e.message}`, sourcePath);
|
|
40
41
|
}
|
|
42
|
+
if (raw === null || raw === undefined) {
|
|
43
|
+
return fail("MSL-S001", "Mapping YAML is empty or null", sourcePath);
|
|
44
|
+
}
|
|
45
|
+
if (!isRecord(raw)) {
|
|
46
|
+
return fail("MSL-S001", "Mapping YAML must be an object", sourcePath);
|
|
47
|
+
}
|
|
41
48
|
const schema = raw.schema;
|
|
49
|
+
if (typeof schema !== "number") {
|
|
50
|
+
return fail("MSL-S001", "Missing or non-number `schema` field", sourcePath);
|
|
51
|
+
}
|
|
42
52
|
if (schema !== SUPPORTED_SCHEMA) {
|
|
43
53
|
return fail("MSL-S001", `Unsupported mapping schema: ${schema} (expected ${SUPPORTED_SCHEMA})`, sourcePath);
|
|
44
54
|
}
|
|
@@ -47,12 +57,18 @@ function parseMapping(yaml, sourcePath) {
|
|
|
47
57
|
return fail("MSL-S001", "Missing or non-string `system` field", sourcePath);
|
|
48
58
|
}
|
|
49
59
|
const direction = raw.direction;
|
|
60
|
+
if (typeof direction !== "string") {
|
|
61
|
+
return fail("MSL-S001", "Missing or non-string `direction` field", sourcePath);
|
|
62
|
+
}
|
|
50
63
|
if (direction !== "outbound" && direction !== "inbound" &&
|
|
51
64
|
direction !== "bidirectional") {
|
|
52
65
|
return fail("MSL-S001", `Invalid top-level direction '${direction}' (expected outbound/inbound/bidirectional)`, sourcePath);
|
|
53
66
|
}
|
|
54
67
|
const identity = raw.identity;
|
|
55
|
-
|
|
68
|
+
if (!isRecord(identity)) {
|
|
69
|
+
return fail("MSL-S001", "Missing or non-object `identity` field", sourcePath);
|
|
70
|
+
}
|
|
71
|
+
const scheme = identity["external-id-scheme"];
|
|
56
72
|
if (typeof scheme !== "string") {
|
|
57
73
|
return fail("MSL-S001", "Missing identity.external-id-scheme", sourcePath);
|
|
58
74
|
}
|
|
@@ -60,19 +76,42 @@ function parseMapping(yaml, sourcePath) {
|
|
|
60
76
|
return fail("MSL-S004", `system '${system}' does not match identity.external-id-scheme '${scheme}'`, sourcePath);
|
|
61
77
|
}
|
|
62
78
|
const conflict = raw.conflict;
|
|
79
|
+
if (conflict !== undefined && !isRecord(conflict)) {
|
|
80
|
+
return fail("MSL-S001", "Non-object `conflict` field", sourcePath);
|
|
81
|
+
}
|
|
63
82
|
const policy = conflict?.default;
|
|
83
|
+
if (policy !== undefined && typeof policy !== "string") {
|
|
84
|
+
return fail("MSL-S001", "Non-string conflict.default", sourcePath);
|
|
85
|
+
}
|
|
64
86
|
if (policy !== undefined && !ALLOWED_POLICIES.has(policy)) {
|
|
65
87
|
return fail("MSL-S003", `Unknown conflict policy '${policy}' (allowed: manual, local-wins, remote-wins; newest-wins removed pre-1.0)`, sourcePath);
|
|
66
88
|
}
|
|
67
89
|
const cacheRaw = raw.cache;
|
|
68
|
-
|
|
90
|
+
if (cacheRaw !== undefined && !isRecord(cacheRaw)) {
|
|
91
|
+
return fail("MSL-S001", "Non-object `cache` field", sourcePath);
|
|
92
|
+
}
|
|
93
|
+
const ttlStr = cacheRaw?.ttl === undefined ? "15m" : cacheRaw.ttl;
|
|
94
|
+
if (typeof ttlStr !== "string") {
|
|
95
|
+
return fail("MSL-S001", "Non-string cache.ttl", sourcePath);
|
|
96
|
+
}
|
|
69
97
|
const ttlMs = parseDurationMs(ttlStr);
|
|
70
98
|
if (ttlMs === null) {
|
|
71
99
|
return fail("MSL-S005", `Unparseable cache.ttl '${ttlStr}' (expected: 15m, 1h, 7d etc.)`, sourcePath);
|
|
72
100
|
}
|
|
73
|
-
const attrsRaw = raw.attributes
|
|
101
|
+
const attrsRaw = raw.attributes === undefined ? [] : raw.attributes;
|
|
102
|
+
if (!Array.isArray(attrsRaw)) {
|
|
103
|
+
return fail("MSL-S001", "Non-array `attributes` field", sourcePath);
|
|
104
|
+
}
|
|
74
105
|
const attributes = [];
|
|
75
106
|
for (const a of attrsRaw) {
|
|
107
|
+
if (!isRecord(a) || typeof a.markspec !== "string" ||
|
|
108
|
+
typeof a.external !== "string") {
|
|
109
|
+
return fail("MSL-S001", "Each attribute mapping requires an object with string 'markspec' and 'external' fields", sourcePath);
|
|
110
|
+
}
|
|
111
|
+
if ((a.direction !== undefined && typeof a.direction !== "string") ||
|
|
112
|
+
(a.locked !== undefined && typeof a.locked !== "boolean")) {
|
|
113
|
+
return fail("MSL-S001", "Attribute mapping requires a string 'direction' and boolean 'locked' when present", sourcePath);
|
|
114
|
+
}
|
|
76
115
|
const attrDir = (a.direction === "outbound" || a.direction === "inbound" ||
|
|
77
116
|
a.direction === "bidirectional")
|
|
78
117
|
? a.direction
|
|
@@ -81,9 +120,6 @@ function parseMapping(yaml, sourcePath) {
|
|
|
81
120
|
if (locked && attrDir === "outbound") {
|
|
82
121
|
return fail("MSL-S002", `Attribute '${a.markspec}': locked: true contradicts direction: outbound`, sourcePath);
|
|
83
122
|
}
|
|
84
|
-
if (typeof a.markspec !== "string" || typeof a.external !== "string") {
|
|
85
|
-
return fail("MSL-S001", "Each attribute mapping requires string 'markspec' and 'external' fields", sourcePath);
|
|
86
|
-
}
|
|
87
123
|
attributes.push({
|
|
88
124
|
markspec: a.markspec,
|
|
89
125
|
external: a.external,
|
|
@@ -103,6 +139,13 @@ function parseMapping(yaml, sourcePath) {
|
|
|
103
139
|
};
|
|
104
140
|
return { mapping, diagnostics: [] };
|
|
105
141
|
}
|
|
142
|
+
/** Whether a YAML value is a plain mapping rather than a scalar or sequence. */
|
|
143
|
+
function isRecord(value) {
|
|
144
|
+
if (typeof value !== "object" || value === null)
|
|
145
|
+
return false;
|
|
146
|
+
const prototype = Object.getPrototypeOf(value);
|
|
147
|
+
return prototype === Object.prototype || prototype === null;
|
|
148
|
+
}
|
|
106
149
|
/**
|
|
107
150
|
* Cross-system validation: at most one system writes locally per attribute.
|
|
108
151
|
* "Writes locally" = direction is `inbound` or `bidirectional`. Multiple
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display-ID token characters are ASCII letters, digits, dots, slashes,
|
|
3
|
+
* underscores and hyphens. The LSP reads the whole token under the cursor,
|
|
4
|
+
* including trailing characters in this set, then applies DISPLAY_ID_TOKEN_RE.
|
|
5
|
+
* The renderer scans whole runs of the same characters and resolves each
|
|
6
|
+
* against the known IDs: exact match first, then split on slashes only if
|
|
7
|
+
* every segment is nonempty and a known ID. If neither resolves, remove one
|
|
8
|
+
* trailing period and repeat, leaving the removed period outside the link.
|
|
9
|
+
* A token with a trailing hyphen, such as SYS_A-, does not link SYS_A.
|
|
10
|
+
* With only A/B and C known, A/B/C links nothing: slash segments are not
|
|
11
|
+
* recursively grouped. A known short ID links wherever it stands alone.
|
|
12
|
+
* These recognition rules do not constrain the parser's entry IDs.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DISPLAY_ID_CHAR_RE: RegExp;
|
|
15
|
+
/**
|
|
16
|
+
* An LSP display-ID token starts with an ASCII letter or digit and contains
|
|
17
|
+
* at least three characters. Any display-ID character may end the token.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DISPLAY_ID_TOKEN_RE: RegExp;
|
|
20
|
+
//# sourceMappingURL=display_id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display_id.d.ts","sourceRoot":"","sources":["../../src/util/display_id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,QAAoB,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAEjC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DISPLAY_ID_TOKEN_RE = exports.DISPLAY_ID_CHAR_RE = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Display-ID token characters are ASCII letters, digits, dots, slashes,
|
|
6
|
+
* underscores and hyphens. The LSP reads the whole token under the cursor,
|
|
7
|
+
* including trailing characters in this set, then applies DISPLAY_ID_TOKEN_RE.
|
|
8
|
+
* The renderer scans whole runs of the same characters and resolves each
|
|
9
|
+
* against the known IDs: exact match first, then split on slashes only if
|
|
10
|
+
* every segment is nonempty and a known ID. If neither resolves, remove one
|
|
11
|
+
* trailing period and repeat, leaving the removed period outside the link.
|
|
12
|
+
* A token with a trailing hyphen, such as SYS_A-, does not link SYS_A.
|
|
13
|
+
* With only A/B and C known, A/B/C links nothing: slash segments are not
|
|
14
|
+
* recursively grouped. A known short ID links wherever it stands alone.
|
|
15
|
+
* These recognition rules do not constrain the parser's entry IDs.
|
|
16
|
+
*/
|
|
17
|
+
exports.DISPLAY_ID_CHAR_RE = /[A-Za-z0-9._/-]/;
|
|
18
|
+
/**
|
|
19
|
+
* An LSP display-ID token starts with an ASCII letter or digit and contains
|
|
20
|
+
* at least three characters. Any display-ID character may end the token.
|
|
21
|
+
*/
|
|
22
|
+
exports.DISPLAY_ID_TOKEN_RE = new RegExp(`^[A-Za-z0-9]${exports.DISPLAY_ID_CHAR_RE.source}{2,}$`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/validator/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/validator/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AAYzB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,kBAAkB,CAoCpB;AAqBD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,UAAU,EAAE,CA8Ed"}
|
|
@@ -16,6 +16,7 @@ exports.effectiveScope = effectiveScope;
|
|
|
16
16
|
exports.validateAttributesForEntry = validateAttributesForEntry;
|
|
17
17
|
const mod_js_1 = require("../model/mod.js");
|
|
18
18
|
const value_types_js_1 = require("./value_types.js");
|
|
19
|
+
const split_js_1 = require("../refs/split.js");
|
|
19
20
|
/** Core-reserved attribute keys that are always permitted regardless of profile. */
|
|
20
21
|
const CORE_RESERVED_KEYS = new Set([
|
|
21
22
|
"Id",
|
|
@@ -136,8 +137,10 @@ function validateAttributesForEntry(entry, profile) {
|
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
139
|
// MSL-A004: value-type conformance.
|
|
140
|
+
// A bracket locator (`A [x]`) is not part of an id value.
|
|
141
|
+
const isIdType = decl.type === "id" || decl.type === "id-list";
|
|
139
142
|
for (const v of values) {
|
|
140
|
-
const detail = (0, value_types_js_1.validateValue)(v, decl);
|
|
143
|
+
const detail = (0, value_types_js_1.validateValue)(isIdType ? (0, split_js_1.traceTarget)(v) : v, decl);
|
|
141
144
|
if (detail !== null) {
|
|
142
145
|
diagnostics.push({
|
|
143
146
|
code: "MSL-A004",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/block_role
|
|
3
|
+
*
|
|
4
|
+
* Diagnostics for the role of a Gherkin block (epic #915, ADR-038).
|
|
5
|
+
*
|
|
6
|
+
* `MSL-B064` (warning): a scenario of a criteria block has no outcome step.
|
|
7
|
+
* A criteria block belongs to an entry that is, or extends, a Requirement
|
|
8
|
+
* or a Contract (see `blockRole`). The scenario has no `Then` step (or the
|
|
9
|
+
* keyword of the block language that means `Then`, including `And` and `But`
|
|
10
|
+
* after it), or no step at all. A scenario with `Given` and `Then` and no
|
|
11
|
+
* action is valid. `Scenario Outline` Examples are not considered.
|
|
12
|
+
*
|
|
13
|
+
* Each `feature` or `gherkin` block is checked in a top-level block or in a
|
|
14
|
+
* list item at any depth, as for `MSL-B062`. A block that has a `parseError`
|
|
15
|
+
* or no `feature` is skipped. Upstream entries are not checked
|
|
16
|
+
* (`emittableEntries`). An entry without a type after classification with
|
|
17
|
+
* the profile is not checked.
|
|
18
|
+
*
|
|
19
|
+
* The warning is reported at the file line of the `Scenario` keyword, in
|
|
20
|
+
* column 1.
|
|
21
|
+
*
|
|
22
|
+
* Four information diagnostics (severity `info`) complete the checks:
|
|
23
|
+
*
|
|
24
|
+
* - `MSL-B065`: in a procedure block (an entry that is, or extends, a Test),
|
|
25
|
+
* a step has an expected result and no action. Reported at the line of the
|
|
26
|
+
* first expected-result step.
|
|
27
|
+
* - `MSL-B066`: a scenario starts with `And` or `But`, which is read as an
|
|
28
|
+
* action. Reported at the line of that step. It applies to every role
|
|
29
|
+
* except an illustration.
|
|
30
|
+
* - `MSL-B067`: in a procedure block, a `# Step` label comment labels no
|
|
31
|
+
* step. Reported at the line of the comment.
|
|
32
|
+
* - `MSL-B068`: a feature block in a typed entry whose type has no role (an
|
|
33
|
+
* illustration). Reported at the first line of the block.
|
|
34
|
+
*
|
|
35
|
+
* The diagnostics of one entry are sorted by file line.
|
|
36
|
+
*/
|
|
37
|
+
import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
|
|
38
|
+
/** Report the block-role diagnostics for `entries`. */
|
|
39
|
+
export declare function checkBlockRoles(entries: readonly Entry[], profile: EffectiveProfile | null): Diagnostic[];
|
|
40
|
+
//# sourceMappingURL=block_role.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block_role.d.ts","sourceRoot":"","sources":["../../src/validator/block_role.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAY3E,uDAAuD;AACvD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,UAAU,EAAE,CAmGd"}
|