create-pmos 0.422.0 → 0.424.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/board-programs-test.js +28 -0
  8. package/workspace/briefing-premium-adddoc-test.js +1 -1
  9. package/workspace/briefing-premium-board-test.js +12 -10
  10. package/workspace/briefing-premium-initiative-test.js +30 -38
  11. package/workspace/briefing-premium-products-test.js +16 -3
  12. package/workspace/changelog.json +24 -0
  13. package/workspace/guide/briefing-premium.md +1 -1
  14. package/workspace/guide/claude-proposes.md +37 -0
  15. package/workspace/guide/home.md +9 -2
  16. package/workspace/guide/index.md +1 -0
  17. package/workspace/guide/programs.md +1 -0
  18. package/workspace/guide/workflows.md +5 -1
  19. package/workspace/home-pill-test.js +138 -0
  20. package/workspace/ini-workflow-test.js +4 -4
  21. package/workspace/lib/board-premium.js +3 -2
  22. package/workspace/lib/custom-docs.js +65 -3
  23. package/workspace/lib/engine/boards.js +25 -2
  24. package/workspace/lib/headless.js +14 -1
  25. package/workspace/lib/initiative-writer.js +63 -1
  26. package/workspace/lib/plan-items.js +36 -5
  27. package/workspace/lib/pmos-verbs.js +3 -0
  28. package/workspace/lib/programs.js +11 -3
  29. package/workspace/lib/proposal-runs.js +148 -0
  30. package/workspace/lib/proposals.js +370 -0
  31. package/workspace/lib/propose-cli.js +96 -0
  32. package/workspace/lib/route-modules.js +2 -0
  33. package/workspace/lib/routes-board-premium.js +33 -0
  34. package/workspace/lib/routes-boards.js +50 -10
  35. package/workspace/lib/routes-initiatives.js +12 -0
  36. package/workspace/lib/routes-proposals.js +325 -0
  37. package/workspace/lib/routes-task-links.js +336 -0
  38. package/workspace/lib/split-merge-suggest.js +162 -0
  39. package/workspace/lib/split-merge.js +379 -0
  40. package/workspace/lib/task-cli.js +58 -5
  41. package/workspace/lib/task-items.js +14 -2
  42. package/workspace/lib/task-links.js +422 -0
  43. package/workspace/package-lock.json +2 -2
  44. package/workspace/package.json +1 -1
  45. package/workspace/premium-board-actions-test.js +4 -4
  46. package/workspace/premium-core-doc-issue-test.js +2 -2
  47. package/workspace/premium-vw-backlog-test.js +3 -3
  48. package/workspace/premium-vw-item-test.js +3 -3
  49. package/workspace/premium-vw-jira-test.js +6 -6
  50. package/workspace/product-lane-test.js +165 -0
  51. package/workspace/program-panel-test.js +1 -1
  52. package/workspace/public/pm/bd-asks.js +3 -0
  53. package/workspace/public/pm/bd-ini-panel.js +16 -6
  54. package/workspace/public/pm/bd-prog.js +6 -1
  55. package/workspace/public/pm/bd-span.js +69 -15
  56. package/workspace/public/pm/bd-views.js +3 -2
  57. package/workspace/public/pm/cozy-board.css +10 -0
  58. package/workspace/public/pm/cozy-today.css +23 -0
  59. package/workspace/public/pm/cozy-viewer.js +14 -3
  60. package/workspace/public/pm/cozy-vw-shell.css +8 -0
  61. package/workspace/public/pm/home-app.js +45 -14
  62. package/workspace/public/pm/home-ini-model.js +0 -34
  63. package/workspace/public/pm/home-ini.js +72 -204
  64. package/workspace/public/pm/home-task.js +2 -1
  65. package/workspace/public/pm/home-today.js +66 -16
  66. package/workspace/public/pm/ini-groups.js +253 -0
  67. package/workspace/public/pm/ini-links.js +519 -0
  68. package/workspace/public/pm/ini-props.js +218 -0
  69. package/workspace/public/pm/ini-tasks.js +58 -22
  70. package/workspace/public/pm/ini-versions.js +14 -9
  71. package/workspace/public/pm/ini-view-model.js +93 -4
  72. package/workspace/public/pm/ini-view.css +306 -18
  73. package/workspace/public/pm/ini-view.js +161 -36
  74. package/workspace/public/pm/premium-board.js +54 -6
  75. package/workspace/public/pm/premium-vw-item.js +2 -1
  76. package/workspace/public/pm/split-merge.css +77 -0
  77. package/workspace/public/pm/split-merge.js +265 -0
  78. package/workspace/public/pm/stage-line.js +414 -0
  79. package/workspace/public/pm/task-card.css +13 -0
  80. package/workspace/public/pm/task-card.js +42 -5
  81. package/workspace/public/pm/wf-page.css +2 -0
  82. package/workspace/public/pm/wf-page.js +2 -0
  83. package/workspace/public/pm/wf-stage.js +2 -1
  84. package/workspace/server.js +52 -3
  85. package/workspace/skills/initiative-propose.skill +45 -0
  86. package/workspace/split-merge-ui-test.js +175 -0
  87. package/workspace/stage-card-test.js +13 -12
  88. package/workspace/task-card-test.js +3 -2
  89. package/workspace/task-delete-test.js +126 -0
  90. package/workspace/task-links-test.js +239 -0
  91. package/workspace/task-milestones-test.js +1 -1
  92. package/workspace/task-plans-test.js +6 -0
  93. package/workspace/task-views-test.js +1 -1
  94. package/workspace/test-lists/bd-ini-panel.json +8 -2
  95. package/workspace/test-lists/claude-proposes.json +5 -0
  96. package/workspace/test-lists/home-sessions-pill.json +6 -0
  97. package/workspace/test-lists/product-lane.json +6 -0
  98. package/workspace/test-lists/split-merge.json +15 -0
  99. package/workspace/test-lists/task-delete.json +5 -0
  100. package/workspace/test-lists/task-links.json +6 -0
  101. package/workspace/tk-tasks-test.js +186 -57
  102. package/workspace/workflows-setup-test.js +4 -3
@@ -5,25 +5,36 @@
5
5
  *
