create-pmos 0.681.0 → 0.683.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.681.0",
3
+ "version": "0.683.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": {
@@ -34,21 +34,34 @@
34
34
  ],
35
35
  "pmosChanges": [
36
36
  {
37
- "v": "0.681.0",
38
- "at": "2026-11-22T07:52:20.147Z",
37
+ "v": "0.683.0",
38
+ "at": "2026-11-22T08:20:39.884Z",
39
39
  "f": 4,
40
40
  "prs": [
41
41
  {
42
- "n": 1488,
43
- "t": "Read a document as a CFO, an engineer and a sceptic (A110)",
44
- "s": "Read a document as a CFO, an engineer and a sceptic (A110)",
42
+ "n": 1494,
43
+ "t": "Acceptance criteria on each ticket, written from the done test",
44
+ "s": "Acceptance criteria on each ticket, written from the done test",
45
45
  "k": "new"
46
- },
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.682.0",
51
+ "at": "2026-11-22T07:57:47.146Z",
52
+ "f": 4,
53
+ "prs": [
47
54
  {
48
55
  "n": 1487,
49
56
  "t": "Design drift guard counts token bypasses, with a ratchet",
50
57
  "s": "Design drift guard counts token bypasses, with a ratchet",
51
58
  "k": "new"
59
+ },
60
+ {
61
+ "n": 1478,
62
+ "t": "Work breakdown keeps done tasks in date order and folds a finished stage",
63
+ "s": "Work breakdown keeps done tasks in date order and folds a finished stage",
64
+ "k": "new"
52
65
  }
53
66
  ]
54
67
  },
@@ -369,19 +382,6 @@
369
382
  "k": "new"
370
383
  }
371
384
  ]
372
- },
373
- {
374
- "v": "0.647.0",
375
- "at": "2026-11-20T05:31:50.958Z",
376
- "f": 4,
377
- "prs": [
378
- {
379
- "n": 1429,
380
- "t": "Work's Initiatives tab built from design system blocks",
381
- "s": "Work's Initiatives tab built from design system blocks",
382
- "k": "new"
383
- }
384
- ]
385
385
  }
386
386
  ]
