@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
@@ -5,7 +5,40 @@
5
5
  * MarkSpec document model — AST types, ID types, and project configuration.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ConfigError = exports.DEFAULT_PROJECT_CONFIG = exports.REFHUB_URL = void 0;
8
+ exports.VALUE_TYPES = exports.LIST_VALUE_TYPES = exports.ConfigError = exports.DEFAULT_PROJECT_CONFIG = exports.REFHUB_URL = exports.URI_SCHEME_RE = exports.ULID_RE = exports.IDENTITY_KEY = exports.PALETTE_HUES = exports.COLOR_NAME_RE = exports.UNIVERSAL_ATTRIBUTE_KEYS = exports.attributeSpec = exports.ATTRIBUTE_CATALOG = void 0;
9
+ exports.shapeFromIdValue = shapeFromIdValue;
10
+ var attributes_js_1 = require("./attributes.js");
11
+ Object.defineProperty(exports, "ATTRIBUTE_CATALOG", { enumerable: true, get: function () { return attributes_js_1.ATTRIBUTE_CATALOG; } });
12
+ Object.defineProperty(exports, "attributeSpec", { enumerable: true, get: function () { return attributes_js_1.attributeSpec; } });
13
+ Object.defineProperty(exports, "UNIVERSAL_ATTRIBUTE_KEYS", { enumerable: true, get: function () { return attributes_js_1.UNIVERSAL_ATTRIBUTE_KEYS; } });
14
+ var palette_js_1 = require("./palette.js");
15
+ Object.defineProperty(exports, "COLOR_NAME_RE", { enumerable: true, get: function () { return palette_js_1.COLOR_NAME_RE; } });
16
+ Object.defineProperty(exports, "PALETTE_HUES", { enumerable: true, get: function () { return palette_js_1.PALETTE_HUES; } });
17
+ /** Core-reserved identity attribute name. */
18
+ exports.IDENTITY_KEY = "Id";
19
+ /** Regex matching a bare ULID (identified-entry `Id:` value). */
20
+ exports.ULID_RE = /^[0-9A-HJKMNP-TV-Z]{26}$/;
21
+ /**
22
+ * Regex matching a scheme-qualified URI (RFC 3986 §3.1 scheme).
23
+ *
24
+ * A scheme starts with a letter, followed by letters/digits/`+`/`-`/`.`,
25
+ * terminated by `:`. This is the gate that distinguishes a URI value from
26
+ * a bare slug in an `Id:` attribute.
27
+ */
28
+ exports.URI_SCHEME_RE = /^[A-Za-z][A-Za-z0-9+\-.]*:/;
29
+ /**
30
+ * Decide the shape of an entry from its `Id:` value.
31
+ *
32
+ * Returns `undefined` for inputs that are neither a bare ULID nor a
33
+ * scheme-qualified URI — the caller emits a validation error.
34
+ */
35
+ function shapeFromIdValue(value) {
36
+ if (exports.ULID_RE.test(value))
37
+ return "identified";
38
+ if (exports.URI_SCHEME_RE.test(value))
39
+ return "referenced";
40
+ return undefined;
41
+ }
9
42
  // ---------------------------------------------------------------------------
10
43
  // Project configuration
11
44
  // ---------------------------------------------------------------------------
@@ -14,7 +47,6 @@ exports.REFHUB_URL = "https://driftsys.github.io/refhub";
14
47
  /** Default configuration used when no `project.yaml` is found. */
15
48
  exports.DEFAULT_PROJECT_CONFIG = {
16
49
  name: "",
17
- domain: "",
18
50
  version: "0.0.0",
19
51
  labels: [],
20
52
  parents: [],
@@ -49,3 +81,6 @@ class ConfigError extends Error {
49
81
  }
50
82
  }
51
83
  exports.ConfigError = ConfigError;
