create-pmos 0.415.0 → 0.417.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 +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +3 -3
- package/workspace/briefing-premium-board-test.js +72 -43
- package/workspace/briefing-premium-doc-edit-test.js +2 -2
- package/workspace/briefing-premium-initiative-test.js +19 -22
- package/workspace/briefing-premium-insights-test.js +28 -17
- package/workspace/changelog.json +24 -0
- package/workspace/core-docs-workflow-test.js +1 -1
- package/workspace/guide/workflows.md +4 -3
- package/workspace/ini-workflow-test.js +11 -11
- package/workspace/lib/board-premium.js +7 -2
- package/workspace/lib/board-trail.js +6 -1
- package/workspace/lib/engine/boards.js +8 -2
- package/workspace/lib/initiative-chat.js +4 -3
- package/workspace/lib/initiative-premium.js +5 -3
- package/workspace/lib/insights-premium.js +9 -1
- package/workspace/lib/pmos-verbs.js +1 -1
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-boards.js +73 -6
- package/workspace/lib/routes-live.js +53 -0
- package/workspace/lib/task-cli.js +88 -24
- package/workspace/lib/task-items.js +3 -1
- package/workspace/lib/workflow-cli.js +10 -4
- package/workspace/milestone-suggest-test.js +2 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +12 -8
- package/workspace/premium-chat-report-tab-test.js +13 -5
- package/workspace/premium-core-doc-issue-test.js +1 -1
- package/workspace/premium-report-read-test.js +66 -51
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-doc-test.js +3 -3
- package/workspace/premium-vw-item-test.js +4 -4
- package/workspace/premium-vw-jira-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +7 -5
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +68 -230
- package/workspace/public/pm/cozy-insights.css +15 -0
- package/workspace/public/pm/cozy-live-pill.css +48 -0
- package/workspace/public/pm/cozy-live-pill.js +141 -0
- package/workspace/public/pm/cozy-viewer.js +4 -3
- package/workspace/public/pm/cozy-vw-rp.css +48 -0
- package/workspace/public/pm/home-app.js +45 -8
- package/workspace/public/pm/home-chat.js +5 -2
- package/workspace/public/pm/home-ini.js +57 -22
- package/workspace/public/pm/home-task.js +16 -5
- package/workspace/public/pm/ini-view-model.js +277 -0
- package/workspace/public/pm/ini-view.css +122 -0
- package/workspace/public/pm/ini-view.js +180 -0
- package/workspace/public/pm/live-model.js +104 -0
- package/workspace/public/pm/ov-view.css +44 -0
- package/workspace/public/pm/premium-board.js +15 -16
- package/workspace/public/pm/premium-insights.js +61 -35
- package/workspace/public/pm/premium-report-read.js +74 -50
- package/workspace/public/pm/premium-report-tab.js +36 -15
- package/workspace/public/pm/premium-shell.js +1 -1
- package/workspace/public/pm/premium-vw-item-model.js +6 -3
- package/workspace/public/pm/premium-vw-item.js +25 -6
- package/workspace/public/pm/premium-vw-jira.js +17 -15
- package/workspace/public/pm/rp-parts.js +75 -12
- package/workspace/public/pm/task-card.css +24 -49
- package/workspace/public/pm/task-card.js +90 -64
- package/workspace/public/pm/tk-view.css +21 -0
- package/workspace/public/pm/tk-view.js +216 -0
- package/workspace/public/pm/wf-page.js +2 -0
- package/workspace/server.js +24 -1
- package/workspace/stage-card-test.js +49 -41
- package/workspace/task-card-test.js +83 -38
- package/workspace/test-files.json +3 -1
- package/workspace/test-lists/bd-ini-panel.json +3 -3
- package/workspace/tk-tasks-test.js +3 -3
- package/workspace/public/pm/bd-ini-model.js +0 -81
- package/workspace/public/pm/cozy-rec-pill.css +0 -12
- package/workspace/public/pm/cozy-rec-pill.js +0 -46
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
* POST /api/boards/tasks/reschedule { ws, board, task, days } → { ok, item }
|
|
30
30
|
* POST /api/boards/tasks/undo-add { ws, board, task } → { ok } takes back a task added in the last 2 minutes, still To do
|
|
31
31
|
* POST /api/boards/tasks/rename { ws, board, task, title } → { ok, from, item } only the title changes
|
|
32
|
-
* POST /api/boards/tasks/edit { ws, board, task, owner?, notes?, start?, due?, initiative? } → { ok, from, item } the Viewer's edits in place
|
|
32
|
+
* POST /api/boards/tasks/edit { ws, board, task, owner?, notes?, start?, due?, initiative?, section? } → { ok, from, item } the Viewer's edits in place
|
|
33
|
+
* (section: the task's place in the breakdown, a stage key of its initiative's workflow or '' — a task-section line)
|
|
33
34
|
* (canvas XetX1Rest); `from` holds the fields as they were, so Undo is the same call with `from`
|
|
34
35
|
* POST /api/boards/tickets/note { ws, board, ref, notes } → { ok, from, notes } the PM's notes on a Jira ticket
|
|
35
36
|
* POST /api/boards/archive { ws, board, id, archived, reason? } → { ok, row } archive (hidden everywhere, kept whole) or restore;
|
|
@@ -290,6 +291,14 @@ function epicsOf(base, folded) {
|
|
|
290
291
|
/** D99: the workflow an initiative runs and where it stands in it. Product feature unless an ini-wf line set another (the PMOS-self
|
|
291
292
|
* board always runs Product feature, derived). Answers { wf, stage (key), stages (WF.stagesOf), ended }. The ONE place every surface
|
|
292
293
|
* (Board, track, stage card, Viewer, program milestones) gets an initiative's stages from. */
|
|
294
|
+
/** The stage an older board's merged column ("Build & Deliver", "Monitor & Evaluate") names on wf: `prefer` when it is one of its parts,
|
|
295
|
+
* else the first part, else null. */
|
|
296
|
+
function mergedStage(wf, name, prefer) {
|
|
297
|
+
const parts = String(name || '').split(/\s*(?:&|\/|\band\b)\s*/i).filter(Boolean);
|
|
298
|
+
if (parts.length < 2) return null;
|
|
299
|
+
const st = parts.map((x) => WF.stageByRef(wf, x)).filter(Boolean);
|
|
300
|
+
return st.length ? (prefer && st.some((x) => x.key === prefer.key) ? prefer : st[0]) : null;
|
|
301
|
+
}
|
|
293
302
|
function workflowRowOf(board, base, folded, lib, legacyStage) {
|
|
294
303
|
const k = B.key(board.id, base.id);
|
|
295
304
|
const own = !(board && board.self) && folded && folded.iniWf ? folded.iniWf.get(k) : null;
|
|
@@ -300,7 +309,10 @@ function workflowRowOf(board, base, folded, lib, legacyStage) {
|
|
|
300
309
|
cur = (WF.stageByRef(wf, moved) || wf.stages[0]).key;
|
|
301
310
|
} else {
|
|
302
311
|
const byName = WF.stageByRef(wf, legacyStage);
|
|
303
|
-
|
|
312
|
+
const read = WF.stageByRef(wf, base.reading);
|
|
313
|
+
// an older board's merged column ("Build & Deliver") names two stages: the reading when it is one of them, else the first (it fell
|
|
314
|
+
// back to the reading, so a move to Build & Deliver showed Triage)
|
|
315
|
+
cur = (byName || mergedStage(wf, legacyStage, read) || read || wf.stages[0]).key;
|
|
304
316
|
}
|
|
305
317
|
const judged = (folded && folded.judged && folded.judged.get(k)) || {};
|
|
306
318
|
const auto = (folded && folded.autoOver && folded.autoOver.get(k)) || {};
|
|
@@ -481,6 +493,9 @@ function itemsOf(w, fr, board, rows) {
|
|
|
481
493
|
for (const t of fr.folded.tasks.values()) if (t.board === board.id && ids.has(t.initiative)) out.push(B.taskItem(t));
|
|
482
494
|
out.push(...TI.rowsOf(w.root, ids, board.id)); // one kind of task: an initiative's breakdown items show as its tasks (lib/task-items.js)
|
|
483
495
|
for (const x of out) if (x.src === 'jira') x.notes = (fr.folded.ticketNotes && fr.folded.ticketNotes.get(board.id + '\u0000' + x.key)) || ''; // the PM's notes (canvas XetX1Jira)
|
|
496
|
+
// a task's place in the breakdown (one view): the PM's own choice, else the stage whose To finish entry made it
|
|
497
|
+
const SEC = fr.folded.sections || new Map();
|
|
498
|
+
for (const x of out) if (x.src === 'pmos' && x.kind !== 'Epic') { if (SEC.has(x.uid)) x.section = SEC.get(x.uid); else if (x.from && x.from.stage) x.section = x.from.stage; }
|
|
484
499
|
return B.rollupItems(out);
|
|
485
500
|
}
|
|
486
501
|
|
|
@@ -640,7 +655,8 @@ const READS = {
|
|
|
640
655
|
const live = r.rows.filter((x) => !x.archived); // an archived initiative leaves every list and timeline (c3-initiative-lifecycle)
|
|
641
656
|
seedRows(ctx, r.w, r.fr, r.board, live);
|
|
642
657
|
ctx.json(res, { ok: true, ws: r.w.id, board: r.board.id, build: r.board.build, jira: r.board.jira, jiraProjects: r.board.jiraProjects, items: itemsOf(r.w, r.fr, r.board, live),
|
|
643
|
-
initiatives: live.map((x) => ({ id: x.id, title: x.title, stage: x.stage, cat: x.cat, status: x.status, owner: x.owner, horizon: x.horizon, start: x.start, end: x.end, progress: x.progress, template: x.template, epics: x.epics
|
|
658
|
+
initiatives: live.map((x) => ({ id: x.id, title: x.title, stage: x.stage, cat: x.cat, status: x.status, owner: x.owner, horizon: x.horizon, start: x.start, end: x.end, progress: x.progress, template: x.template, epics: x.epics,
|
|
659
|
+
stages: (x.wfStages || []).map((st) => ({ key: st.key, name: st.name, milestone: !!st.milestone })) })) }); // the sections a task can sit in (the task Viewer's move icon)
|
|
644
660
|
},
|
|
645
661
|
'/api/boards/sprints': (ctx, res, url) => {
|
|
646
662
|
const r = boardRead(ctx, res, url);
|
|
@@ -718,7 +734,8 @@ function moveOnWorkflow(ctx, res, body, g, p, own) {
|
|
|
718
734
|
if (body.why != null && (typeof body.why !== 'string' || body.why.length > 500)) return fail(ctx, res, 400, 'why is text of at most 500 characters');
|
|
719
735
|
if (!p.file) return fail(ctx, res, 409, NO_STATE);
|
|
720
736
|
const wf = WF.resolve(libOf(p.fr.folded), own.wf);
|
|
721
|
-
|
|
737
|
+
// a Product feature initiative pinned by a move (moveToProductStage) is still dragged to the board's merged columns ("Build & Deliver")
|
|
738
|
+
const t = WF.stageByRef(wf, body.to) || (wf.id === WF.PRODUCT_FEATURE_ID ? mergedStage(wf, body.to) : null);
|
|
722
739
|
if (!t) return fail(ctx, res, 400, `"${body.to}" is not a stage of ${wf.name} (${wf.stages.map((s) => s.name).join(', ')})`);
|
|
723
740
|
const base = needRows(ctx, res, p.w);
|
|
724
741
|
if (!base) return;
|
|
@@ -735,6 +752,29 @@ function moveOnWorkflow(ctx, res, body, g, p, own) {
|
|
|
735
752
|
ctx.json(res, { ok: true, row, warnings, ...(made ? { tasksMade: made } : {}) });
|
|
736
753
|
}
|
|
737
754
|
|
|
755
|
+
/** A move of a Product feature initiative to one of its eight stages (pf) that the board has no column for: an ini-wf line pins it to
|
|
756
|
+
* Product feature at that stage, the same line a workflow switch writes, so every surface reads the stage from it (batch 7 item 2). */
|
|
757
|
+
function moveToProductStage(ctx, res, body, g, p, pf) {
|
|
758
|
+
if (body.why != null && (typeof body.why !== 'string' || body.why.length > 500)) return fail(ctx, res, 400, 'why is text of at most 500 characters');
|
|
759
|
+
if (typeof body.id !== 'string' || !body.id) return fail(ctx, res, 400, 'id is required');
|
|
760
|
+
if (!p.file) return fail(ctx, res, 409, NO_STATE);
|
|
761
|
+
const base = needRows(ctx, res, p.w);
|
|
762
|
+
if (!base) return;
|
|
763
|
+
const b0 = base.find((r) => r.id === body.id);
|
|
764
|
+
if (!b0 || boardIdOf(b0, p.fr.boards, p.fr.folded, p.w) !== p.board.id) return fail(ctx, res, 404, `no initiative ${body.id} on this board`);
|
|
765
|
+
const before = boardRow(p.board, b0, p.fr.folded);
|
|
766
|
+
if (before.wf && before.wf.id !== WF.PRODUCT_FEATURE_ID) return fail(ctx, res, 400, `"${body.to}" is not a stage of ${before.wf.name}`);
|
|
767
|
+
const wf = WF.PRODUCT_FEATURE;
|
|
768
|
+
const a = wf.stages.findIndex((s) => s.key === before.wfStage.key), b = wf.stages.findIndex((s) => s.key === pf.key);
|
|
769
|
+
const warnings = [];
|
|
770
|
+
for (let i = a + 1; i < b; i++) { const sk = before.wfStages[i]; if (sk && sk.status !== 'skipped' && (!sk.when || sk.when.mode !== 'optional')) warnings.push('Skipped ' + sk.name); }
|
|
771
|
+
if (!before.anchor) warnings.push('No anchor');
|
|
772
|
+
append(p.file, g.actor, { kind: 'ini-wf', board: p.board.id, id: body.id, wf: wf.id, from: wf.id, moved: { from: before.wfStage.key, to: pf.key }, why: body.why ? String(body.why).trim() : '' });
|
|
773
|
+
const f1 = foldOf(ctx, p.w), row = boardRow(p.board, b0, f1);
|
|
774
|
+
const made = stageTasks(p.file, f1, p.board, row, g.actor.by);
|
|
775
|
+
ctx.json(res, { ok: true, row, warnings, ...(made ? { tasksMade: made } : {}) });
|
|
776
|
+
}
|
|
777
|
+
|
|
738
778
|
/** A breakdown item named as a task (lib/task-items.js), when its initiative is on this board; answers and returns null when not. */
|
|
739
779
|
function itemOnBoard(ctx, res, p, id) {
|
|
740
780
|
const it = TI.isItemId(id) ? TI.itemOf(p.w.root, id) : null;
|
|
@@ -807,6 +847,10 @@ const WRITES = {
|
|
|
807
847
|
const own = typeof body.id === 'string' && p.fr.folded.iniWf ? p.fr.folded.iniWf.get(B.key(p.board.id, body.id)) : null;
|
|
808
848
|
if (own) return moveOnWorkflow(ctx, res, body, g, p, own);
|
|
809
849
|
const wfOwn = typeof body.id === 'string' ? B.workflowOf(p.board, body.id, p.fr.folded) : p.board.workflow;
|
|
850
|
+
// an initiative on Product feature shows its eight stages, but an older board's columns merge them ("Build & Deliver"). A Product
|
|
851
|
+
// feature stage that is not a column pins the initiative to Product feature at that stage, so it lands where it was sent.
|
|
852
|
+
const pf = typeof body.to === 'string' && !wfOwn.some((s) => s.name === body.to) ? WF.stageByRef(WF.PRODUCT_FEATURE, body.to) : null;
|
|
853
|
+
if (pf) return moveToProductStage(ctx, res, body, g, p, pf);
|
|
810
854
|
if (typeof body.to !== 'string' || !wfOwn.some((s) => s.name === body.to)) {
|
|
811
855
|
return fail(ctx, res, 400, `"${body.to}" is not a stage of this ${wfOwn === p.board.workflow ? 'board' : 'initiative'}'s workflow (${wfOwn.map((s) => s.name).join(', ')})`);
|
|
812
856
|
}
|
|
@@ -1113,7 +1157,28 @@ const WRITES = {
|
|
|
1113
1157
|
if (!b0 || boardIdOf(b0, p.fr.boards, p.fr.folded, p.w) !== p.board.id) return fail(ctx, res, 404, `no initiative ${body.initiative} on this board`);
|
|
1114
1158
|
ev.initiative = body.initiative; from.initiative = t.initiative;
|
|
1115
1159
|
}
|
|
1116
|
-
|
|
1160
|
+
// the task's place in the breakdown (one view, feedback batch 6 item 1): a stage key of its initiative's workflow, or '' for Not in a
|
|
1161
|
+
// stage. It is a board-ledger line for both kinds of task, so a breakdown item and a Board task move the same way, and it never moves
|
|
1162
|
+
// the initiative's own stage
|
|
1163
|
+
let sec = null;
|
|
1164
|
+
if (body.section != null) {
|
|
1165
|
+
if (typeof body.section !== 'string' || body.section.length > 80) return fail(ctx, res, 400, "section is a stage key of the initiative's workflow, or '' for Not in a stage");
|
|
1166
|
+
const iniId = ev.initiative || t.initiative, base = needRows(ctx, res, p.w);
|
|
1167
|
+
if (!base) return;
|
|
1168
|
+
const b0 = base.find((r) => r.id === iniId);
|
|
1169
|
+
if (!b0) return fail(ctx, res, 404, `no initiative ${iniId} on this board`);
|
|
1170
|
+
const st = boardRow(p.board, b0, p.fr.folded).wfStages || [];
|
|
1171
|
+
if (body.section && !st.some((x) => x.key === body.section)) return fail(ctx, res, 400, `"${body.section}" is not a stage of this initiative's workflow: one of ${st.map((x) => x.key).join(', ')}, or ''`);
|
|
1172
|
+
const S0 = p.fr.folded.sections || new Map();
|
|
1173
|
+
sec = body.section; from.section = S0.has(t.id) ? S0.get(t.id) : (t.from && t.from.stage) || '';
|
|
1174
|
+
if (!p.file) return fail(ctx, res, 409, NO_STATE);
|
|
1175
|
+
}
|
|
1176
|
+
if (!Object.keys(ev).length && sec == null) return fail(ctx, res, 400, 'nothing to change: send owner, notes, start, due, initiative or section');
|
|
1177
|
+
if (sec != null) append(p.file, g.actor, { kind: 'task-section', board: p.board.id, task: t.id, section: sec, why: sec ? 'placed under ' + sec : 'placed under no stage' });
|
|
1178
|
+
if (!Object.keys(ev).length) {
|
|
1179
|
+
const items = itemsOf(p.w, { ...p.fr, folded: B.fold(readLedger(ctx, p.w)) }, p.board, (needRows(ctx, res, p.w) || []).filter((r) => r.id === t.initiative));
|
|
1180
|
+
return ctx.json(res, { ok: true, from, item: items.find((x) => x.uid === t.id) || null });
|
|
1181
|
+
}
|
|
1117
1182
|
if (t.item) return itemWrite(ctx, res, p, t, TI.editEvents(t, ev), g, { from });
|
|
1118
1183
|
if (!p.file) return fail(ctx, res, 409, NO_STATE);
|
|
1119
1184
|
append(p.file, g.actor, { kind: 'task-update', board: p.board.id, task: t.id, ...ev, why: 'edited ' + Object.keys(ev).join(', ') });
|
|
@@ -1285,6 +1350,8 @@ function switchWorkflow(ctx, body, g) { return writeAs(ctx, '/api/boards/ini-wf'
|
|
|
1285
1350
|
function taskState(ctx, body, g) { return writeAs(ctx, '/api/boards/tasks/state', body, g); }
|
|
1286
1351
|
/** A new Board task, by the same function as the page's Add a task (POST /api/boards/tasks/add; `pmos task add`). body: { ws, board, initiative, title, start?, due?, owner? }. */
|
|
1287
1352
|
function taskAdd(ctx, body, g) { return writeAs(ctx, '/api/boards/tasks/add', body, g); }
|
|
1353
|
+
/** A task's edit, by the same function as the Viewer's (POST /api/boards/tasks/edit; `pmos task set`). body: { ws, board, task, section?, start?, due?, owner?, notes? }. */
|
|
1354
|
+
function taskEdit(ctx, body, g) { return writeAs(ctx, '/api/boards/tasks/edit', body, g); }
|
|
1288
1355
|
|
|
1289
1356
|
/** The workflow one initiative runs and where it stands in it, as the Board's row has it (boardRow: wf, wfStage, wfStages, ended), with the
|
|
1290
1357
|
* board it is on. For `pmos workflow of|move|switch` and the initiative chat's opening (bug 2026-10-25: an agent that could not see the
|
|
@@ -1372,4 +1439,4 @@ function meetingBoards(ctx) {
|
|
|
1372
1439
|
return { list, detail };
|
|
1373
1440
|
}
|
|
1374
1441
|
|
|
1375
|
-
module.exports = { prefixes: ['/api/boards'], handle, move, switchWorkflow, taskState, taskAdd, initiativeWorkflow, seedInitiative, stageTasks, itemsOf, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, workflowRowOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
|
|
1442
|
+
module.exports = { prefixes: ['/api/boards'], handle, move, switchWorkflow, taskState, taskAdd, taskEdit, initiativeWorkflow, seedInitiative, stageTasks, itemsOf, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, workflowRowOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* routes-live.js — what the Live pill reads (batch 6 item 2, canvas XrrAGrill "Live pill · every scenario"; pm/cozy-live-pill.js).
|
|
3
|
+
*
|
|
4
|
+
* GET /api/live → { ok, sessions: [row], titles: { [initiative id]: title } }
|
|
5
|
+
* row = the /api/sessions fields the pill needs: id, ws, name, auto_name, name_by, agent, origin, automatic, shown, created,
|
|
6
|
+
* lastOutputAt, touched_at, exited_at, auto_ended, outcome { ok } | null, initiative, hx { title, turn } | null
|
|
7
|
+
* titles = the initiatives those sessions work on, by id, from each workspace's records (kept 60 s per workspace)
|
|
8
|
+
*
|
|
9
|
+
* Read-only. The pill shows on every page, so it reads this small answer every 10 s rather than the whole of /api/sessions; the
|
|
10
|
+
* times the PM touched a session are kept by server.js (touchSession: opened on Home, typed or answered). Nothing is written. */
|
|
11
|
+
|
|
12
|
+
const TITLES_MS = 60000;
|
|
13
|
+
const cache = new Map(); // workspace root → { at, titles }
|
|
14
|
+
|
|
15
|
+
function titlesOf(ctx, ws) {
|
|
16
|
+
const w = ctx.getWs ? ctx.getWs(ws) : null;
|
|
17
|
+
if (!w || !w.root || typeof ctx.initiativeIndex !== 'function') return {};
|
|
18
|
+
const c = cache.get(w.root);
|
|
19
|
+
if (c && Date.now() - c.at < TITLES_MS) return c.titles;
|
|
20
|
+
const titles = {};
|
|
21
|
+
try { for (const g of ctx.initiativeIndex(w.root).initiatives || []) if (g && g.id) titles[g.id] = g.title || g.id; } catch { /* a folder with no records names none */ }
|
|
22
|
+
cache.set(w.root, { at: Date.now(), titles });
|
|
23
|
+
return titles;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const iniOf = (s) => s.initiative || ((/^chat:(?:init|board):([^:]+)/.exec(String(s.origin || '')) || [])[1]) || null;
|
|
27
|
+
|
|
28
|
+
function rowOf(s) {
|
|
29
|
+
return {
|
|
30
|
+
id: s.id, ws: s.ws, name: s.name, auto_name: s.auto_name || null, name_by: s.name_by || null, agent: s.agent, origin: s.origin || null,
|
|
31
|
+
automatic: !!s.automatic, shown: s.shown, created: s.created || null, lastOutputAt: s.lastOutputAt || null,
|
|
32
|
+
touched_at: s.touched_at || null, exited_at: s.exited_at || null, auto_ended: !!s.auto_ended,
|
|
33
|
+
outcome: s.outcome ? { ok: s.outcome.ok !== false } : null, initiative: s.initiative || null,
|
|
34
|
+
hx: s.hx ? { title: s.hx.title || null, turn: s.hx.turn || null } : null,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function handle(req, res, url, ctx) {
|
|
39
|
+
if (url.pathname !== '/api/live') return false;
|
|
40
|
+
if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
|
|
41
|
+
let list = [];
|
|
42
|
+
try { list = ctx.sessionList ? ctx.sessionList() : []; } catch { list = []; }
|
|
43
|
+
const sessions = list.map(rowOf);
|
|
44
|
+
const titles = {};
|
|
45
|
+
for (const s of sessions) {
|
|
46
|
+
const id = iniOf(s); if (!id || titles[id]) continue;
|
|
47
|
+
const t = titlesOf(ctx, s.ws)[id]; if (t) titles[id] = t;
|
|
48
|
+
}
|
|
49
|
+
ctx.json(res, { ok: true, sessions, titles });
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = { prefixes: ['/api/live'], handle, rowOf };
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
/* task-cli.js — `pmos task …`: an initiative's tasks from a terminal, so an agent the PM asks can add, close or move them (Wawan,
|
|
3
3
|
* 2026-10-25: "I made instruction to move, but agent still ask to move myself from Board"; feedback batch 5: one kind of task).
|
|
4
4
|
*
|
|
5
|
-
* pmos task add <initiative> "<title>" [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]
|
|
5
|
+
* pmos task add <initiative> "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]
|
|
6
6
|
* a new task, by the same function as the page's Add a task (lib/routes-boards.js taskAdd, POST /api/boards/tasks/add)
|
|
7
|
+
* pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start …|none] [--owner <who>] [--notes <text>]
|
|
8
|
+
* place tasks under a workflow stage of their initiative, or change their dates, owner or notes, by the same function as the Viewer's
|
|
9
|
+
* edit (lib/routes-boards.js taskEdit, POST /api/boards/tasks/edit). The Tasks section groups tasks by stage (feedback batch 6:
|
|
10
|
+
* an agent asked to group tasks by stage had no command for it).
|
|
7
11
|
* pmos task list <initiative> [--all] its open tasks (To do, In progress); --all adds Done, Won't do and Archived
|
|
8
12
|
* pmos task state <task> [<task> …] --to <state> [--why <text>]
|
|
9
13
|
* set each task's state: To do, In progress, Done, Won't do or Archived, by the same function as the Board's press
|
|
@@ -11,7 +15,8 @@
|
|
|
11
15
|
*
|
|
12
16
|
* ONE KIND OF TASK. The list holds the initiative's Board tasks, its breakdown items (the plan-items ledger, lib/task-items.js) and its
|
|
13
17
|
* current stage's To finish entries, which become tasks the first time they are read (routes-boards stageTasks). `state` closes any of
|
|
14
|
-
* them. A task
|
|
18
|
+
* them. A task's stage (--stage) is its place in the breakdown, never its state, and it never moves the initiative: the initiative's
|
|
19
|
+
* workflow stage is `pmos workflow of|move`. Who wrote a
|
|
15
20
|
* line is the call path (lib/actor.js), never an argument. Exit codes: 0 done, 1 refused, 2 usage. Nothing is sent. */
|
|
16
21
|
const path = require('path');
|
|
17
22
|
const { execFileSync } = require('child_process');
|
|
@@ -22,22 +27,25 @@ const B = require(repoScript('boards.js'));
|
|
|
22
27
|
const TI = require('./task-items.js');
|
|
23
28
|
const rowsLib = require('./initiative-rows.js');
|
|
24
29
|
|
|
25
|
-
const COMMANDS = { task: ['add', 'list', 'state'] };
|
|
30
|
+
const COMMANDS = { task: ['add', 'list', 'state', 'set'] };
|
|
26
31
|
const USAGE = [
|
|
27
|
-
'usage: pmos task add|list|state — an initiative\'s tasks, the ones the PM sees in its Tasks section',
|
|
28
|
-
' pmos task add <initiative> "<title>" [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]',
|
|
32
|
+
'usage: pmos task add|list|state|set — an initiative\'s tasks, the ones the PM sees in its Tasks section',
|
|
33
|
+
' pmos task add <initiative> "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]',
|
|
29
34
|
' Add a task. Every new task goes here; pmos item add is the older breakdown record.',
|
|
35
|
+
' pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>]',
|
|
36
|
+
' Group tasks under a stage of the initiative\'s workflow (key or name; none takes it out), or change dates, owner or notes.',
|
|
30
37
|
' pmos task list <initiative> [--all] its open tasks; --all adds Done, Won\'t do and Archived',
|
|
31
38
|
' pmos task state <task> [<task> …] --to <state> [--why <text>]',
|
|
32
39
|
' Set each task\'s state when the PM asks: To do, In progress, Done, Won\'t do or Archived. The page shows it at once.',
|
|
33
40
|
' Give --why with Done: it is the evidence the PM reads.',
|
|
34
41
|
' There is one kind of task: Board tasks, breakdown items and the current stage\'s To finish tasks all list and close here.',
|
|
35
|
-
'
|
|
42
|
+
' The Tasks section groups tasks by the workflow\'s stages: --stage places a task there. It never changes the task\'s state or',
|
|
43
|
+
' moves the initiative. Move the initiative with pmos workflow move.',
|
|
36
44
|
' every command: [--json] [--root <dir>]. Nothing is sent.',
|
|
37
45
|
];
|
|
38
46
|
const BOOL = new Set(['json', 'help', 'all']);
|
|
39
|
-
const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes']);
|
|
40
|
-
const ONLY = { add: ['due', 'start', 'owner', 'notes'], list: ['all'], state: ['to', 'why'] };
|
|
47
|
+
const VALUE = new Set(['to', 'why', 'root', 'due', 'start', 'owner', 'notes', 'stage']);
|
|
48
|
+
const ONLY = { add: ['due', 'start', 'owner', 'notes', 'stage'], list: ['all'], state: ['to', 'why'], set: ['due', 'start', 'owner', 'notes', 'stage'] };
|
|
41
49
|
const OPEN = new Set(['To do', 'In progress']);
|
|
42
50
|
/** The PM's words for a state: any case, with or without the apostrophe or the space. */
|
|
43
51
|
function stateOf(s) {
|
|
@@ -45,6 +53,15 @@ function stateOf(s) {
|
|
|
45
53
|
return { todo: 'To do', inprogress: 'In progress', doing: 'In progress', done: 'Done', wontdo: "Won't do", archived: 'Archived', archive: 'Archived' }[k] || null;
|
|
46
54
|
}
|
|
47
55
|
|
|
56
|
+
/** A stage the PM or agent names (its key or its name, any case) → its key in the initiative's workflow, '' for none, or null. */
|
|
57
|
+
function stageKey(stages, s) {
|
|
58
|
+
const k = String(s || '').trim().toLowerCase();
|
|
59
|
+
if (k === 'none' || k === '-') return '';
|
|
60
|
+
const n = (x) => String(x || '').toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
61
|
+
const hit = (stages || []).find((x) => String(x.key).toLowerCase() === k || n(x.name) === n(k) || n(x.key) === n(k));
|
|
62
|
+
return hit ? hit.key : null;
|
|
63
|
+
}
|
|
64
|
+
|
|
48
65
|
function parse(argv) {
|
|
49
66
|
const pos = []; const flags = {};
|
|
50
67
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -70,7 +87,7 @@ function boardsCtx(root, stateDir) {
|
|
|
70
87
|
const w = { id: driver.wsIdOf(root), name: path.basename(root), root };
|
|
71
88
|
return { w, ctx: { getWs: () => w, workspaceList: () => [w], stateDirFor: () => stateDir, selfRoot: path.resolve(__dirname, '..', '..') } };
|
|
72
89
|
}
|
|
73
|
-
const line = (t) => `${t.id} · ${t.state} · ${t.title}${t.kind === 'Epic' ? ' (epic)' : ''}${t.due ? ' · due ' + t.due : ''}`;
|
|
90
|
+
const line = (t) => `${t.id} · ${t.state} · ${t.title}${t.kind === 'Epic' ? ' (epic)' : ''}${t.stage ? ' · under ' + t.stage : ''}${t.due ? ' · due ' + t.due : ''}`;
|
|
74
91
|
/** The workflow row of an initiative, deriving the rows when they are still being read. */
|
|
75
92
|
function rowOf(boards, ctx, w, id) {
|
|
76
93
|
let r = boards.initiativeWorkflow(ctx, w, id);
|
|
@@ -85,7 +102,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
85
102
|
const json = !!flags.json;
|
|
86
103
|
if (!verb || verb === 'help' || verb === '--help' || verb === '-h' || flags.help) { for (const l of USAGE) say(l); return verb ? 0 : 1; }
|
|
87
104
|
if (!COMMANDS.task.includes(verb)) { say(`unknown task command "${verb}" — one of ${COMMANDS.task.join(', ')}`); return 2; }
|
|
88
|
-
if (verb === 'add' && pos.length > 2) { say('usage: pmos task add <initiative> "<title>" [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]'); return 2; }
|
|
105
|
+
if (verb === 'add' && pos.length > 2) { say('usage: pmos task add <initiative> "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]'); return 2; }
|
|
89
106
|
if ('by' in flags || 'via' in flags) { say(`attribution is set from the call path; --${'by' in flags ? 'by' : 'via'} is not accepted`); return 2; }
|
|
90
107
|
for (const k of Object.keys(flags)) {
|
|
91
108
|
if (!BOOL.has(k) && !VALUE.has(k)) { say(`unknown option --${k}`); return 2; }
|
|
@@ -106,23 +123,32 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
106
123
|
const tasksOf = (id) => {
|
|
107
124
|
const r = rowOf(boards, ctx, w, id);
|
|
108
125
|
const board = r.ok ? r.board.id : null;
|
|
109
|
-
const
|
|
110
|
-
const
|
|
126
|
+
const F = boards.foldOf(ctx, w), S = F.sections || new Map();
|
|
127
|
+
const stageOf = (tid, from) => (S.has(tid) ? S.get(tid) : (from && from.stage) || ''); // the group the Tasks section shows it under
|
|
128
|
+
const own = [...(F.tasks || new Map()).values()].filter((t) => t.initiative === id).map((t) => ({ ...t, stage: stageOf(t.id, t.from) }));
|
|
129
|
+
const items = TI.rowsOf(root, new Set([id]), board).map((x) => ({ id: x.uid, board, kind: 'Task', title: x.title, state: x.status, owner: x.owner, due: x.end, store: 'item', stage: stageOf(x.uid) }));
|
|
111
130
|
return own.concat(items);
|
|
112
131
|
};
|
|
113
132
|
|
|
114
133
|
if (verb === 'add') {
|
|
115
134
|
const [id, title] = pos;
|
|
116
|
-
if (!id || title === undefined) { say('usage: pmos task add <initiative> "<title>" [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]'); return 2; }
|
|
135
|
+
if (!id || title === undefined) { say('usage: pmos task add <initiative> "<title>" [--stage <stage>] [--due YYYY-MM-DD] [--start YYYY-MM-DD] [--owner <who>] [--notes <text>]'); return 2; }
|
|
117
136
|
const r = rowOf(boards, ctx, w, id);
|
|
118
137
|
if (!r.ok) return fail(r.error);
|
|
138
|
+
const stages = r.row.wfStages || [];
|
|
139
|
+
const sec = flags.stage !== undefined ? stageKey(stages, flags.stage) : null;
|
|
140
|
+
if (flags.stage !== undefined && sec == null) return fail(`"${flags.stage}" is not a stage of ${id}'s workflow: one of ${stages.map((x) => x.key).join(', ')}, or none`, 2);
|
|
119
141
|
const body = { ws: w.id, board: r.board.id, initiative: id, title };
|
|
120
142
|
for (const k of ['due', 'start', 'owner', 'notes']) if (flags[k] !== undefined) body[k] = flags[k];
|
|
121
143
|
const a = boards.taskAdd(ctx, body, g);
|
|
122
144
|
if (!a.body || a.body.ok !== true) return fail((a.body && a.body.error) || 'the write was refused');
|
|
123
145
|
const t = a.body.item;
|
|
124
|
-
if (
|
|
125
|
-
|
|
146
|
+
if (sec) {
|
|
147
|
+
const e = boards.taskEdit(ctx, { ws: w.id, board: r.board.id, task: t.uid, section: sec }, g);
|
|
148
|
+
if (!e.body || e.body.ok !== true) return fail(`added ${t.uid}, but it was not placed under ${sec}: ${(e.body && e.body.error) || 'the write was refused'}`);
|
|
149
|
+
}
|
|
150
|
+
if (json) say(JSON.stringify({ ok: true, task: { id: t.uid, board: t.board, title: t.title, state: t.status, owner: t.owner, start: t.start, due: t.end, ...(sec ? { stage: sec } : {}) } }));
|
|
151
|
+
else say(`✓ added ${t.uid} · ${t.status} · ${t.title}${sec ? ' · under ' + sec : ''}${t.end ? ' · due ' + t.end : ''}. The initiative's Tasks section shows it. Nothing was sent.`);
|
|
126
152
|
return 0;
|
|
127
153
|
}
|
|
128
154
|
|
|
@@ -131,11 +157,55 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
131
157
|
try { boards.seedInitiative(ctx, w, id); } catch { /* the To finish tasks are made on the next read */ }
|
|
132
158
|
const all = tasksOf(id);
|
|
133
159
|
const shown = flags.all ? all : all.filter((t) => OPEN.has(t.state));
|
|
134
|
-
if (json) { say(JSON.stringify({ ok: true, tasks: shown.map((t) => ({ id: t.id, board: t.board, kind: t.kind, title: t.title, state: t.state, owner: t.owner, due: t.due, ...(t.from ? { from: t.from } : {}) })) })); return 0; }
|
|
160
|
+
if (json) { say(JSON.stringify({ ok: true, tasks: shown.map((t) => ({ id: t.id, board: t.board, kind: t.kind, title: t.title, state: t.state, owner: t.owner, due: t.due, stage: t.stage || '', ...(t.from ? { from: t.from } : {}) })) })); return 0; }
|
|
135
161
|
if (!shown.length) { say(all.length ? `No open task on ${id}. --all lists the ${all.length} closed.` : `No task on ${id}.`); return 0; }
|
|
136
162
|
for (const t of shown) say(line(t));
|
|
137
163
|
return 0;
|
|
138
164
|
}
|
|
165
|
+
/** A task by its id: a Board task, or a breakdown item with the board its initiative is on. */
|
|
166
|
+
const findTask = (folded, id) => {
|
|
167
|
+
let t = B.taskOf(folded, id);
|
|
168
|
+
if (!t && TI.isItemId(id)) {
|
|
169
|
+
// a breakdown item: the Board's press writes it to the plan-items ledger (lib/task-items.js)
|
|
170
|
+
const it = TI.itemOf(root, id);
|
|
171
|
+
const r = it ? rowOf(boards, ctx, w, it.initiative) : null;
|
|
172
|
+
if (it && r && r.ok) t = { id, board: r.board.id, initiative: it.initiative, title: it.title, state: TI.STATE_OF[it.state] };
|
|
173
|
+
}
|
|
174
|
+
return t;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
if (verb === 'set') {
|
|
178
|
+
const keys = ['stage', 'due', 'start', 'owner', 'notes'].filter((k) => flags[k] !== undefined);
|
|
179
|
+
if (!pos.length || !keys.length) { say('usage: pmos task set <task> [<task> …] [--stage <stage>|none] [--due YYYY-MM-DD|none] [--start YYYY-MM-DD|none] [--owner <who>] [--notes <text>]'); return 2; }
|
|
180
|
+
const folded = boards.foldOf(ctx, w);
|
|
181
|
+
const done = [], refused = [];
|
|
182
|
+
for (const id of pos) {
|
|
183
|
+
const t = findTask(folded, id);
|
|
184
|
+
if (!t) { refused.push({ task: id, error: `no task ${id}; pmos task list <initiative> names them` }); continue; }
|
|
185
|
+
const body = { ws: w.id, board: t.board, task: id };
|
|
186
|
+
if (flags.stage !== undefined) {
|
|
187
|
+
const r = rowOf(boards, ctx, w, t.initiative);
|
|
188
|
+
const stages = r.ok ? r.row.wfStages || [] : [];
|
|
189
|
+
const sec = stageKey(stages, flags.stage);
|
|
190
|
+
if (sec == null) { refused.push({ task: id, error: `"${flags.stage}" is not a stage of ${t.initiative}'s workflow: one of ${stages.map((x) => x.key).join(', ')}, or none` }); continue; }
|
|
191
|
+
body.section = sec;
|
|
192
|
+
}
|
|
193
|
+
for (const k of ['due', 'start']) if (flags[k] !== undefined) body[k] = String(flags[k]).toLowerCase() === 'none' ? '' : flags[k];
|
|
194
|
+
for (const k of ['owner', 'notes']) if (flags[k] !== undefined) body[k] = flags[k];
|
|
195
|
+
const e = boards.taskEdit(ctx, body, g);
|
|
196
|
+
if (!e.body || e.body.ok !== true) refused.push({ task: id, error: (e.body && e.body.error) || 'the write was refused' });
|
|
197
|
+
else done.push({ task: id, title: t.title, set: Object.fromEntries(keys.map((k) => [k, k === 'stage' ? body.section : body[k]])) });
|
|
198
|
+
}
|
|
199
|
+
const what = (x) => Object.entries(x).map(([k, v]) => (k === 'stage' ? (v ? 'under ' + v : 'under no stage') : v === '' ? 'no ' + k : k + ' ' + v)).join(', ');
|
|
200
|
+
if (json) say(JSON.stringify({ ok: !refused.length, done, refused }));
|
|
201
|
+
else {
|
|
202
|
+
for (const d of done) say(`✓ ${d.task} ${what(d.set)}: ${d.title}`);
|
|
203
|
+
for (const x of refused) say(`✗ ${x.task}: ${x.error}`);
|
|
204
|
+
if (done.length) say(' The page shows it. Nothing was sent.');
|
|
205
|
+
}
|
|
206
|
+
return refused.length ? 1 : 0;
|
|
207
|
+
}
|
|
208
|
+
|
|
139
209
|
// state
|
|
140
210
|
if (!pos.length || !flags.to) { say('usage: pmos task state <task> [<task> …] --to <state> [--why <text>]'); return 2; }
|
|
141
211
|
const to = stateOf(flags.to);
|
|
@@ -143,13 +213,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
143
213
|
const folded = boards.foldOf(ctx, w);
|
|
144
214
|
const done = [], refused = [];
|
|
145
215
|
for (const id of pos) {
|
|
146
|
-
|
|
147
|
-
if (!t && TI.isItemId(id)) {
|
|
148
|
-
// a breakdown item: the Board's press writes it to the plan-items ledger (lib/task-items.js)
|
|
149
|
-
const it = TI.itemOf(root, id);
|
|
150
|
-
const r = it ? rowOf(boards, ctx, w, it.initiative) : null;
|
|
151
|
-
if (it && r && r.ok) t = { id, board: r.board.id, title: it.title, state: TI.STATE_OF[it.state] };
|
|
152
|
-
}
|
|
216
|
+
const t = findTask(folded, id);
|
|
153
217
|
if (!t) { refused.push({ task: id, error: `no task ${id}; pmos task list <initiative> names them` }); continue; }
|
|
154
218
|
if (t.state === to) { done.push({ task: id, title: t.title, state: to, same: true }); continue; }
|
|
155
219
|
const r = boards.taskState(ctx, { ws: w.id, board: t.board, task: id, state: to, ...(flags.why ? { why: flags.why } : {}) }, g);
|
|
@@ -165,4 +229,4 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
165
229
|
return refused.length ? 1 : 0;
|
|
166
230
|
}
|
|
167
231
|
|
|
168
|
-
module.exports = { run, COMMANDS, USAGE, stateOf };
|
|
232
|
+
module.exports = { run, COMMANDS, USAGE, stateOf, stageKey };
|
|
@@ -50,7 +50,9 @@ function rowsOf(root, ids, board) {
|
|
|
50
50
|
const it = f.items[id];
|
|
51
51
|
if (!it || it.proposed || !ids.has(it.initiative)) continue;
|
|
52
52
|
out.push({ uid: it.id, key: '', kind: 'Task', src: 'pmos', store: 'item', title: it.title, status: STATE_OF[it.state] || 'To do', blocked: !!it.blocked, owner: ownerName(it.owner),
|
|
53
|
-
notes: it.note || '', ini: it.initiative, epic: null, start: it.start || null, end: it.due || null, ref: it.id, board
|
|
53
|
+
notes: it.note || '', ini: it.initiative, epic: null, start: it.start || null, end: it.due || null, ref: it.id, board,
|
|
54
|
+
// the breakdown's own stage (plan-tree) and order: the one view places the item in the workflow stage of the same name
|
|
55
|
+
...(it.stage ? { itemStage: it.stage } : {}), ...(Number.isFinite(it.order) ? { order: it.order } : {}) });
|
|
54
56
|
}
|
|
55
57
|
return out;
|
|
56
58
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
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
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>]
|
|
14
|
+
* pmos workflow move <initiative> --stage <key|name|number> [--why <text>]
|
|
15
15
|
* pmos workflow switch <initiative> --to <workflow id> [--stage <key|name>] [--why <text>]
|
|
16
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
17
|
* write routes (lib/routes-boards.js move, switchWorkflow) outside HTTP, so the checks, the warnings and the boards.jsonl line are the
|
|
@@ -45,7 +45,7 @@ const USAGE = [
|
|
|
45
45
|
' pmos workflow judge --board <id> --id <initiative> --stage <key> --undo',
|
|
46
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
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>]',
|
|
48
|
+
' pmos workflow move <initiative> --stage <key|name|number> [--why <text>]',
|
|
49
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
50
|
' pmos workflow switch <initiative> --to <workflow id> [--stage <key|name>] [--why <text>]',
|
|
51
51
|
' Put the initiative on another workflow, when the PM asks. Without --stage it lands where the Board\'s switch puts it.',
|
|
@@ -179,14 +179,14 @@ function ofLines(r) {
|
|
|
179
179
|
const out = [`${row.title} (${row.id}) runs ${row.wf.name} (${row.wf.id}) on the board ${r.board.name}.`];
|
|
180
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
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>.
|
|
182
|
+
out.push(`Move it: pmos workflow move ${row.id} --stage <key>. Moving the initiative changes no task; a task's group (pmos task set --stage) is its place in the breakdown, not its state.`);
|
|
183
183
|
return out;
|
|
184
184
|
}
|
|
185
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
186
|
|
|
187
187
|
function onInitiative(verb, { pos, flags, json, say, fail, root, stateDir, actor }) {
|
|
188
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];
|
|
189
|
+
const usage = { of: 'pmos workflow of <initiative>', move: 'pmos workflow move <initiative> --stage <key|name|number> [--why <text>]', switch: 'pmos workflow switch <initiative> --to <workflow id> [--stage <key|name>] [--why <text>]' }[verb];
|
|
190
190
|
if (!id) { say('usage: ' + usage); return 2; }
|
|
191
191
|
if (verb === 'move' && !flags.stage) { say('usage: ' + usage); return 2; }
|
|
192
192
|
if (verb === 'switch' && !flags.to) { say('usage: ' + usage); return 2; }
|
|
@@ -205,6 +205,12 @@ function onInitiative(verb, { pos, flags, json, say, fail, root, stateDir, actor
|
|
|
205
205
|
const g = { ok: true, actor };
|
|
206
206
|
const base = { ws: w.id, board: before.board.id, id, ...(flags.why ? { why: flags.why } : {}) };
|
|
207
207
|
let to = flags.stage;
|
|
208
|
+
// a stage by its number, as pmos workflow of numbers them (batch 7 item 2: "--stage 5" was refused)
|
|
209
|
+
if (/^\d+$/.test(String(to || '').trim()) && verb === 'move') {
|
|
210
|
+
const st = (before.row.wfStages || [])[Number(to) - 1];
|
|
211
|
+
if (!st) return fail(`there is no stage ${to}: ${before.row.wf.name} has ${(before.row.wfStages || []).length} stages`);
|
|
212
|
+
to = st.key;
|
|
213
|
+
}
|
|
208
214
|
let r;
|
|
209
215
|
if (verb === 'move') {
|
|
210
216
|
// Product feature: the Board's move names the stage; a key of Product feature reads as its name
|
|
@@ -33,7 +33,8 @@ const finish = async (code) => {
|
|
|
33
33
|
};
|
|
34
34
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
/* three hours ago, but never before today's midnight: the line says "today" at any hour */
|
|
37
|
+
const CHECKED = new Date(Math.max(Date.now() - 3 * 3600e3, new Date().setHours(0, 0, 0, 0))).toISOString();
|
|
37
38
|
const CHANGES = [
|
|
38
39
|
{ key: 'k-move', op: 'move', milestone: 'pilot-live', date: '2026-12-02', why: 'Was Nov 18. Jira moved epic DSC-41 to sprint 24, which ends Dec 1.', src: { kind: 'jira', label: 'Jira, read 2h ago' } },
|
|
39
40
|
{ key: 'k-add', op: 'add', name: 'Partner SSO cut-over', date: '2027-03-15', waits: ['microsite-signin'], why: 'Partner SSO joined the program yesterday. Its ◆ Deliver is Mar 15, 2027.', src: { kind: 'member', label: 'Partner SSO' } },
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.417.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.417.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -38,6 +38,10 @@ const finish = async (code) => {
|
|
|
38
38
|
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
39
39
|
|
|
40
40
|
/** Every line of a ledger the routes append to, wherever the repository keeps it. */
|
|
41
|
+
// a stage move is a move line, or (batch 7 item 4) the ini-wf line that pins a Product feature initiative to a stage the board has no column for
|
|
42
|
+
const isMove = (l) => l.kind === 'move' || (l.kind === 'ini-wf' && !!l.moved);
|
|
43
|
+
const toOf = (l) => (l.kind === 'ini-wf' ? l.moved.to : l.to);
|
|
44
|
+
const sameStage = (a, b) => String(a).toLowerCase() === String(b).toLowerCase(); // a stored Product feature key against its name
|
|
41
45
|
const lines = (name) => {
|
|
42
46
|
const out = [];
|
|
43
47
|
const walk = (d) => { for (const e of fs.readdirSync(d, { withFileTypes: true })) { if (e.name === '.git') continue; const p = path.join(d, e.name); if (e.isDirectory()) walk(p); else if (e.name === name) out.push(...fs.readFileSync(p, 'utf8').split('\n').filter(Boolean).map((x) => JSON.parse(x))); } };
|
|
@@ -188,17 +192,17 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
|
|
|
188
192
|
const I = await open('/premium-initiative.html?id=pa-one&ws=' + encodeURIComponent(B.ws) + '&board=' + encodeURIComponent(B.id));
|
|
189
193
|
const ip = I.page;
|
|
190
194
|
const viaMore = async (pg, label) => { await pg.click('#czViewer:not([hidden]) [data-cz-vw="more"]'); await until(() => pg.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); await pg.click(`#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${label}"))`); }; // the Overview's other views, Open the full record and Sprint sit under ⋯ (XvATasks)
|
|
191
|
-
const landed = await until(() => ip.evaluate(() => { const q = new URLSearchParams(location.search); return location.pathname === '/premium.html' && q.get('ini') === 'pa-one' && !!q.get('ws') && !!q.get('board') && !!document.querySelector('
|
|
195
|
+
const landed = await until(() => ip.evaluate(() => { const q = new URLSearchParams(location.search); return location.pathname === '/premium.html' && q.get('ini') === 'pa-one' && !!q.get('ws') && !!q.get('board') && !!document.querySelector('#czViewer .iv-sc'); }), 60000);
|
|
192
196
|
ok('I0 the expand link lands on Home with the initiative selected, ws and board kept', !!landed, await ip.evaluate(() => location.href));
|
|
193
|
-
await ip.click('#czViewer .
|
|
197
|
+
await ip.click('#czViewer [data-cz-vw="more"]').then(() => ip.click('.cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("All tasks"))')); // the initiative's page (canvas HbC): its + drills into Tasks
|
|
194
198
|
await until(() => ip.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-hi-v]')), 60000);
|
|
195
199
|
await (async (pg) => { if (await pg.$('#czViewer [data-hi-view="stage"]')) await pg.click('#czViewer [data-hi-view="stage"]'); else await viaMore(pg, 'Stage'); })(ip);
|
|
196
200
|
const bar = await until(() => ip.evaluate(() => { const v = document.querySelector('#czViewer:not([hidden])'); if (!v || !v.querySelector('[data-ov-move]')) return null; const cur = v.querySelector('[data-ov-move][aria-pressed="true"]'); return { moves: [...v.querySelectorAll('[data-ov-move]')].map((x) => x.dataset.ovMove), cur: cur ? cur.dataset.ovMove : '', life: [...v.querySelectorAll('[data-ov-life]')].map((x) => x.dataset.ovLife) }; }), 60000);
|
|
197
201
|
ok('I1 the Overview offers the stages, the current one pressed, and the lifecycle presses', !!bar && bar.moves.length > 1 && !!bar.cur && bar.moves.indexOf(bar.cur) < bar.moves.length - 1 && bar.life.join() === 'on-hold,cancelled', JSON.stringify(bar) + ' ' + (await ip.evaluate(() => (document.querySelector('#czViewer .cz-vw-body') || {}).innerText || 'no Viewer')).slice(0, 400));
|
|
198
|
-
const n0 = lines('boards.jsonl').filter(
|
|
202
|
+
const n0 = lines('boards.jsonl').filter(isMove).length;
|
|
199
203
|
const next = bar ? bar.moves[bar.moves.indexOf(bar.cur) + 1] : '';
|
|
200
204
|
await ip.click(`#czViewer [data-ov-move="${next}"]`);
|
|
201
|
-
ok('I2 a stage press records one move line', await until(() => { const L = lines('boards.jsonl').filter(
|
|
205
|
+
ok('I2 a stage press records one move line', await until(() => { const L = lines('boards.jsonl').filter(isMove); return L.length === n0 + 1 && L[L.length - 1].id === 'pa-one' && sameStage(toOf(L[L.length - 1]), next); }), JSON.stringify(lines('boards.jsonl').filter(isMove).slice(-1)));
|
|
202
206
|
ok('I2 the Overview then shows the new stage pressed', await until(() => ip.evaluate((n) => !!document.querySelector(`#czViewer [data-ov-move="${n}"][aria-pressed="true"]`), next)));
|
|
203
207
|
const lif0 = lines('lifecycle.jsonl').length;
|
|
204
208
|
await ip.click('#czViewer [data-ov-life="on-hold"]');
|
|
@@ -208,17 +212,17 @@ const ALLOWED = /^\/api\/(?:boards\/(?:asks\/(?:add|accept|decline)|move|archive
|
|
|
208
212
|
await ip.click('#czViewer [data-cz-vw="back"]'); // ← from Stage: the initiative's page again (canvas HbCDrill)
|
|
209
213
|
// the card (stage card D): its last node, the next stage, opens the move popover with Move now and Back; Back always asks for a reason,
|
|
210
214
|
// and the move line carries it (InStage)
|
|
211
|
-
const openNext = async () => { await until(() => ip.evaluate(() => !!document.querySelector('.
|
|
215
|
+
const openNext = async () => { await until(() => ip.evaluate(() => !!document.querySelector('.iv-sc [data-iv-next]')), 30000); await ip.click('.iv-sc [data-iv-next]'); return until(() => ip.evaluate(() => !!document.querySelector('.hi-pop [data-hi-goback]'))); };
|
|
212
216
|
const back = await openNext();
|
|
213
217
|
ok('I4 the card\'s next stage opens Move to the next stage now and Back', back && await ip.evaluate(() => /^Move to .+ now$/.test(((document.querySelector('.hi-pop [data-hi-go]') || {}).textContent || '').trim())));
|
|
214
218
|
if (back) {
|
|
215
|
-
const m0 = lines('boards.jsonl').filter(
|
|
219
|
+
const m0 = lines('boards.jsonl').filter(isMove).length;
|
|
216
220
|
await ip.click('.hi-pop [data-hi-goback]');
|
|
217
221
|
const asked = await until(() => ip.evaluate(() => { const d = document.querySelector('.hi-pop[role="dialog"]'); return d ? { go: d.querySelector('[data-hi-go]').disabled, chips: d.querySelectorAll('[data-hi-why]').length } : null; }));
|
|
218
|
-
ok('I4 Back asks why first: Move back waits for a reason and records nothing yet', !!asked && asked.go === true && asked.chips === 4 && lines('boards.jsonl').filter(
|
|
222
|
+
ok('I4 Back asks why first: Move back waits for a reason and records nothing yet', !!asked && asked.go === true && asked.chips === 4 && lines('boards.jsonl').filter(isMove).length === m0, JSON.stringify(asked));
|
|
219
223
|
await ip.click('.hi-pop [data-hi-why="New research"]'); await ip.fill('.hi-pop #hiWhy', 'Interviews changed the scope');
|
|
220
224
|
await ip.click('.hi-pop [data-hi-go]');
|
|
221
|
-
ok('I4 Move back records one move line with the reason as its why', await until(() => { const L = lines('boards.jsonl').filter(
|
|
225
|
+
ok('I4 Move back records one move line with the reason as its why', await until(() => { const L = lines('boards.jsonl').filter(isMove); const x = L[L.length - 1]; return L.length === m0 + 1 && x.id === 'pa-one' && sameStage(toOf(x), bar.cur) && x.why === 'Back: New research. Interviews changed the scope'; }), JSON.stringify(lines('boards.jsonl').filter((l) => l.kind === 'move').slice(-1)));
|
|
222
226
|
ok('I4 the Undo toast shows after the move', await until(() => ip.evaluate(() => { const t = document.querySelector('#hiToast'); return !!t && !t.hidden && /moved to/.test(t.textContent) && !!t.querySelector('[data-hi-undo]'); })));
|
|
223
227
|
await openNext();
|
|
224
228
|
await ip.click('.hi-pop [data-hi-auto]');
|