create-pmos 0.412.0 → 0.413.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/pmos-log.sh +6 -3
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-programs-test.js +2 -2
- package/workspace/changelog.json +12 -0
- package/workspace/core-docs-workflow-test.js +144 -0
- package/workspace/guide/workflows.md +8 -1
- package/workspace/lib/board-premium.js +7 -2
- package/workspace/lib/briefing-premium-agent.js +16 -4
- package/workspace/lib/core-docs.js +79 -14
- package/workspace/lib/engine/boards.js +20 -12
- package/workspace/lib/initiative-chat.js +49 -0
- package/workspace/lib/initiative-premium.js +17 -7
- package/workspace/lib/item-cli.js +7 -2
- package/workspace/lib/plan-items.js +1 -1
- package/workspace/lib/pmos-verbs.js +1 -1
- package/workspace/lib/program-chat.js +1 -1
- package/workspace/lib/programs.js +21 -5
- package/workspace/lib/routes-boards.js +75 -13
- package/workspace/lib/routes-briefing-premium.js +17 -1
- package/workspace/lib/routes-core-docs.js +3 -1
- package/workspace/lib/routes-programs.js +12 -1
- package/workspace/lib/workflow-chat.js +1 -0
- package/workspace/lib/workflow-cli.js +91 -6
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-chat-line-test.js +9 -0
- package/workspace/premium-vw-item-test.js +3 -3
- package/workspace/premium-vw-jira-test.js +2 -1
- package/workspace/program-order-test.js +180 -0
- package/workspace/public/pm/bd-prog.js +3 -3
- package/workspace/public/pm/cozy-viewer.js +8 -3
- package/workspace/public/pm/goal-chat.js +1 -1
- package/workspace/public/pm/home-app.js +22 -8
- package/workspace/public/pm/home-chat.js +6 -1
- package/workspace/public/pm/home-ini-model.js +42 -29
- package/workspace/public/pm/home-ini.css +1 -0
- package/workspace/public/pm/home-ini.js +26 -34
- package/workspace/public/pm/home-list.js +2 -1
- package/workspace/public/pm/home-stage-card.js +3 -1
- package/workspace/public/pm/home-task.js +41 -65
- package/workspace/public/pm/home-today.js +7 -5
- package/workspace/public/pm/premium-board.js +12 -6
- package/workspace/public/pm/premium-initiative-head.js +21 -11
- package/workspace/public/pm/premium-viewer.js +1 -0
- package/workspace/public/pm/premium-vw-item-model.js +13 -7
- package/workspace/public/pm/premium-vw-item.js +49 -5
- package/workspace/public/pm/prog-order.css +47 -0
- package/workspace/public/pm/prog-order.js +188 -0
- package/workspace/public/pm/program-model.js +75 -0
- package/workspace/public/pm/task-card.css +108 -0
- package/workspace/public/pm/task-card.js +271 -0
- package/workspace/skills/workflow-setup.skill +14 -5
- package/workspace/stage-card-test.js +11 -0
- package/workspace/task-card-test.js +248 -0
- package/workspace/test-lists/core-documents-backend.json +15 -3
- package/workspace/test-lists/program-order.json +6 -0
- package/workspace/test-lists/task-card.json +6 -0
- package/workspace/test-lists/workflow-stage.json +5 -0
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* POST /api/programs/check { program, milestone, done } the PM marks a program check (a milestone that waits on no initiative) done or
|
|
12
12
|
* not; the line goes to the workspace the charter is in, whatever `ws` says
|
|
13
13
|
* POST /api/programs/archive { ws, program }
|
|
14
|
+
* POST /api/programs/order { program, order: [initiative id] } the PM's sequence of the program's initiatives (drag, or Claude's order
|
|
15
|
+
* from the dates applied); like a check line it goes to the charter's workspace.
|
|
16
|
+
* The answer holds `was`, the order before, so the page's Undo writes it back
|
|
14
17
|
*
|
|
15
18
|
* FILE MODE ONLY (D64/D66): <state>/programs.jsonl of the workspace named by `ws`, append-only. Every POST is a page press (pm-guard
|
|
16
19
|
* requirePagePress): an agent session may make, join or archive a program too (D98). Nothing here writes to Jira. */
|
|
@@ -54,7 +57,7 @@ module.exports = {
|
|
|
54
57
|
const g = guard.requirePagePress(req, b);
|
|
55
58
|
if (!g.ok) return bad(g.error, g.status);
|
|
56
59
|
// a check line belongs with the charter, so every workspace's reader applies it to the same milestones
|
|
57
|
-
const home = p === '/api/programs/check' && P.ID_RE.test(String(b.program || '')) ? (all(ctx).find((x) => x.id === b.program) || {}).home : null;
|
|
60
|
+
const home = (p === '/api/programs/check' || p === '/api/programs/order') && P.ID_RE.test(String(b.program || '')) ? (all(ctx).find((x) => x.id === b.program) || {}).home : null;
|
|
58
61
|
const w = ctx.getWs ? ctx.getWs(home || b.ws || null) : null;
|
|
59
62
|
if (!w) return bad('that workspace is not registered', 404);
|
|
60
63
|
const file = fileOf(ctx, w);
|
|
@@ -117,6 +120,14 @@ module.exports = {
|
|
|
117
120
|
ctx.json(res, { ok: true, program: known(pid) });
|
|
118
121
|
return true;
|
|
119
122
|
}
|
|
123
|
+
if (p === '/api/programs/order') {
|
|
124
|
+
const v = P.validOrder(b.order);
|
|
125
|
+
if (v.error) return bad(v.error);
|
|
126
|
+
const was = known(pid).order || [];
|
|
127
|
+
add({ kind: 'order', program: pid, order: v });
|
|
128
|
+
ctx.json(res, { ok: true, was, program: known(pid) });
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
120
131
|
if (p === '/api/programs/archive') {
|
|
121
132
|
add({ kind: 'archive', program: pid });
|
|
122
133
|
ctx.json(res, { ok: true });
|
|
@@ -15,6 +15,7 @@ const RULE = [
|
|
|
15
15
|
'The PM is in Settings › Workflows, describing a new workflow: the stages one kind of initiative goes through. Follow the workflow-setup skill (workspace/skills/workflow-setup.skill).',
|
|
16
16
|
'Draft it with `pmos workflow draft --file <json>`: the page shows the draft beside this chat at once. Draft again after each answer or change; the newest draft replaces the one before.',
|
|
17
17
|
'A workflow is ONE numbered list of stages. Triage is always the first stage, in To do. Each stage sits in To do, In progress or Done. Won\'t do and Archived are in every workflow: do not draft them as stages.',
|
|
18
|
+
'When the PM did not name Triage, say in one line that PMOS puts it first in every workflow: a new initiative waits there until PMOS reads its BRD and picks its workflow.',
|
|
18
19
|
'Write conditions in the PM\'s plain words ("Only when they touch customer data"), never as a rule or code.',
|
|
19
20
|
'In the chat, say in one line per choice why you drafted it so (quote the PM or the file they added), then ask at most one question when something is unclear.',
|
|
20
21
|
'You never save, copy or archive a workflow: the PM presses Create workflow. Never write a .jsonl file by hand.',
|
|
@@ -10,9 +10,19 @@
|
|
|
10
10
|
* pmos workflow judge --board <id> --id <initiative> --stage <key> --runs yes|no|unsure --why <reason> [--cite <where>]
|
|
11
11
|
* pmos workflow judge --board <id> --id <initiative> --stage <key> --undo
|
|
12
12
|
* records PMOS's reading of an Only-when stage (one stage-judge line in boards.jsonl): yes runs it, no skips it, unsure asks the PM.
|
|
13
|
+
* pmos workflow of <initiative> the workflow the initiative runs, its current stage, and every stage numbered (done, current, skipped)
|
|
14
|
+
* pmos workflow move <initiative> --stage <key|name> [--why <text>]
|
|
15
|
+
* pmos workflow switch <initiative> --to <workflow id> [--stage <key|name>] [--why <text>]
|
|
16
|
+
* move the initiative along its workflow, or put it on another workflow, as the PM asked (bug 2026-10-25). These run the Board's own
|
|
17
|
+
* write routes (lib/routes-boards.js move, switchWorkflow) outside HTTP, so the checks, the warnings and the boards.jsonl line are the
|
|
18
|
+
* page press's, with the agent as the writer. `of` reads the same row the Board reads (routes-boards initiativeWorkflow).
|
|
13
19
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
20
|
+
* THE WORKFLOW STAGE IS THE INITIATIVE'S. A task has no workflow stage: its only stage is its state (To do, In progress, Done, Won't do,
|
|
21
|
+
* Archived; Wawan, 2026-10-25). Moving an initiative never touches its tasks.
|
|
22
|
+
*
|
|
23
|
+
* WHO WRITES. These write through lib/workflows-store.js and lib/routes-boards.js, never over HTTP. An agent may draft, judge, and move or
|
|
24
|
+
* switch an initiative when the PM asks; it never saves, copies or archives a workflow: Create, Copy and Archive are the PM's presses on the
|
|
25
|
+
* Workflows page. Who wrote a line is the call path (lib/actor.js), never an
|
|
16
26
|
* argument. Exit codes: 0 done, 1 refused, 2 usage. Nothing is sent. */
|
|
17
27
|
const fs = require('fs');
|
|
18
28
|
const path = require('path');
|
|
@@ -23,9 +33,9 @@ const WS = require('./workflows-store.js');
|
|
|
23
33
|
const { repoScript } = require('./repo-script.js');
|
|
24
34
|
const WF = require(repoScript('workflows.js'));
|
|
25
35
|
|
|
26
|
-
const COMMANDS = { workflow: ['list', 'show', 'draft', 'show-draft', 'judge'] };
|
|
36
|
+
const COMMANDS = { workflow: ['list', 'show', 'draft', 'show-draft', 'judge', 'of', 'move', 'switch'] };
|
|
27
37
|
const USAGE = [
|
|
28
|
-
'usage: pmos workflow list|show|draft|show-draft|judge — the workflows each kind of initiative goes through (D99)',
|
|
38
|
+
'usage: pmos workflow list|show|draft|show-draft|judge|of|move|switch — the workflows each kind of initiative goes through (D99)',
|
|
29
39
|
' pmos workflow list the workflows of this repository',
|
|
30
40
|
' pmos workflow show <id> one workflow, its stages numbered',
|
|
31
41
|
' pmos workflow draft --file <path|-> [--note <text>]',
|
|
@@ -34,10 +44,17 @@ const USAGE = [
|
|
|
34
44
|
' pmos workflow judge --board <id> --id <initiative> --stage <key> --runs yes|no|unsure --why <reason> [--cite <where>]',
|
|
35
45
|
' pmos workflow judge --board <id> --id <initiative> --stage <key> --undo',
|
|
36
46
|
' Record PMOS\'s reading of an Only-when stage: yes runs it, no skips it, unsure asks the PM. Give the reason and where you read it.',
|
|
47
|
+
' pmos workflow of <initiative> the workflow it runs and its current stage, every stage numbered',
|
|
48
|
+
' pmos workflow move <initiative> --stage <key|name> [--why <text>]',
|
|
49
|
+
' Move the initiative to a stage of its own workflow, when the PM asks. The stage card and the Board show it at once.',
|
|
50
|
+
' pmos workflow switch <initiative> --to <workflow id> [--stage <key|name>] [--why <text>]',
|
|
51
|
+
' Put the initiative on another workflow, when the PM asks. Without --stage it lands where the Board\'s switch puts it.',
|
|
52
|
+
' These are the initiative\'s workflow stages. They are not task stages: a task\'s only stage is its state (To do, In progress,',
|
|
53
|
+
' Done, Won\'t do, Archived), and moving the initiative never changes a task.',
|
|
37
54
|
' every command: [--json] [--root <dir>]. Nothing is sent.',
|
|
38
55
|
];
|
|
39
56
|
const BOOL = new Set(['json', 'help', 'undo']);
|
|
40
|
-
const VALUE = new Set(['file', 'note', 'board', 'id', 'stage', 'runs', 'why', 'cite', 'root']);
|
|
57
|
+
const VALUE = new Set(['file', 'note', 'board', 'id', 'stage', 'runs', 'why', 'cite', 'root', 'to']);
|
|
41
58
|
const RUNS = { yes: true, no: false, unsure: null };
|
|
42
59
|
|
|
43
60
|
function parse(argv) {
|
|
@@ -81,7 +98,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
81
98
|
}
|
|
82
99
|
const fail = (error, code = 1) => { if (json) say(JSON.stringify({ ok: false, error })); else say(`✗ ${error}`); return code; };
|
|
83
100
|
const root = flags.root ? path.resolve(cwd, flags.root) : repoRoot(cwd);
|
|
84
|
-
const stateDir = driver.stateDirOf(root, { create:
|
|
101
|
+
const stateDir = driver.stateDirOf(root, { create: ['draft', 'judge', 'move', 'switch'].includes(verb) });
|
|
85
102
|
if (!stateDir) return fail('this repository has no PMOS state folder (pmos/state, state or .pmos)');
|
|
86
103
|
const e = env === undefined ? process.env : env;
|
|
87
104
|
const actor = actorLib.fromCli({ isTTY: isTTY === undefined ? !!(process.stdin.isTTY && process.stdout.isTTY) : isTTY, env: e });
|
|
@@ -123,6 +140,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
123
140
|
else say(`✓ drafted ${r.draft.name} with ${r.draft.stages.length} stages. The Workflows page shows it beside the chat; the PM presses Create workflow. Nothing was sent.`);
|
|
124
141
|
return 0;
|
|
125
142
|
}
|
|
143
|
+
if (verb === 'of' || verb === 'move' || verb === 'switch') return onInitiative(verb, { pos, flags, json, say, fail, root, stateDir, actor });
|
|
126
144
|
// judge
|
|
127
145
|
if (!flags.board || !flags.id || !flags.stage) { say('usage: pmos workflow judge --board <id> --id <initiative> --stage <key> --runs yes|no|unsure --why <reason> [--cite <where>]'); return 2; }
|
|
128
146
|
let r;
|
|
@@ -138,4 +156,71 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
138
156
|
return 0;
|
|
139
157
|
}
|
|
140
158
|
|
|
159
|
+
/* ── an initiative's own workflow: of, move, switch ── */
|
|
160
|
+
const MARK = { done: '✓', current: '▶', skipped: '–', next: ' ' };
|
|
161
|
+
/** The Board's routes outside HTTP: this repository as the one workspace, its state folder, and the PMOS checkout as the self board. */
|
|
162
|
+
function boardsCtx(root, stateDir) {
|
|
163
|
+
const w = { id: driver.wsIdOf(root), name: path.basename(root), root };
|
|
164
|
+
return { w, ctx: { getWs: () => w, workspaceList: () => [w], stateDirFor: () => stateDir, selfRoot: path.resolve(__dirname, '..', '..') } };
|
|
165
|
+
}
|
|
166
|
+
/** The initiative's row, reading the records now when nothing is cached (a CLI process starts with an empty cache). */
|
|
167
|
+
function rowOf(ctx, w, id) {
|
|
168
|
+
const boards = require('./routes-boards.js');
|
|
169
|
+
const rowsLib = require('./initiative-rows.js');
|
|
170
|
+
const was = rowsLib.setBackground(false);
|
|
171
|
+
try {
|
|
172
|
+
let r = boards.initiativeWorkflow(ctx, w, id);
|
|
173
|
+
if (r.pending) { rowsLib.deriveNow(w.root); r = boards.initiativeWorkflow(ctx, w, id); }
|
|
174
|
+
return r;
|
|
175
|
+
} finally { rowsLib.setBackground(was); }
|
|
176
|
+
}
|
|
177
|
+
function ofLines(r) {
|
|
178
|
+
const row = r.row, st = row.wfStage || {};
|
|
179
|
+
const out = [`${row.title} (${row.id}) runs ${row.wf.name} (${row.wf.id}) on the board ${r.board.name}.`];
|
|
180
|
+
out.push(row.ended ? `It ended: ${row.ended.as === 'wontdo' ? "Won't do" : 'Archived'}.` : `Stage ${st.n} of ${st.of}: ${st.name} [${st.key}]`);
|
|
181
|
+
(row.wfStages || []).forEach((s, i) => out.push(` ${MARK[s.status] || ' '} ${String(i + 1).padStart(2)}. ${s.milestone ? '◆ ' : ''}${s.name} [${s.key}]${s.status === 'current' ? ' · current' : s.status === 'skipped' ? ' · skipped' : ''}`));
|
|
182
|
+
out.push(`Move it: pmos workflow move ${row.id} --stage <key>. A task has no workflow stage; moving the initiative changes no task.`);
|
|
183
|
+
return out;
|
|
184
|
+
}
|
|
185
|
+
const ofJson = (r) => ({ initiative: { id: r.row.id, title: r.row.title }, board: { id: r.board.id, name: r.board.name }, wf: r.row.wf, stage: r.row.wfStage, stages: r.row.wfStages, ended: r.row.ended });
|
|
186
|
+
|
|
187
|
+
function onInitiative(verb, { pos, flags, json, say, fail, root, stateDir, actor }) {
|
|
188
|
+
const id = pos[0];
|
|
189
|
+
const usage = { of: 'pmos workflow of <initiative>', move: 'pmos workflow move <initiative> --stage <key|name> [--why <text>]', switch: 'pmos workflow switch <initiative> --to <workflow id> [--stage <key|name>] [--why <text>]' }[verb];
|
|
190
|
+
if (!id) { say('usage: ' + usage); return 2; }
|
|
191
|
+
if (verb === 'move' && !flags.stage) { say('usage: ' + usage); return 2; }
|
|
192
|
+
if (verb === 'switch' && !flags.to) { say('usage: ' + usage); return 2; }
|
|
193
|
+
for (const k of ['board', 'runs', 'cite', 'file', 'note', 'undo']) if (k in flags) return fail(`--${k} is not an option of ${verb}`, 2);
|
|
194
|
+
if (verb === 'of') for (const k of ['stage', 'to', 'why']) if (k in flags) return fail(`--${k} is not an option of of`, 2);
|
|
195
|
+
if (verb === 'move' && 'to' in flags) return fail('--to names a workflow: use pmos workflow switch. Move takes --stage', 2);
|
|
196
|
+
const { w, ctx } = boardsCtx(root, stateDir);
|
|
197
|
+
const before = rowOf(ctx, w, id);
|
|
198
|
+
if (!before.ok) return fail(before.error);
|
|
199
|
+
if (verb === 'of') {
|
|
200
|
+
if (json) { say(JSON.stringify({ ok: true, ...ofJson(before) })); return 0; }
|
|
201
|
+
for (const l of ofLines(before)) say(l);
|
|
202
|
+
return 0;
|
|
203
|
+
}
|
|
204
|
+
const boards = require('./routes-boards.js');
|
|
205
|
+
const g = { ok: true, actor };
|
|
206
|
+
const base = { ws: w.id, board: before.board.id, id, ...(flags.why ? { why: flags.why } : {}) };
|
|
207
|
+
let to = flags.stage;
|
|
208
|
+
let r;
|
|
209
|
+
if (verb === 'move') {
|
|
210
|
+
// Product feature: the Board's move names the stage; a key of Product feature reads as its name
|
|
211
|
+
if (!before.row.wf || before.row.wf.id === WF.PRODUCT_FEATURE_ID) { const t = WF.stageByRef(WF.PRODUCT_FEATURE, to); if (t) to = t.name; }
|
|
212
|
+
r = boards.move(ctx, { ...base, to }, g);
|
|
213
|
+
} else r = boards.switchWorkflow(ctx, { ...base, wf: flags.to, ...(to ? { to } : {}) }, g);
|
|
214
|
+
if (!r.body || r.body.ok !== true) return fail((r.body && r.body.error) || 'the write was refused');
|
|
215
|
+
const after = rowOf(ctx, w, id);
|
|
216
|
+
const warnings = r.body.warnings || [];
|
|
217
|
+
if (json) { say(JSON.stringify({ ok: true, ...(after.ok ? ofJson(after) : {}), warnings })); return 0; }
|
|
218
|
+
const row = after.ok ? after.row : before.row;
|
|
219
|
+
say(verb === 'move' ? `✓ moved ${row.title} to ${row.wfStage.name}, stage ${row.wfStage.n} of ${row.wfStage.of} of ${row.wf.name}.`
|
|
220
|
+
: `✓ ${row.title} now runs ${row.wf.name}, in ${row.wfStage.name} (stage ${row.wfStage.n} of ${row.wfStage.of}).`);
|
|
221
|
+
for (const x of warnings) say(' ' + x);
|
|
222
|
+
say(' The stage card and the Board show it. No task was moved. Nothing was sent.');
|
|
223
|
+
return 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
141
226
|
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.413.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.413.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* P3 (390) a session with no step list: "Working · m:ss", no count; a session with its own steps: its step and "1 of 3 done"
|
|
10
10
|
* P4 (390) Claude asks: the line is blue, "Claude asks before it goes on"; a tap scrolls to the ask, not to the Viewer
|
|
11
11
|
* P5/P6 a finished goal: no line; "Goal done" over Claude's result, or the amber "Goal stopped: …" and the box says how to go on
|
|
12
|
+
* P5b a goal that finished before every shown message: its divider leads the log, never trails the newest message
|
|
12
13
|
* P7 (390) a meeting records: the pill is in the chat's top bar, which shows ← and the title only
|
|
13
14
|
* P8 (390) Home: a running row's ring fills as its steps are met, no number; a running row with no steps has the plain ring
|
|
14
15
|
* P9 (1280) the line sits over the chat column; a tap opens the steps in the Viewer and the line is tinted while it shows them
|
|
@@ -156,6 +157,14 @@ const look = () => {
|
|
|
156
157
|
ok('F1 (finished) no page error', !errs.length, errs.join(' | '));
|
|
157
158
|
await ctx.close(); }
|
|
158
159
|
|
|
160
|
+
/* P5b: a goal that finished before every message shown: the divider leads the log, it never trails the newest message */
|
|
161
|
+
{ const st = { goal: goal('done', { met: DRAFT.done, at: ago(90) }), conv: { turn: 'pm', messages: BASE.concat([{ role: 'assistant', text: 'Later work, after the goal.', at: ago(0.5) }]) } };
|
|
162
|
+
const { p, ctx, errs } = await open(1280, st);
|
|
163
|
+
const s0 = await until(async () => { const v = await p.evaluate(() => { const d = document.querySelector('#hmLog .pl-dv'); const kids = [...document.querySelectorAll('#hmLog > *')]; return d ? { first: kids.indexOf(d) <= 1, last: kids[kids.length - 1] === d } : null; }); return v; }) || {};
|
|
164
|
+
ok('P5b a goal done before the shown messages: "Goal done" leads the log, not after the newest message', s0.first && !s0.last, JSON.stringify(s0));
|
|
165
|
+
ok('F1 (old goal) no page error', !errs.length, errs.join(' | '));
|
|
166
|
+
await ctx.close(); }
|
|
167
|
+
|
|
159
168
|
/* P9: a desktop */
|
|
160
169
|
{ const st = { goal: goal('started'), conv: { turn: 'tool', messages: BASE } };
|
|
161
170
|
const { p, ctx, errs } = await open(1280, st);
|
|
@@ -74,12 +74,12 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
74
74
|
await until(async () => /UAT with five partners/.test(await paneTxt(page, TK)));
|
|
75
75
|
s = await cur(page); t = await paneTxt(page, TK);
|
|
76
76
|
ok('R9 a task inside the record opens in its place, named by the task', s.on === TK && s.title === 'UAT with five partners', JSON.stringify(s));
|
|
77
|
-
ok('R9 the task
|
|
77
|
+
ok('R9 the task is the task editor: owner, start and due, and status (item 7: no Type, Reference or Source rows)', ['Dara', '20 → 27 Oct', 'To do'].every((x) => t.includes(x)) && !/PMOS task|Reference/.test(t), t);
|
|
78
78
|
ok('R9 the record and its task read the route once', S.vgets.length - n0 === 1, String(S.vgets.length - n0));
|
|
79
|
-
await page.click(`#czViewer .obody.vw[data-vw="${TK}"] [data-
|
|
79
|
+
await page.click(`#czViewer .obody.vw[data-vw="${TK}"] [data-tkc="ini"]`);
|
|
80
80
|
s = await cur(page);
|
|
81
81
|
ok('R9 the initiative link brings the record back, not a second one', await until(async () => (await cur(page)).on === INI) && (await cur(page)).n === 1, JSON.stringify(s));
|
|
82
|
-
ok('R9 the task press in the Overview opens the same task view', await overview(page) && await page.click('#czViewer [data-ov-tk="task:t1"]').then(() => until(async () => (await cur(page)).on === TK && /
|
|
82
|
+
ok('R9 the task press in the Overview opens the same task view', await overview(page) && await page.click('#czViewer [data-ov-tk="task:t1"]').then(() => until(async () => (await cur(page)).on === TK && /20 → 27 Oct/.test(await paneTxt(page, TK)))), JSON.stringify(await cur(page)));
|
|
83
83
|
ok('R9 the old dialog never opens', await page.evaluate(() => { const d = document.querySelector('#dlg'); return !d || !d.classList.contains('on'); }));
|
|
84
84
|
ok('R9 no page error', S.errors.length === 0, S.errors.join(' | '));
|
|
85
85
|
await ctx.close();
|
|
@@ -179,7 +179,8 @@ const TICKETS = {
|
|
|
179
179
|
{
|
|
180
180
|
const I = await open();
|
|
181
181
|
await I.page.click('#czViewer [data-ov-tk="task:ONB-12"]');
|
|
182
|
-
|
|
182
|
+
// item 7 (feedback batch 3): a Jira task opens the one task card, with Jira's values read-only, not the bare ticket view
|
|
183
|
+
ok('I2 a Jira task in the Overview opens its task card in the Viewer', !!(await until(async () => /^item:task:self-serve-v2:task:ONB-12$/.test(String(await curId(I.page))))), JSON.stringify(await curId(I.page)));
|
|
183
184
|
await I.page.goto(BASE + '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1');
|
|
184
185
|
ok('I1 the initiative loads the Jira view module without a page error', !!(await until(() => I.page.evaluate(() => !!window.__premiumVwJira))) && I.errors.length === 0, I.errors.join(' | '));
|
|
185
186
|
await I.ctx.close();
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* program-order-test.js — the order of a program's initiatives on the Board and on Home (feedback batch 3 item 5, option A agreed 2026-10-25;
|
|
4
|
+
* canvas RoADrag, RoASuggest, RoAApplied, RoAPhone). Serves the real pages from the real server; GET /api/programs answers Project Ascent
|
|
5
|
+
* (fixtures/program-ascent.js) and POST /api/programs/order is answered here, from the order the page sent, so a reload reads it back.
|
|
6
|
+
* B Board: the program's rows follow its order; ✦ shows (with its dot) only while the dates disagree; the suggestion lists the date order with a
|
|
7
|
+
* reason per row; ✓ applies it, Undo puts the order back; ✕ is "not now" until a date changes; drag by the grip; Alt + ↓ moves a row
|
|
8
|
+
* H Home: the program group lists the same order; the grip moves a row there too; a phone holds the row, then drags it */
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { spawn } = require('child_process');
|
|
11
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
12
|
+
const T = require('./test-run').configure({ name: 'program-order' });
|
|
13
|
+
const BP = require('./lib/board-premium.js');
|
|
14
|
+
const F = require('./fixtures/board-premium-facts.js');
|
|
15
|
+
const B = require('./lib/briefing-premium.js');
|
|
16
|
+
const HF = require('./fixtures/briefing-premium-facts.js');
|
|
17
|
+
const A = require('./fixtures/program-ascent.js');
|
|
18
|
+
|
|
19
|
+
const BASE = T.BASE;
|
|
20
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
21
|
+
const until = async (fn, ms = 8000, step = 100) => { const t0 = Date.now(); for (;;) { let v; try { v = await fn(); } catch { v = null; } if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
22
|
+
const results = [];
|
|
23
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 600) : ''}`); };
|
|
24
|
+
let srv = null; let browser = null;
|
|
25
|
+
const finish = async (code) => {
|
|
26
|
+
if (browser) await browser.close().catch(() => {});
|
|
27
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
28
|
+
T.killTmux();
|
|
29
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
30
|
+
console.log(`\n${results.length - bad}/${results.length} program-order assertions passed`);
|
|
31
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
32
|
+
};
|
|
33
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
34
|
+
|
|
35
|
+
/** The program as GET /api/programs answers it, with the order the last POST saved. */
|
|
36
|
+
let ORDER = [];
|
|
37
|
+
const programs = () => A.programs().map((p) => ({ ...p, order: ORDER.slice() }));
|
|
38
|
+
const posts = [];
|
|
39
|
+
const routePrograms = async (page) => {
|
|
40
|
+
await page.route('**/api/programs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, programs: programs() }) }));
|
|
41
|
+
await page.route('**/api/programs/order', (r) => {
|
|
42
|
+
const b = JSON.parse(r.request().postData() || '{}'); posts.push(b);
|
|
43
|
+
const was = ORDER.slice(); ORDER = b.order.slice();
|
|
44
|
+
r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, was, program: programs().find((p) => p.id === b.program) }) });
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
(async () => {
|
|
49
|
+
const exe = findBrowser();
|
|
50
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
51
|
+
let chromium;
|
|
52
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
53
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
54
|
+
await T.waitForServer(BASE);
|
|
55
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
56
|
+
|
|
57
|
+
const board = async (o = {}) => {
|
|
58
|
+
const ctx = await browser.newContext({ viewport: { width: o.w || 1440, height: o.h || 900 }, hasTouch: !!o.touch });
|
|
59
|
+
const page = await ctx.newPage();
|
|
60
|
+
const errors = [];
|
|
61
|
+
page.on('pageerror', (e) => errors.push(String((e && e.stack) || e)));
|
|
62
|
+
await page.clock.setFixedTime(new Date(F.NOW));
|
|
63
|
+
await page.route('**/api/board-premium*', (r) => { const q = new URL(r.request().url()).searchParams; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: BP.build(F.programFacts(q.get('ws') || 'idpf')), as_of: Date.now() }) }); });
|
|
64
|
+
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'not in this check' }) }));
|
|
65
|
+
await routePrograms(page);
|
|
66
|
+
await page.addInitScript(() => { try { if (!sessionStorage.getItem('set')) { sessionStorage.setItem('set', '1'); localStorage.setItem('pmos.board.view', 'track'); localStorage.setItem('pmos.board.grouping', 'program'); } } catch { /* none */ } });
|
|
67
|
+
await page.goto(BASE + '/premium-board.html?ws=idpf&board=idpf');
|
|
68
|
+
await page.waitForSelector('#ibBody [data-key]', { timeout: 15000 });
|
|
69
|
+
await page.waitForTimeout(700);
|
|
70
|
+
return { ctx, page, errors };
|
|
71
|
+
};
|
|
72
|
+
const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list] [data-po-id]')].map((r) => r.dataset.poId));
|
|
73
|
+
const sug = (p) => p.evaluate(() => { const b = document.querySelector('#ibBody .bt-pg [data-po-sug]'); return b ? { dot: !!b.querySelector('.po-nd'), label: b.getAttribute('aria-label') } : null; });
|
|
74
|
+
|
|
75
|
+
/* B — the Board's stage track */
|
|
76
|
+
{
|
|
77
|
+
ORDER = ['legacy-idp-sunset', 'descope-parity']; // the PM's order, against the dates (Descope starts Oct 5, Legacy Oct 11)
|
|
78
|
+
const { ctx, page: p, errors } = await board();
|
|
79
|
+
ok('B the program\'s rows follow its order, each with a grip', (await kids(p)).join() === 'legacy-idp-sunset,descope-parity' && (await p.locator('#ibBody [data-po-id] [data-po-grip]').count()) === 2, JSON.stringify(await kids(p)));
|
|
80
|
+
const s = await sug(p);
|
|
81
|
+
ok('B ✦ shows in the program header while the dates disagree, with the blue dot', !!s && s.dot, JSON.stringify(s));
|
|
82
|
+
await p.click('#ibBody .bt-pg [data-po-sug]');
|
|
83
|
+
const pop = await until(() => p.evaluate(() => { const d = document.querySelector('.po-pop'); return d ? { why: d.querySelector('.po-why').textContent, rows: [...d.querySelectorAll('.po-so')].map((r) => ({ t: r.querySelector('b').textContent, r: r.querySelector('.r').textContent, mv: r.classList.contains('mv') })), focus: document.activeElement && document.activeElement.getAttribute('aria-label') } : null; }));
|
|
84
|
+
ok('B the suggestion lists the date order with a reason per row, the moved rows marked; ✓ has the focus', !!pop && pop.rows[0].t === 'Descope feature parity' && /Starts first, on Oct 5/.test(pop.rows[0].r) && pop.rows[0].mv && /Today the order is yours/.test(pop.why) && pop.focus === 'Use this order', JSON.stringify(pop));
|
|
85
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/board-suggest.png' });
|
|
86
|
+
await p.click('.po-pop [data-po-use]');
|
|
87
|
+
await until(async () => (await kids(p))[0] === 'descope-parity');
|
|
88
|
+
const toast = await p.evaluate(() => { const t = document.querySelector('#bdToast'); return t && !t.hidden ? t.textContent : ''; });
|
|
89
|
+
ok('B ✓ applies it: one write with the whole order, the rows move, the toast says where with Undo, and ✦ goes quiet', posts.length === 1 && posts[0].program === 'project-ascent' && posts[0].order[0] === 'descope-parity' && posts[0].order[1] === 'legacy-idp-sunset' && (await kids(p)).join() === 'descope-parity,legacy-idp-sunset' && /Ordered by dates · Board, program page and Home/.test(toast) && /Undo/.test(toast) && !(await sug(p)), JSON.stringify({ posts, toast, k: await kids(p) }));
|
|
90
|
+
await p.click('#bdToast .bd-undo');
|
|
91
|
+
await until(async () => (await kids(p))[0] === 'legacy-idp-sunset');
|
|
92
|
+
ok('B Undo writes the order before back', posts.length === 2 && posts[1].order.join() === 'legacy-idp-sunset,descope-parity' && (await kids(p)).join() === 'legacy-idp-sunset,descope-parity', JSON.stringify(posts));
|
|
93
|
+
// ✕: not now, until a date changes — the dot goes, ✦ stays
|
|
94
|
+
await p.click('#ibBody .bt-pg [data-po-sug]');
|
|
95
|
+
await p.waitForSelector('.po-pop');
|
|
96
|
+
await p.click('.po-pop [data-po-no]');
|
|
97
|
+
const s2 = await sug(p);
|
|
98
|
+
ok('B ✕ is "not now": no write, the popover closes, ✦ stays without its dot', posts.length === 2 && !(await p.$('.po-pop')) && !!s2 && !s2.dot, JSON.stringify(s2));
|
|
99
|
+
// drag: Descope's grip above Legacy
|
|
100
|
+
await p.hover('#ibBody [data-po-id="descope-parity"]');
|
|
101
|
+
const g = await p.locator('#ibBody [data-po-id="descope-parity"] [data-po-grip]').boundingBox();
|
|
102
|
+
const top = await p.locator('#ibBody [data-po-id="legacy-idp-sunset"]').boundingBox();
|
|
103
|
+
await p.mouse.move(g.x + g.width / 2, g.y + g.height / 2); await p.mouse.down();
|
|
104
|
+
await p.mouse.move(g.x + g.width / 2, top.y + 10, { steps: 6 });
|
|
105
|
+
const lifted = await p.evaluate(() => ({ lift: !!document.querySelector('[data-po-id="descope-parity"].po-lift'), slot: !!document.querySelector('.po-slot') }));
|
|
106
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/board-drag.png' });
|
|
107
|
+
await p.mouse.up();
|
|
108
|
+
await until(async () => (await kids(p))[0] === 'descope-parity');
|
|
109
|
+
ok('B drag by the grip: the row lifts over a slot, and the drop saves the new order', lifted.lift && lifted.slot && posts.length === 3 && posts[2].order.slice(0, 2).join() === 'descope-parity,legacy-idp-sunset' && (await kids(p)).join() === 'descope-parity,legacy-idp-sunset', JSON.stringify({ lifted, posts: posts.slice(2) }));
|
|
110
|
+
// keyboard: Alt + ↓ on the first row's grip
|
|
111
|
+
await p.focus('#ibBody [data-po-id="descope-parity"] [data-po-grip]');
|
|
112
|
+
await p.keyboard.press('Alt+ArrowDown');
|
|
113
|
+
await until(async () => (await kids(p))[0] === 'legacy-idp-sunset');
|
|
114
|
+
const foc = await until(() => p.evaluate(() => { const r = document.activeElement && document.activeElement.closest('[data-po-id]'); return r && r.dataset.poId; }));
|
|
115
|
+
ok('B Alt + ↓ moves the focused row one place down, and the focus stays on it', posts.length === 4 && (await kids(p)).join() === 'legacy-idp-sunset,descope-parity' && foc === 'descope-parity', JSON.stringify({ k: await kids(p), foc }));
|
|
116
|
+
ok('B no page error', !errors.length, errors.join(' | '));
|
|
117
|
+
await ctx.close();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* H — Home: the same order, the grip, and a phone's hold-then-drag */
|
|
121
|
+
const home = async (o = {}) => {
|
|
122
|
+
const ctx = await browser.newContext({ viewport: { width: o.w || 1440, height: o.h || 900 }, hasTouch: !!o.touch, isMobile: !!o.touch });
|
|
123
|
+
const page = await ctx.newPage();
|
|
124
|
+
const errors = [];
|
|
125
|
+
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
126
|
+
const json = (body) => (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(body) });
|
|
127
|
+
await page.route(/\/api\/briefing-premium(\?.*)?$/, json({ ok: true, state: 'ready', model: B.build(HF.facts()), as_of: Date.now() }));
|
|
128
|
+
await page.route('**/api/briefing-premium/thread**', json({ ok: true, turns: [], working: false }));
|
|
129
|
+
await page.route('**/api/board-premium*', (r) => { const q = new URL(r.request().url()).searchParams; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: BP.build(F.programFacts(q.get('ws') || 'idpf')), as_of: Date.now() }) }); });
|
|
130
|
+
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'not in this check' }) }));
|
|
131
|
+
await routePrograms(page);
|
|
132
|
+
const am = new Date(); am.setHours(10, 0, 0, 0); await page.clock.setFixedTime(am);
|
|
133
|
+
await page.goto(BASE + '/premium.html?theme=light');
|
|
134
|
+
await until(() => page.evaluate(() => !!document.querySelector('#hmList .hv-g.prg [data-po-id]')), 20000);
|
|
135
|
+
return { ctx, page, errors };
|
|
136
|
+
};
|
|
137
|
+
const hkids = (p) => p.evaluate(() => [...document.querySelectorAll('#hmList .hv-g.prg [data-po-id]')].map((r) => r.dataset.poId));
|
|
138
|
+
{
|
|
139
|
+
ORDER = ['legacy-idp-sunset', 'descope-parity'];
|
|
140
|
+
const n0 = posts.length;
|
|
141
|
+
const { ctx, page: p, errors } = await home();
|
|
142
|
+
ok('H Home\'s program group lists the program\'s order (not your turn first)', (await hkids(p)).join() === 'legacy-idp-sunset,descope-parity', JSON.stringify(await hkids(p)));
|
|
143
|
+
ok('H ✦ sits in the open program header', !!(await p.$('#hmList .hv-g.prg .hv-gh [data-po-sug]')));
|
|
144
|
+
if (process.env.SHOTS) { await p.hover('#hmList [data-po-id="descope-parity"]'); await p.screenshot({ path: process.env.SHOTS + '/home-desk.png' }); }
|
|
145
|
+
await p.hover('#hmList [data-po-id="descope-parity"]');
|
|
146
|
+
const g = await p.locator('#hmList [data-po-id="descope-parity"] [data-po-grip]').boundingBox();
|
|
147
|
+
const top = await p.locator('#hmList [data-po-id="legacy-idp-sunset"]').boundingBox();
|
|
148
|
+
await p.mouse.move(g.x + g.width / 2, g.y + g.height / 2); await p.mouse.down();
|
|
149
|
+
await p.mouse.move(g.x + g.width / 2, top.y + 6, { steps: 6 }); await p.mouse.up();
|
|
150
|
+
await until(async () => (await hkids(p))[0] === 'descope-parity');
|
|
151
|
+
ok('H the grip moves a row on Home too: one write, and the list follows it', posts.length === n0 + 1 && (await hkids(p)).join() === 'descope-parity,legacy-idp-sunset', JSON.stringify({ k: await hkids(p), posts: posts.slice(n0) }));
|
|
152
|
+
ok('H no page error', !errors.length, errors.join(' | '));
|
|
153
|
+
await ctx.close();
|
|
154
|
+
}
|
|
155
|
+
{
|
|
156
|
+
ORDER = ['legacy-idp-sunset', 'descope-parity'];
|
|
157
|
+
const n0 = posts.length;
|
|
158
|
+
const { ctx, page: p, errors } = await home({ w: 390, h: 844, touch: true });
|
|
159
|
+
const grips = await p.evaluate(() => [...document.querySelectorAll('#hmList [data-po-grip]')].filter((g) => getComputedStyle(g).display !== 'none').length);
|
|
160
|
+
ok('H phone: no grip shows (hold the row instead)', grips === 0, String(grips));
|
|
161
|
+
// a hold, then a drag, through the touch events the page reads (CDP touch input)
|
|
162
|
+
const s = await p.locator('#hmList [data-po-id="descope-parity"]').boundingBox();
|
|
163
|
+
const t = await p.locator('#hmList [data-po-id="legacy-idp-sunset"]').boundingBox();
|
|
164
|
+
const cdp = await ctx.newCDPSession(p);
|
|
165
|
+
const pt = (y) => [{ x: s.x + s.width / 2, y }];
|
|
166
|
+
await cdp.send('Input.dispatchTouchEvent', { type: 'touchStart', touchPoints: pt(s.y + s.height / 2) });
|
|
167
|
+
await sleep(600);
|
|
168
|
+
const lifted = await p.evaluate(() => !!document.querySelector('[data-po-id="descope-parity"].po-lift'));
|
|
169
|
+
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/home-phone-hold.png' });
|
|
170
|
+
for (let k = 1; k <= 6; k++) await cdp.send('Input.dispatchTouchEvent', { type: 'touchMove', touchPoints: pt(s.y + s.height / 2 - ((s.y + s.height / 2 - (t.y + 6)) * k) / 6) });
|
|
171
|
+
await cdp.send('Input.dispatchTouchEvent', { type: 'touchEnd', touchPoints: [] });
|
|
172
|
+
await until(async () => (await hkids(p))[0] === 'descope-parity');
|
|
173
|
+
ok('H phone: hold the row, it lifts; drag it up and the order saves', lifted && posts.length === n0 + 1 && (await hkids(p)).join() === 'descope-parity,legacy-idp-sunset', JSON.stringify({ lifted, k: await hkids(p), posts: posts.slice(n0) }));
|
|
174
|
+
const wide = await p.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth + 1);
|
|
175
|
+
ok('H phone: no sideways scroll', wide);
|
|
176
|
+
ok('H phone: no page error', !errors.length, errors.join(' | '));
|
|
177
|
+
await ctx.close();
|
|
178
|
+
}
|
|
179
|
+
finish();
|
|
180
|
+
})();
|
|
@@ -54,7 +54,7 @@ export function groupsOf(programs, rows, M, byProduct) {
|
|
|
54
54
|
export function stateOf(p, M, XR, now = Date.now()) {
|
|
55
55
|
const ws = (M && M.board && M.board.ws) || '';
|
|
56
56
|
const steps = (M && M.steps) || [];
|
|
57
|
-
const rows = ((M && M.rows) || []).filter((r) => r.id).map((r) => ({ id: r.id, title: r.title, stage: r.track && r.track.k >= 0 && steps[r.track.k] ? steps[r.track.k].key : r.stage, anchor: r.anchor, ws: r.ws, product: r.product }));
|
|
57
|
+
const rows = ((M && M.rows) || []).filter((r) => r.id).map((r) => ({ id: r.id, title: r.title, stage: r.track && r.track.k >= 0 && steps[r.track.k] ? steps[r.track.k].key : r.stage, anchor: r.anchor, ws: r.ws, product: r.product, start: r.start || null, end: r.end || null })); // the dates: Claude's order (prog-order.js)
|
|
58
58
|
// All products: every product's rows are on this board, each with its own workspace
|
|
59
59
|
if (M && M.board && M.board.all) return programState(p, (w) => { const R = rows.filter((r) => r.ws === w); return R.length ? { name: R[0].product, rows: R } : null; }, now);
|
|
60
60
|
return programState(p, (w) => (!w || !ws || w === ws ? { name: prodName(M), rows } : (XR && XR[w]) || null), now);
|
|
@@ -140,7 +140,7 @@ const whole = (st) => !st.missing.length;
|
|
|
140
140
|
/** The open milestones in date order: the next merged with the ones close to it (PgKanban "Pilot live +2 · Nov 18–21"). */
|
|
141
141
|
export const nextCluster = (st) => mergeClose((st.milestones || []).filter((m) => !m.done), 7)[0] || null;
|
|
142
142
|
|
|
143
|
-
/** The stage track's program row (PgBoard .pg). g: the program group; o: { steps, rows (this board's rows in it), plain }. */
|
|
143
|
+
/** The stage track's program row (PgBoard .pg). g: the program group; o: { steps, rows (this board's rows in it), plain, sug (✦, prog-order.js) }. */
|
|
144
144
|
export function bandHtml(g, st, o) {
|
|
145
145
|
const p = g.program, steps = o.steps || [], open = !folded(g.key);
|
|
146
146
|
const n = productsOf(p);
|
|
@@ -160,7 +160,7 @@ export function bandHtml(g, st, o) {
|
|
|
160
160
|
const t3 = [af ? `<i class="bd-dm o"></i>${esc(af.name + (af.day ? ' ' + af.day : ''))}` : '', tasks ? tasks + ' program ' + plural(tasks, 'task', 'tasks') : ''].filter(Boolean).join(' · ');
|
|
161
161
|
const meta = n > 1 ? n + ' products' : st.state;
|
|
162
162
|
return `<div class="bt-r bt-pg" role="row" data-prow="${esc(p.id)}">`
|
|
163
|
-
+ `<div class="bt-pgn" role="rowheader"><button type="button" class="bt-pgo" data-prog="${esc(p.id)}" aria-haspopup="dialog" aria-label="${esc(p.title)}, a program: ${esc([meta, words].join(', '))}. Open the program">${progTile()}<span class="tt"><b>${esc(p.title)}</b><span class="m">${esc(meta)}</span></span></button>${yoursHtml(st)}`
|
|
163
|
+
+ `<div class="bt-pgn" role="rowheader"><button type="button" class="bt-pgo" data-prog="${esc(p.id)}" aria-haspopup="dialog" aria-label="${esc(p.title)}, a program: ${esc([meta, words].join(', '))}. Open the program">${progTile()}<span class="tt"><b>${esc(p.title)}</b><span class="m">${esc(meta)}</span></span></button>${yoursHtml(st)}${o.sug || ''}`
|
|
164
164
|
+ `<button type="button" class="bd-ib sm bd-fold" data-fold="${esc(g.key)}" aria-expanded="${open}" aria-label="${open ? 'Fold' : 'Show'} ${esc(p.title)}" title="${open ? 'Fold' : 'Show'}">${SV(open ? CHEV_D : CHEV_R)}</button></div>`
|
|
165
165
|
+ `<div class="bt-spread" role="cell">${band}${lab}</div>`
|
|
166
166
|
+ `<div class="bt-dl" role="cell">${ms}${t3 ? `<div class="t3">${t3}</div>` : ''}</div></div>`;
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
* back true: keep the item shown now, so ← comes back to it. Without back, opening an item forgets what was behind it.
|
|
30
30
|
* keep true: this item takes the place of the one shown now, and what was behind that one stays behind this one (a view switch)
|
|
31
31
|
* add { label, on(button) }: a quiet + before ⋯ (Home's "New session" on an initiative, canvas HbC). Not drawn on a phone.
|
|
32
|
+
* check { state: 'todo'|'prog'|'done'|'wont'|'arch', label, title?, disabled? }: a task's check box in the tile's place (canvas XetX1Rest);
|
|
33
|
+
* a press runs onPress('check', button). setCheck(id, check) changes it while the item is shown.
|
|
32
34
|
* sub one quiet line under the title: what the item is when the title is its parent's name (a program's "Charter", canvas MsBCharter)
|
|
33
35
|
* presses [{ act, label, icon, text?, solid? }]: the item's own presses before ⋯ (a program's charter icon, canvas MsB0Entry; the
|
|
34
36
|
* charter's Save, MsBCharter). text draws the word beside the icon (not on a phone); solid is the one dark primary.
|
|
@@ -122,7 +124,8 @@ export function headHtml(it) {
|
|
|
122
124
|
: `<button type="button" class="cz-vw-ib" data-cz-vw="press" data-cz-vw-p="${esc(x.act)}" aria-label="${esc(x.label)}" title="${esc(x.label)}">${svg(path(x.icon), 18)}</button>`).join('');
|
|
123
125
|
const sub = o.sub ? `<p class="cz-vw-sub">${esc(o.sub)}</p>` : '';
|
|
124
126
|
return (o.canBack || phone ? ib('back', o.canBack ? 'Back' : 'Close the viewer', P.back) : '')
|
|
125
|
-
+ `<
|
|
127
|
+
+ (o.check ? `<button type="button" class="cz-vw-tile cz-vw-chk s-${esc(o.check.state || 'todo')}" data-cz-vw="press" data-cz-vw-p="check" aria-label="${esc(o.check.label || 'Mark done')}" title="${esc(o.check.title || o.check.label || 'Mark done')}"${o.check.disabled ? ' disabled' : ''}><span class="bx"></span></button>`
|
|
128
|
+
: `<span class="cz-vw-tile" aria-hidden="true">${svg(path(o.icon), 17)}</span>`)
|
|
126
129
|
+ (o.renaming ? renHtml(o) : `<div class="cz-vw-t">${kind}<h3 class="cz-vw-title" id="czVwTitle">${o.rename ? `<button type="button" class="cz-vw-rn" data-cz-vw-rn aria-label="${esc('Rename ' + (o.title || ''))}" title="Rename">${esc(o.title || '')}</button>` : esc(o.title || '')}</h3>${sub}</div>`)
|
|
127
130
|
+ disc + own + add + more
|
|
128
131
|
+ (phone ? '' : ib('wide', o.isWide ? 'Back to the side' : 'Open wide', o.isWide ? P.side : P.wide, ` aria-pressed="${o.isWide ? 'true' : 'false'}"`))
|
|
@@ -426,6 +429,8 @@ async function saveRename() {
|
|
|
426
429
|
}
|
|
427
430
|
/** The item's own presses change while it is shown (the charter's Save shows only after a change). */
|
|
428
431
|
export function setPresses(id, list) { if (V.cur && V.cur.id === String(id)) { V.cur.presses = list || null; if (V.cur.args) V.cur.args = { ...V.cur.args, presses: list || null }; if (!V.cur.renaming) redraw(); } }
|
|
432
|
+
/** A task's check box changes while it is shown (a status move from the card, canvas XetX1Done). */
|
|
433
|
+
export function setCheck(id, check) { if (V.cur && V.cur.id === String(id)) { V.cur.check = check || null; if (V.cur.args) V.cur.args = { ...V.cur.args, check: check || null }; if (!V.cur.renaming) redraw(); } }
|
|
429
434
|
/** The caller's own rename landed elsewhere (Undo, or a reload): the header shows the name. */
|
|
430
435
|
export function retitle(id, title) { if (V.cur && V.cur.id === String(id) && title) { V.cur.title = title; if (V.cur.args) V.cur.args = { ...V.cur.args, title }; if (!V.cur.renaming) redraw(); emit(); } }
|
|
431
436
|
|
|
@@ -445,7 +450,7 @@ export function open(it) {
|
|
|
445
450
|
V.drill = false;
|
|
446
451
|
const sameKind = V.cur && kindKey(V.cur.kind) === kindKey(o.kind);
|
|
447
452
|
leave();
|
|
448
|
-
V.cur = { id: o.id == null ? null : String(o.id), kind: o.kind || '', title: o.title || '', icon: o.icon, url: o.url || '', full: !!o.full, onClose: o.onClose, more: o.more, discuss: o.discuss, add: o.add || null, sub: o.sub || '', presses: o.presses || null, onPress: o.onPress, guard: o.guard, rename: o.rename && typeof o.rename.save === 'function' ? o.rename : null, args: o };
|
|
453
|
+
V.cur = { id: o.id == null ? null : String(o.id), kind: o.kind || '', title: o.title || '', icon: o.icon, url: o.url || '', full: !!o.full, onClose: o.onClose, more: o.more, discuss: o.discuss, add: o.add || null, sub: o.sub || '', check: o.check || null, presses: o.presses || null, onPress: o.onPress, guard: o.guard, rename: o.rename && typeof o.rename.save === 'function' ? o.rename : null, args: o };
|
|
449
454
|
el.setAttribute('aria-label', 'Viewer: ' + (o.kind || o.title || 'item'));
|
|
450
455
|
redraw();
|
|
451
456
|
const m = el.querySelector('.cz-vw-menu'); if (m) m.remove();
|
|
@@ -500,4 +505,4 @@ if (typeof window !== 'undefined' && typeof window.addEventListener === 'functio
|
|
|
500
505
|
e.preventDefault(); e.stopImmediatePropagation(); guarded(close);
|
|
501
506
|
}, true);
|
|
502
507
|
}
|
|
503
|
-
if (typeof window !== 'undefined') window.czViewer = { open, close, back, drill, setPresses, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, ICONS };
|
|
508
|
+
if (typeof window !== 'undefined') window.czViewer = { open, close, back, drill, setPresses, setCheck, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, ICONS };
|
|
@@ -59,7 +59,7 @@ export function shownUser(text) {
|
|
|
59
59
|
if (t.includes(MARK.cancel)) return 'Cancel the goal';
|
|
60
60
|
const g = t.indexOf(MARK.grill + ' The PM set a goal: ');
|
|
61
61
|
if (g >= 0) return '/goal ' + t.slice(g + (MARK.grill + ' The PM set a goal: ').length).split('\n')[0];
|
|
62
|
-
if (t.startsWith(OPENING) || t.startsWith('[PMOS report]') || t.startsWith('[PMOS program]') || t.startsWith('[PMOS workflow]')) { const s = pmSays(t); if (s != null) return s; } // premium-reports-from-chat: lib/report-chat.js wrap; lib/program-chat.js wrap; lib/workflow-chat.js wrap
|
|
62
|
+
if (t.startsWith(OPENING) || t.startsWith('[PMOS report]') || t.startsWith('[PMOS program]') || t.startsWith('[PMOS workflow]') || t.startsWith('[PMOS initiative]')) { const s = pmSays(t); if (s != null) return s; } // premium-reports-from-chat: lib/report-chat.js wrap; lib/program-chat.js wrap; lib/workflow-chat.js wrap
|
|
63
63
|
return t;
|
|
64
64
|
}
|
|
65
65
|
|