@driftsys/markspec 0.7.2 → 0.7.4

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 (95) hide show
  1. package/esm/config/markspec.d.ts +17 -0
  2. package/esm/config/markspec.d.ts.map +1 -1
  3. package/esm/config/markspec.js +30 -1
  4. package/esm/lock/mod.d.ts +2 -2
  5. package/esm/lock/mod.d.ts.map +1 -1
  6. package/esm/lock/mod.js +1 -1
  7. package/esm/lock/model.d.ts +25 -0
  8. package/esm/lock/model.d.ts.map +1 -1
  9. package/esm/lock/parser.d.ts.map +1 -1
  10. package/esm/lock/parser.js +20 -0
  11. package/esm/lock/resolve.d.ts +19 -1
  12. package/esm/lock/resolve.d.ts.map +1 -1
  13. package/esm/lock/resolve.js +47 -1
  14. package/esm/lock/serializer.d.ts.map +1 -1
  15. package/esm/lock/serializer.js +31 -0
  16. package/esm/mod.d.ts +9 -7
  17. package/esm/mod.d.ts.map +1 -1
  18. package/esm/mod.js +6 -4
  19. package/esm/model/mod.d.ts +16 -0
  20. package/esm/model/mod.d.ts.map +1 -1
  21. package/esm/model/mod.js +16 -0
  22. package/esm/profile/display_id.d.ts +78 -25
  23. package/esm/profile/display_id.d.ts.map +1 -1
  24. package/esm/profile/display_id.js +164 -26
  25. package/esm/profile/manifest.d.ts.map +1 -1
  26. package/esm/profile/manifest.js +19 -0
  27. package/esm/profile/mod.d.ts +2 -2
  28. package/esm/profile/mod.d.ts.map +1 -1
  29. package/esm/profile/mod.js +1 -1
  30. package/esm/refs/mod.d.ts +43 -0
  31. package/esm/refs/mod.d.ts.map +1 -0
  32. package/esm/refs/mod.js +128 -0
  33. package/esm/validator/mod.d.ts +1 -1
  34. package/esm/validator/mod.d.ts.map +1 -1
  35. package/esm/validator/pattern.d.ts +47 -13
  36. package/esm/validator/pattern.d.ts.map +1 -1
  37. package/esm/validator/pattern.js +91 -41
  38. package/esm/validator/pipeline.d.ts +15 -1
  39. package/esm/validator/pipeline.d.ts.map +1 -1
  40. package/esm/validator/pipeline.js +16 -7
  41. package/esm/validator/traceability.d.ts +6 -3
  42. package/esm/validator/traceability.d.ts.map +1 -1
  43. package/esm/validator/traceability.js +23 -5
  44. package/esm/validator/types.d.ts.map +1 -1
  45. package/esm/validator/types.js +10 -4
  46. package/esm/validator/value_types.d.ts.map +1 -1
  47. package/esm/validator/value_types.js +4 -2
  48. package/package.json +1 -1
  49. package/script/config/markspec.d.ts +17 -0
  50. package/script/config/markspec.d.ts.map +1 -1
  51. package/script/config/markspec.js +30 -0
  52. package/script/lock/mod.d.ts +2 -2
  53. package/script/lock/mod.d.ts.map +1 -1
  54. package/script/lock/mod.js +2 -1
  55. package/script/lock/model.d.ts +25 -0
  56. package/script/lock/model.d.ts.map +1 -1
  57. package/script/lock/parser.d.ts.map +1 -1
  58. package/script/lock/parser.js +20 -0
  59. package/script/lock/resolve.d.ts +19 -1
  60. package/script/lock/resolve.d.ts.map +1 -1
  61. package/script/lock/resolve.js +47 -0
  62. package/script/lock/serializer.d.ts.map +1 -1
  63. package/script/lock/serializer.js +31 -0
  64. package/script/mod.d.ts +9 -7
  65. package/script/mod.d.ts.map +1 -1
  66. package/script/mod.js +30 -22
  67. package/script/model/mod.d.ts +16 -0
  68. package/script/model/mod.d.ts.map +1 -1
  69. package/script/model/mod.js +17 -1
  70. package/script/profile/display_id.d.ts +78 -25
  71. package/script/profile/display_id.d.ts.map +1 -1
  72. package/script/profile/display_id.js +166 -26
  73. package/script/profile/manifest.d.ts.map +1 -1
  74. package/script/profile/manifest.js +19 -0
  75. package/script/profile/mod.d.ts +2 -2
  76. package/script/profile/mod.d.ts.map +1 -1
  77. package/script/profile/mod.js +2 -1
  78. package/script/refs/mod.d.ts +43 -0
  79. package/script/refs/mod.d.ts.map +1 -0
  80. package/script/refs/mod.js +133 -0
  81. package/script/validator/mod.d.ts +1 -1
  82. package/script/validator/mod.d.ts.map +1 -1
  83. package/script/validator/pattern.d.ts +47 -13
  84. package/script/validator/pattern.d.ts.map +1 -1
  85. package/script/validator/pattern.js +92 -41
  86. package/script/validator/pipeline.d.ts +15 -1
  87. package/script/validator/pipeline.d.ts.map +1 -1
  88. package/script/validator/pipeline.js +16 -7
  89. package/script/validator/traceability.d.ts +6 -3
  90. package/script/validator/traceability.d.ts.map +1 -1
  91. package/script/validator/traceability.js +23 -5
  92. package/script/validator/types.d.ts.map +1 -1
  93. package/script/validator/types.js +9 -3
  94. package/script/validator/value_types.d.ts.map +1 -1
  95. package/script/validator/value_types.js +3 -1
