@driftsys/markspec 0.2.0 → 0.4.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 (214) hide show
  1. package/README.md +32 -8
  2. package/esm/compiler/inverses.d.ts +22 -0
  3. package/esm/compiler/inverses.d.ts.map +1 -0
  4. package/esm/compiler/inverses.js +147 -0
  5. package/esm/compiler/link_target.d.ts +19 -0
  6. package/esm/compiler/link_target.d.ts.map +1 -0
  7. package/esm/compiler/link_target.js +66 -0
  8. package/esm/compiler/mod.d.ts +7 -1
  9. package/esm/compiler/mod.d.ts.map +1 -1
  10. package/esm/compiler/mod.js +61 -14
  11. package/esm/compiler/schema.d.ts.map +1 -1
  12. package/esm/compiler/schema.js +20 -1
  13. package/esm/config/markspec.d.ts +51 -0
  14. package/esm/config/markspec.d.ts.map +1 -0
  15. package/esm/config/markspec.js +216 -0
  16. package/esm/config/mod.d.ts +4 -0
  17. package/esm/config/mod.d.ts.map +1 -1
  18. package/esm/config/mod.js +27 -16
  19. package/esm/formatter/mod.d.ts +19 -4
  20. package/esm/formatter/mod.d.ts.map +1 -1
  21. package/esm/formatter/mod.js +139 -29
  22. package/esm/mod.d.ts +11 -7
  23. package/esm/mod.d.ts.map +1 -1
  24. package/esm/mod.js +6 -3
  25. package/esm/model/attributes.d.ts +47 -0
  26. package/esm/model/attributes.d.ts.map +1 -0
  27. package/esm/model/attributes.js +97 -0
  28. package/esm/model/mod.d.ts +257 -26
  29. package/esm/model/mod.d.ts.map +1 -1
  30. package/esm/model/mod.js +28 -1
  31. package/esm/model/palette.d.ts +18 -0
  32. package/esm/model/palette.d.ts.map +1 -0
  33. package/esm/model/palette.js +23 -0
  34. package/esm/model/profile.d.ts +189 -0
  35. package/esm/model/profile.d.ts.map +1 -0
  36. package/esm/model/profile.js +31 -0
  37. package/esm/parser/attributes.d.ts +13 -1
  38. package/esm/parser/attributes.d.ts.map +1 -1
  39. package/esm/parser/attributes.js +47 -0
  40. package/esm/parser/frontmatter.d.ts +53 -0
  41. package/esm/parser/frontmatter.d.ts.map +1 -0
  42. package/esm/parser/frontmatter.js +185 -0
  43. package/esm/parser/grammars.js +11 -2
  44. package/esm/parser/markdown.d.ts +21 -7
  45. package/esm/parser/markdown.d.ts.map +1 -1
  46. package/esm/parser/markdown.js +101 -40
  47. package/esm/parser/mod.d.ts +26 -10
  48. package/esm/parser/mod.d.ts.map +1 -1
  49. package/esm/parser/mod.js +40 -10
  50. package/esm/parser/source.d.ts +12 -8
  51. package/esm/parser/source.d.ts.map +1 -1
  52. package/esm/parser/source.js +21 -14
  53. package/esm/profile/cache.d.ts +29 -0
  54. package/esm/profile/cache.d.ts.map +1 -0
  55. package/esm/profile/cache.js +45 -0
  56. package/esm/profile/chain.d.ts +42 -0
  57. package/esm/profile/chain.d.ts.map +1 -0
  58. package/esm/profile/chain.js +193 -0
  59. package/esm/profile/colors.d.ts +26 -0
  60. package/esm/profile/colors.d.ts.map +1 -0
  61. package/esm/profile/colors.js +46 -0
  62. package/esm/profile/git-cache.d.ts +73 -0
  63. package/esm/profile/git-cache.d.ts.map +1 -0
  64. package/esm/profile/git-cache.js +96 -0
  65. package/esm/profile/load.d.ts +28 -0
  66. package/esm/profile/load.d.ts.map +1 -0
  67. package/esm/profile/load.js +50 -0
  68. package/esm/profile/manifest.d.ts +21 -0
  69. package/esm/profile/manifest.d.ts.map +1 -0
  70. package/esm/profile/manifest.js +815 -0
  71. package/esm/profile/merge.d.ts +26 -0
  72. package/esm/profile/merge.d.ts.map +1 -0
  73. package/esm/profile/merge.js +518 -0
  74. package/esm/profile/mod.d.ts +24 -0
  75. package/esm/profile/mod.d.ts.map +1 -0
  76. package/esm/profile/mod.js +15 -0
  77. package/esm/profile/npm.d.ts +51 -0
  78. package/esm/profile/npm.d.ts.map +1 -0
  79. package/esm/profile/npm.js +186 -0
  80. package/esm/profile/resolver.d.ts +60 -0
  81. package/esm/profile/resolver.d.ts.map +1 -0
  82. package/esm/profile/resolver.js +132 -0
  83. package/esm/reporter/mod.js +14 -27
  84. package/esm/validator/attributes.d.ts +43 -0
  85. package/esm/validator/attributes.d.ts.map +1 -0
  86. package/esm/validator/attributes.js +169 -0
  87. package/esm/validator/mod.d.ts +27 -6
  88. package/esm/validator/mod.d.ts.map +1 -1
  89. package/esm/validator/mod.js +132 -124
  90. package/esm/validator/normalize.d.ts +21 -0
  91. package/esm/validator/normalize.d.ts.map +1 -0
  92. package/esm/validator/normalize.js +58 -0
  93. package/esm/validator/pattern.d.ts +23 -0
  94. package/esm/validator/pattern.d.ts.map +1 -0
  95. package/esm/validator/pattern.js +44 -0
  96. package/esm/validator/pipeline.d.ts +30 -0
  97. package/esm/validator/pipeline.d.ts.map +1 -0
  98. package/esm/validator/pipeline.js +115 -0
  99. package/esm/validator/traceability.d.ts +48 -0
  100. package/esm/validator/traceability.d.ts.map +1 -0
  101. package/esm/validator/traceability.js +141 -0
  102. package/esm/validator/types.d.ts +48 -0
  103. package/esm/validator/types.d.ts.map +1 -0
  104. package/esm/validator/types.js +140 -0
  105. package/esm/validator/value_types.d.ts +20 -0
  106. package/esm/validator/value_types.d.ts.map +1 -0
  107. package/esm/validator/value_types.js +126 -0
  108. package/package.json +1 -1
  109. package/script/compiler/inverses.d.ts +22 -0
  110. package/script/compiler/inverses.d.ts.map +1 -0
  111. package/script/compiler/inverses.js +150 -0
  112. package/script/compiler/link_target.d.ts +19 -0
  113. package/script/compiler/link_target.d.ts.map +1 -0
  114. package/script/compiler/link_target.js +69 -0
  115. package/script/compiler/mod.d.ts +7 -1
  116. package/script/compiler/mod.d.ts.map +1 -1
  117. package/script/compiler/mod.js +62 -14
  118. package/script/compiler/schema.d.ts.map +1 -1
  119. package/script/compiler/schema.js +20 -1
  120. package/script/config/markspec.d.ts +51 -0
  121. package/script/config/markspec.d.ts.map +1 -0
  122. package/script/config/markspec.js +222 -0
  123. package/script/config/mod.d.ts +4 -0
  124. package/script/config/mod.d.ts.map +1 -1
  125. package/script/config/mod.js +28 -16
  126. package/script/formatter/mod.d.ts +19 -4
  127. package/script/formatter/mod.d.ts.map +1 -1
  128. package/script/formatter/mod.js +140 -29
  129. package/script/mod.d.ts +11 -7
  130. package/script/mod.d.ts.map +1 -1
  131. package/script/mod.js +50 -19
  132. package/script/model/attributes.d.ts +47 -0
  133. package/script/model/attributes.d.ts.map +1 -0
  134. package/script/model/attributes.js +101 -0
  135. package/script/model/mod.d.ts +257 -26
  136. package/script/model/mod.d.ts.map +1 -1
  137. package/script/model/mod.js +37 -2
  138. package/script/model/palette.d.ts +18 -0
  139. package/script/model/palette.d.ts.map +1 -0
  140. package/script/model/palette.js +26 -0
  141. package/script/model/profile.d.ts +189 -0
  142. package/script/model/profile.d.ts.map +1 -0
  143. package/script/model/profile.js +34 -0
  144. package/script/parser/attributes.d.ts +13 -1
  145. package/script/parser/attributes.d.ts.map +1 -1
  146. package/script/parser/attributes.js +48 -0
  147. package/script/parser/frontmatter.d.ts +53 -0
  148. package/script/parser/frontmatter.d.ts.map +1 -0
  149. package/script/parser/frontmatter.js +188 -0
  150. package/script/parser/grammars.js +11 -2
  151. package/script/parser/markdown.d.ts +21 -7
  152. package/script/parser/markdown.d.ts.map +1 -1
  153. package/script/parser/markdown.js +100 -39
  154. package/script/parser/mod.d.ts +26 -10
  155. package/script/parser/mod.d.ts.map +1 -1
  156. package/script/parser/mod.js +42 -11
  157. package/script/parser/source.d.ts +12 -8
  158. package/script/parser/source.d.ts.map +1 -1
  159. package/script/parser/source.js +21 -14
  160. package/script/profile/cache.d.ts +29 -0
  161. package/script/profile/cache.d.ts.map +1 -0
  162. package/script/profile/cache.js +48 -0
  163. package/script/profile/chain.d.ts +42 -0
  164. package/script/profile/chain.d.ts.map +1 -0
  165. package/script/profile/chain.js +229 -0
  166. package/script/profile/colors.d.ts +26 -0
  167. package/script/profile/colors.d.ts.map +1 -0
  168. package/script/profile/colors.js +49 -0
  169. package/script/profile/git-cache.d.ts +73 -0
  170. package/script/profile/git-cache.d.ts.map +1 -0
  171. package/script/profile/git-cache.js +104 -0
  172. package/script/profile/load.d.ts +28 -0
  173. package/script/profile/load.d.ts.map +1 -0
  174. package/script/profile/load.js +53 -0
  175. package/script/profile/manifest.d.ts +21 -0
  176. package/script/profile/manifest.d.ts.map +1 -0
  177. package/script/profile/manifest.js +818 -0
  178. package/script/profile/merge.d.ts +26 -0
  179. package/script/profile/merge.d.ts.map +1 -0
  180. package/script/profile/merge.js +521 -0
  181. package/script/profile/mod.d.ts +24 -0
  182. package/script/profile/mod.d.ts.map +1 -0
  183. package/script/profile/mod.js +33 -0
  184. package/script/profile/npm.d.ts +51 -0
  185. package/script/profile/npm.d.ts.map +1 -0
  186. package/script/profile/npm.js +191 -0
  187. package/script/profile/resolver.d.ts +60 -0
  188. package/script/profile/resolver.d.ts.map +1 -0
  189. package/script/profile/resolver.js +136 -0
  190. package/script/reporter/mod.js +14 -27
  191. package/script/validator/attributes.d.ts +43 -0
  192. package/script/validator/attributes.d.ts.map +1 -0
  193. package/script/validator/attributes.js +173 -0
  194. package/script/validator/mod.d.ts +27 -6
  195. package/script/validator/mod.d.ts.map +1 -1
  196. package/script/validator/mod.js +145 -123
  197. package/script/validator/normalize.d.ts +21 -0
  198. package/script/validator/normalize.d.ts.map +1 -0
  199. package/script/validator/normalize.js +61 -0
  200. package/script/validator/pattern.d.ts +23 -0
  201. package/script/validator/pattern.d.ts.map +1 -0
  202. package/script/validator/pattern.js +47 -0
  203. package/script/validator/pipeline.d.ts +30 -0
  204. package/script/validator/pipeline.d.ts.map +1 -0
  205. package/script/validator/pipeline.js +118 -0
  206. package/script/validator/traceability.d.ts +48 -0
  207. package/script/validator/traceability.d.ts.map +1 -0
  208. package/script/validator/traceability.js +146 -0
  209. package/script/validator/types.d.ts +48 -0
  210. package/script/validator/types.d.ts.map +1 -0
  211. package/script/validator/types.js +144 -0
  212. package/script/validator/value_types.d.ts +20 -0
  213. package/script/validator/value_types.d.ts.map +1 -0
  214. package/script/validator/value_types.js +129 -0
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @module model/attributes
3
+ *
4
+ * Built-in attribute catalog per the language spec (Part 2.1).
5
+ *
6
+ * The core defines one reserved identity slot (`Id:`) plus a small
7
+ * universal attribute set. Profile-declared attributes extend this
8
+ * catalog at runtime. Type-specific attributes (`Derived-from`,
9
+ * `Verifies`, `Allocated-to`, `Element-kind`, `Test-level`, …) are not
10
+ * built-ins — they are declared by the active profile.
11
+ */
12
+ import type { AttributeOrigin, AttributeValueType, EntryShape } from "./mod.js";
13
+ /** Specification of a single built-in attribute. */
14
+ export interface AttributeSpec {
15
+ /** Canonical Title-Case key (e.g., `Id`, `Labels`). */
16
+ readonly key: string;
17
+ /** Value type from the 14-type system. */
18
+ readonly type: AttributeValueType;
19
+ /** How the value arrives in the model. */
20
+ readonly origin: AttributeOrigin;
21
+ /**
22
+ * Shapes on which the attribute may appear. An empty list means the
23
+ * attribute applies to both shapes (universal).
24
+ */
25
+ readonly shapes: readonly EntryShape[];
26
+ /** Whether the attribute is required. */
27
+ readonly required: boolean;
28
+ /** Closed vocabulary — set when `type === "enum"`. */
29
+ readonly enumValues?: readonly string[];
30
+ }
31
+ /**
32
+ * Full catalog of core built-in attributes.
33
+ *
34
+ * Order within the array has no semantic meaning; consumers look up by key
35
+ * via {@linkcode attributeSpec}.
36
+ *
37
+ * Profile-declared attributes (`type:`, `Derived-from:`, `Verifies:`,
38
+ * `Allocated-to:`, `Element-kind:`, `Test-level:`, compliance attributes,
39
+ * …) are not listed here; they appear at runtime via the active profile's
40
+ * manifest.
41
+ */
42
+ export declare const ATTRIBUTE_CATALOG: readonly AttributeSpec[];
43
+ /** Canonical Title-Case attribute keys the core recognizes. */
44
+ export declare const UNIVERSAL_ATTRIBUTE_KEYS: readonly string[];
45
+ /** Look up an attribute specification by its canonical key. */
46
+ export declare function attributeSpec(key: string): AttributeSpec | undefined;
47
+ //# sourceMappingURL=attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/model/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAMhF,oDAAoD;AACpD,MAAM,WAAW,aAAa;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAgBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,aAAa,EAqDrD,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAC5B,CAAC;AAU3B,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEpE"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @module model/attributes
3
+ *
4
+ * Built-in attribute catalog per the language spec (Part 2.1).
5
+ *
6
+ * The core defines one reserved identity slot (`Id:`) plus a small
7
+ * universal attribute set. Profile-declared attributes extend this
8
+ * catalog at runtime. Type-specific attributes (`Derived-from`,
9
+ * `Verifies`, `Allocated-to`, `Element-kind`, `Test-level`, …) are not
10
+ * built-ins — they are declared by the active profile.
11
+ */
12
+ // ---------------------------------------------------------------------------
13
+ // Universal attribute catalog
14
+ // ---------------------------------------------------------------------------
15
+ /** Both shapes. */
16
+ const BOTH_SHAPES = ["identified", "referenced"];
17
+ /**
18
+ * Shapes that carry `References:` — identified entries only. A referenced
19
+ * entry does not itself cite other referenced entries via `References:`
20
+ * (the replacement relation is expressed via universal `Supersedes:`).
21
+ */
22
+ const CITING_SHAPES = ["identified"];
23
+ /**
24
+ * Full catalog of core built-in attributes.
25
+ *
26
+ * Order within the array has no semantic meaning; consumers look up by key
27
+ * via {@linkcode attributeSpec}.
28
+ *
29
+ * Profile-declared attributes (`type:`, `Derived-from:`, `Verifies:`,
30
+ * `Allocated-to:`, `Element-kind:`, `Test-level:`, compliance attributes,
31
+ * …) are not listed here; they appear at runtime via the active profile's
32
+ * manifest.
33
+ */
34
+ export const ATTRIBUTE_CATALOG = [
35
+ // Identity — required on every entry, shape-discriminated by value format
36
+ {
37
+ key: "Id",
38
+ type: "id",
39
+ origin: "assigned",
40
+ shapes: BOTH_SHAPES,
41
+ required: true,
42
+ },
43
+ // Universal — apply to every entry
44
+ {
45
+ key: "Labels",
46
+ type: "tag-list",
47
+ origin: "authored",
48
+ shapes: BOTH_SHAPES,
49
+ required: false,
50
+ },
51
+ {
52
+ key: "References",
53
+ type: "citation",
54
+ origin: "authored",
55
+ shapes: CITING_SHAPES,
56
+ required: false,
57
+ },
58
+ {
59
+ key: "External-id",
60
+ type: "external-id",
61
+ origin: "authored",
62
+ shapes: BOTH_SHAPES,
63
+ required: false,
64
+ },
65
+ {
66
+ key: "Supersedes",
67
+ type: "id",
68
+ origin: "authored",
69
+ shapes: BOTH_SHAPES,
70
+ required: false,
71
+ },
72
+ {
73
+ key: "Superseded-by",
74
+ type: "id",
75
+ origin: "generated",
76
+ shapes: BOTH_SHAPES,
77
+ required: false,
78
+ },
79
+ {
80
+ key: "Deprecated",
81
+ type: "text",
82
+ origin: "authored",
83
+ shapes: BOTH_SHAPES,
84
+ required: false,
85
+ },
86
+ ];
87
+ /** Canonical Title-Case attribute keys the core recognizes. */
88
+ export const UNIVERSAL_ATTRIBUTE_KEYS = ATTRIBUTE_CATALOG
89
+ .map((spec) => spec.key);
90
+ // ---------------------------------------------------------------------------
91
+ // Lookup helpers
92
+ // ---------------------------------------------------------------------------
93
+ const SPEC_BY_KEY = new Map(ATTRIBUTE_CATALOG.map((spec) => [spec.key, spec]));
94
+ /** Look up an attribute specification by its canonical key. */
95
+ export function attributeSpec(key) {
96
+ return SPEC_BY_KEY.get(key);
97
+ }
@@ -3,24 +3,27 @@
3
3
  *
