@nowline/core 0.8.6 → 0.10.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 (174) 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 +134 -24
  10. package/dist/generated/ast.d.ts.map +1 -1
  11. package/dist/generated/ast.js +95 -3
  12. package/dist/generated/ast.js.map +1 -1
  13. package/dist/generated/grammar.d.ts.map +1 -1
  14. package/dist/generated/grammar.js +434 -148
  15. package/dist/generated/grammar.js.map +1 -1
  16. package/dist/i18n/codes.d.ts +1 -1
  17. package/dist/i18n/codes.d.ts.map +1 -1
  18. package/dist/i18n/codes.js +44 -1
  19. package/dist/i18n/codes.js.map +1 -1
  20. package/dist/i18n/index.d.ts +1 -0
  21. package/dist/i18n/index.d.ts.map +1 -1
  22. package/dist/i18n/index.js.map +1 -1
  23. package/dist/i18n/messages.en.d.ts +107 -0
  24. package/dist/i18n/messages.en.d.ts.map +1 -1
  25. package/dist/i18n/messages.en.js +220 -1
  26. package/dist/i18n/messages.en.js.map +1 -1
  27. package/dist/i18n/messages.fr.d.ts.map +1 -1
  28. package/dist/i18n/messages.fr.js +250 -1
  29. package/dist/i18n/messages.fr.js.map +1 -1
  30. package/dist/i18n/wave-message-types.d.ts +238 -0
  31. package/dist/i18n/wave-message-types.d.ts.map +1 -0
  32. package/dist/i18n/wave-message-types.js +11 -0
  33. package/dist/i18n/wave-message-types.js.map +1 -0
  34. package/dist/index.d.ts +6 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +5 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/internal.d.ts +6 -0
  39. package/dist/internal.d.ts.map +1 -0
  40. package/dist/internal.js +9 -0
  41. package/dist/internal.js.map +1 -0
  42. package/dist/language/ast-walk.d.ts +31 -0
  43. package/dist/language/ast-walk.d.ts.map +1 -0
  44. package/dist/language/ast-walk.js +109 -0
  45. package/dist/language/ast-walk.js.map +1 -0
  46. package/dist/language/calendar-declarations.d.ts +31 -0
  47. package/dist/language/calendar-declarations.d.ts.map +1 -0
  48. package/dist/language/calendar-declarations.js +99 -0
  49. package/dist/language/calendar-declarations.js.map +1 -0
  50. package/dist/language/include-references.d.ts +11 -0
  51. package/dist/language/include-references.d.ts.map +1 -0
  52. package/dist/language/include-references.js +45 -0
  53. package/dist/language/include-references.js.map +1 -0
  54. package/dist/language/include-resolver.d.ts +78 -1
  55. package/dist/language/include-resolver.d.ts.map +1 -1
  56. package/dist/language/include-resolver.js +190 -12
  57. package/dist/language/include-resolver.js.map +1 -1
  58. package/dist/language/include-waves.d.ts +73 -0
  59. package/dist/language/include-waves.d.ts.map +1 -0
  60. package/dist/language/include-waves.js +319 -0
  61. package/dist/language/include-waves.js.map +1 -0
  62. package/dist/language/nowline-validator.d.ts +6 -1
  63. package/dist/language/nowline-validator.d.ts.map +1 -1
  64. package/dist/language/nowline-validator.js +95 -1589
  65. package/dist/language/nowline-validator.js.map +1 -1
  66. package/dist/language/references.d.ts +14 -0
  67. package/dist/language/references.d.ts.map +1 -0
  68. package/dist/language/references.js +36 -0
  69. package/dist/language/references.js.map +1 -0
  70. package/dist/language/style-chain.d.ts +37 -0
  71. package/dist/language/style-chain.d.ts.map +1 -0
  72. package/dist/language/style-chain.js +55 -0
  73. package/dist/language/style-chain.js.map +1 -0
  74. package/dist/language/validator/calendar.d.ts +9 -0
  75. package/dist/language/validator/calendar.d.ts.map +1 -0
  76. package/dist/language/validator/calendar.js +250 -0
  77. package/dist/language/validator/calendar.js.map +1 -0
  78. package/dist/language/validator/entities.d.ts +23 -0
  79. package/dist/language/validator/entities.d.ts.map +1 -0
  80. package/dist/language/validator/entities.js +261 -0
  81. package/dist/language/validator/entities.js.map +1 -0
  82. package/dist/language/validator/properties.d.ts +18 -0
  83. package/dist/language/validator/properties.d.ts.map +1 -0
  84. package/dist/language/validator/properties.js +356 -0
  85. package/dist/language/validator/properties.js.map +1 -0
  86. package/dist/language/validator/references.d.ts +7 -0
  87. package/dist/language/validator/references.d.ts.map +1 -0
  88. package/dist/language/validator/references.js +261 -0
  89. package/dist/language/validator/references.js.map +1 -0
  90. package/dist/language/validator/structure.d.ts +16 -0
  91. package/dist/language/validator/structure.d.ts.map +1 -0
  92. package/dist/language/validator/structure.js +166 -0
  93. package/dist/language/validator/structure.js.map +1 -0
  94. package/dist/language/validator/style.d.ts +5 -0
  95. package/dist/language/validator/style.d.ts.map +1 -0
  96. package/dist/language/validator/style.js +126 -0
  97. package/dist/language/validator/style.js.map +1 -0
  98. package/dist/language/validator/support.d.ts +35 -0
  99. package/dist/language/validator/support.d.ts.map +1 -0
  100. package/dist/language/validator/support.js +49 -0
  101. package/dist/language/validator/support.js.map +1 -0
  102. package/dist/language/validator/symbols.d.ts +6 -0
  103. package/dist/language/validator/symbols.d.ts.map +1 -0
  104. package/dist/language/validator/symbols.js +131 -0
  105. package/dist/language/validator/symbols.js.map +1 -0
  106. package/dist/language/validator/tables.d.ts +34 -0
  107. package/dist/language/validator/tables.d.ts.map +1 -0
  108. package/dist/language/validator/tables.js +120 -0
  109. package/dist/language/validator/tables.js.map +1 -0
  110. package/dist/language/validator-utils.d.ts +32 -0
  111. package/dist/language/validator-utils.d.ts.map +1 -0
  112. package/dist/language/validator-utils.js +118 -0
  113. package/dist/language/validator-utils.js.map +1 -0
  114. package/dist/language/value-tables.d.ts +107 -0
  115. package/dist/language/value-tables.d.ts.map +1 -0
  116. package/dist/language/value-tables.js +240 -0
  117. package/dist/language/value-tables.js.map +1 -0
  118. package/dist/language/waves-order.d.ts +51 -0
  119. package/dist/language/waves-order.d.ts.map +1 -0
  120. package/dist/language/waves-order.js +787 -0
  121. package/dist/language/waves-order.js.map +1 -0
  122. package/dist/language/waves-plan.d.ts +45 -0
  123. package/dist/language/waves-plan.d.ts.map +1 -0
  124. package/dist/language/waves-plan.js +64 -0
  125. package/dist/language/waves-plan.js.map +1 -0
  126. package/dist/language/waves.d.ts +96 -0
  127. package/dist/language/waves.d.ts.map +1 -0
  128. package/dist/language/waves.js +575 -0
  129. package/dist/language/waves.js.map +1 -0
  130. package/dist/util/props.d.ts +27 -0
  131. package/dist/util/props.d.ts.map +1 -0
  132. package/dist/util/props.js +49 -0
  133. package/dist/util/props.js.map +1 -0
  134. package/dist/util/single-line.d.ts +14 -0
  135. package/dist/util/single-line.d.ts.map +1 -0
  136. package/dist/util/single-line.js +16 -0
  137. package/dist/util/single-line.js.map +1 -0
  138. package/package.json +7 -3
  139. package/src/convert/printer.ts +20 -10
  140. package/src/convert/schema.ts +8 -1
  141. package/src/generated/ast.ts +159 -27
  142. package/src/generated/grammar.ts +434 -148
  143. package/src/i18n/codes.ts +95 -2
  144. package/src/i18n/index.ts +1 -0
  145. package/src/i18n/messages.en.ts +300 -1
  146. package/src/i18n/messages.fr.ts +335 -1
  147. package/src/i18n/wave-message-types.ts +206 -0
  148. package/src/index.ts +33 -0
  149. package/src/internal.ts +9 -0
  150. package/src/language/ast-walk.ts +158 -0
  151. package/src/language/calendar-declarations.ts +141 -0
  152. package/src/language/include-references.ts +49 -0
  153. package/src/language/include-resolver.ts +284 -10
  154. package/src/language/include-waves.ts +419 -0
  155. package/src/language/nowline-validator.ts +98 -1835
  156. package/src/language/nowline.langium +56 -22
  157. package/src/language/references.ts +40 -0
  158. package/src/language/style-chain.ts +95 -0
  159. package/src/language/validator/calendar.ts +319 -0
  160. package/src/language/validator/entities.ts +366 -0
  161. package/src/language/validator/properties.ts +425 -0
  162. package/src/language/validator/references.ts +295 -0
  163. package/src/language/validator/structure.ts +206 -0
  164. package/src/language/validator/style.ts +149 -0
  165. package/src/language/validator/support.ts +84 -0
  166. package/src/language/validator/symbols.ts +141 -0
  167. package/src/language/validator/tables.ts +171 -0
  168. package/src/language/validator-utils.ts +123 -0
  169. package/src/language/value-tables.ts +260 -0
  170. package/src/language/waves-order.ts +879 -0
  171. package/src/language/waves-plan.ts +101 -0
  172. package/src/language/waves.ts +731 -0
  173. package/src/util/props.ts +59 -0
  174. package/src/util/single-line.ts +15 -0
