create-pmos 0.688.0 → 0.690.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 (52) hide show
  1. package/package.json +26 -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 +25 -0
  9. package/workspace/guide/breakdown.md +24 -1
  10. package/workspace/guide/cli.md +2 -0
  11. package/workspace/guide/initiatives-and-next-steps.md +13 -1
  12. package/workspace/guide/intelligence-okr-goals.md +1 -1
  13. package/workspace/guide/settings-and-switches.md +1 -1
  14. package/workspace/lib/board-premium.js +13 -3
  15. package/workspace/lib/engine/boards.js +18 -3
  16. package/workspace/lib/initiative-premium.js +7 -4
  17. package/workspace/lib/jira-cli.js +21 -2
  18. package/workspace/lib/jira-epics.js +125 -0
  19. package/workspace/lib/jira-status.js +18 -3
  20. package/workspace/lib/kind-scope.js +73 -0
  21. package/workspace/lib/route-modules.js +1 -0
  22. package/workspace/lib/routes-boards.js +109 -6
  23. package/workspace/lib/routes-intake.js +7 -3
  24. package/workspace/lib/routes-jira-epics.js +65 -0
  25. package/workspace/lib/settings-store.js +3 -0
  26. package/workspace/lib/task-cli.js +25 -7
  27. package/workspace/lib/task-store.js +2 -2
  28. package/workspace/package-lock.json +2 -2
  29. package/workspace/package.json +1 -1
  30. package/workspace/public/pm/bd-asks.js +4 -3
  31. package/workspace/public/pm/bd-backlog.js +25 -4
  32. package/workspace/public/pm/bd-ini-panel.js +1 -1
  33. package/workspace/public/pm/bd-pop-ds.css +22 -0
  34. package/workspace/public/pm/bd-pop-ds.js +48 -11
  35. package/workspace/public/pm/bd-sprint-ds.js +5 -4
  36. package/workspace/public/pm/bd-sprint.js +10 -3
  37. package/workspace/public/pm/bd-work-ds.css +4 -0
  38. package/workspace/public/pm/cozy-pop-work.css +12 -0
  39. package/workspace/public/pm/cozy-pop-work.js +172 -9
  40. package/workspace/public/pm/cozy-settings.js +9 -0
  41. package/workspace/public/pm/home-app.js +1 -1
  42. package/workspace/public/pm/home-ini-model.js +1 -1
  43. package/workspace/public/pm/home-ini.js +6 -3
  44. package/workspace/public/pm/ini-view-model.js +12 -1
  45. package/workspace/public/pm/pop-work-model.js +40 -7
  46. package/workspace/public/pm/premium-initiative-head.js +17 -6
  47. package/workspace/public/pm/premium-insights.js +1 -1
  48. package/workspace/public/pm/work-select.js +73 -0
  49. package/workspace/public/pm/work-tree.js +111 -0
  50. package/workspace/skills/jira-epic.skill +35 -0
  51. package/workspace/test-lists/kind-scopes-lifecycle-stages.json +9 -0
  52. 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.690.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,31 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.690.0",
38
+ "at": "2026-11-22T09:18:54.354Z",
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
+ "n": 1501,
55
+ "t": "Kind marks each lifecycle stage owned, watched or hidden",
56
+ "s": "Kind marks each lifecycle stage owned, watched or hidden",
57
+ "k": "new"
58
+ }
59
+ ]
60
+ },
36
61
  {
37
62
  "v": "0.688.0",
38
63
  "at": "2026-11-22T09:05:24.774Z",
@@ -387,19 +412,6 @@
387
412
  "k": "new"
388
413
  }
389
414
  ]
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
415
  }
404
416
  ]
