@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,80 @@
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
+ /** Regex capturing the `{n:Nd}` placeholder; `0` and the digit count are both captured. */
23
+ const PLACEHOLDER_RE = /\{n:(\d+)d\}/;
24
+ /**
25
+ * Parse a `display-id-pattern` template. Returns `undefined` when
26
+ * the pattern does not contain a recognised `{n:Nd}` placeholder so
27
+ * callers can decide how to surface the error (CLI exits, LSP
28
+ * silently skips the type).
29
+ */
30
+ export function parseDisplayIdPattern(pattern) {
31
+ const match = PLACEHOLDER_RE.exec(pattern);
32
+ if (!match)
33
+ return undefined;
34
+ const width = parseInt(match[1], 10);
35
+ if (!Number.isFinite(width) || width < 1)
36
+ return undefined;
37
+ return {
38
+ prefix: pattern.slice(0, match.index),
39
+ width,
40
+ suffix: pattern.slice(match.index + match[0].length),
41
+ };
42
+ }
43
+ /**
44
+ * Pad a positive integer with leading zeros to at least `width`
45
+ * characters. Numbers longer than `width` are left unchanged — the
46
+ * pattern's width is a minimum, not a maximum, mirroring printf
47
+ * `%0Nd` semantics.
48
+ */
49
+ export function padDisplayIdNumber(n, width) {
50
+ return n.toString().padStart(width, "0");
51
+ }
52
+ /**
53
+ * Format a display ID from a parsed pattern and a numeric value.
54
+ * Inverse of the per-entry scan that {@linkcode highestDisplayIdNumber}
55
+ * performs.
56
+ */
57
+ export function formatDisplayId(shape, n) {
58
+ return `${shape.prefix}${padDisplayIdNumber(n, shape.width)}${shape.suffix}`;
59
+ }
60
+ /**
61
+ * Scan `entries` for the highest numeric value used by any display
62
+ * ID that matches the given shape (same prefix AND same suffix; the
63
+ * numeric segment is parsed as a base-10 integer). Returns 0 when no
64
+ * matching ID exists, so `+ 1` yields the next sequential number.
65
+ */
66
+ export function highestDisplayIdNumber(shape, entries) {
67
+ let max = 0;
68
+ for (const entry of entries) {
69
+ const id = entry.displayId;
70
+ if (!id.startsWith(shape.prefix))
71
+ continue;
72
+ if (shape.suffix && !id.endsWith(shape.suffix))
73
+ continue;
74
+ const numberPart = id.slice(shape.prefix.length, id.length - shape.suffix.length);
75
+ const n = parseInt(numberPart, 10);
76
+ if (!isNaN(n) && n > max)
77
+ max = n;
78
+ }
79
+ return max;
80
+ }
@@ -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"}
@@ -8,7 +8,8 @@
8
8
  import { parse as parseYaml } from "@std/yaml";
9
9
  import { COLOR_NAME_RE, CORE_KINDS, CORE_TYPES, LIST_VALUE_TYPES, MIXED_DISCIPLINE, PALETTE_HUES, VALUE_TYPES, } from "../model/mod.js";
10
10
  const VALUE_TYPE_SET = new Set(VALUE_TYPES);
