create-pmos 0.411.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 +25 -25
- 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/briefing-premium-adddoc-test.js +1 -1
- package/workspace/briefing-premium-insights-test.js +2 -2
- package/workspace/briefing-premium-test.js +3 -3
- package/workspace/changelog.json +24 -0
- package/workspace/core-docs-workflow-test.js +144 -0
- package/workspace/guide/board.md +1 -1
- package/workspace/guide/breakdown.md +6 -13
- package/workspace/guide/index.md +1 -1
- package/workspace/guide/initiative-driver.md +1 -1
- package/workspace/guide/initiatives-screen.md +1 -1
- package/workspace/guide/pm-only-acts.md +23 -24
- package/workspace/guide/today.md +1 -1
- 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/briefing-premium-writes.js +5 -4
- package/workspace/lib/core-docs.js +79 -14
- package/workspace/lib/coredoc-cli.js +1 -1
- package/workspace/lib/driver-cli.js +2 -1
- package/workspace/lib/driver-decide.js +3 -2
- package/workspace/lib/driver.js +2 -1
- package/workspace/lib/engine/boards.js +20 -12
- package/workspace/lib/grant-mint.js +3 -2
- package/workspace/lib/initiative-chat.js +49 -0
- package/workspace/lib/initiative-cli.js +9 -9
- package/workspace/lib/initiative-premium.js +17 -7
- package/workspace/lib/issues.js +5 -4
- package/workspace/lib/item-cli.js +7 -2
- package/workspace/lib/people-store.js +1 -1
- package/workspace/lib/people.js +3 -1
- package/workspace/lib/placements.js +13 -15
- package/workspace/lib/plan-items.js +18 -49
- package/workspace/lib/pm-guard.js +18 -5
- package/workspace/lib/pm-lines-needs.js +9 -5
- 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/report-cli.js +2 -2
- package/workspace/lib/routes-board-metric-targets.js +0 -1
- package/workspace/lib/routes-boards.js +75 -13
- package/workspace/lib/routes-briefing-premium.js +20 -6
- package/workspace/lib/routes-core-docs.js +3 -2
- package/workspace/lib/routes-custom-docs.js +0 -1
- package/workspace/lib/routes-driver.js +0 -1
- package/workspace/lib/routes-home-desk.js +1 -1
- package/workspace/lib/routes-home-review.js +1 -1
- package/workspace/lib/routes-initiative-layout.js +1 -1
- package/workspace/lib/routes-insights-records.js +0 -1
- package/workspace/lib/routes-meeting-material.js +0 -1
- package/workspace/lib/routes-onboarding.js +3 -1
- package/workspace/lib/routes-orchestrator.js +0 -1
- package/workspace/lib/routes-premium-charts.js +0 -1
- package/workspace/lib/routes-premium-dashboards.js +0 -1
- package/workspace/lib/routes-programs.js +13 -2
- package/workspace/lib/routes-records.js +1 -1
- package/workspace/lib/routes-report-design.js +7 -3
- package/workspace/lib/routes-report-setups.js +0 -1
- package/workspace/lib/routes-report-structure.js +0 -1
- package/workspace/lib/routes-runs.js +2 -5
- package/workspace/lib/routes-scan.js +0 -1
- package/workspace/lib/routes-sources.js +1 -1
- package/workspace/lib/run-answers.js +14 -5
- package/workspace/lib/scan-cli.js +2 -1
- package/workspace/lib/scan.js +2 -1
- package/workspace/lib/vendor/scripts/onboarding/proposals.js +7 -3
- 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-core-doc-issue-test.js +1 -1
- package/workspace/premium-viewer-share-test.js +5 -2
- 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/replaced-tests.json +101 -0
- package/workspace/server.js +8 -9
- 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
|
@@ -29,11 +29,13 @@ function requestIdOf(body) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function recordAnswer(file, input, who, now = new Date()) {
|
|
32
|
-
|
|
32
|
+
// D98: an agent session answers too; the line keeps its `by`, so the PM sees who answered.
|
|
33
|
+
if (!actor.isPm(who) && !actor.isAgent(who)) return { ok: false, status: 403, error: 'only the PM or an agent session can answer a run' };
|
|
33
34
|
const i = input && typeof input === 'object' ? input : {};
|
|
34
35
|
if (typeof i.run !== 'string' || !RUN_RE.test(i.run)) return { ok: false, status: 400, error: 'run must be a session id' };
|
|
35
36
|
if (typeof i.request !== 'string' || !i.request || i.request.length > 120) return { ok: false, status: 400, error: 'request must be a short id' };
|
|
36
37
|
if (!BEHAVIORS.includes(i.behavior)) return { ok: false, status: 400, error: 'behavior must be one of ' + BEHAVIORS.join(', ') };
|
|
38
|
+
if (ownRun(who.by, i.run)) return { ok: false, status: 403, error: 'a run does not answer its own question or permission request' };
|
|
37
39
|
const message = typeof i.message === 'string' ? i.message.slice(0, 400) : '';
|
|
38
40
|
const line = { type: 'answer', run: i.run, request: i.request, behavior: i.behavior, message, by: who.by };
|
|
39
41
|
appendOutbox(file, line, now);
|
|
@@ -45,20 +47,27 @@ function readAnswers(file) {
|
|
|
45
47
|
catch { return []; }
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
const answerer = (by) => typeof by === 'string' && (by.startsWith('pm:') || by.startsWith('agent:'));
|
|
51
|
+
/** True when `by` is the agent session of run `run` itself. Kept through D98: a run that answered its own permission
|
|
52
|
+
* request would make the request mean nothing. Any other agent session may answer it. */
|
|
53
|
+
const ownRun = (by, run) => typeof by === 'string' && typeof run === 'string' && by.startsWith('agent:' + run + '.');
|
|
54
|
+
const counts = (l, run) => answerer(l.by) && !ownRun(l.by, run);
|
|
55
|
+
|
|
48
56
|
function answerFor(run, requestId, lines = []) {
|
|
49
57
|
let found = null;
|
|
50
58
|
for (const l of lines) {
|
|
51
|
-
if (l && l.type === 'answer' && l.run === run && l.request === requestId &&
|
|
59
|
+
if (l && l.type === 'answer' && l.run === run && l.request === requestId && counts(l, run)) found = l;
|
|
52
60
|
}
|
|
53
61
|
return found;
|
|
54
62
|
}
|
|
55
63
|
|
|
56
|
-
// The
|
|
57
|
-
// permission request.
|
|
64
|
+
// The recorded answers as the contract's own events (reply-contract.js fold): an answer to an ask, a decision on a
|
|
65
|
+
// permission request. Lines written by the PM or another agent session (D98) become events, in the contract's answerer role
|
|
66
|
+
// (`by: 'pm'`); the run-answers line itself keeps who wrote it. The fold then checks the ids against what is open.
|
|
58
67
|
function asEvents(run, lines = []) {
|
|
59
68
|
const out = [];
|
|
60
69
|
for (const l of lines) {
|
|
61
|
-
if (!l || l.type !== 'answer' || l.run !== run.id ||
|
|
70
|
+
if (!l || l.type !== 'answer' || l.run !== run.id || !counts(l, run.id)) continue;
|
|
62
71
|
if (l.behavior === 'answer') out.push({ kind: 'answer', run: run.id, session: run.session, ask_id: l.request, answer: l.message, by: 'pm' });
|
|
63
72
|
else if (l.behavior === 'allow' || l.behavior === 'deny') out.push({ kind: 'decision', run: run.id, session: run.session, perm_id: l.request, decision: l.behavior, by: 'pm', at: l.at });
|
|
64
73
|
}
|
|
@@ -130,7 +130,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
130
130
|
if (!file) file = S.ledgerFile(D.stateDirOf(flags.root ? path.resolve(cwd, flags.root) : repoRoot(cwd)));
|
|
131
131
|
const noState = () => fail('this repository has no PMOS state folder (pmos/state, state or .pmos), so the scan has nowhere to keep its ledger');
|
|
132
132
|
const actor = actorLib.fromCli(who);
|
|
133
|
-
|
|
133
|
+
// D98: an agent session may do it too; the ledger line carries its own `by`.
|
|
134
|
+
const pmOnly = (act) => (actorLib.isPm(actor) || actorLib.isAgent(actor) ? { ok: true } : { ok: false, error: `only the PM or an agent session can ${act}` });
|
|
134
135
|
const openScan = (state, id, mode) => {
|
|
135
136
|
const sc = id ? state.scans.get(id) : null;
|
|
136
137
|
if (!sc || sc.end || (mode && sc.mode !== mode)) return null;
|
package/workspace/lib/scan.js
CHANGED
|
@@ -88,7 +88,8 @@ const REPORT_RE = /^r-[0-9a-f]{10}$/;
|
|
|
88
88
|
const PROPOSAL_RE = /^p-[0-9a-f]{10}$/;
|
|
89
89
|
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
90
90
|
const oneLine = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
|
|
91
|
-
|
|
91
|
+
// D98: a press line by the PM or an agent session takes effect; the line keeps who wrote it.
|
|
92
|
+
const pm = (by) => typeof by === 'string' && (by.startsWith('pm:') || by.startsWith('agent:'));
|
|
92
93
|
const newId = (prefix, bytes = 4) => `${prefix}-${crypto.randomBytes(bytes).toString('hex')}`;
|
|
93
94
|
const refuse = (status, error) => ({ ok: false, status, error });
|
|
94
95
|
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* proposed { id, kind:'proposed', proposal_id, scan_id, candidate, at, why } written by the scan process
|
|
9
9
|
* decided { id, kind:'decided', proposal_id, decision: approve|reject|revise, revision?, why, at } by (and via) from the call path
|
|
10
10
|
* fold(lines) gives each proposal its state: open | approved | rejected | revised. The latest decision wins; earlier ones stay in `history`.
|
|
11
|
-
* A decision is a PM press: decide() and approveBulk() take the actor as an argument and
|
|
11
|
+
* A decision is a PM press or an agent session's (D98): decide() and approveBulk() take the actor as an argument and
|
|
12
|
+
* refuse anything that is not 'human:' or 'agent:'.
|
|
12
13
|
*/
|
|
13
14
|
const fs = require('fs');
|
|
14
15
|
const path = require('path');
|
|
@@ -20,10 +21,13 @@ const SCAN_ACTOR = { by: 'process:onboarding-scan', via: 'cli' };
|
|
|
20
21
|
|
|
21
22
|
const inside = (child, parent) => { const r = path.relative(path.resolve(parent), path.resolve(child)); return r === '' || (!r.startsWith('..') && !path.isAbsolute(r)); };
|
|
22
23
|
|
|
23
|
-
/** The actor of a decision as ledger.append wants it ({by, via}). A bare string 'human:wawan' is a PM press;
|
|
24
|
+
/** The actor of a decision as ledger.append wants it ({by, via}). A bare string 'human:wawan' is a PM press; an
|
|
25
|
+
* `agent:…` actor is an agent session deciding (D98), and the line keeps its name. Anything else is refused. */
|
|
24
26
|
function humanActor(actor) {
|
|
25
27
|
const a = typeof actor === 'string' ? { by: actor, via: 'ui' } : actor;
|
|
26
|
-
|
|
28
|
+
// An agent is agent:<session> (the workspace) or claude-code/<skill> (scripts/trust/ledger.js actorFrom).
|
|
29
|
+
const ok = a && typeof a.by === 'string' && ((a.by.startsWith('human:') && a.by.length > 'human:'.length) || /^agent:(?:unknown|sess-\d+\.[0-9a-f]{8})$/.test(a.by) || /^claude-code\/[\w-]+$/.test(a.by));
|
|
30
|
+
if (!ok) throw new Error('a decision is made by the PM (human:<name>) or an agent session (agent:<session>) (got ' + (a && a.by ? a.by : 'none') + ')');
|
|
27
31
|
return { by: a.by, via: a.via || 'ui' };
|
|
28
32
|
}
|
|
29
33
|
|
|
@@ -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);
|
|
@@ -170,7 +170,7 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
|
|
|
170
170
|
const bare = await fetch(BASE + '/api/core-docs/issue', { method: 'POST', headers: { 'Content-Type': 'application/json', Origin: BASE }, body: JSON.stringify({ ws: B.ws, scope: bscope, key: bkey, slot: d1.slot }) });
|
|
171
171
|
ok('P3 a press without the launch nonce is refused', bare.status === 403);
|
|
172
172
|
const agent = await fetch(BASE + '/api/core-docs/issue', { method: 'POST', headers: { ...H, 'x-pmos-session': 's1' }, body: JSON.stringify({ ws: B.ws, scope: bscope, key: bkey, slot: d1.slot }) });
|
|
173
|
-
ok('P4 an agent session
|
|
173
|
+
ok('P4 D98: an agent session is not refused as an agent (the press is checked like the PM\'s)', agent.status !== 403, String(agent.status));
|
|
174
174
|
ok('P5 no script error on any page', !P.errors.length && !I.errors.length && !J.errors.length, P.errors.concat(I.errors, J.errors).join(' | '));
|
|
175
175
|
await J.ctx.close();
|
|
176
176
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* but I can set password)"). lib/share-store.js keeps the copies, POST /api/shares makes one on a page press, share-server.js serves them.
|
|
5
5
|
* K1 the store: 22-character ids, a scrypt hash and never the password, five wrong tries lock for 15 minutes, a link past its end is deleted,
|
|
6
6
|
* the cookie is signed per link and a changed one fails
|
|
7
|
-
* K2 the routes:
|
|
7
|
+
* K2 the routes: a request without the page's press headers is refused; an agent session makes and turns off a link (D98); a file with a secret is refused and the answer
|
|
8
8
|
* names the rule only; 1, 7 or 30 days only; a made link is listed with its password flag and no hash
|
|
9
9
|
* K3 the share server: the password page names neither the file nor PMOS; a wrong password counts down, five lock, the right one opens; the copy
|
|
10
10
|
* is under a sandbox CSP; Download gives the file's own text; every answer is noindex, no-store, no-referrer; any other path is 404
|
|
@@ -83,7 +83,10 @@ const SHOTS = process.env.PMOS_SHOTS || '';
|
|
|
83
83
|
// K2 the routes
|
|
84
84
|
{
|
|
85
85
|
ok('K2 a POST without the page\'s press headers is refused', (await req(BASE + '/api/shares', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ path: PRD, days: 7 }) })).status === 403);
|
|
86
|
-
|
|
86
|
+
const agentMk = await post('/api/shares', { path: PRD, days: 7 }, { 'x-pmos-session': 'sess-1' });
|
|
87
|
+
const agentId = (JSON.parse(agentMk.text || '{}')).id;
|
|
88
|
+
const agentOff = await post('/api/shares/off', { id: agentId }, { 'x-pmos-session': 'sess-1' });
|
|
89
|
+
ok('K2 D98: an agent session makes a link (the secret scan still runs) and turns it off', agentMk.status === 200 && !!agentId && agentOff.status === 200, agentMk.text);
|
|
87
90
|
fs.writeFileSync(path.join(REPO, SECRET_REL), '# Keys\n\naws ' + 'AKIA' + 'ABCDEFGHIJKLMNOP' + ' here\n');
|
|
88
91
|
const sec = await post('/api/shares', { path: SECRET_REL, days: 7, password: null });
|
|
89
92
|
ok('K2 a file with a secret is refused, naming the rule and not the text', sec.status === 422 && /aws-access-key/.test(sec.text) && !/AKIAABCD/.test(sec.text), sec.status + ' ' + sec.text);
|
|
@@ -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>`;
|