create-pmos 0.441.0 → 0.443.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 (87) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +1 -1
  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/workspace/adler-seasons-art-test.js +106 -0
  7. package/workspace/adler-seasons-test.js +111 -0
  8. package/workspace/briefing-premium-board-test.js +19 -17
  9. package/workspace/briefing-premium-initiative-test.js +7 -4
  10. package/workspace/changelog.json +24 -0
  11. package/workspace/goals-clear-ui-test.js +249 -0
  12. package/workspace/guide/adler.md +10 -0
  13. package/workspace/guide/home.md +8 -1
  14. package/workspace/guide/metric-drafts.md +8 -2
  15. package/workspace/home-railcard-test.js +193 -0
  16. package/workspace/ini-workflow-test.js +6 -2
  17. package/workspace/intelligence-gaps-ui-test.js +16 -14
  18. package/workspace/lib/engine/records/index.js +9 -2
  19. package/workspace/lib/initiative-layout.js +3 -1
  20. package/workspace/lib/insights-premium.js +22 -1
  21. package/workspace/lib/metric-drafts.js +37 -10
  22. package/workspace/lib/metric-read-runs.js +20 -13
  23. package/workspace/lib/metric-reads.js +208 -23
  24. package/workspace/lib/metrics-cli.js +62 -5
  25. package/workspace/lib/routes-goal-status.js +89 -6
  26. package/workspace/lib/routes-insights-premium.js +1 -1
  27. package/workspace/lib/routes-metric-drafts.js +26 -3
  28. package/workspace/lib/settings-store.js +38 -0
  29. package/workspace/metric-drafts-ui-test.js +7 -4
  30. package/workspace/okr-goals-ui-test.js +7 -5
  31. package/workspace/package-lock.json +2 -2
  32. package/workspace/package.json +1 -1
  33. package/workspace/premium-board-actions-test.js +2 -1
  34. package/workspace/premium-chat-attach-test.js +2 -0
  35. package/workspace/program-panel-test.js +1 -1
  36. package/workspace/public/pm/bd-ini-panel.js +2 -2
  37. package/workspace/public/pm/c3-ini-ui.js +1 -1
  38. package/workspace/public/pm/cozy-adler.css +21 -0
  39. package/workspace/public/pm/cozy-adler.js +415 -8
  40. package/workspace/public/pm/cozy-ev.css +16 -1
  41. package/workspace/public/pm/cozy-home.css +8 -0
  42. package/workspace/public/pm/cozy-insights.css +82 -0
  43. package/workspace/public/pm/cozy-live-pill.css +5 -0
  44. package/workspace/public/pm/cozy-news.js +1 -1
  45. package/workspace/public/pm/cozy-seasons.js +318 -0
  46. package/workspace/public/pm/cozy-settings.js +88 -5
  47. package/workspace/public/pm/cozy-today.css +15 -0
  48. package/workspace/public/pm/cozy-viewer.js +50 -18
  49. package/workspace/public/pm/cozy-vw-shell.css +4 -0
  50. package/workspace/public/pm/cozy.css +65 -0
  51. package/workspace/public/pm/dash-view.js +4 -2
  52. package/workspace/public/pm/goals-clear.js +258 -0
  53. package/workspace/public/pm/home-app.js +59 -5
  54. package/workspace/public/pm/home-chat.js +1 -1
  55. package/workspace/public/pm/home-day.js +7 -4
  56. package/workspace/public/pm/home-ini.js +2 -2
  57. package/workspace/public/pm/home-mentions.js +1 -1
  58. package/workspace/public/pm/home-today.js +51 -10
  59. package/workspace/public/pm/impact.js +1 -1
  60. package/workspace/public/pm/ini-groups.js +28 -17
  61. package/workspace/public/pm/ini-links.js +1 -1
  62. package/workspace/public/pm/ini-tasks.js +246 -48
  63. package/workspace/public/pm/ini-view-model.js +45 -16
  64. package/workspace/public/pm/ini-view.css +330 -1
  65. package/workspace/public/pm/ini-view.js +196 -83
  66. package/workspace/public/pm/metric-drafts.js +4 -1
  67. package/workspace/public/pm/mission.js +238 -0
  68. package/workspace/public/pm/premium-board.js +1 -1
  69. package/workspace/public/pm/premium-insights.js +178 -24
  70. package/workspace/public/pm/premium-welcome.js +2 -2
  71. package/workspace/public/pm/split-merge.js +1 -1
  72. package/workspace/public/pm/stage-line.js +2 -2
  73. package/workspace/server.js +6 -2
  74. package/workspace/skills/metric-read.skill +7 -5
  75. package/workspace/split-merge-ui-test.js +1 -1
  76. package/workspace/stage-card-test.js +56 -11
  77. package/workspace/task-links-test.js +2 -0
  78. package/workspace/task-milestones-test.js +5 -1
  79. package/workspace/task-plans-test.js +3 -3
  80. package/workspace/task-views-test.js +279 -37
  81. package/workspace/test-lists/adler-seasons-art.json +13 -0
  82. package/workspace/test-lists/batch18-adler-seasons.json +13 -0
  83. package/workspace/test-lists/goals-clear.json +15 -0
  84. package/workspace/test-lists/home-railcard.json +9 -0
  85. package/workspace/test-lists/mission.json +5 -0
  86. package/workspace/test-lists/viewer-tasks.json +5 -0
  87. package/workspace/tk-tasks-test.js +27 -32
@@ -3,13 +3,11 @@
3
3
  * markup in the Viewer's shell; only the host's chrome differs (the Board floats it with its grip, Home sets it beside the chat, the phone
4
4
  * shows it full screen). The look is pm/ini-view.css, loaded here once.
