create-pmos 0.415.0 → 0.416.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 +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/briefing-premium-adddoc-test.js +3 -3
- package/workspace/briefing-premium-board-test.js +72 -43
- package/workspace/briefing-premium-doc-edit-test.js +2 -2
- package/workspace/briefing-premium-initiative-test.js +19 -22
- package/workspace/briefing-premium-insights-test.js +28 -17
- package/workspace/changelog.json +12 -0
- package/workspace/core-docs-workflow-test.js +1 -1
- package/workspace/guide/workflows.md +2 -1
- package/workspace/ini-workflow-test.js +11 -11
- package/workspace/lib/board-premium.js +7 -2
- package/workspace/lib/board-trail.js +6 -1
- package/workspace/lib/engine/boards.js +8 -2
- package/workspace/lib/initiative-chat.js +4 -3
- package/workspace/lib/insights-premium.js +9 -1
- package/workspace/lib/pmos-verbs.js +1 -1
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-boards.js +32 -4
- package/workspace/lib/routes-live.js +53 -0
- package/workspace/lib/task-cli.js +88 -24
- package/workspace/lib/task-items.js +3 -1
- package/workspace/lib/workflow-cli.js +1 -1
- package/workspace/milestone-suggest-test.js +2 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +3 -3
- package/workspace/premium-chat-report-tab-test.js +13 -5
- package/workspace/premium-core-doc-issue-test.js +1 -1
- package/workspace/premium-report-read-test.js +66 -51
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-doc-test.js +3 -3
- package/workspace/premium-vw-item-test.js +4 -4
- package/workspace/premium-vw-jira-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +7 -5
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +68 -230
- package/workspace/public/pm/cozy-insights.css +15 -0
- package/workspace/public/pm/cozy-live-pill.css +48 -0
- package/workspace/public/pm/cozy-live-pill.js +141 -0
- package/workspace/public/pm/cozy-viewer.js +4 -3
- package/workspace/public/pm/cozy-vw-rp.css +48 -0
- package/workspace/public/pm/home-app.js +45 -8
- package/workspace/public/pm/home-chat.js +5 -2
- package/workspace/public/pm/home-ini.js +57 -22
- package/workspace/public/pm/home-task.js +16 -5
- package/workspace/public/pm/ini-view-model.js +277 -0
- package/workspace/public/pm/ini-view.css +122 -0
- package/workspace/public/pm/ini-view.js +180 -0
- package/workspace/public/pm/live-model.js +104 -0
- package/workspace/public/pm/ov-view.css +44 -0
- package/workspace/public/pm/premium-board.js +14 -15
- package/workspace/public/pm/premium-insights.js +61 -35
- package/workspace/public/pm/premium-report-read.js +74 -50
- package/workspace/public/pm/premium-report-tab.js +36 -15
- package/workspace/public/pm/premium-shell.js +1 -1
- package/workspace/public/pm/premium-vw-item-model.js +6 -3
- package/workspace/public/pm/premium-vw-item.js +25 -6
- package/workspace/public/pm/premium-vw-jira.js +17 -15
- package/workspace/public/pm/rp-parts.js +75 -12
- package/workspace/public/pm/task-card.css +24 -49
- package/workspace/public/pm/task-card.js +90 -64
- package/workspace/public/pm/tk-view.css +21 -0
- package/workspace/public/pm/tk-view.js +216 -0
- package/workspace/public/pm/wf-page.js +2 -0
- package/workspace/server.js +24 -1
- package/workspace/stage-card-test.js +49 -41
- package/workspace/task-card-test.js +83 -38
- package/workspace/test-files.json +3 -1
- package/workspace/test-lists/bd-ini-panel.json +3 -3
- package/workspace/tk-tasks-test.js +3 -3
- package/workspace/public/pm/bd-ini-model.js +0 -81
- package/workspace/public/pm/cozy-rec-pill.css +0 -12
- package/workspace/public/pm/cozy-rec-pill.js +0 -46
|
@@ -22,6 +22,16 @@ const F = require('./fixtures/insights-premium-facts.js');
|
|
|
22
22
|
|
|
23
23
|
const BASE = T.BASE;
|
|
24
24
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
25
|
+
/* SHOTS_1B=<dir>: the Viewer as it is now, light and dark, at 1440 and 390 wide (batch 6 item 1b's screenshots); the page is put back after. */
|
|
26
|
+
const four = async (p, name) => {
|
|
27
|
+
const dir = process.env.SHOTS_1B; if (!dir) return;
|
|
28
|
+
const vp = p.viewportSize();
|
|
29
|
+
for (const [w, h, tag] of [[1440, 900, 'desktop'], [390, 844, 'phone']]) for (const sch of ['light', 'dark']) {
|
|
30
|
+
await p.setViewportSize({ width: w, height: h }); await p.emulateMedia({ colorScheme: sch }); await new Promise((r) => setTimeout(r, 350));
|
|
31
|
+
await p.screenshot({ path: require('path').join(dir, `${name}-${tag}-${sch}.png`) });
|
|
32
|
+
}
|
|
33
|
+
await p.setViewportSize(vp); await p.emulateMedia({ colorScheme: null }); await new Promise((r) => setTimeout(r, 250));
|
|
34
|
+
};
|
|
25
35
|
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); } };
|
|
26
36
|
const results = [];
|
|
27
37
|
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
@@ -66,6 +76,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
|
|
|
66
76
|
};
|
|
67
77
|
/* the Viewer card (pm/cozy-viewer.js): its title, and the feature its "Waiting for design" card names */
|
|
68
78
|
const vw = (pg) => pg.evaluate(() => { const v = document.querySelector('#czViewer'); if (!v || v.hidden) return null; const ph = v.querySelector('[data-cz-placeholder]'); return { title: (v.querySelector('.cz-vw-title') || {}).textContent || '', wait: ph ? ph.dataset.czPlaceholder : null, text: v.querySelector('.cz-vw-body').textContent }; });
|
|
79
|
+
const vwMoreItem = async (pg, label) => { await pg.click('#czViewer [data-cz-vw="more"]'); await sleep(80); await pg.click(`.cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${label}"))`); await sleep(80); };
|
|
69
80
|
const vwClose = async (pg) => { await pg.evaluate(() => window.czViewer && window.czViewer.close()); await until(() => pg.evaluate(() => { const v = document.querySelector('#czViewer'); return !v || v.hidden; })); };
|
|
70
81
|
|
|
71
82
|
const A = await open();
|
|
@@ -166,33 +177,33 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
|
|
|
166
177
|
await q.route('**/api/premium-dashboards/save', (r) => { saved.push(JSON.parse(r.request().postData() || '{}')); r.fulfill({ contentType: 'application/json', body: '{"ok":true}' }); });
|
|
167
178
|
await q.click('#goalTbl [data-goal="krm-act"] .nm');
|
|
168
179
|
const v = await until(() => vw(q));
|
|
169
|
-
/* re-pointed (
|
|
170
|
-
*
|
|
180
|
+
/* re-pointed (batch 6 item 1b, canvas OvViewers "Goal"): the summary (on course or not, the source and how fresh, the words), the big
|
|
181
|
+
* number and its target over the chart (the target line, the milestones that move it), Moved by shown open, then the folds Readings and
|
|
182
|
+
* On dashboards. No primary: Add a reading and Edit chart are under ⋯. Readings opens on a press */
|
|
171
183
|
await q.click('#czViewer [data-czs-fold="read"]'); await sleep(80);
|
|
172
|
-
const d = await q.evaluate(() => ({ kind: (document.querySelector('#czViewer .cz-vw-kind') || {}).textContent, tabs: [...document.querySelectorAll('#czViewer .czs-row b')].map((t) => t.textContent).join(), more: !!document.querySelector('#czViewer [data-cz-vw="more"]'),
|
|
173
|
-
ok('G1 on All goals a goal press opens its detail: the
|
|
174
|
-
ok('G1 the chart
|
|
175
|
-
ok('G1 the newest three readings show with their source, then All 4 readings; Moved by counts the work', d.rows === 3 && d.all === 'All 4 readings' && d.moved === '2', JSON.stringify(d));
|
|
184
|
+
const d = await q.evaluate(() => ({ kind: (document.querySelector('#czViewer .cz-vw-kind') || {}).textContent, tabs: [...document.querySelectorAll('#czViewer .czs-row b')].map((t) => t.textContent).join(), more: !!document.querySelector('#czViewer [data-cz-vw="more"]'), line: (document.querySelector('#czViewer .czs-line > span:not(.czs-dot):not(.czs-r)') || {}).textContent, right: (document.querySelector('#czViewer .czs-line .czs-r') || {}).textContent, sumText: (document.querySelector('#czViewer .czs-p') || {}).textContent, big: (document.querySelector('#czViewer .ins-gnum') || {}).textContent, pri: (document.querySelector('#czViewer .czs-pri') || {}).textContent, tg: (document.querySelector('#czViewer .ins-gch .tgl') || {}).textContent, ship: (document.querySelector('#czViewer .ins-gch .shipl') || {}).textContent, ms: [...document.querySelectorAll('#czViewer .ins-gch .msl')].map((x) => x.textContent).join('|'), now: document.querySelectorAll('#czViewer .ins-gch .pt.now').length, rows: document.querySelectorAll('#czViewer .ins-rd3').length, all: (document.querySelector('#czViewer [data-gx="all"]') || {}).textContent, moved: (document.querySelector('#czViewer .ins-mvh span') || {}).textContent, mv: [...document.querySelectorAll('#czViewer .ins-mvr')].map((a) => a.textContent.replace(/\s+/g, ' ').trim()), sw: [...document.querySelectorAll('#czViewer [data-gx="dash"]')].map((b) => b.getAttribute('aria-label') + ':' + b.getAttribute('aria-checked')).join(), dlg: !!document.querySelector('#dlg') }));
|
|
185
|
+
ok('G1 on All goals a goal press opens its detail: the state line with where the reading comes from and how fresh, the words, the folds Readings and On dashboards, and ⋯; no primary; no "Waiting for design" (OvViewers "Goal")', v && v.title === 'KR 1.1 · Partner activation' && !v.wait && d.kind === 'Goal' && d.tabs === 'Readings,On dashboards' && d.more && d.line === 'Off course' && /^Insights · read /.test(d.right || '') && /^28% now, 50% by Dec 31\. Up 8 points since July\. ≈34% by Dec 31, 16 pts short at this pace\.$/.test(d.sumText || '') && !d.pri && !d.dlg, JSON.stringify([v, d]));
|
|
186
|
+
ok('G1 the big number and its target sit over the chart; the chart draws the target with its value, the ship date of the work that moves it and the latest reading', d.big === '28%target 50% by Dec 31' && d.tg === 'Target 50%' && d.ship === 'SSO for partners shipped' && d.now === 1 && d.ms === 'Evaluate, Oct 23|Deliver, Oct 10', JSON.stringify(d));
|
|
187
|
+
ok('G1 the newest three readings show with their source, then All 4 readings; Moved by is open and counts the work, each with its milestone or stage and plan date', d.rows === 3 && d.all === 'All 4 readings' && d.moved === '2' && d.mv.join('|') === 'SSO for partnersEvaluate, plan Oct 23|Self-serve onboarding v2Deliver, plan Oct 10', JSON.stringify(d));
|
|
188
|
+
await four(q, 'goal');
|
|
176
189
|
await q.click('#czViewer [data-czs-fold="dash"]'); await sleep(80);
|
|
177
190
|
const sw = await q.evaluate(() => [...document.querySelectorAll('#czViewer [data-gx="dash"]')].map((b) => b.getAttribute('aria-label') + ':' + b.getAttribute('aria-checked')).join());
|
|
178
191
|
ok('G1 On your dashboards has a switch for each saved dashboard, on where the goal is', sw === 'On Weekly partner review:true', sw);
|
|
179
192
|
await q.click('#czViewer [data-cz-vw="more"]'); await sleep(80);
|
|
180
193
|
const mi = await q.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.textContent.trim()).join('|'));
|
|
181
|
-
ok('G1 ⋯ holds Edit chart, then Copy link and Copy as text (xvMore order)', /^Edit chart\|Copy link\|Copy as text/.test(mi), mi);
|
|
194
|
+
ok('G1 ⋯ holds Add a reading and Edit chart, then Copy link and Copy as text (xvMore order)', /^Add a reading\|Edit chart\|Copy link\|Copy as text/.test(mi), mi);
|
|
182
195
|
await q.click('#czViewer .cz-vw-title'); await sleep(80); // a press outside the menu closes it
|
|
183
196
|
await q.click('#czViewer [data-gx="all"]'); ok('G1 All readings shows every reading', (await q.evaluate(() => document.querySelectorAll('#czViewer .ins-rd3').length)) === 4);
|
|
184
|
-
await q
|
|
197
|
+
await vwMoreItem(q, 'Add a reading'); await q.fill('#czViewer [data-rdf] [name="v"]', '31'); await q.click('#czViewer [data-rdf] button[type="submit"]'); await until(() => sent.length > 0, 4000);
|
|
185
198
|
ok('G1 Add a reading posts the date and the number to the KR metric reading route', sent.length === 1 && sent[0].rid === 'krm-act' && sent[0].value === 31 && sent[0].at === '2026-10-18' && sent[0].ws === 'w1', JSON.stringify(sent));
|
|
186
199
|
await until(() => q.evaluate(() => !!document.querySelector('#czViewer [data-gx="dash"]')), 4000);
|
|
187
200
|
await q.click('#czViewer [data-gx="dash"]'); await until(() => saved.length > 0, 4000);
|
|
188
201
|
ok('G1 the dashboard switch saves that dashboard without the goal', saved[0] && saved[0].id === 'pd-1' && saved[0].charts.join() === 'krm-ttfc,krm-gone' && saved[0].ws === 'w1', JSON.stringify(saved));
|
|
189
|
-
|
|
190
|
-
await sleep(100);
|
|
191
|
-
ok('G1 Moved by lists the initiatives on their lifecycle track', (await q.evaluate(() => document.querySelectorAll('#czViewer [data-czs-id="moved"] .ins-ini').length)) === 2);
|
|
202
|
+
ok('G1 Moved by lists the initiatives, each a link to it', (await q.evaluate(() => [...document.querySelectorAll('#czViewer .ins-mvb a.ins-mvr')].filter((a) => /premium-initiative\.html/.test(a.href)).length)) === 2);
|
|
192
203
|
await vwClose(q);
|
|
193
204
|
await q.click('#goalTbl [data-goal="krm-nps"] .nm'); await until(() => vw(q));
|
|
194
|
-
const e1 = await txt('#czViewer .ins-etr', q), p1 = await txt('#czViewer .
|
|
195
|
-
/* re-pointed (
|
|
205
|
+
const e1 = await txt('#czViewer .ins-etr', q), p1 = await txt('#czViewer .ins-etr [data-gx="add"]', q);
|
|
206
|
+
/* re-pointed (batch 6 item 1b): the goal Viewer has no primary, so the empty trend carries Add a reading, its next action */
|
|
196
207
|
ok('G1 a goal with one reading says a trend needs 2 readings and where the next comes from, with Add a reading (IsMenus)', /A trend needs 2 readings\./.test(e1) && p1 === 'Add a reading', e1 + ' | ' + p1);
|
|
197
208
|
await R.ctx.close();
|
|
198
209
|
}
|
|
@@ -379,7 +390,7 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
|
|
|
379
390
|
ok('L3 a dashboard card opens Goals on that view', (await txt('#viewName', q)) === 'Reliability' && (await q.evaluate(() => document.querySelector('#tabGoals').getAttribute('aria-selected'))) === 'true' && (await q.evaluate(() => [...document.querySelectorAll('#goalTbl [data-goal]')].map((r) => r.dataset.goal).join())) === 'krm-up,krm-churn');
|
|
380
391
|
await q.click('#tabLibrary'); await q.locator('#listRows [data-rpt]').first().click(); // a report file with no setup opens straight in the reader
|
|
381
392
|
ok('L4 a report opens in the page\'s reader, not the console (premium-report-read R1; re-pointed by premium-agreed-design: the reader is the report panel in the Viewer card)', await until(() => q.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) .vz-rp0')), 5000) && /premium-insights\.html/.test(q.url()), q.url());
|
|
382
|
-
ok('L4 a draft report has Issue in the reader, so nothing sends you to the console to issue it', await until(() => q.evaluate(() => !!document.querySelector('#czViewer .vz-rp0 .
|
|
393
|
+
ok('L4 a draft report has Issue it in the reader, so nothing sends you to the console to issue it', await until(() => q.evaluate(() => !!document.querySelector('#czViewer .vz-rp0 .rp-sum [data-r="issue"]')), 8000) && await q.evaluate(() => !document.querySelector('#czViewer a[href*="console.html"]')));
|
|
383
394
|
await R.ctx.close();
|
|
384
395
|
const lead = { 'planning/reports/biweekly/2026-10-14.md': 'Activation slipped to 28% this fortnight.' };
|
|
385
396
|
const R2 = await open({ model: mk({ leads: lead }) });
|
|
@@ -537,9 +548,9 @@ const BMR = { ok: true, state: 'ready', model: { tiles: [
|
|
|
537
548
|
{
|
|
538
549
|
const R = await open({ w: 390, h: 844 }), q = R.page;
|
|
539
550
|
await q.click('#goalCards [data-goal="krm-act"]'); await until(() => vw(q));
|
|
540
|
-
/* re-pointed (
|
|
541
|
-
const ph = await q.evaluate(() => { const v = document.querySelector('#czViewer').getBoundingClientRect(), b = document.querySelector('#czViewer .cz-vw-body'); return { w: Math.round(v.width), tabs: [...document.querySelectorAll('#czViewer .czs-row b')].map((t) => t.textContent).join(), first: b.firstElementChild.className,
|
|
542
|
-
ok('P1 on a phone the goal detail covers the screen: the summary
|
|
551
|
+
/* re-pointed (batch 6 item 1b, OvViewers phone): the same Viewer, full screen: the summary first, the big number and chart, Moved by, the folds */
|
|
552
|
+
const ph = await q.evaluate(() => { const v = document.querySelector('#czViewer').getBoundingClientRect(), b = document.querySelector('#czViewer .cz-vw-body'); return { w: Math.round(v.width), tabs: [...document.querySelectorAll('#czViewer .czs-row b')].map((t) => t.textContent).join(), first: b.firstElementChild.className, order: [...b.children].map((x) => x.className.split(' ')[0]).join(), over: document.documentElement.scrollWidth > innerWidth }; });
|
|
553
|
+
ok('P1 on a phone the goal detail covers the screen: the summary first, the big number and chart, Moved by, then Readings and On dashboards', ph.w === 390 && ph.tabs === 'Readings,On dashboards' && ph.first === 'czs-sum' && /^czs-sum,ins-gbig,ins-mvb,czs-secs/.test(ph.order) && !ph.over, JSON.stringify(ph));
|
|
543
554
|
await q.click('#czViewer [data-czs-fold="dash"]'); await sleep(80);
|
|
544
555
|
ok('P1 the On your dashboards row holds the switches', (await q.evaluate(() => document.querySelectorAll('#czViewer [data-czs-id="dash"] [data-gx="dash"]').length)) === 1);
|
|
545
556
|
await vwClose(q);
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.416.0",
|
|
4
|
+
"at": "2026-10-26T00:23:58.708Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1050,
|
|
9
|
+
"t": "Sixth testing feedback batch (items 1–5)",
|
|
10
|
+
"s": "Sixth testing feedback batch (items 1–5)"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
2
14
|
{
|
|
3
15
|
"v": "0.415.0",
|
|
4
16
|
"at": "2026-10-25T15:54:44.873Z",
|
|
@@ -102,7 +102,7 @@ const OLD = new Map([['initiative:' + ID + '|risks', { drafts: [], issued: { at:
|
|
|
102
102
|
await page.goto(BASE + '/premium.html?ini=' + ID + '&ws=w1&board=w1&theme=' + theme);
|
|
103
103
|
let up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-hi-v]')), 30000);
|
|
104
104
|
if (up) {
|
|
105
|
-
if (await page.$('#czViewer [data-hi-v="page"] [data-
|
|
105
|
+
if (await page.$('#czViewer [data-hi-v="page"] [data-iv-docs]')) await page.click('#czViewer [data-iv-docs]');
|
|
106
106
|
else { await page.click('#czViewer [data-cz-vw="more"]'); await until(() => page.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); await page.click('#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("Documents"))'); }
|
|
107
107
|
up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-hi-v="docs"] .czs-secs')), 15000);
|
|
108
108
|
}
|
|
@@ -68,8 +68,9 @@ An initiative's **workflow stage** is the stage on its stage card and on the Boa
|
|
|
68
68
|
|
|
69
69
|
An agent adds and closes tasks when you ask, so you do not have to find the task on the Board yourself. There is one kind of task: the tasks in the initiative's Tasks section. The older breakdown items (`pmos item`) and the To finish entries of the current stage are tasks too, and these commands list and close them.
|
|
70
70
|
|
|
71
|
-
- `pmos task add <initiative> "<title>"` adds a task. `--due` and `--start` set its days, `--owner` its owner and `--notes` its notes. The task is the same as one added with Add a task on the page, under the agent's name.
|
|
71
|
+
- `pmos task add <initiative> "<title>"` adds a task. `--stage` puts it under a stage, `--due` and `--start` set its days, `--owner` its owner and `--notes` its notes. The task is the same as one added with Add a task on the page, under the agent's name.
|
|
72
72
|
- `pmos task list <initiative>` lists the initiative's open tasks (To do and In progress) with their ids. `--all` adds the Done, Won't do and Archived tasks.
|
|
73
73
|
- `pmos task state <task> [<task> …] --to <state>` sets the state of one or more tasks: To do, In progress, Done, Won't do or Archived. `--why` adds the reason, and for Done it is the evidence you read. Each change writes the same line as the page's press, under the agent's name. Won't do on a breakdown item withdraws it, and it cannot come back.
|
|
74
|
+
- `pmos task set <task> [<task> …] --stage <stage>` puts one or more tasks under a stage of the initiative's workflow, by the stage's key or name. `--stage none` takes them out of every stage. The Tasks section groups the tasks by these stages. A task's stage is its place in the plan: it does not change the task's state, and it does not move the initiative. `set` also takes `--due`, `--start`, `--owner` and `--notes`; `--due none` and `--start none` clear a day.
|
|
74
75
|
|
|
75
76
|
When an initiative reaches a stage, each entry of that stage's To finish list becomes one task, once. Closing that task, on the stage card, in the Tasks section or with `pmos task state`, marks the entry done on the stage card.
|
|
@@ -86,7 +86,7 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
86
86
|
for (const p of ['ini-wf', 'wontdo', 'archive', 'ini-auto', 'move']) await page.route('**/api/boards/' + p, (r) => json(r, { ok: true, row: {} }));
|
|
87
87
|
if (!fresh) await page.addInitScript(() => { try { localStorage.setItem('pmos.wf.seen', JSON.stringify({ 'self-serve-v2|tender': 1 })); } catch { /* none */ } });
|
|
88
88
|
await page.goto(BASE + '/premium.html?ini=' + ID + '&ws=w1&board=w1&theme=' + theme);
|
|
89
|
-
const up = await until(() => page.evaluate(() => /Tender/.test((document.querySelector('#czViewer:not([hidden]) .cz-vw-kind') || {}).textContent || '') && !!document.querySelector('#czViewer [data-hi-v="page"] .
|
|
89
|
+
const up = await until(() => page.evaluate(() => /Tender/.test((document.querySelector('#czViewer:not([hidden]) .cz-vw-kind') || {}).textContent || '') && !!document.querySelector('#czViewer [data-hi-v="page"] .iv-meta [data-iv-wf]')), 30000);
|
|
90
90
|
return { ctx, page, errors, posts, up, S };
|
|
91
91
|
};
|
|
92
92
|
const V = '#czViewer:not([hidden])';
|
|
@@ -95,19 +95,19 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
95
95
|
const pickMore = async (p, label) => { await p.click('#czViewer [data-cz-vw="more"]'); await until(() => p.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); await p.click(`#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${label}"))`); };
|
|
96
96
|
|
|
97
97
|
const A = await open(), p = A.page;
|
|
98
|
-
ok('W1 the page opens on the initiative with the workflow
|
|
98
|
+
ok('W1 the page opens on the initiative with the workflow on its meta line', A.up, await txt(p, V + ' .cz-vw-kind'));
|
|
99
99
|
ok('W1 the kind line names the workflow and the anchor: "Tender · KR 1.1" (Kind becomes Workflow)', /^Tender · KR 1\.1$/.test(await txt(p, V + ' .cz-vw-kind')), await txt(p, V + ' .cz-vw-kind'));
|
|
100
|
-
ok('W1 the card names the stage of that workflow: Triage', (await txt(p, V + ' .
|
|
101
|
-
ok('W1 the ladder draws the ten stages of Tender, three of them milestones', await p.evaluate((v) => document.querySelectorAll(v + ' .
|
|
102
|
-
ok('W1 the next stage is Tender\'s own: the card\'s last
|
|
103
|
-
ok('W1 the icon names the workflow for a screen reader', await p.evaluate((v) => /Workflow: Tender/.test(document.querySelector(v + ' [data-
|
|
100
|
+
ok('W1 the card names the stage of that workflow: Triage', (await txt(p, V + ' .iv-sch > b')) === 'Triage', await txt(p, V + ' .iv-sch'));
|
|
101
|
+
ok('W1 the ladder draws the ten stages of Tender, three of them milestones', await p.evaluate((v) => document.querySelectorAll(v + ' .iv-lad i').length === 10 && document.querySelectorAll(v + ' .iv-lad i.ms').length === 3, V));
|
|
102
|
+
ok('W1 the next stage is Tender\'s own: the card\'s last line is Requirements', /^Requirements/.test(await txt(p, V + ' .iv-nx')), await txt(p, V + ' .iv-nx'));
|
|
103
|
+
ok('W1 the icon names the workflow for a screen reader', await p.evaluate((v) => /Workflow: Tender/.test(document.querySelector(v + ' [data-iv-wf]').getAttribute('aria-label')), V));
|
|
104
104
|
ok('W2 PMOS set it from the BRD: the toast says so, with Undo (WfTriage)', await until(() => p.evaluate(() => { const t = document.getElementById('hiToast'); return !!t && !t.hidden && /Set to Tender from the BRD/.test(t.textContent) && !!t.querySelector('[data-hi-undo]'); })));
|
|
105
105
|
await shot(p, 'triage-1440');
|
|
106
106
|
await p.click('#hiToast [data-hi-undo]');
|
|
107
107
|
ok('W2 Undo puts it back on the workflow it ran before', await until(() => A.posts.some((x) => x.path === '/api/boards/ini-wf' && x.body.wf === 'product-feature' && x.body.id === ID)), JSON.stringify(A.posts));
|
|
108
108
|
|
|
109
109
|
// W3 the Change picker
|
|
110
|
-
await p.click(V + ' [data-
|
|
110
|
+
await p.click(V + ' [data-iv-wf]');
|
|
111
111
|
const pick = await until(() => p.evaluate(() => { const el = document.querySelector('.hi-pop[role="listbox"]'); if (!el) return null; return { opts: [...el.querySelectorAll('[role="option"]')].map((o) => o.textContent.replace(/\s+/g, ' ').trim() + (o.getAttribute('aria-selected') === 'true' ? '*' : '')), text: el.textContent }; }));
|
|
112
112
|
ok('W3 the picker lists every workflow with its stage count, Tender picked', pick && JSON.stringify(pick.opts) === JSON.stringify(['Product feature8', 'Tender10*']), JSON.stringify(pick));
|
|
113
113
|
ok('W3 it offers New workflow…, shows Tender\'s stage chain and why PMOS picked it', pick && /New workflow…/.test(pick.text) && /Triage → Requirements → ◆\sRFP out/.test(pick.text) && /Why: “choose a vendor/.test(pick.text), pick && pick.text);
|
|
@@ -139,7 +139,7 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
139
139
|
await p.reload();
|
|
140
140
|
await until(() => p.evaluate((v) => !!document.querySelector(v + ' .hi-end'), V), 30000);
|
|
141
141
|
ok('W7 the page of a Won’t do says why, and offers Back to Triage', /Won't do · No budget: Moved to next year’s budget\./.test(await txt(p, V + ' .hi-end')), await txt(p, V + ' .hi-end'));
|
|
142
|
-
ok('W7 its stage does not move: the card
|
|
142
|
+
ok('W7 its stage does not move: the card has no next stage to move to', !(await p.evaluate((v) => !!document.querySelector(v + ' .iv-sc .iv-nx, ' + v + ' [data-iv-next]'), V)), await txt(p, V + ' .iv-sc'));
|
|
143
143
|
ok('W7 ⋯ has Back to Triage in place of Won’t do', await moreLabels(p).then((l) => l.includes('Back to Triage') && !l.includes('Won’t do')));
|
|
144
144
|
await shot(p, 'wontdo-page-1440');
|
|
145
145
|
await p.click(V + ' .hi-end [data-wf-back]');
|
|
@@ -149,10 +149,10 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
149
149
|
|
|
150
150
|
// W8 the phone, and dark
|
|
151
151
|
const P = await open({ w: 390, h: 844, fresh: false, B: board('requirements') });
|
|
152
|
-
ok('W8 the phone opens the page with the workflow at Requirements, the second of its ten bars', P.up && (await txt(P.page, V + ' .
|
|
152
|
+
ok('W8 the phone opens the page with the workflow at Requirements, the second of its ten bars', P.up && (await txt(P.page, V + ' .iv-sch > b')) === 'Requirements' && await P.page.evaluate((v) => { const b = [...document.querySelectorAll(v + ' .iv-lad i')]; return b.length === 10 && b[1].classList.contains('now'); }, V));
|
|
153
153
|
ok('W8 the toast shows once only: seen before, not again', !(await P.page.evaluate(() => { const t = document.getElementById('hiToast'); return !!t && !t.hidden; })));
|
|
154
154
|
await shot(P.page, 'page-390');
|
|
155
|
-
await P.page.click(V + ' [data-
|
|
155
|
+
await P.page.click(V + ' [data-iv-wf]');
|
|
156
156
|
await until(() => P.page.evaluate(() => !!document.querySelector('.hi-pop[role="listbox"]')));
|
|
157
157
|
await shot(P.page, 'picker-390');
|
|
158
158
|
await P.page.click('.hi-pop [data-wf-pick="product-feature"]');
|
|
@@ -166,7 +166,7 @@ const BRIEF = BRP.build(BRF.facts());
|
|
|
166
166
|
ok('W8 no page error on the phone', !P.errors.length, P.errors.join(' | '));
|
|
167
167
|
await P.ctx.close();
|
|
168
168
|
const D = await open({ theme: 'dark', fresh: false });
|
|
169
|
-
await D.page.click(V + ' [data-
|
|
169
|
+
await D.page.click(V + ' [data-iv-wf]');
|
|
170
170
|
await until(() => D.page.evaluate(() => !!document.querySelector('.hi-pop[role="listbox"]')));
|
|
171
171
|
await shot(D.page, 'picker-1440-dark');
|
|
172
172
|
ok('W8 dark: the picker draws, no page error', D.up && !D.errors.length, D.errors.join(' | '));
|
|
@@ -270,6 +270,8 @@ function rowOf(r, wf, today) {
|
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
const TASK_MAX = 400; // the tasks one initiative's view reads (a WBS of a few hundred lines)
|
|
274
|
+
|
|
273
275
|
function build(f) {
|
|
274
276
|
const now = f.now || Date.now();
|
|
275
277
|
const today = new Date(now); const todayIso = today.getFullYear() + '-' + pad(today.getMonth() + 1) + '-' + pad(today.getDate());
|
|
@@ -296,9 +298,12 @@ function build(f) {
|
|
|
296
298
|
for (const w of f.items || []) {
|
|
297
299
|
if (!w || w.src !== 'pmos' || w.kind === 'Epic' || !w.ini || !w.uid || w.status === 'Archived') continue;
|
|
298
300
|
if (!taskBy.has(w.ini)) taskBy.set(w.ini, []);
|
|
299
|
-
taskBy.get(w.ini).push({ uid: w.uid, title: clip(w.title || '', 160), status: w.status || 'To do', owner: w.owner || '', end: w.end || '', ...(w.from ? { from: { stage: w.from.stage, finish: w.from.finish } } : {})
|
|
301
|
+
taskBy.get(w.ini).push({ uid: w.uid, title: clip(w.title || '', 160), status: w.status || 'To do', owner: w.owner || '', end: w.end || '', ...(w.from ? { from: { stage: w.from.stage, finish: w.from.finish } } : {}),
|
|
302
|
+
// one view (feedback batch 6 item 1): its place in the breakdown, and a breakdown item's own stage and order
|
|
303
|
+
...(typeof w.section === 'string' ? { section: w.section } : {}), ...(w.itemStage ? { itemStage: w.itemStage } : {}), ...(Number.isFinite(w.order) ? { order: w.order } : {}), ...(w.store === 'item' ? { item: true } : {}) });
|
|
300
304
|
}
|
|
301
|
-
|
|
305
|
+
// every task, not the first 60: the Board's panel and Home count the same tasks (feedback batch 6 item 1: Board said 56 done, Home 61)
|
|
306
|
+
for (const r of rows.concat(stageRows, gone.cancelled, gone.archived)) if (!r.tasks) r.tasks = (taskBy.get(r.id) || []).slice(0, TASK_MAX);
|
|
302
307
|
for (const r of rows.concat(stageRows, gone.cancelled, gone.archived)) if (!r.track) {
|
|
303
308
|
r.track = trackOf(r, tkBy.get(r.id), todayIso, relOfIni.get(r.id)); r.theme = themeOf(r.anchor);
|
|
304
309
|
if (epicBy.has(r.id) && !r.epics.includes(epicBy.get(r.id))) r.epics.unshift(epicBy.get(r.id));
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* trail({ root, ids, rows, moves, now, io }) → { ok, at, usual, themes, items: { [id]: item } }
|
|
6
6
|
*
|
|
7
7
|
* Everything is DERIVED from what the repository already holds. Nothing here writes:
|
|
8
|
+
* · the stages it ran its board moves of the current workflow, oldest first ({ to, at }), for the one view's stage dates
|
|
8
9
|
* · days in the current stage the last board move into the stage (the board ledger), else the first appearance in git of
|
|
9
10
|
* the newest artifact on the initiative's ladder (record, PRD, rubric, evaluation)
|
|
10
11
|
* · "usually N days" per stage the median days past initiatives spent in that stage, from the same dates (record → PRD is
|
|
@@ -223,8 +224,12 @@ function trail({ root, ids, rows = [], moves = [], now = Date.now(), io } = {})
|
|
|
223
224
|
const tickets = {};
|
|
224
225
|
for (const t of tks) if (t.key && t.jira) tickets[t.key] = { subtasks: t.jira.subtasks || null, reason: t.jira.reason || null, flagged: !!t.jira.flagged };
|
|
225
226
|
|
|
227
|
+
// the moves of its current workflow, oldest first: the one view dates each stage it ran (feedback batch 6 item 1)
|
|
228
|
+
const mvAll = (byIni.get(id) || []).slice().sort((a, b) => String(a.at).localeCompare(String(b.at)));
|
|
229
|
+
let mvFrom = 0; if (wk) for (let i = 0; i < mvAll.length; i++) if (mvAll[i].via === 'ini-wf') mvFrom = i;
|
|
230
|
+
const ran = mvAll.slice(mvFrom).filter((m) => m.to && m.at).slice(-40).map((m) => ({ to: String(m.to), at: dayIso(Date.parse(m.at)) }));
|
|
226
231
|
items[id] = {
|
|
227
|
-
since: since ? dayIso(since) : null, sinceFrom, days: since ? Math.max(0, Math.floor((now - since) / DAY)) : null,
|
|
232
|
+
since: since ? dayIso(since) : null, sinceFrom, days: since ? Math.max(0, Math.floor((now - since) / DAY)) : null, moves: ran,
|
|
228
233
|
skipped, parts, next: parts ? (parts.find((p) => !p.done) || {}).name || null : null, you,
|
|
229
234
|
links: { prd: prdRel, prdVersion: prdRel && (typeof prdFm.version === 'string' || typeof prdFm.version === 'number') && String(prdFm.version).trim() ? String(prdFm.version).trim().slice(0, 12) : null,
|
|
230
235
|
rubric: rubRel, evaluation: evals[0] || null, epic: jv && jv.ok && jv.epic && jv.epic.key ? jv.epic.key : null },
|
|
@@ -38,6 +38,9 @@
|
|
|
38
38
|
* task { task, type: Task|Epic, initiative, title, epic, owner, state, start, due } a PMOS task (or PMOS epic) on the board
|
|
39
39
|
* task-update { task, state?, start?, due?, title?, owner?, notes?, initiative?, why } a status move, a reschedule, a rename or an edit in the Viewer
|
|
40
40
|
* ticket-note { ref, notes } the PM's own notes on a Jira ticket (Jira keeps its fields)
|
|
41
|
+
* task-section { task, section } a task's place in the breakdown (one view, feedback batch 6 item 1): the key
|
|
42
|
+
* of a stage of its initiative's workflow, '' for "Not in a stage". It is the task's place, never its state, and moving a task
|
|
43
|
+
* never moves the initiative. `task` is a Board task or a breakdown item; the last line wins.
|
|
41
44
|
* Nothing is deleted. A line that is not an object with a known kind is skipped.
|
|
42
45
|
*
|
|
43
46
|
* STAGE OF AN INITIATIVE on a team board: the last move recorded for it on that board (a workflow edit's `moved` and an
|
|
@@ -158,7 +161,7 @@ function foundOf(f) {
|
|
|
158
161
|
const sources = Array.isArray(f.sources) ? f.sources.filter((x) => x && typeof x.ref === 'string').slice(0, 8).map((x) => ({ label: String(x.label || ''), ref: x.ref })) : [];
|
|
159
162
|
return { why: typeof f.why === 'string' ? f.why : '', sources, match: typeof f.match === 'string' && f.match ? f.match : null, scan: typeof f.scan === 'string' ? f.scan : null, run: typeof f.run === 'string' ? f.run : null };
|
|
160
163
|
}
|
|
161
|
-
const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto']);
|
|
164
|
+
const KINDS = new Set(['board', 'workflow', 'move', 'assign', 'ask', 'ask-accept', 'ask-decline', 'ask-more', 'ini-workflow', 'task', 'task-update', 'task-remove', 'ticket-note', 'ini-epics', 'ini-archive', 'ini-notdup', 'ini-wf', 'ini-end', 'stage-judge', 'ini-auto', 'task-section']);
|
|
162
165
|
// A task's state is its only stage (Wawan, 2026-10-25): the same five every workflow ends in. An old 'In review' reads as In progress (taskState).
|
|
163
166
|
const TASK_STATES = Object.freeze(['To do', 'In progress', 'Done', "Won't do", 'Archived']);
|
|
164
167
|
const taskState = (s) => (s === 'In review' ? 'In progress' : TASK_STATES.includes(s) ? s : null);
|
|
@@ -187,6 +190,7 @@ function fold(events) {
|
|
|
187
190
|
const stages = new Map(); // key(board, id) → stage name (the last move)
|
|
188
191
|
const iniWorkflows = new Map(); // key(board, id) → { template, stages } (the initiative's own workflow)
|
|
189
192
|
const tasks = new Map(); // task id → { id, board, initiative, title, epic, owner, state, start, due, at, by, history }
|
|
193
|
+
const sections = new Map(); // task id → the stage key its breakdown section is ('' = Not in a stage); the last task-section line wins
|
|
190
194
|
const ticketNotes = new Map(); // key(board, Jira key) → the PM's notes on that ticket (the last ticket-note line wins)
|
|
191
195
|
const epics = new Map(); // initiative id → the Jira epic keys the PM linked to it (the last ini-epics line wins)
|
|
192
196
|
const archives = new Map(); // initiative id → { at, by, reason, into, moved } while archived (an `archived: false` line restores it)
|
|
@@ -268,6 +272,8 @@ function fold(events) {
|
|
|
268
272
|
if (typeof e.owner === 'string') t.owner = e.owner.trim() || null; // the Viewer's edits (canvas XetX1Rest); '' clears
|
|
269
273
|
if (typeof e.notes === 'string') t.notes = e.notes;
|
|
270
274
|
t.history.push({ at: e.at || null, by: e.by || null, state: e.state || null, start: e.start || null, due: e.due || null, why: e.why || '' });
|
|
275
|
+
} else if (e.kind === 'task-section' && typeof e.task === 'string' && e.task && typeof e.section === 'string') {
|
|
276
|
+
sections.set(e.task, e.section);
|
|
271
277
|
} else if (e.kind === 'ticket-note' && b && typeof e.ref === 'string' && typeof e.notes === 'string') {
|
|
272
278
|
if (e.notes) ticketNotes.set(key(b, e.ref), e.notes); else ticketNotes.delete(key(b, e.ref));
|
|
273
279
|
} else if (e.kind === 'task-remove' && typeof e.task === 'string' && tasks.has(e.task)) {
|
|
@@ -310,7 +316,7 @@ function fold(events) {
|
|
|
310
316
|
Object.assign(a, { state: 'declined', why: e.why || '', closedAt: e.at || null });
|
|
311
317
|
}
|
|
312
318
|
}
|
|
313
|
-
return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, ticketNotes, epics, archives, notDup, iniWf, ends, judged, autoOver, events: list };
|
|
319
|
+
return { boards, moves, assigns, asks, stages, iniWorkflows, tasks, sections, ticketNotes, epics, archives, notDup, iniWf, ends, judged, autoOver, events: list };
|
|
314
320
|
}
|
|
315
321
|
|
|
316
322
|
/** The stages an initiative runs on a board: its own workflow when one is recorded, else the board's. */
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* names an initiative's workflow, said the initiative was "not attached" to it, read the task stages of `pmos item` (lib/plan-tree.js) as
|
|
5
5
|
* the board's columns and moved 47 tasks. Two things are kept apart here, in the words the agent gets:
|
|
6
6
|
* the WORKFLOW stage is on the initiative (the stage card, the Board; `pmos workflow of|move|switch`, lib/workflow-cli.js);
|
|
7
|
-
* a task
|
|
7
|
+
* a task's state is To do, In progress, Done, Won't do or Archived (Wawan, 2026-10-25); its group in the Tasks section is a workflow stage
|
|
8
|
+
* (`pmos task set --stage`, feedback batch 6), never its state.
|
|
8
9
|
* The chat's opening states the initiative's workflow and current stage (lib/briefing-premium-agent.js openingFor); in a live session, a
|
|
9
10
|
* message about a stage, a workflow or a move reaches the session with this rule first, read fresh, as lib/program-chat.js does for programs.
|
|
10
11
|
*
|
|
@@ -39,8 +40,8 @@ function rule(info, id) {
|
|
|
39
40
|
out.push(
|
|
40
41
|
`The workflow stage is on the initiative: the stage card and the Board show it. \`pmos workflow of ${ini}\` reads it. When the PM asks to move the initiative, run \`pmos workflow move ${ini} --stage <key> --why "<reason>"\`. When the PM asks to change its workflow, run \`pmos workflow switch ${ini} --to <workflow id>\`. Both write what the page's press writes, under your name.`,
|
|
41
42
|
'There is one kind of task: the ones the PM sees in the initiative\'s Tasks section. The stage card\'s To finish entries and the older breakdown items are tasks too. '
|
|
42
|
-
+ 'A task
|
|
43
|
-
+ `do it yourself, never send the PM to the Board: \`pmos task add ${ini} "<title>" [--due YYYY-MM-DD]\` adds one, \`pmos task list ${ini}\` names them all
|
|
43
|
+
+ 'A task\'s state is To do, In progress, Done, Won\'t do or Archived. The Tasks section groups the tasks under the stages of this initiative\'s workflow: a task\'s group is its place in the breakdown, never its state. When the PM asks to add, close, group or change a task, '
|
|
44
|
+
+ `do it yourself, never send the PM to the Board: \`pmos task add ${ini} "<title>" [--stage <stage>] [--due YYYY-MM-DD]\` adds one, \`pmos task list ${ini}\` names them all, \`pmos task state <task> [<task> …] --to "<state>" --why "<what shows it>"\` sets their state and \`pmos task set <task> [<task> …] --stage <stage>|none\` groups them (it also takes --due, --start, --owner, --notes; none clears a date). Never use \`pmos item add\` for new work, and never change tasks to move the initiative.`,
|
|
44
45
|
);
|
|
45
46
|
return out;
|
|
46
47
|
}
|
|
@@ -288,7 +288,15 @@ function initOf(r) {
|
|
|
288
288
|
const i = lifeIndex(r.stage);
|
|
289
289
|
return { id: String(r.id), title: clip(r.title || r.id, 120), stage: r.stage || '', idx: i, stageLabel: i >= 0 ? LIFE_LABEL[i] : (r.stage || ''), status: r.status || '', lane: r.lane || '',
|
|
290
290
|
owner: r.owner || '', end: r.end ? shortDate(r.end) : '', endAt: r.end ? String(r.end).slice(0, 10) : null, anchor: r.anchor || '',
|
|
291
|
-
startAt: r.start ? String(r.start).slice(0, 10) : null, skipped: IG.skippedOf(r.warnings) };
|
|
291
|
+
startAt: r.start ? String(r.start).slice(0, 10) : null, skipped: IG.skippedOf(r.warnings), milestone: milestoneOf(r, i) };
|
|
292
|
+
}
|
|
293
|
+
/** The milestone an initiative works toward next, for the goal Viewer's "Moved by" (canvas OvViewers "Goal"): the first milestone stage of its
|
|
294
|
+
* own workflow that is not done or skipped (the board row's wfStages), else the lifecycle's next one (Deliver, then Evaluate). null when its
|
|
295
|
+
* milestones are all behind it. Its date is the initiative's planned finish, said as "plan Nov 4". */
|
|
296
|
+
function milestoneOf(r, i) {
|
|
297
|
+
const S = Array.isArray(r.wfStages) ? r.wfStages : null;
|
|
298
|
+
if (S && S.some((s) => s.milestone)) { const m = S.find((s) => s.milestone && s.status !== 'done' && s.status !== 'skipped'); return m ? { name: clip(m.name, 60) } : null; }
|
|
299
|
+
return i < 5 ? { name: LIFE_LABEL[5] } : i < 7 ? { name: LIFE_LABEL[7] } : null;
|
|
292
300
|
}
|
|
293
301
|
/** One goal per KR metric record, with or without a series. `today` is a day in ms (UTC midnight). */
|
|
294
302
|
function goalsOf(outcomes, charts, inits, today, meta) {
|
|
@@ -67,7 +67,7 @@ const VERBS = Object.freeze({
|
|
|
67
67
|
help: 'pmos workflow list|show|draft|show-draft|judge|of|move|switch … — the workflows of this repository, the New workflow draft, a reading of an Only-when stage, and an initiative\'s workflow stage (pmos workflow help)' }),
|
|
68
68
|
// Not a pm-os-absorb verb (run: null): feedback batch 4 (Wawan, 2026-10-25) added it through the same table.
|
|
69
69
|
task: Object.freeze({ module: 'task-cli.js', run: null, guide: 'workflows.md',
|
|
70
|
-
help: 'pmos task add|list|state … — an initiative\'s tasks: add one, list them, set their state when the PM asks (pmos task help)' }),
|
|
70
|
+
help: 'pmos task add|list|state|set … — an initiative\'s tasks: add one, list them, set their state or group them under a stage when the PM asks (pmos task help)' }),
|
|
71
71
|
// Not a pm-os-absorb verb (run: null): feedback batch 4 item 6 (Claude suggests program milestones) added it through the same table.
|
|
72
72
|
program: Object.freeze({ module: 'program-cli.js', run: null, guide: 'programs.md',
|
|
73
73
|
help: 'pmos program suggest — Claude\'s milestone suggestions for a program, filed by its review run (pmos program help)' }),
|
|
@@ -53,6 +53,7 @@ const MODULES = Object.freeze([
|
|
|
53
53
|
'routes-board-grill', // premium-uncovered-features (Board): a new initiative's Why, material and first questions (page press; file mode)
|
|
54
54
|
'routes-insights-premium', // briefing-premium-insights: the premium Insights page's model from the KR metric records and report files (read-only)
|
|
55
55
|
'routes-home-desk', // premium-agreed-design (Home): seen marks, queued messages, the weekly update's recipients and sends, stakeholders (page press; file mode)
|
|
56
|
+
'routes-live', // batch 6 item 2: the Live pill's sessions and the titles of their initiatives (read-only)
|
|
56
57
|
'routes-home-review', // premium-uncovered-features (Home): the weekly review's four steps and the untouched work looked at (page press; file mode)
|
|
57
58
|
'routes-initiative-premium', // briefing-premium-initiative: the premium initiative page's model from the Initiatives sheet's own routes (read-only)
|
|
58
59
|
'routes-initiative-layout', // premium-uncovered-features (Initiative): Moves on by itself, held stages, task groups and saved group sets (page press; file mode)
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
* POST /api/boards/tasks/reschedule { ws, board, task, days } → { ok, item }
|
|
30
30
|
* POST /api/boards/tasks/undo-add { ws, board, task } → { ok } takes back a task added in the last 2 minutes, still To do
|
|
31
31
|
* POST /api/boards/tasks/rename { ws, board, task, title } → { ok, from, item } only the title changes
|
|
32
|
-
* POST /api/boards/tasks/edit { ws, board, task, owner?, notes?, start?, due?, initiative? } → { ok, from, item } the Viewer's edits in place
|
|
32
|
+
* POST /api/boards/tasks/edit { ws, board, task, owner?, notes?, start?, due?, initiative?, section? } → { ok, from, item } the Viewer's edits in place
|
|
33
|
+
* (section: the task's place in the breakdown, a stage key of its initiative's workflow or '' — a task-section line)
|
|
33
34
|
* (canvas XetX1Rest); `from` holds the fields as they were, so Undo is the same call with `from`
|
|
34
35
|
* POST /api/boards/tickets/note { ws, board, ref, notes } → { ok, from, notes } the PM's notes on a Jira ticket
|
|
35
36
|
* POST /api/boards/archive { ws, board, id, archived, reason? } → { ok, row } archive (hidden everywhere, kept whole) or restore;
|
|
@@ -481,6 +482,9 @@ function itemsOf(w, fr, board, rows) {
|
|
|
481
482
|
for (const t of fr.folded.tasks.values()) if (t.board === board.id && ids.has(t.initiative)) out.push(B.taskItem(t));
|
|
482
483
|
out.push(...TI.rowsOf(w.root, ids, board.id)); // one kind of task: an initiative's breakdown items show as its tasks (lib/task-items.js)
|
|
483
484
|
for (const x of out) if (x.src === 'jira') x.notes = (fr.folded.ticketNotes && fr.folded.ticketNotes.get(board.id + '\u0000' + x.key)) || ''; // the PM's notes (canvas XetX1Jira)
|
|
485
|
+
// a task's place in the breakdown (one view): the PM's own choice, else the stage whose To finish entry made it
|
|
486
|
+
const SEC = fr.folded.sections || new Map();
|
|
487
|
+
for (const x of out) if (x.src === 'pmos' && x.kind !== 'Epic') { if (SEC.has(x.uid)) x.section = SEC.get(x.uid); else if (x.from && x.from.stage) x.section = x.from.stage; }
|
|
484
488
|
return B.rollupItems(out);
|
|
485
489
|
}
|
|
486
490
|
|
|
@@ -640,7 +644,8 @@ const READS = {
|
|
|
640
644
|
const live = r.rows.filter((x) => !x.archived); // an archived initiative leaves every list and timeline (c3-initiative-lifecycle)
|
|
641
645
|
seedRows(ctx, r.w, r.fr, r.board, live);
|
|
642
646
|
ctx.json(res, { ok: true, ws: r.w.id, board: r.board.id, build: r.board.build, jira: r.board.jira, jiraProjects: r.board.jiraProjects, items: itemsOf(r.w, r.fr, r.board, live),
|
|
643
|
-
initiatives: live.map((x) => ({ id: x.id, title: x.title, stage: x.stage, cat: x.cat, status: x.status, owner: x.owner, horizon: x.horizon, start: x.start, end: x.end, progress: x.progress, template: x.template, epics: x.epics
|
|
647
|
+
initiatives: live.map((x) => ({ id: x.id, title: x.title, stage: x.stage, cat: x.cat, status: x.status, owner: x.owner, horizon: x.horizon, start: x.start, end: x.end, progress: x.progress, template: x.template, epics: x.epics,
|
|
648
|
+
stages: (x.wfStages || []).map((st) => ({ key: st.key, name: st.name, milestone: !!st.milestone })) })) }); // the sections a task can sit in (the task Viewer's move icon)
|
|
644
649
|
},
|
|
645
650
|
'/api/boards/sprints': (ctx, res, url) => {
|
|
646
651
|
const r = boardRead(ctx, res, url);
|
|
@@ -1113,7 +1118,28 @@ const WRITES = {
|
|
|
1113
1118
|
if (!b0 || boardIdOf(b0, p.fr.boards, p.fr.folded, p.w) !== p.board.id) return fail(ctx, res, 404, `no initiative ${body.initiative} on this board`);
|
|
1114
1119
|
ev.initiative = body.initiative; from.initiative = t.initiative;
|
|
1115
1120
|
}
|
|
1116
|
-
|
|
1121
|
+
// the task's place in the breakdown (one view, feedback batch 6 item 1): a stage key of its initiative's workflow, or '' for Not in a
|
|
1122
|
+
// stage. It is a board-ledger line for both kinds of task, so a breakdown item and a Board task move the same way, and it never moves
|
|
1123
|
+
// the initiative's own stage
|
|
1124
|
+
let sec = null;
|
|
1125
|
+
if (body.section != null) {
|
|
1126
|
+
if (typeof body.section !== 'string' || body.section.length > 80) return fail(ctx, res, 400, "section is a stage key of the initiative's workflow, or '' for Not in a stage");
|
|
1127
|
+
const iniId = ev.initiative || t.initiative, base = needRows(ctx, res, p.w);
|
|
1128
|
+
if (!base) return;
|
|
1129
|
+
const b0 = base.find((r) => r.id === iniId);
|
|
1130
|
+
if (!b0) return fail(ctx, res, 404, `no initiative ${iniId} on this board`);
|
|
1131
|
+
const st = boardRow(p.board, b0, p.fr.folded).wfStages || [];
|
|
1132
|
+
if (body.section && !st.some((x) => x.key === body.section)) return fail(ctx, res, 400, `"${body.section}" is not a stage of this initiative's workflow: one of ${st.map((x) => x.key).join(', ')}, or ''`);
|
|
1133
|
+
const S0 = p.fr.folded.sections || new Map();
|
|
1134
|
+
sec = body.section; from.section = S0.has(t.id) ? S0.get(t.id) : (t.from && t.from.stage) || '';
|
|
1135
|
+
if (!p.file) return fail(ctx, res, 409, NO_STATE);
|
|
1136
|
+
}
|
|
1137
|
+
if (!Object.keys(ev).length && sec == null) return fail(ctx, res, 400, 'nothing to change: send owner, notes, start, due, initiative or section');
|
|
1138
|
+
if (sec != null) append(p.file, g.actor, { kind: 'task-section', board: p.board.id, task: t.id, section: sec, why: sec ? 'placed under ' + sec : 'placed under no stage' });
|
|
1139
|
+
if (!Object.keys(ev).length) {
|
|
1140
|
+
const items = itemsOf(p.w, { ...p.fr, folded: B.fold(readLedger(ctx, p.w)) }, p.board, (needRows(ctx, res, p.w) || []).filter((r) => r.id === t.initiative));
|
|
1141
|
+
return ctx.json(res, { ok: true, from, item: items.find((x) => x.uid === t.id) || null });
|
|
1142
|
+
}
|
|
1117
1143
|
if (t.item) return itemWrite(ctx, res, p, t, TI.editEvents(t, ev), g, { from });
|
|
1118
1144
|
if (!p.file) return fail(ctx, res, 409, NO_STATE);
|
|
1119
1145
|
append(p.file, g.actor, { kind: 'task-update', board: p.board.id, task: t.id, ...ev, why: 'edited ' + Object.keys(ev).join(', ') });
|
|
@@ -1285,6 +1311,8 @@ function switchWorkflow(ctx, body, g) { return writeAs(ctx, '/api/boards/ini-wf'
|
|
|
1285
1311
|
function taskState(ctx, body, g) { return writeAs(ctx, '/api/boards/tasks/state', body, g); }
|
|
1286
1312
|
/** A new Board task, by the same function as the page's Add a task (POST /api/boards/tasks/add; `pmos task add`). body: { ws, board, initiative, title, start?, due?, owner? }. */
|
|
1287
1313
|
function taskAdd(ctx, body, g) { return writeAs(ctx, '/api/boards/tasks/add', body, g); }
|
|
1314
|
+
/** A task's edit, by the same function as the Viewer's (POST /api/boards/tasks/edit; `pmos task set`). body: { ws, board, task, section?, start?, due?, owner?, notes? }. */
|
|
1315
|
+
function taskEdit(ctx, body, g) { return writeAs(ctx, '/api/boards/tasks/edit', body, g); }
|
|
1288
1316
|
|
|
1289
1317
|
/** The workflow one initiative runs and where it stands in it, as the Board's row has it (boardRow: wf, wfStage, wfStages, ended), with the
|
|
1290
1318
|
* board it is on. For `pmos workflow of|move|switch` and the initiative chat's opening (bug 2026-10-25: an agent that could not see the
|
|
@@ -1372,4 +1400,4 @@ function meetingBoards(ctx) {
|
|
|
1372
1400
|
return { list, detail };
|
|
1373
1401
|
}
|
|
1374
1402
|
|
|
1375
|
-
module.exports = { prefixes: ['/api/boards'], handle, move, switchWorkflow, taskState, taskAdd, initiativeWorkflow, seedInitiative, stageTasks, itemsOf, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, workflowRowOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
|
|
1403
|
+
module.exports = { prefixes: ['/api/boards'], handle, move, switchWorkflow, taskState, taskAdd, taskEdit, initiativeWorkflow, seedInitiative, stageTasks, itemsOf, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, workflowRowOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* routes-live.js — what the Live pill reads (batch 6 item 2, canvas XrrAGrill "Live pill · every scenario"; pm/cozy-live-pill.js).
|
|
3
|
+
*
|
|
4
|
+
* GET /api/live → { ok, sessions: [row], titles: { [initiative id]: title } }
|
|
5
|
+
* row = the /api/sessions fields the pill needs: id, ws, name, auto_name, name_by, agent, origin, automatic, shown, created,
|
|
6
|
+
* lastOutputAt, touched_at, exited_at, auto_ended, outcome { ok } | null, initiative, hx { title, turn } | null
|
|
7
|
+
* titles = the initiatives those sessions work on, by id, from each workspace's records (kept 60 s per workspace)
|
|
8
|
+
*
|
|
9
|
+
* Read-only. The pill shows on every page, so it reads this small answer every 10 s rather than the whole of /api/sessions; the
|
|
10
|
+
* times the PM touched a session are kept by server.js (touchSession: opened on Home, typed or answered). Nothing is written. */
|
|
11
|
+
|
|
12
|
+
const TITLES_MS = 60000;
|
|
13
|
+
const cache = new Map(); // workspace root → { at, titles }
|
|
14
|
+
|
|
15
|
+
function titlesOf(ctx, ws) {
|
|
16
|
+
const w = ctx.getWs ? ctx.getWs(ws) : null;
|
|
17
|
+
if (!w || !w.root || typeof ctx.initiativeIndex !== 'function') return {};
|
|
18
|
+
const c = cache.get(w.root);
|
|
19
|
+
if (c && Date.now() - c.at < TITLES_MS) return c.titles;
|
|
20
|
+
const titles = {};
|
|
21
|
+
try { for (const g of ctx.initiativeIndex(w.root).initiatives || []) if (g && g.id) titles[g.id] = g.title || g.id; } catch { /* a folder with no records names none */ }
|
|
22
|
+
cache.set(w.root, { at: Date.now(), titles });
|
|
23
|
+
return titles;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const iniOf = (s) => s.initiative || ((/^chat:(?:init|board):([^:]+)/.exec(String(s.origin || '')) || [])[1]) || null;
|
|
27
|
+
|
|
28
|
+
function rowOf(s) {
|
|
29
|
+
return {
|
|
30
|
+
id: s.id, ws: s.ws, name: s.name, auto_name: s.auto_name || null, name_by: s.name_by || null, agent: s.agent, origin: s.origin || null,
|
|
31
|
+
automatic: !!s.automatic, shown: s.shown, created: s.created || null, lastOutputAt: s.lastOutputAt || null,
|
|
32
|
+
touched_at: s.touched_at || null, exited_at: s.exited_at || null, auto_ended: !!s.auto_ended,
|
|
33
|
+
outcome: s.outcome ? { ok: s.outcome.ok !== false } : null, initiative: s.initiative || null,
|
|
34
|
+
hx: s.hx ? { title: s.hx.title || null, turn: s.hx.turn || null } : null,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function handle(req, res, url, ctx) {
|
|
39
|
+
if (url.pathname !== '/api/live') return false;
|
|
40
|
+
if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
|
|
41
|
+
let list = [];
|
|
42
|
+
try { list = ctx.sessionList ? ctx.sessionList() : []; } catch { list = []; }
|
|
43
|
+
const sessions = list.map(rowOf);
|
|
44
|
+
const titles = {};
|
|
45
|
+
for (const s of sessions) {
|
|
46
|
+
const id = iniOf(s); if (!id || titles[id]) continue;
|
|
47
|
+
const t = titlesOf(ctx, s.ws)[id]; if (t) titles[id] = t;
|
|
48
|
+
}
|
|
49
|
+
ctx.json(res, { ok: true, sessions, titles });
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = { prefixes: ['/api/live'], handle, rowOf };
|