84
+ var profile_js_1 = require("./profile.js");
85
+ Object.defineProperty(exports, "LIST_VALUE_TYPES", { enumerable: true, get: function () { return profile_js_1.LIST_VALUE_TYPES; } });
86
+ Object.defineProperty(exports, "VALUE_TYPES", { enumerable: true, get: function () { return profile_js_1.VALUE_TYPES; } });
@@ -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,26 @@
1
+ "use strict";
2
+ /**
3
+ * @module model/palette
4
+ *
5
+ * The seven-hue entry color palette and its semantic-name regex. Single
6
+ * source of truth — both the profile manifest parser and the renderer
7
+ * import from here so the two layers can never drift.
8
+ *
9
+ * Mirrors the `diagram:` group in `theme/tokens.yaml`. Adding a hue is a
10
+ * tokens-side change followed by an entry here; the order does not matter
11
+ * but kept stable for diagnostic message readability.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.COLOR_NAME_RE = exports.PALETTE_HUES = void 0;
15
+ /** The seven palette hues a profile may bind a semantic color name to. */
16
+ exports.PALETTE_HUES = [
17
+ "blue",
18
+ "cyan",
19
+ "teal",
20
+ "orange",
21
+ "red",
22
+ "purple",
23
+ "grey",
24
+ ];
25
+ /** Regex for a valid semantic color-role name (key into `profile.colors:`). */
26
+ exports.COLOR_NAME_RE = /^[a-z][a-z0-9-]*$/;
@@ -0,0 +1,189 @@
1
+ /**
2
+ * @module model/profile
3
+ *
4
+ * Profile data model — TypeScript types that mirror ADR-008 §4 manifest
5
+ * schema. Used by the profile loader, merger, and validator.
6
+ */
7
+ import type { EntryShape } from "./mod.js";
8
+ /** All 14 attribute value-type keywords recognized by the core. */
9
+ export declare const VALUE_TYPES: readonly ["id", "id-list", "uri", "url", "path", "path-or-id", "enum", "tag-list", "text", "citation", "external-id", "integer", "date", "boolean"];
10
+ export type ValueType = typeof VALUE_TYPES[number];
11
+ /** Types whose default cardinality is a list (`0..N`). */
12
+ export declare const LIST_VALUE_TYPES: ReadonlySet<ValueType>;
13
+ /** Count bounds `lower..upper` where upper = Infinity represents `N`. */
14
+ export interface Cardinality {
15
+ readonly lower: number;
16
+ readonly upper: number;
17
+ }
18
+ /** Inverse declaration for link attributes (`id` / `id-list`). */
19
+ export interface InverseDecl {
20
+ readonly name: string;
21
+ readonly category: string;
22
+ }
23
+ /** A single attribute declaration within a profile scope. */
24
+ export interface AttrDecl {
25
+ readonly name: string;
26
+ readonly type: ValueType;
27
+ readonly required: boolean;
28
+ readonly cardinality: Cardinality;
29
+ readonly values?: readonly string[];
30
+ readonly inverse?: InverseDecl;
31
+ }
32
+ /** Target matcher: either a type name or a shape matcher object. */
33
+ export type TargetMatcher = string | {
34
+ readonly shape: "identified" | "referenced";
35
+ };
36
+ /** Traceability rule declared on a shape or type scope. */
37
+ export interface TraceRule {
38
+ readonly target: readonly TargetMatcher[];
39
+ readonly cardinality?: Cardinality;
40
+ readonly required: boolean;
41
+ }
42
+ export type EnforcementMode = "off" | "warn" | "error";
43
+ export interface TypeDef {
44
+ readonly name: string;
45
+ readonly shape: EntryShape;
46
+ readonly displayIdPattern?: string;
47
+ readonly displayIdPatternEnforcement: EnforcementMode;
48
+ readonly required: readonly string[];
49
+ readonly attributes: readonly AttrDecl[];
50
+ readonly traceability: ReadonlyMap<string, TraceRule>;
51
+ /** Optional semantic color-role name (key into `ProfileManifest.colors`). */
52
+ readonly color?: string;
53
+ }
54
+ export interface DocTypeDef {
55
+ readonly id: string;
56
+ readonly contains: readonly string[];
57
+ readonly description?: string;
58
+ }
59
+ /** Specifier scheme identifying where a profile lives. */
60
+ export type ProfileSpecifier = {
61
+ readonly kind: "local";
62
+ readonly path: string;
63
+ } | {
64
+ readonly kind: "git";
65
+ readonly repo: string;
66
+ readonly subpath?: string;
67
+ readonly tag: string;
68
+ } | {
69
+ readonly kind: "npm";
70
+ readonly scope?: string;
71
+ readonly name: string;
72
+ readonly range: string;
73
+ };
74
+ /** Parsed `markspec.yaml` content — the manifest authored in a profile. */
75
+ export interface ProfileManifest {
76
+ readonly id: string;
77
+ readonly version: string;
78
+ readonly description?: string;
79
+ readonly license?: string;
80
+ readonly extends?: ProfileSpecifier;
81
+ readonly universalRequired: readonly string[];
82
+ readonly universalAttributes: readonly AttrDecl[];
83
+ readonly labels: readonly string[];
84
+ /**
85
+ * Semantic color-role bindings authored on this manifest.
86
+ * Maps a profile-author-chosen name (e.g. "primary") to a palette hue
87
+ * name (one of "blue", "cyan", "teal", "orange", "red", "purple", "grey").
88
+ * Empty when the manifest does not declare `profile.colors:`.
89
+ */
90
+ readonly colors: ReadonlyMap<string, string>;
91
+ readonly identified: {
92
+ readonly required: readonly string[];
93
+ readonly attributes: readonly AttrDecl[];
94
+ readonly traceability: ReadonlyMap<string, TraceRule>;
95
+ };
96
+ readonly referenced: {
97
+ readonly required: readonly string[];
98
+ readonly attributes: readonly AttrDecl[];
99
+ };
100
+ readonly types: ReadonlyMap<string, TypeDef>;
101
+ readonly documents: {
102
+ readonly types: readonly DocTypeDef[];
103
+ readonly frontMatter: readonly AttrDecl[];
104
+ };
105
+ }
106
+ /**
107
+ * A profile after it has been resolved and parsed. One tier of a
108
+ * {@linkcode ProfileChain}.
109
+ *
110
+ * `sourcePath` is the absolute path of the `markspec.yaml` the manifest was
111
+ * parsed from. `baseDir` is the directory containing that file — used as the
112
+ * context for resolving this profile's `extends:` (in Phase 3+).
113
+ */
114
+ export interface LoadedProfile {
115
+ readonly id: string;
116
+ readonly version: string;
117
+ readonly specifier: ProfileSpecifier;
118
+ readonly manifest: ProfileManifest;
119
+ readonly sourcePath: string;
120
+ readonly baseDir: string;
121
+ }
122
+ /**
123
+ * The resolved profile chain for a project. A Phase 2 chain always contains
124
+ * exactly one tier (no `extends:` walking). Phase 3 introduces multi-tier
125
+ * chains ordered root-parent → leaf-child.
126
+ */
127
+ export interface ProfileChain {
128
+ readonly tiers: readonly LoadedProfile[];
129
+ readonly effective: EffectiveProfile;
130
+ }
131
+ /** Identifier of the profile (tier) that contributed a value — `manifest.id`. */
132
+ export type ProfileId = string;
133
+ /** A single value annotated with the profile it originated from. */
134
+ export interface ProvenancedValue<T> {
135
+ readonly value: T;
136
+ readonly origin: ProfileId;
137
+ }
138
+ /**
139
+ * A map-valued entry: the current effective value, the tier that set it, and
140
+ * the ordered list of parent tiers whose values this entry narrowed or
141
+ * replaced. Used for fields where children can override parents (attributes,
142
+ * traceability rules, type definitions).
143
+ */
144
+ export interface ProvenancedMapEntry<V> {
145
+ readonly value: V;
146
+ readonly origin: ProfileId;
147
+ readonly overrides?: readonly ProfileId[];
148
+ }
149
+ /** Map with per-entry provenance. Keys are always strings (attr/type/link names). */
150
+ export type ProvenancedMap<V> = ReadonlyMap<string, ProvenancedMapEntry<V>>;
151
+ /** Shape-scope rules after merging (identified or referenced). */
152
+ export interface EffectiveShapeScope {
153
+ readonly required: ProvenancedValue<readonly string[]>;
154
+ readonly attributes: ProvenancedMap<AttrDecl>;
155
+ /** Referenced scope's traceability is always empty (referenced entries don't originate links). */
156
+ readonly traceability: ProvenancedMap<TraceRule>;
157
+ }
158
+ /** Type-scope rules after merging. */
159
+ export interface EffectiveTypeDef {
160
+ readonly name: string;
161
+ /** Shape is frozen at the type's declaration — never changes across the chain. */
162
+ readonly shape: EntryShape;
163
+ readonly displayIdPattern: ProvenancedValue<string | undefined>;
164
+ readonly displayIdPatternEnforcement: ProvenancedValue<EnforcementMode>;
165
+ /** Resolved semantic color-role name, or `undefined` when unset. */
166
+ readonly color: ProvenancedValue<string | undefined>;
167
+ readonly required: ProvenancedValue<readonly string[]>;
168
+ readonly attributes: ProvenancedMap<AttrDecl>;
169
+ readonly traceability: ProvenancedMap<TraceRule>;
170
+ }
171
+ /**
172
+ * The merged, validator-ready view of a profile chain. Every field carries
173
+ * per-rule provenance so a diagnostic can blame the right tier.
174
+ */
175
+ export interface EffectiveProfile {
176
+ readonly required: ProvenancedValue<readonly string[]>;
177
+ readonly attributes: ProvenancedMap<AttrDecl>;
178
+ readonly labels: ProvenancedValue<readonly string[]>;
179
+ /** Semantic color-role bindings merged across the chain. */
180
+ readonly colors: ProvenancedMap<string>;
181
+ readonly identified: EffectiveShapeScope;
182
+ readonly referenced: EffectiveShapeScope;
183
+ readonly types: ProvenancedMap<EffectiveTypeDef>;
184
+ readonly documents: {
185
+ readonly types: ProvenancedMap<DocTypeDef>;
186
+ readonly frontMatter: ProvenancedMap<AttrDecl>;
187
+ };
188
+ }
189
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/model/profile.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAM3C,mEAAmE;AACnE,eAAO,MAAM,WAAW,qJAed,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;AAEnD,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,SAAS,CAGlD,CAAC;AAMH,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAMD,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,6DAA6D;AAC7D,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,WAAW,C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S,MAAM,EAAE,CAAC,CAAC;IACrD,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IACjD,QAAQ,CAAC,SAAS,EAAE;QAClB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;QAC3C,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;KAChD,CAAC;CACH"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * @module model/profile
4
+ *
5
+ * Profile data model — TypeScript types that mirror ADR-008 §4 manifest
6
+ * schema. Used by the profile loader, merger, and validator.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LIST_VALUE_TYPES = exports.VALUE_TYPES = void 0;
10
+ // ---------------------------------------------------------------------------
11
+ // Value types (ADR-002 Annex C)
12
+ // ---------------------------------------------------------------------------
13
+ /** All 14 attribute value-type keywords recognized by the core. */
14
+ exports.VALUE_TYPES = [
15
+ "id",
16
+ "id-list",
17
+ "uri",
18
+ "url",
19
+ "path",
20
+ "path-or-id",
21
+ "enum",
22
+ "tag-list",
23
+ "text",
24
+ "citation",
25
+ "external-id",
26
+ "integer",
27
+ "date",
28
+ "boolean",
29
+ ];
30
+ /** Types whose default cardinality is a list (`0..N`). */
31
+ exports.LIST_VALUE_TYPES = new Set([
32
+ "id-list",
33
+ "tag-list",
34
+ ]);
@@ -5,7 +5,7 @@
5
5
  * Handles trailing backslash separators and distinguishes