5
5
  *
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
- * 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 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. Under the stage card, the success measure Claude
11
- * drafted from the PRD (pm/metric-drafts.js, GET /api/metric-drafts scope initiative): the proposal, or once kept its
12
- * fold with Undo; nothing when nothing is drafted.
6
+ * viewHtml(v, o) the body: the card (batch 18 item 1, XvpA1: Adler's ask with the one primary, the meta line of icons, then the
7
+ * mission, pm/mission.js, in the stage line's place), then Tasks as the WBS (sections in workflow order), then Documents
8
+ * and Linked as folds. From about 900 px the card is a 420 px column on the left and the rest fills the right
9
+ * (XvpD1Desktop). Under the card, the success measure Claude drafted from the PRD (pm/metric-drafts.js, GET
10
+ * /api/metric-drafts scope initiative): the proposal, or once kept its fold with Undo; nothing when nothing is drafted.
13
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,
14
12
  * quick (each task's box carries the status caret and its date is a press: the host has h.status and h.dates),
15
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),
@@ -22,14 +20,16 @@
22
20
  * h.person(btn), h.stagePick(btn), h.planDates(btn), h.jira(btn) (batch 16 item 5c),
23
21
  * 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,
24
22
  * h.status(uid, state) and h.dates(uid, { start?, due? }) (the quick changes, each saved at once with Undo in the host's toast);
25
- * 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),
26
- * h.hold(i, btn) a hold's ⏸ or calendar (o.hold: the host has it), h.openIni(id) "after <initiative>";
23
+ * the mission: h.openTask(uid) a flag, the planet or the dish, h.hold(i, btn) the hold's chip (o.hold: the host has it),
24
+ * h.asks(btn) the ask's count (else the primary);
27
25
  * for planned versus actual (pm/ini-versions.js) h.where() → { ws, board }, h.reload() and h.toast(text, undo?)
28
26
  *
29
27
  * Tasks has three views (batch 9 item 5b; canvas In development, row "Tasks views"): the List (the WBS below), Timeline and Kanban
30
- * (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
31
- * 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
32
- * carries the send icons and Send to Jira, which used to be the old All tasks panel's.
28
+ * (pm/ini-tasks.js). The Tasks header holds one view button and + (batch 18 item 1, XvpA4Sheet): the button opens the view sheet, three
29
+ * rows of the same shape: View, Group by and the Timeline's Zoom (Weeks, Months, All). The last view is remembered for the PM. Group by
30
+ * (batch 11 item 20, pm/ini-groups.js) groups the same tasks by Stage, Owner or Status (the sheet's ⋯: Epic, Your groups) in all three
31
+ * views; By epic carries the send icons and Send to Jira, which used to be the old All tasks panel's. The List shows only the stages with
32
+ * something open (the rest wait in one fold at its foot), and a stage folds after 3 tasks.
33
33
  *
34
34
  * Folds keep their state per initiative for the session (a section, the Later line, a WBS group, the done tasks). Icon-only presses carry
35
35
  * their words in aria-label and title. Zero is silence: a part with nothing on record draws nothing. */
@@ -40,7 +40,8 @@ import * as LK from './ini-links.js'; // links between tasks and quiet moves (
40
40
  import * as PP from './ini-props.js'; // what Claude proposes, under the one blue ✦ after the title (batch 12 items 2, 3 and 4)
41
41
  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)
42
42
  import { cardHtml as smCard, mergedHtml as smMerged } from './split-merge.js'; // split or merge: Claude's card, the merged summary (batch 11 item 14)
43
- import { lineHtml, fitLine } from './stage-line.js'; // the stage card's one line (batch 11 item 21)
43
+ import * as MI from './mission.js'; // the initiative as a mission, the stage line's place (batch 18 item 1)
44
+ import * as AD from './cozy-adler.js'; // Adler on the card: his face for the ask, his full body for a real win
44
45
  import * as MD from './metric-drafts.js'; // the success measure Claude drafts from the PRD (batch 15 item 1, canvas Iq9Initiative)
45
46
 
46
47
  const CSS = new URL('./ini-view.css', import.meta.url).href;
@@ -59,74 +60,125 @@ const FOLD = new Map(); // `${id}|${key}` → true (open) | false (shut): the
59
60
  const isOpen = (v, key, dflt) => { const k = (v.id || v.key) + '|' + key; return FOLD.has(k) ? FOLD.get(k) : !!dflt; };
60
61
  const SHOWN = new Map(); // id → the view last drawn, for the Kanban's stage picker
61
62
 
62
- /* ── the summary card ── */
63
- function summaryHtml(s, o = {}) {
64
- const dot = s.tone === 'you' ? 'you' : s.tone === 'warn' ? 'warn' : s.tone === 'ok' ? 'ok' : '';
65
- const go = s.primary ? `<button type="button" class="iv-go" data-iv-primary="${esc(s.primary.act)}" aria-label="${esc(s.primary.label)}" title="${esc(s.primary.label)}">${SVG(P.go, 16, 2.2)}</button>` : '';
66
- const meta = [];
67
- // the dashed + after the people (batch 16 item 5c): Add a stakeholder, where it left the ⋯
68
- const addP = o.person ? `<button type="button" class="iv-addp" data-iv-person aria-label="Add a stakeholder" title="Add a stakeholder">${SVG(P.plus, 12, 2.4)}</button>` : '';
69
- if (s.status) meta.push(`<span class="iv-st ${esc(s.status.tone)}"><i aria-hidden="true"></i>${esc(s.status.text)}</span>`);
70
- meta.push((s.owner ? `<span class="iv-who"><span class="iv-av" aria-hidden="true">${esc(s.owner.av)}</span>${esc(s.owner.name)}</span>` : '<span class="iv-who q">No owner</span>') + addP);
71
- if (s.wf) meta.push(o.wf ? `<button type="button" class="iv-wf" data-iv-wf aria-haspopup="listbox" aria-label="${esc('Workflow: ' + (s.wf.name || 'Product feature') + '. Change')}" title="Change the workflow">${wfIcon(s.wf, 15)}${esc(s.wf.name || 'Product feature')}</button>`
72
- : `<span class="iv-wf">${wfIcon(s.wf, 15)}${esc(s.wf.name || 'Product feature')}</span>`);
73
- if (s.program) meta.push(`<button type="button" class="iv-prog" data-iv-program="${esc(s.program.id)}" title="Open the program ${esc(s.program.title)}">${SVG(P.prog, 15)}${esc(s.program.title)}</button>`);
74
- if (!s.line && !s.text && !go) return '';
75
- // nothing to say beyond the status (batch 16 item 7, "feels like wasting space"): one row. The owner is the avatar, the workflow its icon,
76
- // each named on hover and to a reader; the program keeps its name, because it is a press
77
- if (!s.text && !go) {
78
- const m = [];
79
- if (s.status) m.push(`<span class="iv-st ${esc(s.status.tone)}"><i aria-hidden="true"></i>${esc(s.status.text)}</span>`);
80
- m.push((s.owner ? `<span class="iv-who" title="${esc('Owner: ' + s.owner.name)}"><span class="iv-av" aria-hidden="true">${esc(s.owner.av)}</span><span class="iv-sr">${esc(s.owner.name)}</span></span>` : '<span class="iv-who q">No owner</span>') + addP);
81
- const wn = s.wf ? s.wf.name || 'Product feature' : '';
82
- if (s.wf) m.push(o.wf ? `<button type="button" class="iv-wf" data-iv-wf aria-haspopup="listbox" aria-label="${esc('Workflow: ' + wn + '. Change')}" title="${esc('Workflow: ' + wn + '. Change')}">${wfIcon(s.wf, 15)}<span class="iv-sr">${esc(wn)}</span></button>`
83
- : `<span class="iv-wf" title="${esc('Workflow: ' + wn)}">${wfIcon(s.wf, 15)}<span class="iv-sr">${esc(wn)}</span></span>`);
84
- if (s.program) m.push(`<button type="button" class="iv-prog" data-iv-program="${esc(s.program.id)}" title="Open the program ${esc(s.program.title)}">${SVG(P.prog, 15)}${esc(s.program.title)}</button>`);
85
- return `<section class="iv-sum iv-one" aria-label="Summary"><div class="iv-s1 ${dot}">${dot && dot !== 'ok' ? '<span class="iv-dot" aria-hidden="true"></span>' : ''}<b>${esc(s.line)}</b>`
86
- + `<p class="iv-meta">${m.join('')}</p>${s.right ? `<span class="iv-r">${esc(s.right)}</span>` : ''}</div></section>`;
87
- }
88
- return `<section class="iv-sum" aria-label="Summary"><div class="iv-s1 ${dot}">${dot && dot !== 'ok' ? '<span class="iv-dot" aria-hidden="true"></span>' : ''}<b>${esc(s.line)}</b>`
89
- + `${s.right ? `<span class="iv-r">${esc(s.right)}</span>` : ''}${go}</div>${s.text ? `<p class="iv-why">${esc(s.text)}</p>` : ''}`
90
- + `<p class="iv-meta">${meta.join('<span class="iv-sep" aria-hidden="true">·</span>')}</p></section>`;
63
+ /* ── the card: the ask, the meta line and the mission, one card (batch 18 item 1, agreed A; canvas XvpA1, XvpA2Dark, XvpE1States,
64
+ * XvpE2Stages, XvpE5Adler, XvpD1Desktop) ──
65
+ * The ask: Adler's Needs you face where the dot and the label stood, the ask in his voice, one → (a small count opens the other asks).
66
+ * With Adler on the card (he asks, or Claude works) the whole card takes his wash; without him it is plain. One primary per card: the ask's
67
+ * →, else Plan → once every task of the stage is done. The meta line: the owner (face or an empty ring), the stakeholders as a stack with
68
+ * "+N", the workflow icon and the program chip, which truncates first. The mission (pm/mission.js) replaces the stage line; a tap on a
69
+ * flag, the planet or the dish opens that milestone's task, a tap anywhere else opens the stages and milestones in place (2 of 4 done, ⋯ for
70
+ * the stage picker, the next stage). His full body shows only on a real win (the stage's tasks are all done, the first view: his thanks and
71
+ * Plan →, the mission steps aside that once). */
72
+ const LINE = new Map(); // id → what is unfolded under the mission ('' | 'list' | 'list+')
73
+ const MORE = 'M5 12h.01M12 12h.01M19 12h.01', RING = 'M12 12a3.5 3.5 0 1 0 0-7a3.5 3.5 0 1 0 0 7M5.5 19.5a6.5 6.5 0 0 1 13 0';
74
+ function metaHtml(s, o) {
75
+ const who = s.owner ? `<span class="iv-mt iv-own" title="${esc('Owner: ' + s.owner.name)}"><span class="iv-av" aria-hidden="true">${esc(s.owner.av)}</span><span class="iv-sr">${esc('Owner: ' + s.owner.name)}</span></span>`
76
+ : `<span class="iv-mt iv-ring" role="img" aria-label="No owner" title="No owner">${SVG(RING, 16, 2)}</span>`;
77
+ const st = s.stake || [], shown = st.slice(0, 2), more = st.length - shown.length;
78
+ const stack = shown.map((p) => `<span class="iv-av" aria-hidden="true">${esc(p.av)}</span>`).join('') + (more > 0 ? `<span class="iv-avn" aria-hidden="true">+${more}</span>` : '');
79
+ const sw = st.length ? (o.person ? `<button type="button" class="iv-mt iv-avs" data-iv-person aria-label="${esc('Stakeholders: ' + st.map((p) => p.name).join(', ') + '. Add one')}" title="Stakeholders">${stack}</button>`
80
+ : `<span class="iv-mt iv-avs" role="img" aria-label="${esc('Stakeholders: ' + st.map((p) => p.name).join(', '))}">${stack}</span>`)
81
+ : o.person ? `<button type="button" class="iv-mt iv-addp" data-iv-person aria-label="Add a stakeholder" title="Add a stakeholder">${SVG(P.plus, 14, 2.2)}</button>` : '';
82
+ const wn = s.wf ? s.wf.name || 'Product feature' : '';
83
+ const wf = !s.wf ? '' : o.wf ? `<button type="button" class="iv-mt iv-wf" data-iv-wf aria-haspopup="listbox" aria-label="${esc('Workflow: ' + wn + '. Change')}" title="${esc('Workflow: ' + wn + '. Change')}">${wfIcon(s.wf, 17)}</button>`
84
+ : `<span class="iv-mt iv-wf" role="img" aria-label="${esc('Workflow: ' + wn)}" title="${esc('Workflow: ' + wn)}">${wfIcon(s.wf, 17)}</span>`;
85
+ const prog = s.program ? `<button type="button" class="iv-prog" data-iv-program="${esc(s.program.id)}" title="${esc('Open the program ' + s.program.title)}">${SVG(P.prog, 15)}<span>${esc(s.program.title)}</span></button>` : '';
86
+ return `<p class="iv-meta">${who}${sw}${wf}${prog}</p>`;
91
87
  }
92
-
93
- /* ── 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) ──
94
- * 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
95
- * replaces it, the calendar when a date is missing, and the next stage's name with → that opens the move sheet (blue when every task of the
96
- * stage is done and the next stage waits; batch 14 item 11: a bare → did not say where it goes). The line is pm/stage-line.js. */
97
- const CLOCK = 'M12 7.5V12l3 2M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17';
98
- const LINE = new Map(); // id → what is unfolded under the line ('' | 'list' | 'list+' | 'ms:<i>' | 'gap:<i>')
99
- function stageHtml(st, o, id) {
100
- const L = st.line;
88
+ function nextHtml(st, o, pri) {
89
+ const n = st.next; if (!n) return '';
90
+ const tag = o.next ? 'button type="button" data-iv-next' : 'span';
91
+ return `<${tag} class="iv-scgo${pri ? ' 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)}"><span class="iv-scgn">${n.ms ? '◆ ' : ''}${esc(n.name)}</span>${SVG(P.go, 16, 2.2)}</${o.next ? 'button' : 'span'}>`;
92
+ }
93
+ function missionBox(v, o, pri) {
94
+ const st = v.stage, L = st.line, id = v.id || v.key || '', M = MI.missionOf(L);
95
+ const open = LINE.get(id) || '';
101
96
  const tile = st.n ? `<span class="iv-no${st.ms ? ' ms' : ''}" aria-hidden="true">${st.ms ? '' : st.n}</span>` : '';
102
- 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>`) : '';
103
- 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>` : '';
104
- const clock = !chip && st.clock ? `<span class="iv-clk${st.dayOver ? ' w' : ''}">${SVG(CLOCK, 13, 2)}${esc(st.clock)}</span>` : '';
105
- 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>`
106
- : 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>` : '';
107
- const n = st.next;
108
- 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)}"><span class="iv-scgn">${n.ms ? '◆ ' : ''}${esc(n.name)}</span>${SVG(P.go, 16, 2.2)}</${o.next ? 'button' : 'span'}>` : '';
109
- // a phone puts "N of M done" and the clock on a line of their own under the name (ScxA2Phone)
110
- const meta = of || clock || chip ? `<span class="iv-scm">${of}${clock}${chip}</span>` : '';
111
- // the stage's name is the chip that moves it (batch 16 item 5c, FmI2Stage): every stage, Moves on by itself, hold, Won't do, Archive
112
- const name = o.stagePick ? `<button type="button" class="iv-stc" data-iv-stagepick aria-haspopup="menu" aria-expanded="false" aria-label="${esc('Stage: ' + st.name + '. Change')}" title="Change the stage"><b>${esc(st.name)}</b>${SVG(P.down, 12, 2.4)}</button>` : `<b>${esc(st.name)}</b>`;
113
- // the plan's dates are the chip that changes them; with none, a calendar says so
114
- const D = st.dates, dtxt = D && (D.start || D.end) ? [D.start, D.end].filter(Boolean).join(' – ') : '';
115
- const dates = o.planDates ? (dtxt ? `<button type="button" class="iv-dtc" data-iv-plandates aria-label="${esc('Plan dates: ' + dtxt + '. Change')}" title="Change the plan dates">${esc(dtxt)}</button>`
116
- : `<button type="button" class="iv-ib iv-scb" data-iv-plandates aria-label="No plan dates yet. Set them" title="Set the plan dates">${SVG(P.cal, 16)}</button>`) : '';
117
- const head = `<div class="iv-sch">${tile}${name}<span class="iv-sp"></span>${meta}${dates}${dates && cal && L.cal === 'dates' ? '' : cal}${go}</div>`;
118
- return `<section class="iv-sc" aria-label="${esc(st.aria || 'Stage · ' + st.name)}">${head}${lineHtml(L, { open: LINE.get(id) || '', hold: !!o.hold })}</section>`;
97
+ const name = o.stagePick ? `<button type="button" class="iv-stc" data-iv-stagepick aria-haspopup="menu" aria-expanded="false" aria-label="${esc('Stage: ' + st.name + '. Change')}" title="Change the stage"><b>${esc(st.name)}</b></button>` : `<b>${esc(st.name)}</b>`;
98
+ // no plan dates: the gap carries its next action
99
+ const set = L && L.empty && o.planDates ? `<button type="button" class="iv-setd" data-iv-plandates aria-label="No plan dates yet. Set them" title="Set the plan dates">${SVG(P.cal, 15, 2)}Set dates</button>` : '';
100
+ const go = pri ? nextHtml(st, o, true) : '';
101
+ // on hold: when it comes back, a press on it opens the hold (the host sets a return date)
102
+ const ch = L && L.chip && L.chip.pause ? (o.hold && L.holdAt != null ? `<button type="button" class="iv-chp ${esc(L.chip.tone)}" data-iv-hold="${L.holdAt}" title="Open the hold">${SVG(P.pause, 11, 2.4)}${esc(L.chip.text)}</button>`
103
+ : `<span class="iv-chp ${esc(L.chip.tone)}">${SVG(P.pause, 11, 2.4)}${esc(L.chip.text)}</span>`) : '';
104
+ const head = `<div class="iv-sch"><span class="iv-shn">${tile}${name}</span><span class="iv-sp"></span>${ch}${set}${go}</div>`;
105
+ const nn = MI.nowName(M);
106
+ const pic = `<div class="iv-mi" role="button" tabindex="0" data-iv-mi aria-expanded="${!!open}" aria-label="${esc('Stage ' + st.name + '. Show the stages and milestones')}">`
107
+ + MI.missionSvg(M, { tap: !!o.openTask })
108
+ + (nn ? `<div class="iv-mi-nm" aria-hidden="true"><span class="${nn.late ? 'late' : ''}" style="left:${nn.x}%">${esc(nn.name)}</span></div>` : '')
109
+ + '<span class="iv-mi-tip" role="tooltip" hidden></span></div>';
110
+ // in place (XvpE2Stages, Wawan 10:59): the stage's dates, ⋯ the stage picker, the next stage; then the milestones, the same list as the
111
+ // desktop's Milestones card (the picture already shows the stages)
112
+ // on a desktop the dates line always shows under the picture and the Milestones card holds the list (Wawan 11:58: the line was missing,
113
+ // and an open picture showed the milestones twice); on a phone both wait for the picture's tap
114
+ let below = '';
115
+ {
116
+ const more = o.stagePick ? `<button type="button" class="iv-ib iv-mo" data-iv-stagepick aria-haspopup="menu" aria-expanded="false" aria-label="${esc('Stage: ' + st.name + '. Change')}" title="Change the stage">${SVG(MORE, 18, 3)}</button>` : '';
117
+ const D = st.dates, dt = D && (D.start || D.end) ? [D.start, D.end].filter(Boolean).join(' – ') + (D.left ? ' · ' + D.left : '') : '';
118
+ const dates = dt ? (o.planDates ? `<button type="button" class="iv-dtc${D.over ? ' w' : ''}" data-iv-plandates aria-label="${esc('Plan dates: ' + dt + '. Change')}" title="Change the plan dates">${esc(dt)}</button>` : `<span class="iv-dtc${D.over ? ' w' : ''}">${esc(dt)}</span>`) : '';
119
+ below = `<div class="iv-mio${open ? ' on' : ''}"><div class="iv-mio-h">${dates}<span class="iv-mio-b">${more}${pri ? '' : nextHtml(st, o, false)}</span></div>${msListHtml(v, o)}</div>`;
120
+ }
121
+ return `<div class="iv-sc iv-mis" aria-label="${esc(st.aria || 'Stage · ' + st.name)}">${head}${pic}${below}</div>`;
122
+ }
123
+ function cardHtml(v, o = {}) {
124
+ const s = v.summary, st = v.stage, id = v.id || v.key || '';
125
+ const on = AD.prefs()['adler.amount'] !== 'off';
126
+ const ask = s.tone === 'you' && s.primary;
127
+ const claude = !ask && s.claude;
128
+ const pri = !ask && !!st.ready && !!st.next;
129
+ // a real win: every task of the stage is done, on the first view only (pm/cozy-adler.js celebrateOnce), his thanks and Plan →
130
+ const win = pri && on && st.key && id && AD.prefs()['adler.amount'] === 'full' && AD.celebrateOnce('stage:' + id + ':' + st.key);
131
+ const meta = metaHtml(s, o);
132
+ if (win) {
133
+ return `<section class="iv-sum iv-card adl win" aria-label="Summary and stage"><div class="iv-win"><span class="iv-wfig">${AD.adler('celebrating', 'l', { label: 'Adler, glad' })}</span>`
134
+ + `<div class="iv-wt"><p>${esc(st.name + ' is done. Thanks for the work that got it there.')}</p>${nextHtml(st, o, true)}</div></div>${meta}</section>`;
135
+ }
136
+ let top = '';
137
+ if (ask) {
138
+ const n = s.n > 1 ? `<button type="button" class="iv-cnt" data-iv-asks aria-label="${esc(s.n + ' asks wait on you. Show them')}" title="Show the other asks">${s.n}</button>` : '';
139
+ top = `<div class="iv-ask">${AD.adler('needs-you', 'm', { label: false })}<p class="iv-why">${esc(s.say || s.text || s.primary.label)}</p>${n}`
140
+ + `<button type="button" class="iv-go" data-iv-primary="${esc(s.primary.act)}" aria-label="${esc(s.primary.label)}" title="${esc(s.primary.label)}">${SVG(P.go, 16, 2.2)}</button></div>`;
141
+ } else if (claude) top = `<div class="iv-ask cl">${AD.adler('thinking', 'm', { label: false })}<p class="iv-why">${esc(s.claude)}</p></div>`;
142
+ const box = missionBox(v, o, pri);
143
+ const adl = on && (ask || claude);
144
+ const body = ask || claude ? top + meta + '<div class="iv-hr"></div>' + box : box + '<div class="iv-hr"></div>' + meta;
145
+ return `<section class="iv-sum iv-card${adl ? ' adl' : ''}" aria-label="Summary and stage">${body}</section>`;
146
+ }
147
+ /* the milestones, one list for both sizes (Wawan 10:53 and 10:59, canvas v586 and v589): on a desktop their own card under the card, always
148
+ * shown (XvpD1Desktop); on a phone the mission's tap opens them in place (XvpE2Stages; ini-view.css hides the card below two columns).
149
+ * "Milestones · 1 of 4 done"; a done one has a green tick, the next one is blue with "in N days" (orange with its days late), the release
150
+ * says so; a row opens its task. */
151
+ const DIA = 'M12 3l9 9-9 9-9-9z';
152
+ function msListHtml(v, o) {
153
+ const L = v.stage && v.stage.line; if (!L || !L.ms) return '';
154
+ const seen = new Set(), all = [];
155
+ for (const m of L.ms) for (const x of m.items || []) if (x.id && !seen.has(x.id)) { seen.add(x.id); all.push(x); }
156
+ if (!all.length) return '';
157
+ const rel = MI.releaseOf(L.ms), relId = rel && rel.item.id, next = all.find((x) => !x.done), done = all.filter((x) => x.done).length;
158
+ const row = (x) => {
159
+ const up = x === next, cls = x.done ? 'dn' : up ? (x.late ? 'up late' : 'up') : '';
160
+ const note = x.done ? '' : up ? (x.late ? (x.ago ? x.ago + (x.ago === 1 ? ' day late' : ' days late') : 'late') : x.left === 0 ? 'today' : x.left === 1 ? 'tomorrow' : x.left ? 'in ' + x.left + ' days' : '') : x.id === relId ? 'release' : '';
161
+ const when = x.date + (note ? ' · ' + note : '') + (x.id === relId && note !== 'release' ? ' · release' : '');
162
+ const mk = x.done ? `<span class="iv-msk dn">${SVG(P.check, 11, 3)}</span>` : `<span class="iv-msk">${SVG(DIA, 13, 2.4)}</span>`;
163
+ const tag = o.openTask ? 'button type="button"' : 'div';
164
+ return `<${tag} class="iv-msr${cls ? ' ' + cls : ''}" role="listitem"${o.openTask ? ` data-iv-ms="${esc(x.id)}"` : ''} aria-label="${esc('Milestone ' + x.name + ', ' + when + (o.openTask ? '. Open its task' : ''))}">${mk}<span class="iv-msn">${esc(x.name)}</span><span class="iv-msd">${esc(when)}</span></${o.openTask ? 'button' : 'div'}>`;
165
+ };
166
+ return `<div class="iv-msh"><b>Milestones</b><span class="n">${esc(done + ' of ' + all.length + ' done')}</span></div><div class="iv-msl" role="list">${all.map(row).join('')}</div>`;
119
167
  }
168
+ function msCardHtml(v, o) { const h = msListHtml(v, o); return h ? `<section class="iv-msc" aria-label="Milestones">${h}</section>` : ''; }
169
+ /** Adler is on the card (his face asks or Claude works, or his full body on a win): the empty Tasks then draws no figure (one Adler per screen). */
170
+ const cardHasAdler = (v) => AD.prefs()['adler.amount'] !== 'off' && ((v.summary.tone === 'you' && !!v.summary.primary) || !!v.summary.claude);
120
171
 
121
172
  /* ── the WBS ── */
122
173
  function taskHtml(x, o, arch) {
123
174
  // the box marks done in one press; its caret opens the status picker right under it (an archived task has only the caret)
124
175
  const car = o.quick && x.uid ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" data-ms="${x.ms ? 1 : 0}" aria-haspopup="dialog" aria-label="${esc('Change the status: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '';
125
176
  const cls = ['iv-cb', x.done ? 'on' : '', x.prog ? 'pr' : '', x.wont ? 'wo' : ''].filter(Boolean).join(' ');
126
- const chk = x.jkey && !x.dr ? `<span class="iv-bxw"><span class="iv-jq${x.closed ? ' dn' : ''}" role="img" aria-label="${esc('Jira ' + x.jkey + ': ' + x.status)}" title="${esc('Jira · ' + x.status)}"></span>${arch ? car : ''}</span>` : x.dr ? `<span class="iv-bxw"><span class="iv-cb dr" aria-hidden="true"></span>${car}</span>` : x.canCheck && !arch ? `<span class="iv-bxw"><button type="button" class="${cls}" data-iv-check="${esc(x.uid)}" aria-pressed="${x.done}" aria-label="${esc((x.done ? 'Reopen: ' : 'Mark done: ') + x.title)}" title="${x.done ? 'Reopen' : 'Mark done'}">${x.done ? SVG(P.check, 12, 3) : ''}</button>${car}</span>`
177
+ const chk = x.jkey && !x.dr ? `<span class="iv-bxw">${TV.jqMark(x)}${arch ? car : ''}</span>` : x.dr ? `<span class="iv-bxw"><span class="iv-cb dr" aria-hidden="true"></span>${car}</span>` : x.canCheck && !arch ? `<span class="iv-bxw"><button type="button" class="${cls}" data-iv-check="${esc(x.uid)}" aria-pressed="${x.done}" aria-label="${esc((x.done ? 'Reopen: ' : 'Mark done: ') + x.title)}" title="${x.done ? 'Reopen' : 'Mark done'}">${x.done ? SVG(P.check, 12, 3) : ''}</button>${car}</span>`
127
178
  : `<span class="iv-bxw"><span class="iv-cb off${x.done ? ' on' : ''}" aria-hidden="true">${x.done ? SVG(P.check, 12, 3) : ''}</span>${arch ? car : ''}</span>`;
128
- // a task named for a Jira ticket looks like the ticket rows beside it (batch 14 item 6): the Jira square, the key in blue
129
- const name = x.jkey ? `<em>${esc(x.jkey)}</em> ${esc(x.title.replace(/^\s*[A-Z][A-Z0-9]+-\d+\s*/, ''))}` : esc(x.title);
179
+ // a task linked to the Jira ticket it names looks like the ticket rows beside it (batch 14 item 6): the Jira square, the key in blue.
180
+ // A key PMOS has not read is only text: a plain task with its box (0.442.0 hotfix)
181
+ const name = TV.keyName(x);
130
182
  const t = (o.openTask && x.uid && !x.dr ? `<button type="button" class="iv-tt" data-iv-task="${esc(x.uid)}">${name}</button>` : `<b class="iv-tt">${name}</b>`) + TV.msGlyph(x) + TV.addedMark(x);
131
183
  // the meta: In progress, the dates (a press: the start and due picker opens under them), the late days, the owner
132
184
  let meta = x.sub ? `<span class="${x.late ? 'w' : ''}">${esc(x.sub)}</span>` : '';
@@ -144,7 +196,10 @@ function taskHtml(x, o, arch) {
144
196
  const chev = (open) => `<span class="iv-cv" aria-hidden="true">${SVG(open ? P.down : P.right, 15, 2)}</span>`;
145
197
  function bodyHtml(v, sec, o) {
146
198
  // By epic (batch 11 item 20): an epic's tickets first, or what comes next while nothing is drafted
147
- let h = G.tkRowsHtml(sec) + G.tkEmptyHtml(sec) + sec.top.map((x) => taskHtml(x, o)).join('');
199
+ // a stage folds after 3 tasks (batch 18 item 1): "N more" shows the rest
200
+ const mk = sec.key + ':more', mop = isOpen(v, mk, false), top = mop || sec.top.length <= 3 ? sec.top : sec.top.slice(0, 3);
201
+ let h = G.tkRowsHtml(sec) + G.tkEmptyHtml(sec) + top.map((x) => taskHtml(x, o)).join('');
202
+ if (sec.top.length > top.length) h += `<button type="button" class="iv-more" data-iv-fold="${esc(mk)}" aria-expanded="false">${esc((sec.top.length - top.length) + ' more')}${SVG(P.right, 14, 2)}</button>`;
148
203
  if (sec.jira) {
149
204
  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); }
150
205
  const all = isOpen(v, sec.key + ':tk', false), shown = all ? sec.jira.open : sec.jira.open.slice(0, 3);
@@ -214,10 +269,15 @@ function tasksHtml(v0, o) {
214
269
  // links (batch 11 item 15): the blue ✦ (proposals), the grey ✦ (quiet moves), the late count, between the count and the version chip
215
270
  const lk = T.empty ? null : LK.of(v);
216
271
  o = { ...o, lk };
217
- 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>`
272
+ 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 ? '' : G.headHtml(v) + TV.viewBtnHtml(mode) + TV.fullBtnHtml(mode)}${VS.liveHtml(v.vs)}${add}</div>`
218
273
  + (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>` : '');
219
274
  // while Claude looks for a new initiative elsewhere, Tasks waits for what it finds (PiA1)
220
275
  if (T.empty && PP.lookHtml(v)) return head + PP.lookHtml(v);
276
+ if (T.empty && !cardHasAdler(v0) && AD.prefs()['adler.amount'] === 'full') {
277
+ // an empty space (XvpE5Adler 2): Adler rests in it with the next action; the card above keeps no face then (one Adler per screen)
278
+ return head + `<div class="iv-empty ad">${AD.adler('resting', 96, { label: 'Adler, resting' })}<p class="iv-q">No tasks yet. I can draft them, one section per stage. Nothing is saved until you keep it.</p>`
279
+ + `<div class="iv-ea">${o.draft ? `<button type="button" class="iv-pbtn" data-iv-draft>${SVG(P.draft, 16, 2)}Draft</button>` : ''}${o.add ? `<button type="button" class="iv-ib" data-iv-add aria-label="Add a task" title="Add a task">${SVG(P.plus, 16, 2.2)}</button>` : ''}</div></div>`;
280
+ }
221
281
  if (T.empty) {
222
282
  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('');
223
283
  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>`
@@ -227,11 +287,24 @@ function tasksHtml(v0, o) {
227
287
  const fold = (k, d) => isOpen(v, k, d), q = { ...o, mark: markOf };
228
288
  const top = head + G.sumHtml(v);
229
289
  if (mode === 'timeline') return top + `<div class="iv-tk">${TV.timelineHtml(v, q, fold)}</div>`;
230
- if (mode === 'kanban') return top + `<div class="iv-tk">${TV.kanbanHtml(v, q, fold)}</div>`;
290
+ if (mode === 'kanban') return top + `<div class="iv-tk"><div class="ivk-pk">${TV.kanbanPickHtml(v)}</div>${TV.kanbanHtml(v, q, fold)}</div>`;
231
291
  const ol = T.by === 'mine' ? { ...o, gdrag: !!o.quick } : o;
232
292
  // the stage the card showed has no task: say so, and the ✕ in the header shows every stage again (batch 12 item 0)
233
293
  if (T.only && !T.sections.length) return top + `<p class="iv-q ig-none">No tasks in ${esc(T.only)} yet.</p>`;
234
- return top + `<div class="iv-wbs">${T.sections.map((s) => sectionHtml(v, s, ol)).join('')}</div>`;
294
+ // only the stages with something open show (batch 18 item 1, XvpA1); the rest wait in one fold at the foot. The stage card's filter shows
295
+ // its stage as it is.
296
+ // (by stage only: the PM's own groups stay, each a place to drop a task)
297
+ const hide = !T.only && (!T.by || T.by === 'stage');
298
+ const live = hide ? T.sections.filter(openIn) : T.sections, rest = hide ? T.sections.filter((s) => !openIn(s)) : [];
299
+ const rop = isOpen(v, 'rest', !live.length);
300
+ const restRow = rest.length ? `<button type="button" class="iv-grp iv-rest" data-iv-fold="rest" aria-expanded="${rop}"><b>${esc(rest.length + (rest.length === 1 ? ' stage' : ' stages'))}</b><span class="n">nothing open</span>${chev(rop)}</button>`
301
+ + (rop ? rest.map((s) => sectionHtml(v, s, ol)).join('') : '') : '';
302
+ return top + `<div class="iv-wbs">${live.map((s) => sectionHtml(v, s, ol)).join('')}${restRow}</div>`;
303
+ }
304
+ /** A section with something open: a task, a ticket, a work package, a drafted ticket, or By epic's next step. */
305
+ function openIn(sec) {
306
+ if (sec.stages) return sec.stages.some(openIn);
307
+ return !!((sec.top && sec.top.length) || (sec.groups && sec.groups.length) || (sec.jira && sec.jira.open.length) || (sec.tk && sec.tk.some((t) => t.cat !== 'done')) || sec.tkEmpty);
235
308
  }
236
309
  function foldsHtml(v, o) {
237
310
  const rows = [];
@@ -258,8 +331,11 @@ const VIEWED = new Map(); // initiative id → the view drawn last (the ✦ in
258
331
  export function viewHtml(v, o = {}) {
259
332
  if (v && v.id) VIEWED.set(v.id, v);
260
333
  // 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)
261
- const top = v.merged ? smMerged(v.merged) : summaryHtml(v.summary, o) + (o.sm !== false ? smCard(v.suggest, v.title) : '');
262
- return `<div class="iv" data-iv="${esc(v.id || v.key || '')}">${top}${v.merged ? '' : stageHtml(v.stage, o, v.id || v.key || '') + MD.iniHtml(v.id, '', v.title) + tasksHtml(v, o)}${foldsHtml(v, o)}${o.tail || ''}</div>`;
334
+ if (v.merged) return `<div class="iv" data-iv="${esc(v.id || v.key || '')}"><div class="iv-cols"><div class="iv-cl">${smMerged(v.merged)}</div><div class="iv-cr">${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
335
+ // two columns from about 820 px of room (XvpD1Desktop; "below about 900 px wide, the phone layout"): the card and what Claude proposes
336
+ // for it on the left, Tasks on the right from the same top (canvas v582), as one panel with its own scroll; one column below it
337
+ return `<div class="iv" data-iv="${esc(v.id || v.key || '')}"><div class="iv-cols"><div class="iv-cl">${cardHtml(v, o)}${msCardHtml(v, o)}${o.sm !== false ? smCard(v.suggest, v.title) : ''}${MD.iniHtml(v.id, '', v.title)}</div>`
338
+ + `<div class="iv-cr"><section class="iv-tasks" aria-label="Tasks">${tasksHtml(v, o)}</section>${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
263
339
  }
264
340
 
265
341
  /* ── the presses ── */
@@ -275,14 +351,40 @@ export function wireView(body, h) {
275
351
  G.attach(body, body.__iv); // the layout and the drafted tickets of the initiative shown (batch 11 item 20)
276
352
  if (body.__ivWired) return;
277
353
  body.__ivWired = true;
278
- // the stage line's labels are checked as drawn (pm/stage-line.js fitLine): after each draw and when the panel changes width
354
+ // the ✦ after the title and the drafted measure follow each draw
279
355
  if (typeof MutationObserver === 'function') {
280
- let q = 0; const fit = () => { if (q) return; q = requestAnimationFrame(() => { q = 0; fitLine(body); chip(); }); };
356
+ // two columns: Tasks fills the Viewer's height from its top and scrolls on its own (--iv-h, read by ini-view.css)
357
+ const tall = () => { const iv = body.querySelector('.iv'); if (!iv) return; const top = iv.getBoundingClientRect().top - body.getBoundingClientRect().top + body.scrollTop;
358
+ const h = Math.max(320, Math.round(body.clientHeight - top - 16)); if (iv.style.getPropertyValue('--iv-h') !== h + 'px') iv.style.setProperty('--iv-h', h + 'px'); };
359
+ let q = 0; const fit = () => { if (q) return; q = requestAnimationFrame(() => { q = 0; chip(); tall(); }); };
281
360
  new MutationObserver(fit).observe(body, { childList: true, subtree: true });
282
361
  if (typeof ResizeObserver === 'function') new ResizeObserver(fit).observe(body);
283
362
  fit();
284
363
  }
364
+ // the mission (batch 18 item 1): a flag, the planet or the dish opens its milestone's task; anywhere else on it opens the list in place
365
+ const missionPress = (e) => {
366
+ const H = body.__iv || {}, m = e.target.closest('[data-mi-ms]');
367
+ if (m && body.contains(m) && H.openTask) { e.preventDefault(); H.openTask(m.dataset.miMs, m); return true; }
368
+ const pic = e.target.closest('[data-iv-mi]'); if (!pic || !body.contains(pic) || e.target.closest('button, a')) return false;
369
+ const root = pic.closest('[data-iv]'); if (!root) return false;
370
+ e.preventDefault(); const id = root.dataset.iv; LINE.set(id, LINE.get(id) ? '' : 'list'); if (H.redraw) H.redraw();
371
+ later(pic, (r) => r.querySelector('[data-iv-mi]'), true);
372
+ return true;
373
+ };
374
+ body.addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches && e.target.matches('[data-mi-ms], [data-iv-mi]')) missionPress(e); });
375
+ // hover names a milestone and its date (XvpD1Desktop); a click opens its task
376
+ const tip = (m, show) => {
377
+ const box = m.closest('.iv-mi'), t = box && box.querySelector('.iv-mi-tip'); if (!t) return;
378
+ if (!show) { t.hidden = true; return; }
379
+ t.innerHTML = `<b>${esc(m.dataset.miTip)}</b><i>${esc((m.dataset.miDate ? m.dataset.miDate + ' · ' : '') + 'click to open its task')}</i>`;
380
+ t.style.left = m.dataset.miX + '%'; t.classList.toggle('r', +m.dataset.miX > 60); t.hidden = false;
381
+ };
382
+ const hov = typeof matchMedia === 'function' && matchMedia('(hover: hover)').matches;
383
+ for (const [ev, on] of [['mouseover', true], ['mouseout', false], ['focusin', true], ['focusout', false]]) {
384
+ body.addEventListener(ev, (e) => { const m = e.target.closest && e.target.closest('[data-mi-ms]'); if (m && body.contains(m) && (hov || ev.startsWith('focus'))) tip(m, on); });
385
+ }
285
386
  body.addEventListener('click', (e) => {
387
+ if (missionPress(e)) return;
286
388
  const H = body.__iv || {}, b = e.target.closest('button, a'); if (!b || !body.contains(b)) return;
287
389
  const root = b.closest('[data-iv]'); if (!root) return;
288
390
  const id = root.dataset.iv;
@@ -291,7 +393,7 @@ export function wireView(body, h) {
291
393
  if (VS.press(b, d, root, H)) return;
292
394
  if (G.press(b, d, root, H)) return;
293
395
  if (LK.press(b, d, root, { ...H, __dates: (x) => TV.press(x, { ivtBar: x.dataset.ivtBar }, root, H, e) })) return;
294
- if (TV.press(b, d, root, { ...H, __v: SHOWN.get(id) }, e)) return;
396
+ if (TV.press(b, d, root, { ...H, __v: SHOWN.get(id), __g: G.api(root, H) }, e)) return;
295
397
  if (d.ivFold) { e.preventDefault(); const k = id + '|' + d.ivFold; FOLD.set(k, b.getAttribute('aria-expanded') !== 'true'); if (H.redraw) H.redraw(); return; }
296
398
  if (d.ivCheck && H.check) { e.preventDefault(); H.check(d.ivCheck, b); return; }
297
399
  if (d.ivTask && H.openTask) { e.preventDefault(); H.openTask(d.ivTask, b); return; }
@@ -302,6 +404,7 @@ export function wireView(body, h) {
302
404
  if (d.sm && H.sm) { e.preventDefault(); H.sm(d.sm, b); return; }
303
405
  if (d.smOpen && H.openIni) { e.preventDefault(); H.openIni(d.smOpen, b); return; }
304
406
  if (d.ivPrimary && H.primary) { e.preventDefault(); H.primary(d.ivPrimary, b); return; }
407
+ if ('ivAsks' in d) { e.preventDefault(); if (H.asks) H.asks(b); else if (H.primary) { const p = root.querySelector('[data-iv-primary]'); if (p) H.primary(p.dataset.ivPrimary, p); } return; }
305
408
  if ('ivWf' in d && H.wf) { e.preventDefault(); H.wf(b); return; }
306
409
  if ('ivPerson' in d && H.person) { e.preventDefault(); H.person(b); return; }
307
410
  if ('ivStagepick' in d && H.stagePick) { e.preventDefault(); H.stagePick(b); return; }
@@ -331,6 +434,7 @@ function lineMove(b, d, id, H, e) {
331
434
  const fold = (k) => { LINE.set(id, LINE.get(id) === k ? '' : k); if (H.redraw) H.redraw(); };
332
435
  const inLine = !!b.closest('[data-iv-line]');
333
436
  if (d.ivStage != null) { e.preventDefault(); if (inLine && phone()) fold('list'); else showIn(b, id, H, d.ivStage, null); return true; }
437
+ if (d.ivMs && b.closest('.iv-mio, .iv-msc') && H.openTask) { e.preventDefault(); H.openTask(d.ivMs, b); return true; } // the mission's list and the Milestones card: a milestone opens its task
334
438
  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; }
335
439
  if (d.ivMsc != null) { e.preventDefault(); fold(phone() ? 'list' : 'ms:' + d.ivMsc); return true; }
336
440
  if (d.ivGap != null) { e.preventDefault(); fold(phone() ? 'list' : 'gap:' + d.ivGap); return true; }
@@ -354,11 +458,12 @@ function findRow(v, uid) {
354
458
  return null;
355
459
  }
356
460
  /** After the redraw: find the target in the view and bring it into sight, with a short highlight. */
357
- function later(b, pick) {
461
+ function later(b, pick, focus) {
358
462
  const body = b.closest('[data-iv]') && b.closest('[data-iv]').parentElement;
359
463
  const go = () => {
360
464
  const root = body && body.querySelector('[data-iv]'); if (!root) return;
361
465
  const el = pick(root); if (!el) return;
466
+ if (focus) { el.focus({ preventScroll: true }); return; } // the same press after a redraw keeps the focus, no highlight
362
467
  el.scrollIntoView({ block: 'center', behavior: 'smooth' });
363
468
  el.classList.add('iv-hit'); setTimeout(() => el.classList.remove('iv-hit'), 1600);
364
469
  };
@@ -368,8 +473,16 @@ function later(b, pick) {
368
473
  function showIn(b, id, H, key, uid) {
369
474
  // 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)
370
475
  if (key != null && !uid && G.onlyStage(id, key)) { if (H.redraw) H.redraw(); later(b, (root) => root.querySelector('.iv-th')); return; }
371
- if (key != null) { FOLD.set(id + '|sec:' + (key || 'none'), true); TV.setKanbanStage(id, key); }
372
- if (uid) { const v = SHOWN.get(id), f = v && findRow(v, uid); if (f && f.fold) FOLD.set(id + '|' + f.fold, true); }
476
+ if (key != null) {
477
+ FOLD.set(id + '|sec:' + (key || 'none'), true); TV.setKanbanStage(id, key);
478
+ // a stage with nothing open waits in the List's last fold: open it too
479
+ const v = SHOWN.get(id), sec = v && ((v.tasks && v.tasks.sections) || []).find((s) => (s.key || '') === key || (s.stages || []).some((c) => (c.key || '') === key));
480
+ if (sec && !openIn(sec)) FOLD.set(id + '|rest', true);
481
+ }
482
+ if (uid) {
483
+ const v = SHOWN.get(id), f = v && findRow(v, uid); if (f && f.fold) FOLD.set(id + '|' + f.fold, true);
484
+ if (f && !f.fold) FOLD.set(id + '|' + f.sec + ':more', true); // past the first 3
485
+ }
373
486
  if (H.redraw) H.redraw();
374
487
  const q = (v) => String(v).replace(/["\\]/g, '\\$&');
375
488
  later(b, (root) => {
@@ -17,6 +17,7 @@
17
17
  * each row's name, target and where it is measured; ✓ saves them (POST /api/metric-drafts/edit, one per changed row), × puts them back, and the
18
18
  * chat icon asks Claude in Home for anything else. Discuss goes to Home's chat. Nothing is kept until the PM's ✓ keep. */
19
19
  import { pmPost } from './http.js';
20
+ import { rhythmOf } from './goals-clear.js'; // the Kept toast says the goal's own rhythm (batch 18 item 11)
20
21
  import { adler } from './cozy-adler.js'; // Claude drafted it unasked, so Adler holds the card (batch 16 item 2, canvas AdM3)
21
22
 
22
23
  (function sheet() { // once, at import: the parts show on the Board and in Home's Viewer, and the look must come with them on both
@@ -196,7 +197,9 @@ export function press(b, h = {}) {
196
197
  }
197
198
  one.busy = false;
198
199
  if (!r || !r.ok) { say((r && r.error) || (a === 'keep' ? 'Not kept. The server did not say why.' : 'Not undone. The server did not say why.')); redraw(); return; }
199
- if (a === 'keep') say(scope === 'program' ? 'Kept. I check the goal every morning.' : 'Kept. I check the success measure every morning after the release.');
200
+ // batch 18 item 11: "Kept" names the goal's own rhythm (the server's rhythm.txt, else the drafted recipe), never "every morning"
201
+ if (a === 'keep') { const rh = r.rhythm && r.rhythm.txt ? r.rhythm.txt : (rhythmOf(rowsOf(one.d).find((x) => x.state === 'open' && (x.rhythm || x.recipe))) || {}).long;
202
+ say(scope === 'program' ? 'Kept. I read the goal ' + (rh || 'on its own rhythm') + '.' : 'Kept. I read the success measure ' + (rh || 'on its own rhythm') + ' after the release.'); }
200
203
  else say('Undone. It is a proposal again.');
201
204
  await again(scope, id, redraw);
202
205
  })();