create-pmos 0.688.0 → 0.689.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 (38) hide show
  1. package/package.json +20 -14
  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/briefing-premium-insights-test.js +23 -1
  7. package/workspace/briefing-premium-test.js +3 -0
  8. package/workspace/changelog.json +19 -0
  9. package/workspace/guide/breakdown.md +24 -1
  10. package/workspace/guide/cli.md +2 -0
  11. package/workspace/guide/intelligence-okr-goals.md +1 -1
  12. package/workspace/lib/board-premium.js +13 -3
  13. package/workspace/lib/engine/boards.js +18 -3
  14. package/workspace/lib/jira-cli.js +21 -2
  15. package/workspace/lib/jira-epics.js +125 -0
  16. package/workspace/lib/jira-status.js +18 -3
  17. package/workspace/lib/route-modules.js +1 -0
  18. package/workspace/lib/routes-boards.js +109 -6
  19. package/workspace/lib/routes-jira-epics.js +65 -0
  20. package/workspace/lib/task-cli.js +25 -7
  21. package/workspace/lib/task-store.js +2 -2
  22. package/workspace/package-lock.json +2 -2
  23. package/workspace/package.json +1 -1
  24. package/workspace/public/pm/bd-backlog.js +25 -4
  25. package/workspace/public/pm/bd-pop-ds.css +22 -0
  26. package/workspace/public/pm/bd-pop-ds.js +48 -11
  27. package/workspace/public/pm/bd-sprint-ds.js +5 -4
  28. package/workspace/public/pm/bd-sprint.js +10 -3
  29. package/workspace/public/pm/bd-work-ds.css +4 -0
  30. package/workspace/public/pm/cozy-pop-work.css +12 -0
  31. package/workspace/public/pm/cozy-pop-work.js +172 -9
  32. package/workspace/public/pm/ini-view-model.js +12 -1
  33. package/workspace/public/pm/pop-work-model.js +40 -7
  34. package/workspace/public/pm/premium-insights.js +1 -1
  35. package/workspace/public/pm/work-select.js +73 -0
  36. package/workspace/public/pm/work-tree.js +111 -0
  37. package/workspace/skills/jira-epic.skill +35 -0
  38. package/workspace/test-lists/work-subtasks.json +11 -0
@@ -26,7 +26,7 @@
26
26
  * POST /api/boards/settings { ws, board, buildDeliver?, jira?, offer?, defTpl? } → { ok, board } jira: one key or a list
27
27
  * POST /api/boards/ini-workflow { ws, board, id, template?, stages, moveTo? } → { ok, row, moved }
28
28
  * POST /api/boards/ini-epics { ws, board, id, epics: [Jira key] } → { ok, row } the Jira epics of an initiative ([] unlinks)
29
- * POST /api/boards/tasks/add { ws, board, initiative, title, type?, epic?, start?, due?, owner?, notes?, section?, milestone? } → { ok, item } also `pmos task add`
29
+ * POST /api/boards/tasks/add { ws, board, initiative, title, type?, epic?, start?, due?, owner?, notes?, section?, milestone?, parent? } → { ok, item } also `pmos task add`
30
30
  * (milestone: true adds it as a milestone, ◇ with one date: the due day, no start; batch 25 item 5)
31
31
  * (section: the stage it goes under, as tasks/edit's section: the + on a stage of the Tasks list, batch 18 item 16)
32
32
  * POST /api/boards/tasks/order { ws, board, initiative, section, tasks: [id] } → { ok, from } the PM's order inside one stage (a drag in the
@@ -36,8 +36,12 @@
36
36
  * the popup's direct ✓ presses (bet 1f): see "direct ✓ presses" below; { ask: true } sends the words to Ask PMOS
37
37
  * POST /api/boards/tasks/reschedule { ws, board, task, days } → { ok, item }
38
38
  * POST /api/boards/tasks/undo-add { ws, board, task } → { ok } takes back a task added in the last 2 minutes, still To do
39
+ * POST /api/boards/tasks/bulk { ws, board, tasks: [id], op: parent|section|owner|shift|done, value } → { ok, moved, skipped, undo } several tasks
40
+ * at once (initiative work-subtasks, WorkBulkDS), each through the single route; a Jira ticket keeps its stage, assignee and status
41
+ * POST /api/boards/tasks/bulk-undo { ws, board, undo } → { ok, back, failed } the one Undo of a bulk move
39
42
  * POST /api/boards/tasks/rename { ws, board, task, title } → { ok, from, item } only the title changes
40
- * POST /api/boards/tasks/edit { ws, board, task, owner?, notes?, start?, due?, initiative?, section?, milestone?, pinned? } → { ok, from, item } the Viewer's edits in place
43
+ * POST /api/boards/tasks/edit { ws, board, task, owner?, notes?, start?, due?, initiative?, section?, milestone?, pinned?, parent? } → { ok, from, item } the Viewer's edits in place
44
+ * (parent: the task it sits under, '' for the top level; a task-parent line, any kind of task, a loop refused)
41
45
  * (milestone: true | false, the ◇ flag of batch 11 item 3; a Jira key takes the flag only)
42
46
  * (pinned: true | false | null, a milestone's pin on the Board timeline, batch 13 item 4; null = the rule, the last one only)
43
47
  * (section: the task's place in the breakdown, a stage key of its initiative's workflow or '' — a task-section line)
@@ -855,6 +859,9 @@ function itemsOf(w, fr, board, rows) {
855
859
  if (hit) x.rank = hit.ids.indexOf(x.uid);
856
860
  }
857
861
  }
862
+ // a subtask's parent (initiative work-subtasks): any kind of task, the last task-parent line wins
863
+ const PA = fr.folded.parents || new Map();
864
+ if (PA.size) for (const x of out) if (x.kind !== 'Epic' && PA.has(x.uid)) x.parent = PA.get(x.uid);
858
865
  // a task flagged as a milestone (feedback batch 11 item 3): the PM's flag on the board ledger, else a breakdown item's own plan-items flag
859
866
  const MS = fr.folded.milestones || new Map();
860
867
  for (const x of out) if (x.kind !== 'Epic') { const on = MS.has(x.uid) ? MS.get(x.uid) : !!x.milestone; if (on) x.milestone = true; else delete x.milestone; }
@@ -875,7 +882,10 @@ function trackerMarks(w, items) {
875
882
  if (!key) continue;
876
883
  if (!snaps.has(x.ini)) { let sn = null; try { sn = jiraStatus.readSnapshot(w.root, x.ini); } catch { sn = null; } snaps.set(x.ini, sn); }
877
884
  const sn = snaps.get(x.ini), rd = sn && sn.tickets ? sn.tickets.get(key) : null;
878
- x.tracker = { key, status: (rd && rd.status) || null, readAt: (sn && sn.fetchedAt) || null, stale: TJ.staleOf([key], sn, now).stale };
885
+ x.tracker = { key, status: (rd && rd.status) || null, readAt: (sn && sn.fetchedAt) || null, stale: TJ.staleOf([key], sn, now).stale,
886
+ // the epic check and the sub-tasks (initiative work-subtasks): the read's parent (its epic, or its ticket for a sub-task), assignee, link
887
+ ...(rd ? { read: true, url: rd.url || '', type: rd.type || '', assignee: rd.assignee || '', ...(/sub-?task/i.test(String(rd.type || '')) ? { parentTicket: rd.parent || '' } : { epic: rd.parent || '', parentName: rd.parentName || '' }),
888
+ ...(Array.isArray(rd.subs) && rd.subs.length ? { subs: rd.subs } : {}) } : {}) };
879
889
  }
880
890
  }