405
417
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@18bd45e3
1
+ kernel-source: pmos@b5c57f64
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:18:51Z"}
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:18:51Z"}
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:18:51Z"}
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,29 @@
1
1
  [
2
+ {
3
+ "v": "0.690.0",
4
+ "at": "2026-11-22T09:18:54.354Z",
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
+ "n": 1501,
21
+ "t": "Kind marks each lifecycle stage owned, watched or hidden",
22
+ "s": "Kind marks each lifecycle stage owned, watched or hidden",
23
+ "k": "new"
24
+ }
25
+ ]
26
+ },
2
27
  {
3
28
  "v": "0.688.0",
4
29
  "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
 
@@ -148,7 +148,7 @@ The writer makes the record in `planning/initiatives/<id>.md` with its type, tit
148
148
  - **Full SDLC.** From idea to shipped. Where a factory runs in the repository, PMOS also builds it, as pull requests. The product's guardrail check merges the safe ones and leaves the rest for you. Elsewhere PMOS writes the done test and the pull request plan, and the team's agents build it. A factory runs where the repository has `planning/work-items.jsonl` and `scripts/verify-work.js`. A repository made with `create-pmos` has no factory yet.
149
149
  - **Project.** Project management. Others do the work. PMOS chases, syncs the dates and reports.
150
150
 
151
- PMOS picks a kind from the name as you type, and a blue line says so. Tap another kind to change it. After you tap a kind, PMOS does not change it. When the name gives no hint, the kind is Product.
151
+ PMOS picks a kind from the name as you type, and a blue line says so. Tap another kind to change it. After you tap a kind, PMOS does not change it. When the name gives no hint, the kind is the one set in **Settings › General › New work starts as** (Product if you did not set it).
152
152
 
153
153
  The kind is saved as `kind:` in the record (`product`, `sdlc` or `project`). An older record with no `kind:` line reads as Product. Use `pmos initiative new --kind <kind>` to set it from a terminal. The kind is not a lane, but it sets the workflow and the gate that the initiative starts on:
154
154
 
@@ -162,6 +162,18 @@ Project and Full SDLC are built in, beside Product feature, under **Settings ›
162
162
 
163
163
  When you change the kind, an initiative that runs its old kind's workflow moves to the new kind's. Its stage maps by meaning: Plan to Plan, Build to Execute, Deliver or Release to Close. A gate that it passed stays passed. One line in the initiative says what changed, for example "Kind changed to Project from Product: the Plan gate now needs milestone dates, owners and a go-live that matches the KR." An initiative on a workflow that you picked yourself stays on it.
164
164
 
165
+ **What each kind shows.** The kind decides how far your work reaches along the eight stages. For each stage, PMOS drives it with you (owned), reads it from where others do it (watched), or leaves it out of view (hidden):
166
+
167
+ | Stage | Project | Product | Full SDLC |
168
+ |---|---|---|---|
169
+ | Triage, Discover | Hidden | Owned | Owned |
170
+ | Plan, Prioritize | Owned | Owned | Owned |
171
+ | Build | Watched, from Jira | Watched, from Jira | Owned: PMOS builds it where a factory runs |
172
+ | Deliver, Monitor, Evaluate | Owned | Owned | Owned |
173
+ | Gate | Plan before start | PRD and done test before build | Done test and kill before build |
174
+
175
+ A Project initiative also hides the product documents: the problem statement, research notes, PRD, eval rubric and design. It shows no PRD gate; its gate is the Plan gate in **Project control**. Hidden is never removed. The stage ladder leaves Triage and Discover out (6 stages), but the stage the initiative is in always shows, and **Move to a stage** still lists every stage. In **Documents**, the hidden documents are in a closed **Product documents** section at the end. Open it to read or draft them.
176
+
165
177
  **Project control.** A Project initiative shows **Project control** at the top of the initiative:
166
178
 
167
179
  - **On track for <date>?** The answer comes from the task dates and the task links. The date is the KR's date, else the end, else the date in the title. On a No, it names the forecast, the slip and the task that causes it.
@@ -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
 
@@ -11,7 +11,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
11
11
 
12
12
  | Section | What it holds |
13
13
  |---|---|
14
- | General | The theme (Light, Dark or Auto), the products Home, the Board and Intelligence read, when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
14
+ | General | The theme (Light, Dark or Auto), the products Home, the Board and Intelligence read, **New work starts as** (Product, Project or Full SDLC: the kind a new initiative starts as when its name gives no hint; see [what each kind shows](initiatives-and-next-steps.md)), when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
15
15
  | How PMOS decides | One suggestion from PMOS when it sees a pattern in what you kept, each kind of change PMOS makes by itself, the calls that are **Always yours**, and PMOS's **Lessons**. |
16
16
  | Checks | When PMOS grills an initiative by itself and the monthly credit for its checks. |
17
17
  | Prototype rules | What every prototype version is checked for before you see it. |
@@ -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
  };