@@ -1,38 +1,91 @@
1
1
  /**
2
2
  * @module core/profile/display_id
3
3
  *
4
- * Shared parser for the `display-id-pattern` template used by profile
5
- * type declarations. Patterns look like:
6
- *
7
- * STK_{n:4d}
8
- * STK_AEB_{n:04d}
9
- * REQ-{n:03d}-draft
10
- *
11
- * The `{n:Nd}` placeholder (with optional leading zero in the Nd
12
- * form) names the sequential number slot. The text before the
13
- * placeholder becomes the literal prefix; the text after becomes the
14
- * literal suffix.
15
- *
16
- * Note: the `{scope}` placeholder documented in the profile schema
17
- * is NOT substituted here — callers handle that separately. For
18
- * patterns containing `{scope}`, the literal text `{scope}` ends up
19
- * in `prefix` (or `suffix`) and must be replaced upstream before the
20
- * pattern is fed to scaffolding.
4
+ * Single source of truth for the `display-id-pattern` template grammar.
5
+ *
6
+ * One tokenizer ({@linkcode tokenizePattern}) and one well-formedness
7
+ * oracle ({@linkcode validateDisplayIdPattern}) back both consumers of the
8
+ * grammar: classification (`compileDisplayIdPattern` in `core/validator`,
9
+ * which builds the recognizer regex) and minting/scaffolding
10
+ * ({@linkcode parseDisplayIdPattern}, which decomposes the numeric slot).
11
+ * Keeping a single grammar here prevents the two from drifting — see #596.
12
+ *
13
+ * A pattern is one of two kinds, selected by whether it contains a counter:
14
+ *
15
+ * numbered := segment+ (exactly one `{n}` counter) — mintable + classifying
16
+ * named := segment+ (literal anchor, ≥1 named, no counter) — classifying
17
+ *
18
+ * counter := "{n}" | "{n:" digits "d}" (e.g. {n}, {n:4d}, {n:04d})
19
+ * named := "{" identifier "}" (e.g. {scope}, {name})
20
+ *
21
+ * The padding digit count is a minimum width; `{n:4d}` and `{n:04d}` are
22
+ * equivalent. A bare `{n}` mints with no zero-padding (width 1).
23
+ *
24
+ * Patterns:
25
+ *
26
+ * STK_{n:4d} → numbered, width 4
27
+ * STK_AEB_{n:04d} → numbered, width 4
28
+ * REQ-{n:03d}-draft → numbered, width 3, suffix "-draft"
29
+ * REQ-{n} → numbered, width 1
30
+ * SWC_{name} → named (classifying only — not mintable)
31
+ *
32
+ * Note: the `{scope}` placeholder documented in the profile schema is NOT
33
+ * substituted here. For a numbered pattern like `XREQ_{scope}_{n:04d}`,
34
+ * the literal `{scope}` text ends up in `prefix` and must be replaced
35
+ * upstream before the pattern is fed to scaffolding.
21
36
  */
22
- /** Width-and-position decomposition of a display-id-pattern. */
37
+ /** Width-and-position decomposition of a *numbered* display-id-pattern. */
23
38
  export interface DisplayIdPatternShape {
24
- /** Literal text before the `{n:Nd}` placeholder. */
39
+ /** Literal text before the counter placeholder. */
25
40
  readonly prefix: string;
26
- /** Width of the zero-padded numeric segment. */
41
+ /** Minimum width of the numeric segment (1 for a bare `{n}`). */
27
42
  readonly width: number;
28
- /** Literal text after the `{n:Nd}` placeholder (often empty). */
43
+ /** Literal text after the counter placeholder (often empty). */
29
44
  readonly suffix: string;
30
45
  }