6
6
  * trailing attribute blocks from body prose.
7
7
  */
8
- import type { Attribute } from "../model/mod.js";
8
+ import type { Attribute, TypedAttributes } from "../model/mod.js";
9
9
  /**
10
10
  * Parse an array of attribute lines into Attribute objects.
11
11
  *
@@ -22,6 +22,18 @@ export declare function parseAttributes(lines: readonly string[]): Attribute[];
22
22
  * Used to detect attribute blocks at the end of entry bodies.
23
23
  */
24
24
  export declare const ATTR_LINE_RE: RegExp;
25
+ /**
26
+ * Collate a flat list of parsed attributes into a typed, keyed map per
27
+ * ADR-002 §2.6.
28
+ *
29
+ * - Repeatable types (`id-list` / `tag-list` / `external-id`): multi-line
30
+ * entries merge; CSV values on a single line split on `,`.
31
+ * - `citation`: multi-line only (locators may contain commas).
32
+ * - Single-valued types: all occurrences are preserved in-order; the
33
+ * validator decides what to do about duplicates.
34
+ * - Unknown keys: preserved as-is, one entry per occurrence.
35
+ */
36
+ export declare function collateAttributes(attributes: readonly Attribute[]): TypedAttributes;
25
37
  /**
26
38
  * Split raw entry content into body text and attribute lines.
27
39
  *
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/parser/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AASjD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAAE,CAiBrE;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,QAA6B,CAAC;AAEvD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,GACd,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CA+BpB"}
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/parser/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAUlE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAAE,CAiBrE;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,QAA6B,CAAC;AAYvD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,eAAe,CA6BjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,GACd,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CA+BpB"}
@@ -9,7 +9,9 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.ATTR_LINE_RE = void 0;
11
11
  exports.parseAttributes = parseAttributes;
12
+ exports.collateAttributes = collateAttributes;
12
13
  exports.splitBodyAndAttributes = splitBodyAndAttributes;
14
+ const attributes_js_1 = require("../model/attributes.js");
13
15
  /**
14
16
  * Pattern matching a `Key: Value` attribute line.
15
17
  * Key must start with an uppercase letter, may contain lowercase letters and hyphens.
@@ -47,6 +49,52 @@ function parseAttributes(lines) {
47
49
  * Used to detect attribute blocks at the end of entry bodies.
48
50
  */
