bokata 3.0.0-beta.6 → 3.0.0-beta.8

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 (38) hide show
  1. package/.agents/skills/bokata-acceptance-criteria/SKILL.md +6 -6
  2. package/.agents/skills/bokata-feature-map/SKILL.md +4 -4
  3. package/.agents/skills/bokata-feature-map/resources/features-template.md +5 -5
  4. package/.agents/skills/bokata-feature-mapper/SKILL.md +1 -1
  5. package/.agents/skills/bokata-feature-slicer/SKILL.md +18 -13
  6. package/.agents/skills/bokata-feature-slicer/resources/breakdown-strategies.md +15 -7
  7. package/.agents/skills/bokata-feature-slicer/resources/output-template-bites.md +3 -3
  8. package/.agents/skills/bokata-feature-slicer/resources/{phase-2-increments.md → phase-2-options.md} +1 -1
  9. package/.agents/skills/bokata-feature-slicer/resources/phase-3-skeleton.md +7 -6
  10. package/.agents/skills/bokata-feature-slicer/resources/phase-4-bites.md +7 -7
  11. package/.agents/skills/bokata-plan/SKILL.md +30 -30
  12. package/.agents/skills/bokata-plan/resources/plan-template.md +13 -13
  13. package/.agents/skills/bokata-render/SKILL.md +20 -20
  14. package/.agents/skills/bokata-render/assets/story-map.html +86 -86
  15. package/.agents/skills/bokata-render/scripts/render.mjs +208 -178
  16. package/.agents/skills/bokata-shape/SKILL.md +2 -2
  17. package/.agents/skills/bokata-slice/SKILL.md +198 -120
  18. package/.agents/skills/bokata-slice/resources/appetite-template.md +71 -0
  19. package/.agents/skills/bokata-slice/resources/proposed-slices.md +50 -0
  20. package/.agents/skills/bokata-spec/SKILL.md +256 -0
  21. package/.agents/skills/bokata-spec/resources/slice-template.md +49 -0
  22. package/.agents/skills/bokata-status/SKILL.md +29 -29
  23. package/.agents/skills/bokata-tdd/SKILL.md +12 -12
  24. package/README.md +475 -320
  25. package/agents/bokata-product-designer.md +7 -7
  26. package/agents/bokata-product-engineer.md +10 -10
  27. package/agents/bokata-product-manager.md +8 -8
  28. package/agents/code-executor.md +25 -21
  29. package/agents/feature-slicer.md +1 -1
  30. package/bin/bokata.js +1 -1
  31. package/package.json +1 -1
  32. package/src/config.js +1 -1
  33. package/src/install.js +11 -4
  34. package/.agents/skills/bokata-inc/SKILL.md +0 -244
  35. package/.agents/skills/bokata-inc/resources/inc-template.md +0 -36
  36. package/.agents/skills/bokata-slice/resources/proposed-increments.md +0 -42
  37. package/.agents/skills/bokata-slice/resources/slice-template.md +0 -70
  38. /package/.agents/skills/bokata-feature-slicer/resources/{output-template-increments.md → output-template-options.md} +0 -0
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // Renders <docs>/<initiative>/story-map.html from features.md, slices/<nn>-<name>.md (+ its folder) and plan.md.
2
+ // Renders <docs>/<initiative>/story-map.html from features.md, appetites/<nn>-<name>.md (+ its folder) and plan.md.
3
3
  // Deterministic and stateless: the same markdown always gives the same HTML (apart from the date).
4
4
  // No dependencies, Node >= 18. Usage:
5
5
  // node render.mjs <initiative-dir> [--lang en|es] [--date YYYY-MM-DD] [--out file] [--check]
@@ -23,16 +23,19 @@ export class RenderError extends Error {
23
23
  }
24
24
  }
25
25
 
26
- // Slices written by hand (or in Spanish) say the same things with other words.
26
+ // Appetites written by hand (or in Spanish) say the same things with other words.
27
27
  const FIELD_ALIASES = { 'depende de': 'depends on', valor: 'value', comprobación: 'check' };
28
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.
29
+ // Bite IDs: letters per Feature (F1-a, F1-ab), d<n> for deferred, w<n> for the skeleton bites of Slice 1.
30
30
  const BITE_ID = /\bF\d+-(?:[a-z]+|[dw]\d+)\b/g;
31
31
  const PRIORITIES = ['skeleton', 'must-have', 'nice-to-have', 'deferred'];
32
- // An increment is proposed (a row of `### Proposed increments`, no file) until bokata-inc specifies it:
33
- // then its inc-<n>.md says specified, bokata-plan sets planned, the executor sets done. (Older slices say
32
+ // What a slice's optional `## Learned` entries may be tagged with, and the IDs their `Affects:` line may name.
33
+ const LEARNED_KINDS = ['technical', 'user', 'business', 'uncertainty'];
34
+ const BITE_ID_OR_OPTION = /\bF\d+-(?:[a-z]+|[dw]\d+|\d+\.\d+)\b/g;
35
+ // An slice is proposed (a row of `### Proposed slices`, no file) until bokata-spec specifies it:
36
+ // then its slice-<n>.md says specified, bokata-plan sets planned, the executor sets done. (Older appetites say
34
37
  // `sliced` for what is now `specified`.)
35
- const INC_STATES = ['specified', 'planned', 'done'];
38
+ const SLICE_STATES = ['specified', 'planned', 'done'];
36
39
  const LEGACY_STATES = { sliced: 'specified' };
37
40
 
38
41
  const read = (file) => fs.readFileSync(file, 'utf8').replace(/\r\n/g, '\n');
@@ -41,7 +44,7 @@ const esc = (s) =>
41
44
  const norm = (s) => s.toLowerCase().replace(/\s+/g, ' ').trim();