11
- const ALLOWED_ROOT_KEYS = new Set([
11
+ export const ALLOWED_ROOT_KEYS = new Set([
12
+ "$schema",
12
13
  "id",
13
14
  "version",
14
15
  "markspec-schema",
@@ -17,7 +18,7 @@ const ALLOWED_ROOT_KEYS = new Set([
17
18
  "extends",
18
19
  "profile",
19
20
  ]);
20
- const ALLOWED_PROFILE_KEYS = new Set([
21
+ export const ALLOWED_PROFILE_KEYS = new Set([
21
22
  "attributes",
22
23
  "labels",
23
24
  "colors",
@@ -28,7 +29,7 @@ const ALLOWED_PROFILE_KEYS = new Set([
28
29
  "prose",
29
30
  "discipline-mode",
30
31
  ]);
31
- const ALLOWED_TYPE_KEYS = new Set([
32
+ export const ALLOWED_TYPE_KEYS = new Set([
32
33
  "extends",
33
34
  "description",
34
35
  "display-id-pattern",
@@ -39,9 +40,9 @@ const ALLOWED_TYPE_KEYS = new Set([
39
40
  "color",
40
41
  "discipline",
41
42
  ]);
42
- const ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
43
- const ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
44
- const ALLOWED_ATTR_KEYS = new Set([
43
+ export const ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
44
+ export const ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
45
+ export const ALLOWED_ATTR_KEYS = new Set([
45
46
  "name",
46
47
  "type",
47
48
  "required",
@@ -50,8 +51,8 @@ const ALLOWED_ATTR_KEYS = new Set([
50
51
  "inverse",
51
52
  "description",
52
53
  ]);
53
- const ALLOWED_INVERSE_KEYS = new Set(["name", "category"]);
54
- const ALLOWED_TRACE_RULE_KEYS = new Set([
54
+ export const ALLOWED_INVERSE_KEYS = new Set(["name", "category"]);
55
+ export const ALLOWED_TRACE_RULE_KEYS = new Set([
55
56
  "target",
56
57
  "cardinality",
57
58
  "required",
@@ -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"}
@@ -17,4 +17,6 @@ export { mergeChain } from "./merge.js";
17
17
  export { resolveEntryColor } from "./colors.js";
18
18
  export { buildEffectiveDisciplineRegistry } from "./discipline_registry.js";
19
19
  export { inferDisciplineMode, resolveDisciplineMode, } from "./discipline_mode.js";
20
+ export { formatDisplayId, highestDisplayIdNumber, padDisplayIdNumber, parseDisplayIdPattern, } from "./display_id.js";
21
+ export { entryMatchesTargets, filterEntriesByTraceTargets, targetsForRelation, } from "./trace_targets.js";
20
22
  export { buildProfileIntrospection } from "./introspect.js";
@@ -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"}
@@ -0,0 +1,74 @@
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 { extendsTransitively } from "./discipline_mode.js";
22
+ /**
23
+ * Return the `TargetMatcher[]` for a given source-entry type and
24
+ * relation name, or `undefined` when no rule constrains it. Callers
25
+ * MUST treat `undefined` as "do not filter" rather than "no targets
26
+ * allowed" — the latter would silently hide every suggestion.
27
+ */
28
+ export function targetsForRelation(profile, sourceType, relationName) {
29
+ if (!sourceType)
30
+ return undefined;
31
+ const typeDef = profile.types.get(sourceType);
32
+ if (!typeDef)
33
+ return undefined;
34
+ const rule = typeDef.value.traceability.get(relationName);
35
+ if (!rule)
36
+ return undefined;
37
+ return rule.value.target;
38
+ }
39
+ /**
40
+ * Whether `entry` satisfies any matcher in `targets`. A string
41
+ * matcher matches when the entry's `type` equals or transitively
42
+ * extends the named type. A shape matcher matches when the entry's
43
+ * `shape` equals the matcher's shape. An entry with no resolved
44
+ * `type` only matches shape selectors.
45
+ */
46
+ export function entryMatchesTargets(entry, targets, profile) {
47
+ for (const target of targets) {
48
+ if (typeof target === "string") {
49
+ if (!entry.type)
50
+ continue;
51
+ if (entry.type === target)
52
+ return true;
53
+ if (extendsTransitively(entry.type, target, profile))
54
+ return true;
55
+ }
56
+ else {
57
+ if (entry.shape === target.shape)
58
+ return true;
59
+ }
60
+ }
61
+ return false;
62
+ }
63
+ /**
64
+ * Filter `entries` to those that satisfy at least one of `targets`.
65
+ * Order is preserved.
66
+ */
67
+ export function filterEntriesByTraceTargets(entries, targets, profile) {
68
+ const out = [];
69
+ for (const entry of entries) {
70
+ if (entryMatchesTargets(entry, targets, profile))
71
+ out.push(entry);
72
+ }
73
+ return out;
74
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @module core/self_upgrade/compare
3
+ *
4
+ * Strict semver-tuple comparison for self-upgrade. Three outcomes:
5
+ * - "up-to-date" current === target
6
+ * - "newer-available" current < target
7
+ * - "downgrade" current > target
8
+ *
9
+ * Accepts an optional leading 'v' on either arg. Rejects pre-release
10
+ * and build-metadata suffixes — the CLI only ships clean MAJOR.MINOR.PATCH
11
+ * tags and any drift means the input is malformed.
12
+ *
13
+ * Throws `Error` on malformed input; callers pass the compiled-in
14
+ * VERSION constant (known good) and the parsed GitHub `tag_name` (also
15
+ * known good if `releases/latest` returned successfully).
16
+ */
17
+ export type Comparison = "up-to-date" | "newer-available" | "downgrade";
18
+ export declare function compareVersions(current: string, target: string): Comparison;
19
+ //# sourceMappingURL=compare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/compare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,iBAAiB,GAAG,WAAW,CAAC;AAExE,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAO3E"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @module core/self_upgrade/compare
3
+ *
4
+ * Strict semver-tuple comparison for self-upgrade. Three outcomes:
5
+ * - "up-to-date" current === target
6
+ * - "newer-available" current < target
7
+ * - "downgrade" current > target
8
+ *
9
+ * Accepts an optional leading 'v' on either arg. Rejects pre-release
10
+ * and build-metadata suffixes — the CLI only ships clean MAJOR.MINOR.PATCH
11
+ * tags and any drift means the input is malformed.
12
+ *
13
+ * Throws `Error` on malformed input; callers pass the compiled-in
14
+ * VERSION constant (known good) and the parsed GitHub `tag_name` (also
15
+ * known good if `releases/latest` returned successfully).
16
+ */
17
+ const VERSION_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
18
+ export function compareVersions(current, target) {
19
+ const c = parse(current);
20
+ const t = parse(target);
21
+ if (c[0] !== t[0])
22
+ return c[0] < t[0] ? "newer-available" : "downgrade";
23
+ if (c[1] !== t[1])
24
+ return c[1] < t[1] ? "newer-available" : "downgrade";
25
+ if (c[2] !== t[2])
26
+ return c[2] < t[2] ? "newer-available" : "downgrade";
27
+ return "up-to-date";
28
+ }
29
+ function parse(s) {
30
+ const stripped = s.startsWith("v") ? s.slice(1) : s;
31
+ const m = VERSION_RE.exec(stripped);
32
+ if (!m)
33
+ throw new Error(`invalid version: ${JSON.stringify(s)}`);
34
+ return [parseInt(m[1], 10), parseInt(m[2], 10), parseInt(m[3], 10)];
35
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @module core/self_upgrade/manifest
3
+ *
4
+ * Build the release tarball + SHA-256 URLs for a (version, target) pair,
5
+ * and parse the single-line .sha256 files produced by sha256sum /
6
+ * shasum -a 256 in the release workflow. Pure — no I/O.
7
+ *
8
+ * The .sha256 line format is the standard one shared by GNU coreutils
9
+ * sha256sum and BSD/macOS shasum: `<64-hex> <basename>` with a two-space
10
+ * separator. We accept a trailing newline and lowercase the digest so
11
+ * callers can compare strings directly.
12
+ */
13
+ export interface ReleaseAssets {
14
+ readonly tarballUrl: string;
15
+ readonly checksumUrl: string;
16
+ }
17
+ /** Build the tarball + checksum URLs for a (version, target). */
18
+ export declare function releaseAssets(baseUrl: string, version: string, target: string): ReleaseAssets;
19
+ /** Parse a single sha256sum-format line; return the lowercase hex digest. */
20
+ export declare function parseSha256Line(line: string): string;
21
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAID,iEAAiE;AACjE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,aAAa,CAKf;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIpD"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @module core/self_upgrade/manifest
3
+ *
4
+ * Build the release tarball + SHA-256 URLs for a (version, target) pair,
5
+ * and parse the single-line .sha256 files produced by sha256sum /
6
+ * shasum -a 256 in the release workflow. Pure — no I/O.
7
+ *
8
+ * The .sha256 line format is the standard one shared by GNU coreutils
9
+ * sha256sum and BSD/macOS shasum: `<64-hex> <basename>` with a two-space
10
+ * separator. We accept a trailing newline and lowercase the digest so
11
+ * callers can compare strings directly.
12
+ */
13
+ const SHA256_LINE_RE = /^([0-9a-fA-F]{64})\s+(\S.*?)\s*$/;
14
+ /** Build the tarball + checksum URLs for a (version, target). */
15
+ export function releaseAssets(baseUrl, version, target) {
16
+ const tag = version.startsWith("v") ? version : `v${version}`;
17
+ const tarballUrl = `${baseUrl}/${tag}/markspec-${target}.tar.gz`;
18
+ const checksumUrl = `${tarballUrl}.sha256`;
19
+ return { tarballUrl, checksumUrl };
20
+ }
21
+ /** Parse a single sha256sum-format line; return the lowercase hex digest. */
22
+ export function parseSha256Line(line) {
23
+ const m = SHA256_LINE_RE.exec(line);
24
+ if (!m)
25
+ throw new Error(`malformed sha256 line: ${JSON.stringify(line)}`);
26
+ return m[1].toLowerCase();
27
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @module core/self_upgrade
3
+ *
4
+ * Pure helpers for `markspec self-upgrade`. No I/O — see
5
+ * `cli/self_upgrade/` and `cli/commands/self_upgrade.ts` for the
6
+ * orchestrator and helpers that wire these into HTTP + filesystem.
7
+ */
8
+ export { compareVersions, type Comparison } from "./compare.js";
9
+ export { classifyInstallPath, type ClassifyResult, type InstallSource, } from "./pm_detect.js";
10
+ export { parseSha256Line, type ReleaseAssets, releaseAssets, } from "./manifest.js";
11
+ export { type Arch, detectTarget, type Os, type Platform, platformFromBuild, type Target, } from "./target.js";
12
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,KAAK,aAAa,EAClB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,IAAI,EACT,YAAY,EACZ,KAAK,EAAE,EACP,KAAK,QAAQ,EACb,iBAAiB,EACjB,KAAK,MAAM,GACZ,MAAM,aAAa,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @module core/self_upgrade
3
+ *
4
+ * Pure helpers for `markspec self-upgrade`. No I/O — see
5
+ * `cli/self_upgrade/` and `cli/commands/self_upgrade.ts` for the
6
+ * orchestrator and helpers that wire these into HTTP + filesystem.
7
+ */
8
+ export { compareVersions } from "./compare.js";
9
+ export { classifyInstallPath, } from "./pm_detect.js";
10
+ export { parseSha256Line, releaseAssets, } from "./manifest.js";
11
+ export { detectTarget, platformFromBuild, } from "./target.js";
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @module core/self_upgrade/pm_detect
3
+ *
4
+ * Classify the realpath of the running binary into one of four
5
+ * install-source buckets so the self-upgrade orchestrator can refuse
6
+ * with a per-manager hint instead of fighting the package manager.
7
+ *
8
+ * The check is heuristic and order-sensitive — Homebrew first (because
9
+ * brew's bin paths live under /opt/homebrew or /usr/local), npm second,
10
+ * system third, user-local fourth. Anything that falls through is
11
+ * "unknown" and the orchestrator proceeds with a warning.
12
+ *
13
+ * Path matching is whole-segment (path separator on both sides) to
14
+ * avoid matching e.g. `/foo/.localfish/markspec` against the user-local
15
+ * `.local` rule.
16
+ *
17
+ * Pure — no I/O. Callers must pass the realpath (symlinks resolved) so
18
+ * brew's `/opt/homebrew/bin/markspec` -> `/opt/homebrew/Cellar/.../bin/markspec`
19
+ * is classified correctly.
20
+ */
21
+ export type InstallSource = "user-local" | "homebrew" | "npm" | "system" | "unknown";
22
+ export interface ClassifyResult {
23
+ readonly source: InstallSource;
24
+ readonly hintCommand?: string;
25
+ }
26
+ export declare function classifyInstallPath(realPath: string, home: string): ClassifyResult;
27
+ //# sourceMappingURL=pm_detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pm_detect.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/pm_detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,UAAU,GACV,KAAK,GACL,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,cAAc,CA+ChB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @module core/self_upgrade/pm_detect
3
+ *
4
+ * Classify the realpath of the running binary into one of four
5
+ * install-source buckets so the self-upgrade orchestrator can refuse
6
+ * with a per-manager hint instead of fighting the package manager.
7
+ *
8
+ * The check is heuristic and order-sensitive — Homebrew first (because
9
+ * brew's bin paths live under /opt/homebrew or /usr/local), npm second,
10
+ * system third, user-local fourth. Anything that falls through is
11
+ * "unknown" and the orchestrator proceeds with a warning.
12
+ *
13
+ * Path matching is whole-segment (path separator on both sides) to
14
+ * avoid matching e.g. `/foo/.localfish/markspec` against the user-local
15
+ * `.local` rule.
16
+ *
17
+ * Pure — no I/O. Callers must pass the realpath (symlinks resolved) so
18
+ * brew's `/opt/homebrew/bin/markspec` -> `/opt/homebrew/Cellar/.../bin/markspec`
19
+ * is classified correctly.
20
+ */
21
+ export function classifyInstallPath(realPath, home) {
22
+ // Normalise to forward slashes for matching. Windows paths use '\';
23
+ // we accept both by replacing.
24
+ const p = realPath.replace(/\\/g, "/");
25
+ const h = home.replace(/\\/g, "/");
26
+ // 1. Homebrew. The Cellar segment is the canonical real-path marker;
27
+ // /opt/homebrew/ on its own catches symlink-without-realpath.
28
+ if (p.includes("/Cellar/") ||
29
+ p.startsWith("/opt/homebrew/")) {
30
+ return { source: "homebrew", hintCommand: "brew upgrade markspec" };
31
+ }
32
+ // 2. npm. node_modules, .npm/, .nvm/.
33
+ if (p.includes("/node_modules/") ||
34
+ p.includes("/.nvm/") ||
35
+ p.includes("/.npm/")) {
36
+ return { source: "npm", hintCommand: "npm update -g markspec" };
37
+ }
38
+ // 3. user-local paths under $HOME.
39
+ if (h && p.startsWith(`${h}/`)) {
40
+ const tail = p.slice(h.length + 1);
41
+ if (tail.startsWith(".local/") ||
42
+ tail.startsWith(".cargo/bin/") ||
43
+ tail.startsWith("bin/") ||
44
+ tail.startsWith("Library/")) {
45
+ return { source: "user-local" };
46
+ }
47
+ }
48
+ // 4. system bins.
49
+ if (p.startsWith("/usr/") ||
50
+ p.startsWith("/opt/") ||
51
+ p.startsWith("/snap/")) {
52
+ return { source: "system" };
53
+ }
54
+ return { source: "unknown" };
55
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @module core/self_upgrade/target
3
+ *
4
+ * Map (os, arch) → the GitHub release target string used in tarball
5
+ * names. Targets match those produced by the Release workflow:
6
+ * x86_64-unknown-linux-gnu, x86_64-apple-darwin,
7
+ * aarch64-apple-darwin, x86_64-pc-windows-msvc.
8
+ *
9
+ * Pure functions — no I/O, no Deno.* APIs. The CLI passes
10
+ * `Deno.build.os` / `Deno.build.arch` strings to platformFromBuild;
11
+ * this module never reads them itself so tests don't need any
12
+ * environment setup.
13
+ */
14
+ export type Os = "linux" | "darwin" | "windows";
15
+ export type Arch = "x86_64" | "aarch64";
16
+ export interface Platform {
17
+ readonly os: Os;
18
+ readonly arch: Arch;
19
+ }
20
+ export type Target = "x86_64-unknown-linux-gnu" | "x86_64-apple-darwin" | "aarch64-apple-darwin" | "x86_64-pc-windows-msvc";
21
+ /** Return the release target for a platform, or undefined if not shipped. */
22
+ export declare function detectTarget(platform: Platform): Target | undefined;
23
+ /** Parse Deno.build.{os,arch} strings into a typed Platform, or undefined. */
24
+ export declare function platformFromBuild(os: string, arch: string): Platform | undefined;
25
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,EAAE,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAChD,MAAM,MAAM,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAChB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,MAAM,GACd,0BAA0B,GAC1B,qBAAqB,GACrB,sBAAsB,GACtB,wBAAwB,CAAC;AAE7B,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAOnE;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,GACX,QAAQ,GAAG,SAAS,CAKtB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @module core/self_upgrade/target
3
+ *
4
+ * Map (os, arch) → the GitHub release target string used in tarball
5
+ * names. Targets match those produced by the Release workflow:
6
+ * x86_64-unknown-linux-gnu, x86_64-apple-darwin,
7
+ * aarch64-apple-darwin, x86_64-pc-windows-msvc.
8
+ *
9
+ * Pure functions — no I/O, no Deno.* APIs. The CLI passes
10
+ * `Deno.build.os` / `Deno.build.arch` strings to platformFromBuild;
11
+ * this module never reads them itself so tests don't need any
12
+ * environment setup.
13
+ */
14
+ /** Return the release target for a platform, or undefined if not shipped. */
15
+ export function detectTarget(platform) {
16
+ const { os, arch } = platform;
17
+ if (os === "linux" && arch === "x86_64")
18
+ return "x86_64-unknown-linux-gnu";
19
+ if (os === "darwin" && arch === "x86_64")
20
+ return "x86_64-apple-darwin";
21
+ if (os === "darwin" && arch === "aarch64")
22
+ return "aarch64-apple-darwin";
23
+ if (os === "windows" && arch === "x86_64")
24
+ return "x86_64-pc-windows-msvc";
25
+ return undefined;
26
+ }
27
+ /** Parse Deno.build.{os,arch} strings into a typed Platform, or undefined. */
28
+ export function platformFromBuild(os, arch) {
29
+ const okOs = os === "linux" || os === "darwin" || os === "windows";
30
+ const okArch = arch === "x86_64" || arch === "aarch64";
31
+ if (!okOs || !okArch)
32
+ return undefined;
33
+ return { os, arch };
34
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../../src/validator/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAWpE,oDAAoD;AACpD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC;AAEnE,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAC3C;AA8SD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GACtC,SAAS,UAAU,EAAE,CAMvB"}
1
+ {"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../../src/validator/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAYpE,oDAAoD;AACpD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC;AAEnE,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAC3C;AA4SD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GACtC,SAAS,UAAU,EAAE,CAMvB"}
@@ -18,19 +18,19 @@
18
18
  * does not carry.
19
19
  */
20
20
  import { basename } from "@std/path";
21
+ import { descendantsOf } from "../model/mod.js";
21
22
  import { validateGlossaryStructure } from "../parser/glossary.js";
22
23
  import { isSchemeQualifiedUri, parseComponentScheme, } from "./component_schemes.js";
23
24
  // ---------------------------------------------------------------------------
24
25
  // Component-family and Unit-family sets
25
26
  // ---------------------------------------------------------------------------
26
- /** Core Component-family type names per ADR-003 §Part 2 / spec §6.3. */
27
- const COMPONENT_FAMILY = new Set([
28
- "Component",
29
- "SoftwareComponent",
30
- "HardwareComponent",
31
- "SoftwareInterface",
32
- "HardwareInterface",
33
- ]);
27
+ /** Core Component-family type names per ADR-003 §Part 2 / spec §6.3.
28
+ *
29
+ * SoftwareInterface and HardwareInterface are NOT included here: they
30
+ * were re-parented from Component to Contract (interface-as-contract
31
+ * design). A components listing accepts only true structural components.
32
+ */
33
+ const COMPONENT_FAMILY = descendantsOf("Component");
34
34
  /** Core Unit-family type names per ADR-003 §Part 2. */
35
35
  const UNIT_FAMILY = new Set([
36
36
  "Unit",
@@ -226,8 +226,7 @@ function validateComponentsEntry(entry, file, diagnostics) {
226
226
  severity: "error",
227
227
  message: `${file}:${entry.location.line}: entry '[${entry.displayId}]' ` +
228
228
  `has Type: ${typeVal} which is not in the Component family ` +
229
- `(Component/SoftwareComponent/HardwareComponent/` +
230
- `SoftwareInterface/HardwareInterface) — ` +
229
+ `(Component/SoftwareComponent/HardwareComponent) — ` +
231
230
  `only Component-family types are permitted in a components listing ` +
232
231
  `(spec §6.3)`,
233
232
  location: entry.location,