881
891
  /** The Jira items of an initiative PMOS pushed nothing for: its linked epics and the issues under them, from the last
@@ -1188,6 +1198,20 @@ function itemOnBoard(ctx, res, p, id) {
1188
1198
  if (!b0 || boardIdOf(b0, p.fr.boards, p.fr.folded, p.w) !== p.board.id) { fail(ctx, res, 404, `no PMOS task ${id} on this board`); return null; }
1189
1199
  return it;
1190
1200
  }
1201
+ /** A subtask's parent (initiative work-subtasks): '' for the top level, else a PMOS task, a breakdown item or a Jira key of the same
1202
+ * initiative (a Jira key is taken as it is: PMOS reads its initiative from Jira). → the error to answer, or null when it may be written. */
1203
+ function parentError(p, taskId, parent, iniId) {
1204
+ if (typeof parent !== 'string' || parent.length > 80) return 'parent is the id of a task of the same initiative, or \'\' for the top level';
1205
+ if (!parent) return null;
1206
+ if (parent === taskId) return 'a task cannot be its own parent';
1207
+ if (B.wouldCycle(p.fr.folded.parents || new Map(), taskId, parent)) return 'that parent sits under this task: it would make a loop';
1208
+ if (B.JIRA_KEY_RE.test(parent) && !B.taskOf(p.fr.folded, parent)) return null;
1209
+ const pt = B.taskOf(p.fr.folded, parent) || (TI.isItemId(parent) ? TI.itemOf(p.w.root, parent) : null);
1210
+ if (!pt) return `no task ${parent} to put it under`;
1211
+ if (iniId && pt.initiative && pt.initiative !== iniId) return 'the parent is a task of another initiative';
1212
+ return null;
1213
+ }
1214
+ const parentLine = (p, task, parent) => ({ kind: 'task-parent', board: p.board.id, task, parent, why: parent ? 'put under ' + parent : 'moved to the top level' });
1191
1215
  /** Writes an item's lines (r: TI.stateEvents or TI.editEvents) as the task routes do and answers the item as a task. */
