create-pmos 0.727.0 → 0.729.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 (36) hide show
  1. package/package.json +39 -39
  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/changelog.json +38 -0
  7. package/workspace/guide/cli.md +14 -0
  8. package/workspace/guide/jira.md +18 -0
  9. package/workspace/guide/layout.md +1 -1
  10. package/workspace/lib/change-cues.js +34 -0
  11. package/workspace/lib/jira-cli.js +101 -3
  12. package/workspace/lib/jira-criteria.js +214 -0
  13. package/workspace/lib/jira-status.js +10 -5
  14. package/workspace/lib/jira-tiers.js +266 -0
  15. package/workspace/lib/open-questions.js +163 -0
  16. package/workspace/lib/pmos-verbs.js +3 -0
  17. package/workspace/lib/questions-cli.js +97 -0
  18. package/workspace/lib/refresh-probe.js +5 -0
  19. package/workspace/lib/refresh-run.js +2 -0
  20. package/workspace/lib/route-modules.js +1 -0
  21. package/workspace/lib/routes-jira-epics.js +62 -4
  22. package/workspace/lib/routes-open-questions.js +29 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -1
  25. package/workspace/public/pm/change-cues.css +15 -0
  26. package/workspace/public/pm/change-cues.js +52 -0
  27. package/workspace/public/pm/cozy-pop-work.js +46 -3
  28. package/workspace/public/pm/cozy-today-app.js +11 -8
  29. package/workspace/public/pm/home-app.js +4 -2
  30. package/workspace/public/today.html +1 -0
  31. package/workspace/skills/jira-criteria.skill +35 -0
  32. package/workspace/skills/jira-sync.skill +7 -2
  33. package/workspace/test-lists/change-cues.json +9 -0
  34. package/workspace/test-lists/jira-criteria-write.json +9 -0
  35. package/workspace/test-lists/jira-tiered-refresh.json +9 -0
  36. package/workspace/test-lists/open-questions.json +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.727.0",
3
+ "version": "0.729.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,44 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.729.0",
38
+ "at": "2026-11-23T05:35:01.695Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1625,
43
+ "t": "A short cue when an item is done, moved or dropped (A313)",
44
+ "s": "A short cue when an item is done, moved or dropped (A313)",
45
+ "k": "new"
46
+ },
47
+ {
48
+ "n": 1623,
49
+ "t": "Write the done test's acceptance criteria onto Jira tickets (A384)",
50
+ "s": "Write the done test's acceptance criteria onto Jira tickets (A384)",
51
+ "k": "new"
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ "v": "0.728.0",
57
+ "at": "2026-11-23T05:05:21.945Z",
58
+ "f": 4,
59
+ "prs": [
60
+ {
61
+ "n": 1620,
62
+ "t": "Pmos questions, every open question in one list with owner, age and default (A420)",
63
+ "s": "Pmos questions, every open question in one list with owner, age and default (A420)",
64
+ "k": "new"
65
+ },
66
+ {
67
+ "n": 1603,
68
+ "t": "Refresh Jira by tier, reading only what changed",
69
+ "s": "Refresh Jira by tier, reading only what changed",
70
+ "k": "new"
71
+ }
72
+ ]
73
+ },
36
74
  {
37
75
  "v": "0.727.0",
38
76
  "at": "2026-11-23T04:50:40.142Z",
@@ -410,44 +448,6 @@
410
448
  "k": "new"
411
449
  }
412
450
  ]
413
- },
414
- {
415
- "v": "0.703.0",
416
- "at": "2026-11-22T10:51:01.624Z",
417
- "f": 4,
418
- "prs": [
419
- {
420
- "n": 1528,
421
- "t": "Lists stay short, 50 rows a step from one shared block (A455)",
422
- "s": "Lists stay short, 50 rows a step from one shared block (A455)",
423
- "k": "new"
424
- },
425
- {
426
- "n": 1530,
427
- "t": "Esc and Stage in Backlog and This sprint; tests for the Gantt parent bar and the bulk stage move",
428
- "s": "Esc and Stage in Backlog and This sprint; tests for the Gantt parent bar and the bulk stage move",
429
- "k": "fix"
430
- }
431
- ]
432
- },
433
- {
434
- "v": "0.701.0",
435
- "at": "2026-11-22T10:38:05.886Z",
436
- "f": 4,
437
- "prs": [
438
- {
439
- "n": 1529,
440
- "t": "PMOS proposes each unlinked initiative's Jira work under its ✦ (A465)",
441
- "s": "PMOS proposes each unlinked initiative's Jira work under its ✦ (A465)",
442
- "k": "new"
443
- },
444
- {
445
- "n": 1531,
446
- "t": "Pmos ready shows what an initiative lacks before it goes to engineering (bet A392)",
447
- "s": "Pmos ready shows what an initiative lacks before it goes to engineering (bet A392)",
448
- "k": "new"
449
- }
450
- ]
451
451
  }