46
+ /** A tokenized fragment of a display-id-pattern template. */
47
+ export type PatternToken = {
48
+ readonly kind: "literal";
49
+ readonly text: string;
50
+ } | {
51
+ readonly kind: "counter";
52
+ readonly padding?: string;
53
+ } | {
54
+ readonly kind: "named";
55
+ readonly name: string;
56
+ };
57
+ /** Split a template into its literal / counter / named tokens. */
58
+ export declare function tokenizePattern(template: string): PatternToken[];
59
+ /** Outcome of {@linkcode validateDisplayIdPattern}. */
60
+ export type DisplayIdPatternValidation = {
61
+ readonly ok: true;
62
+ } | {
63
+ readonly ok: false;
64
+ readonly message: string;
65
+ };
66
+ /**
67
+ * Decide whether a `display-id-pattern` template is well-formed, returning
68
+ * a MarkSpec-authored reason when it is not. This is the single oracle
69
+ * shared by classification (which throws this message) and profile-load
70
+ * validation (which emits it as a diagnostic), so a malformed pattern is
71
+ * reported identically everywhere and never reaches `new RegExp`.
72
+ *
73
+ * Rejects: more than one counter; a malformed/zero-width padding
74
+ * specifier; an all-literal template (no variable part); a counter-less
75
+ * pattern with no literal anchor (a bare `{name}` matches every ID); and
76
+ * a duplicate named placeholder (which would build an invalid RegExp).
77
+ */
78
+ export declare function validateDisplayIdPattern(template: string): DisplayIdPatternValidation;
31
79
  /**
32
- * Parse a `display-id-pattern` template. Returns `undefined` when
33
- * the pattern does not contain a recognised `{n:Nd}` placeholder so
34
- * callers can decide how to surface the error (CLI exits, LSP
35
- * silently skips the type).
80
+ * Decompose a *numbered* `display-id-pattern` into its mint shape.
81
+ *
82
+ * Returns `undefined` for any template that is not mintable — a named
83
+ * (counter-less) pattern, an all-literal template, or a malformed one —
84
+ * so callers can decide how to surface it (the CLI distinguishes a valid
85
+ * named type from a malformed pattern via {@linkcode validateDisplayIdPattern};
86
+ * the LSP skips non-mintable types). Shares the {@linkcode tokenizePattern}
87
+ * grammar with `compileDisplayIdPattern`, so the two never disagree about
88
+ * which counter forms are valid (#596).
36
89
  */
37
90
  export declare function parseDisplayIdPattern(pattern: string): DisplayIdPatternShape | undefined;