42
45
  const plain = (s) => s.replace(/\*\*/g, '').replace(/`/g, '').trim();
43
46
 
44
- // ——— a small markdown → HTML for the increment pages (the subset the slices use) ———
47
+ // ——— a small markdown → HTML for the slice pages (the subset the appetites use) ———
45
48
 
46
49
  const inline = (s) =>
47
50
  esc(s)
@@ -190,17 +193,17 @@ export function parseFeatures(file) {
190
193
  return { initiative, features };
191
194
  }
192
195
 
193
- // ——— slices/<nn>-<name>.md ———
196
+ // ——— appetites/<nn>-<name>.md ———
194
197
 
195
- // ——— slices/<nn>-<name>.md (the index) + slices/<nn>-<name>/ (increments, slicing, notes) ———
198
+ // ——— appetites/<nn>-<name>.md (the index) + appetites/<nn>-<name>/ (slices, slicing, notes) ———
196
199
 
197
200
  const sectionName = (heading) => heading.split(/[\s—:]/)[0].toLowerCase();
198
201
 
199
202
  // An option line of slicing/F<k>.md:
200
- // - F1-1.2 <name> — <what changes> · <strategy> · [covers R1 …] · [skeleton | deferred (…) · F1-a] [→ Inc n] [→ target]
203
+ // - F1-1.2 <name> — <what changes> · <strategy> · [covers R1 …] · [skeleton | deferred (…) · F1-a] [→ Slice n] [→ target]
201
204
  // Read from the end: the trailing "meta" pieces first, then the strategy, and what is left is the description.
202
- // (Older slices wrote "paquete F6-e → objetivo" for "F6-e → target": both are accepted.)
203
- const META = /^(?:covers\b.*|cubre\b.*|skeleton|esqueleto|deferred\b.*|(?:(?:paquete|package|bite)\s+)?(?:F\d+-(?:[a-z]+|[dw]\d+))?(?:\s*→\s*(?:Inc\s*\d+|target|objetivo))*)$/;
205
+ // (Older appetites wrote "paquete F6-e → objetivo" for "F6-e → target": both are accepted.)
206
+ const META = /^(?:covers\b.*|cubre\b.*|skeleton|esqueleto|deferred\b.*|(?:(?:paquete|package|bite)\s+)?(?:F\d+-(?:[a-z]+|[dw]\d+))?(?:\s*→\s*(?:Slice\s*\d+|target|objetivo))*)$/;
204
207
  export function optionTail(raw, id) {
205
208
  const text = raw.replace(/^\s*-\s+/, '').slice(id.length).trim();
206
209
  const dash = text.indexOf(' — ');
@@ -209,8 +212,8 @@ export function optionTail(raw, id) {
209
212
  const name = dash < 0 ? parts.shift() : text.slice(0, dash);
210
213
  const keep = dash < 0 ? 0 : 1; // the description is never a strategy or a meta piece
211
214
  let target = false;
212
- // "<strategy> → Inc 1": the arrows may be glued to the last piece with no " · " before them
213
- const glued = parts.length > keep && !META.test(parts[parts.length - 1]) && parts[parts.length - 1].match(/(?:\s*→\s*(?:Inc\s*\d+|target|objetivo))+\s*$/);
215
+ // "<strategy> → Slice 1": the arrows may be glued to the last piece with no " · " before them
216
+ const glued = parts.length > keep && !META.test(parts[parts.length - 1]) && parts[parts.length - 1].match(/(?:\s*→\s*(?:Slice\s*\d+|target|objetivo))+\s*$/);
214
217
  if (glued) {
215
218
  if (/target|objetivo/.test(glued[0])) target = true;
216
219
  parts[parts.length - 1] = parts[parts.length - 1].slice(0, glued.index);
@@ -223,26 +226,26 @@ export function optionTail(raw, id) {
223
226
  return { name: plain(name), desc: plain(parts.join(' · ')), strategy: plain(strategy), target };
224
227
  }
225
228
 
226
- export function parseSlice(file) {
229
+ export function parseAppetite(file) {
227
230
  const base = path.basename(file, '.md');
228
231
  const fm = base.match(/^(\d+)-(.+)$/);
229
- if (!fm) throw new RenderError(file, 0, 'slice files are named <nn>-<name>.md');
232
+ if (!fm) throw new RenderError(file, 0, 'appetite files are named <nn>-<name>.md');
230
233
  const dir = path.join(path.dirname(file), base);
231
- const slice = {
234
+ const appetite = {
232
235
  file,
233
236
  base,
234
237
  dir,
235
238
  nn: parseInt(fm[1], 10),
236
239
  status: 'open',
237
240
  options: new Map(),
238
- incs: [],
241
+ slices: [],
239
242
  bites: [],
240
243
  proposed: []
241
244
  };
242
245
 
243
246
  // ---- the index ----
244
247
  let section = 'header';
245
- let inc = null;
248
+ let slice = null;
246
249
  let fence = false;
247
250
  read(file)
248
251
  .split('\n')
@@ -252,36 +255,36 @@ export function parseSlice(file) {
252
255
  if (/^```/.test(raw)) fence = !fence;