452
452
  ]
453
453
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@9b002a5c
1
+ kernel-source: pmos@b5147c2e
2
2
  assembled: 2026-11-23
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-23T04:50:37Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-23T05:34:58Z"}
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-23T04:50:37Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-23T05:34:58Z"}
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-23T04:50:37Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-23T05:34:58Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,42 @@
1
1
  [
2
+ {
3
+ "v": "0.729.0",
4
+ "at": "2026-11-23T05:35:01.695Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1625,
9
+ "t": "A short cue when an item is done, moved or dropped (A313)",
10
+ "s": "A short cue when an item is done, moved or dropped (A313)",
11
+ "k": "new"
12
+ },
13
+ {
14
+ "n": 1623,
15
+ "t": "Write the done test's acceptance criteria onto Jira tickets (A384)",
16
+ "s": "Write the done test's acceptance criteria onto Jira tickets (A384)",
17
+ "k": "new"
18
+ }
19
+ ]
20
+ },
21
+ {
22
+ "v": "0.728.0",
23
+ "at": "2026-11-23T05:05:21.945Z",
24
+ "f": 4,
25
+ "prs": [
26
+ {
27
+ "n": 1620,
28
+ "t": "Pmos questions, every open question in one list with owner, age and default (A420)",
29
+ "s": "Pmos questions, every open question in one list with owner, age and default (A420)",
30
+ "k": "new"
31
+ },
32
+ {
33
+ "n": 1603,
34
+ "t": "Refresh Jira by tier, reading only what changed",
35
+ "s": "Refresh Jira by tier, reading only what changed",
36
+ "k": "new"
37
+ }
38
+ ]
39
+ },
2
40
  {
3
41
  "v": "0.727.0",
4
42
  "at": "2026-11-23T04:50:40.142Z",
@@ -278,6 +278,15 @@ The idle lab run uses only the first three commands:
278
278
  - `pmos lab critic checks [--root <dir>]`: the checks the critic uses for the product in that folder. No server is needed.
279
279
  - `pmos lab critic label <run> <n> real|noise`: your word on finding `n` of a critic run. `pmos lab critic stats` counts the runs, the findings, and how many you called real or noise.
280
280
 
281
+ ### pmos questions: every open question in one list
282
+
283
+ Run it in the product's repository, or pass `--root <dir>`. It changes nothing, takes no default and sends nothing.
284
+
285
+ - `pmos questions` lists every unanswered question across all initiatives, oldest first: one line per person and initiative. Each line says who can answer, how many days it has waited, and what PMOS does if nobody answers and by when. A question that has no safe default says why it waits for an answer.
286
+ - The list holds the plan changes PMOS holds for want of a source, a drafted ticket's open questions, the outside sign-offs and the open drafts from PMOS's Driver. A draft changes nothing until you keep it, so its default is to drop it, 14 days after it was filed.
287
+ - With the workspace running, the list is the same one the workspace reads. Without it, `pmos questions` reads the records on disk and says that held plan changes were not read.
288
+ - `pmos questions age` prints the median age in days of the lines. Its last line is the number, so a script can read it.
289
+
281
290
  ### pmos why: why the work exists, in three lines
282
291
 
283
292
  Anyone can run it, not only the PM: an engineer or a stakeholder who wants to know why an initiative or a task exists. Run it in the product's repository, or pass `--root <dir>`. It reads the records on disk, needs no running workspace and changes nothing.
@@ -712,6 +721,11 @@ The benchmark needs a signed-in agent CLI. It never pushes and never opens a pul
712
721
  - `pmos jira answer <initiative> <ticket> <n> --text "<answer>"` or `--keep-default`
713
722
  - `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.
714
723
  - `pmos jira epic-done <ask id>` or `--refused "<why>"` records the answer for a ticket that is assigned to you.
724
+ - `pmos jira pin <initiative> [--off]` keeps an initiative live: its tickets get the sprint read and full detail on every refresh.
725
+ - `pmos jira criteria-propose <initiative>` lists, for each open Jira ticket of the initiative, the done-test checks PMOS proposes as acceptance criteria ([Jira tickets](jira.md)).
726
+ - `pmos jira criteria-ask <initiative> [KEY …]` says yes to them. Tickets assigned to you get the criteria in Jira; the others go to the draft for their owners.
727
+ - `pmos jira criteria-asks [--direct|--draft|--health]` lists the criteria asks that wait for Jira, prints the draft by owner, or prints the health number.
728
+ - `pmos jira criteria-done <ask id>` or `--refused "<why>"` records the answer for one criteria ask.
715
729
  - `pmos jira criteria <initiative>`: the done-test checks each ticket carries as acceptance criteria, and the checks on no ticket
716
730
  - `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.
717
731
 
@@ -114,6 +114,24 @@ Your own criteria stay above the block. A ticket you edited, selected or pushed
114
114
  pmos jira criteria <initiative>
115
115
  ```
116
116
 
117
+ ### On the tickets you already have in Jira
118
+
119
+ Most tickets an initiative tracks were made in Jira, not drafted by PMOS. When the initiative has a done test, the Work breakdown shows a ✦: "Add the done test's checks to 3 Jira tickets". Open it to see each ticket and the checks that fit it. PMOS uses the same matching as above and leaves out tickets that are done.
120
+
121
+ - Press ✓ to say yes. A ticket assigned to you gets the block at the end of its description. A session with your own Atlassian connection writes it, and it changes nothing else on the ticket.
122
+ - A ticket of another owner is not changed. It goes to the day's draft for that owner, with the block to paste. PMOS does not send the draft.
123
+ - Press Undo to withdraw what Jira has not done yet. Press ✕ to hide the ✦.
124
+ - When the done test changes, PMOS proposes the new block again. A second write replaces the old block and keeps the rest of the description.
125
+
126
+ In the terminal:
127
+
128
+ ```
129
+ pmos jira criteria-propose <initiative> what PMOS proposes, ticket by ticket
130
+ pmos jira criteria-ask <initiative> [KEY …] say yes to all, or to the keys you name
131
+ pmos jira criteria-asks [--direct | --draft] what waits for Jira, or the draft by owner
132
+ pmos jira criteria-done <ask id> [--refused "<why>"] the session's answer for one ticket
133
+ ```
134
+
117
135
  ## The dry run: where a builder would guess
118
136
 
119
137
  A ticket points to the PRD, but the builder holds only the ticket. Before you select the tickets, PMOS dry-runs them: the initiative's background run reads each drafted ticket as a builder would, and lists every point where it would have to guess. For each guess it quotes the PRD lines that answer it.
@@ -69,7 +69,7 @@ Each row has two lines:
69
69
  To use the log:
70
70
 
71
71
  1. Type a task, an event or a note in the first line and press Enter. Start with **o** for an event (add a time, such as 14:00, to put it on the agenda), with **-** for a note, and with **!** for what comes first. Enter only adds the row. It opens nothing and starts no session.
72
- 2. Point at a row to see its icons. The first is its job: **Reply**, **Decide** or **Send** opens the item where you do it, and **Done** marks it done. Then come **Move to tomorrow** and **Set a date**. A done row turns grey. Each change shows Undo for a moment.
72
+ 2. Point at a row to see its icons. The first is its job: **Reply**, **Decide** or **Send** opens the item where you do it, and **Done** marks it done. Then come **Move to tomorrow** and **Set a date**. A done row turns grey. Each change shows Undo for a moment. Before the log draws again, the row shows a short cue for about half a second, so you see which row changed: a done row turns green and slides out, a row you move to another day slides out to the side, and a dropped row fades. Home's check does the same. When your system asks for reduced motion, nothing moves: the row only keeps its colour for a moment.
73
73
  3. Press a row, or an event in the agenda, to open that one item in the popup. An ask opens that one mention, not the list of mentions. A task opens its initiative at that task, with the task's row lit, and the task itself in a small popup on top; Esc closes only the small popup. A check ("did it work?") opens its initiative. With the popup open, press **j** or **k** (or **↓** and **↑** in an ask) to open the next or the previous row in its place.
74
74
 
75
75
  When the same step waits on several initiatives (for example "Draft the PRD" on six of them), it is one row, "6 initiatives have no PRD", with the ✦ line "PMOS drafts them for you to read": ✓ starts one draft per initiative, ✕ hides the line for a month. Press the row to list the initiatives. A title never shows an id, and Work names a product by its name.
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ /* change-cues.js — the health number of the short cue on a row that is done, moved or dropped (idea A313, initiative change-cues; the cue
4
+ * is public/pm/change-cues.js). It only reads the local use log (lib/use-log.js, A466): nothing is written or sent.
5
+ *
6
+ * cuesShown(lines, now, days) → the cues (use-log controls cue-done, cue-moved, cue-gone) in the last `days` days PURE
7
+ * CLI: node lib/change-cues.js uses [days] → that count on its last line (the health number) */
8
+ const U = require('./use-log.js');
9
+
10
+ const CONTROLS = new Set(['cue-done', 'cue-moved', 'cue-gone']);
11
+ const DAY = 864e5;
12
+
13
+ function cuesShown(lines, now = Date.now(), days = 7) {
14
+ const cut = now - days * DAY;
15
+ let n = 0;
16
+ for (const l of lines || []) {
17
+ if (!l || l.kind !== 'use' || !CONTROLS.has(l.control)) continue;
18
+ const t = Date.parse(l.at);
19
+ if (t >= cut && t <= now + DAY) n++;
20
+ }
21
+ return n;
22
+ }
23
+
24
+ module.exports = { CONTROLS, cuesShown };
25
+
26
+ if (require.main === module) {
27
+ const [cmd, d] = process.argv.slice(2);
28
+ const days = d ? Number(d) : 7;
29
+ if (cmd !== 'uses' || !(days > 0)) { console.error('usage: node lib/change-cues.js uses [days] (cues shown on a row done, moved or dropped, default the last 7 days)'); process.exit(2); }
30
+ const dir = require('./state-root.js').defaultRoot({ env: process.env });
31
+ const n = cuesShown(U.readLines(dir), Date.now(), days);
32
+ console.log('[change-cues] cues shown on a row done, moved or dropped, last ' + days + ' days');
33
+ console.log(String(n));
34
+ }
@@ -9,6 +9,10 @@
9
9
  * pmos jira pending <initiative> what the agent creates or updates in Jira (approved only)
10
10
  * pmos jira record <initiative> [ID=KEY …] [--epic KEY [--group <g>]] [--updated ID,ID] the keys the agent created
11
11
  * pmos jira query [<initiative>] the Jira search for the tickets an initiative pushed
12
+ * pmos jira query --changed this refresh's searches: what changed among every tracked ticket, and the
13
+ * initiatives due a full read (lib/jira-tiers.js, jira-tiered-refresh)
14
+ * pmos jira sync --changed --from <file|-|a,b> patch the changed tickets into each initiative; a ticket not returned keeps its reading
15
+ * pmos jira pin <initiative> [--off] keep an initiative live: all its tickets are Tier 0
12
16
  * pmos jira sync <initiative> --from <file|-> [--query "<jql>"] [--dry-run] a saved search → the status snapshot
13
17
  * pmos jira query --sprints the Jira search for every issue in the sprints the tickets are in
14
18
  * pmos jira sync --sprints --from <file|-> [--query "<jql>"] a saved whole-sprint search → the Sprints tab (jira-sprint-scope)
@@ -21,6 +25,12 @@
21
25
  * pmos jira epic-asks [--direct | --draft] the epic fixes the PM approved (lib/jira-epics.js): --direct the ones
22
26
  * assigned to the PM (the jira-epic agent sets them), --draft the day's draft by owner
23
27
  * pmos jira epic-done <ask id> [--refused "<why>"] the jira-epic agent's answer for one ask
28
+ * pmos jira criteria-propose <initiative> the done test's checks PMOS proposes for each open Jira ticket the
29
+ * initiative tracks (lib/jira-criteria.js, jira-criteria-write)
30
+ * pmos jira criteria-ask <initiative> [KEY …] the PM's yes: those tickets (or all proposed) get the block; the ones
31
+ * assigned to the PM go to the jira-criteria agent, the rest to the draft
32
+ * pmos jira criteria-asks [--direct | --draft | --health] the criteria asks waiting; --health prints the percent Jira accepted
33
+ * pmos jira criteria-done <ask id> [--refused "<why>"] the jira-criteria agent's answer for one ask
24
34
  * pmos jira guesses <initiative> [--from <file|->] a ticket dry run (lib/ticket-dry-run.js), recorded or shown
25
35
  * pmos jira answer <initiative> <ticket> <n> --text "<answer>" | --keep-default the PM's answer to one dry-run gap, or its default kept
26
36
  * pmos jira digest [--since <YYYY-MM-DD or time>] the standup facts from the stored reads (lib/tracker-digest.js)
@@ -35,13 +45,16 @@ const path = require('path');
35
45
  const { execFileSync } = require('child_process');
36
46
  const { parseArgs } = require('./schedule-cli');
37
47
  const jiraStatus = require('./jira-status.js');
48
+ const tiers = require('./jira-tiers.js');
38
49
  const jiraTickets = require('./jira-tickets.js');
39
50
  const jiraMoves = require('./jira-moves.js');
40
51
  const jiraEpics = require('./jira-epics.js');
52
+ const jiraCriteria = require('./jira-criteria.js');
53
+ const pmName = (env) => { const e = String(((env || process.env).PMOS_PM_NAME) || '').trim(); if (e) return e; try { return require('./routes-board-publish.js').sharedBy() || ''; } catch { return ''; } };
41
54
  const planItems = require('./plan-items.js');
42
55
  const guard = require('./pm-guard.js');
43
56
 
44
- const COMMANDS = { jira: ['draft', 'show', 'epic', 'approve', 'pending', 'record', 'query', 'sync', 'summary', 'which', 'moves', 'moved', 'epic-asks', 'epic-done', 'guesses', 'answer', 'criteria', 'digest'] };
57
+ const COMMANDS = { jira: ['draft', 'show', 'epic', 'approve', 'pending', 'record', 'query', 'sync', 'pin', 'summary', 'which', 'moves', 'moved', 'epic-asks', 'epic-done', 'guesses', 'answer', 'criteria', 'digest', 'criteria-propose', 'criteria-ask', 'criteria-asks', 'criteria-done'] };
45
58
  const USAGE = [
46
59
  'usage: pmos jira draft|show|epic|approve|pending|record|query|sync|summary|which — Jira tickets from the PRD, and their status',
47
60
  ' pmos jira draft <initiative> [--dry-run] draft one ticket per PRD item, in the ticket template',
@@ -58,7 +71,10 @@ const USAGE = [
58
71
  ' pmos jira record <initiative> [ID=KEY …] [--epic KEY [--group <g>]] [--updated ID,ID] the keys created in Jira',
59
72
  ' pmos jira query [<initiative>] the Jira search for the pushed tickets',
60
73
  ' pmos jira sync <initiative> --from <file|-|a,b> [--query "<jql>"] [--dry-run] save the status read from Jira (a,b: one file per page)',
61
- ' pmos jira query --sprints the Jira search for every issue in those tickets\' sprints',
74
+ ' pmos jira query --changed this refresh\'s searches: what changed among every tracked ticket, and the full reads due',
75
+ ' pmos jira sync --changed --from <file|-|a,b> patch the changed tickets in; a ticket not returned keeps its reading',
76
+ ' pmos jira pin <initiative> [--off] keep an initiative live: its tickets get the sprint read and full detail',
77
+ ' pmos jira query --sprints the Jira search for every issue in those tickets\' sprints, when a live ticket changed',
62
78
  ' pmos jira sync --sprints --from <file|-> [--query "<jql>"] save every issue of the sprints, for the Sprints tab',
63
79
  ' pmos jira query --sprint "<name>" the Jira search for every ticket one sprint held',
64
80
  ' pmos jira sync --sprint "<name>" --from <file|-> keep that read as the sprint\'s snapshot',
@@ -69,11 +85,15 @@ const USAGE = [
69
85
  ' pmos jira moved <move id> --status "<status>" | --refused "<why>" what Jira did with one move',
70
86
  ' 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
87
  ' pmos jira epic-done <ask id> [--refused "<why>"] what Jira did with one epic fix',
88
+ ' pmos jira criteria-propose <initiative> the done test\'s checks PMOS proposes as acceptance criteria for each open Jira ticket',
89
+ ' pmos jira criteria-ask <initiative> [KEY …] say yes: your own tickets get them in Jira, the others go to the draft for their owners',
90
+ ' pmos jira criteria-asks [--direct | --draft | --health] the criteria asks waiting for Jira, the draft by owner, or the health number',
91
+ ' pmos jira criteria-done <ask id> [--refused "<why>"] what Jira did with one criteria ask',
72
92
  ' 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',
73
93
  ' every command: [--json] [--root <dir>]',
74
94
  'This command never calls Jira. Your agent reads and writes Jira with your own connection.',
75
95
  ];
76
- const BOOL = new Set(['json', 'dry-run', 'help', 'sprints', 'keep-default', 'direct', 'draft']);
96
+ const BOOL = new Set(['json', 'dry-run', 'help', 'sprints', 'keep-default', 'direct', 'draft', 'changed', 'off', 'all', 'health']);
77
97
  const VALUE = new Set(['from', 'query', 'root', 'epic', 'updated', 'group', 'status', 'refused', 'sprint', 'text', 'since']);
78
98
  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' };
79
99
 
@@ -135,6 +155,42 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
135
155
  if (flags.sprints && verb !== 'query' && verb !== 'sync') return fail('--sprints goes with query or sync', 2);
136
156
  if (flags.sprint != null && verb !== 'query' && verb !== 'sync') return fail('--sprint goes with query or sync', 2);
137
157
  if (flags.since != null && verb !== 'digest') return fail('--since goes with digest', 2);
158
+ if (flags.changed && verb !== 'query' && verb !== 'sync') return fail('--changed goes with query or sync', 2);
159
+ if (flags.off && verb !== 'pin') return fail('--off goes with pin', 2);
160
+ if (flags.all && !(verb === 'query' && flags.sprints)) return fail('--all goes with query --sprints', 2);
161
+ if (verb === 'query' && flags.changed) {
162
+ const p = tiers.plan(root, { now: now == null ? Date.now() : now, record: !flags['dry-run'] });
163
+ const lines = [];
164
+ if (!p.linked) lines.push('no initiative has a ticket in Jira yet');
165
+ if (p.change.length) {
166
+ lines.push(`changed · ${p.checked} tracked ${p.checked === 1 ? 'ticket' : 'tickets'} in ${p.change.length} ${p.change.length === 1 ? 'initiative' : 'initiatives'} · since ${p.since} (the last ${p.minutes} minutes)`);
167
+ for (const q of p.searches) lines.push(`search\t${q}`);
168
+ }
169
+ for (const f of p.full) lines.push(`full\t${f.initiative}\t${f.query}\t(${f.why})`);
170
+ return out(p, lines);
171
+ }
172
+ if (verb === 'sync' && flags.changed) {
173
+ if (!flags.from) return need('--changed --from <file|-|a,b>');
174
+ let raw;
175
+ try { raw = readSearch(flags.from, cwd, stdin); }
176
+ catch (e) { return fail(`could not read ${flags.from} as JSON — ${String((e && e.message) || e).slice(0, 160)}`); }
177
+ const r = tiers.applyChanged(root, raw, { now: now == null ? Date.now() : now, dryRun: !!flags['dry-run'] });
178
+ if (!r.ok) return fail(r.error);
179
+ const lines = [`changed · ${r.fetched} ${r.fetched === 1 ? 'issue' : 'issues'} returned · ${r.kept} patched in${r.ignored ? ` · ${r.ignored} tracked by no initiative, ignored` : ''}${r.dryRun ? ' · dry run, nothing written' : ''}`];
180
+ for (const x of r.initiatives) {
181
+ if (x.error) { lines.push(` ${x.initiative} · ${x.error}`); continue; }
182
+ for (const c of x.changes) lines.push(` ${x.initiative} ${c.key} · ${c.what}${c.from !== undefined ? `: ${c.from} → ${c.to}` : c.status ? `: ${c.status}` : ''}${c.reason ? ` (${c.reason})` : ''}`);
183
+ }
184
+ if (!r.kept) lines.push('no tracked ticket changed: if no initiative was read in full, run pmos refresh same jira');
185
+ lines.push(r.sprintNeeded ? 'sprint read: needed, a live ticket changed' : 'sprint read: not needed for these changes');
186
+ return out(r, lines);
187
+ }
188
+ if (verb === 'pin') {
189
+ if (!initiative) return need('<initiative> [--off]');
190
+ const r = tiers.pin(root, initiative, !flags.off);
191
+ if (!r.ok) return fail(r.error);
192
+ return out(r, [r.pinned ? `${initiative} · kept live: its tickets get the sprint read and full detail on every refresh` : `${initiative} · no longer kept live: its tickets follow their Jira state`]);
193
+ }
138
194
  if (verb === 'digest') {
139
195
  const d = require('./tracker-digest.js').gather(root, { now: now == null ? Date.now() : now, since: flags.since || null });
140
196
  if (!d.ok) return fail(d.error, 2);
@@ -155,6 +211,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
155
211
  return out(r, [`${r.backfill} · kept ${r.read} ${r.read === 1 ? 'ticket' : 'tickets'}${r.ignored ? ` · ${r.ignored} not in it, ignored` : ''}${r.dryRun ? ' · dry run, nothing written' : ''}`, ...(r.dryRun ? [] : [`history ${r.snapshot}`])]);
156
212
  }
157
213
  if (verb === 'query' && flags.sprints) {
214
+ const due = tiers.sprintDue(root, { now: now == null ? Date.now() : now });
215
+ if (!due.due && !flags.all) return out({ ok: true, linked: false, needed: false, why: due.why, query: null }, [`sprint read not needed: ${due.why}`]);
158
216
  const q = jiraStatus.sprintQuery(root);
159
217
  return out(q, [q.linked ? q.query : q.kept.length ? 'every sprint is closed and summarised once — nothing to read' : 'no Jira reading has a sprint yet — run the initiatives\' searches first']);
160
218
  }
@@ -165,6 +223,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
165
223
  catch (e) { return fail(`could not read ${flags.from} as JSON — ${String((e && e.message) || e).slice(0, 160)}`); }
166
224
  const r = jiraStatus.syncSprints(root, raw, { query: flags.query || undefined, dryRun: !!flags['dry-run'], now });
167
225
  if (!r.ok) return fail(r.error);
226
+ if (!r.dryRun) tiers.sprintRead(root, { now: now == null ? Date.now() : now });
168
227
  const lines = [`sprints · read ${r.read} ${r.read === 1 ? 'issue' : 'issues'}${r.ignored ? ` · ${r.ignored} in no sprint, ignored` : ''}${r.skipped ? ` · ${r.skipped} skipped (no key or summary)` : ''}${r.dryRun ? ' · dry run, nothing written' : ''}`];
169
228
  for (const [name, n] of Object.entries(r.sprints)) lines.push(` ${name} · ${n} ${n === 1 ? 'issue' : 'issues'}`);
170
229
  for (const name of r.closedNow || []) lines.push(` ${name} closed since the last read: write its summary now (pmos jira summary)`);
@@ -219,6 +278,25 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
219
278
  if (!r.ok) return fail(r.error);
220
279
  return out(r, [r.ask.state === 'set' ? `${r.ask.key} · under ${r.ask.epic} in Jira` : `${r.ask.key} · refused: ${r.ask.why}`]);
221
280
  }
281
+ // acceptance criteria written onto the Jira tickets an initiative tracks (jira-criteria-write, A384)
282
+ if (verb === 'criteria-asks') {
283
+ const F = jiraCriteria.readCriteriaAsks(root);
284
+ if (flags.health) { const h = jiraCriteria.healthOf(F, now == null ? Date.now() : now); return out({ ok: true, ...h }, [`${h.written} written, ${h.refused} refused in 14 days`, String(h.pct)]); }
285
+ if (flags.draft) { const t = jiraCriteria.criteriaDraftText(F); return out({ ok: true, draft: t }, [t || 'no ticket waits in the draft']); }
286
+ const P = jiraCriteria.pendingCriteriaAsks(F, flags.direct ? { direct: true } : {});
287
+ if (json) return out({ ok: true, asks: P, written: [...F.values()].filter((a) => a.state === 'written').length }, []);
288
+ if (!P.length) return out(null, ['no criteria ask waits for Jira']);
289
+ const L = [];
290
+ for (const a of P) L.push(`${a.id}\t${a.key}\t${a.labels.length} ${a.labels.length === 1 ? 'check' : 'checks'}${a.direct ? '' : '\t(draft for ' + (a.who || 'its owner') + ')'}`, ...(flags.direct ? [a.block, ''] : []));
291
+ return out(null, L);
292
+ }
293
+ if (verb === 'criteria-done') {
294
+ const id = pos[0];
295
+ if (!id) return need('<ask id> [--refused "<why Jira refused>"]');
296
+ const r = jiraCriteria.answerCriteriaAsk(root, id, flags.refused != null ? { why: flags.refused } : { written: true }, 'agent', now);
297
+ if (!r.ok) return fail(r.error);
298
+ return out(r, [r.ask.state === 'written' ? `${r.ask.key} · acceptance criteria in Jira` : `${r.ask.key} · refused: ${r.ask.why}`]);
299
+ }
222
300
  if (verb === 'moved') {
223
301
  const id = pos[0];
224
302
  if (!id || (flags.status == null) === (flags.refused == null)) return need('<move id> --status "<the status Jira shows now>" | --refused "<why Jira refused>"');
@@ -314,6 +392,24 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
314
392
  const who = r.group ? `${initiative} · ${r.group.name}` : initiative;
315
393
  return out(r, [e.mode === 'new' ? `${who} · a new epic is created at the first push` : `${who} · tickets go under ${e.key}`]);
316
394
  }
395
+ if (verb === 'criteria-propose') {
396
+ const r = jiraCriteria.propose(root, initiative, { me: pmName(env) });
397
+ if (!r.ok) return fail(r.error);
398
+ if (!r.checks) return out(r, [`${initiative} · ${r.note}`]);
399
+ const L = [`${initiative} · ${r.proposals.length} ${r.proposals.length === 1 ? 'ticket' : 'tickets'} to get the done test's checks (${r.doneTest})${r.unmatched.length ? ` · on no ticket: ${r.unmatched.join(', ')}` : ''}`];
400
+ for (const p of r.proposals) L.push('', `${p.key} · ${p.summary || 'no summary read'} · ${p.direct ? 'yours: written in Jira' : 'draft for ' + (p.who || 'its owner')}`, p.block);
401
+ return out(r, L);
402
+ }
403
+ if (verb === 'criteria-ask') {
404
+ if (!initiative) return need('<initiative> [KEY …]');
405
+ const g = await guard.requirePmCli({ act: 'push', expect: initiative,
406
+ ...(isTTY === undefined ? {} : { isTTY }), ...(env === undefined ? {} : { env }), ask: ask || guard.askAtTerminal });
407
+ if (!g.ok) return fail(g.error);
408
+ const keys = pos.slice(1);
409
+ const r = jiraCriteria.askCriteria(root, { ini: initiative, keys: keys.length ? keys : null, me: pmName(env) }, (g.actor && g.actor.by) || 'pm', now);
410
+ if (!r.ok) return fail(r.error);
411
+ return out(r, [`${initiative} · ${r.direct.length} yours to write in Jira${r.direct.length ? ' (run the jira-criteria skill, or ask on the page)' : ''} · ${r.draft.length} in the draft for their owners (pmos jira criteria-asks --draft)${r.skipped.length ? ` · not asked: ${r.skipped.join(', ')}` : ''}`]);
412
+ }
317
413
  if (verb === 'approve') {
318
414
  const ids = pos.slice(1);
319
415
  if (!ids.length) return need('<initiative> <ID> …');
@@ -354,8 +450,10 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
354
450
  let raw;
355
451
  try { raw = readSearch(flags.from, cwd, stdin); }
356
452
  catch (e) { return fail(`could not read ${flags.from} as JSON — ${String((e && e.message) || e).slice(0, 160)}`); }
453
+ const before = jiraStatus.readSnapshot(root, initiative);
357
454
  const r = jiraStatus.sync(root, initiative, raw, { query: flags.query || undefined, dryRun: !!flags['dry-run'], now });
358
455
  if (!r.ok) return fail(r.error);
456
+ tiers.noteFull(root, initiative, r, { now: now == null ? Date.now() : now, before: before ? before.tickets : null });
359
457
  const lines = [`${initiative} · read ${r.read} ${r.read === 1 ? 'ticket' : 'tickets'}${r.ignored ? ` · ${r.ignored} other issues ignored` : ''}${r.skipped ? ` · ${r.skipped} skipped (no key or summary)` : ''}${r.dryRun ? ' · dry run, nothing written' : ''}`];
360
458
  for (const c of r.changes) lines.push(` ${c.key} · ${c.what}${c.from !== undefined ? `: ${c.from} → ${c.to}` : c.status ? `: ${c.status}` : ''}${c.reason ? ` (${c.reason})` : ''}`);
361
459
  if (!r.changes.length) lines.push(' no change');