38
91
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"display_id.d.ts","sourceRoot":"","sources":["../../src/profile/display_id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAKD;;;;;GAKG;AACH,wBAAgB,q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ACvD,MAAM,MAAM,0BAA0B,GAClC;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GACrB;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,GACf,0BAA0B,CAsE5B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,GACd,qBAAqB,GAAG,SAAS,CAcnC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,qBAAqB,EAC5B,CAAC,EAAE,MAAM,GACR,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,qBAAqB,EAC5B,OAAO,EAAE,QAAQ,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GACvC,MAAM,CAcR"}
@@ -1,43 +1,181 @@
1
1
  /**
2
2
  * @module core/profile/display_id
3
3
  *
4
- * Shared parser for the `display-id-pattern` template used by profile
5
- * type declarations. Patterns look like:
4
+ * Single source of truth for the `display-id-pattern` template grammar.
6
5
  *
7
- * STK_{n:4d}
8
- * STK_AEB_{n:04d}
9
- * REQ-{n:03d}-draft
6
+ * One tokenizer ({@linkcode tokenizePattern}) and one well-formedness
7
+ * oracle ({@linkcode validateDisplayIdPattern}) back both consumers of the
8
+ * grammar: classification (`compileDisplayIdPattern` in `core/validator`,
9
+ * which builds the recognizer regex) and minting/scaffolding
10
+ * ({@linkcode parseDisplayIdPattern}, which decomposes the numeric slot).
11
+ * Keeping a single grammar here prevents the two from drifting — see #596.
10
12
  *
11
- * The `{n:Nd}` placeholder (with optional leading zero in the Nd
12
- * form) names the sequential number slot. The text before the
13
- * placeholder becomes the literal prefix; the text after becomes the
14
- * literal suffix.
13
+ * A pattern is one of two kinds, selected by whether it contains a counter:
15
14
  *
16
- * Note: the `{scope}` placeholder documented in the profile schema
17
- * is NOT substituted here — callers handle that separately. For
18
- * patterns containing `{scope}`, the literal text `{scope}` ends up
19
- * in `prefix` (or `suffix`) and must be replaced upstream before the
20
- * pattern is fed to scaffolding.
15
+ * numbered := segment+ (exactly one `{n}` counter) — mintable + classifying
16
+ * named := segment+ (literal anchor, ≥1 named, no counter) — classifying
17
+ *
18
+ * counter := "{n}" | "{n:" digits "d}" (e.g. {n}, {n:4d}, {n:04d})
19
+ * named := "{" identifier "}" (e.g. {scope}, {name})
20
+ *
21
+ * The padding digit count is a minimum width; `{n:4d}` and `{n:04d}` are
22
+ * equivalent. A bare `{n}` mints with no zero-padding (width 1).
23
+ *
24
+ * Patterns:
25
+ *
26
+ * STK_{n:4d} → numbered, width 4
27
+ * STK_AEB_{n:04d} → numbered, width 4
28
+ * REQ-{n:03d}-draft → numbered, width 3, suffix "-draft"
29
+ * REQ-{n} → numbered, width 1
30
+ * SWC_{name} → named (classifying only — not mintable)
31
+ *
32
+ * Note: the `{scope}` placeholder documented in the profile schema is NOT
33
+ * substituted here. For a numbered pattern like `XREQ_{scope}_{n:04d}`,
34
+ * the literal `{scope}` text ends up in `prefix` and must be replaced
35
+ * upstream before the pattern is fed to scaffolding.
36
+ */
37
+ /**
38
+ * One template token: the `{n}` counter (optionally padded) OR a `{named}`
39
+ * segment. The padding capture accepts any positive digit count — `{n:4d}`
40
+ * and `{n:04d}` both tokenize to a counter (`Number()` collapses the
41
+ * leading zero downstream).
42
+ */
43
+ const TOKEN_RE = /\{n(?::(\d+)d)?\}|\{([A-Za-z][A-Za-z0-9_]*)\}/g;
44
+ /** Split a template into its literal / counter / named tokens. */
45
+ export function tokenizePattern(template) {
46
+ const tokens = [];
47
+ let lastIndex = 0;
48
+ const re = new RegExp(TOKEN_RE);
49
+ let match;
50
+ while ((match = re.exec(template)) !== null) {
51
+ if (match.index > lastIndex) {
52
+ tokens.push({
53
+ kind: "literal",
54
+ text: template.slice(lastIndex, match.index),
55
+ });
56
+ }
57
+ const named = match[2];
58
+ if (named === undefined) {
59
+ tokens.push({ kind: "counter", padding: match[1] });
60
+ }
61
+ else {
62
+ tokens.push({ kind: "named", name: named });
63
+ }
64
+ lastIndex = match.index + match[0].length;
65
+ }
66
+ if (lastIndex < template.length) {
67
+ tokens.push({ kind: "literal", text: template.slice(lastIndex) });
68
+ }
69
+ return tokens;
70
+ }
71
+ /** Re-emit the literal source a non-counter token contributes to a
72
+ * numbered pattern's prefix/suffix. A named placeholder is rendered in
73
+ * its `{name}` form (callers substitute it upstream). */
74
+ function reconstructLiteral(token) {
75
+ switch (token.kind) {
76
+ case "literal":
77
+ return token.text;
78
+ case "named":
79
+ return `{${token.name}}`;
80
+ case "counter":
81
+ return token.padding ? `{n:${token.padding}d}` : "{n}";
82
+ }
83
+ }
84
+ /**
85
+ * Decide whether a `display-id-pattern` template is well-formed, returning
86
+ * a MarkSpec-authored reason when it is not. This is the single oracle
87
+ * shared by classification (which throws this message) and profile-load
88
+ * validation (which emits it as a diagnostic), so a malformed pattern is
89
+ * reported identically everywhere and never reaches `new RegExp`.
90
+ *
91
+ * Rejects: more than one counter; a malformed/zero-width padding
92
+ * specifier; an all-literal template (no variable part); a counter-less
93
+ * pattern with no literal anchor (a bare `{name}` matches every ID); and
94
+ * a duplicate named placeholder (which would build an invalid RegExp).
21
95
  */
