@nowline/core 0.8.5 → 0.9.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 (180) hide show
  1. package/README.md +9 -0
  2. package/dist/convert/printer.d.ts.map +1 -1
  3. package/dist/convert/printer.js +20 -9
  4. package/dist/convert/printer.js.map +1 -1
  5. package/dist/convert/schema.d.ts +7 -0
  6. package/dist/convert/schema.d.ts.map +1 -1
  7. package/dist/convert/schema.js +1 -1
  8. package/dist/convert/schema.js.map +1 -1
  9. package/dist/generated/ast.d.ts +251 -141
  10. package/dist/generated/ast.d.ts.map +1 -1
  11. package/dist/generated/ast.js +96 -4
  12. package/dist/generated/ast.js.map +1 -1
  13. package/dist/generated/grammar.d.ts +1 -1
  14. package/dist/generated/grammar.d.ts.map +1 -1
  15. package/dist/generated/grammar.js +435 -149
  16. package/dist/generated/grammar.js.map +1 -1
  17. package/dist/generated/module.d.ts +3 -3
  18. package/dist/generated/module.d.ts.map +1 -1
  19. package/dist/generated/module.js +1 -1
  20. package/dist/i18n/codes.d.ts +1 -1
  21. package/dist/i18n/codes.d.ts.map +1 -1
  22. package/dist/i18n/codes.js +44 -1
  23. package/dist/i18n/codes.js.map +1 -1
  24. package/dist/i18n/index.d.ts +1 -0
  25. package/dist/i18n/index.d.ts.map +1 -1
  26. package/dist/i18n/index.js.map +1 -1
  27. package/dist/i18n/messages.en.d.ts +107 -0
  28. package/dist/i18n/messages.en.d.ts.map +1 -1
  29. package/dist/i18n/messages.en.js +220 -1
  30. package/dist/i18n/messages.en.js.map +1 -1
  31. package/dist/i18n/messages.fr.d.ts.map +1 -1
  32. package/dist/i18n/messages.fr.js +250 -1
  33. package/dist/i18n/messages.fr.js.map +1 -1
  34. package/dist/i18n/wave-message-types.d.ts +238 -0
  35. package/dist/i18n/wave-message-types.d.ts.map +1 -0
  36. package/dist/i18n/wave-message-types.js +11 -0
  37. package/dist/i18n/wave-message-types.js.map +1 -0
  38. package/dist/index.d.ts +6 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +5 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/internal.d.ts +6 -0
  43. package/dist/internal.d.ts.map +1 -0
  44. package/dist/internal.js +9 -0
  45. package/dist/internal.js.map +1 -0
  46. package/dist/language/ast-walk.d.ts +31 -0
  47. package/dist/language/ast-walk.d.ts.map +1 -0
  48. package/dist/language/ast-walk.js +109 -0
  49. package/dist/language/ast-walk.js.map +1 -0
  50. package/dist/language/calendar-declarations.d.ts +31 -0
  51. package/dist/language/calendar-declarations.d.ts.map +1 -0
  52. package/dist/language/calendar-declarations.js +99 -0
  53. package/dist/language/calendar-declarations.js.map +1 -0
  54. package/dist/language/include-references.d.ts +11 -0
  55. package/dist/language/include-references.d.ts.map +1 -0
  56. package/dist/language/include-references.js +45 -0
  57. package/dist/language/include-references.js.map +1 -0
  58. package/dist/language/include-resolver.d.ts +78 -1
  59. package/dist/language/include-resolver.d.ts.map +1 -1
  60. package/dist/language/include-resolver.js +190 -12
  61. package/dist/language/include-resolver.js.map +1 -1
  62. package/dist/language/include-waves.d.ts +73 -0
  63. package/dist/language/include-waves.d.ts.map +1 -0
  64. package/dist/language/include-waves.js +319 -0
  65. package/dist/language/include-waves.js.map +1 -0
  66. package/dist/language/nowline-module.js.map +1 -1
  67. package/dist/language/nowline-validator.d.ts +6 -1
  68. package/dist/language/nowline-validator.d.ts.map +1 -1
  69. package/dist/language/nowline-validator.js +95 -1589
  70. package/dist/language/nowline-validator.js.map +1 -1
  71. package/dist/language/references.d.ts +14 -0
  72. package/dist/language/references.d.ts.map +1 -0
  73. package/dist/language/references.js +36 -0
  74. package/dist/language/references.js.map +1 -0
  75. package/dist/language/style-chain.d.ts +37 -0
  76. package/dist/language/style-chain.d.ts.map +1 -0
  77. package/dist/language/style-chain.js +55 -0
  78. package/dist/language/style-chain.js.map +1 -0
  79. package/dist/language/validator/calendar.d.ts +9 -0
  80. package/dist/language/validator/calendar.d.ts.map +1 -0
  81. package/dist/language/validator/calendar.js +250 -0
  82. package/dist/language/validator/calendar.js.map +1 -0
  83. package/dist/language/validator/entities.d.ts +23 -0
  84. package/dist/language/validator/entities.d.ts.map +1 -0
  85. package/dist/language/validator/entities.js +261 -0
  86. package/dist/language/validator/entities.js.map +1 -0
  87. package/dist/language/validator/properties.d.ts +18 -0
  88. package/dist/language/validator/properties.d.ts.map +1 -0
  89. package/dist/language/validator/properties.js +356 -0
  90. package/dist/language/validator/properties.js.map +1 -0
  91. package/dist/language/validator/references.d.ts +7 -0
  92. package/dist/language/validator/references.d.ts.map +1 -0
  93. package/dist/language/validator/references.js +261 -0
  94. package/dist/language/validator/references.js.map +1 -0
  95. package/dist/language/validator/structure.d.ts +16 -0
  96. package/dist/language/validator/structure.d.ts.map +1 -0
  97. package/dist/language/validator/structure.js +166 -0
  98. package/dist/language/validator/structure.js.map +1 -0
  99. package/dist/language/validator/style.d.ts +5 -0
  100. package/dist/language/validator/style.d.ts.map +1 -0
  101. package/dist/language/validator/style.js +126 -0
  102. package/dist/language/validator/style.js.map +1 -0
  103. package/dist/language/validator/support.d.ts +35 -0
  104. package/dist/language/validator/support.d.ts.map +1 -0
  105. package/dist/language/validator/support.js +49 -0
  106. package/dist/language/validator/support.js.map +1 -0
  107. package/dist/language/validator/symbols.d.ts +6 -0
  108. package/dist/language/validator/symbols.d.ts.map +1 -0
  109. package/dist/language/validator/symbols.js +131 -0
  110. package/dist/language/validator/symbols.js.map +1 -0
  111. package/dist/language/validator/tables.d.ts +34 -0
  112. package/dist/language/validator/tables.d.ts.map +1 -0
  113. package/dist/language/validator/tables.js +120 -0
  114. package/dist/language/validator/tables.js.map +1 -0
  115. package/dist/language/validator-utils.d.ts +32 -0
  116. package/dist/language/validator-utils.d.ts.map +1 -0
  117. package/dist/language/validator-utils.js +118 -0
  118. package/dist/language/validator-utils.js.map +1 -0
  119. package/dist/language/value-tables.d.ts +107 -0
  120. package/dist/language/value-tables.d.ts.map +1 -0
  121. package/dist/language/value-tables.js +240 -0
  122. package/dist/language/value-tables.js.map +1 -0
  123. package/dist/language/waves-order.d.ts +51 -0
  124. package/dist/language/waves-order.d.ts.map +1 -0
  125. package/dist/language/waves-order.js +787 -0
  126. package/dist/language/waves-order.js.map +1 -0
  127. package/dist/language/waves-plan.d.ts +45 -0
  128. package/dist/language/waves-plan.d.ts.map +1 -0
  129. package/dist/language/waves-plan.js +64 -0
  130. package/dist/language/waves-plan.js.map +1 -0
  131. package/dist/language/waves.d.ts +96 -0
  132. package/dist/language/waves.d.ts.map +1 -0
  133. package/dist/language/waves.js +575 -0
  134. package/dist/language/waves.js.map +1 -0
  135. package/dist/util/props.d.ts +27 -0
  136. package/dist/util/props.d.ts.map +1 -0
  137. package/dist/util/props.js +49 -0
  138. package/dist/util/props.js.map +1 -0
  139. package/dist/util/single-line.d.ts +14 -0
  140. package/dist/util/single-line.d.ts.map +1 -0
  141. package/dist/util/single-line.js +16 -0
  142. package/dist/util/single-line.js.map +1 -0
  143. package/package.json +10 -6
  144. package/src/convert/printer.ts +20 -10
  145. package/src/convert/schema.ts +8 -1
  146. package/src/generated/ast.ts +160 -28
  147. package/src/generated/grammar.ts +435 -149
  148. package/src/generated/module.ts +1 -1
  149. package/src/i18n/codes.ts +95 -2
  150. package/src/i18n/index.ts +1 -0
  151. package/src/i18n/messages.en.ts +300 -1
  152. package/src/i18n/messages.fr.ts +335 -1
  153. package/src/i18n/wave-message-types.ts +206 -0
  154. package/src/index.ts +33 -0
  155. package/src/internal.ts +9 -0
  156. package/src/language/ast-walk.ts +158 -0
  157. package/src/language/calendar-declarations.ts +141 -0
  158. package/src/language/include-references.ts +49 -0
  159. package/src/language/include-resolver.ts +284 -10
  160. package/src/language/include-waves.ts +419 -0
  161. package/src/language/nowline-validator.ts +98 -1835
  162. package/src/language/nowline.langium +56 -22
  163. package/src/language/references.ts +40 -0
  164. package/src/language/style-chain.ts +95 -0
  165. package/src/language/validator/calendar.ts +319 -0
  166. package/src/language/validator/entities.ts +366 -0
  167. package/src/language/validator/properties.ts +425 -0
  168. package/src/language/validator/references.ts +295 -0
  169. package/src/language/validator/structure.ts +206 -0
  170. package/src/language/validator/style.ts +149 -0
  171. package/src/language/validator/support.ts +84 -0
  172. package/src/language/validator/symbols.ts +141 -0
  173. package/src/language/validator/tables.ts +171 -0
  174. package/src/language/validator-utils.ts +123 -0
  175. package/src/language/value-tables.ts +260 -0
  176. package/src/language/waves-order.ts +879 -0
  177. package/src/language/waves-plan.ts +101 -0
  178. package/src/language/waves.ts +731 -0
  179. package/src/util/props.ts +59 -0
  180. package/src/util/single-line.ts +15 -0