49
51
  exports.ATTR_LINE_RE = /^[A-Z][A-Za-z-]*: .+\\?$/;
52
+ /**
53
+ * Types whose values may be CSV-split on input per ADR-002 §2.6.
54
+ * `citation` is deliberately excluded because locators may contain commas.
55
+ */
56
+ const CSV_SPLITTABLE_TYPES = new Set([
57
+ "id-list",
58
+ "tag-list",
59
+ "external-id",
60
+ ]);
61
+ /**
62
+ * Collate a flat list of parsed attributes into a typed, keyed map per
63
+ * ADR-002 §2.6.
64
+ *
65
+ * - Repeatable types (`id-list` / `tag-list` / `external-id`): multi-line
66
+ * entries merge; CSV values on a single line split on `,`.
67
+ * - `citation`: multi-line only (locators may contain commas).
68
+ * - Single-valued types: all occurrences are preserved in-order; the
69
+ * validator decides what to do about duplicates.
70
+ * - Unknown keys: preserved as-is, one entry per occurrence.
71
+ */
72
+ function collateAttributes(attributes) {
73
+ const map = new Map();
74
+ for (const attr of attributes) {
75
+ const spec = (0, attributes_js_1.attributeSpec)(attr.key);
76
+ const type = spec?.type;
77
+ let values;
78
+ if (type && CSV_SPLITTABLE_TYPES.has(type) && attr.value.includes(",")) {
79
+ values = attr.value
80
+ .split(",")
81
+ .map((s) => s.trim())
82
+ .filter((s) => s.length > 0);
83
+ }
84
+ else {
85
+ values = [attr.value];
86
+ }
87
+ const existing = map.get(attr.key);
88
+ if (existing) {
89
+ existing.push(...values);
90
+ }
91
+ else {
92
+ map.set(attr.key, values);
93
+ }
94
+ }
95
+ // Freeze value arrays to match the readonly contract.
96
+ return new Map(Array.from(map, ([key, values]) => [key, Object.freeze([...values])]));
97
+ }
50
98
  /**
51
99
  * Split raw entry content into body text and attribute lines.
52
100
  *
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @module parser/frontmatter
3
+ *
4
+ * YAML front-matter parser per ADR-007.
5
+ *
6
+ * Extracts a `---`-delimited YAML block at the top of a Markdown file,
7
+ * classifies keys into core / `metadata` / allowlisted ecosystem, and rejects
8
+ * forbidden keys (MSL-D001). Returns a {@linkcode DocumentAttributes} record
9
+ * and the markdown content with the front matter stripped.
10
+ *
11
+ * Full validation of core-key value types is deferred to the validator
12
+ * (Phase 3); this module handles extraction and key-category classification.
13
+ */
14
+ import type { Diagnostic, DocumentAttributes } from "../model/mod.js";
15
+ /** Options for {@linkcode extractFrontMatter}. */
16
+ export interface ExtractFrontMatterOptions {
17
+ /** File path used in diagnostic source locations. */
18
+ readonly file?: string;
19
+ /**
20
+ * Profile-declared keys. Accepted alongside core keys, passed through on
21
+ * {@linkcode FrontMatterResult.attributes.extra}.
22
+ */
23
+ readonly profileKeys?: readonly string[];
24
+ /**
25
+ * Allowlisted ecosystem keys from `.markspec.yaml`
26
+ * (`frontMatter.allowedKeys`). Accepted and passed through on
27
+ * {@linkcode FrontMatterResult.attributes.extra}.
28
+ */
29
+ readonly allowedKeys?: readonly string[];
30
+ }
31
+ /** Result of front-matter extraction. */
32
+ export interface FrontMatterResult {
33
+ /** Parsed document attributes. Empty when no front matter is present. */
34
+ readonly attributes: DocumentAttributes;
35
+ /** Diagnostics (forbidden keys, unknown keys, YAML errors). */
36
+ readonly diagnostics: readonly Diagnostic[];
37
+ /** Markdown content with front matter stripped. */
38
+ readonly markdown: string;
39
+ /** Whether front matter was present. */
40
+ readonly hadFrontMatter: boolean;
41
+ }
42
+ /**
43
+ * Extract YAML front matter from a Markdown source, validate its keys, and
44
+ * return structured attributes plus the stripped markdown.
45
+ *
46
+ * No front matter → {@linkcode FrontMatterResult.hadFrontMatter} is `false`
47
+ * and attributes are empty.
48
+ *
49
+ * @param markdown - Full source text, including any leading front matter.
50
+ * @param options - Key allowlists and file path for diagnostics.
51
+ */
52
+ export declare function extractFrontMatter(markdown: string, options?: ExtractFrontMatterOptions): FrontMatterResult;
53
+ //# sourceMappingURL=frontmatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/parser/frontmatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAyCtE,kDAAkD;AAClD,MAAM,WAAW,yBAAyB;IACxC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,yBAAyB,GAClC,iBAAiB,CA8InB"}