22
- /** Regex capturing the `{n:Nd}` placeholder; `0` and the digit count are both captured. */
23
- const PLACEHOLDER_RE = /\{n:(\d+)d\}/;
96
+ export function validateDisplayIdPattern(template) {
97
+ const tokens = tokenizePattern(template);
98
+ const counters = tokens.filter((t) => t.kind === "counter");
99
+ const named = tokens.filter((t) => t.kind === "named");
100
+ const hasLiteralAnchor = tokens.some((t) => t.kind === "literal" && t.text.length > 0);
101
+ if (counters.length > 1) {
102
+ return {
103
+ ok: false,
104
+ message: `display-id-pattern '${template}': multiple {n} counters (expected one)`,
105
+ };
106
+ }
107
+ if (counters.length === 1) {
108
+ const padding = counters[0].padding;
109
+ if (padding !== undefined && parseInt(padding, 10) < 1) {
110
+ return {
111
+ ok: false,
112
+ message: `display-id-pattern '${template}': invalid padding specifier ` +
113
+ `(expected {n} or {n:NNd})`,
114
+ };
115
+ }
116
+ }
117
+ if (counters.length === 0) {
118
+ // A malformed counter (`{n:abc}`, `{n:4}`) is not tokenized as a
119
+ // counter — it lands in literal text. Surface it as an invalid padding
120
+ // error before the missing-counter / named-pattern checks.
121
+ if (/\{n:[^}]*\}/.test(template)) {
122
+ return {
123
+ ok: false,
124
+ message: `display-id-pattern '${template}': invalid padding specifier ` +
125
+ `(expected {n} or {n:NNd})`,
126
+ };
127
+ }
128
+ if (named.length === 0) {
129
+ return {
130
+ ok: false,
131
+ message: `display-id-pattern '${template}': missing {n} placeholder`,
132
+ };
133
+ }
134
+ if (!hasLiteralAnchor) {
135
+ return {
136
+ ok: false,
137
+ message: `display-id-pattern '${template}': named pattern needs a literal ` +
138
+ `prefix (a bare {name} would match every display ID)`,
139
+ };
140
+ }
141
+ }
142
+ const seen = new Set();
143
+ for (const t of named) {
144
+ const name = t.name;
145
+ if (seen.has(name)) {
146
+ return {
147
+ ok: false,
148
+ message: `display-id-pattern '${template}': duplicate named placeholder '{${name}}'`,
149
+ };
150
+ }
151
+ seen.add(name);
152
+ }
153
+ return { ok: true };
154
+ }
24
155
  /**
25
- * Parse a `display-id-pattern` template. Returns `undefined` when
26
- * the pattern does not contain a recognised `{n:Nd}` placeholder so
27
- * callers can decide how to surface the error (CLI exits, LSP
28
- * silently skips the type).
156
+ * Decompose a *numbered* `display-id-pattern` into its mint shape.
157
+ *
158
+ * Returns `undefined` for any template that is not mintable — a named
159
+ * (counter-less) pattern, an all-literal template, or a malformed one —
160
+ * so callers can decide how to surface it (the CLI distinguishes a valid
161
+ * named type from a malformed pattern via {@linkcode validateDisplayIdPattern};
162
+ * the LSP skips non-mintable types). Shares the {@linkcode tokenizePattern}
163
+ * grammar with `compileDisplayIdPattern`, so the two never disagree about
164
+ * which counter forms are valid (#596).
29
165
  */
30
166
  export function parseDisplayIdPattern(pattern) {
31
- const match = PLACEHOLDER_RE.exec(pattern);
32
- if (!match)
33
- return undefined;
34
- const width = parseInt(match[1], 10);
167
+ const tokens = tokenizePattern(pattern);
168
+ const counters = tokens.filter((t) => t.kind === "counter");
169
+ if (counters.length !== 1)
170
+ return undefined; // named/none, or multi-counter
171
+ const counterIndex = tokens.indexOf(counters[0]);
172
+ const width = counters[0].padding ? parseInt(counters[0].padding, 10) : 1;
35
173
  if (!Number.isFinite(width) || width < 1)
36
174
  return undefined;
37
175
  return {
38
- prefix: pattern.slice(0, match.index),
176
+ prefix: tokens.slice(0, counterIndex).map(reconstructLiteral).join(""),
39
177
  width,
40
- suffix: pattern.slice(match.index + match[0].length),
178
+ suffix: tokens.slice(counterIndex + 1).map(reconstructLiteral).join(""),
41
179
  };
42
180
  }
43
181
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA4BnE,eAAO,MAAM,iBAAiB,aAS5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAU/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAU5B,CAAC;AAEH,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAChF,eAAO,MAAM,sBAAsB,aAAoC,CAAC;AAExE,eAAO,MAAM,iBAAiB,aAQ5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAAgC,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAKlC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAysCD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CA+LrB"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA6BnE,eAAO,MAAM,iBAAiB,aAS5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAU/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAU5B,CAAC;AAEH,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAChF,eAAO,MAAM,sBAAsB,aAAoC,CAAC;AAExE,eAAO,MAAM,iBAAiB,aAQ5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAAgC,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAKlC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AA2tCD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CA+LrB"}
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { parse as parseYaml } from "@std/yaml";
9
9
  import { COLOR_NAME_RE, CORE_KINDS, CORE_TYPES, LIST_VALUE_TYPES, MIXED_DISCIPLINE, PALETTE_HUES, VALUE_TYPES, } from "../model/mod.js";
