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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.688.0",
3
+ "version": "0.689.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,25 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.689.0",
38
+ "at": "2026-11-22T09:16:40.013Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1511,
43
+ "t": "Intelligence C6 at the default URL, and correct the ?dash= claim",
44
+ "s": "Intelligence C6 at the default URL, and correct the ?dash= claim",
45
+ "k": "x"
46
+ },
47
+ {
48
+ "n": 1492,
49
+ "t": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
50
+ "s": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
51
+ "k": "new"
52
+ }
53
+ ]
54
+ },
36
55
  {
37
56
  "v": "0.688.0",
38
57
  "at": "2026-11-22T09:05:24.774Z",
@@ -387,19 +406,6 @@
387
406
  "k": "new"
388
407
  }
389
408
  ]
390
- },
391
- {
392
- "v": "0.650.0",
393
- "at": "2026-11-20T06:52:20.858Z",
394
- "f": 4,
395
- "prs": [
396
- {
397
- "n": 1432,
398
- "t": "The initiative popup is built from design system blocks",
399
- "s": "The initiative popup is built from design system blocks",
400
- "k": "new"
401
- }
402
- ]
403
409
  }
404
410
  ]
405
411
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@18bd45e3
1
+ kernel-source: pmos@a41a0c46
2
2
  assembled: 2026-11-22
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-22T09:05:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T09:16:35Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-22T09:05:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T09:16:35Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-22T09:05:21Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T09:16:35Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -319,6 +319,28 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
319
319
  const ph = await P.page.evaluate(() => ({ goals: getComputedStyle(document.querySelector('#pGoals')).display, cards: [...document.querySelectorAll('#goalCards .ins-card')].filter((c) => c.getBoundingClientRect().height > 0).map((c) => c.dataset.goal).join() }));
320
320
  ok('C6 a phone keeps its goal cards on the default view (the phone page does not change)', ph.goals !== 'none' && ph.cards === 'krm-act,krm-up,krm-ttfc,krm-nps', JSON.stringify(ph));
321
321
  await P.ctx.close(); }
322
+ /* C6 (intelligence-ds-page, recheck): at the default URL key results come back on a saved dashboard view and while a new dashboard picks its
323
+ * goals; a shared ?goal= link and a ?ws= link still land. */
324
+ { const G = await open({ tab: '', q: '&goal=krm-act' }); const gp = G.page;
325
+ const gv = await until(() => vw(gp), 8000);
326
+ ok('C6 a ?goal= link at the default URL opens that goal in the Viewer', !!gv && gv.title === 'Partner activation', JSON.stringify(gv));
327
+ await vwClose(gp);
328
+ const shown = () => gp.evaluate(() => ({ krs: document.body.classList.contains('ins-krs'), goals: getComputedStyle(document.querySelector('#pGoals')).display, rows: [...document.querySelectorAll('#goalTbl [data-goal]')].filter((r) => r.getBoundingClientRect().height > 0).map((r) => r.dataset.goal).join() }));
329
+ ok('C6 before a view is picked, the default desk view has no key results', !(await shown()).krs, JSON.stringify(await shown()));
330
+ await gp.click('#viewChip'); await gp.click('#viewMenu [data-view="pd-1"]'); await sleep(200);
331
+ const sv = await shown();
332
+ ok('C6 a saved dashboard view at the default URL shows its key results', sv.krs && sv.goals !== 'none' && sv.rows === 'krm-act,krm-ttfc', JSON.stringify(sv));
333
+ await gp.click('#viewChip'); await gp.click('#viewMenu [data-view="all"]'); await sleep(200);
334
+ ok('C6 back on All goals, the key results step aside again', !(await shown()).krs, JSON.stringify(await shown()));
335
+ await gp.click('#viewChip'); await gp.click('#viewMenu [data-newdash]'); await sleep(200);
336
+ const nd = await shown();
337
+ ok('C6 while a new dashboard picks its goals, the key results show to pick from', nd.krs && nd.goals !== 'none' && nd.rows.split(',').length >= 3, JSON.stringify(nd));
338
+ ok('C6 no page error on these views', G.errors.length === 0, G.errors.join(' | '));
339
+ await G.ctx.close();
340
+ const Wc = await open({ tab: '', q: '&ws=w1' });
341
+ const wv = await Wc.page.evaluate(() => ({ krs: document.body.classList.contains('ins-krs'), brief: document.querySelector('#brief').textContent, trends: !document.querySelector('#trendBox').hidden }));
342
+ ok('C6 a ?ws= link lands on that product\'s page, on the default desk view', Wc.up && !wv.krs && !/could not be read/.test(wv.brief) && wv.trends, JSON.stringify(wv));
343
+ await Wc.ctx.close(); }
322
344
 
323
345
  /* D: New dashboard (AgInsNewDash), describe, the saved view, Edit chart (AgInsChart) and the pin */
