@driftsys/markspec 0.6.1 → 0.7.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.
Files changed (156) hide show
  1. package/README.md +2 -3
  2. package/esm/compiler/constants.d.ts +1 -1
  3. package/esm/compiler/constants.d.ts.map +1 -1
  4. package/esm/compiler/constants.js +4 -14
  5. package/esm/config/markspec.d.ts +1 -0
  6. package/esm/config/markspec.d.ts.map +1 -1
  7. package/esm/config/markspec.js +5 -1
  8. package/esm/lint/mod.d.ts +2 -0
  9. package/esm/lint/mod.d.ts.map +1 -1
  10. package/esm/lint/mod.js +1 -0
  11. package/esm/lint/rules/xref.d.ts +32 -5
  12. package/esm/lint/rules/xref.d.ts.map +1 -1
  13. package/esm/lint/rules/xref.js +40 -0
  14. package/esm/lint/runner.d.ts.map +1 -1
  15. package/esm/lint/runner.js +6 -2
  16. package/esm/lint/score_text.d.ts +67 -0
  17. package/esm/lint/score_text.d.ts.map +1 -0
  18. package/esm/lint/score_text.js +74 -0
  19. package/esm/lock/compare.d.ts +34 -0
  20. package/esm/lock/compare.d.ts.map +1 -0
  21. package/esm/lock/compare.js +64 -0
  22. package/esm/lock/mod.d.ts +2 -1
  23. package/esm/lock/mod.d.ts.map +1 -1
  24. package/esm/lock/mod.js +1 -0
  25. package/esm/lock/model.d.ts +13 -0
  26. package/esm/lock/model.d.ts.map +1 -1
  27. package/esm/lock/parser.d.ts +3 -0
  28. package/esm/lock/parser.d.ts.map +1 -1
  29. package/esm/lock/parser.js +37 -1
  30. package/esm/lock/resolve.d.ts.map +1 -1
  31. package/esm/lock/resolve.js +3 -11
  32. package/esm/lock/serializer.d.ts.map +1 -1
  33. package/esm/lock/serializer.js +6 -1
  34. package/esm/mod.d.ts +9 -5
  35. package/esm/mod.d.ts.map +1 -1
  36. package/esm/mod.js +7 -3
  37. package/esm/model/attributes.d.ts.map +1 -1
  38. package/esm/model/attributes.js +7 -0
  39. package/esm/model/mod.d.ts +3 -1
  40. package/esm/model/mod.d.ts.map +1 -1
  41. package/esm/model/mod.js +6 -14
  42. package/esm/model/relations.d.ts +35 -0
  43. package/esm/model/relations.d.ts.map +1 -0
  44. package/esm/model/relations.js +86 -0
  45. package/esm/model/type_hierarchy.d.ts +7 -0
  46. package/esm/model/type_hierarchy.d.ts.map +1 -1
  47. package/esm/model/type_hierarchy.js +35 -10
  48. package/esm/profile/display_id.d.ts +60 -0
  49. package/esm/profile/display_id.d.ts.map +1 -0
  50. package/esm/profile/display_id.js +80 -0
  51. package/esm/profile/manifest.d.ts +8 -0
  52. package/esm/profile/manifest.d.ts.map +1 -1
  53. package/esm/profile/manifest.js +9 -8
  54. package/esm/profile/mod.d.ts +3 -0
  55. package/esm/profile/mod.d.ts.map +1 -1
  56. package/esm/profile/mod.js +2 -0
  57. package/esm/profile/trace_targets.d.ts +43 -0
  58. package/esm/profile/trace_targets.d.ts.map +1 -0
  59. package/esm/profile/trace_targets.js +74 -0
  60. package/esm/self_upgrade/compare.d.ts +19 -0
  61. package/esm/self_upgrade/compare.d.ts.map +1 -0
  62. package/esm/self_upgrade/compare.js +35 -0
  63. package/esm/self_upgrade/manifest.d.ts +21 -0
  64. package/esm/self_upgrade/manifest.d.ts.map +1 -0
  65. package/esm/self_upgrade/manifest.js +27 -0
  66. package/esm/self_upgrade/mod.d.ts +12 -0
  67. package/esm/self_upgrade/mod.d.ts.map +1 -0
  68. package/esm/self_upgrade/mod.js +11 -0
  69. package/esm/self_upgrade/pm_detect.d.ts +27 -0
  70. package/esm/self_upgrade/pm_detect.d.ts.map +1 -0
  71. package/esm/self_upgrade/pm_detect.js +55 -0
  72. package/esm/self_upgrade/target.d.ts +25 -0
  73. package/esm/self_upgrade/target.d.ts.map +1 -0
  74. package/esm/self_upgrade/target.js +34 -0
  75. package/esm/validator/listing.d.ts.map +1 -1
  76. package/esm/validator/listing.js +9 -10
  77. package/esm/validator/trace_types.d.ts.map +1 -1
  78. package/esm/validator/trace_types.js +7 -29
  79. package/package.json +1 -1
  80. package/script/compiler/constants.d.ts +1 -1
  81. package/script/compiler/constants.d.ts.map +1 -1
  82. package/script/compiler/constants.js +4 -14
  83. package/script/config/markspec.d.ts +1 -0
  84. package/script/config/markspec.d.ts.map +1 -1
  85. package/script/config/markspec.js +7 -3
  86. package/script/lint/mod.d.ts +2 -0
  87. package/script/lint/mod.d.ts.map +1 -1
  88. package/script/lint/mod.js +3 -1
  89. package/script/lint/rules/xref.d.ts +32 -5
  90. package/script/lint/rules/xref.d.ts.map +1 -1
  91. package/script/lint/rules/xref.js +42 -0
  92. package/script/lint/runner.d.ts.map +1 -1
  93. package/script/lint/runner.js +5 -1
  94. package/script/lint/score_text.d.ts +67 -0
  95. package/script/lint/score_text.d.ts.map +1 -0
  96. package/script/lint/score_text.js +77 -0
  97. package/script/lock/compare.d.ts +34 -0
  98. package/script/lock/compare.d.ts.map +1 -0
  99. package/script/lock/compare.js +67 -0
  100. package/script/lock/mod.d.ts +2 -1
  101. package/script/lock/mod.d.ts.map +1 -1
  102. package/script/lock/mod.js +3 -1
  103. package/script/lock/model.d.ts +13 -0
  104. package/script/lock/model.d.ts.map +1 -1
  105. package/script/lock/parser.d.ts +3 -0
  106. package/script/lock/parser.d.ts.map +1 -1
  107. package/script/lock/parser.js +37 -1
  108. package/script/lock/resolve.d.ts.map +1 -1
  109. package/script/lock/resolve.js +3 -11
  110. package/script/lock/serializer.d.ts.map +1 -1
  111. package/script/lock/serializer.js +6 -1
  112. package/script/mod.d.ts +9 -5
  113. package/script/mod.d.ts.map +1 -1
  114. package/script/mod.js +85 -63
  115. package/script/model/attributes.d.ts.map +1 -1
  116. package/script/model/attributes.js +7 -0
  117. package/script/model/mod.d.ts +3 -1
  118. package/script/model/mod.d.ts.map +1 -1
  119. package/script/model/mod.js +9 -14
  120. package/script/model/relations.d.ts +35 -0
  121. package/script/model/relations.d.ts.map +1 -0
  122. package/script/model/relations.js +89 -0
  123. package/script/model/type_hierarchy.d.ts +7 -0
  124. package/script/model/type_hierarchy.d.ts.map +1 -1
  125. package/script/model/type_hierarchy.js +36 -10
  126. package/script/profile/display_id.d.ts +60 -0
  127. package/script/profile/display_id.d.ts.map +1 -0
  128. package/script/profile/display_id.js +86 -0
  129. package/script/profile/manifest.d.ts +8 -0
  130. package/script/profile/manifest.d.ts.map +1 -1
  131. package/script/profile/manifest.js +18 -16
  132. package/script/profile/mod.d.ts +3 -0
  133. package/script/profile/mod.d.ts.map +1 -1
  134. package/script/profile/mod.js +10 -1
  135. package/script/profile/trace_targets.d.ts +43 -0
  136. package/script/profile/trace_targets.d.ts.map +1 -0
  137. package/script/profile/trace_targets.js +79 -0
  138. package/script/self_upgrade/compare.d.ts +19 -0
  139. package/script/self_upgrade/compare.d.ts.map +1 -0
  140. package/script/self_upgrade/compare.js +38 -0
  141. package/script/self_upgrade/manifest.d.ts +21 -0
  142. package/script/self_upgrade/manifest.d.ts.map +1 -0
  143. package/script/self_upgrade/manifest.js +31 -0
  144. package/script/self_upgrade/mod.d.ts +12 -0
  145. package/script/self_upgrade/mod.d.ts.map +1 -0
  146. package/script/self_upgrade/mod.js +20 -0
  147. package/script/self_upgrade/pm_detect.d.ts +27 -0
  148. package/script/self_upgrade/pm_detect.d.ts.map +1 -0
  149. package/script/self_upgrade/pm_detect.js +58 -0
  150. package/script/self_upgrade/target.d.ts +25 -0
  151. package/script/self_upgrade/target.d.ts.map +1 -0
  152. package/script/self_upgrade/target.js +38 -0
  153. package/script/validator/listing.d.ts.map +1 -1
  154. package/script/validator/listing.js +9 -10
  155. package/script/validator/trace_types.d.ts.map +1 -1
  156. package/script/validator/trace_types.js +6 -28
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @module model/relations
3
+ *
4
+ * Single source of truth for core trace-relation metadata. Each consumer
5
+ * (compiler link production, validator target rules, lockfile edge extraction)
6
+ * PROJECTS the facet it needs from CORE_RELATIONS rather than hand-listing
7
+ * relations — see ADR-024's "four duplicated lists" follow-up.
8
+ *
9
+ * This is the CORE relation set only. Profile-declared relations/inverses and
10
+ * the runtime inverse-generation path are separate and extend this at runtime.
11
+ */
12
+ import type { LinkKind } from "./mod.js";
13
+ /** Intrinsic facts about one core trace relation. Facet PRESENCE drives each
14
+ * consumer's membership. */
15
+ export interface RelationDef {
16
+ /** Trailer attribute key, e.g. "Provides". */
17
+ readonly attr: string;
18
+ /** Present ⇒ the relation produces a graph edge of this kind. */
19
+ readonly linkKind?: LinkKind;
20
+ /** Present ⇒ MSL-R083 constrains the target to these types (ancestor-walked). */
21
+ readonly targetTypes?: readonly string[];
22
+ /** true ⇒ included in lockfile canonical edge extraction. */
23
+ readonly lockEdge?: boolean;
24
+ }
25
+ /** The core relations. Union of what the compiler / validator / lock each need;
26
+ * every row carries exactly the facets that consumer set has today. */
27
+ export declare const CORE_RELATIONS: readonly RelationDef[];
28
+ /**
29
+ * Lock-edge keys that are NOT forward relations. The lockfile tracks the
30
+ * verification edge by its inverse name `Verified-by` (not `Verifies`), so it is
31
+ * an explicit addition rather than a derived `lockEdge` flag. Kept visible on
32
+ * purpose — see ADR-024.
33
+ */
34
+ export declare const LOCK_EXTRA_INVERSE_KEYS: readonly string[];
35
+ //# sourceMappingURL=relations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relations.d.ts","sourceRoot":"","sources":["../../src/model/relations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC;4BAC4B;AAC5B,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;uEACuE;AACvE,eAAO,MAAM,cAAc,EAAE,SAAS,WAAW,EAiEhD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAAoB,CAAC"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ /**
3
+ * @module model/relations
4
+ *
5
+ * Single source of truth for core trace-relation metadata. Each consumer
6
+ * (compiler link production, validator target rules, lockfile edge extraction)
7
+ * PROJECTS the facet it needs from CORE_RELATIONS rather than hand-listing
8
+ * relations — see ADR-024's "four duplicated lists" follow-up.
9
+ *
10
+ * This is the CORE relation set only. Profile-declared relations/inverses and
11
+ * the runtime inverse-generation path are separate and extend this at runtime.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.LOCK_EXTRA_INVERSE_KEYS = exports.CORE_RELATIONS = void 0;
15
+ /** The core relations. Union of what the compiler / validator / lock each need;
16
+ * every row carries exactly the facets that consumer set has today. */
17
+ exports.CORE_RELATIONS = [
18
+ {
19
+ attr: "Satisfies",
20
+ linkKind: "satisfies",
21
+ targetTypes: ["Specification"],
22
+ lockEdge: true,
23
+ },
24
+ {
25
+ attr: "Derived-from",
26
+ linkKind: "derived-from",
27
+ targetTypes: ["Specification"],
28
+ lockEdge: true,
29
+ },
30
+ { attr: "References", linkKind: "references", lockEdge: true },
31
+ {
32
+ attr: "Allocated-to",
33
+ linkKind: "allocated-to",
34
+ targetTypes: ["Component"],
35
+ lockEdge: true,
36
+ },
37
+ {
38
+ attr: "Realizes",
39
+ linkKind: "realizes",
40
+ targetTypes: ["Specification"],
41
+ lockEdge: true,
42
+ },
43
+ {
44
+ attr: "Verifies",
45
+ linkKind: "verifies",
46
+ targetTypes: ["Requirement", "Contract"],
47
+ },
48
+ {
49
+ attr: "Tests",
50
+ linkKind: "tests",
51
+ targetTypes: ["Component", "Unit", "Contract"],
52
+ lockEdge: true,
53
+ },
54
+ {
55
+ attr: "Depends-on",
56
+ linkKind: "depends-on",
57
+ targetTypes: ["Component", "Unit"],
58
+ lockEdge: true,
59
+ },
60
+ {
61
+ attr: "Part-of",
62
+ linkKind: "part-of",
63
+ targetTypes: ["Component"],
64
+ lockEdge: true,
65
+ },
66
+ { attr: "Generated-from", linkKind: "generated-from", lockEdge: true },
67
+ { attr: "Supersedes", linkKind: "supersedes", lockEdge: true },
68
+ {
69
+ attr: "Provides",
70
+ linkKind: "provides",
71
+ targetTypes: ["Contract"],
72
+ lockEdge: true,
73
+ },
74
+ {
75
+ attr: "Requires",
76
+ linkKind: "requires",
77
+ targetTypes: ["Contract"],
78
+ lockEdge: true,
79
+ },
80
+ { attr: "Mitigated-by", targetTypes: ["Specification"] },
81
+ { attr: "Affects", targetTypes: ["Component", "Unit", "Contract"] },
82
+ ];
83
+ /**
84
+ * Lock-edge keys that are NOT forward relations. The lockfile tracks the
85
+ * verification edge by its inverse name `Verified-by` (not `Verifies`), so it is
86
+ * an explicit addition rather than a derived `lockEdge` flag. Kept visible on
87
+ * purpose — see ADR-024.
88
+ */
89
+ exports.LOCK_EXTRA_INVERSE_KEYS = ["Verified-by"];
@@ -41,6 +41,13 @@ export declare const CORE_TYPE_HIERARCHY: Readonly<Record<string, CoreTypeDef>>;
41
41
  * `ownAttrs` list contributes.
