create-pmos 0.264.0 → 0.266.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 +1 -1
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/briefing-premium-test.js +31 -0
- package/workspace/guide/briefing-premium.md +6 -1
- package/workspace/lib/board-premium.js +29 -3
- package/workspace/lib/initiative-premium.js +8 -0
- package/workspace/lib/routes-board-premium.js +15 -4
- package/workspace/lib/routes-initiative-premium.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +209 -0
- package/workspace/public/pm/premium-acts.js +281 -0
- package/workspace/public/pm/premium-board.js +36 -7
- package/workspace/public/pm/premium-initiative.js +9 -2
- package/workspace/public/pm/premium-shell.js +59 -0
- package/workspace/public/pm/premium.css +42 -0
- package/workspace/public/premium-board.html +4 -2
- package/workspace/public/premium-initiative.html +2 -1
- package/workspace/public/premium-insights.html +1 -0
- package/workspace/public/premium-work.html +1 -0
- package/workspace/public/premium.html +1 -0
- package/workspace/server.js +2 -0
- package/workspace/test-lists/premium-board-actions.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.266.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": {
|
package/payload/KIT-VERSION
CHANGED
|
@@ -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-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-18T10:48:48Z"}
|
|
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-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-18T10:48:48Z"}
|
|
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-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-18T10:48:48Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -139,7 +139,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
139
139
|
/* B10 dialog */
|
|
140
140
|
await p.locator('#ibBody .ini2').first().click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(700);
|
|
141
141
|
const dlg = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, sub: document.querySelector('#dSub').textContent, grid: [...document.querySelectorAll('#oMain .kv2 span')].map((s) => s.textContent).join('|'), path: document.querySelector('#oMain .dpath').textContent, buttons: [...document.querySelectorAll('#card button')].length, hold: document.querySelector('#holdWhy').textContent, ask: !!document.querySelector('#askGo'), label: document.querySelector('#oLab').textContent }));
|
|
142
|
-
ok('B10 an initiative opens its record as a grid with the path of its file, the read-only agent beside it and no press', dlg.title === 'Self-serve onboarding v2' && /Stage\|Build \(derived\)/.test(dlg.grid) && /Progress\|62%/.test(dlg.grid) && dlg.path === 'planning/initiatives/self-serve-v2.md' && dlg.buttons === 0 && dlg.ask && /
|
|
142
|
+
ok('B10 an initiative opens its record as a grid with the path of its file, the read-only agent beside it and no press', dlg.title === 'Self-serve onboarding v2' && /Stage\|Build \(derived\)/.test(dlg.grid) && /Progress\|62%/.test(dlg.grid) && dlg.path === 'planning/initiatives/self-serve-v2.md' && dlg.buttons === 0 && dlg.ask && /This dialog changes nothing/.test(dlg.hold) && dlg.label === 'Initiative record', JSON.stringify(dlg));
|
|
143
143
|
A.setThread({ ok: true, working: false, turns: [] });
|
|
144
144
|
await p.fill('#askIn', 'Why is this late?'); const nA = A.posts.length; await p.press('#askIn', 'Enter');
|
|
145
145
|
ok('B10 a question posts the initiative key and the text', await until(() => A.posts.length > nA && A.posts[A.posts.length - 1].path === '/api/briefing-premium/ask' && A.posts[A.posts.length - 1].body.key === 'board:self-serve-v2' && A.posts[A.posts.length - 1].body.text === 'Why is this late?'));
|
|
@@ -95,6 +95,37 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
95
95
|
for (let i = A.reqs.length - 1; i >= 0; i--) if (/^POST \/api\/proactive\/settings$/.test(A.reqs[i])) A.reqs.splice(i, 1); // R10 below counts presses on a page where nothing was pressed
|
|
96
96
|
await p.keyboard.press('Escape'); }
|
|
97
97
|
|
|
98
|
+
/* premium-sessions: the running list reads /api/sessions; Stop asks first and the one write is /api/session/remove */
|
|
99
|
+
{ const fake = [
|
|
100
|
+
{ id: 'sess-1', name: 'Draft the brief', agent: 'claude', note: 'Writing the brief', cwd: 'planning', created: new Date(Date.now() - 14 * 60000).toISOString(), shown: 'working', label: 'Working', automatic: false },
|
|
101
|
+
{ id: 'sess-2', name: 'Refresh metrics', agent: 'claude', note: '', cwd: '.', created: new Date(Date.now() - 6 * 60000).toISOString(), shown: 'working', label: 'Working', automatic: true, headless: 'skill' },
|
|
102
|
+
{ id: 'sess-3', name: 'Old one', agent: 'claude', note: '', cwd: '.', created: new Date().toISOString(), shown: 'exited', label: 'Exited', automatic: false }];
|
|
103
|
+
let removes = 0, slowOnce = true;
|
|
104
|
+
await p.route('**/api/sessions', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ sessions: fake }) }));
|
|
105
|
+
await p.route('**/api/session/remove', (r) => { removes++; const id = JSON.parse(r.request().postData()).id; if (id === 'sess-2' && slowOnce) { slowOnce = false; return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, removed: false, note: 'asked it to end' }) }); } const i = fake.findIndex((x) => x.id === id); if (i >= 0) fake.splice(i, 1); return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, removed: true }) }); });
|
|
106
|
+
const bt = await p.evaluate(() => { const b = document.querySelector('#sessBtn'); if (!b) return null; const r = b.getBoundingClientRect(); return { w: Math.round(r.width), h: Math.round(r.height) }; });
|
|
107
|
+
ok('X1 the header has an Agent sessions button of at least 44 px', bt && bt.w >= 44 && bt.h >= 44, JSON.stringify(bt));
|
|
108
|
+
await p.click('#sessBtn');
|
|
109
|
+
const rows = await until(() => p.evaluate(() => document.querySelectorAll('#oMain .ssr').length), 8000);
|
|
110
|
+
ok('X2 the list shows the sessions that have not exited, and the title counts them', rows === 2 && (await p.evaluate(() => document.querySelector('#dTitle').textContent)) === '2 running', String(rows));
|
|
111
|
+
const meta = await p.evaluate(() => [...document.querySelectorAll('#oMain .ssr')].map((r) => r.querySelector('.ssm').textContent + '|' + r.querySelector('.ssn').textContent));
|
|
112
|
+
ok('X3 a row carries only record fields: agent, state word, folder, age; a background run and a PMOS start are named', /claude.*Working.*planning.*min ago/.test(meta[0]) && /Background run/.test(meta[1]) && /Started by PMOS/.test(meta[1]) && /No note$/.test(meta[1]), meta.join(' // '));
|
|
113
|
+
await p.click('#oMain [data-stop="sess-1"]');
|
|
114
|
+
const asked = await p.evaluate(() => { const c = document.querySelector('#oMain .ssc'); return c ? c.textContent : ''; });
|
|
115
|
+
ok('X4 Stop asks first and says what it ends, and nothing is sent yet', /Stop “Draft the brief”\?/.test(asked) && /closes its terminal/.test(asked) && removes === 0, asked);
|
|
116
|
+
await p.click('#oMain [data-no="sess-1"]');
|
|
117
|
+
ok('X5 Keep running closes the question and sends nothing', (await p.evaluate(() => !document.querySelector('#oMain .ssc'))) && removes === 0);
|
|
118
|
+
await p.click('#oMain [data-stop="sess-2"]'); await p.click('#oMain [data-yes="sess-2"]');
|
|
119
|
+
const slow = await until(() => p.evaluate(() => { const c = document.querySelector('#oMain .ssc'); return c ? c.textContent : ''; }), 6000);
|
|
120
|
+
ok('X6 a session that has not exited says so and offers Stop again, never "Ended"', /has not exited yet/.test(slow) && !/Ended/.test(await p.evaluate(() => document.querySelector('#oMain').textContent)), slow);
|
|
121
|
+
await p.click('#oMain [data-yes="sess-2"]');
|
|
122
|
+
ok('X7 the second press ends it: the row says Ended and the toast confirms', !!(await until(() => p.evaluate(() => /Ended “Refresh metrics”/.test(document.querySelector('#oMain').textContent) && /Ended “Refresh metrics”/.test(document.querySelector('#toast').textContent)), 6000)));
|
|
123
|
+
ok('X8 the list re-reads and drops it, and the badge follows', !!(await until(() => p.evaluate(() => document.querySelectorAll('#oMain .ssr').length === 1 && document.querySelector('#sessBdg').textContent === '1'), 8000)));
|
|
124
|
+
const bare = await fetch(BASE + '/api/session/remove', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: 'sess-1' }) });
|
|
125
|
+
ok('X9 Stop is a page press: no nonce, no end (403)', bare.status === 403, String(bare.status));
|
|
126
|
+
await p.keyboard.press('Escape'); await p.unroute('**/api/sessions'); await p.unroute('**/api/session/remove');
|
|
127
|
+
for (let i = A.reqs.length - 1; i >= 0; i--) if (/^POST \/api\/session\/remove$/.test(A.reqs[i])) A.reqs.splice(i, 1); }
|
|
128
|
+
|
|
98
129
|
/* R2 */
|
|
99
130
|
const hero = await p.evaluate(() => ({ text: document.querySelector('#brief').textContent, k: [...document.querySelectorAll('#brief .k')].map((x) => x.textContent) }));
|
|
100
131
|
const want = MODEL.hero.map((s) => s.parts.map((x) => x.t).join('')).join(' ');
|
|
@@ -15,6 +15,8 @@ Every premium page has an **Open the console** button beside the theme button. I
|
|
|
15
15
|
|
|
16
16
|
Every premium page has a **Settings** button beside it. It opens one dialog with two sections. **Workspaces** lists the repositories PMOS works in, with Add (a folder path) and Remove; Remove forgets the address and never deletes the folder, and a refusal shows the server's reason. **Connectors** has an On/Off switch for each source the Briefing reads. Each press saves that one record. Every other setting runs on a default and stays in the console; the dialog links to it. Remove needs the page's launch nonce, so an agent session cannot call it.
|
|
17
17
|
|
|
18
|
+
Every premium page has an **Agent sessions** button beside the console button, with a count of the sessions running. It opens a dialog that lists each running session and background run with its note, state and start time. **Stop** asks first and says what it ends, then ends the session and closes its terminal. If the session has not exited yet, the row says so and offers Stop again. Terminals, new sessions and run questions stay in the console; the dialog links to it.
|
|
19
|
+
|
|
18
20
|
## Products
|
|
19
21
|
|
|
20
22
|
You work across products, and a conversation in email, the calendar or Confluence cannot be tied to one product. So the Briefing reads more than one workspace and merges what needs you into one list.
|
|
@@ -157,7 +159,10 @@ Board is the third place on the rail, at `/premium-board.html`. It reads what th
|
|
|
157
159
|
- **Metrics** appears above the Initiatives card on the board of any workspace except the home one (PMOS itself), and counts from that workspace's own repository. It has four tiles. **Corrections per 100 runs** is the corrections logged on the week's runs in `planning/runs/agent-runs.jsonl`; a week with fewer than 10 runs is left blank. **Merged a week** counts the commits on the first-parent line of the trunk. **Blocked** and **Idle for a month** come from the workflow engine and keep no history, so they have no chart. Move over a chart, or use the arrow keys, to read a week. A tile that cannot be counted says **Not read** and why. Press a tile for its definition and values, with the read-only agent beside it. There are no targets, and Day and Month are off. It was tested only on made-up repositories, not on a real IDPF or microsite repository.
|
|
158
160
|
- **The crumb** at the top names the board. With more than one board a menu switches between them, and the sparkle opens the board in the dialog with the read-only agent.
|
|
159
161
|
- **Core documents** lists the board's documents with their state, cadence and writer, a summary (drafts to review, not started, up to date), a progress bar, a filter and a search. **Draft it** starts the existing read-only run that writes a draft and sends nothing; **Draft the N not started** does that for each document that can be drafted. **Set it up** and **Open** go to the console. **Add a document** opens a form (title, who writes it, where it lives) and saves a document the core set does not cover on the board's record, in `custom-docs.jsonl`. A document with no link reads "Not started". A document with a link to Confluence or Google Docs reads "Linked" and shows its address. PMOS does not read or sync the linked page, so a linked document is never counted as up to date. Issue and Drop are not on this page.
|
|
160
|
-
- **Opening an initiative.** A click on an initiative opens its page (see "Initiative page"). The **Page / Popup** switch in the header changes that: Popup opens the initiative's dialog instead, which shows its record as a grid and the path of its file, with the read-only agent beside it. The choice is kept in this browser. The dialog holds no press
|
|
162
|
+
- **Opening an initiative.** A click on an initiative opens its page (see "Initiative page"). The **Page / Popup** switch in the header changes that: Popup opens the initiative's dialog instead, which shows its record as a grid and the path of its file, with the read-only agent beside it. The choice is kept in this browser. The dialog holds no press.
|
|
163
|
+
- **New asks** sits at the top of the right column on a team board. Each ask shows where it came from and the drafted title, lane and anchor. **Accept** makes it an initiative in the first stage, through the console's accept route; **Decline** asks for a reason first. The card says when nothing is left to triage.
|
|
164
|
+
- **New initiative** (beside the Initiatives heading, team boards only) asks for a title, a lane and an anchor (a KR or a health budget). It writes an ask and accepts it, as the console does. An unanchored initiative is refused on the page.
|
|
165
|
+
- **⋯ on a row** (and the bar under an initiative page's heading) moves it to the next or another stage, puts it on hold with a reason and a check-back day, cancels it with a reason, or archives it. Each press writes one line through the console's route, says what it recorded, and offers Undo for a few seconds. An on-hold row offers Resume; a cancelled one offers Reopen; an archived one offers Restore. Cancelled and archived initiatives leave the list and sit under a fold below it. On the PMOS board the workflow engine places each initiative, so the moves are not offered and New asks and New initiative are hidden.
|
|
161
166
|
|
|
162
167
|
Not drawn, because PMOS holds no record for them: the Metrics card on the PMOS board, the mockup's demo measures (Activation, Partner uptime, API p95), targets, and the mockup's demo boards.
|
|
163
168
|
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* sprints GET /api/boards/sprints → { source: 'jira'|'none', readAt, sprints: [{ name, state, start, end, counts: { todo, doing, done } }] }
|
|
13
13
|
* docs GET /api/core-docs?level=board → { scope, summary, docs: [{ key, title, for, cadence, by, kind, st, act, running }] }
|
|
14
14
|
* nextRelease { id, type, at } | null
|
|
15
|
+
* held, cancelled, archived GET /api/boards/backlog?view=all&status=on hold | status=cancelled | archived=1 → rows (initiative premium-board-actions)
|
|
16
|
+
* asks GET /api/boards/asks → asks [{ id, line, source, by, at, draft: { title, lane, anchor_suggestion } }]; null when it was not read
|
|
15
17
|
*
|
|
16
18
|
* THE RULE THE FILE FOLLOWS (as the other premium models): a figure, chip, bar or date is made only from a field of a record. An owner, an end date,
|
|
17
19
|
* a progress or a sprint that no record holds is not drawn. The header, the list, the stage columns and the dock read ONE set of counts. The Metrics
|
|
@@ -31,10 +33,28 @@ const STATUS_LABEL = { 'at risk': 'At risk', late: 'Late', 'on hold': 'On hold',
|
|
|
31
33
|
const DOC_STATE = { missing: 'Not started', draft: 'Draft', ok: 'Up to date', stale: 'Stale', due: 'Due' };
|
|
32
34
|
const BY = { drafts: 'PMOS drafts it', proposes: 'PMOS proposes', reviews: 'PMOS reviews', you: 'You write it', live: 'Live view' };
|
|
33
35
|
const GO = { reports: 'rep', initiatives: 'init' };
|
|
36
|
+
const LANES = ['feature', 'discovery', 'chore', 'incident', 'content', 'prototype'];
|
|
34
37
|
|
|
35
38
|
let last = null;
|
|
36
39
|
const peekModel = () => last;
|
|
37
40
|
|
|
41
|
+
/** What the row's ⋯ menu and the initiative page's bar can do, from the row's own fields (initiative premium-board-actions): its workflow's stage names,
|
|
42
|
+
* its stage, its lifecycle (on hold or cancelled, with the reason and check-back day the lifecycle line holds) and its archive entry. */
|
|
43
|
+
function actsOf(r, boardNames) {
|
|
44
|
+
const own = Array.isArray(r.workflow) && r.workflow.length ? r.workflow.map((s) => s.name) : boardNames;
|
|
45
|
+
const st = r.stopped || {};
|
|
46
|
+
const life = r.status === 'on hold' ? 'hold' : r.status === 'cancelled' ? 'cancelled' : null;
|
|
47
|
+
return {
|
|
48
|
+
stages: own, stage: r.stage || null, life, reason: life ? clip(st.reason || '', 300) : '', back: life === 'hold' && st.back ? shortDate(st.back) : '', backDay: life === 'hold' && st.back ? String(st.back).slice(0, 10) : null,
|
|
49
|
+
archived: r.archived ? { reason: clip(r.archived.reason || '', 300), into: r.archived.into ? (r.archived.intoTitle || r.archived.into) : null } : null,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const askOf = (a) => {
|
|
53
|
+
const d = a.draft || {};
|
|
54
|
+
return { id: a.id, line: clip(a.line, 500), source: a.source || '', by: a.by || '', at: a.at ? shortDate(String(a.at).slice(0, 10)) : '',
|
|
55
|
+
draft: { title: clip(d.title || a.line, 120), lane: LANES.includes(d.lane) ? d.lane : null, anchor: d.anchor_suggestion || '' } };
|
|
56
|
+
};
|
|
57
|
+
|
|
38
58
|
function rowOf(r, wf, today) {
|
|
39
59
|
const names = (wf || []).map((s) => s.name), cur = names.indexOf(r.stage);
|
|
40
60
|
const bad = r.status === 'late' || r.status === 'at risk';
|
|
@@ -51,11 +71,12 @@ function rowOf(r, wf, today) {
|
|
|
51
71
|
stage: r.stage || null, cat: r.cat || null, stageNote: r.stageSource === 'derived' ? 'derived' : null,
|
|
52
72
|
seg: names.map((n, j) => (j < cur ? 'p' : j === cur ? 'n' : '')), progress: r.progress != null ? Math.max(0, Math.min(100, Math.round(r.progress))) : null,
|
|
53
73
|
finish: r.end ? shortDate(r.end) : 'Not planned', over: !!over, start: r.start || null, end: r.end || null,
|
|
74
|
+
acts: actsOf(r, names),
|
|
54
75
|
dialog: {
|
|
55
76
|
eye: 'Initiative', logTitle: 'Read from the board',
|
|
56
77
|
log: ['Read the initiative from the board' + (r.stageSource === 'derived' ? ' (its stage is derived by the workflow engine)' : ''), 'Placed it in the ' + (r.stage || 'unknown') + ' stage', r.status ? 'Took its status from the record: ' + r.status : 'No status is on record'],
|
|
57
78
|
say: r.title + ' is in ' + (r.stage || 'no stage') + (r.status ? ' and its status is ' + r.status : '') + '.' + (r.stageSource === 'derived' ? ' The stage comes from the workflow engine, not from a person.' : ''),
|
|
58
|
-
head: 'Where it stands', facts, hold: '
|
|
79
|
+
head: 'Where it stands', facts, hold: 'This dialog changes nothing. To move it, put it on hold, cancel or archive it, use ⋯ on its row or open its page.',
|
|
59
80
|
pane: { label: 'Initiative record', file: 'planning/initiatives/' + r.id + '.md', rows: facts },
|
|
60
81
|
},
|
|
61
82
|
};
|
|
@@ -69,6 +90,9 @@ function build(f) {
|
|
|
69
90
|
const missing = (f.missing || []).slice();
|
|
70
91
|
const open = Number(counts.open) || 0, on = Number(st['on track']) || 0, risk = Number(st['at risk']) || 0, late = Number(st.late) || 0, hold = Number(st['on hold']) || 0;
|
|
71
92
|
const rows = (f.rows || []).slice(0, MAX_LIST).map((r) => rowOf(r, wf, todayIso));
|
|
93
|
+
// the on-hold rows follow the open ones; the cancelled and archived rows sit under the list's fold (initiative premium-board-actions)
|
|
94
|
+
for (const r of (f.held || [])) if (rows.length < MAX_LIST + 50 && !rows.some((x) => x.id === r.id)) rows.push(rowOf(r, wf, todayIso));
|
|
95
|
+
const gone = { cancelled: (f.cancelled || []).slice(0, MAX_LIST).map((r) => rowOf(r, wf, todayIso)), archived: (f.archived || []).slice(0, MAX_LIST).map((r) => rowOf(r, wf, todayIso)) };
|
|
72
96
|
// the list reads the board's own rank; "Do this first" only where a record says the first row is late
|
|
73
97
|
if (rows[0] && rows[0].late) rows[0].first = true;
|
|
74
98
|
const stages = (f.columns || []).map((c) => ({ stage: c.stage, cat: c.cat, count: Number(c.count) || 0, rows: (c.rows || []).slice(0, STAGE_ROWS).map((r) => rowOf(r, wf, todayIso)), more: Math.max(0, (Number(c.count) || 0) - STAGE_ROWS) }));
|
|
@@ -117,17 +141,19 @@ function build(f) {
|
|
|
117
141
|
const model = {
|
|
118
142
|
pending: !!f.pending,
|
|
119
143
|
header: { text: 'Real data · as of ' + hhmm(now) + (missing.length ? ' · not read: ' + missing.join(', ') : '') + (f.pending ? ' · reading the board' : ''), missing },
|
|
120
|
-
board: { name: board.name || '', id: board.id || null, ws: board.ws || null, switcher: (f.boards || []).length > 1 ? f.boards.map((b) => ({ id: b.id, ws: b.ws, name: b.name })) : null },
|
|
144
|
+
board: { name: board.name || '', id: board.id || null, ws: board.ws || null, self: !!board.self, stages: wf.map((s) => s.name), switcher: (f.boards || []).length > 1 ? f.boards.map((b) => ({ id: b.id, ws: b.ws, name: b.name })) : null },
|
|
121
145
|
initiatives: {
|
|
122
146
|
title: 'Initiatives', open, on, risk, late, hold, total: Number(counts.total) || 0,
|
|
123
147
|
cap: open ? { on, open } : null,
|
|
124
148
|
note: open ? (rows.length >= open ? 'All ' + open + ' open ' + plural(open, 'initiative is', 'initiatives are') + ' listed. Late and at-risk ones come first.' : rows.length + ' of ' + open + ' open initiatives are loaded: late and at-risk ones first, then the board\'s now view.') : 'The board has no open initiatives.',
|
|
125
149
|
list: { rows, total: rows.length },
|
|
150
|
+
gone,
|
|
126
151
|
stages, timeline,
|
|
127
152
|
},
|
|
128
153
|
sprint, release, docs,
|
|
154
|
+
asks: f.asks == null ? { missing: true, rows: [] } : { rows: f.asks.filter((a) => a && a.state !== 'accepted' && a.state !== 'declined').slice(0, 50).map(askOf) },
|
|
129
155
|
dock: { needs: risk + late, label: 'need a look', next: (rows.find((r) => r.late) || rows.find((r) => r.bad) || {}).title || null },
|
|
130
|
-
rows: rows.concat(stageRows.filter((r) => !rows.some((x) => x.key === r.key))).concat([{ key: 'board:this-board', id: null, title: board.name || 'This board', sub: 'Board', dialog: { eye: 'Board', logTitle: 'Read from the board', log: ['Read the board and its initiatives', 'Counted them by status', 'Changed nothing'], say: (board.name || 'This board') + ' has ' + open + ' open ' + plural(open, 'initiative', 'initiatives') + ': ' + on + ' on track, ' + risk + ' at risk, ' + late + ' late' + (hold ? ', ' + hold + ' on hold' : '') + '.', head: 'Where it stands', facts: [['Open initiatives', String(open)], ['On track', String(on)], ['At risk', String(risk)], ['Late', String(late)], ['On hold', hold ? String(hold) : '']].filter((x) => x[1] !== ''), hold: 'Nothing here changes a board.', pane: { label: 'Board record', file: '', note: 'The board as its records hold it.', rows: [['Open initiatives', String(open)], ['On track', String(on)], ['At risk', String(risk)], ['Late', String(late)], ['On hold', hold ? String(hold) : '']].filter((x) => x[1] !== '') } } }]),
|
|
156
|
+
rows: rows.concat(stageRows.filter((r) => !rows.some((x) => x.key === r.key)), gone.cancelled, gone.archived).concat([{ key: 'board:this-board', id: null, title: board.name || 'This board', sub: 'Board', dialog: { eye: 'Board', logTitle: 'Read from the board', log: ['Read the board and its initiatives', 'Counted them by status', 'Changed nothing'], say: (board.name || 'This board') + ' has ' + open + ' open ' + plural(open, 'initiative', 'initiatives') + ': ' + on + ' on track, ' + risk + ' at risk, ' + late + ' late' + (hold ? ', ' + hold + ' on hold' : '') + '.', head: 'Where it stands', facts: [['Open initiatives', String(open)], ['On track', String(on)], ['At risk', String(risk)], ['Late', String(late)], ['On hold', hold ? String(hold) : '']].filter((x) => x[1] !== ''), hold: 'Nothing here changes a board.', pane: { label: 'Board record', file: '', note: 'The board as its records hold it.', rows: [['Open initiatives', String(open)], ['On track', String(on)], ['At risk', String(risk)], ['Late', String(late)], ['On hold', hold ? String(hold) : '']].filter((x) => x[1] !== '') } } }]),
|
|
131
157
|
};
|
|
132
158
|
last = model;
|
|
133
159
|
return model;
|
|
@@ -139,6 +139,14 @@ function build(f) {
|
|
|
139
139
|
header: { text: 'Real data · as of ' + hhmm(now) + (missing.length ? ' · not read: ' + missing.join(', ') : ''), missing },
|
|
140
140
|
board: { name: board.name || '', id: board.id || null, ws: board.ws || null },
|
|
141
141
|
id, key, title: clip(row.title || id, 160), lane: row.lane || '', anchor: row.anchor || '',
|
|
142
|
+
// the bar's presses (initiative premium-board-actions): the workflow, the lifecycle and the archive entry the row holds
|
|
143
|
+
acts: {
|
|
144
|
+
self: !!board.self, stages: names, stage: row.stage || null,
|
|
145
|
+
life: status === 'on hold' ? 'hold' : status === 'cancelled' ? 'cancelled' : null,
|
|
146
|
+
reason: (status === 'on hold' || status === 'cancelled') && row.stopped ? clip(row.stopped.reason || '', 300) : '',
|
|
147
|
+
back: status === 'on hold' && row.stopped && row.stopped.back ? shortDate(row.stopped.back) : '', backDay: status === 'on hold' && row.stopped && row.stopped.back ? String(row.stopped.back).slice(0, 10) : null,
|
|
148
|
+
archived: row.archived ? { reason: clip(row.archived.reason || '', 300), into: row.archived.into ? (row.archived.intoTitle || row.archived.into) : null } : null,
|
|
149
|
+
},
|
|
142
150
|
head, overview, health, warnings, checks, allSteps, tasks, docs, files, desc, crumbTitle, help,
|
|
143
151
|
boards: f.boards || [], siblings: (f.siblings || []).slice(0, 100),
|
|
144
152
|
dock: { label: head.statusLabel || 'No status', stage: row.stage || '', next: String(overview.h || '').replace(/^Next: /, '') },
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* 200 { ok, state: 'ready', model, as_of } | 202 { ok, state: 'reading' } | 500 { ok: false, state: 'error', error }
|
|
5
5
|
* model is lib/board-premium.js build(), made from the answers of the routes the production Initiatives page reads: /api/boards, /api/boards/board,
|
|
6
6
|
* /backlog, /columns, /sprints and /api/core-docs?level=board. Those routes derive the initiatives in the background and answer 202 while they do, so
|
|
7
|
-
* this route answers 202 too and the page asks again: no request waits for the read. Read-only: the
|
|
8
|
-
* POST /api/core-docs/draft
|
|
7
|
+
* this route answers 202 too and the page asks again: no request waits for the read. Read-only: the page's presses go from the page to the
|
|
8
|
+
* console's own routes (POST /api/core-docs/draft, /api/boards/asks/*, /api/boards/move, /api/lifecycle, /api/boards/archive).
|
|
9
|
+
* initiative premium-board-actions adds the open asks (/api/boards/asks), the on-hold rows and the cancelled and archived rows (/backlog). */
|
|
9
10
|
const BoardPremium = require('./board-premium.js');
|
|
10
11
|
const BoardP = BoardPremium;
|
|
12
|
+
const Rows = require('./initiative-rows.js');
|
|
11
13
|
const boards = require('./routes-boards.js');
|
|
12
14
|
const coreDocs = require('./routes-core-docs.js');
|
|
13
15
|
const Custom = require('./custom-docs.js');
|
|
@@ -65,15 +67,20 @@ module.exports = {
|
|
|
65
67
|
const missing = [];
|
|
66
68
|
// the late and at-risk initiatives first (the board's own `risk` view, late before at risk), then its `now` view, each initiative once
|
|
67
69
|
const listOf = (a, n) => { const seen = new Set(), out = []; const rank = (r) => (r.status === 'late' ? 0 : 1); for (const r of [...((a && a.rows) || [])].sort((x, y) => rank(x) - rank(y))) { if (!seen.has(r.id)) { seen.add(r.id); out.push(r); } } for (const r of (n && n.rows) || []) if (!seen.has(r.id)) { seen.add(r.id); out.push(r); } return out.slice(0, 100); };
|
|
68
|
-
const [risk, now, cols, spr, docs] = await Promise.all([
|
|
70
|
+
const [risk, now, cols, spr, docs, held, can, arc, asks] = await Promise.all([
|
|
69
71
|
via(boards, '/api/boards/backlog' + q + '&view=risk&limit=100', req, ctx),
|
|
70
72
|
via(boards, '/api/boards/backlog' + q + '&view=now&limit=100', req, ctx),
|
|
71
73
|
via(boards, '/api/boards/columns' + q, req, ctx),
|
|
72
74
|
via(boards, '/api/boards/sprints' + q, req, ctx),
|
|
73
75
|
via(coreDocs, '/api/core-docs' + qs({ level: 'board', ws: pick.ws, board: pick.id }), req, ctx),
|
|
76
|
+
via(boards, '/api/boards/backlog' + q + '&view=all&status=' + encodeURIComponent('on hold') + '&limit=100', req, ctx),
|
|
77
|
+
via(boards, '/api/boards/backlog' + q + '&view=all&status=cancelled&limit=100', req, ctx),
|
|
78
|
+
via(boards, '/api/boards/backlog' + q + '&archived=1&limit=100', req, ctx),
|
|
79
|
+
via(boards, '/api/boards/asks' + q, req, ctx),
|
|
74
80
|
]);
|
|
75
81
|
const ok = (r, name) => { if (r.status === 202 || !r.body || r.body.ok === false || r.body.pending) { missing.push(name); return null; } return r.body; };
|
|
76
82
|
const rk = ok(risk, 'initiatives'), nw = ok(now, 'initiatives'), c = ok(cols, 'stages'), s = ok(spr, 'sprints'), d = ok(docs, 'core documents');
|
|
83
|
+
const hd = ok(held, 'on-hold initiatives'), cn = ok(can, 'cancelled initiatives'), ar = ok(arc, 'archived initiatives'), ak = ok(asks, 'new asks');
|
|
77
84
|
// the documents the PM added (lib/custom-docs.js): one file read, no route
|
|
78
85
|
let custom = [];
|
|
79
86
|
try { const w = ctx.getWs ? ctx.getWs(pick.ws) : null; custom = w ? Custom.list(w.root, 'board:' + pick.id) : []; } catch { custom = []; missing.push('added documents'); }
|
|
@@ -81,8 +88,12 @@ module.exports = {
|
|
|
81
88
|
now: Date.now(), pending: false, missing: missing.filter((m) => m !== 'core documents'), boards: all.map((x) => ({ ws: x.ws, id: x.id, name: x.name })),
|
|
82
89
|
board: head.body.board, counts: head.body.counts, nextRelease: head.body.nextRelease || null,
|
|
83
90
|
rows: listOf(rk, nw), columns: c ? c.columns : [], sprints: s || { source: 'none', sprints: [] }, docs: d, custom,
|
|
91
|
+
held: hd ? hd.rows : [], cancelled: cn ? cn.rows : [], archived: ar ? ar.rows : [], asks: ak ? ak.asks || [] : null,
|
|
84
92
|
});
|
|
85
|
-
|
|
93
|
+
// a press re-derives the rows in the background; while the answer is stale the page asks again (initiative premium-board-actions)
|
|
94
|
+
let stale = false;
|
|
95
|
+
try { const w = ctx.getWs ? ctx.getWs(pick.ws) : null; const pk = w ? Rows.peek(w.root) : null; stale = !!(pk && (pk.pending || pk.stale)); } catch { stale = false; }
|
|
96
|
+
ctx.json(res, { ok: true, state: 'ready', model, stale, as_of: Date.now() });
|
|
86
97
|
return true;
|
|
87
98
|
} catch (e) { return fail((e && e.message) || e); }
|
|
88
99
|
},
|
|
@@ -60,7 +60,7 @@ module.exports = {
|
|
|
60
60
|
try { const w = ctx.getWs ? ctx.getWs(pick.ws) : null; custom = w ? Custom.list(w.root, 'initiative:' + id) : []; } catch { custom = []; missing.push('added documents'); }
|
|
61
61
|
const model = InitPremium.build({
|
|
62
62
|
now: Date.now(), pending: false, missing: missing.filter((m) => m !== 'core documents'),
|
|
63
|
-
board: { ws: own.ws || pick.ws, id: own.id, name: own.name, workflow: own.workflow },
|
|
63
|
+
board: { ws: own.ws || pick.ws, id: own.id, name: own.name, workflow: own.workflow, self: !!own.self },
|
|
64
64
|
row: head.body.row, sheet: sh, items: it ? it.items : [], docs: dd, custom, ladder: lad,
|
|
65
65
|
boards: all.map((x) => ({ ws: x.ws, id: x.id, name: x.name })), siblings: it ? (it.initiatives || []).map((x) => ({ id: x.id, title: x.title })) : [],
|
|
66
66
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.266.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.266.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* premium-board-actions-test.js — the board presses of the premium Board and initiative pages (initiative premium-board-actions; planning/prd/premium-board-actions-prd.md A1 to A12).
|
|
4
|
+
* A real server on a scratch `team` repository (planning/initiatives, pmos/state), never the PMOS checkout. The real pages press the real routes:
|
|
5
|
+
* T triage (accept, decline) · N New initiative · M move and Undo · L hold, resume, cancel, reopen, archive, restore · I the initiative page's bar
|
|
6
|
+
* S the PMOS-self board (a model answer, since only the embedded checkout is self) · P the POST allow-list and the refusals · F floors */
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const { spawn } = require('child_process');
|
|
10
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
11
|
+
const T = require('./test-run').configure({ name: 'premium-board-actions' });
|
|
12
|
+
const { makeRepos, codeRepo, write, git } = require('./plan-test-repos');
|
|
13
|
+
const BP = require('./lib/board-premium.js');
|
|
14
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
15
|
+
|
|
16
|
+
const BASE = T.BASE;
|
|
17
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
18
|
+
const until = async (fn, ms = 20000, step = 150) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
19
|
+
const results = [];
|
|
20
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 500) : ''}`); };
|
|
21
|
+
const R = makeRepos('premium-board-actions');
|
|
22
|
+
const team = codeRepo(path.join(R.base, 'team'));
|
|
23
|
+
fs.mkdirSync(path.join(team, 'pmos', 'state'), { recursive: true });
|
|
24
|
+
/* a record that declares its id, so the lifecycle route knows it (the synthetic records of plan-test-repos declare none) */
|
|
25
|
+
write(team, 'planning/initiatives/pa-one.md', '---\ntype: Initiative\ntitle: Partner rate limits\ntimestamp: 2026-10-01\nid: pa-one\nlane: chore\nparent_kr: health:tech\nspecimen_test: "description-judgeable — x"\nsurface_check: "greenfield — x"\nstatus: "open — intent: limit partner calls."\n---\n# pa-one\n');
|
|
26
|
+
git(team, ['add', '-A']); git(team, ['commit', '-q', '-m', 'pa-one']);
|
|
27
|
+
let srv = null; let browser = null;
|
|
28
|
+
const finish = async (code) => {
|
|
29
|
+
if (browser) await browser.close().catch(() => {});
|
|
30
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
31
|
+
T.killTmux(); R.cleanup();
|
|
32
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
33
|
+
console.log(`\n${results.length - bad}/${results.length} premium-board-actions assertions passed`);
|
|
34
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
35
|
+
};
|
|
36
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
37
|
+
|
|
38
|
+
/** Every line of a ledger the routes append to, wherever the repository keeps it. */
|
|
39
|
+
const lines = (name) => {
|
|
40
|
+
const out = [];
|
|
41
|
+
const walk = (d) => { for (const e of fs.readdirSync(d, { withFileTypes: true })) { if (e.name === '.git') continue; const p = path.join(d, e.name); if (e.isDirectory()) walk(p); else if (e.name === name) out.push(...fs.readFileSync(p, 'utf8').split('\n').filter(Boolean).map((x) => JSON.parse(x))); } };
|
|
42
|
+
walk(team); if (process.env.PMOS_STATE_DIR && fs.existsSync(process.env.PMOS_STATE_DIR)) walk(process.env.PMOS_STATE_DIR);
|
|
43
|
+
return out;
|
|
44
|
+
};
|
|
45
|
+
/** A press on a choice chip inside the dialog's pane, as a click event on the element (Playwright's pointer check races the dialog's spring). */
|
|
46
|
+
const tap = (pg, sel) => pg.$eval(sel, (b) => b.click());
|
|
47
|
+
const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive)|lifecycle|briefing-premium\/note)$/;
|
|
48
|
+
|
|
49
|
+
(async () => {
|
|
50
|
+
const exe = findBrowser();
|
|
51
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
52
|
+
let chromium;
|
|
53
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
54
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: team, PMOS_NO_OPEN: '1' }) });
|
|
55
|
+
await T.waitForServer(BASE);
|
|
56
|
+
const ready = await until(async () => { const r = await fetch(BASE + '/api/board-premium'); const j = await r.json().catch(() => null); return r.status === 200 && j && j.ok && j.state === 'ready' && j.model.initiatives.list.rows.length ? j : null; }, 90000, 400);
|
|
57
|
+
ok('A1 the real route reads the scratch board, with its stages, its new asks and no PMOS-self flag', !!ready && ready.model.board.self === false && ready.model.board.stages.length > 2 && Array.isArray(ready.model.asks.rows) && !ready.model.asks.missing, ready && JSON.stringify(ready.model.board));
|
|
58
|
+
if (!ready) return finish(1);
|
|
59
|
+
const B = ready.model.board, H = await T.pressHeaders(BASE);
|
|
60
|
+
const post = (p, body, h = H) => fetch(BASE + p, { method: 'POST', headers: h, body: JSON.stringify({ ws: B.ws, board: B.id, ...body }) }).then(async (r) => ({ status: r.status, body: await r.json().catch(() => null) }));
|
|
61
|
+
const a1 = await post('/api/boards/asks/add', { line: 'Finance wants a CSV of failed payouts each morning', source: 'Email from Rina' });
|
|
62
|
+
const a2 = await post('/api/boards/asks/add', { line: 'Can the portal get a dark mode', source: 'Support inbox' });
|
|
63
|
+
ok('setup two asks are on the board', a1.status === 200 && a2.status === 200, JSON.stringify([a1, a2]));
|
|
64
|
+
|
|
65
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
66
|
+
const open = async (url, { w = 1280, h = 900 } = {}) => {
|
|
67
|
+
const ctx = await browser.newContext({ viewport: { width: w, height: h } });
|
|
68
|
+
await ctx.addInitScript(() => { try { localStorage.setItem('pmos.premium.openAs', 'popup'); } catch { /* none */ } });
|
|
69
|
+
const page = await ctx.newPage(), errors = [], posts = [];
|
|
70
|
+
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
71
|
+
page.on('request', (rq) => { if (rq.method() === 'POST') posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}') }); });
|
|
72
|
+
await page.goto(BASE + url);
|
|
73
|
+
return { ctx, page, errors, posts };
|
|
74
|
+
};
|
|
75
|
+
const P = await open('/premium-board.html');
|
|
76
|
+
const p = P.page;
|
|
77
|
+
const listed = (id) => p.evaluate((x) => [...document.querySelectorAll('#ibBody .ini2')].some((b) => b.dataset.key === 'board:' + x), id);
|
|
78
|
+
const toastIs = (re) => until(() => p.evaluate((s) => { const t = document.querySelector('#toast'); return t.classList.contains('on') && new RegExp(s).test(t.textContent) ? t.textContent : null; }, re.source));
|
|
79
|
+
const dlgOn = async () => { const v = await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(800); return v; };
|
|
80
|
+
const dlgOff = () => until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
81
|
+
ok('A2 the New asks card lists both asks with Accept and Decline', await until(() => p.evaluate(() => document.querySelectorAll('#cAsks .baa').length === 2 && document.querySelectorAll('#cAsks [data-ask^="acc:"]').length === 2)), await p.evaluate(() => (document.querySelector('#asksHost') || {}).textContent));
|
|
82
|
+
ok('A2 an ask shows its source, not an invented name', await p.evaluate(() => /Email from Rina/.test(document.querySelector('#cAsks').textContent) && !/demo/i.test(document.querySelector('#cAsks').textContent)));
|
|
83
|
+
|
|
84
|
+
/* T triage */
|
|
85
|
+
await p.click(`#cAsks [data-ask="acc:${a1.body.ask.id}"]`); await dlgOn();
|
|
86
|
+
const anc = await until(() => p.evaluate(() => { const s = document.querySelector('#paNA'); return s && s.tagName === 'SELECT' && !s.disabled ? [...s.options].map((o) => o.value) : null; }));
|
|
87
|
+
ok('T1 Accept opens the form with the anchors the board declares', !!anc && anc.includes('health:tech'), JSON.stringify(anc));
|
|
88
|
+
await p.fill('#paNT', ''); await p.click('#paNGo');
|
|
89
|
+
ok('T2 an empty title is refused on the page, before any press', await p.evaluate(() => /Give it a title/.test(document.querySelector('#paNM').textContent)) && !P.posts.some((x) => x.path === '/api/boards/asks/accept'));
|
|
90
|
+
await p.fill('#paNT', 'Daily CSV of failed payouts'); await p.selectOption('#paNA', 'health:tech'); await p.click('#paNGo');
|
|
91
|
+
ok('T3 Accept records the accept line and a new initiative, and says so', !!(await toastIs(/accepted in/)) && lines('boards.jsonl').some((l) => l.kind === 'ask-accept' && l.ask === a1.body.ask.id), JSON.stringify(lines('boards.jsonl').map((l) => l.kind)));
|
|
92
|
+
await dlgOff();
|
|
93
|
+
ok('T4 the accepted ask leaves the card', await until(() => p.evaluate((id) => !document.querySelector(`#cAsks [data-ask="acc:${id}"]`) && document.querySelectorAll('#cAsks .baa').length === 1, a1.body.ask.id)));
|
|
94
|
+
await p.click(`#cAsks [data-ask="dec:${a2.body.ask.id}"]`); await dlgOn();
|
|
95
|
+
ok('T5 Decline waits for a reason', await p.evaluate(() => document.querySelector('#paDGo').disabled));
|
|
96
|
+
await p.fill('#paDW', 'Not tied to a goal this quarter'); await p.click('#paDGo');
|
|
97
|
+
ok('T6 Decline records the reason in the board ledger', !!(await toastIs(/Ask declined/)) && lines('boards.jsonl').some((l) => l.kind === 'ask-decline' && l.why === 'Not tied to a goal this quarter'));
|
|
98
|
+
ok('T7 the card says nothing is left to triage', await until(() => p.evaluate(() => /Nothing new to triage/.test(document.querySelector('#cAsks').textContent))));
|
|
99
|
+
|
|
100
|
+
/* N New initiative */
|
|
101
|
+
ok('N1 New initiative is offered on a team board', await p.evaluate(() => !document.querySelector('#newIni').hidden));
|
|
102
|
+
await p.click('#newIni'); await dlgOn();
|
|
103
|
+
await until(() => p.evaluate(() => { const s = document.querySelector('#paNA'); return s && !s.disabled; }));
|
|
104
|
+
await p.fill('#paNT', 'Partner usage per key'); await p.click('#paNGo');
|
|
105
|
+
ok('N2 an unanchored create is refused on the page', await p.evaluate(() => /Choose an anchor/.test(document.querySelector('#paNM').textContent)));
|
|
106
|
+
await p.selectOption('#paNA', 'health:tech'); await p.click('#paNGo');
|
|
107
|
+
const made = await toastIs(/created in/);
|
|
108
|
+
const recs = fs.readdirSync(path.join(team, 'planning', 'initiatives'));
|
|
109
|
+
ok('N3 Create writes an ask, its accept and a new initiative record, as the console does', !!made && recs.some((f) => /partner-usage/.test(f)) && lines('boards.jsonl').some((l) => l.kind === 'ask' && l.line === 'Partner usage per key'), made + ' / ' + recs.join());
|
|
110
|
+
|
|
111
|
+
/* M move and Undo, from the row's menu */
|
|
112
|
+
await dlgOff();
|
|
113
|
+
await until(() => listed('pa-one'));
|
|
114
|
+
const menuBtn = '#ibBody .inim[data-im="board:pa-one"]';
|
|
115
|
+
await p.click(menuBtn);
|
|
116
|
+
const items = await until(() => p.evaluate(() => { const m = document.querySelector('.bam2'); return m ? [...m.querySelectorAll('[role="menuitem"] b')].map((b) => b.textContent) : null; }));
|
|
117
|
+
ok('M1 the row menu offers the next stage, hold, cancel and archive', !!items && /^Move to /.test(items[0]) && items.includes('Put on hold') && items.includes('Cancel') && items.includes('Archive'), JSON.stringify(items));
|
|
118
|
+
ok('M2 the menu takes the focus and the arrow keys move it; Escape closes it and gives the focus back', await (async () => {
|
|
119
|
+
const f0 = await p.evaluate(() => document.activeElement.closest('.bam2') !== null);
|
|
120
|
+
await p.keyboard.press('ArrowDown'); const f1 = await p.evaluate(() => [...document.querySelectorAll('.bam2 [role="menuitem"]')].indexOf(document.activeElement));
|
|
121
|
+
await p.keyboard.press('Escape'); const gone = await p.evaluate(() => !document.querySelector('.bam2') && document.activeElement.matches('.inim'));
|
|
122
|
+
return f0 && f1 === 1 && gone;
|
|
123
|
+
})());
|
|
124
|
+
const from = ready.model.initiatives.list.rows.find((r) => r.id === 'pa-one').acts.stage;
|
|
125
|
+
await p.click(menuBtn); await p.click('.bam2 [data-pk^="mv:"]');
|
|
126
|
+
const mv = await toastIs(/^Moved to/);
|
|
127
|
+
ok('M3 Move records one move line and says what it recorded', !!mv && lines('boards.jsonl').filter((l) => l.kind === 'move' && l.id === 'pa-one').length === 1, mv);
|
|
128
|
+
await p.click('#paUndo');
|
|
129
|
+
ok('M4 Undo writes the move back', !!(await toastIs(new RegExp('Back in ' + from))) && lines('boards.jsonl').filter((l) => l.kind === 'move' && l.id === 'pa-one').pop().to === from);
|
|
130
|
+
|
|
131
|
+
/* L hold, resume, cancel, reopen, archive, restore */
|
|
132
|
+
await until(() => listed('pa-one'));
|
|
133
|
+
await p.click(menuBtn);
|
|
134
|
+
await p.click('.bam2 [data-pk="hold"]'); await dlgOn();
|
|
135
|
+
await p.fill('#paHR', 'Waiting for the Q1 budget'); await tap(p, '#paHB [data-v="two"]'); await p.click('#paHGo');
|
|
136
|
+
const hl = await until(() => lines('lifecycle.jsonl').find((l) => l.initiative_id === 'pa-one' && l.state === 'on-hold'));
|
|
137
|
+
ok('L1 Put on hold records one on-hold line with the reason and a check-back day', !!hl && hl.reason === 'Waiting for the Q1 budget' && /^\d{4}-\d{2}-\d{2}$/.test(hl.back || ''), JSON.stringify(hl) + ' ' + await p.evaluate(() => (document.querySelector('#paHM') || {}).textContent));
|
|
138
|
+
ok('L2 the row then says On hold and its menu offers Resume', await until(async () => { const t = await p.evaluate(() => { const b = document.querySelector('#ibBody .ini2[data-key="board:pa-one"]'); return b ? b.textContent : ''; }); return /On hold/.test(t); }, 30000));
|
|
139
|
+
await p.click(menuBtn);
|
|
140
|
+
ok('L2 Resume is offered and the moves are not', await until(() => p.evaluate(() => { const m = document.querySelector('.bam2'); return m && !!m.querySelector('[data-pk="resume"]') && !m.querySelector('[data-pk^="mv:"]'); })));
|
|
141
|
+
await p.click('.bam2 [data-pk="resume"]');
|
|
142
|
+
ok('L3 Resume records an active line', await until(() => { const L = lines('lifecycle.jsonl').filter((l) => l.initiative_id === 'pa-one'); return L.length && L[L.length - 1].state === 'active'; }));
|
|
143
|
+
await until(() => p.evaluate(() => { const b = document.querySelector('#ibBody .ini2[data-key="board:pa-one"]'); return b && !/On hold/.test(b.textContent); }), 30000);
|
|
144
|
+
await p.click(menuBtn); await p.click('.bam2 [data-pk="cancel"]'); await dlgOn();
|
|
145
|
+
ok('L4 Cancel waits for a reason', await p.evaluate(() => document.querySelector('#paCGo').disabled));
|
|
146
|
+
await tap(p, '#paCW [data-v="worth"]'); await p.click('#paCGo');
|
|
147
|
+
ok('L4 Cancel records a cancelled line with the reason', await until(() => lines('lifecycle.jsonl').some((l) => l.initiative_id === 'pa-one' && l.state === 'cancelled' && l.reason === 'Not worth it now')));
|
|
148
|
+
ok('L5 the row leaves the list and the fold counts it', await until(() => p.evaluate(() => !document.querySelector('#ibBody .inil .ini2[data-key="board:pa-one"]') && /1 cancelled/.test((document.querySelector('#goneT') || {}).textContent || '')), 30000));
|
|
149
|
+
await p.click('#goneT'); await p.click('#ibBody .inim[data-im="board:pa-one"]');
|
|
150
|
+
ok('L6 a cancelled row offers Reopen only', await until(() => p.evaluate(() => { const m = document.querySelector('.bam2'); return m && [...m.querySelectorAll('[data-pk]')].map((b) => b.dataset.pk).join() === 'reopen'; })));
|
|
151
|
+
await p.click('.bam2 [data-pk="reopen"]');
|
|
152
|
+
ok('L6 Reopen records an active line', await until(() => { const L = lines('lifecycle.jsonl').filter((l) => l.initiative_id === 'pa-one'); return L[L.length - 1].state === 'active'; }));
|
|
153
|
+
await until(() => listed('pa-one'), 30000);
|
|
154
|
+
await p.click(menuBtn); await p.click('.bam2 [data-pk="archive"]'); await dlgOn();
|
|
155
|
+
await tap(p, '#paAW [data-v="dup"]'); await p.fill('#paAN', 'Same as the CSV export'); await p.click('#paAGo');
|
|
156
|
+
ok('L7 Archive records one archive line with the reason', await until(() => lines('boards.jsonl').some((l) => l.kind === 'ini-archive' && l.id === 'pa-one' && l.archived === true && l.reason === 'Duplicate: Same as the CSV export')));
|
|
157
|
+
ok('L8 the fold counts it as archived', await until(() => p.evaluate(() => /1 archived/.test((document.querySelector('#goneT') || {}).textContent || '')), 30000));
|
|
158
|
+
await p.click('#paUndo');
|
|
159
|
+
ok('L9 Undo restores it with a restore line', await until(() => lines('boards.jsonl').some((l) => l.kind === 'ini-archive' && l.id === 'pa-one' && l.archived === false)));
|
|
160
|
+
|
|
161
|
+
/* I the initiative page's bar */
|
|
162
|
+
const I = await open('/premium-initiative.html?id=pa-one&ws=' + encodeURIComponent(B.ws) + '&board=' + encodeURIComponent(B.id));
|
|
163
|
+
const ip = I.page;
|
|
164
|
+
const bar = await until(() => ip.evaluate(() => { const b = document.querySelector('#iBar'); return b && b.querySelector('[data-pk^="mv:"]') ? [...b.querySelectorAll('button')].map((x) => x.textContent.trim()) : null; }), 60000);
|
|
165
|
+
ok('I1 the bar offers the next stage and More', !!bar && bar.some((t) => /^Move to /.test(t)) && bar.includes('More'), JSON.stringify(bar));
|
|
166
|
+
const n0 = lines('boards.jsonl').filter((l) => l.kind === 'move').length;
|
|
167
|
+
await ip.click('#iBar [data-pk^="mv:"]');
|
|
168
|
+
ok('I2 a press on the bar records one move line', await until(() => lines('boards.jsonl').filter((l) => l.kind === 'move').length === n0 + 1));
|
|
169
|
+
await ip.click('#iBar [data-im="bar"]');
|
|
170
|
+
ok('I3 More lists the lifecycle presses and no move', await until(() => ip.evaluate(() => { const m = document.querySelector('.bam2'); return m && [...m.querySelectorAll('[data-pk]')].map((b) => b.dataset.pk).join() === 'hold,cancel,archive'; })));
|
|
171
|
+
await ip.keyboard.press('Escape');
|
|
172
|
+
await ip.click('#paUndo').catch(() => {});
|
|
173
|
+
|
|
174
|
+
/* S the PMOS-self board: the model says self, the page offers no move and no New initiative */
|
|
175
|
+
{
|
|
176
|
+
const m = BP.build(F.facts({ board: Object.assign({}, F.facts().board, { self: true }), asks: [] }));
|
|
177
|
+
const S = await open('/premium-board.html');
|
|
178
|
+
await S.page.route('**/api/board-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: m, as_of: Date.now() }) }));
|
|
179
|
+
await S.page.reload();
|
|
180
|
+
await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .ini2').length > 0));
|
|
181
|
+
ok('S1 the PMOS-self board names the router in its asks card and hides New initiative', await S.page.evaluate(() => /pmos-router/.test(document.querySelector('#cAsks').textContent) && document.querySelector('#newIni').hidden));
|
|
182
|
+
await S.page.click('#ibBody .inim');
|
|
183
|
+
ok('S2 its row menu has no move', await until(() => S.page.evaluate(() => { const x = document.querySelector('.bam2'); return x && !x.querySelector('[data-pk^="mv:"]') && !!x.querySelector('[data-pk="hold"]'); })));
|
|
184
|
+
await S.ctx.close();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* P the POST allow-list and the refusals */
|
|
188
|
+
const all = P.posts.concat(I.posts);
|
|
189
|
+
const other = all.filter((x) => !ALLOWED.test(x.path));
|
|
190
|
+
ok('P1 the pages post only to the asks, move, lifecycle and archive routes', all.length > 10 && !other.length, JSON.stringify(other));
|
|
191
|
+
const noNonce = await post('/api/boards/move', { id: 'fx-bare', to: ready.model.board.stages[1] }, { 'Content-Type': 'application/json', Origin: BASE });
|
|
192
|
+
const lifeNo = await post('/api/lifecycle', { initiative_id: 'fx-bare', state: 'on-hold' }, { 'Content-Type': 'application/json', Origin: BASE });
|
|
193
|
+
ok('P2 a press without the launch nonce is refused', noNonce.status === 403 && lifeNo.status === 403, JSON.stringify([noNonce.status, lifeNo.status]));
|
|
194
|
+
ok('P3 no script error on either page', !P.errors.length && !I.errors.length, P.errors.concat(I.errors).join(' | '));
|
|
195
|
+
|
|
196
|
+
/* F floors */
|
|
197
|
+
{
|
|
198
|
+
const S = await open('/premium-board.html', { w: 390, h: 844 });
|
|
199
|
+
await until(() => S.page.evaluate(() => document.querySelectorAll('#ibBody .inim').length > 0), 30000);
|
|
200
|
+
const f = await S.page.evaluate(() => ({ wide: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('#ibBody .inim, #cAsks button, #newIni')].filter((b) => b.offsetParent && (b.getBoundingClientRect().width < 44 || b.getBoundingClientRect().height < 44)).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().width) + 'x' + Math.round(b.getBoundingClientRect().height)) }));
|
|
201
|
+
ok('F1 at 390 px there is no sideways scroll and every new control is at least 44 px', !f.wide && !f.small.length, JSON.stringify(f));
|
|
202
|
+
await S.page.click('#ibBody .inim');
|
|
203
|
+
const mi = await until(() => S.page.evaluate(() => { const L = [...document.querySelectorAll('.bam2 [role="menuitem"]')]; return L.length ? L.every((b) => b.getBoundingClientRect().height >= 44) && document.documentElement.scrollWidth <= innerWidth + 1 : null; }));
|
|
204
|
+
ok('F2 the menu items are 44 px tall and the open menu adds no sideways scroll', !!mi);
|
|
205
|
+
await S.ctx.close();
|
|
206
|
+
}
|
|
207
|
+
await P.ctx.close(); await I.ctx.close();
|
|
208
|
+
finish();
|
|
209
|
+
})();
|