bokata 3.0.0-beta.3 → 3.0.0-beta.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.
- package/.agents/skills/bokata-acceptance-criteria/SKILL.md +6 -7
- package/.agents/skills/bokata-acceptance-criteria/resources/output-template-functional.md +3 -3
- package/.agents/skills/bokata-acceptance-criteria/resources/output-template.md +1 -1
- package/.agents/skills/bokata-feature-map/SKILL.md +10 -11
- package/.agents/skills/bokata-feature-mapper/SKILL.md +4 -5
- package/.agents/skills/bokata-feature-mapper/resources/output-template.md +1 -1
- package/.agents/skills/bokata-feature-slicer/SKILL.md +16 -12
- package/.agents/skills/bokata-feature-slicer/resources/output-template-bites.md +12 -4
- package/.agents/skills/bokata-feature-slicer/resources/phase-2-increments.md +29 -51
- package/.agents/skills/bokata-feature-slicer/resources/{phase-3-baby-steps.md → phase-3-skeleton.md} +3 -3
- package/.agents/skills/bokata-feature-slicer/resources/phase-4-bites.md +8 -7
- package/.agents/skills/bokata-plan/SKILL.md +21 -15
- package/.agents/skills/bokata-plan/resources/plan-template.md +7 -5
- package/.agents/skills/bokata-render/SKILL.md +62 -138
- package/.agents/skills/bokata-render/assets/story-map.html +428 -0
- package/.agents/skills/bokata-render/scripts/render.mjs +703 -0
- package/.agents/skills/bokata-shape/SKILL.md +1 -1
- package/.agents/skills/bokata-slice/SKILL.md +194 -100
- package/.agents/skills/bokata-slice/resources/inc-template.md +36 -0
- package/.agents/skills/bokata-slice/resources/slice-template.md +37 -84
- package/.agents/skills/bokata-status/SKILL.md +27 -15
- package/.agents/skills/bokata-tdd/resources/evidence-rules.md +2 -2
- package/LICENSE +21 -0
- package/README.md +54 -40
- package/agents/bokata-product-designer.md +2 -2
- package/agents/bokata-product-engineer.md +2 -2
- package/agents/bokata-product-manager.md +3 -3
- package/agents/code-executor.md +27 -16
- package/agents/design-reviewer.md +2 -2
- package/agents/feature-slicer.md +21 -9
- package/bin/bokata.js +17 -5
- package/package.json +1 -1
- package/src/agents.js +36 -11
- package/src/config.js +8 -7
- package/src/install.js +12 -3
- package/.agents/skills/bokata-render/resources/story-map-template.md +0 -835
- package/agents/story-map-renderer.md +0 -19
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Renders <docs>/<initiative>/story-map.html from features.md, slices/<nn>-<name>.md (+ its folder) and plan.md.
|
|
3
|
+
// Deterministic and stateless: the same markdown always gives the same HTML (apart from the date).
|
|
4
|
+
// No dependencies, Node >= 18. Usage:
|
|
5
|
+
// node render.mjs <initiative-dir> [--lang en|es] [--date YYYY-MM-DD] [--out file] [--check]
|
|
6
|
+
// Exit code 1 (message on stderr, "file:line: problem") when the markdown breaks the contract.
|
|
7
|
+
// --check parses everything with the same parser, prints every problem and writes nothing.
|
|
8
|
+
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
12
|
+
|
|
13
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const TEMPLATE = path.join(HERE, '..', 'assets', 'story-map.html');
|
|
15
|
+
|
|
16
|
+
export class RenderError extends Error {
|
|
17
|
+
constructor(file, line, message) {
|
|
18
|
+
super(`${file}${line ? `:${line}` : ''}: ${message}`);
|
|
19
|
+
this.name = 'RenderError';
|
|
20
|
+
this.file = file;
|
|
21
|
+
this.line = line;
|
|
22
|
+
this.reason = message;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Slices written by hand (or in Spanish) say the same things with other words.
|
|
27
|
+
const FIELD_ALIASES = { 'depende de': 'depends on', valor: 'value', comprobación: 'check' };
|
|
28
|
+
const OPTION_ID = /F\d+-\d+\.\d+/g;
|
|
29
|
+
// Bite IDs: letters per Feature (F1-a, F1-ab), d<n> for deferred, w<n> for the skeleton bites of Inc 1.
|
|
30
|
+
const BITE_ID = /\bF\d+-(?:[a-z]+|[dw]\d+)\b/g;
|
|
31
|
+
const PRIORITIES = ['skeleton', 'must-have', 'nice-to-have', 'deferred'];
|
|
32
|
+
const INC_STATES = ['sliced', 'planned', 'done'];
|
|
33
|
+
|
|
34
|
+
const read = (file) => fs.readFileSync(file, 'utf8').replace(/\r\n/g, '\n');
|
|
35
|
+
const esc = (s) =>
|
|
36
|
+
String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
37
|
+
const norm = (s) => s.toLowerCase().replace(/\s+/g, ' ').trim();
|
|
38
|
+
const plain = (s) => s.replace(/\*\*/g, '').replace(/`/g, '').trim();
|
|
39
|
+
|
|
40
|
+
// ——— a small markdown → HTML for the increment pages (the subset the slices use) ———
|
|
41
|
+
|
|
42
|
+
const inline = (s) =>
|
|
43
|
+
esc(s)
|
|
44
|
+
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
|
45
|
+
.replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>')
|
|
46
|
+
.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '$1');
|
|
47
|
+
|
|
48
|
+
export function markdown(lines) {
|
|
49
|
+
const out = [];
|
|
50
|
+
let i = 0;
|
|
51
|
+
let ul = false;
|
|
52
|
+
const closeUl = () => {
|
|
53
|
+
if (ul) {
|
|
54
|
+
out.push('</ul>');
|
|
55
|
+
ul = false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
while (i < lines.length) {
|
|
59
|
+
const l = lines[i];
|
|
60
|
+
if (/^```/.test(l)) {
|
|
61
|
+
closeUl();
|
|
62
|
+
const buf = [];
|
|
63
|
+
i++;
|
|
64
|
+
while (i < lines.length && !/^```/.test(lines[i])) buf.push(lines[i++]);
|
|
65
|
+
i++;
|
|
66
|
+
out.push(
|
|
67
|
+
'<pre class="gh">' +
|
|
68
|
+
buf
|
|
69
|
+
.map((b) => {
|
|
70
|
+
const t = b.trim();
|
|
71
|
+
const pad = `style="padding-left:${b.match(/^\s*/)[0].length * 0.5}ch"`;
|
|
72
|
+
if (/^(Scenario Outline|Scenario|Background|Examples|Feature):/.test(t)) return `<span class="g-sc" ${pad}>${esc(t)}</span>`;
|
|
73
|
+
const k = t.match(/^(Given|When|Then|And|But)\b/);
|
|
74
|
+
if (k) return `<span class="g-st" ${pad}><i>${k[1]}</i>${esc(t.slice(k[1].length))}</span>`;
|
|
75
|
+
if (t.startsWith('#')) return `<span class="g-cm" ${pad}>${esc(t)}</span>`;
|
|
76
|
+
return `<span ${pad}>${esc(b)}</span>`;
|
|
77
|
+
})
|
|
78
|
+
.join('\n') +
|
|
79
|
+
'</pre>'
|
|
80
|
+
);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (/^\s*<!--.*-->\s*$/.test(l) || l.trim() === '') {
|
|
84
|
+
closeUl();
|
|
85
|
+
i++;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
let m;
|
|
89
|
+
if ((m = l.match(/^(#{1,6})\s+(.*)$/))) {
|
|
90
|
+
closeUl();
|
|
91
|
+
const n = Math.min(6, m[1].length + 1);
|
|
92
|
+
out.push(`<h${n}>${inline(m[2])}</h${n}>`);
|
|
93
|
+
i++;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (/^\s*\|/.test(l)) {
|
|
97
|
+
closeUl();
|
|
98
|
+
const rows = [];
|
|
99
|
+
while (i < lines.length && /^\s*\|/.test(lines[i])) rows.push(lines[i++]);
|
|
100
|
+
const cells = (r) => r.trim().replace(/^\||\|$/g, '').split('|').map((c) => c.trim());
|
|
101
|
+
const body = rows.filter((r) => !/^\s*\|[\s:|-]+\|\s*$/.test(r));
|
|
102
|
+
out.push('<table>' + body.map((r, k) => `<tr>${cells(r).map((c) => `<${k ? 'td' : 'th'}>${inline(c)}</${k ? 'td' : 'th'}>`).join('')}</tr>`).join('') + '</table>');
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if ((m = l.match(/^(\s*)[-*]\s+(.*)$/))) {
|
|
106
|
+
if (!ul) {
|
|
107
|
+
ul = true;
|
|
108
|
+
out.push('<ul>');
|
|
109
|
+
}
|
|
110
|
+
let t = m[2];
|
|
111
|
+
i++;
|
|
112
|
+
while (i < lines.length && /^\s{2,}\S/.test(lines[i]) && !/^\s*[-*]\s/.test(lines[i])) t += ' ' + lines[i++].trim();
|
|
113
|
+
out.push(`<li class="n${Math.min(2, Math.floor(m[1].length / 2))}">${inline(t)}</li>`);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
closeUl();
|
|
117
|
+
let t = l;
|
|
118
|
+
i++;
|
|
119
|
+
while (i < lines.length && lines[i].trim() !== '' && !/^(```|#|\s*[-*]\s|\s*\|)/.test(lines[i])) t += ' ' + lines[i++].trim();
|
|
120
|
+
out.push(/^\*\*Rule:/.test(t) ? `<p class="rule">${inline(t)}</p>` : `<p>${inline(t)}</p>`);
|
|
121
|
+
}
|
|
122
|
+
closeUl();
|
|
123
|
+
return out.join('\n');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ——— features.md ———
|
|
127
|
+
|
|
128
|
+
export function parseFeatures(file) {
|
|
129
|
+
const lines = read(file).split('\n');
|
|
130
|
+
const features = [];
|
|
131
|
+
let initiative = null;
|
|
132
|
+
let feature = null;
|
|
133
|
+
let task = null;
|
|
134
|
+
let collecting = null;
|
|
135
|
+
let fence = false;
|
|
136
|
+
|
|
137
|
+
lines.forEach((raw, i) => {
|
|
138
|
+
const n = i + 1;
|
|
139
|
+
if (/^```/.test(raw)) fence = !fence;
|
|
140
|
+
if (fence) return;
|
|
141
|
+
let m;
|
|
142
|
+
if (!initiative && (m = raw.match(/^<!--\s*Initiative:\s*([^|]+?)\s*(?:\||-->)/))) initiative = m[1];
|
|
143
|
+
if (!initiative && (m = raw.match(/^# (.+?)(?: — Features)?\s*$/))) initiative = m[1];
|
|
144
|
+
|
|
145
|
+
if ((m = raw.match(/^#{2,6}\s+Feature(?:\s+\d+)?:\s*(.+?)\s*$/))) {
|
|
146
|
+
feature = { name: plain(m[1]), id: null, line: n, tasks: [], systemTasks: [] };
|
|
147
|
+
features.push(feature);
|
|
148
|
+
task = null;
|
|
149
|
+
collecting = 'feature';
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if ((m = raw.match(/^#{2,6}\s+User Task(?:\s+[\d.]+)?:\s*(.+?)\s*$/))) {
|
|
153
|
+
if (!feature) throw new RenderError(file, n, 'User Task before any "Feature:" heading');
|
|
154
|
+
task = { name: plain(m[1]), id: null, line: n, description: '' };
|
|
155
|
+
feature.tasks.push(task);
|
|
156
|
+
collecting = 'task';
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if ((m = raw.match(/^#{2,6}\s+System Task[^:]*:\s*(.+?)\s*$/))) {
|
|
160
|
+
if (feature) feature.systemTasks.push(plain(m[1]));
|
|
161
|
+
task = null;
|
|
162
|
+
collecting = null;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (/^#{1,6}\s/.test(raw)) {
|
|
166
|
+
collecting = null;
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (collecting === 'feature' && feature && (m = raw.match(/<!--\s*ID:\s*(\S+?)\s*(?:\|[^>]*)?-->/))) feature.id = m[1];
|
|
170
|
+
if (collecting === 'task' && task) {
|
|
171
|
+
if ((m = raw.match(/<!--\s*Task ID:\s*(\S+?)\s*(?:\|[^>]*)?-->/))) task.id = m[1];
|
|
172
|
+
else if (!task.description && raw.trim() && !raw.trim().startsWith('<!--')) task.description = plain(raw);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (features.length === 0) throw new RenderError(file, 0, 'no "Feature:" heading found');
|
|
177
|
+
features.forEach((f, idx) => {
|
|
178
|
+
f.code = `F${idx + 1}`;
|
|
179
|
+
f.id = f.id || `FEAT-${idx + 1}`;
|
|
180
|
+
if (f.tasks.length === 0) throw new RenderError(file, f.line, `Feature "${f.name}" has no User Task`);
|
|
181
|
+
f.tasks.forEach((t, k) => {
|
|
182
|
+
t.id = t.id || `${f.code}-T${k + 1}`;
|
|
183
|
+
t.feature = f;
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
return { initiative, features };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// ——— slices/<nn>-<name>.md ———
|
|
190
|
+
|
|
191
|
+
// ——— slices/<nn>-<name>.md (the index) + slices/<nn>-<name>/ (increments, slicing, notes) ———
|
|
192
|
+
|
|
193
|
+
const sectionName = (heading) => heading.split(/[\s—:]/)[0].toLowerCase();
|
|
194
|
+
|
|
195
|
+
export function parseSlice(file) {
|
|
196
|
+
const base = path.basename(file, '.md');
|
|
197
|
+
const fm = base.match(/^(\d+)-(.+)$/);
|
|
198
|
+
if (!fm) throw new RenderError(file, 0, 'slice files are named <nn>-<name>.md');
|
|
199
|
+
const dir = path.join(path.dirname(file), base);
|
|
200
|
+
const slice = {
|
|
201
|
+
file,
|
|
202
|
+
base,
|
|
203
|
+
dir,
|
|
204
|
+
nn: parseInt(fm[1], 10),
|
|
205
|
+
status: 'open',
|
|
206
|
+
options: new Map(),
|
|
207
|
+
incs: [],
|
|
208
|
+
bites: [],
|
|
209
|
+
proposed: []
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// ---- the index ----
|
|
213
|
+
let section = 'header';
|
|
214
|
+
let inc = null;
|
|
215
|
+
let fence = false;
|
|
216
|
+
read(file)
|
|
217
|
+
.split('\n')
|
|
218
|
+
.forEach((raw, i) => {
|
|
219
|
+
const n = i + 1;
|
|
220
|
+
let m;
|
|
221
|
+
if (/^```/.test(raw)) fence = !fence;
|
|
222
|
+
if (!fence && (m = raw.match(/^##\s+(.+?)\s*$/))) {
|
|
223
|
+
section = sectionName(m[1]);
|
|
224
|
+
inc = null;
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (section === 'header' && (m = raw.match(/^-\s*Status:\s*(\w+)/))) slice.status = m[1].toLowerCase() === 'closed' ? 'done' : m[1].toLowerCase();
|
|
228
|
+
|
|
229
|
+
if (section === 'increments') {
|
|
230
|
+
if ((m = raw.match(/^###\s+Inc\s+(\d+)\s*(?:[—–:-]\s*)?(.*)$/))) {
|
|
231
|
+
const tags = [...m[2].matchAll(/\*\*\[([^\]]+)\]\*\*/g)].map((t) => t[1].trim());
|
|
232
|
+
const name = plain(m[2].replace(/\*\*\[[^\]]+\]\*\*/g, '')).replace(/\s+/g, ' ');
|
|
233
|
+
inc = { n: parseInt(m[1], 10), name, tags, outcome: '', bites: [], options: [], line: n };
|
|
234
|
+
if (slice.incs.some((x) => x.n === inc.n)) throw new RenderError(file, n, `Inc ${inc.n} appears twice`);
|
|
235
|
+
slice.incs.push(inc);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (/^###\s/.test(raw)) {
|
|
239
|
+
inc = null;
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (inc && !fence) {
|
|
243
|
+
const clean = raw.replace(/<!--.*?-->/g, '');
|
|
244
|
+
if ((m = clean.match(/^-\s*Outcome:\s*(.*)$/))) inc.outcome = plain(m[1]);
|
|
245
|
+
else if ((m = clean.match(/^-\s*Bites:\s*(.*)$/))) inc.bites = m[1].match(BITE_ID) || [];
|
|
246
|
+
else if ((m = clean.match(/^-\s*Options:\s*(.*)$/))) inc.options = clean.match(OPTION_ID) || []; // an Inc with no bites: its options are drawn loose
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (section === 'backlog') {
|
|
251
|
+
// the proposed increments of `### Proposed increments`
|
|
252
|
+
if ((m = raw.match(/^\|\s*Inc\s+(\d+)\s*[—–:-]\s*(.+?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*$/))) {
|
|
253
|
+
slice.proposed.push({ n: parseInt(m[1], 10), name: plain(m[2]), bites: m[3].match(BITE_ID) || [], gains: plain(m[4]), why: m[5], line: n });
|
|
254
|
+
}
|
|
255
|
+
// A bite line starts with its ID and a dot; older backlogs (flat option lists) have none and draw nothing.
|
|
256
|
+
if (/^\s*-\s+~?(?:\*\*)?F\d+-(?:[a-z]+|[dw]\d+)\s+·/.test(raw)) {
|
|
257
|
+
const b = raw.match(
|
|
258
|
+
/^\s*-\s+(~)?(?:\*\*)?(F\d+-(?:[a-z]+|[dw]\d+))\s+·\s+(.+?)(?:\*\*)?\s+\((skeleton|must-have|nice-to-have|deferred)(?::\s*([^)]*))?\)([^—]*?)\s+—\s+(.*)$/
|
|
259
|
+
);
|
|
260
|
+
if (!b) throw new RenderError(file, n, `not a bite line (expected "- **F1-a · <title>** (must-have) — F1-1.2 · depends on: … · value: … · check: …"): ${raw.trim().slice(0, 70)}`);
|
|
261
|
+
const [, , id, title, priority, reason, tail, rest] = b;
|
|
262
|
+
const taken = tail.match(/Inc\s*(\d+)/)?.[1]; // canonical "→ Inc n"; hand-edited slices vary
|
|
263
|
+
const parts = rest.split(' · ');
|
|
264
|
+
const fields = {};
|
|
265
|
+
for (const part of parts.slice(1)) {
|
|
266
|
+
const kv = part.match(/^(depends on|depende de|value|valor|check|comprobación):\s*(.*)$/);
|
|
267
|
+
if (kv) fields[FIELD_ALIASES[kv[1]] || kv[1]] = kv[2].trim();
|
|
268
|
+
}
|
|
269
|
+
if (slice.bites.some((x) => x.id === id)) throw new RenderError(file, n, `bite ${id} appears twice`);
|
|
270
|
+
slice.bites.push({
|
|
271
|
+
id,
|
|
272
|
+
title: plain(title),
|
|
273
|
+
priority,
|
|
274
|
+
reason: reason || '',
|
|
275
|
+
takenLine: taken ? parseInt(taken, 10) : null,
|
|
276
|
+
options: parts[0].match(OPTION_ID) || [],
|
|
277
|
+
dependsOn: fields['depends on'] || '',
|
|
278
|
+
value: fields.value || '',
|
|
279
|
+
check: fields.check || '',
|
|
280
|
+
line: n
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// ---- slicing/F<k>.md: the options and the User Task each belongs to ----
|
|
287
|
+
const sdir = path.join(dir, 'slicing');
|
|
288
|
+
if (fs.existsSync(sdir)) {
|
|
289
|
+
for (const f of fs.readdirSync(sdir).filter((x) => x.endsWith('.md')).sort()) {
|
|
290
|
+
const sfile = path.join(sdir, f);
|
|
291
|
+
let currentUT = null;
|
|
292
|
+
read(sfile)
|
|
293
|
+
.split('\n')
|
|
294
|
+
.forEach((raw, i) => {
|
|
295
|
+
let m;
|
|
296
|
+
if ((m = raw.match(/^#{2,5}\s+User Task(?:\s+[\d.]+)?:\s*(.+?)\s*$/))) currentUT = plain(m[1]);
|
|
297
|
+
else if ((m = raw.match(/^\s*-\s+(F\d+-\d+\.\d+)\s+(.+?)(?:\s+—\s|$)/))) {
|
|
298
|
+
if (!currentUT) throw new RenderError(sfile, i + 1, `option ${m[1]} is not under a "### User Task:" heading`);
|
|
299
|
+
slice.options.set(m[1], { id: m[1], name: plain(m[2]), ut: currentUT, file: sfile, line: i + 1 });
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// ---- inc-<n>.md: State, Unknowns, scenarios, Pending and the body of each increment ----
|
|
306
|
+
for (const incRec of slice.incs) {
|
|
307
|
+
const ifile = path.join(dir, `inc-${incRec.n}.md`);
|
|
308
|
+
incRec.detailFile = fs.existsSync(ifile) ? ifile : null;
|
|
309
|
+
incRec.stateRaw = null;
|
|
310
|
+
incRec.stateLine = 0;
|
|
311
|
+
incRec.scenarios = [];
|
|
312
|
+
incRec.pending = [];
|
|
313
|
+
incRec.unknowns = '';
|
|
314
|
+
incRec.body = [];
|
|
315
|
+
if (!incRec.detailFile) continue;
|
|
316
|
+
const lines = read(ifile).split('\n');
|
|
317
|
+
incRec.body = lines.slice(1);
|
|
318
|
+
let sec = '';
|
|
319
|
+
let fenced = false;
|
|
320
|
+
lines.forEach((raw, i) => {
|
|
321
|
+
let m;
|
|
322
|
+
if (/^```/.test(raw)) fenced = !fenced;
|
|
323
|
+
if (!fenced && (m = raw.match(/^##\s+(.+?)\s*$/))) sec = sectionName(m[1]);
|
|
324
|
+
if (i < 12 && (m = raw.match(/^-\s*State:\s*(\S+)/))) {
|
|
325
|
+
incRec.stateRaw = m[1].toLowerCase();
|
|
326
|
+
incRec.stateLine = i + 1;
|
|
327
|
+
}
|
|
328
|
+
if (i < 12 && (m = raw.match(/^-\s*Unknowns:\s*(.*)$/))) incRec.unknowns = m[1].trim();
|
|
329
|
+
if ((m = raw.match(/^\s*Scenario(?: Outline)?:\s*(.+?)\s*$/))) incRec.scenarios.push(m[1]);
|
|
330
|
+
if (sec === 'pending' && !fenced && (m = raw.match(/^\s*-\s+(.*)$/))) incRec.pending.push(plain(m[1]));
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
return slice;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
// ——— plan.md ———
|
|
338
|
+
|
|
339
|
+
export function parsePlan(file) {
|
|
340
|
+
const plan = { slices: new Map() };
|
|
341
|
+
if (!fs.existsSync(file)) return plan;
|
|
342
|
+
let slice = null;
|
|
343
|
+
let inc = null;
|
|
344
|
+
read(file).split('\n').forEach((raw) => {
|
|
345
|
+
let m;
|
|
346
|
+
if ((m = raw.match(/^##\s+Slice\s+(\d+)/))) {
|
|
347
|
+
slice = parseInt(m[1], 10);
|
|
348
|
+
if (!plan.slices.has(slice)) plan.slices.set(slice, new Map());
|
|
349
|
+
inc = null;
|
|
350
|
+
} else if ((m = raw.match(/^###\s+Inc\s+(\d+)/))) {
|
|
351
|
+
inc = parseInt(m[1], 10);
|
|
352
|
+
if (slice !== null) plan.slices.get(slice).set(inc, plan.slices.get(slice).get(inc) || []);
|
|
353
|
+
} else if (/^##\s/.test(raw)) {
|
|
354
|
+
slice = null;
|
|
355
|
+
inc = null;
|
|
356
|
+
} else if (slice !== null && inc !== null && (m = raw.match(/^\s*-\s+\[( |x|X)\]\s+(.*)$/))) {
|
|
357
|
+
plan.slices.get(slice).get(inc).push({ done: m[1] !== ' ', text: m[2].trim() });
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
return plan;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// ——— model ———
|
|
364
|
+
|
|
365
|
+
function stateOf(steps) {
|
|
366
|
+
if (!steps || steps.length === 0) return null;
|
|
367
|
+
const done = steps.filter((s) => s.done).length;
|
|
368
|
+
return { state: done === steps.length ? 'done' : done > 0 ? 'building' : 'planned', done, total: steps.length };
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// The state of an increment: `State: done` in its inc-<n>.md (or a done slice) wins; otherwise the checked
|
|
372
|
+
// steps of its section in plan.md say planned / building / done; with no steps, its own State (default sliced).
|
|
373
|
+
function incState(slice, inc, steps) {
|
|
374
|
+
if (slice.status === 'done' || inc.stateRaw === 'done') return { state: 'done', done: 0, total: 0 };
|
|
375
|
+
const fromPlan = stateOf(steps);
|
|
376
|
+
if (fromPlan) return fromPlan;
|
|
377
|
+
return { state: inc.stateRaw === 'planned' ? 'planned' : 'sliced', done: 0, total: 0 };
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export function buildModel(dir) {
|
|
381
|
+
const featuresFile = path.join(dir, 'features.md');
|
|
382
|
+
if (!fs.existsSync(featuresFile)) {
|
|
383
|
+
throw new RenderError(featuresFile, 0, 'not found — pass the initiative folder (<docs>/<slug>)');
|
|
384
|
+
}
|
|
385
|
+
const { initiative, features } = parseFeatures(featuresFile);
|
|
386
|
+
const tasks = features.flatMap((f) => f.tasks);
|
|
387
|
+
tasks.forEach((t, i) => {
|
|
388
|
+
t.col = i + 1;
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
const slicesDir = path.join(dir, 'slices');
|
|
392
|
+
const sliceFiles = fs.existsSync(slicesDir) ? fs.readdirSync(slicesDir).filter((f) => /^\d+-.+\.md$/.test(f)).sort() : [];
|
|
393
|
+
const slices = sliceFiles.map((f) => parseSlice(path.join(slicesDir, f))).sort((a, b) => a.nn - b.nn);
|
|
394
|
+
const planFile = path.join(dir, 'plan.md');
|
|
395
|
+
const plan = parsePlan(planFile);
|
|
396
|
+
|
|
397
|
+
const taskOf = (featureCode, ut) => (features.find((f) => f.code === featureCode)?.tasks || []).find((t) => norm(t.name) === norm(ut)) || null;
|
|
398
|
+
const issues = [];
|
|
399
|
+
|
|
400
|
+
for (const slice of slices) {
|
|
401
|
+
for (const opt of slice.options.values()) {
|
|
402
|
+
opt.feature = opt.id.match(/^(F\d+)-/)[1];
|
|
403
|
+
opt.task = taskOf(opt.feature, opt.ut);
|
|
404
|
+
if (!opt.task) throw new RenderError(opt.file, opt.line, `User Task "${opt.ut}" is not a User Task of ${opt.feature} in features.md`);
|
|
405
|
+
}
|
|
406
|
+
const byId = new Map(slice.bites.map((b) => [b.id, b]));
|
|
407
|
+
const optionOwner = new Map();
|
|
408
|
+
for (const bite of slice.bites) {
|
|
409
|
+
const first = slice.options.get(bite.options[0]);
|
|
410
|
+
if (!first) {
|
|
411
|
+
throw new RenderError(slice.file, bite.line, `bite ${bite.id}: its first option ${bite.options[0] || '(none)'} is not in ${slice.base}/slicing/`);
|
|
412
|
+
}
|
|
413
|
+
bite.feature = bite.id.match(/^(F\d+)-/)[1];
|
|
414
|
+
bite.task = first.task;
|
|
415
|
+
bite.resolved = bite.options.map((id) => {
|
|
416
|
+
const o = slice.options.get(id);
|
|
417
|
+
if (!o) issues.push({ file: slice.file, line: bite.line, text: `bite ${bite.id}: option ${id} is not in ${slice.base}/slicing/` });
|
|
418
|
+
if (optionOwner.has(id)) issues.push({ file: slice.file, line: bite.line, text: `option ${id} is in two bites (${optionOwner.get(id)} and ${bite.id})` });
|
|
419
|
+
optionOwner.set(id, bite.id);
|
|
420
|
+
return { id, name: o ? o.name : '(not in the slicing)', task: o ? o.task : null };
|
|
421
|
+
});
|
|
422
|
+
const others = [...new Set(bite.resolved.map((o) => o.task).filter(Boolean))].filter((t) => t.id !== bite.task.id);
|
|
423
|
+
bite.others = others;
|
|
424
|
+
}
|
|
425
|
+
const taker = new Map();
|
|
426
|
+
for (const inc of slice.incs) {
|
|
427
|
+
for (const id of inc.bites) {
|
|
428
|
+
if (!byId.has(id)) throw new RenderError(slice.file, inc.line, `Inc ${inc.n}: bite ${id} has no line in ## Backlog`);
|
|
429
|
+
if (taker.has(id)) issues.push({ file: slice.file, line: inc.line, text: `bite ${id} is taken by Inc ${taker.get(id)} and Inc ${inc.n}` });
|
|
430
|
+
taker.set(id, inc.n);
|
|
431
|
+
}
|
|
432
|
+
if (inc.bites.length === 0 && inc.options.length === 0 && inc.tags.length === 0) {
|
|
433
|
+
throw new RenderError(slice.file, inc.line, `Inc ${inc.n} has no Bites: line (every Inc is made of bites; the skeleton ones are F<n>-w<k>)`);
|
|
434
|
+
}
|
|
435
|
+
for (const id of inc.options) {
|
|
436
|
+
if (!slice.options.has(id)) issues.push({ file: slice.file, line: inc.line, text: `Inc ${inc.n}: option ${id} is not in ${slice.base}/slicing/` });
|
|
437
|
+
}
|
|
438
|
+
const steps = plan.slices.get(slice.nn)?.get(inc.n) || null;
|
|
439
|
+
inc.steps = steps;
|
|
440
|
+
inc.st = incState(slice, inc, steps);
|
|
441
|
+
if (!inc.detailFile) issues.push({ file: slice.file, line: inc.line, text: `Inc ${inc.n} has no ${slice.base}/inc-${inc.n}.md` });
|
|
442
|
+
else if (inc.stateRaw === null) issues.push({ file: inc.detailFile, line: 1, text: 'no "- State:" line in the first lines' });
|
|
443
|
+
else if (!INC_STATES.includes(inc.stateRaw)) issues.push({ file: inc.detailFile, line: inc.stateLine, text: `unknown State "${inc.stateRaw}" (sliced | planned | done)` });
|
|
444
|
+
if (steps && steps.length && inc.stateRaw === 'done') issues.push({ file: planFile, line: 0, text: `Slice ${slice.nn} · Inc ${inc.n} is done but still has a section in plan.md — delete it` });
|
|
445
|
+
if (steps && steps.length && steps.every((s) => s.done) && inc.stateRaw !== 'done') issues.push({ file: inc.detailFile || slice.file, line: inc.stateLine || inc.line, text: `every step of Inc ${inc.n} is checked: set "- State: done" and clean its section of plan.md` });
|
|
446
|
+
}
|
|
447
|
+
for (const bite of slice.bites) {
|
|
448
|
+
bite.takenBy = taker.get(bite.id) ?? bite.takenLine ?? null;
|
|
449
|
+
if (bite.takenLine !== null && taker.has(bite.id) && taker.get(bite.id) !== bite.takenLine) {
|
|
450
|
+
issues.push({ file: slice.file, line: bite.line, text: `bite ${bite.id} says → Inc ${bite.takenLine} but Inc ${taker.get(bite.id)} lists it` });
|
|
451
|
+
}
|
|
452
|
+
if (bite.takenLine !== null && !slice.incs.some((i) => i.n === bite.takenLine)) {
|
|
453
|
+
issues.push({ file: slice.file, line: bite.line, text: `bite ${bite.id} says → Inc ${bite.takenLine}, which is not in ## Increments` });
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
slice.proposed = slice.proposed.filter((p) => !slice.incs.some((i) => i.n === p.n));
|
|
457
|
+
for (const p of slice.proposed) {
|
|
458
|
+
for (const id of p.bites) {
|
|
459
|
+
const b = byId.get(id);
|
|
460
|
+
if (b && b.takenBy === null) b.proposedInc = p.n;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
// the tasks each Inc touches
|
|
464
|
+
for (const inc of slice.incs) {
|
|
465
|
+
const ofBites = inc.bites.map((id) => byId.get(id));
|
|
466
|
+
inc.biteRecs = ofBites;
|
|
467
|
+
const opts = [];
|
|
468
|
+
const seen = new Set();
|
|
469
|
+
for (const b of ofBites) for (const o of b.resolved) if (!seen.has(o.id)) (seen.add(o.id), opts.push(o));
|
|
470
|
+
for (const id of inc.options) {
|
|
471
|
+
if (seen.has(id)) continue;
|
|
472
|
+
const o = slice.options.get(id);
|
|
473
|
+
seen.add(id);
|
|
474
|
+
opts.push({ id, name: o ? o.name : '(not in the slicing)', task: o ? o.task : null });
|
|
475
|
+
}
|
|
476
|
+
inc.resolvedOptions = opts;
|
|
477
|
+
const fromTags = [];
|
|
478
|
+
if (ofBites.length === 0 && opts.length === 0) {
|
|
479
|
+
// the oldest slices only name the User Tasks, as **[User Task]** tags of the Inc heading
|
|
480
|
+
for (const tag of inc.tags) {
|
|
481
|
+
const task = tasks.find((x) => norm(x.name) === norm(tag));
|
|
482
|
+
if (!task) throw new RenderError(slice.file, inc.line, `Inc ${inc.n}: User Task "${tag}" is not in features.md`);
|
|
483
|
+
fromTags.push(task);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
const ids = new Set([...ofBites.flatMap((b) => [b.task, ...b.others]), ...opts.map((o) => o.task), ...fromTags].filter(Boolean).map((t) => t.id));
|
|
487
|
+
inc.taskIds = [...ids];
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return { initiative, features, tasks, slices, plan, issues, planFile };
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// ——— data for the page ———
|
|
494
|
+
|
|
495
|
+
const sliceName = (base) => base.replace(/^\d+-/, '');
|
|
496
|
+
|
|
497
|
+
function dataOf(model, lang, date) {
|
|
498
|
+
const { features, slices, plan } = model;
|
|
499
|
+
const out = {
|
|
500
|
+
lang,
|
|
501
|
+
date,
|
|
502
|
+
initiative: model.initiative || '',
|
|
503
|
+
next: nextStep(model),
|
|
504
|
+
features: features.map((f) => ({
|
|
505
|
+
code: f.code,
|
|
506
|
+
id: f.id,
|
|
507
|
+
name: f.name,
|
|
508
|
+
systemTasks: f.systemTasks,
|
|
509
|
+
tasks: f.tasks.map((t) => ({ id: t.id, name: t.name, desc: t.description }))
|
|
510
|
+
})),
|
|
511
|
+
slices: []
|
|
512
|
+
};
|
|
513
|
+
for (const s of slices) {
|
|
514
|
+
const k = (id) => `${s.nn}-${id}`;
|
|
515
|
+
const sl = { nn: s.nn, name: sliceName(s.base), base: s.base, status: s.status, incs: [], bites: [] };
|
|
516
|
+
for (const b of s.bites) {
|
|
517
|
+
sl.bites.push({
|
|
518
|
+
key: k(b.id),
|
|
519
|
+
id: b.id,
|
|
520
|
+
title: b.title,
|
|
521
|
+
priority: b.priority,
|
|
522
|
+
reason: b.reason,
|
|
523
|
+
taken: b.takenBy,
|
|
524
|
+
proposedInc: b.proposedInc || null,
|
|
525
|
+
value: b.value,
|
|
526
|
+
check: b.check,
|
|
527
|
+
dependsOn: b.dependsOn,
|
|
528
|
+
options: b.resolved.map((o) => ({ id: o.id, name: o.name, task: o.task ? o.task.id : null })),
|
|
529
|
+
anchor: b.task.id,
|
|
530
|
+
others: b.others.map((t) => t.id),
|
|
531
|
+
feature: b.feature,
|
|
532
|
+
source: `slices/${s.base}.md:${b.line}`
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
for (const i of s.incs) {
|
|
536
|
+
sl.incs.push({
|
|
537
|
+
key: `${s.nn}-${i.n}`,
|
|
538
|
+
n: i.n,
|
|
539
|
+
name: i.name,
|
|
540
|
+
outcome: i.outcome || i.name,
|
|
541
|
+
state: i.st.state,
|
|
542
|
+
progress: i.st.total ? `${i.st.done}/${i.st.total}` : '',
|
|
543
|
+
scenarios: i.scenarios.length,
|
|
544
|
+
bites: i.bites.map(k),
|
|
545
|
+
options: i.resolvedOptions.map((o) => ({ id: o.id, name: o.name, task: o.task ? o.task.id : null })),
|
|
546
|
+
tasks: i.taskIds,
|
|
547
|
+
unknowns: i.unknowns,
|
|
548
|
+
pending: i.pending,
|
|
549
|
+
body: markdown(i.body),
|
|
550
|
+
source: i.detailFile ? `slices/${s.base}/inc-${i.n}.md` : `slices/${s.base}.md:${i.line}`,
|
|
551
|
+
proposed: false
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
for (const p of s.proposed) {
|
|
555
|
+
sl.incs.push({
|
|
556
|
+
key: `${s.nn}-${p.n}`,
|
|
557
|
+
n: p.n,
|
|
558
|
+
name: p.name,
|
|
559
|
+
outcome: p.gains,
|
|
560
|
+
state: 'proposed',
|
|
561
|
+
progress: '',
|
|
562
|
+
scenarios: 0,
|
|
563
|
+
bites: p.bites.map(k),
|
|
564
|
+
options: [],
|
|
565
|
+
tasks: [],
|
|
566
|
+
unknowns: '',
|
|
567
|
+
pending: [],
|
|
568
|
+
body: p.why ? `<p><b>Why this order:</b> ${inline(p.why)}</p>` : '',
|
|
569
|
+
source: `slices/${s.base}.md:${p.line} (## Backlog › Proposed increments)`,
|
|
570
|
+
proposed: true
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
out.slices.push(sl);
|
|
574
|
+
}
|
|
575
|
+
return out;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function nextStep(model) {
|
|
579
|
+
for (const slice of model.slices) {
|
|
580
|
+
if (slice.status !== 'open') continue;
|
|
581
|
+
const sections = model.plan.slices.get(slice.nn);
|
|
582
|
+
if (!sections) continue;
|
|
583
|
+
for (const steps of sections.values()) {
|
|
584
|
+
const open = steps.find((s) => !s.done);
|
|
585
|
+
if (open) return { text: `${open.text.replace(/`/g, '')} — ${slice.base}`, link: 'plan.md' };
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return null;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function counts(model) {
|
|
592
|
+
let incTotal = 0;
|
|
593
|
+
let incDone = 0;
|
|
594
|
+
let stepTotal = 0;
|
|
595
|
+
let stepDone = 0;
|
|
596
|
+
let bitesLeft = 0;
|
|
597
|
+
for (const s of model.slices) {
|
|
598
|
+
for (const i of s.incs) {
|
|
599
|
+
incTotal += 1;
|
|
600
|
+
if (i.st.state === 'done') incDone += 1;
|
|
601
|
+
stepTotal += i.st.total;
|
|
602
|
+
stepDone += i.st.done;
|
|
603
|
+
}
|
|
604
|
+
bitesLeft += s.bites.filter((b) => b.takenBy === null).length;
|
|
605
|
+
}
|
|
606
|
+
return { incTotal, incDone, stepTotal, stepDone, bitesLeft };
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export function render(dir, { lang = 'en', date = new Date().toISOString().slice(0, 10) } = {}) {
|
|
610
|
+
const model = buildModel(dir);
|
|
611
|
+
const c = counts(model);
|
|
612
|
+
const title = `${model.initiative || path.basename(path.resolve(dir))} — Story Map`;
|
|
613
|
+
const json = JSON.stringify(dataOf(model, lang, date))
|
|
614
|
+
.replace(/</g, '\\u003c')
|
|
615
|
+
.replace(/\u2028/g, '\\u2028')
|
|
616
|
+
.replace(/\u2029/g, '\\u2029');
|
|
617
|
+
const values = { LANG: esc(lang), TITLE: esc(title), DATA: json };
|
|
618
|
+
const html = fs.readFileSync(TEMPLATE, 'utf8').replace(/\{\{(\w+)\}\}/g, (_, key) => String(values[key] ?? ''));
|
|
619
|
+
return {
|
|
620
|
+
html,
|
|
621
|
+
summary: `story-map.html updated (${c.incDone}/${c.incTotal} increments, ${c.stepDone}/${c.stepTotal} steps, ${c.bitesLeft} bites left)`
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// Everything the parser can say about the markdown, without writing anything.
|
|
626
|
+
export function check(dir) {
|
|
627
|
+
let model;
|
|
628
|
+
try {
|
|
629
|
+
model = buildModel(dir);
|
|
630
|
+
} catch (err) {
|
|
631
|
+
if (!(err instanceof RenderError)) throw err;
|
|
632
|
+
return { problems: [{ file: err.file, line: err.line, text: err.reason }], summary: '' };
|
|
633
|
+
}
|
|
634
|
+
const bites = model.slices.reduce((n, s) => n + s.bites.length, 0);
|
|
635
|
+
const incs = model.slices.reduce((n, s) => n + s.incs.length, 0);
|
|
636
|
+
return {
|
|
637
|
+
problems: model.issues,
|
|
638
|
+
summary: `ok — ${model.features.length} Features, ${model.slices.length} slices, ${incs} increments, ${bites} bites`
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
function storyMapEnabled(dir) {
|
|
643
|
+
for (let d = path.resolve(dir); ; d = path.dirname(d)) {
|
|
644
|
+
const config = path.join(d, '.bokata.json');
|
|
645
|
+
if (fs.existsSync(config)) {
|
|
646
|
+
try {
|
|
647
|
+
return JSON.parse(fs.readFileSync(config, 'utf8')).story_map !== false;
|
|
648
|
+
} catch {
|
|
649
|
+
return true;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
if (path.dirname(d) === d) return true;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
const USAGE = 'Usage: render.mjs <initiative-dir> [--lang en|es] [--date YYYY-MM-DD] [--out file] [--check]';
|
|
657
|
+
|
|
658
|
+
export function main(argv) {
|
|
659
|
+
const args = { dir: null, lang: 'en', date: undefined, out: null, check: false };
|
|
660
|
+
for (let i = 0; i < argv.length; i++) {
|
|
661
|
+
const a = argv[i];
|
|
662
|
+
if (a === '--lang') args.lang = argv[++i];
|
|
663
|
+
else if (a === '--date') args.date = argv[++i];
|
|
664
|
+
else if (a === '--out') args.out = argv[++i];
|
|
665
|
+
else if (a === '--check') args.check = true;
|
|
666
|
+
else if (a === '-h' || a === '--help') {
|
|
667
|
+
console.log(USAGE);
|
|
668
|
+
return 0;
|
|
669
|
+
} else if (a.startsWith('-')) {
|
|
670
|
+
console.error(`unknown option "${a}"`);
|
|
671
|
+
return 1;
|
|
672
|
+
} else args.dir = a;
|
|
673
|
+
}
|
|
674
|
+
if (!args.dir) {
|
|
675
|
+
console.error(USAGE);
|
|
676
|
+
return 1;
|
|
677
|
+
}
|
|
678
|
+
if (args.check) {
|
|
679
|
+
const { problems, summary } = check(args.dir);
|
|
680
|
+
for (const p of problems) console.error(`✖ ${p.file}${p.line ? `:${p.line}` : ''}: ${p.text}`);
|
|
681
|
+
if (problems.length) return 1;
|
|
682
|
+
console.log(summary);
|
|
683
|
+
return 0;
|
|
684
|
+
}
|
|
685
|
+
if (!storyMapEnabled(args.dir)) {
|
|
686
|
+
console.log('story map disabled (.bokata.json: "story_map": false) — nothing rendered');
|
|
687
|
+
return 0;
|
|
688
|
+
}
|
|
689
|
+
try {
|
|
690
|
+
const { html, summary } = render(args.dir, { lang: args.lang, ...(args.date ? { date: args.date } : {}) });
|
|
691
|
+
fs.writeFileSync(args.out || path.join(args.dir, 'story-map.html'), html);
|
|
692
|
+
console.log(summary);
|
|
693
|
+
return 0;
|
|
694
|
+
} catch (err) {
|
|
695
|
+
if (!(err instanceof RenderError)) throw err;
|
|
696
|
+
console.error(`✖ ${err.message}`);
|
|
697
|
+
return 1;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
|
|
702
|
+
process.exitCode = main(process.argv.slice(2));
|
|
703
|
+
}
|