@driftsys/markspec 0.12.1 → 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/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/formatter/entry_body.d.ts +8 -5
- package/esm/formatter/entry_body.d.ts.map +1 -1
- package/esm/formatter/entry_body.js +12 -8
- 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/mod.d.ts +21 -2
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +64 -22
- package/esm/gates/mod.d.ts +2 -2
- package/esm/gates/mod.d.ts.map +1 -1
- package/esm/gates/mod.js +17 -2
- 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/mod.d.ts +23 -6
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +18 -5
- package/esm/model/mod.d.ts +42 -1
- 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 +2 -1
- package/esm/refs/mod.d.ts.map +1 -1
- package/esm/refs/mod.js +12 -4
- 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/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 +4 -12
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +24 -5
- 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/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/formatter/entry_body.d.ts +8 -5
- package/script/formatter/entry_body.d.ts.map +1 -1
- package/script/formatter/entry_body.js +12 -8
- 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/mod.d.ts +21 -2
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +63 -21
- package/script/gates/mod.d.ts +2 -2
- package/script/gates/mod.d.ts.map +1 -1
- package/script/gates/mod.js +17 -2
- 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/mod.d.ts +23 -6
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +45 -6
- package/script/model/mod.d.ts +42 -1
- 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 +2 -1
- package/script/refs/mod.d.ts.map +1 -1
- package/script/refs/mod.js +12 -4
- 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/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 +4 -12
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +23 -5
- 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
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* 5. Reference-shape URI scheme inference (ADR-003 §Part 6).
|
|
15
15
|
* 6. Discriminating-attribute presence (Verifies → Test,
|
|
16
16
|
* Schema-language → Contract, …).
|
|
17
|
+
* 6a. `.feature` header entries only: Feature / Rule → Requirement,
|
|
18
|
+
* Scenario → Test.
|
|
17
19
|
*
|
|
18
20
|
* Step 7 (document directive) is not consulted here; step 8
|
|
19
21
|
* (display-ID shape) has its own warning-emitting stage in
|
|
@@ -40,7 +42,7 @@ export declare function inferTypeFromDisplayIdPrefix(displayId: string): string
|
|
|
40
42
|
export declare function explicitType(entry: Entry): string | undefined;
|
|
41
43
|
/** Which step of the §1.3.1 chain resolved a type. Steps 7 and 8 are
|
|
42
44
|
* not reported here; step 8 has its own warning-emitting stage. */
|
|
43
|
-
export type TypeResolutionStep = 1 | 2 | 3 | 4 | 5 | 6;
|
|
45
|
+
export type TypeResolutionStep = 1 | 2 | 3 | 4 | 5 | 6 | "6a";
|
|
44
46
|
/** A type together with the step of the §1.3.1 chain that resolved it. */
|
|
45
47
|
export interface ResolvedTypeWithProvenance {
|
|
46
48
|
readonly type: string;
|
|
@@ -49,7 +51,7 @@ export interface ResolvedTypeWithProvenance {
|
|
|
49
51
|
/**
|
|
50
52
|
* Resolve an entry's effective core type and report which step of the
|
|
51
53
|
* spec §1.3.1 chain matched. First match wins. Returns `undefined` when
|
|
52
|
-
* no step in {1..
|
|
54
|
+
* no step in {1..6a} resolves to a known core type — callers may then
|
|
53
55
|
* consult late-stage step-8 inference (`inferTypeFromDisplayIdShape`)
|
|
54
56
|
* or treat the entry as unclassified (fallback to `Item`).
|
|
55
57
|
*/
|
|
@@ -59,7 +61,7 @@ export declare function resolvedCoreTypeWithProvenance(entry: Entry, profile?: E
|
|
|
59
61
|
* wrapper around {@linkcode resolvedCoreTypeWithProvenance} for callers
|
|
60
62
|
* that don't need to know which step matched.
|
|
61
63
|
*
|
|
62
|
-
* Returns `undefined` when no step in {1..
|
|
64
|
+
* Returns `undefined` when no step in {1..6a} resolves to a known core
|
|
63
65
|
* type. The caller decides whether to skip validation, fall back to a
|
|
64
66
|
* less specific check, or report on the unclassified state.
|
|
65
67
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type_resolution.d.ts","sourceRoot":"","sources":["../../src/validator/type_resolution.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"type_resolution.d.ts","sourceRoot":"","sources":["../../src/validator/type_resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAuB/D;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAWpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAO7D;AAYD;mEACmE;AACnE,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAE9D,0EAA0E;AAC1E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAkBD;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,0BAA0B,GAAG,SAAS,CAsDxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,MAAM,GAAG,SAAS,CAEpB"}
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* 5. Reference-shape URI scheme inference (ADR-003 §Part 6).
|
|
15
15
|
* 6. Discriminating-attribute presence (Verifies → Test,
|
|
16
16
|
* Schema-language → Contract, …).
|
|
17
|
+
* 6a. `.feature` header entries only: Feature / Rule → Requirement,
|
|
18
|
+
* Scenario → Test.
|
|
17
19
|
*
|
|
18
20
|
* Step 7 (document directive) is not consulted here; step 8
|
|
19
21
|
* (display-ID shape) has its own warning-emitting stage in
|
|
@@ -95,7 +97,7 @@ function profileTypeToCore(typeName, profile) {
|
|
|
95
97
|
/**
|
|
96
98
|
* Resolve an entry's effective core type and report which step of the
|
|
97
99
|
* spec §1.3.1 chain matched. First match wins. Returns `undefined` when
|
|
98
|
-
* no step in {1..
|
|
100
|
+
* no step in {1..6a} resolves to a known core type — callers may then
|
|
99
101
|
* consult late-stage step-8 inference (`inferTypeFromDisplayIdShape`)
|
|
100
102
|
* or treat the entry as unclassified (fallback to `Item`).
|
|
101
103
|
*/
|
|
@@ -146,6 +148,16 @@ export function resolvedCoreTypeWithProvenance(entry, profile) {
|
|
|
146
148
|
if (fromDiscriminator && CORE_TYPE_HIERARCHY[fromDiscriminator]) {
|
|
147
149
|
return { type: fromDiscriminator, step: 6 };
|
|
148
150
|
}
|
|
151
|
+
// Step 6a: node kind of a `.feature` header entry (epic #915 Case B) —
|
|
152
|
+
// Feature and Rule are Requirements, Scenario is a Test. Applies only to
|
|
153
|
+
// entries built from `.feature` files; Markdown and source-file entries
|
|
154
|
+
// never reach it.
|
|
155
|
+
if (entry.source.kind === "feature-file") {
|
|
156
|
+
return {
|
|
157
|
+
type: entry.source.node === "scenario" ? "Test" : "Requirement",
|
|
158
|
+
step: "6a",
|
|
159
|
+
};
|
|
160
|
+
}
|
|
149
161
|
return undefined;
|
|
150
162
|
}
|
|
151
163
|
/**
|
|
@@ -153,7 +165,7 @@ export function resolvedCoreTypeWithProvenance(entry, profile) {
|
|
|
153
165
|
* wrapper around {@linkcode resolvedCoreTypeWithProvenance} for callers
|
|
154
166
|
* that don't need to know which step matched.
|
|
155
167
|
*
|
|
156
|
-
* Returns `undefined` when no step in {1..
|
|
168
|
+
* Returns `undefined` when no step in {1..6a} resolves to a known core
|
|
157
169
|
* type. The caller decides whether to skip validation, fall back to a
|
|
158
170
|
* less specific check, or report on the unclassified state.
|
|
159
171
|
*/
|
package/esm/validator/types.d.ts
CHANGED
|
@@ -53,6 +53,15 @@ export declare function inferTypeFromLateStageChain(entry: Entry): readonly Diag
|
|
|
53
53
|
* is plausibly a profile type, just unreachable in core-only mode.
|
|
54
54
|
*/
|
|
55
55
|
export declare function validateCoreTypeAttribute(entry: Entry, profile: EffectiveProfile | null): readonly Diagnostic[];
|
|
56
|
+
/**
|
|
57
|
+
* The core type of a `.feature` header entry that no profile pattern
|
|
58
|
+
* classifies (epic #915 Case B). It is resolved through the type resolution
|
|
59
|
+
* chain without the profile, so `Source:` (step 3), the display-ID prefix
|
|
60
|
+
* (step 4) and a discriminating attribute (step 6) win over the node kind
|
|
61
|
+
* (step 6a: `Test` for a Scenario, `Requirement` for a Feature or a Rule).
|
|
62
|
+
* `undefined` for every other entry.
|
|
63
|
+
*/
|
|
64
|
+
export declare function featureFileCoreType(entry: Entry): string | undefined;
|
|
56
65
|
/** Result of classifying a single entry. */
|
|
57
66
|
export interface ClassifyResult {
|
|
58
67
|
/** The assigned type name, or `undefined` if un-classified. */
|
|
@@ -66,6 +75,8 @@ export interface ClassifyResult {
|
|
|
66
75
|
* 1. Explicit `Type:` trailer attribute (if present).
|
|
67
76
|
* 2. Display-ID pattern match across types whose `shape` matches
|
|
68
77
|
* `entry.shape`.
|
|
78
|
+
* 3. For a `.feature` header entry that no pattern matched, the node
|
|
79
|
+
* kind (step 6a, {@linkcode featureFileCoreType}).
|
|
69
80
|
*
|
|
70
81
|
* Emits:
|
|
71
82
|
* - `MSL-T001` when explicit `Type:` value is not in the profile's type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validator/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAEhB,KAAK,EAEN,MAAM,iBAAiB,CAAC;AAwBzB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,KAAK,GACX,SAAS,UAAU,EAAE,CAWvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,KAAK,GACX,SAAS,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validator/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAEhB,KAAK,EAEN,MAAM,iBAAiB,CAAC;AAwBzB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,KAAK,GACX,SAAS,UAAU,EAAE,CAWvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,KAAK,GACX,SAAS,UAAU,EAAE,CAkBvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,SAAS,UAAU,EAAE,CAwBvB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAGpE;AAED,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,gBAAgB,GACxB,cAAc,CAwEhB;AAED,0EAA0E;AAC1E,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GACxB,mBAAmB,CAkCrB"}
|
package/esm/validator/types.js
CHANGED
|
@@ -74,7 +74,8 @@ export function inferTypeFromLateStageChain(entry) {
|
|
|
74
74
|
const resolved = resolvedCoreTypeWithProvenance(entry);
|
|
75
75
|
if (!resolved)
|
|
76
76
|
return [];
|
|
77
|
-
|
|
77
|
+
// Step 6a is the silent default for `.feature` header entries.
|
|
78
|
+
if (resolved.step === "6a" || resolved.step < 5)
|
|
78
79
|
return [];
|
|
79
80
|
const source = resolved.step === 5
|
|
80
81
|
? "URI scheme"
|
|
@@ -126,6 +127,19 @@ export function validateCoreTypeAttribute(entry, profile) {
|
|
|
126
127
|
location: entry.location,
|
|
127
128
|
}];
|
|
128
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* The core type of a `.feature` header entry that no profile pattern
|
|
132
|
+
* classifies (epic #915 Case B). It is resolved through the type resolution
|
|
133
|
+
* chain without the profile, so `Source:` (step 3), the display-ID prefix
|
|
134
|
+
* (step 4) and a discriminating attribute (step 6) win over the node kind
|
|
135
|
+
* (step 6a: `Test` for a Scenario, `Requirement` for a Feature or a Rule).
|
|
136
|
+
* `undefined` for every other entry.
|
|
137
|
+
*/
|
|
138
|
+
export function featureFileCoreType(entry) {
|
|
139
|
+
if (entry.source.kind !== "feature-file")
|
|
140
|
+
return undefined;
|
|
141
|
+
return resolvedCoreTypeWithProvenance(entry)?.type;
|
|
142
|
+
}
|
|
129
143
|
/**
|
|
130
144
|
* Classify one {@linkcode Entry} against the profile's type vocabulary.
|
|
131
145
|
*
|
|
@@ -133,6 +147,8 @@ export function validateCoreTypeAttribute(entry, profile) {
|
|
|
133
147
|
* 1. Explicit `Type:` trailer attribute (if present).
|
|
134
148
|
* 2. Display-ID pattern match across types whose `shape` matches
|
|
135
149
|
* `entry.shape`.
|
|
150
|
+
* 3. For a `.feature` header entry that no pattern matched, the node
|
|
151
|
+
* kind (step 6a, {@linkcode featureFileCoreType}).
|
|
136
152
|
*
|
|
137
153
|
* Emits:
|
|
138
154
|
* - `MSL-T001` when explicit `Type:` value is not in the profile's type
|
|
@@ -160,8 +176,9 @@ export function classifyEntry(entry, profile) {
|
|
|
160
176
|
// 2. Display-ID pattern match across same-shape types (Authored only).
|
|
161
177
|
// Reference entries use URI scheme or explicit Type: for classification;
|
|
162
178
|
// matching display-id-patterns against their slug-style IDs is incorrect.
|
|
163
|
-
if (entry.shape !== "Authored")
|
|
164
|
-
return { type:
|
|
179
|
+
if (entry.shape !== "Authored") {
|
|
180
|
+
return { type: featureFileCoreType(entry), diagnostics };
|
|
181
|
+
}
|
|
165
182
|
const matches = [];
|
|
166
183
|
for (const [typeName, typeEntry] of profile.types) {
|
|
167
184
|
const pattern = typeEntry.value.displayIdPattern.value;
|
|
@@ -189,7 +206,12 @@ export function classifyEntry(entry, profile) {
|
|
|
189
206
|
});
|
|
190
207
|
return { type: undefined, diagnostics };
|
|
191
208
|
}
|
|
192
|
-
// 0 matches.
|
|
209
|
+
// 0 matches. A `.feature` header entry falls back to step 6a (Feature and
|
|
210
|
+
// Rule are Requirements, Scenario is a Test) and is never un-classified.
|
|
211
|
+
const fromNode = featureFileCoreType(entry);
|
|
212
|
+
if (fromNode !== undefined)
|
|
213
|
+
return { type: fromNode, diagnostics };
|
|
214
|
+
// Strict mode → MSL-T003; permissive → OK.
|
|
193
215
|
if (profile.types.size > 0) {
|
|
194
216
|
diagnostics.push({
|
|
195
217
|
code: "MSL-T003",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* Upstream entries are uxil-inert (the #771 `emittableEntries` partition,
|
|
25
25
|
* mirroring validateTypl). Entries are gated by `entry.type` when the
|
|
26
26
|
* pipeline's Stage 2 already classified them, else by `classifyEntry` —
|
|
27
|
-
* so
|
|
27
|
+
* so a caller that passes unclassified entries gates identically; the
|
|
28
28
|
* classification diagnostics are deliberately dropped here (the pipeline
|
|
29
29
|
* owns emitting those).
|
|
30
30
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driftsys/markspec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Markdown flavor and toolchain for traceable industrial documentation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"scripts": {},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"@cucumber/gherkin": "42.0.1",
|
|
33
|
+
"@cucumber/messages": "34.2.1",
|
|
32
34
|
"@dprint/formatter": "0.5.1",
|
|
33
35
|
"@dprint/markdown": "0.20.0",
|
|
34
36
|
"@types/mdast": "^4",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/ast/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAKV,IAAI,EAKL,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/ast/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAKV,IAAI,EAKL,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAGV,SAAS,EAeV,MAAM,YAAY,CAAC;AAwCpB;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE;IACH,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACxD,GAAG,SAAS,GACZ,MAAM,CAgCR;AAkdD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,GACX;IAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAkBrC"}
|
package/script/ast/build.js
CHANGED
|
@@ -14,6 +14,8 @@ exports.buildBodyAst = buildBodyAst;
|
|
|
14
14
|
exports.buildBodyAstWithTree = buildBodyAstWithTree;
|
|
15
15
|
const remark_js_1 = require("../parser/remark.js");
|
|
16
16
|
const line_endings_js_1 = require("../util/line_endings.js");
|
|
17
|
+
const load_js_1 = require("../gherkin/load.js");
|
|
18
|
+
const parse_js_1 = require("../gherkin/parse.js");
|
|
17
19
|
/**
|
|
18
20
|
* Build an InlineContent from verbatim source prose.
|
|
19
21
|
* `storedText` is the verbatim source prose that `render` emits (§5.1
|
|
@@ -391,11 +393,23 @@ function mapMdastNode(node, body) {
|
|
|
391
393
|
case "code": {
|
|
392
394
|
const lang = node.lang ?? undefined; // empty string → undefined
|
|
393
395
|
if (lang === "gherkin" || lang === "feature") {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
range
|
|
398
|
-
|
|
396
|
+
const source = node.value ?? "";
|
|
397
|
+
const api = (0, load_js_1.loadedGherkin)();
|
|
398
|
+
if (!api)
|
|
399
|
+
return { kind: "feature", source, range };
|
|
400
|
+
const parsed = (0, parse_js_1.parseFeature)(api, source);
|
|
401
|
+
return parsed.ok
|
|
402
|
+
? { kind: "feature", source, feature: parsed.feature, range }
|
|
403
|
+
: {
|
|
404
|
+
kind: "feature",
|
|
405
|
+
source,
|
|
406
|
+
parseError: {
|
|
407
|
+
line: parsed.line,
|
|
408
|
+
column: parsed.column,
|
|
409
|
+
message: parsed.message,
|
|
410
|
+
},
|
|
411
|
+
range,
|
|
412
|
+
};
|
|
399
413
|
}
|
|
400
414
|
return {
|
|
401
415
|
kind: "code",
|
|
@@ -41,8 +41,8 @@ function deepEqualIgnoringRanges(a, b) {
|
|
|
41
41
|
if (typeof a === "object" && typeof b === "object") {
|
|
42
42
|
const ao = a;
|
|
43
43
|
const bo = b;
|
|
44
|
-
const ak =
|
|
45
|
-
const bk =
|
|
44
|
+
const ak = comparedKeys(ao);
|
|
45
|
+
const bk = comparedKeys(bo);
|
|
46
46
|
if (ak.length !== bk.length)
|
|
47
47
|
return false;
|
|
48
48
|
for (let i = 0; i < ak.length; i++) {
|
|
@@ -57,3 +57,15 @@ function deepEqualIgnoringRanges(a, b) {
|
|
|
57
57
|
}
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Keys compared for one object: every key except `range`. A `FeatureNode`
|
|
62
|
+
* also skips `feature` and `parseError`: both are pure functions of
|
|
63
|
+
* `source`, which is compared, and they exist only while the Gherkin parser
|
|
64
|
+
* is loaded. Comparing them would make equivalence depend on load timing.
|
|
65
|
+
*/
|
|
66
|
+
function comparedKeys(node) {
|
|
67
|
+
const derived = node.kind === "feature";
|
|
68
|
+
return Object.keys(node)
|
|
69
|
+
.filter((k) => k !== "range" && !(derived && (k === "feature" || k === "parseError")))
|
|
70
|
+
.sort();
|
|
71
|
+
}
|
package/script/ast/nodes.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* see `core/parser/body_tokens.ts`. `InlineContent` now carries only
|
|
15
15
|
* verbatim source text.
|
|
16
16
|
*/
|
|
17
|
+
import type { FeatureAst } from "../gherkin/types.js";
|
|
17
18
|
/** Body-relative source span. 1-based line/column, matching the
|
|
18
19
|
* codebase's {@link SourceLocation} convention. No `file`: that
|
|
19
20
|
* lives on the owning {@link Entry}. */
|
|
@@ -113,12 +114,23 @@ export interface CodeNode {
|
|
|
113
114
|
readonly text: string;
|
|
114
115
|
readonly range: SourceRange;
|
|
115
116
|
}
|
|
116
|
-
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
117
|
+
/**
|
|
118
|
+
* Fenced code with info-string `gherkin` or `feature`. `source` is the
|
|
119
|
+
* authored text, kept verbatim. When the Gherkin parser is loaded, exactly
|
|
120
|
+
* one of `feature` (the normalized AST) and `parseError` is set; when it is
|
|
121
|
+
* not loaded, neither is set. Both are pure functions of `source`.
|
|
122
|
+
*/
|
|
119
123
|
export interface FeatureNode {
|
|
120
124
|
readonly kind: "feature";
|
|
121
125
|
readonly source: string;
|
|
126
|
+
/** Normalized AST of the block; ranges are relative to `source`. */
|
|
127
|
+
readonly feature?: FeatureAst;
|
|
128
|
+
/** First parser error; line 1 is the first line of `source`. */
|
|
129
|
+
readonly parseError?: {
|
|
130
|
+
readonly line: number;
|
|
131
|
+
readonly column: number;
|
|
132
|
+
readonly message: string;
|
|
133
|
+
};
|
|
122
134
|
readonly range: SourceRange;
|
|
123
135
|
}
|
|
124
136
|
/** `$$ … $$` math block (spec §2.4). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/ast/nodes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;wCAEwC;AACxC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,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AK,EAAE,WAAW,CAAC;CAC7B;AAED;qEACqE;AACrE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,gBAAgB,GAAG,MAAM,CAAC;IACzD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED,uEAAuE;AACvE,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,QAAQ,GACR,SAAS,GACT,UAAU,GACV,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,kBAAkB,GAClB,QAAQ,GACR,cAAc,GACd,WAAW,GACX,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inverses.d.ts","sourceRoot":"","sources":["../../src/compiler/inverses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,KAAK,EAEL,IAAI,EACL,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"inverses.d.ts","sourceRoot":"","sources":["../../src/compiler/inverses.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,KAAK,EAEL,IAAI,EACL,MAAM,iBAAiB,CAAC;AAIzB,oCAAoC;AACpC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAcD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GACxB,sBAAsB,CAgKxB"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.generateInverses = generateInverses;
|
|
11
11
|
const constants_js_1 = require("./constants.js");
|
|
12
|
+
const split_js_1 = require("../refs/split.js");
|
|
12
13
|
/**
|
|
13
14
|
* Generate inverse (back-link) attributes from forward link declarations.
|
|
14
15
|
*
|
|
@@ -35,6 +36,8 @@ function generateInverses(entries, profile) {
|
|
|
35
36
|
// Step 3–5: Walk entries, accumulate back-links
|
|
36
37
|
// Map: targetId → Map<inverseAttrName, Set<sourceId>>
|
|
37
38
|
const generated = new Map();
|
|
39
|
+
/** Keys of the generated edges already emitted. */
|
|
40
|
+
const edgeKeys = new Set();
|
|
38
41
|
// Parallel list of raw generated-edge data for Link emission.
|
|
39
42
|
const generatedEdges = [];
|
|
40
43
|
for (const source of entries) {
|
|
@@ -45,7 +48,13 @@ function generateInverses(entries, profile) {
|
|
|
45
48
|
const forwardValues = source.typedAttributes.get(spec.attrName);
|
|
46
49
|
if (!forwardValues)
|
|
47
50
|
continue;
|
|
48
|
-
for (const
|
|
51
|
+
for (const forwardValue of forwardValues) {
|
|
52
|
+
// A value may carry a locator (`<ULID> [Scenario name]`); the
|
|
53
|
+
// target is the part before it and the locator is copied to the
|
|
54
|
+
// generated link.
|
|
55
|
+
const parsed = (0, split_js_1.parseTraceValue)(forwardValue);
|
|
56
|
+
const locator = parsed.locator;
|
|
57
|
+
const targetId = parsed.target;
|
|
49
58
|
const target = byId.get(targetId);
|
|
50
59
|
if (!target || target.type !== spec.inverse.category)
|
|
51
60
|
continue;
|
|
@@ -59,13 +68,18 @@ function generateInverses(entries, profile) {
|
|
|
59
68
|
idSet = new Set();
|
|
60
69
|
targetMap.set(spec.inverse.name, idSet);
|
|
61
70
|
}
|
|
62
|
-
const wasNew = !idSet.has(source.id);
|
|
63
71
|
idSet.add(source.id);
|
|
72
|
+
// One generated edge per (target, inverse, source, locator): two
|
|
73
|
+
// locators from one source keep two edges.
|
|
74
|
+
const edgeKey = `${targetId}\u0000${spec.inverse.name}\u0000${source.id}\u0000${locator === undefined ? "-" : `+${locator}`}`;
|
|
75
|
+
const wasNew = !edgeKeys.has(edgeKey);
|
|
76
|
+
edgeKeys.add(edgeKey);
|
|
64
77
|
if (wasNew) {
|
|
65
78
|
generatedEdges.push({
|
|
66
79
|
targetUlid: targetId,
|
|
67
80
|
sourceUlid: source.id,
|
|
68
81
|
attrName: spec.attrName,
|
|
82
|
+
...(locator !== undefined ? { locator } : {}),
|
|
69
83
|
});
|
|
70
84
|
}
|
|
71
85
|
}
|
|
@@ -118,7 +132,7 @@ function generateInverses(entries, profile) {
|
|
|
118
132
|
}
|
|
119
133
|
// Resolve generated edges to displayId-based Link objects.
|
|
120
134
|
const links = [];
|
|
121
|
-
for (const { targetUlid, sourceUlid, attrName } of generatedEdges) {
|
|
135
|
+
for (const { targetUlid, sourceUlid, attrName, locator } of generatedEdges) {
|
|
122
136
|
const kind = constants_js_1.ATTR_TO_LINK_KIND[attrName];
|
|
123
137
|
if (!kind)
|
|
124
138
|
continue;
|
|
@@ -132,6 +146,7 @@ function generateInverses(entries, profile) {
|
|
|
132
146
|
kind,
|
|
133
147
|
location: source.location,
|
|
134
148
|
origin: "generated",
|
|
149
|
+
...(locator !== undefined ? { locator } : {}),
|
|
135
150
|
});
|
|
136
151
|
}
|
|
137
152
|
return { entries: result, links, diagnostics };
|
package/script/compiler/mod.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Compiler pipeline. Takes file paths, parses all entries, validates them,
|
|
5
5
|
* builds a bidirectional traceability graph, and returns the compiled model.
|
|
6
6
|
*/
|
|
7
|
-
import type { Diagnostic, DisplayId, Document, EffectiveProfile, Entry, Link } from "../model/mod.js";
|
|
7
|
+
import type { CaptionConventions, Diagnostic, DisplayId, Document, EffectiveProfile, Entry, Link } from "../model/mod.js";
|
|
8
8
|
import { type TypeRegistry } from "../typl/mod.js";
|
|
9
9
|
/** Options for {@linkcode compile}. */
|
|
10
10
|
export interface CompileOptions {
|
|
@@ -50,6 +50,31 @@ export interface CompileOptions {
|
|
|
50
50
|
* deterministically. Optional — absent means no corpus.
|
|
51
51
|
*/
|
|
52
52
|
readonly corpusEntries?: readonly Entry[];
|
|
53
|
+
/**
|
|
54
|
+
* Caption-position conventions from `.markspec.yaml`
|
|
55
|
+
* (`ToolConfig.captionConventions`), passed to the validator pipeline
|
|
56
|
+
* for MSL-C072. Optional — absent means the rule is inactive.
|
|
57
|
+
*/
|
|
58
|
+
readonly captionConventions?: CaptionConventions;
|
|
59
|
+
/**
|
|
60
|
+
* Upstream ids declared in `project.yaml` `dependencies:` and
|
|
61
|
+
* `references:` (derived with `deriveUpstreamId`). Passed to the
|
|
62
|
+
* validator pipeline so a trace target that stays unresolved is
|
|
63
|
+
* reported as MSL-T014 instead of MSL-L006. Optional — absent means
|
|
64
|
+
* MSL-L006 is unchanged.
|
|
65
|
+
*/
|
|
66
|
+
readonly declaredUpstreamIds?: readonly string[];
|
|
67
|
+
/**
|
|
68
|
+
* Scope of the validator pipeline. Defaults to `true`: the compiled path
|
|
69
|
+
* set is the whole project, so MSL-L006 and MSL-T014 are reported. Pass
|
|
70
|
+
* `false` when the paths are one file or a subset (`insert <file>`,
|
|
71
|
+
* `doc build <file>`, `lint <file>`): a target in a file outside the set
|
|
72
|
+
* cannot be told from a typo, so the project-wide trace and DSL codes are
|
|
73
|
+
* suppressed, as in `check <file>` (ADR-027). `false` also suppresses the
|
|
74
|
+
* cross-entry DSL codes TYPL-009, TYPL-010, TYPL-011, UXIL-016, UXIL-017
|
|
75
|
+
* and UXIL-018 for the same reason.
|
|
76
|
+
*/
|
|
77
|
+
readonly projectWide?: boolean;
|
|
53
78
|
}
|
|
54
79
|
/** Compiled project output with resolved traceability graph. */
|
|
55
80
|
export interface CompileResult {
|
|
@@ -75,6 +100,14 @@ export interface CompileResult {
|
|
|
75
100
|
* Compile MarkSpec files from the given paths into a resolved
|
|
76
101
|
* traceability graph.
|
|
77
102
|
*
|
|
103
|
+
* The returned diagnostics combine parse diagnostics, the validator
|
|
104
|
+
* pipeline's diagnostics, inverse-generation diagnostics and MSL-T013. The
|
|
105
|
+
* pipeline call is the same `runPipeline` call that bare `markspec check`
|
|
106
|
+
* and the LSP make, with project-wide scope by default
|
|
107
|
+
* (`options.projectWide`), so MSL-L006 and the other traceability rules are
|
|
108
|
+
* included. The diagnostics do not include fmt drift, lockfile drift or prose
|
|
109
|
+
* lint.
|
|
110
|
+
*
|
|
78
111
|
* @param paths - File paths to compile
|
|
79
112
|
* @param options - Compile options
|
|
80
113
|
* @returns Compiled entries, links, and diagnostics
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/compiler/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,KAAK,EAEL,IAAI,EAEL,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/compiler/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,KAAK,EAEL,IAAI,EAEL,MAAM,iBAAiB,CAAC;AAczB,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAOtE,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,qGAAqG;IACrG,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAClB,IAAI,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