@@ -26,6 +26,7 @@ const shortDate = (v) => { const d = isoDay(v); return d ? d.getDate() + ' ' + M
26
26
  const plural = (n, one, many) => (n === 1 ? one : many);
27
27
  const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
28
28
  const cap1 = (s) => (s ? String(s).charAt(0).toUpperCase() + String(s).slice(1) : '');
29
+ const KS = require('./kind-scope.js'); // the kind marks each stage owned, watched or hidden, and a project hides the product documents
29
30
  const SP = require('./status-proof.js'); // T3: a status renders only with its source and read time
30
31
  const STATUS_LABEL = { 'no signal': 'No signal', 'on track': 'On track', 'at risk': 'At risk', late: 'Late', 'on hold': 'On hold', done: 'Done', cancelled: 'Cancelled' };
31
32
  const DOC_STATE = { missing: 'Not started', draft: 'Draft', ok: 'Up to date', stale: 'Stale', due: 'Due' };
@@ -126,19 +127,21 @@ function build(f) {
126
127
  const dd = f.docs || null;
127
128
  // D99: an initiative on a library workflow groups its documents under its own stages (dd.phases), not Discover/Plan/Build/Evaluate
128
129
  const phases = dd && Array.isArray(dd.phases) && dd.phases.length ? dd.phases.slice() : null;
130
+ const kindOf = ['product', 'sdlc', 'project'].includes(row.kind) ? row.kind : 'product';
129
131
  const all = dd ? (dd.docs || []).map((d) => ({
130
132
  key: d.key, title: d.title, what: d.for || '', st: d.st, state: d.kind === 'live' ? 'Live' : DOC_STATE[d.st] || d.st || '', by: BY[d.by] || d.by || '', byKey: d.by || '',
131
133
  when: d.when ? shortDate(d.when) : '', at: d.when || '', cat: phases ? (d.other ? null : d.cat || null) : d.cat === 'Do' ? 'Build' : d.cat === 'Learn' ? 'Evaluate' : d.cat || 'Board', ...(d.other ? { other: true } : {}), path: d.open && d.open.path ? d.open.path : null, slot: d.st === 'draft' && d.draft && d.draft.slot ? d.draft.slot : '', running: !!d.running, tech: TECH.has(d.key), kind: d.kind || '', reader: d.reader || '', cadence: d.cadence || '', sections: ((GUIDE[d.key] || {}).sections || []).slice(),
132
134
  act: d.act && d.act.do === 'draft' ? { kind: 'draft', label: d.running ? 'Drafting' : d.act.label || 'Draft it' } : null,
133
135
  from: d.from && d.from.text ? { path: d.from.path, heading: d.from.heading, text: d.from.text, cut: !!d.from.cut } : null,
136
+ ...(KS.docHidden(kindOf, d.key) ? { hidden: true } : {}), // folded, never dropped (pm/home-ini.js docsView)
134
137
  })) : [];
135
138
  const custom = (f.custom || []).map((d) => Object.assign(Custom.rowOf(d), { added: shortDate(d.at), at: d.at || '', cat: d.phase || 'Board' }));
136
139
  const rows = all.concat(custom);
137
- const core = rows.filter((d) => !d.tech);
140
+ const core = rows.filter((d) => !d.tech && !d.hidden); // a hidden document is not counted or offered, only folded
138
141
  const cnt = { all: core.length, none: core.filter((d) => d.st === 'missing').length, draft: core.filter((d) => d.st === 'draft').length, ok: core.filter((d) => d.st === 'ok' || d.st === 'live').length };
139
142
  const nLinked = core.filter((d) => d.st === 'linked').length;
140
143
  if (nLinked) cnt.linked = nLinked; // a key only when an added document is linked
141
- const docs = dd || custom.length ? { rows, counts: cnt, techCount: rows.length - core.length,
144
+ const docs = dd || custom.length ? { rows, counts: cnt, techCount: rows.filter((d) => d.tech).length, ...(rows.some((d) => d.hidden) ? { hiddenCount: rows.filter((d) => d.hidden).length } : {}),
142
145
  cap: core.length ? [cnt.draft ? cnt.draft + ' ' + plural(cnt.draft, 'draft', 'drafts') + ' to review' : '', cnt.none ? cnt.none + ' not started' : '', cnt.ok ? cnt.ok + ' up to date' : '', nLinked ? nLinked + ' linked' : ''].filter(Boolean).join(' · ') : '',
143
146
  scope: (dd && dd.scope) || 'initiative:' + id, missing: !dd, ...(phases ? { phases, cur: dd.cat || phases[0] } : {}) } : { rows: [], counts: { all: 0, none: 0, draft: 0, ok: 0 }, techCount: 0, cap: '', missing: true };
144
147
  if (!dd && !missing.includes('core documents')) missing.push('core documents');
@@ -147,7 +150,7 @@ function build(f) {
147
150
  const phase = Math.max(0, PHASE_OF_CAT[row.cat] != null ? PHASE_OF_CAT[row.cat] : Math.max(0, cur >= 0 && names.length ? Math.floor(cur / Math.max(1, names.length) * 4) : 0));
148
151
  const help = [];
149
152
  const docAt = (d) => (docs.phases ? docs.phases.indexOf(d.cat) <= docs.phases.indexOf(docs.cur) && docs.phases.includes(d.cat) : DOC_CAT_ORDER.indexOf(d.cat) <= phase);
150
- const nd = docs.rows.find((d) => d.st === 'missing' && !d.tech && d.act && d.act.kind === 'draft' && docAt(d));
153
+ const nd = docs.rows.find((d) => d.st === 'missing' && !d.tech && !d.hidden && d.act && d.act.kind === 'draft' && docAt(d));
151
154
  if (nd) help.push({ label: 'Draft the ' + nd.title.toLowerCase(), kind: 'draft', key: nd.key });
152
155
  const wantsOptions = bad || (lad && lad.next && /^(review|accept)$/.test(lad.next.step));
153
156
  if (wantsOptions) help.push({ label: lad ? 'Summarise the review findings' : 'Lay out the options', kind: 'ask', q: lad ? 'Summarise the review findings for this initiative, from the evidence you can read in this repository. Say what you could not find.' : 'Lay out the options for this initiative, from what you can read in this repository, and say what you could not find. Do not recommend one unless the records do.' });
@@ -166,7 +169,7 @@ function build(f) {
166
169
  pending: !!f.pending,
167
170
  header: { text: 'Real data · as of ' + hhmm(now) + (missing.length ? ' · not read: ' + missing.join(', ') : ''), missing },
168
171
  board: { name: board.name || '', id: board.id || null, ws: board.ws || null },
169
- id, key, title: clip(row.title || id, 160), lane: row.lane || '', kind: ['product', 'sdlc', 'project'].includes(row.kind) ? row.kind : 'product', anchor: row.anchor || '',
172
+ id, key, title: clip(row.title || id, 160), lane: row.lane || '', kind: kindOf, scope: KS.scopeOf(kindOf), anchor: row.anchor || '',
170
173
  // the bar's presses (initiative premium-board-actions): the workflow, the lifecycle and the archive entry the row holds
171
174
  acts: {
172
175
  self: !!board.self, stages: moveNames, stage: (own ? names[cur] : row.stage) || null,
@@ -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>"');