create-pmos 0.567.0 → 0.569.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 +27 -27
- 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/scripts/gate-initiative.sh +29 -0
- package/payload/scripts/workflow-state.js +36 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/cli.md +1 -1
- package/workspace/guide/initiatives-and-next-steps.md +20 -1
- package/workspace/lib/artefact-mirror.js +121 -0
- package/workspace/lib/artefacts-cli.js +15 -1
- package/workspace/lib/driver-decide.js +2 -0
- package/workspace/lib/engine/workflow-state.js +36 -1
- package/workspace/lib/engine/workflows.js +71 -7
- package/workspace/lib/jira-cli.js +1 -0
- package/workspace/lib/jira-tickets.js +23 -0
- package/workspace/lib/kind-control.js +232 -0
- package/workspace/lib/outcome-props.js +21 -1
- package/workspace/lib/rehearse-read.js +7 -3
- package/workspace/lib/rehearse.js +30 -2
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-artefacts.js +4 -1
- package/workspace/lib/routes-boards.js +50 -2
- package/workspace/lib/routes-initiatives.js +3 -1
- package/workspace/lib/routes-kind-control.js +95 -0
- package/workspace/lib/today-cli.js +19 -0
- package/workspace/lib/vendor/scripts/workflow-state.js +36 -1
- package/workspace/lib/work-kind.js +16 -4
- package/workspace/lib/workflows-store.js +2 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/ini-agent.js +16 -6
- package/workspace/public/pm/ini-kind.js +59 -0
- package/workspace/public/pm/ini-view.css +23 -0
- package/workspace/public/pm/ini-view.js +5 -2
- package/workspace/run-tests.js +9 -0
- package/workspace/test-lists/kind-workflows.json +5 -0
- package/workspace/test-lists/launch-rerun-gaps.json +4 -0
|
@@ -226,11 +226,23 @@ function createAndPlace(ctx, w, boardId, input, actor, tie) {
|
|
|
226
226
|
* (Settings opens on home), and that workflow is adopted into this workspace's library first, as a switch does. PMOS still reads the BRD
|
|
227
227
|
* and proposes a switch. Never throws: a new initiative is made even when this line cannot be written.
|
|
228
228
|
* boardId: the board the initiative is on; else its domain board (products/<domain>/) or the workspace board. → the workflow id | null */
|
|
229
|
-
function startOnDefault(ctx, w, iniId, actor, { boardId = null, recordPath = null } = {}) {
|
|
229
|
+
function startOnDefault(ctx, w, iniId, actor, { boardId = null, recordPath = null, kind = null } = {}) {
|
|
230
230
|
try {
|
|
231
231
|
const file = ledgerFile(ctx, w);
|
|
232
232
|
const dir = ctx.stateDirFor ? ctx.stateDirFor(w) : null;
|
|
233
233
|
if (!file || !dir || isSelf(ctx, w)) return null;
|
|
234
|
+
// W5: the kind of work sets the default. Project and Full SDLC start on their own built-in workflow; Product management on the default.
|
|
235
|
+
const k = WK.valid(kind) ? kind : recordKind(w.root, recordPath);
|
|
236
|
+
if (k !== 'product') {
|
|
237
|
+
const def = WF.forKind(WS.library(dir), k);
|
|
238
|
+
const fr = frameFor(ctx, w);
|
|
239
|
+
const dm = recordPath ? /^products\/([^/]+)\//.exec(recordPath) : null;
|
|
240
|
+
const bid = boardId || (dm && fr.boards.some((b) => b.id === dm[1] && b.kind === 'domain') ? dm[1] : w.id);
|
|
241
|
+
const board = fr.boards.find((b) => b.id === bid);
|
|
242
|
+
if (!board || board.self) return null;
|
|
243
|
+
append(file, actor, { kind: 'ini-wf', board: board.id, id: iniId, wf: def.id, why: 'the ' + WK.LABEL[k] + ' workflow: the kind of work sets it', start: true });
|
|
244
|
+
return def.id;
|
|
245
|
+
}
|
|
234
246
|
let lib = WS.library(dir), from = null;
|
|
235
247
|
if (!lib.defaultId) {
|
|
236
248
|
const home = ctx.getWs ? ctx.getWs(null) : null;
|
|
@@ -251,6 +263,36 @@ function startOnDefault(ctx, w, iniId, actor, { boardId = null, recordPath = nul
|
|
|
251
263
|
} catch { return null; }
|
|
252
264
|
}
|
|
253
265
|
|
|
266
|
+
/** The `kind:` of an initiative record (lib/work-kind.js kindOf: no line or no file reads as Product management). */
|
|
267
|
+
function recordKind(root, recordPath) {
|
|
268
|
+
if (!root || !recordPath) return 'product';
|
|
269
|
+
try {
|
|
270
|
+
const text = fs.readFileSync(path.resolve(root, recordPath), 'utf8');
|
|
271
|
+
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
272
|
+
const line = m ? m[1].split(/\r?\n/).find((l) => /^kind:/.test(l)) : null;
|
|
273
|
+
return WK.kindOf(line ? line.slice(5) : '');
|
|
274
|
+
} catch { return 'product'; }
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** A kind change (POST /api/initiatives/kind, `pmos initiative set … --kind`): an initiative that runs its OLD kind's default workflow moves to
|
|
278
|
+
* the new kind's, its stage mapped by meaning (scripts/workflows.js MEANING: Plan to Plan, Build to Execute, Release to Close). The switch line
|
|
279
|
+
* says what changed in one sentence. A workflow the PM picked by hand is left alone. Never throws. → { switched, wf?, line } */
|
|
280
|
+
function kindSwitch(ctx, w, id, from, to, actor) {
|
|
281
|
+
const line = WK.switchLine(from, to);
|
|
282
|
+
try {
|
|
283
|
+
if (!w || isSelf(ctx, w) || WK.kindOf(from) === WK.kindOf(to)) return { switched: false, line };
|
|
284
|
+
const r = initiativeWorkflow(ctx, w, id);
|
|
285
|
+
if (!r.ok) return { switched: false, line };
|
|
286
|
+
const lib = libOf(foldOf(ctx, w));
|
|
287
|
+
const cur = (r.row.wf && r.row.wf.id) || WF.PRODUCT_FEATURE_ID;
|
|
288
|
+
if (!WF.isKindDefault(lib, WK.kindOf(from), cur)) return { switched: false, line, kept: cur };
|
|
289
|
+
const target = WF.forKind(lib, WK.kindOf(to));
|
|
290
|
+
if (target.id === cur) return { switched: false, line };
|
|
291
|
+
const out = switchWorkflow(ctx, { ws: w.id, board: r.board.id, id, wf: target.id, why: line, pmos: true }, { ok: true, actor });
|
|
292
|
+
return out.body && out.body.ok ? { switched: true, wf: target.id, moved: out.body.moved, line } : { switched: false, line, error: out.body && out.body.error };
|
|
293
|
+
} catch (e) { return { switched: false, line, error: String((e && e.message) || e).slice(0, 200) }; }
|
|
294
|
+
}
|
|
295
|
+
|
|
254
296
|
// ── boards of a workspace ─────────────────────────────────────────────────────────────────────────
|
|
255
297
|
const isSelf = (ctx, w) => !!(ctx.selfRoot && w && path.resolve(w.root) === path.resolve(ctx.selfRoot));
|
|
256
298
|
|
|
@@ -559,6 +601,12 @@ function boardRow(board, base, folded, lib) {
|
|
|
559
601
|
row.oneStage = { ...row.oneStage, stage: row.wfStage.key, step: row.wfStage.key, label: OS.labelOf(row.wfStage.key) };
|
|
560
602
|
}
|
|
561
603
|
if (wx.own) { row.stage = (wx.stages.find((x) => x.key === wx.stage) || {}).name || row.stage; row.cat = null; row.stageSource = 'move'; }
|
|
604
|
+
// launch simulation W6: an initiative on a workflow other than Product feature (a Project's, a Full SDLC's, a library one) shows that
|
|
605
|
+
// workflow's stage name, as the chip draws it (public/pm/stage-chip.js stageName): Initiate, Done test, never the eight-step word its
|
|
606
|
+
// first key `triage` also names. The CLI and the lists read this label. A PM word (shipped, on hold, cancelled) still wins.
|
|
607
|
+
if (row.wfStage && row.wfStage.name && row.wf && row.wf.id !== WF.PRODUCT_FEATURE_ID && !['shipped', 'on-hold', 'cancelled'].includes(one.stage)) {
|
|
608
|
+
row.oneStage = { ...row.oneStage, label: row.wfStage.name, wf: row.wf.id };
|
|
609
|
+
}
|
|
562
610
|
// batch 26 item 5: an initiative in its workflow's terminal stage is finished, so it is never late or at risk. Every surface (the Board's
|
|
563
611
|
// tone, dot, late line and edge tabs, Home, Kanban, the program rollups) reads the status this leaves and row.closed.
|
|
564
612
|
// workspace grill W2: the status from what PMOS read, a passed date, or a risk the PM confirmed on a program milestone; else No signal.
|
|
@@ -1904,4 +1952,4 @@ function meetingBoards(ctx) {
|
|
|
1904
1952
|
return { list, detail };
|
|
1905
1953
|
}
|
|
1906
1954
|
|
|
1907
|
-
module.exports = { prefixes: ['/api/boards'], handle, tasksOfIni, postFrame, needRows, itemsOf, readLedger, foldOf, epicsOf, rowsOfBoard, invalidateRows: (w) => { rowsLib.invalidate(w.root); rowCache.delete(w.root); }, move, switchWorkflow, taskState, taskAdd, taskEdit, writeAs, taskDelete, taskRestore, initiativeWorkflow, seedInitiative, stageTasks, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, startOnDefault, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, taskSpanOf, workflowRowOf, closedOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
|
|
1955
|
+
module.exports = { prefixes: ['/api/boards'], handle, tasksOfIni, postFrame, needRows, itemsOf, readLedger, foldOf, epicsOf, rowsOfBoard, invalidateRows: (w) => { rowsLib.invalidate(w.root); rowCache.delete(w.root); }, move, switchWorkflow, taskState, taskAdd, taskEdit, writeAs, taskDelete, taskRestore, initiativeWorkflow, seedInitiative, stageTasks, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, startOnDefault, kindSwitch, recordKind, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, taskSpanOf, workflowRowOf, closedOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
|
|
@@ -655,9 +655,11 @@ async function handle(req, res, url, ctx) {
|
|
|
655
655
|
if (!g.ok) return answer(ctx, res, g), true;
|
|
656
656
|
const r = writer.setKind(w.root, body.id, body.kind, { actor: g.actor });
|
|
657
657
|
if (!r.ok) { ctx.json(res, { ok: false, status: r.status, error: r.error, field: r.field }, r.status); return true; }
|
|
658
|
+
// W5: the kind sets the default workflow, so an initiative on its old kind's default moves to the new kind's (stages mapped by meaning)
|
|
659
|
+
const sw = r.same ? null : require('./routes-boards.js').kindSwitch(ctx, w, r.id, r.from, r.kind, g.actor);
|
|
658
660
|
rowsLib.invalidate(w.root);
|
|
659
661
|
if (ctx.invalidateNeedsAgg) ctx.invalidateNeedsAgg(w.id);
|
|
660
|
-
ctx.json(res, { ok: true, id: r.id, from: r.from, kind: r.kind, sig: sigOf(w.root) });
|
|
662
|
+
ctx.json(res, { ok: true, id: r.id, from: r.from, kind: r.kind, ...(sw ? { workflow: sw } : {}), sig: sigOf(w.root) });
|
|
661
663
|
return true;
|
|
662
664
|
}
|
|
663
665
|
// split or merge initiatives (feedback batch 11 item 14; lib/split-merge.js): the editor's button or ✓ on Claude's card, Undo, and ✕ Not now
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* routes-kind-control.js — the Viewer's Project and Full SDLC section (launch simulation W5; boards WfA and WfB). READ ONLY.
|
|
3
|
+
*
|
|
4
|
+
* GET /api/kind-control?ws=&ini=<id>
|
|
5
|
+
* → { ok, kind: 'product' } Product management: the Viewer shows what it shows today
|
|
6
|
+
* → { ok, kind: 'sdlc', gate, line? } lib/kind-control.js sdlc
|
|
7
|
+
* → { ok, kind: 'project', gate, rows, critical, ontrack, proposal, goLive, baselineAt, line? } lib/kind-control.js project
|
|
8
|
+
* line: the last kind change on the initiative's workflow ("Kind changed to Project …"), written by routes-boards.js kindSwitch.
|
|
9
|
+
*
|
|
10
|
+
* Every value comes through the readers the pmos verbs use (lib/rehearse-read.js snapshotOf for tasks, links, the committed end and the goals;
|
|
11
|
+
* lib/people-store.js for People; the task ledgers for the baseline), never a typed status. A reader that fails leaves its part out. */
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const KC = require('./kind-control.js');
|
|
15
|
+
const WK = require('./work-kind.js');
|
|
16
|
+
|
|
17
|
+
const fail = (status, error) => ({ status, body: { ok: false, error } });
|
|
18
|
+
const okBody = (body) => ({ status: 200, body: { ok: true, ...body } });
|
|
19
|
+
const ID_RE = /^[a-z0-9][a-z0-9._-]{0,120}$/;
|
|
20
|
+
|
|
21
|
+
function readJsonl(file) {
|
|
22
|
+
let text = '';
|
|
23
|
+
try { text = fs.readFileSync(file, 'utf8'); } catch { return []; }
|
|
24
|
+
const out = [];
|
|
25
|
+
for (const raw of text.split('\n')) { if (!raw.trim()) continue; try { out.push(JSON.parse(raw)); } catch { /* a torn line */ } }
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
/** The record's front matter keys this section reads. */
|
|
29
|
+
function recordOf(root, id) {
|
|
30
|
+
const file = path.join(root, 'planning', 'initiatives', id + '.md');
|
|
31
|
+
let text = '';
|
|
32
|
+
try { text = fs.readFileSync(file, 'utf8'); } catch {
|
|
33
|
+
try { const got = require('./initiative-rows.js').rowsFor(root); const r = got && got.ok ? got.rows.find((x) => x.id === id) : null; if (r && r.record) text = fs.readFileSync(path.resolve(root, r.record), 'utf8'); } catch { return null; }
|
|
34
|
+
}
|
|
35
|
+
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
36
|
+
if (!m) return null;
|
|
37
|
+
const fm = {};
|
|
38
|
+
for (const l of m[1].split(/\r?\n/)) { const k = /^([a-z_]+):\s*(.*)$/.exec(l); if (k && !(k[1] in fm)) fm[k[1]] = k[2].trim().replace(/^"(.*)"$/, '$1').replace(/^'(.*)'$/, '$1'); }
|
|
39
|
+
return fm;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** One initiative's section. o: { today?, snapshot?, people? } for a test. */
|
|
43
|
+
function control(ctx, q, o = {}) {
|
|
44
|
+
const w = ctx && ctx.getWs ? ctx.getWs(q.ws || null) : null;
|
|
45
|
+
if (!w || !w.root) return fail(404, 'no such workspace');
|
|
46
|
+
const id = String(q.ini || '');
|
|
47
|
+
if (!ID_RE.test(id)) return fail(400, 'ini is an initiative id');
|
|
48
|
+
const fm = recordOf(w.root, id);
|
|
49
|
+
if (!fm) return fail(404, 'no initiative record for ' + id);
|
|
50
|
+
const kind = WK.kindOf(fm.kind);
|
|
51
|
+
if (kind === 'product') return okBody({ kind });
|
|
52
|
+
const stateDir = ctx.stateDirFor ? ctx.stateDirFor(w) : null;
|
|
53
|
+
// the last kind change on the workflow, said once
|
|
54
|
+
let line = null, baselineAt = null;
|
|
55
|
+
try {
|
|
56
|
+
const RB = require('./routes-boards.js'), f = RB.ledgerFile(ctx, w);
|
|
57
|
+
for (const e of f ? readJsonl(f) : []) {
|
|
58
|
+
if (!e || e.kind !== 'ini-wf' || e.id !== id) continue;
|
|
59
|
+
if (typeof e.why === 'string' && /^Kind changed to /.test(e.why)) line = e.why;
|
|
60
|
+
if (!baselineAt && e.moved && e.moved.from === 'plan' && e.moved.to !== 'plan') baselineAt = e.at || null;
|
|
61
|
+
}
|
|
62
|
+
} catch { /* no workflow ledger */ }
|
|
63
|
+
if (kind === 'sdlc') return okBody({ ...KC.sdlc({ record: fm }), ...(line ? { line } : {}) });
|
|
64
|
+
|
|
65
|
+
const today = o.today || new Date().toISOString().slice(0, 10);
|
|
66
|
+
let snap;
|
|
67
|
+
try { snap = o.snapshot || require('./rehearse-read.js').snapshotOf(w.root, { today, stateDir: stateDir || undefined }); } catch { snap = { tasks: [], links: [], rows: [], goals: [] }; }
|
|
68
|
+
const tasks = (snap.tasks || []).filter((x) => x && x.ini === id);
|
|
69
|
+
const row = (snap.rows || []).find((r) => r.id === id) || null;
|
|
70
|
+
const goal = (snap.goals || []).find((g) => (g.moves || []).includes(id)) || null;
|
|
71
|
+
let people = o.people;
|
|
72
|
+
if (!people) { try { const v = require('./people-store.js').view(w.root); people = v && v.ok ? v.people : []; } catch { people = []; } }
|
|
73
|
+
// the baseline: each task's dates when the initiative left Plan, read from both task ledgers
|
|
74
|
+
const lines = [];
|
|
75
|
+
try { const TS = require('./task-store.js'), s = TS.storeFor(w.root); if (s) lines.push(...readJsonl(s.file)); } catch { /* none */ }
|
|
76
|
+
try { lines.push(...readJsonl(require('./plan-ledgers.js').ledgerPath(w.root, 'plan-items'))); } catch { /* none */ }
|
|
77
|
+
try { const f = require('./routes-boards.js').ledgerFile(ctx, w); if (f) lines.push(...readJsonl(f).filter((e) => e && (e.kind === 'task' || e.kind === 'task-update'))); } catch { /* none */ }
|
|
78
|
+
lines.sort((a, b) => String(a.at || '').localeCompare(String(b.at || '')));
|
|
79
|
+
const baseline = KC.baselineOf(lines, new Set(tasks.map((x) => x.uid || x.key)), baselineAt);
|
|
80
|
+
const m = KC.project({ today, title: fm.title || (row && row.title) || id, goal: goal ? { id: goal.id, title: goal.title, byAt: goal.byAt } : null, end: row && row.end,
|
|
81
|
+
record: fm, tasks, links: snap.links || [], baseline, baselineAt, people });
|
|
82
|
+
return okBody({ ...m, ...(line ? { line } : {}) });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const respond = (ctx, res, r) => { ctx.json(res, r.body, r.status); return true; };
|
|
86
|
+
|
|
87
|
+
module.exports = {
|
|
88
|
+
prefixes: ['/api/kind-control'],
|
|
89
|
+
control, recordOf,
|
|
90
|
+
handle: async (req, res, url, ctx) => {
|
|
91
|
+
if (url.pathname !== '/api/kind-control') return false;
|
|
92
|
+
if (req.method !== 'GET') return respond(ctx, res, fail(405, 'GET only'));
|
|
93
|
+
return respond(ctx, res, control(ctx, Object.fromEntries(url.searchParams)));
|
|
94
|
+
},
|
|
95
|
+
};
|
|
@@ -77,6 +77,24 @@ async function moveOf(call, ws, { wait = WAIT_MS } = {}) {
|
|
|
77
77
|
return { ok: true, ws, source: 'your-move', count: r.rows.length, rows: r.rows.map(slim), older: r.older.map(slim) };
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
/* A refuted outcome's ✦ next step (launch simulation W2) waits for the PM's ✓ under the initiative's ✦. With a server, Your move lists it.
|
|
81
|
+
* Without one, the cards did not: `pmos today` said "Nothing needs you" while it waited (W6). It joins as a kind-1 card, like a due check. */
|
|
82
|
+
const clip = (v, n) => { const t = String(v == null ? '' : v).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1).replace(/\s+\S*$/, '') + '…' : t; };
|
|
83
|
+
function withRefuted(out, root) {
|
|
84
|
+
let list = [];
|
|
85
|
+
try { list = require('./outcome-props.js').waiting(root, today.stateDirOf(root)); } catch { return out; }
|
|
86
|
+
if (!list.length) return out;
|
|
87
|
+
const O = require('./outcomes.js');
|
|
88
|
+
const add = list.filter((x) => !out.cards.some((c) => c.run_id === 'refuted:' + x.ini)).map((x) => ({
|
|
89
|
+
id: `${out.ws}|refuted:${x.ini}`, run_id: `refuted:${x.ini}`, ws: out.ws, kind: 1, source: 'outcomes', row_kind: 'refuted', initiative_id: x.ini,
|
|
90
|
+
cause: `✦ ${O.NEXT_WORDS[x.next] || 'A next step'}: ${x.title}. Its outcome check said it did not work; your ✓ picks the next step.`.slice(0, 200),
|
|
91
|
+
evidence: clip(x.say, 240), act: { label: 'Open', cli: `pmos outcomes propose ${x.ini}` },
|
|
92
|
+
}));
|
|
93
|
+
if (!add.length) return out;
|
|
94
|
+
const cards = today.rank([...out.cards, ...add]);
|
|
95
|
+
return { ...out, cards, count: cards.length, next: null };
|
|
96
|
+
}
|
|
97
|
+
|
|
80
98
|
function printMove(say, mv, cards) {
|
|
81
99
|
const waiting = ((cards && cards.cards) || []).filter((c) => c.kind === 2);
|
|
82
100
|
const n = mv.count + waiting.length;
|
|
@@ -145,6 +163,7 @@ async function run(argv, { say, call }) {
|
|
|
145
163
|
if (f.wait || recordCount(root) <= AUTO_READ) { try { rowsLib.deriveNow(root); } catch { /* the banner says what could not be read */ } }
|
|
146
164
|
out = today.todayFor({ id: 'local', root }, {});
|
|
147
165
|
} finally { rowsLib.setBackground(was); }
|
|
166
|
+
if (out && out.ok) out = withRefuted(out, root);
|
|
148
167
|
}
|
|
149
168
|
if (!out.ok) { say('✗ ' + out.error); return 1; }
|
|
150
169
|
if (sessions) {
|
|
@@ -963,7 +963,26 @@ function computeWorkflowDerived(id, opts) {
|
|
|
963
963
|
'the done test is the spec (D13 as amended by D107). Land it in an earlier commit than the build, or split this PR so it lands first',
|
|
964
964
|
{ blocking: !legacy, rule });
|
|
965
965
|
};
|
|
966
|
-
|
|
966
|
+
// W5 (boards WfA/WfB/WfC, agreed 2026-11-12): the kind of work sets the gate. Full SDLC: a done test and a kill condition before the first
|
|
967
|
+
// pull request. Project: a dated plan (plan_path), never a PRD. Product management (and a record with no kind:) keeps the rules below. A
|
|
968
|
+
// PRD already on the record still satisfies the spec rung after a kind change: a gate already passed stays passed.
|
|
969
|
+
const workKind = (() => { const k = String(fm.kind || '').trim().replace(/^["']|["']$/g, ''); return k === 'sdlc' || k === 'project' ? k : 'product'; })();
|
|
970
|
+
const planPath = String(fm.plan_path || '').trim();
|
|
971
|
+
if (!doneTest && workKind === 'sdlc' && !prd) {
|
|
972
|
+
steps.push(step('spec', 'spec', 'blocked', 'Full SDLC needs a done test and a kill condition before the first pull request — never a PRD',
|
|
973
|
+
`write the done test (okf/core/templates/done-test-template.md), set done_test_path and kill: in ${recRel}`, { blocking: true, rule: 'R2' }));
|
|
974
|
+
} else if (!doneTest && workKind === 'project' && (planPath || !prd)) {
|
|
975
|
+
const planIdx = planPath ? firstAppearance(root, range, planPath) : null;
|
|
976
|
+
if (!planPath) {
|
|
977
|
+
steps.push(step('spec', 'spec', 'blocked', 'Project needs a dated plan before Execute — never a PRD',
|
|
978
|
+
`write the plan (milestones with dates and owners, go-live matching the KR date) and set plan_path in ${recRel}, or a done test`, { blocking: true, rule: 'R2' }));
|
|
979
|
+
} else if (planIdx === null) {
|
|
980
|
+
steps.push(step('spec', 'spec', 'blocked', `plan_path '${planPath}' does not exist in the repo`,
|
|
981
|
+
'create the plan the record points at, or correct plan_path', { blocking: true, rule: 'R2' }));
|
|
982
|
+
} else {
|
|
983
|
+
steps.push(orderOf(`plan ${planPath}`, planIdx, 'O1'));
|
|
984
|
+
}
|
|
985
|
+
} else if (doneTest) {
|
|
967
986
|
const dtIdx = firstAppearance(root, range, doneTest);
|
|
968
987
|
if (dtIdx === null) {
|
|
969
988
|
steps.push(step('spec', 'spec', 'blocked', `done_test_path '${doneTest}' does not exist in the repo`,
|
|
@@ -1580,7 +1599,21 @@ function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, re
|
|
|
1580
1599
|
: briefPath ? firstAppearance(root, range, briefPath) : null;
|
|
1581
1600
|
const docIdx = docPath ? firstAppearance(root, range, docPath) : null;
|
|
1582
1601
|
|
|
1602
|
+
// W6 (launch simulation rerun, 2026-11-15): the kind of work sets this ladder too, as it sets the product-code gate (W5) and the kit gate.
|
|
1603
|
+
// Full SDLC: a done test and a kill condition, never a brief. Project: a dated plan (plan_path), never a brief. A brief already on the
|
|
1604
|
+
// record still passes (a gate passed stays passed). Their deliverable is not a document: the pull requests, or the plan's milestones.
|
|
1605
|
+
const workKind = (() => { const k = String(fm.kind || '').trim().replace(/^["']|["']$/g, ''); return k === 'sdlc' || k === 'project' ? k : 'product'; })();
|
|
1606
|
+
const planPath = String(fm.plan_path || '').trim();
|
|
1607
|
+
const kindSpec = !doneTest && !exists(briefPath) && !foundBrief && (workKind === 'sdlc' || (workKind === 'project'));
|
|
1583
1608
|
if (doneTest && dtPresent && killCond) steps.push(step('brief', def.brief_label, 'done', `done test ${doneTest} + kill condition (D107)`));
|
|
1609
|
+
else if (kindSpec && workKind === 'sdlc') steps.push(step('brief', 'done test', legacy ? 'pending' : 'blocked',
|
|
1610
|
+
'Full SDLC needs a done test and a kill condition before the first pull request — never a brief or a PRD',
|
|
1611
|
+
`write the done test, set done_test_path and kill: in ${recRel} (pmos artefacts set experiment:${id} done-test check --text "…" writes both)`, { blocking: !legacy, rule: 'R2' }));
|
|
1612
|
+
else if (kindSpec && exists(planPath)) steps.push(step('brief', 'dated plan', 'done', `plan ${planPath} present`));
|
|
1613
|
+
else if (kindSpec) steps.push(step('brief', 'dated plan', legacy ? 'pending' : 'blocked',
|
|
1614
|
+
planPath ? `plan_path '${planPath}' does not exist in the repo` : 'Project needs a dated plan before Execute — never a brief or a PRD',
|
|
1615
|
+
planPath ? 'create the plan the record points at, or correct plan_path' : `write the plan (milestones with dates and owners, go-live matching the KR date) and set plan_path in ${recRel}, or a done test`,
|
|
1616
|
+
{ blocking: !legacy, rule: 'R2' }));
|
|
1584
1617
|
else if (doneTest && dtPresent) steps.push(step('brief', def.brief_label, 'blocked', 'no kill condition — an experiment states what would stop it (D107)',
|
|
1585
1618
|
`write kill: "<the result that would make us stop>" in ${recRel}`, { blocking: !legacy, rule: 'R2' }));
|
|
1586
1619
|
else if (doneTest) steps.push(step('brief', def.brief_label, 'blocked', `done_test_path '${doneTest}' does not exist in the repo`,
|
|
@@ -1594,6 +1627,8 @@ function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, re
|
|
|
1594
1627
|
{ blocking: enforce, rule: 'P1' }));
|
|
1595
1628
|
|
|
1596
1629
|
if (!flows('draft')) steps.push(skipped('draft', def.draft_label));
|
|
1630
|
+
else if (workKind !== 'product' && !exists(docPath) && !foundDraft) steps.push(step('draft', 'deliverable', 'na',
|
|
1631
|
+
workKind === 'sdlc' ? 'Full SDLC — the pull requests are the deliverable, not a document' : 'Project — the plan\'s milestones are the deliverable, not a document'));
|
|
1597
1632
|
else if (foundDraft) steps.push(step('draft', def.draft_label, 'done', `${foundDraft} — found by the repository scan`));
|
|
1598
1633
|
else if (exists(docPath)) {
|
|
1599
1634
|
const inOrder = briefIdx == null || docIdx == null ? null : docIdx >= briefIdx;
|
|
@@ -14,9 +14,14 @@
|
|
|
14
14
|
* (the factory, D65: propose-only, the PM merges) where a factory runs, else the team's agents (PMOS writes
|
|
15
15
|
* the done test and the pull request plan); Product and Project → the team
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* (
|
|
17
|
+
* switchLine(from, to) → string the one line a kind change writes on the workflow switch (the Viewer shows it)
|
|
18
|
+
*
|
|
19
|
+
* NOT A LANE (D107). The kind sits on the record beside the lane; it does not replace the lane. No model call: the pre-pick is the small
|
|
20
|
+
* word table below, and when it cannot tell it says so (cue '') instead of guessing.
|
|
21
|
+
* THE KIND SETS THE DEFAULT WORKFLOW AND GATE (launch simulation W5, boards WfA, WfB, WfC, agreed by Wawan 2026-11-12; this amends the
|
|
22
|
+
* batch-29 note that the kind was a hint only). Project starts on the Project workflow, Full SDLC on Full SDLC, Product management on the
|
|
23
|
+
* workspace default (scripts/workflows.js forKind). The Initiative Gate reads it too (scripts/workflow-state.js). Each initiative can still
|
|
24
|
+
* switch workflow; a kind change switches only an initiative that runs its old kind's default (routes-boards.js kindSwitch). */
|
|
20
25
|
|
|
21
26
|
const KINDS = Object.freeze(['product', 'sdlc', 'project']);
|
|
22
27
|
const LABEL = Object.freeze({ product: 'Product management', sdlc: 'Full SDLC', project: 'Project management' });
|
|
@@ -57,4 +62,11 @@ const factoryRuns = (root) => {
|
|
|
57
62
|
};
|
|
58
63
|
const executorOf = (kind, factory) => (kindOf(kind) !== 'sdlc' ? 'team' : factory ? 'factory' : 'team-agents');
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
/** The line a kind change writes: what the kind now is and what its gate adds (WfC: "Kind changed to Project, Plan gate now needs …"). */
|
|
66
|
+
function switchLine(from, to) {
|
|
67
|
+
const GATE = { product: 'the Build gate reads the done test and kill condition, or a PRD', sdlc: 'the first pull request now needs a done test and a kill condition', project: 'the Plan gate now needs milestone dates, owners and a go-live that matches the KR' };
|
|
68
|
+
const k = kindOf(to);
|
|
69
|
+
return 'Kind changed to ' + SHORT[k] + (from && kindOf(from) !== k ? ' from ' + SHORT[kindOf(from)] : '') + ': ' + GATE[k] + '.';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
module.exports = { KINDS, LABEL, SHORT, DEFAULT, valid, kindOf, fromName, executorOf, factoryRuns, switchLine };
|
|
@@ -76,7 +76,7 @@ function copy(stateDir, id, name, actor) {
|
|
|
76
76
|
/** An initiative here switches to a workflow saved in another workspace's library: the same definition (same id) is saved here. */
|
|
77
77
|
function adopt(stateDir, wf, actor, fromWs) {
|
|
78
78
|
if (!stateDir) return { ok: false, status: 409, error: NO_STATE };
|
|
79
|
-
if (!wf || wf.id
|
|
79
|
+
if (!wf || W.isBuiltin(wf.id)) return { ok: true, workflow: wf }; // built in everywhere (W5: Project and Full SDLC too)
|
|
80
80
|
const c = W.check({ id: wf.id, name: wf.name, icon: wf.icon, decide: wf.decide, stages: wf.stages });
|
|
81
81
|
if (!c.ok) return c;
|
|
82
82
|
append(fileOf(stateDir), actor, { kind: 'wf-save', wf: c.workflow, ...(fromWs ? { adoptedFrom: fromWs } : {}) });
|
|
@@ -85,7 +85,7 @@ function adopt(stateDir, wf, actor, fromWs) {
|
|
|
85
85
|
|
|
86
86
|
function archive(stateDir, id, archived, actor, { inUse = [] } = {}) {
|
|
87
87
|
if (!stateDir) return { ok: false, status: 409, error: NO_STATE };
|
|
88
|
-
if (
|
|
88
|
+
if (W.isBuiltin(id)) return { ok: false, status: 409, error: `${W.BUILTIN[id].name} is built in and stays.` };
|
|
89
89
|
const lib = library(stateDir);
|
|
90
90
|
if (!lib.byId.has(id)) return { ok: false, status: 404, error: 'That workflow could not be found. It may have been removed.' };
|
|
91
91
|
if (archived && inUse.length) return { ok: false, status: 409, error: `${inUse.length} ${inUse.length === 1 ? 'initiative runs' : 'initiatives run'} this workflow. Move ${inUse.length === 1 ? 'it' : 'them'} to another workflow first.`, inUse };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.569.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.569.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* A check that is already due is Your move on Home, so nothing here repeats it.
|
|
25
25
|
* Icon-only presses carry their words in aria-label and title. */
|
|
26
26
|
import { pmGet, pmPost } from './http.js';
|
|
27
|
+
import { controlHtml } from './ini-kind.js'; // W5 (boards WfA, WfB): Project control and the kind's own gate, read with the experiment
|
|
27
28
|
|
|
28
29
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
29
30
|
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
@@ -113,6 +114,7 @@ export function agentModel(A, U, id, o = {}) {
|
|
|
113
114
|
/** D107: with an experiment on record, the gate to Build is its done test and its kill condition (not the PRD and the rubric). */
|
|
114
115
|
export function gateOf(M) {
|
|
115
116
|
if (!M || !M.gate) return null;
|
|
117
|
+
if (M.gate.kind) return M.gate.kind; // W5: a Project's or a Full SDLC's own gate (kindGate)
|
|
116
118
|
return { label: 'Gate to Build', parts: [{ text: 'done test', ok: M.gate.done, ...(M.gate.done ? {} : { note: 'No done test is written yet' }) }, { text: 'kill condition', ok: M.gate.kill, ...(M.gate.kill ? {} : { note: 'No kill condition is written yet' }) }] };
|
|
117
119
|
}
|
|
118
120
|
|
|
@@ -199,13 +201,18 @@ export function comingHtml(rows, o = {}) {
|
|
|
199
201
|
/** Both sections in one holder the page can swap when the reads arrive. */
|
|
200
202
|
export function sectionsHtml(M, v, id, o = {}) {
|
|
201
203
|
const k = v && v.kind ? kindOf(v.kind) : '';
|
|
202
|
-
return `<div class="ia" data-ia="${esc(id)}"${k ? ` data-ia-kind="${k}"` : ''}>${expHtml(M, k)}${workHtml(M, o)}${comingHtml(comingUp(v, M), { all: !!o.cuAll })}</div>`;
|
|
204
|
+
return `<div class="ia" data-ia="${esc(id)}"${k ? ` data-ia-kind="${k}"` : ''}>${controlHtml(cachedControl(id), { hidden: HIDDEN })}${expHtml(M, k)}${workHtml(M, o)}${comingHtml(comingUp(v, M), { all: !!o.cuAll })}</div>`;
|
|
203
205
|
}
|
|
206
|
+
/** W5: the gate a Project or a Full SDLC initiative shows on its stage card, in place of the experiment's or the PRD's. null: Product. */
|
|
207
|
+
export function kindGate(id) { const C = cachedControl(id); return C && C.gate && C.kind && C.kind !== 'product' ? C.gate : null; }
|
|
208
|
+
const HIDDEN = new Set(); // the proposals ✕ dismissed, for this session
|
|
209
|
+
export function dismiss(key) { if (key) HIDDEN.add(key); }
|
|
204
210
|
|
|
205
211
|
/* ── the reads and the presses (the page only) ── */
|
|
206
212
|
const CACHE = new Map(), WANT = new Map(), OPEN = new Set();
|
|
207
213
|
const FRESH_MS = 30e3;
|
|
208
214
|
export const cached = (id) => (CACHE.get(id) || {}).M || null;
|
|
215
|
+
export const cachedControl = (id) => (CACHE.get(id) || {}).C || null;
|
|
209
216
|
export const allOpen = (id) => OPEN.has(id);
|
|
210
217
|
/** Read the experiment and Claude's work for one initiative, at most every 30 s; done() runs when the answer changed what shows. */
|
|
211
218
|
export function want(ws, id, done, title) {
|
|
@@ -215,16 +222,19 @@ export function want(ws, id, done, title) {
|
|
|
215
222
|
if (WANT.has(k)) return;
|
|
216
223
|
const q = ws ? 'ws=' + encodeURIComponent(ws) + '&' : '';
|
|
217
224
|
const p = Promise.all([pmGet('/api/artefacts?' + q + 'scope=' + encodeURIComponent('experiment:' + id)).catch(() => null), pmGet('/api/autonomy' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null),
|
|
218
|
-
pmGet('/api/autonomy/ahead?' + q + 'ini=' + encodeURIComponent(id) + (title ? '&title=' + encodeURIComponent(title) : '')).catch(() => null)
|
|
219
|
-
.
|
|
225
|
+
pmGet('/api/autonomy/ahead?' + q + 'ini=' + encodeURIComponent(id) + (title ? '&title=' + encodeURIComponent(title) : '')).catch(() => null),
|
|
226
|
+
pmGet('/api/kind-control?' + q + 'ini=' + encodeURIComponent(id)).catch(() => null)])
|
|
227
|
+
.then(([a, u, h, k]) => {
|
|
220
228
|
const M = agentModel(a && a.ok ? a : null, u && u.ok ? u : null, id, { ahead: h && h.ok ? h : null });
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
229
|
+
const C = k && k.ok && k.kind !== 'product' ? k : null;
|
|
230
|
+
const was = JSON.stringify([cached(id), cachedControl(id)]);
|
|
231
|
+
CACHE.set(id, { M, C, at: Date.now() });
|
|
232
|
+
if (JSON.stringify([M, C]) !== was && done) done();
|
|
224
233
|
}).finally(() => WANT.delete(k));
|
|
225
234
|
WANT.set(k, p);
|
|
226
235
|
}
|
|
227
236
|
const forget = (id) => { const c = CACHE.get(id); if (c) c.at = 0; };
|
|
237
|
+
export { forget };
|
|
228
238
|
export function toggleMore(id) { if (OPEN.has(id)) OPEN.delete(id); else OPEN.add(id); }
|
|
229
239
|
/** Coming up's own "N more" and "Fewer", kept apart from PMOS's work. */
|
|
230
240
|
export const cuOpen = (id) => OPEN.has('cu|' + id);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* pm/ini-kind.js — the Viewer's part for a Project or a Full SDLC initiative (launch simulation W5; main canvas boards WfA and WfB, agreed by
|
|
2
|
+
* Wawan 2026-11-12). Pure: Node imports it (kind-control.test.js). pm/ini-agent.js reads GET /api/kind-control with the experiment and draws
|
|
3
|
+
* this inside the same holder, so no new pattern: the PMOS's work row shape, the one ✦ proposal with icon-only ✓ and ✕.
|
|
4
|
+
*
|
|
5
|
+
* controlHtml(C, o) → '' | the section C: the route's answer (lib/kind-control.js). o: { hidden: Set of dismissed proposal keys }
|
|
6
|
+
* proposalKey(C) → the key a ✕ hides for this session
|
|
7
|
+
*
|
|
8
|
+
* PROJECT (WfA): "On track for <date>?" first (amber on a No, with the cause), then the ✦ (move the go-live milestone to its forecast; the
|
|
9
|
+
* goal and the title stay: they are Wawan's), the critical path in one line, then each task with its colour, its owner and a bar: the
|
|
10
|
+
* outline is the baseline, the fill is now. Colour comes from dates and links, never from a status someone typed. A task that is on time
|
|
11
|
+
* and has float shows only its bar (zero is silence).
|
|
12
|
+
* FULL SDLC (WfB): nothing beyond the gate, which the stage card draws (the Experiment's Who builds line is the honest one).
|
|
13
|
+
* The kind change line ("Kind changed to Project: …") shows once, at the top. */
|
|
14
|
+
|
|
15
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
16
|
+
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
17
|
+
const P = { check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', path: 'M4 12h4l3-6 3 12 3-6h3', info: 'M12 8v.01M11 12h1v5h1M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17' };
|
|
18
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
19
|
+
const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
|
|
20
|
+
const dn = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) / 864e5 : null; };
|
|
21
|
+
const RAG = { r: 'late', a: 'risk', g: 'ok', done: 'done', n: 'none' };
|
|
22
|
+
const RAG_WORDS = { r: 'Late, moves go-live', a: 'Slipping', g: 'On time', done: 'Done', n: 'No dates' };
|
|
23
|
+
|
|
24
|
+
export const proposalKey = (C) => (C && C.proposal ? C.proposal.task + '>' + C.proposal.to : '');
|
|
25
|
+
|
|
26
|
+
/** The bars: one scale for every row, from the earliest date to the latest of baseline and now. */
|
|
27
|
+
function scaleOf(rows) {
|
|
28
|
+
let lo = null, hi = null;
|
|
29
|
+
for (const r of rows) for (const x of [r.base.start, r.base.due, r.now.start, r.now.due]) { const n = dn(x); if (n == null) continue; lo = lo == null ? n : Math.min(lo, n); hi = hi == null ? n : Math.max(hi, n); }
|
|
30
|
+
return lo == null ? null : { lo, span: Math.max(1, hi - lo + 1) };
|
|
31
|
+
}
|
|
32
|
+
function barHtml(r, S) {
|
|
33
|
+
if (!S) return '';
|
|
34
|
+
const pc = (a, b) => { const s = dn(a), e = dn(b); if (s == null && e == null) return null; const x = s == null ? e : s, y = e == null ? s : e; return { l: ((x - S.lo) / S.span) * 100, w: Math.max(1.5, ((y - x + 1) / S.span) * 100) }; };
|
|
35
|
+
const b = pc(r.base.start, r.base.due), n = pc(r.now.start, r.now.due);
|
|
36
|
+
// an SVG, so the geometry is attributes, not an inline style (conformance R28-1); the colour is a class
|
|
37
|
+
const at = (g) => `x="${g.l.toFixed(2)}%" width="${g.w.toFixed(2)}%"`;
|
|
38
|
+
return `<svg class="ik-tl" aria-hidden="true" width="100%" height="16">${b ? `<rect class="bb" ${at(b)} y="1.5" height="4" rx="2"/>` : ''}${n ? `<rect class="ab ${RAG[r.rag] || 'none'}" ${at(n)} y="8" height="7" rx="3.5"/>` : ''}</svg>`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function controlHtml(C, o = {}) {
|
|
42
|
+
if (!C || !C.kind || C.kind === 'product') return '';
|
|
43
|
+
const line = C.line ? `<p class="ia-note ik-line">${esc(C.line)}</p>` : '';
|
|
44
|
+
if (C.kind !== 'project') return line ? `<section class="ia-sec ik" aria-label="Kind of work">${line}</section>` : '';
|
|
45
|
+
const T = C.ontrack || {};
|
|
46
|
+
const head = T.date ? 'On track for ' + dm(T.date) + '?' : 'On track?';
|
|
47
|
+
const card = T.answer ? `<div class="ik-card${T.answer === 'no' ? ' am' : ''}"><b>${esc(head)}</b><span>${esc(T.words || '')}</span>${T.why ? `<span>${esc(T.why)}</span>` : ''}${T.src ? `<em>${esc(T.src)}</em>` : ''}</div>` : '';
|
|
48
|
+
const hidden = o.hidden instanceof Set ? o.hidden : new Set();
|
|
49
|
+
const pk = proposalKey(C);
|
|
50
|
+
const prop = C.proposal && !hidden.has(pk) ? `<div class="ik-card pr"><b><span class="you" aria-hidden="true">✦</span> PMOS proposes</b><span>${esc(C.proposal.text)}</span>`
|
|
51
|
+
+ `<span class="ia-eb"><button type="button" class="yd-ok sm" data-ik-ok="${esc(C.proposal.task)}" data-ik-to="${esc(C.proposal.to)}" aria-label="${esc('Approve: move ' + C.proposal.title + ' to ' + dm(C.proposal.to))}" title="Approve">${SVG(P.check, 16, 2.6)}</button>`
|
|
52
|
+
+ `<button type="button" class="yd-alt sm" data-ik-no="${esc(pk)}" aria-label="Dismiss" title="Dismiss">${SVG(P.x, 16, 2)}</button></span></div>` : '';
|
|
53
|
+
const crit = C.critical && C.critical.length ? `<div class="ia-dr ik-cp"><span class="ck up" aria-hidden="true">${SVG(P.path, 12, 2.2)}</span><span><b>${esc(C.critical.join(' → '))}</b><em>Critical path: ${esc(C.critical.length + ' of ' + (C.rows || []).length)} tasks. A day lost on any of them is a day lost on go-live.</em></span></div>` : '';
|
|
54
|
+
const S = scaleOf(C.rows || []);
|
|
55
|
+
const row = (r) => `<div class="ia-dr ik-r" data-rag="${esc(r.rag)}"><span class="ik-dot ${RAG[r.rag] || 'none'}" role="img" aria-label="${esc(RAG_WORDS[r.rag] || '')}"></span><span><b${r.critical ? ' class="ik-crit"' : ''}>${esc((r.milestone ? '◇ ' : '') + r.title)}</b>`
|
|
56
|
+
+ `<em>${esc([r.owner ? r.owner + (r.ownerLinked ? '' : ' (not in People)') : 'No owner', r.critical ? 'critical path' : r.rag === 'g' ? 'has float' : '', r.rag === 'g' || r.rag === 'done' ? '' : r.words].filter(Boolean).join(' · '))}</em>${barHtml(r, S)}</span></div>`;
|
|
57
|
+
const rows = (C.rows || []).length ? `<div class="iv-folds">${C.rows.map(row).join('')}<p class="ia-note">Outline is the baseline${C.baselineAt ? ', set ' + esc(dm(C.baselineAt)) : ''}; the filled bar is now. Colour comes from dates and links, never from a status someone typed.</p></div>` : '';
|
|
58
|
+
return `<section class="ia-sec ik" aria-label="Project control" data-ik><div class="ia-th"><b>Project control</b></div>${line}${card}${prop}${crit}${rows}</section>`;
|
|
59
|
+
}
|
|
@@ -1356,3 +1356,26 @@ button.ia-xr:hover { background: var(--cz-well); }
|
|
|
1356
1356
|
.ia .yd-ok { background: var(--cz-blue); color: var(--cz-onsolid); }
|
|
1357
1357
|
.ia .yd-alt { background: var(--cz-well); color: var(--cz-ink2); }
|
|
1358
1358
|
.ia .yd-alt:disabled { opacity: .5; cursor: default; }
|
|
1359
|
+
|
|
1360
|
+
/* W5 (boards WfA, WfB): Project control — on track, the ✦, the critical path, each task's colour and baseline against now (pm/ini-kind.js) */
|
|
1361
|
+
.ik-line { padding: 0 2px 4px; }
|
|
1362
|
+
.ik-card { display: flex; flex-direction: column; gap: 4px; margin: 0 0 8px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--cz-hair); background: var(--cz-card); font-size: var(--fs-meta); line-height: 1.45; }
|
|
1363
|
+
.ik-card > b { font-weight: var(--fw-strong); }
|
|
1364
|
+
.ik-card em { font-style: normal; font-size: var(--fs-label); color: var(--cz-ink3); }
|
|
1365
|
+
.ik-card.am { background: var(--cz-latebg); color: var(--cz-late); border-color: transparent; }
|
|
1366
|
+
.ik-card.pr .you { color: var(--cz-blue); }
|
|
1367
|
+
.ik-card .ia-eb { margin-top: 6px; }
|
|
1368
|
+
.ik-r > span:not(.ik-dot) { flex: 1; min-width: 0; }
|
|
1369
|
+
.ik-crit { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
|
|
1370
|
+
.ik-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--cz-hair); }
|
|
1371
|
+
.ik-dot.ok { background: var(--cz-ok); }
|
|
1372
|
+
.ik-dot.risk { background: var(--cz-risk); }
|
|
1373
|
+
.ik-dot.late { background: var(--cz-late); }
|
|
1374
|
+
.ik-dot.done { background: var(--cz-ink3); }
|
|
1375
|
+
.ik-tl { display: block; margin-top: 4px; overflow: visible; }
|
|
1376
|
+
.ik-tl .bb { fill: none; stroke: var(--cz-ink3); stroke-width: 1; }
|
|
1377
|
+
.ik-tl .ab { fill: var(--cz-hair); }
|
|
1378
|
+
.ik-tl .ab.ok { fill: var(--cz-ok); }
|
|
1379
|
+
.ik-tl .ab.risk { fill: var(--cz-risk); }
|
|
1380
|
+
.ik-tl .ab.late { fill: var(--cz-late); }
|
|
1381
|
+
.ik-tl .ab.done { fill: var(--cz-ink3); }
|
|
@@ -411,7 +411,7 @@ const VIEWED = new Map(); // initiative id → the view drawn last (the ✦ in
|
|
|
411
411
|
const OPTS = new Map(); // initiative id → the options it was drawn with, so About can draw alone when its description arrives
|
|
412
412
|
export function viewHtml(v, o = {}) {
|
|
413
413
|
// agent-run (AwB): with an experiment on record the gate to Build reads its done test and kill condition (D107), not PRD and rubric
|
|
414
|
-
const AM = v && v.id ? IA.cached(v.id) : null, ag = IA.gateOf(AM);
|
|
414
|
+
const AM = v && v.id ? IA.cached(v.id) : null, ag = (v && v.id && IA.kindGate(v.id)) || IA.gateOf(AM); // W5: a Project's or Full SDLC's own gate first
|
|
415
415
|
if (ag && v.stage) v = { ...v, stage: { ...v.stage, gate: ag } };
|
|
416
416
|
if (v && v.id) { VIEWED.set(v.id, v); OPTS.set(v.id, o); }
|
|
417
417
|
// a merged initiative leads with where its work went, and draws no stage or tasks (they moved; its folds stay); an open one shows Claude's split or merge card under the summary (batch 11 item 14)
|
|
@@ -433,7 +433,7 @@ export function wireView(body, h) {
|
|
|
433
433
|
const agent = (id) => { if (id && VIEWED.has(id)) IA.want(wsOf(), id, () => paintAgent(id), (VIEWED.get(id) || {}).title); };
|
|
434
434
|
const paintAgent = (id) => {
|
|
435
435
|
if (idOf() !== id || !VIEWED.has(id)) return;
|
|
436
|
-
const v0 = VIEWED.get(id), M = IA.cached(id), g = IA.gateOf(M), v = g ? { ...v0, stage: { ...v0.stage, gate: g } } : v0;
|
|
436
|
+
const v0 = VIEWED.get(id), M = IA.cached(id), g = IA.kindGate(id) || IA.gateOf(M), v = g ? { ...v0, stage: { ...v0.stage, gate: g } } : v0;
|
|
437
437
|
VIEWED.set(id, v);
|
|
438
438
|
// replace only what changed: a node another press holds (a task card's day picker) is never swapped for an identical copy
|
|
439
439
|
const swap = (n, html) => { const t = document.createElement('template'); t.innerHTML = html; const x = t.content.firstElementChild; if (!x || !x.isEqualNode(n)) n.outerHTML = html; };
|
|
@@ -487,6 +487,9 @@ export function wireView(body, h) {
|
|
|
487
487
|
if (d.iaUndo) { e.preventDefault(); IA.undo(b, wsOf(), () => paintAgent(id), H.toast); return; }
|
|
488
488
|
if ('iaMore' in d) { e.preventDefault(); IA.toggleMore(id); paintAgent(id); return; }
|
|
489
489
|
if ('iaCumore' in d) { e.preventDefault(); IA.toggleCu(id); paintAgent(id); return; }
|
|
490
|
+
// W5 (WfA): the ✦ moves the go-live milestone to its forecast, through the same quick date change as the task row (Undo in the toast)
|
|
491
|
+
if (d.ikOk) { e.preventDefault(); if (H.dates) { H.dates(d.ikOk, { due: d.ikTo }); IA.forget(id); setTimeout(() => IA.want(wsOf(), id, () => paintAgent(id)), 400); } return; }
|
|
492
|
+
if (d.ikNo) { e.preventDefault(); IA.dismiss(d.ikNo); paintAgent(id); return; }
|
|
490
493
|
if (d.ivMc) { e.preventDefault(); const M = MD.measuresOf(id); mcToggle(id, d.ivMc, { proposal: !!(M && M.mode === 'open') }); if (H.redraw) H.redraw(); later(b, (r) => r.querySelector(`[data-iv-mc="${d.ivMc}"]`), true); return; }
|
|
491
494
|
if (d.abMore && AB.pressMore(b, H.redraw)) { e.preventDefault(); return; }
|
|
492
495
|
if (d.md && MD.press(b, { redraw: H.redraw, toast: H.toast })) { e.preventDefault(); return; }
|
package/workspace/run-tests.js
CHANGED
|
@@ -624,6 +624,15 @@ function traceChanges(changes, ctx) {
|
|
|
624
624
|
if (/^lib\/routes-/.test(g)) { const w = routeModule(g); if (w) return w; continue; }
|
|
625
625
|
const w = users(g); if (w) return w;
|
|
626
626
|
}
|
|
627
|
+
// a needs provider is named by its bare stem in the PROVIDERS list of the needs providers module, which requires it by path.join(__dirname, name + '.js'):
|
|
628
|
+
// that list is its user (launch simulation W6: report-structure-needs.js, named nowhere else, sent every change of routes-boards.js to
|
|
629
|
+
// every suite)
|
|
630
|
+
const NP = ['lib', 'needs-providers'].join('/') + '.js'; // built, so this file does not read as a user of it
|
|
631
|
+
if (!n && /^lib\/[\w.-]+-needs\.js$/.test(f) && f !== NP) {
|
|
632
|
+
const np = sget(NP) || '';
|
|
633
|
+
const list = /const PROVIDERS = Object\.freeze\(\[([\s\S]*?)\]\)/.exec(np);
|
|
634
|
+
if (list && new RegExp(`'${reEsc(stemOf(f))}'`).test(list[1])) { n = 1; const w = users(NP); if (w) return w; }
|
|
635
|
+
}
|
|
627
636
|
named.set(f, n);
|
|
628
637
|
if (!n && /^lib\/.*\.m?js$/.test(f)) return `no file names ${f}`;
|
|
629
638
|
return null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "launch simulation W5 (2026-11-12): the kind of work sets the default workflow and gate; Project control (colours, critical path, on track, the ✦), the Full SDLC gate, rehearse end on a Project, a Project's Jira draft as a work breakdown.",
|
|
3
|
+
"modules": ["kind-workflows.test.js"],
|
|
4
|
+
"seconds": { "kind-workflows.test.js": 4 }
|
|
5
|
+
}
|