create-pmos 0.434.0 → 0.435.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/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/changelog.json +12 -0
- package/workspace/fixtures/ready-reports.js +145 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/ready-made-dashboards.md +62 -0
- package/workspace/lib/board-premium.js +1 -1
- package/workspace/lib/intel-report.js +36 -5
- package/workspace/lib/ready-reports.js +616 -0
- package/workspace/lib/report-dashboards.js +5 -0
- package/workspace/lib/report-setups.js +16 -7
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-board-premium.js +5 -0
- package/workspace/lib/routes-boards.js +1 -1
- package/workspace/lib/routes-ready-reports.js +455 -0
- package/workspace/lib/routes-report-setups.js +4 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/program-charter-test.js +11 -7
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +23 -6
- package/workspace/public/pm/bd-prog-panel.js +58 -10
- package/workspace/public/pm/cozy-viewer.js +2 -2
- package/workspace/public/pm/cozy-vw-rp.css +13 -0
- package/workspace/public/pm/dash-view.css +111 -0
- package/workspace/public/pm/dash-view.js +261 -0
- package/workspace/public/pm/home-app.js +26 -0
- package/workspace/public/pm/home-data.js +3 -2
- package/workspace/public/pm/home-ini.js +19 -1
- package/workspace/public/pm/premium-insights.js +10 -2
- package/workspace/public/pm/premium-report-read.js +36 -5
- package/workspace/public/pm/ready-lib.css +29 -0
- package/workspace/public/pm/ready-lib.js +62 -0
- package/workspace/ready-dash-ui-test.js +227 -0
- package/workspace/server.js +2 -0
- package/workspace/test-lists/batch17-ready-reports.json +9 -0
- package/workspace/test-lists/ready-reports-ui.json +6 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* pm/ready-lib.js — the ready-made reports in Reports and dashboards (batch 17 item 1, design A+; canvas In development: PbA6Library, PbG4Overlap,
|
|
2
|
+
* PbG6Trust). Intelligence's ⋯ › Reports and dashboards side panel puts it at the top, before the reports the PM made ("Yours").
|
|
3
|
+
*
|
|
4
|
+
* readLib(ws) GET /api/ready-reports/library?ws → { lead, groups, yours, overlap } | null (null: the route is missing or refused, so
|
|
5
|
+
* the panel shows only what it showed before)
|
|
6
|
+
* libHtml(L, o) the ✦ card (Claude's picks: "To keep your week light I'd schedule only 3"), then one Ready-made group per scope (a
|
|
7
|
+
* program, a product, the initiatives), each report a switch; Claude's picks carry ✦. The weekly updates that are off
|
|
8
|
+
* fold into "N more". The overlap card (PbG4: one person gets at most one update a week) and its "Who gets what" list.
|
|
9
|
+
* o: { open: Set of folded groups shown }
|
|
10
|
+
* wireLib(el, h) the presses: a switch (POST /api/ready-reports/switch), ✓ on the picks card (/picks), ✓ on the overlap card (/overlap),
|
|
11
|
+
* the folds. h: { ws, toast(text), reload(), redraw(), open: Set }
|
|
12
|
+
* Nothing here sends anything: a switch only says whether Claude drafts that report at its moment. */
|
|
13
|
+
import { pmPost } from './http.js';
|
|
14
|
+
|
|
15
|
+
const CSS = new URL('./ready-lib.css', import.meta.url).href;
|
|
16
|
+
if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
|
|
17
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
|
|
18
|
+
}
|
|
19
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
20
|
+
const SV = (d, w = 18, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
21
|
+
const I = { spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', chk: 'M5 12l5 5 9-10', down: 'M7 10l5 5 5-5', merge: 'M6 4v6a4 4 0 0 0 4 4h8M14 10l4 4-4 4',
|
|
22
|
+
people: 'M9 11a3.5 3.5 0 1 0 0-7a3.5 3.5 0 1 0 0 7M2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 6.5M18 14a6 6 0 0 1 3.5 6' };
|
|
23
|
+
const LEVEL = { program: 'program', product: 'product', initiative: 'initiatives' };
|
|
24
|
+
|
|
25
|
+
export async function readLib(ws) {
|
|
26
|
+
try { const r = await fetch('/api/ready-reports/library?' + new URLSearchParams(ws ? { ws } : {}).toString(), { credentials: 'same-origin' }); if (r.status !== 200) return null; const j = await r.json(); return j && j.ok !== false && Array.isArray(j.groups) ? j : null; } catch { return null; }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const sw = (scope, r) => `<button type="button" class="rl-sw${r.on ? ' on' : ''}" role="switch" aria-checked="${!!r.on}" aria-label="${esc((r.on ? 'Stop drafting ' : 'Draft ') + r.name)}" data-rl="switch" data-scope="${esc(scope)}" data-kind="${esc(r.kind)}"><i></i></button>`;
|
|
30
|
+
const row = (scope, r) => `<div class="rl-row"><span class="rl-t"><b>${r.pick ? '<span class="rl-pk" aria-label="Claude\'s pick">✦</span> ' : ''}${esc(r.name)}</b>${r.sub ? `<small>${esc(r.sub)}</small>` : ''}</span>${sw(scope, r)}</div>`;
|
|
31
|
+
|
|
32
|
+
/** The library's ready-made part, as html. Zero is silence: no group draws nothing. */
|
|
33
|
+
export function libHtml(L, o = {}) {
|
|
34
|
+
if (!L || !(L.groups || []).length) return '';
|
|
35
|
+
const open = o.open || new Set();
|
|
36
|
+
const lead = L.lead && L.lead.text ? `<div class="rl-lead"><span class="rl-sp">${SV(I.spark, 16)}</span><p><b>${esc(L.lead.text)}</b>${L.lead.rest ? ' ' + esc(L.lead.rest) : ''}</p>`
|
|
37
|
+
+ `<button type="button" class="rl-ok" data-rl="picks" aria-label="Keep Claude's picks" title="Keep Claude's picks">${SV(I.chk, 18, 2.4)}</button></div>` : '';
|
|
38
|
+
const ov = L.overlap && L.overlap.lead ? `<div class="rl-lead"><span class="rl-sp">${SV(I.spark, 16)}</span><p><b>${esc(L.overlap.lead)}</b>${L.overlap.rest ? ' ' + esc(L.overlap.rest) : ''}</p>`
|
|
39
|
+
+ `<button type="button" class="rl-ok" data-rl="overlap" aria-label="Send one update that carries the others" title="Send one update that carries the others">${SV(I.merge, 18, 2.2)}</button></div>`
|
|
40
|
+
+ ((L.overlap.people || []).length ? `<h4 class="rl-h">${esc(L.overlap.title || 'Who gets what')}</h4><div class="rl-card">${L.overlap.people.map((p) => `<div class="rl-row"><span class="rl-av">${SV(I.people, 16)}</span><span class="rl-t"><b>${esc(p.who)}</b>${p.sub ? `<small>${esc(p.sub)}</small>` : ''}</span></div>`).join('')}</div>` : '') : '';
|
|
41
|
+
const groups = L.groups.map((g) => {
|
|
42
|
+
const k = g.scope || g.name, more = g.more && g.more.count ? (() => { const on = open.has(k); return `<button type="button" class="rl-row rl-fold" data-rl="fold" data-k="${esc(k)}" aria-expanded="${on}"><span class="rl-t"><b>${esc(g.more.text || g.more.count + ' more weekly updates')}</b>${g.more.sub ? `<small>${esc(g.more.sub)}</small>` : ''}</span>${SV(I.down, 16)}</button>${on ? (g.more.rows || []).map((r) => row(g.scope, r)).join('') : ''}`; })() : '';
|
|
43
|
+
// the folded rows sit after the first row, as the design draws them (one ✦ pick, then "4 more weekly updates", then the other kinds)
|
|
44
|
+
const R = g.rows || [];
|
|
45
|
+
return `<h4 class="rl-h">${esc(g.name)}${g.level ? ` <span>· ${esc(LEVEL[g.level] || g.level)}</span>` : ''}</h4><div class="rl-card">${R.slice(0, 1).map((r) => row(g.scope, r)).join('')}${more}${R.slice(1).map((r) => row(g.scope, r)).join('')}</div>`;
|
|
46
|
+
}).join('');
|
|
47
|
+
return `<div class="rl">${lead}${ov}${groups}${(L.yours || []).length || o.yours ? '<h4 class="rl-h">Yours</h4>' : ''}</div>`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function wireLib(el, h) {
|
|
51
|
+
el.addEventListener('click', async (e) => {
|
|
52
|
+
const b = e.target.closest('[data-rl]'); if (!b || b.disabled || !el.contains(b)) return;
|
|
53
|
+
const a = b.dataset.rl;
|
|
54
|
+
if (a === 'fold') { const k = b.dataset.k; if (h.open.has(k)) h.open.delete(k); else h.open.add(k); h.redraw(); return; }
|
|
55
|
+
b.disabled = true;
|
|
56
|
+
const done = async (r, ok) => { if (!r || r.ok === false) { b.disabled = false; h.toast((r && r.error) || 'Nothing was changed. The server did not say why.'); return; } h.toast(ok); await h.reload(); };
|
|
57
|
+
if (a === 'switch') { const on = b.getAttribute('aria-checked') !== 'true'; return done(await Promise.resolve(pmPost('/api/ready-reports/switch', { ws: h.ws || undefined, scope: b.dataset.scope, kind: b.dataset.kind, on })).catch(() => null), on ? 'On. Claude drafts it at its moment; nothing goes out until you approve it.' : 'Off. Claude no longer drafts it.'); }
|
|
58
|
+
if (a === 'picks') return done(await Promise.resolve(pmPost('/api/ready-reports/picks', { ws: h.ws || undefined })).catch(() => null), 'Kept. Only Claude\'s picks are scheduled; the rest draft at their moment.');
|
|
59
|
+
if (a === 'overlap') return done(await Promise.resolve(pmPost('/api/ready-reports/overlap', { ws: h.ws || undefined })).catch(() => null), 'One update each. The wider one carries the others as sections.');
|
|
60
|
+
b.disabled = false;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* ready-dash-ui-test.js — the ready-made Dashboard in the program panel and the initiative view, and a ready-made report's two cuts in the one
|
|
4
|
+
* report Viewer (batch 17 item 1; canvas PbH1Header, PbA1, PbA2, PbA7, PbG2, PbG5). Serves the real Board page from the real server; Project
|
|
5
|
+
* Ascent comes from fixtures/program-ascent.js, and the /api/ready-reports routes answer fixtures/ready-reports.js, the shape the backend agreed.
|
|
6
|
+
* H the header: one toggle icon where the charter icon was (a gauge, "Show the dashboard", aria-pressed false); none before the dashboard reads
|
|
7
|
+
* D the Dashboard: ✦ line with Adler's face, Goals, Milestones, Needs you, Reports in order; the toggle shows a list, pressed; the pencil on
|
|
8
|
+
* Milestones opens the charter · W wide (1440): two columns (PbA7) · N ✓ on Needs you keeps the pick (POST /api/proposals/keep)
|
|
9
|
+
* R a report row opens the one report Viewer: Sponsors · 1 minute | Team · full; Sponsors reads the cut and lists the Team-only sections
|
|
10
|
+
* L the last choice per page: after a reload the Dashboard opens first
|
|
11
|
+
* I the initiative view on the Board has the same toggle; a held report (PbG2): Wait posts the hold
|
|
12
|
+
* M on a phone (390): the title keeps 150 px, the Dashboard fits the width, no page error · S the type scale only
|
|
13
|
+
* P the product page on Home (390 and 1440) is the product's Dashboard, with no toggle (PbA3, PbG8).
|
|
14
|
+
* PMOS_SHOTS=<dir> also saves the screenshots. */
|
|
15
|
+
const path = require('path');
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const { spawn } = require('child_process');
|
|
18
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
19
|
+
const T = require('./test-run').configure({ name: 'ready-dash-ui' });
|
|
20
|
+
const BP = require('./lib/board-premium.js');
|
|
21
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
22
|
+
const A = require('./fixtures/program-ascent.js');
|
|
23
|
+
const RR = require('./fixtures/ready-reports.js');
|
|
24
|
+
|
|
25
|
+
const BASE = T.BASE;
|
|
26
|
+
const SHOTS = process.env.PMOS_SHOTS || '';
|
|
27
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
28
|
+
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
29
|
+
const results = [];
|
|
30
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 700) : ''}`); };
|
|
31
|
+
let srv = null; let browser = null;
|
|
32
|
+
const finish = async (code) => {
|
|
33
|
+
if (browser) await browser.close().catch(() => {});
|
|
34
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
35
|
+
T.killTmux();
|
|
36
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
37
|
+
console.log(`\n${results.length - bad}/${results.length} ready-dash-ui assertions passed`);
|
|
38
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
39
|
+
};
|
|
40
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
41
|
+
|
|
42
|
+
const TEAM = '# Inline login slips to early December unless passkeys move to v1.1\n\n1. Sign-in at checkout is +1.2 of +5 points.\n2. Build is 14 of 23 tickets.\n3. Cutting passkeys keeps 18 Nov.\n\n## Your decision\n\nShip 18 Nov without passkeys.\n\n## Scorecard\n\n| Goal | Now |\n|---|---|\n| Checkout | +1.2 |\n\n## Tickets and risks\n\n14 of 23 done.\n\n## Next week\'s plan\n\nCut passkeys.\n';
|
|
43
|
+
const SPONSORS = '# Inline login slips to early December unless passkeys move to v1.1\n\n1. Sign-in at checkout is +1.2 of +5 points.\n2. Build is 14 of 23 tickets.\n3. Cutting passkeys keeps 18 Nov.\n\n## Your decision\n\nShip 18 Nov without passkeys.\n\n## Scorecard\n\n| Goal | Now |\n|---|---|\n| Checkout | +1.2 |\n';
|
|
44
|
+
|
|
45
|
+
(async () => {
|
|
46
|
+
const exe = process.env.PMOS_CHROME || findBrowser();
|
|
47
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
48
|
+
let chromium;
|
|
49
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
50
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
51
|
+
await T.waitForServer(BASE);
|
|
52
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
53
|
+
if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
|
|
54
|
+
const shot = async (p, name) => { if (SHOTS) { await sleep(450); await p.screenshot({ path: path.join(SHOTS, name + '.png') }); } };
|
|
55
|
+
|
|
56
|
+
const open = async ({ w = 1440, h = 900, dark = false, ctx = null, dash = {} } = {}) => {
|
|
57
|
+
const c = ctx || await browser.newContext({ viewport: { width: w, height: h }, colorScheme: dark ? 'dark' : 'light' });
|
|
58
|
+
const page = await c.newPage();
|
|
59
|
+
const errors = [], posts = [], gets = [];
|
|
60
|
+
page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
|
|
61
|
+
const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) }), wsOf = (r) => new URL(r.request().url()).searchParams.get('ws') || 'idpf';
|
|
62
|
+
await page.route('**/api/board-premium*', (r) => json(r, { ok: true, state: 'ready', model: BP.build(F.programFacts(wsOf(r))), as_of: Date.now() }));
|
|
63
|
+
await page.route('**/api/programs', (r) => json(r, { ok: true, programs: F.programs() }));
|
|
64
|
+
await page.route('**/api/boards/anchors*', (r) => json(r, { ok: true, anchors: A.ANCHORS[wsOf(r)] || [] }));
|
|
65
|
+
await page.route('**/api/insights-premium*', (r) => json(r, { ok: true, model: { goals: A.GOALS[wsOf(r)] || [] } }));
|
|
66
|
+
await page.route('**/api/boards/items*', (r) => json(r, { ok: true, items: A.ITEMS[wsOf(r)] || [] }));
|
|
67
|
+
await page.route('**/api/programs/*', (r) => json(r, { ok: true }));
|
|
68
|
+
await page.route('**/api/board-trail*', (r) => json(r, { ok: false, error: 'not in this check' }, 500));
|
|
69
|
+
await page.route('**/api/metric-drafts**', (r) => json(r, { ok: true, rows: [], run: { state: 'idle', step: 0, reads: [] } }));
|
|
70
|
+
// the ready-made dashboards, per scope (the backend's GET /api/ready-reports/dashboard), and its writes
|
|
71
|
+
const D = { 'program:project-ascent': RR.program(), 'initiative:descope-parity': RR.initiative(), ...dash };
|
|
72
|
+
await page.route('**/api/ready-reports/**', (r) => {
|
|
73
|
+
const rq = r.request(), u = new URL(rq.url());
|
|
74
|
+
if (rq.method() === 'GET' && u.pathname === '/api/ready-reports/dashboard') { const s = u.searchParams.get('scope'); gets.push({ scope: s, from: u.searchParams.get('from'), ws: u.searchParams.get('ws') }); return D[s] ? json(r, D[s]) : json(r, { ok: false, error: 'no such scope' }, 404); }
|
|
75
|
+
if (rq.method() === 'GET' && u.pathname === '/api/ready-reports/cut') { gets.push({ cut: u.searchParams.get('cut'), path: u.searchParams.get('path') }); return json(r, { ok: true, cut: 'sponsors', markdown: SPONSORS }); }
|
|
76
|
+
posts.push({ path: u.pathname, body: JSON.parse(rq.postData() || '{}') });
|
|
77
|
+
return json(r, { ok: true });
|
|
78
|
+
});
|
|
79
|
+
await page.route('**/api/proposals/**', (r) => { posts.push({ path: new URL(r.request().url()).pathname, body: JSON.parse(r.request().postData() || '{}') }); return json(r, { ok: true }); });
|
|
80
|
+
// the one report Viewer's reads: the document, its cycles; the rest answer nothing to show
|
|
81
|
+
await page.route('**/api/doc?*', (r) => r.fulfill({ contentType: 'text/markdown', body: TEAM }));
|
|
82
|
+
await page.route('**/api/report-documents*', (r) => json(r, { ok: true, docs: [{ path: 'reports/one-login-sponsor/2026-10-29.md', slot: '2026-10-29', state: 'draft' }] }));
|
|
83
|
+
await page.route('**/api/doc-sheet/stamp*', (r) => json(r, { ok: true, hash: 'h1' }));
|
|
84
|
+
await page.goto(BASE + '/premium-board.html?ws=idpf&program=project-ascent');
|
|
85
|
+
await until(() => page.evaluate(() => { const v = document.querySelector('#czViewer'); return !!v && !v.hidden && !!v.querySelector('.pp-vw'); }), 15000);
|
|
86
|
+
return { page, ctx: c, errors, posts, gets, D };
|
|
87
|
+
};
|
|
88
|
+
const head = (p) => p.evaluate(() => {
|
|
89
|
+
const h = document.querySelector('#czViewer .cz-vw-head') || document.querySelector('#czViewer'); const t = document.querySelector('#czViewer [data-cz-vw-p="dash"]');
|
|
90
|
+
return { toggle: t ? { label: t.getAttribute('aria-label'), title: t.getAttribute('title'), pressed: t.getAttribute('aria-pressed'), text: t.textContent.trim() } : null,
|
|
91
|
+
charter: !!document.querySelector('#czViewer [data-cz-vw-p="charter"]'), title: (() => { const e = document.querySelector('#czViewer .cz-vw-t'); return e ? Math.round(e.getBoundingClientRect().width) : 0; })(),
|
|
92
|
+
presses: [...h.querySelectorAll('[data-cz-vw="press"]')].map((b) => b.getAttribute('aria-label')) };
|
|
93
|
+
});
|
|
94
|
+
const dash = (p) => p.evaluate(() => {
|
|
95
|
+
const d = document.querySelector('#czViewer .db'); if (!d) return null;
|
|
96
|
+
return { heads: [...d.querySelectorAll('.db-h')].map((x) => x.textContent), hd: (d.querySelector('.db-hd b') || {}).textContent || '', face: !!d.querySelector('.db-hd .db-face svg, .db-hd .db-face .ad-dot'),
|
|
97
|
+
cols: getComputedStyle(d.querySelector('.db-grid')).gridTemplateColumns.split(' ').filter(Boolean).length, w: d.getBoundingClientRect().width, over: d.scrollWidth > d.clientWidth + 1 };
|
|
98
|
+
});
|
|
99
|
+
const sizes = (p, sel) => p.evaluate((s) => [...new Set([...document.querySelectorAll(s + ', ' + s + ' *')].filter((e) => e.childNodes.length && [...e.childNodes].some((n) => n.nodeType === 3 && n.textContent.trim())).map((e) => getComputedStyle(e).fontSize))], sel);
|
|
100
|
+
const SCALE = new Set(['11px', '12px', '14px', '16px', '20px', '28px']);
|
|
101
|
+
|
|
102
|
+
/* ── H: the header ── */
|
|
103
|
+
const X = await open();
|
|
104
|
+
const p = X.page;
|
|
105
|
+
const h0 = await until(async () => { const h = await head(p); return h.toggle ? h : null; });
|
|
106
|
+
ok('H one toggle icon in the charter\'s place: a gauge, "Show the dashboard", not pressed, icon-only', !!h0 && !h0.charter && h0.toggle.label === 'Show the dashboard' && h0.toggle.title === 'Show the dashboard' && h0.toggle.pressed === 'false' && !h0.toggle.text, JSON.stringify(h0));
|
|
107
|
+
ok('H the dashboard is read for the program, as a press to act (a Board row)', X.gets.some((g) => g.scope === 'program:project-ascent' && g.from === 'act' && g.ws === 'idpf'), JSON.stringify(X.gets));
|
|
108
|
+
ok('H Work opens first: the panel\'s own summary shows, no Dashboard', await p.evaluate(() => !!document.querySelector('#czViewer .pp-vw .czs-sum') && !document.querySelector('#czViewer .db')));
|
|
109
|
+
|
|
110
|
+
/* ── D: the Dashboard ── */
|
|
111
|
+
await p.click('#czViewer [data-cz-vw-p="dash"]');
|
|
112
|
+
const d0 = await until(() => dash(p));
|
|
113
|
+
ok('D the blocks in order: Goals, Milestones, Needs you, Reports; no empty block', !!d0 && d0.heads.join() === 'Goals,Milestones,Needs you,Reports', JSON.stringify(d0));
|
|
114
|
+
ok('D the ✦ line leads with what Claude handled, with Adler\'s face', !!d0 && d0.hd === '3 of 4 milestones hold their dates. I drafted the sponsor update for Thursday.' && d0.face, JSON.stringify(d0));
|
|
115
|
+
const h1 = await head(p);
|
|
116
|
+
ok('D the same icon now shows the list to go back, pressed', !!h1.toggle && h1.toggle.label === 'Show the work' && h1.toggle.pressed === 'true', JSON.stringify(h1));
|
|
117
|
+
ok('D in the 560 px panel the blocks stack in one column', !!d0 && d0.cols === 1, JSON.stringify(d0));
|
|
118
|
+
const ds = await sizes(p, '#czViewer .db');
|
|
119
|
+
ok('S the Dashboard uses the type scale only', ds.length && ds.every((x) => SCALE.has(x)), ds.join());
|
|
120
|
+
await shot(p, 'PbA2Prog-desk-built');
|
|
121
|
+
|
|
122
|
+
/* ── W: wide ── */
|
|
123
|
+
await p.click('#czViewer [data-cz-vw="wide"]');
|
|
124
|
+
const dw = await until(async () => { const d = await dash(p); return d && d.cols === 2 ? d : null; }, 4000);
|
|
125
|
+
ok('W wide (PbA7): two columns, each block its own card', !!dw && dw.cols === 2, JSON.stringify(await dash(p)));
|
|
126
|
+
await shot(p, 'PbA7Desk-built');
|
|
127
|
+
await p.click('#czViewer [data-cz-vw="wide"]');
|
|
128
|
+
|
|
129
|
+
/* ── N: Needs you ✓ ── */
|
|
130
|
+
await p.click('#czViewer .db-need [data-db="needs"][data-k="keep"]');
|
|
131
|
+
const kp = await until(() => X.posts.find((x) => x.path === '/api/proposals/keep'));
|
|
132
|
+
ok('N ✓ keeps Claude\'s pick: POST /api/proposals/keep with the proposal ids and the initiative', !!kp && kp.body.ids.join() === 'p-dates-1' && kp.body.initiative === 'descope-parity' && kp.body.ws === 'idpf', JSON.stringify(kp));
|
|
133
|
+
ok('N the dashboard is read again after the press', (await until(() => X.gets.filter((g) => g.scope === 'program:project-ascent').length >= 2, 3000)));
|
|
134
|
+
|
|
135
|
+
/* ── the Milestones pencil opens the charter, ← comes back to the Dashboard ── */
|
|
136
|
+
await p.click('#czViewer .db [data-db="milestones"]');
|
|
137
|
+
ok('D the pencil on Milestones opens the charter', !!(await until(() => p.evaluate(() => window.czViewer && window.czViewer.current() && /^charter:/.test(window.czViewer.current().id)), 4000)));
|
|
138
|
+
await p.click('#czViewer [data-cz-vw="back"]');
|
|
139
|
+
ok('D ← comes back to the Dashboard', !!(await until(() => p.evaluate(() => !!document.querySelector('#czViewer .db')), 4000)));
|
|
140
|
+
|
|
141
|
+
/* ── R: a report row, and its two cuts ── */
|
|
142
|
+
await p.click('#czViewer .db [data-db="report"][data-k="r-sponsor"]');
|
|
143
|
+
const seg = await until(() => p.evaluate(() => { const s = document.querySelector('#czViewer .vz-cuts'); return s ? [...s.querySelectorAll('button')].map((b) => b.textContent + ':' + b.getAttribute('aria-pressed')) : null; }), 8000);
|
|
144
|
+
ok('R the report opens in the one report Viewer with Sponsors · 1 minute | Team · full, Team first', !!seg && seg.join() === 'Sponsors · 1 minute:false,Team · full:true', JSON.stringify(seg));
|
|
145
|
+
await shot(p, 'PbA4Report-team-built');
|
|
146
|
+
await p.click('#czViewer .vz-cuts [data-r="cut|sponsors"]');
|
|
147
|
+
const cut = await until(() => p.evaluate(() => { const L = [...document.querySelectorAll('#czViewer .vz-cutl li')]; return L.length ? L.map((l) => (l.classList.contains('on') ? '✓' : '·') + l.querySelector('b').textContent + (l.querySelector('small') ? ' (' + l.querySelector('small').textContent + ')' : '')) : null; }), 5000);
|
|
148
|
+
ok('R Sponsors reads the cut (GET /api/ready-reports/cut) and ticks what sponsors read; the rest say Team only', !!cut && cut.join(' / ') === '✓The answer and 3 points / ✓Your decision / ✓Scorecard / ·Tickets and risks (Team only) / ·Next week\'s plan (Team only)', JSON.stringify(cut));
|
|
149
|
+
ok('R the cut was read for this file', X.gets.some((g) => g.cut === 'sponsors' && g.path === 'reports/one-login-sponsor/2026-10-29.md'));
|
|
150
|
+
ok('R Edit is not offered on the sponsors cut (the team cut is the one edited)', await p.evaluate(() => !document.querySelector('#czViewer [data-r="edit"]')));
|
|
151
|
+
await shot(p, 'PbG5Readers-built');
|
|
152
|
+
await p.click('#czViewer .vz-cuts [data-r="cut|team"]');
|
|
153
|
+
ok('R Team shows the full draft again', !!(await until(() => p.evaluate(() => !document.querySelector('#czViewer .vz-cutl') && document.querySelector('#czViewer [data-r="cut|team"]').getAttribute('aria-pressed') === 'true'), 3000)));
|
|
154
|
+
ok('0 no page error (desk)', X.errors.length === 0, X.errors.join(' | '));
|
|
155
|
+
await p.close();
|
|
156
|
+
|
|
157
|
+
/* ── L: the last choice per page ── */
|
|
158
|
+
const L = await open({ ctx: X.ctx });
|
|
159
|
+
const dl = await until(() => dash(L.page), 8000);
|
|
160
|
+
ok('L after a reload the Dashboard opens first: the PM\'s last choice on this program', !!dl && dl.heads[0] === 'Goals', JSON.stringify(dl));
|
|
161
|
+
|
|
162
|
+
/* ── I: the initiative view on the Board ── */
|
|
163
|
+
await L.page.click('#czViewer [data-cz-vw-p="dash"]'); // back to the work, so the tree is there
|
|
164
|
+
await until(() => L.page.evaluate(() => { const b = document.querySelector('#czViewer [data-czs-fold="tree"]'); if (b && b.getAttribute('aria-expanded') !== 'true') b.click(); return !!document.querySelector('#czViewer button.pp-open[data-ini="descope-parity"]'); }));
|
|
165
|
+
await L.page.click('#czViewer button.pp-open[data-ini="descope-parity"]');
|
|
166
|
+
const it = await until(async () => { const h = await head(L.page); return h.toggle && (await L.page.evaluate(() => !!document.querySelector('#czViewer .iv'))) ? h : null; }, 8000);
|
|
167
|
+
ok('I the initiative view carries the same toggle; Work shows first', !!it && it.toggle.label === 'Show the dashboard', JSON.stringify(it));
|
|
168
|
+
ok('I the initiative\'s dashboard is read for its scope', L.gets.some((g) => g.scope === 'initiative:descope-parity'));
|
|
169
|
+
await L.page.click('#czViewer [data-cz-vw-p="dash"]');
|
|
170
|
+
const di = await until(() => dash(L.page));
|
|
171
|
+
ok('I PbA1: Goal, Ships, Needs you, Reports', !!di && di.heads.join() === 'Goal,Ships,Needs you,Reports', JSON.stringify(di));
|
|
172
|
+
ok('I Ships: the range against the promise', await L.page.evaluate(() => /28 Nov to 5 Dec/.test(document.querySelector('#czViewer .db').textContent) && /promised 18 Nov/.test(document.querySelector('#czViewer .db').textContent)));
|
|
173
|
+
await shot(L.page, 'PbA1Ini-desk-built');
|
|
174
|
+
ok('0 no page error (initiative)', L.errors.length === 0, L.errors.join(' | '));
|
|
175
|
+
await X.ctx.close();
|
|
176
|
+
|
|
177
|
+
/* ── G: a held report (PbG2) ── */
|
|
178
|
+
const G = await open({ dash: { 'program:project-ascent': { ...RR.held(), scope: 'program:project-ascent' } } });
|
|
179
|
+
await until(async () => (await head(G.page)).toggle);
|
|
180
|
+
await G.page.click('#czViewer [data-cz-vw-p="dash"]');
|
|
181
|
+
await until(() => dash(G.page));
|
|
182
|
+
ok('G the held update: the honest ✦ line and Skip, Send with a note, Wait', await G.page.evaluate(() => !!document.querySelector('#czViewer .db-hd.warn') && document.querySelectorAll('#czViewer .db-held .db-ib').length === 3));
|
|
183
|
+
await G.page.click('#czViewer .db-held [data-k="r-weekly|wait"]');
|
|
184
|
+
const hp = await until(() => G.posts.find((x) => x.path === '/api/ready-reports/hold'));
|
|
185
|
+
ok('G Wait posts the hold (POST /api/ready-reports/hold, act wait)', !!hp && hp.body.act === 'wait' && hp.body.kind === 'weekly' && hp.body.scope === 'program:project-ascent', JSON.stringify(hp));
|
|
186
|
+
await shot(G.page, 'PbG2Stale-built');
|
|
187
|
+
ok('0 no page error (held)', G.errors.length === 0, G.errors.join(' | '));
|
|
188
|
+
await G.ctx.close();
|
|
189
|
+
|
|
190
|
+
/* ── Z: no dashboard: no toggle ── */
|
|
191
|
+
const Z = await open({ dash: { 'program:project-ascent': null } });
|
|
192
|
+
await until(() => Z.gets.some((g) => g.scope === 'program:project-ascent'), 5000); await sleep(500);
|
|
193
|
+
const hz = await head(Z.page);
|
|
194
|
+
ok('Z the dashboard cannot be read: no toggle, the work as before', !hz.toggle && !hz.charter, JSON.stringify(hz));
|
|
195
|
+
await Z.ctx.close();
|
|
196
|
+
|
|
197
|
+
/* ── M: a phone ── */
|
|
198
|
+
const M = await open({ w: 390, h: 844, dark: true });
|
|
199
|
+
const hm = await until(async () => { const h = await head(M.page); return h.toggle ? h : null; });
|
|
200
|
+
ok('M at 390 px the title keeps 150 px beside the one toggle (PbH1Header)', !!hm && hm.title >= 150, JSON.stringify(hm));
|
|
201
|
+
await M.page.click('#czViewer [data-cz-vw-p="dash"]');
|
|
202
|
+
const dm = await until(() => dash(M.page));
|
|
203
|
+
ok('M the Dashboard fits the phone: one column, no sideways scroll', !!dm && dm.cols === 1 && !dm.over && dm.w <= 390, JSON.stringify(dm));
|
|
204
|
+
ok('M every press is at least 40 px', await M.page.evaluate(() => [...document.querySelectorAll('#czViewer .db .db-ib')].every((b) => b.getBoundingClientRect().width >= 40)));
|
|
205
|
+
await shot(M.page, 'PbA2Prog-phone-dark-built');
|
|
206
|
+
ok('0 no page error (phone)', M.errors.length === 0, M.errors.join(' | '));
|
|
207
|
+
await M.ctx.close();
|
|
208
|
+
|
|
209
|
+
/* ── P: the product page on Home is the product's Dashboard (PbA3, PbG8): no toggle; Goals as dots, Ships next, This week ── */
|
|
210
|
+
for (const [w, hgt, nm] of [[390, 844, 'phone'], [1440, 900, 'desk']]) {
|
|
211
|
+
const c = await browser.newContext({ viewport: { width: w, height: hgt } });
|
|
212
|
+
const pg = await c.newPage(); const errs = [], gets = [];
|
|
213
|
+
pg.on('pageerror', (e) => errs.push(String((e && e.stack) || e)));
|
|
214
|
+
await pg.route('**/api/ready-reports/dashboard*', (r) => { const u = new URL(r.request().url()); gets.push({ scope: u.searchParams.get('scope'), from: u.searchParams.get('from') }); return r.fulfill({ contentType: 'application/json', body: JSON.stringify(RR.product()) }); });
|
|
215
|
+
await pg.goto(BASE + '/premium.html?ini=product');
|
|
216
|
+
const pd = await until(() => pg.evaluate(() => { const d = document.querySelector('#czViewer .db'); if (!d) return null; return { heads: [...d.querySelectorAll('.db-h')].map((x) => x.textContent), sum: (d.querySelector('.db-sum b') || {}).textContent || '', late: !!d.querySelector('.db-late'), over: d.scrollWidth > d.clientWidth + 1, toggle: !!document.querySelector('#czViewer [data-cz-vw-p="dash"]') }; }), 15000);
|
|
217
|
+
ok('P (' + nm + ') the product page is the Dashboard: Goals folded to dots, Ships next, This week with the late update; no toggle', !!pd && pd.sum === 'Goals' && pd.heads.join() === 'Ships next,This week' && pd.late && !pd.toggle && !pd.over, JSON.stringify(pd));
|
|
218
|
+
const mx = await pg.evaluate(() => { const b = document.querySelector('#czViewer .db [data-db="metrics"]'); if (!b) return null; const r = b.getBoundingClientRect(), s = document.querySelector('#czViewer .db-sum').getBoundingClientRect(); return { w: r.width, label: b.getAttribute('aria-label'), beside: Math.abs((r.top + r.height / 2) - (s.top + s.height / 2)) < 12 }; });
|
|
219
|
+
ok('P (' + nm + ') the metrics review keeps its way in: one icon at the Goals head, 40 px', !!mx && mx.label === 'Open the metrics review' && mx.w >= 40 && mx.beside, JSON.stringify(mx));
|
|
220
|
+
if (nm === 'desk') { await pg.click('#czViewer .db [data-db="metrics"]'); ok('P the icon opens the metrics review, ← back to the product', !!(await until(() => pg.evaluate(() => { const c = window.czViewer && window.czViewer.current(); return c && c.id !== 'product' ? c.id : null; })))); }
|
|
221
|
+
ok('P (' + nm + ') read as a page to read (scope product)', gets.some((g) => g.scope === 'product' && g.from === 'read'), JSON.stringify(gets));
|
|
222
|
+
await shot(pg, 'PbA3Product-' + nm + '-built');
|
|
223
|
+
ok('0 no page error (product, ' + nm + ')', errs.length === 0, errs.join(' | '));
|
|
224
|
+
await c.close();
|
|
225
|
+
}
|
|
226
|
+
return finish();
|
|
227
|
+
})();
|
package/workspace/server.js
CHANGED
|
@@ -2661,6 +2661,8 @@ const dashboardScheduleTick = () => {
|
|
|
2661
2661
|
let setups = null; try { setups = require('./lib/routes-report-setups.js'); } catch { setups = null; }
|
|
2662
2662
|
(setups ? setups.tick(reportSetupsCtx()) : Promise.resolve())
|
|
2663
2663
|
.catch((e) => warnWriteFail('report setups tick', e))
|
|
2664
|
+
.then(() => { let rr = null; try { rr = require('./lib/routes-ready-reports.js'); } catch { return null; } return rr.tick(reportSetupsCtx()); }) // batch 17 item 1: the ready-made reports
|
|
2665
|
+
.catch((e) => warnWriteFail('ready reports tick', e))
|
|
2664
2666
|
.then(() => m.runDue({ getWs, runtimeDir: STATE }))
|
|
2665
2667
|
.catch((e) => warnWriteFail('dashboard schedule tick', e));
|
|
2666
2668
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "batch 17 item 1 (1-A backend): the ready-made dashboard and reports of every program, product and initiative (pure engine, report scopes, routes and tick, in process).",
|
|
3
|
+
"modules": [
|
|
4
|
+
"ready-reports.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"ready-reports.test.js": 3
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "batch 17 item 1 (UI): the ready-made Dashboard view in the program panel, the initiative view and the product page, the one toggle icon in the headers, a ready-made report's Sponsors and Team cuts in the one report Viewer, and the Ready-made groups in Reports and dashboards; canvas PbH1Header, PbA1-PbA7, PbS1, PbS2, PbG2-PbG10. The /api/ready-reports routes answer fixtures/ready-reports.js, the shape agreed with the backend.",
|
|
3
|
+
"modules": ["dash-view.test.mjs"],
|
|
4
|
+
"panels": ["ready-dash-ui-test.js"],
|
|
5
|
+
"seconds": { "dash-view.test.mjs": 1, "ready-dash-ui-test.js": 40 }
|
|
6
|
+
}
|