1192
1216
  function itemWrite(ctx, res, p, it, r, g, extra = {}) {
1193
1217
  if (r.error) return fail(ctx, res, 400, r.error);
@@ -1200,6 +1224,8 @@ function itemWrite(ctx, res, p, it, r, g, extra = {}) {
1200
1224
  ctx.json(res, { ok: true, item: B.rollupItems([row])[0], ...extra });
1201
1225
  }
1202
1226
 
1227
+ /** What a bulk move does (POST /api/boards/tasks/bulk): under a parent, to a stage, to a person, by N days, to Done. */
1228
+ const BULK_OPS = ['parent', 'section', 'owner', 'shift', 'done'];
1203
1229
  const WRITES = {
1204
1230
  '/api/boards/create': (ctx, res, body, g) => {
1205
1231
  const p = postFrame(ctx, res, body, { needBoard: false });
@@ -1498,12 +1524,14 @@ const WRITES = {
1498
1524
  if (body.section && !st.some((x) => x.key === body.section)) return fail(ctx, res, 400, `"${body.section}" is not a stage of this initiative's workflow: one of ${st.map((x) => x.key).join(', ')}, or ''`);
1499
1525
  }
1500
1526
  const id = `task-${crypto.randomBytes(5).toString('hex')}`;
1527
+ // "under Batch 2: …" in the add box (initiative work-subtasks): the new task is a subtask from its first line
1528
+ if (body.parent != null && body.parent !== '') { const pe = parentError(p, id, body.parent, body.initiative); if (pe) return fail(ctx, res, 400, pe); }
1501
1529
  // a milestone has one date, the due day, and no start (the ◇ of the Viewer's add field, batch 25 item 5)
1502
1530
  const ms = body.milestone === true;
1503
1531
  const start = ms ? '' : body.start || (body.due && body.due < B.shiftDay(today(), 1) ? body.due : B.shiftDay(today(), 1));
1504
1532
  const due = body.due || (ms ? body.start || B.shiftDay(today(), 8) : B.shiftDay(start, 7));
1505
1533
  append(p.file, g.actor, { kind: 'task', board: p.board.id, task: id, type: body.type || 'Task', initiative: body.initiative, title: body.title.trim(), epic: body.epic ? String(body.epic).trim() : null,
1506
- owner: body.owner ? String(body.owner).trim() : actorLib.pageName(g.actor.by), state: 'To do', start, due, ...(body.notes && body.notes.trim() ? { notes: body.notes.replace(/\s+$/, '') } : {}) });
1534
+ owner: body.owner ? String(body.owner).trim() : actorLib.pageName(g.actor.by), state: 'To do', start, due, ...(body.notes && body.notes.trim() ? { notes: body.notes.replace(/\s+$/, '') } : {}), ...(body.parent ? { parent: body.parent } : {}) });
1507
1535
  if (typeof body.section === 'string') append(p.file, g.actor, { kind: 'task-section', board: p.board.id, task: id, section: body.section, why: body.section ? 'placed under ' + body.section : 'placed under no stage' });
1508
1536
  if (ms) append(p.file, g.actor, { kind: 'task-milestone', board: p.board.id, task: id, milestone: true, why: 'added as a milestone' });
1509
1537
  const t = B.taskOf(B.fold(readLedger(ctx, p.w)), id);
@@ -1629,7 +1657,8 @@ const WRITES = {
1629
1657
  // Jira keeps its title, status and assignee, and nothing is written to Jira
1630
1658
  if (typeof body.task === 'string' && B.JIRA_KEY_RE.test(body.task) && !B.taskOf(p.fr.folded, body.task)) {
1631
1659
  if (['owner', 'notes', 'initiative', 'section'].some((k) => body[k] != null)) return fail(ctx, res, 409, 'Jira owns this ticket: only its dates, its milestone flag and its pin change here');
1632
- if (body.milestone == null && body.start == null && body.due == null && body.pinned === undefined) return fail(ctx, res, 400, 'nothing to change: send start, due, milestone or pinned');
1660
+ if (body.milestone == null && body.start == null && body.due == null && body.pinned === undefined && body.parent == null) return fail(ctx, res, 400, 'nothing to change: send start, due, milestone, pinned or parent');
1661
+ if (body.parent != null) { const pe = parentError(p, body.task, body.parent, null); if (pe) return fail(ctx, res, 400, pe); }
1633
1662
  for (const k of ['start', 'due']) if (body[k] != null && body[k] !== '' && !/^\d{4}-\d{2}-\d{2}$/.test(String(body[k]))) return fail(ctx, res, 400, `${k} is a day, YYYY-MM-DD, or '' for none`);
1634
1663
  if (!p.file) return fail(ctx, res, 409, NO_STATE);
1635
1664
  const from = {}, ref = body.task.toUpperCase();
@@ -1647,6 +1676,7 @@ const WRITES = {
1647
1676
  append(p.file, g.actor, { kind: 'task-milestone', board: p.board.id, task: body.task, milestone: body.milestone, why: body.milestone ? 'made a milestone' : 'no longer a milestone' });
1648
1677
  }
1649
1678
  if (body.pinned !== undefined) { from.pinned = pinWas(body.task); append(p.file, g.actor, pinLine(body.task)); }
1679
+ if (body.parent != null) { from.parent = (p.fr.folded.parents || new Map()).get(body.task) || ''; append(p.file, g.actor, parentLine(p, body.task, body.parent)); }
1650
1680
  return ctx.json(res, { ok: true, from, item: null });
1651
1681
  }
1652
1682
  const t0 = B.taskOf(p.fr.folded, body.task);
@@ -1699,10 +1729,19 @@ const WRITES = {
1699
1729
  // the pin (batch 13 item 4): a board-ledger line like the milestone flag
1700
1730
  const pin = body.pinned !== undefined;
1701
1731
  if (pin) { if (!p.file) return fail(ctx, res, 409, NO_STATE); from.pinned = pinWas(t.id); }
1702
- if (!Object.keys(ev).length && sec == null && ms == null && !pin) return fail(ctx, res, 400, 'nothing to change: send owner, notes, start, due, initiative, section, milestone or pinned');
1732
+ // a subtask's parent (initiative work-subtasks): a board-ledger line for every kind of task, like the section
1733
+ let par = null;
1734
+ if (body.parent != null) {
1735
+ const pe = parentError(p, t.id, body.parent, ev.initiative || t.initiative);
1736
+ if (pe) return fail(ctx, res, 400, pe);
1737
+ if (!p.file) return fail(ctx, res, 409, NO_STATE);
1738
+ par = body.parent; from.parent = (p.fr.folded.parents || new Map()).get(t.id) || '';
1739
+ }
1740
+ if (!Object.keys(ev).length && sec == null && ms == null && !pin && par == null) return fail(ctx, res, 400, 'nothing to change: send owner, notes, start, due, initiative, section, milestone, pinned or parent');
1703
1741
  if (sec != null) append(p.file, g.actor, { kind: 'task-section', board: p.board.id, task: t.id, section: sec, why: sec ? 'placed under ' + sec : 'placed under no stage' });
1704
1742
  if (ms != null) append(p.file, g.actor, { kind: 'task-milestone', board: p.board.id, task: t.id, milestone: ms, why: ms ? 'made a milestone' : 'no longer a milestone' });
1705
1743
  if (pin) append(p.file, g.actor, pinLine(t.id));
1744
+ if (par != null) append(p.file, g.actor, parentLine(p, t.id, par));
1706
1745
  if (!Object.keys(ev).length) {
1707
1746
  const items = itemsOf(p.w, { ...p.fr, folded: B.fold(readLedger(ctx, p.w)) }, p.board, (needRows(ctx, res, p.w) || []).filter((r) => r.id === t.initiative));
1708
1747
  return ctx.json(res, { ok: true, from, item: items.find((x) => x.uid === t.id) || null });
@@ -1713,6 +1752,70 @@ const WRITES = {
1713
1752
  const t2 = B.taskOf(B.fold(readLedger(ctx, p.w)), t.id);
1714
1753
  ctx.json(res, { ok: true, from, item: B.rollupItems([B.taskItem(t2)])[0] });
1715
1754
  },
1755
+ '/api/boards/tasks/bulk': (ctx, res, body, g) => {
1756
+ // bulk move (initiative work-subtasks, board WorkBulkDS): several tasks under a parent, to a stage, to a person, by N days, or to Done.
1757
+ // Each task goes through the same route a single press uses; the answer's `undo` puts every one back in one press (tasks/bulk-undo)
1758
+ const p = postFrame(ctx, res, body);
1759
+ if (!p) return;
1760
+ const ids = Array.isArray(body.tasks) ? [...new Set(body.tasks.filter((x) => typeof x === 'string' && x && x.length <= 80))] : [];
1761
+ if (!ids.length || ids.length > 200) return fail(ctx, res, 400, 'tasks is a list of 1 to 200 task ids');
1762
+ const op = body.op, v = body.value;
1763
+ if (!BULK_OPS.includes(op)) return fail(ctx, res, 400, `op is one of ${BULK_OPS.join(', ')}`);
1764
+ if (op === 'shift' && (!Number.isInteger(Number(v)) || Number(v) === 0 || Math.abs(Number(v)) > 730)) return fail(ctx, res, 400, 'value is a whole number of days, not 0, at most 730 either way');
1765
+ if ((op === 'parent' || op === 'section' || op === 'owner') && typeof v !== 'string') return fail(ctx, res, 400, `value is the ${op === 'parent' ? 'parent task id' : op === 'section' ? 'stage key' : 'owner'}, or '' for none`);
1766
+ if (op === 'parent' && v && ids.includes(v)) return fail(ctx, res, 400, 'the parent is one of the selected tasks');
1767
+ const base = { ws: body.ws, board: body.board };
1768
+ const moved = [], skipped = [];
1769
+ for (const id of ids) {
1770
+ const jira = B.JIRA_KEY_RE.test(id) && !B.taskOf(p.fr.folded, id);
1771
+ if (jira && (op === 'section' || op === 'owner' || op === 'done')) { skipped.push({ task: id, why: 'Jira owns its ' + (op === 'section' ? 'stage' : op === 'owner' ? 'assignee' : 'status') }); continue; }
1772
+ let r, undo;
1773
+ if (op === 'done') {
1774
+ const t = B.taskOf(p.fr.folded, id) || (TI.isItemId(id) ? (() => { const it = TI.itemOf(p.w.root, id); return it ? { state: TI.STATE_OF[it.state] || 'To do' } : null; })() : null);
1775
+ if (t && t.state === 'Done') { skipped.push({ task: id, why: 'already done' }); continue; }
1776
+ r = writeAs(ctx, '/api/boards/tasks/state', { ...base, task: id, state: 'Done', why: 'marked done with ' + (ids.length - 1) + ' more' }, g);
1777
+ undo = { task: id, op, from: { state: (t && t.state) || 'To do' } };
1778
+ } else if (op === 'shift') {
1779
+ if (jira) {
1780
+ const TD = p.fr.folded.ticketDates || new Map(), was = TD.get(p.board.id + '\u0000' + id.toUpperCase());
1781
+ if (!was || (!was.start && !was.due)) { skipped.push({ task: id, why: 'Jira keeps its dates: give it dates in PMOS first' }); continue; }
1782
+ r = writeAs(ctx, '/api/boards/tasks/edit', { ...base, task: id, ...(was.start ? { start: B.shiftDay(was.start, Number(v)) } : {}), ...(was.due ? { due: B.shiftDay(was.due, Number(v)) } : {}) }, g);
1783
+ undo = { task: id, op: 'edit', from: r.body && r.body.from };
1784
+ } else {
1785
+ r = writeAs(ctx, '/api/boards/tasks/reschedule', { ...base, task: id, days: Number(v) }, g);
1786
+ undo = { task: id, op, from: { days: Number(v) } };
1787
+ }
1788
+ } else {
1789
+ r = writeAs(ctx, '/api/boards/tasks/edit', { ...base, task: id, [op]: v }, g);
1790
+ undo = { task: id, op: 'edit', from: r.body && r.body.from };
1791
+ }
1792
+ if (r.body && r.body.ok !== false) moved.push(undo); else skipped.push({ task: id, why: (r.body && r.body.error) || 'not changed' });
1793
+ }
1794
+ if (!moved.length) return fail(ctx, res, 400, 'no task was moved: ' + skipped.map((x) => x.task + ' (' + x.why + ')').join(', '), { skipped });
1795
+ ctx.json(res, { ok: true, moved: moved.map((x) => x.task), skipped, undo: moved, said: moved.length + (moved.length === 1 ? ' task' : ' tasks') + ' moved.' + (skipped.length ? ' Not moved: ' + skipped.length + '.' : '') });
1796
+ },
1797
+ '/api/boards/tasks/bulk-undo': (ctx, res, body, g) => {
1798
+ // the one Undo of a bulk move: each task back as it was, the last one first
1799
+ const p = postFrame(ctx, res, body);
1800
+ if (!p) return;
1801
+ const list = Array.isArray(body.undo) ? body.undo.filter((x) => x && typeof x.task === 'string' && x.from && typeof x.from === 'object') : [];
1802
+ if (!list.length || list.length > 200) return fail(ctx, res, 400, 'undo is the list a bulk move answered');
1803
+ const base = { ws: body.ws, board: body.board }, back = [], failed = [];
1804
+ for (const x of list.slice().reverse()) {
1805
+ let r;
1806
+ if (x.op === 'done') r = writeAs(ctx, '/api/boards/tasks/state', { ...base, task: x.task, state: String(x.from.state || 'To do'), why: 'undo of a bulk move' }, g);
1807
+ else if (x.op === 'shift') r = writeAs(ctx, '/api/boards/tasks/reschedule', { ...base, task: x.task, days: -Number(x.from.days) }, g);
1808
+ else {
1809
+ const from = {};
1810
+ for (const k of ['owner', 'notes', 'start', 'due', 'initiative', 'section', 'parent']) if (typeof x.from[k] === 'string') from[k] = x.from[k];
1811
+ if (typeof x.from.milestone === 'boolean') from.milestone = x.from.milestone;
1812
+ if (!Object.keys(from).length) continue;
1813
+ r = writeAs(ctx, '/api/boards/tasks/edit', { ...base, task: x.task, ...from }, g);
1814
+ }
1815
+ if (r.body && r.body.ok !== false) back.push(x.task); else failed.push(x.task);
1816
+ }
1817
+ ctx.json(res, { ok: !failed.length || back.length > 0, back, failed, said: back.length + (back.length === 1 ? ' task' : ' tasks') + ' back as they were.' });
1818
+ },
1716
1819
  '/api/boards/tickets/note': (ctx, res, body, g) => {
1717
1820
  // the PM's own notes on a Jira ticket (canvas XetX1Jira): Jira keeps the title, status, dates and assignee
1718
1821
  const p = postFrame(ctx, res, body);
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+ /* routes-jira-epics.js — the epic check's fix (initiative work-subtasks; board WorkJiraDS). lib/jira-epics.js is the store.
3
+ *
4
+ * GET /api/jira-epics?ws → { ok, asks, draft } the asks not answered yet, and the day's draft text by owner
5
+ * POST /api/jira-epics/fix { ws, ini, epic, tickets: [{ key, from, who }] } → { ok, direct: [key], draft: [{ key, who }], ids, session? }
6
+ * POST /api/jira-epics/undo { ws, ids } → { ok, withdrawn, kept } the ✦'s Undo: asks not answered yet are withdrawn
7
+ *
8
+ * A ticket assigned to the PM is direct: a jira-epic session with the PM's own Atlassian connection sets its epic and answers with
9
+ * `pmos jira epic-done`. Every other ticket waits in the day's draft for its owner, which the PM reads first. This route makes no request to
10
+ * Jira (D53). Every POST passes pm-guard requirePagePress: the page only. */
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+ const guard = require('./pm-guard.js');
14
+ const JE = require('./jira-epics.js');
15
+
16
+ const pmNameOf = () => { try { return require('./routes-board-publish.js').sharedBy() || process.env.PMOS_PM_NAME || ''; } catch { return process.env.PMOS_PM_NAME || ''; } };
17
+ const SKILL = path.join(__dirname, '..', 'skills', 'jira-epic.skill');
18
+ /** The skill's body: the prompt the session starts with. */
19
+ function promptOf() {
20
+ let t = '';
21
+ try { t = fs.readFileSync(SKILL, 'utf8'); } catch { return null; }
22
+ const m = /^---\n[\s\S]*?\n---\n([\s\S]*)$/.exec(t);
23
+ return (m ? m[1] : t).trim() || null;
24
+ }
25
+ const running = new Map(); // ws id → session id
26
+
27
+ module.exports = {
28
+ prefixes: ['/api/jira-epics'],
29
+ handle: async (req, res, url, ctx) => {
30
+ const p = url.pathname;
31
+ if (p === '/api/jira-epics' && req.method === 'GET') {
32
+ const w = ctx.getWs(url.searchParams.get('ws'));
33
+ if (!w) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
34
+ const F = JE.readEpicAsks(w.root);
35
+ ctx.json(res, { ok: true, asks: JE.pendingEpicAsks(F), draft: JE.epicDraftText(F) });
36
+ return true;
37
+ }
38
+ if (req.method !== 'POST' || (p !== '/api/jira-epics/fix' && p !== '/api/jira-epics/undo')) return false;
39
+ const got = await ctx.readJson(req);
40
+ if (!got.ok) { ctx.json(res, { ok: false, error: 'invalid JSON body' }, 400); return true; }
41
+ const body = got.body || {};
42
+ const g = guard.requirePagePress(req, body);
43
+ if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
44
+ const w = ctx.getWs(typeof body.ws === 'string' && body.ws ? body.ws : null);
45
+ if (!w || (body.ws && w.id !== body.ws)) { ctx.json(res, { ok: false, error: 'no such workspace' }, 404); return true; }
46
+ const by = (g.actor && g.actor.by) || 'pm';
47
+ if (p === '/api/jira-epics/undo') { ctx.json(res, JE.withdrawEpicAsks(w.root, Array.isArray(body.ids) ? body.ids : [], by)); return true; }
48
+ const r = JE.askEpics(w.root, { ini: body.ini, epic: body.epic, tickets: body.tickets, me: pmNameOf() }, by);
49
+ if (!r.ok) { ctx.json(res, r, r.status || 400); return true; }
50
+ const out = { ok: true, direct: r.direct.map((a) => a.key), draft: r.draft.map((a) => ({ key: a.key, who: a.who })), ids: r.ids };
51
+ // the direct ones: one jira-epic session per workspace sets them in Jira with the PM's own connection
52
+ if (r.direct.length && typeof ctx.spawnSession === 'function') {
53
+ const prompt = promptOf(), was = running.get(w.id), live = was && typeof ctx.sessionList === 'function' && (ctx.sessionList() || []).some((s) => s && s.id === was && s.state !== 'exited');
54
+ if (prompt && !live) {
55
+ try {
56
+ const s = ctx.spawnSession({ name: 'Set epics in Jira', agent: 'claude', ws: w.id, origin: 'jira:epic', initialInput: prompt + `\n\nThis run: the asks \`pmos jira epic-asks --direct\` lists (the first: ${r.direct[0].key} under ${r.direct[0].epic}).\r` });
57
+ if (s && s.state !== 'exited') { running.set(w.id, s.id); out.session = s.id; }
58
+ else for (const a of r.direct) JE.answerEpicAsk(w.root, a.id, { why: (s && s.note) || 'the agent could not start' }, 'pmos');
59
+ } catch (e) { for (const a of r.direct) JE.answerEpicAsk(w.root, a.id, { why: 'the agent could not start' }, 'pmos'); }
60
+ } else if (live) out.session = was;
61
+ }
62
+ ctx.json(res, out);
63
+ return true;
64
+ },
65
+ };
@@ -39,12 +39,14 @@ const USAGE = [
39
39
  ' pmos task add <initiative> "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]',
40
40
  ' Add a task. Every new task goes here; pmos item add is the older breakdown record.',
41
41
  ' pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>]',
42
- ' [--milestone|--no-milestone] [--pin|--no-pin|--pin-default]',
42
+ ' [--milestone|--no-milestone] [--pin|--no-pin|--pin-default] [--parent <task>|none]',
43
+ ' --parent puts the task under another task of the same initiative as a subtask; none takes it back to the top level. Set it only when the PM asks.',
43
44
  ' Group tasks under a stage of the initiative\'s workflow (key or name; none takes it out), or change dates, owner or notes.',
44
45
  ' --milestone makes a task a milestone: its due date shows as ◇ on the Board and the timeline. Set it only when the PM asks.',
45
46
  ' --pin shows a milestone on the Board timeline, --no-pin hides it, --pin-default goes back to the rule (the last milestone',
46
47
  ' shows). Set it only when the PM asks.',
47
- ' pmos task list <initiative> [--all] its open tasks, with the start and due day the Board shows; --all adds Done, Won\'t do and Archived',
48
+ ' pmos task list <initiative> [--all] its open tasks, with the start and due day the Board shows; --all adds Done, Won\'t do and Archived.',
49
+ ' A subtask prints under its parent, indented.',
48
50
  ' pmos task remove <task> [<task> …] [--why <text>]',
49
51
  ' Delete a task added by mistake (a placeholder, a duplicate) when the PM asks. It goes from every list; the page\'s Undo brings',
50
52
  ' it back. Work that stopped is Archived or Won\'t do instead. A breakdown item is not deleted: set it to Won\'t do.',
@@ -63,7 +65,7 @@ const USAGE = [
63
65
  ];
64
66
  const BOOL = new Set(['json', 'help', 'all', 'milestone', 'no-milestone', 'pin', 'no-pin', 'pin-default', 'propose']);
65
67
  const PIN_FLAGS = ['pin', 'no-pin', 'pin-default'];
66
- const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage', 'type', 'lag']);
68
+ const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage', 'type', 'lag', 'parent']);
67
69
  const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage'], list: ['all'], state: ['to', 'why'], remove: ['why'], set: ['due', 'start', 'owner', 'notes', 'stage'], link: ['type', 'lag', 'why'], unlink: [] };
68
70
  const OPEN = new Set(['To do', 'In progress']);
69
71
  /** The PM's words for a state: any case, with or without the apostrophe or the space. */
@@ -107,6 +109,16 @@ function boardsCtx(root, stateDir) {
107
109
  return { w, ctx: { getWs: () => w, workspaceList: () => [w], stateDirFor: () => stateDir, selfRoot: path.resolve(__dirname, '..', '..') } };
108
110
  }
109
111
  const line = (t) => `${t.id} · ${t.state} · ${t.title}${t.kind === 'Epic' ? ' (epic)' : ''}${t.milestone ? ' · ◇ milestone' : ''}${t.pinned === true ? ' · pinned' : t.pinned === false ? ' · not pinned' : ''}${t.stage ? ' · under ' + t.stage : ''}${t.start ? ' · starts ' + String(t.start).slice(0, 10) : ''}${t.due ? ' · due ' + String(t.due).slice(0, 10) : ''}`;
112
+ /** The tasks in tree order: each one, then the ones under it (a parent not in the list leaves its subtask at the top level). */
113
+ function nested(T) {
114
+ const ids = new Set(T.map((t) => t.id)), kids = new Map(), out = [];
115
+ for (const t of T) if (t.parent && ids.has(t.parent) && t.parent !== t.id) { if (!kids.has(t.parent)) kids.set(t.parent, []); kids.get(t.parent).push(t); }
116
+ const seen = new Set();
117
+ const walk = (t, d) => { if (seen.has(t.id)) return; seen.add(t.id); out.push({ t, depth: d }); for (const k of kids.get(t.id) || []) walk(k, d + 1); };
118
+ for (const t of T) if (!(t.parent && ids.has(t.parent) && t.parent !== t.id)) walk(t, 0);
119
+ for (const t of T) if (!seen.has(t.id)) walk(t, 0); // a loop: still listed
120
+ return out;
121
+ }
110
122
  /** The workflow row of an initiative, deriving the rows when they are still being read. */
111
123
  function rowOf(boards, ctx, w, id) {
112
124
  let r = boards.initiativeWorkflow(ctx, w, id);
@@ -144,7 +156,11 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
144
156
  const cli = { isTTY: isTTY === undefined ? !!(process.stdin.isTTY && process.stdout.isTTY) : isTTY, env: env === undefined ? process.env : env };
145
157
  const g = { ok: true, actor: actorLib.fromCli(cli), cli };
146
158
  /** Every task of an initiative: its Board tasks and its breakdown items (lib/stage-read.js, which `pmos board` reads too). */
147
- const tasksOf = (id) => require('./stage-read.js').tasksOf(ctx, w, id);
159
+ const tasksOf = (id) => {
160
+ // each with its parent (subtasks, initiative work-subtasks), from the same fold the Board reads
161
+ const PA = boards.foldOf(ctx, w).parents || new Map();
162
+ return require('./stage-read.js').tasksOf(ctx, w, id).map((t) => (PA.has(t.id) ? { ...t, parent: PA.get(t.id) } : t));
163
+ };
148
164
 
149
165
  if (verb === 'add') {
150
166
  const [id, title] = pos;
@@ -173,9 +189,10 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
173
189
  try { boards.seedInitiative(ctx, w, id); } catch { /* the To finish tasks are made on the next read */ }
174
190
  const all = tasksOf(id);
175
191
  const shown = flags.all ? all : all.filter((t) => OPEN.has(t.state));
176
- if (json) { say(JSON.stringify({ ok: true, tasks: shown.map((t) => ({ id: t.id, board: t.board, kind: t.kind, title: t.title, state: t.state, owner: t.owner, start: t.start || null, due: t.due, stage: t.stage || '', ...(t.milestone ? { milestone: true } : {}), ...(typeof t.pinned === 'boolean' ? { pinned: t.pinned } : {}), ...(t.from ? { from: t.from } : {}) })) })); return 0; }
192
+ if (json) { say(JSON.stringify({ ok: true, tasks: shown.map((t) => ({ id: t.id, board: t.board, kind: t.kind, title: t.title, state: t.state, owner: t.owner, start: t.start || null, due: t.due, stage: t.stage || '', ...(t.milestone ? { milestone: true } : {}), ...(typeof t.pinned === 'boolean' ? { pinned: t.pinned } : {}), ...(t.from ? { from: t.from } : {}), ...(t.parent ? { parent: t.parent } : {}) })) })); return 0; }
177
193
  if (!shown.length) { say(all.length ? `No open task on ${id}. --all lists the ${all.length} closed.` : `No task on ${id}.`); return 0; }
178
- for (const t of shown) say(line(t));
194
+ // subtasks (initiative work-subtasks): a task with a parent prints under it, indented one step per level, up to three
195
+ for (const x of nested(shown)) say(' '.repeat(Math.min(x.depth, 3)) + line(x.t));
179
196
  return 0;
180
197
  }
181
198
  /** A task by its id: a Board task, or a breakdown item with the board its initiative is on. */
@@ -191,7 +208,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
191
208
  };
192
209
 
193
210
  if (verb === 'set') {
194
- const keys = ['stage', 'due', 'start', 'owner', 'notes'].filter((k) => flags[k] !== undefined).concat(flags.milestone || flags['no-milestone'] ? ['milestone'] : []).concat(PIN_FLAGS.some((k) => flags[k]) ? ['pinned'] : []);
211
+ const keys = ['stage', 'due', 'start', 'owner', 'notes', 'parent'].filter((k) => flags[k] !== undefined).concat(flags.milestone || flags['no-milestone'] ? ['milestone'] : []).concat(PIN_FLAGS.some((k) => flags[k]) ? ['pinned'] : []);
195
212
  if (!pos.length || !keys.length) { say('usage: pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>] [--milestone|--no-milestone] [--pin|--no-pin|--pin-default]'); return 2; }
196
213
  const folded = boards.foldOf(ctx, w);
197
214
  const done = [], refused = [];
@@ -208,6 +225,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
208
225
  }
209
226
  for (const k of ['due', 'start']) if (flags[k] !== undefined) body[k] = String(flags[k]).toLowerCase() === 'none' ? '' : flags[k];
210
227
  for (const k of ['owner', 'notes']) if (flags[k] !== undefined) body[k] = flags[k];
228
+ if (flags.parent !== undefined) body.parent = String(flags.parent).toLowerCase() === 'none' ? '' : String(flags.parent); // a subtask (initiative work-subtasks)
211
229
  if (flags.milestone || flags['no-milestone']) body.milestone = !!flags.milestone;
212
230
  if (PIN_FLAGS.some((k) => flags[k])) body.pinned = flags.pin ? true : flags['no-pin'] ? false : null;
213
231
  const e = boards.taskEdit(ctx, body, g);
@@ -28,7 +28,7 @@ const path = require('path');
28
28
  const ledgers = require('./plan-ledgers.js');
29
29
 
30
30
  const LEDGER = 'initiative-tasks.jsonl';
31
- const TASK_KINDS = Object.freeze(['task', 'task-update', 'task-remove', 'task-restore', 'task-section', 'task-milestone', 'task-pin', 'task-order']);
31
+ const TASK_KINDS = Object.freeze(['task', 'task-update', 'task-remove', 'task-restore', 'task-section', 'task-milestone', 'task-pin', 'task-order', 'task-parent']);
32
32
  const KINDS = new Set(TASK_KINDS);
33
33
  const isTaskKind = (k) => KINDS.has(k);
34
34
  const isTaskLine = (r) => !!r && typeof r === 'object' && !Array.isArray(r) && isTaskKind(r.kind);
@@ -118,7 +118,7 @@ function view(boardLines, storeLines) {
118
118
  /** The task part of a boards fold, as JSON text: equal text = the Board shows the same tasks, dates, places, milestones, pins and orders. */
119
119
  function snapshot(f) {
120
120
  const m = (x) => (x instanceof Map ? [...x.entries()].sort((a, b) => (String(a[0]) < String(b[0]) ? -1 : String(a[0]) > String(b[0]) ? 1 : 0)) : []);
121
- return JSON.stringify({ tasks: m(f.tasks), removed: m(f.removed), sections: m(f.sections), milestones: m(f.milestones), pins: m(f.pins), orders: m(f.orders),
121
+ return JSON.stringify({ tasks: m(f.tasks), removed: m(f.removed), sections: m(f.sections), parents: m(f.parents), milestones: m(f.milestones), pins: m(f.pins), orders: m(f.orders),
122
122
  // the last task-remove of a task is what its Undo reads (routes-boards tasks/restore)
123
123
  removes: (f.events || []).filter((e) => e.kind === 'task-remove').map((e) => [e.task, e.at || null, e.why || null]) });
124
124
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.688.0",
3
+ "version": "0.689.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.688.0",
9
+ "version": "0.689.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.688.0",
3
+ "version": "0.689.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -16,6 +16,7 @@
16
16
  import * as BM from './bk-model.js';
17
17
  import { productName } from './scope-chip.js'; // the product's display name ("IDPF"), never its folder id
18
18
  import * as SP from './bd-sprint.js';
19
+ import * as WS from './work-select.js'; // the bulk move with one Undo, shared with the initiative popup and This sprint (WorkBulkDS)
19
20
  import * as BD from './bd-backlog-ds.js'; // the Backlog from the system's parts (WorkBacklogDS) // the sprint overview while "This sprint" is on (initiative sprint-overview)
20
21
 
21
22
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
@@ -39,6 +40,7 @@ let CHIPS = new Set(), PICK = {}, SORT = 'due';
39
40
  let FOLD = {}; // group key → open (true) | folded (false), as the PM left it
40
41
  let MORE = new Set(); // the groups whose "N more" was pressed
41
42
  let SEL = new Set(); // ticked rows: ws|board|id
43
+ let ANCHOR = ''; // the last row picked in This sprint (Shift-click adds the range from it)
42
44
  let host = null, sw = null;
43
45
  let iniApplied = false; // ?ini= is read once
44
46
  let SAID = null; // the one line after a Yes: { text, undo }
@@ -143,7 +145,7 @@ function draw() {
143
145
  // This sprint (WorkSprintDS): the Summary card and the Tasks Table, both pm/bd-sprint.js; a past sprint keeps its frozen view and list
144
146
  if (tabOf() === 'sp') {
145
147
  const card = SP.bandHtml({ tasks: T.filter(BM.isOpen), all: T, inis: DATA.inis, readAt: DATA.readAt, notes: DATA.notes, hist: DATA.hist, now: DATA.now }, spDeps());
146
- const list = SP.pastOn() ? SP.pastListHtml() : SP.tasksNowHtml();
148
+ const list = SP.pastOn() ? SP.pastListHtml() : SP.tasksNowHtml(SEL);
147
149
  host.innerHTML = (DATA.err ? `<p class="bk-err">${esc(DATA.err)}</p>` : '') + (SAID ? `<p class="bk-said" role="status">${esc(SAID.text)}${SAID.undo ? ' <button type="button" class="bk-lnk" data-bksaid>Undo</button>' : ''}</p>` : '')
148
150
  + (card || list ? card + list : '<section class="pm-block"><p class="pm-meta">No sprint is active. When Jira has one, its work shows here, with the tasks outside Jira in its dates.</p></section>');
149
151
  drawBar();
@@ -323,7 +325,8 @@ function rowHtml(t, gk, cols = COLS) {
323
325
 
324
326
  /** What the sprint band (pm/bd-sprint.js) needs from the Backlog and its page. */
325
327
  const spDeps = () => ({ post, tasks: () => (DATA ? DATA.tasks.filter(BM.isOpen) : []), say: (m, u) => AP().say(m, u), draw, load, reload: () => AP().reload(), taskOf,
326
- openTask: (t, from) => AP().openTask(t, from),
328
+ openTask: (t, from) => AP().openTask(t, from), sel: SEL,
329
+ pick: (uid, order, e) => { const r = WS.pick(SEL, order, uid, { shift: e.shiftKey, meta: e.metaKey || e.ctrlKey, anchor: ANCHOR }); if (!r) return false; SEL.clear(); for (const u of r.sel) SEL.add(u); ANCHOR = r.anchor; draw(); return true; },
327
330
  pickIni: (at, p, done) => pickPop(at, 'Put them in', (DATA.inis || []).filter((x) => x.ws === p.ws && x.board === p.board).map((x) => [x.id, x.title]), (id) => done(id, ((DATA.inis || []).find((x) => x.id === id) || {}).title || id)),
328
331
  readJira: A && A.readJira ? () => A.readJira() : null, newInitiative: A && A.newInitiative ? (name, from) => A.newInitiative(name, from) : null });
329
332
 
@@ -335,7 +338,8 @@ function drawBar() {
335
338
  if (!n || !on()) { if (bar) { bar.remove(); bar = null; } return; }
336
339
  if (!bar) { bar = document.createElement('div'); bar.className = 'bk-bar'; bar.setAttribute('role', 'toolbar'); bar.setAttribute('aria-label', 'Ticked tasks'); document.body.appendChild(bar); bar.addEventListener('click', barPress); }
337
340
  bar.innerHTML = `<span class="c">${n} selected</span><button type="button" class="pm" data-bkb="give">${SPARK} Give to PMOS</button><button type="button" data-bkb="person">Give to a person</button>`
338
- + `<button type="button" data-bkb="ini">Move to initiative</button><button type="button" data-bkb="date">Set date</button><button type="button" data-bkb="archive">Archive</button>`
341
+ + `<button type="button" data-bkb="ini">Move to initiative</button><button type="button" data-bkb="parent">Under a parent</button><button type="button" data-bkb="date">Set date</button><button type="button" data-bkb="shift">Move dates</button>`
342
+ + `<button type="button" data-bkb="done">Done</button><button type="button" data-bkb="archive">Archive</button>`
339
343
  + `<button type="button" class="x" data-bkb="clear" aria-label="Clear the ticks" title="Clear">${SV(I.x)}</button>`;
340
344
  }
341
345
  const picked = () => DATA.tasks.filter((t) => SEL.has(uidOf(t)));
@@ -347,7 +351,24 @@ async function barPress(e) {
347
351
  if (k === 'person') { pickPop(b, 'Give to a person', people(), async (who) => { await editMany(T, { owner: who }, 'Given to ' + who); }, { free: 'A name' }); return; }
348
352
  if (k === 'ini') { pickPop(b, 'Move to initiative', inisFor(T).map((x) => [x.id, x.title]), async (id) => { await moveMany(T, id); }); return; }
349
353
  if (k === 'date') { datePop(b, async (d) => { await editMany(T, { due: d }, 'Due ' + d); }); return; }
350
- if (k === 'archive') { await stateMany(T, 'Archived'); }
354
+ if (k === 'archive') { await stateMany(T, 'Archived'); return; }
355
+ // the bulk move (initiative work-subtasks, WorkBulkDS): under a parent of the same initiative, by N days, or done, with one Undo
356
+ if (k === 'parent') {
357
+ const inis = new Set(T.map((t) => t.ini || '')), ini = [...inis][0];
358
+ if (inis.size !== 1 || !ini) { AP().say('Pick tasks of one initiative to put them under a parent.'); return; }
359
+ const L = DATA.tasks.filter((t) => t.ini === ini && t.src === 'pmos' && !SEL.has(uidOf(t))).map((t) => [uidOf(t), t.title]);
360
+ pickPop(b, 'Under a parent', [['', 'Top level (no parent)']].concat(L), async (v) => { const p = v ? DATA.tasks.find((t) => uidOf(t) === v) : null; await bulkMany(T, 'parent', p ? p.id : '', p ? p.title : 'the top level'); });
361
+ return;
362
+ }
363
+ if (k === 'shift') { pickPop(b, 'Move dates', [['-7', '1 week earlier'], ['-1', '1 day earlier'], ['1', '1 day later'], ['7', '1 week later']], async (v) => { const n = WS.shiftOf(v); if (n != null) await bulkMany(T, 'shift', n); }, { free: 'Days: +3, -2, 1w' }); return; }
364
+ if (k === 'done') { await bulkMany(T, 'done', null); }
365
+ }
366
+ /** One bulk write per board (POST /api/boards/tasks/bulk) and one Undo for all of it (pm/work-select.js). */
367
+ async function bulkMany(T, op, value, label) {
368
+ const by = new Map(T.map((t) => [uidOf(t), t]));
369
+ SEL.clear();
370
+ await WS.bulk((p, b) => post(p, b), (u) => { const t = by.get(u); return t ? { ws: t.ws, board: t.board, id: t.id } : null; }, [...by.keys()], op, value,
371
+ { say: (m, u) => AP().say(m, u || undefined), reload: async () => { load(); AP().reload(); } }, label);
351
372
  }
352
373
  const inisFor = (T) => { const ws = new Set(T.map((t) => t.ws + '|' + t.board)); return (DATA.inis || []).filter((x) => ws.has(x.ws + '|' + x.board)); };
353
374
 
@@ -78,6 +78,28 @@ div.pwd-art { cursor: default; }
78
78
  .pwd-art.miss .t { color: var(--muted); }
79
79
  .pwd-art .w.warn { color: var(--alert); }
80
80
  .pwd-ai { flex: none; color: var(--muted); display: inline-flex; }
81
+
82
+ /* ── subtasks, the bulk bar and the Jira chip (initiative work-subtasks; WorkSubtasksDS, WorkBulkDS, WorkJiraDS) ── */
83
+ .pwd-li[style*="--pwd-d"] { padding-left: calc(var(--pwd-d) * 24px + var(--space-4)); }
84
+ .pwd-chev { width: 20px; height: 20px; flex: none; display: inline-grid; place-items: center; border: 0; background: none; color: var(--muted); padding: 0; cursor: pointer; border-radius: var(--radius-sm); }
85
+ .pwd-chev:hover { color: var(--ink); background: var(--well); }
86
+ .pwd-chev.sp { visibility: hidden; cursor: default; }
87
+ .pwd-tl { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-4) var(--space-8); }
88
+ .pwd-prog { flex: none; width: 56px; height: 4px; border-radius: 2px; background: var(--well); overflow: hidden; margin-left: auto; }
89
+ .pwd-prog i { display: block; height: 100%; background: var(--leaf); }
90
+ .pwd-cnt { flex: none; white-space: nowrap; }
91
+ .pwd-key { display: inline-flex; align-items: center; gap: var(--space-4); text-decoration: none; color: var(--muted); font-size: var(--fs-meta); }
92
+ .pwd-key:hover { color: var(--ink); }
93
+ .pwd-ep { margin-left: var(--space-8); }
94
+ .pwd-epic { flex: none; display: inline-flex; align-items: center; gap: var(--space-4); font-size: var(--fs-meta); color: var(--ink); background: var(--well); border-radius: var(--radius-sm); padding: 2px var(--space-8); white-space: nowrap; }
95
+ .pwd-epic i { width: 6px; height: 6px; border-radius: 50%; background: var(--alert); }
96
+ .pwd-li.sel { box-shadow: inset 3px 0 0 var(--blue); background: var(--blue-tint); }
97
+ .pwd-list.picking .pwd-li { cursor: default; }
98
+ .ws-bar { gap: var(--space-8); flex-wrap: wrap; padding: var(--space-8) 0; }
99
+ .ws-bar .ws-n { margin-right: var(--space-8); }
100
+ .ws-bar .ws-x { margin-left: auto; }
101
+ .pwd-ask { margin: var(--space-8) 0; }
102
+
81
103
  /* a stage head is a press that folds the stage (Wawan, 2026-11-22): the system's pm-group as a button, the chevron at the end */
82
104
  .pwd-list .pm-group.pwd-gh { width: 100%; border: 0; font: inherit; font-size: var(--fs-label); font-weight: var(--fw-strong); text-align: left; cursor: pointer; }
83
105
  .pwd-list .pm-group.pwd-gh svg { margin-left: auto; flex: none; }