324
346
  {
@@ -385,7 +407,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
385
407
  const R3 = await open({ model: IP.build(met) }), q3 = R3.page, sent = [];
386
408
  await q3.route(/\/api\/insights-records\/verdict(-undo)?$/, (r) => { sent.push([new URL(r.request().url()).pathname, JSON.parse(r.request().postData() || '{}')]); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
387
409
  const dv = await q3.evaluate(() => ({ text: document.querySelector('#outTbl [data-ini="refund-reason-codes"]').textContent.replace(/\s+/g, ' '), keep: (document.querySelector('#outTbl [data-keep]') || {}).getAttribute && document.querySelector('#outTbl [data-keep]').getAttribute('aria-label') }));
388
- ok('O2 a met promise gets a drafted verdict said from the readings, with ✓ Record the verdict: Keep', /It beat the promise: −2\.2 pts against −2 pts\./.test(dv.text) && dv.keep === 'Record the verdict: Keep', JSON.stringify(dv));
410
+ ok('O2 a met promise gets a drafted verdict said from the readings: PMOS thinks Yes (board IntelligenceDS: the verdict word is the badge, no longer "Keep."), with ✓ Record the verdict: Keep', /Yes ?It beat the promise: −2\.2 pts against −2 pts\./.test(dv.text) && dv.keep === 'Record the verdict: Keep', JSON.stringify(dv));
389
411
  await q3.click('#outTbl [data-keep]'); await until(() => sent.length > 0, 4000);
390
412
  ok('O2 ✓ Keep records Keep with the drafted line, marked drafted, without opening a panel', sent[0][0] === '/api/insights-records/verdict' && sent[0][1].verdict === 'Keep' && sent[0][1].drafted === true && /beat the promise/.test(sent[0][1].learned) && sent[0][1].ini === 'refund-reason-codes' && sent[0][1].board === 'w1' && await q3.evaluate(() => document.querySelector('#side').hidden), JSON.stringify(sent));
391
413
  await q3.click('#toast .cta'); await until(() => sent.length > 1, 4000);
@@ -196,6 +196,9 @@ const vw = () => { const v = document.querySelector('#czViewer:not([hidden])');
196
196
 
197
197
  {
198
198
  // the real server refuses what it must, with requests that cannot write
199
+ // The browser steps above can leave fetch's pooled socket idle past the server's 5 s keep-alive, so the first
200
+ // GET / can meet a reset socket and T.nonce() answers ''. One plain GET first opens a fresh socket.
201
+ await fetch(BASE + '/').then((r) => r.text()).catch(() => '');
199
202
  const hdr = await T.pressHeaders(BASE);
200
203
  const send = (h, body, route = 'decide') => fetch(BASE + '/api/briefing-premium/' + route, { method: 'POST', headers: h, body: JSON.stringify(body) }).then(async (r) => ({ s: r.status, j: await r.json().catch(() => ({})) }));
201
204
  const good = { key: 'decision:nope', choice: 'kill', why: 'test only' };
@@ -1,4 +1,23 @@
1
1
  [
2
+ {
3
+ "v": "0.689.0",
4
+ "at": "2026-11-22T09:16:40.013Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1511,
9
+ "t": "Intelligence C6 at the default URL, and correct the ?dash= claim",
10
+ "s": "Intelligence C6 at the default URL, and correct the ?dash= claim",
11
+ "k": "x"
12
+ },
13
+ {
14
+ "n": 1492,
15
+ "t": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
16
+ "s": "Subtasks at any depth, bulk move with one Undo, and the Jira epic check",
17
+ "k": "new"
18
+ }
19
+ ]
20
+ },
2
21
  {
3
22
  "v": "0.688.0",
4
23
  "at": "2026-11-22T09:05:24.774Z",
@@ -2,13 +2,36 @@
2
2
  type: Guide
3
3
  title: "An initiative's tasks"
4
4
  description: "Where an initiative's tasks show in the workspace, how an agent adds tasks, and who made a change."
5
- timestamp: 2026-11-08
5
+ timestamp: 2026-11-22
6
6
  ---
7
7
 
8
8
  # An initiative's tasks
9
9
 
10
10
  An initiative owns its task breakdown. In the workspace, its tasks show under the initiative in Home's list (the 3 most urgent, then **Show N more tasks**) and on the initiative's page in the Viewer. Press **+** at the top of Home's list, then **Task**, to add one. A check box is a task: amber when it is late. [Home](home.md) explains the list.
11
11
 
12
+ ## Subtasks
13
+
14
+ A task can sit under another task, at any depth. To add a subtask, type `under <parent>: <title>` in the add box of the Work breakdown, for example `under Batch 2: TM web`. To move a task, open its **More** menu and select **Make subtask of…** or **Move out of …**.
15
+
16
+ A parent shows a fold arrow and "n of m done". Its dates are the earliest start and the latest end of the tasks under it. A parent with more than five subtasks is folded until you open it. When you tick a parent that has open subtasks, PMOS asks once if it must tick them too.
17
+
18
+ In the terminal, `pmos task set <task> --parent <task>` sets the parent, and `--parent none` moves the task back to the top level. `pmos task list` shows each subtask under its parent.
19
+
20
+ ## Move several tasks at once
21
+
22
+ To select tasks, Cmd-click or Ctrl-click each one, or Shift-click to select a range. This works in the Work breakdown's List and Gantt, in Work › Backlog and in This sprint. A bar shows the number of selected tasks. Use it to put the tasks under a parent, move them to a stage, give them to a person, move their dates by a number of days, or mark them done. One **Undo** puts all of them back. Press Esc to clear the selection.
23
+
24
+ PMOS does not change the stage, owner or status of a Jira ticket. It skips these tickets and tells you why.
25
+
26
+ ## Jira tickets in the breakdown
27
+
28
+ A task that is linked to a Jira ticket shows the ticket key. Select the key to open the ticket in Jira. A task that is only in PMOS shows no key. The Jira sub-tasks of a ticket show under the ticket.
29
+
30
+ A red dot on a ticket shows that it has no epic, or that its epic is not one of the initiative's epics. Hold the pointer on the dot to see why. Above the list, PMOS suggests a fix: put the tickets under the initiative's epic. When you select ✓:
31
+
32
+ - PMOS sets the epic directly only on the tickets that are assigned to you. It uses your own Atlassian connection.
33
+ - PMOS adds each other ticket to the day's draft for that ticket's owner. PMOS does not send the draft. To read it, run `pmos jira epic-asks --draft`.
34
+
12
35
  ## Items an agent adds
13
36
 
14
37
  An agent can add items with `pmos item add`. Since D98 its items are live at once: they show under the initiative and count in its progress, with no Keep card. Each item names the agent that added it, so you can withdraw it if you do not want it. A Keep line from before D98 has no effect any more and is not flagged.
@@ -660,6 +660,8 @@ The benchmark needs a signed-in agent CLI. It never pushes and never opens a pul
660
660
  - `pmos jira moved <move id> --status "<Jira status>"` or `--refused "<why>"`
661
661
  - `pmos jira guesses <initiative> [--from <file|->]`
662
662
  - `pmos jira answer <initiative> <ticket> <n> --text "<answer>"` or `--keep-default`
663
+ - `pmos jira epic-asks [--direct|--draft]` lists the tickets waiting to go under their initiative's epic. `--draft` prints the day's draft by owner, for you to send.
664
+ - `pmos jira epic-done <ask id>` or `--refused "<why>"` records the answer for a ticket that is assigned to you.
663
665
  - `pmos jira criteria <initiative>`: the done-test checks each ticket carries as acceptance criteria, and the checks on no ticket
664
666
  - `pmos jira digest [--since <YYYY-MM-DD or time>]`: what moved in the tracker since the last working day, who moved it, the moved tickets with no task in PMOS, and what is worth a question (blocked, reopened, nobody assigned, stuck, not in the last read). It reads only the stored Jira reads.
665
667
 
@@ -22,7 +22,7 @@ Intelligence is built from the design system's blocks, in one column. It is the
22
22
  5. **Did it work?** (below).
23
23
  6. **Waiting on a source**: a key result with no reading, with Connect or Add a reading.
24
24
 
25
- To see the key results on this page too, pick **Key results here** in ⋯, or open a link with `?tab=goals`.
25
+ To see the key results on this page too, pick **Key results here** in ⋯, or open a link with `?tab=goals`. A saved dashboard, and New dashboard while you pick its goals, also show them. A shared goal link (`?goal=`) opens that goal. A dashboard opens from the View chip: the address has no dashboard part, so `?dash=` opens the page as usual.
26
26
 
27
27
  ## The goal list
28
28
 
@@ -66,6 +66,14 @@ const tkStatus = (status, category) => {
66
66
  if (category === 'doing' || /progress|doing|block|started/i.test(s)) return 'In progress';
67
67
  return 'To do';
68
68
  };
69
+ /* the epic check and the sub-tasks (initiative work-subtasks): a reading's parent is its epic, unless it is a sub-task, whose parent is its ticket */
70
+ const isSub = (type) => /sub-?task/i.test(String(type || ''));
71
+ const epicOfReading = (i) => (i && i.parent ? (isSub(i.type) ? { parentTicket: i.parent, sub: true } : { epic: i.parent }) : { epic: '' });
72
+ /** The Jira ticket a PMOS task names, as the read holds it (lib/routes-boards.js trackerMarks): small, so the row stays light. */
73
+ function jiraOf(t) {
74
+ return { key: t.key, ...(t.url ? { url: t.url } : {}), ...(t.status ? { status: t.status } : {}), ...(t.read ? { epic: t.epic || '' } : {}), ...(t.parentName ? { epicName: clip(t.parentName, 80) } : {}),
75
+ ...(t.parentTicket ? { parentTicket: t.parentTicket } : {}), ...(t.assignee ? { assignee: t.assignee } : {}), ...(t.type ? { type: t.type } : {}), ...(Array.isArray(t.subs) && t.subs.length ? { subs: t.subs.slice(0, 30) } : {}) };
76
+ }
69
77
  /** The Jira tickets of each initiative, from the sprint readings (with sprint, points and flag) and the board's work items (pushed tickets). */
70
78
  function ticketsBy(sprints, items) {
71
79
  const by = new Map(), seen = new Map();
@@ -79,11 +87,11 @@ function ticketsBy(sprints, items) {
79
87
  for (const sp of sprints || []) for (const i of sp.issues || []) {
80
88
  const status = tkStatus(i.status, i.category);
81
89
  add(i.initiative, { key: i.key, title: clip(i.summary || i.key, 120), status, raw: i.status || '', cls: i.flagged ? 'bl' : TK_CLS[status], blocked: !!i.flagged, reason: i.flagged && i.reason ? clip(i.reason, 160) : '',
82
- points: Number.isFinite(i.points) ? i.points : null, url: i.url || '', sprint: sp.name || '', sprintState: sp.state || '', sprintEnd: sp.end ? String(sp.end).slice(0, 10) : '', assignee: i.assignee || '' });
90
+ points: Number.isFinite(i.points) ? i.points : null, url: i.url || '', sprint: sp.name || '', sprintState: sp.state || '', sprintEnd: sp.end ? String(sp.end).slice(0, 10) : '', assignee: i.assignee || '', ...epicOfReading(i) });
83
91
  }
84
92
  for (const w of items || []) {
85
93
  if (!w || w.src !== 'jira' || w.kind === 'Epic' || !w.key) continue;
86
- add(w.ini, { key: w.key, title: clip(w.title || w.key, 120), status: w.status || 'To do', raw: w.status || '', cls: w.blocked ? 'bl' : TK_CLS[w.status] || '', blocked: !!w.blocked, reason: '', points: null, url: '', sprint: '', sprintState: '', sprintEnd: '', assignee: w.owner || '',
94
+ add(w.ini, { key: w.key, title: clip(w.title || w.key, 120), status: w.status || 'To do', raw: w.status || '', cls: w.blocked ? 'bl' : TK_CLS[w.status] || '', blocked: !!w.blocked, reason: '', points: null, url: '', sprint: '', sprintState: '', sprintEnd: '', assignee: w.owner || '', ...(w.epic ? { epic: w.epic } : {}), ...(w.parent ? { parent: w.parent } : {}),
87
95
  ...(w.datesHere ? { start: w.start || '', due: w.end || '', datesHere: true } : {}) }); // the dates the PM keeps in PMOS (batch 11 item 23)
88
96
  }
89
97
  return by;
@@ -338,7 +346,9 @@ function build(f) {
338
346
  // the start too: the Tasks Timeline draws a bar from the start to the due day (batch 9 item 5b)
339
347
  taskBy.get(w.ini).push({ uid: w.uid, title: clip(w.title || '', 160), status: w.status || 'To do', owner: w.owner || '', start: w.start || '', end: w.end || '', ...(w.from ? { from: { stage: w.from.stage, finish: w.from.finish } } : {}),
340
348
  // one view (feedback batch 6 item 1): its place in the breakdown, and a breakdown item's own stage and order
341
- ...(typeof w.section === 'string' ? { section: w.section } : {}), ...(w.itemStage ? { itemStage: w.itemStage } : {}), ...(Number.isFinite(w.order) ? { order: w.order } : {}), ...(Number.isFinite(w.rank) ? { rank: w.rank } : {}), ...(w.store === 'item' ? { item: true } : {}), ...(w.milestone ? { milestone: true } : {}), ...(w.since ? { since: w.since } : {}) });
349
+ ...(typeof w.section === 'string' ? { section: w.section } : {}), ...(w.itemStage ? { itemStage: w.itemStage } : {}), ...(Number.isFinite(w.order) ? { order: w.order } : {}), ...(Number.isFinite(w.rank) ? { rank: w.rank } : {}), ...(w.store === 'item' ? { item: true } : {}), ...(w.milestone ? { milestone: true } : {}), ...(w.since ? { since: w.since } : {}),
350
+ // a subtask's parent (initiative work-subtasks), and the Jira ticket the task names as read: its key, link, epic, assignee and sub-tasks
351
+ ...(w.parent ? { parent: w.parent } : {}), ...(w.tracker && w.tracker.key ? { jira: jiraOf(w.tracker) } : {}) });
342
352
  }
343
353
  // the milestones of each initiative (feedback batch 11 item 3): its tasks flagged ◇, PMOS and Jira alike, at their due dates. Won't do and
344
354
  // Archived take one off the timeline; one with no due date is not drawn (the Tasks list asks for the date)
@@ -49,6 +49,9 @@
49
49
  * task-order { initiative, section, tasks: [id] } the PM's order of the open tasks inside one stage of an
50
50
  * initiative's breakdown (feedback batch 18 item 16, a drag in the stage list): the ids top to bottom. A task not named sorts after
51
51
  * them. An empty list takes the order out (the urgency again). It never changes a task's status, dates or place; the last line wins.
52
+ * task-parent { task, parent } a subtask (initiative work-subtasks): `task` sits under the
53
+ * task `parent`, at any depth; '' takes it back to the top level. `task` and `parent` are Board tasks, breakdown items or Jira keys.
54
+ * A line that names the task itself or would make a cycle has no effect; the last line wins. A `task` line may carry `parent` too.
52
55
  * ticket-dates { ref, start, due } the PM's own start and due days for a Jira ticket (feedback batch 11
53
56
  * item 23): kept in PMOS only, never written to Jira; '' clears one. They win over Jira's dates on the timeline; the last line wins.
54
57
  * ini-delete { id, title, tasks, items } the PM's Delete of an initiative (feedback batch 16 item 5d): it
@@ -175,7 +178,13 @@ function foundOf(f) {
175
178
  const sources = Array.isArray(f.sources) ? f.sources.filter((x) => x && typeof x.ref === 'string').slice(0, 8).map((x) => ({ label: String(x.label || ''), ref: x.ref })) : [];
176
179
  return { why: typeof f.why === 'string' ? f.why : '', sources, match: typeof f.match === 'string' && f.match ? f.match : null, scan: typeof f.scan === 'string' ? f.scan : null, run: typeof f.run === 'string' ? f.run : null };
177
180
  }
178
- const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'task-restore', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto', 'task-section', 'task-milestone', 'task-pin', 'ticket-dates', 'task-order',
181
+ /** true when putting `task` under `parent` would make a cycle: `parent` is `task` itself or sits under it. parents: Map id → parent id. */
182
+ function wouldCycle(parents, task, parent) {
183
+ const seen = new Set();
184
+ for (let p = parent; p; p = parents.get(p)) { if (p === task || seen.has(p)) return true; seen.add(p); }
185
+ return false;
186
+ }
187
+ const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'task-restore', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto', 'task-section', 'task-milestone', 'task-pin', 'ticket-dates', 'task-order', 'task-parent',
179
188
  // split or merge initiatives (feedback batch 11 item 14): a Jira ticket moved to another initiative, the split and merge records with their Undo, Claude's suggestion dismissed
180
189
  'ticket-move', 'ini-split', 'ini-merge', 'ini-sm-undo', 'ini-suggest', 'backlog-rank',
181
190
  // Delete an initiative with its tasks, and its Undo (feedback batch 16 item 5d)
@@ -210,6 +219,7 @@ function fold(events) {
210
219
  const tasks = new Map(); // task id → { id, board, initiative, title, epic, owner, state, start, due, at, by, history }
211
220
  const sections = new Map(); // task id → the stage key its breakdown section is ('' = Not in a stage); the last task-section line wins
212
221
  const milestones = new Map(); // task id (or Jira key) → true | false: the PM's milestone flag; the last task-milestone line wins
222
+ const parents = new Map(); // task id (or Jira key) → the id of its parent task (subtasks, initiative work-subtasks); the last task-parent line wins
213
223
  const orders = new Map(); // key(initiative, section) → the task ids in the PM's order inside that stage; the last task-order line wins
214
224
  const pins = new Map(); // task id (or Jira key) → true | false: the PM's pin on a milestone; a null line takes it out (the rule again)
215
225
  const removed = new Map(); // task id → the task a task-remove took out, so a task-restore (Delete's Undo) puts it back
@@ -293,6 +303,7 @@ function fold(events) {
293
303
  start: typeof e.start === 'string' ? e.start : null, due: typeof e.due === 'string' ? e.due : null, at: e.at || null, by: e.by || null, history: [],
294
304
  // a stage's To finish entry made a task (routes-boards stageTasks): the stage card counts it, and it is made once
295
305
  from: isObj(e.from) && typeof e.from.stage === 'string' && typeof e.from.finish === 'string' ? { stage: e.from.stage, finish: e.from.finish } : null });
306
+ if (typeof e.parent === 'string' && e.parent && e.parent !== e.task && !wouldCycle(parents, e.task, e.parent)) parents.set(e.task, e.parent);
296
307
  } else if (e.kind === 'task-update' && typeof e.task === 'string' && tasks.has(e.task)) {
297
308
  const t = tasks.get(e.task);
298
309
  if (taskState(e.state)) t.state = taskState(e.state);
@@ -307,6 +318,10 @@ function fold(events) {
307
318
  if (taskState(e.state)) t.since = typeof e.happened === 'string' ? e.happened : String(e.at || '').slice(0, 10) || null;
308
319
  } else if (e.kind === 'task-section' && typeof e.task === 'string' && e.task && typeof e.section === 'string') {
309
320
  sections.set(e.task, e.section);
321
+ } else if (e.kind === 'task-parent' && typeof e.task === 'string' && e.task && typeof e.parent === 'string') {
322
+ // a subtask (initiative work-subtasks): any depth; '' takes it back to the top level; a line that names the task itself or makes a cycle has no effect
323
+ if (!e.parent) parents.delete(e.task);
324
+ else if (e.parent !== e.task && !wouldCycle(parents, e.task, e.parent)) parents.set(e.task, e.parent);
310
325
  } else if (e.kind === 'task-milestone' && typeof e.task === 'string' && e.task && typeof e.milestone === 'boolean') {
311
326
  milestones.set(e.task, e.milestone);
312
327
  } else if (e.kind === 'task-order' && typeof e.initiative === 'string' && e.initiative && typeof e.section === 'string' && Array.isArray(e.tasks)) {
@@ -393,7 +408,7 @@ function fold(events) {
393
408
  suggestNo.set(e.id, { kind: e.of === 'merge' ? 'merge' : 'split', fp: e.fp, at: e.at || null });
394
409
  }
395
410
  }
396
- return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, removed, sections, orders, milestones, pins, ticketNotes, ticketDates, epics, archives, deleted, notDup, iniWf, ends, judged, autoOver, ticketMoves, backlogRank, smOps, smUndone, suggestNo, events: list };
411
+ return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, removed, sections, parents, orders, milestones, pins, ticketNotes, ticketDates, epics, archives, deleted, notDup, iniWf, ends, judged, autoOver, ticketMoves, backlogRank, smOps, smUndone, suggestNo, events: list };
397
412
  }
398
413
 
399
414
  /** The stages an initiative runs on a board: its own workflow when one is recorded, else the board's. */
@@ -897,5 +912,5 @@ module.exports = {
897
912
  templateWorkflow, isTemplateEdited, fold, readingOf, deriveStage, stageOf, catOf, moveWarnings, cardWarnings,
898
913
  applyWorkflowEdit, filterRows, health, counts, sprintsOf, backlogOf, key,
899
914
  INI_TEMPLATES, TASK_STATES, taskState, isBuildStage, templateBuilds, boardSettings, jiraProjectsOf, JIRA_KEY_RE, JIRA_PROJECT_RE, workflowOf, templateOf, applyIniWorkflow, taskOf, shiftDay,
900
- ITEM_PROGRESS, itemStatus, taskItem, rollupItems,
915
+ ITEM_PROGRESS, itemStatus, taskItem, rollupItems, wouldCycle,
901
916
  };
@@ -18,6 +18,9 @@
18
18
  * pmos jira which <KEY> [<KEY> …] the initiative a Jira key belongs to
19
19
  * pmos jira moves the status moves the PM asked in PMOS, not answered yet (lib/jira-moves.js)
20
20
  * pmos jira moved <move id> --status "<Jira status>" | --refused "<why>" the agent's answer for one move
21
+ * pmos jira epic-asks [--direct | --draft] the epic fixes the PM approved (lib/jira-epics.js): --direct the ones
22
+ * assigned to the PM (the jira-epic agent sets them), --draft the day's draft by owner
23
+ * pmos jira epic-done <ask id> [--refused "<why>"] the jira-epic agent's answer for one ask
21
24
  * pmos jira guesses <initiative> [--from <file|->] a ticket dry run (lib/ticket-dry-run.js), recorded or shown
22
25
  * pmos jira answer <initiative> <ticket> <n> --text "<answer>" | --keep-default the PM's answer to one dry-run gap, or its default kept
23
26
  * pmos jira digest [--since <YYYY-MM-DD or time>] the standup facts from the stored reads (lib/tracker-digest.js)
@@ -34,10 +37,11 @@ const { parseArgs } = require('./schedule-cli');
34
37
  const jiraStatus = require('./jira-status.js');
35
38
  const jiraTickets = require('./jira-tickets.js');
36
39
  const jiraMoves = require('./jira-moves.js');
40
+ const jiraEpics = require('./jira-epics.js');
37
41
  const planItems = require('./plan-items.js');
38
42
  const guard = require('./pm-guard.js');
39
43
 
40
- const COMMANDS = { jira: ['draft', 'show', 'epic', 'approve', 'pending', 'record', 'query', 'sync', 'summary', 'which', 'moves', 'moved', 'guesses', 'answer', 'criteria', 'digest'] };
44
+ const COMMANDS = { jira: ['draft', 'show', 'epic', 'approve', 'pending', 'record', 'query', 'sync', 'summary', 'which', 'moves', 'moved', 'epic-asks', 'epic-done', 'guesses', 'answer', 'criteria', 'digest'] };
41
45
  const USAGE = [
42
46
  'usage: pmos jira draft|show|epic|approve|pending|record|query|sync|summary|which — Jira tickets from the PRD, and their status',
43
47
  ' pmos jira draft <initiative> [--dry-run] draft one ticket per PRD item, in the ticket template',
@@ -63,11 +67,13 @@ const USAGE = [
63
67
  ' pmos jira which <KEY> [<KEY> …] the initiative a Jira key belongs to',
64
68
  ' pmos jira moves the status moves asked in PMOS that wait for Jira',
65
69
  ' pmos jira moved <move id> --status "<status>" | --refused "<why>" what Jira did with one move',
70
+ ' pmos jira epic-asks [--direct | --draft] the epic fixes the PM approved: the ones assigned to the PM, or the day\'s draft by owner',
71
+ ' pmos jira epic-done <ask id> [--refused "<why>"] what Jira did with one epic fix',
66
72
  ' pmos jira digest [--since <YYYY-MM-DD or time>] what moved since the last working day, who moved it, and what is worth a question',
67
73
  ' every command: [--json] [--root <dir>]',
68
74
  'This command never calls Jira. Your agent reads and writes Jira with your own connection.',
69
75
  ];
70
- const BOOL = new Set(['json', 'dry-run', 'help', 'sprints', 'keep-default']);
76
+ const BOOL = new Set(['json', 'dry-run', 'help', 'sprints', 'keep-default', 'direct', 'draft']);
71
77
  const VALUE = new Set(['from', 'query', 'root', 'epic', 'updated', 'group', 'status', 'refused', 'sprint', 'text', 'since']);
72
78
  const FLAG_TEXT = { 'prd-changed': 'PRD changed', removed: 'Removed from PRD', blocked: 'Blocked', incomplete: 'Missing text', pushing: 'Selected, waiting for the push', edited: 'Edited, not in Jira yet' };
73
79
 
@@ -200,6 +206,19 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
200
206
  const P = jiraMoves.pending(jiraMoves.read(root));
201
207
  return out({ ok: true, moves: P }, P.length ? P.map((m) => `${m.id}\t${m.key}\t${m.from || '?'} → ${m.to}${m.fromRaw ? `\t(Jira showed ${m.fromRaw})` : ''}`) : ['no move waits for Jira']);
202
208
  }
209
+ if (verb === 'epic-asks') {
210
+ const F = jiraEpics.readEpicAsks(root);
211
+ if (flags.draft) { const t = jiraEpics.epicDraftText(F); return out({ ok: true, draft: t }, [t || 'no ticket waits in the draft']); }
212
+ const P = jiraEpics.pendingEpicAsks(F, flags.direct ? { direct: true } : {});
213
+ return out({ ok: true, asks: P }, P.length ? P.map((a) => `${a.id}\t${a.key}\t${a.from || 'none'} → ${a.epic}${a.direct ? '' : '\t(draft for ' + (a.who || 'its owner') + ')'}`) : ['no epic ask waits for Jira']);
214
+ }
215
+ if (verb === 'epic-done') {
216
+ const id = pos[0];
217
+ if (!id) return need('<ask id> [--refused "<why Jira refused>"]');
218
+ const r = jiraEpics.answerEpicAsk(root, id, flags.refused != null ? { why: flags.refused } : { set: true }, 'agent', now);
219
+ if (!r.ok) return fail(r.error);
220
+ return out(r, [r.ask.state === 'set' ? `${r.ask.key} · under ${r.ask.epic} in Jira` : `${r.ask.key} · refused: ${r.ask.why}`]);
221
+ }
203
222
  if (verb === 'moved') {
204
223
  const id = pos[0];
205
224
  if (!id || (flags.status == null) === (flags.refused == null)) return need('<move id> --status "<the status Jira shows now>" | --refused "<why Jira refused>"');
@@ -0,0 +1,125 @@
1
+ 'use strict';
2
+ /* jira-epics.js — the epic check's fix (initiative work-subtasks; board WorkJiraDS on Exploring 3, page Work). THE ONE WRITER and THE ONE FOLD of
3
+ * <state>/tracker/jira/epics.jsonl.
4
+ *
5
+ * The Work breakdown flags a Jira ticket that has no epic, or whose epic is not one of the initiative's (pm/work-tree.js epicFlag), and PMOS
6
+ * proposes to put it under the initiative's epic. On the PM's yes, each ticket becomes an ASK here. The workspace server makes no request to
7
+ * Jira (D53, D88):
8
+ * · a ticket assigned to the PM is DIRECT: an agent session with the PM's own Atlassian connection (skill jira-epic) sets its parent to the
9
+ * epic and answers with `pmos jira epic-done`. Direct Jira writes only on tickets assigned to the PM (Wawan 2026-11-22).
10
+ * · every other ticket goes to the day's DRAFT for its owner: `pmos jira epic-asks --draft` lists them by owner, for the PM to read and
11
+ * send. Nothing is sent by PMOS.
12
+ *
13
+ * THE LEDGER. One line per change, append-only:
14
+ * ask { v, kind: 'ask', id, key, ini, epic, from, who, direct, at, by } from: the epic it had ('' none); who: its assignee as read
15
+ * set { v, kind: 'set', id, at, by } the agent set the epic in Jira
16
+ * refused { v, kind: 'refused', id, why, at, by } Jira refused, or could not be reached
17
+ * withdrawn { v, kind: 'withdrawn', id, at, by } the PM's Undo, before an answer
18
+ *
19
+ * epicsFile(root) · readEpicAsks(root) → Map key → ask (the latest ask of each ticket, with state 'asked' | 'set' | 'refused' | 'withdrawn')
20
+ * isPmName(who, me) · askEpics(root, o, by) · answerEpicAsk(root, id, r, by) · withdrawEpicAsks(root, ids, by) · pendingEpicAsks(F, { direct }) · epicDraftText(F)
21
+ */
22
+ const fs = require('fs');
23
+ const path = require('path');
24
+ const crypto = require('crypto');
25
+ const jiraTickets = require('./jira-tickets.js');
26
+
27
+ const FILE = 'epics.jsonl';
28
+ const KEY_RE = /^[A-Z][A-Z0-9_]{0,30}-\d{1,9}$/;
29
+ const ID_RE = /^ep-[0-9a-f]{10}$/;
30
+ const oneLine = (s, n) => { const t = String(s == null ? '' : s).replace(/[\r\n\t]+/g, ' ').replace(/\s{2,}/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t; };
31
+
32
+ function epicsFile(root) { return path.join(jiraTickets.jiraDir(root), FILE); }
33
+ function epicLines(root) {
34
+ let txt = '';
35
+ try { txt = fs.readFileSync(epicsFile(root), 'utf8'); } catch { return []; }
36
+ const out = [];
37
+ for (const l of txt.split('\n')) { if (!l.trim()) continue; try { out.push(JSON.parse(l)); } catch { /* a torn line is skipped */ } }
38
+ return out;
39
+ }
40
+ function appendEpicLines(root, ls) {
41
+ fs.mkdirSync(path.dirname(epicsFile(root)), { recursive: true });
42
+ fs.appendFileSync(epicsFile(root), ls.map((l) => JSON.stringify(l)).join('\n') + '\n');
43
+ }
44
+
45
+ /** PURE: the latest ask of each ticket. An answer counts only for the ask it names, and only while that ask is still asked. */
46
+ function foldEpicAsks(ls) {
47
+ const by = new Map(), ids = new Map();
48
+ for (const l of ls || []) {
49
+ if (!l || typeof l !== 'object') continue;
50
+ if (l.kind === 'ask' && ID_RE.test(String(l.id || '')) && KEY_RE.test(String(l.key || '')) && KEY_RE.test(String(l.epic || ''))) {
51
+ const a = { id: l.id, key: l.key, ini: String(l.ini || ''), epic: l.epic, from: String(l.from || ''), who: oneLine(l.who, 80), direct: l.direct === true, state: 'asked', why: '', at: l.at || '', askedAt: l.at || '' };
52
+ by.set(l.key, a); ids.set(l.id, a);
53
+ } else if (['set', 'refused', 'withdrawn'].includes(l.kind) && ids.has(l.id)) {
54
+ const a = ids.get(l.id);
55
+ if (by.get(a.key) !== a || a.state !== 'asked') continue;
56
+ a.state = l.kind; a.at = l.at || a.at;
57
+ if (l.kind === 'refused') a.why = oneLine(l.why, 200) || 'Jira did not say why';
58
+ }
59
+ }
60
+ return by;
61
+ }
62
+ function readEpicAsks(root) { return foldEpicAsks(epicLines(root)); }
63
+
64
+ /** The PM's own name against a Jira assignee: the same name, or the same first name (Jira shows "Wawan Setiawan", the PM is "Wawan"). */
65
+ function isPmName(who, me) {
66
+ const w = String(who || '').trim().toLowerCase(), m = String(me || '').trim().toLowerCase();
67
+ if (!w || !m) return false;
68
+ return w === m || w.split(/\s+/)[0] === m.split(/\s+/)[0];
69
+ }
70
+
71
+ /** Ask the fix of several tickets. o: { ini, epic, tickets: [{ key, from, who }], me }. → { ok, direct: [ask], draft: [ask] } */
72
+ function askEpics(root, o, by, now = Date.now()) {
73
+ const epic = String((o && o.epic) || '').toUpperCase();
74
+ if (!KEY_RE.test(epic)) return { ok: false, status: 400, error: 'epic is a Jira key, for example IDPF-2600' };
75
+ const T = Array.isArray(o.tickets) ? o.tickets : [];
76
+ if (!T.length || T.length > 100) return { ok: false, status: 400, error: 'tickets is a list of 1 to 100 Jira tickets' };
77
+ const at = new Date(now).toISOString(), out = [], seen = new Set();
78
+ for (const t of T) {
79
+ const key = String((t && t.key) || '').toUpperCase();
80
+ if (!KEY_RE.test(key)) return { ok: false, status: 400, error: `${oneLine(t && t.key, 40) || 'a ticket'} is not a Jira key` };
81
+ if (key === epic || seen.has(key)) continue;
82
+ seen.add(key);
83
+ out.push({ v: 1, kind: 'ask', id: 'ep-' + crypto.randomBytes(5).toString('hex'), key, ini: oneLine(o.ini, 120), epic, from: oneLine(t.from, 40).toUpperCase(), who: oneLine(t.who, 80), direct: isPmName(t.who, o.me), at, by: by || 'pm' });
84
+ }
85
+ if (!out.length) return { ok: false, status: 400, error: 'no ticket to put under the epic' };
86
+ appendEpicLines(root, out);
87
+ const F = foldEpicAsks(epicLines(root));
88
+ const A = out.map((l) => F.get(l.key));
89
+ return { ok: true, direct: A.filter((a) => a.direct), draft: A.filter((a) => !a.direct), ids: out.map((l) => l.id) };
90
+ }
91
+ /** The agent's answer for one direct ask: r { set: true } or { why }. */
92
+ function answerEpicAsk(root, id, r, by, now = Date.now()) {
93
+ if (!ID_RE.test(String(id || ''))) return { ok: false, status: 400, error: 'name an epic ask id, for example ep-0a1b2c3d4e' };
94
+ const a = [...readEpicAsks(root).values()].find((x) => x.id === id);
95
+ if (!a) return { ok: false, status: 404, error: `${id} is not the latest epic ask of any ticket` };
96
+ if (a.state !== 'asked') return { ok: false, status: 409, error: `${a.key} already has an answer (${a.state})` };
97
+ const refused = r && r.why != null;
98
+ appendEpicLines(root, [refused ? { v: 1, kind: 'refused', id, why: oneLine(r.why, 200), at: new Date(now).toISOString(), by: by || 'agent' } : { v: 1, kind: 'set', id, at: new Date(now).toISOString(), by: by || 'agent' }]);
99
+ return { ok: true, ask: readEpicAsks(root).get(a.key) };
100
+ }
101
+ /** The PM's Undo: the asks not answered yet are withdrawn. → { ok, withdrawn: [key], kept: [key] (already set in Jira) } */
102
+ function withdrawEpicAsks(root, ids, by, now = Date.now()) {
103
+ const F = readEpicAsks(root), want = new Set((ids || []).filter((x) => ID_RE.test(String(x))));
104
+ const A = [...F.values()].filter((a) => want.has(a.id));
105
+ const go = A.filter((a) => a.state === 'asked');
106
+ if (go.length) appendEpicLines(root, go.map((a) => ({ v: 1, kind: 'withdrawn', id: a.id, at: new Date(now).toISOString(), by: by || 'pm' })));
107
+ return { ok: true, withdrawn: go.map((a) => a.key), kept: A.filter((a) => a.state === 'set').map((a) => a.key) };
108
+ }
109
+ /** The asks not answered yet, oldest first. o.direct: true only the direct ones, false only the draft ones. */
110
+ const pendingEpicAsks = (F, o = {}) => [...F.values()].filter((a) => a.state === 'asked' && (o.direct == null || a.direct === o.direct)).sort((a, b) => String(a.askedAt).localeCompare(String(b.askedAt)));
111
+ /** The day's draft, by owner: plain text the PM can read and send. Nothing is sent by PMOS. */
112
+ function epicDraftText(F) {
113
+ const P = pendingEpicAsks(F, { direct: false }), by = new Map();
114
+ for (const a of P) { const k = a.who || 'No assignee'; if (!by.has(k)) by.set(k, []); by.get(k).push(a); }
115
+ const out = [];
116
+ for (const [who, A] of by) {
117
+ out.push(`To ${who}:`);
118
+ out.push(`Please put ${A.length === 1 ? 'this ticket' : 'these tickets'} under the epic ${A[0].epic === A[A.length - 1].epic ? A[0].epic : 'named'}, so the epic's progress in Jira counts ${A.length === 1 ? 'it' : 'them'}:`);
119
+ for (const a of A) out.push(`- ${a.key}: ${a.from ? 'now under ' + a.from : 'no epic now'} → ${a.epic}`);
120
+ out.push('');
121
+ }
122
+ return out.join('\n').trim();
123
+ }
124
+
125
+ module.exports = { FILE, KEY_RE, ID_RE, epicsFile, readEpicAsks, foldEpicAsks, isPmName, askEpics, answerEpicAsk, withdrawEpicAsks, pendingEpicAsks, epicDraftText };
@@ -24,7 +24,7 @@
24
24
  * readSprintNotes(root) → { writtenAt, notes: [note] } | null (sprint-goal-summary)
25
25
  *
26
26
  * A READING is { key, summary, status, category: todo|doing|done, sprint: { name, state: active|future|closed, id?, start?, end?,
27
- * completed?, goal? } | null, subtasks: { done, total }, fixVersion: [names], points: number | null, resolved: YYYY-MM-DD | null,
27
+ * completed?, goal? } | null, subtasks: { done, total }, subs?: [{ key, summary, status, category }] (the sub-task list, when the search returned it), fixVersion: [names], points: number | null, resolved: YYYY-MM-DD | null,
28
28
  * flagged, reason, url }. The sprint's dates, `points` and `resolved` feed the sprint burndown (lib/stage-tools.js); a
29
29
  * reading saved before they were carried has none of them, and the burndown says it cannot be drawn. A ticket the search did not return keeps its last reading, marked
30
30
  * stale. Titles and statuses only: never a description or a comment. The one person a reading carries is the assignee's display name, with
@@ -198,6 +198,21 @@ function subtasksOf(v) {
198
198
  }
199
199
  return { done: 0, total: 0 };
200
200
  }
201
+ /** The sub-task list itself (initiative work-subtasks: Jira sub-tasks show under their ticket): { subs: [{ key, summary, status, category }] }
202
+ * when the search returned the sub-tasks with keys, {} otherwise (a count alone keeps only `subtasks`). At most 30. */
203
+ function subsOf(v) {
204
+ if (!Array.isArray(v)) return {};
205
+ const out = [];
206
+ for (const s of v) {
207
+ const key = oneLine(s && s.key).toUpperCase();
208
+ if (!KEY_RE.test(key)) continue;
209
+ const f = (s.fields && typeof s.fields === 'object') ? s.fields : s, st = f.status;
210
+ const status = nameOf(st) || 'Unknown';
211
+ out.push({ key, summary: clip(oneLine(f.summary || f.title || key), 160), status, category: categoryOf(status, st && typeof st === 'object' ? st.statusCategory : f.category) });
212
+ if (out.length >= 30) break;
213
+ }
214
+ return out.length ? { subs: out } : {};
215
+ }
201
216
  /** https://site.atlassian.net/rest/api/3/issue/10001 → https://site.atlassian.net/browse/KEY */
202
217
  function urlOf(x, key) {
203
218
  const raw = isStr(x.url) ? x.url : isStr(x.self) ? x.self : '';
@@ -237,7 +252,7 @@ function normalizeIssue(x) {
237
252
  const st = f.status || {};
238
253
  const status = nameOf(st) || 'Unknown';
239
254
  const flagged = flaggedIn(f) || /block|impediment|on hold/i.test(status);
240
- return { key, summary, status, category: categoryOf(status, st.statusCategory), sprint: sprintIn(f), ...sprintsAll(sprintField(f)), subtasks: subtasksOf(f.subtasks), fixVersion: fixVersionsOf(f.fixVersions),
255
+ return { key, summary, status, category: categoryOf(status, st.statusCategory), sprint: sprintIn(f), ...sprintsAll(sprintField(f)), subtasks: subtasksOf(f.subtasks), ...subsOf(f.subtasks), fixVersion: fixVersionsOf(f.fixVersions),
241
256
  points: pointsIn(f), resolved: dayOf(f.resolutiondate || f.resolved),
242
257
  flagged, reason: flagged ? (flaggedIn(f) ? 'Flagged in Jira' : `Status: ${status}`) : null, url: urlOf(x, key),
243
258
  ...typeParent(f.issuetype, f.parent), ...whoWhen(f.assignee, f.updated) };
@@ -247,7 +262,7 @@ function normalizeIssue(x) {
247
262
  if (!summary) return null;
248
263
  const status = oneLine(x.status) || 'Unknown';
249
264
  const flagged = x.flagged === true || /block|impediment|on hold/i.test(status);
250
- return { key, summary, status, category: categoryOf(status, x.category), sprint: sprintOf(x.sprint), ...sprintsAll(x.sprints != null ? x.sprints : x.sprint), subtasks: subtasksOf(x.subtasks), fixVersion: fixVersionsOf(x.fixVersions != null ? x.fixVersions : x.fixVersion),
265
+ return { key, summary, status, category: categoryOf(status, x.category), sprint: sprintOf(x.sprint), ...sprintsAll(x.sprints != null ? x.sprints : x.sprint), subtasks: subtasksOf(x.subtasks), ...subsOf(x.subtasks), fixVersion: fixVersionsOf(x.fixVersions != null ? x.fixVersions : x.fixVersion),
251
266
  points: pointsIn(x), resolved: dayOf(x.resolved || x.resolutiondate),
252
267
  flagged, reason: flagged ? clip(oneLine(x.reason || x.flag_reason || (x.flagged === true ? 'Flagged in Jira' : `Status: ${status}`)), 160) : null,
253
268
  url: urlOf(x, key), ...typeParent(x.type != null ? x.type : x.issuetype, x.parent), ...whoWhen(x.assignee, x.updated) };
@@ -135,6 +135,7 @@ const MODULES = Object.freeze([
135
135
  'routes-drift', // weekly-drift-check: What would I have missed, Home's weekly ✦ and its ⋯ drop and Undo (runtime drift/drift.jsonl; page-press POST)
136
136
  'routes-moments', // onboarding B3 gradual exposure: the day's ✦ in Home's chat, the menu dots, a quiet place's one line (onboarding-progress record; page-press POST)
137
137
  'routes-spec-critic', // spec-critic: the sceptical reviewer's hardest questions on a document before it is shared (runtime spec-critic.jsonl)
138
+ 'routes-jira-epics', // work-subtasks: the epic check's fix, direct on tickets assigned to the PM, the day's draft for the rest (tracker/jira/epics.jsonl; page-press POST)
138
139
  ]);
139
140
  const PM_DIR = path.join(__dirname, '..', 'public', 'pm');
140
141
  const MODULE_NAME = /^[a-z0-9][a-z0-9-]*\.js$/;