create-pmos 0.602.0 → 0.604.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.602.0",
3
+ "version": "0.604.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,38 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.604.0",
38
+ "at": "2026-11-18T10:31:31.776Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1349,
43
+ "t": "One item, one panel",
44
+ "s": "One item, one panel",
45
+ "k": "fix"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.603.0",
51
+ "at": "2026-11-18T08:33:37.110Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1345,
56
+ "t": "Timeline bars and axis labels start on their day, under the Today line",
57
+ "s": "Timeline bars and axis labels start on their day, under the Today line",
58
+ "k": "fix"
59
+ },
60
+ {
61
+ "n": 1346,
62
+ "t": "A finished initiative's lateness counts to when it finished, not today",
63
+ "s": "A finished initiative's lateness counts to when it finished, not today",
64
+ "k": "fix"
65
+ }
66
+ ]
67
+ },
36
68
  {
37
69
  "v": "0.602.0",
38
70
  "at": "2026-11-18T08:21:52.461Z",
@@ -284,38 +316,6 @@
284
316
  "k": "fix"
285
317
  }
286
318
  ]
287
- },
288
- {
289
- "v": "0.584.0",
290
- "at": "2026-11-17T06:55:14.683Z",
291
- "f": 4,
292
- "prs": [
293
- {
294
- "n": 1319,
295
- "t": "The product improve loop reads PMOS's stage from a hosted PMOS checkout",
296
- "s": "The product improve loop reads PMOS's stage from a hosted PMOS checkout",
297
- "k": "fix"
298
- },
299
- {
300
- "n": 1318,
301
- "t": "Read the add-directory trust prompt as a real 80-column pane draws it",
302
- "s": "Read the add-directory trust prompt as a real 80-column pane draws it",
303
- "k": "fix"
304
- }
305
- ]
306
- },
307
- {
308
- "v": "0.583.0",
309
- "at": "2026-11-17T04:07:38.209Z",
310
- "f": 4,
311
- "prs": [
312
- {
313
- "n": 1316,
314
- "t": "Answer Claude Code's add-directory trust prompt for PMOS's own chat-files folder",
315
- "s": "Answer Claude Code's add-directory trust prompt for PMOS's own chat-files folder",
316
- "k": "fix"
317
- }
318
- ]
319
319
  }
320
320
  ]