253
256
  if (!fence && (m = raw.match(/^##\s+(.+?)\s*$/))) {
254
257
  section = sectionName(m[1]);
255
- inc = null;
258
+ slice = null;
256
259
  return;
257
260
  }
258
- if (section === 'header' && (m = raw.match(/^-\s*Status:\s*(\w+)/))) slice.status = m[1].toLowerCase() === 'closed' ? 'done' : m[1].toLowerCase();
261
+ if (section === 'header' && (m = raw.match(/^-\s*Status:\s*(\w+)/))) appetite.status = m[1].toLowerCase() === 'closed' ? 'done' : m[1].toLowerCase();
259
262
 
260
- if (section === 'increments') {
261
- if ((m = raw.match(/^###\s+Inc\s+(\d+)\s*(?:[—–:-]\s*)?(.*)$/))) {
263
+ if (section === 'slices') {
264
+ if ((m = raw.match(/^###\s+Slice\s+(\d+)\s*(?:[—–:-]\s*)?(.*)$/))) {
262
265
  const tags = [...m[2].matchAll(/\*\*\[([^\]]+)\]\*\*/g)].map((t) => t[1].trim());
263
266
  const name = plain(m[2].replace(/\*\*\[[^\]]+\]\*\*/g, '')).replace(/\s+/g, ' ');
264
- inc = { n: parseInt(m[1], 10), name, tags, outcome: '', bites: [], options: [], line: n };
265
- if (slice.incs.some((x) => x.n === inc.n)) throw new RenderError(file, n, `Inc ${inc.n} appears twice`);
266
- slice.incs.push(inc);
267
+ slice = { n: parseInt(m[1], 10), name, tags, outcome: '', bites: [], options: [], line: n };
268
+ if (appetite.slices.some((x) => x.n === slice.n)) throw new RenderError(file, n, `Slice ${slice.n} appears twice`);
269
+ appetite.slices.push(slice);
267
270
  return;
268
271
  }
269
272
  if (/^###\s/.test(raw)) {
270
- inc = null;
273
+ slice = null;
271
274
  return;
272
275
  }
273
- if (inc && !fence) {
276
+ if (slice && !fence) {
274
277
  const clean = raw.replace(/<!--.*?-->/g, '');
275
- if ((m = clean.match(/^-\s*Outcome:\s*(.*)$/))) inc.outcome = plain(m[1]);
276
- else if ((m = clean.match(/^-\s*Bites:\s*(.*)$/))) inc.bites = m[1].match(BITE_ID) || [];
277
- else if ((m = clean.match(/^-\s*Options:\s*(.*)$/))) inc.options = clean.match(OPTION_ID) || []; // an Inc with no bites: its options are drawn loose
278
+ if ((m = clean.match(/^-\s*Outcome:\s*(.*)$/))) slice.outcome = plain(m[1]);
279
+ else if ((m = clean.match(/^-\s*Bites:\s*(.*)$/))) slice.bites = m[1].match(BITE_ID) || [];
280
+ else if ((m = clean.match(/^-\s*Options:\s*(.*)$/))) slice.options = clean.match(OPTION_ID) || []; // an Slice with no bites: its options are drawn loose
278
281
  }
279
282
  }
280
283
 
281
284
  if (section === 'backlog') {
282
- // the proposed increments of `### Proposed increments`
283
- if ((m = raw.match(/^\|\s*Inc\s+(\d+)\s*[—–:-]\s*(.+?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*$/))) {
284
- 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 });
285
+ // the proposed slices of `### Proposed slices`
286
+ if ((m = raw.match(/^\|\s*Slice\s+(\d+)\s*[—–:-]\s*(.+?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*(.*?)\s*\|\s*$/))) {
287
+ appetite.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 });
285
288
  }
286
289
  // A bite line starts with its ID and a dot; older backlogs (flat option lists) have none and draw nothing.
287
290
  if (/^\s*-\s+~?(?:\*\*)?F\d+-(?:[a-z]+|[dw]\d+)\s+·/.test(raw)) {
@@ -290,15 +293,15 @@ export function parseSlice(file) {
290
293
  );
291
294
  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)}`);
292
295
  const [, , id, title, priority, reason, tail, rest] = b;
293
- const taken = tail.match(/Inc\s*(\d+)/)?.[1]; // canonical "→ Inc n"; hand-edited slices vary
296
+ const taken = tail.match(/Slice\s*(\d+)/)?.[1]; // canonical "→ Slice n"; hand-edited appetites vary
294
297
  const parts = rest.split(' · ');
295
298
  const fields = {};
296
299
  for (const part of parts.slice(1)) {
297
300
  const kv = part.match(/^(depends on|depende de|value|valor|check|comprobación):\s*(.*)$/);
298
301
  if (kv) fields[FIELD_ALIASES[kv[1]] || kv[1]] = kv[2].trim();
299
302
  }
300
- if (slice.bites.some((x) => x.id === id)) throw new RenderError(file, n, `bite ${id} appears twice`);
301
- slice.bites.push({
303
+ if (appetite.bites.some((x) => x.id === id)) throw new RenderError(file, n, `bite ${id} appears twice`);
304
+ appetite.bites.push({
302
305
  id,
303
306
  title: plain(title),
304
307
  priority,
@@ -315,7 +318,7 @@ export function parseSlice(file) {
315
318
  });
316
319
 
317
320
  // ---- slicing/F<k>.md: the Steps, the options (with what they say) and the User Task each belongs to ----
318
- slice.steps = new Map(); // "F1-3" -> { f, n, name, kind, desc, note, ut }
321
+ appetite.steps = new Map(); // "F1-3" -> { f, n, name, kind, desc, note, ut }
319
322
  const sdir = path.join(dir, 'slicing');
320
323
  if (fs.existsSync(sdir)) {
321
324
  for (const f of fs.readdirSync(sdir).filter((x) => x.endsWith('.md')).sort()) {
@@ -329,40 +332,41 @@ export function parseSlice(file) {
329
332
  if ((m = raw.match(/^#{2,5}\s+User Task(?:\s+[\d.]+)?:\s*(.+?)\s*$/))) currentUT = plain(m[1]);
330
333
  else if (code && (m = raw.match(/^\s*-\s+\*\*S(\d+)\s+(.+?)\*\*(?:\s+·\s+([A-Za-z]+))?(?:\s+—\s+(.*))?$/))) {
331
334
  const [desc, note] = (m[4] || '').split(' · note: ');
332
- slice.steps.set(`${code}-${m[1]}`, { f: code, n: parseInt(m[1], 10), name: plain(m[2]), kind: m[3] || '', desc: plain(desc), note: plain(note || ''), ut: currentUT });
335
+ appetite.steps.set(`${code}-${m[1]}`, { f: code, n: parseInt(m[1], 10), name: plain(m[2]), kind: m[3] || '', desc: plain(desc), note: plain(note || ''), ut: currentUT });
333
336
  } else if ((m = raw.match(/^\s*-\s+(F\d+-\d+\.\d+)\s+(.+?)(?:\s+—\s|$)/))) {
334
337
  if (!currentUT) throw new RenderError(sfile, i + 1, `option ${m[1]} is not under a "### User Task:" heading`);
335
- slice.options.set(m[1], { id: m[1], ut: currentUT, file: sfile, line: i + 1, ...optionTail(raw, m[1]) });
338
+ appetite.options.set(m[1], { id: m[1], ut: currentUT, file: sfile, line: i + 1, ...optionTail(raw, m[1]) });
336
339
  }
337
340
  });
338
341
  }
339
342
  }
340
343
 
341
344
  // ---- pruned.md: the options cut with a reason (they are gone from slicing/) ----
342
- slice.pruned = [];
345
+ appetite.pruned = [];
343
346
  const pfile = path.join(dir, 'pruned.md');
344
347
  if (fs.existsSync(pfile)) {
345
348
  read(pfile)
346
349
  .split('\n')
347
350
  .forEach((raw, i) => {
348
351
  const m = raw.match(/^\s*-\s+(F\d+-\d+\.\d+)\s+(.+?)\s+—\s+`(\w+)`:\s*(.*)$/);
349
- if (m) slice.pruned.push({ id: m[1], name: plain(m[2]), cat: m[3], reason: m[4].trim(), file: pfile, line: i + 1 });
352
+ if (m) appetite.pruned.push({ id: m[1], name: plain(m[2]), cat: m[3], reason: m[4].trim(), file: pfile, line: i + 1 });
350
353
  });
351
354
  }
352
355
 
353
- // ---- inc-<n>.md: State, Unknowns, scenarios, Pending and the body of each increment ----
354
- for (const incRec of slice.incs) {
355
- const ifile = path.join(dir, `inc-${incRec.n}.md`);
356
- incRec.detailFile = fs.existsSync(ifile) ? ifile : null;
357
- incRec.stateRaw = null;
358
- incRec.stateLine = 0;
359
- incRec.scenarios = [];
360
- incRec.pending = [];
361
- incRec.unknowns = '';
362
- incRec.body = [];
363
- if (!incRec.detailFile) continue;
356
+ // ---- slice-<n>.md: State, Unknowns, scenarios, Pending and the body of each slice ----
357
+ for (const sliceRec of appetite.slices) {
358
+ const ifile = path.join(dir, `slice-${sliceRec.n}.md`);
359
+ sliceRec.detailFile = fs.existsSync(ifile) ? ifile : null;
360
+ sliceRec.stateRaw = null;
361
+ sliceRec.stateLine = 0;
362
+ sliceRec.scenarios = [];
363
+ sliceRec.pending = [];
364
+ sliceRec.learned = []; // { kind, text, affects: [ids] | null, line, file }
365
+ sliceRec.unknowns = '';
366
+ sliceRec.body = [];
367
+ if (!sliceRec.detailFile) continue;
364
368
  const lines = read(ifile).split('\n');
365
- incRec.body = lines.slice(1);
369
+ sliceRec.body = lines.slice(1);
366
370
  let sec = '';
367
371
  let fenced = false;
368
372
  lines.forEach((raw, i) => {
@@ -370,39 +374,48 @@ export function parseSlice(file) {
370
374
  if (/^```/.test(raw)) fenced = !fenced;
371
375
  if (!fenced && (m = raw.match(/^##\s+(.+?)\s*$/))) sec = sectionName(m[1]);
372
376
  if (i < 12 && (m = raw.match(/^-\s*State:\s*(\S+)/))) {
373
- incRec.stateRaw = LEGACY_STATES[m[1].toLowerCase()] || m[1].toLowerCase();
374
- incRec.stateLine = i + 1;
377
+ sliceRec.stateRaw = LEGACY_STATES[m[1].toLowerCase()] || m[1].toLowerCase();
378
+ sliceRec.stateLine = i + 1;
379
+ }
380
+ if (i < 12 && (m = raw.match(/^-\s*Unknowns:\s*(.*)$/))) sliceRec.unknowns = m[1].trim();
381
+ if ((m = raw.match(/^\s*Scenario(?: Outline)?:\s*(.+?)\s*$/))) sliceRec.scenarios.push(m[1]);
382
+ if (sec === 'pending' && !fenced && (m = raw.match(/^\s*-\s+(.*)$/))) sliceRec.pending.push(plain(m[1]));
383
+ // ## Learned: "- <technical|user|business|uncertainty>: <what>" then "Affects: <bite or option IDs | none>"
384
+ if (sec === 'learned' && !fenced) {
385
+ if ((m = raw.match(/^-\s+([A-Za-z]+)\s*:\s*(.*)$/))) sliceRec.learned.push({ kind: m[1].toLowerCase(), text: plain(m[2]), affects: null, line: i + 1, file: ifile });
386
+ else if ((m = raw.match(/^\s*(?:-\s+)?Affects:\s*(.*)$/i)) && sliceRec.learned.length) {
387
+ const last = sliceRec.learned[sliceRec.learned.length - 1];
388
+ last.affects = /^none\b/i.test(m[1].trim()) ? [] : m[1].match(BITE_ID_OR_OPTION) || [];
389
+ last.affectsLine = i + 1;
390
+ }
375
391
  }
376
- if (i < 12 && (m = raw.match(/^-\s*Unknowns:\s*(.*)$/))) incRec.unknowns = m[1].trim();
377
- if ((m = raw.match(/^\s*Scenario(?: Outline)?:\s*(.+?)\s*$/))) incRec.scenarios.push(m[1]);
378
- if (sec === 'pending' && !fenced && (m = raw.match(/^\s*-\s+(.*)$/))) incRec.pending.push(plain(m[1]));
379
392
  });
380
393
  }
381
- return slice;
394
+ return appetite;
382
395
  }
383
396
 
384
397
 
385
398
  // ——— plan.md ———
386
399
 
387
400
  export function parsePlan(file) {
388
- const plan = { slices: new Map() };
401
+ const plan = { appetites: new Map() };
389
402
  if (!fs.existsSync(file)) return plan;
403
+ let appetite = null;
390
404
  let slice = null;
391
- let inc = null;
392
405
  read(file).split('\n').forEach((raw) => {
393
406
  let m;
394
- if ((m = raw.match(/^##\s+Slice\s+(\d+)/))) {
407
+ if ((m = raw.match(/^##\s+Appetite\s+(\d+)/))) {
408
+ appetite = parseInt(m[1], 10);
409
+ if (!plan.appetites.has(appetite)) plan.appetites.set(appetite, new Map());
410
+ slice = null;
411
+ } else if ((m = raw.match(/^###\s+Slice\s+(\d+)/))) {
395
412
  slice = parseInt(m[1], 10);
396
- if (!plan.slices.has(slice)) plan.slices.set(slice, new Map());
397
- inc = null;
398
- } else if ((m = raw.match(/^###\s+Inc\s+(\d+)/))) {
399
- inc = parseInt(m[1], 10);
400
- if (slice !== null) plan.slices.get(slice).set(inc, plan.slices.get(slice).get(inc) || []);
413
+ if (appetite !== null) plan.appetites.get(appetite).set(slice, plan.appetites.get(appetite).get(slice) || []);
401
414
  } else if (/^##\s/.test(raw)) {
415
+ appetite = null;
402
416
  slice = null;
403
- inc = null;
404
- } else if (slice !== null && inc !== null && (m = raw.match(/^\s*-\s+\[( |x|X)\]\s+(.*)$/))) {
405
- plan.slices.get(slice).get(inc).push({ done: m[1] !== ' ', text: m[2].trim() });
417
+ } else if (appetite !== null && slice !== null && (m = raw.match(/^\s*-\s+\[( |x|X)\]\s+(.*)$/))) {
418
+ plan.appetites.get(appetite).get(slice).push({ done: m[1] !== ' ', text: m[2].trim() });
406
419
  }
407
420
  });
408
421
  return plan;
@@ -416,13 +429,13 @@ function stateOf(steps) {
416
429
  return { state: done === steps.length ? 'done' : done > 0 ? 'building' : 'planned', done, total: steps.length };
417
430
  }
418
431
 
419
- // The state of an increment: `State: done` in its inc-<n>.md (or a done slice) wins; otherwise the checked
432
+ // The state of an slice: `State: done` in its slice-<n>.md (or a done appetite) wins; otherwise the checked
420
433
  // steps of its section in plan.md say planned / building / done; with no steps, its own State (default specified).
421
- function incState(slice, inc, steps) {
422
- if (slice.status === 'done' || inc.stateRaw === 'done') return { state: 'done', done: 0, total: 0 };
434
+ function sliceState(appetite, slice, steps) {
435
+ if (appetite.status === 'done' || slice.stateRaw === 'done') return { state: 'done', done: 0, total: 0 };
423
436
  const fromPlan = stateOf(steps);
424
437
  if (fromPlan) return fromPlan;
425
- return { state: inc.stateRaw === 'planned' ? 'planned' : 'specified', done: 0, total: 0 };
438
+ return { state: slice.stateRaw === 'planned' ? 'planned' : 'specified', done: 0, total: 0 };
426
439
  }
427
440
 
428
441
  export function buildModel(dir) {
@@ -436,63 +449,63 @@ export function buildModel(dir) {
436
449
  t.col = i + 1;
437
450
  });
438
451
 
439
- const slicesDir = path.join(dir, 'slices');
440
- const sliceFiles = fs.existsSync(slicesDir) ? fs.readdirSync(slicesDir).filter((f) => /^\d+-.+\.md$/.test(f)).sort() : [];
441
- const slices = sliceFiles.map((f) => parseSlice(path.join(slicesDir, f))).sort((a, b) => a.nn - b.nn);
452
+ const appetitesDir = path.join(dir, 'appetites');
453
+ const appetiteFiles = fs.existsSync(appetitesDir) ? fs.readdirSync(appetitesDir).filter((f) => /^\d+-.+\.md$/.test(f)).sort() : [];
454
+ const appetites = appetiteFiles.map((f) => parseAppetite(path.join(appetitesDir, f))).sort((a, b) => a.nn - b.nn);
442
455
  const planFile = path.join(dir, 'plan.md');
443
456
  const plan = parsePlan(planFile);
444
457
 
445
458
  const taskOf = (featureCode, ut) => (features.find((f) => f.code === featureCode)?.tasks || []).find((t) => norm(t.name) === norm(ut)) || null;
446
459
  const issues = [];
447
460
 
448
- for (const slice of slices) {
449
- for (const opt of slice.options.values()) {
461
+ for (const appetite of appetites) {
462
+ for (const opt of appetite.options.values()) {
450
463
  opt.feature = opt.id.match(/^(F\d+)-/)[1];
451
464
  opt.task = taskOf(opt.feature, opt.ut);
452
465
  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`);
453
466
  }
454
- // the trace of the slice: its Steps in order, each with its live options and the ones pruned from it
467
+ // the trace of the appetite: its Steps in order, each with its live options and the ones pruned from it
455
468
  const stepOf = (id) => id.replace(/\.\d+$/, '');
456
469
  const trace = new Map();
457
470
  const stepRec = (key, ut) => {
458
471
  if (!trace.has(key)) {
459
472
  const [f, n] = key.split('-');
460
- const base = slice.steps.get(key) || { f, n: parseInt(n, 10), name: `Step ${n}`, kind: '', desc: '', note: '', ut };
473
+ const base = appetite.steps.get(key) || { f, n: parseInt(n, 10), name: `Step ${n}`, kind: '', desc: '', note: '', ut };
461
474
  const task = taskOf(f, base.ut);
462
- if (!task && slice.steps.has(key)) issues.push({ file: slice.file, line: 0, text: `${slice.base}/slicing/${f}.md: Step S${n} is under User Task "${base.ut}", which is not a User Task of ${f} in features.md` });
475
+ if (!task && appetite.steps.has(key)) issues.push({ file: appetite.file, line: 0, text: `${appetite.base}/slicing/${f}.md: Step S${n} is under User Task "${base.ut}", which is not a User Task of ${f} in features.md` });
463
476
  trace.set(key, { ...base, task, options: [] });
464
477
  }
465
478
  return trace.get(key);
466
479
  };
467
- for (const key of slice.steps.keys()) stepRec(key);
468
- for (const o of slice.options.values()) {
480
+ for (const key of appetite.steps.keys()) stepRec(key);
481
+ for (const o of appetite.options.values()) {
469
482
  stepRec(stepOf(o.id), o.ut).options.push({ id: o.id, name: o.name, desc: o.desc, strategy: o.strategy, target: o.target, state: 'live' });
470
483
  }
471
- for (const p of slice.pruned) {
484
+ for (const p of appetite.pruned) {
472
485
  const st = trace.get(stepOf(p.id));
473
486
  if (!st) {
474
- if (slice.steps.size) issues.push({ file: p.file, line: p.line, text: `pruned option ${p.id} has no Step in ${slice.base}/slicing/` });
487
+ if (appetite.steps.size) issues.push({ file: p.file, line: p.line, text: `pruned option ${p.id} has no Step in ${appetite.base}/slicing/` });
475
488
  continue;
476
489
  }
477
490
  st.options.push({ id: p.id, name: p.name, cat: p.cat, reason: p.reason, state: 'pruned' });
478
491
  }
479
492
  const num = (id) => parseInt(id.match(/\.(\d+)$/)[1], 10);
480
493
  for (const st of trace.values()) st.options.sort((a, b) => num(a.id) - num(b.id));
481
- slice.trace = [...trace.values()].sort((a, b) => a.f.localeCompare(b.f, undefined, { numeric: true }) || a.n - b.n);
494
+ appetite.trace = [...trace.values()].sort((a, b) => a.f.localeCompare(b.f, undefined, { numeric: true }) || a.n - b.n);
482
495
 
483
- const byId = new Map(slice.bites.map((b) => [b.id, b]));
496
+ const byId = new Map(appetite.bites.map((b) => [b.id, b]));
484
497
  const optionOwner = new Map();
485
- for (const bite of slice.bites) {
486
- const first = slice.options.get(bite.options[0]);
498
+ for (const bite of appetite.bites) {
499
+ const first = appetite.options.get(bite.options[0]);
487
500
  if (!first) {
488
- throw new RenderError(slice.file, bite.line, `bite ${bite.id}: its first option ${bite.options[0] || '(none)'} is not in ${slice.base}/slicing/`);
501
+ throw new RenderError(appetite.file, bite.line, `bite ${bite.id}: its first option ${bite.options[0] || '(none)'} is not in ${appetite.base}/slicing/`);
489
502
  }
490
503
  bite.feature = bite.id.match(/^(F\d+)-/)[1];
491
504
  bite.task = first.task;
492
505
  bite.resolved = bite.options.map((id) => {
493
- const o = slice.options.get(id);
494
- if (!o) issues.push({ file: slice.file, line: bite.line, text: `bite ${bite.id}: option ${id} is not in ${slice.base}/slicing/` });
495
- 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})` });
506
+ const o = appetite.options.get(id);
507
+ if (!o) issues.push({ file: appetite.file, line: bite.line, text: `bite ${bite.id}: option ${id} is not in ${appetite.base}/slicing/` });
508
+ if (optionOwner.has(id)) issues.push({ file: appetite.file, line: bite.line, text: `option ${id} is in two bites (${optionOwner.get(id)} and ${bite.id})` });
496
509
  optionOwner.set(id, bite.id);
497
510
  return { id, name: o ? o.name : '(not in the slicing)', task: o ? o.task : null };
498
511
  });
@@ -500,93 +513,109 @@ export function buildModel(dir) {
500
513
  bite.others = others;
501
514
  }
502
515
  const taker = new Map();
503
- for (const inc of slice.incs) {
504
- for (const id of inc.bites) {
505
- if (!byId.has(id)) throw new RenderError(slice.file, inc.line, `Inc ${inc.n}: bite ${id} has no line in ## Backlog`);
506
- 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}` });
507
- taker.set(id, inc.n);
516
+ for (const slice of appetite.slices) {
517
+ for (const id of slice.bites) {
518
+ if (!byId.has(id)) throw new RenderError(appetite.file, slice.line, `Slice ${slice.n}: bite ${id} has no line in ## Backlog`);
519
+ if (taker.has(id)) issues.push({ file: appetite.file, line: slice.line, text: `bite ${id} is taken by Slice ${taker.get(id)} and Slice ${slice.n}` });
520
+ taker.set(id, slice.n);
508
521
  }
509
- if (inc.bites.length === 0 && inc.options.length === 0 && inc.tags.length === 0) {
510
- 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>)`);
522
+ if (slice.bites.length === 0 && slice.options.length === 0 && slice.tags.length === 0) {
523
+ throw new RenderError(appetite.file, slice.line, `Slice ${slice.n} has no Bites: line (every Slice is made of bites; the skeleton ones are F<n>-w<k>)`);
511
524
  }
512
- for (const id of inc.options) {
513
- 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/` });
525
+ for (const id of slice.options) {
526
+ if (!appetite.options.has(id)) issues.push({ file: appetite.file, line: slice.line, text: `Slice ${slice.n}: option ${id} is not in ${appetite.base}/slicing/` });
514
527
  }
515
- const steps = plan.slices.get(slice.nn)?.get(inc.n) || null;
516
- inc.steps = steps;
517
- inc.st = incState(slice, inc, steps);
518
- if (!inc.detailFile) issues.push({ file: slice.file, line: inc.line, text: `Inc ${inc.n} has no ${slice.base}/inc-${inc.n}.md` });
519
- else if (inc.stateRaw === null) issues.push({ file: inc.detailFile, line: 1, text: 'no "- State:" line in the first lines' });
520
- else if (inc.stateRaw === 'draft') issues.push({ file: inc.detailFile, line: inc.stateLine, text: `Inc ${inc.n} is listed in the index but its file is still a draft (the ACs were never approved): finish \`bokata-inc\` or take the Inc out of ## Increments` });
521
- else if (!INC_STATES.includes(inc.stateRaw)) issues.push({ file: inc.detailFile, line: inc.stateLine, text: `unknown State "${inc.stateRaw}" (specified | planned | done)` });
522
- 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` });
523
- 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` });
528
+ const steps = plan.appetites.get(appetite.nn)?.get(slice.n) || null;
529
+ slice.steps = steps;
530
+ slice.st = sliceState(appetite, slice, steps);
531
+ if (!slice.detailFile) issues.push({ file: appetite.file, line: slice.line, text: `Slice ${slice.n} has no ${appetite.base}/slice-${slice.n}.md` });
532
+ else if (slice.stateRaw === null) issues.push({ file: slice.detailFile, line: 1, text: 'no "- State:" line in the first lines' });
533
+ else if (slice.stateRaw === 'draft') issues.push({ file: slice.detailFile, line: slice.stateLine, text: `Slice ${slice.n} is listed in the index but its file is still a draft (the ACs were never approved): finish \`bokata-spec\` or take the Slice out of ## Slices` });
534
+ else if (!SLICE_STATES.includes(slice.stateRaw)) issues.push({ file: slice.detailFile, line: slice.stateLine, text: `unknown State "${slice.stateRaw}" (specified | planned | done)` });
535
+ if (steps && steps.length && slice.stateRaw === 'done') issues.push({ file: planFile, line: 0, text: `Appetite ${appetite.nn} · Slice ${slice.n} is done but still has a section in plan.md — delete it` });
536
+ if (steps && steps.length && steps.every((s) => s.done) && slice.stateRaw !== 'done') issues.push({ file: slice.detailFile || appetite.file, line: slice.stateLine || slice.line, text: `every step of Slice ${slice.n} is checked: set "- State: done" and clean its section of plan.md` });
524
537
  }
525
- for (const bite of slice.bites) {
538
+ for (const bite of appetite.bites) {
526
539
  bite.takenBy = taker.get(bite.id) ?? bite.takenLine ?? null;
527
540
  if (bite.takenLine !== null && taker.has(bite.id) && taker.get(bite.id) !== bite.takenLine) {
528
- issues.push({ file: slice.file, line: bite.line, text: `bite ${bite.id} says → Inc ${bite.takenLine} but Inc ${taker.get(bite.id)} lists it` });
541
+ issues.push({ file: appetite.file, line: bite.line, text: `bite ${bite.id} says → Slice ${bite.takenLine} but Slice ${taker.get(bite.id)} lists it` });
529
542
  }
530
- if (bite.takenLine !== null && !slice.incs.some((i) => i.n === bite.takenLine)) {
531
- issues.push({ file: slice.file, line: bite.line, text: `bite ${bite.id} says → Inc ${bite.takenLine}, which is not in ## Increments` });
543
+ if (bite.takenLine !== null && !appetite.slices.some((i) => i.n === bite.takenLine)) {
544
+ issues.push({ file: appetite.file, line: bite.line, text: `bite ${bite.id} says → Slice ${bite.takenLine}, which is not in ## Slices` });
532
545
  }
533
546
  }
534
- // The proposed increments are edited by hand: say what a hand edit may have broken.
547
+ // The proposed slices are edited by hand: say what a hand edit may have broken.
535
548
  const rowOf = new Map();
536
- for (const p of slice.proposed) {
537
- if (slice.incs.some((i) => i.n === p.n)) issues.push({ file: slice.file, line: p.line, text: `proposed Inc ${p.n} is already in ## Increments — drop its row (or renumber it)` });
538
- if (slice.proposed.some((q) => q !== p && q.n === p.n && q.line < p.line)) issues.push({ file: slice.file, line: p.line, text: `Inc ${p.n} appears twice in ### Proposed increments` });
549
+ for (const p of appetite.proposed) {
550
+ if (appetite.slices.some((i) => i.n === p.n)) issues.push({ file: appetite.file, line: p.line, text: `proposed Slice ${p.n} is already in ## Slices — drop its row (or renumber it)` });
551
+ if (appetite.proposed.some((q) => q !== p && q.n === p.n && q.line < p.line)) issues.push({ file: appetite.file, line: p.line, text: `Slice ${p.n} appears twice in ### Proposed slices` });
539
552
  for (const id of p.bites) {
540
553
  const b = byId.get(id);
541
- if (!b) issues.push({ file: slice.file, line: p.line, text: `proposed Inc ${p.n}: bite ${id} has no line in ## Backlog` });
542
- else if (taker.has(id)) issues.push({ file: slice.file, line: p.line, text: `proposed Inc ${p.n}: bite ${id} is already taken by Inc ${taker.get(id)}` });
543
- if (rowOf.has(id) && rowOf.get(id) !== p.n) issues.push({ file: slice.file, line: p.line, text: `bite ${id} is in two proposed increments (Inc ${rowOf.get(id)} and Inc ${p.n})` });
554
+ if (!b) issues.push({ file: appetite.file, line: p.line, text: `proposed Slice ${p.n}: bite ${id} has no line in ## Backlog` });
555
+ else if (taker.has(id)) issues.push({ file: appetite.file, line: p.line, text: `proposed Slice ${p.n}: bite ${id} is already taken by Slice ${taker.get(id)}` });
556
+ if (rowOf.has(id) && rowOf.get(id) !== p.n) issues.push({ file: appetite.file, line: p.line, text: `bite ${id} is in two proposed slices (Slice ${rowOf.get(id)} and Slice ${p.n})` });
544
557
  rowOf.set(id, p.n);
545
558
  }
546
559
  }
547
- slice.proposed = slice.proposed.filter((p) => !slice.incs.some((i) => i.n === p.n));
548
- for (const p of slice.proposed) {
560
+ appetite.proposed = appetite.proposed.filter((p) => !appetite.slices.some((i) => i.n === p.n));
561
+ for (const p of appetite.proposed) {
549
562
  for (const id of p.bites) {
550
563
  const b = byId.get(id);
551
- if (b && b.takenBy === null) b.proposedInc = p.n;
564
+ if (b && b.takenBy === null) b.proposedSlice = p.n;
552
565
  }
553
566
  }
554
- // the tasks each Inc touches
555
- for (const inc of slice.incs) {
556
- const ofBites = inc.bites.map((id) => byId.get(id));
557
- inc.biteRecs = ofBites;
567
+ // the tasks each Slice touches
568
+ for (const slice of appetite.slices) {
569
+ const ofBites = slice.bites.map((id) => byId.get(id));
570
+ slice.biteRecs = ofBites;
558
571
  const opts = [];
559
572
  const seen = new Set();
560
573
  for (const b of ofBites) for (const o of b.resolved) if (!seen.has(o.id)) (seen.add(o.id), opts.push(o));
561
- for (const id of inc.options) {
574
+ for (const id of slice.options) {
562
575
  if (seen.has(id)) continue;
563
- const o = slice.options.get(id);
576
+ const o = appetite.options.get(id);
564
577
  seen.add(id);
565
578
  opts.push({ id, name: o ? o.name : '(not in the slicing)', task: o ? o.task : null });
566
579
  }
567
- inc.resolvedOptions = opts;
580
+ slice.resolvedOptions = opts;
568
581
  const fromTags = [];
569
582
  if (ofBites.length === 0 && opts.length === 0) {
570
- // the oldest slices only name the User Tasks, as **[User Task]** tags of the Inc heading
571
- for (const tag of inc.tags) {
583
+ // the oldest appetites only name the User Tasks, as **[User Task]** tags of the Slice heading
584
+ for (const tag of slice.tags) {
572
585
  const task = tasks.find((x) => norm(x.name) === norm(tag));
573
- if (!task) throw new RenderError(slice.file, inc.line, `Inc ${inc.n}: User Task "${tag}" is not in features.md`);
586
+ if (!task) throw new RenderError(appetite.file, slice.line, `Slice ${slice.n}: User Task "${tag}" is not in features.md`);
574
587
  fromTags.push(task);
575
588
  }
576
589
  }
577
590
  const ids = new Set([...ofBites.flatMap((b) => [b.task, ...b.others]), ...opts.map((o) => o.task), ...fromTags].filter(Boolean).map((t) => t.id));
578
- inc.taskIds = [...ids];
591
+ slice.taskIds = [...ids];
592
+ }
593
+ }
594
+ // ---- ## Learned: a known kind, an Affects: line, and Affects IDs that name something of the initiative ----
595
+ const known = new Set();
596
+ for (const a of appetites) {
597
+ for (const b of a.bites) known.add(b.id);
598
+ for (const id of a.options.keys()) known.add(id);
599
+ for (const p of a.pruned) known.add(p.id);
600
+ }
601
+ for (const a of appetites) {
602
+ for (const slice of a.slices) {
603
+ for (const l of slice.learned || []) {
604
+ if (!LEARNED_KINDS.includes(l.kind)) issues.push({ file: l.file, line: l.line, text: `Learned: "${l.kind}" is not one of ${LEARNED_KINDS.join(' | ')}` });
605
+ else if (!l.affects) issues.push({ file: l.file, line: l.line, text: 'Learned: this entry has no "Affects:" line (bite or option IDs, or none)' });
606
+ else for (const id of l.affects) if (!known.has(id)) issues.push({ file: l.file, line: l.affectsLine, text: `Learned: Affects names ${id}, which is no bite or option of this initiative` });
607
+ }
579
608
  }
580
609
  }
581
- return { initiative, features, tasks, slices, plan, issues, planFile };
610
+ return { initiative, features, tasks, appetites, plan, issues, planFile };
582
611
  }
583
612
 
584
613
  // ——— data for the page ———
585
614
 
586
- const sliceName = (base) => base.replace(/^\d+-/, '');
615
+ const appetiteName = (base) => base.replace(/^\d+-/, '');
587
616
 
588
617
  function dataOf(model, lang, date) {
589
- const { features, slices, plan } = model;
618
+ const { features, appetites, plan } = model;
590
619
  const out = {
591
620
  lang,
592
621
  date,
@@ -599,16 +628,16 @@ function dataOf(model, lang, date) {
599
628
  systemTasks: f.systemTasks,
600
629
  tasks: f.tasks.map((t) => ({ id: t.id, name: t.name, desc: t.description }))
601
630
  })),
602
- slices: []
631
+ appetites: []
603
632
  };
604
- for (const s of slices) {
633
+ for (const s of appetites) {
605
634
  const k = (id) => `${s.nn}-${id}`;
606
635
  const sl = {
607
636
  nn: s.nn,
608
- name: sliceName(s.base),
637
+ name: appetiteName(s.base),
609
638
  base: s.base,
610
639
  status: s.status,
611
- incs: [],
640
+ slices: [],
612
641
  bites: [],
613
642
  trace: s.trace.map((st) => ({ f: st.f, n: st.n, name: st.name, kind: st.kind, desc: st.desc, note: st.note, task: st.task ? st.task.id : null, options: st.options }))
614
643
  };
@@ -620,7 +649,7 @@ function dataOf(model, lang, date) {
620
649
  priority: b.priority,
621
650
  reason: b.reason,
622
651
  taken: b.takenBy,
623
- proposedInc: b.proposedInc || null,
652
+ proposedSlice: b.proposedSlice || null,
624
653
  value: b.value,
625
654
  check: b.check,
626
655
  dependsOn: b.dependsOn,
@@ -628,11 +657,11 @@ function dataOf(model, lang, date) {
628
657
  anchor: b.task.id,
629
658
  others: b.others.map((t) => t.id),
630
659
  feature: b.feature,
631
- source: `slices/${s.base}.md:${b.line}`
660
+ source: `appetites/${s.base}.md:${b.line}`
632
661
  });
633
662
  }
634
- for (const i of s.incs) {
635
- sl.incs.push({
663
+ for (const i of s.slices) {
664
+ sl.slices.push({
636
665
  key: `${s.nn}-${i.n}`,
637
666
  n: i.n,
638
667
  name: i.name,
@@ -645,13 +674,14 @@ function dataOf(model, lang, date) {
645
674
  tasks: i.taskIds,
646
675
  unknowns: i.unknowns,
647
676
  pending: i.pending,
677
+ learned: i.learned.map((l) => ({ kind: l.kind, text: l.text, affects: l.affects || [] })),
648
678
  body: markdown(i.body),
649
- source: i.detailFile ? `slices/${s.base}/inc-${i.n}.md` : `slices/${s.base}.md:${i.line}`,
679
+ source: i.detailFile ? `appetites/${s.base}/slice-${i.n}.md` : `appetites/${s.base}.md:${i.line}`,
650
680
  proposed: false
651
681
  });
652
682
  }
653
683
  for (const p of s.proposed) {
654
- sl.incs.push({
684
+ sl.slices.push({
655
685
  key: `${s.nn}-${p.n}`,
656
686
  n: p.n,
657
687
  name: p.name,
@@ -665,56 +695,56 @@ function dataOf(model, lang, date) {
665
695
  unknowns: '',
666
696
  pending: [],
667
697
  body: p.why ? `<p><b>Why this order:</b> ${inline(p.why)}</p>` : '',
668
- source: `slices/${s.base}.md:${p.line} (## Backlog › Proposed increments)`,
698
+ source: `appetites/${s.base}.md:${p.line} (## Backlog › Proposed slices)`,
669
699
  proposed: true
670
700
  });
671
701
  }
672
- out.slices.push(sl);
702
+ out.appetites.push(sl);
673
703
  }
674
704
  return out;
675
705
  }
676
706
 
677
- // The next thing to do, in the order the flow goes: an unchecked plan step; a specified Inc with no plan
678
- // (bokata-plan); with nothing in flight, the first proposed increment (bokata-inc).
707
+ // The next thing to do, in the order the flow goes: an unchecked plan step; a specified Slice with no plan
708
+ // (bokata-plan); with nothing in flight, the first proposed slice (bokata-spec).
679
709
  function nextStep(model) {
680
- for (const slice of model.slices) {
681
- if (slice.status !== 'open') continue;
682
- const sections = model.plan.slices.get(slice.nn);
710
+ for (const appetite of model.appetites) {
711
+ if (appetite.status !== 'open') continue;
712
+ const sections = model.plan.appetites.get(appetite.nn);
683
713
  if (!sections) continue;
684
714
  for (const steps of sections.values()) {
685
715
  const open = steps.find((s) => !s.done);
686
- if (open) return { text: `${open.text.replace(/`/g, '')} — ${slice.base}`, link: 'plan.md' };
716
+ if (open) return { text: `${open.text.replace(/`/g, '')} — ${appetite.base}`, link: 'plan.md' };
687
717
  }
688
718
  }
689
- for (const slice of model.slices) {
690
- if (slice.status !== 'open') continue;
691
- const specified = slice.incs.find((i) => i.st.state === 'specified');
692
- if (specified) return { text: `bokata-plan — Inc ${specified.n} ${specified.name} (${slice.base})`, link: `${slice.base}/inc-${specified.n}.md` };
693
- const inFlight = slice.incs.some((i) => i.st.state !== 'done');
694
- if (!inFlight && slice.proposed.length) {
695
- const p = slice.proposed[0];
696
- return { text: `bokata-inc — Inc ${p.n} ${p.name} (${slice.base})`, link: `${slice.base}.md` };
719
+ for (const appetite of model.appetites) {
720
+ if (appetite.status !== 'open') continue;
721
+ const specified = appetite.slices.find((i) => i.st.state === 'specified');
722
+ if (specified) return { text: `bokata-plan — Slice ${specified.n} ${specified.name} (${appetite.base})`, link: `${appetite.base}/slice-${specified.n}.md` };
723
+ const inFlight = appetite.slices.some((i) => i.st.state !== 'done');
724
+ if (!inFlight && appetite.proposed.length) {
725
+ const p = appetite.proposed[0];
726
+ return { text: `bokata-spec — Slice ${p.n} ${p.name} (${appetite.base})`, link: `${appetite.base}.md` };
697
727
  }
698
728
  }
699
729
  return null;
700
730
  }
701
731
 
702
732
  function counts(model) {
703
- let incTotal = 0;
704
- let incDone = 0;
733
+ let sliceTotal = 0;
734
+ let sliceDone = 0;
705
735
  let stepTotal = 0;
706
736
  let stepDone = 0;
707
737
  let bitesLeft = 0;
708
- for (const s of model.slices) {
709
- for (const i of s.incs) {
710
- incTotal += 1;
711
- if (i.st.state === 'done') incDone += 1;
738
+ for (const s of model.appetites) {
739
+ for (const i of s.slices) {
740
+ sliceTotal += 1;
741
+ if (i.st.state === 'done') sliceDone += 1;
712
742
  stepTotal += i.st.total;
713
743
  stepDone += i.st.done;
714
744
  }
715
745
  bitesLeft += s.bites.filter((b) => b.takenBy === null).length;
716
746
  }
717
- return { incTotal, incDone, stepTotal, stepDone, bitesLeft };
747
+ return { sliceTotal, sliceDone, stepTotal, stepDone, bitesLeft };
718
748
  }
719
749
 
720
750
  export function render(dir, { lang = 'en', date = new Date().toISOString().slice(0, 10) } = {}) {
@@ -729,7 +759,7 @@ export function render(dir, { lang = 'en', date = new Date().toISOString().slice
729
759
  const html = fs.readFileSync(TEMPLATE, 'utf8').replace(/\{\{(\w+)\}\}/g, (_, key) => String(values[key] ?? ''));
730
760
  return {
731
761
  html,
732
- summary: `story-map.html updated (${c.incDone}/${c.incTotal} increments, ${c.stepDone}/${c.stepTotal} steps, ${c.bitesLeft} bites left)`
762
+ summary: `story-map.html updated (${c.sliceDone}/${c.sliceTotal} slices, ${c.stepDone}/${c.stepTotal} steps, ${c.bitesLeft} bites left)`
733
763
  };
734
764
  }
735
765
 
@@ -742,11 +772,11 @@ export function check(dir) {
742
772
  if (!(err instanceof RenderError)) throw err;
743
773
  return { problems: [{ file: err.file, line: err.line, text: err.reason }], summary: '' };
744
774
  }
745
- const bites = model.slices.reduce((n, s) => n + s.bites.length, 0);
746
- const incs = model.slices.reduce((n, s) => n + s.incs.length, 0);
775
+ const bites = model.appetites.reduce((n, s) => n + s.bites.length, 0);
776
+ const slices = model.appetites.reduce((n, s) => n + s.slices.length, 0);
747
777
  return {
748
778
  problems: model.issues,
749
- summary: `ok — ${model.features.length} Features, ${model.slices.length} slices, ${incs} increments, ${bites} bites`
779
+ summary: `ok — ${model.features.length} Features, ${model.appetites.length} appetites, ${slices} slices, ${bites} bites`
750
780
  };
751
781
  }
752
782