10
+ import { validateDisplayIdPattern } from "./display_id.js";
10
11
  const VALUE_TYPE_SET = new Set(VALUE_TYPES);
11
12
  export const ALLOWED_ROOT_KEYS = new Set([
12
13
  "$schema",
@@ -914,6 +915,24 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
914
915
  return undefined;
915
916
  }
916
917
  displayIdPattern = r["display-id-pattern"];
918
+ // Compile-check the pattern here, at profile-load, against the same grammar
919
+ // oracle classification uses. A malformed pattern (duplicate named
920
+ // placeholder, bad padding, no anchor, …) is reported as a clean
921
+ // PROFILE-TYPE-008 diagnostic instead of throwing an uncaught exception
922
+ // later inside classifyEntry / checkEnforcement. Like the sibling field
923
+ // checks above, an error here drops the type so the bad pattern never
924
+ // reaches compileDisplayIdPattern (and, per parseManifest's all-or-nothing
925
+ // error contract, the manifest is rejected). (#597)
926
+ const patternValidation = validateDisplayIdPattern(displayIdPattern);
927
+ if (!patternValidation.ok) {
928
+ diagnostics.push({
929
+ code: "PROFILE-TYPE-008",
930
+ severity: "error",
931
+ message: `${ctx}: ${patternValidation.message}`,
932
+ location: { file: sourcePath, line: 1, column: 1 },
933
+ });
934
+ return undefined;
935
+ }
917
936
  }
918
937
  let enforcement = "off";
919
938
  const rawEnf = r["display-id-pattern-enforcement"];
@@ -19,8 +19,8 @@ export type { MergeResult } from "./merge.js";
19
19
  export { resolveEntryColor } from "./colors.js";
20
20
  export { buildEffectiveDisciplineRegistry } from "./discipline_registry.js";
21
21
  export { inferDisciplineMode, resolveDisciplineMode, } from "./discipline_mode.js";
22
- export { formatDisplayId, highestDisplayIdNumber, padDisplayIdNumber, parseDisplayIdPattern, } from "./display_id.js";
23
- export type { DisplayIdPatternShape } from "./display_id.js";
22
+ export { formatDisplayId, highestDisplayIdNumber, padDisplayIdNumber, parseDisplayIdPattern, validateDisplayIdPattern, } from "./display_id.js";
23
+ export type { DisplayIdPatternShape, DisplayIdPatternValidation, } from "./display_id.js";
24
24
  export { entryMatchesTargets, filterEntriesByTraceTargets, targetsForRelation, } from "./trace_targets.js";
25
25
  export { buildProfileIntrospection } from "./introspect.js";
26
26
  export type { AttributeDetail, ConventionDetail, LabelConcernDetail, ProfileElementDetail, ProfileElementKind, ProfileElementRef, ProfileIntrospection, ProfileOverview, ProvenancedDescription, RelationDetail, TypeDetail, } from "./introspect.js";
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/profile/mod.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,qBAAqB,EAAE,M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AAO,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC"}
@@ -17,6 +17,6 @@ export { mergeChain } from "./merge.js";
17
17
  export { resolveEntryColor } from "./colors.js";
18
18
  export { buildEffectiveDisciplineRegistry } from "./discipline_registry.js";
19
19
  export { inferDisciplineMode, resolveDisciplineMode, } from "./discipline_mode.js";
20
- export { formatDisplayId, highestDisplayIdNumber, padDisplayIdNumber, parseDisplayIdPattern, } from "./display_id.js";
20
+ export { formatDisplayId, highestDisplayIdNumber, padDisplayIdNumber, parseDisplayIdPattern, validateDisplayIdPattern, } from "./display_id.js";
21
21
  export { entryMatchesTargets, filterEntriesByTraceTargets, targetsForRelation, } from "./trace_targets.js";