387
387
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@ee3639a5
1
+ kernel-source: pmos@9303acc0
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-22T07:52:17Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T08:20:37Z"}
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-22T07:52:17Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T08:20:37Z"}
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-22T07:52:17Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T08:20:37Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,20 +1,33 @@
1
1
  [
2
2
  {
3
- "v": "0.681.0",
4
- "at": "2026-11-22T07:52:20.147Z",
3
+ "v": "0.683.0",
4
+ "at": "2026-11-22T08:20:39.884Z",
5
5
  "f": 4,
6
6
  "prs": [
7
7
  {
8
- "n": 1488,
9
- "t": "Read a document as a CFO, an engineer and a sceptic (A110)",
10
- "s": "Read a document as a CFO, an engineer and a sceptic (A110)",
8
+ "n": 1494,
9
+ "t": "Acceptance criteria on each ticket, written from the done test",
10
+ "s": "Acceptance criteria on each ticket, written from the done test",
11
11
  "k": "new"
12
- },
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.682.0",
17
+ "at": "2026-11-22T07:57:47.146Z",
18
+ "f": 4,
19
+ "prs": [
13
20
  {
14
21
  "n": 1487,
15
22
  "t": "Design drift guard counts token bypasses, with a ratchet",
16
23
  "s": "Design drift guard counts token bypasses, with a ratchet",
17
24
  "k": "new"
25
+ },
26
+ {
27
+ "n": 1478,
28
+ "t": "Work breakdown keeps done tasks in date order and folds a finished stage",
29
+ "s": "Work breakdown keeps done tasks in date order and folds a finished stage",
30
+ "k": "new"
18
31
  }
19
32
  ]
20
33
  },
@@ -639,6 +639,7 @@ The benchmark needs a signed-in agent CLI. It never pushes and never opens a pul
639
639
  - `pmos jira moved <move id> --status "<Jira status>"` or `--refused "<why>"`
640
640
  - `pmos jira guesses <initiative> [--from <file|->]`
641
641
  - `pmos jira answer <initiative> <ticket> <n> --text "<answer>"` or `--keep-default`
642
+ - `pmos jira criteria <initiative>`: the done-test checks each ticket carries as acceptance criteria, and the checks on no ticket
642
643
 
643
644
  Every command takes `--json` and `--root <dir>`.
644
645
 
@@ -92,6 +92,28 @@ To see every ticket in the terminal:
92
92
  pmos jira show <initiative>
93
93
  ```
94
94
 
95
+ ## Acceptance criteria from the done test
96
+
97
+ The people who build a ticket often never see the initiative's done test. So when the initiative has a done test (`done_test_path`), each drafted ticket carries the checks that apply to it, at the end of its Acceptance Criteria, under **From the done test**. Each check is written as Given / When / Then:
98
+
99
+ - **Given** the ticket's work is built,
100
+ - **When** a reviewer checks it the way the done test says,
101
+ - **Then** the check holds.
102
+
103
+ PMOS puts a check on a ticket in this order:
104
+
105
+ 1. A check that names a ticket id, such as TD-01, goes to that ticket.
106
+ 2. With one ticket, every check goes to it.
107
+ 3. Otherwise a check goes to the ticket that shares the most words with it (at least two).
108
+
109
+ A check that fits no ticket is not put on a ticket. `pmos jira draft` and `pmos jira criteria` list it as "on no ticket". To place it, name the ticket id in the check, or add the criteria to a ticket yourself.
110
+
111
+ Your own criteria stay above the block. A ticket you edited, selected or pushed is not changed. When the done test changes, the next draft updates the block on the tickets PMOS may still change. Nothing is sent to Jira until you select a ticket and push it.
112
+
113
+ ```
114
+ pmos jira criteria <initiative>
115
+ ```
116
+
95
117
  ## The dry run: where a builder would guess
96
118
 
97
119
  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.
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Layout and first run: the places, the navigation, the Viewer, the launcher and Adler"
4
4
  description: "The places, the navigation at the left, the Viewer, the keys and the phone; the first run; when features appear; the PMOS app; and Adler."
5
- timestamp: 2026-11-20
5
+ timestamp: 2026-11-22
6
6
  ---
7
7
 
8
8
  # Layout and first run
@@ -150,7 +150,7 @@ The left column has three blocks:
150
150
 
151
151
  - **Where it stands.** What is happening, in a few sentences. Then **Next**: the next three dates, a milestone as a diamond and the outcome check as a circle; press a milestone to open it. Then one suggestion from PMOS with **Why**, **PMOS will** and **Based on**. The pencil opens it so you can change it first, ✓ does it and ✕ drops it. Other suggestions are one link under it.
152
152
  - **Stages.** Each stage of the workflow, with its dates under its name or "no dates yet", on a month scale with a red line for today. A stage's bar runs from the earliest start to the latest end of its tasks; a task with no start counts from its due date. Only a stage with no dated task uses the days the workflow moved through it. To change a stage's dates, change its tasks' dates. A stage has a bar only when it has real dates. A milestone is a diamond on its stage's row.
153
- - **Work breakdown.** **List** or **Gantt**; PMOS keeps your choice on this computer. **List** has one box on top: type a task and press Enter. Say its stage ("… in Plan"), or it goes to the stage in progress; start with ◇ to add a milestone. Each stage with tasks is one group that says how much is done, for example "1 of 3 done". A done task stays in its stage, in grey with a check. Stages with no tasks fold into one line at the end. Press the box before a task to mark it done, with **Undo**. Press its name to rename it: Enter saves and Escape cancels. When you point at the row, four icons show: **Who** (You, the people on this initiative, or **PMOS does it**, which gives the task to PMOS), **Due date**, **Stage** (moves the task to another stage) and ⋯ (**Status**, **Make it a milestone** and **Open the task**). Each change has **Undo**. A Jira ticket keeps its owner and stage from Jira. **Gantt** is the table described below, with its bars.
153
+ - **Work breakdown.** **List** or **Gantt**; PMOS keeps your choice on this computer. **List** has one box on top: type a task and press Enter. Say its stage ("… in Plan"), or it goes to the stage in progress; start with ◇ to add a milestone. Each stage with tasks is one group that says how much is done, for example "1 of 3 done". Press the group to fold it, and press it again to open it. A stage whose tasks are all done is folded until you open it. In a stage, the tasks are in date order, a late task first. A done task stays in its place, in grey with a check. Stages with no tasks fold into one line at the end. Press the box before a task to mark it done, with **Undo**. Press its name to rename it: Enter saves and Escape cancels. When you point at the row, four icons show: **Who** (You, the people on this initiative, or **PMOS does it**, which gives the task to PMOS), **Due date**, **Stage** (moves the task to another stage) and ⋯ (**Status**, **Make it a milestone** and **Open the task**). Each change has **Undo**. A Jira ticket keeps its owner and stage from Jira. **Gantt** is the table described below, with its bars.
154
154
 
155
155
  Press the rest of a row, or a milestone, to open it as a full popup in place of the work side. Its top line has ←, the path (**Work › product › initiative**), the chat button, ⋯ and ×. ← or the initiative's name goes back to the initiative, where you left it. The chat button shows **Ask PMOS** beside it. × closes the popup. A task shows its status, dates, owner, notes and what changed. A milestone also shows its date and how many days are left, the done test, **Kill if**, and the suggestion from PMOS about it when there is one.
156
156
 
@@ -162,7 +162,7 @@ The right column has two blocks:
162
162
  On a phone, in a shared read-only copy and in a breakdown given the whole popup, the work side keeps the three parts below. They use the full width of the popup: in a wide popup the timeline gets the extra width. A done task shows in grey text, never struck through.
163
163
 
164
164
  - **Overview.** Three short lines from the initiative's own records: **Problem**, **Goal** (with the goal it serves, by name) and **Done when**. A line with no record says **Not written yet.** and offers a draft with ✓ and ✕. Press a line to change it; it saves when you leave the field, with **Undo**. Then one line on where it stands, **PMOS suggests** (at most three, each with ✓ and ✕), and **Details ›** for the facts: Stage, Status, Start, Target end, Next milestone, Goal, Product, Program, Workflow and Open. A fact with no value is not shown. Goal, Product, Program and Next milestone are in the link colour and open their thing; the others are plain text. An initiative that is closed or done but has open tasks shows one suggestion: **Close them** or **Reopen**.
165
- - **Work breakdown.** Each stage is a row that folds and says how much is done, for example "3 of 9 done". Only the stage in progress opens by itself. In a long stage you see the late tasks, the tasks in progress and the next five, then **N more tasks**. Done tasks fold to one line, and the stages after the next one fold to one row. A task in no stage is not in the breakdown: it is in Work › Backlog, and one quiet line under the breakdown says how many, for example **2 tasks with no stage are in the Backlog ›**. A task with no date shows no date and is never late. The timeline is on the right, with **Today** on it. Drag the grip between the columns and the timeline to make the timeline wider or narrower; a double press puts it back. Choose its span (Quarter to Full) beside the tune icon, which shows or hides columns. The four-corners icon gives the breakdown the whole popup. Type in the last row of a stage to add a task; the **Task** choice beside it makes the next one a milestone.
165
+ - **Work breakdown.** Each stage is a row that folds and says how much is done, for example "3 of 9 done". Only the stage in progress opens by itself, and a stage whose tasks are all done stays folded until you open it. In a stage, the tasks are in date order, a late task first; a done task stays in its place, in grey. In a long stage you see the late tasks, the tasks in progress and the next five, then **N more tasks**. The stages after the next one fold to one row. A task in no stage is not in the breakdown: it is in Work › Backlog, and one quiet line under the breakdown says how many, for example **2 tasks with no stage are in the Backlog ›**. A task with no date shows no date and is never late. The timeline is on the right, with **Today** on it. Drag the grip between the columns and the timeline to make the timeline wider or narrower; a double press puts it back. Choose its span (Quarter to Full) beside the tune icon, which shows or hides columns. The four-corners icon gives the breakdown the whole popup. Type in the last row of a stage to add a task; the **Task** choice beside it makes the next one a milestone.
166
166
  - **Status.** Press a task's status and pick the new one. **When did this happen?** shows under the list, with **Today** chosen: press the status again, or Enter, to keep today. Press **Yesterday**, or **Pick a date**, when the work moved earlier than you noted it. A day in the future, or a day before the task's previous move, cannot be picked. The toast says both days, for example "Done on 14 Nov, noted today.", with **Undo**.
167
167
  - **Open the task.** The ↗ on a row, or **Open the task** in its ⋯, opens a small popup on top: Task or Milestone, the name (press it to rename), status, dates, owner and notes. Its status asks **When did this happen?** too. ↑ and ↓ go to the task before or after it, and ⋯ has **Make it a milestone**, **Archive** and **Delete**, each with **Undo**. A change shows on the task's row at once. Escape, × or a press outside closes only the small popup, and the task's row lights for a moment.
168
168
  - **Dates.** Press a task's date. **Task | Milestone** on top turns it into a milestone (one Date) or back into a task (Start and Due). Write a day as "15 Oct 2026", or press the calendar icon. The row's ⋯ also has **Make it a milestone** and **Open the task**.
@@ -20,6 +20,7 @@
20
20
  * pmos jira moved <move id> --status "<Jira status>" | --refused "<why>" the agent's answer for one move
21
21
  * pmos jira guesses <initiative> [--from <file|->] a ticket dry run (lib/ticket-dry-run.js), recorded or shown
22
22
  * pmos jira answer <initiative> <ticket> <n> --text "<answer>" | --keep-default the PM's answer to one dry-run gap, or its default kept
23
+ * pmos jira criteria <initiative> the done-test checks each ticket carries, and the checks on no ticket (A384)
23
24
  * every command: [--json] [--root <dir>]
24
25
  *
25
26
  * This command never talks to Jira. An agent session does, with the PM's own Atlassian connection (D53, D88), and
@@ -35,7 +36,7 @@ const jiraMoves = require('./jira-moves.js');
35
36
  const planItems = require('./plan-items.js');
36
37
  const guard = require('./pm-guard.js');
37
38
 
38
- const COMMANDS = { jira: ['draft', 'show', 'epic', 'approve', 'pending', 'record', 'query', 'sync', 'summary', 'which', 'moves', 'moved', 'guesses', 'answer'] };
39
+ const COMMANDS = { jira: ['draft', 'show', 'epic', 'approve', 'pending', 'record', 'query', 'sync', 'summary', 'which', 'moves', 'moved', 'guesses', 'answer', 'criteria'] };
39
40
  const USAGE = [
40
41
  'usage: pmos jira draft|show|epic|approve|pending|record|query|sync|summary|which — Jira tickets from the PRD, and their status',
41
42
  ' pmos jira draft <initiative> [--dry-run] draft one ticket per PRD item, in the ticket template',
@@ -45,6 +46,7 @@ const USAGE = [
45
46
  ' Quotes not found word for word in the PRD, done test or record are dropped. Gaps go to the day\'s question list.',
46
47
  ' pmos jira guesses <initiative> the dry run so far: the guesses of each ticket and the open gaps',
47
48
  ' pmos jira answer <initiative> <ticket> <n> --text "<answer>" | --keep-default the PM\'s answer to gap n, or keep its default: it goes into the ticket',
49
+ ' pmos jira criteria <initiative> the done-test checks each ticket carries as acceptance criteria, and the checks on no ticket',
48
50
  ' pmos jira epic <initiative> new|<KEY or link> [--group <g>] create a new epic at the first push, or use an existing one',
49
51
  ' pmos jira approve <initiative> <ID> … select tickets to push (you, in your own terminal)',
50
52
  ' pmos jira pending <initiative> what the push creates or updates in Jira',
@@ -219,6 +221,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
219
221
  if (r.from === 'done-test' || r.from === 'tasks') lines.push(` From ${r.from === 'done-test' ? 'the done test\'s checks' : 'the open tasks'} (${r.sources.join(', ')}): the PRD has no stories section.`);
220
222
  else if (r.from === 'plan') lines.push(' From the plan: each milestone is an epic, with the tasks that end before it. A Project has no PRD.');
221
223
  for (const c of r.changes) lines.push(` ${c.what.padEnd(9)} ${c.ticket} · ${c.summary}${c.why ? ` (${c.why})` : ''}`);
224
+ if (r.criteria) lines.push(` Acceptance criteria from the done test (${r.criteria.doneTest}): ${r.criteria.checks - r.criteria.unmatched.length} of ${r.criteria.checks} checks on a ticket${r.criteria.unmatched.length ? `; on no ticket: ${r.criteria.unmatched.join(', ')} (see pmos jira criteria ${initiative})` : ''}.`);
222
225
  lines.push('Read them on the Jira tickets tab, or with pmos jira show. Select the ready ones there, or with pmos jira approve.');
223
226
  return out(r, lines);
224
227
  }
@@ -243,6 +246,16 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
243
246
  if (r.gaps) lines.push(` The ${r.gaps === 1 ? 'gap goes' : r.gaps + ' gaps go'} to the PM's question list for today or tomorrow.`);
244
247
  return out(r, lines);
245
248
  }
249
+ if (verb === 'criteria') {
250
+ const r = jiraTickets.criteria(root, initiative);
251
+ if (!r.ok) return fail(r.error);
252
+ if (!r.doneTest) return out(r, [`${initiative} · no done test: give the record a done_test_path, then run pmos jira draft ${initiative}`]);
253
+ const lines = [`${initiative} · ${r.tickets_with_criteria} of ${r.tickets.length} ${r.tickets.length === 1 ? 'ticket carries' : 'tickets carry'} acceptance criteria from ${r.doneTest} · ${r.checks_on_a_ticket} of ${r.checks} checks on a ticket`];
254
+ for (const t of r.tickets) lines.push(` ${t.id} · ${t.checks.length ? `checks ${t.checks.join(', ')}` : 'no check'} · ${t.summary}`);
255
+ for (const u of r.unmatched) lines.push(` on no ticket: ${u.label} · ${u.check}`);
256
+ if (r.unmatched.length) lines.push('Name the ticket id in the check, or add the criteria to a ticket by hand, then run pmos jira draft again.');
257
+ return out(r, lines);
258
+ }
246
259
  if (verb === 'answer') {
247
260
  const [, ticket, n] = pos;
248
261
  if (!ticket || !n || (!flags.text === !flags['keep-default'])) return need('<initiative> <ticket> <n> --text "<the answer>" | --keep-default');
@@ -52,6 +52,7 @@ const planItems = require('./plan-items.js');
52
52
  const planTree = require('./plan-tree.js');
53
53
  const consoleState = require('./console-state');
54
54
  const { repoScript } = require('./repo-script.js');
55
+ const TAm = () => require('./ticket-acceptance.js');
55
56
 
56
57
  const KEY_RE = /^[A-Za-z][A-Za-z0-9_]*-\d+$/;
57
58
  const KEY_IN = /\b([A-Z][A-Z0-9_]+-\d+)\b/;
@@ -215,22 +216,9 @@ function readPrd(root, prd) {
215
216
  try { return fs.readFileSync(path.join(root, prd), 'utf8'); } catch { /* the main tree */ }
216
217
  try { return fs.readFileSync(path.join(mainRoot(root), prd), 'utf8'); } catch { return null; }
217
218
  }
218
- /** The checks of a done test (D107): its table rows `| n | check | how |`, else its top-level bullets. → [{ n, check, how }] */
219
- function checksInDoneTest(text) {
220
- const lines = stripFm(text).split('\n');
221
- const out = [];
222
- for (const l of lines) {
223
- const m = /^\|\s*(\d+)\s*\|\s*(.+?)\s*\|\s*(.*?)\s*\|?\s*$/.exec(l);
224
- if (m && m[2] && !/^-+$/.test(m[2])) out.push({ n: Number(m[1]), check: m[2].replace(/\\\|/g, '|'), how: m[3] || '' });
225
- }
226
- if (out.length) return out;
227
- let n = 0;
228
- for (const l of lines) {
229
- const b = /^[-*] (?:\[[ xX]\] )?(.+)$/.exec(l);
230
- if (b) out.push({ n: ++n, check: b[1].trim(), how: '' });
231
- }
232
- return out;
233
- }
219
+ /** The checks of a done test (D107): its table rows `| 1 | check | how |` or `| Q1 | … |`, else its top-level bullets.
220
+ * → [{ label, n, check, how }] (lib/ticket-acceptance.js) */
221
+ function checksInDoneTest(text) { return TAm().checksOf(text); }
234
222
  /** The done test a record names, read from the worktree or the main tree (a kit repository may name it under pmos/). */
235
223
  function readDoneTest(root, rfm) {
236
224
  const p = rfm && isStr(rfm.done_test_path) ? rfm.done_test_path.trim() : '';
@@ -244,12 +232,14 @@ function readDoneTest(root, rfm) {
244
232
  }
245
233
  return null;
246
234
  }
247
- /** One ticket item per done-test check: the check is the requirement, and how to check it is the acceptance. */
235
+ /** One ticket item per done-test check: the check is the requirement, and how to check it is the acceptance. `check` names the
236
+ * done-test row, so the criteria block (ticket-acceptance-from-done-test) writes it as Given / When / Then in place of these lines. */
248
237
  function itemsFromDoneTest(dt, title) {
249
238
  return checksInDoneTest(dt.text).map((c) => {
250
239
  const check = oneLine(c.check);
251
240
  return {
252
- id: `DT-${String(c.n).padStart(2, '0')}`, title: clip(check.replace(/\.$/, ''), 120), epic: null, refLabel: 'Done test', source: dt.path,
241
+ id: /^\d+$/.test(c.label) ? `DT-${String(c.n).padStart(2, '0')}` : `DT-${c.label}`, check: c.label,
242
+ title: clip(check.replace(/\.$/, ''), 120), epic: null, refLabel: 'Done test', source: dt.path,
253
243
  body: [`### User Story`, `As the PM of ${title}, I want this check of the done test to pass: ${check}`,
254
244
  `### Functional Requirements`, check,
255
245
  `### Acceptance Criteria`, `- ${check}`, ...(c.how ? [`- How to check: ${oneLine(c.how)}`] : [])].join('\n'),
@@ -537,18 +527,84 @@ function draft(root, initiative, { dryRun = false, now } = {}) {
537
527
  }
538
528
  // Tickets whose item is gone stay, at the end: the tab says so and Jira is not touched (J10).
539
529
  for (const t of byId.values()) out.push(t);
530
+ // Acceptance criteria from the done test (ticket-acceptance-from-done-test, A384), on every ticket PMOS may still write.
531
+ const crit = applyCriteria(root, initiative, st, out);
532
+ const listed = new Set(changes.map((c) => c.ticket));
533
+ for (const id of crit.written) if (!listed.has(id)) { const t = out.find((x) => x.id === id); changes.push({ ticket: id, what: 'criteria', summary: t.summary, why: 'its acceptance criteria from the done test changed' }); }
540
534
  const fm = old ? { ...old.fm } : {};
541
535
  if (!fm.epic_mode) {
542
536
  const anchor = anchorOf(recordFm(root, initiative) || {});
543
537
  fm.epic_mode = anchor ? 'existing' : 'new';
544
538
  if (anchor && !fm.epic) fm.epic = anchor;
545
539
  }
546
- const result = { ok: true, initiative, draft: draftRel(root, initiative), sources: st.sources, from: st.from, tickets: out.length, changes, changed: !old || changes.length > 0 };
540
+ const result = { ok: true, initiative, draft: draftRel(root, initiative), sources: st.sources, from: st.from, tickets: out.length, changes, changed: !old || changes.length > 0,
541
+ criteria: crit.doneTest ? { doneTest: crit.doneTest, checks: crit.checks, unmatched: crit.unmatched } : null };
547
542
  if (dryRun || (old && !changes.length)) return result;
548
543
  writeDraft(root, initiative, { fm, tickets: out }, { now, prd: st.prd });
549
544
  return result;
550
545
  }
551
546
 
547
+ // ── acceptance criteria from the done test (initiative ticket-acceptance-from-done-test; A384) ──────────
548
+ /** What a ticket says, for matching it to a check: summary, story, flow, requirements, end states and the PM's own criteria. */
549
+ function ticketWords(t) {
550
+ const sec = t.sections || {};
551
+ return [t.summary, sec.story, sec.flow, sec.functional, sec.terminal, TAm().withBlock(sec.acceptance, '')].filter(Boolean).join('\n');
552
+ }
553
+ /**
554
+ * Put each ticket's done-test checks, as Given / When / Then, at the end of its Acceptance Criteria. Only tickets PMOS may still
555
+ * write (dryRunWritable). A ticket drafted from one check alone carries the block in place of its plain lines.
556
+ * → { doneTest, checks, unmatched: [label], written: [id] }
557
+ */
558
+ function applyCriteria(root, initiative, st, tickets) {
559
+ const rfm = recordFm(root, initiative) || {};
560
+ const dt = readDoneTest(root, rfm);
561
+ const checks = dt ? checksInDoneTest(dt.text) : [];
562
+ if (!dt || !checks.length) return { doneTest: null, checks: 0, unmatched: [], written: [] };
563
+ const own = new Map((st && st.ok ? st.items : []).filter((x) => x.check).map((x) => [x.id, x.check]));
564
+ const a = TAm().assign(checks, tickets.map((t) => ({ id: t.id, text: ticketWords(t) })), { own });
565
+ const byLabel = new Map(checks.map((c) => [c.label, c]));
566
+ const title = oneLine(rfm.title || initiative);
567
+ const written = [];
568
+ for (const t of tickets) {
569
+ if (!dryRunWritable(t)) continue;
570
+ const labels = a.byTicket.get(t.id) || [];
571
+ const block = TAm().blockOf(labels.map((l) => byLabel.get(l)), { path: dt.path, subject: own.has(t.id) ? title : oneLine(t.summary) });
572
+ const base = own.has(t.id) && block ? '' : t.sections.acceptance;
573
+ const next = TAm().withBlock(base, block);
574
+ if (next === (t.sections.acceptance || '')) continue;
575
+ t.sections.acceptance = next; t.drafted = contentHash(t); written.push(t.id);
576
+ }
577
+ return { doneTest: dt.path, checks: checks.length, unmatched: a.unmatched, written };
578
+ }
579
+ /** The labels of the checks a ticket's text carries in its "From the done test" block. */
580
+ function criteriaLabelsOf(t) {
581
+ const s = String((t.sections || {}).acceptance || '');
582
+ const i = s.indexOf(TAm().MARK);
583
+ if (i < 0) return [];
584
+ return [...s.slice(i).matchAll(/^- Check (\S+)\s*$/gm)].map((m) => m[1]);
585
+ }
586
+ /**
587
+ * The coverage of the done test by the drafted tickets, read from the ticket text itself: which checks each ticket carries, and
588
+ * which checks no ticket carries. → { ok, doneTest, tickets: [{ id, summary, checks: [label] }], tickets_with_criteria, checks,
589
+ * checks_on_a_ticket, unmatched: [{ label, check }] } | { ok: false, status, error }
590
+ */
591
+ function criteria(root, initiative) {
592
+ const rfm = recordFm(root, initiative);
593
+ if (!rfm) return { ok: false, status: 404, error: `no initiative ${initiative} in this repository` };
594
+ const { d, error } = mustDraft(root, initiative);
595
+ if (error) return { ok: false, status: 404, error };
596
+ const dt = readDoneTest(root, rfm);
597
+ const checks = dt ? checksInDoneTest(dt.text) : [];
598
+ const tickets = d.tickets.map((t) => ({ id: t.id, summary: t.summary, checks: criteriaLabelsOf(t) }));
599
+ const on = new Set(tickets.flatMap((t) => t.checks));
600
+ return {
601
+ ok: true, initiative, doneTest: dt ? dt.path : null, tickets: tickets.length ? tickets : [],
602
+ tickets_with_criteria: tickets.filter((t) => t.checks.length).length, checks: checks.length,
603
+ checks_on_a_ticket: checks.filter((c) => on.has(c.label)).length,
604
+ unmatched: checks.filter((c) => !on.has(c.label)).map((c) => ({ label: c.label, check: oneLine(c.check) })),
605
+ };
606
+ }
607
+
552
608
  // ── the dry run (initiative dry-run-tickets-before-build; A194) ─────────────────────────────────────
553
609
  /** The dry-run helpers, loaded when a dry run is read or written. */
554
610
  /** The state folder of the repository: <state>/tracker/ holds the ticket drafts, dry runs and sign-offs. */
@@ -713,7 +769,7 @@ function view(root, initiative, { snapshot } = {}) {
713
769
  : waiting ? 'pushing' : edited ? 'edited' : null;
714
770
  return {
715
771
  id: t.id, summary: t.summary, type: t.type, priority: t.priority, estimate: t.estimate, depends: t.depends,
716
- epic: t.epic ? groupId(t.epic) : null, sections: t.sections, key: t.jira, inJira: !!t.jira, edited, prdChanged, removed, missing, waiting,
772
+ epic: t.epic ? groupId(t.epic) : null, sections: t.sections, doneTestChecks: criteriaLabelsOf(t), key: t.jira, inJira: !!t.jira, edited, prdChanged, removed, missing, waiting,
717
773
  selectable: !missing.length && !removed && (!t.jira || t.pushed !== h), flag,
718
774
  jira: r ? { status: r.status, category: r.category, sprint: r.sprint, subtasks: r.subtasks, flagged: !!r.flagged, reason: r.reason || null, url: r.url || null, stale: !!r.stale,
719
775
  assignee: (typeof r.assignee === 'string' && r.assignee.trim()) || (r.assignee && (r.assignee.displayName || r.assignee.name)) || null } : null,
@@ -1011,4 +1067,5 @@ module.exports = {
1011
1067
  readDraft, parseDraft, pushedTickets, draftedInitiatives, epicInitiatives, epicKeysOf, linkedEpics, anchorOf, missingOf, contentHash, describe,
1012
1068
  draftPath, draftRel, jiraDir, relOf, recordFm, prdOf,
1013
1069
  dryRun, answerDryRun, dryRunGaps, dryRunView, dryRunInitiatives, dryRunPath, stateDirOf,
1070
+ criteria, checksInDoneTest,
1014
1071
  };
@@ -0,0 +1,120 @@
1
+ 'use strict';
2
+ /* ticket-acceptance.js — acceptance criteria on each drafted ticket, written from the initiative's done test
3
+ * (initiative ticket-acceptance-from-done-test; bet A384 in pmos-ideas proofs/A384-ac).
4
+ *
5
+ * On three test products, 69% of recent tickets stated no acceptance criteria, and the done test the PM agreed lived only in
6
+ * PMOS. So each ticket PMOS drafts carries the done-test checks that apply to it, as Given / When / Then, and the checks that fit
7
+ * no ticket are listed so the PM can place them.
8
+ *
9
+ * checksOf(text) → [{ label, n, check, how }] the done test's rows (`| 1 |` or `| Q1 |`), else bullets PURE
10
+ * gwt(check, { subject }) → { given, when, then } PURE
11
+ * assign(checks, tickets) → { byTicket: Map(id → [label]), unmatched: [label] } PURE
12
+ * blockOf(rows, { path, subject }) → the block that goes at the end of Acceptance Criteria, or '' PURE
13
+ * withBlock(text, block) → the section text with the old block replaced PURE
14
+ *
15
+ * MATCHING. A check that names a ticket id (TD-01) goes to that ticket. With one ticket, every check goes to it. Else a check goes
16
+ * to the ticket, or the tied tickets, that share most of its words (summary, story and requirements), when they share at least
17
+ * two. A check that fits no ticket is never guessed onto one: it is listed as not on any ticket. No model, nothing sent.
18
+ */
19
+
20
+ const MARK = '**From the done test**';
21
+ const MIN_SHARED = 2;
22
+ const STOP = new Set(('a an and are as at be been by can cannot does each every for from has have how in into is it its it\'s more no not ' +
23
+ 'of on one or our per same says so than that the their them then there these they this those to two was we were what when where which who ' +
24
+ 'will with without would you your check checks test tests done pass passes run runs ticket tickets item items shows show read reads ' +
25
+ 'still only also any all some other new use used uses user users pmos').split(' '));
26
+
27
+ const one = (s) => String(s == null ? '' : s).replace(/[\r\n\t]+/g, ' ').replace(/\s{2,}/g, ' ').trim();
28
+ const stripFm = (text) => String(text).replace(/^---\n[\s\S]*?\n---\n?/, '');
29
+ const words = (s) => {
30
+ const out = new Set();
31
+ for (const w of String(s || '').toLowerCase().replace(/`[^`]*`/g, (m) => m.replace(/[^a-z0-9]+/g, ' ')).split(/[^a-z0-9]+/)) {
32
+ if (w.length < 3 || STOP.has(w) || /^\d+$/.test(w)) continue;
33
+ out.add(w.length > 4 ? w.replace(/(ies|es|s|ed|ing)$/, '') : w); // a light stem: "tickets" and "ticket", "drafted" and "draft"
34
+ }
35
+ return out;
36
+ };
37
+ const sentence = (s) => one(s).replace(/[.;:,\s]+$/, '');
38
+ const lowerFirst = (s) => (/^[A-Z](?![A-Z0-9_-])/.test(s) ? s[0].toLowerCase() + s.slice(1) : s); // "A reader" → "a reader"; "PW-3", "API" kept
39
+
40
+ /** The checks of a done test: its table rows `| 1 | check | how |` or `| Q1 | … |`, else its top-level bullets. */
41
+ function checksOf(text) {
42
+ const lines = stripFm(text).split('\n');
43
+ const out = [];
44
+ for (const l of lines) {
45
+ if (!/^\s*\|/.test(l)) continue;
46
+ // cells split on pipes, an escaped pipe (\|) kept as text
47
+ const cells = l.replace(/\\\|/g, '\u0000').trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map((c) => c.replace(/\u0000/g, '|').trim());
48
+ const [label, check, how] = cells;
49
+ if (!/^[A-Za-z]{0,4}-?\d+[a-z]?$/.test(label || '') || !check || /^:?-+:?$/.test(check)) continue;
50
+ out.push({ label, n: Number(/(\d+)/.exec(label)[1]), check, how: how || '' });
51
+ }
52
+ if (out.length) return out;
53
+ let n = 0;
54
+ for (const l of lines) {
55
+ const b = /^[-*] (?:\[[ xX]\] )?(.+)$/.exec(l);
56
+ if (b) { n++; out.push({ label: String(n), n, check: b[1].trim(), how: '' }); }
57
+ }
58
+ return out;
59
+ }
60
+
61
+ /** A check as Given / When / Then. subject: what is built (the ticket's summary, or the initiative's title). */
62
+ function gwt(c, { subject } = {}) {
63
+ const what = sentence(subject) || 'this work';
64
+ const how = sentence(c && c.how);
65
+ return {
66
+ given: `${what} is built`,
67
+ when: how ? `a reviewer checks it: ${lowerFirst(how)}` : 'a reviewer checks it',
68
+ then: lowerFirst(sentence(c && c.check)),
69
+ };
70
+ }
71
+
72
+ /**
73
+ * Which checks go on which ticket. tickets: [{ id, text }] where text is what the ticket says (summary, story, requirements).
74
+ * own: optional Map(ticket id → label) for tickets drafted from one check each (a draft from the done test alone).
75
+ */
76
+ function assign(checks, tickets, { own } = {}) {
77
+ const byTicket = new Map(tickets.map((t) => [t.id, []]));
78
+ const unmatched = [];
79
+ const tw = tickets.map((t) => ({ id: t.id, w: words(t.text) }));
80
+ for (const c of checks) {
81
+ let to = [];
82
+ if (own) for (const [id, label] of own) if (label === c.label && byTicket.has(id)) to.push(id);
83
+ if (!to.length) {
84
+ const named = tickets.filter((t) => new RegExp(`(^|[^A-Za-z0-9-])${t.id.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}([^A-Za-z0-9-]|$)`).test(`${c.check} ${c.how}`));
85
+ to = named.map((t) => t.id);
86
+ }
87
+ if (!to.length && tickets.length === 1) to = [tickets[0].id];
88
+ if (!to.length) {
89
+ const cw = words(`${c.check} ${c.how}`);
90
+ let best = 0;
91
+ const score = tw.map((t) => { let s = 0; for (const w of cw) if (t.w.has(w)) s++; if (s > best) best = s; return { id: t.id, s }; });
92
+ if (best >= MIN_SHARED) to = score.filter((x) => x.s === best).map((x) => x.id);
93
+ }
94
+ if (!to.length) { unmatched.push(c.label); continue; }
95
+ for (const id of to) byTicket.get(id).push(c.label);
96
+ }
97
+ return { byTicket, unmatched };
98
+ }
99
+
100
+ /** The block for one ticket: each check as Given / When / Then. rows: [{ label, check, how }]. '' when there is none. */
101
+ function blockOf(rows, { path, subject } = {}) {
102
+ if (!rows || !rows.length) return '';
103
+ const lines = [`${MARK}${path ? ` (\`${path}\`)` : ''}`, ''];
104
+ for (const c of rows) {
105
+ const g = gwt(c, { subject });
106
+ lines.push(`- Check ${c.label}`, ` - Given ${g.given}`, ` - When ${g.when}`, ` - Then ${g.then}`);
107
+ }
108
+ return lines.join('\n');
109
+ }
110
+
111
+ /** The section text with the old block taken out and the new one put at its end. */
112
+ function withBlock(text, block) {
113
+ const s = String(text || '');
114
+ const i = s.indexOf(MARK);
115
+ const base = (i >= 0 ? s.slice(0, i) : s).replace(/\s+$/, '');
116
+ const clean = /^[\s—–-]*$/.test(base) ? '' : base;
117
+ return [clean, block].filter(Boolean).join('\n\n');
118
+ }
119
+
120
+ module.exports = { MARK, checksOf, gwt, assign, blockOf, withBlock, words };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.681.0",
3
+ "version": "0.683.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.681.0",
9
+ "version": "0.683.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.681.0",
3
+ "version": "0.683.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -78,3 +78,8 @@ div.pwd-art { cursor: default; }
78
78
  .pwd-art.miss .t { color: var(--muted); }
79
79
  .pwd-art .w.warn { color: var(--alert); }
80
80
  .pwd-ai { flex: none; color: var(--muted); display: inline-flex; }
81
+ /* a stage head is a press that folds the stage (Wawan, 2026-11-22): the system's pm-group as a button, the chevron at the end */
82
+ .pwd-list .pm-group.pwd-gh { width: 100%; border: 0; font: inherit; font-size: var(--fs-label); font-weight: var(--fw-strong); text-align: left; cursor: pointer; }
83
+ .pwd-list .pm-group.pwd-gh svg { margin-left: auto; flex: none; }
84
+ .pwd-list .pm-group.pwd-gh:hover { color: var(--ink); }
85
+ .pwd-list .pm-group.pwd-gh:focus-visible { outline: none; box-shadow: var(--glow); }
@@ -19,7 +19,7 @@ export const I = {
19
19
  star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', pen: 'M4 20h4L19 9l-4-4L4 16z', ok: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18',
20
20
  plus: 'M12 5v14M5 12h14', more: 'M5 12h.01M12 12h.01M19 12h.01', open: 'M14 5h5v5M19 5l-8 8M18 14v5H5V6h5', box: 'M6 5h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z',
21
21
  dia: 'M12 4l8 8-8 8-8-8z', doc: 'M7 3h7l4 4v14H7zM14 3v4h4M9.5 12h6M9.5 16h6', deck: 'M4 5h16v11H4zM12 16v4M8 20h8', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1',
22
- proto: 'M4 5h16v12H4zM9 21h6M12 17v4', right: 'M10 7l5 5-5 5',
22
+ proto: 'M4 5h16v12H4zM9 21h6M12 17v4', right: 'M10 7l5 5-5 5', down: 'M7 10l5 5 5-5',
23
23
  who: 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM5 20a7 7 0 0 1 14 0', cal: 'M5 6h14v14H5zM5 10h14M9 4v4M15 4v4', stage: 'M5 7h14M5 12h10M5 17h6',
24
24
  };
25
25
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@@ -131,7 +131,8 @@ export function stageKeyOf(text, st) {
131
131
  const cur = L.find((x) => x.now) || L.find((x) => !x.done) || L[0];
132
132
  return cur ? { key: cur.key, name: cur.name, title: s, guessed: true } : null;
133
133
  }
134
- /** rows: the breakdown with every stage open, its done tasks shown and no fold (pop-work-model.js breakdownOf). o: { ro, looseN, ms } */
134
+ /** rows: the breakdown with every stage open but a finished one, done tasks in their date order and no "more" fold (pop-work-model.js
135
+ * breakdownOf with openAll). A stage head is a press that folds it (data-pw-fold, the Gantt's own). o: { ro, looseN, ms } */
135
136
  export function listHtml(rows, W, o = {}) {
136
137
  const groups = [], empty = [];
137
138
  let g = null;
@@ -156,9 +157,13 @@ export function listHtml(rows, W, o = {}) {
156
157
  return `<div class="pm-li pwd-li${x.done ? ' dn' : ''}${x.lit ? ' now' : ''}" data-pwli="${esc(x.uid)}" data-pw-row="${esc(x.uid)}">${box}<span class="txt">${title}${sub ? `<span class="w${x.late ? ' late' : ''}">${esc(sub)}</span>` : ''}</span>${acts}</div>`;
157
158
  };
158
159
  const body = groups.map((G) => {
159
- if (!G.tasks.length) { empty.push(G.s.name); return ''; }
160
- const open = G.tasks.filter((x) => !x.done), dn = G.tasks.filter((x) => x.done);
161
- return `<div class="pm-group${G.s.now ? ' now' : ''}"><b>${esc(G.s.name)}</b> <span class="pm-meta">${esc(dn.length + ' of ' + G.tasks.length + ' done')}</span></div>` + open.concat(dn).map(li).join('');
160
+ // a stage row from breakdownOf says whether it has tasks (can) and is open; a row without them is open when tasks follow it
161
+ const has = G.s.can != null ? !!G.s.can : G.tasks.length > 0, open = G.s.open != null ? !!G.s.open : true;
162
+ if (!has) { empty.push(G.s.name); return ''; }
163
+ const count = G.s.count || G.tasks.filter((x) => x.done).length + ' of ' + G.tasks.length + ' done';
164
+ // the head folds the stage (Wawan, 2026-11-22: "completed stage can be collapsed"); its tasks keep their date order, done ones in place
165
+ const head = `<button type="button" class="pm-group pwd-gh${G.s.now ? ' now' : ''}" data-pw-fold="${esc(G.s.key)}" aria-expanded="${open}"><b>${esc(G.s.name)}</b> <span class="pm-meta">${esc(count)}</span>${SV(open ? I.down : I.right, 14)}</button>`;
166
+ return head + (open ? G.tasks.map(li).join('') : '');
162
167
  }).join('');
163
168
  const fold = empty.length ? `<div class="pm-fold pwd-fold">${esc(empty.length === 1 ? empty[0] + ' has no tasks yet' : empty.slice(0, -1).join(', ') + ' and ' + empty[empty.length - 1] + ' have no tasks yet')}</div>` : '';
164
169
  const cap = o.ro ? '' : `<input class="pm-input pwd-cap" data-pw-cap placeholder="Add a task; say its stage, or PMOS picks one" aria-label="Add a task. Say its stage, or PMOS picks one" maxlength="200" autocomplete="off">`;
@@ -52,10 +52,10 @@ const store = {
52
52
  // 'pw-cols2': a column choice saved before round 3 (Status and Date hidden by an older tune menu) no longer hides them (round 3 point 5)
53
53
  const COLS = 'pw-cols2', SPAN = 'pw-span', BIG = 'pw-big', TLW = 'pw-tlw';
54
54
  const cols = () => ({ status: true, date: true, tl: true, kind: true, when: true, ...store.get(COLS, {}) });
55
- const ST = new Map(); // initiative id → { open, shut, doneOpen, farOpen, details, top }
55
+ const ST = new Map(); // initiative id → { open, shut, moreOpen, farOpen, details, top }
56
56
  const LOOSE = 'pw-loose'; // the initiatives whose Not in a stage row the PM opened (round 3 point 21), remembered on this computer
57
57
  const stOf = (id) => {
58
- if (!ST.has(id)) ST.set(id, { open: new Set((store.get(LOOSE, []) || []).includes(id) ? [''] : []), shut: new Set(), doneOpen: new Set(), moreOpen: new Set(), farOpen: false, details: null, top: 0, msAdd: false, focus: '' });
58
+ if (!ST.has(id)) ST.set(id, { open: new Set((store.get(LOOSE, []) || []).includes(id) ? [''] : []), shut: new Set(), moreOpen: new Set(), farOpen: false, details: null, top: 0, msAdd: false, focus: '' });
59
59
  return ST.get(id);
60
60
  };
61
61
  const looseKeep = (id, on) => { const L = (store.get(LOOSE, []) || []).filter((x) => x !== id); if (on) L.push(id); store.set(LOOSE, L.slice(-200)); };
@@ -207,12 +207,11 @@ const xOf = (W) => { const a = Date.parse(W.span.a), b = Date.parse(W.span.b); r
207
207
  function barHtml(x, W) {
208
208
  const X = xOf(W);
209
209
  if (x.kind === 'stage') return x.start || x.end ? CB.stageBar({ start: x.start, end: x.end, tone: x.tone, late: x.late, ms: x.ms, name: x.name, gaps: x.gaps, marks: x.open ? [] : x.marks }, X, { today: W.today }) : '';
210
- if (x.kind === 'done') return x.start || x.end ? CB.stageBar({ start: x.start, end: x.end, tone: 'dn' }, X, { today: W.today }) : '';
211
210
  return CB.taskBar(x, X, W.today);
212
211
  }
213
212
  function rowHtml(x, W, C, sugRows) {
214
213
  if (RO) { x = { ...x, jira: true }; sugRows = new Map(); } // a copy: a task's status, date and name are text, as a Jira task's are; no ✦
215
- const tl = C.tl ? `<div class="pw-tl">${(x.kind === 'stage' || x.kind === 'task' || x.kind === 'done') ? barHtml(x, W) : ''}${W.tx != null ? `<i class="pw-now" style="left:${W.tx.toFixed(2)}%"></i>` : ''}</div>` : '';
214
+ const tl = C.tl ? `<div class="pw-tl">${(x.kind === 'stage' || x.kind === 'task') ? barHtml(x, W) : ''}${W.tx != null ? `<i class="pw-now" style="left:${W.tx.toFixed(2)}%"></i>` : ''}</div>` : '';
216
215
  const stc = C.status ? `<span class="pw-st">${x.kind === 'task' && !x.jira ? `<button type="button" class="pw-cell" data-pw-status="${esc(x.uid)}" aria-haspopup="menu" aria-label="${esc('Status: ' + x.status + '. Change it')}">${esc(x.status)}</button>` : esc(x.status || '')}</span>` : '';
217
216
  const dtc = C.date ? `<span class="pw-dt${x.late ? ' warn' : ''}">${x.kind === 'task' && !x.jira ? `<button type="button" class="pw-cell${x.date ? '' : ' empty'}" data-pw-date="${esc(x.uid)}" aria-label="${esc((x.date ? (x.ms ? 'Milestone ' : 'Due ') + x.date : 'No date') + '. Set the date, or make it a ' + (x.ms ? 'task' : 'milestone'))}">${esc(x.date || 'Set a date')}</button>` : esc(x.date || '')}</span>` : '';
218
217
  if (x.kind === 'stage') {
@@ -223,7 +222,6 @@ function rowHtml(x, W, C, sugRows) {
223
222
  }
224
223
  if (x.kind === 'far') return `<div class="pw-tr pw-sr" role="row"><span class="pw-it"><button type="button" class="pw-stg" data-pw-far aria-expanded="false"><span class="pw-n">${esc(x.n)}</span><b>${esc(x.name)}</b>${SVG(P.right, 14)}<small>${esc(x.count)}</small></button></span>${stc}${C.date ? '<span></span>' : ''}${tl}</div>`;
225
224
  if (x.kind === 'more') return `<div class="pw-tr pw-dr" role="row"><span class="pw-it"><button type="button" class="pw-dn" data-pw-more="${esc(x.key)}" aria-expanded="false">${esc(x.label)}${SVG(P.right, 14)}</button></span>${C.status ? '<span></span>' : ''}${C.date ? '<span></span>' : ''}${C.tl ? '<div class="pw-tl"></div>' : ''}</div>`;
226
- if (x.kind === 'done') return `<div class="pw-tr pw-dr" role="row"><span class="pw-it"><button type="button" class="pw-dn" data-pw-done="${esc(x.key)}" aria-expanded="${x.open}">${esc(x.label)}${SVG(x.open ? P.down : P.right, 14)}</button></span>${C.status ? '<span></span>' : ''}${C.date ? '<span></span>' : ''}${tl}</div>`;
227
225
  const s = sugRows.get(x.uid);
228
226
  const title = x.jira ? `<span class="pw-tt">${esc(x.title)}</span>` : `<button type="button" class="pw-tt" data-pw-name="${esc(x.uid)}" aria-label="${esc('Rename ' + x.title)}">${esc(x.title)}</button>`;
229
227
  return `<div class="pw-tr pw-kr${x.done ? ' done' : ''}${x.lit ? ' lit' : ''}" role="row" data-pw-row="${esc(x.uid)}" data-pw-sec="${esc(x.sec)}"><span class="pw-it"><i class="pw-bul${x.ms ? ' ms' : ''}" aria-hidden="true"></i>${title}${RO ? '' : ib(`data-pw-open="${esc(x.uid)}"`, 'Open the task', P.open, 'xs hov') + ib(`data-pw-row-more="${esc(x.uid)}" aria-haspopup="menu"`, 'More for ' + x.title, P.more, 'xs hov')}</span>${stc}${dtc}${tl}</div>`
@@ -289,7 +287,7 @@ const keyOf = (v, o) => String((o && o.id) || (v && (v.id || v.key)) || '');
289
287
  function model(r, v, o) {
290
288
  const id = keyOf(v, o), S = stOf(id), it = ITEMS.get(id);
291
289
  const g = o.goal || goalOf(o.ws, o.board, r.anchor || v.anchor);
292
- const W = M.workOf(r, v, { ...o, goal: M.idShaped(g) ? '' : g, product: productName(o.product, o.ws), art: artOf(id, o.ws), open: S.open, shut: S.shut, doneOpen: S.doneOpen, moreOpen: S.moreOpen, farOpen: S.farOpen, focus: S.focus, mode: store.get(SPAN, 'full'), items: it || [], dropped: dropped() });
290
+ const W = M.workOf(r, v, { ...o, goal: M.idShaped(g) ? '' : g, product: productName(o.product, o.ws), art: artOf(id, o.ws), open: S.open, shut: S.shut, moreOpen: S.moreOpen, farOpen: S.farOpen, focus: S.focus, mode: store.get(SPAN, 'full'), items: it || [], dropped: dropped() });
293
291
  const mk = M.marksOf(W.span, W.today); W.tx = mk.today;
294
292
  return { W, S, id };
295
293
  }
@@ -306,13 +304,15 @@ export function html(r, v, o = {}) {
306
304
  * breakdown table with its bars and tools; List and Gantt are one remembered choice ('pw-view'). */
307
305
  const VIEW = 'pw-view';
308
306
  const allOpen = (v) => { const k = new Set(((v.tasks || {}).sections || []).filter((s) => s.kind === 'stage').map((s) => s.key)); return k; };
309
- function stagesOf(r, v, o) {
307
+ // the List (S given): every stage with tasks open but a finished one (Wawan, 2026-11-22), and the PM's own fold and unfold, shared with the
308
+ // Gantt. No S (a lookup: which stage holds a task, which stage a line names): every stage open, so every task is a row
309
+ function stagesOf(r, v, o, S) {
310
310
  const k = allOpen(v);
311
- return M.breakdownOf(r, v, { ...o, open: k, shut: new Set(), doneOpen: k, moreOpen: k, farOpen: true }).rows;
311
+ return M.breakdownOf(r, v, { ...o, openAll: true, open: S ? S.open : k, shut: S ? S.shut : new Set(), moreOpen: k, farOpen: true }).rows;
312
312
  }
313
313
  function dsHtml(r, v, o, W, S, C, mode) {
314
314
  const id = keyOf(v, o), view = store.get(VIEW, 'list') === 'gantt' ? 'gantt' : 'list';
315
- const st = stagesOf(r, v, { ...o, today: W.today, focus: S.focus });
315
+ const st = stagesOf(r, v, { ...o, today: W.today, focus: S.focus }, S);
316
316
  const wbs = view === 'gantt'
317
317
  ? breakdownHtml(W, C, mode, false, S).replace('<h3>Work breakdown</h3>', PD.wbsHead('gantt')).replace('class="pw-sec"', 'class="pw-sec pm-block pwd-blk pwd-wbs"')
318
318
  : `<section class="pm-block pwd-blk pwd-wbs" aria-label="Work breakdown">${PD.wbsHead('list')}${PD.listHtml(st, W, { looseN: W.looseN })}</section>`;
@@ -352,7 +352,6 @@ function phoneHtml(W, S, oid, v) {
352
352
  if (x.kind === 'stage' && x.loose) return '';
353
353
  if (x.kind === 'stage') return `<li class="pw-pst${x.now ? ' now' : ''}">${dot(x)}<button type="button" class="pw-pstg" data-pw-fold="${esc(x.key)}" aria-expanded="${x.open}"${x.can ? '' : ' disabled'}><span class="pw-n">${esc(x.n)}</span><b>${esc(x.name)}</b></button>${x.date ? `<span class="pw-pd${x.late ? ' warn' : ''}">${esc(x.date)}</span>` : x.can ? `<span class="pw-pd">${esc(x.count || '')}</span>` : ''}</li>`;
354
354
  if (x.kind === 'far') return `<li class="pw-pst">${dot({ status: 'To do' })}<button type="button" class="pw-pstg" data-pw-far aria-expanded="false"><span class="pw-n">${esc(x.n)}</span><b>${esc(x.name)}</b></button><span class="pw-pd">${esc(x.count)}</span></li>`;
355
- if (x.kind === 'done') return `<li class="pw-ptk"><button type="button" class="pw-dn" data-pw-done="${esc(x.key)}" aria-expanded="${x.open}">${esc(x.label)}</button></li>`;
356
355
  if (x.kind === 'more') return `<li class="pw-ptk"><button type="button" class="pw-dn" data-pw-more="${esc(x.key)}" aria-expanded="false">${esc(x.label)}</button></li>`;
357
356
  if (x.kind === 'task') return `<li class="pw-ptk${x.done ? ' done' : ''}"><i class="pw-bul${x.ms ? ' ms' : ''}" aria-hidden="true"></i><button type="button" class="pw-tt" data-pw-open="${esc(x.uid)}">${esc(x.title)}</button>${x.date ? `<span class="pw-pd${x.late ? ' warn' : ''}">${esc(x.date)}</span>` : ''}</li>`;
358
357
  return '';
@@ -508,7 +507,6 @@ export function wire(body, h0, x0) {
508
507
  if ('pwDetails' in d) { S.details = !S.details; redraw(); return; }
509
508
  if (d.pwFold != null) { const k = d.pwFold, open = b.getAttribute('aria-expanded') === 'true'; S.open.delete(k); S.shut.delete(k); (open ? S.shut : S.open).add(k); if (k === '') looseKeep(c.id, !open); redraw(); return; }
510
509
  if ('pwFar' in d) { S.farOpen = true; redraw(); return; }
511
- if (d.pwDone != null) { if (S.doneOpen.has(d.pwDone)) S.doneOpen.delete(d.pwDone); else S.doneOpen.add(d.pwDone); redraw(); return; }
512
510
  if ('pwTl' in d) { store.set(COLS, { ...cols(), tl: !cols().tl }); redraw(); return; }
513
511
  if ('pwSpan' in d) { spanMenu(b, redraw); return; }
514
512
  if (d.pwTune) { tuneMenu(b, d.pwTune, redraw); return; }
@@ -8,7 +8,7 @@
8
8
  * o { steps (Product feature's eight), today ('YYYY-MM-DD'), docs (home-ini-model.js docRows of the initiative's read), items (the
9
9
  * Library's rows for this initiative, GET /api/library-items, when that route is there), product (its name), program ({ title } | null),
10
10
  * goal (the goal's name, else the anchor), mode ('full' | 'quarter' | 'half' | 'year' | '2y' | '5y': the timeline's span), open (Set of
11
- * stage keys the PM unfolded), shut (Set of stage keys the PM folded), doneOpen (Set of stage keys whose done tasks show), farOpen (bool) }
11
+ * stage keys the PM unfolded), shut (Set of stage keys the PM folded), openAll (the List: every stage with tasks opens by itself), farOpen (bool) }
12
12
  * levelOf(L, o) → the same parts one level up: a program or a product (boards 26, 27). L: { kind, title, path, summary, facts, rows, docs, props }
13
13
  * spanOf(dates, mode, today) → { a, b } ISO the window of the timeline: Full runs from the earliest start to the latest end (no bar is cut)
14
14
  * barOf(x, span, today) → { l, w, pass, late, ms, dot } in % of the window one bar: the plan, the part that has passed, the missed date
@@ -19,9 +19,10 @@
19
19
  * 1 Overview: the summary, then "PMOS suggests" (at most three; absent when there is none), then the facts. With many tasks the Overview
20
20
  * folds to its summary and "Details" opens the facts (many: more than 6 rows of tasks in the open stage).
21
21
  * 2 A suggestion about one task sits under that task (rowSuggests by uid); the same suggestion never shows twice.
22
- * 3 The breakdown: a stage is a row that folds ("3 of 9 done"). Only the stage in progress opens by itself. In the open stage late tasks
23
- * come first, then by date; done tasks fold to one line ("3 tasks done"). The stages after the next one fold into one row
24
- * ("Prioritize to Evaluate, 5 stages").
22
+ * 3 The breakdown: a stage is a row that folds ("3 of 9 done"). Only the stage in progress opens by itself (the List: every stage with
23
+ * tasks). A stage whose tasks are all done stays folded until the PM opens it. In an open stage late open tasks come first, then every
24
+ * task by date, a done task in its place, marked done (Wawan, 2026-11-22: "it's weird to put done task on the bottom and hidden. Also
25
+ * completed stage can be collapsed"). The stages after the next one fold into one row ("Prioritize to Evaluate, 5 stages").
25
26
  * 4 Bars: light grey the plan, dark grey the part that has passed, the missed date a diamond, a red line from it to today. A row with no
26
27
  * date has no bar: PMOS does not invent a date.
27
28
  * 5 Artefacts: one table: Artefact, Kind, Updated. A core document a gate needs that is not written is a grey row that says which gate. */
@@ -121,6 +122,8 @@ const taskSpan = (ts) => {
121
122
  return [a[0] || '', b[b.length - 1] || ''];
122
123
  };
123
124
  const urgent = (a, b) => (b.late - a.late) || (a.end || '9999').localeCompare(b.end || '9999');
125
+ /** One date order for a stage's done and open tasks: a late open task first, then by date, a done task in its place. */
126
+ const inOrder = (a, b) => ((!b.closed && !!b.late) - (!a.closed && !!a.late)) || (a.end || a.start || '9999').localeCompare(b.end || b.start || '9999');
124
127
  const STATUS = { done: 'Done', now: 'In progress', next: 'To do', skip: 'Skipped' };
125
128
  const taskStatus = (x) => (x.wont ? "Won't do" : x.status || 'To do');
126
129
 
@@ -301,7 +304,7 @@ export function breakdownOf(r, v, o = {}) {
301
304
  const t = todayOf(o), list = ((v.stage || {}).ladder || []).map((s, i) => ({ name: s.name, status: s.cls, ms: !!s.ms, i }));
302
305
  const secs = (v.tasks || {}).sections || [];
303
306
  const ran = ranOf(r, secs.filter((s) => s.kind === 'stage').map((s) => ({ key: s.key, name: s.name, status: s.status })));
304
- const open = o.open || new Set(), shut = o.shut || new Set(), dOpen = o.doneOpen || new Set(), f = o.focus ? String(o.focus) : '';
307
+ const open = o.open || new Set(), shut = o.shut || new Set(), f = o.focus ? String(o.focus) : '';
305
308
  const lit = (row) => (f && row.uid != null && String(row.uid) === f ? { ...row, lit: true } : row);
306
309
  const stages = secs.filter((s) => s.kind === 'stage');
307
310
  const cur = stages.findIndex((s) => s.status === 'now');
@@ -330,7 +333,9 @@ export function breakdownOf(r, v, o = {}) {
330
333
  if (a && b && b < a) b = a;
331
334
  const live = s.status === 'now' && r.status !== 'done' && !r.ended;
332
335
  const dl = b && (s.status === 'now' || s.status === 'next') ? dateLate(b, t, live || ts.some((x) => !x.closed)) : { text: b && s.status === 'done' ? '' : '', late: false };
333
- const isOpen = holds(all, f) ? true : shut.has(s.key) ? false : open.has(s.key) ? true : s.status === 'now';
336
+ // a finished stage (every task done) folds until the PM opens it; the List opens every other stage with tasks
337
+ const finished = n > 0 && nDone === n;
338
+ const isOpen = holds(all, f) ? true : shut.has(s.key) ? false : open.has(s.key) ? true : !finished && (o.openAll || s.status === 'now');
334
339
  // the count holds every task drawn under the stage: its own and the ones in no stage that sit under it (design check, 2026-11-19)
335
340
  const nAll = n + lz.length;
336
341
  const count = nAll ? (s.status === 'next' && !nDone ? plural(nAll, 'task', 'tasks') : nDone + ' of ' + nAll + ' done') : '';
@@ -341,8 +346,8 @@ export function breakdownOf(r, v, o = {}) {
341
346
  rows.push({ kind: 'stage', key: s.key, n: s.n, name: s.name, ms: !!s.ms, status: STATUS[s.status] || '', count, date: dl.text, late: dl.late, start: a, end: b, gaps, marks, tone: s.status === 'done' ? 'dn' : s.status === 'now' ? 'now' : '',
342
347
  done: s.status === 'done', open: (isOpen || lz.length > 0) && has, can: has, now: s.status === 'now', skip: s.status === 'skip' });
343
348
  if (!((isOpen || lz.length > 0) && has)) return;
344
- const sorted = ts.slice().sort(urgent);
345
- if (s.status === 'now' && sorted.length > MANY) many = true;
349
+ if (s.status === 'now' && ts.length > MANY) many = true;
350
+ const sorted = all.slice().sort(inOrder);
346
351
  // a long stage (round 3 point 7): the late and in-progress tasks, then the next NEXT, then "N more"; the task a Today row opened always shows
347
352
  const all2 = sorted.map((x) => taskRow(x, t));
348
353
  let shown = all2;
@@ -354,12 +359,6 @@ export function breakdownOf(r, v, o = {}) {
354
359
  for (const x of shown) rows.push(lit({ ...x, sec: s.key }));
355
360
  if (shown.length < all2.length) rows.push({ kind: 'more', key: s.key, n: all2.length - shown.length, label: plural(all2.length - shown.length, 'more task', 'more tasks') });
356
361
  for (const x of lz.slice().sort(urgent)) { rows.push(lit({ ...taskRow(x, t), sec: '', loose: s.key })); loose.push({ uid: x.uid, title: x.title, to: s.key, name: s.name }); }
357
- if (nDone) {
358
- const dd = s.done.map((x) => x.end).filter(Boolean).sort();
359
- const dO = dOpen.has(s.key) || holds(s.done, f);
360
- rows.push({ kind: 'done', key: s.key, n: nDone, label: plural(nDone, 'task', 'tasks') + ' done', open: dO, start: (s.done.map((x) => x.start).filter(Boolean).sort()[0]) || dd[0] || '', end: dd[dd.length - 1] || '' });
361
- if (dO) for (const x of s.done) rows.push(lit({ ...taskRow(x, t), sec: s.key }));
362
- }
363
362
  };
364
363
  // the stages after the next one fold into one row (board 20), unless the PM opened it
365
364
  const farFrom = cur >= 0 ? cur + 2 : -1;
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Acceptance criteria from the done test (initiative ticket-acceptance-from-done-test, done test AC1-AC9): each drafted ticket carries the done-test checks that apply to it as Given / When / Then, and the checks on no ticket are listed. Synthetic kit-layout repositories. No connector, model or network.",
3
+ "modules": [
4
+ "ticket-acceptance.test.js"
5
+ ],
6
+ "seconds": {
7
+ "ticket-acceptance.test.js": 5
8
+ }
9
+ }