package/src/i18n/codes.ts CHANGED
@@ -12,9 +12,11 @@
12
12
  // NL.E0600–E0699 item / swimlane
13
13
  // NL.E0700–E0799 capacity / utilization
14
14
  // NL.E0800–E0899 style / color / symbol
15
- // NL.E0900–E0999 config blocks (calendar, scale, default)
15
+ // NL.E0900–E0999 calendar declarations (non-working / working)
16
+ // NL.E1100–E1199 waves
16
17
  // NL.W0700–W0799 warnings (silently-ignored input)
17
18
  // NL.W1000–W1099 layout warnings (author intent lost)
19
+ // NL.W1100–W1199 wave warnings
18
20
  // NL.I1000–I1099 layout insights (informational reflow consequences)
19
21
  //
20
22
  // The full list of allocated codes lives in `messages.en.ts` (one entry
@@ -39,10 +41,12 @@ export type MessageCode =
39
41
  // Include (NL.E0200–E0299)
40
42
  | 'NL.E0200' // invalid-include-mode
41
43
  | 'NL.E0201' // duplicate-include-option
44
+ | 'NL.E0202' // include-wave-agreement
42
45
 
43
46
  // Identifier (NL.E0300–E0399)
44
47
  | 'NL.E0300' // duplicate-identifier