6
6
  * viewHtml(v, o) the body, top to bottom: the summary card (what waits on you leads, with the one primary; else the status and why;
7
7
  * the meta line: the status when something waits, the owner, the workflow, the program), the stage card (the stage's
8
- * number and name, how much of its section is done, the day clock, the ladder, the dates line that replaced the Plan
9
- * card, the next stage), Tasks as the WBS (sections in workflow order), then Documents and Linked as folds.
8
+ * number and name, how much of its section is done, the day clock and the → to the next stage, then its one line:
9
+ * each stage on its own dates with the milestone tasks as ◇, pm/stage-line.js, batch 11 item 21), Tasks as the WBS
10
+ * (sections in workflow order), then Documents and Linked as folds.
10
11
  * o: { add (the Tasks + icon), adding (the inline field is open), next (the next stage is a press: Home's move sheet), openTask, docs: { n, html? } | null,
11
12
  * quick (each task's box carries the status caret and its date is a press: the host has h.status and h.dates),
12
13
  * draft (the empty breakdown's Draft it), program (the chip opens the program), wf (the workflow on the meta line opens the Change picker) }
13
14
  * wireView(body, h) the presses, once per body: h.check(uid, btn), h.openTask(uid), h.openTicket(key), h.add(btn) (the + icon: the host
14
15
  * redraws with o.adding, an inline field), h.addTask(title, input), h.addCancel(), h.next(btn),
15
16
  * h.primary(act, btn), h.program(id), h.docs(), h.doc(path) (a linked document), h.draft(btn), h.wf(btn), h.redraw() (after a fold opens or closes),
17
+ * h.sm(act, btn) a press on Claude's split or merge card (pm/split-merge.js press), h.openIni(id) the merged summary's link,
16
18
  * h.status(uid, state) and h.dates(uid, { start?, due? }) (the quick changes, each saved at once with Undo in the host's toast);
19
+ * the stage card's line (batch 11 item 21, pm/stage-line.js): h.add(btn, { start, due }) a gap's + (a task on those dates),
20
+ * h.hold(i, btn) a hold's ⏸ or calendar (o.hold: the host has it), h.openIni(id) "after <initiative>";
17
21
  * for planned versus actual (pm/ini-versions.js) h.where() → { ws, board }, h.reload() and h.toast(text, undo?)
18
22
  *
19
23
  * Tasks has three views (batch 9 item 5b; canvas In development, row "Tasks views"): the List (the WBS below), Timeline and Kanban
20
- * (pm/ini-tasks.js). The icon segment in the Tasks header switches them, and the last one is remembered for the PM.
24
+ * (pm/ini-tasks.js). The icon segment in the Tasks header switches them, and the last one is remembered for the PM. The group icon before
25
+ * it (batch 11 item 20, pm/ini-groups.js) groups the same tasks by Stage, Epic, Your groups, Owner or Status in all three views; By epic
26
+ * carries the send icons and Send to Jira, which used to be the old All tasks panel's.
21
27
  *
22
28
  * Folds keep their state per initiative for the session (a section, the Later line, a WBS group, the done tasks). Icon-only presses carry
23
29
  * their words in aria-label and title. Zero is silence: a part with nothing on record draws nothing. */
24
30
  import { wfIcon } from './wf-model.js';
25
31
  import * as TV from './ini-tasks.js'; // Tasks as List, Timeline or Kanban, and the quick status and dates (batch 9 item 5b)
26
32
  import * as VS from './ini-versions.js'; // planned versus actual: the version chip, Make live, a draft's writes (batch 11 item 8)
33
+ import * as LK from './ini-links.js'; // links between tasks and quiet moves (batch 11 item 15)
34
+ import * as PP from './ini-props.js'; // what Claude proposes, under the one blue ✦ after the title (batch 12 items 2, 3 and 4)
35
+ import * as G from './ini-groups.js'; // Group by and Send to Jira, in place of the old All tasks panel (batch 11 item 20)
36
+ import { cardHtml as smCard, mergedHtml as smMerged } from './split-merge.js'; // split or merge: Claude's card, the merged summary (batch 11 item 14)
37
+ import { lineHtml, fitLine } from './stage-line.js'; // the stage card's one line (batch 11 item 21)
27
38
 
28
39
  const CSS = new URL('./ini-view.css', import.meta.url).href;
29
40
  if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
@@ -35,6 +46,7 @@ const P = {
35
46
  go: 'M5 12h14M13 6l6 6-6 6', check: 'M5 12l5 5 9-10', right: 'M10 7l5 5-5 5', down: 'M7 10l5 5 5-5', plus: 'M12 5v14M5 12h14',
36
47
  prog: 'M12 3l9 5-9 5-9-5zM3 13l9 5 9-5', doc: 'M7 3h7l5 5v13H7zM14 3v5h5', draft: 'M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8',
37
48
  skip: 'M6 7l5 5-5 5M13 7l5 5-5 5', // » a skipped stage (batch 11 item 13: the same mark as the timelines)
49
+ pause: 'M9 6v12M15 6v12', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16',
38
50
  };
39
51
  const FOLD = new Map(); // `${id}|${key}` → true (open) | false (shut): the PM's own fold, for the session
40
52
  const isOpen = (v, key, dflt) => { const k = (v.id || v.key) + '|' + key; return FOLD.has(k) ? FOLD.get(k) : !!dflt; };
@@ -56,17 +68,26 @@ function summaryHtml(s, o = {}) {
56
68
  + `<p class="iv-meta">${meta.join('<span class="iv-sep" aria-hidden="true">·</span>')}</p></section>`;
57
69
  }
58
70
 
59
- /* ── the stage card, with the dates line (the old Plan card, item 3) ── */
60
- function stageHtml(st, o) {
61
- const right = [st.doneOf, st.day].filter(Boolean);
62
- const head = `<div class="iv-sch">${st.n ? `<span class="iv-no${st.ms ? ' ms' : ''}" aria-hidden="true">${st.ms ? '' : st.n}</span>` : ''}<b>${esc(st.name)}</b>`
63
- + (right.length ? `<span class="iv-r">${st.doneOf ? esc(st.doneOf) : ''}${st.doneOf && st.day ? ' · ' : ''}${st.day ? `<span class="${st.dayOver ? 'w' : ''}">${esc(st.day)}</span>` : ''}</span>` : '') + '</div>';
64
- const lad = st.ladder.length ? `<div class="iv-lad" role="img" aria-label="${esc(st.aria)}">${st.ladder.map((x) => `<i class="${[x.cls, x.ms ? 'ms' : ''].filter(Boolean).join(' ')}" title="${esc(x.name + (x.cls === 'skip' ? ' · skipped' : x.cls === 'done' ? ' · done' : x.cls === 'now' ? ' · now' : ''))}"></i>`).join('')}</div>` : '';
65
- const d = st.dates;
66
- const dates = d ? `<div class="iv-dl"><span>${esc(d.start)}</span><span class="e${d.over ? ' w' : ''}">${d.end ? `<b>${esc(d.end)}</b> end` : ''}${d.left ? ' · ' + esc(d.left) : ''}${d.jira ? ` · <span class="j">Jira: ${esc(d.jira)}</span>` : ''}</span></div>` : '';
71
+ /* ── the stage card: its header and one line (batch 11 item 21, agreed A; it replaced the ladder, the dates line and the next stage) ──
72
+ * The header: the stage's number and name, "N of M done" (a press shows the stage in Tasks), the clock, or the hold, done or draft chip that
73
+ * replaces it, the calendar when a date is missing, and the icon-only → that opens the move sheet (blue when every task of the stage is done
74
+ * and the next stage waits). The line is pm/stage-line.js. */
75
+ const CLOCK = 'M12 7.5V12l3 2M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17';
76
+ const LINE = new Map(); // id → what is unfolded under the line ('' | 'list' | 'list+' | 'ms:<i>' | 'gap:<i>')
77
+ function stageHtml(st, o, id) {
78
+ const L = st.line;
79
+ const tile = st.n ? `<span class="iv-no${st.ms ? ' ms' : ''}" aria-hidden="true">${st.ms ? '' : st.n}</span>` : '';
80
+ const of = st.doneOf ? (st.key ? `<button type="button" class="iv-scd" data-iv-stage="${esc(st.key)}" title="Show ${esc(st.name)} in Tasks">${esc(st.doneOf)}</button>` : `<span class="iv-scd">${esc(st.doneOf)}</span>`) : '';
81
+ const chip = L && L.chip ? `<span class="iv-chp ${esc(L.chip.tone)}">${L.chip.pause ? SVG(P.pause, 11, 2.4) : ''}${esc(L.chip.text)}</span>` : '';
82
+ const clock = !chip && st.clock ? `<span class="iv-clk${st.dayOver ? ' w' : ''}">${SVG(CLOCK, 13, 2)}${esc(st.clock)}</span>` : '';
83
+ const cal = L && L.cal === 'dates' ? `<button type="button" class="iv-ib iv-scb" data-iv-tlcal aria-label="No dates yet. Set them in Tasks" title="Set the dates">${SVG(P.cal, 16)}</button>`
84
+ : L && L.cal === 'back' && o.hold ? `<button type="button" class="iv-ib iv-scb" data-iv-hold="${L.holdAt}" aria-label="On hold with no return date. Set it" title="Set the return date">${SVG(P.cal, 16)}</button>` : '';
67
85
  const n = st.next;
68
- const nx = n ? `<${o.next ? 'button type="button" data-iv-next' : 'div'} class="iv-nx"${o.next ? ` aria-label="${esc('Move to ' + n.name)}"` : ''}><span class="iv-nd${n.ms ? ' ms' : ''}" aria-hidden="true"></span><span class="w"><b>${esc(n.name)}</b><span>Next stage${n.moves ? ' · moves' : ''}${n.moves ? ` <i class="iv-kr">${esc(n.moves)}</i>` : ''}</span></span></${o.next ? 'button' : 'div'}>` : '';
69
- return `<section class="iv-sc" aria-label="${esc('Stage · ' + st.name)}">${head}${lad}${dates}${nx}</section>`;
86
+ const go = n ? `<${o.next ? 'button type="button" data-iv-next' : 'span'} class="iv-scgo${st.ready ? ' on' : ''}"${n.ms ? ' data-ms="1"' : ''} aria-label="${esc('Next: ' + (n.ms ? '◆ ' : '') + n.name + (o.next ? '. Move to ' + n.name : ''))}" title="${esc('Next: ' + n.name)}">${SVG(P.go, 16, 2.2)}</${o.next ? 'button' : 'span'}>` : '';
87
+ // a phone puts "N of M done" and the clock on a line of their own under the name (ScxA2Phone)
88
+ const meta = of || clock || chip ? `<span class="iv-scm">${of}${clock}${chip}</span>` : '';
89
+ const head = `<div class="iv-sch">${tile}<b>${esc(st.name)}</b><span class="iv-sp"></span>${meta}${cal}${go}</div>`;
90
+ return `<section class="iv-sc" aria-label="${esc(st.aria || 'Stage · ' + st.name)}">${head}${lineHtml(L, { open: LINE.get(id) || '', hold: !!o.hold })}</section>`;
70
91
  }
71
92
 
72
93
  /* ── the WBS ── */
@@ -81,20 +102,26 @@ function taskHtml(x, o, arch) {
81
102
  let meta = x.sub ? `<span class="${x.late ? 'w' : ''}">${esc(x.sub)}</span>` : '';
82
103
  if (o.quick && x.uid) {
83
104
  // no dates: the calendar icon sits last and shows on hover, so an undated row reads the same as before
84
- const parts = [x.prog ? 'In progress' : '', x.days ? TV.dateBtn(x, o) + (x.lateText ? `<span class="iv-late">, ${esc(x.lateText)}</span>` : '') + TV.slipHtml(x) : '', x.owner && x.owner !== 'You' ? esc(x.owner) : ''];
105
+ const parts = [x.prog ? 'In progress' : '', x.days ? TV.dateBtn(x, o) + (x.lateText ? `<span class="iv-late">, ${esc(x.lateText)}</span>` : '') + TV.slipHtml(x) : '', LK.metaHtml(x, o.lk, o.quick), x.owner && x.owner !== 'You' ? esc(x.owner) : ''];
85
106
  meta = `<span class="iv-rm">${parts.filter(Boolean).join('<span class="iv-sep" aria-hidden="true"> · </span>')}${x.days ? '' : TV.dateBtn(x, o)}</span>`;
86
107
  } else if (TV.msNoDate(x)) {
87
108
  meta = `<span class="iv-rm">${x.sub ? `<span>${esc(x.sub)}</span> ` : ''}<span class="iv-dc ms">Set the due date</span></span>`;
88
109
  }
89
- return `<div class="iv-tr${x.closed ? ' done' : ''}${x.wont ? ' wo' : ''}${arch ? ' ar' : ''}">${chk}<span class="w">${t}${meta}</span></div>`;
110
+ // Your groups (batch 11 item 20): a task drags to another of the PM's groups
111
+ const drag = o.gdrag && x.uid && !x.dr ? ` draggable="true" data-ig-drag="${esc(x.uid)}"` : '';
112
+ return `<div class="iv-tr${x.closed ? ' done' : ''}${x.wont ? ' wo' : ''}${arch ? ' ar' : ''}"${drag}>${chk}<span class="w">${t}${meta}</span></div>`;
90
113
  }
91
114
  const chev = (open) => `<span class="iv-cv" aria-hidden="true">${SVG(open ? P.down : P.right, 15, 2)}</span>`;
92
115
  function bodyHtml(v, sec, o) {
93
- let h = sec.top.map((x) => taskHtml(x, o)).join('');
116
+ // By epic (batch 11 item 20): an epic's tickets first, or what comes next while nothing is drafted
117
+ let h = G.tkRowsHtml(sec) + G.tkEmptyHtml(sec) + sec.top.map((x) => taskHtml(x, o)).join('');
94
118
  if (sec.jira) {
95
119
  const byEp = new Map(); for (const k of sec.jira.open) { const e = k.epic || ''; if (!byEp.has(e)) byEp.set(e, []); byEp.get(e).push(k); }
96
120
  const all = isOpen(v, sec.key + ':tk', false), shown = all ? sec.jira.open : sec.jira.open.slice(0, 3);
97
- h += shown.map((k) => `<button type="button" class="iv-tr iv-tk" data-iv-ticket="${esc(k.key)}"><span class="iv-jq" aria-hidden="true"></span><span class="w"><b class="iv-tt"><em>${esc(k.key)}</em> ${esc(k.title)}</b><span class="${k.warn ? 'w' : ''}">${esc(k.sub)}</span></span></button>`).join('');
121
+ // the title opens the ticket; with quick changes on, its dates are a press too: the start and due kept in PMOS (batch 11 item 23)
122
+ h += shown.map((k) => o.quick
123
+ ? `<div class="iv-tr iv-tkr"><span class="iv-jq" aria-hidden="true"></span><span class="w"><button type="button" class="iv-tt" data-iv-ticket="${esc(k.key)}"><em>${esc(k.key)}</em> ${esc(k.title)}</button><span class="iv-rm"><span class="${k.warn ? 'w' : ''}">${esc(k.sub)}</span>${k.days ? '<span class="iv-sep" aria-hidden="true"> · </span>' : ''}${TV.dateBtn(TV.jiraRow(k), o)}</span></span></div>`
124
+ : `<button type="button" class="iv-tr iv-tk" data-iv-ticket="${esc(k.key)}"><span class="iv-jq" aria-hidden="true"></span><span class="w"><b class="iv-tt"><em>${esc(k.key)}</em> ${esc(k.title)}</b><span class="${k.warn ? 'w' : ''}">${esc(k.sub)}</span></span></button>`).join('');
98
125
  if (sec.jira.open.length > shown.length) h += `<button type="button" class="iv-more" data-iv-fold="${esc(sec.key + ':tk')}" aria-expanded="false">${esc((sec.jira.open.length - shown.length) + ' more open' + (byEp.size > 1 ? ' · by epic' : ''))}${SVG(P.right, 14, 2)}</button>`;
99
126
  h += `<p class="iv-q">${esc(sec.jira.done + ' of ' + sec.jira.total + ' done in Jira' + (sec.jira.at ? ' · ' + sec.jira.at : ''))}</p>`;
100
127
  }
@@ -127,29 +154,40 @@ function markOf(sec) {
127
154
  if (sec.kind === 'later' || sec.kind === 'none') return '<span class="iv-no dash" aria-hidden="true"></span>';
128
155
  if (sec.status === 'skip') return `<span class="iv-no skip" aria-hidden="true">${SVG(P.skip, 12, 2)}</span>`;
129
156
  if (sec.status === 'done') return `<span class="iv-no ok" aria-hidden="true">${SVG(P.check, 12, 3)}</span>`;
157
+ if (sec.kind === 'group' || sec.kind === 'epic') return ''; // a group of another grouping has no stage number (batch 11 item 20)
130
158
  if (sec.ms) return '<span class="iv-no ms" aria-hidden="true"></span>';
131
159
  return `<span class="iv-no${sec.status === 'now' ? ' now' : ''}" aria-hidden="true">${esc(sec.n)}</span>`;
132
160
  }
133
161
  function sectionHtml(v, sec, o, inner) {
134
162
  const key = 'sec:' + (sec.key || 'none'), op = isOpen(v, key, sec.open);
135
- const has = sec.top.length || sec.groups.length || sec.done.length || (sec.archived || []).length || sec.jira || (sec.stages && sec.stages.length);
163
+ const has = sec.top.length || sec.groups.length || sec.done.length || (sec.archived || []).length || sec.jira || (sec.stages && sec.stages.length) || (sec.tk && sec.tk.length) || sec.tkEmpty;
136
164
  const name = sec.label || sec.name;
137
- const row = `<button type="button" class="iv-ws${sec.kind !== 'stage' && sec.kind !== 'none' ? ' mut' : ''}${inner ? ' in' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'}>${markOf(sec)}`
138
- + `<span class="w"><b>${esc(name)}</b>${sec.sub ? `<small class="${sec.subWarn ? 'w' : ''}">${esc(sec.sub)}</small>` : ''}</span>${sec.count ? `<span class="n${sec.warn ? ' w' : ''}">${esc(sec.count)}</span>` : ''}${has ? chev(op) : ''}</button>`;
139
- if (!op || !has) return row;
165
+ const row = `<button type="button" class="iv-ws${sec.kind === 'past' || sec.kind === 'later' ? ' mut' : ''}${inner ? ' in' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'}>${markOf(sec)}`
166
+ + `<span class="w"><b>${esc(name)}</b>${sec.sub ? `<small class="${sec.subWarn ? 'w' : ''}">${esc(sec.sub)}</small>` : ''}</span>${sec.epicKey ? `<span class="ig-key">${esc(sec.epicKey)}</span>` : ''}${sec.count ? `<span class="n${sec.warn ? ' w' : ''}">${esc(sec.count)}</span>` : ''}${has ? chev(op) : ''}</button>`;
167
+ // a group's own presses sit beside its fold: ⋯ on the PM's own group, the send icon on an epic (batch 11 item 20)
168
+ const tools = G.toolsHtml(sec), head = tools ? `<div class="iv-wsw">${row}${tools}</div>` : row;
169
+ // the PM's own groups and Not in a group take a dragged task
170
+ const drop = (h) => (sec.mine != null && o.gdrag ? `<div class="ig-dz" data-ig-drop="${esc(sec.mine || '')}">${h}</div>` : h);
171
+ if (!op || !has) return drop(head);
140
172
  // the folded lines (past stages, Later) open into their own stages, each a section of its own
141
173
  const body = sec.stages ? sec.stages.map((s) => sectionHtml(v, s, o, true)).join('') : bodyHtml(v, sec, o);
142
- return row + `<div class="iv-wl">${body}</div>`;
174
+ return drop(head + `<div class="iv-wl">${body}</div>`);
143
175
  }
144
- function tasksHtml(v, o) {
145
- const T = v.tasks;
176
+ function tasksHtml(v0, o) {
177
+ // the grouping the PM picked (batch 11 item 20): every view draws its groups as it draws the stages
178
+ const v = G.view(v0), T = v.tasks;
146
179
  const add = o.add ? `<button type="button" class="iv-ib" data-iv-add aria-label="Add a task to ${esc(v.title)}" title="Add a task">${SVG(P.plus, 16, 2.2)}</button>` : '';
147
180
  // the view switch shows once there is a task to see another way (zero is silence)
148
181
  const mode = T.empty ? 'list' : TV.viewMode();
149
182
  // planned versus actual (batch 11 item 8): the version chip and the end slip after the count; Make live (seal) while a draft is shown
150
183
  const cnt = VS.countText(v.vs, T.count, T.open + T.done);
151
- const head = `<div class="iv-th"><b>Tasks</b>${cnt ? `<span class="n">${esc(cnt)}</span>` : ''}${VS.headHtml(v.vs)}<span class="iv-sp"></span>${T.empty ? '' : TV.headExtraHtml(v, mode) + TV.switchHtml(mode)}${VS.liveHtml(v.vs)}${add}</div>`
184
+ // links (batch 11 item 15): the blue ✦ (proposals), the grey ✦ (quiet moves), the late count, between the count and the version chip
185
+ const lk = T.empty ? null : LK.of(v);
186
+ o = { ...o, lk };
187
+ const head = `<div class="iv-th"><b>Tasks</b>${cnt ? `<span class="n">${esc(cnt)}</span>` : ''}${LK.headHtml(lk)}${VS.headHtml(v.vs)}<span class="iv-sp"></span>${T.empty ? '' : TV.headExtraHtml(v, mode) + G.headHtml(v) + TV.switchHtml(mode)}${VS.liveHtml(v.vs)}${add}</div>`
152
188
  + (o.adding ? `<form class="iv-addf" data-iv-addform><input id="ivAddTask" type="text" maxlength="160" autocomplete="off" placeholder="A task for ${esc(v.title)}${o.addHint ? esc(', ' + o.addHint) : ''}" aria-label="New task"><button type="submit" class="iv-go" aria-label="Add the task" title="Add (Enter). Esc cancels.">${SVG(P.check, 16, 2.2)}</button></form>` : '');
189
+ // while Claude looks for a new initiative elsewhere, Tasks waits for what it finds (PiA1)
190
+ if (T.empty && PP.lookHtml(v)) return head + PP.lookHtml(v);
153
191
  if (T.empty) {
154
192
  const sk = T.empty.stages.map((s) => `<span class="iv-sk"><span class="iv-no dash${s.ms ? ' ms' : ''}" aria-hidden="true">${s.ms ? '' : s.n}</span>${esc(s.name)}${s.now ? ' <i>· now</i>' : ''}</span>`).join('');
155
193
  return head + `<div class="iv-empty">${sk}<p class="iv-q">Claude drafts the breakdown, one section per stage. Nothing is saved until you keep it.</p>`
@@ -157,17 +195,26 @@ function tasksHtml(v, o) {
157
195
  }
158
196
  SHOWN.set(v.id || v.key || '', v);
159
197
  const fold = (k, d) => isOpen(v, k, d), q = { ...o, mark: markOf };
160
- if (mode === 'timeline') return head + `<div class="iv-tk">${TV.timelineHtml(v, q, fold)}</div>`;
161
- if (mode === 'kanban') return head + `<div class="iv-tk">${TV.kanbanHtml(v, q, fold)}</div>`;
162
- return head + `<div class="iv-wbs">${T.sections.map((s) => sectionHtml(v, s, o)).join('')}</div>`;
198
+ const top = head + G.sumHtml(v);
199
+ if (mode === 'timeline') return top + `<div class="iv-tk">${TV.timelineHtml(v, q, fold)}</div>`;
200
+ if (mode === 'kanban') return top + `<div class="iv-tk">${TV.kanbanHtml(v, q, fold)}</div>`;
201
+ const ol = T.by === 'mine' ? { ...o, gdrag: !!o.quick } : o;
202
+ // the stage the card showed has no task: say so, and the ✕ in the header shows every stage again (batch 12 item 0)
203
+ if (T.only && !T.sections.length) return top + `<p class="iv-q ig-none">No tasks in ${esc(T.only)} yet.</p>`;
204
+ return top + `<div class="iv-wbs">${T.sections.map((s) => sectionHtml(v, s, ol)).join('')}</div>`;
163
205
  }
164
206
  function foldsHtml(v, o) {
165
207
  const rows = [];
166
- if (o.docs && o.docs.n) {
167
- const op = o.docs.html ? isOpen(v, 'docs', false) : false;
168
- rows.push(`<button type="button" class="iv-fr" ${o.docs.html ? `data-iv-fold="docs" aria-expanded="${op}"` : 'data-iv-docs'}><b>Documents</b><span class="n">${o.docs.n}</span>${chev(op)}</button>` + (op ? `<div class="iv-fb">${o.docs.html}</div>` : ''));
208
+ // the documents a ✓ kept from elsewhere (batch 12 item 4) list inline under Documents, each with its source and date
209
+ const fd = PP.foundDocs(v);
210
+ const fdHtml = fd.map((d) => (/^https?:\/\//.test(d.ref) ? `<a class="iv-fd" href="${esc(d.ref)}" target="_blank" rel="noopener">` : '<span class="iv-fd">') + `<b>${esc(d.title)}</b>${d.meta ? `<small>${esc(d.meta)}</small>` : ''}` + (/^https?:\/\//.test(d.ref) ? '</a>' : '</span>')).join('');
211
+ if ((o.docs && o.docs.n) || fd.length) {
212
+ const n = ((o.docs && o.docs.n) || 0) + fd.length, inl = !!(o.docs && o.docs.html) || fd.length > 0;
213
+ const op = inl ? isOpen(v, 'docs', false) : false;
214
+ const own = o.docs && o.docs.n ? (o.docs.html || `<button type="button" class="iv-fd" data-iv-docs><b>Core documents</b><small>${o.docs.n}</small></button>`) : '';
215
+ rows.push(`<button type="button" class="iv-fr" ${inl ? `data-iv-fold="docs" aria-expanded="${op}"` : 'data-iv-docs'}><b>Documents</b><span class="n">${n}</span>${chev(op)}</button>` + (op ? `<div class="iv-fb">${own}${fd.length ? `<div class="iv-fds">${fdHtml}</div>` : ''}</div>` : ''));
169
216
  }
170
- const L = v.linked || [];
217
+ const L = (v.linked || []).concat(((v.found && v.found.linked) || []).map((x) => ({ kind: 'found', label: x.label, title: x.title, ref: x.ref })));
171
218
  if (L.length) {
172
219
  const op = isOpen(v, 'linked', false);
173
220
  const chip = (x) => (x.kind === 'doc' ? `<button type="button" class="iv-chip" data-iv-doc="${esc(x.path)}" title="${esc(x.path)}">${esc(x.label)}</button>` : `<span class="iv-chip"${x.title ? ` title="${esc(x.title)}"` : ''}>${esc(x.label)}</span>`);
@@ -175,29 +222,50 @@ function foldsHtml(v, o) {
175
222
  }
176
223
  return rows.length ? `<div class="iv-folds">${rows.join('')}</div>` : '';
177
224
  }
225
+ const VIEWED = new Map(); // initiative id → the view drawn last (the ✦ in the Viewer's header reads it)
178
226
  export function viewHtml(v, o = {}) {
179
- return `<div class="iv" data-iv="${esc(v.id || v.key || '')}">${summaryHtml(v.summary, o)}${stageHtml(v.stage, o)}${tasksHtml(v, o)}${foldsHtml(v, o)}${o.tail || ''}</div>`;
227
+ if (v && v.id) VIEWED.set(v.id, v);
228
+ // a merged initiative leads with where its work went, and draws no stage or tasks (they moved; its folds stay); an open one shows Claude's split or merge card under the summary (batch 11 item 14)
229
+ const top = v.merged ? smMerged(v.merged) : summaryHtml(v.summary, o) + (o.sm !== false ? smCard(v.suggest, v.title) : '');
230
+ return `<div class="iv" data-iv="${esc(v.id || v.key || '')}">${top}${v.merged ? '' : stageHtml(v.stage, o, v.id || v.key || '') + tasksHtml(v, o)}${foldsHtml(v, o)}${o.tail || ''}</div>`;
180
231
  }
181
232
 
182
233
  /* ── the presses ── */
183
234
  export function wireView(body, h) {
184
235
  if (!body) return;
185
- body.__iv = VS.wrap(h, body, (id) => SHOWN.get(id));
236
+ const idOf = () => { const n = body.querySelector('[data-iv]'); return n ? n.dataset.iv : null; };
237
+ body.__iv = LK.wrap(VS.wrap(h, body, (id) => SHOWN.get(id)), idOf);
238
+ // the one blue ✦ after the title (pm/ini-props.js), drawn again with each draw of the initiative
239
+ const chip = () => { const id = idOf(); if (id && VIEWED.has(id)) PP.sync(VIEWED.get(id), body.__iv || {}); };
240
+ chip();
241
+ G.attach(body, body.__iv); // the layout and the drafted tickets of the initiative shown (batch 11 item 20)
186
242
  if (body.__ivWired) return;
187
243
  body.__ivWired = true;
244
+ // the stage line's labels are checked as drawn (pm/stage-line.js fitLine): after each draw and when the panel changes width
245
+ if (typeof MutationObserver === 'function') {
246
+ let q = 0; const fit = () => { if (q) return; q = requestAnimationFrame(() => { q = 0; fitLine(body); chip(); }); };
247
+ new MutationObserver(fit).observe(body, { childList: true, subtree: true });
248
+ if (typeof ResizeObserver === 'function') new ResizeObserver(fit).observe(body);
249
+ fit();
250
+ }
188
251
  body.addEventListener('click', (e) => {
189
252
  const H = body.__iv || {}, b = e.target.closest('button, a'); if (!b || !body.contains(b)) return;
190
253
  const root = b.closest('[data-iv]'); if (!root) return;
191
254
  const id = root.dataset.iv;
192
255
  const d = b.dataset;
193
256
  if (VS.press(b, d, root, H)) return;
257
+ if (G.press(b, d, root, H)) return;
258
+ if (LK.press(b, d, root, { ...H, __dates: (x) => TV.press(x, { ivtBar: x.dataset.ivtBar }, root, H, e) })) return;
194
259
  if (TV.press(b, d, root, { ...H, __v: SHOWN.get(id) }, e)) return;
195
260
  if (d.ivFold) { e.preventDefault(); const k = id + '|' + d.ivFold; FOLD.set(k, b.getAttribute('aria-expanded') !== 'true'); if (H.redraw) H.redraw(); return; }
196
261
  if (d.ivCheck && H.check) { e.preventDefault(); H.check(d.ivCheck, b); return; }
197
262
  if (d.ivTask && H.openTask) { e.preventDefault(); H.openTask(d.ivTask, b); return; }
198
263
  if (d.ivTicket && H.openTicket) { e.preventDefault(); H.openTicket(d.ivTicket, b); return; }
199
264
  if ('ivAdd' in d && H.add) { e.preventDefault(); H.add(b); return; }
265
+ if (lineMove(b, d, id, H, e)) return;
200
266
  if ('ivNext' in d && H.next) { e.preventDefault(); H.next(b); return; }
267
+ if (d.sm && H.sm) { e.preventDefault(); H.sm(d.sm, b); return; }
268
+ if (d.smOpen && H.openIni) { e.preventDefault(); H.openIni(d.smOpen, b); return; }
201
269
  if (d.ivPrimary && H.primary) { e.preventDefault(); H.primary(d.ivPrimary, b); return; }
202
270
  if ('ivWf' in d && H.wf) { e.preventDefault(); H.wf(b); return; }
203
271
  if (d.ivProgram && H.program) { e.preventDefault(); H.program(d.ivProgram, b); return; }
@@ -211,8 +279,65 @@ export function wireView(body, h) {
211
279
  e.preventDefault(); const H = body.__iv || {}, inp = f.querySelector('input'), t = inp ? inp.value.trim() : '';
212
280
  if (t && H.addTask) H.addTask(t, inp);
213
281
  });
214
- TV.wireDrag(body);
282
+ G.wireDrag(body);
283
+ TV.wireDrag(body, () => { LK.draw(body, true); const n = body.querySelector('[data-iv]'); if (n) LK.sweep(n.dataset.iv, body.__iv || {}); });
215
284
  body.addEventListener('keydown', (e) => { if (e.key === 'Escape' && e.target.id === 'ivAddTask') { e.stopPropagation(); const H = body.__iv || {}; if (H.addCancel) H.addCancel(); } });
216
285
  }
286
+ /* ── the stage card's presses (batch 11 item 21) ──
287
+ * A part of the line or "N of M done" shows that stage in Tasks: its section opens and scrolls into view (the Kanban turns to that stage).
288
+ * A ◇ shows its task there. On a phone a tap on the line lists the stages and milestones under it instead (ScxA2Phone). A counted ◇, a
289
+ * gap and the phone's list unfold under the line; a second press folds them. */
290
+ const phone = () => typeof matchMedia === 'function' && matchMedia('(max-width: 760px)').matches;
291
+ function lineMove(b, d, id, H, e) {
292
+ const fold = (k) => { LINE.set(id, LINE.get(id) === k ? '' : k); if (H.redraw) H.redraw(); };
293
+ const inLine = !!b.closest('[data-iv-line]');
294
+ if (d.ivStage != null) { e.preventDefault(); if (inLine && phone()) fold('list'); else showIn(b, id, H, d.ivStage, null); return true; }
295
+ if (d.ivMs) { e.preventDefault(); if (inLine && phone()) { fold('list'); return true; } const v = SHOWN.get(id), f = v && findRow(v, d.ivMs); showIn(b, id, H, f ? f.sec : null, d.ivMs); return true; }
296
+ if (d.ivMsc != null) { e.preventDefault(); fold(phone() ? 'list' : 'ms:' + d.ivMsc); return true; }
297
+ if (d.ivGap != null) { e.preventDefault(); fold(phone() ? 'list' : 'gap:' + d.ivGap); return true; }
298
+ if ('ivTlall' in d) { e.preventDefault(); LINE.set(id, LINE.get(id) === 'list+' ? 'list' : 'list+'); if (H.redraw) H.redraw(); return true; }
299
+ if (d.ivGapadd && H.add) { e.preventDefault(); const [start, due] = d.ivGapadd.split(' '); LINE.set(id, ''); H.add(b, { start, due }); return true; }
300
+ if ('ivTlcal' in d) { e.preventDefault(); TV.setViewMode('timeline'); if (H.redraw) H.redraw(); later(b, (root) => root.querySelector('.iv-th')); return true; }
301
+ if (d.ivHold != null && H.hold) { e.preventDefault(); H.hold(+d.ivHold, b); return true; }
302
+ if (d.ivIni && H.openIni) { e.preventDefault(); H.openIni(d.ivIni, b); return true; }
303
+ return false;
304
+ }
305
+ /** A task row of the view by its id: { x, sec, fold } — fold: the fold inside its section that holds it (a WBS group or Done), or ''. */
306
+ function findRow(v, uid) {
307
+ for (const s of (v.tasks && v.tasks.sections) || []) {
308
+ const inner = s.stages ? s.stages : [s];
309
+ for (const c of inner) {
310
+ if ((c.top || []).some((x) => x.uid === uid)) return { x: c.top.find((x) => x.uid === uid), sec: c.key, fold: '' };
311
+ for (const g of c.groups || []) if (g.rows.some((x) => x.uid === uid)) return { x: g.rows.find((x) => x.uid === uid), sec: c.key, fold: c.key + ':g:' + g.key };
312
+ if ((c.done || []).some((x) => x.uid === uid)) return { x: c.done.find((x) => x.uid === uid), sec: c.key, fold: c.key + ':done' };
313
+ }
314
+ }
315
+ return null;
316
+ }
317
+ /** After the redraw: find the target in the view and bring it into sight, with a short highlight. */
318
+ function later(b, pick) {
319
+ const body = b.closest('[data-iv]') && b.closest('[data-iv]').parentElement;
320
+ const go = () => {
321
+ const root = body && body.querySelector('[data-iv]'); if (!root) return;
322
+ const el = pick(root); if (!el) return;
323
+ el.scrollIntoView({ block: 'center', behavior: 'smooth' });
324
+ el.classList.add('iv-hit'); setTimeout(() => el.classList.remove('iv-hit'), 1600);
325
+ };
326
+ if (typeof requestAnimationFrame === 'function') requestAnimationFrame(go); else go();
327
+ }
328
+ /** Show a stage (and one task of it) in Tasks: its section opens in the List and the Timeline, the Kanban turns to it. */
329
+ function showIn(b, id, H, key, uid) {
330
+ // grouped by epic (or any grouping but Stage) there is no stage section to open: Tasks shows that stage's tasks only (batch 12 item 0)
331
+ if (key != null && !uid && G.onlyStage(id, key)) { if (H.redraw) H.redraw(); later(b, (root) => root.querySelector('.iv-th')); return; }
332
+ if (key != null) { FOLD.set(id + '|sec:' + (key || 'none'), true); TV.setKanbanStage(id, key); }
333
+ if (uid) { const v = SHOWN.get(id), f = v && findRow(v, uid); if (f && f.fold) FOLD.set(id + '|' + f.fold, true); }
334
+ if (H.redraw) H.redraw();
335
+ const q = (v) => String(v).replace(/["\\]/g, '\\$&');
336
+ later(b, (root) => {
337
+ if (uid) { const t = root.querySelector(`.iv-tk [data-iv-task="${q(uid)}"], .iv-wbs [data-iv-task="${q(uid)}"], .iv-wbs [data-iv-check="${q(uid)}"], .iv-tk [data-ivt-bar="${q(uid)}"], .iv-tk [data-iv-check="${q(uid)}"]`); if (t) return t.closest('.iv-tr') || t; }
338
+ return root.querySelector(`[data-iv-fold="sec:${q(key || 'none')}"]`) || root.querySelector('.iv-th');
339
+ });
340
+ }
341
+
217
342
  /** For the tests: forget every fold the PM opened or shut. */
218
- export const resetFolds = () => { FOLD.clear(); TV.resetViews(); VS.resetVersions(); };
343
+ export const resetFolds = () => { LINE.clear(); FOLD.clear(); TV.resetViews(); VS.resetVersions(); LK.resetLinks(); G.resetGroups(); };
@@ -35,6 +35,7 @@ import { open as viewerOpen, current as viewerCur } from './cozy-viewer.js';
35
35
  import * as VW from './cozy-viewer.js';
36
36
  import * as PP from './bd-prog-panel.js';
37
37
  import * as PO from './prog-order.js';
38
+ import * as SM from './split-merge.js'; // split one initiative in two, or merge two: Claude suggests, the PM approves (batch 11 item 14)
38
39
  import * as PM from './prog-move.js'; // move an initiative out of its program, or to another (canvas LpA1More, LpA2Other)
39
40
  import * as Pop from './bd-pop.js'; // the order of a program's initiatives: the grip and Claude's order from the dates (canvas RoADrag, RoASuggest)
40
41
  import * as BI from './bd-ini-panel.js';
@@ -346,7 +347,7 @@ function trackRow(r, cls = '', po = false) {
346
347
  }).join('');
347
348
  const many = TK.mode === 'cats'; // All: each row names its workflow with its icon (WfATrack)
348
349
  return `<div class="bt-r bt-l${cls}${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}"${po ? ` data-po-id="${esc(r.id)}"` : ''}>${po ? PO.gripHtml(r.title) : ''}`
349
- + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${esc(r.title)}</b><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
350
+ + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
350
351
  + `<div class="${cellsCls()}" role="presentation"${cellsStyle()}>${cells}</div>`
351
352
  + `<div class="bt-dl" role="cell">${nextHtml(r, { self: M.board.self, icon: !PHONE.matches })}</div></div>`; // the Next cell (XocA): what finishes the step next
352
353
  }
@@ -396,7 +397,7 @@ function drawTrack(L) {
396
397
  /* ── the timeline (AgBoardTimeline; TsCOpen, TsCDesk, TsAllSpans, TsCPhone) ───────────────────────────────────────── */
397
398
  function drawTime(L) {
398
399
  const S = M.steps || [], phone = PHONE.matches, bw = $('#ibBody').clientWidth || innerWidth;
399
- const T = timelineHtml(L, M, span, { groups: groups(L), progState, folded: PG.folded, prodHtml: (g) => PG.prodHtml(g, 'tg-prd'), subHtml: (n) => PG.subHtml(n, 'tg-psb'), progTile: () => PG.progTile(), productsOf: PG.productsOf,
400
+ const T = timelineHtml(L, M, span, { groups: groups(L), progState, folded: PG.folded, prodHtml: (g) => PG.prodHtml(g, 'tg-prd'), prodCell: (g) => PG.prodCell(g), subHtml: (n) => PG.subHtml(n, 'tg-psb'), progTile: () => PG.progTile(), productsOf: PG.productsOf,
400
401
  foldBtn: (g) => PG.foldBtn(g.key, g.program.title), memberIcon: (id) => PG.memberIcon(PGS, id), sel: peek && peek.kind !== 'acts' ? peek.key : null, status: statusOf, phone, trackPx: bw - 2 - (phone ? 0 : matchMedia('(max-width: 980px)').matches ? 180 : 250), avatar: (n) => V.avatar(n, 'sm'),
401
402
  askHref: (none) => askHref(null, 'Propose start and end dates for ' + none.map((r) => r.title).join(', ')) });
402
403
  return T.html;
@@ -490,6 +491,9 @@ $('#ibBody').addEventListener('click', (e) => {
490
491
  const pg = e.target.closest('[data-prog]'); if (pg) { PG.openProgram(pg.dataset.prog, pg); return; }
491
492
  // a counted milestone ◇ lists its milestones right under it; on a phone the row's bar lane opens them in a sheet (batch 11 item 3)
492
493
  const mc = e.target.closest('[data-ms-row]'); if (mc) { msPop(mc, rowOf(mc.dataset.msRow), mc.dataset.msIds.split(' ')); return; }
494
+ // a product lane's counted ◇ lists its milestones with their initiatives; on a phone a tap on the lane lists them all in a sheet (batch 11 item 17)
495
+ const ml = e.target.closest('[data-ms-lane]'); if (ml) { lanePop(ml, ml.dataset.msLane); return; }
496
+ const pl = PHONE.matches && e.target.closest('.tgq-r.tg-lane > .tg-p[data-lane-ms]'); if (pl) { lanePop(pl, pl.dataset.laneMs, pl.dataset.laneName); return; }
493
497
  // a gap's press (batch 11 item 13): its words, and + New task with its dates while part of it is ahead
494
498
  const gp = e.target.closest('[data-gap]'); if (gp) { gapPop(gp, rowOf(gp.dataset.gap)); return; }
495
499
  // the phone's row sheet lists the milestones, the gaps and the skipped stages in date order (XmlA5Phone, XgapA3Phone)
@@ -559,6 +563,25 @@ function moveItems(r) {
559
563
  return PM.moveItems({ programs: () => PGS, ws: r.ws || M.board.ws || '', id: r.id, product: r.product || M.board.product || M.board.name || '', pmPost, say,
560
564
  reload: async () => { await loadPrograms(); load(); }, phone: () => PHONE.matches, stateOf: (p) => progState(p), openList: moveList });
561
565
  }
566
+ /** Split or merge (pm/split-merge.js; canvas XsmA1Menu, XsmA1Suggest): the context of one row. After the write the Board reads again and the
567
+ * row the PM lands on (the new one after a split, the one that stays after a merge) is selected and open. */
568
+ function smCtx(r) {
569
+ const ws = r.ws || M.board.ws || '';
570
+ return { row: r, rows: () => ((M.initiatives && M.initiatives.list && M.initiatives.list.rows) || []).filter((x) => (x.boardId || M.board.id) === (r.boardId || M.board.id)),
571
+ ws, board: r.boardId || M.board.id, product: r.product || M.board.product || M.board.name || '', program: programOf(PGS, ws, r.id), pmPost, say,
572
+ reload: async () => { await loadPrograms(); await load(); }, openIni: (id) => openIniId(id), openList: moveList };
573
+ }
574
+ const smItems = (r) => (M.board.self ? [] : SM.menuItems(smCtx(r)));
575
+ const smPress = (r, act) => SM.press(smCtx(r), act);
576
+ /** Open a row by its record id once the read holds it (a split's new row can take a read or two to show). */
577
+ async function openIniId(id, tries = 8) {
578
+ const r = (M && M.rows || []).find((x) => x.id === id) || goneRows().find((x) => x.id === id);
579
+ if (r && r.track) { if (curView() === 'time') TL.reveal(r.key); openIni(r, null); return true; }
580
+ if (tries <= 0) return false;
581
+ await new Promise((ok) => setTimeout(ok, 900));
582
+ await load();
583
+ return openIniId(id, tries - 1);
584
+ }
562
585
  function moveList(b, label, rows) {
563
586
  const host = Pop.open(`<p class="bd-mlbl">${esc(label)}</p>${rows.map((x, i) => `<button type="button" class="bd-mi" role="menuitem" data-pm-to="${i}">${x.icon ? `<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${x.icon}"/></svg>` : ''}<span class="tx"><span>${esc(x.label)}</span>${x.sub ? `<small>${esc(x.sub)}</small>` : ''}</span></button>`).join('')}`,
564
587
  b, { label: 'Move to another program', role: 'menu', width: 280, align: 'right', cls: 'bd-menu', focus: '.bd-mi' });
@@ -642,6 +665,22 @@ function msPop(anchor, r, ids, sheet) {
642
665
  document.addEventListener('pointerdown', (e) => { if (msEl && !msEl.contains(e.target) && !(msEl.__a && msEl.__a.contains(e.target))) msClose(); }, true);
643
666
  document.addEventListener('keydown', (e) => { if (msEl && e.key === 'Escape') { e.stopPropagation(); const a = msEl.__a; msClose(); if (a && a.focus) a.focus(); } }, true);
644
667
  addEventListener('resize', () => msClose());
668
+ /** A product lane's milestones as a list (batch 11 item 17; PlmA2Folded, PlmA3Phone): ◇, the name over its initiative, the date. Under a counted
669
+ * ◇ it holds that ◇'s milestones; a phone's sheet (title: the product) holds every one, in date order. A line opens its initiative. */
670
+ function lanePop(anchor, data, title) {
671
+ const was = msEl && msEl.__a === anchor; msClose(); if (was) return;
672
+ let L = []; try { L = JSON.parse(data || '[]'); } catch { L = []; }
673
+ if (!L.length) return;
674
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], md = (iso) => MON[+iso.slice(5, 7) - 1] + ' ' + +iso.slice(8, 10);
675
+ const el = document.createElement('div');
676
+ el.className = 'tg-msp tg-lnp' + (title ? ' sh' : ''); el.setAttribute('role', 'menu'); el.setAttribute('aria-label', title || 'Milestones'); el.dataset.escLayer = '';
677
+ el.innerHTML = (title ? `<i class="gr" aria-hidden="true"></i><b class="h">${esc(title)}</b>` : '')
678
+ + L.map((m) => `<button type="button" role="menuitem" class="o" data-ms-ini="${esc(m.k)}"><i class="tg-tm-i${m.s ? ' ' + m.s : ''}" aria-hidden="true"></i><span>${esc(m.n)}<small>${esc(m.t)}</small></span><span class="k${m.s === 'late' ? ' late' : ''}">${esc(md(m.d))}</span></button>`).join('');
679
+ document.body.appendChild(el); el.__a = anchor; msEl = el; anchor.setAttribute('aria-expanded', 'true');
680
+ if (!title) { const b = anchor.getBoundingClientRect(), w = el.offsetWidth; el.style.left = Math.max(8, Math.min(b.left + b.width / 2 - w / 2, innerWidth - w - 8)) + 'px'; el.style.top = b.bottom + 8 + 'px'; }
681
+ el.onclick = (e) => { const o = e.target.closest('[data-ms-ini]'); if (!o) return; msClose(); openIni(rowOf(o.dataset.msIni), anchor); };
682
+ const f = el.querySelector('button'); if (f) f.focus({ preventScroll: true });
683
+ }
645
684
  /** A gap's card (batch 11 item 13; XgapAHard 2): its words under it; while part of it is ahead, + opens New task with those dates filled in. */
646
685
  function gapPop(anchor, r) {
647
686
  const was = msEl && msEl.__a === anchor; msClose(); if (was || !r) return;
@@ -888,9 +927,18 @@ async function setDates(r, uid, patch) {
888
927
  const res = await pmPost('/api/boards/tasks/edit', { ...body, ...patch }).catch(() => null);
889
928
  if (!res || res.ok === false) { say((res && res.error) || 'Nothing was changed.'); return; }
890
929
  const ms = 'milestone' in patch;
891
- const back = {}; for (const f of Object.keys(patch)) back[f] = f === 'milestone' ? (res.from && 'milestone' in res.from ? !!res.from.milestone : !patch.milestone) : k ? (f === 'due' ? k.end : k[f]) || '' : '';
930
+ const back = {}; for (const f of Object.keys(patch)) back[f] = f === 'milestone' ? (res.from && 'milestone' in res.from ? !!res.from.milestone : !patch.milestone) : k ? (f === 'due' ? k.end : k[f]) || '' : res.from && f in res.from ? res.from[f] || '' : ''; // a Jira ticket's days come back in from (batch 11 item 23)
892
931
  const words = ms ? (patch.milestone ? 'Milestone' : 'Not a milestone') : 'Dates saved';
893
- say(words + (k ? ': ' + k.title : '') + '.', k || ms ? async () => { const u = await pmPost('/api/boards/tasks/edit', { ...body, ...back }).catch(() => null); say(u && u.ok !== false ? (ms ? 'Put back.' : 'Dates put back.') : (u && u.error) || 'The undo did not land.'); load(); } : undefined);
932
+ const jd = !k && !ms && res.from && ('start' in res.from || 'due' in res.from); // a Jira ticket's days, kept in PMOS (batch 11 item 23)
933
+ say(words + (k ? ': ' + k.title : jd ? ': ' + uid + ', kept in PMOS' : '') + '.', k || ms || jd ? async () => { const u = await pmPost('/api/boards/tasks/edit', { ...body, ...back }).catch(() => null); say(u && u.ok !== false ? (ms ? 'Put back.' : 'Dates put back.') : (u && u.error) || 'The undo did not land.'); load(); } : undefined);
934
+ load();
935
+ }
936
+ /** The status picker's trash on the panel's Tasks (batch 11 item 16): POST /api/boards/tasks/delete, a Board task or a breakdown item; Undo restores it. */
937
+ async function removeTask(r, uid) {
938
+ const k = (r.tasks || []).find((x) => x.uid === uid), body = { ws: r.ws || M.board.ws, board: r.boardId || M.board.id, task: uid };
939
+ const res = await pmPost('/api/boards/tasks/delete', body).catch(() => null);
940
+ if (!res || res.ok === false) { say((res && res.error) || 'The task was not deleted.'); return; }
941
+ say('Deleted · ' + (k ? k.title : uid) + '.', async () => { const u = await pmPost('/api/boards/tasks/restore', body).catch(() => null); if (!u || u.ok === false) say((u && u.error) || 'The undo did not land.'); load(); });
894
942
  load();
895
943
  }
896
944
  /** A task's title on the initiative view: the one task editor (task-card.js through home-task.js), as Home opens it; ← is the initiative. */
@@ -943,8 +991,8 @@ Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePa
943
991
  grouping: () => ({ on: groupingOn(), byProduct }), setGrouping, sprintFilter: sprintFilterOn });
944
992
  BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
945
993
  send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
946
- acts: (r, b) => Acts.open.row(r, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
947
- programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, toast: say, rename: renameIni, setTask, setDates, addTask, openTask, turnProgram, moveItems });
994
+ acts: (r, b) => Acts.open.row(r, b), hold: (r, i, b) => Acts.open.hold(r, i, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
995
+ programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, toast: say, rename: renameIni, setTask, setDates, removeTask, addTask, openTask, turnProgram, moveItems, smItems, smPress, openIniId });
948
996
  /** Tap the title to rename (canvas RnAIni): the list, the Timeline and the panel show the new name at once; Undo is the same press.
949
997
  * The Jira box opens Home's chat about it with the request typed, for the PM to send (PMOS holds no Jira credential, D53). */
950
998
  // a name the PM just saved holds over a read that predates it (the board derives off the request path) until a read says it too
@@ -7,7 +7,7 @@
7
7
  * 'reading' while the board derives, and the tab asks again. Inside a tab a task opens its own tab and the initiative link opens the initiative's. */
8
8
  import { vwOpen, vwStyle, vwClose } from './premium-viewer.js';
9
9
  import { esc, iniId, taskId, stateOf, readingHtml, errorHtml, iniHtml, taskHtml, findTask, cardTask } from './premium-vw-item-model.js';
10
- import { mountCard, boardSaver, checkOf, cardStyle, toastUndo, placeOf, deleteEntry } from './task-card.js';
10
+ import { mountCard, boardSaver, checkOf, cardStyle, toastUndo, placeOf, deleteEntry, historyFor } from './task-card.js';
11
11
  import { pmPost } from './http.js';
12
12
  import { setCheck } from './cozy-viewer.js';
13
13
 
@@ -104,6 +104,7 @@ export function openWorkItem(o) {
104
104
  openIni: (id) => openWorkItem({ kind: 'initiative', id, title: id === m.id ? m.title : '', ws: ctx.ws, board: ctx.board }),
105
105
  iniTitleOf: (id) => ((lists.inis || []).find((x) => x.id === id) || {}).title || id,
106
106
  inis: () => lists.inis || [], owners: () => lists.owners || [], groups: () => lists.groups, sections: () => lists.sections,
107
+ history: historyFor({ ws, board, t, post: (p, b) => pmPost(p, b) }), // what Claude changed with your ✓ (batch 12, TpA6)
107
108
  });
108
109
  check();
109
110
  // the pickers' lists: the board's initiatives and owners, the initiative's groups (read once, after the card shows)
@@ -0,0 +1,77 @@
1
+ /* pm/split-merge.css — split or merge initiatives (pm/split-merge.js; canvas In development, row "Split or merge initiatives"). split-merge.js
2
+ * loads it once, so it works on the Board and on Home. Token vars only, over pm/cozy.css; Claude's purple is the program's (cozy-panel.css),
3
+ * with the frames' value when the page sets none. Quiet: no motion. Every class starts with sm-. */
4
+ .sm-card, .sm-dot, .sm-v, .sm-gone { --sm-prog: var(--pp-prog, var(--cz-c-6b4fa3)); --sm-progbg: var(--pp-progbg, rgba(107,79,163,.10)); }
5
+ b:has(> .sm-nm), span:has(> .sm-nm) { display: flex; align-items: center; min-width: 0; }
6
+ .sm-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
7
+ .sm-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--sm-prog); margin-left: 8px; vertical-align: 2px; flex: none; box-shadow: 0 0 0 2px var(--cz-card); }
8
+
9
+ /* the card under the summary (XsmA1Suggest) */
10
+ .sm-card { background: var(--sm-progbg); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
11
+ .sm-h { display: flex; align-items: center; gap: 8px; color: var(--sm-prog); font-size: 13.5px; }
12
+ .sm-h b { font-weight: 800; }
13
+ .sm-h.q { color: var(--cz-ink3); }
14
+ .sm-why { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--cz-ink2); }
15
+ .sm-pl { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--cz-card); font-size: 13px; color: var(--cz-ink3); font-weight: 600; }
16
+ .sm-pl svg { color: var(--sm-prog); flex: none; }
17
+ .sm-pl b { color: var(--cz-ink); font-weight: 800; }
18
+ .sm-acts { display: flex; justify-content: flex-end; gap: 6px; }
19
+ .sm-ib { all: unset; box-sizing: border-box; cursor: pointer; width: 36px; height: 36px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink2); background: var(--cz-card); }
20
+ .sm-ib.ok { background: var(--cz-ink); color: var(--cz-card); }
21
+ .sm-ib[disabled] { opacity: .4; cursor: default; }
22
+ @media (hover: hover) { .sm-ib:not([disabled]):hover { color: var(--cz-ink); box-shadow: 0 0 0 1px var(--cz-hair); } .sm-ib.ok:not([disabled]):hover { filter: brightness(1.15); color: var(--cz-card); } }
23
+ .sm-ib:focus-visible, .sm-pk:focus-visible, .sm-gone .sm-lk:focus-visible, .sm-seg button:focus-visible, .sm-cb:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
24
+
25
+ /* the merged summary (XsmA7Closed) */
26
+ .sm-gone { background: var(--cz-well); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
27
+ .sm-gone p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--cz-ink2); }
28
+ .sm-gone .sm-lk { all: unset; cursor: pointer; color: var(--cz-blueink); font-weight: 700; }
29
+
30
+ /* the split editor and the merge check (XsmA2Split, XsmA5MergeCheck) */
31
+ .sm-v { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; min-height: 100%; box-sizing: border-box; }
32
+ .sm-nf { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px 0 14px; border-radius: 16px; background: var(--cz-well); color: var(--cz-ink2); }
33
+ .sm-nf input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 17px; font-weight: 800; color: var(--cz-ink); outline: none; }
34
+ .sm-sg, .sm-sg2 { display: inline-flex; color: var(--sm-prog); }
35
+ .sm-sg2 { margin-left: 6px; vertical-align: -1px; }
36
+ .sm-keep { margin: 0 4px; font-size: 12.5px; font-weight: 700; color: var(--cz-ink3); line-height: 1.6; }
37
+ .sm-st { display: inline-flex; align-items: center; gap: 2px; position: relative; }
38
+ .sm-st select { all: unset; cursor: pointer; font: inherit; color: var(--cz-ink2); padding-right: 2px; }
39
+ .sm-list { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--cz-hair); border-radius: 18px; padding: 6px; }
40
+ .sm-gh { display: flex; align-items: center; gap: 10px; padding: 8px 8px 4px; font-size: 12px; font-weight: 800; color: var(--cz-ink3); }
41
+ .sm-gh .n { margin-left: auto; color: var(--cz-blueink); }
42
+ .sm-pk { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; border-radius: 12px; cursor: pointer; }
43
+ .sm-pk.on { background: var(--cz-bluebg); }
44
+ .sm-t { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
45
+ .sm-t b { font-size: 13.5px; font-weight: 700; color: var(--cz-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
46
+ .sm-t span { margin-left: auto; font-size: 12px; color: var(--cz-ink3); font-weight: 600; white-space: nowrap; }
47
+ .sm-cb { all: unset; box-sizing: border-box; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--cz-ink3); background: var(--cz-card); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--cz-onsolid); cursor: pointer; }
48
+ .sm-cb.on { background: var(--cz-blueink); border-color: var(--cz-blueink); }
49
+ .sm-cb.some { border-color: var(--cz-blueink); }
50
+ .sm-cb.some i { width: 9px; height: 2px; border-radius: 1px; background: var(--cz-blueink); }
51
+ .sm-ki { display: inline-flex; color: var(--cz-ink3); }
52
+ .sm-q { margin: 8px; font-size: 12.5px; color: var(--cz-ink3); }
53
+ .sm-foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 2px; }
54
+ .sm-cnt { flex: 1; font-size: 13px; font-weight: 700; color: var(--cz-ink2); }
55
+ .sm-foot .sm-ib { width: 44px; height: 44px; box-shadow: 0 0 0 1px var(--cz-hair); }
56
+ .sm-foot .sm-ib.ok { box-shadow: none; }
57
+ .sm-mc { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--cz-hair); }
58
+ .sm-mc .sm-t { flex-direction: column; gap: 2px; align-items: flex-start; }
59
+ .sm-mc .sm-t span { margin-left: 0; }
60
+ .sm-mc.gone { background: var(--cz-well); }
61
+ .sm-mc.gone b { color: var(--cz-ink2); }
62
+ .sm-mc.stay { border-color: color-mix(in srgb, var(--cz-blueink) 35%, transparent); box-shadow: 0 0 0 3px var(--cz-bluebg); }
63
+ .sm-vi { width: 28px; height: 28px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--cz-bluebg); color: var(--cz-blueink); }
64
+ .sm-mc.gone .sm-vi { background: var(--cz-card); color: var(--cz-ink3); }
65
+ .sm-mid { display: flex; align-items: center; justify-content: center; gap: 10px; margin: -4px 0; color: var(--cz-ink3); }
66
+ .sm-mid .sm-ib { box-shadow: 0 0 0 1px var(--cz-hair); }
67
+ .sm-r { margin: -2px 0 0 4px; font-size: 12px; color: var(--cz-ink3); font-weight: 600; }
68
+ .sm-dfs { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
69
+ .sm-df { display: flex; align-items: center; gap: 10px; }
70
+ .sm-dl { width: 90px; font-size: 12.5px; font-weight: 800; color: var(--cz-ink3); }
71
+ .sm-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--cz-well); gap: 2px; }
72
+ .sm-seg button { all: unset; cursor: pointer; height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--cz-ink3); display: inline-flex; align-items: center; }
73
+ .sm-seg button[aria-checked="true"] { background: var(--cz-card); color: var(--cz-ink); box-shadow: 0 1px 3px rgba(42,46,53,.12); }
74
+ .sm-dn { margin: 0; display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--cz-ink2); line-height: 1.45; }
75
+ .sm-dn svg { color: var(--cz-ink3); flex: none; }
76
+ /* a phone: the Viewer is the full-screen sheet; the touch targets grow to 44 px */
77
+ @media (max-width: 760px) { .sm-ib { width: 44px; height: 44px; } .sm-pk { min-height: 48px; } .sm-card { border-radius: 18px; } }