4
4
  * MarkSpec document model — AST types, ID types, and project configuration.
5
5
  */
6
- /** Builtin requirement, architecture, and verification types. */
7
- export type BuiltinType = "STK" | "SYS" | "SRS" | "SAD" | "ICD" | "VAL" | "SIT" | "SWT";
6
+ export { ATTRIBUTE_CATALOG, attributeSpec, UNIVERSAL_ATTRIBUTE_KEYS, } from "./attributes.js";
7
+ export type { AttributeSpec } from "./attributes.js";
8
+ export { COLOR_NAME_RE, PALETTE_HUES } from "./palette.js";
9
+ export type { PaletteHue } from "./palette.js";
8
10
  /**
9
- * Entry type — a builtin type or any user-defined uppercase string.
10
- * Non-builtin types are valid; tooling validates format but not
11
- * traceability direction or level.
12
- */
13
- export type EntryType = BuiltinType | (string & Record<never, never>);
14
- /**
15
- * Human-readable entry identifier.
11
+ * Human-readable entry identifier from the `[...]` bracket marker.
12
+ *
13
+ * The core accepts any non-empty, project-unique string. Profiles may
14
+ * tighten by declaring per-type `display-id-pattern:` templates, used for
15
+ * both ID minting and type inference.
16
16
  *
17
- * Typed entries match `TYPE_XYZ_NNN[N]` (e.g., `SRS_BRK_001`, `SRS_BRK_0001`).
18
- * Reference entries are slugs: `[A-Za-z0-9-]+` (e.g., `ISO-26262-6`).
17
+ * For referenced entries the display ID is a slug (pandoc/BibTeX cite-key
18
+ * convention, e.g., `ISO-26262-6`, `serde`, `smith2021`). The leading `@`
19
+ * in `[@slug]` is accepted as Pandoc sugar and stripped during parsing.
19
20
  */