45
48
  | 'NL.E0301' // id-or-title-required
49
+ | 'NL.E0302' // unresolved-reference
46
50
 
47
51
  // Property values (NL.E0400–E0499)
48
52
  | 'NL.E0400' // invalid-duration
@@ -70,11 +74,56 @@ export type MessageCode =
70
74
  // Item (NL.E0600–E0699)
71
75
  | 'NL.E0600' // item-requires-size-or-duration
72
76
 
77
+ // Style / color / symbol (NL.E0800–E0899)
78
+ | 'NL.E0800' // invalid-non-working
79
+ | 'NL.E0801' // invalid-style-color
80
+ | 'NL.E0802' // invalid-style-value
81
+ | 'NL.E0803' // unknown-style-property
82
+ | 'NL.E0804' // raw-style-property
83
+ | 'NL.E0805' // symbol-id-reserved
84
+ | 'NL.E0806' // symbol-requires-unicode
85
+ | 'NL.E0807' // symbol-empty-unicode
86
+ | 'NL.E0808' // symbol-invalid-ascii
87
+ | 'NL.E0809' // unknown-symbol-property
88
+ | 'NL.E0810' // duplicate-symbol-id
89
+ | 'NL.E0811' // unknown-icon-reference
90
+ | 'NL.E0812' // icon-forward-reference
91
+
92
+ // Config blocks (NL.E0900–E0999): non-working and working declarations
93
+ | 'NL.E0900' // calendar-declaration-shape
94
+ | 'NL.E0901' // unknown-calendar-declaration-property
95
+ | 'NL.E0902' // calendar-declaration-date-list
96
+ | 'NL.E0903' // calendar-declaration-end-before-start
97
+ | 'NL.E0904' // invalid-weekday
98
+ | 'NL.E0905' // duplicate-weekday
99
+ | 'NL.E0906' // no-working-weekday
100
+ | 'NL.E0907' // duplicate-calendar-declaration-id
101
+
73
102
  // Warnings (NL.W0700–W0799)
74
103
  | 'NL.W0700' // unknown-entity-property
104
+ | 'NL.W0701' // include-wave-presentation
105
+ | 'NL.W0702' // wave-ignored-no-waves
106
+ | 'NL.W0703' // roadmap-only-key-on-default
107
+ | 'NL.W0704' // timeline-strip-hidden
108
+ | 'NL.W0705' // days-per-week-mismatch
109
+
110
+ // Waves (NL.E1100–E1199)
111
+ | 'NL.E1100' // wave-needs-id
112
+ | 'NL.E1101' // wave-ref-invalid
113
+ | 'NL.E1102' // wave-container-conflict
114
+ | 'NL.E1103' // wave-order-unrealizable
115
+ | 'NL.E1104' // wave-disallowed-entity
116
+ | 'NL.E1105' // wave-disallowed-property
117
+ | 'NL.E1106' // wave-after-invalid-target
75
118
 
76
119
  // Layout warnings (NL.W1000–W1099)
77
120
  | 'NL.W1000' // now-line-outside-window
121
+ // NL.W1001 (wave-pin-moved) is retired with item pins; never reuse it.
122
+ | 'NL.W1002' // wave-barrier-cap
123
+
124
+ // Wave warnings (NL.W1100–W1199)
125
+ | 'NL.W1100' // wave-before-unmeetable
126
+ | 'NL.W1101' // wave-reference-ignored
78
127
 
79
128
  // Layout insights (NL.I1000–I1099)
80
129
  | 'NL.I1000' // caption-spilled-right
@@ -82,7 +131,10 @@ export type MessageCode =
82
131
  | 'NL.I1002' // bar-too-narrow
83
132
  | 'NL.I1003' // before-overflow
84
133
  | 'NL.I1004' // lane-multi-row
85
- | 'NL.I1005'; // lane-over-capacity
134
+ | 'NL.I1005' // lane-over-capacity
135
+ | 'NL.I1006' // wave-empty
136
+ | 'NL.I1007' // wave-overruns-milestone
137
+ | 'NL.I1008'; // pin-on-non-working-day
86
138
 
