create-pmos 0.279.0 → 0.281.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 +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/bin/pmos.js +1 -1
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/briefing-premium-doc-edit-test.js +3 -3
- package/workspace/briefing-premium-initiative-test.js +3 -3
- package/workspace/briefing-premium-insights-test.js +1 -1
- package/workspace/briefing-premium-test.js +3 -3
- package/workspace/briefing-premium-work-test.js +3 -3
- package/workspace/guide/briefing-premium.md +13 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-core-doc-issue-test.js +5 -5
- package/workspace/premium-welcome-test.js +213 -0
- package/workspace/premium-work-depth-test.js +2 -2
- package/workspace/public/pm/premium-first.js +36 -0
- package/workspace/public/pm/premium-initiative.js +8 -4
- package/workspace/public/pm/premium-shell.js +2 -1
- package/workspace/public/pm/premium-welcome-model.js +110 -0
- package/workspace/public/pm/premium-welcome.js +235 -0
- package/workspace/public/pm/premium.css +89 -1
- package/workspace/public/pm/premium.js +2 -0
- package/workspace/public/premium-board.html +1 -1
- package/workspace/public/premium-initiative.html +1 -1
- package/workspace/public/premium-insights.html +1 -1
- package/workspace/public/premium-welcome.html +23 -0
- package/workspace/public/premium-work.html +1 -1
- package/workspace/public/premium.html +1 -1
- package/workspace/server.js +2 -2
- package/workspace/test-files.json +2 -0
- package/workspace/test-lists/briefing-premium.json +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.281.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
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
kernel-source: pmos@
|
|
2
|
-
assembled: 2026-10-
|
|
1
|
+
kernel-source: pmos@f82b641
|
|
2
|
+
assembled: 2026-10-19
|
|
3
3
|
mode: vendor
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T01:13:19Z"}
|
|
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-19T01:13:19Z"}
|
|
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-19T01:13:19Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/payload/state/log.md
CHANGED
package/workspace/bin/pmos.js
CHANGED
|
@@ -247,7 +247,7 @@ async function openWorkspace(dir, port, { open = true } = {}) {
|
|
|
247
247
|
} catch { first = false; }
|
|
248
248
|
}
|
|
249
249
|
if (first) say(FORCE_WELCOME ? '✓ opening Welcome' : '✓ first run — opening Welcome');
|
|
250
|
-
if (open) openBrowser(first ? `${urlOf(port)}/welcome?ws=${w.id}` : `${urlOf(port)}?ws=${w.id}`);
|
|
250
|
+
if (open) openBrowser(first ? `${urlOf(port)}/premium-welcome.html?ws=${w.id}` : `${urlOf(port)}?ws=${w.id}`);
|
|
251
251
|
return 0;
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -218,7 +218,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
218
218
|
ok(`B13 at 390 px (${theme}) the stage and timeline views do not scroll sideways`, await q.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1));
|
|
219
219
|
await q.click('#ibTabs [data-v="list"]'); await q.locator('#ibBody .ini2').first().click(); await until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(900);
|
|
220
220
|
const g = await q.evaluate(() => { const r = document.querySelector('#dlg').getBoundingClientRect(); return { l: Math.round(r.left), w: Math.round(r.width), vw: innerWidth, tabs: getComputedStyle(document.querySelector('#dTabs')).display }; });
|
|
221
|
-
ok(`B13 at 390 px (${theme}) the dialog is full width and its
|
|
221
|
+
ok(`B13 at 390 px (${theme}) the dialog is full width and its Detail / Conversation switch is shown`, g.l === 0 && g.w === g.vw && g.tabs !== 'none', JSON.stringify(g));
|
|
222
222
|
await R.ctx.close();
|
|
223
223
|
}
|
|
224
224
|
{
|
|
@@ -78,12 +78,12 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
|
|
|
78
78
|
return { ctx, page, S };
|
|
79
79
|
};
|
|
80
80
|
const txt = (p, q) => p.evaluate((s) => (document.querySelector(s) || {}).textContent || '', q);
|
|
81
|
-
const tab = async (p, k) => { await p.click(`#shT [data-sh="${k}"]`); await sleep(150); };
|
|
81
|
+
const tab = async (p, k) => { if (!(await p.$('#shT [data-sh]'))) await p.click('#shV'); await p.click(`#shT [data-sh="${k}"]`); await sleep(150); };
|
|
82
82
|
|
|
83
83
|
const A = await open(); const p = A.page;
|
|
84
84
|
ok('0 the sheet opens', !!(await p.evaluate(() => document.querySelector('#shT'))));
|
|
85
85
|
/* E1 tabs */
|
|
86
|
-
ok('E1 the sheet has Read, Edit, Proposals, Edit log and Health,
|
|
86
|
+
await p.click('#shV'); ok('E1 the sheet has a view menu with Read, Edit, Proposals, Edit log and Health, and the open count on Proposals', await p.evaluate(() => [...document.querySelectorAll('#shT [data-sh]')].map((b) => b.textContent.replace(/\s+/g, ' ').trim()).join('|') === 'Read|Edit|Proposals 1|Edit log|Health'));
|
|
87
87
|
ok('E1 the Read outline marks only a heading an open proposal names', await p.evaluate(() => { const b = [...document.querySelectorAll('.dso button')]; return b.length === 0 || b.every((x) => !x.querySelector('i') === !/Goal|Summary/.test(x.textContent)); }));
|
|
88
88
|
ok('E7 the footnote no longer says read-only', !/Read-only/.test(await txt(p, '#oMain .xn')) && /only when you press Save or Accept/.test(await txt(p, '#oMain .xn')));
|
|
89
89
|
|
|
@@ -119,7 +119,7 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
|
|
|
119
119
|
ok('E4 Accept posts path, id, hash and only the sections still current', ac.route === 'accept' && Object.keys(ac.body).sort().join() === 'hash,id,path,sections' && ac.body.hash === 'ha' && ac.body.sections.join() === 'Summary', JSON.stringify(ac.body));
|
|
120
120
|
await until(() => p.evaluate(() => /Closed · 1/.test(document.querySelector('#oMain').textContent)));
|
|
121
121
|
ok('E5 after Accept the proposal is listed as closed and accepted, and none is open', await p.evaluate(() => /Open proposals · 0/.test(document.querySelector('#oMain').textContent) && /Accepted/.test(document.querySelector('.dsp.accepted').textContent) && /No open proposals/.test(document.querySelector('#oMain').textContent)));
|
|
122
|
-
ok('E5 the Proposals count is gone from the
|
|
122
|
+
if (!(await p.$('#shT [data-sh]'))) await p.click('#shV'); ok('E5 the Proposals count is gone from the menu once none is open', await p.evaluate(() => document.querySelector('#shT [data-sh="props"]').textContent.trim() === 'Proposals'));
|
|
123
123
|
await A.ctx.close();
|
|
124
124
|
|
|
125
125
|
/* E4 stale-all, reject, ask */
|
|
@@ -181,13 +181,13 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
181
181
|
/* I8 the document sheet */
|
|
182
182
|
const nPost0 = A.posts.length;
|
|
183
183
|
await p.locator('#dmList .dmo[data-doc="prd"]').click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && /Self-serve onboarding v2/.test(document.querySelector('#oMain').textContent) && document.querySelector('#oMain .dsbody'))); await sleep(500);
|
|
184
|
-
const sh = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, path: document.querySelector('#oMain .dpath').textContent, tabs: [...document.querySelectorAll('#shT
|
|
184
|
+
const sh = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, path: document.querySelector('#oMain .dpath').textContent, tabs: (() => { document.querySelector('#shV').click(); const t = [...document.querySelectorAll('#shT [data-sh]')].map((b) => b.textContent).join(','); document.querySelector('#shV').click(); return t; })(), fm: [...document.querySelectorAll('#oMain .kv2 span')].map((s) => s.textContent).join('|'), heads: [...document.querySelectorAll('#oMain h3.d2')].map((h) => h.textContent).join('|'), outline: [...document.querySelectorAll('#oMain .dso button')].map((b) => b.textContent).join('|'), pre: [...document.querySelectorAll('#oMain pre')].map((e) => e.textContent).join('|'), li: document.querySelectorAll('#oMain li').length }));
|
|
185
185
|
ok('I8 Read shows the file\'s path, its front matter as a grid, its headings, list and code', sh.title === 'PRD' && sh.path === 'planning/prd/self-serve-v2-prd.md' && sh.tabs === 'Read,Edit,Proposals,Edit log,Health' && /type\|PRD\|title\|Self-serve onboarding v2/.test(sh.fm) && sh.heads === 'PRD: Self-serve onboarding v2|Problem|Goal|Requirements' && sh.li === 2 && /R1 a first call/.test(sh.pre), JSON.stringify(sh));
|
|
186
186
|
ok('I8 Read asked for the log and the last revision, by GET, for this path', A.gets.some((g) => g.path === '/api/doc-sheet/log' && /path=planning%2Fprd%2Fself-serve-v2-prd.md/.test(g.query)) && A.gets.some((g) => g.path === '/api/doc-sheet/at' && /rev=2/.test(g.query)));
|
|
187
|
-
await p.click('#shT [data-sh="log"]');
|
|
187
|
+
await p.click('#shV'); await p.click('#shT [data-sh="log"]');
|
|
188
188
|
const lg = await until(() => p.evaluate(() => document.querySelector('#oMain .hsr') && [...document.querySelectorAll('#oMain .hsr')].map((r) => r.textContent.replace(/\s+/g, ' ').trim())));
|
|
189
189
|
ok('I8 Edit log lists the revisions newest first with their reasons and the other entries', lg && /v2 tightened the goal · pm/.test(lg[0]) && /v1 The file as the sheet first saw it · baseline/.test(lg[1]) && /asked What is missing\?/.test(lg[2]), JSON.stringify(lg));
|
|
190
|
-
await p.click('#shT [data-sh="health"]');
|
|
190
|
+
await p.click('#shV'); await p.click('#shT [data-sh="health"]');
|
|
191
191
|
const hl = await until(() => p.evaluate(() => document.querySelector('#oMain .ckr') && { note: document.querySelector('#oMain .note').textContent, rows: [...document.querySelectorAll('#oMain .ckr')].map((r) => r.className + ':' + r.querySelector('span').textContent) }));
|
|
192
192
|
ok('I8 Health shows each check as passed, not passed or no input, and says no input is not counted', hl && /1 of 2 checks/.test(hl.note) && hl.rows.join() === 'ckr done:Passed,ckr blocked:Not passed,ckr skipped:No input', JSON.stringify(hl));
|
|
193
193
|
ok('I8 the health check posts the path and the workspace only', A.posts.some((x) => x.path === '/api/doc-health/check' && Object.keys(x.body).sort().join() === 'path,ws' && x.body.ws === 'w1'));
|
|
@@ -216,7 +216,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
216
216
|
ok(`I11 at 390 px (${theme}) the page has no sideways scroll and every control is 44 px`, !m.over && m.small.length === 0, JSON.stringify(m));
|
|
217
217
|
await q.locator('#dashBody .nfr').first().click(); await until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(900);
|
|
218
218
|
const g = await q.evaluate(() => { const r = document.querySelector('#dlg').getBoundingClientRect(); return { l: Math.round(r.left), w: Math.round(r.width), vw: innerWidth, tabs: getComputedStyle(document.querySelector('#dTabs')).display }; });
|
|
219
|
-
ok(`I11 at 390 px (${theme}) the dialog is full width and its
|
|
219
|
+
ok(`I11 at 390 px (${theme}) the dialog is full width and its Detail / Conversation switch is shown`, g.l === 0 && g.w === g.vw && g.tabs !== 'none', JSON.stringify(g));
|
|
220
220
|
await R.ctx.close();
|
|
221
221
|
}
|
|
222
222
|
{
|
|
@@ -350,7 +350,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
350
350
|
await q.goto(BASE + '/premium.html?theme=' + theme);
|
|
351
351
|
await until(() => q.evaluate(() => document.querySelectorAll('#rank .rr').length > 0));
|
|
352
352
|
await q.locator('#rank .rhd').nth(3).click(); await until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(800);
|
|
353
|
-
await q.click('#
|
|
353
|
+
await q.click('#dTabs [data-t="chat"]'); await sleep(300);
|
|
354
354
|
await q.locator('#card .op').nth(0).click(); await q.fill('#why', 'A reason');
|
|
355
355
|
const m = await q.evaluate(() => { const hs = (sel) => [...document.querySelectorAll(sel)].map((b) => Math.round(b.getBoundingClientRect().height)); return { over: document.documentElement.scrollWidth > innerWidth + 1 || document.querySelector('#dlg').scrollWidth > document.querySelector('#dlg').clientWidth + 1, small: [].concat(hs('#card .seg2 button'), hs('#recBtn'), hs('.askbar input'), hs('#askGo'), hs('#card .op')).filter((h) => h < 44) }; });
|
|
356
356
|
ok('W10 at 390 px (' + theme + ') the decision card has no sideways scroll and every new control is 44 px', !m.over && m.small.length === 0, JSON.stringify(m));
|
|
@@ -492,8 +492,8 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
492
492
|
const ov = await R.page.evaluate(() => document.documentElement.scrollWidth - innerWidth);
|
|
493
493
|
ok(`R11 no sideways scroll at 390 px (${th})`, ov <= 0, String(ov));
|
|
494
494
|
await R.page.click('#rank .rhd');
|
|
495
|
-
const ph = await until(() => R.page.evaluate(() => document.querySelector('#dlg').classList.contains('on')), 3000) && await R.page.evaluate(() => ({ tab: document.querySelector('#dGrid').dataset.tab, pressed: document.querySelector('#dTabs [data-t="out"]').getAttribute('aria-pressed'), tabsShown: getComputedStyle(document.querySelector('#dTabs')).display !== 'none', w: Math.round(document.querySelector('#dlg').getBoundingClientRect().width), l: Math.round(document.querySelector('#dlg').getBoundingClientRect().left), vw: innerWidth, btn: document.querySelector('#dPane').getAttribute('aria-pressed'), ov: document.documentElement.scrollWidth - innerWidth }));
|
|
496
|
-
ok(`R4 on a phone the dialog opens on Detail, the
|
|
495
|
+
const ph = await until(() => R.page.evaluate(() => document.querySelector('#dlg').classList.contains('on')), 3000) && await R.page.evaluate(() => ({ tab: document.querySelector('#dGrid').dataset.tab, pressed: document.querySelector('#dTabs [data-t="out"]').getAttribute('aria-pressed'), tabsShown: getComputedStyle(document.querySelector('#dTabs')).display !== 'none', paneBtn: getComputedStyle(document.querySelector('#dPane')).display, w: Math.round(document.querySelector('#dlg').getBoundingClientRect().width), l: Math.round(document.querySelector('#dlg').getBoundingClientRect().left), vw: innerWidth, btn: document.querySelector('#dPane').getAttribute('aria-pressed'), ov: document.documentElement.scrollWidth - innerWidth }));
|
|
496
|
+
ok(`R4 on a phone the dialog opens on Detail, with the mockup's Detail / Conversation switch and no panel button (${th})`, ph && ph.tab === 'out' && ph.pressed === 'true' && ph.tabsShown && ph.paneBtn === 'none' && ph.l === 0 && ph.w === ph.vw && ph.ov <= 0, JSON.stringify(ph));
|
|
497
497
|
ok(`0 no page error at 390 px (${th})`, R.errors.length === 0, R.errors.join(' | '));
|
|
498
498
|
await R.ctx.close();
|
|
499
499
|
}
|
|
@@ -200,7 +200,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
200
200
|
const R = await open({ w: 820, h: 1000 }), t = R.page;
|
|
201
201
|
await t.locator('.wrow[data-key="work:item-aaaaaaaaaaa1"] .wrh').click(); await until(() => t.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(900);
|
|
202
202
|
const g = await t.evaluate(() => { const r = document.querySelector('#dlg').getBoundingClientRect(); return { l: Math.round(r.left), w: Math.round(r.width), vw: innerWidth, tabs: getComputedStyle(document.querySelector('#dTabs')).display }; });
|
|
203
|
-
ok('M12 on a tablet (820 px) the dialog is centred with a 12 px margin, and the
|
|
203
|
+
ok('M12 on a tablet (820 px) the dialog is centred with a 12 px margin, and the Detail / Conversation switch is shown', Math.abs(g.l - (g.vw - g.w) / 2) <= 2 && g.w === g.vw - 24 && g.tabs !== 'none', JSON.stringify(g));
|
|
204
204
|
await R.ctx.close();
|
|
205
205
|
}
|
|
206
206
|
/* M12 floors on a phone, both themes */
|
|
@@ -210,9 +210,9 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
210
210
|
const geo = () => q.evaluate(() => { const r = document.querySelector('#dlg').getBoundingClientRect(); return { l: Math.round(r.left), w: Math.round(r.width), vw: innerWidth }; });
|
|
211
211
|
const g1 = await geo();
|
|
212
212
|
ok(`M12 at 390 px (${theme}) the dialog opens on Detail at the full width of the screen`, g1.l === 0 && g1.w === g1.vw, JSON.stringify(g1));
|
|
213
|
-
await q.click('#
|
|
213
|
+
await q.click('#dTabs [data-t="chat"]'); await sleep(900);
|
|
214
214
|
const g2 = await geo();
|
|
215
|
-
ok(`M12 at 390 px (${theme}) with the conversation brought in it is still full width`, g2.l === 0 && g2.w === g2.vw && await q.evaluate(() => document.querySelector('#
|
|
215
|
+
ok(`M12 at 390 px (${theme}) with the conversation brought in it is still full width`, g2.l === 0 && g2.w === g2.vw && await q.evaluate(() => document.querySelector('#dTabs [data-t="chat"]').getAttribute('aria-pressed') === 'true' && getComputedStyle(document.querySelector('#dBody')).display !== 'none' && getComputedStyle(document.querySelector('#dOut')).display === 'none'), JSON.stringify(g2));
|
|
216
216
|
const m = await q.evaluate(() => { const hs = (sel) => [...document.querySelectorAll(sel)].map((b) => Math.round(b.getBoundingClientRect().height)); return { over: document.documentElement.scrollWidth > innerWidth + 1 || document.querySelector('#dlg').scrollWidth > document.querySelector('#dlg').clientWidth + 1, small: [].concat(hs('#card .cta'), hs('#card .seg2 button'), hs('#wOn'), hs('.askbar input'), hs('#askGo')).filter((h) => h < 44) }; });
|
|
217
217
|
ok(`M12 at 390 px (${theme}) the dialog has no sideways scroll and every control is 44 px`, !m.over && m.small.length === 0, JSON.stringify(m));
|
|
218
218
|
await q.keyboard.press('Escape'); await sleep(300);
|
|
@@ -248,6 +248,19 @@ Insights is the fourth place on the rail, at `/premium-insights.html`. It reads
|
|
|
248
248
|
|
|
249
249
|
Not built: a second measure next to a chart, bar highlights, speaker notes and notes on a slide, changing a set-up report's audience, format or schedule, tile sizes and free layout, the finder's settings, run-based charts such as corrections per 100 runs (they belong to the Board's Metrics card), and any measure no record holds. The console's own dashboards are separate and unchanged. KR metric records belong to a workspace, so every board of a workspace shows the same charts.
|
|
250
250
|
|
|
251
|
+
## Welcome
|
|
252
|
+
|
|
253
|
+
Welcome is the premium first-run page, at `/premium-welcome.html`. It is a page of its own, with no rail. `pmos` opens it on a first run. The older `/welcome` page stays at its address.
|
|
254
|
+
|
|
255
|
+
- **About you.** Your name, role and the few lines PMOS should know. **Continue** saves them to the workspace's proactive settings.
|
|
256
|
+
- **Your sources.** Choose the tools PMOS may read (calendar, Jira, mail, Slack) and add folders. **Look at my work** starts the chosen tools, scans, and shows what it found.
|
|
257
|
+
- **What PMOS found.** The initiatives, the board each goes to, and the defaults, with a count. You can change a board or a title before you import. **Import** applies the import and opens the premium Briefing with a first card that lists what came in and each tool's state, and an **Undo** that reverses the import and returns here. **Not now** dismisses the import and opens the Briefing.
|
|
258
|
+
- If the workspace already holds an import, the page goes straight to the Briefing with the first card. After an Undo the found step shows the rows but not the first-look sentence, because PMOS does not keep it. An agent session cannot make the writes; a refused import shows the server's reason.
|
|
259
|
+
|
|
251
260
|
## The default page
|
|
252
261
|
|
|
253
262
|
The premium Briefing is the default page: `/` and `/index.html` open it. The console is at `/console.html`, and the header button **Open the console** on each premium page goes there. The old address `/c3.html` goes to the premium Briefing; with a query (for example `/c3.html?tab=rep`) it goes to `/console.html` with the same query. `/classic.html` is unchanged. To go back, change the last page name in the page-route chain in `server.js` from `premium.html` to `c3.html` and delete the `/c3.html` redirect above it.
|
|
263
|
+
|
|
264
|
+
## The dialog on a phone and the document sheet's views
|
|
265
|
+
|
|
266
|
+
On a phone or tablet (under 1000 px) every dialog opens on **Detail**. A **Detail / Conversation** switch sits under the title, and **Open it** at the foot of Detail brings the conversation when an action waits there. The header holds only **Close**. A document sheet picks its view (**Read**, **Edit**, **Proposals**, **Edit log**, **Health**) from one button with a menu.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.281.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.281.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -92,7 +92,7 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
|
|
|
92
92
|
ok('B1 a document with no file is not', await p.evaluate((k) => !document.querySelector('#docBody .dmo:not(button)') || [...document.querySelectorAll('#docBody .dmo:not(button)')].every((x) => !x.closest('.dmr').querySelector(`[data-doc="${k}"]`)), bkey));
|
|
93
93
|
await p.click(`#docBody [data-doc="${bkey}"]`); await dlgOn(p);
|
|
94
94
|
ok('B2 the reader shows the file\'s text and path, and the bar says nothing is sent', await until(() => p.evaluate((pt) => { const o = document.querySelector('#oMain'); return /Why this board exists/.test(o.textContent) && o.textContent.includes(pt) && !!o.querySelector('[data-issue-bar="draft"]') && /Nothing is sent/.test(o.querySelector('[data-issue-bar]').textContent) && !!o.querySelector('[data-rd="issue"]'); }, d1.path)), await p.evaluate(() => document.querySelector('#oMain').textContent));
|
|
95
|
-
ok('B2 the reader has no Edit tab', await p.evaluate(() => !document.querySelector('#oMain [data-sh]')));
|
|
95
|
+
ok('B2 the reader has no Edit tab', await p.evaluate(() => !document.querySelector('#oMain [data-sh], #oMain #shV')));
|
|
96
96
|
const n0 = ledger().filter((l) => l.ev === 'issue').length;
|
|
97
97
|
await p.click('[data-rd="issue"]');
|
|
98
98
|
ok('B3 Issue it says it sent nothing', !!(await toastIs(p, /Issued\. Nothing was sent to anyone/)));
|
|
@@ -110,17 +110,17 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
|
|
|
110
110
|
await until(() => ip.evaluate((k) => !!document.querySelector(`#dmList [data-doc="${k}"]`), ikey), 60000);
|
|
111
111
|
await ip.click(`#dmList [data-doc="${ikey}"]`); await dlgOn(ip);
|
|
112
112
|
ok('I1 the Read tab of a draft has the Issue it bar above the text', await until(() => ip.evaluate(() => { const o = document.querySelector('#oMain'); const b = o.querySelector('[data-issue-bar="draft"]'); return !!b && /Nothing is sent/.test(b.textContent) && /Why this board exists/.test(o.textContent) && b.compareDocumentPosition(o.querySelector('.dsbody')) & Node.DOCUMENT_POSITION_FOLLOWING; })));
|
|
113
|
-
await ip.click('[data-sh="edit"]');
|
|
113
|
+
await ip.click('#shV'); await ip.click('[data-sh="edit"]');
|
|
114
114
|
await until(() => ip.evaluate(() => !!document.querySelector('#dsEd')));
|
|
115
115
|
await ip.fill('#dsEd', BODY + '\n## Added\n\nUnsaved line.\n');
|
|
116
|
-
await ip.click('[data-sh="read"]');
|
|
116
|
+
await ip.click('#shV'); await ip.click('[data-sh="read"]');
|
|
117
117
|
await until(() => ip.evaluate(() => !!document.querySelector('[data-ds="issue"]')));
|
|
118
118
|
const nI = I.posts.length;
|
|
119
119
|
await ip.click('[data-ds="issue"]');
|
|
120
120
|
ok('I2 Issue it with unsaved edits posts nothing and says to save or cancel first', await until(() => ip.evaluate(() => /unsaved changes.*Save or cancel/.test((document.querySelector('#dsErr') || {}).textContent || ''))) && I.posts.length === nI);
|
|
121
121
|
ok('I2 the ledger has no issue line for that draft yet', !ledger().some((l) => l.ev === 'issue' && l.slot === d2.slot && l.scope === iscope));
|
|
122
|
-
await ip.click('[data-sh="edit"]'); await until(() => ip.evaluate(() => !!document.querySelector('[data-ds="discard"]')));
|
|
123
|
-
await ip.click('[data-ds="discard"]'); await ip.click('[data-sh="read"]');
|
|
122
|
+
await ip.click('#shV'); await ip.click('[data-sh="edit"]'); await until(() => ip.evaluate(() => !!document.querySelector('[data-ds="discard"]')));
|
|
123
|
+
await ip.click('[data-ds="discard"]'); await ip.click('#shV'); await ip.click('[data-sh="read"]');
|
|
124
124
|
await until(() => ip.evaluate(() => !!document.querySelector('[data-ds="issue"]')));
|
|
125
125
|
/* a refusal: someone else issues the same draft first (the console, a second tab) */
|
|
126
126
|
const raced = await fetch(BASE + '/api/core-docs/issue', { method: 'POST', headers: H, body: JSON.stringify({ ws: B.ws, scope: iscope, key: ikey, slot: d2.slot }) });
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* premium-welcome-test.js — the premium Welcome page and the first-Briefing card (initiative premium-welcome; planning/prd/premium-welcome-prd.md R1 to R11).
|
|
4
|
+
* Serves the real pages from the real server. The onboarding routes, the proactive settings and the source routes are answered by stand-ins, so each press can be
|
|
5
|
+
* read off the request the page sent. The routes' own behaviour is in their own suites (pm-welcome-test.js, the onboarding suites).
|
|
6
|
+
* R1 own address · R2 About you · R3 sources · R4 found · R5 defaults · R6 import · R7 first card · R8 not now · R9 already imported · R10 writes · R11 floors and fidelity
|
|
7
|
+
* Every wait polls the page; no fixed sleep stands in for a state. */
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const os = require('os');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const { spawn, spawnSync } = require('child_process');
|
|
12
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
13
|
+
const T = require('./test-run').configure({ name: 'premium-welcome' });
|
|
14
|
+
const B = require('./lib/briefing-premium.js');
|
|
15
|
+
const F = require('./fixtures/briefing-premium-facts.js');
|
|
16
|
+
|
|
17
|
+
const BASE = T.BASE;
|
|
18
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
19
|
+
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
20
|
+
const results = [];
|
|
21
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
22
|
+
let srv = null; let browser = null;
|
|
23
|
+
const finish = async (code) => {
|
|
24
|
+
if (browser) await browser.close().catch(() => {});
|
|
25
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
26
|
+
T.killTmux();
|
|
27
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
28
|
+
console.log(`\n${results.length - bad}/${results.length} premium-welcome browser assertions passed`);
|
|
29
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
30
|
+
};
|
|
31
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
32
|
+
|
|
33
|
+
const mockupFile = path.join(os.tmpdir(), `premium-welcome-mockup-${process.pid}.html`);
|
|
34
|
+
const built = spawnSync('python3', [path.join(__dirname, '..', 'prototype', 'premium-welcome', 'build.py'), mockupFile], { encoding: 'utf8' });
|
|
35
|
+
|
|
36
|
+
const STRUCT = {
|
|
37
|
+
ok: true,
|
|
38
|
+
boards: [
|
|
39
|
+
{ key: 'payments', name: 'Payments', unsorted: [{}, {}, {}], initiatives: [
|
|
40
|
+
{ proposal_id: 'p1', title: 'Refund reason codes', lane: 'feature', anchor: null, stage: 'Specified', checked: true, docs: [{ file: 'payments/refund-codes-prd.md' }, { file: 'payments/x.md' }] },
|
|
41
|
+
{ proposal_id: 'p3', title: 'Card vault migration', lane: 'feature', anchor: 'KR-P1', stage: 'Done', checked: false, docs: [{ file: 'a.md' }] }] },
|
|
42
|
+
{ key: 'growth', name: 'Growth', unsorted: [], initiatives: [{ proposal_id: 'g1', title: 'Win-back emails', lane: 'feature', anchor: 'KR-G1', stage: 'Building', checked: true, docs: [] }] }],
|
|
43
|
+
questions: [{ id: 'anchor', text: 'Anchor for the ones with none', default: 'per-board', options: [{ value: 'per-board', label: 'Each board’s domain anchor' }, { value: 'health:upkeep', label: 'health:upkeep for all' }] },
|
|
44
|
+
{ id: 'fiscal', text: 'Fiscal year starts', default: 'January' }],
|
|
45
|
+
};
|
|
46
|
+
const LOOK = { sentence: '214 files read. 3 initiatives on 2 boards, 41 documents.', findings: [
|
|
47
|
+
{ title: 'Deadline 30 Oct has no owner', why: 'A date within 30 days names no owner.', evidence: [{ file: 'payments/refund-codes-prd.md', line: 14 }] },
|
|
48
|
+
{ title: '<img src=x onerror="window.__pwn=1">', why: '<b>bold</b>', evidence: [{ file: 'growth/pricing.md' }] }] };
|
|
49
|
+
const BRIEFING = { ok: true, items: [{ title: 'Refund reason codes needs an anchor you confirm', why: 'It had no anchor.', evidence: [{ file: 'payments/refund-codes-prd.md', line: 1 }], initiative: { title: 'Refund reason codes', board: 'payments' } }] };
|
|
50
|
+
|
|
51
|
+
(async () => {
|
|
52
|
+
const exe = findBrowser();
|
|
53
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
54
|
+
let chromium;
|
|
55
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
56
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
57
|
+
await T.waitForServer(BASE);
|
|
58
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
59
|
+
const json = (r, b, status = 200) => r.fulfill({ status, contentType: 'application/json', body: JSON.stringify(b) });
|
|
60
|
+
|
|
61
|
+
/* opts: status (the onboarding status answer), applyError, toolError, briefing, structure, w, h, theme, touch, url, tools (the sessionStorage record the first card reads) */
|
|
62
|
+
const open = async ({ url = '/premium-welcome.html?ws=w1', w = 1280, h = 900, theme = 'light', touch = false, status = { ok: true, state: 'new', first_run: true, imports: [] }, applyError = null, toolError = null, briefing = BRIEFING, structure = STRUCT, tools = null } = {}) => {
|
|
63
|
+
const ctx = await browser.newContext({ viewport: { width: w, height: h }, hasTouch: touch, isMobile: touch });
|
|
64
|
+
const page = await ctx.newPage();
|
|
65
|
+
const S = { errors: [], reqs: [], posts: [], headers: [], dismissed: 0, undone: [], settings: { name: 'Dana', about: { role: 'Senior PM', work: '', duties: '' } }, applied: [] };
|
|
66
|
+
page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
|
|
67
|
+
page.on('request', (r) => { if (r.url().startsWith(BASE)) { const u = new URL(r.url()); if (u.pathname.startsWith('/api/')) S.reqs.push(r.method() + ' ' + u.pathname); if (r.method() === 'POST') S.headers.push(r.headers()['x-pmos-nonce'] || ''); } });
|
|
68
|
+
const body = (r) => JSON.parse(r.request().postData() || '{}');
|
|
69
|
+
await page.route('**/api/workspaces', (r) => (r.request().method() === 'GET' ? json(r, { workspaces: [{ id: 'w1', name: 'checkout-team', root: '/home/u/checkout-team' }, { id: 'w2', name: 'growth-notes', root: '/home/u/growth-notes' }] }) : (S.posts.push(['workspaces', body(r)]), json(r, { workspace: { id: 'w2', name: 'growth-notes', root: '/home/u/growth-notes' } }))));
|
|
70
|
+
await page.route('**/api/pick-folder', (r) => { S.posts.push(['pick-folder', body(r)]); return json(r, { ok: true, root: '/home/u/growth-notes' }); });
|
|
71
|
+
await page.route('**/api/proactive/settings', (r) => { if (r.request().method() === 'GET') return json(r, { ok: true, settings: S.settings }); const b = body(r); S.posts.push(['settings', b]); return json(r, { ok: true }); });
|
|
72
|
+
await page.route('**/api/proactive/goals/plan', (r) => { S.posts.push(['plan', body(r)]); return json(r, { ok: true }); });
|
|
73
|
+
await page.route('**/api/sources/refresh', (r) => { const b = body(r); S.posts.push(['refresh', b]); return toolError && b.source === toolError.source ? json(r, { ok: false, error: toolError.error }, 409) : json(r, { ok: true }); });
|
|
74
|
+
await page.route('**/api/onboarding/status*', (r) => json(r, status));
|
|
75
|
+
await page.route('**/api/onboarding/scan', (r) => { S.posts.push(['scan', body(r)]); return json(r, { ok: true, scan_id: 's1', first_look: LOOK }); });
|
|
76
|
+
await page.route('**/api/onboarding/structure*', (r) => json(r, structure));
|
|
77
|
+
await page.route('**/api/onboarding/apply', (r) => { const b = body(r); S.posts.push(['apply', b]); S.applied.push(b); return applyError ? json(r, { ok: false, error: applyError }, 400) : json(r, { ok: true, import_id: 'imp1', boards: 2, initiatives: b.include.length }); });
|
|
78
|
+
await page.route('**/api/onboarding/briefing*', (r) => json(r, briefing));
|
|
79
|
+
await page.route('**/api/onboarding/dismiss', (r) => { S.dismissed++; S.posts.push(['dismiss', body(r)]); return json(r, { ok: true }); });
|
|
80
|
+
await page.route('**/api/onboarding/undo', (r) => { S.undone.push(body(r)); S.posts.push(['undo', body(r)]); return json(r, { ok: true, retracted: 1 }); });
|
|
81
|
+
await page.route('**/api/briefing-premium*', (r) => json(r, { ok: true, state: 'ready', model: B.build(F.facts()), as_of: Date.now() }));
|
|
82
|
+
if (tools) await page.addInitScript((t) => { try { sessionStorage.setItem('pmos.welcome.tools', t); } catch { /* none */ } }, JSON.stringify(tools));
|
|
83
|
+
await page.goto(BASE + url + (url.includes('?') ? '&' : '?') + 'theme=' + theme);
|
|
84
|
+
return { ctx, page, S };
|
|
85
|
+
};
|
|
86
|
+
const text = (page, sel) => page.evaluate((s) => { const e = document.querySelector(s); return e ? e.textContent.replace(/\s+/g, ' ').trim() : null; }, sel);
|
|
87
|
+
const heading = (page, re) => until(() => page.evaluate((src) => new RegExp(src).test((document.querySelector('#wlH') || {}).textContent || ''), re.source));
|
|
88
|
+
const click = (page, sel) => page.evaluate((s) => document.querySelector(s).click(), sel);
|
|
89
|
+
const fillIn = async (page, sel, v) => { await page.fill(sel, v); };
|
|
90
|
+
|
|
91
|
+
if (built.status !== 0) { ok('the mockup builds (prototype/premium-welcome/build.py)', false, built.stderr); return finish(1); }
|
|
92
|
+
|
|
93
|
+
/* ── the whole flow ──────────────────────────────────────────────────────────────────────── */
|
|
94
|
+
const P = await open();
|
|
95
|
+
ok('R1 the page is served at its own address with the launch nonce', await until(() => P.page.evaluate(() => (document.querySelector('meta[name="pmos-nonce"]').content || '').length > 8)));
|
|
96
|
+
ok('R2 About you opens on its heading and is prefilled from the proactive settings', await heading(P.page, /Welcome to PMOS/) && await P.page.inputValue('[data-f=name]') === 'Dana' && await P.page.inputValue('[data-f=role]') === 'Senior PM');
|
|
97
|
+
ok('R2 the step bar and count say step 1 of 3', /step 1 of 3/.test(await text(P.page, '#wlCount')) && (await P.page.$$('#wlSteps li')).length === 3);
|
|
98
|
+
await fillIn(P.page, '[data-f=work]', 'I run checkout'); await fillIn(P.page, '[data-f=name]', 'Dana K');
|
|
99
|
+
await click(P.page, '[data-w=about]');
|
|
100
|
+
ok('R2 Continue saves the four fields through the proactive settings and moves on', await heading(P.page, /Where does your work live/) && JSON.stringify(P.S.posts.find((p) => p[0] === 'settings')[1]) === JSON.stringify({ name: 'Dana K', about: { role: 'Senior PM', work: 'I run checkout', duties: '' } }));
|
|
101
|
+
ok('R3 the folder being set up is listed, and each tool is Off until ticked', /checkout-team/.test(await text(P.page, '#wlCard')) && await P.page.evaluate(() => [...document.querySelectorAll('[data-w=tool]')].length === 4 && [...document.querySelectorAll('[data-w=tool]')].every((b) => b.getAttribute('aria-pressed') === 'false' && /Off/.test(b.textContent))));
|
|
102
|
+
ok('R3 nothing was read or started before Scan', !P.S.posts.some((p) => ['scan', 'plan', 'refresh'].includes(p[0])) && !P.S.reqs.some((r) => /onboarding\/(scan|structure)|sources\/refresh/.test(r)));
|
|
103
|
+
await click(P.page, '[data-w=folder]'); await until(() => P.page.evaluate(() => /growth-notes/.test(document.querySelector('#wlCard').textContent)));
|
|
104
|
+
ok('R3 Add another folder asks the chooser and registers the folder without focusing it', P.S.posts.some((p) => p[0] === 'pick-folder') && JSON.stringify(P.S.posts.find((p) => p[0] === 'workspaces')[1]) === JSON.stringify({ root: '/home/u/growth-notes', name: 'growth-notes', focus: false }));
|
|
105
|
+
await click(P.page, '[data-w=tool][data-k=calendar]'); await click(P.page, '[data-w=tool][data-k=inbox]');
|
|
106
|
+
ok('R3 the Scan button names the tools it will read', /Scan the folder and read 2 tools/.test(await text(P.page, '[data-w=scan]')));
|
|
107
|
+
await click(P.page, '[data-w=scan]');
|
|
108
|
+
ok('R4 the scan ends on What PMOS found', await heading(P.page, /What PMOS found/));
|
|
109
|
+
const posts = P.S.posts.map((p) => p[0]);
|
|
110
|
+
ok('R3 Scan turned the Inbox on for the Briefing, prepared the day, refreshed Calendar only, then scanned with the added folder', JSON.stringify(P.S.posts.find((p) => p[0] === 'settings' && p[1].briefSources)[1]) === '{"briefSources":{"mail":true}}' && posts.includes('plan') && P.S.posts.filter((p) => p[0] === 'refresh').map((p) => p[1].source).join() === 'calendar' && JSON.stringify(P.S.posts.find((p) => p[0] === 'scan')[1].extra_roots) === '["/home/u/growth-notes"]');
|
|
111
|
+
ok('R4 the scan\'s sentence and findings are shown with their file and line', /214 files read/.test(await text(P.page, '.wl-lede')) && /payments\/refund-codes-prd\.md:14/.test(await text(P.page, '#wlCard')));
|
|
112
|
+
ok('R10 text taken from the folder is text: no element was made from it', await P.page.evaluate(() => !window.__pwn && !document.querySelector('#wlCard img') && /<img src=x/.test(document.querySelector('#wlCard').textContent) && !document.querySelector('#wlCard b + small b')));
|
|
113
|
+
ok('R4 the portfolio shows each board with its unsorted count and each row with lane, anchor, stage and documents', /Payments/.test(await text(P.page, '.wl-bh')) && /3 documents unsorted/.test(await text(P.page, '.wl-bh')) && /feature · no anchor · Specified · 2 documents/.test(await text(P.page, '.wl-ed')));
|
|
114
|
+
ok('R4 the row the scan proposed unchecked starts left out, and the button counts the others', await P.page.evaluate(() => document.querySelectorAll('.wl-ed.off').length === 1) && /Import 2 initiatives into 2 boards/.test(await text(P.page, '[data-w=import]')));
|
|
115
|
+
await click(P.page, '[data-w=inc][data-id=g1]');
|
|
116
|
+
ok('R4 Leave out takes a row from the count and Edit is off for it', /Import 1 initiative into 1 board/.test(await text(P.page, '[data-w=import]')) && await P.page.evaluate(() => document.querySelector('[data-w=edit][data-id=g1]').disabled));
|
|
117
|
+
await click(P.page, '[data-w=inc][data-id=g1]'); await click(P.page, '[data-w=inc][data-id=p3]');
|
|
118
|
+
ok('R4 a left-out row can be brought back, and a left-in one counts', /Import 3 initiatives into 2 boards/.test(await text(P.page, '[data-w=import]')));
|
|
119
|
+
await click(P.page, '[data-w=inc][data-id=p3]');
|
|
120
|
+
await click(P.page, '[data-w=edit][data-id=p1]'); await fillIn(P.page, '[data-f=title][data-id=p1]', 'Refund codes');
|
|
121
|
+
await P.page.selectOption('[data-f=board][data-id=p1]', 'growth');
|
|
122
|
+
ok('R4 Edit changes the title and the board of a row', await until(() => P.page.evaluate(() => document.querySelector('[data-f=title][data-id=p1]').value === 'Refund codes')) && /Import 2 initiatives into 1 board/.test(await text(P.page, '[data-w=import]')));
|
|
123
|
+
ok('R5 the defaults list each scan question with the default it will send', /Anchor for the ones with none/.test(await text(P.page, '.wl-def')) && /Each board’s domain anchor/.test(await text(P.page, '.wl-def')) && /January/.test(await text(P.page, '.wl-def')));
|
|
124
|
+
await click(P.page, '[data-w=defs]'); await P.page.selectOption('[data-f=answer][data-id=anchor]', 'health:upkeep'); await click(P.page, '[data-w=skipq][data-id=fiscal]');
|
|
125
|
+
ok('R5 Change the defaults shows the inputs, and a skipped question says nothing is sent', await until(() => P.page.evaluate(() => /Skipped\. Nothing is sent/.test(document.querySelector('.wl-def dl').textContent))) && /health:upkeep/.test(await text(P.page, '.wl-def dl')));
|
|
126
|
+
await click(P.page, '[data-w=import]');
|
|
127
|
+
ok('R6 Import posts once with the ticked ids, the revisions and the answers', await until(() => P.S.applied.length === 1) && JSON.stringify(P.S.applied[0]) === JSON.stringify({ ws: 'w1', include: ['p1', 'g1'], revisions: { p1: { title: 'Refund codes', board: 'growth' } }, answers: { anchor: 'health:upkeep' } }), JSON.stringify(P.S.applied));
|
|
128
|
+
ok('R6 the page then lands on the premium Briefing with the import id', await until(() => P.page.url().includes('/premium.html?ws=w1&first=imp1'), 15000), P.page.url());
|
|
129
|
+
ok('R10 every write carried the launch nonce', P.S.headers.length > 5 && P.S.headers.every((h) => h.length > 8));
|
|
130
|
+
const allowed = /^(GET \/api\/(workspaces|proactive\/settings|onboarding\/(status|structure|briefing)|briefing-premium|notes|premium-[a-z-]+|calendar-views|search|bell|sessions[a-z/-]*|board-metrics-premium|[a-z-]+)|POST \/api\/(proactive\/settings|proactive\/goals\/plan|pick-folder|workspaces|sources\/refresh|onboarding\/(scan|apply|dismiss|undo)))$/;
|
|
131
|
+
const welcomeReqs = P.S.reqs.slice(0, P.S.reqs.findIndex((r) => /briefing-premium/.test(r)) > 0 ? P.S.reqs.findIndex((r) => /briefing-premium/.test(r)) : P.S.reqs.length);
|
|
132
|
+
ok('R10 Welcome sent no request beyond the onboarding, settings and source routes', welcomeReqs.every((r) => allowed.test(r)), welcomeReqs.filter((r) => !allowed.test(r)).join());
|
|
133
|
+
ok('R10 no script error on the way', P.S.errors.length === 0, P.S.errors.join(' | '));
|
|
134
|
+
|
|
135
|
+
/* R7 the first-Briefing card, and Undo */
|
|
136
|
+
const C = await open({ url: '/premium.html?ws=w1&first=imp1', tools: { calendar: { started: true }, inbox: { error: 'No connection for Inbox.' } } });
|
|
137
|
+
ok('R7 the card sits above the columns with the import\'s item, its initiative and its file', await until(() => C.page.evaluate(() => { const c = document.querySelector('#wlFirst'); return !!c && c.nextElementSibling && c.nextElementSibling.classList.contains('cols2') && /Refund reason codes needs an anchor/.test(c.textContent) && /payments board/.test(c.textContent) && /refund-codes-prd\.md:1/.test(c.textContent); })));
|
|
138
|
+
ok('R7 the card lists the ticked tools: one being read, one with its reason', await C.page.evaluate(() => /Calendar is being read in an agent session/.test(document.querySelector('#wlFirst').textContent) && /No connection for Inbox\./.test(document.querySelector('#wlFirst').textContent) && !/Slack|Jira/.test(document.querySelector('#wlFirst').textContent)));
|
|
139
|
+
await click(C.page, '#wlUndo');
|
|
140
|
+
ok('R7 Undo this import retracts that import and returns to the found step', await until(() => C.S.undone.length === 1) && JSON.stringify(C.S.undone[0]) === '{"ws":"w1","import_id":"imp1"}' && await until(() => C.page.url().includes('/premium-welcome.html?ws=w1&step=found')) && await heading(C.page, /What PMOS found/));
|
|
141
|
+
ok('R7 the found step after Undo shows no first-look sentence it does not hold', await C.page.evaluate(() => !document.querySelector('.wl-lede') && !/Nothing in this folder needs you/.test(document.querySelector('#wlCard').textContent) && document.querySelectorAll('.wl-ed').length === 3));
|
|
142
|
+
await C.ctx.close();
|
|
143
|
+
const E = await open({ url: '/premium.html?ws=w1&first=imp9', briefing: { ok: true, items: [] } });
|
|
144
|
+
ok('R7 a Briefing with no items says nothing needs the PM and lists nothing', await until(() => E.page.evaluate(() => { const c = document.querySelector('#wlFirst'); return !!c && /Nothing needs you right now/.test(c.textContent) && !c.querySelector('ol'); })));
|
|
145
|
+
await E.ctx.close();
|
|
146
|
+
const N = await open({ url: '/premium.html?ws=w1' });
|
|
147
|
+
ok('R7 without first= the Briefing has no first card', await until(() => N.page.evaluate(() => document.querySelectorAll('#rank .rr').length > 0)) && await N.page.evaluate(() => !document.querySelector('#wlFirst')));
|
|
148
|
+
await N.ctx.close();
|
|
149
|
+
|
|
150
|
+
/* R8 not now, R9 already imported */
|
|
151
|
+
const Q = await open();
|
|
152
|
+
await heading(Q.page, /Welcome to PMOS/); await click(Q.page, '#wlSkip');
|
|
153
|
+
ok('R8 Not now dismisses the first run for this folder and lands on the premium Briefing, and writes nothing else', await until(() => Q.page.url().includes('/premium.html?ws=w1')) && Q.S.dismissed === 1 && Q.S.posts.every((p) => p[0] === 'dismiss'));
|
|
154
|
+
await Q.ctx.close();
|
|
155
|
+
const R = await open({ status: { ok: true, state: 'imported', first_run: false, imports: [{ import_id: 'old', retracted: true }, { import_id: 'imp7' }] } });
|
|
156
|
+
ok('R9 a folder with a live import goes to that import\'s card', await until(() => R.page.url().includes('/premium.html?ws=w1&first=imp7'), 15000), R.page.url());
|
|
157
|
+
await R.ctx.close();
|
|
158
|
+
|
|
159
|
+
/* failures say why and change nothing */
|
|
160
|
+
const X = await open({ applyError: 'the import stopped: a board is missing', toolError: { source: 'calendar', error: 'No calendar connection.' } });
|
|
161
|
+
await heading(X.page, /Welcome to PMOS/); await click(X.page, '[data-w=about]'); await heading(X.page, /Where does your work/);
|
|
162
|
+
await click(X.page, '[data-w=tool][data-k=calendar]'); await click(X.page, '[data-w=scan]'); await heading(X.page, /What PMOS found/);
|
|
163
|
+
ok('R3 a tool that cannot start does not stop the scan', X.S.posts.some((p) => p[0] === 'scan'));
|
|
164
|
+
await click(X.page, '[data-w=import]');
|
|
165
|
+
ok('R6 a refused import shows the server\'s reason, stays on the found step and keeps the choices', await until(() => X.page.evaluate(() => /a board is missing/.test((document.querySelector('.wl-err') || {}).textContent || ''))) && /What PMOS found/.test(await text(X.page, '#wlH')) && X.page.url().includes('premium-welcome') && await X.page.evaluate(() => document.querySelectorAll('.wl-ed.off').length === 1));
|
|
166
|
+
await click(X.page, '[data-w=inc][data-id=p1]'); await click(X.page, '[data-w=inc][data-id=g1]');
|
|
167
|
+
ok('R6 with nothing to import the button is off', await X.page.evaluate(() => document.querySelector('[data-w=import]').disabled && /Import 0 initiatives into 0 boards/.test(document.querySelector('[data-w=import]').textContent)));
|
|
168
|
+
await X.ctx.close();
|
|
169
|
+
|
|
170
|
+
/* R11 floors and fidelity */
|
|
171
|
+
let mk = null; let mp = { close: async () => {} };
|
|
172
|
+
const mkOf = async (w, th) => { if (mk) await mk.close(); mk = await browser.newContext({ viewport: { width: w, height: w === 390 ? 800 : 900 }, colorScheme: th }); return mk; };
|
|
173
|
+
const mockupHtml = fs.readFileSync(mockupFile, 'utf8');
|
|
174
|
+
const pick = (sel, props) => (s, p) => document.querySelector(s) && p.map((k) => getComputedStyle(document.querySelector(s))[k]).join('|');
|
|
175
|
+
const css = (page, sel, props) => page.evaluate(([s, p]) => { const e = document.querySelector(s); if (!e) return null; const k = getComputedStyle(e); return p.map((n) => k[n]).join('|'); }, [sel, props]);
|
|
176
|
+
const CMP = [
|
|
177
|
+
['the brand pill', '.wl-brand', ['fontWeight', 'fontSize', 'borderRadius', 'height', 'paddingLeft']],
|
|
178
|
+
['the heading', '#wlH', ['fontSize', 'fontWeight', 'letterSpacing', 'lineHeight', 'color']],
|
|
179
|
+
['the lede', '.wl-lede', ['fontSize', 'color', 'maxWidth']],
|
|
180
|
+
['a field label', '.wl-f label', ['fontSize', 'fontWeight', 'color']],
|
|
181
|
+
['a field', '.wl-f input', ['height', 'borderRadius', 'paddingLeft', 'fontSize', 'backgroundColor']],
|
|
182
|
+
['the text area', '.wl-f textarea', ['minHeight', 'borderRadius', 'lineHeight']],
|
|
183
|
+
['the main button', '.wl-foot .wl-btn', ['height', 'borderRadius', 'fontWeight', 'backgroundColor', 'color', 'paddingLeft']],
|
|
184
|
+
['the card', '.wl-card', ['borderRadius', 'paddingLeft', 'backgroundColor']],
|
|
185
|
+
['a step label', '.wl-steps li span', ['fontSize', 'fontWeight', 'letterSpacing', 'textTransform']],
|
|
186
|
+
];
|
|
187
|
+
for (const [w, th] of [[1280, 'light'], [1280, 'dark'], [390, 'light'], [390, 'dark']]) {
|
|
188
|
+
const A = await open({ w, h: w === 390 ? 800 : 900, theme: th, touch: w === 390 });
|
|
189
|
+
await heading(A.page, /Welcome to PMOS/);
|
|
190
|
+
await mp.close(); mp = await (await mkOf(w, th)).newPage(); await mp.goto('file://' + mockupFile); await mp.evaluate((t) => { document.documentElement.dataset.theme = t; }, th); await mp.waitForTimeout(500);
|
|
191
|
+
const diffs = [];
|
|
192
|
+
for (const [name, sel, props] of CMP) { const a = await css(A.page, sel, props), m = await css(mp, sel, props); if (a !== m) diffs.push(`${name}: ${a} vs ${m}`); }
|
|
193
|
+
ok(`R11 fidelity at ${w} px (${th}): About you keeps the mockup's type, radii, colours and sizes`, diffs.length === 0, diffs.join(' ; '));
|
|
194
|
+
const scrolls = [];
|
|
195
|
+
const floor = async (label) => scrolls.push(await A.page.evaluate((l) => ({ l, scroll: document.documentElement.scrollWidth <= innerWidth + 1, btn: [...document.querySelectorAll('#wlCard button, #wlSkip')].filter((b) => b.offsetParent).map((b) => Math.round(b.getBoundingClientRect().height)) }), label));
|
|
196
|
+
await floor('about'); await click(A.page, '[data-w=about]'); await heading(A.page, /Where does your work/); await floor('sources');
|
|
197
|
+
await click(A.page, '[data-w=scan]'); await heading(A.page, /What PMOS found/); await floor('found');
|
|
198
|
+
const foot = await A.page.evaluate(() => { const f = document.querySelector('.wl-foot').getBoundingClientRect(); return [Math.round(f.bottom), innerHeight]; });
|
|
199
|
+
ok(`R11 at ${w} px (${th}) the three steps have no sideways scroll${w === 390 ? ' and every press is at least 44 px' : ''}`, scrolls.every((s) => s.scroll) && (w !== 390 || scrolls.every((s) => s.btn.length && s.btn.every((n) => n >= 43.5))), JSON.stringify(scrolls));
|
|
200
|
+
if (w === 390) ok('R11 at 390 px the footer buttons stay at the bottom of the screen on the found step', foot[0] >= foot[1] - 2 && foot[0] <= foot[1] + 2, foot.join('/'));
|
|
201
|
+
if (th === 'light' && w === 1280) {
|
|
202
|
+
await mp.goto('file://' + mockupFile + '#found'); await mp.reload(); await mp.waitForTimeout(500);
|
|
203
|
+
const FCMP = [['a row', '.wl-ed .wl-row', ['display', 'gap', 'paddingLeft']], ['a row button', '.wl-ed .wgo', ['height', 'borderRadius', 'fontSize', 'fontWeight']], ['a section label', '.wl-sec', ['fontSize', 'letterSpacing', 'textTransform', 'color']], ['the defaults box', '.wl-def', ['borderRadius', 'borderTopStyle', 'paddingLeft']]];
|
|
204
|
+
const d2 = [];
|
|
205
|
+
for (const [name, sel, props] of FCMP) { const a = await css(A.page, sel, props), m = await css(mp, sel, props); if (a !== m) d2.push(`${name}: ${a} vs ${m}`); }
|
|
206
|
+
ok('R11 fidelity: the found step\'s rows, buttons, labels and defaults box keep the mockup\'s styles', d2.length === 0, d2.join(' ; '));
|
|
207
|
+
}
|
|
208
|
+
await A.ctx.close();
|
|
209
|
+
}
|
|
210
|
+
if (mk) await mk.close();
|
|
211
|
+
try { fs.unlinkSync(mockupFile); } catch { /* gone */ }
|
|
212
|
+
finish();
|
|
213
|
+
})();
|
|
@@ -301,7 +301,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
301
301
|
const R = await open({ w: 390, h: 844, theme }), q2 = R.page;
|
|
302
302
|
const bar2 = await q2.evaluate(() => { const b = document.querySelector('#xFocus').getBoundingClientRect(); return { over: document.documentElement.scrollWidth > innerWidth + 1, w: Math.round(b.width), h: [...document.querySelectorAll('#xFocus button')].map((x) => Math.round(x.getBoundingClientRect().height)) }; });
|
|
303
303
|
ok(`W12 at 390 px (${theme}) the Focus bar fits and its buttons are 44 px`, !bar2.over && bar2.h.every((x) => x >= 44), JSON.stringify(bar2));
|
|
304
|
-
await openKey(q2, 'work:item-bbbbbbbbbbb2'); await q2.click('#
|
|
304
|
+
await openKey(q2, 'work:item-bbbbbbbbbbb2'); await q2.click('#dTabs [data-t="chat"]'); await sleep(900);
|
|
305
305
|
const g = {};
|
|
306
306
|
for (const k of ['edit', 'steps', 'defer']) {
|
|
307
307
|
await q2.click(`[data-p="xt"][data-k="${k}"]`); await sleep(150);
|
|
@@ -309,7 +309,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
309
309
|
}
|
|
310
310
|
ok(`W12 at 390 px (${theme}) the edit, steps and Not before panels have no sideways scroll and every control is 44 px`, ['edit', 'steps', 'defer'].every((k) => !g[k].over && g[k].small.length === 0), JSON.stringify(g));
|
|
311
311
|
await q2.keyboard.press('Escape'); await dlgOff(q2);
|
|
312
|
-
await R.page.locator('#plateBody .wrow[data-key="work:wbs:alpha:4.2"] .wrh').click(); await dlgOn(q2); await sleep(500); await q2.click('#
|
|
312
|
+
await R.page.locator('#plateBody .wrow[data-key="work:wbs:alpha:4.2"] .wrh').click(); await dlgOn(q2); await sleep(500); await q2.click('#dTabs [data-t="chat"]'); await sleep(900);
|
|
313
313
|
const ag = await q2.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1 || document.querySelector('#dlg').scrollWidth > document.querySelector('#dlg').clientWidth + 1, small: [...document.querySelectorAll('.agblk button')].filter((b) => b.getBoundingClientRect().height < 43.5).map((b) => b.textContent.trim()) }));
|
|
314
314
|
ok(`W12 at 390 px (${theme}) the agent block has no sideways scroll and its buttons are 44 px`, !ag.over && ag.small.length === 0, JSON.stringify(ag));
|
|
315
315
|
await R.ctx.close();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* pm/premium-first.js — the "Your first Briefing" card on the premium Briefing (initiative premium-welcome). It shows only when the page was opened with
|
|
2
|
+
* first=<import id>, which the premium Welcome sets after an import. It reads GET /api/onboarding/briefing, lists each item, the state of the tools the PM
|
|
3
|
+
* ticked (what Welcome recorded in this browser) and Undo this import (POST /api/onboarding/undo), which goes back to Welcome's found step.
|
|
4
|
+
* The card keeps the page's own rows untouched: it is inserted above the columns. Text from the scanned folder is untrusted and goes through esc(). */
|
|
5
|
+
import { pmGet, pmPost } from './http.js';
|
|
6
|
+
import { firstView, FIRST_KEY } from './premium-welcome-model.js';
|
|
7
|
+
|
|
8
|
+
const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
9
|
+
const SUN = '<svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>';
|
|
10
|
+
|
|
11
|
+
function toolState() {
|
|
12
|
+
try { return JSON.parse(sessionStorage.getItem(FIRST_KEY) || '{}'); } catch { return {}; }
|
|
13
|
+
}
|
|
14
|
+
export async function mountFirst() {
|
|
15
|
+
const q = new URLSearchParams(location.search), id = q.get('first'), ws = q.get('ws') || '';
|
|
16
|
+
const cols = document.querySelector('.cols2');
|
|
17
|
+
if (!id || !cols || document.getElementById('wlFirst')) return;
|
|
18
|
+
const r = await pmGet(`/api/onboarding/briefing?ws=${encodeURIComponent(ws)}`);
|
|
19
|
+
const v = firstView(r, toolState());
|
|
20
|
+
const sec = document.createElement('section');
|
|
21
|
+
sec.className = 'card wl-first'; sec.id = 'wlFirst'; sec.setAttribute('aria-labelledby', 'hWl');
|
|
22
|
+
const items = v.items.map((f, i) => `<li class="wl-row"><span class="wl-ic wl-n">${String(i + 1).padStart(2, '0')}</span><span><b>${esc(f.title)}</b>${f.why ? `<small>${esc(f.why)}</small>` : ''}<span class="path">${f.ini ? esc(f.ini) + ' · ' : ''}${esc(f.ref)}</span></span><span></span></li>`).join('');
|
|
23
|
+
const tools = v.tools.map((t) => `<li class="wl-row"><span class="wl-ic">${SUN}</span><span><b>${esc(t.name)}</b><small${t.started ? '' : ' class="wl-bad"'}>${t.started ? `${esc(t.name)} is being read in an agent session. Its items join your Briefing when it finishes.` : esc(t.error || 'It did not start.')}</small></span><span></span></li>`).join('');
|
|
24
|
+
sec.innerHTML = `<div class="ch"><span class="ic">${SUN}</span><h2 id="hWl">Your first Briefing</h2><small>From the scan</small></div>
|
|
25
|
+
<p class="note wl-first-note">${r && r.ok ? (v.calm ? 'Your portfolio is in. Nothing needs you right now.' : 'Your portfolio is in. These need you first.') : esc((r && r.error) || 'The scan\'s Briefing could not be read.')}</p>
|
|
26
|
+
${items ? `<ol class="wl-list">${items}</ol>` : ''}${tools ? `<p class="wl-sec">Your tools</p><ul class="wl-list">${tools}</ul>` : ''}
|
|
27
|
+
<div class="wl-actions"><button class="wl-btn alt" type="button" id="wlUndo">Undo this import</button></div><p class="note wl-first-err" id="wlUndoErr" role="alert" hidden></p>`;
|
|
28
|
+
cols.parentNode.insertBefore(sec, cols);
|
|
29
|
+
document.addEventListener('click', async (e) => {
|
|
30
|
+
const b = e.target.closest('#wlUndo'); if (!b || b.disabled) return;
|
|
31
|
+
b.disabled = true;
|
|
32
|
+
const u = await pmPost('/api/onboarding/undo', { ws, import_id: id });
|
|
33
|
+
if (!u || !u.ok) { b.disabled = false; const e = document.getElementById('wlUndoErr'); e.textContent = (u && u.error) || 'Undo did not work.'; e.hidden = false; return; }
|
|
34
|
+
location.assign('/premium-welcome.html?ws=' + encodeURIComponent(ws) + '&step=found');
|
|
35
|
+
});
|
|
36
|
+
}
|