20
21
  export type DisplayId = string;
21
22
  /**
22
- * Universally unique ID in `TYPE_ULID` format (e.g., `SRS_01HGW2Q8MNP3`).
23
- * Assigned by tooling, never hand-authored, never changes once assigned.
23
+ * Universally unique identifier, bare 26-character Crockford base32.
24
+ *
25
+ * Used as the `Id:` attribute value for identified entries. Assigned by
26
+ * tooling, never hand-authored, immutable once assigned.
24
27
  */
25
28
  export type Ulid = string;
26
29
  /** Points to a span within a source file. */
@@ -39,14 +42,137 @@ export interface Attribute {
39
42
  /** Raw attribute value string. */
40
43
  readonly value: string;
41
44
  }
45
+ /**
46
+ * Collated attributes keyed by Title-Case attribute name.
47
+ *
48
+ * Repeatable types (`id-list`, `tag-list`, `external-id`) carry one entry
49
+ * per value after CSV-splitting and multi-line merging; `citation` carries
50
+ * one entry per occurrence (no CSV-splitting, locators may contain `,`).
51
+ * Single-valued types carry a one-element array; if the author wrote the
52
+ * attribute twice, the later value wins but both appear in
53
+ * {@linkcode Entry.rawAttributes} for round-trip fidelity.
54
+ *
55
+ * This is the representation the validator, formatter, and compiler consult
56
+ * for typed processing; {@linkcode Entry.rawAttributes} is the source of truth
57
+ * for exact round-trip through `markspec format`.
58
+ */
59
+ export type TypedAttributes = ReadonlyMap<string, readonly string[]>;
42
60
  /** The origin format of the entry. */