@@ -0,0 +1,356 @@
1
+ // Property value, unknown key, raw style key and style enum checks
2
+ // (specs/core-ast-utilities.md §3.6). Moved out of nowline-validator.ts as-is; the class
3
+ // forwards one method per check.
4
+ import { isDefaultDeclaration, isItemDeclaration, isSwimlaneDeclaration, } from '../../generated/ast.js';
5
+ import { isRealIsoDate, propKey } from '../../util/props.js';
6
+ import { describeNode, suggestKey } from '../validator-utils.js';
7
+ import { isWaveBannedProperty } from '../waves.js';
8
+ import { acceptTr, isIdentifier } from './support.js';
9
+ import { CALENDAR_MODES, COLOR_NAMES, DURATION_RE, ENTITY_KNOWN_PROPS, HEX_COLOR_RE, NON_WORKING_VALUES, PERCENTAGE_RE, POSITIVE_DECIMAL_FRACTION_RE, POSITIVE_INTEGER_RE, POSITIVE_NUMBER_RE, POSITIVE_PERCENT_RE, STYLE_PROP_ENUMS, STYLE_PROP_KEYS, suggestConcept, UNIVERSAL_ENTITY_PROPS, UTILIZATION_NONE, } from './tables.js';
10
+ // --- Property value validation (general) ---
11
+ export function checkPropertyValues(prop, accept) {
12
+ // A key a wave may not take is NL.E1105 only (checkWaveDeclarations).
13
+ if (isWaveBannedProperty(prop))
14
+ return;
15
+ const key = propKey(prop);
16
+ const val = prop.value;
17
+ const vals = prop.values;
18
+ const allValues = val ? [val] : vals;
19
+ switch (key) {
20
+ case 'status':
21
+ // Forward/resolution validated at file scope (checkForwardReferences).
22
+ break;
23
+ case 'duration':
24
+ // `duration:` is literal-only — no alias lookup. Authors who
25
+ // want a named alias use `size:NAME` instead, which resolves
26
+ // to the size's `effort:` (and divides by `capacity:` at
27
+ // layout time, m5).
28
+ if (val && !DURATION_RE.test(val)) {
29
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0400', {
30
+ value: val,
31
+ });
32
+ }
33
+ break;
34
+ case 'size':
35
+ if (val && !isIdentifier(val)) {
36
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0401', {
37
+ value: val,
38
+ });
39
+ }
40
+ break;
41
+ case 'effort':
42
+ if (val && !DURATION_RE.test(val)) {
43
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0402', {
44
+ value: val,
45
+ });
46
+ }
47
+ break;
48
+ case 'remaining': {
49
+ // Accepts either a percent (`30%`, validated 0-100) or a
50
+ // single-engineer effort literal (`1w`, `0.5d`). The literal
51
+ // form is normalized to a percent at layout time using the
52
+ // item's resolved total effort (m5); overflow there emits a
53
+ // soft warning and clamps the rendered bar to 100%.
54
+ if (val) {
55
+ if (PERCENTAGE_RE.test(val)) {
56
+ const pct = parseFloat(val);
57
+ if (pct < 0 || pct > 100) {
58
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0404', {
59
+ value: val,
60
+ });
61
+ }
62
+ }
63
+ else if (!DURATION_RE.test(val)) {
64
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0403', {
65
+ value: val,
66
+ });
67
+ }
68
+ }
69
+ break;
70
+ }
71
+ case 'date':
72
+ case 'start':
73
+ case 'end':
74
+ // A date must name a real calendar day: `Date` would roll `2026-02-30`
75
+ // over to March 2, and layout reads an impossible day as no date.
76
+ if (val && !isRealIsoDate(val)) {
77
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0405', {
78
+ key,
79
+ value: val,
80
+ });
81
+ }
82
+ break;
83
+ case 'scale':
84
+ if (val && !DURATION_RE.test(val)) {
85
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0406', {
86
+ value: val,
87
+ });
88
+ }
89
+ break;
90
+ case 'calendar':
91
+ if (val && !CALENDAR_MODES.has(val)) {
92
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0407', {
93
+ value: val,
94
+ });
95
+ }
96
+ break;
97
+ case 'on':
98
+ case 'after':
99
+ case 'before':
100
+ if (allValues.length === 0) {
101
+ acceptTr(accept, 'error', { node: prop }, 'NL.E0408', { key });
102
+ }
103
+ break;
104
+ case 'capacity': {
105
+ if (!val)
106
+ break;
107
+ const parent = prop.$container;
108
+ const parentKind = capacityParentKind(parent);
109
+ // Parallel/group ban is reported by checkNoComputedProperties; skip here.
110
+ if (parentKind === 'invalid')
111
+ break;
112
+ if (parentKind === 'lane') {
113
+ if (!POSITIVE_NUMBER_RE.test(val) || parseFloat(val) <= 0) {
114
+ accept('error', `Invalid swimlane capacity "${val}". Use a positive integer (e.g. capacity:5) or decimal (e.g. capacity:1.5). Percent literals are not allowed on swimlanes.`, { node: prop, property: 'value' });
115
+ }
116
+ }
117
+ else {
118
+ if (POSITIVE_PERCENT_RE.test(val)) {
119
+ const pct = parseFloat(val);
120
+ if (pct <= 0) {
121
+ accept('error', `Item capacity "${val}" must be positive.`, {
122
+ node: prop,
123
+ property: 'value',
124
+ });
125
+ }
126
+ }
127
+ else if (POSITIVE_NUMBER_RE.test(val)) {
128
+ if (parseFloat(val) <= 0) {
129
+ accept('error', `Item capacity "${val}" must be positive.`, {
130
+ node: prop,
131
+ property: 'value',
132
+ });
133
+ }
134
+ }
135
+ else {
136
+ accept('error', `Invalid item capacity "${val}". Use a positive integer (capacity:2), decimal (capacity:0.5), or percent literal (capacity:50%).`, { node: prop, property: 'value' });
137
+ }
138
+ }
139
+ break;
140
+ }
141
+ case 'overcapacity': {
142
+ // Removed in m9. Suppression is now expressed via
143
+ // `utilization-warn-at:none` / `utilization-over-at:none`
144
+ // (see specs/dsl.md § Capacity → Utilization thresholds).
145
+ accept('error', `"overcapacity:" was removed. Use "utilization-over-at:none" (and/or "utilization-warn-at:none") to suppress the lane utilization underline.`, { node: prop });
146
+ break;
147
+ }
148
+ case 'utilization-warn-at':
149
+ case 'utilization-over-at': {
150
+ if (!val)
151
+ break;
152
+ if (!isUtilizationAllowedHere(prop.$container)) {
153
+ accept('error', `"${key}:" is only valid on "swimlane" or "default swimlane".`, {
154
+ node: prop,
155
+ });
156
+ break;
157
+ }
158
+ if (val === UTILIZATION_NONE)
159
+ break;
160
+ if (POSITIVE_PERCENT_RE.test(val)) {
161
+ if (parseFloat(val) <= 0) {
162
+ accept('error', `${key} value "${val}" must be positive.`, {
163
+ node: prop,
164
+ property: 'value',
165
+ });
166
+ }
167
+ break;
168
+ }
169
+ // Decimals must include the dot to read as fractions; bare
170
+ // integers are ambiguous (`80` could mean 80% or 8000% as a
171
+ // fraction) so we reject them with a hint to disambiguate.
172
+ if (POSITIVE_DECIMAL_FRACTION_RE.test(val)) {
173
+ if (parseFloat(val) <= 0) {
174
+ accept('error', `${key} value "${val}" must be positive.`, {
175
+ node: prop,
176
+ property: 'value',
177
+ });
178
+ }
179
+ break;
180
+ }
181
+ if (POSITIVE_INTEGER_RE.test(val)) {
182
+ accept('error', `Ambiguous ${key} value "${val}". Use the percent form ("${val}%") or the decimal-fraction form ("0.${val}") to make the intent explicit.`, { node: prop, property: 'value' });
183
+ break;
184
+ }
185
+ accept('error', `Invalid ${key} value "${val}". Use a positive percent (e.g. 80%), a positive decimal fraction (e.g. 0.8), or "none" to opt out.`, { node: prop, property: 'value' });
186
+ break;
187
+ }
188
+ case 'capacity-icon':
189
+ // Value-form rule (built-in / symbol id / string literal) and
190
+ // forward-reference rule are enforced together by
191
+ // checkSymbolReferences at file scope so style blocks and
192
+ // default-declaration property positions share one code path.
193
+ break;
194
+ case 'icon':
195
+ // Same handling as capacity-icon.
196
+ break;
197
+ case 'non-working':
198
+ // Raw on an entity line the key is Rule 20's error alone
199
+ // (checkNoRawStyleProperties); the value is checked where the
200
+ // key may be set, on a `default` line.
201
+ if (isDefaultDeclaration(prop.$container)) {
202
+ checkNonWorkingValue(val, prop, accept);
203
+ }
204
+ break;
205
+ default:
206
+ if (STYLE_PROP_KEYS.has(key)) {
207
+ if (key === 'bg' || key === 'fg' || key === 'text') {
208
+ if (val && !isColorValue(val)) {
209
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0801', {
210
+ value: val,
211
+ key,
212
+ });
213
+ }
214
+ }
215
+ else if (key in STYLE_PROP_ENUMS) {
216
+ const allowed = STYLE_PROP_ENUMS[key];
217
+ if (val && !allowed.has(val)) {
218
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0802', {
219
+ value: val,
220
+ key,
221
+ allowed: [...allowed].join(', '),
222
+ });
223
+ }
224
+ }
225
+ }
226
+ break;
227
+ }
228
+ }
229
+ // --- Rule 20: Raw style properties banned on roadmap-section entities ---
230
+ export function checkNoRawStyleProperties(node, accept) {
231
+ for (const prop of node.properties) {
232
+ const key = propKey(prop);
233
+ if (STYLE_PROP_KEYS.has(key)) {
234
+ acceptTr(accept, 'error', { node: prop }, 'NL.E0804', {
235
+ key,
236
+ entity: describeNode(node),
237
+ });
238
+ }
239
+ }
240
+ }
241
+ // Warn on property keys the runtime never reads. Severity is `warning` so a
242
+ // file that happened to render with a bogus key (e.g. `roadmap r now:2026-01-25`)
243
+ // keeps parsing — promoting to error would break files that work today even
244
+ // though the bogus key was a no-op all along.
245
+ //
246
+ // Skips:
247
+ // - raw style keys (already an error from `checkNoRawStyleProperties`)
248
+ // - `footnote` (already an error from `checkNoFootnoteProperty`)
249
+ // - sizing keys on parallel/group (already an error from `checkNoComputedProperties`)
250
+ // - `wave` on every entity (the wave rules own it: NL.W0702 with no waves,
251
+ // NL.E1104 / NL.E1105 where it is not allowed)
252
+ // - the keys a wave may not take (already NL.E1105)
253
+ //
254
+ // Suggests the closest known key within 2 edits when one exists, so the
255
+ // existing `DID_YOU_MEAN_RE` in `packages/cli/src/diagnostics/adapt.ts` picks
256
+ // it up as a structured suggestion alongside the rendered message.
257
+ export function checkUnknownEntityProperties(node, accept) {
258
+ const known = ENTITY_KNOWN_PROPS[node.$type];
259
+ if (!known)
260
+ return;
261
+ const computedBanned = node.$type === 'ParallelBlock' || node.$type === 'GroupBlock'
262
+ ? new Set(['size', 'duration', 'remaining', 'capacity'])
263
+ : null;
264
+ for (const prop of node.properties) {
265
+ const key = propKey(prop);
266
+ if (known.has(key))
267
+ continue;
268
+ if (UNIVERSAL_ENTITY_PROPS.has(key))
269
+ continue;
270
+ if (STYLE_PROP_KEYS.has(key))
271
+ continue;
272
+ if (key === 'footnote')
273
+ continue;
274
+ if (computedBanned?.has(key))
275
+ continue;
276
+ if (key === 'wave' || isWaveBannedProperty(prop))
277
+ continue;
278
+ const candidates = [...known, ...UNIVERSAL_ENTITY_PROPS];
279
+ const suggested = suggestConcept(key, known, node.$type) ?? suggestKey(key, candidates) ?? '';
280
+ acceptTr(accept, 'warning', { node: prop, property: 'key' }, 'NL.W0700', {
281
+ key,
282
+ entity: describeNode(node),
283
+ suggested,
284
+ });
285
+ }
286
+ }
287
+ // --- Rule 18: Style property enum values ---
288
+ // Value forms accepted by `icon:` and `capacity-icon:` (built-in identifier,
289
+ // symbol name, or inline string literal) plus forward-reference resolution are
290
+ // enforced by checkSymbolReferences at file scope so style blocks and
291
+ // `default <entity>` lines share a single code path.
292
+ export function checkStylePropertyEnum(prop, accept) {
293
+ const key = propKey(prop);
294
+ const val = prop.value;
295
+ if (key === 'bg' || key === 'fg' || key === 'text') {
296
+ if (!isColorValue(val)) {
297
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0801', {
298
+ value: val,
299
+ key,
300
+ });
301
+ }
302
+ }
303
+ else if (key === 'non-working') {
304
+ checkNonWorkingValue(val, prop, accept);
305
+ }
306
+ else if (key in STYLE_PROP_ENUMS) {
307
+ const allowed = STYLE_PROP_ENUMS[key];
308
+ if (!allowed.has(val)) {
309
+ acceptTr(accept, 'error', { node: prop, property: 'value' }, 'NL.E0802', {
310
+ value: val,
311
+ key,
312
+ allowed: [...allowed].join(', '),
313
+ });
314
+ }
315
+ }
316
+ else if (!STYLE_PROP_KEYS.has(key)) {
317
+ acceptTr(accept, 'error', { node: prop, property: 'key' }, 'NL.E0803', { key });
318
+ }
319
+ }
320
+ // --- Roadmap declaration specific property checks ---
321
+ // Property-level validation of start:/date: lives in the generic EntityProperty check;
322
+ // this hook is kept for future roadmap-scoped rules (and to make registration symmetric).
323
+ export function checkRoadmapProperties(_roadmap, _accept) {
324
+ // intentionally empty
325
+ }
326
+ function isColorValue(val) {
327
+ return COLOR_NAMES.has(val) || HEX_COLOR_RE.test(val);
328
+ }
329
+ /** NL.E0800 unless `value` is a `non-working:` value (`hide` or `show`). */
330
+ function checkNonWorkingValue(value, node, accept) {
331
+ if (value === undefined || NON_WORKING_VALUES.has(value))
332
+ return;
333
+ acceptTr(accept, 'error', { node, property: 'value' }, 'NL.E0800', { value });
334
+ }
335
+ function capacityParentKind(parent) {
336
+ if (!parent)
337
+ return 'invalid';
338
+ if (isSwimlaneDeclaration(parent))
339
+ return 'lane';
340
+ if (isItemDeclaration(parent))
341
+ return 'item';
342
+ if (isDefaultDeclaration(parent)) {
343
+ return parent.entityType === 'swimlane' ? 'lane' : 'item';
344
+ }
345
+ return 'invalid';
346
+ }
347
+ function isUtilizationAllowedHere(parent) {
348
+ if (!parent)
349
+ return false;
350
+ if (isSwimlaneDeclaration(parent))
351
+ return true;
352
+ if (isDefaultDeclaration(parent) && parent.entityType === 'swimlane')
353
+ return true;
354
+ return false;
355
+ }
356
+ //# sourceMappingURL=properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/language/validator/properties.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,yFAAyF;AACzF,iCAAiC;AAIjC,OAAO,EACH,oBAAoB,EACpB,iBAAiB,EACjB,qBAA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AO,KAAK,CAAC;IAC1B,IAAI,qBAAqB,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/C,IAAI,oBAAoB,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAClF,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ValidationAcceptor } from 'langium';
2
+ import type { NowlineFile } from '../../generated/ast.js';
3
+ export declare function checkForwardReferences(file: NowlineFile, accept: ValidationAcceptor): void;
4
+ export declare function checkReferenceResolution(file: NowlineFile, accept: ValidationAcceptor): void;
5
+ export declare function checkInlineDatePins(file: NowlineFile, accept: ValidationAcceptor): void;
6
+ export declare function checkCircularDependencies(file: NowlineFile, accept: ValidationAcceptor): void;
7
+ //# sourceMappingURL=references.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/language/validator/references.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAW,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAmB1E,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAuD1F;AAeD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAI5F;AAoBD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI,CA4EvF;AAGD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI,CA2F7F"}
@@ -0,0 +1,261 @@
1
+ // Forward reference, reference resolution, inline date pin and cycle checks
2
+ // (specs/core-ast-utilities.md §3.6). Moved out of nowline-validator.ts as-is; the class
3
+ // forwards one method per check.
4
+ import { isGroupBlock, isItemDeclaration, isParallelBlock, isSizeDeclaration, isStatusDeclaration, isTeamDeclaration, isWaveDeclaration, } from '../../generated/ast.js';
5
+ import { ISO_DATE_RE, isRealIsoDate, parseIsoDate, propKey } from '../../util/props.js';
6
+ import { declarations, visitProperties } from '../ast-walk.js';
7
+ import { unresolvedReferences } from '../references.js';
8
+ import { entityTypeLabel } from '../validator-utils.js';
9
+ import { isWaveBannedProperty } from '../waves.js';
10
+ import { acceptTr, resolveLocalStart } from './support.js';
11
+ import { BUILTIN_STATUS_SET } from './tables.js';
12
+ // --- Rule 15: size:/status: references resolve to earlier declarations ---
13
+ export function checkForwardReferences(file, accept) {
14
+ // Declarations in source order across the file.
15
+ const sizeOrder = new Map();
16
+ const statusOrder = new Map();
17
+ for (let i = 0; i < file.roadmapEntries.length; i++) {
18
+ const entry = file.roadmapEntries[i];
19
+ if (isSizeDeclaration(entry) && entry.name) {
20
+ if (!sizeOrder.has(entry.name))
21
+ sizeOrder.set(entry.name, i);
22
+ }
23
+ else if (isStatusDeclaration(entry) && entry.name) {
24
+ if (!statusOrder.has(entry.name))
25
+ statusOrder.set(entry.name, i);
26
+ }
27
+ }
28
+ for (let i = 0; i < file.roadmapEntries.length; i++) {
29
+ const entry = file.roadmapEntries[i];
30
+ visitProperties(entry, (prop) => {
31
+ if (isWaveBannedProperty(prop))
32
+ return;
33
+ const key = propKey(prop);
34
+ if (key === 'size' && prop.value) {
35
+ const val = prop.value;
36
+ const declIdx = sizeOrder.get(val);
37
+ if (declIdx === undefined) {
38
+ accept('error', `Size "${val}" is not declared. Add "size ${val} effort:<literal>" earlier in the roadmap section.`, { node: prop, property: 'value' });
39
+ }
40
+ else if (declIdx >= i) {
41
+ accept('error', `Size "${val}" is referenced before its declaration. Move "size ${val}" above this entity.`, { node: prop, property: 'value' });
42
+ }
43
+ }
44
+ else if (key === 'status' && prop.value) {
45
+ const val = prop.value;
46
+ if (BUILTIN_STATUS_SET.has(val))
47
+ return;
48
+ const declIdx = statusOrder.get(val);
49
+ if (declIdx === undefined) {
50
+ accept('error', `Status "${val}" is not a built-in and has no declaration. Add "status ${val}" earlier in the roadmap section.`, { node: prop, property: 'value' });
51
+ }
52
+ else if (declIdx >= i) {
53
+ accept('error', `Status "${val}" is referenced before its declaration. Move "status ${val}" above this entity.`, { node: prop, property: 'value' });
54
+ }
55
+ }
56
+ });
57
+ }
58
+ }
59
+ // --- Rules 24/1 (reference): after/before/on must resolve to declared ids ---
60
+ // `owner:` is intentionally NOT checked here. Per specs/dsl.md ("Declarations
61
+ // are optional"), `owner:sam` is valid even if no `person sam` declaration
62
+ // exists — it renders as the bare id. Sequencing properties (`after`,
63
+ // `before`, `on`) stay strict because a phantom dependency silently breaks
64
+ // the timeline / footnote target.
65
+ //
66
+ // Inline date literals in `after:` / `before:` (e.g. `after:2026-03-15`)
67
+ // are intentionally NOT id references — they pin the entity directly to a
68
+ // calendar date without a named anchor. `unresolvedReferences` (../references.ts,
69
+ // shared with the include resolver) skips them; their own validation
70
+ // (entity-type allowlist, multi-date-per-direction, roadmap-start:
71
+ // requirements) lives in `checkInlineDatePins` below.
72
+ export function checkReferenceResolution(file, accept) {
73
+ for (const { prop, key, value } of unresolvedReferences(file)) {
74
+ acceptTr(accept, 'error', { node: prop }, 'NL.E0302', { key, value });
75
+ }
76
+ }
77
+ // --- Rules 24a/24b/27/28 (inline-date pins on after:/before:) ---
78
+ // An inline ISO date literal in `after:` or `before:` pins the entity
79
+ // directly to a calendar position without a named `anchor` declaration
80
+ // (see specs/dsl.md "Inline date pins"). This check enforces:
81
+ // - 24a: inline date allowed only on item / parallel / group, and on a
82
+ // wave's after: (its start floor). A wave's before: is skipped
83
+ // entirely: NL.E1105 is its only diagnostic.
84
+ // - 24b: at most one inline date per direction (per `after:` / `before:`)
85
+ // - 27: file with any inline date requires roadmap `start:`
86
+ // - 28: every inline date must be on or after roadmap `start:`
87
+ // - 1: every inline date names a real calendar day (NL.E0405)
88
+ //
89
+ // Cycle detection (`checkCircularDependencies`) skips dates entirely —
90
+ // they are not graph nodes — so this is the only validator that touches
91
+ // their date semantics. The grammar's DATE_LITERAL terminal already
92
+ // enforces the YYYY-MM-DD shape; an impossible day such as `2026-02-30`
93
+ // is NL.E0405 and skips rules 27 and 28, since layout reads it as no date
94
+ // and `Date` would roll it over to March 2.
95
+ export function checkInlineDatePins(file, accept) {
96
+ const start = resolveLocalStart(file);
97
+ const visit = (entry) => {
98
+ const props = entry.properties ?? [];
99
+ const wave = isWaveDeclaration(entry);
100
+ const allowed = isItemDeclaration(entry) || isParallelBlock(entry) || isGroupBlock(entry) || wave;
101
+ for (const prop of props) {
102
+ const key = propKey(prop);
103
+ if (key !== 'after' && key !== 'before')
104
+ continue;
105
+ if (wave && key === 'before')
106
+ continue;
107
+ const vals = prop.value ? [prop.value] : prop.values;
108
+ const dateVals = vals.filter((v) => !!v && ISO_DATE_RE.test(v));
109
+ if (dateVals.length === 0)
110
+ continue;
111
+ if (!allowed) {
112
+ acceptTr(accept, 'error', { node: prop }, 'NL.E0411', {
113
+ key,
114
+ type: entityTypeLabel(entry),
115
+ });
116
+ continue;
117
+ }
118
+ if (dateVals.length > 1) {
119
+ acceptTr(accept, 'error', { node: prop }, 'NL.E0410', { key });
120
+ }
121
+ for (const dateVal of dateVals) {
122
+ if (!isRealIsoDate(dateVal)) {
123
+ acceptTr(accept, 'error', prop.value !== undefined
124
+ ? { node: prop, property: 'value' }
125
+ : {
126
+ node: prop,
127
+ property: 'values',
128
+ index: prop.values.indexOf(dateVal),
129
+ }, 'NL.E0405', { key, value: dateVal });
130
+ continue;
131
+ }
132
+ switch (start.kind) {
133
+ case 'invalid':
134
+ // Roadmap start: itself is malformed; the user
135
+ // already sees that error. Suppress this one to
136
+ // avoid noise (mirrors anchor / milestone behavior).
137
+ continue;
138
+ case 'missing':
139
+ acceptTr(accept, 'error', { node: prop }, 'NL.E0412', {
140
+ key,
141
+ date: dateVal,
142
+ });
143
+ continue;
144
+ case 'valid': {
145
+ const d = parseIsoDate(dateVal);
146
+ if (d && d < start.date) {
147
+ acceptTr(accept, 'error', { node: prop }, 'NL.E0413', {
148
+ key,
149
+ date: dateVal,
150
+ start: start.iso,
151
+ });
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+ };
158
+ for (const node of declarations(file)) {
159
+ if (!isNestedTeam(node))
160
+ visit(node);
161
+ }
162
+ }
163
+ // --- Rule 25: circular dependencies in after/before graph ---
164
+ export function checkCircularDependencies(file, accept) {
165
+ // Build forward-edge graph: id -> set of ids that must finish before id can start.
166
+ // `after:x` on entity y means y depends on x (edge y -> x).
167
+ // `before:y` on entity x means x must finish before y starts, so y depends on x (edge y -> x).
168
+ const deps = new Map();
169
+ const addDep = (node, dep) => {
170
+ if (!deps.has(node))
171
+ deps.set(node, new Set());
172
+ deps.get(node).add(dep);
173
+ };
174
+ const indexDependents = (idName, props, file) => {
175
+ if (!idName)
176
+ return;
177
+ for (const prop of props) {
178
+ const key = propKey(prop);
179
+ if (key === 'after') {
180
+ const refs = prop.value ? [prop.value] : prop.values;
181
+ for (const r of refs) {
182
+ if (!r)
183
+ continue;
184
+ // Inline date literals are not graph nodes — they pin
185
+ // to a calendar position, not to another entity. Skip
186
+ // them so they never participate in a cycle (per
187
+ // specs/dsl.md rule 25).
188
+ if (ISO_DATE_RE.test(r))
189
+ continue;
190
+ addDep(idName, r);
191
+ }
192
+ }
193
+ else if (key === 'before') {
194
+ const refs = prop.value ? [prop.value] : prop.values;
195
+ for (const r of refs) {
196
+ if (!r)
197
+ continue;
198
+ if (ISO_DATE_RE.test(r))
199
+ continue;
200
+ addDep(r, idName);
201
+ }
202
+ }
203
+ }
204
+ void file;
205
+ };
206
+ const visitEntry = (entry) => {
207
+ // A wave's after: names constants (anchors, dated milestones, a
208
+ // date) and its before: is NL.E1105, so neither is a schedule
209
+ // edge. Skipping them keeps the wave-deadline idiom
210
+ // (`wave w2 after:gate` + `milestone gate date:... after:w2`)
211
+ // from reading as a cycle.
212
+ if (isWaveDeclaration(entry))
213
+ return;
214
+ const id = entry.name;
215
+ const props = entry.properties ?? [];
216
+ indexDependents(id, props, file);
217
+ };
218
+ for (const node of declarations(file)) {
219
+ if (!isNestedTeam(node))
220
+ visitEntry(node);
221
+ }
222
+ // DFS for cycles.
223
+ const WHITE = 0, GRAY = 1, BLACK = 2;
224
+ const color = new Map();
225
+ for (const id of deps.keys())
226
+ color.set(id, WHITE);
227
+ const reported = new Set();
228
+ const dfs = (node, path) => {
229
+ color.set(node, GRAY);
230
+ path.push(node);
231
+ for (const dep of deps.get(node) ?? []) {
232
+ const c = color.get(dep) ?? WHITE;
233
+ if (c === GRAY) {
234
+ const cycleStart = path.indexOf(dep);
235
+ const cycle = path.slice(cycleStart).concat(dep);
236
+ const key = [...cycle].sort().join('→');
237
+ if (!reported.has(key)) {
238
+ reported.add(key);
239
+ accept('error', `Circular dependency detected: ${cycle.join(' → ')}.`, {
240
+ node: file.roadmapDecl ?? file,
241
+ });
242
+ }
243
+ }
244
+ else if (c === WHITE) {
245
+ dfs(dep, path);
246
+ }
247
+ }
248
+ path.pop();
249
+ color.set(node, BLACK);
250
+ };
251
+ for (const node of deps.keys()) {
252
+ if ((color.get(node) ?? WHITE) === WHITE)
253
+ dfs(node, []);
254
+ }
255
+ }
256
+ // The rule 24 and rule 25 walks never looked inside a team, so a team nested
257
+ // in a team is skipped to keep their diagnostics (specs/core-ast-utilities.md §6).
258
+ function isNestedTeam(node) {
259
+ return isTeamDeclaration(node) && isTeamDeclaration(node.$container);
260
+ }
261
+ //# sourceMappingURL=references.js.map