create-pmos 0.663.0 → 0.665.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.663.0",
3
+ "version": "0.665.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -33,6 +33,25 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.665.0",
38
+ "at": "2026-11-22T04:21:42.729Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1448,
43
+ "t": "Check launch readiness before go-live",
44
+ "s": "Check launch readiness before go-live",
45
+ "k": "new"
46
+ },
47
+ {
48
+ "n": 1452,
49
+ "t": "A task opened from a place is the full popup from design system blocks",
50
+ "s": "A task opened from a place is the full popup from design system blocks",
51
+ "k": "new"
52
+ }
53
+ ]
54
+ },
36
55
  {
37
56
  "v": "0.663.0",
38
57
  "at": "2026-11-22T04:09:31.042Z",
@@ -321,19 +340,6 @@
321
340
  "k": "fix"
322
341
  }
323
342
  ]
324
- },
325
- {
326
- "v": "0.633.0",
327
- "at": "2026-11-19T13:29:42.454Z",
328
- "f": 4,
329
- "prs": [
330
- {
331
- "n": 1415,
332
- "t": "Build the agreed phone design (Ph2 boards)",
333
- "s": "Build the agreed phone design (Ph2 boards)",
334
- "k": "new"
335
- }
336
- ]
337
343
  }
338
344
  ]
339
345
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@41fb08b4
1
+ kernel-source: pmos@6d64f247
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-22T04:09:27Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T04:21:39Z"}
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-22T04:09:27Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T04:21:39Z"}
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-22T04:09:27Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-22T04:21:39Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -63,7 +63,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
63
63
  await T.waitForServer(BASE);
64
64
  browser = classicBoard(await chromium.launch({ executablePath: exe }));
65
65
 
66
- const open = async ({ w = 1440, h = 900, theme = 'light', model = mk(), answers = null, bm = BMR, q = '', pick = null } = {}) => {
66
+ const open = async ({ w = 1440, h = 900, theme = 'light', model = mk(), answers = null, bm = BMR, q = '', pick = null, tab = 'goals' } = {}) => {
67
67
  const ctx = await browser.newContext({ viewport: { width: w, height: h } });
68
68
  const page = await ctx.newPage();
69
69
  let current = model, calls = 0; const errors = [], posts = [];
@@ -78,7 +78,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
78
78
  if (r.request().method() === 'POST') { pk.on = JSON.parse(r.request().postData() || '{}').on; pk.posts.push(pk.on); }
79
79
  r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, all: false, chosen: true, products: reg.map((x, i) => ({ ...x, home: false, primary: !i, initials: null, on: pk.on.includes(x.ws) })) }) });
80
80
  });
81
- await page.goto(BASE + '/premium-intelligence.html?theme=' + theme + '&tab=goals' + q); // key results live on Goals: ?tab=goals shows them here (intelligence-ds-page)
81
+ await page.goto(BASE + '/premium-intelligence.html?theme=' + theme + (tab ? '&tab=' + tab : '') + q); // key results live on Goals: ?tab=goals shows them here (intelligence-ds-page)
82
82
  const up = await until(() => page.evaluate(() => document.querySelectorAll('#goalTbl .ins-row').length > 0 || /could not be read/.test(document.querySelector('#brief').textContent) || !!document.querySelector('#goalTbl .ins-empty')), 20000);
83
83
  return { ctx, page, errors, posts, up, pk, calls: () => calls, setModel: (m) => { current = m; } };
84
84
  };
@@ -292,6 +292,34 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
292
292
  ok('I9 no demo label, and the page makes no write request on its own', !(await p.evaluate(() => /demo/i.test(document.querySelector('main.stage').textContent))) && A.posts.length === 0, A.posts.join());
293
293
  }
294
294
 
295
+ /* C4 + C6 (intelligence-ds-page): the default desk view, with no ?tab=goals. Key results step aside; Delivery trends is its own block with
296
+ * Choose tiles; a phone keeps its goal cards. */
297
+ { const D = await open({ tab: '' }); const dp = D.page;
298
+ await until(() => dp.evaluate(() => !!document.querySelector('#trendBox:not([hidden]) #bmBody [data-tile]')), 10000);
299
+ const dv = await dp.evaluate(() => { const tb = document.querySelector('#trendBox'), g = document.querySelector('#pGoals'); return { krs: document.body.classList.contains('ins-krs'), goals: getComputedStyle(g).display, block: tb.matches('section.pm-block') && !tb.hidden && tb.parentElement === g.parentElement, inGoals: !!g.querySelector('#trendBox'), h: (tb.querySelector('#hTr') || {}).textContent, tiles: tb.querySelectorAll('#bmBody [data-tile]').length, chooser: (tb.querySelector('#tileB') || { getAttribute: () => '' }).getAttribute('aria-label'), menu: !!document.querySelector('#tileMenu') }; });
300
+ ok('C6 on a desk the default view shows no key results: the table is in the page but hidden, and ?tab=goals is what shows it', !dv.krs && dv.goals === 'none', JSON.stringify(dv));
301
+ ok('C4 on the default view Delivery trends is a pm-block of its own (not inside key results), with its tiles and Choose tiles, its menu shut', dv.block && !dv.inGoals && dv.h === 'Delivery trends' && dv.tiles >= 3 && dv.chooser === 'Choose tiles' && !dv.menu, JSON.stringify(dv));
302
+ await dp.click('#tileB');
303
+ const mn = await until(() => dp.evaluate(() => { const m = document.querySelector('#tileMenu'); return m ? [...m.querySelectorAll('.pm-switch[role="switch"]')].map((s) => s.dataset.tileon + ':' + s.getAttribute('aria-checked')) : null; }), 3000);
304
+ ok('C4 Choose tiles opens a menu with one switch per tile, all on', !!mn && mn.length === dv.tiles && mn.every((x) => /:true$/.test(x)), JSON.stringify(mn));
305
+ const k0 = mn && mn[0].split(':')[0];
306
+ await dp.click(`#tileMenu [data-tileon="${k0}"]`);
307
+ const off = await until(() => dp.evaluate((k) => !document.querySelector(`#bmBody [data-tile="${k}"]`) && document.querySelector(`#tileMenu [data-tileon="${k}"]`).getAttribute('aria-checked') === 'false', k0), 3000);
308
+ ok('C4 a switch turned off takes its tile out of the block', !!off, k0);
309
+ await dp.click(`#tileMenu [data-tileon="${k0}"]`);
310
+ ok('C4 turned on again, the tile comes back', !!(await until(() => dp.evaluate((k) => !!document.querySelector(`#bmBody [data-tile="${k}"]`), k0), 3000)));
311
+ await dp.click('#tileB');
312
+ await dp.click('#trendBox [data-tile="merges"]');
313
+ ok('C4 on the default view a tile press opens the tile in the Viewer', !!(await until(() => dp.evaluate(() => { const v = document.querySelector('#czViewer'); return v && !v.hidden && !!v.querySelector('[data-tgset]'); }), 3000)));
314
+ await dp.click('#czViewer [data-tgset]');
315
+ ok('C4 and its Set target opens the target popover over the tiles', !!(await until(() => dp.evaluate(() => !!document.querySelector('#tgPop')), 3000)));
316
+ ok('C4 no page error on the default view', D.errors.length === 0, D.errors.join(' | '));
317
+ await D.ctx.close();
318
+ const P = await open({ tab: '', w: 390, h: 844 });
319
+ const ph = await P.page.evaluate(() => ({ goals: getComputedStyle(document.querySelector('#pGoals')).display, cards: [...document.querySelectorAll('#goalCards .ins-card')].filter((c) => c.getBoundingClientRect().height > 0).map((c) => c.dataset.goal).join() }));
320
+ ok('C6 a phone keeps its goal cards on the default view (the phone page does not change)', ph.goals !== 'none' && ph.cards === 'krm-act,krm-up,krm-ttfc,krm-nps', JSON.stringify(ph));
321
+ await P.ctx.close(); }
322
+
295
323
  /* D: New dashboard (AgInsNewDash), describe, the saved view, Edit chart (AgInsChart) and the pin */
