bokata 3.0.0-beta.4 → 3.0.0-beta.6

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.
@@ -46,7 +46,7 @@ code{background:#eef0f4;padding:0 4px;border-radius:3px;font-size:.92em}
46
46
  .lab .m{font-size:11.5px;color:var(--mute);margin-top:3px}
47
47
  .pill{display:inline-block;font-size:10.5px;font-weight:600;border-radius:999px;padding:1px 8px;border:1px solid;vertical-align:1px}
48
48
  .p-done{background:var(--done);border-color:var(--done-b);color:#1e6b36}.p-building{background:var(--build);border-color:var(--build-b);color:#8a5d00}
49
- .p-sliced,.p-planned,.p-proposed{background:var(--plan);border-color:var(--plan-b);color:#2f56b0}.p-open{background:#eee;border-color:#ccc;color:#555}
49
+ .p-specified,.p-planned,.p-proposed{background:var(--plan);border-color:var(--plan-b);color:#2f56b0}.p-open{background:#eee;border-color:#ccc;color:#555}
50
50
  .bar{height:4px;background:#e5e7eb;border-radius:3px;margin-top:4px;overflow:hidden}.bar i{display:block;height:100%;background:var(--build-b)}
51
51
  .card{display:flex;flex-direction:column;gap:2px;margin:3px 5px;padding:6px 8px;border-radius:8px;border:1.5px solid;font-size:12px;line-height:1.3;min-height:44px;overflow:hidden;position:relative}
52
52
  .card:hover{box-shadow:0 2px 8px rgba(0,0,0,.18);z-index:5}
@@ -106,6 +106,54 @@ pre.gh span{display:block}.g-sc{font-weight:700;color:#14326e}.g-st i{font-style
106
106
  .detail table{border-collapse:collapse;margin:8px 0;font-size:12.5px}.detail td,.detail th{border:1px solid var(--line);padding:4px 8px;text-align:left}
107
107
  .banner{background:#fff7e0;border:1px solid #ecd48a;border-radius:8px;padding:8px 12px;margin:8px 16px;font-size:12.5px}
108
108
  .tbl{width:100%;border-collapse:collapse;font-size:13px}.tbl td,.tbl th{border-bottom:1px solid var(--line);padding:6px 8px;text-align:left;vertical-align:top}
109
+ /* layers: the options of every Step, a Step per row */
110
+ .page.wide{max-width:none;padding-left:24px;padding-right:24px}
111
+ .bocata{width:max-content;min-width:100%}
112
+ .bocata-wrap{overflow-x:auto;padding-bottom:8px}
113
+ .bread{background:#f6e7c8;border:1.5px solid #dcc08a;color:#4a3714;padding:10px 18px;font-size:13px;position:relative}
114
+ .bread.top{border-radius:46px 46px 8px 8px/28px 28px 8px 8px;padding-top:14px}
115
+ .bread.bot{border-radius:8px 8px 34px 34px/8px 8px 22px 22px;padding-bottom:14px}
116
+ .bread .in{position:sticky;left:20px;max-width:min(980px,86vw)}
117
+ .bread .ol{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;font-weight:700;opacity:.7}
118
+ .bread p{margin:1px 0 6px;font-size:14.5px}
119
+ .bread .chips{margin:2px 0 0}
120
+ .bread .chip{background:#fffaf0;border-color:#dcc08a}
121
+ .layers{--cw:238px;--lw:200px;width:max-content;min-width:100%;margin:8px 0}
122
+ .layers.lz1{--cw:300px}.layers.lz2{--cw:238px}.layers.lz3{--cw:170px;--lw:170px}.layers.lz4{--cw:116px;--lw:130px}
123
+ .lrow{display:grid;grid-template-columns:var(--lw) repeat(var(--n), var(--cw));border-top:1px solid var(--line);padding:6px 0}
124
+ .lrow:first-child{border-top:0}
125
+ .llab{position:sticky;left:0;z-index:5;background:var(--bg);padding:6px 12px 6px 4px;margin-right:6px;display:flex;flex-direction:column;gap:3px;align-items:flex-start;border-radius:8px}
126
+ .llab b{font-size:13.5px;line-height:1.25}
127
+ .llab small{color:var(--mute);font-size:11px}
128
+ .kd{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;border-radius:4px;padding:1px 6px;color:#fff}
129
+ .kd-logic{background:#7c5cc4}.kd-ui{background:#3f7fd8}.kd-int{background:#d9822b}.kd-data{background:#3f9a6a}
130
+ .ut-sep{position:sticky;left:0;width:max-content;font-size:11px;text-transform:uppercase;letter-spacing:.06em;font-weight:700;color:var(--mute);padding:12px 4px 2px;border-top:2px solid var(--line)}
131
+ .ut-sep:first-child{border-top:0;padding-top:4px}
132
+ .card.opt{margin:3px 5px;min-height:0;overflow:visible;gap:3px}
133
+ .card.opt .id{flex-wrap:wrap}
134
+ .card.opt .ti{-webkit-line-clamp:6;font-weight:600;font-size:12.5px}
135
+ .card.opt .de{font-size:11.5px;color:#3d4452;display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden}
136
+ .card.opt .cx{font-size:10.5px;color:var(--mute)}
137
+ .card.opt .bt{margin-top:auto;font-size:10.5px;font-weight:700;display:flex;gap:5px;align-items:center;flex-wrap:wrap;padding-top:3px}
138
+ .card.opt.other{opacity:.82}
139
+ .card.opt.other:hover{opacity:1}
140
+ .card.mine{box-shadow:0 0 0 2.5px var(--ink);opacity:1}
141
+ .card.mine .star{margin-left:auto;font-size:14px;line-height:1}
142
+ .tg{color:#b4551b;font-weight:700}
143
+ .card.pruned{background:repeating-linear-gradient(135deg,#f3f4f6,#f3f4f6 6px,#e9ebef 6px,#e9ebef 12px);border:1.5px dashed #9aa1ad;color:#59606d}
144
+ .card.pruned .ti{text-decoration:line-through;text-decoration-color:#aab0bb;font-weight:500}
145
+ .card.pruned .why{font-size:11.5px;color:#454b57}
146
+ .cat{font-size:9.5px;font-weight:700;border-radius:4px;padding:0 5px;margin-left:auto;text-transform:uppercase;letter-spacing:.03em;background:#dfe2e8;color:#444b57}
147
+ .cat-contradicts{background:#f6d6d2;color:#8d2a20}.cat-dominated{background:#e6dcf4;color:#523a80}.cat-obsolete{background:#d8e6f1;color:#2d4c66}.cat-filler{background:#ebe9e2;color:#6b675c}
148
+ .layers.hide-pruned .card.pruned{display:none}
149
+ .layers.lz3 .card.opt .de,.layers.lz3 .card.opt .cx,.layers.lz4 .card.opt .de,.layers.lz4 .card.opt .cx,.layers.lz4 .card.pruned .why{display:none}
150
+ .layers.lz3 .card.opt .ti,.layers.lz4 .card.opt .ti{font-size:11.5px;-webkit-line-clamp:4}
151
+ .layers.lz4 .card.opt .bt{font-size:9.5px}
152
+ .lbar{display:flex;gap:14px;align-items:center;flex-wrap:wrap;margin:10px 0 4px;font-size:12.5px;color:var(--mute)}
153
+ .lbar .legend{margin-left:0}
154
+ .lbar .sw-mine{display:inline-block;width:12px;height:12px;border-radius:3px;background:#fff;border:1.5px solid #999;box-shadow:0 0 0 2px var(--ink);vertical-align:-2px;margin-right:5px}
155
+ .lbar .lg-pruned{background:repeating-linear-gradient(135deg,#f3f4f6,#f3f4f6 3px,#dfe2e8 3px,#dfe2e8 6px);border-color:#9aa1ad!important;border-style:dashed!important}
156
+ .sumline{color:var(--mute);font-size:12.5px;margin:2px 0 6px}
109
157
  </style>
110
158
  </head>
111
159
  <body>
@@ -118,7 +166,7 @@ const ES = String(D.lang || 'en').toLowerCase().startsWith('es');
118
166
  const I = {
119
167
  en: {
120
168
  zoom: 'Zoom', fold: 'Fold features', unfold: 'Unfold features', empty: 'Only columns with cards', minimap: 'Minimap', state: 'State', priority: 'Priority',
121
- done: 'done', building: 'building', planned: 'planned', sliced: 'sliced', proposed: 'proposed', back: 'untaken', open: 'open',
169
+ done: 'done', building: 'building', planned: 'planned', specified: 'specified', proposed: 'proposed', back: 'untaken', open: 'open',
122
170
  must: 'must', nice: 'nice', def: 'def', backlog: 'Backlog', backlogSub: 'Untaken bites, by priority', bitesN: (n) => `${n} ${n === 1 ? 'bite' : 'bites'}`, noBites: 'no bites', scN: (n) => `${n} sc.`,
123
171
  map: 'Map', mapBack: '← Map', slice: 'Slice', incsDone: (a, b) => `${a}/${b} Incs done`, bitesTotal: (n) => `${n} bites`,
124
172
  summary: (f, u, a, b, n) => `${f} features · ${u} user tasks · ${a}/${b} Incs · ${n} bites untaken`,
@@ -139,7 +187,7 @@ const I = {
139
187
  },
140
188
  es: {
141
189
  zoom: 'Zoom', fold: 'Plegar features', unfold: 'Desplegar features', empty: 'Solo columnas con tarjetas', minimap: 'Minimapa', state: 'Estado', priority: 'Prioridad',
142
- done: 'hecho', building: 'en curso', planned: 'planificado', sliced: 'cortado', proposed: 'propuesto', back: 'sin tomar', open: 'abierto',
190
+ done: 'hecho', building: 'en curso', planned: 'planificado', specified: 'especificado', proposed: 'propuesto', back: 'sin tomar', open: 'abierto',
143
191
  must: 'must', nice: 'nice', def: 'def', backlog: 'Backlog', backlogSub: 'Bites sin tomar, por prioridad', bitesN: (n) => `${n} ${n === 1 ? 'bite' : 'bites'}`, noBites: 'sin bites', scN: (n) => `${n} esc.`,
144
192
  map: 'Mapa', mapBack: '← Mapa', slice: 'Slice', incsDone: (a, b) => `${a}/${b} Incs hechos`, bitesTotal: (n) => `${n} bites`,
145
193
  summary: (f, u, a, b, n) => `${f} features · ${u} user tasks · ${a}/${b} Incs · ${n} bites sin tomar`,
@@ -171,19 +219,19 @@ const sliceByNn = {}, biteByKey = {}, incByKey = {};
171
219
  D.slices.forEach((s) => { sliceByNn[s.nn] = s; s.bites.forEach((b) => (biteByKey[b.key] = b)); s.incs.forEach((i) => { i.slice = s.nn; incByKey[i.key] = i; }); });
172
220
  D.slices.forEach((s) => s.bites.forEach((b) => { b.slice = s.nn; const n = b.taken || b.proposedInc; b.stateInc = n ? incByKey[`${s.nn}-${n}`] || null : null; }));
173
221
 
174
- const ui = { minimap: true, zoom: 2, collapsed: new Set(), hideEmpty: false, state: null, prio: null, closed: new Set() };
222
+ const ui = { minimap: true, zoom: 2, lz: 2, hidePruned: false, collapsed: new Set(), hideEmpty: false, state: null, prio: null, closed: new Set() };
175
223
  try {
176
224
  Object.assign(ui, JSON.parse(sessionStorage.getItem('mapui') || '{}'), { collapsed: new Set(JSON.parse(sessionStorage.getItem('mapcol') || '[]')), closed: new Set() });
177
225
  } catch (e) {}
178
- const save = () => { try { sessionStorage.setItem('mapui', JSON.stringify({ zoom: ui.zoom, hideEmpty: ui.hideEmpty, minimap: ui.minimap })); sessionStorage.setItem('mapcol', JSON.stringify([...ui.collapsed])); } catch (e) {} };
226
+ const save = () => { try { sessionStorage.setItem('mapui', JSON.stringify({ zoom: ui.zoom, lz: ui.lz, hidePruned: ui.hidePruned, hideEmpty: ui.hideEmpty, minimap: ui.minimap })); sessionStorage.setItem('mapcol', JSON.stringify([...ui.collapsed])); } catch (e) {} };
179
227
 
180
- // done | building | planned (sliced too) | proposed | back (untaken)
228
+ // done | building | planned (specified too) | proposed | back (untaken)
181
229
  const cardState = (b) => {
182
230
  const i = b.stateInc;
183
231
  if (!i) return 'back';
184
- return i.state === 'sliced' ? 'planned' : i.state;
232
+ return i.state === 'specified' ? 'planned' : i.state;
185
233
  };
186
- const incClass = (i) => (i.state === 'sliced' ? 'planned' : i.state);
234
+ const incClass = (i) => (i.state === 'specified' ? 'planned' : i.state);
187
235
  const pad2 = (n) => String(n).padStart(2, '0');
188
236
 
189
237
  /* ---------- map ---------- */
@@ -368,7 +416,120 @@ function viewInc(key) {
368
416
  ${i.body ? `<details class="more"><summary>${t('detail', i.scenarios)}</summary><div class="detail">${i.body}</div></details>` : ''}
369
417
  ${src(i.source)}</div>`;
370
418
  }
419
+ /* ---------- layers: the options of every Step, a Step per row (bite page and User Task page) ---------- */
420
+ Object.assign(I.en, {
421
+ layersTitle: 'Layers', utLayersTitle: 'All the options of each step', thisBite: 'this bite', pruned: 'pruned', hidePruned: 'Hide pruned',
422
+ stepsN: (n) => `${n} ${n === 1 ? 'step' : 'steps'}`, target: 'step target',
423
+ layersSum: (m, o, p) => `${m} options in this bite · ${o} in other bites · ${p} pruned`,
424
+ utSum: (l, p) => `${l} live options · ${p} pruned`, utHint: 'Every option of each step, coloured by the bite that takes it. This is where bites will be chosen.',
425
+ top: 'What the user gets', bottom: 'How it is checked', skelCheck: 'The skeleton is checked with the acceptance criteria of its increment.', untakenTag: 'untaken'
426
+ });
427
+ Object.assign(I.es, {
428
+ layersTitle: 'Capas', utLayersTitle: 'Todas las opciones de cada step', thisBite: 'este bite', pruned: 'podada', hidePruned: 'Ocultar podadas',
429
+ stepsN: (n) => `${n} ${n === 1 ? 'step' : 'steps'}`, target: 'meta del step',
430
+ layersSum: (m, o, p) => `${m} opciones en este bite · ${o} en otros bites · ${p} podadas`,
431
+ utSum: (l, p) => `${l} opciones vivas · ${p} podadas`, utHint: 'Todas las opciones de cada step, coloreadas por el bite que las toma. Aquí se elegirán los bites.',
432
+ top: 'Qué consigue el usuario', bottom: 'Cómo se comprueba', skelCheck: 'El esqueleto se comprueba con los criterios de aceptación de su incremento.', untakenTag: 'sin tomar'
433
+ });
434
+ const KIND = { Logic: 'kd-logic', UI: 'kd-ui', Integration: 'kd-int', Data: 'kd-data' };
435
+ const LZ = ['', 'L', 'M', 'S', 'XS'];
436
+ const biteOfOpt = {}, incOfOpt = {};
437
+ D.slices.forEach((s) => {
438
+ const m = (biteOfOpt[s.nn] = {}); s.bites.forEach((b) => b.options.forEach((o) => { m[o.id] = b; }));
439
+ const l = (incOfOpt[s.nn] = {}); s.incs.filter((i) => !i.proposed).forEach((i) => i.options.forEach((o) => { if (!m[o.id]) l[o.id] = i; })); // older slices: an Inc lists loose options, no bites
440
+ });
441
+ const incTag = (b) => (b.stateInc ? `Inc ${b.stateInc.n}` : t('untakenTag'));
442
+ const stepKeyOf = (id) => id.replace(/^(F\d+-\d+)\..*$/, '$1');
443
+
444
+ function optCard(o, owner, mine, loose) {
445
+ if (o.state === 'pruned') {
446
+ return `<div class="card opt pruned" title="${esc(o.cat)}"><span class="id">${o.id}<span class="cat cat-${o.cat}">${esc(o.cat)}</span></span><span class="ti">${esc(o.name)}</span><span class="why">${esc(o.reason)}</span></div>`;
447
+ }
448
+ const b = owner[o.id];
449
+ if (!b) {
450
+ const inc = loose[o.id];
451
+ const body = `<span class="id">${o.id}${o.target ? `<span class="tg" title="${t('target')}">◎</span>` : ''}</span><span class="ti">${esc(o.name)}</span>${o.desc ? `<span class="de">${esc(o.desc)}</span>` : ''}${o.strategy ? `<span class="cx">${esc(o.strategy)}</span>` : ''}`;
452
+ return inc
453
+ ? `<a class="card opt other c-${incClass(inc)}" href="#/inc/${inc.key}">${body}<span class="bt"><u>Inc ${inc.n}</u></span></a>`
454
+ : `<div class="card opt c-back">${body}<span class="bt">${t('untakenTag')}</span></div>`;
455
+ }
456
+ const isMine = mine && b === mine;
457
+ const inner = `<span class="id">${o.id}${o.target ? `<span class="tg" title="${t('target')}">◎</span>` : ''}${isMine ? '<span class="star">★</span>' : ''}</span>`
458
+ + `<span class="ti">${esc(o.name)}</span>${o.desc ? `<span class="de">${esc(o.desc)}</span>` : ''}${o.strategy ? `<span class="cx">${esc(o.strategy)}</span>` : ''}`
459
+ + (isMine ? '' : `<span class="bt"><u>${b.id}</u> · ${incTag(b)}</span>`);
460
+ return isMine
461
+ ? `<div class="card opt mine c-${cardState(b)}">${inner}</div>`
462
+ : `<a class="card opt other c-${cardState(b)}" href="#/bite/${b.key}" title="${esc(b.id + ' · ' + b.title)}">${inner}</a>`;
463
+ }
464
+ function layers(slice, steps, mine) {
465
+ const owner = biteOfOpt[slice.nn], loose = incOfOpt[slice.nn];
466
+ const N = Math.max(1, ...steps.map((s) => s.options.length));
467
+ let h = `<div class="layers lz${ui.lz}${ui.hidePruned ? ' hide-pruned' : ''}" style="--n:${N}">`;
468
+ let last = null;
469
+ steps.forEach((s) => {
470
+ if (s.task !== last) { last = s.task; h += `<div class="ut-sep">${esc(taskById[s.task] ? taskById[s.task].name : '—')}</div>`; }
471
+ h += `<div class="lrow"><div class="llab">${s.kind ? `<span class="kd ${KIND[s.kind] || ''}">${esc(s.kind)}</span>` : ''}<b>${esc(s.name)}</b><small>${s.f}-S${s.n}</small></div>`;
472
+ s.options.forEach((o) => { h += optCard(o, owner, mine, loose); });
473
+ h += `</div>`;
474
+ });
475
+ return h + `</div>`;
476
+ }
477
+ const layerBar = (withMine) => `<div class="lbar"><label><input type="checkbox" id="hp" ${ui.hidePruned ? 'checked' : ''}> ${t('hidePruned')}</label>`
478
+ + `<span class="tool">${t('zoom')} <button data-lz="-1">−</button><b id="lzl">${LZ[ui.lz]}</b><button data-lz="1">+</button></span>`
479
+ + `<span class="legend">${withMine ? `<span><i class="sw-mine"></i>${t('thisBite')}</span>` : ''}<span><i class="lg-done"></i>${t('done')}</span><span><i class="lg-build"></i>${t('building')}</span><span><i class="lg-planned"></i>${t('planned')}</span><span><i class="lg-plan"></i>${t('proposed')}</span><span><i class="lg-back"></i>${t('back')}</span><span><i class="lg-pruned"></i>${t('pruned')}</span><span><b class="tg">◎</b> ${t('target')}</span></span></div>`;
480
+ const wireBar = () => {
481
+ const hp = $('#hp');
482
+ if (hp) hp.onchange = () => { ui.hidePruned = hp.checked; document.querySelectorAll('.layers').forEach((l) => l.classList.toggle('hide-pruned', hp.checked)); save(); };
483
+ document.querySelectorAll('[data-lz]').forEach((e) => e.addEventListener('click', () => {
484
+ ui.lz = Math.max(1, Math.min(4, ui.lz + +e.dataset.lz)); save();
485
+ document.querySelectorAll('.layers').forEach((l) => { l.className = l.className.replace(/\blz\d\b/, `lz${ui.lz}`); });
486
+ const l = $('#lzl'); if (l) l.textContent = LZ[ui.lz];
487
+ }));
488
+ };
489
+ const countOpts = (steps, owner, mine) => {
490
+ let m = 0, o = 0, p = 0;
491
+ steps.forEach((s) => s.options.forEach((x) => { if (x.state === 'pruned') p++; else if (mine && owner[x.id] === mine) m++; else o++; }));
492
+ return [m, o, p];
493
+ };
494
+
371
495
  function viewBite(key) {
496
+ const b = biteByKey[key]; if (!b) return notFound();
497
+ const s = sliceByNn[b.slice];
498
+ const keys = new Set(b.options.map((o) => stepKeyOf(o.id)));
499
+ const steps = (s.trace || []).filter((x) => keys.has(`${x.f}-${x.n}`));
500
+ if (!steps.length) return viewBiteFlat(key); // slices cut before the steps were written down: the plain list
501
+ const tasks = [b.anchor, ...b.others].filter(Boolean);
502
+ const [m, o, p] = countOpts(steps, biteOfOpt[s.nn], b);
503
+ $('#app').innerHTML = `<div class="page wide">${crumbs(sliceLabel(s), `Bite ${b.id}`)}
504
+ <h1>${b.id} · ${esc(b.title)}</h1>
505
+ <div class="chips"><span class="chip pr-${b.priority}" style="${b.priority === 'must-have' ? 'background:var(--ink);color:#fff' : ''}">${esc(b.priority === 'deferred' && b.reason ? `deferred: ${b.reason}` : b.priority)}</span>
506
+ ${b.stateInc ? incChip(b.stateInc) : `<span class="pill p-open">${t('notTaken')}</span>`}${chipF(b.feature)}<span class="chip">${t('stepsN', steps.length)}</span></div>
507
+ ${layerBar(true)}
508
+ <div class="bocata-wrap"><div class="bocata">
509
+ <div class="bread top"><div class="in">${b.value ? `<div class="ol">${t('top')}</div><p>${esc(b.value)}</p>` : ''}
510
+ ${b.dependsOn ? `<div class="ol">${t('dependsOn')}</div><p>${esc(b.dependsOn)}</p>` : ''}
511
+ <div class="ol">${t('userTasks')}</div><div class="chips">${tasks.map(chipUT).join('')}</div></div></div>
512
+ ${layers(s, steps, b)}
513
+ <div class="bread bot"><div class="in"><div class="ol">${t('bottom')}</div><p>${b.check ? esc(b.check) : t('skelCheck')}</p></div></div>
514
+ </div></div>
515
+ <div class="sumline">${t('layersSum', m, o, p)}</div>
516
+ ${src(b.source)}</div>`;
517
+ wireBar();
518
+ }
519
+ function utLayers(id) {
520
+ let live = 0, pruned = 0;
521
+ const parts = D.slices.map((s) => {
522
+ const steps = (s.trace || []).filter((x) => x.task === id);
523
+ if (!steps.length) return '';
524
+ const [m, o, p] = countOpts(steps, biteOfOpt[s.nn], null);
525
+ live += m + o; pruned += p;
526
+ return `${D.slices.length > 1 ? `<p class="muted" style="margin:14px 0 0">${sliceLabel(s)}</p>` : ''}<div class="bocata-wrap"><div class="bocata">${layers(s, steps, null)}</div></div>`;
527
+ }).join('');
528
+ if (!parts) return '';
529
+ return `<h2>${t('utLayersTitle')}</h2><p class="muted" style="margin:0">${t('utHint')}</p>${layerBar(false)}${parts}<div class="sumline">${t('utSum', live, pruned)}</div>`;
530
+ }
531
+
532
+ function viewBiteFlat(key) {
372
533
  const b = biteByKey[key]; if (!b) return notFound();
373
534
  const s = sliceByNn[b.slice];
374
535
  const tasks = [b.anchor, ...b.others].filter(Boolean);
@@ -389,12 +550,13 @@ function viewUT(id) {
389
550
  const opts = s.incs.reduce((a, i) => a + i.options.filter((o) => o.task === id).length, 0);
390
551
  return { s, bs, incs, opts };
391
552
  });
392
- $('#app').innerHTML = `<div class="page">${crumbs(`<a href="#/feature/${f.code}">${f.code} ${esc(f.name)}</a>`, 'User Task')}
553
+ $('#app').innerHTML = `<div class="page wide">${crumbs(`<a href="#/feature/${f.code}">${f.code} ${esc(f.name)}</a>`, 'User Task')}
393
554
  <h1>${esc(x.name)}</h1><div class="chips">${chipF(f.code)}</div>
394
555
  ${x.desc ? `<p>${esc(x.desc)}</p>` : ''}
395
556
  <h2>${t('covered')}</h2>
396
557
  <table class="tbl"><tr><th>${t('thSlice')}</th><th>${t('thIncs')}</th><th>${t('thBites')}</th><th>${t('thOpts')}</th></tr>
397
558
  ${rows.map((r) => `<tr><td>${t('slice')} ${pad2(r.s.nn)}</td><td class="chips">${r.incs.map(incChip).join('') || '<span class="muted">—</span>'}</td><td>${r.bs.length ? `<div class="grid" style="grid-template-columns:repeat(auto-fill,minmax(190px,1fr))">${r.bs.map(miniCard).join('')}</div>` : '<span class="muted">—</span>'}</td><td>${r.opts || '—'}</td></tr>`).join('')}</table>
559
+ ${utLayers(id)}
398
560
  ${src('features.md', t('desc'))}</div>`;
399
561
  }
400
562
  function viewFeature(code) {
@@ -29,7 +29,11 @@ const OPTION_ID = /F\d+-\d+\.\d+/g;
29
29
  // Bite IDs: letters per Feature (F1-a, F1-ab), d<n> for deferred, w<n> for the skeleton bites of Inc 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
- const INC_STATES = ['sliced', 'planned', 'done'];
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
34
+ // `sliced` for what is now `specified`.)
35
+ const INC_STATES = ['specified', 'planned', 'done'];
36
+ const LEGACY_STATES = { sliced: 'specified' };
33
37
 
34
38
  const read = (file) => fs.readFileSync(file, 'utf8').replace(/\r\n/g, '\n');
35
39
  const esc = (s) =>
@@ -192,6 +196,33 @@ export function parseFeatures(file) {
192
196
 
193
197
  const sectionName = (heading) => heading.split(/[\s—:]/)[0].toLowerCase();
194
198
 
199
+ // 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]
201
+ // 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))*)$/;
204
+ export function optionTail(raw, id) {
205
+ const text = raw.replace(/^\s*-\s+/, '').slice(id.length).trim();
206
+ const dash = text.indexOf(' — ');
207
+ // with no " — " the line is just the name and its trailing pieces
208
+ const parts = (dash < 0 ? text : text.slice(dash + 3)).split(' · ').map((s) => s.trim());
209
+ const name = dash < 0 ? parts.shift() : text.slice(0, dash);
210
+ const keep = dash < 0 ? 0 : 1; // the description is never a strategy or a meta piece
211
+ 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*$/);
214
+ if (glued) {
215
+ if (/target|objetivo/.test(glued[0])) target = true;
216
+ parts[parts.length - 1] = parts[parts.length - 1].slice(0, glued.index);
217
+ }
218
+ while (parts.length > keep && META.test(parts[parts.length - 1])) {
219
+ if (/→\s*(?:target|objetivo)/.test(parts[parts.length - 1])) target = true;
220
+ parts.pop();
221
+ }
222
+ const strategy = parts.length > keep ? parts.pop() : '';
223
+ return { name: plain(name), desc: plain(parts.join(' · ')), strategy: plain(strategy), target };
224
+ }
225
+
195
226
  export function parseSlice(file) {
196
227
  const base = path.basename(file, '.md');
197
228
  const fm = base.match(/^(\d+)-(.+)$/);
@@ -283,25 +314,42 @@ export function parseSlice(file) {
283
314
  }
284
315
  });
285
316
 
286
- // ---- slicing/F<k>.md: the options and the User Task each belongs to ----
317
+ // ---- 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 }
287
319
  const sdir = path.join(dir, 'slicing');
288
320
  if (fs.existsSync(sdir)) {
289
321
  for (const f of fs.readdirSync(sdir).filter((x) => x.endsWith('.md')).sort()) {
290
322
  const sfile = path.join(sdir, f);
323
+ const code = f.match(/^(F\d+)/)?.[1] || null;
291
324
  let currentUT = null;
292
325
  read(sfile)
293
326
  .split('\n')
294
327
  .forEach((raw, i) => {
295
328
  let m;
296
329
  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|$)/))) {
330
+ else if (code && (m = raw.match(/^\s*-\s+\*\*S(\d+)\s+(.+?)\*\*(?:\s+·\s+([A-Za-z]+))?(?:\s+—\s+(.*))?$/))) {
331
+ 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 });
333
+ } else if ((m = raw.match(/^\s*-\s+(F\d+-\d+\.\d+)\s+(.+?)(?:\s+—\s|$)/))) {
298
334
  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 });
335
+ slice.options.set(m[1], { id: m[1], ut: currentUT, file: sfile, line: i + 1, ...optionTail(raw, m[1]) });
300
336
  }
301
337
  });
302
338
  }
303
339
  }
304
340
 
341
+ // ---- pruned.md: the options cut with a reason (they are gone from slicing/) ----
342
+ slice.pruned = [];
343
+ const pfile = path.join(dir, 'pruned.md');
344
+ if (fs.existsSync(pfile)) {
345
+ read(pfile)
346
+ .split('\n')
347
+ .forEach((raw, i) => {
348
+ 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 });
350
+ });
351
+ }
352
+
305
353
  // ---- inc-<n>.md: State, Unknowns, scenarios, Pending and the body of each increment ----
306
354
  for (const incRec of slice.incs) {
307
355
  const ifile = path.join(dir, `inc-${incRec.n}.md`);
@@ -322,7 +370,7 @@ export function parseSlice(file) {
322
370
  if (/^```/.test(raw)) fenced = !fenced;
323
371
  if (!fenced && (m = raw.match(/^##\s+(.+?)\s*$/))) sec = sectionName(m[1]);
324
372
  if (i < 12 && (m = raw.match(/^-\s*State:\s*(\S+)/))) {
325
- incRec.stateRaw = m[1].toLowerCase();
373
+ incRec.stateRaw = LEGACY_STATES[m[1].toLowerCase()] || m[1].toLowerCase();
326
374
  incRec.stateLine = i + 1;
327
375
  }
328
376
  if (i < 12 && (m = raw.match(/^-\s*Unknowns:\s*(.*)$/))) incRec.unknowns = m[1].trim();
@@ -369,12 +417,12 @@ function stateOf(steps) {
369
417
  }
370
418
 
371
419
  // 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).
420
+ // steps of its section in plan.md say planned / building / done; with no steps, its own State (default specified).
373
421
  function incState(slice, inc, steps) {
374
422
  if (slice.status === 'done' || inc.stateRaw === 'done') return { state: 'done', done: 0, total: 0 };
375
423
  const fromPlan = stateOf(steps);
376
424
  if (fromPlan) return fromPlan;
377
- return { state: inc.stateRaw === 'planned' ? 'planned' : 'sliced', done: 0, total: 0 };
425
+ return { state: inc.stateRaw === 'planned' ? 'planned' : 'specified', done: 0, total: 0 };
378
426
  }
379
427
 
380
428
  export function buildModel(dir) {
@@ -403,6 +451,35 @@ export function buildModel(dir) {
403
451
  opt.task = taskOf(opt.feature, opt.ut);
404
452
  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
453
  }
454
+ // the trace of the slice: its Steps in order, each with its live options and the ones pruned from it
455
+ const stepOf = (id) => id.replace(/\.\d+$/, '');
456
+ const trace = new Map();
457
+ const stepRec = (key, ut) => {
458
+ if (!trace.has(key)) {
459
+ const [f, n] = key.split('-');
460
+ const base = slice.steps.get(key) || { f, n: parseInt(n, 10), name: `Step ${n}`, kind: '', desc: '', note: '', ut };
461
+ 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` });
463
+ trace.set(key, { ...base, task, options: [] });
464
+ }
465
+ return trace.get(key);
466
+ };
467
+ for (const key of slice.steps.keys()) stepRec(key);
468
+ for (const o of slice.options.values()) {
469
+ 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
+ }
471
+ for (const p of slice.pruned) {
472
+ const st = trace.get(stepOf(p.id));
473
+ 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/` });
475
+ continue;
476
+ }
477
+ st.options.push({ id: p.id, name: p.name, cat: p.cat, reason: p.reason, state: 'pruned' });
478
+ }
479
+ const num = (id) => parseInt(id.match(/\.(\d+)$/)[1], 10);
480
+ 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);
482
+
406
483
  const byId = new Map(slice.bites.map((b) => [b.id, b]));
407
484
  const optionOwner = new Map();
408
485
  for (const bite of slice.bites) {
@@ -440,7 +517,8 @@ export function buildModel(dir) {
440
517
  inc.st = incState(slice, inc, steps);
441
518
  if (!inc.detailFile) issues.push({ file: slice.file, line: inc.line, text: `Inc ${inc.n} has no ${slice.base}/inc-${inc.n}.md` });
442
519
  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)` });
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)` });
444
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` });
445
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` });
446
524
  }
@@ -453,6 +531,19 @@ export function buildModel(dir) {
453
531
  issues.push({ file: slice.file, line: bite.line, text: `bite ${bite.id} says → Inc ${bite.takenLine}, which is not in ## Increments` });
454
532
  }
455
533
  }
534
+ // The proposed increments are edited by hand: say what a hand edit may have broken.
535
+ 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` });
539
+ for (const id of p.bites) {
540
+ 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})` });
544
+ rowOf.set(id, p.n);
545
+ }
546
+ }
456
547
  slice.proposed = slice.proposed.filter((p) => !slice.incs.some((i) => i.n === p.n));
457
548
  for (const p of slice.proposed) {
458
549
  for (const id of p.bites) {
@@ -512,7 +603,15 @@ function dataOf(model, lang, date) {
512
603
  };
513
604
  for (const s of slices) {
514
605
  const k = (id) => `${s.nn}-${id}`;
515
- const sl = { nn: s.nn, name: sliceName(s.base), base: s.base, status: s.status, incs: [], bites: [] };
606
+ const sl = {
607
+ nn: s.nn,
608
+ name: sliceName(s.base),
609
+ base: s.base,
610
+ status: s.status,
611
+ incs: [],
612
+ bites: [],
613
+ 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
+ };
516
615
  for (const b of s.bites) {
517
616
  sl.bites.push({
518
617
  key: k(b.id),
@@ -575,6 +674,8 @@ function dataOf(model, lang, date) {
575
674
  return out;
576
675
  }
577
676
 
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).
578
679
  function nextStep(model) {
579
680
  for (const slice of model.slices) {
580
681
  if (slice.status !== 'open') continue;
@@ -585,6 +686,16 @@ function nextStep(model) {
585
686
  if (open) return { text: `${open.text.replace(/`/g, '')} — ${slice.base}`, link: 'plan.md' };
586
687
  }
587
688
  }
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` };
697
+ }
698
+ }
588
699
  return null;
589
700
  }
590
701
 
@@ -64,7 +64,9 @@ Sketch two or three approaches at the right altitude: concrete enough to judge,
64
64
  to leave room for design. Follow [resources/breadboarding.md](resources/breadboarding.md):
65
65
 
66
66
  - every approach gets a **Mermaid breadboard** (places, affordances, connections);
67
- - add a **low-fi fat-marker sketch** (HTML) only when spatial layout is part of the decision.
67
+ - add a **low-fi fat-marker sketch** (HTML) only when spatial layout is part of the decision;
68
+ - keep them in `<docs>/<slug>/approaches.md` while you work: the narrowed problem, then one section
69
+ per approach with its breadboard (and a link to its sketch). Step 4 decides what becomes of it.
68
70
 
69
71
  ## 3. Trio pass over the approaches
70
72
 
@@ -101,6 +103,14 @@ Write `<docs>/<slug>/pitch.md` from the template. No time estimates or appetite
101
103
  instead write one **ambition** line (for example "minimum a coach can use in a real match"
102
104
  or "fully polished"). It is the tie-breaker when choosing between two solutions.
103
105
 
106
+ **What becomes of `approaches.md`.** The pitch keeps one line per approach (`### Approaches
107
+ considered`: the chosen one and why, the others and why not) and the breadboard of the chosen one.
108
+ - If those lines say it all, **delete `approaches.md`**: the pitch and the Discovery Context of
109
+ `bokata-slice` carry the decision.
110
+ - If the approaches need more than a line each — a breadboard per approach, a sketch, a comparison
111
+ someone will want to reread — **keep it as an annex** and link it from `### Approaches considered`.
112
+ It is a record of what was weighed: no other bokata skill reads it, so nothing downstream pays for it.
113
+
104
114
  Self-review before you show it: no placeholders, no contradictions, every rabbit hole has an
105
115
  outcome, every no-go is explicit.
106
116
 
@@ -22,6 +22,9 @@ flowchart LR
22
22
 
23
23
  ### Approaches considered
24
24
 
25
+ <!-- One line per approach. If they need more (a breadboard each, a sketch), keep that in an annex
26
+ and link it here: [approaches](approaches.md). Otherwise delete approaches.md. -->
27
+
25
28
  - **A — <name>** ← chosen: <why>
26
29
  - **B — <name>**: <why not>
27
30