87
139
  export const ALL_CODES: ReadonlyArray<MessageCode> = [
88
140
  'NL.E0001',
@@ -97,8 +149,10 @@ export const ALL_CODES: ReadonlyArray<MessageCode> = [
97
149
  'NL.E0104',
98
150
  'NL.E0200',
99
151
  'NL.E0201',
152
+ 'NL.E0202',
100
153
  'NL.E0300',
101
154
  'NL.E0301',
155
+ 'NL.E0302',
102
156
  'NL.E0400',
103
157
  'NL.E0401',
104
158
  'NL.E0402',
@@ -119,12 +173,51 @@ export const ALL_CODES: ReadonlyArray<MessageCode> = [
119
173
  'NL.E0504',
120
174
  'NL.E0505',
121
175
  'NL.E0600',
176
+ 'NL.E0800',
177
+ 'NL.E0801',
178
+ 'NL.E0802',
179
+ 'NL.E0803',
180
+ 'NL.E0804',
181
+ 'NL.E0805',
182
+ 'NL.E0806',
183
+ 'NL.E0807',
184
+ 'NL.E0808',
185
+ 'NL.E0809',
186
+ 'NL.E0810',
187
+ 'NL.E0811',
188
+ 'NL.E0812',
189
+ 'NL.E0900',
190
+ 'NL.E0901',
191
+ 'NL.E0902',
192
+ 'NL.E0903',
193
+ 'NL.E0904',
194
+ 'NL.E0905',
195
+ 'NL.E0906',
196
+ 'NL.E0907',
122
197
  'NL.W0700',
198
+ 'NL.W0701',
199
+ 'NL.W0702',
200
+ 'NL.W0703',
201
+ 'NL.W0704',
202
+ 'NL.W0705',
203
+ 'NL.E1100',
204
+ 'NL.E1101',
205
+ 'NL.E1102',
206
+ 'NL.E1103',
207
+ 'NL.E1104',
208
+ 'NL.E1105',
209
+ 'NL.E1106',
123
210
  'NL.W1000',
211
+ 'NL.W1002',
212
+ 'NL.W1100',
213
+ 'NL.W1101',
124
214
  'NL.I1000',
125
215
  'NL.I1001',
126
216
  'NL.I1002',
127
217
  'NL.I1003',
128
218
  'NL.I1004',
129
219
  'NL.I1005',
220
+ 'NL.I1006',
221
+ 'NL.I1007',
222
+ 'NL.I1008',
130
223
  ] as const;
package/src/i18n/index.ts CHANGED
@@ -15,6 +15,7 @@ import { messages as frCAMessages } from './messages.fr-CA.js';
15
15
  import { messages as frFRMessages } from './messages.fr-FR.js';
16
16
 
17
17
  export type { MessageCode } from './codes.js';
18
+ export type * from './wave-message-types.js';
18
19
 
19
20
  // `messages.en.ts` re-exported with its inferred type so other locales
20
21
  // can `satisfies` against it. Each function takes one named-argument
@@ -14,6 +14,135 @@
14
14
  // per-code argument inference. Coverage of `MessageCode` is enforced by
15
15
  // the runtime test in `test/i18n/messages-coverage.test.ts`.
16
16
 
17
+ import type {
18
+ E0202Args,
19
+ E1100Args,
20
+ E1101Args,
21
+ E1102Args,
22
+ E1103Args,
23
+ E1104Args,
24
+ E1105Args,
25
+ E1106Args,
26
+ FlowRef,
27
+ I1006Args,
28
+ I1007Args,
29
+ I1008Args,
30
+ W0701Args,
31
+ W0702Args,
32
+ W1002Args,
33
+ W1100Args,
34
+ W1101Args,
35
+ WaveContainerKind,
36
+ WaveKind,
37
+ WaveSuggestion,
38
+ } from './wave-message-types.js';
39
+
40
+ // Kind descriptors for wave messages arrive as structured values and are
41
+ // rendered here (with an article) so other bundles can translate the noun.
42
+ const KIND_WITH_ARTICLE: Record<WaveKind, string> = {
43
+ item: 'an item',
44
+ group: 'a group',
45
+ parallel: 'a parallel block',
46
+ swimlane: 'a swimlane',
47
+ anchor: 'an anchor',
48
+ milestone: 'a milestone',
49
+ 'floating-milestone': 'a milestone without a date',
50
+ wave: 'a wave',
51
+ label: 'a label',
52
+ size: 'a size',
53
+ status: 'a status',
54
+ person: 'a person',
55
+ team: 'a team',
56
+ footnote: 'a footnote',
57
+ roadmap: 'the roadmap',
58
+ style: 'a style',
59
+ symbol: 'a symbol',
60
+ };
61
+
62
+ const KIND_NOUN: Record<WaveKind, string> = {
63
+ item: 'item',
64
+ group: 'group',
65
+ parallel: 'parallel block',
66
+ swimlane: 'swimlane',
67
+ anchor: 'anchor',
68
+ milestone: 'milestone',
69
+ 'floating-milestone': 'milestone',
70
+ wave: 'wave',
71
+ label: 'label',
72
+ size: 'size',
73
+ status: 'status',
74
+ person: 'person',
75
+ team: 'team',
76
+ footnote: 'footnote',
77
+ roadmap: 'roadmap',
78
+ style: 'style',
79
+ symbol: 'symbol',
80
+ };
81
+
82
+ const capitalize = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1);
83
+
84
+ // A flow (swimlane, group, parallel) by name, or by position when unnamed.
85
+ function flowText(f: FlowRef): string {
86
+ if (f.kind === 'parallel-block') return `the parallel block on line ${f.line}`;
87
+ if (f.kind === 'group-block') return `the group on line ${f.line}`;
88
+ return `${f.kind} "${f.name}"`;
89
+ }
90
+
91
+ // The entity a W1100/W1101 is on: `"name"`, or by position when it is an
92
+ // unnamed group or parallel.
93
+ function ownerText(a: { name: string; kind?: WaveContainerKind; line?: number }): string {
94
+ if (a.name || a.line === undefined) return `"${a.name}"`;
95
+ return flowText({
96
+ kind: a.kind === 'parallel' ? 'parallel-block' : 'group-block',
97
+ line: a.line,
98
+ });
99
+ }
100
+
101
+ // An entity or container that may be unnamed, identified by line then.
102
+ function entityText(
103
+ e: {
104
+ kind: 'item' | 'group' | 'parallel';
105
+ name: string;
106
+ line?: number;
107
+ },
108
+ withArticle = true,
109
+ ): string {
110
+ if (e.name) return `${e.kind} "${e.name}"`;
111
+ const noun = e.kind === 'parallel' ? 'parallel block' : e.kind;
112
+ const the = withArticle ? 'the ' : '';
113
+ return e.line === undefined ? `${the}${noun}` : `${the}${noun} on line ${e.line}`;
114
+ }
115
+
116
+ // Sentence subject for a container that may be unnamed: `Group "g"` or
117
+ // `The group on line 4`.
118
+ function containerSubject(c: { kind: WaveContainerKind; name: string; line?: number }): string {
119
+ return c.name ? `${capitalize(c.kind)} "${c.name}"` : capitalize(entityText(c));
120
+ }
121
+
122
+ function floorClause(floor: string | null): string {
123
+ return floor === null ? 'has no start floor' : `opens no earlier than ${floor}`;
124
+ }
125
+
126
+ function suggestionText(s: WaveSuggestion | undefined): string {
127
+ if (!s) return '';
128
+ return s.title === undefined
129
+ ? ` Did you mean wave:${s.id}?`
130
+ : ` Did you mean wave:${s.id} ("${s.title}")?`;
131
+ }
132
+
133
+ // Up to five quoted names, then "and N more".
134
+ /** `"a", "b" and "c"`; past five, `"a", …, "e" and 3 more`. */
135
+ function namesAndText(names: string[]): string {
136
+ const shown = names.slice(0, 5).map((n) => `"${n}"`);
137
+ const rest = names.length - shown.length;
138
+ if (rest > 0) return `${shown.join(', ')} and ${rest} more`;
139
+ return `${shown.slice(0, -1).join(', ')} and ${shown[shown.length - 1]}`;
140
+ }
141
+
142
+ function waveListText(ids: string[]): string {
143
+ return `[${ids.join(', ')}]`;
144
+ }
145
+
17
146
  export const messages = {
18
147
  // Structural
19
148
  'NL.E0001': () => 'Config section must appear before roadmap.',
@@ -38,11 +167,25 @@ export const messages = {
38
167
  'NL.E0200': (a: { value: string }) =>
39
168
  `Invalid include mode "${a.value}". Must be merge, ignore, or isolate.`,
40
169
  'NL.E0201': (a: { key: string }) => `Duplicate "${a.key}" option on include.`,
170
+ 'NL.E0202': (a: E0202Args) => {
171
+ switch (a.reason) {
172
+ case 'mismatch':
173
+ return `Included "${a.path}" declares waves ${waveListText(a.child)}, but this file's waves are ${waveListText(a.parent)}. Every included roadmap must declare the same waves in the same order: copy this file's wave lines into "${a.path}".`;
174
+ case 'child-none':
175
+ return `Included "${a.path}" declares no waves, but this file's waves are ${waveListText(a.parent)}. Copy this file's wave lines into "${a.path}" so its work joins the waves.`;
176
+ case 'parent-none':
177
+ return `Included "${a.path}" declares waves ${waveListText(a.child)}, but this file declares none. Declare the same waves here so the barriers apply to the whole roadmap.`;
178
+ case 'floor':
179
+ return `Wave "${a.id}" in "${a.path}" ${floorClause(a.childFloor)}, but this file's wave "${a.id}" ${floorClause(a.parentFloor)}. A wave must have the same start floor in every included roadmap.`;
180
+ }
181
+ },
41
182
 
42
183
  // Identifier
43
184
  'NL.E0300': (a: { name: string; location: string }) =>
44
185
  `Duplicate identifier "${a.name}". First declared at ${a.location}.`,
45
186
  'NL.E0301': (a: { type: string }) => `${a.type} must have an identifier, a title, or both.`,
187
+ 'NL.E0302': (a: { key: string; value: string }) =>
188
+ `${a.key}: reference "${a.value}" does not resolve to any declared entity in this file.`,
46
189
 
47
190
  // Property values
48
191
  'NL.E0400': (a: { value: string }) =>
@@ -64,7 +207,7 @@ export const messages = {
64
207
  'NL.E0410': (a: { key: string }) =>
65
208
  `"${a.key}:" accepts at most one inline date per direction; collapse the multiple dates to a single binding date or use a declared anchor.`,
66
209
  'NL.E0411': (a: { key: string; type: string }) =>
67
- `Inline date in "${a.key}:" is not allowed on ${a.type}. Allowed only on item, parallel, and group; for a milestone use "date:" instead.`,
210
+ `Inline date in "${a.key}:" is not allowed on ${a.type}. Allowed only on item, parallel, and group, and on a wave's after:; for a milestone use "date:" instead.`,
68
211
  'NL.E0412': (a: { key: string; date: string }) =>
69
212
  `Inline date "${a.date}" in "${a.key}:" requires the roadmap to declare "start:". Add start:YYYY-MM-DD to the roadmap.`,
70
213
  'NL.E0413': (a: { key: string; date: string; start: string }) =>
@@ -86,16 +229,164 @@ export const messages = {
86
229
  'NL.E0600': (a: { name: string }) =>
87
230
  `Item "${a.name}" requires a "size:" or "duration:" property.`,
88
231
 
232
+ // Style
233
+ 'NL.E0800': (a: { value: string }) =>
234
+ `Invalid non-working value "${a.value}". Use hide or show.`,
235
+ 'NL.E0801': (a: { value: string; key: string }) =>
236
+ `Invalid color "${a.value}" for "${a.key}". Use a named color, hex value, or "none".`,
237
+ 'NL.E0802': (a: { value: string; key: string; allowed: string }) =>
238
+ `Invalid value "${a.value}" for "${a.key}". Allowed: ${a.allowed}.`,
239
+ 'NL.E0803': (a: { key: string }) => `Unknown style property "${a.key}".`,
240
+ 'NL.E0804': (a: { key: string; entity: string }) =>
241
+ `Raw style property "${a.key}" is not allowed on ${a.entity}. ` +
242
+ `Declare a named style in config and reference it via "style:id".`,
243
+ 'NL.E0805': (a: { name: string; builtins: string }) =>
244
+ `Symbol id "${a.name}" collides with a built-in icon name. Reserved built-ins: ${a.builtins}.`,
245
+ 'NL.E0806': (a: { name: string }) =>
246
+ `Symbol "${a.name}" requires a "unicode:" property (e.g. unicode:"💰" or unicode:"\\u{1F464}").`,
247
+ 'NL.E0807': (a: { name: string }) => `Symbol "${a.name}" unicode: must be a non-empty value.`,
248
+ 'NL.E0808': (a: { name: string; length: number }) =>
249
+ `Symbol "${a.name}" ascii: must be 1-3 ASCII characters (got ${a.length} character${a.length === 1 ? '' : 's'}).`,
250
+ 'NL.E0809': (a: { key: string }) =>
251
+ `Unknown symbol property "${a.key}". Allowed: unicode, ascii, link, description.`,
252
+ 'NL.E0810': (a: { name: string; location: string }) =>
253
+ `Duplicate symbol id "${a.name}". First declared at ${a.location}.`,
254
+ 'NL.E0811': (a: { key: string; value: string; builtins: string }) =>
255
+ `${a.key}: "${a.value}" is neither a built-in (${a.builtins}) nor a declared symbol. Add "symbol ${a.value} unicode:..." earlier in config or use a quoted Unicode literal.`,
256
+ 'NL.E0812': (a: { key: string; value: string }) =>
257
+ `${a.key}: symbol "${a.value}" is referenced before its declaration. Move "symbol ${a.value}" above this entry.`,
258
+
259
+ // Calendar declarations (non-working and working)
260
+ 'NL.E0900': (a: { kind: string }) =>
261
+ `A ${a.kind} declaration takes date:, or start: and end:, or every: with optional start: and end:.`,
262
+ 'NL.E0901': (a: { kind: string; key: string }) =>
263
+ `Unknown ${a.kind} property "${a.key}". Allowed: date, start, end, every.`,
264
+ 'NL.E0902': (a: { kind: string; key: string }) =>
265
+ `${a.key}: on a ${a.kind} declaration takes one date, not a list.`,
266
+ 'NL.E0903': (a: { start: string; end: string }) => `end: ${a.end} is before start: ${a.start}.`,
267
+ 'NL.E0904': (a: { value: string }) =>
268
+ `Invalid weekday "${a.value}". Use sun, mon, tue, wed, thu, fri or sat.`,
269
+ 'NL.E0905': (a: { value: string }) => `Weekday "${a.value}" is listed more than once.`,
270
+ 'NL.E0906': () =>
271
+ 'This leaves no working day in the week with no end date. Keep at least one weekday working.',
272
+ 'NL.E0907': (a: { kind: string; name: string }) => `Duplicate ${a.kind} id "${a.name}".`,
273
+
89
274
  // Warnings
90
275
  'NL.W0700': (a: { key: string; entity: string; suggested: string }) =>
91
276
  `Unknown property "${a.key}" on ${a.entity}. The renderer ignores it.${
92
277
  a.suggested ? ` Did you mean "${a.suggested}"?` : ''
93
278
  }`,
94
279
 
280
+ 'NL.W0701': (a: W0701Args) =>
281
+ `Wave "${a.id}" in "${a.path}" differs from this file's definition (${a.fields
282
+ .map(
283
+ (f) =>
284
+ `${f.field} ${f.there === '' ? 'none' : `"${f.there}"`} there, ${f.here === '' ? 'none' : `"${f.here}"`} here`,
285
+ )
286
+ .join('; ')}); this file's definition is used.`,
287
+ 'NL.W0702': (a: W0702Args) =>
288
+ `"wave:" on ${
289
+ a.target.kind === 'default'
290
+ ? `"default ${a.target.entityType}"`
291
+ : !a.target.name && a.target.line !== undefined
292
+ ? `the ${a.target.kind === 'parallel' ? 'parallel block' : a.target.kind} on line ${a.target.line}`
293
+ : `${a.target.kind} "${a.target.name}"`
294
+ } is ignored: this roadmap declares no waves. Declare waves with "wave <id>" to use it, or remove the property.`,
295
+ 'NL.W0703': (a: { key: string; entityType: string }) =>
296
+ `"${a.key}" on "default ${a.entityType}" is ignored: it is a roadmap-only style key. Set it on "default roadmap" instead.`,
297
+ 'NL.W0704': (a: { position: string }) =>
298
+ `"timeline-position:${a.position}" draws no dates: "header-height:none" removes every timeline date strip. Set header-height to xs, sm, md, lg or xl to show them.`,
299
+ 'NL.W0705': (a: { daysPerWeek: number; working: number }) =>
300
+ `days-per-week is ${a.daysPerWeek}, but the week leaves ${a.working} working days.`,
301
+
302
+ // Waves
303
+ 'NL.E1100': (a: E1100Args) =>
304
+ `Wave ${
305
+ a.title === undefined ? `on line ${a.line}` : `"${a.title}"`
306
+ } needs an explicit identifier so work can reference it with wave:<id>, e.g. wave build "Build".`,
307
+ 'NL.E1101': (a: E1101Args) => {
308
+ switch (a.reason) {
309
+ case 'list':
310
+ return `"wave:" takes exactly one wave id; an item belongs to at most one wave. Got "${a.value}".`;
311
+ case 'unknown':
312
+ return `Wave "${a.value}" is not declared. Declared waves: ${
313
+ a.declared.length > 0 ? a.declared.join(', ') : 'none'
314
+ }. Add "wave ${a.value}" above the first swimlane that uses it.${suggestionText(a.suggestion)}`;
315
+ case 'forward':
316
+ return `Wave "${a.value}" is used before its declaration on line ${a.line}. Declare waves above the swimlanes that use them.`;
317
+ case 'not-a-wave':
318
+ return `"wave:" must name a wave, but "${a.value}" is ${KIND_WITH_ARTICLE[a.kind]}.${suggestionText(a.suggestion)}`;
319
+ }
320
+ },
321
+ 'NL.E1102': (a: E1102Args) =>
322
+ `${capitalize(entityText(a.entity))} has wave:${a.wave}, but its enclosing ${entityText(a.container, false)} has wave:${a.containerWave}. A container's wave applies to everything inside it; remove one of the two wave: properties.`,
323
+ 'NL.E1103': (a: E1103Args) => {
324
+ switch (a.reason) {
325
+ case 'sequence': {
326
+ const many = a.items.length > 1;
327
+ const items = `${many ? 'Items' : 'Item'} ${a.items.map((n) => `"${n}"`).join(', ')} (wave "${a.itemWave}")`;
328
+ const ref = typeof a.ref === 'string' ? `"${a.ref}"` : flowText(a.ref);
329
+ return `${items} ${many ? 'come' : 'comes'} after ${ref} (wave "${a.refWave}") in ${flowText(a.flow)}. Work in a lane or group runs in order, so it must also be ordered by wave: move ${ref} below "${a.last}", or change their waves.`;
330
+ }
331
+ case 'join':
332
+ return `Item "${a.name}" (wave "${a.wave}") comes after ${flowText(a.block)} in ${flowText(a.flow)}, and that block cannot end before its track "${a.track}" (wave "${a.trackWave}") does. Move "${a.name}" above the block or into a track of its own, or change one of their waves.`;
333
+ case 'after-item':
334
+ return a.container
335
+ ? `${containerSubject(a.container)} has after:${a.refId}, but "${a.ref}" is in later wave "${a.refWave}". Wave "${a.refWave}" cannot start until wave "${a.wave}" ends, so "${a.name}" (wave "${a.wave}") inside it could never start: move "${a.name}" to wave "${a.refWave}" or later, or remove the after:.`
336
+ : `Item "${a.name}" (wave "${a.wave}") has after:${a.refId}, but "${a.ref}" is in later wave "${a.refWave}". Wave "${a.refWave}" cannot start until wave "${a.wave}" ends, so "${a.name}" could never start: move it to wave "${a.refWave}" or later, or remove the after:.`;
337
+ case 'after-wave':
338
+ return a.container
339
+ ? `${containerSubject(a.container)} (wave "${a.wave}") has after:${a.refId}, but work cannot wait for the end of its own wave or a later one. Use an earlier wave, or move the ${a.container.kind} to a later wave.`
340
+ : `Item "${a.name}" (wave "${a.wave}") has after:${a.refId}, but work cannot wait for the end of its own wave or a later one. Use an earlier wave, or move "${a.name}" to a later wave.`;
341
+ case 'chain':
342
+ return `Item "${a.name}" (wave "${a.wave}") could never start: through ${a.chain.join(' → ')}, it waits for work that cannot start until wave "${a.wave}" has ended. Move "${a.name}" to a later wave, or break the chain.`;
343
+ }
344
+ },
345
+ 'NL.E1104': (a: E1104Args) => {
346
+ switch (a.reason) {
347
+ case 'swimlane':
348
+ return `"wave:" is not allowed on swimlane "${a.name}": a swimlane spans every wave. Put wave: on its items, or wrap them in "group wave:${a.value}".`;
349
+ case 'milestone':
350
+ return `"wave:" is not allowed on milestone "${a.name}". To place a milestone at the end of a wave, use after:${a.value}.`;
351
+ case 'other':
352
+ return `"wave:" is not allowed on ${KIND_NOUN[a.type]} "${a.name}"; only item, group, and parallel can belong to a wave.`;
353
+ }
354
+ },
355
+ 'NL.E1105': (a: E1105Args) =>
356
+ a.reason === 'before'
357
+ ? `"before:" is not allowed on wave "${a.name}". A wave's end comes from its items; to give a wave a deadline, add a dated milestone: milestone ${a.name}-due date:<YYYY-MM-DD> after:${a.name}.`
358
+ : `"${a.key}:" is not allowed on wave "${a.name}". A wave's span comes from its items; only after: (an anchor, a dated milestone, or one ISO date) can hold back a wave's start.`,
359
+ 'NL.E1106': (a: E1106Args) =>
360
+ `Wave "${a.name}" has after:${a.ref}, but "${a.ref}" is ${KIND_WITH_ARTICLE[a.kind]}. A wave's after: accepts only anchors, dated milestones, or one ISO date; to make a wave wait for work, put that work in an earlier wave.`,
361
+
95
362
  // Layout warnings
96
363
  'NL.W1000': (a: { date: string; start: string; end: string }) =>
97
364
  `Now-line date ${a.date} is outside the roadmap window (${a.start} – ${a.end}); it will not be drawn.`,
98
365
 
366
+ 'NL.W1002': (a: W1002Args) =>
367
+ `Wave barriers did not settle after ${a.passes} layout passes, so the drawn schedule may not respect the wave order. The roadmap probably has an ordering conflict that validation did not catch.`,
368
+
369
+ // Wave warnings
370
+ 'NL.W1100': (a: W1100Args) => {
371
+ const owner = ownerText(a);
372
+ return a.reason === 'item'
373
+ ? `before:${a.ref} on ${owner} can never be met: ${owner} is in wave "${a.wave}", which cannot start until "${a.ref}" (wave "${a.refWave}") has finished. The overrun will be painted.`
374
+ : `before:${a.ref} on ${owner} can never be met: ${owner} is in wave "${a.wave}", which cannot finish before wave "${a.ref}" starts. The overrun will be painted.`;
375
+ },
376
+ 'NL.W1101': (a: W1101Args) => {
377
+ const owner = ownerText(a);
378
+ switch (a.reason) {
379
+ case 'forward-lane':
380
+ return `${a.key}:${a.ref} on ${owner} refers to "${a.ref}", which is in a later swimlane ("${a.lane}"). Layout places swimlanes in order and ignores references to work it has not placed yet, so it ignores this ${a.key}:. Move swimlane "${a.lane}" above swimlane "${a.ownLane}", or remove the ${a.key}:.`;
381
+ case 'forward-flow':
382
+ return `${a.key}:${a.ref} on ${owner} refers to "${a.ref}", which comes later in ${flowText(a.flow)}. Layout ignores references to work it has not placed yet, so it ignores this ${a.key}:. Move "${a.ref}" above ${owner}, or remove the ${a.key}:.`;
383
+ case 'ancestor':
384
+ return `${a.key}:${a.ref} on ${owner} refers to "${a.ref}", which contains it. Layout ignores references to an enclosing group or parallel, so it ignores this ${a.key}:. Remove the ${a.key}:.`;
385
+ case 'floating-milestone':
386
+ return `${a.key}:${a.ref} on ${owner} refers to milestone "${a.ref}", which has no date. Floating milestones are placed after all work, so layout ignores this ${a.key}:. Reference the milestone's predecessors or a wave instead.`;
387
+ }
388
+ },
389
+
99
390
  // Layout insights (informational)
100
391
  'NL.I1000': (a: { name: string }) =>
101
392
  `Title on item "${a.name}" is wider than its bar at this scale; it rendered to the right of the bar.`,
@@ -111,4 +402,12 @@ export const messages = {
111
402
  `Swimlane "${a.lane}" packed into ${a.rows} rows to avoid overlap.`,
112
403
  'NL.I1005': (a: { lane: string }) =>
113
404
  `Swimlane "${a.lane}" is over capacity in one or more periods (red utilization band).`,
405
+ 'NL.I1006': (a: I1006Args) =>
406
+ a.names.length === 1
407
+ ? `Wave "${a.names[0]}" won't be displayed: it has no items assigned.`
408
+ : `Waves ${namesAndText(a.names)} won't be displayed: they have no items assigned.`,
409
+ 'NL.I1007': (a: I1007Args) =>
410
+ `Milestone "${a.name}" (${a.date}) is overrun: wave "${a.wave}" ends ${a.end}.`,
411
+ 'NL.I1008': (a: I1008Args) =>
412
+ `Item "${a.name}" is pinned to ${a.pin} (${a.key}:), a non-working day; it starts on ${a.start}.`,
114
413
  };