43
61
  export type EntrySource = "markdown" | "doc-comment";
62
+ /**
63
+ * Entry shape — one of two semantics-free categories the core recognizes.
64
+ *
65
+ * - `identified` — content unit the project authors and owns; `Id:` value
66
+ * is a bare ULID.
67
+ * - `referenced` — citation pointing to an external artifact; `Id:` value
68
+ * is a scheme-qualified URI (RFC 3986): `urn:`, `doi:`, `pkg:`,
69
+ * `https:`, `isbn:`, …
70
+ *
71
+ * Shape is determined by the `Id:` attribute's value format, not by the
72
+ * display-ID format or the document context. Concrete types
73
+ * (`requirement`, `test`, `unit`, `standard`, `dependency`, …) are declared
74
+ * by the active profile, not by the core.
75
+ */
76
+ export type EntryShape = "identified" | "referenced";
77
+ /** Core-reserved identity attribute name. */
78
+ export declare const IDENTITY_KEY: "Id";
79
+ /** Regex matching a bare ULID (identified-entry `Id:` value). */
80
+ export declare const ULID_RE: RegExp;
81
+ /**
82
+ * Regex matching a scheme-qualified URI (RFC 3986 §3.1 scheme).
83
+ *
84
+ * A scheme starts with a letter, followed by letters/digits/`+`/`-`/`.`,
85
+ * terminated by `:`. This is the gate that distinguishes a URI value from
86
+ * a bare slug in an `Id:` attribute.
87
+ */
88
+ export declare const URI_SCHEME_RE: RegExp;
89
+ /**
90
+ * Decide the shape of an entry from its `Id:` value.
91
+ *
92
+ * Returns `undefined` for inputs that are neither a bare ULID nor a
93
+ * scheme-qualified URI — the caller emits a validation error.
94
+ */
95
+ export declare function shapeFromIdValue(value: string): EntryShape | undefined;
96
+ /**
97
+ * Origin of an attribute value.
98
+ *
99
+ * - `authored` — written by the author in the source file.
100
+ * - `inferred` — pre-filled by `markspec format` from a heuristic,
101
+ * committed to source, author-overridable.
102
+ * - `assigned` — generated fresh by `markspec format` at creation time
103
+ * (the ULID inside an identified-entry `Id:`). Never derived, never
104
+ * changes after assignment.
105
+ * - `generated` — computed at build time from inverse relations.
106
+ * Never committed to source.
107
+ */
108
+ export type AttributeOrigin = "authored" | "inferred" | "assigned" | "generated";
109
+ /**
110
+ * Attribute value type (14 types).
111
+ *
112
+ * Cardinality is encoded in the type:
113
+ * - Repeatable: `id-list`, `tag-list`, `citation`, `external-id`.
114
+ * - Single-valued: everything else.
115
+ *
116
+ * Repeatable types accept multi-line and (except `citation`) CSV on input;
117
+ * the formatter always emits multi-line form.
118
+ */
119
+ export type AttributeValueType = "id" | "id-list" | "uri" | "url" | "path" | "path-or-id" | "enum" | "tag-list" | "text" | "citation" | "external-id" | "integer" | "date" | "boolean";
120
+ /**
121
+ * Observed properties of an entry.
122
+ *
123
+ * Properties are model-level observations — never authored in source, never
124
+ * round-trip through `markspec format`, not in git diffs. Each category is
125
+ * optional; absence means "not observed (yet)".
126
+ */
127
+ export interface EntryProperties {
128
+ /** Repository location. */
129
+ readonly file?: {
130
+ readonly path: string;
131
+ readonly line?: number;
132
+ readonly column?: number;
133
+ };
134
+ /** Version-control observations. */
135
+ readonly git?: {
136
+ readonly createdAt?: string;
137
+ readonly modifiedAt?: string;
138
+ readonly contributors?: readonly string[];
139
+ readonly revision?: string;
140
+ };
141
+ /** External connector state. */
142
+ readonly sync?: {
143
+ readonly lastSyncedAt?: string;
144
+ readonly remoteState?: string;
145
+ readonly externalSource?: string;
146
+ };
147
+ /** Compilation-time provenance. */
148
+ readonly build?: {
149
+ readonly resolutionSource?: string;
150
+ readonly registryOrigin?: string;
151
+ };
152
+ /**
153
+ * Entry-source provenance — set when an entry is produced by an adapter
154
+ * other than the Markdown parser (doc-comment extractor, SBOM ingester,
155
+ * ECAD/PLM connector).
156
+ */
157
+ readonly source?: {
158
+ readonly type: string;
159
+ readonly adapter?: string;
160
+ readonly language?: string;
161
+ readonly rule?: string;
162
+ readonly extractedAt?: string;
163
+ };
164
+ }
44
165
  /**
45
166
  * A parsed MarkSpec entry — the core AST node.
46
167
  *
47
- * Covers both typed entries (`SRS_BRK_0001`) and reference entries
48
- * (`ISO-26262-6`). The `entryType` field is set for typed entries,
49
- * `undefined` for reference entries.
168
+ * The `shape` field discriminates the two core categories:
169
+ * - `identified` entries carry a bare ULID in `id` (populated).
170
+ * - `referenced` entries carry a URI in `id` (populated).
171
+ *
172
+ * The `type` field holds the active profile's classification for the entry
173
+ * (inferred from the display-ID pattern or authored explicitly via a
174
+ * `type:` attribute). It is `undefined` when no profile rule classifies
175
+ * the entry.
50
176
  */