42
42
  */
43
43
  export declare function attributesForType(typeName: string): Set<string>;
44
+ /**
45
+ * Every type whose ancestor chain includes `ancestor` (inclusive of `ancestor`
46
+ * itself), per {@linkcode CORE_TYPE_HIERARCHY}. Returns an empty set when
47
+ * `ancestor` is not a known core type. Used to derive type-family sets (e.g. the
48
+ * components-listing family) so they cannot drift from the hierarchy.
49
+ */
50
+ export declare function descendantsOf(ancestor: string): Set<string>;
44
51
  /**
45
52
  * Union of every type-scoped attribute name declared anywhere in the
46
53
  * core hierarchy. Used by the validator to suppress `MSL-R010`
@@ -1 +1 @@
1
- {"version":3,"file":"type_hierarchy.d.ts","sourceRoot":"","sources":["../../src/model/type_hierarchy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CA0ErE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAa/D;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAMnD,CAAC"}
1
+ {"version":3,"file":"type_hierarchy.d.ts","sourceRoot":"","sources":["../../src/model/type_hierarchy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CA6ErE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAa/D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAc3D;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAMnD,CAAC"}
@@ -11,6 +11,7 @@
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CORE_TYPE_SCOPED_ATTRS = exports.CORE_TYPE_HIERARCHY = void 0;
13
13
  exports.attributesForType = attributesForType;
14
+ exports.descendantsOf = descendantsOf;
14
15
  /**
15
16
  * Built-in type hierarchy. Keyed by the canonical TitleCase / lower-with-
16
17
  * hyphens name as it would appear in a `Type:` attribute value.
@@ -32,6 +33,19 @@ exports.CORE_TYPE_HIERARCHY = {
32
33
  excludedAttrs: ["Allocated-to"],
33
34
  },
34
35
  Contract: { parent: "Specification", ownAttrs: ["Schema-language"] },
36
+ // Interface specifications — software/hardware boundary contracts.
37
+ // Re-parented from Component (an interface is a spec, not a building
38
+ // block); names kept (literature terms for an interface specification).
39
+ SoftwareInterface: { parent: "Contract", ownAttrs: [] },
40
+ HardwareInterface: {
41
+ parent: "Contract",
42
+ ownAttrs: [
43
+ "Bus-protocol",
44
+ "Connector-type",
45
+ "Voltage-level",
46
+ "Signal-direction",
47
+ ],
48
+ },
35
49
  Record: { parent: "Specification", ownAttrs: ["Caused-by", "Affects"] },
36
50
  Risk: { parent: "Specification", ownAttrs: ["Caused-by", "Mitigated-by"] },
37
51
  // Component family (ADR-003 §Part 2 — Component)
@@ -54,16 +68,6 @@ exports.CORE_TYPE_HIERARCHY = {
54
68
  parent: "Component",
55
69
  ownAttrs: ["Manufacturer", "Part-number", "Datasheet"],
56
70
  },
57
- SoftwareInterface: { parent: "Component", ownAttrs: [] },
58
- HardwareInterface: {
59
- parent: "Component",
60
- ownAttrs: [
61
- "Bus-protocol",
62
- "Connector-type",
63
- "Voltage-level",
64
- "Signal-direction",
65
- ],
66
- },
67
71
  // Unit family (ADR-003 §Part 2 — Unit)
68
72
  Unit: {
69
73
  parent: "Item",
@@ -114,6 +118,28 @@ function attributesForType(typeName) {
114
118
  result.delete(a);
115
119
  return result;
116
120
  }
121
+ /**
122
+ * Every type whose ancestor chain includes `ancestor` (inclusive of `ancestor`
123
+ * itself), per {@linkcode CORE_TYPE_HIERARCHY}. Returns an empty set when
124
+ * `ancestor` is not a known core type. Used to derive type-family sets (e.g. the
125
+ * components-listing family) so they cannot drift from the hierarchy.
126
+ */
127
+ function descendantsOf(ancestor) {
128
+ const result = new Set();
129
+ if (!exports.CORE_TYPE_HIERARCHY[ancestor])
130
+ return result;
131
+ for (const name of Object.keys(exports.CORE_TYPE_HIERARCHY)) {
132
+ let cursor = name;
133
+ while (cursor !== null && exports.CORE_TYPE_HIERARCHY[cursor]) {
134
+ if (cursor === ancestor) {
135
+ result.add(name);
136
+ break;
137
+ }
138
+ cursor = exports.CORE_TYPE_HIERARCHY[cursor].parent;
139
+ }
140
+ }
141
+ return result;
142
+ }
117
143
  /**
118
144
  * Union of every type-scoped attribute name declared anywhere in the
119
145
  * core hierarchy. Used by the validator to suppress `MSL-R010`
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @module core/profile/display_id
3
+ *
4
+ * Shared parser for the `display-id-pattern` template used by profile
5
+ * type declarations. Patterns look like:
6
+ *
7
+ * STK_{n:4d}
8
+ * STK_AEB_{n:04d}
9
+ * REQ-{n:03d}-draft
10
+ *
11
+ * The `{n:Nd}` placeholder (with optional leading zero in the Nd
12
+ * form) names the sequential number slot. The text before the
13
+ * placeholder becomes the literal prefix; the text after becomes the
14
+ * literal suffix.
15
+ *
16
+ * Note: the `{scope}` placeholder documented in the profile schema
17
+ * is NOT substituted here — callers handle that separately. For
18
+ * patterns containing `{scope}`, the literal text `{scope}` ends up
19
+ * in `prefix` (or `suffix`) and must be replaced upstream before the
20
+ * pattern is fed to scaffolding.
21
+ */
22
+ /** Width-and-position decomposition of a display-id-pattern. */
23
+ export interface DisplayIdPatternShape {
24
+ /** Literal text before the `{n:Nd}` placeholder. */
25
+ readonly prefix: string;
26
+ /** Width of the zero-padded numeric segment. */
27
+ readonly width: number;
28
+ /** Literal text after the `{n:Nd}` placeholder (often empty). */
29
+ readonly suffix: string;
30
+ }
31
+ /**
32
+ * Parse a `display-id-pattern` template. Returns `undefined` when
33
+ * the pattern does not contain a recognised `{n:Nd}` placeholder so
34
+ * callers can decide how to surface the error (CLI exits, LSP
35
+ * silently skips the type).
36
+ */
37
+ export declare function parseDisplayIdPattern(pattern: string): DisplayIdPatternShape | undefined;
38
+ /**
39
+ * Pad a positive integer with leading zeros to at least `width`
40
+ * characters. Numbers longer than `width` are left unchanged — the
41
+ * pattern's width is a minimum, not a maximum, mirroring printf
42
+ * `%0Nd` semantics.
43
+ */
44
+ export declare function padDisplayIdNumber(n: number, width: number): string;
45
+ /**
46
+ * Format a display ID from a parsed pattern and a numeric value.
47
+ * Inverse of the per-entry scan that {@linkcode highestDisplayIdNumber}
48
+ * performs.
49
+ */
50
+ export declare function formatDisplayId(shape: DisplayIdPatternShape, n: number): string;
51
+ /**
52
+ * Scan `entries` for the highest numeric value used by any display
53
+ * ID that matches the given shape (same prefix AND same suffix; the
54
+ * numeric segment is parsed as a base-10 integer). Returns 0 when no
55
+ * matching ID exists, so `+ 1` yields the next sequential number.
56
+ */
57
+ export declare function highestDisplayIdNumber(shape: DisplayIdPatternShape, entries: Iterable<{
58
+ displayId: string;
59
+ }>): number;
60
+ //# sourceMappingURL=display_id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display_id.d.ts","sourceRoot":"","sources":["../../src/profile/display_id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAKD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,GACd,qBAAqB,GAAG,SAAS,CAUnC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,qBAAqB,EAC5B,CAAC,EAAE,MAAM,GACR,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,qBAAqB,EAC5B,OAAO,EAAE,QAAQ,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GACvC,MAAM,CAcR"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ /**
3
+ * @module core/profile/display_id
4
+ *
5
+ * Shared parser for the `display-id-pattern` template used by profile
6
+ * type declarations. Patterns look like:
7
+ *
8
+ * STK_{n:4d}
9
+ * STK_AEB_{n:04d}
10
+ * REQ-{n:03d}-draft
11
+ *
12
+ * The `{n:Nd}` placeholder (with optional leading zero in the Nd
13
+ * form) names the sequential number slot. The text before the
14
+ * placeholder becomes the literal prefix; the text after becomes the
15
+ * literal suffix.
16
+ *
17
+ * Note: the `{scope}` placeholder documented in the profile schema
18
+ * is NOT substituted here — callers handle that separately. For
19
+ * patterns containing `{scope}`, the literal text `{scope}` ends up
20
+ * in `prefix` (or `suffix`) and must be replaced upstream before the
21
+ * pattern is fed to scaffolding.
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.parseDisplayIdPattern = parseDisplayIdPattern;
25
+ exports.padDisplayIdNumber = padDisplayIdNumber;
26
+ exports.formatDisplayId = formatDisplayId;
27
+ exports.highestDisplayIdNumber = highestDisplayIdNumber;
28
+ /** Regex capturing the `{n:Nd}` placeholder; `0` and the digit count are both captured. */
29
+ const PLACEHOLDER_RE = /\{n:(\d+)d\}/;
30
+ /**
31
+ * Parse a `display-id-pattern` template. Returns `undefined` when
32
+ * the pattern does not contain a recognised `{n:Nd}` placeholder so
33
+ * callers can decide how to surface the error (CLI exits, LSP
34
+ * silently skips the type).
35
+ */
36
+ function parseDisplayIdPattern(pattern) {
37
+ const match = PLACEHOLDER_RE.exec(pattern);
38
+ if (!match)
39
+ return undefined;
40
+ const width = parseInt(match[1], 10);
41
+ if (!Number.isFinite(width) || width < 1)
42
+ return undefined;
43
+ return {
44
+ prefix: pattern.slice(0, match.index),
45
+ width,
46
+ suffix: pattern.slice(match.index + match[0].length),
47
+ };
48
+ }
49
+ /**
50
+ * Pad a positive integer with leading zeros to at least `width`
51
+ * characters. Numbers longer than `width` are left unchanged — the
52
+ * pattern's width is a minimum, not a maximum, mirroring printf
53
+ * `%0Nd` semantics.
54
+ */
55
+ function padDisplayIdNumber(n, width) {
56
+ return n.toString().padStart(width, "0");
57
+ }
58
+ /**
59
+ * Format a display ID from a parsed pattern and a numeric value.
60
+ * Inverse of the per-entry scan that {@linkcode highestDisplayIdNumber}
61
+ * performs.
62
+ */
63
+ function formatDisplayId(shape, n) {
64
+ return `${shape.prefix}${padDisplayIdNumber(n, shape.width)}${shape.suffix}`;
65
+ }
66
+ /**
67
+ * Scan `entries` for the highest numeric value used by any display
68
+ * ID that matches the given shape (same prefix AND same suffix; the
69
+ * numeric segment is parsed as a base-10 integer). Returns 0 when no
70
+ * matching ID exists, so `+ 1` yields the next sequential number.
71
+ */
72
+ function highestDisplayIdNumber(shape, entries) {
73
+ let max = 0;
74
+ for (const entry of entries) {
75
+ const id = entry.displayId;
76
+ if (!id.startsWith(shape.prefix))
77
+ continue;
78
+ if (shape.suffix && !id.endsWith(shape.suffix))
79
+ continue;
80
+ const numberPart = id.slice(shape.prefix.length, id.length - shape.suffix.length);
81
+ const n = parseInt(numberPart, 10);
82
+ if (!isNaN(n) && n > max)
83
+ max = n;
84
+ }
85
+ return max;
86
+ }
@@ -6,6 +6,14 @@
6
6
  * schema violations.
