@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,216 @@
1
+ /**
2
+ * @module core/config/markspec
3
+ *
4
+ * Load and validate `.markspec.yaml` — the consumer-project binding that
5
+ * declares which profiles the project uses.
6
+ *
7
+ * Emits diagnostics (MARKSPEC-YAML-*) on parse or schema errors. See
8
+ * [spec §7.6](../../../../docs/superpowers/specs/2026-04-21-adr-008-profile-system-v1-design.md).
9
+ */
10
+ import { parse as parseYaml } from "@std/yaml";
11
+ import { join } from "@std/path";
12
+ /** The consumer-binding config filename, placed next to `project.yaml`. */
13
+ export const MARKSPEC_YAML_FILENAME = ".markspec.yaml";
14
+ /**
15
+ * Read a `.markspec.yaml` file at the given project root.
16
+ *
17
+ * @param projectRoot - Absolute path to the directory containing `project.yaml`
18
+ * @param readFile - File reader (returns `undefined` when missing)
19
+ * @returns Raw file contents, or `null` when the file is absent
20
+ */
21
+ export async function readMarkspecYaml(projectRoot, readFile) {
22
+ const path = join(projectRoot, MARKSPEC_YAML_FILENAME);
23
+ const content = await readFile(path);
24
+ return content ?? null;
25
+ }
26
+ const ALLOWED_MARKSPEC_YAML_KEYS = new Set(["profiles"]);
27
+ /**
28
+ * Parse and validate a `.markspec.yaml` string.
29
+ *
30
+ * - `MARKSPEC-YAML-002` — YAML parse error.
31
+ * - `MARKSPEC-YAML-003` — schema error (wrong type, bad specifier).
32
+ * - `MARKSPEC-YAML-001` — unknown top-level key (warning; config still produced).
33
+ */
34
+ export function parseMarkspecYaml(rawYaml, sourcePath) {
35
+ const diagnostics = [];
36
+ // Empty file is equivalent to `profiles: []`
37
+ const trimmed = rawYaml.trim();
38
+ if (trimmed.length === 0) {
39
+ return { config: { profiles: [] }, diagnostics };
40
+ }
41
+ let parsed;
42
+ try {
43
+ parsed = parseYaml(rawYaml);
44
+ }
45
+ catch (err) {
46
+ const message = err instanceof Error ? err.message : String(err);
47
+ diagnostics.push({
48
+ code: "MARKSPEC-YAML-002",
49
+ severity: "error",
50
+ message: `.markspec.yaml: YAML parse error: ${message}`,
51
+ location: { file: sourcePath, line: 1, column: 1 },
52
+ });
53
+ return { config: null, diagnostics };
54
+ }
55
+ if (parsed == null || typeof parsed !== "object" || Array.isArray(parsed)) {
56
+ diagnostics.push({
57
+ code: "MARKSPEC-YAML-003",
58
+ severity: "error",
59
+ message: ".markspec.yaml must be a YAML mapping",
60
+ location: { file: sourcePath, line: 1, column: 1 },
61
+ });
62
+ return { config: null, diagnostics };
63
+ }
64
+ const root = parsed;
65
+ // Unknown keys — warn, but continue parsing.
66
+ for (const key of Object.keys(root)) {
67
+ if (!ALLOWED_MARKSPEC_YAML_KEYS.has(key)) {
68
+ diagnostics.push({
69
+ code: "MARKSPEC-YAML-001",
70
+ severity: "warning",
71
+ message: `.markspec.yaml: unknown top-level key '${key}'`,
72
+ location: { file: sourcePath, line: 1, column: 1 },
73
+ });
74
+ }
75
+ }
76
+ const rawProfiles = root.profiles;
77
+ if (rawProfiles !== undefined && !Array.isArray(rawProfiles)) {
78
+ diagnostics.push({
79
+ code: "MARKSPEC-YAML-003",
80
+ severity: "error",
81
+ message: ".markspec.yaml: 'profiles' must be a list",
82
+ location: { file: sourcePath, line: 1, column: 1 },
83
+ });
84
+ return { config: null, diagnostics };
85
+ }
86
+ const profiles = [];
87
+ if (Array.isArray(rawProfiles)) {
88
+ for (let i = 0; i < rawProfiles.length; i++) {
89
+ const spec = parseProfileSpecifier(rawProfiles[i], `.markspec.yaml: profiles[${i}]`, sourcePath, diagnostics);
90
+ if (spec)
91
+ profiles.push(spec);
92
+ }
93
+ }
94
+ // If any specifier failed to parse, treat the whole file as invalid.
95
+ const hasErrors = diagnostics.some((d) => d.severity === "error");
96
+ if (hasErrors) {
97
+ return { config: null, diagnostics };
98
+ }
99
+ return { config: { profiles }, diagnostics };
100
+ }
101
+ /**
102
+ * Parse a single specifier string into a {@linkcode ProfileSpecifier}.
103
+ * Emits `MARKSPEC-YAML-003` on malformed input.
104
+ */
105
+ function parseProfileSpecifier(raw, context, sourcePath, diagnostics) {
106
+ if (typeof raw !== "string" || raw.length === 0) {
107
+ diagnostics.push({
108
+ code: "MARKSPEC-YAML-003",
109
+ severity: "error",
110
+ message: `${context}: specifier must be a non-empty string`,
111
+ location: { file: sourcePath, line: 1, column: 1 },
112
+ });
113
+ return undefined;
114
+ }
115
+ if (raw.startsWith("./") || raw.startsWith("../")) {
116
+ return { kind: "local", path: raw };
117
+ }
118
+ if (raw.startsWith("git+")) {
119
+ const m = /^git\+((?:https?|file):\/\/[^#]+?\.git)(\/[^#]+)?#(.+)$/.exec(raw);
120
+ if (!m) {
121
+ diagnostics.push({
122
+ code: "MARKSPEC-YAML-003",
123
+ severity: "error",
124
+ message: `${context}: git specifier malformed; expected git+<https|file>://host/.git[/subpath]#<tag>`,
125
+ location: { file: sourcePath, line: 1, column: 1 },
126
+ });
127
+ return undefined;
128
+ }
129
+ const [, repo, rawSubpath, tag] = m;
130
+ const subpath = rawSubpath ? rawSubpath.slice(1) : undefined;
131
+ return { kind: "git", repo, subpath, tag };
132
+ }
133
+ if (raw.startsWith("npm:")) {
134
+ // npm:@scope/name@range or npm:name@range
135
+ const body = raw.slice(4); // strip "npm:"
136
+ const scopedMatch = /^(@[a-z0-9-]+\/[a-z0-9-]+)@(.+)$/.exec(body);
137
+ if (scopedMatch) {
138
+ const [, fullName, range] = scopedMatch;
139
+ const slashIdx = fullName.indexOf("/");
140
+ return {
141
+ kind: "npm",
142
+ scope: fullName.slice(0, slashIdx),
143
+ name: fullName.slice(slashIdx + 1),
144
+ range,
145
+ };
146
+ }
147
+ const unscopedMatch = /^([a-z0-9-]+)@(.+)$/.exec(body);
148
+ if (unscopedMatch) {
149
+ const [, name, range] = unscopedMatch;
150
+ return { kind: "npm", name, range };
151
+ }
152
+ diagnostics.push({
153
+ code: "MARKSPEC-YAML-003",
154
+ severity: "error",
155
+ message: `${context}: npm specifier malformed; expected npm:[@scope/]name@<version-range>`,
156
+ location: { file: sourcePath, line: 1, column: 1 },
157
+ });
158
+ return undefined;
159
+ }
160
+ diagnostics.push({
161
+ code: "MARKSPEC-YAML-003",
162
+ severity: "error",
163
+ message: `${context}: unsupported specifier scheme (use './path', 'git+<https|file>://…#<tag>', or 'npm:[@scope/]name@<range>')`,
164
+ location: { file: sourcePath, line: 1, column: 1 },
165
+ });
166
+ return undefined;
167
+ }
168
+ /**
169
+ * Append a profile specifier to `.markspec.yaml`.
170
+ *
171
+ * - File absent: creates with `profiles:\n - <specifier>\n`.
172
+ * - File exists with `profiles:` key: appends after the last list entry.
173
+ * - File exists without `profiles:` key: appends the block at end of file.
174
+ *
175
+ * Uses raw string manipulation to preserve user comments and formatting.
176
+ */
177
+ export async function addProfileSpecifier(specifier, readFileFn, writeFileFn, projectRoot) {
178
+ const filePath = join(projectRoot, MARKSPEC_YAML_FILENAME);
179
+ const existing = await readFileFn(filePath);
180
+ if (existing === undefined) {
181
+ await writeFileFn(filePath, `profiles:\n - "${specifier}"\n`);
182
+ return;
183
+ }
184
+ const profilesIdx = existing.indexOf("profiles:");
185
+ if (profilesIdx === -1) {
186
+ const trailing = existing.endsWith("\n") ? "" : "\n";
187
+ await writeFileFn(filePath, existing + trailing + `\nprofiles:\n - "${specifier}"\n`);
188
+ return;
189
+ }
190
+ const lines = existing.split("\n");
191
+ let lastEntryLine = -1;
192
+ let inProfiles = false;
193
+ for (let i = 0; i < lines.length; i++) {
194
+ if (lines[i].trimStart().startsWith("profiles:")) {
195
+ inProfiles = true;
196
+ continue;
197
+ }
198
+ if (inProfiles) {
199
+ if (/^\s+-\s/.test(lines[i])) {
200
+ lastEntryLine = i;
201
+ }
202
+ else if (lines[i].trim().length > 0 && !lines[i].startsWith(" ") &&
203
+ !lines[i].startsWith("#")) {
204
+ break;
205
+ }
206
+ }
207
+ }
208
+ if (lastEntryLine >= 0) {
209
+ lines.splice(lastEntryLine + 1, 0, ` - "${specifier}"`);
210
+ }
211
+ else {
212
+ const profilesLine = lines.findIndex((l) => l.trimStart().startsWith("profiles:"));
213
+ lines.splice(profilesLine + 1, 0, ` - "${specifier}"`);
214
+ }
215
+ await writeFileFn(filePath, lines.join("\n"));
216
+ }
@@ -34,6 +34,10 @@ export declare function discoverProjectRoot(startDir: string, readFile: ReadFile
34
34
  * @throws {ConfigError} on invalid content
35
35
  */
36
36
  export declare function parseProjectConfig(yaml: string, filePath: string): ProjectConfig;
37
+ /**
38
+ * Derive a 3-6 letter project domain abbreviation from the project name.
39
+ */
40
+ export declare function deriveDomain(projectName: string): string;
37
41
  /**
38
42
  * Discover `project.yaml` by walking up from `startDir`, load, and validate.
39
43
  *
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/config/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAEzB,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,yFAAyF;AACzF,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAMrE;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAU7B;AAsBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,aAAa,CAuJf;AAMD;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAUvC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/config/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AAEzB,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,yFAAyF;AACzF,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAMrE;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAU7B;AAsBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,aAAa,CAwIf;AAMD;;GAEG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAiBxD;AAMD;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAUvC"}
package/esm/config/mod.js CHANGED
@@ -97,21 +97,7 @@ export function parseProjectConfig(yaml, filePath) {
97
97
  line: findLineNumber(yaml, "name"),
98
98
  });
99
99
  }
100
- // domain: optional, must match ^[A-Z]{2,6}$
101
- let domain = DEFAULT_PROJECT_CONFIG.domain;
102
- if (obj.domain !== undefined && obj.domain !== null) {
103
- if (typeof obj.domain !== "string" || !/^[A-Z]{2,6}$/.test(obj.domain)) {
104
- errors.push({
105
- field: "domain",
106
- message: "must be 2-6 uppercase letters (e.g., BRK), got " +
107
- JSON.stringify(obj.domain),
108
- line: findLineNumber(yaml, "domain"),
109
- });
110
- }
111
- else {
112
- domain = obj.domain;
113
- }
114
- }
100
+ // version: optional string
115
101
  // version: optional string
116
102
  let version = DEFAULT_PROJECT_CONFIG.version;
117
103
  if (obj.version !== undefined && obj.version !== null) {
@@ -191,7 +177,6 @@ export function parseProjectConfig(yaml, filePath) {
191
177
  }
192
178
  return {
193
179
  name: obj.name,
194
- domain,
195
180
  version,
196
181
  labels,
197
182
  parents,
@@ -199,6 +184,32 @@ export function parseProjectConfig(yaml, filePath) {
199
184
  };
200
185
  }
201
186
  // ---------------------------------------------------------------------------
187
+ // Domain derivation
188
+ // ---------------------------------------------------------------------------
189
+ /**
190
+ * Derive a 3-6 letter project domain abbreviation from the project name.
191
+ */
192
+ export function deriveDomain(projectName) {
193
+ const lastSegment = projectName.split(".").pop() ?? projectName;
194
+ const words = lastSegment.split(/[-_]+/).filter((w) => w.length > 0);
195
+ if (words.length === 0) {
196
+ return "XXXXX";
197
+ }
198
+ const charsPerWord = Math.ceil(6 / words.length);
199
+ const abbrev = words
200
+ .map((word) => word.slice(0, charsPerWord).toUpperCase())
201
+ .join("");
202
+ if (abbrev.length >= 3 && abbrev.length <= 6) {
203
+ return abbrev;
204
+ }
205
+ else if (abbrev.length > 6) {
206
+ return abbrev.slice(0, 6);
207
+ }
208
+ else {
209
+ return (abbrev + "XXXXXX").slice(0, 6);
210
+ }
211
+ }
212
+ // ---------------------------------------------------------------------------
202
213
  // Combined load
203
214
  // ---------------------------------------------------------------------------
204
215
  /**
@@ -32,13 +32,28 @@ export interface FormatResult {
32
32
  */
33
33
  export declare function format(markdown: string, options?: FormatOptions): FormatResult;
34
34
  /**
35
- * Sort attributes to canonical order.
36
- * Unknown keys are placed before Labels, preserving their relative order.
35
+ * Expand CSV values on repeatable-type attributes into one entry per value
36
+ * per ADR-002 §2.6. `id-list` / `tag-list` / `external-id` accept CSV input
37
+ * but must round-trip as multi-line output; `citation` is left alone
38
+ * because locators may contain commas.
39
+ */
40
+ export declare function expandCsvValues(attrs: Attribute[]): Attribute[];
41
+ /**
42
+ * Sort attributes to canonical order per the language spec.
43
+ *
44
+ * `Id:` first, then profile-declared/unknown keys in source order, then
45
+ * universal attributes (References / Labels / External-id / Supersedes /
46
+ * Superseded-by / Deprecated).
37
47
  */
38
48
  export declare function sortAttributes(attributes: Attribute[]): Attribute[];
39
49
  /**
40
- * Render attributes as indented `Key: Value\` lines.
41
- * Trailing backslash on all lines except the last.
50
+ * Render attributes as an indented code block.
51
+ * Each line is `Key: Value` at (indent + 4) absolute columns;
52
+ * no trailing line-continuation characters.
53
+ *
54
+ * @param attributes - The attributes to render, in canonical order.
55
+ * @param indent - Body indent for the entry (2 for list-wrapped entries,
56
+ * 0 for entries inside source-file doc comments).
42
57
  */
43
58
  export declare function renderAttributeBlock(attributes: Attribute[], indent: number): string;
44
59
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/formatter/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAS,MAAM,iBAAiB,CAAC;AAiBpE,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC;CACtC;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CA6Dd;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAmCnE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,EAAE,EACvB,MAAM,EAAE,MAAM,GACb,MAAM,CAQR;AA2BD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACb;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA2B5C"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/formatter/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EAGX,MAAM,iBAAiB,CAAC;AAyDzB,sCAAsC;AACtC,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC;CACtC;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CACpB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CA8Ed;AA8BD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAmB/D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,SAAS,EAAE,GACtB,SAAS,EAAE,CAmCb;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,EAAE,EACvB,MAAM,EAAE,MAAM,GACb,MAAM,CAKR;AA2BD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACb;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CA2B5C"}
@@ -6,19 +6,58 @@
6
6
  * and requirement block insertion.
7
7
  */
8
8
  import { ulid as defaultUlid } from "@std/ulid";
9
+ import { stringify as stringifyYaml } from "@std/yaml";
10
+ import { attributeSpec, IDENTITY_KEY } from "../model/mod.js";
9
11
  import { ATTR_LINE_RE } from "../parser/attributes.js";
12
+ import { extractFrontMatter } from "../parser/frontmatter.js";
10
13
  import { parseMarkdown } from "../parser/markdown.js";
11
- /** Canonical attribute ordering. Unknown keys go before Labels. */
14
+ /**
15
+ * Value types that accept CSV on input but must be emitted as multi-line
16
+ * per ADR-002 §2.6. `citation` is deliberately excluded because locators
17
+ * may contain commas.
18
+ */
19
+ const CSV_SPLITTABLE_TYPES = new Set([
20
+ "id-list",
21
+ "tag-list",
22
+ "external-id",
23
+ ]);
24
+ /**
25
+ * Canonical front-matter key order per ADR-007. Core keys first, then
26
+ * `metadata` (reserved free-form map), then `extra` (allowlisted ecosystem
27
+ * keys / profile keys) are emitted verbatim at the end.
28
+ */
29
+ const FRONT_MATTER_CORE_ORDER = [
30
+ "document-id",
31
+ "document-type",
32
+ "labels",
33
+ "deprecated",
34
+ "external-id",
35
+ "supersedes",
36
+ "references",
37
+ ];
38
+ /**
39
+ * Canonical attribute ordering per the language spec.
40
+ *
41
+ * Identity (`Id:`) comes first, then profile-declared attributes appear in
42
+ * the order the author wrote them (or in the order a profile-aware pass
43
+ * may rewrite them), then the universal set
44
+ * (References / Labels / External-id / Supersedes / Deprecated). Unknown
45
+ * keys are placed just before `Labels:`, preserving their relative order.
46
+ *
47
+ * A profile-aware formatter may extend this with profile-declared canonical
48
+ * positions; the core formatter only knows about `Id:` and the universal
49
+ * set.
50
+ */
12
51
  const CANONICAL_ORDER = [
13
52
  "Id",
14
- "Satisfies",
15
- "Derived-from",
16
- "Allocates",
17
- "Component",
18
- "Constrains",
19
- "Between",
20
- "Interface",
53
+ // Profile-declared attributes land here in whatever order the source has
54
+ // them; the filler slot keeps them between Id and the universal set.
55
+ "References",
21
56
  "Labels",
57
+ "External-id",
58
+ "Supersedes",
59
+ "Superseded-by",
60
+ "Deprecated",
22
61
  ];
23
62
  /**
24
63
  * Format a Markdown string — normalize attribute blocks,
@@ -30,23 +69,30 @@ const CANONICAL_ORDER = [
30
69
  */
31
70
  export function format(markdown, options) {
32
71
  const file = options?.file ?? "<unknown>";
33
- const entries = parseMarkdown(markdown, { file });
34
- if (entries.length === 0) {
35
- return { output: markdown, diagnostics: [], changed: false };
72
+ // Extract any YAML front matter first so entries are parsed against the
73
+ // body only (front-matter `---` could be confused with horizontal rules).
74
+ const fm = extractFrontMatter(markdown, { file });
75
+ const body = fm.hadFrontMatter ? fm.markdown : markdown;
76
+ const { entries } = parseMarkdown(body, { file });
77
+ const diagnostics = [...fm.diagnostics];
78
+ if (entries.length === 0 && !fm.hadFrontMatter) {
79
+ return { output: markdown, diagnostics, changed: false };
36
80
  }
37
- const lines = markdown.split("\n");
38
- const diagnostics = [];
81
+ const lines = body.split("\n");
39
82
  let changed = false;
40
83
  // Process bottom-to-top so line splicing doesn't shift earlier entries.
41
84
  const sorted = [...entries].sort((a, b) => b.location.line - a.location.line);
42
85
  const genUlid = options?.generateUlid ?? defaultUlid;
43
86
  for (const entry of sorted) {
44
87
  const indent = (entry.location.column - 1) + 2;
45
- let attrs = [...entry.attributes];
46
- // Assign ULID to typed entries missing Id.
47
- if (entry.entryType && !attrs.some((a) => a.key === "Id")) {
48
- const newId = `${entry.entryType}_${genUlid()}`;
49
- attrs = [{ key: "Id", value: newId }, ...attrs];
88
+ let attrs = [...entry.rawAttributes];
89
+ // Assign a bare ULID `Id:` to identified entries that carry no
90
+ // identity yet. Referenced entries are left alone — their `Id:` is a
91
+ // URI that must be author-provided.
92
+ const hasIdentity = attrs.some((a) => a.key === IDENTITY_KEY);
93
+ if (!hasIdentity && entry.shape === "identified") {
94
+ const newId = genUlid();
95
+ attrs = [{ key: IDENTITY_KEY, value: newId }, ...attrs];
50
96
  diagnostics.push({
51
97
  code: "MSL-F001",
52
98
  severity: "info",
@@ -56,7 +102,7 @@ export function format(markdown, options) {
56
102
  }
57
103
  if (attrs.length === 0)
58
104
  continue;
59
- const normalized = sortAttributes(attrs);
105
+ const normalized = sortAttributes(expandCsvValues(attrs));
60
106
  const range = findAttributeBlockRange(lines, entry.location.line, indent);
61
107
  if (range) {
62
108
  // Replace existing attribute block.
@@ -75,11 +121,73 @@ export function format(markdown, options) {
75
121
  changed = true;
76
122
  }
77
123
  }
78
- return { output: lines.join("\n"), diagnostics, changed };
124
+ const formattedBody = lines.join("\n");
125
+ if (fm.hadFrontMatter) {
126
+ const canonicalFm = renderFrontMatter(fm.attributes);
127
+ const output = canonicalFm + formattedBody;
128
+ if (output !== markdown)
129
+ changed = true;
130
+ return { output, diagnostics, changed };
131
+ }
132
+ return { output: formattedBody, diagnostics, changed };
133
+ }
134
+ /**
135
+ * Render {@linkcode DocumentAttributes} as a canonical YAML front matter
136
+ * block. Keys are emitted in canonical order (core → metadata → extra);
137
+ * an `extra` subtree is flattened to top-level keys per ADR-007
138
+ * allowlist conventions.
139
+ */
140
+ function renderFrontMatter(attrs) {
141
+ const ordered = {};
142
+ const a = attrs;
143
+ for (const key of FRONT_MATTER_CORE_ORDER) {
144
+ if (a[key] !== undefined)
145
+ ordered[key] = a[key];
146
+ }
147
+ if (a.metadata !== undefined)
148
+ ordered.metadata = a.metadata;
149
+ if (a.extra && typeof a.extra === "object") {
150
+ for (const [key, value] of Object.entries(a.extra)) {
151
+ ordered[key] = value;
152
+ }
153
+ }
154
+ if (Object.keys(ordered).length === 0) {
155
+ return "---\n---\n\n";
156
+ }
157
+ const yaml = stringifyYaml(ordered).trimEnd();
158
+ return `---\n${yaml}\n---\n\n`;
79
159
  }
80
160
  /**
81
- * Sort attributes to canonical order.
82
- * Unknown keys are placed before Labels, preserving their relative order.
161
+ * Expand CSV values on repeatable-type attributes into one entry per value
162
+ * per ADR-002 §2.6. `id-list` / `tag-list` / `external-id` accept CSV input
163
+ * but must round-trip as multi-line output; `citation` is left alone
164
+ * because locators may contain commas.
165
+ */
166
+ export function expandCsvValues(attrs) {
167
+ const result = [];
168
+ for (const attr of attrs) {
169
+ const spec = attributeSpec(attr.key);
170
+ if (spec && CSV_SPLITTABLE_TYPES.has(spec.type) && attr.value.includes(",")) {
171
+ const values = attr.value
172
+ .split(",")
173
+ .map((s) => s.trim())
174
+ .filter((s) => s.length > 0);
175
+ for (const value of values) {
176
+ result.push({ key: attr.key, value });
177
+ }
178
+ }
179
+ else {
180
+ result.push(attr);
181
+ }
182
+ }
183
+ return result;
184
+ }
185
+ /**
186
+ * Sort attributes to canonical order per the language spec.
187
+ *
188
+ * `Id:` first, then profile-declared/unknown keys in source order, then
189
+ * universal attributes (References / Labels / External-id / Supersedes /
190
+ * Superseded-by / Deprecated).
83
191
  */
84
192
  export function sortAttributes(attributes) {
85
193
  const known = new Array(CANONICAL_ORDER.length);
@@ -115,16 +223,18 @@ export function sortAttributes(attributes) {
115
223
  return result;
116
224
  }
117
225
  /**
118
- * Render attributes as indented `Key: Value\` lines.
119
- * Trailing backslash on all lines except the last.
226
+ * Render attributes as an indented code block.
227
+ * Each line is `Key: Value` at (indent + 4) absolute columns;
228
+ * no trailing line-continuation characters.
229
+ *
230
+ * @param attributes - The attributes to render, in canonical order.
231
+ * @param indent - Body indent for the entry (2 for list-wrapped entries,
232
+ * 0 for entries inside source-file doc comments).
120
233
  */
121
234
  export function renderAttributeBlock(attributes, indent) {
122
- const prefix = " ".repeat(indent);
235
+ const prefix = " ".repeat(indent + 4);
123
236
  return attributes
124
- .map((attr, i) => {
125
- const sep = i < attributes.length - 1 ? "\\" : "";
126
- return `${prefix}${attr.key}: ${attr.value}${sep}`;
127
- })
237
+ .map((attr) => `${prefix}${attr.key}: ${attr.value}`)
128
238
  .join("\n");
129
239
  }
130
240
  /**
package/esm/mod.d.ts CHANGED
@@ -9,18 +9,22 @@
9
9
  */
10
10
  import "./_dnt.polyfills.js";
11
11
  export declare const VERSION = "0.0.1";
12
- export { ConfigError, DEFAULT_PROJECT_CONFIG, REFHUB_URL, } from "./model/mod.js";
13
- export type { Attribute, BuiltinType, Caption, ConfigFieldError, Diagnostic, Directive, DisplayId, Entry, EntrySource, EntryType, InlineRef, Link, LinkKind, ProjectConfig, Severity, SourceLocation, Ulid, } from "./model/mod.js";
12
+ export { ConfigError, DEFAULT_PROJECT_CONFIG, PALETTE_HUES, REFHUB_URL, } from "./model/mod.js";
13
+ export type { Attribute, Caption, ConfigFieldError, Diagnostic, Directive, DisplayId, EffectiveProfile, EffectiveTypeDef, Entry, EntryShape, EntrySource, InlineRef, Link, LinkKind, PaletteHue, ProfileChain, ProjectConfig, Severity, SourceLocation, Ulid, } from "./model/mod.js";
14
14
  export { discoverProjectRoot, loadConfig, parseProjectConfig, } from "./config/mod.js";
15
15
  export type { LoadConfigResult, ReadFile } from "./config/mod.js";
16
+ export { MARKSPEC_YAML_FILENAME, parseMarkspecYaml, readMarkspecYaml, } from "./config/markspec.js";
17
+ export type { MarkspecYaml, ParseMarkspecYamlResult, } from "./config/markspec.js";
18
+ export { computeCacheKey, computeCacheLocation, defaultAppendFile, defaultRunGit, ensureCacheGitignored, loadChain, loadProfileForCommand, mergeChain, parseManifest, resolveEntryColor, resolveGitSpecifier, resolveLocalSpecifier, } from "./profile/mod.js";
19
+ export type { AppendFile, CacheLocation, GitCacheKeyInput, LoadChainOptions, LoadChainResult, LoadProfileForCommandResult, MergeResult, ParseManifestResult, ResolvedProfileSource, ResolveGitOptions, RunGit, RunGitResult, } from "./profile/mod.js";
16
20
  export { detectCaptions, detectDirectives, detectInlineRefs, isSupportedExtension, loadGrammar, parse, parseFile, parseSource, } from "./parser/mod.js";
17
- export type { DetectCaptionsOptions, DetectDirectivesOptions, DetectInlineRefsOptions, ParseOptions, ParseSourceOptions, } from "./parser/mod.js";
21
+ export type { DetectCaptionsOptions, DetectDirectivesOptions, DetectInlineRefsOptions, ParseFileResult, ParseOptions, ParseSourceOptions, ParseSourceResult, } from "./parser/mod.js";
18
22
  export { format } from "./formatter/mod.js";
19
23
  export type { FormatOptions, FormatResult } from "./formatter/mod.js";
20
- export { validate } from "./validator/mod.js";
21
- export type { ValidateResult } from "./validator/mod.js";
22
- export { compile, serializeCompileResult } from "./compiler/mod.js";
23
- export type { CompileOptions, CompileResult, SerializedCompileResult, } from "./compiler/mod.js";
24
+ export { classifyEntriesStage, classifyEntry, compileDisplayIdPattern, effectiveScope, effectiveTraceRules, matchesAnyTarget, normalizeListValues, runPipeline, validate, validateAttributesForEntry, validateTraceabilityForEntry, validateValue, } from "./validator/mod.js";
25
+ export type { ClassifyResult, ClassifyStageResult, EffectiveAttrScope, PipelineResult, ValidateResult, ValueValidator, } from "./validator/mod.js";
26
+ export { compile, generateInverses, serializeCompileResult, } from "./compiler/mod.js";
27
+ export type { CompileOptions, CompileResult, GenerateInversesResult, SerializedCompileResult, } from "./compiler/mod.js";
24
28
  export { report } from "./reporter/mod.js";
25
29
  export type { ReportFormat, ReportKind, ReportOptions, } from "./reporter/mod.js";
26
30
  //# sourceMappingURL=mod.d.ts.map
package/esm/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,qBAAqB,CAAC;AAG7B,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,SAAS,EACT,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,SAAS,EACT,KAAK,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,cAAc,EACd,IAAI,GACL,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,KAAK,EACL,SAAS,EACT,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACpE,YAAY,EACV,cAAc,EACd,aAAa,EACb,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,YAAY,EACV,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,qBAAqB,CAAC;AAG7B,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,YAAY,EACZ,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,EACL,UAAU,EACV,WAAW,EACX,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,IAAI,GACL,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,YAAY,EACZ,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,EACN,YAAY,GACb,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,KAAK,EACL,SAAS,EACT,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,0BAA0B,EAC1B,4BAA4B,EAC5B,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,YAAY,EACV,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC"}
package/esm/mod.js CHANGED
@@ -10,16 +10,19 @@
10
10
  import "./_dnt.polyfills.js";
11
11
  export const VERSION = "0.0.1";
12
12
  // Model types
13
- export { ConfigError, DEFAULT_PROJECT_CONFIG, REFHUB_URL, } from "./model/mod.js";
13
+ export { ConfigError, DEFAULT_PROJECT_CONFIG, PALETTE_HUES, REFHUB_URL, } from "./model/mod.js";
14
14
  // Config
15
15
  export { discoverProjectRoot, loadConfig, parseProjectConfig, } from "./config/mod.js";
16
+ export { MARKSPEC_YAML_FILENAME, parseMarkspecYaml, readMarkspecYaml, } from "./config/markspec.js";
17
+ // Profile system (ADR-008)
18
+ export { computeCacheKey, computeCacheLocation, defaultAppendFile, defaultRunGit, ensureCacheGitignored, loadChain, loadProfileForCommand, mergeChain, parseManifest, resolveEntryColor, resolveGitSpecifier, resolveLocalSpecifier, } from "./profile/mod.js";
16
19
  // Parser
17
20
  export { detectCaptions, detectDirectives, detectInlineRefs, isSupportedExtension, loadGrammar, parse, parseFile, parseSource, } from "./parser/mod.js";
18
21
  // Formatter
19
22
  export { format } from "./formatter/mod.js";
20
23
  // Validator
21
- export { validate } from "./validator/mod.js";
24
+ export { classifyEntriesStage, classifyEntry, compileDisplayIdPattern, effectiveScope, effectiveTraceRules, matchesAnyTarget, normalizeListValues, runPipeline, validate, validateAttributesForEntry, validateTraceabilityForEntry, validateValue, } from "./validator/mod.js";
22
25
  // Compiler
23
- export { compile, serializeCompileResult } from "./compiler/mod.js";
26
+ export { compile, generateInverses, serializeCompileResult, } from "./compiler/mod.js";
24
27
  // Reporter
25
28
  export { report } from "./reporter/mod.js";