51
177
  export interface Entry {
52
178
  /** Human-readable display ID from the `[...]` marker. */
@@ -55,16 +181,46 @@ export interface Entry {
55
181
  readonly title: string;
56
182
  /** Body content (paragraphs, alerts, code blocks) between title and attributes. */
57
183
  readonly body: string;
58
- /** Parsed attribute block (`Key: Value` lines). */
59
- readonly attributes: readonly Attribute[];
60
- /** ULID from the `Id:` attribute, if present. */
61
- readonly id: Ulid | undefined;
62
- /** Resolved entry type prefix (e.g., `SRS`), if this is a typed entry. */
63
- readonly entryType: EntryType | undefined;
184
+ /**
185
+ * Source-order raw attribute array. Used by the formatter for round-trip
186
+ * fidelity (preserving key casing, line order, and trailing backslashes).
187
+ * For lookup-oriented access, use `typedAttributes` — the collated,
188
+ * CSV-split Map view of the same data.
189
+ */
190
+ readonly rawAttributes: readonly Attribute[];
191
+ /**
192
+ * Collated, typed view of {@linkcode Entry.rawAttributes}.
193
+ *
194
+ * Populated by the parser alongside `rawAttributes`. Downstream layers
195
+ * (validator, compiler) consult this map for typed processing; the
196
+ * formatter still reads `rawAttributes` for exact round-trip.
197
+ */
198
+ readonly typedAttributes: TypedAttributes;
199
+ /**
200
+ * Value of the `Id:` attribute — a ULID for identified entries, a URI for
201
+ * referenced entries. Absent when `Id:` was missing or malformed.
202
+ */
203
+ readonly id?: string;
204
+ /**
205
+ * Profile-declared type for this entry, when classified.
206
+ *
207
+ * Normally inferred by the active profile from the display-ID prefix
208
+ * matching a declared `display-id-pattern:`. An explicit `type:`
209
+ * attribute in source overrides inference. Absent when no profile rule
210
+ * matches (e.g., free-form display ID with no `type:` attribute).
211
+ */
212
+ readonly type?: string;
213
+ /** Entry shape — `identified` or `referenced`. */
214
+ readonly shape: EntryShape;
64
215
  /** Where the entry was found. */
65
216
  readonly location: SourceLocation;
66
217
  /** Whether this came from a Markdown file or a doc comment. */
67
218
  readonly source: EntrySource;
219
+ /**
220
+ * Observed properties (file path, git history, sync state, build origin,
221
+ * source-adapter provenance).
222
+ */
223
+ readonly properties?: EntryProperties;
68
224
  }
69
225
  /** Severity level for diagnostics. */
70
226
  export type Severity = "error" | "warning" | "info";
@@ -85,8 +241,6 @@ export declare const REFHUB_URL = "https://driftsys.github.io/refhub";
85
241
  export interface ProjectConfig {
86
242
  /** Project name (e.g., `io.driftsys.markspec`). */
87
243
  readonly name: string;
88
- /** 2-6 letter project/domain abbreviation used in display IDs (e.g., `BRK`). */
89
- readonly domain: string;
90
244
  /** Project version string. */
91
245
  readonly version: string;
92
246
  /** Allowed label vocabulary (e.g., `["ASIL-A", "ASIL-B"]`). Empty = no constraint. */
@@ -140,8 +294,16 @@ export interface InlineRef {
140
294
  readonly refId: string;
141
295
  readonly location: SourceLocation;
142
296
  }
143
- /** Kind of directional link between entries. */
144
- export type LinkKind = "satisfies" | "derived-from" | "allocates" | "constrains" | "verifies" | "implements";
297
+ /**
298
+ * Kind of directional link between entries — relation name lifted from the
299
+ * source attribute.
300
+ *
301
+ * The core bakes in only `supersedes` (universal retirement). All other
302
+ * relation names listed here are conventions recognized by shipped profile
303
+ * packages; in a profile-aware pipeline, link kinds come from the active
304
+ * profile's `traceability:` declarations rather than this closed union.
305
+ */
306
+ export type LinkKind = "satisfies" | "derived-from" | "references" | "allocated-to" | "realizes" | "verifies" | "tests" | "depends-on" | "part-of" | "generated-from" | "supersedes";
145
307
  /** A directional link between two entries in the traceability graph. */
146
308
  export interface Link {
147
309
  readonly from: DisplayId;
@@ -149,4 +311,73 @@ export interface Link {
149
311
  readonly kind: LinkKind;
150
312
  readonly location: SourceLocation;
151
313
  }
314
+ /**
315
+ * Document-level attributes authored in YAML front matter.
316
+ *
317
+ * Keys use kebab-case (YAML-ecosystem convention). Core keys below; profiles
318
+ * declare additional keys; `.markspec.yaml` → `frontMatter.allowedKeys`
319
+ * allowlists ecosystem keys (Hugo, Jekyll, Docusaurus). Keys forbidden by
320
+ * the language spec (`title`, `description`, `date`, `authors`, …) are
321
+ * rejected by MSL-D001 and never reach this map.
322
+ */
323
+ export interface DocumentAttributes {
324
+ /**
325
+ * Document identity — ULID (identified) or URI (referenced), same
326
+ * discrimination rule as entry `Id:`. Conventionally a ULID for
327
+ * project-authored documents.
328
+ */
329
+ readonly "document-id"?: string;
330
+ /** Overrides filename/directive-based type detection. */
331
+ readonly "document-type"?: string;
332
+ /** Classification tags (`tag-list`). */
333
+ readonly labels?: readonly string[];
334
+ /** Retirement reason (free-text). Presence marks the document as retired. */
335
+ readonly deprecated?: string;
336
+ /** Cross-system identifier(s) (`external-id`). */
337
+ readonly "external-id"?: readonly string[];
338
+ /** `document-id` of a document this one replaces. */
339
+ readonly supersedes?: string;
340
+ /** External reference citations with optional locator (`citation`). */
341
+ readonly references?: readonly string[];
342
+ /** Org free-form metadata, never validated. */
343
+ readonly metadata?: Readonly<Record<string, unknown>>;
344
+ /** Allowlisted ecosystem keys (preserved verbatim, not validated). */
345
+ readonly extra?: Readonly<Record<string, unknown>>;
346
+ }
347
+ /**
348
+ * Observed document properties — derived, never authored.
349
+ *
350
+ * The H1, first paragraph, git history, and filesystem are the
351
+ * authoritative sources. These fields are populated progressively as
352
+ * observation support lands.
353
+ */
354
+ export interface DocumentProperties {
355
+ /** H1 heading, or filename stem fallback. */
356
+ readonly title?: string;
357
+ /** Merge-to-main count (starts at `0`). */
358
+ readonly revision?: number;
359
+ /** Contributors from `project.yaml` or git history. */
360
+ readonly authors?: readonly string[];
361
+ /** First commit timestamp, or filesystem ctime fallback. */
362
+ readonly createdAt?: string;
363
+ /** Last merge-commit timestamp, or filesystem mtime fallback. */
364
+ readonly modifiedAt?: string;
365
+ }
366
+ /**
367
+ * A parsed MarkSpec document.
368
+ *
369
+ * A Markdown (or source) file containing entries, optionally preceded by
370
+ * YAML front matter. Document metadata is split into authored `attributes`
371
+ * (front matter) and observed `properties` (H1, git, filesystem).
372
+ */
373
+ export interface Document {
374
+ /** File path (absolute or project-relative). */
375
+ readonly file: string;
376
+ /** Document-level attributes from front matter. */
377
+ readonly attributes: DocumentAttributes;
378
+ /** Observed document properties. */
379
+ readonly properties: DocumentProperties;
380
+ }
381
+ export type { AttrDecl, Cardinality, DocTypeDef, EffectiveProfile, EffectiveShapeScope, EffectiveTypeDef, EnforcementMode, InverseDecl, LoadedProfile, ProfileChain, ProfileId, ProfileManifest, ProfileSpecifier, ProvenancedMap, ProvenancedMapEntry, ProvenancedValue, TargetMatcher, TraceRule, TypeDef, ValueType, } from "./profile.js";
382
+ export { LIST_VALUE_TYPES, VALUE_TYPES } from "./profile.js";
152
383
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/model/mod.ts"],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gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
package/esm/model/mod.js CHANGED
@@ -3,6 +3,33 @@
3
3
  *
4
4
  * MarkSpec document model — AST types, ID types, and project configuration.
5
5
  */
6
+ export { ATTRIBUTE_CATALOG, attributeSpec, UNIVERSAL_ATTRIBUTE_KEYS, } from "./attributes.js";
7
+ export { COLOR_NAME_RE, PALETTE_HUES } from "./palette.js";
8
+ /** Core-reserved identity attribute name. */
9
+ export const IDENTITY_KEY = "Id";
10
+ /** Regex matching a bare ULID (identified-entry `Id:` value). */
11
+ export const ULID_RE = /^[0-9A-HJKMNP-TV-Z]{26}$/;
12
+ /**
13
+ * Regex matching a scheme-qualified URI (RFC 3986 §3.1 scheme).
14
+ *
15
+ * A scheme starts with a letter, followed by letters/digits/`+`/`-`/`.`,
16
+ * terminated by `:`. This is the gate that distinguishes a URI value from
17
+ * a bare slug in an `Id:` attribute.
18
+ */
19
+ export const URI_SCHEME_RE = /^[A-Za-z][A-Za-z0-9+\-.]*:/;
20
+ /**
21
+ * Decide the shape of an entry from its `Id:` value.
22
+ *
23
+ * Returns `undefined` for inputs that are neither a bare ULID nor a
24
+ * scheme-qualified URI — the caller emits a validation error.
25
+ */
26
+ export function shapeFromIdValue(value) {
27
+ if (ULID_RE.test(value))
28
+ return "identified";
29
+ if (URI_SCHEME_RE.test(value))
30
+ return "referenced";
31
+ return undefined;
32
+ }
6
33
  // ---------------------------------------------------------------------------
7
34
  // Project configuration
8
35
  // ---------------------------------------------------------------------------
@@ -11,7 +38,6 @@ export const REFHUB_URL = "https://driftsys.github.io/refhub";
11
38
  /** Default configuration used when no `project.yaml` is found. */
12
39
  export const DEFAULT_PROJECT_CONFIG = {
13
40
  name: "",
14
- domain: "",
15
41
  version: "0.0.0",
16
42
  labels: [],
17
43
  parents: [],
@@ -45,3 +71,4 @@ export class ConfigError extends Error {
45
71
  this.fieldErrors = fieldErrors;
46
72
  }
47
73
  }
74
+ export { LIST_VALUE_TYPES, VALUE_TYPES } from "./profile.js";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @module model/palette
3
+ *
4
+ * The seven-hue entry color palette and its semantic-name regex. Single
5
+ * source of truth — both the profile manifest parser and the renderer
6
+ * import from here so the two layers can never drift.
7
+ *
8
+ * Mirrors the `diagram:` group in `theme/tokens.yaml`. Adding a hue is a
9
+ * tokens-side change followed by an entry here; the order does not matter
10
+ * but kept stable for diagnostic message readability.
11
+ */
12
+ /** The seven palette hues a profile may bind a semantic color name to. */
13
+ export declare const PALETTE_HUES: readonly ["blue", "cyan", "teal", "orange", "red", "purple", "grey"];
14
+ /** Type of a palette hue name. */
15
+ export type PaletteHue = typeof PALETTE_HUES[number];
16
+ /** Regex for a valid semantic color-role name (key into `profile.colors:`). */
17
+ export declare const COLOR_NAME_RE: RegExp;
18
+ //# sourceMappingURL=palette.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/model/palette.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,YAAY,sEAQf,CAAC;AAEX,kCAAkC;AAClC,MAAM,MAAM,UAAU,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAErD,+EAA+E;AAC/E,eAAO,MAAM,aAAa,QAAsB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @module model/palette
3
+ *
4
+ * The seven-hue entry color palette and its semantic-name regex. Single
5
+ * source of truth — both the profile manifest parser and the renderer
6
+ * import from here so the two layers can never drift.
7
+ *
8
+ * Mirrors the `diagram:` group in `theme/tokens.yaml`. Adding a hue is a
9
+ * tokens-side change followed by an entry here; the order does not matter
10
+ * but kept stable for diagnostic message readability.
11
+ */
12
+ /** The seven palette hues a profile may bind a semantic color name to. */
13
+ export const PALETTE_HUES = [
14
+ "blue",
15
+ "cyan",
16
+ "teal",
17
+ "orange",
18
+ "red",
19
+ "purple",
20
+ "grey",
21
+ ];
22
+ /** Regex for a valid semantic color-role name (key into `profile.colors:`). */
23
+ export const COLOR_NAME_RE = /^[a-z][a-z0-9-]*$/;