create-pmos 0.413.0 → 0.414.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 +13 -13
- 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/briefing-premium-board-test.js +45 -9
- package/workspace/briefing-premium-test.js +3 -2
- package/workspace/changelog.json +12 -0
- package/workspace/guide/programs.md +13 -0
- package/workspace/guide/workflows.md +7 -0
- package/workspace/home-other-product-test.js +18 -0
- package/workspace/lib/board-premium.js +1 -0
- package/workspace/lib/headless.js +10 -1
- package/workspace/lib/initiative-chat.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 +4 -2
- package/workspace/lib/routes-programs.js +73 -7
- package/workspace/lib/task-cli.js +120 -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 +123 -58
- 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-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 +1 -1
- package/workspace/public/pm/premium-initiative-head.js +13 -4
- 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
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* task-cli.js — `pmos task …`: an initiative's Board tasks from a terminal, so an agent the PM asks can close or move them (Wawan,
|
|
3
|
+
* 2026-10-25: "I made instruction to move, but agent still ask to move myself from Board").
|
|
4
|
+
*
|
|
5
|
+
* pmos task list <initiative> [--all] its open tasks (To do, In progress); --all adds Done, Won't do and Archived
|
|
6
|
+
* pmos task state <task> [<task> …] --to <state> [--why <text>]
|
|
7
|
+
* set each task's state: To do, In progress, Done, Won't do or Archived. One task-update line per task in boards.jsonl, written by
|
|
8
|
+
* the same function as the Board's press (lib/routes-boards.js taskState, POST /api/boards/tasks/state), with the agent as the writer.
|
|
9
|
+
*
|
|
10
|
+
* A Board task is not a breakdown item (`pmos item`) and has no workflow stage: its only stage is its state. The initiative's workflow
|
|
11
|
+
* stage is `pmos workflow of|move`. Who wrote a line is the call path (lib/actor.js), never an argument. Exit codes: 0 done, 1 refused,
|
|
12
|
+
* 2 usage. Nothing is sent. */
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { execFileSync } = require('child_process');
|
|
15
|
+
const actorLib = require('./actor.js');
|
|
16
|
+
const driver = require('./driver.js');
|
|
17
|
+
const { repoScript } = require('./repo-script.js');
|
|
18
|
+
const B = require(repoScript('boards.js'));
|
|
19
|
+
|
|
20
|
+
const COMMANDS = { task: ['list', 'state'] };
|
|
21
|
+
const USAGE = [
|
|
22
|
+
'usage: pmos task list|state — an initiative\'s Board tasks',
|
|
23
|
+
' pmos task list <initiative> [--all] its open tasks; --all adds Done, Won\'t do and Archived',
|
|
24
|
+
' pmos task state <task> [<task> …] --to <state> [--why <text>]',
|
|
25
|
+
' Set each task\'s state when the PM asks: To do, In progress, Done, Won\'t do or Archived. The Board shows it at once.',
|
|
26
|
+
' A Board task has no workflow stage: its only stage is its state. Move the initiative with pmos workflow move.',
|
|
27
|
+
' every command: [--json] [--root <dir>]. Nothing is sent.',
|
|
28
|
+
];
|
|
29
|
+
const BOOL = new Set(['json', 'help', 'all']);
|
|
30
|
+
const VALUE = new Set(['to', 'why', 'root']);
|
|
31
|
+
const OPEN = new Set(['To do', 'In progress']);
|
|
32
|
+
/** The PM's words for a state: any case, with or without the apostrophe or the space. */
|
|
33
|
+
function stateOf(s) {
|
|
34
|
+
const k = String(s || '').toLowerCase().replace(/[^a-z]/g, '');
|
|
35
|
+
return { todo: 'To do', inprogress: 'In progress', doing: 'In progress', done: 'Done', wontdo: "Won't do", archived: 'Archived', archive: 'Archived' }[k] || null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function parse(argv) {
|
|
39
|
+
const pos = []; const flags = {};
|
|
40
|
+
for (let i = 0; i < argv.length; i++) {
|
|
41
|
+
const a = argv[i];
|
|
42
|
+
if (a === '-h') { flags.help = true; continue; }
|
|
43
|
+
if (!a.startsWith('--')) { pos.push(a); continue; }
|
|
44
|
+
const eq = a.indexOf('=');
|
|
45
|
+
const key = eq > 0 ? a.slice(2, eq) : a.slice(2);
|
|
46
|
+
if (BOOL.has(key)) { flags[key] = true; continue; }
|
|
47
|
+
let val;
|
|
48
|
+
if (eq > 0) val = a.slice(eq + 1);
|
|
49
|
+
else { const next = argv[i + 1]; if (next === undefined || next.startsWith('--')) val = ''; else { val = next; i++; } }
|
|
50
|
+
flags[key] = val;
|
|
51
|
+
}
|
|
52
|
+
return { pos, flags };
|
|
53
|
+
}
|
|
54
|
+
function repoRoot(cwd) {
|
|
55
|
+
try { return execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; }
|
|
56
|
+
catch { return cwd; }
|
|
57
|
+
}
|
|
58
|
+
/** The Board's routes outside HTTP: this repository as the one workspace, its state folder, and the PMOS checkout as the self board. */
|
|
59
|
+
function boardsCtx(root, stateDir) {
|
|
60
|
+
const w = { id: driver.wsIdOf(root), name: path.basename(root), root };
|
|
61
|
+
return { w, ctx: { getWs: () => w, workspaceList: () => [w], stateDirFor: () => stateDir, selfRoot: path.resolve(__dirname, '..', '..') } };
|
|
62
|
+
}
|
|
63
|
+
const line = (t) => `${t.id} · ${t.state} · ${t.title}${t.kind === 'Epic' ? ' (epic)' : ''}${t.due ? ' · due ' + t.due : ''}`;
|
|
64
|
+
|
|
65
|
+
async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isTTY, env } = {}) {
|
|
66
|
+
const args = argv[0] === 'task' ? argv.slice(1) : argv.slice();
|
|
67
|
+
const verb = args[0];
|
|
68
|
+
const { pos, flags } = parse(args.slice(1));
|
|
69
|
+
const json = !!flags.json;
|
|
70
|
+
if (!verb || verb === 'help' || verb === '--help' || verb === '-h' || flags.help) { for (const l of USAGE) say(l); return verb ? 0 : 1; }
|
|
71
|
+
if (!COMMANDS.task.includes(verb)) { say(`unknown task command "${verb}" — one of ${COMMANDS.task.join(', ')}`); return 2; }
|
|
72
|
+
if ('by' in flags || 'via' in flags) { say(`attribution is set from the call path; --${'by' in flags ? 'by' : 'via'} is not accepted`); return 2; }
|
|
73
|
+
for (const k of Object.keys(flags)) {
|
|
74
|
+
if (!BOOL.has(k) && !VALUE.has(k)) { say(`unknown option --${k}`); return 2; }
|
|
75
|
+
if (VALUE.has(k) && flags[k] === '') { say(`--${k} needs a value`); return 2; }
|
|
76
|
+
}
|
|
77
|
+
const fail = (error, code = 1) => { if (json) say(JSON.stringify({ ok: false, error })); else say(`✗ ${error}`); return code; };
|
|
78
|
+
const root = flags.root ? path.resolve(cwd, flags.root) : repoRoot(cwd);
|
|
79
|
+
const stateDir = driver.stateDirOf(root, { create: verb === 'state' });
|
|
80
|
+
if (!stateDir) return fail('this repository has no PMOS state folder (pmos/state, state or .pmos)');
|
|
81
|
+
const boards = require('./routes-boards.js');
|
|
82
|
+
const { w, ctx } = boardsCtx(root, stateDir);
|
|
83
|
+
|
|
84
|
+
if (verb === 'list') {
|
|
85
|
+
const id = pos[0]; if (!id || pos.length > 1) { say('usage: pmos task list <initiative> [--all]'); return 2; }
|
|
86
|
+
for (const k of ['to', 'why']) if (k in flags) return fail(`--${k} is not an option of list`, 2);
|
|
87
|
+
const all = [...(boards.foldOf(ctx, w).tasks || new Map()).values()].filter((t) => t.initiative === id);
|
|
88
|
+
const shown = flags.all ? all : all.filter((t) => OPEN.has(t.state));
|
|
89
|
+
if (json) { say(JSON.stringify({ ok: true, tasks: shown.map((t) => ({ id: t.id, board: t.board, kind: t.kind, title: t.title, state: t.state, owner: t.owner, due: t.due })) })); return 0; }
|
|
90
|
+
if (!shown.length) { say(all.length ? `No open task on ${id}. --all lists the ${all.length} closed.` : `No Board task on ${id}.`); return 0; }
|
|
91
|
+
for (const t of shown) say(line(t));
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
// state
|
|
95
|
+
if (!pos.length || !flags.to) { say('usage: pmos task state <task> [<task> …] --to <state> [--why <text>]'); return 2; }
|
|
96
|
+
if (flags.all) return fail('--all is not an option of state', 2);
|
|
97
|
+
const to = stateOf(flags.to);
|
|
98
|
+
if (!to) return fail(`--to is one of ${B.TASK_STATES.join(', ')}`, 2);
|
|
99
|
+
const actor = actorLib.fromCli({ isTTY: isTTY === undefined ? !!(process.stdin.isTTY && process.stdout.isTTY) : isTTY, env: env === undefined ? process.env : env });
|
|
100
|
+
const g = { ok: true, actor };
|
|
101
|
+
const folded = boards.foldOf(ctx, w);
|
|
102
|
+
const done = [], refused = [];
|
|
103
|
+
for (const id of pos) {
|
|
104
|
+
const t = B.taskOf(folded, id);
|
|
105
|
+
if (!t) { refused.push({ task: id, error: `no Board task ${id}; pmos task list <initiative> names them` }); continue; }
|
|
106
|
+
if (t.state === to) { done.push({ task: id, title: t.title, state: to, same: true }); continue; }
|
|
107
|
+
const r = boards.taskState(ctx, { ws: w.id, board: t.board, task: id, state: to, ...(flags.why ? { why: flags.why } : {}) }, g);
|
|
108
|
+
if (!r.body || r.body.ok !== true) refused.push({ task: id, error: (r.body && r.body.error) || 'the write was refused' });
|
|
109
|
+
else done.push({ task: id, title: t.title, state: to });
|
|
110
|
+
}
|
|
111
|
+
if (json) say(JSON.stringify({ ok: !refused.length, done, refused }));
|
|
112
|
+
else {
|
|
113
|
+
for (const d of done) say(d.same ? ` ${d.task} was already ${to}: ${d.title}` : `✓ ${d.task} is ${to}: ${d.title}`);
|
|
114
|
+
for (const x of refused) say(`✗ ${x.task}: ${x.error}`);
|
|
115
|
+
if (done.some((d) => !d.same)) say(' The Board shows it. Nothing was sent.');
|
|
116
|
+
}
|
|
117
|
+
return refused.length ? 1 : 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
module.exports = { run, COMMANDS, USAGE, stateOf };
|
|
@@ -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.414.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.414.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
|
+
}
|