321
321
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@eb57bfa2
1
+ kernel-source: pmos@7601647c
2
2
  assembled: 2026-11-18
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-18T08:21:48Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-18T10:31:28Z"}
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-18T08:21:48Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-18T10:31:28Z"}
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-18T08:21:48Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-18T10:31:28Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,36 @@
1
1
  [
2
+ {
3
+ "v": "0.604.0",
4
+ "at": "2026-11-18T10:31:31.776Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1349,
9
+ "t": "One item, one panel",
10
+ "s": "One item, one panel",
11
+ "k": "fix"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.603.0",
17
+ "at": "2026-11-18T08:33:37.110Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1345,
22
+ "t": "Timeline bars and axis labels start on their day, under the Today line",
23
+ "s": "Timeline bars and axis labels start on their day, under the Today line",
24
+ "k": "fix"
25
+ },
26
+ {
27
+ "n": 1346,
28
+ "t": "A finished initiative's lateness counts to when it finished, not today",
29
+ "s": "A finished initiative's lateness counts to when it finished, not today",
30
+ "k": "fix"
31
+ }
32
+ ]
33
+ },
2
34
  {
3
35
  "v": "0.602.0",
4
36
  "at": "2026-11-18T08:21:52.461Z",
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Home: your list, the chat, the Viewer, My work, documents and people"
4
4
  description: "Home's list, Mentions, Your day, the chat and the Viewer; My work; documents and their copies; People; and the suggested next prompt."
5
- timestamp: 2026-11-17
5
+ timestamp: 2026-11-18
6
6
  ---
7
7
 
8
8
  # Home
@@ -119,7 +119,7 @@ Press an initiative's name in the list, or open `?ini=<id>`. The list stays as i
119
119
  - **Set a Jira ticket's dates.** Press the dates of a Jira ticket in the List, or drag its bar on the Timeline, as you do for a task. PMOS keeps the start and due days and shows them in place of the sprint end. Jira does not change. The status and the name stay Jira's.
120
120
  - **Tasks** show one row (one group) for each stage of the workflow, in order. Finished stages and later stages are never merged into one row; they start folded, and the current stage and any stage with a late task start open.
121
121
  - **Change a task where it is.** In the List, press a task's name. The row opens in place: change the name (Enter saves), the status, and the dates. Only one row is open at a time. Esc closes it. The ⋯ after the dates has **Milestone** (or **Make it a plain task**), **Move to a stage**, **Open the task card** and **Delete task**. A milestone has one date: its due day. Each change shows **Undo**.
122
- - In the List, a task's full name always shows: a long name wraps onto more lines. A short prefix such as "Bus shelter:" stays in the name, in grey. The dates show at the right. In a narrow panel or on a phone, the dates show under the name. On a computer, the Timeline's name column wraps a long name too, and its row grows; on a phone, each title stays on one line above its bar. A task with no dates shows no date; open the row to set them.
122
+ - In the List, a task's full name always shows: a long name wraps onto more lines. A short prefix such as "Bus shelter:" stays in the name, in grey. The dates show at the right. In a narrow panel or on a phone, the dates show under the name. On a computer, the Timeline's name column wraps a long name too, and its row grows; on a phone, each title stays on one line above its bar. On the Timeline, the blue Today line is your own day, from the clock of your device. Each bar starts on its start day and ends on its due day: a task that starts today starts at the Today line, and a bar, its grid line and its date at the top always meet on the same day. A task with no dates shows no date; open the row to set them.
123
123
  - **Add a task to a stage.** Press **+** on an open stage. The field opens at the top of that stage, with one row of chips under it. **Stage** is the stage you pressed + on; press it to pick another stage of the workflow. **Task** can change to **Milestone**: the box becomes ◇ and **Date** takes one day. **Dates** and **Owner** are optional; with no owner, the task is yours. Enter adds the task and keeps the field open for the next one. Esc closes the field.
124
124
  - **Move a task between stages.** On a computer, drag the grip at the left of a row. On a phone, press and hold the task's name, then drag. Drop it on a stage name to put it last in that stage, or between two rows to put it there. The status and the dates do not change. The message shows **Undo**.
125
125
  - A linked Jira ticket opens in place too. Its name and status stay Jira's ("In Progress in Jira · read 4 min ago"). Its dates can change, and it can be a milestone. It has no **Delete**.
@@ -28,6 +28,7 @@ The Viewer shows one item: an initiative, a program, a task, a document, a meeti
28
28
  - It opens beside the page. Settings › General › **Viewer opens as** makes it a popup over the page instead.
29
29
  - Drag its edge to change its width. The expand icon opens it wide. Each kind of item keeps the width you gave it.
30
30
  - It keeps one trail: a press inside it keeps the item behind, ← goes back, → goes forward, and the browser's Back and Forward move along the same trail. × or Escape closes it.
31
+ - One item shows in one Viewer only. If an item is already open, opening it again (a row, a ⌘-click, Open beside) shows it in the Viewer it is in. It never opens a second copy.
31
32
 
32
33
  ## Board and Intelligence
33
34
 
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Statuses, the lifecycle and workflows"
4
4
  description: "What each status means, the stages every initiative goes through, and the workflows of Settings › Workspaces › Workflows."
5
- timestamp: 2026-11-08
5
+ timestamp: 2026-11-18
6
6
  ---
7
7
 
8
8
  # Statuses, the lifecycle and workflows
@@ -37,6 +37,17 @@ To read the same table in the app, choose **status** in the list, then **what do
37
37
  - **On hold**, **Closed** and **Cancelled** come from your latest line in `lifecycle.jsonl`.
38
38
  - **Unknown** appears when the trunk history or a ledger cannot be read. The detail gives the reason.
39
39
 
40
+ ## Days over and days late
41
+
42
+ While an initiative is open, its card counts from its planned finish (the latest due date of its tasks) to today: **12 days left**, **ends today** or **145 days over**.
43
+
44
+ When it is finished, the count stops. Finished means it is in the last stage of its workflow (for example Closed or Done). The card then compares the planned finish with the day the work finished. That day is the end of its last Done task. If no Done task has a date, it is the day the initiative moved into its last stage.
45
+
46
+ - If it finished on or before the planned finish, the card shows no count. It says **Done** with the day it finished.
47
+ - If it finished after the planned finish, the card says **Finished N days late**. This number does not grow.
48
+
49
+ Closing an initiative late does not make it late. To clear the badge, do not change dates. The dates are the record.
50
+
40
51
  ## What you can change by hand
41
52
 
42
53
  You can hold, close, cancel or reopen an initiative. Each action writes one line to `lifecycle.jsonl` with your reason. A held, closed or cancelled initiative leaves the board and stops gating. Reopen puts it back. The detail lists every change.
@@ -55,6 +55,9 @@ function rule(info, id) {
55
55
  'There is one kind of task: the ones the PM sees in the initiative\'s Tasks section. The stage card\'s To finish entries and the older breakdown items are tasks too. '
56
56
  + 'A task\'s state is To do, In progress, Done, Won\'t do or Archived. The Tasks section groups the tasks under the stages of this initiative\'s workflow: a task\'s group is its place in the breakdown, never its state. When the PM asks to add, close, group or change a task, '
57
57
  + `do it yourself, never send the PM to the Board: \`pmos task add ${ini} "<title>" [--stage <stage>] [--due YYYY-MM-DD]\` adds one, \`pmos task list ${ini}\` names them all, \`pmos task state <task> [<task> …] --to "<state>" --why "<what shows it>"\` sets their state and \`pmos task set <task> [<task> …] --stage <stage>|none\` groups them (it also takes --due, --start, --owner, --notes; none clears a date). \`pmos task remove <task> [<task> …]\` deletes a task added by mistake when the PM asks; work that stopped is Archived instead. Never use \`pmos item add\` for new work, and never change tasks to move the initiative.`,
58
+ // batch 31 (Wawan 2026-11-18): the chat offered to rewrite a closed initiative's dates to clear "145 days over"; the count was the page's bug
59
+ 'The "N days over" badge counts from the planned finish (the latest due of its tasks). While the initiative is open it counts to today. Once it is in its workflow\'s last stage (Closed, Done) it counts to when the work really finished: the end of its last Done task, else the day it moved into that stage. On time, the badge goes away and the card says Done with that date; late, it reads "Finished N days late" and that number never grows. '
60
+ + 'Never change a date, a task or the stage to clear or shorten the badge: the dates are the record. When the PM asks why it shows, explain this rule.',
58
61
  'The Board timeline draws one bar per initiative, from the earliest start to the latest due of its tasks. An initiative with no dated task has no bar. Every stage shows there, Monitor and Evaluate included. Use these rules when the PM asks why an initiative is not on the timeline.',
59
62
  `A stage's document fills its card only through \`pmos coredoc write --scope initiative:${ini} --key wf-<stage key> --file <path>\` (the stage keys are in \`pmos workflow of ${ini}\`). It is a draft the PM issues on the page. A file written under planning/ is not linked to a card.`,
60
63
  );
@@ -68,6 +68,7 @@ function build(f) {
68
68
  statusLabel: status ? (STATUS_LABEL[status] || cap1(status)) : null, tone: status === 'on track' || status === 'done' ? 'ok' : bad ? (status === 'late' ? 'bad' : 'warn') : 'mut',
69
69
  meta: [board.name || '', row.owner || '', row.end ? 'planned finish ' + shortDate(row.end) : ''].filter(Boolean),
70
70
  stage: row.stage || null, stageNote: row.stageSource === 'derived' ? 'derived by the workflow engine' : null,
71
+ closed: !!row.closed, // batch 31: in its workflow's last stage, so a passed planned finish is not over (premium-initiative-head.js)
71
72
  oneStage: row.oneStage || null, // W1: the one stage and what set it (lib/one-stage.js); the stage card and the chip draw it
72
73
  strip: { names, seg: names.map((n, j) => (j < cur ? 'p' : j === cur ? 'n' : '')), cur: cur >= 0 ? cur : null },
73
74
  };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.602.0",
3
+ "version": "0.604.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.602.0",
9
+ "version": "0.604.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.602.0",
3
+ "version": "0.604.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",
@@ -187,6 +187,16 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
187
187
  const l6c = await until(() => lay(A.page).then((l) => { const t = l.panels.filter((p) => p.kind === 'viewer' && p.box.shown); return t.length === 2 && t.some((p) => p.title !== t6[0] && p.title !== t6[1]) ? l : null; }), 6000);
188
188
  const t6c = l6c ? l6c.panels.filter((p) => p.kind === 'viewer' && p.box.shown).map((p) => p.title) : []; // the one giving way closes a moment later
189
189
  ok('N6 a third Viewer at 1440 replaces the one used least recently (still two side by side)', !!l6c && !t6c.includes(t6[0]) && t6c.includes(t6[1]), JSON.stringify([t6c, await lay(A.page)]));
190
+ // one item, one Viewer (batch 31 item 10): opening beside an item already shown does not copy it; bodyOf finds its own Viewer
191
+ const dup = await A.page.evaluate(async () => {
192
+ const it = { id: 'dup-one', kind: 'Note', title: 'Shown once', html: '<p class="dup-a">a</p>' };
193
+ window.czPanels.openBeside(it); await new Promise((r) => setTimeout(r, 400));
194
+ window.czPanels.openBeside({ ...it, html: '<p class="dup-b">b</p>' }); await new Promise((r) => setTimeout(r, 400));
195
+ const open = [...document.querySelectorAll('.cz-vw')].filter((e) => !e.hidden && e.querySelector('.cz-vw-body .dup-a, .cz-vw-body .dup-b'));
196
+ const b = window.czViewer.bodyOf('dup-one');
197
+ return { n: open.length, own: !!b && open.length === 1 && open[0].contains(b), b: !!(b && b.querySelector('.dup-b')) };
198
+ });
199
+ ok('N6 the same item opened beside twice stays in one Viewer, shown again there; czViewer.bodyOf finds that Viewer', dup.n === 1 && dup.own && dup.b, JSON.stringify(dup));
190
200
  ok('0 no page error at 1440', A.errors.length === 0, A.errors.join(' | '));
191
201
  await A.close();
192
202
 
@@ -271,7 +271,7 @@ export function openIni(r, from, o = {}) {
271
271
  apply: (k) => { const y = O.rowOf(r.key) || x; y.kind = k; VW.setPresses(vidOf(y), [WK.pressOf(k)].concat(dashFor(y) ? dashFor(y).presses() : [])); if (O.redraw) O.redraw(); refresh(true); },
272
272
  reload: async () => { if (O.reload) await O.reload(); } }), !!((O.M() || {}).board || {}).factory);