22
22
  export { buildProfileIntrospection } from "./introspect.js";
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @module core/refs
3
+ *
4
+ * Project-aware trace-reference canonicalisation + rename-healing (issue #593,
5
+ * Slice 4). Pure module: given a project-wide display-ID ↔ ULID index and the
6
+ * lockfile's edge ledger, rewrite a file's trace-attribute values losslessly —
7
+ * ULID → current display ID (canonicalise), and a stale display ID → the
8
+ * ledger's stable target ULID → the target's current display ID (heal).
9
+ *
10
+ * Architecture: composed AROUND the pure `core/formatter` by the `markspec fmt`
11
+ * CLI. It MUST NOT import `core/formatter`, and `core/formatter` MUST NOT import
12
+ * it (WASM-migration purity guard, AGENTS.md).
13
+ */
14
+ import type { Entry } from "../model/mod.js";
15
+ import type { LockEdge } from "../lock/mod.js";
16
+ /**
17
+ * Trace-attribute keys whose values are canonicalised/healed: the core
18
+ * relations plus `Verified-by`. Derived from {@linkcode CORE_RELATIONS} so new
19
+ * relations are covered automatically.
20
+ */
21
+ export declare const TRACE_ATTRIBUTE_KEYS: ReadonlySet<string>;
22
+ /** Bidirectional display-ID ↔ ULID resolution index over a project's entries. */
23
+ export interface RefIndex {
24
+ readonly displayIdToUlid: ReadonlyMap<string, string>;
25
+ readonly ulidToDisplayId: ReadonlyMap<string, string>;
26
+ }
27
+ /**
28
+ * Build a {@linkcode RefIndex} from a project's entries. First-entry-wins on
29
+ * duplicate keys (validator/workspace convention). Entries without a ULID are
30
+ * skipped.
31
+ */
32
+ export declare function buildRefIndex(entries: readonly Entry[]): RefIndex;
33
+ /**
34
+ * Rewrite trace-attribute values in `content` per the canonicalise/heal rules.
35
+ * `entries` MUST be the parse of `content` (used to map each trailer line to its
36
+ * source entry's stable ULID). Returns the rewritten text and whether anything
37
+ * changed. Lossless: only resolvable value tokens are replaced.
38
+ */
39
+ export declare function canonicalizeRefs(content: string, entries: readonly Entry[], index: RefIndex, ledger: readonly LockEdge[]): {
40
+ output: string;
41
+ changed: boolean;
42
+ };
43
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/refs/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAO7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAGnD,CAAC;AAEH,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,QAAQ,CAajE;AAQD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,SAAS,QAAQ,EAAE,GAC1B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAuDtC"}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * @module core/refs
3
+ *
4
+ * Project-aware trace-reference canonicalisation + rename-healing (issue #593,
5
+ * Slice 4). Pure module: given a project-wide display-ID ↔ ULID index and the
6
+ * lockfile's edge ledger, rewrite a file's trace-attribute values losslessly —
7
+ * ULID → current display ID (canonicalise), and a stale display ID → the
8
+ * ledger's stable target ULID → the target's current display ID (heal).
9
+ *
10
+ * Architecture: composed AROUND the pure `core/formatter` by the `markspec fmt`
11
+ * CLI. It MUST NOT import `core/formatter`, and `core/formatter` MUST NOT import
12
+ * it (WASM-migration purity guard, AGENTS.md).
13
+ */
14
+ import { CORE_RELATIONS, DISPLAY_ID_RE, LOCK_EXTRA_INVERSE_KEYS, ULID_RE, } from "../model/mod.js";
15
+ /**
16
+ * Trace-attribute keys whose values are canonicalised/healed: the core
17
+ * relations plus `Verified-by`. Derived from {@linkcode CORE_RELATIONS} so new
18
+ * relations are covered automatically.
19
+ */
20
+ export const TRACE_ATTRIBUTE_KEYS = new Set([
21
+ ...CORE_RELATIONS.map((r) => r.attr),
22
+ ...LOCK_EXTRA_INVERSE_KEYS,
23
+ ]);
24
+ /**
25
+ * Build a {@linkcode RefIndex} from a project's entries. First-entry-wins on
26
+ * duplicate keys (validator/workspace convention). Entries without a ULID are
27
+ * skipped.
28
+ */
29
+ export function buildRefIndex(entries) {
30
+ const displayIdToUlid = new Map();
31
+ const ulidToDisplayId = new Map();
32
+ for (const e of entries) {
33
+ if (e.id === undefined)
34
+ continue;
35
+ if (!displayIdToUlid.has(e.displayId)) {
36
+ displayIdToUlid.set(e.displayId, e.id);
37
+ }
38
+ if (!ulidToDisplayId.has(e.id)) {
39
+ ulidToDisplayId.set(e.id, e.displayId);
40
+ }
41
+ }
42
+ return { displayIdToUlid, ulidToDisplayId };
43
+ }
44
+ /** Trailer trace line: indent, key, `:` + spaces, value-rest. */
45
+ const TRACE_TRAILER_RE = /^(\s{4,})([A-Z][A-Za-z-]*)(\s*:\s*)(.*)$/;
46
+ /** Token splitter that preserves separators between value tokens. */
47
+ const VALUE_TOKEN_RE = /[^\s,]+/g;
48
+ /**
49
+ * Rewrite trace-attribute values in `content` per the canonicalise/heal rules.
50
+ * `entries` MUST be the parse of `content` (used to map each trailer line to its
51
+ * source entry's stable ULID). Returns the rewritten text and whether anything
52
+ * changed. Lossless: only resolvable value tokens are replaced.
53
+ */
54
+ export function canonicalizeRefs(content, entries, index, ledger) {
55
+ const ledgerByKey = new Map();
56
+ for (const e of ledger) {
57
+ if (e.targetUlid === undefined)
58
+ continue;
59
+ ledgerByKey.set(`${e.sourceUlid} ${e.relation} ${e.authoredTarget}`, e.targetUlid);
60
+ }
61
+ // Sort entries by start line so binary-search for source ULID is correct.
62
+ const sorted = [...entries].sort((a, b) => a.location.line - b.location.line);
63
+ /** Return the ULID of the entry whose block contains the given 1-based line. */
64
+ const sourceUlidForLine = (line1) => {
65
+ let lo = 0;
66
+ let hi = sorted.length - 1;
67
+ let ans = -1;
68
+ while (lo <= hi) {
69
+ const mid = (lo + hi) >> 1;
70
+ if (sorted[mid].location.line <= line1) {
71
+ ans = mid;
72
+ lo = mid + 1;
73
+ }
74
+ else {
75
+ hi = mid - 1;
76
+ }
77
+ }
78
+ return ans >= 0 ? sorted[ans].id : undefined;
79
+ };
80
+ const lines = content.split("\n");
81
+ let changed = false;
82
+ for (let i = 0; i < lines.length; i++) {
83
+ // Strip a trailing CR before matching so CRLF files are handled (the
84
+ // trailer regex ends in `$`, which `\r` would block) and re-append it on
85
+ // rewrite so line endings stay byte-for-byte lossless.
86
+ const cr = lines[i].endsWith("\r");
87
+ const bare = cr ? lines[i].slice(0, -1) : lines[i];
88
+ const m = TRACE_TRAILER_RE.exec(bare);
89
+ if (!m)
90
+ continue;
91
+ const [, indent, key, sep, rest] = m;
92
+ if (!TRACE_ATTRIBUTE_KEYS.has(key))
93
+ continue;
94
+ // Multi-line continuation — leave untouched (debt: full multi-line support).
95
+ if (rest.endsWith("\\"))
96
+ continue;
97
+ const sourceUlid = sourceUlidForLine(i + 1);
98
+ const rewritten = rest.replace(VALUE_TOKEN_RE, (token) => rewriteToken(token, sourceUlid, key, index, ledgerByKey));
99
+ if (rewritten !== rest) {
100
+ lines[i] = `${indent}${key}${sep}${rewritten}${cr ? "\r" : ""}`;
101
+ changed = true;
102
+ }
103
+ }
104
+ return { output: lines.join("\n"), changed };
105
+ }
106
+ function rewriteToken(token, sourceUlid, relation, index, ledgerByKey) {
107
+ if (ULID_RE.test(token)) {
108
+ // Rule 1: ULID → current display ID (canonicalise).
109
+ return index.ulidToDisplayId.get(token) ?? token;
110
+ }
111
+ if (!DISPLAY_ID_RE.test(token))
112
+ return token;
113
+ if (index.displayIdToUlid.has(token)) {
114
+ // Rule 2: current display ID — leave unchanged.
115
+ return token;
116
+ }
117
+ if (sourceUlid !== undefined) {
118
+ // Rule 3: stale display ID — try to heal via ledger.
119
+ const targetUlid = ledgerByKey.get(`${sourceUlid} ${relation} ${token}`);
120
+ if (targetUlid !== undefined) {
121
+ const healed = index.ulidToDisplayId.get(targetUlid);
122
+ if (healed !== undefined)
123
+ return healed;
124
+ }
125
+ }
126
+ // Rule 4: leave untouched (URI/broken/unknown).
127
+ return token;
128
+ }
@@ -31,7 +31,7 @@ export declare function validate(entries: readonly Entry[]): ValidateResult;
31
31
  export declare function indexByDisplayId(entries: readonly Entry[]): ReadonlyMap<string, Entry>;
32
32
  export declare function findAttr(attrs: readonly Attribute[], key: string): Attribute | undefined;
33
33
  export { runPipeline, suppressDeclaredAttrR010 } from "./pipeline.js";
34
- export type { PipelineResult } from "./pipeline.js";
34
+ export type { PipelineOptions, PipelineResult } from "./pipeline.js";
35
35
  export { validateListingDocuments } from "./listing.js";
36
36
  export type { ListingFileContext, ListingKind } from "./listing.js";
37
37
  export { classifyEntriesStage, classifyEntry } from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAqCpE,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,CAclE;AA2aD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAM5B;AAGD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,GAAG,EAAE,MAAM,GACV,SAAS,GAAG,SAAS,CAEvB;AAED,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM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