7
7
  */
8
8
  import type { Diagnostic, ProfileManifest } from "../model/mod.js";
9
+ export declare const ALLOWED_ROOT_KEYS: Set<string>;
10
+ export declare const ALLOWED_PROFILE_KEYS: Set<string>;
11
+ export declare const ALLOWED_TYPE_KEYS: Set<string>;
12
+ export declare const ALLOWED_DOC_TYPE_KEYS: Set<string>;
13
+ export declare const ALLOWED_DOCUMENTS_KEYS: Set<string>;
14
+ export declare const ALLOWED_ATTR_KEYS: Set<string>;
15
+ export declare const ALLOWED_INVERSE_KEYS: Set<string>;
16
+ export declare const ALLOWED_TRACE_RULE_KEYS: Set<string>;
9
17
  /** Result of parsing a profile manifest. */
10
18
  export interface ParseManifestResult {
11
19
  readonly manifest: ProfileManifest | null;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAoFnE,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAysCD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CA+LrB"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA4BnE,eAAO,MAAM,iBAAiB,aAS5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAU/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAU5B,CAAC;AAEH,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAChF,eAAO,MAAM,sBAAsB,aAAoC,CAAC;AAExE,eAAO,MAAM,iBAAiB,aAQ5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAAgC,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAKlC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAysCD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CA+LrB"}
