create-pmos 0.413.0 → 0.415.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 +25 -25
- package/payload/AGENTS.md +2 -2
- package/payload/KIT-VERSION +1 -1
- package/payload/mods/pmos-cockpit/README.md +1 -1
- package/payload/mods/pmos-cockpit/hooks/lib/guard.mjs +11 -5
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/pmos-log.sh +12 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/bin/pmos.js +1 -1
- package/workspace/briefing-premium-board-test.js +45 -9
- package/workspace/briefing-premium-test.js +3 -2
- package/workspace/changelog.json +24 -0
- package/workspace/guide/programs.md +13 -0
- package/workspace/guide/workflows.md +10 -0
- package/workspace/home-other-product-test.js +18 -0
- package/workspace/lib/board-premium.js +9 -0
- package/workspace/lib/engine/boards.js +4 -2
- package/workspace/lib/goal-chat.js +46 -15
- package/workspace/lib/headless.js +10 -1
- package/workspace/lib/initiative-chat.js +5 -3
- package/workspace/lib/initiative-premium.js +4 -2
- package/workspace/lib/item-cli.js +2 -1
- package/workspace/lib/milestone-review.js +120 -0
- package/workspace/lib/milestone-suggest.js +176 -0
- package/workspace/lib/pmos-verbs.js +6 -0
- package/workspace/lib/program-cli.js +56 -0
- package/workspace/lib/programs.js +4 -1
- package/workspace/lib/routes-boards.js +121 -16
- package/workspace/lib/routes-briefing-premium.js +14 -1
- package/workspace/lib/routes-programs.js +73 -7
- package/workspace/lib/task-cli.js +168 -0
- package/workspace/lib/task-items.js +86 -0
- package/workspace/milestone-suggest-test.js +175 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-chat-line-test.js +3 -1
- package/workspace/public/pm/bd-ini-model.js +81 -0
- package/workspace/public/pm/bd-ini-panel.js +144 -59
- package/workspace/public/pm/bd-prog-panel.js +54 -14
- package/workspace/public/pm/cozy-home.css +5 -0
- package/workspace/public/pm/cozy-panel.css +2 -0
- package/workspace/public/pm/cozy-viewer.js +2 -0
- package/workspace/public/pm/cozy-xv.css +51 -16
- package/workspace/public/pm/cozy-xv.js +6 -5
- package/workspace/public/pm/home-app.js +13 -11
- package/workspace/public/pm/home-ask.js +9 -3
- package/workspace/public/pm/home-chat.js +10 -1
- package/workspace/public/pm/home-list.js +12 -7
- package/workspace/public/pm/home-stage-card.js +3 -2
- package/workspace/public/pm/home-today.js +5 -8
- package/workspace/public/pm/ms-suggest.css +50 -0
- package/workspace/public/pm/ms-suggest.js +98 -0
- package/workspace/public/pm/premium-board.js +11 -2
- package/workspace/public/pm/premium-initiative-head.js +25 -6
- package/workspace/public/pm/program-charter.js +47 -7
- package/workspace/public/pm/program-model.js +4 -1
- package/workspace/public/pm/wf-page.js +3 -0
- package/workspace/server.js +23 -1
- package/workspace/skills/milestone-review.skill +53 -0
- package/workspace/test-lists/bd-ini-panel.json +5 -0
- package/workspace/test-lists/milestone-suggest.json +6 -0
- package/workspace/test-lists/one-task-list.json +5 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* task-items.js — one kind of task (feedback batch 5, items 2 and 3; Wawan picked "One list", 2026-10-25).
|
|
3
|
+
* An initiative had two task stores: Board tasks (boards.jsonl, the Tasks section, `pmos task`) and breakdown items (the plan-items ledger,
|
|
4
|
+
* `pmos item`), which showed nowhere but the timeline. Claude added 19 work packages as breakdown items and the PM found none of them; a
|
|
5
|
+
* chat could not close three "workflow tasks" because `pmos task` did not see them. Here a breakdown item reads and writes as a task:
|
|
6
|
+
*
|
|
7
|
+
* isItemId(id) → whether id names a breakdown item (<initiative>.<10 characters>), not a Board task (task-…)
|
|
8
|
+
* STATE_OF[item.state] → its task state: todo To do · doing, review In progress · done Done
|
|
9
|
+
* rowsOf(root, ids, board) → the items of those initiatives as work items (routes-boards itemsOf's shape, src 'pmos', store 'item')
|
|
10
|
+
* itemOf(root, id) → the folded item, or null (a withdrawn item is gone: it was Won't do)
|
|
11
|
+
* stateEvents(it, state, why) → the plan-items lines that set a task state: a move, or a withdraw for Won't do and Archived
|
|
12
|
+
* editEvents(it, edit) → the lines of a rename, a reschedule or the Viewer's edits (title, owner, notes, start, due)
|
|
13
|
+
* write(root, events, actor, cli) → the plan-items writer's answer: appendFromCli for a `pmos` call (cli: { isTTY, env }), else appendFromUi
|
|
14
|
+
*
|
|
15
|
+
* The item keeps its store: its start and due still feed the timeline exactly as before (lib/board-fold.js, lib/item-spans.js), and
|
|
16
|
+
* `pmos item list` reads the same fold. Won't do is a withdraw, which the ledger cannot undo, so a closed item leaves the list. */
|
|
17
|
+
const planItems = require('./plan-items.js');
|
|
18
|
+
const actorLib = require('./actor.js');
|
|
19
|
+
|
|
20
|
+
const STATE_OF = Object.freeze({ todo: 'To do', doing: 'In progress', review: 'In progress', done: 'Done' });
|
|
21
|
+
const MOVE_TO = Object.freeze({ 'To do': 'todo', 'In progress': 'doing', Done: 'done' });
|
|
22
|
+
|
|
23
|
+
const isItemId = (id) => typeof id === 'string' && !/^task-/.test(id) && planItems.ID_RE.test(id) && !!planItems.initiativeOf(id);
|
|
24
|
+
|
|
25
|
+
/** An item's owner in the words the Board uses for a task's owner. */
|
|
26
|
+
function ownerName(o) {
|
|
27
|
+
if (o === 'you') return 'pm:' + actorLib.PM_SLUG;
|
|
28
|
+
if (o === 'agent') return 'Claude';
|
|
29
|
+
const m = /^(?:person|tracker):(.+)$/s.exec(String(o || ''));
|
|
30
|
+
return m ? m[1] : null;
|
|
31
|
+
}
|
|
32
|
+
/** A task owner typed on the page or the CLI, as an item owner. */
|
|
33
|
+
function ownerOf(text) {
|
|
34
|
+
const t = String(text || '').trim();
|
|
35
|
+
if (!t || /^pm:/.test(t) || t.toLowerCase() === 'you') return 'you';
|
|
36
|
+
if (/^(claude|agent)\b/i.test(t)) return 'agent';
|
|
37
|
+
return 'person:' + t.slice(0, 60);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function itemOf(root, id) {
|
|
41
|
+
try { return planItems.readFold(root).items[id] || null; } catch { return null; }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The breakdown items of the initiatives in `ids` (a Set), as work items. A proposed item is not a task yet. */
|
|
45
|
+
function rowsOf(root, ids, board) {
|
|
46
|
+
let f;
|
|
47
|
+
try { f = planItems.readFold(root); } catch { return []; }
|
|
48
|
+
const out = [];
|
|
49
|
+
for (const id of f.order) {
|
|
50
|
+
const it = f.items[id];
|
|
51
|
+
if (!it || it.proposed || !ids.has(it.initiative)) continue;
|
|
52
|
+
out.push({ uid: it.id, key: '', kind: 'Task', src: 'pmos', store: 'item', title: it.title, status: STATE_OF[it.state] || 'To do', blocked: !!it.blocked, owner: ownerName(it.owner),
|
|
53
|
+
notes: it.note || '', ini: it.initiative, epic: null, start: it.start || null, end: it.due || null, ref: it.id, board });
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** → { events } | { same: true } | { error } */
|
|
59
|
+
function stateEvents(it, state, why) {
|
|
60
|
+
if (state === "Won't do" || state === 'Archived') return { events: [{ ev: 'withdrawn', item: it.id }] };
|
|
61
|
+
const to = MOVE_TO[state];
|
|
62
|
+
if (!to) return { error: `state is one of ${Object.keys(MOVE_TO).concat("Won't do", 'Archived').join(', ')}` };
|
|
63
|
+
if (STATE_OF[it.state] === state) return { same: true };
|
|
64
|
+
const ev = { ev: 'moved', item: it.id, to };
|
|
65
|
+
// the reason a person gave is the Done's evidence: an agent Done with none goes to the PM to check (lib/plan-items.js noEvidence)
|
|
66
|
+
if (to === 'done' && typeof why === 'string' && why.trim()) ev.evidence = { kind: 'note', ref: why.trim().replace(/\s+/g, ' ').slice(0, 200) };
|
|
67
|
+
return { events: [ev] };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** edit: { title?, owner?, notes?, start?, due? } with '' clearing a day or the notes. → { events } | { error } */
|
|
71
|
+
function editEvents(it, edit) {
|
|
72
|
+
const fields = {};
|
|
73
|
+
if (edit.title != null) fields.title = String(edit.title).trim();
|
|
74
|
+
if (edit.owner != null) fields.owner = ownerOf(edit.owner);
|
|
75
|
+
if (edit.notes != null) fields.note = edit.notes === '' ? null : String(edit.notes).slice(0, 1000);
|
|
76
|
+
for (const k of ['start', 'due']) if (edit[k] != null) fields[k] = edit[k] === '' ? null : String(edit[k]);
|
|
77
|
+
if (!Object.keys(fields).length) return { error: 'nothing to change' };
|
|
78
|
+
return { events: [{ ev: 'set', item: it.id, fields }] };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function write(root, events, actor, cli) {
|
|
82
|
+
if (cli) return planItems.appendFromCli(root, events, cli);
|
|
83
|
+
return planItems.appendFromUi(root, events, { actor: actor && actor.by ? { by: actor.by, via: 'ui' } : undefined });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = { STATE_OF, isItemId, ownerName, ownerOf, itemOf, rowsOf, stateEvents, editEvents, write };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* milestone-suggest-test.js — Claude's milestone suggestions on the program panel, the charter and Home (feedback batch 4 item 6, option B;
|
|
4
|
+
* canvas XmsgB, sticky xmsgRules). Serves the real Board and Home pages from the real server; Project Ascent comes from fixtures/program-ascent.js
|
|
5
|
+
* with a `review` added the way GET /api/programs answers it, and the program writes are captured, not written.
|
|
6
|
+
* F a program with no milestones: Claude's first suggestions take the place of "Add the first milestone", each with why and its source; ✓ ✎ ✕
|
|
7
|
+
* are icon-only; keep all · W later changes lead Waits on you; ✓ keeps, ✕ drops · C the pencil opens the charter with the change filled in;
|
|
8
|
+
* Save writes it and answers the suggestion; last checked and Check now · Z nothing to suggest, nothing shows · K the ◆ dates are reported once
|
|
9
|
+
* · M Home's Your move has one line per program · H on a phone. PMOS_SHOTS=<dir> also saves the screenshots the frames are compared with. */
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const { spawn } = require('child_process');
|
|
13
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
14
|
+
const T = require('./test-run').configure({ name: 'milestone-suggest' });
|
|
15
|
+
const BP = require('./lib/board-premium.js');
|
|
16
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
17
|
+
const A = require('./fixtures/program-ascent.js');
|
|
18
|
+
|
|
19
|
+
const BASE = T.BASE;
|
|
20
|
+
const SHOTS = process.env.PMOS_SHOTS || '';
|
|
21
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
22
|
+
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
23
|
+
const results = [];
|
|
24
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
25
|
+
let srv = null; let browser = null;
|
|
26
|
+
const finish = async (code) => {
|
|
27
|
+
if (browser) await browser.close().catch(() => {});
|
|
28
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
29
|
+
T.killTmux();
|
|
30
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
31
|
+
console.log(`\n${results.length - bad}/${results.length} milestone-suggest assertions passed`);
|
|
32
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
33
|
+
};
|
|
34
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
35
|
+
|
|
36
|
+
const CHECKED = new Date(Date.now() - 3 * 3600e3).toISOString();
|
|
37
|
+
const CHANGES = [
|
|
38
|
+
{ key: 'k-move', op: 'move', milestone: 'pilot-live', date: '2026-12-02', why: 'Was Nov 18. Jira moved epic DSC-41 to sprint 24, which ends Dec 1.', src: { kind: 'jira', label: 'Jira, read 2h ago' } },
|
|
39
|
+
{ key: 'k-add', op: 'add', name: 'Partner SSO cut-over', date: '2027-03-15', waits: ['microsite-signin'], why: 'Partner SSO joined the program yesterday. Its ◆ Deliver is Mar 15, 2027.', src: { kind: 'member', label: 'Partner SSO' } },
|
|
40
|
+
{ key: 'k-risk', op: 'risk', milestone: 'legacy-idp-off', why: 'Steering, Oct 23: legal holds the deletion of the old user store until a review in March.', src: { kind: 'meeting', label: 'Steering, Oct 23' } },
|
|
41
|
+
];
|
|
42
|
+
const FIRST = [
|
|
43
|
+
{ key: 'f1', op: 'add', name: 'Vendor contract signed', date: '2026-10-28', waits: [], why: 'A check you tick. The vendor order form is due Oct 28, and the pilot cannot start without it.', src: { kind: 'task', label: 'Task, due Oct 28' } },
|
|
44
|
+
{ key: 'f2', op: 'add', name: 'Pilot live', date: '2026-11-14', waits: ['descope-parity', 'microsite-signin'], why: 'Descope feature parity and Microsite sign-in both reach ◆ Deliver by Nov 14. The Oct 22 steering notes call this the pilot.', src: { kind: 'deliver', label: '2 initiatives' } },
|
|
45
|
+
{ key: 'f3', op: 'add', name: 'Legacy IdP off', date: '2027-02-20', waits: ['legacy-idp-sunset'], why: 'Waits on Legacy IdP sunset reaching ◆ Deliver on Feb 20, 2027.', src: { kind: 'deliver', label: 'Legacy IdP sunset' } },
|
|
46
|
+
{ key: 'f4', op: 'add', name: 'Program review', date: '2028-06-30', waits: [], why: 'A check you tick, on the program\'s target date.', src: { kind: 'target', label: 'Program target' } },
|
|
47
|
+
];
|
|
48
|
+
const withReview = (open, o = {}) => F.programs().map((p) => ({ ...p, ...(o.empty ? { milestones: [] } : {}), review: { checked: CHECKED, running: false, open, facts: o.facts || '' } }));
|
|
49
|
+
|
|
50
|
+
(async () => {
|
|
51
|
+
const exe = process.env.PMOS_CHROME || findBrowser();
|
|
52
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
53
|
+
let chromium;
|
|
54
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
55
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
56
|
+
await T.waitForServer(BASE);
|
|
57
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
58
|
+
if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
|
|
59
|
+
const shot = async (p, name) => { if (SHOTS) await p.screenshot({ path: path.join(SHOTS, name + '.png') }); };
|
|
60
|
+
|
|
61
|
+
const open = async ({ w = 1440, h = 900, programs = withReview(CHANGES), dark = false, home = false } = {}) => {
|
|
62
|
+
const c = await browser.newContext({ viewport: { width: w, height: h }, colorScheme: dark ? 'dark' : 'light' });
|
|
63
|
+
const page = await c.newPage();
|
|
64
|
+
const errors = [], posts = [];
|
|
65
|
+
page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
|
|
66
|
+
await page.route('**/api/board-premium*', (r) => { const ws = new URL(r.request().url()).searchParams.get('ws') || 'idpf'; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: BP.build(F.programFacts(ws)), as_of: Date.now() }) }); });
|
|
67
|
+
await page.route('**/api/programs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, programs }) }));
|
|
68
|
+
const wsOf = (r) => new URL(r.request().url()).searchParams.get('ws') || 'idpf', json = (r, b) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(b) });
|
|
69
|
+
await page.route('**/api/boards/anchors*', (r) => json(r, { ok: true, anchors: A.ANCHORS[wsOf(r)] || [] }));
|
|
70
|
+
await page.route('**/api/insights-premium*', (r) => json(r, { ok: true, model: { goals: A.GOALS[wsOf(r)] || [] } }));
|
|
71
|
+
await page.route('**/api/boards/items*', (r) => json(r, { ok: true, items: A.ITEMS[wsOf(r)] || [] }));
|
|
72
|
+
await page.route('**/api/programs/*', (r) => { const rq = r.request(); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
73
|
+
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: '{"ok":false,"error":"not in this check"}' }));
|
|
74
|
+
if (home) { await page.goto(BASE + '/premium.html?ws=idpf'); return { page, ctx: c, errors, posts }; }
|
|
75
|
+
await page.goto(BASE + '/premium-board.html?ws=idpf&program=' + programs[0].id);
|
|
76
|
+
await until(() => page.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden && !!v.querySelector('.pp-vw .czs-sum'); }));
|
|
77
|
+
await until(() => page.evaluate(() => !/reading its board/.test((document.querySelector('#czViewer [data-czs-id="tree"]') || {}).textContent || '')), 6000);
|
|
78
|
+
return { page, ctx: c, errors, posts };
|
|
79
|
+
};
|
|
80
|
+
const charterShown = (p) => until(() => p.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden && /Charter/.test(v.getAttribute('aria-label') || '') && !!v.querySelector('.pc-vw .pc'); }));
|
|
81
|
+
const rows = (p, sel) => p.evaluate((s) => [...document.querySelectorAll(s + ' .msg-r')].map((r) => ({ t: r.querySelector('.msg-h b').textContent, d: (r.querySelector('.msg-d') || {}).textContent || '', why: r.querySelector('.msg-w').textContent, src: (r.querySelector('.msg-src') || {}).textContent || '',
|
|
82
|
+
presses: [...r.querySelectorAll('[data-ms-act]')].map((b) => b.dataset.msAct + (b.textContent.trim() ? ':text' : '') + (b.getAttribute('aria-label') ? '' : ':nolabel')) })), sel);
|
|
83
|
+
const wait = (p, f) => until(() => p.evaluate(f));
|
|
84
|
+
|
|
85
|
+
/* ── F: a program with no milestones ── */
|
|
86
|
+
const N = await open({ programs: withReview(FIRST, { empty: true }) });
|
|
87
|
+
const f = await rows(N.page, '#czViewer .msg-box');
|
|
88
|
+
const fh = await N.page.evaluate(() => ({ head: (document.querySelector('#czViewer .msg-box .msg-hd .msg-ht') || {}).textContent || '', ghost: !!document.querySelector('#czViewer [data-pp="first"]'), all: [...document.querySelectorAll('#czViewer .msg-hd [data-ms-act]')].map((b) => b.dataset.msAct) }));
|
|
89
|
+
ok('F a program with no milestones: Claude\'s first suggestions take the place of "Add the first milestone"', f.length === 4 && !fh.ghost && fh.head === 'Claude suggests 4 milestones from a task, the initiatives\' ◆ dates and the target date', JSON.stringify(fh));
|
|
90
|
+
ok('F each row: its name, date, why and source; ✓ ✎ ✕ icon-only with a label', f[0].t === 'Vendor contract signed' && f[0].d === 'Oct 28' && /order form is due Oct 28/.test(f[0].why) && f[0].src === 'Task, due Oct 28'
|
|
91
|
+
&& f.every((r) => r.presses.join() === 'keep,edit,drop'), JSON.stringify(f[0]));
|
|
92
|
+
await shot(N.page, 'XmsgB-first-built');
|
|
93
|
+
await N.page.click('#czViewer .msg-hd [data-ms-act="keepall"]');
|
|
94
|
+
await wait(N.page, () => true);
|
|
95
|
+
await until(() => N.posts.filter((x) => x.path === '/api/programs/suggestion').length >= 4, 6000);
|
|
96
|
+
const ka = N.posts.filter((x) => x.path === '/api/programs/suggestion').map((x) => x.body.key + ':' + x.body.answer);
|
|
97
|
+
ok('F keep all keeps each one, in order, one at a time', ka.join() === 'f1:keep,f2:keep,f3:keep,f4:keep', ka.join());
|
|
98
|
+
ok('0 no page error (first suggestions)', N.errors.length === 0, N.errors.join(' | '));
|
|
99
|
+
await N.ctx.close();
|
|
100
|
+
|
|
101
|
+
/* ── W: later changes in Waits on you ── */
|
|
102
|
+
const D = await open();
|
|
103
|
+
const p = D.page;
|
|
104
|
+
const w = await rows(p, '#czViewer [data-czs-id="needs"]');
|
|
105
|
+
const cnt = await p.evaluate(() => (document.querySelector('#czViewer [data-czs-fold="needs"] .czs-n, #czViewer [data-czs-id="needs"] .czs-n') || {}).textContent || '');
|
|
106
|
+
ok('W the changes lead Waits on you, in plain words, each with why and its source', w.map((r) => r.t).join('|') === 'Move Pilot live to Dec 2|Partner SSO cut-over|Mark Legacy IdP off at risk' && w[0].src === 'Jira, read 2h ago' && /DSC-41/.test(w[0].why), JSON.stringify(w));
|
|
107
|
+
ok('W the Waits on you count includes them', /^\d+$/.test(cnt.trim()) && Number(cnt) >= 3, cnt);
|
|
108
|
+
ok('W the track stays as it is until the PM keeps a change', await p.evaluate(() => !!document.querySelector('#czViewer .pp-mt') && !document.querySelector('#czViewer .msg-box')));
|
|
109
|
+
ok('K the ◆ dates the page reads are reported once, so a moved date asks Claude for a review', await until(() => D.posts.filter((x) => x.path === '/api/programs/facts').length === 1, 4000) && /descope-parity:\d{4}-\d{2}-\d{2}/.test((D.posts.find((x) => x.path === '/api/programs/facts') || { body: {} }).body.fp || ''), JSON.stringify(D.posts.filter((x) => x.path === '/api/programs/facts')));
|
|
110
|
+
await shot(p, 'XmsgB-asks-built');
|
|
111
|
+
await p.click('#czViewer [data-ms-act="keep"][data-key="k-move"]');
|
|
112
|
+
await until(() => D.posts.some((x) => x.path === '/api/programs/suggestion'), 4000);
|
|
113
|
+
ok('W ✓ keeps it in one press', D.posts.some((x) => x.path === '/api/programs/suggestion' && x.body.key === 'k-move' && x.body.answer === 'keep' && x.body.program === 'project-ascent'));
|
|
114
|
+
await until(() => p.evaluate(() => !document.querySelector('#czViewer [data-ms-act][disabled]')), 4000);
|
|
115
|
+
await p.click('#czViewer [data-ms-act="drop"][data-key="k-risk"]');
|
|
116
|
+
await until(() => D.posts.some((x) => x.body.key === 'k-risk'), 4000);
|
|
117
|
+
ok('W ✕ drops it', D.posts.some((x) => x.body.key === 'k-risk' && x.body.answer === 'decline'));
|
|
118
|
+
|
|
119
|
+
/* ── C: the pencil opens the charter with the change filled in ── */
|
|
120
|
+
await until(() => p.evaluate(() => !document.querySelector('#czViewer [data-ms-act][disabled]')), 4000);
|
|
121
|
+
await p.click('#czViewer [data-ms-act="edit"][data-key="k-move"]');
|
|
122
|
+
ok('C the pencil opens the charter', await charterShown(p));
|
|
123
|
+
const cv = await p.evaluate(() => { const r = document.querySelector('#czViewer .pc-lnw.msg-on'); return { day: r && r.querySelector('.pc-fd span').textContent, note: r && (r.querySelector('.msg-chg') || {}).textContent, save: !!document.querySelector('#czViewer .cz-vw-hd .cz-vw-pri'), chk: (document.querySelector('#czViewer .msg-chk span') || {}).textContent || '', now: !!document.querySelector('#czViewer [data-pc="checknow"][aria-label="Check now"]') }; });
|
|
124
|
+
ok('C the change is filled in, unsaved: the row says what it was, and Save shows', cv.day === 'Dec 2' && /^Claude's change, was Nov 18, ready to save\. Edit it, then Save\.$/.test(cv.note || '') && cv.save, JSON.stringify(cv));
|
|
125
|
+
ok('C the charter says when Claude last checked, with Check now', /^Claude checks every Monday and when a date, Jira or a meeting changes\. Last checked today, \d\d:\d\d\.$/.test(cv.chk) && cv.now, cv.chk);
|
|
126
|
+
await shot(p, 'XmsgB-charter-built');
|
|
127
|
+
await p.click('#czViewer .cz-vw-hd .cz-vw-pri');
|
|
128
|
+
await until(() => D.posts.some((x) => x.body.key === 'k-move' && x.body.answer === 'edit'), 5000);
|
|
129
|
+
const sv = D.posts.find((x) => x.path === '/api/programs/save');
|
|
130
|
+
ok('C Save writes the charter with the new date (ids kept) and answers the suggestion', !!sv && sv.body.program.milestones.find((m) => m.id === 'pilot-live').date === '2026-12-02' && D.posts.some((x) => x.body.key === 'k-move' && x.body.answer === 'edit'), JSON.stringify(sv && sv.body.program.milestones.map((m) => m.id + ':' + m.date)));
|
|
131
|
+
await p.click('#czViewer [data-pc="checknow"]');
|
|
132
|
+
await until(() => D.posts.some((x) => x.path === '/api/programs/review'), 4000);
|
|
133
|
+
ok('C Check now asks Claude to review', D.posts.some((x) => x.path === '/api/programs/review' && x.body.program === 'project-ascent'));
|
|
134
|
+
ok('0 no page error (desk)', D.errors.length === 0, D.errors.join(' | '));
|
|
135
|
+
await D.ctx.close();
|
|
136
|
+
|
|
137
|
+
/* ── Z: nothing to suggest, nothing shows; facts already heard are not sent again ── */
|
|
138
|
+
const Z = await open({ programs: withReview([], { facts: '__set_below__' }) });
|
|
139
|
+
ok('Z nothing to suggest: no suggestion row anywhere on the panel', await Z.page.evaluate(() => !document.querySelector('#czViewer .msg-r, #czViewer .msg-box')));
|
|
140
|
+
await Z.ctx.close();
|
|
141
|
+
|
|
142
|
+
/* ── M: Home's Your move ── */
|
|
143
|
+
const M = await open({ home: true });
|
|
144
|
+
// Your move lives in Your day, which the greeting opens
|
|
145
|
+
if (await until(() => M.page.$('[data-hm-day]'), 10000)) { await until(() => M.page.evaluate(() => !!document.querySelector('[data-hm-prog]')), 8000); await M.page.click('[data-hm-day]'); }
|
|
146
|
+
const hm = await until(() => M.page.evaluate(() => { const b = document.querySelector('[data-hm-sel="ms:project-ascent"]'); return b ? [...b.querySelectorAll('b, em')].map((x) => x.textContent.trim()).join(' · ') : null; }), 10000);
|
|
147
|
+
ok('M Home\'s Your move has one line for the program: its name and the changes', hm === 'Project Ascent · 3 milestone changes · Pilot live to Dec 2', String(hm));
|
|
148
|
+
if (hm) {
|
|
149
|
+
await M.page.click('[data-hm-sel="ms:project-ascent"]');
|
|
150
|
+
ok('M a tap opens the program, where the changes lead Waits on you', !!(await until(() => M.page.evaluate(() => !!document.querySelector('#czViewer [data-czs-id="needs"] .msg-r')), 8000)));
|
|
151
|
+
}
|
|
152
|
+
ok('0 no page error on Home', M.errors.length === 0, M.errors.join(' | '));
|
|
153
|
+
await M.ctx.close();
|
|
154
|
+
|
|
155
|
+
/* ── H: a phone ── */
|
|
156
|
+
const S = await open({ w: 390, h: 844 });
|
|
157
|
+
const sp = await S.page.evaluate(() => { const b = document.querySelector('#czViewer [data-ms-act="keep"]'); const r = b && b.getBoundingClientRect(); return { size: r ? Math.round(r.width) : 0, wide: document.documentElement.scrollWidth <= innerWidth + 1 }; });
|
|
158
|
+
ok('H on a phone the presses are 40 px and nothing scrolls sideways', sp.size >= 40 && sp.wide, JSON.stringify(sp));
|
|
159
|
+
await S.page.evaluate(() => { const r = document.querySelector('#czViewer [data-czs-id="needs"]'); if (r) r.scrollIntoView(); });
|
|
160
|
+
await shot(S.page, 'XmsgB-phone-built');
|
|
161
|
+
ok('0 no page error on a phone', S.errors.length === 0, S.errors.join(' | '));
|
|
162
|
+
await S.ctx.close();
|
|
163
|
+
|
|
164
|
+
if (SHOTS) { // dark, for the look only
|
|
165
|
+
const K = await open({ dark: true });
|
|
166
|
+
await shot(K.page, 'XmsgB-asks-built-dark'); await K.ctx.close();
|
|
167
|
+
const K2 = await open({ dark: true, w: 390, h: 844, programs: withReview(FIRST, { empty: true }) });
|
|
168
|
+
await shot(K2.page, 'XmsgB-first-phone-dark'); await K2.ctx.close();
|
|
169
|
+
const K3 = await open({ w: 390, h: 844, home: true });
|
|
170
|
+
if (await until(() => K3.page.$('[data-hm-day]'), 8000)) { await until(() => K3.page.evaluate(() => !!document.querySelector('[data-hm-prog]')), 8000); await K3.page.click('[data-hm-day]'); }
|
|
171
|
+
await until(() => K3.page.$('[data-hm-sel="ms:project-ascent"]'), 8000);
|
|
172
|
+
await shot(K3.page, 'XmsgB-home-phone'); await K3.ctx.close();
|
|
173
|
+
}
|
|
174
|
+
finish();
|
|
175
|
+
})();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.415.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.415.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* P2 (390) a tap opens the line in place: the head line, every point, the Now row and Watch its terminal; Stop reaches the server;
|
|
8
8
|
* the line stays at the top while the page scrolls
|
|
9
9
|
* P3 (390) a session with no step list: "Working · m:ss", no count; a session with its own steps: its step and "1 of 3 done"
|
|
10
|
-
* P4 (390) Claude asks: the line is blue, "Claude asks before it goes on"; a tap scrolls to the ask, not to the Viewer
|
|
10
|
+
* P4 (390) Claude asks: the line is blue, "Claude asks before it goes on"; a tap scrolls to the ask, not to the Viewer, and pulses it
|
|
11
11
|
* P5/P6 a finished goal: no line; "Goal done" over Claude's result, or the amber "Goal stopped: …" and the box says how to go on
|
|
12
12
|
* P5b a goal that finished before every shown message: its divider leads the log, never trails the newest message
|
|
13
13
|
* P7 (390) a meeting records: the pill is in the chat's top bar, which shows ← and the title only
|
|
@@ -139,6 +139,8 @@ const look = () => {
|
|
|
139
139
|
await p.click('#hmPl [data-pl="toggle"]'); await sleep(500);
|
|
140
140
|
const s1 = await p.evaluate(look);
|
|
141
141
|
ok('P4 a tap goes to the ask in the conversation, not to a panel', !s1.open && !s1.vw, JSON.stringify(s1));
|
|
142
|
+
const fl = await p.evaluate(() => { const f = document.querySelector('#hmLog .hm-flash'); return f ? f.textContent : ''; });
|
|
143
|
+
ok('P4b the tap is never silent: Claude\'s newest message, where the goal asks, pulses once (feedback batch 4, item 3)', /Is the draft ready for Dita\?/.test(fl), fl);
|
|
142
144
|
ok('F1 (ask) no page error', !errs.length, errs.join(' | '));
|
|
143
145
|
await ctx.close(); }
|
|
144
146
|
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* pm/bd-ini-model.js — the Board's initiative panel, read as XipB (feedback batch 4 item 1, agreed 2026-10-25): what the panel says, as data.
|
|
2
|
+
* Pure: no DOM, no reads. pm/bd-ini-panel.js draws it; bd-ini-model.test.js checks it.
|
|
3
|
+
*
|
|
4
|
+
* dateY(iso, now) "Aug 11" this year, "Feb 3, 2027" in any other: a date never reads as this year's when it is not
|
|
5
|
+
* ladderOf(r, pfSteps) the stages of the initiative's OWN workflow (r.wfStages, D99), the current one, the skipped ones and the next one;
|
|
6
|
+
* Product feature is the board's eight steps (pfSteps)
|
|
7
|
+
* whyOf(r, pfSteps, now) the one sentence under the status: the plan end passed, or Jira's pace runs past it, then the first blocked ticket
|
|
8
|
+
* planModel(r, now) the Plan card's line: your plan, past the plan, Jira's pace, today, as percents of the span; null with no date
|
|
9
|
+
* blockedLine(track) "SLV-144 is blocked by PLAT-88." */
|
|
10
|
+
const plural = (n, a, b) => (n === 1 ? a : b);
|
|
11
|
+
const dayWord = (n) => n + ' ' + plural(n, 'day', 'days');
|
|
12
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
13
|
+
const dayOf = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
14
|
+
const todayOf = (now) => { const d = new Date(now == null ? Date.now() : now); return new Date(d.getFullYear(), d.getMonth(), d.getDate()); };
|
|
15
|
+
const between = (a, b) => Math.round((b - a) / 864e5);
|
|
16
|
+
/** "Aug 11" this year, "Feb 3, 2027" in any other year: a date never reads as this year's when it is not. */
|
|
17
|
+
export function dateY(iso, now) {
|
|
18
|
+
const d = dayOf(iso); if (!d) return '';
|
|
19
|
+
return MON[d.getMonth()] + ' ' + d.getDate() + (d.getFullYear() !== todayOf(now).getFullYear() ? ', ' + d.getFullYear() : '');
|
|
20
|
+
}
|
|
21
|
+
const PF_ID = 'product-feature';
|
|
22
|
+
/** The initiative's own workflow, when it is not Product feature and the row carries its stages (D99). */
|
|
23
|
+
export const ownWf = (r) => !!(r && r.wf && r.wf.id && r.wf.id !== PF_ID && Array.isArray(r.wfStages) && r.wfStages.length && r.wfStage);
|
|
24
|
+
/** The ladder of the initiative's own workflow: { steps [{ key, label, ms }], k (the current one), skipped [indexes], next (the stage after,
|
|
25
|
+
* skipped ones left out), name (the current stage's name), wf }. Product feature is the board's eight steps. */
|
|
26
|
+
export function ladderOf(r, pfSteps) {
|
|
27
|
+
const t = r.track || {};
|
|
28
|
+
if (ownWf(r)) {
|
|
29
|
+
const S = r.wfStages, k = S.findIndex((s) => s.key === r.wfStage.key);
|
|
30
|
+
const skipped = S.map((s, j) => (s.status === 'skipped' && j !== k ? j : -1)).filter((j) => j >= 0);
|
|
31
|
+
const next = k >= 0 ? S.slice(k + 1).find((s) => s.status !== 'skipped') || null : null;
|
|
32
|
+
return { own: true, steps: S.map((s) => ({ key: s.key, label: s.name, ms: !!s.milestone })), k, skipped, name: r.wfStage.name || (k >= 0 ? S[k].name : ''), stage: k >= 0 ? S[k] : r.wfStage,
|
|
33
|
+
next: next ? { key: next.key, label: next.name, ms: !!next.milestone } : null, wf: r.wf };
|
|
34
|
+
}
|
|
35
|
+
const S = (pfSteps || []).map((s) => ({ key: s.key, label: s.label, ms: !!s.ms })), k = t.k == null ? -1 : t.k, sk = new Set(t.skipped || []);
|
|
36
|
+
const next = k >= 0 ? S.slice(k + 1).find((s, j) => !sk.has(k + 1 + j)) || null : null;
|
|
37
|
+
return { own: false, steps: S, k, skipped: [...sk], name: k >= 0 && S[k] ? S[k].label : (t.label || r.stage || ''), stage: null, next, wf: r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' } };
|
|
38
|
+
}
|
|
39
|
+
/** The first open ticket Jira flags as blocked, said in words: "SLV-144 is blocked by PLAT-88." */
|
|
40
|
+
export function blockedLine(t) {
|
|
41
|
+
const k = (t.tickets || []).find((x) => x.blocked && x.status !== 'Done'); if (!k) return '';
|
|
42
|
+
const on = /\b([A-Z][A-Z0-9]+-\d+)\b/.exec(k.reason || '');
|
|
43
|
+
return k.key + ' is blocked' + (on && on[1] !== k.key ? ' by ' + on[1] : '') + '.';
|
|
44
|
+
}
|
|
45
|
+
/** The one sentence that says why the status is what it is, from the record: the plan end passed, or Jira's pace runs past it. '' when
|
|
46
|
+
* neither holds (the status says enough). now: ms, for the tests. */
|
|
47
|
+
export function whyOf(r, pfSteps, now) {
|
|
48
|
+
const t = r.track || {}, today = todayOf(now), end = dayOf(r.end), fc = dayOf(t.forecast), L = ladderOf(r, pfSteps);
|
|
49
|
+
const done = r.status === 'done' || r.status === 'cancelled';
|
|
50
|
+
const said = [];
|
|
51
|
+
if (end && end < today && !done) said.push('The plan ended ' + dateY(r.end, now) + ', ' + dayWord(between(end, today)) + ' ago, and ' + r.title + ' is in ' + (L.name || 'a stage not on record') + '.');
|
|
52
|
+
else if (end && fc && fc > end && !done) said.push('Jira’s pace ends it ' + dateY(t.forecast, now) + ', ' + dayWord(between(end, fc)) + ' after your plan.');
|
|
53
|
+
const bl = blockedLine(t); if (bl) said.push(bl);
|
|
54
|
+
return said.join(' ');
|
|
55
|
+
}
|
|
56
|
+
/** The plan line's model (XipB): the grey bar is your plan (start → planned end), amber dashed is past the plan to today, blue dashed is
|
|
57
|
+
* Jira's expected end beyond the plan, a tick for today. Positions are percents of the span drawn. null when no record holds a date for it
|
|
58
|
+
* (zero is silence). now: ms, for the tests. */
|
|
59
|
+
export function planModel(r, now) {
|
|
60
|
+
const t = r.track || {}, today = todayOf(now), st = dayOf(r.start), end = dayOf(r.end), fc = dayOf(t.forecast);
|
|
61
|
+
if (!end && !fc) return null;
|
|
62
|
+
const done = r.status === 'done' || r.status === 'cancelled';
|
|
63
|
+
const over = !!(end && end < today && !done), exp = !!(fc && (!end || fc > end) && !done);
|
|
64
|
+
const pts = [st, end, today, exp ? fc : null].filter(Boolean), lo = Math.min(...pts), hi = Math.max(...pts), span = hi - lo || 1;
|
|
65
|
+
const at = (d) => Math.round(((d - lo) / span) * 1000) / 10;
|
|
66
|
+
const m = { over, exp, today: at(today), marks: [], legend: [] };
|
|
67
|
+
if (end) m.bar = { from: at(st || (exp && !over ? today : end)), to: at(end) };
|
|
68
|
+
if (over) m.overBar = { from: at(end), to: at(today), days: between(end, today) };
|
|
69
|
+
if (exp) m.expBar = { from: at(end && end > today ? end : today), to: at(fc), days: end ? between(end, fc) : null };
|
|
70
|
+
if (st) m.marks.push({ at: at(st), label: dateY(r.start, now), kind: 'start' });
|
|
71
|
+
if (end) m.marks.push({ at: at(end), label: dateY(r.end, now), word: 'plan end', kind: 'end' });
|
|
72
|
+
// Today and Jira's date both label the top: when they would touch, Today keeps its tick and the legend names it instead
|
|
73
|
+
const crowd = exp && Math.abs(at(fc) - at(today)) < 24;
|
|
74
|
+
m.marks.push({ at: at(today), label: 'Today', kind: 'today', warn: over, ...(crowd ? { hide: true } : {}) });
|
|
75
|
+
if (exp) m.marks.push({ at: at(fc), label: dateY(t.forecast, now), word: 'Jira', kind: 'jira' });
|
|
76
|
+
if (end) m.legend.push({ kind: 'plan', text: 'Your plan' });
|
|
77
|
+
if (over) m.legend.push({ kind: 'over', text: 'Past the plan · ' + dayWord(m.overBar.days) });
|
|
78
|
+
if (exp) m.legend.push({ kind: 'exp', text: 'Jira’s pace' + (m.expBar.days != null ? ' · ' + dayWord(m.expBar.days) + ' more' : '') });
|
|
79
|
+
if (!over || crowd) m.legend.push({ kind: over ? 'today am' : 'today', text: 'Today' });
|
|
80
|
+
return m;
|
|
81
|
+
}
|