296
324
  {
297
325
  const R = await open(), q = R.page, sent = [];
@@ -1,4 +1,23 @@
1
1
  [
2
+ {
3
+ "v": "0.665.0",
4
+ "at": "2026-11-22T04:21:42.729Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1448,
9
+ "t": "Check launch readiness before go-live",
10
+ "s": "Check launch readiness before go-live",
11
+ "k": "new"
12
+ },
13
+ {
14
+ "n": 1452,
15
+ "t": "A task opened from a place is the full popup from design system blocks",
16
+ "s": "A task opened from a place is the full popup from design system blocks",
17
+ "k": "new"
18
+ }
19
+ ]
20
+ },
2
21
  {
3
22
  "v": "0.663.0",
4
23
  "at": "2026-11-22T04:09:31.042Z",
@@ -703,6 +703,13 @@ The skills that read your tools save their reads with these commands. [Settings,
703
703
  - `pmos calendar import --from <file|-> --sensitivity <label>` saves the events the agent read. The label is `public`, `internal`, `confidential` or `private`. `--dry-run` checks the file and saves nothing.
704
704
  - `pmos calendar status` says how many events are saved and when they were read.
705
705
 
706
+ ### pmos launch
707
+
708
+ Before a launch date, `pmos launch` lists what is not ready in one place. It reads the initiative's tasks, its last tracker reading, its sign-offs and the day's question list. It calls no tracker, sends nothing and writes no record, so read the tracker first.
709
+
710
+ - `pmos launch check <initiative> [--date YYYY-MM-DD]` shows the launch date, a verdict (ready, at risk or no data) and each item that is not ready: open tasks (past their date, or due after the launch), tracker tickets still open (with the days since they moved and any block), sign-offs with no answer, and open questions. The launch date is `--date`, else a ◇ milestone named launch, go-live, release or ship, else the committed end, else the last ◇ milestone. With none, the command asks for `--date`. A tracker reading older than 2 days gives a warning.
711
+ - `pmos launch list [--days N]` lists every initiative with a launch in the next N days (14 by default), with its verdict and the number of items not ready.
712
+
706
713
  ### pmos tracker
707
714
 
708
715
  - `pmos tracker done [--moved N] [--left N] [--not-found N]` records the time of the read for this repository and the counts of what it found. It moves no item.
@@ -116,6 +116,14 @@ The Viewer shows one item: an initiative, a program, a task, a document, a meeti
116
116
  - On a page drawn from the PMOS design system (Today, Home, an item on its own page), the parts inside the Viewer card follow the system too: a meeting, the calendar and a report use its corners, its buttons and its switches. A word button has a small corner, a switch looks like tabs, and a chip or a tag stays round.
117
117
  - 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.
118
118
 
119
+ ### A task opened from a place
120
+
121
+ On a computer, a PMOS task you open from Events, Today, Goals or Search opens as one full popup, in the middle of the page. Home keeps its Viewer until Home is rebuilt, and a Jira ticket keeps the ticket Viewer.
122
+
123
+ - The top line has **Close**, the path (product › initiative › Jira key), the Jira chip, the chat button, ⋯ and ×. Press the initiative's name to open the initiative. One line under the name says Task or Milestone, who has it, when it is due and its stage.
124
+ - The left column has three blocks. **Where it stands** says who has it, its status, when it is due or how many days late it is, what waits on you and which initiative it moves. A task with no due date says so. **Linked** lists the initiative, the Jira ticket and each link in the notes; with nothing linked, the block does not show. **Activity** lists PMOS's kept changes, newest first: three, then **Earlier**. A change from the last 7 days has **Undo**.
125
+ - The right column is the task card: status, dates, owner, notes and every change you can make there, each with **Undo**.
126
+
119
127
  ## Work and its chat, in one popup
120
128
 
121
129
  On a computer, an initiative you open from Home, Board or Intelligence opens in one popup over the page. The work is on the left and the chat about the same work is on the right. A thin dimmed edge of the page shows around it. Escape, × or a press on the edge closes it.
@@ -94,6 +94,11 @@ const WEEKLY = { view: 'view', weeks: 3, day: 'Mon', opens: 4 };
94
94
  const s0 = await until(() => p.evaluate(() => { const m = document.querySelector('#insMv'); const b = document.querySelector('#insAct [data-mv="apply"]'); return m && !m.hidden && b ? { mv: m.textContent, label: b.getAttribute('aria-label'), text: b.textContent.trim(), solid: b.classList.contains('primary'), two: document.querySelector('#insHero').classList.contains('mv') } : null; }), 5000);
95
95
  ok('S the drafted move is the expanded Suggestion under the finding (its label, then PMOS will …), with a primary ✓ that is icon-only', !!s0 && s0.mv.startsWith(MOVE.label) && s0.mv.includes('PMOS will' + MOVE.text) && s0.label === MOVE.label && !s0.text && s0.solid && s0.two, JSON.stringify(s0));
96
96
  await shot(p, 'gap1-strip-move', '#insHero');
97
+ /* C2 (intelligence-ds-page): the expanded Suggestion's parts, in the board's order, and its three answers */
98
+ const sx = await p.evaluate(() => { const m = document.querySelector('#insMv'); return { cls: m.className, dt: [...m.querySelectorAll('dl > dt')].map((d) => d.textContent).join('|'), why: ((m.querySelector('dl > dt + dd') || {}).textContent || ''), src: (m.querySelector('dd.src') || {}).textContent || '', acts: [...m.querySelectorAll('#insAct > .pm-btn')].map((b) => b.getAttribute('aria-label') + ':' + (b.classList.contains('primary') ? 'p' : b.classList.contains('outline') ? 'o' : '-') + ':' + !!b.querySelector('svg') + ':' + !b.textContent.trim()).join('|'), chg: (m.querySelector('#insAct a.pm-btn') || {}).href || '' }; });
99
+ ok('C2 the move is a pm-sug x with Why, PMOS will, What changes and Based on, in that order', /\bpm-sug\b/.test(sx.cls) && /\bx\b/.test(sx.cls) && sx.dt === 'Why|PMOS will|What changes|Based on' && !!sx.why.trim() && !!sx.src.trim(), JSON.stringify(sx));
100
+ ok('C2 its answers are Change it first (pencil, opens a chat), Yes (primary ✓) and No (outline ✕), each icon-only', sx.acts === 'Change it first:-:true:true|' + MOVE.label + ':p:true:true|Not now:o:true:true' && /ask=insights/.test(sx.chg) && /Change%20this%20before|Change\+this\+before/.test(sx.chg), JSON.stringify(sx));
101
+ ok('C2 with a move, the reason is not said twice under the finding', (await p.evaluate(() => document.querySelector('#insWhy').textContent)) === '');
97
102
  await p.click('#insAct [data-mv="apply"]');
98
103
  await until(() => A.posts.some((x) => x.path === '/api/insight-moves/apply'), 3000);
99
104
  const ap = A.posts.find((x) => x.path === '/api/insight-moves/apply');
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+ /* launch-cli.js — `pmos launch …`: what is not ready before a launch date (initiative launch-readiness-check, lib/launch-readiness.js).
3
+ * pmos launch check <initiative> [--date YYYY-MM-DD] [--json] open tasks, tracker tickets, sign-offs and questions before the launch
4
+ * pmos launch list [--days N] [--json] every initiative with a launch in the next N days (14), with its verdict
5
+ * The repository is the one this terminal is in (or --root). Read-only: it calls no tracker, sends nothing and writes no record.
6
+ * Exit codes: 0 done, 1 refused (no launch date, no such initiative), 2 usage. */
7
+ const path = require('path');
8
+ const { execFileSync } = require('child_process');
9
+ const LR = require('./launch-readiness.js');
10
+
11
+ const COMMANDS = { launch: ['check', 'list'] };
12
+ const USAGE = [
13
+ 'usage: pmos launch check|list — what is not ready before a launch date',
14
+ ' pmos launch check <initiative> [--date YYYY-MM-DD] open tasks, tracker tickets, sign-offs with no answer and open questions',
15
+ ' The launch date: --date, else a ◇ milestone named launch, go-live, release or ship, else the committed end, else the last ◇ milestone.',
16
+ ' pmos launch list [--days N] every initiative with a launch in the next N days (default 14), and its verdict',
17
+ ' every command: [--json] [--root <repository>]',
18
+ 'Read-only: it calls no tracker and sends nothing. Read the tracker first so the tickets are fresh.',
19
+ ];
20
+
21
+ function parseArgs(argv) {
22
+ const out = { _: [] };
23
+ for (let i = 0; i < argv.length; i++) {
24
+ const t = argv[i];
25
+ if (!t.startsWith('--')) { out._.push(t); continue; }
26
+ const eq = t.indexOf('=');
27
+ const key = eq > 0 ? t.slice(2, eq) : t.slice(2);
28
+ if (key === 'json' || key === 'help') out[key] = true;
29
+ else if (eq > 0) out[key] = t.slice(eq + 1);
30
+ else if (argv[i + 1] !== undefined) out[key] = argv[++i];
31
+ else out[key] = '';
32
+ }
33
+ return out;
34
+ }
35
+ function repoRoot(cwd) {
36
+ try { return execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; }
37
+ catch { return cwd; }
38
+ }
39
+ const DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
40
+
41
+ function run(argv, { say = console.log, cwd = process.cwd(), now = () => new Date() } = {}) {
42
+ const a = parseArgs(argv[0] === 'launch' ? argv.slice(1) : argv);
43
+ const sub = a._[0];
44
+ const fail = (error, code = 1) => { if (a.json) say(JSON.stringify({ ok: false, error })); else say('✗ ' + error); return code; };
45
+ if (!sub || a.help || sub === 'help') { USAGE.forEach((l) => say(l)); return sub || a.help ? 0 : 2; }
46
+ if (!COMMANDS.launch.includes(sub)) { say(`✗ pmos launch ${sub} is not a command`); USAGE.forEach((l) => say(l)); return 2; }
47
+ for (const k of Object.keys(a)) if (!['_', 'json', 'help', 'root', 'date', 'days', 'today'].includes(k)) return fail(`unknown option --${k}`, 2);
48
+ if (a.date !== undefined && (sub !== 'check' || !DAY_RE.test(a.date))) return fail(sub !== 'check' ? '--date is an option of check' : '--date takes YYYY-MM-DD', 2);
49
+ if (a.today !== undefined && !DAY_RE.test(a.today)) return fail('--today takes YYYY-MM-DD', 2);
50
+ const root = a.root ? path.resolve(cwd, a.root) : repoRoot(cwd);
51
+ const today = a.today || now().toISOString().slice(0, 10);
52
+ const SR = require('./stage-read.js');
53
+ const { w, ctx } = SR.cliCtx(root);
54
+ if (!ctx.stateDirFor()) return fail('this repository has no PMOS state folder (pmos/state, state or .pmos)');
55
+
56
+ if (sub === 'check') {
57
+ const id = a._[1];
58
+ if (!id || a._.length > 2) { say('usage: pmos launch check <initiative> [--date YYYY-MM-DD] [--json]'); return 2; }
59
+ const got = LR.read(root, id, { date: a.date, ctx, w });
60
+ if (got.error) return fail(got.error);
61
+ if (!got.launch) return fail(`${id} has no launch date: no ◇ milestone and no committed end. Give one with --date YYYY-MM-DD.`);
62
+ const res = LR.check(got.input, { launch: got.launch.date, launchTask: got.launch.task, today });
63
+ if (a.json) { say(JSON.stringify({ ok: true, initiative: id, title: got.title, launchFrom: got.launch.from, ...res })); return 0; }
64
+ say(LR.render(res, { title: got.title, id, launchFrom: LR.FROM_WORDS[got.launch.from] }));
65
+ return 0;
66
+ }
67
+
68
+ // list
69
+ const n = a.days === undefined ? 14 : Number(a.days);
70
+ if (!Number.isInteger(n) || n < 0 || n > 365) return fail('--days takes a whole number from 0 to 365', 2);
71
+ const rowsLib = require('./initiative-rows.js');
72
+ const d = rowsLib.deriveNow(root);
73
+ if (!d.ok) return fail(d.error || 'the initiative records could not be read');
74
+ const until = new Date(Date.parse(today + 'T00:00:00Z') + n * 86400000).toISOString().slice(0, 10);
75
+ const out = [];
76
+ for (const row of d.rows || []) {
77
+ if (!row || row.ok === false || row.stopped) continue;
78
+ let got; try { got = LR.read(root, row.id, { ctx, w }); } catch { continue; }
79
+ if (!got || got.error || !got.launch || got.launch.date < today || got.launch.date > until) continue;
80
+ const res = LR.check(got.input, { launch: got.launch.date, launchTask: got.launch.task, today });
81
+ out.push({ initiative: row.id, title: got.title, launch: res.launch, daysLeft: res.daysLeft, launchFrom: got.launch.from, verdict: res.verdict, items: res.items.length, notes: res.notes.length });
82
+ }
83
+ out.sort((x, y) => x.launch.localeCompare(y.launch) || x.initiative.localeCompare(y.initiative));
84
+ if (a.json) { say(JSON.stringify({ ok: true, today, until, launches: out })); return 0; }
85
+ if (!out.length) { say(`No launch in the next ${n} days.`); return 0; }
86
+ for (const x of out) say(`${x.launch} (${x.daysLeft === 0 ? 'today' : 'in ' + x.daysLeft + (x.daysLeft === 1 ? ' day' : ' days')}) · ${x.title} · ${x.verdict}${x.items ? ' · ' + x.items + (x.items === 1 ? ' item' : ' items') + ' not ready' : ''} · pmos launch check ${x.initiative}`);
87
+ return 0;
88
+ }
89
+
90
+ module.exports = { run, COMMANDS, USAGE };
@@ -0,0 +1,176 @@
1
+ 'use strict';
2
+ /* launch-readiness.js — what is not ready before an initiative's launch date (initiative launch-readiness-check; bet A172 with A188 and
3
+ * A194 in pmos-ideas/proofs). Works on any product built with PMOS: it reads only the initiative's own records.
4
+ *
5
+ * launchOf({ tasks, end, date }) → { date, from } | null PURE. The launch date: `date` (--date) first, then a ◇ milestone task whose
6
+ * title says launch, go-live, release or ship (the latest), then the committed end, then the last
7
+ * dated ◇ milestone. from: 'given' | 'milestone' | 'end' | 'last-milestone'.
8
+ * check(input, { launch, launchTask, today, idleDays, staleDays }) → the result PURE. launchTask: the id of the ◇ milestone the date came
9
+ * from (launchOf().task), which is not itself flagged. input:
10
+ * tasks [{ id, title, state, owner, due, milestone }] `pmos task list --all` rows (lib/stage-read.js tasksOf)
11
+ * tracker { fetchedAt, tickets: [reading] } | null the last tracker reading (lib/jira-status.js readSnapshot)
12
+ * signoffs [{ id, who, what, asked, due, state }] | null null: this product records no sign-offs (lib/signoffs.js)
13
+ * questions [{ owner, text, n }] the initiative's held questions (lib/question-batch.js)
14
+ * gaps [{ ticket, n, q }] open questions the ticket dry-run found, when present
15
+ * read(root, ini, o) → { input, launch, title } | { error } the I/O: reads the records above, writes nothing.
16
+ *
17
+ * THE RESULT: { launch, daysLeft, verdict: 'ready' | 'at risk' | 'no data', counts, items: [{ kind, id, title, why, who? }], notes: [line] }.
18
+ * kind: task | ticket | signoff | question. A reading is never counted as ready by default: no tasks and no tickets is 'no data', a
19
+ * tracker reading older than `staleDays` adds a note with its age, and a product with no sign-off record says so. Nothing writes. */
20
+
21
+ const DAY = 86400000;
22
+ const IDLE_DAYS = 14;
23
+ const STALE_DAYS = 2;
24
+ const LAUNCH_WORDS = /\b(launch|go[- ]?live|release|ship|cut-?over)\b/i;
25
+ const OPEN_TASK = new Set(['To do', 'In progress']);
26
+ const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
27
+ const one = (v, n = 140) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
28
+ const dayOf = (v) => { const m = /^(\d{4}-\d{2}-\d{2})/.exec(String(v || '')); return m ? m[1] : ''; };
29
+ const days = (a, b) => Math.round((Date.parse(b + 'T00:00:00Z') - Date.parse(a + 'T00:00:00Z')) / DAY);
30
+ const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
31
+
32
+ /** The launch date of an initiative. PURE. */
33
+ function launchOf({ tasks, end, date } = {}) {
34
+ if (dayOf(date)) return { date: dayOf(date), from: 'given' };
35
+ const ms = (tasks || []).filter((t) => isObj(t) && t.milestone && dayOf(t.due)).sort((a, b) => dayOf(a.due).localeCompare(dayOf(b.due)));
36
+ const named = ms.filter((t) => LAUNCH_WORDS.test(String(t.title || '')));
37
+ if (named.length) { const t = named[named.length - 1]; return { date: dayOf(t.due), from: 'milestone', title: one(t.title, 80), task: String(t.id || '') }; }
38
+ if (dayOf(end)) return { date: dayOf(end), from: 'end' };
39
+ if (ms.length) { const t = ms[ms.length - 1]; return { date: dayOf(t.due), from: 'last-milestone', title: one(t.title, 80), task: String(t.id || '') }; }
40
+ return null;
41
+ }
42
+
43
+ function taskItems(tasks, launch, today, launchTask) {
44
+ const out = [];
45
+ for (const t of tasks || []) {
46
+ if (!isObj(t) || !OPEN_TASK.has(t.state)) continue;
47
+ if (launchTask && String(t.id) === launchTask) continue; // the ◇ launch milestone itself is open until the launch
48
+ const due = dayOf(t.due);
49
+ let why;
50
+ if (due && due > launch) why = `due ${due}, after the launch`;
51
+ else if (due && due < today) why = `past its date (${due}), still ${t.state}`;
52
+ else if (due) why = `${t.state}, due ${due}`;
53
+ else why = `${t.state}, no date`;
54
+ out.push({ kind: 'task', id: String(t.id || ''), title: one(t.title, 120), why, ...(t.owner ? { who: one(t.owner, 60) } : {}) });
55
+ }
56
+ return out;
57
+ }
58
+
59
+ function ticketItems(tracker, today, idleDays) {
60
+ const out = [];
61
+ if (!tracker) return out;
62
+ for (const r of tracker.tickets || []) {
63
+ if (!isObj(r) || r.category === 'done') continue;
64
+ const parts = [String(r.status || 'Open')];
65
+ const upd = dayOf(r.updated);
66
+ const idle = upd ? days(upd, today) : null;
67
+ if (idle != null && idle >= idleDays) parts.push(`not moved for ${idle} days`);
68
+ if (r.flagged) parts.push(one(r.reason || 'flagged', 80));
69
+ if (r.stale) parts.push('not in the last tracker reading');
70
+ out.push({ kind: 'ticket', id: String(r.key || ''), title: one(r.summary, 120), why: parts.join(', '), ...(r.assignee ? { who: one(r.assignee, 60) } : {}), ...(idle != null ? { idle } : {}) });
71
+ }
72
+ return out.sort((a, b) => (b.idle || 0) - (a.idle || 0));
73
+ }
74
+
75
+ function signoffItems(signoffs, today) {
76
+ const out = [];
77
+ for (const s of signoffs || []) {
78
+ if (!isObj(s) || s.state !== 'open') continue;
79
+ const asked = dayOf(s.asked), due = dayOf(s.due);
80
+ const parts = [asked ? `asked ${asked}, ${plural(days(asked, today), 'day', 'days')} with no answer` : 'no answer recorded'];
81
+ if (due && due < today) parts.push(`was due ${due}`);
82
+ out.push({ kind: 'signoff', id: 'signoff:' + String(s.id || ''), title: one(s.what, 120), why: parts.join(', '), who: one(s.who || 'someone outside the team', 60) });
83
+ }
84
+ return out;
85
+ }
86
+
87
+ function questionItems(questions, gaps) {
88
+ const out = [];
89
+ for (const q of questions || []) if (isObj(q) && q.text) out.push({ kind: 'question', id: String(q.key || ''), title: one(q.text, 200), why: 'held: PMOS found no source', who: one(q.owner || '', 60) });
90
+ for (const g of gaps || []) if (isObj(g) && g.q) out.push({ kind: 'question', id: String(g.ticket || ''), title: one(g.q, 200), why: `open question in ${g.ticket || 'a ticket'}` });
91
+ return out;
92
+ }
93
+
94
+ /** The readiness of one initiative for its launch. PURE. */
95
+ function check(input = {}, { launch, launchTask = '', today, idleDays = IDLE_DAYS, staleDays = STALE_DAYS } = {}) {
96
+ const t0 = dayOf(today) || new Date().toISOString().slice(0, 10);
97
+ const L = dayOf(launch);
98
+ const tasks = (input.tasks || []).filter(isObj);
99
+ const tracker = isObj(input.tracker) ? input.tracker : null;
100
+ const items = [
101
+ ...taskItems(tasks, L || '9999-12-31', t0, launchTask),
102
+ ...ticketItems(tracker, t0, idleDays),
103
+ ...signoffItems(input.signoffs, t0),
104
+ ...questionItems(input.questions, input.gaps),
105
+ ];
106
+ const notes = [];
107
+ const read = tracker && dayOf(tracker.fetchedAt);
108
+ if (!tracker) notes.push('No tracker reading for this initiative: run the tracker read first, or the tickets are not counted.');
109
+ else if (read && days(read, t0) > staleDays) notes.push(`The tracker reading is ${plural(days(read, t0), 'day', 'days')} old (${read}). Read the tracker again before you trust this.`);
110
+ if (input.signoffs == null) notes.push('Sign-offs: not recorded for this product, so outside answers are not checked.');
111
+ const nTickets = tracker ? (tracker.tickets || []).length : 0;
112
+ const counts = {
113
+ tasks: { done: tasks.filter((t) => t.state === 'Done').length, total: tasks.filter((t) => t.state !== "Won't do" && t.state !== 'Archived').length },
114
+ tickets: { done: tracker ? (tracker.tickets || []).filter((r) => isObj(r) && r.category === 'done').length : 0, total: nTickets },
115
+ signoffs: items.filter((x) => x.kind === 'signoff').length,
116
+ questions: items.filter((x) => x.kind === 'question').length,
117
+ };
118
+ const verdict = !tasks.length && !nTickets ? 'no data' : items.length ? 'at risk' : 'ready';
119
+ return { launch: L || null, daysLeft: L ? days(t0, L) : null, today: t0, verdict, counts, items, notes };
120
+ }
121
+
122
+ /** One paragraph for a terminal or a chat. */
123
+ function render(res, { title = '', id = '', launchFrom } = {}) {
124
+ const name = title || id;
125
+ const when = res.daysLeft == null ? '' : res.daysLeft < 0 ? `${plural(-res.daysLeft, 'day', 'days')} ago` : res.daysLeft === 0 ? 'today' : `in ${plural(res.daysLeft, 'day', 'days')}`;
126
+ const head = `${name}: launch ${res.launch}${when ? ' (' + when + ')' : ''}${launchFrom ? ', from ' + launchFrom : ''}. ${res.verdict === 'ready' ? 'Ready: nothing open.' : res.verdict === 'no data' ? 'No data: no task and no tracker ticket.' : 'At risk: ' + plural(res.items.length, 'item is', 'items are') + ' not ready.'}`;
127
+ const out = [head];
128
+ const c = res.counts;
129
+ // zero is silence: a part with nothing in it is left out
130
+ const sum = [c.tasks.total ? `tasks ${c.tasks.done} of ${c.tasks.total} done` : '', c.tickets.total ? `tickets ${c.tickets.done} of ${c.tickets.total} done` : '',
131
+ c.signoffs ? `${plural(c.signoffs, 'sign-off', 'sign-offs')} waiting` : '', c.questions ? plural(c.questions, 'open question', 'open questions') : ''].filter(Boolean);
132
+ if (sum.length) out.push(sum.join(' · ').replace(/^./, (x) => x.toUpperCase()) + '.');
133
+ const LABEL = { task: 'Tasks', ticket: 'Tracker tickets', signoff: 'Sign-offs with no answer', question: 'Open questions' };
134
+ for (const k of ['signoff', 'ticket', 'task', 'question']) {
135
+ const xs = res.items.filter((x) => x.kind === k);
136
+ if (!xs.length) continue;
137
+ out.push('', `${LABEL[k]} (${xs.length}):`);
138
+ for (const x of xs) out.push(` ${x.id ? x.id + ' ' : ''}${x.title} | ${x.why}${x.who ? ' | ' + x.who : ''}`);
139
+ }
140
+ if (res.notes.length) out.push('', ...res.notes);
141
+ return out.join('\n');
142
+ }
143
+
144
+ const FROM_WORDS = { given: 'the date you gave', milestone: 'the milestone', end: 'the committed end', 'last-milestone': 'the last milestone' };
145
+
146
+ /** Read one initiative's records. Writes nothing. o: { date, ctx, w } (lib/stage-read.js cliCtx). */
147
+ function read(root, ini, o = {}) {
148
+ const SR = require('./stage-read.js');
149
+ const { w, ctx } = o.ctx ? { w: o.w, ctx: o.ctx } : SR.cliCtx(root);
150
+ if (!ctx.stateDirFor()) return { error: 'this repository has no PMOS state folder (pmos/state, state or .pmos)' };
151
+ const r = SR.rowOf(ctx, w, ini);
152
+ if (!r || !r.ok) return { error: (r && r.error) || `no initiative ${ini}` };
153
+ let tasks = [];
154
+ try { tasks = SR.tasksOf(ctx, w, ini); } catch { tasks = []; }
155
+ const launch = launchOf({ tasks, end: r.row.end, date: o.date });
156
+ let tracker = null;
157
+ try {
158
+ const snap = require('./jira-status.js').readSnapshot(root, ini);
159
+ if (snap) tracker = { fetchedAt: snap.fetchedAt, tickets: [...snap.tickets.values()] };
160
+ } catch { tracker = null; }
161
+ // sign-offs and ticket gaps come from lib/signoffs.js and the ticket dry-run when this PMOS has them; without them, nothing is guessed
162
+ let signoffs = null, gaps = [];
163
+ try {
164
+ const SO = require('./signoffs.js'), JT = require('./jira-tickets.js');
165
+ if (typeof SO.list === 'function' && typeof SO.fileOf === 'function' && typeof JT.stateDirOf === 'function') signoffs = SO.list(SO.fileOf(JT.stateDirOf(root)), { ini });
166
+ } catch { signoffs = null; }
167
+ try { const JT = require('./jira-tickets.js'); if (typeof JT.dryRunGaps === 'function') gaps = JT.dryRunGaps(root, ini) || []; } catch { gaps = []; }
168
+ let questions = [];
169
+ try {
170
+ const held = require('./routes-proposals.js').heldOf(ctx, w).filter((h) => h.ini === ini);
171
+ questions = require('./question-batch.js').questionsOf(held, { pm: 'PM' });
172
+ } catch { questions = []; }
173
+ return { title: r.row.title || ini, launch, input: { tasks, tracker, signoffs, questions, gaps } };
174
+ }
175
+
176
+ module.exports = { launchOf, check, render, read, FROM_WORDS, IDLE_DAYS, STALE_DAYS, LAUNCH_WORDS };
@@ -54,6 +54,9 @@ const VERBS = Object.freeze({
54
54
  // Not a pm-os-absorb verb (run: null): workspace-data-freshness added it through the same table.
55
55
  calendar: Object.freeze({ module: 'calendar-cli.js', run: null, guide: 'cli.md',
56
56
  help: 'pmos calendar import|status — the calendar events an agent session read, saved for Briefing and Calendar (pmos calendar help)' }),
57
+ // Not a pm-os-absorb verb (run: null): launch-readiness-check added it through the same table.
58
+ launch: Object.freeze({ module: 'launch-cli.js', run: null, guide: 'cli.md',
59
+ help: 'pmos launch check|list — what is not ready before a launch date: tasks, tracker tickets, sign-offs, open questions (pmos launch help)' }),
57
60
  // Not a pm-os-absorb verb (run: null): tracker-read-freshness added it through the same table.
58
61
  tracker: Object.freeze({ module: 'tracker-cli.js', run: null, guide: 'cli.md',
59
62
  help: 'pmos tracker done|status — record when the tracker-refresh skill finished a read of this repository (pmos tracker help)' }),
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.663.0",
3
+ "version": "0.665.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.663.0",
9
+ "version": "0.665.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.663.0",
3
+ "version": "0.665.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",
@@ -45,10 +45,30 @@ button.ctp-cr:hover { text-decoration: underline; }
45
45
  .ctp-sep { color: var(--cz-ink2); }
46
46
  .ctp-th { display: flex; align-items: center; gap: var(--space-8); margin: 0 0 var(--space-12); }
47
47
  .ctp-full .ctp-t { font-size: var(--fs-panel); }
48
- .ctp-full .ctp-b, .ctp-full .ctp-hx { max-width: 720px; }
48
+ .ctp-full .ctp-hx { max-width: 720px; }
49
49
  .ctp-hx { margin: 0 0 var(--space-16); display: flex; flex-direction: column; gap: var(--space-12); }
50
50
  .ctp-hx .pwd-facts { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--space-4) var(--space-12); margin: 0; }
51
51
  .ctp-hx .pwd-facts dt { color: var(--cz-ink2); }
52
52
  .ctp-hx .pwd-facts dd { margin: 0; }
53
53
  .ctp-hx .grey { color: var(--cz-ink2); }
54
54
  .ctp-hx .warn { color: var(--cz-late); }
55
+
56
+ /* viewer-ds-task (board ViewerDS): the full popup is main + side, built from Komorebi blocks (pm/vw-ds.js); here only their places.
57
+ * With no popup behind (a task opened from Today, Events, Goals or Search) it is centred and near full (ctp-solo). */
58
+ .ctp.ctp-full.ctp-solo { left: var(--space-24); top: var(--space-24); right: var(--space-24); bottom: var(--space-24); margin: 0 auto; max-width: 1280px; }
59
+ .ctp-full .ctp-th { margin-bottom: var(--space-4); }
60
+ .ctp-meta { margin: 0 0 var(--space-16); }
61
+ .ctp-g { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: var(--space-16); align-items: start; }
62
+ .ctp-main { display: flex; flex-direction: column; gap: var(--space-16); min-width: 0; }
63
+ .ctp-main > div:empty { display: none; }
64
+ .ctp-main .ctp-hx { margin: 0; }
65
+ .ctp-say { margin: 0; }
66
+ .ctp-side { position: sticky; top: 0; min-width: 0; }
67
+ .ctp-ad { flex: none; width: 52px; }
68
+ .ctp-main .pm-li { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; text-decoration: none; cursor: pointer; }
69
+ .ctp-main .pm-li:hover { background: var(--well); }
70
+ .ctp-main div.pm-li { cursor: default; }
71
+ @media (max-width: 900px) {
72
+ .ctp-g { grid-template-columns: minmax(0, 1fr); }
73
+ .ctp-side { position: static; order: -1; }
74
+ }
@@ -18,6 +18,7 @@
18
18
  * Every write is the PM's press, on the board's own routes. The UI says PMOS, never Claude; icon-only buttons carry aria-label. */
19
19
  import { taskOf, mountCard, boardSaver, cardStyle, historyFor } from './task-card.js';
20
20
  import * as SWN from './cozy-status-when.js';
21
+ import * as VD from './vw-ds.js'; // viewer-ds-task (board ViewerDS): the full popup's Where it stands, Linked and Activity blocks
21
22
 
22
23
  const CSS = new URL('./cozy-task-pop.css', import.meta.url).href;
23
24
  if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
@@ -59,6 +60,7 @@ export function closeTask() {
59
60
  function place() {
60
61
  if (!S || !S.el.classList.contains('ctp-full')) return;
61
62
  const L = document.querySelector('.cz-pop .cz-pop-l'), r = L && L.getBoundingClientRect();
63
+ S.el.classList.toggle('ctp-solo', !r || !r.width); // no popup behind (a task opened from Today, Events, Goals or Search): centred, near full
62
64
  if (!r || !r.width) { S.el.removeAttribute('style'); return; }
63
65
  Object.assign(S.el.style, { left: r.left + 'px', top: r.top + 'px', width: r.width + 'px', height: r.height + 'px' });
64
66
  }
@@ -87,7 +89,9 @@ export async function openTask(uid, ctx = {}) {
87
89
  S = { el, scrim, ctx, uid, prevFocus: document.activeElement };
88
90
  // the full popup lies over the work side of the popup and follows its size (the chat opening beside it narrows it)
89
91
  if (ctx.full) {
90
- el.classList.add('ctp-full'); scrim.classList.add('ctp-full');
92
+ el.classList.add('ctp-full', 'pm-ds'); scrim.classList.add('ctp-full'); // pm-ds: the Komorebi parts inside (komorebi.css, loaded below)
93
+ const K = new URL('./komorebi.css', import.meta.url).href;
94
+ if (!document.querySelector(`link[href="${K}"]`) && !document.querySelector('link[href="/pm/komorebi.css"]')) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = K; document.head.appendChild(l); }
91
95
  const L = document.querySelector('.cz-pop .cz-pop-l');
92
96
  if (L && typeof ResizeObserver !== 'undefined') { S.ro = new ResizeObserver(place); S.ro.observe(L); }
93
97
  window.addEventListener('resize', place); place();
@@ -122,14 +126,19 @@ async function show(uid) {
122
126
  const more = !t.jira ? ib('data-ctp-more aria-haspopup="menu"', 'More for this task', P.more) : '';
123
127
  S.el.setAttribute('aria-label', (t.milestone ? 'Milestone: ' : 'Task: ') + t.title);
124
128
  if (ctx.full) {
125
- // WorkStatesDS 4 and 6: ← and the path back to the initiative, then chat, ⋯ and ×; the kind and the title under it
129
+ // WorkStatesDS 4 and 6, ViewerDS: ← and the path back, the source chip, then chat, ⋯ and ×; the kind, the title and one meta line under it.
130
+ // The body is main + side (viewer-ds-task): Where it stands, Linked and Activity, beside the task card (fields and notes) in a block.
126
131
  const path = ctx.path || [], last = path.length - 1;
127
- const crumbs = path.map((p, k) => (k === last ? `<button type="button" class="ctp-cr" data-ctp-close>${esc(p)}</button>` : `<span class="ctp-cr">${esc(p)}</span>`)).join('<span class="ctp-sep" aria-hidden="true">›</span>');
132
+ // iniCrumb (a task opened from a place, not from its initiative's popup): the initiative's name opens it, and ← closes
133
+ const lastAttr = ctx.iniCrumb && t.ini ? `data-ctp-ini="${esc(t.ini)}"` : 'data-ctp-close';
134
+ const crumbs = path.map((p, k) => (k === last ? `<button type="button" class="ctp-cr" ${lastAttr}>${esc(p)}</button>` : `<span class="ctp-cr">${esc(p)}</span>`)).join('<span class="ctp-sep" aria-hidden="true">›</span>');
128
135
  const head = ctx.head ? ctx.head(t) : '';
129
- S.el.innerHTML = `<div class="ctp-h ctp-fh">${ib('data-ctp-close', 'Back to ' + (path[last] || 'the initiative'), P.back)}<nav class="ctp-path" aria-label="Where this is">${crumbs}</nav>`
136
+ const back = path.length && !ctx.iniCrumb ? 'Back to ' + path[last] : 'Close';
137
+ S.el.innerHTML = `<div class="ctp-h ctp-fh">${ib('data-ctp-close', back, P.back)}<nav class="ctp-path" aria-label="Where this is">${crumbs}${t.jira ? '<span class="pm-chip">Jira</span>' : ''}</nav>`
130
138
  + `<span class="ctp-tools">${step}${ctx.chat ? ib('data-ctp-chat', 'Ask PMOS about this', P.chat) : ''}${more}${ib('data-ctp-x', 'Close', P.x)}</span></div>`
131
- + `<div class="ctp-th">${kind}${title}</div>${head ? `<div class="ctp-hx">${head}</div>` : ''}`
132
- + '<div class="ctp-b"></div><div class="ctp-when" hidden></div>';
139
+ + `<div class="ctp-th">${kind}${title}</div><p class="pm-meta ctp-meta">${esc(VD.metaOf(t))}</p>`
140
+ + `<div class="ctp-g"><div class="ctp-main">${head ? `<div class="ctp-hx">${head}</div>` : ''}<div class="ctp-stands"></div><div class="ctp-linked"></div><div class="ctp-act"></div></div>`
141
+ + '<aside class="ctp-side"><section class="pm-block" aria-label="Fields and notes"><div class="ctp-b"></div><div class="ctp-when" hidden></div></section></aside></div>';
133
142
  } else {
134
143
  S.el.innerHTML = `<div class="ctp-h">${kind}${title}<span class="ctp-tools">${step}${more}${ib('data-ctp-close', 'Close', P.x)}</span></div>`
135
144
  + '<div class="ctp-b"></div><div class="ctp-when" hidden></div>';
@@ -143,18 +152,34 @@ async function show(uid) {
143
152
  return base(patch);
144
153
  };
145
154
  // the host's row changes at once (ctx.patch: the list behind shows the new status and dates before the board is read again)
146
- const changed = () => { raw.status = t.status; raw.end = t.due; raw.start = t.start; raw.owner = t.owner; raw.notes = t.notes; raw.milestone = t.milestone; if (ctx.patch) { try { ctx.patch(t.uid, { status: t.status, end: t.due || '', start: t.start || '', milestone: !!t.milestone, title: t.title }); } catch { /* the reload still draws it */ } } clearTimeout(changed.t); changed.t = setTimeout(() => { if (ctx.onChange) ctx.onChange(); }, 400); };
155
+ const changed = () => { raw.status = t.status; raw.end = t.due; raw.start = t.start; raw.owner = t.owner; raw.notes = t.notes; raw.milestone = t.milestone; if (ctx.patch) { try { ctx.patch(t.uid, { status: t.status, end: t.due || '', start: t.start || '', milestone: !!t.milestone, title: t.title }); } catch { /* the reload still draws it */ } } clearTimeout(changed.t); changed.t = setTimeout(() => { if (ctx.onChange) ctx.onChange(); }, 400); if (ctx.full) drawMain(); };
147
156
  const toast = (msg, undo) => (ctx.toast ? ctx.toast(msg, undo) : undefined);
157
+ S.hist = historyFor({ ws: ctx.ws, board: raw.board || ctx.board, t, post: (p, b) => ctx.pmPost(p, b) });
158
+ S.histL = null;
148
159
  S.card = mountCard(S.el.querySelector('.ctp-b'), t, {
149
160
  save, toast, changed, now: () => Date.now(),
150
161
  openIni: (id) => { closeTask(); if (ctx.openIni) ctx.openIni(id); },
151
162
  iniTitleOf: (id) => (ctx.iniTitle ? ctx.iniTitle(id) : id),
152
163
  owners: () => (ctx.owners ? ctx.owners() : []),
153
164
  inis: () => (ctx.inis ? ctx.inis() : []),
154
- history: historyFor({ ws: ctx.ws, board: raw.board || ctx.board, t, post: (p, b) => ctx.pmPost(p, b) }),
165
+ // the full popup says PMOS's changes once, in its Activity block; the small popup keeps the card's History fold
166
+ history: ctx.full ? null : S.hist,
155
167
  });
168
+ if (ctx.full) { drawMain(); loadActivity(); }
156
169
  const f = S.el.querySelector('.ctp-t') || S.el.querySelector('button'); if (f) f.focus();
157
170
  }
171
+ /* the full popup's main column (viewer-ds-task, pm/vw-ds.js): Where it stands and Linked from the task, Activity from PMOS's kept changes */
172
+ function drawMain() {
173
+ if (!S || !S.ctx.full || !S.t) return;
174
+ const put = (sel, html) => { const x = S.el.querySelector(sel); if (x) x.innerHTML = html; };
175
+ put('.ctp-stands', VD.standsHtml(S.t, { waits: S.ctx.waits ? S.ctx.waits(S.t) : '' }));
176
+ put('.ctp-linked', VD.linkedHtml(S.t));
177
+ put('.ctp-act', VD.activityHtml(S.histL || [], { open: !!S.aopen }));
178
+ }
179
+ function loadActivity() {
180
+ const s = S; if (!s || !s.hist) return;
181
+ Promise.resolve(s.hist.load()).catch(() => []).then((L) => { if (S !== s) return; s.histL = Array.isArray(L) ? L : []; drawMain(); });
182
+ }
158
183
 
159
184
  /* the card's status press waits for "When did this happen?": Today preselected, so a second press of the status or Enter keeps today */
160
185
  function holdStatus(e) {
@@ -180,8 +205,19 @@ function hideWhen() { if (!S) return; const w = S.el.querySelector('.ctp-when');
180
205
 
181
206
  async function press(e) {
182
207
  if (!S) return;
183
- const b = e.target.closest('button'); if (!b || b.disabled || !S.el.contains(b)) return;
208
+ const b = e.target.closest('button,a[data-ctp-ini]'); if (!b || b.disabled || !S.el.contains(b)) return;
184
209
  const d = b.dataset, ctx = S.ctx, t = S.t;
210
+ // the full popup's main column (viewer-ds-task): the initiative opens it; Undo a kept change; the Activity fold
211
+ if (d.ctpIni) { e.preventDefault(); const id = d.ctpIni; closeTask(); if (ctx.openIni) ctx.openIni(id); return; }
212
+ if (d.ctpHundo && S.hist) {
213
+ const s0 = S; b.disabled = true;
214
+ const r = await Promise.resolve(s0.hist.undo(d.ctpHundo)).catch(() => null);
215
+ if (!r || r.ok === false) { if (ctx.toast) ctx.toast((r && r.error) || 'The undo did not land.'); }
216
+ if (ctx.onChange) ctx.onChange();
217
+ if (S === s0) show(s0.uid); // the task as it is now, and its Activity again
218
+ return;
219
+ }
220
+ if ('ctpAfold' in d) { S.aopen = true; drawMain(); return; }
185
221
  if (b.closest('.ctp-hx')) { if (ctx.headPress) { const s0 = S; await ctx.headPress(b, { refresh: () => { if (S === s0) show(s0.uid); }, close: closeTask }); } return; }
186
222
  if ('ctpClose' in d) { closeTask(); return; }
187
223
  if ('ctpChat' in d) { if (ctx.chat) ctx.chat(); return; }
@@ -34,8 +34,38 @@ async function read(o) {
34
34
  return p;
35
35
  }
36
36
 
37
+ /* viewer-ds-task (board ViewerDS, brief: the Viewer's item as the full popup): a PMOS task opened from a place (Events, Today, Goals, Search)
38
+ * opens as the full task popup (pm/cozy-task-pop.js full mode: Where it stands, Linked and Activity beside the task card), centred when no
39
+ * popup is open. Home keeps its own Viewer trail until its own rebuild (it holds #hmChat); a Jira ticket keeps the ticket Viewer. */
40
+ const onHome = () => typeof document !== 'undefined' && !!document.getElementById('hmChat');
41
+ async function openFull(o) {
42
+ const uid = String(o.key || '').replace(/^task:/, '');
43
+ const [TP, SC] = await Promise.all([import('./cozy-task-pop.js'), import('./scope-chip.js').catch(() => null)]);
44
+ const s = await read({ id: o.ini, ws: o.ws || '', board: o.board || '' });
45
+ const m = s && s.state === 'ready' ? s.model : null;
46
+ const ws = o.ws || (m && m.board && m.board.ws) || '', board = o.board || (m && m.board && m.board.id) || '';
47
+ const row = m ? findTask(m, o.key) : null;
48
+ if (row && cardTask(m, row).jira) return false; // a Jira ticket: the ticket Viewer, as before
49
+ const product = SC && SC.productName ? SC.productName(ws, (m && m.board && m.board.name) || '') : '';
50
+ TP.openTask(uid, {
51
+ full: true, ws, board, ini: o.ini, pmPost: (p, b) => pmPost(p, b), toast: toastUndo,
52
+ path: [product, (m && m.title) || o.ini].filter(Boolean), iniCrumb: true,
53
+ iniTitle: (id) => (id === o.ini && m ? m.title : id),
54
+ row: () => (row ? { ...row, uid, board, ini: o.ini } : null),
55
+ rename: o.rename && typeof o.rename.save === 'function' ? (raw, title) => o.rename.save(title, {}) : null,
56
+ onChange: () => cache.clear(),
57
+ openIni: (id) => openWorkItem({ kind: 'initiative', id, title: id === o.ini && m ? m.title : '', ws: o.ws, board: o.board }),
58
+ chat: () => import('./page-chat.js').then((PC) => PC.openChat({ kind: 'task', id: uid, title: (row && row.title) || o.title || 'this task' }, { ws })),
59
+ });
60
+ return true;
61
+ }
62
+
37
63
  export function openWorkItem(o) {
38
64
  if (!o) return null;
65
+ if (o.kind === 'task' && /^task:/.test(o.key || '') && o.ini && !onHome() && o.full !== false) {
66
+ openFull(o).then((done) => { if (!done) openWorkItem({ ...o, full: false }); }).catch(() => openWorkItem({ ...o, full: false }));
67
+ return null;
68
+ }
39
69
  vwStyle('item');
40
70
  const ctx = { id: o.kind === 'task' ? o.ini : o.id, ws: o.ws || '', board: o.board || '' };
41
71
  if (!ctx.id) return null;
@@ -197,6 +197,11 @@ export function cardHtml(t, o = {}) {
197
197
  /** History (canvas TpA6): Claude's approved changes to the task, newest first (lib/proposals.js historyOf). Zero is silence. */
198
198
  const FIELD = { due: 'Due', status: 'Status', name: 'Name', notes: 'Notes', add: 'Added' };
199
199
  const valOf = (f, v) => (v == null || v === '' ? '—' : typeof v === 'object' ? [short(v.start), short(v.due)].filter(Boolean).join(' – ') || '—' : f === 'notes' ? 'edited' : String(v));
200
+ /** One history entry in words: { what, by, day } (the Activity block of the full task popup, pm/vw-ds.js, says it the same way). */
201
+ export function historyWords(x) {
202
+ const what = x.field === 'add' ? 'Added from ' + (x.source || 'your sources') : (FIELD[x.field] || x.field) + ': ' + valOf(x.field, x.from) + ' → ' + valOf(x.field, x.to);
203
+ return { what, by: ['PMOS, kept by you', x.why, x.field !== 'add' && x.source ? x.source : ''].filter(Boolean).join(' · '), day: short(String(x.at || '').slice(0, 10)) };
204
+ }
200
205
  export function historyHtml(hist, open, now = Date.now()) {
201
206
  const L = (hist || []).filter((x) => x && !x.undone);
202
207
  if (!L.length) return '';
@@ -0,0 +1,100 @@
1
+ /* pm/vw-ds.js — the blocks a task's full popup is built from (initiative viewer-ds-task; Exploring 3 page "pages", board ViewerDS; brief
2
+ * design-system/pages-rebuild/brief.md, Viewer: item as the full popup). Built only from PMOS Komorebi parts (workspace/design-system/ui).
3
+ * PURE: no DOM, no fetch; `now` comes in. pm/cozy-task-pop.js draws them in its full mode and wires the presses by their data- attributes.
4
+ *
5
+ * metaOf(t) → 'Task · Dina · due 24 Nov · Build' the one line under the title
6
+ * pathOf(t, o) → [crumb] product › initiative › task (the Jira key, or the task's name)
7
+ * standsOf(t, o) → [html] Where it stands, from the record only
8
+ * linkedOf(t) → [{ kind, title, sub, href?, act? }] the initiative, the Jira ticket, each link in the notes
9
+ * standsHtml · linkedHtml · activityHtml(hist, o) the three main-column blocks
10
+ *
11
+ * NOTHING HERE MAKES A FACT UP. A task with no due date says so; a task nobody has says so; zero is silence (no link, no Linked block). */
12
+ import { historyWords } from './task-card.js';
13
+
14
+ export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
15
+ const SV = (d, n = 16, cls = '') => `<svg class="pm-ic${cls ? ' ' + cls : ''}" width="${n}" height="${n}" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
16
+ export const I = {
17
+ star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', 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',
18
+ ini: 'M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01', jira: 'M12 3l9 9-9 9-9-9z', undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', chev: 'M9 6l6 6-6 6',
19
+ };
20
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
21
+ const DAY = 864e5;
22
+ const day = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) : null; };
23
+ const today = (now) => { const d = new Date(now); return Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()); };
24
+ export const dm = (v) => { const t = day(v); if (t == null) return ''; const d = new Date(t); return d.getUTCDate() + ' ' + MON[d.getUTCMonth()]; };
25
+ const days = (n) => n + (n === 1 ? ' day' : ' days');
26
+ const done = (t) => /^(done|closed|resolved|won'?t do|archived)$/i.test(String(t.status || ''));
27
+ /** "pm:wawan" is the PM: "You". */
28
+ const who = (o) => (/^pm:/.test(String(o || '')) ? 'You' : String(o || '').trim());
29
+
30
+ export function metaOf(t) {
31
+ const d = t.due ? 'due ' + dm(t.due) : '', w = who(t.owner);
32
+ return [t.milestone ? 'Milestone' : 'Task', w, d, t.section || ''].filter(Boolean).join(' · ');
33
+ }
34
+ export function pathOf(t, o = {}) {
35
+ return [o.product || '', t.iniTitle || t.ini || '', t.jira ? t.jira.key : ''].filter(Boolean);
36
+ }
37
+
38
+ /* ── Where it stands ──────────────────────────────────────────────────────────────────────────────────────────── */
39
+ export function standsOf(t, o = {}) {
40
+ const now = o.now == null ? Date.now() : o.now, out = [], T = today(now), w = who(t.owner);
41
+ if (done(t)) out.push(`It is ${esc(String(t.status).toLowerCase())}.`);
42
+ else {
43
+ const d = day(t.due), st = String(t.status || 'To do');
44
+ const holder = w ? (w === 'You' ? 'You have it' : `${esc(w)} has it`) : 'Nobody has it yet';
45
+ out.push(`${holder}, and it is ${esc(st.toLowerCase())}.`);
46
+ if (d == null) out.push('It has no due date yet, so nothing shows when it will finish.');
47
+ else {
48
+ const n = Math.round((d - T) / DAY);
49
+ out.push(n < 0 ? `It was due ${esc(dm(t.due))} and is ${days(-n)} late.` : n === 0 ? 'It is due today.' : n === 1 ? `It is due tomorrow, ${esc(dm(t.due))}.` : `It is due ${esc(dm(t.due))}, in ${days(n)}.`);
50
+ }
51
+ if (o.waits) out.push(`It waits on you: ${esc(String(o.waits).replace(/\.$/, ''))}.`);
52
+ }
53
+ if (t.ini) out.push(`It ${t.milestone ? 'is a milestone of' : 'moves'} <a href="#" data-ctp-ini="${esc(t.ini)}">${esc(t.iniTitle || t.ini)}</a>${t.section ? `, in its ${esc(t.section)} stage` : ''}.`);
54
+ return out;
55
+ }
56
+ export function standsHtml(t, o = {}) {
57
+ const S = standsOf(t, o);
58
+ if (!S.length && !o.sug) return '';
59
+ return `<section class="pm-block" aria-label="Where it stands"><h3 class="pm-h-sm pm-row">${SV(I.star, 16, 'pm-star')}Where it stands</h3>`
60
+ + (S.length ? `<p class="ctp-say">${S.join(' ')}</p>` : '') + (o.sug || '') + '</section>';
61
+ }
62
+
63
+ /* ── Linked ───────────────────────────────────────────────────────────────────────────────────────────────────── */
64
+ const URL_RE = /\bhttps?:\/\/[^\s<>"')\]]+/g;
65
+ const shortUrl = (u) => { try { const x = new URL(u); const p = x.pathname.replace(/\/$/, ''); return x.host.replace(/^www\./, '') + (p.length > 32 ? p.slice(0, 31) + '…' : p); } catch { return u.slice(0, 48); } };
66
+ export function linkedOf(t) {
67
+ const out = [];
68
+ if (t.ini) out.push({ kind: 'ini', title: t.iniTitle || t.ini, sub: 'initiative', act: t.ini });
69
+ if (t.jira && t.jira.key) out.push({ kind: 'jira', title: t.jira.key, sub: 'Jira ticket' + (t.jira.readAt ? ' · read ' + dm(t.jira.readAt) : '') });
70
+ const seen = new Set();
71
+ for (const u of String(t.notes || '').match(URL_RE) || []) { if (seen.has(u) || seen.size >= 5) continue; seen.add(u); out.push({ kind: 'url', title: shortUrl(u), sub: 'link in the notes', href: u }); }
72
+ return out;
73
+ }
74
+ export function linkedHtml(t) {
75
+ const L = linkedOf(t);
76
+ if (!L.length) return '';
77
+ const icon = (k) => SV(k === 'ini' ? I.ini : k === 'jira' ? I.jira : I.link);
78
+ const row = (x) => {
79
+ const inner = `${icon(x.kind)}<span class="txt"><span class="t">${esc(x.title)}</span><span class="w">${esc(x.sub)}</span></span>`;
80
+ return x.href ? `<a class="pm-li" href="${esc(x.href)}" target="_blank" rel="noopener">${inner}</a>`
81
+ : x.act ? `<button type="button" class="pm-li" data-ctp-ini="${esc(x.act)}">${inner}</button>` : `<div class="pm-li">${inner}</div>`;
82
+ };
83
+ return `<section class="pm-block list" aria-label="Linked"><div class="head"><h3 class="pm-h-sm">Linked</h3><span class="pm-meta">${L.length}</span></div><div class="rows">${L.map(row).join('')}</div></section>`;
84
+ }
85
+
86
+ /* ── Activity: PMOS's kept changes, newest first ──────────────────────────────────────────────────────────────── */
87
+ /** hist: GET /api/proposals/history entries (task-card.js historyFor). o: { now, open: the fold is open, first: rows before the fold (3) }. */
88
+ export function activityHtml(hist, o = {}) {
89
+ const now = o.now == null ? Date.now() : o.now, first = o.first || 3;
90
+ const L = (hist || []).filter((x) => x && !x.undone);
91
+ if (!L.length) return '';
92
+ const row = (x) => {
93
+ const w = historyWords(x), recent = now - (Date.parse(x.at) || 0) < 7 * DAY;
94
+ return `<div class="pm-li"><span class="code pm-meta ctp-ad">${esc(w.day)}</span><span class="txt"><span class="t">${esc(w.what)}</span><span class="w">${esc(w.by)}</span></span>`
95
+ + (recent && x.batch ? `<button type="button" class="pm-btn" data-ctp-hundo="${esc(x.batch)}" aria-label="Undo this change" title="Undo">${SV(I.undo)}</button>` : '') + '</div>';
96
+ };
97
+ const shown = o.open ? L : L.slice(0, first), rest = L.length - shown.length;
98
+ return `<section class="pm-block list" aria-label="Activity"><div class="head"><h3 class="pm-h-sm">Activity</h3></div><div class="rows">${shown.map(row).join('')}</div>`
99
+ + (rest > 0 ? `<button type="button" class="pm-fold" data-ctp-afold aria-expanded="false">Earlier <span class="pm-meta">${rest}</span></button>` : '') + '</section>';
100
+ }
@@ -171,6 +171,7 @@ const WIDE = new Set([
171
171
  * a page route, a name used outside any function or route block) reaches every suite.
172
172
  * - lib/routes-<x>.js (a route module that lib/route-modules.js loads): every '/api/…' route the file names under the
173
173
  * prefixes it declares (a route it only calls through ctx is left out). With no prefixes it can read: every route it names.
174
+ * - lib/pmos-verbs.js, when the diff only adds a verb (its module line and its help line): the suites that name pmos-verbs or the new module.
174
175
  * - lib/route-modules.js, when the diff only adds module names to its list: what each added lib/routes-<x>.js reaches. Any other change to it is the rule below.
175
176
  * - Any other file: the files that name it (a require, an import or a path string), followed the same way: server.js
176
177
  * through the names it binds the module to, a lib/ file through its own users, a suite directly. A lib/ file that no
@@ -628,6 +629,9 @@ function traceChanges(changes, ctx) {
628
629
  if (inList.has(g)) { picked.add(g); continue; }
629
630
  if (SUITE_NAME.test(g)) continue; // a suite of another group: nothing depends on it
630
631
  if (WIDE.has(g)) return `${f} is used by ${g}`;
632
+ // a verb module is named by the verb table only as `module: '<x>-cli.js'`: only `pmos <verb>` runs it, so its own suites are its users,
633
+ // not every user of the table (launch-readiness-check: a new verb module reached 177 suites through bin/pmos.js)
634
+ if (g === VERBS_FILE && /^lib\/[\w-]+-cli\.js$/.test(f) && new RegExp(`module: '${reEsc(stemOf(f))}\\.js'`).test(t)) continue;
631
635
  if (g.startsWith('public/')) { viaPublic(g); continue; }
632
636
  if (g === 'server.js') {
633
637
  const names = []; const inline = []; const factories = []; const whole = [];
@@ -699,6 +703,11 @@ function traceChanges(changes, ctx) {
699
703
  for (const s of list) if (s === 'headless.test.js' || rk.some((x) => (get(s) || '').includes(x))) picked.add(s);
700
704
  continue;
701
705
  }
706
+ const nv = f === VERBS_FILE ? newVerbOnly(sget(f), lines) : null;
707
+ if (nv) { // a new verb: only `pmos <verb>` calls reach it, so the suites that name the table or the verb's module
708
+ for (const s of list) { const t = get(s) || ''; if (t.includes('pmos-verbs') || nv.some((m) => t.includes(m))) picked.add(s); }
709
+ continue;
710
+ }
702
711
  let why = null;
703
712
  const before = picked.size;
704
713
  if (get(f) == null) { // removed: only the names in the suites can say who used it
@@ -722,6 +731,24 @@ function traceChanges(changes, ctx) {
722
731
  return { suites: list.filter((s) => picked.has(s)), why: `${changes.length} changed file(s) reach these suites` };
723
732
  }
724
733
 
734
+ /* launch-readiness-check: bin/pmos.js asks lib/pmos-verbs.js for every verb, so a change there reaches every suite. A change that only
735
+ * ADDS a verb is narrower: its `<verb>: Object.freeze({ module: '<x>-cli.js', …` line and its `help: '…' }),` line change only `pmos <verb>`.
736
+ * Returns the new modules' stems, or null when any changed line is something else. `src` is without comments. */
737
+ const VERBS_FILE = ['lib', 'pmos-verbs'].join('/') + '.js'; // built, so this file does not read as a user of it
738
+ function newVerbOnly(src, lines) {
739
+ if (src == null || !Array.isArray(lines) || !lines.length) return null;
740
+ const all = src.split('\n'), mods = [];
741
+ for (const n of lines) {
742
+ const l = all[n - 1];
743
+ if (l == null) return null;
744
+ if (!l.trim() || /^\s*help: '.*' \}\),\s*$/.test(l)) continue;
745
+ const m = /^\s*'?[\w-]+'?: Object\.freeze\(\{ module: '([\w-]+-cli)\.js', run: null, guide: '[\w.-]+',\s*$/.exec(l);
746
+ if (!m) return null;
747
+ mods.push(m[1]);
748
+ }
749
+ return mods.length ? mods : null;
750
+ }
751
+
725
752
  /* live-round (W1): lib/headless.js decides the kind of EVERY spawn through kindFor(), so a change there reaches every suite. A change that
726
753
  * only ADDS a kind is narrower: a new `const X_ORIGINS = Object.freeze(['p:'])`, its `if (X_ORIGINS.some(...)) return 'k';` line in kindFor,
727
754
  * its TOOLS entry and its name on WRITE_DIR_KINDS or WRITE_PATH_KINDS change only runs whose origin starts with 'p:'. Returns the new
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Launch readiness check (initiative launch-readiness-check, done test C1-C12): before a launch date, pmos launch check lists open tasks, tracker tickets, sign-offs with no answer and open questions. Pure checks plus the commands on a scratch product. No server, connector, model or network.",
3
+ "modules": [
4
+ "launch-readiness.test.js"
5
+ ],
6
+ "seconds": {
7
+ "launch-readiness.test.js": 15
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "A task opened from a place as the full popup from design system blocks (initiative viewer-ds-task, done test C1-C7): pm/vw-ds.js, pm/cozy-task-pop.js full mode, pm/premium-vw-item.js opener. Pure, node.",
3
+ "modules": [
4
+ "vw-ds.test.js"
5
+ ],
6
+ "seconds": {
7
+ "vw-ds.test.js": 2
8
+ }
9
+ }