@@ -7,11 +7,13 @@
7
7
  * schema violations.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ALLOWED_TRACE_RULE_KEYS = exports.ALLOWED_INVERSE_KEYS = exports.ALLOWED_ATTR_KEYS = exports.ALLOWED_DOCUMENTS_KEYS = exports.ALLOWED_DOC_TYPE_KEYS = exports.ALLOWED_TYPE_KEYS = exports.ALLOWED_PROFILE_KEYS = exports.ALLOWED_ROOT_KEYS = void 0;
10
11
  exports.parseManifest = parseManifest;
11
12
  const yaml_1 = require("@std/yaml");
12
13
  const mod_js_1 = require("../model/mod.js");
13
14
  const VALUE_TYPE_SET = new Set(mod_js_1.VALUE_TYPES);
14
- const ALLOWED_ROOT_KEYS = new Set([
15
+ exports.ALLOWED_ROOT_KEYS = new Set([
16
+ "$schema",
15
17
  "id",
16
18
  "version",
17
19
  "markspec-schema",
@@ -20,7 +22,7 @@ const ALLOWED_ROOT_KEYS = new Set([
20
22
  "extends",
21
23
  "profile",
22
24
  ]);
23
- const ALLOWED_PROFILE_KEYS = new Set([
25
+ exports.ALLOWED_PROFILE_KEYS = new Set([
24
26
  "attributes",
25
27
  "labels",
26
28
  "colors",
@@ -31,7 +33,7 @@ const ALLOWED_PROFILE_KEYS = new Set([
31
33
  "prose",
32
34
  "discipline-mode",
33
35
  ]);
34
- const ALLOWED_TYPE_KEYS = new Set([
36
+ exports.ALLOWED_TYPE_KEYS = new Set([
35
37
  "extends",
36
38
  "description",
37
39
  "display-id-pattern",
@@ -42,9 +44,9 @@ const ALLOWED_TYPE_KEYS = new Set([
42
44
  "color",
43
45
  "discipline",
44
46
  ]);
45
- const ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
46
- const ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
47
- const ALLOWED_ATTR_KEYS = new Set([
47
+ exports.ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
48
+ exports.ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
49
+ exports.ALLOWED_ATTR_KEYS = new Set([
48
50
  "name",
49
51
  "type",
50
52
  "required",
@@ -53,8 +55,8 @@ const ALLOWED_ATTR_KEYS = new Set([
53
55
  "inverse",
54
56
  "description",
55
57
  ]);
56
- const ALLOWED_INVERSE_KEYS = new Set(["name", "category"]);
57
- const ALLOWED_TRACE_RULE_KEYS = new Set([
58
+ exports.ALLOWED_INVERSE_KEYS = new Set(["name", "category"]);
59
+ exports.ALLOWED_TRACE_RULE_KEYS = new Set([
58
60
  "target",
59
61
  "cardinality",
60
62
  "required",
@@ -226,7 +228,7 @@ function parseAttrDecl(raw, context, sourcePath, diagnostics) {
226
228
  }
227
229
  const r = raw;
228
230
  for (const key of Object.keys(r)) {
229
- if (!ALLOWED_ATTR_KEYS.has(key)) {
231
+ if (!exports.ALLOWED_ATTR_KEYS.has(key)) {
230
232
  diagnostics.push({
231
233
  code: "PROFILE-LOAD-003",
232
234
  severity: "error",
@@ -297,7 +299,7 @@ function parseAttrDecl(raw, context, sourcePath, diagnostics) {
297
299
  }
298
300
  const inv = r.inverse;
299
301
  for (const key of Object.keys(inv)) {
300
- if (!ALLOWED_INVERSE_KEYS.has(key)) {
302
+ if (!exports.ALLOWED_INVERSE_KEYS.has(key)) {
301
303
  diagnostics.push({
302
304
  code: "PROFILE-LOAD-003",
303
305
  severity: "error",
@@ -394,7 +396,7 @@ function parseTraceRule(raw, context, sourcePath, diagnostics) {
394
396
  }
395
397
  const r = raw;
396
398
  for (const key of Object.keys(r)) {
397
- if (!ALLOWED_TRACE_RULE_KEYS.has(key)) {
399
+ if (!exports.ALLOWED_TRACE_RULE_KEYS.has(key)) {
398
400
  diagnostics.push({
399
401
  code: "PROFILE-LOAD-003",
400
402
  severity: "error",
@@ -875,7 +877,7 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
875
877
  }
876
878
  const r = raw;
877
879
  for (const key of Object.keys(r)) {
878
- if (!ALLOWED_TYPE_KEYS.has(key)) {
880
+ if (!exports.ALLOWED_TYPE_KEYS.has(key)) {
879
881
  diagnostics.push({
880
882
  code: "PROFILE-TYPE-005",
881
883
  severity: "error",
@@ -1009,7 +1011,7 @@ function parseDocTypeDef(raw, sourcePath, diagnostics) {
1009
1011
  }
1010
1012
  const r = raw;
1011
1013
  for (const key of Object.keys(r)) {
1012
- if (!ALLOWED_DOC_TYPE_KEYS.has(key)) {
1014
+ if (!exports.ALLOWED_DOC_TYPE_KEYS.has(key)) {
1013
1015
  diagnostics.push({
1014
1016
  code: "PROFILE-LOAD-003",
1015
1017
  severity: "error",
@@ -1047,7 +1049,7 @@ function parseDocumentsSection(raw, sourcePath, diagnostics) {
1047
1049
  }
1048
1050
  const r = raw;
1049
1051
  for (const key of Object.keys(r)) {
1050
- if (!ALLOWED_DOCUMENTS_KEYS.has(key)) {
1052
+ if (!exports.ALLOWED_DOCUMENTS_KEYS.has(key)) {
1051
1053
  diagnostics.push({
1052
1054
  code: "PROFILE-LOAD-003",
1053
1055
  severity: "error",
@@ -1110,7 +1112,7 @@ function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
1110
1112
  }
1111
1113
  const root = parsed;
1112
1114
  for (const key of Object.keys(root)) {
1113
- if (!ALLOWED_ROOT_KEYS.has(key)) {
1115
+ if (!exports.ALLOWED_ROOT_KEYS.has(key)) {
1114
1116
  diagnostics.push({
1115
1117
  code: "PROFILE-LOAD-003",
1116
1118
  severity: "error",
@@ -1159,7 +1161,7 @@ function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
1159
1161
  return { manifest: null, diagnostics };
1160
1162
  }
1161
1163
  for (const key of Object.keys(rawProfile)) {
1162
- if (!ALLOWED_PROFILE_KEYS.has(key)) {
1164
+ if (!exports.ALLOWED_PROFILE_KEYS.has(key)) {
1163
1165
  diagnostics.push({
1164
1166
  code: "PROFILE-LOAD-003",
1165
1167
  severity: "error",
@@ -19,6 +19,9 @@ export type { MergeResult } from "./merge.js";
19
19
  export { resolveEntryColor } from "./colors.js";
20
20
  export { buildEffectiveDisciplineRegistry } from "./discipline_registry.js";
21
21
  export { inferDisciplineMode, resolveDisciplineMode, } from "./discipline_mode.js";
22
+ export { formatDisplayId, highestDisplayIdNumber, padDisplayIdNumber, parseDisplayIdPattern, } from "./display_id.js";
23
+ export type { DisplayIdPatternShape } from "./display_id.js";
24
+ export { entryMatchesTargets, filterEntriesByTraceTargets, targetsForRelation, } from "./trace_targets.js";
22
25
  export { buildProfileIntrospection } from "./introspect.js";
23
26
  export type { AttributeDetail, ConventionDetail, LabelConcernDetail, ProfileElementDetail, ProfileElementKind, ProfileElementRef, ProfileIntrospection, ProfileOverview, ProvenancedDescription, RelationDetail, TypeDetail, } from "./introspect.js";
24
27
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * resolution, and merging. Consumed by the validator pipeline and the CLI.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.buildProfileIntrospection = exports.resolveDisciplineMode = exports.inferDisciplineMode = exports.buildEffectiveDisciplineRegistry = exports.resolveEntryColor = exports.mergeChain = exports.loadProfileForCommand = exports.loadChain = exports.ensureCacheGitignored = exports.defaultRunGit = exports.defaultAppendFile = exports.computeCacheLocation = exports.computeCacheKey = exports.resolveLocalSpecifier = exports.resolveGitSpecifier = exports.parseManifest = void 0;
9
+ exports.buildProfileIntrospection = exports.targetsForRelation = exports.filterEntriesByTraceTargets = exports.entryMatchesTargets = exports.parseDisplayIdPattern = exports.padDisplayIdNumber = exports.highestDisplayIdNumber = exports.formatDisplayId = exports.resolveDisciplineMode = exports.inferDisciplineMode = exports.buildEffectiveDisciplineRegistry = exports.resolveEntryColor = exports.mergeChain = exports.loadProfileForCommand = exports.loadChain = exports.ensureCacheGitignored = exports.defaultRunGit = exports.defaultAppendFile = exports.computeCacheLocation = exports.computeCacheKey = exports.resolveLocalSpecifier = exports.resolveGitSpecifier = exports.parseManifest = void 0;
10
10
  var manifest_js_1 = require("./manifest.js");
11
11
  Object.defineProperty(exports, "parseManifest", { enumerable: true, get: function () { return manifest_js_1.parseManifest; } });
12
12
  var resolver_js_1 = require("./resolver.js");
@@ -35,5 +35,14 @@ Object.defineProperty(exports, "buildEffectiveDisciplineRegistry", { enumerable:
35
35
  var discipline_mode_js_1 = require("./discipline_mode.js");
36
36
  Object.defineProperty(exports, "inferDisciplineMode", { enumerable: true, get: function () { return discipline_mode_js_1.inferDisciplineMode; } });
37
37
  Object.defineProperty(exports, "resolveDisciplineMode", { enumerable: true, get: function () { return discipline_mode_js_1.resolveDisciplineMode; } });
38
+ var display_id_js_1 = require("./display_id.js");
39
+ Object.defineProperty(exports, "formatDisplayId", { enumerable: true, get: function () { return display_id_js_1.formatDisplayId; } });
40
+ Object.defineProperty(exports, "highestDisplayIdNumber", { enumerable: true, get: function () { return display_id_js_1.highestDisplayIdNumber; } });
41
+ Object.defineProperty(exports, "padDisplayIdNumber", { enumerable: true, get: function () { return display_id_js_1.padDisplayIdNumber; } });
42
+ Object.defineProperty(exports, "parseDisplayIdPattern", { enumerable: true, get: function () { return display_id_js_1.parseDisplayIdPattern; } });
43
+ var trace_targets_js_1 = require("./trace_targets.js");
44
+ Object.defineProperty(exports, "entryMatchesTargets", { enumerable: true, get: function () { return trace_targets_js_1.entryMatchesTargets; } });
45
+ Object.defineProperty(exports, "filterEntriesByTraceTargets", { enumerable: true, get: function () { return trace_targets_js_1.filterEntriesByTraceTargets; } });
46
+ Object.defineProperty(exports, "targetsForRelation", { enumerable: true, get: function () { return trace_targets_js_1.targetsForRelation; } });
38
47
  var introspect_js_1 = require("./introspect.js");
39
48
  Object.defineProperty(exports, "buildProfileIntrospection", { enumerable: true, get: function () { return introspect_js_1.buildProfileIntrospection; } });
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @module core/profile/trace_targets
3
+ *
4
+ * Pure helpers for resolving the legal target types of a trace
5
+ * attribute (e.g. `Satisfies:`, `Derived-from:`) given the source
6
+ * entry's type and the active profile chain.
7
+ *
8
+ * A profile declares per-type `traceability:` rules — each relation
9
+ * maps to a `TraceRule.target` list of {@linkcode TargetMatcher}s.
10
+ * A matcher is either a type name (string) or a shape selector
11
+ * (`{ shape: "Authored" | "Reference" }`). An entry matches when its
12
+ * `type` equals or extends a string matcher, or its `shape` equals a
13
+ * shape matcher.
14
+ *
15
+ * The LSP uses these helpers to narrow trace-attribute completion
16
+ * suggestions to the IDs the profile actually allows in that slot.
17
+ * Callers fall back to the unfiltered workspace listing when no
18
+ * rule applies (no source type known, relation undeclared, profile
19
+ * absent).
20
+ */
21
+ import type { Entry } from "../model/mod.js";
22
+ import type { EffectiveProfile, TargetMatcher } from "../model/profile.js";
23
+ /**
24
+ * Return the `TargetMatcher[]` for a given source-entry type and
25
+ * relation name, or `undefined` when no rule constrains it. Callers
26
+ * MUST treat `undefined` as "do not filter" rather than "no targets
27
+ * allowed" — the latter would silently hide every suggestion.
28
+ */
29
+ export declare function targetsForRelation(profile: EffectiveProfile, sourceType: string | undefined, relationName: string): readonly TargetMatcher[] | undefined;
30
+ /**
31
+ * Whether `entry` satisfies any matcher in `targets`. A string
32
+ * matcher matches when the entry's `type` equals or transitively
33
+ * extends the named type. A shape matcher matches when the entry's
34
+ * `shape` equals the matcher's shape. An entry with no resolved
35
+ * `type` only matches shape selectors.
36
+ */
37
+ export declare function entryMatchesTargets(entry: Entry, targets: readonly TargetMatcher[], profile: EffectiveProfile): boolean;
38
+ /**
39
+ * Filter `entries` to those that satisfy at least one of `targets`.
40
+ * Order is preserved.
41
+ */
42
+ export declare function filterEntriesByTraceTargets(entries: Iterable<Entry>, targets: readonly TargetMatcher[], profile: EffectiveProfile): Entry[];
43
+ //# sourceMappingURL=trace_targets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace_targets.d.ts","sourceRoot":"","sources":["../../src/profile/trace_targets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG3E;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,YAAY,EAAE,MAAM,GACnB,SAAS,aAAa,EAAE,GAAG,SAAS,CAOtC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAWT;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,EACxB,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,OAAO,EAAE,gBAAgB,GACxB,KAAK,EAAE,CAMT"}