273
273
  },
274
- render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
274
+ render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null, vid: vidOf(x) }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
275
275
  onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
276
276
  }
277
277
 
@@ -288,7 +288,7 @@ export function openTicket(r, k, from) {
288
288
  const c = VW.current && VW.current(), back = !!(c && c.id === vidOf(r));
289
289
  const it = TI(r), tr = it && it.tickets ? it.tickets[k.key] || null : null, M = O.M() || {}, B = M.board || {};
290
290
  O.onShow(r.key, back ? null : from);
291
- cur = { key: r.key, tk: k.key };
291
+ cur = { key: r.key, tk: k.key, vid: vidOf(r) };
292
292
  TV.openTicketView({ ws: r.ws || B.ws || '', board: r.boardId || B.id || '', ini: r.id || '', iniTitle: r.title, ref: k.key, base: k, trail: tr, stage: tkStage(r), release: r.release || null,
293
293
  readAt: (M.jira && M.jira.readAt) || '', back, blockerTitle, askHref: (q) => O.askHref(r, q),
294
294
  refresh: M.jira ? () => O.refreshJira() : null,
@@ -299,15 +299,17 @@ export function openTicket(r, k, from) {
299
299
 
300
300
  /** The shown item drawn again from the new read, in place. A row that left the Board closes it. */
301
301
  export function refresh(force) {
302
- if (!cur || !VW.isOpen()) return;
302
+ if (!cur) return;
303
303
  const r = O.rowOf(cur.key); if (!r || !r.track) { close(); return; }
304
- const b = VW.body(); if (!b || (!force && document.activeElement && b.contains(document.activeElement))) return;
304
+ // the Viewer that shows this initiative, not the one used last (a chat beside it took the initiative's body, batch 31 item 10)
305
+ const b = VW.bodyOf(vidOf(r)); if (!b || (!force && document.activeElement && b.contains(document.activeElement))) return;
305
306
  if (cur.tk) return; // the ticket Viewer reads its own records (tk-view.js); Read Jira again opens it fresh
306
307
  const top = b.scrollTop;
307
308
  b.innerHTML = iniBody(r);
308
309
  b.scrollTop = top;
309
310
  }
310
- export function close() { if (cur) { cur = null; VW.close(); } }
311
+ /** Close the initiative's own Viewer (never the chat beside it). A ticket drilled in shows under its own id: the Viewer used last, as before. */
312
+ export function close() { if (!cur) return; const c = cur; cur = null; if (!c.tk && VW.bodyOf(c.vid)) VW.closeOf(c.vid); else VW.close(); }
311
313
  export const shown = () => (cur ? cur.key : null);
312
314
  export function mount(o) {
313
315
  O = o; ensurePopCss();
@@ -470,6 +470,7 @@ function onViewer(d) {
470
470
  if (d.shut) { drop(d.panel); S.fr = []; layout(); return; }
471
471
  mark(d.panel);
472
472
  if (S.row.includes(d.panel) || S.over === d.panel || S.away.includes(d.panel)) {
473
+ S.pend = null; // an open beside of an item already shown lands in its Viewer (one item, one Viewer): nothing new to place
473
474
  if (S.away.includes(d.panel)) { drop(d.panel); if (S.over) S.away.push(S.over); S.over = d.panel; } // a plain click into the Viewer put away: it slides back over
474
475
  layout(); return;
475
476
  }
@@ -589,8 +589,12 @@ function retitle0(id, title) { if (V.cur && V.cur.id === String(id) && title) {
589
589
 
590
590
  /** Show one item in the Viewer, in place of the one shown. Returns the body element the content is in. */
591
591
  export function open(it) {
592
- const o = it || {};
593
- use(o._inst || (o.into && byP(o.into)) || pick(o)); // into: a panel id ('v1'), the Viewer that shows it (the Board's chat panel)
592
+ let o = it || {};
593
+ let x = o._inst || (o.into && byP(o.into)) || pick(o); // into: a panel id ('v1'), the Viewer that shows it (the Board's chat panel)
594
+ // one item, one Viewer (batch 31 item 10): an item already shown in another Viewer is not opened twice; that Viewer shows it again
595
+ const twin = !o._inst && o.id != null ? ALL.find((y) => y !== x && shown(y) && y.cur.id === String(o.id)) : null;
596
+ if (twin) { x.drill = false; x = twin; o = { ...o, keep: true, fresh: false }; }
597
+ use(x);
594
598
  // an item with unsaved changes asks first; the open goes on when it says so (and keeps a drill-in asked for before it)
595
599
  if (!o._asked && V.cur && typeof V.cur.guard === 'function') {
596
600
  const dr = V.drill; let now = true, ran = false;
@@ -670,6 +674,11 @@ export function close(o = {}) {
670
674
  export const isOpen = () => !!(V.el && !V.el.hidden && V.cur);
671
675
  export const current = () => (V.cur ? { id: V.cur.id, kind: V.cur.kind, title: V.cur.title, url: V.cur.url } : null);
672
676
  export const body = () => (isOpen() ? V.el.querySelector('.cz-vw-body') : null);
677
+ /** The body of the Viewer that shows item id, whichever Viewer was used last (null: no Viewer shows it). A page that draws an item again
678
+ * after a read uses this, so it never draws into another Viewer (the chat beside it, batch 31 item 10). */
679
+ export const bodyOf = (id) => { const x = ALL.find((y) => shown(y) && y.cur.id === String(id)); return x ? x.el.querySelector('.cz-vw-body') : null; };
680
+ /** Close the Viewer that shows item id (nothing else). */
681
+ export function closeOf(id) { const x = ALL.find((y) => shown(y) && y.cur.id === String(id)); if (x) { use(x); close(); } }
673
682
  export function onChange(fn) { if (typeof fn === 'function') G.subs.push(fn); }
674
683
  /** Open the Viewer on a feature the design does not draw yet. */
675
684
  export function placeholder(featureName, o = {}) {
@@ -807,4 +816,4 @@ export const panels = {
807
816
  rest() { ALL.filter(shown).forEach((x) => on(x, () => { const k = widthOf(V.cur.kind); V.wide = false; apply(k || room().def); redraw(); })); },
808
817
  rail(v) { setRail(!!v); }, railOn: () => G.rail, owned, chosen,
809
818
  };
810
- if (typeof window !== 'undefined') window.czViewer = { open, close, back, forward, trail, replaceUrl, drill, setPresses, setChip, setCheck, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, railCard, railSync, keepWide, ICONS };
819
+ if (typeof window !== 'undefined') window.czViewer = { open, close, closeOf, bodyOf, back, forward, trail, replaceUrl, drill, setPresses, setChip, setCheck, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, railCard, railSync, keepWide, ICONS };
@@ -69,6 +69,10 @@ export const setKanbanStage = (id, key) => { if (id && key != null) STAGE.set(id
69
69
  /* ── days, as whole numbers (UTC, so a summer-time night never moves a bar) ── */
70
70
  const DAY = /^(\d{4})-(\d{2})-(\d{2})/;
71
71
  export const dn = (iso) => { const m = DAY.exec(String(iso || '')); return m ? Math.round(Date.UTC(+m[1], +m[2] - 1, +m[3]) / 864e5) : null; };
72
+ // today is the PM's own day: the view's day (the model's), else the day on this device's clock. Never a rounded UTC day: that is tomorrow
73
+ // after 12:00 UTC and yesterday before 08:00 in Singapore (batch 31 item 7)
74
+ export const localDay = (now = Date.now()) => { const d = new Date(now); return Math.round(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()) / 864e5); };
75
+ export const todayOf = (v, now) => { const n = dn(v && v.today); return n != null ? n : localDay(now); };
72
76
  export const isoN = (n) => new Date(n * 864e5).toISOString().slice(0, 10);
73
77
  export const md = (n) => { const d = new Date(n * 864e5); return MON[d.getUTCMonth()] + ' ' + d.getUTCDate(); };
74
78
  /** "Nov 4 → 13", "Nov 28 → Dec 3", "Nov 4": the tip while a bar drags, in the List's words. */
@@ -265,7 +269,7 @@ export function timelineCols() {
265
269
  export function setTimelineCols(keys) { TC = TCOLS.map((c) => c[0]).filter((k) => keys.includes(k)); store.set('pmos.tasks.cols.timeline', JSON.stringify(TC)); }
266
270
  export function timelineHtml(v, o, isOpen) {
267
271
  if (zoomOf() === 'all') return allHtml(v, o, isOpen);
268
- const today = dn(v.today) || Math.round(Date.now() / 864e5), z = ZOOMS.find((x) => x[0] === zoomOf());
272
+ const today = todayOf(v), z = ZOOMS.find((x) => x[0] === zoomOf());
269
273
  const S = v.tasks.sections;
270
274
  // the tasks with no dates share one row at the foot, "N without dates · Set" (XvpA3bMonths), in place of a dashed press on each row
271
275
  const undated = (x) => !x.closed && dn(x.start) == null && dn(x.end) == null;
@@ -442,7 +446,7 @@ const short = (n) => "\u2019" + String(new Date(n * 864e5).getUTCFullYear()).sli
442
446
  /** "Oct 9 – Nov 27", "Dec 14 – 18", "Mar 1": a stage's days in the name column. */
443
447
  const rng = (a, b) => { if (a === b) return md(a); const x = new Date(a * 864e5), y = new Date(b * 864e5); return md(a) + ' \u2013 ' + (x.getUTCMonth() === y.getUTCMonth() && x.getUTCFullYear() === y.getUTCFullYear() ? y.getUTCDate() : md(b)); };
444
448
  export function allHtml(v, o, isOpen) {
445
- const S = v.tasks.sections, today = dn(v.today) || Math.round(Date.now() / 864e5);
449
+ const S = v.tasks.sections, today = todayOf(v);
446
450
  const rowsOf = (sec) => flat(sec).concat(flatDone(sec));
447
451
  const spanOf = (sec) => {
448
452
  const ds = rowsOf(sec).filter((x) => !x.wont).flatMap((x) => [dn(x.start), dn(x.end)]).concat(jiraOf(sec).flatMap((k) => [dn(k.start), dn(k.due)])).filter((n) => n != null);
@@ -182,6 +182,18 @@ export function bodyOf(rows, archived = []) {
182
182
  }
183
183
  const countOf = (open, late, done) => (late && late === open ? late + ' late' : late ? late + ' late · ' + open + ' open' : open ? open + ' open' : done ? done + ' done' : '');
184
184
 
185
+ /** When finished work really finished, and how late that was against its plan (batch 31, Wawan 2026-11-18: a Closed initiative read "145 days
186
+ * over" because the count ran to today). The finish is the latest end of its Done tasks, else the day it moved into its current (last) stage,
187
+ * else null. r: the row (end: the planned finish); rows: its task rows (rowOf); ran: the dates each stage ran; cur: the current stage's index.
188
+ * → { at: 'YYYY-MM-DD' | '', slip: whole days after the planned finish, 0 when on time or unknown }. Pure; it never reads today. */
189
+ export function finishOf(r, rows = [], ran = [], cur = -1) {
190
+ const ends = (rows || []).filter((x) => x && x.done && dayOf(x.end)).map((x) => String(x.end).slice(0, 10)).sort();
191
+ const moved = cur >= 0 && ran[cur] && dayOf(ran[cur].from) ? String(ran[cur].from).slice(0, 10) : '';
192
+ const at = ends.length ? ends[ends.length - 1] : moved;
193
+ const end = dayOf(r && r.end), d = dayOf(at);
194
+ return { at, slip: end && d && d > end ? between(end, d) : 0 };
195
+ }
196
+
185
197
  /* ── the view ── */
186
198
  export function iniView(r, ctx = {}) {
187
199
  const today = todayOf(ctx), t = r.track || {}, tr = r.trail || {};
@@ -224,12 +236,16 @@ export function iniView(r, ctx = {}) {
224
236
  : curRows.length ? curRows.filter((x) => x.closed).length + ' of ' + curRows.length + ' done' : '';
225
237
  // days in the stage: the trail's (when it entered the stage) first, then the track's
226
238
  const days = tr.days != null ? tr.days : tr.since && dayOf(tr.since) ? Math.max(0, between(dayOf(tr.since), today)) : t.days != null ? t.days : null, usual = ctx.usual && ctx.usual.days != null ? ctx.usual.days : null;
227
- const end = dayOf(r.end), fc = dayOf(t.forecast), finished = r.status === 'done' || r.status === 'cancelled';
239
+ const end = dayOf(r.end), fc = dayOf(t.forecast), finished = r.status === 'done' || r.status === 'cancelled' || !!r.closed;
240
+ // batch 31: finished work is measured against when it finished, never today (finishOf): on time says nothing, late is a fixed slip
241
+ const fin = finished && r.status !== 'cancelled' ? finishOf(r, rows, ran, cur) : null;
228
242
  const dates = (r.start || r.end) ? {
229
243
  start: r.start ? dateY(r.start, today) : '',
230
244
  end: r.end ? dateY(r.end, today) : '',
231
- left: end && !finished ? (end < today ? plural(between(end, today), 'day', 'days') + ' over' : end > today ? plural(between(today, end), 'day', 'days') + ' left' : 'ends today') : '',
232
- over: !!(end && end < today && !finished),
245
+ left: end && !finished ? (end < today ? plural(between(end, today), 'day', 'days') + ' over' : end > today ? plural(between(today, end), 'day', 'days') + ' left' : 'ends today')
246
+ : fin && fin.slip > 0 ? 'Finished ' + plural(fin.slip, 'day', 'days') + ' late' : '',
247
+ over: !!(end && end < today && !finished) || !!(fin && fin.slip > 0),
248
+ ...(fin && fin.at ? { doneAt: fin.at } : {}),
233
249
  jira: fc && (!end || fc > end) && !finished ? dateY(t.forecast, today) : '',
234
250
  // the numbers behind "N days left" (the mission's readouts): the plan's length, the days gone (negative before the start), the days left (negative once over); none once finished or with one date
235
251
  n: r.start && end && !finished ? { total: between(dayOf(r.start), end), gone: between(dayOf(r.start), today), left: between(today, end) } : null,
@@ -238,7 +254,7 @@ export function iniView(r, ctx = {}) {
238
254
  // Won't do and Archived hold their stage (D99 wfRules): no next stage to move to
239
255
  if (cur >= 0 && !r.ended && r.status !== 'done' && r.status !== 'cancelled') { const n = list.slice(cur + 1).find((s) => s.status !== 'skip'); if (n) nx = { key: n.key, name: n.name, ms: n.ms, moves: n.ms && r.kr ? r.kr : '' }; }
240
256
  // the stage card is one line (batch 11 item 21, agreed A): each stage on its own dates, the milestone tasks as ◇, the Board's states
241
- const line = lineOf(r, { list, cur, ran, rows, today, deps: tr.deps || [] });
257
+ const line = lineOf(r, { list, cur, ran, rows, today, deps: tr.deps || [], doneAt: fin && fin.at ? fin.at : '' });
242
258
  const ready = !!nx && curRows.length > 0 && curRows.every((x) => x.closed); // every task of the stage done: the → turns blue (state 1)
243
259
  // the way to finish the stage (R5): the stage's count, and its milestone tasks, the open ones by date, the done ones counted
244
260
  const msRows = curRows.filter((x) => x.ms && !x.wont);
@@ -293,6 +293,10 @@ button.iv-bxw.jr:hover .iv-cb { box-shadow: 0 0 0 3px var(--cz-well); }
293
293
  /* batch 25 item 4 (TaskNamesWrap, agreed A): on a desktop a task's name is never cut in the Timeline either. It wraps in the name column;
294
294
  * the row grows and its bar stays in the middle. (A phone keeps each title on one line above its bar.) */
295
295
  @container (min-width: 521px) {
296
+ /* every row's timeline starts at exactly --nw, where the grid and the Today line are: the name cell's padding sits inside its width.
297
+ * Without it a task's bar drew 44 px (two days at Weeks) and an axis label 24 px after its day (batch 31 item 7). A stage row's
298
+ * timeline is placed at --nw on its own (.ivt-r.g .ivt-c), so its name cell keeps its size. */
299
+ .ivt-r:not(.g) > .ivt-n { box-sizing: border-box; }
296
300
  .ivt-r.k .ivt-n { padding-top: 7px; padding-bottom: 7px; }
297
301
  .ivt-r.k .ivt-n .iv-tt { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: break-word; line-height: 1.35; flex: 1 1 0; }
298
302
  /* the days of a hidden Start or Due column sit under the name, not beside it (the name keeps the width) */
@@ -168,7 +168,7 @@ export function headModel(M, now = Date.now()) {
168
168
  time = 'In ' + cur.label + ' for ' + plural(n, 'day', 'days') + (usual != null ? ' · usually ' + usual : ''); over = usual != null && n > usual;
169
169
  clock = { n, usual, over }; // stage card D: "4 of ~6 days", amber when over; only from a record that holds the day it entered
170
170
  } else if (finish && cur) {
171
- time = 'In ' + cur.label + ' · ' + finish; over = !!end && end < new Date(new Date(now).getFullYear(), new Date(now).getMonth(), new Date(now).getDate()) && life !== 'done';
171
+ time = 'In ' + cur.label + ' · ' + finish; over = !!end && end < new Date(new Date(now).getFullYear(), new Date(now).getMonth(), new Date(now).getDate()) && life !== 'done' && !head.closed;
172
172
  } else if (cur) time = 'In ' + cur.label + ' · time in this stage is not recorded';
173
173
  // one CTA: your step when it waits on you, else a question for the read-only agent
174
174
  const cta = turn === 'you' ? (CTA_SAY[step] || ('Open ' + (step || 'the next step'))) : turn === 'stalled' ? 'Ask what is stuck' : turn === 'jira' ? 'Ask about the tickets' : 'Ask what is next';
@@ -98,7 +98,7 @@ function skipsOf(parts, P, B) {
98
98
  /** The model of the line. See the head of this file. */
99
99
  export function lineOf(r, o = {}) {
100
100
  const t = day(o.today) || day(new Date()), list = o.list || [], ran = o.ran || [], rows = o.rows || [];
101
- const finished = r.status === 'done', ended = finished || !!r.ended || r.status === 'cancelled';
101
+ const finished = r.status === 'done' || !!r.closed, ended = finished || !!r.ended || r.status === 'cancelled'; // closed: its workflow's last stage (batch 31)
102
102
  const s0 = day(r.start), e0 = day(r.end), fc0 = r.track && day(r.track.forecast);
103
103
  const draft = !s0 && !e0 && r.draft && day(r.draft.start) ? { name: r.draft.name || 'Draft', a: day(r.draft.start), b: day(r.draft.end) || day(r.draft.start) } : null;
104
104
  const S = draft ? draft.a : s0, E = draft ? draft.b : e0;
@@ -142,7 +142,7 @@ export function lineOf(r, o = {}) {
142
142
 
143
143
  // the clock's place: a hold says when it comes back (the clock stops), done says when it ended, a draft names itself
144
144
  let chip = null;
145
- if (finished) chip = { text: E ? 'Done ' + md(E, t) : 'Done', tone: 'q' };
145
+ if (finished) { const D = day(o.doneAt) || E; chip = { text: D ? 'Done ' + md(D, t) : 'Done', tone: 'q' }; } // o.doneAt: when it really finished (ini-view-model.js finishOf)
146
146
  else if (openHold && openHold.kind === 'over') chip = { text: 'Back ' + md(day(openHold.h.back), t) + ' · ' + plural(days(day(openHold.h.back), t), 'day', 'days') + ' late', tone: 'late', pause: true };
147
147
  else if (openHold && openHold.kind === 'open') chip = { text: 'Back ' + md(openHold.b, t), tone: 'q', pause: true };
148
148
  else if (openHold) chip = { text: 'On hold', tone: 'q', pause: true };