create-pmos 0.564.0 → 0.565.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 +14 -14
- 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/workflow-state.js +21 -4
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/changelog.json +13 -0
- package/workspace/guide/cli.md +1 -0
- package/workspace/lib/board-cli.js +32 -1
- package/workspace/lib/engine/workflow-state.js +21 -4
- package/workspace/lib/initiative-cli.js +5 -1
- package/workspace/lib/report-draft.js +2 -1
- package/workspace/lib/routes-notes.js +3 -1
- package/workspace/lib/stage-read.js +155 -0
- package/workspace/lib/task-cli.js +2 -16
- package/workspace/lib/today-cli.js +18 -5
- package/workspace/lib/vendor/scripts/workflow-state.js +21 -4
- package/workspace/lib/workflow-cli.js +18 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/test-lists/stage-everywhere.json +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.565.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.565.0",
|
|
38
|
+
"at": "2026-11-12T04:27:46.732Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1296,
|
|
43
|
+
"t": "Every surface shows the one stage; pmos workflow check finds a disagreement",
|
|
44
|
+
"s": "Every surface shows the one stage; pmos workflow check finds a disagreement",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.564.0",
|
|
38
51
|
"at": "2026-11-11T14:08:23.553Z",
|
|
@@ -291,19 +304,6 @@
|
|
|
291
304
|
"k": "new"
|
|
292
305
|
}
|
|
293
306
|
]
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
"v": "0.545.0",
|
|
297
|
-
"at": "2026-11-09T10:45:44.000Z",
|
|
298
|
-
"f": 4,
|
|
299
|
-
"prs": [
|
|
300
|
-
{
|
|
301
|
-
"n": 1273,
|
|
302
|
-
"t": "Seven artefacts — model, map, lossless carry, and proposed D107",
|
|
303
|
-
"s": "Seven artefacts — model, map, lossless carry, and proposed D107",
|
|
304
|
-
"k": "new"
|
|
305
|
-
}
|
|
306
|
-
]
|
|
307
307
|
}
|
|
308
308
|
]
|
|
309
309
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
kernel-source: pmos@
|
|
2
|
-
assembled: 2026-11-
|
|
1
|
+
kernel-source: pmos@334d2b91
|
|
2
|
+
assembled: 2026-11-12
|
|
3
3
|
mode: vendor
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-12T04:27:43Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-12T04:27:43Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -351,6 +351,14 @@ function buildRange(root, { spec, whole }) {
|
|
|
351
351
|
* ordering rule; "I cannot tell" is not, and collapsing the second into the first is exactly how a
|
|
352
352
|
* shallow clone would turn every order check into a silent pass.
|
|
353
353
|
*/
|
|
354
|
+
/** The unix seconds of the commit that first added `rel`, or null when git cannot say. */
|
|
355
|
+
function addedDate(root, rel) {
|
|
356
|
+
const out = git(root, ['log', '--diff-filter=A', '--format=%ct', '--', rel]);
|
|
357
|
+
const lines = out ? out.split('\n').map((x) => x.trim()).filter(Boolean) : [];
|
|
358
|
+
const t = lines.length ? Number(lines[lines.length - 1]) : NaN;
|
|
359
|
+
return Number.isFinite(t) ? t : null;
|
|
360
|
+
}
|
|
361
|
+
|
|
354
362
|
function firstAppearance(root, range, rel) {
|
|
355
363
|
const onDisk = fs.existsSync(path.join(root, rel));
|
|
356
364
|
if (!range.ok) return onDisk ? undefined : null;
|
|
@@ -685,7 +693,12 @@ function computeWorkflowDerived(id, opts) {
|
|
|
685
693
|
// would suddenly be enforced. So the commit DATE decides whenever the range can supply it, and
|
|
686
694
|
// -1 keeps its meaning for the gate's range. Same question, asked of evidence that survives both.
|
|
687
695
|
const recIdx = firstAppearance(root, range, recRel);
|
|
688
|
-
|
|
696
|
+
// An EMPTY range (a branch level with main, a fresh clone, a kit repository on its trunk) gates nothing, so -1 there only means "committed
|
|
697
|
+
// before HEAD". It used to read every record as legacy, a record written today too, which turned the order rules off on the ladder
|
|
698
|
+
// (launch simulation W1, 2026-11-12). With nothing to gate, the record's own first commit dates it.
|
|
699
|
+
const emptyRange = range.ok && Array.isArray(range.shas) && range.shas.length === 0;
|
|
700
|
+
const addedAt = (recIdx === -1 && emptyRange) ? addedDate(root, recRel) : null;
|
|
701
|
+
const recAt = (range.dates && typeof recIdx === 'number' && recIdx >= 0) ? range.dates[recIdx] : addedAt;
|
|
689
702
|
/*
|
|
690
703
|
* `reconstructed_from` — the merge date of work whose record was written afterwards.
|
|
691
704
|
*
|
|
@@ -698,7 +711,7 @@ function computeWorkflowDerived(id, opts) {
|
|
|
698
711
|
* genuinely skipped the loop still reports blocked, which is the point of writing it down.
|
|
699
712
|
*/
|
|
700
713
|
const recon = String(fm.reconstructed_from || '').trim().slice(0, 10);
|
|
701
|
-
const legacy = recIdx === -1 ? true
|
|
714
|
+
const legacy = (recIdx === -1 && !addedAt) ? true
|
|
702
715
|
: /^\d{4}-\d{2}-\d{2}$/.test(recon) ? recon < ENFORCED_FROM
|
|
703
716
|
: recAt ? new Date(recAt * 1000).toISOString().slice(0, 10) < ENFORCED_FROM
|
|
704
717
|
: String(fm.timestamp || generatedAt(fm.generated) || '').slice(0, 10) < ENFORCED_FROM; // fallback — see ENFORCED_FROM; D74: OKF v0.2 `generated.at` stands in for `timestamp`
|
|
@@ -1735,7 +1748,11 @@ function renderLadder(w) {
|
|
|
1735
1748
|
const head = `${c(1, w.id)} · ${w.lane}${w.laneKnown ? '' : c(33, ' (unknown lane — enforcing feature)')} · ${w.anchor ? brief(w.anchor, 46) : c(31, 'unanchored')}`;
|
|
1736
1749
|
out.push('');
|
|
1737
1750
|
out.push(` ${head}`);
|
|
1738
|
-
|
|
1751
|
+
// The gate rung, not the initiative's stage: the stage the pages and `pmos initiative list` show is the Board's one stage (PM moves,
|
|
1752
|
+
// Jira, dated plan items, then these files; workspace/lib/stage-read.js). Printing the rung as "stage" gave one record four stages
|
|
1753
|
+
// (launch simulation W1, 2026-11-12). The engine never reads the Board (X29), so it names the rung and says where the stage is.
|
|
1754
|
+
out.push(` ${c(90, 'gate')} ${c(1, w.stage)}${w.legacy ? c(33, ` legacy — record predates ${w.enforced_from}, order rules report but do not fail`) : ''}`);
|
|
1755
|
+
out.push(` ${c(90, 'stage')} ${c(90, `pmos workflow of ${w.id} — the stage every page shows`)}`);
|
|
1739
1756
|
out.push(` ${c(90, '─'.repeat(78))}`);
|
|
1740
1757
|
for (const s of w.steps) {
|
|
1741
1758
|
const label = s.label.padEnd(11);
|
|
@@ -1901,7 +1918,7 @@ function main(argv) {
|
|
|
1901
1918
|
}
|
|
1902
1919
|
if (w.legacy) process.stdout.write(`ℹ️ '${w.id}' is LEGACY (record predates ${ENFORCED_FROM}) — order rules reported, not enforced.\n`);
|
|
1903
1920
|
if (w.range.error) process.stdout.write(`⚠️ order checks degraded — ${w.range.error}\n`);
|
|
1904
|
-
process.stdout.write(`✅ workflow gate PASSED — '${w.id}' (${w.lane}) at
|
|
1921
|
+
process.stdout.write(`✅ workflow gate PASSED — '${w.id}' (${w.lane}) at gate rung ${w.stage}.\n`);
|
|
1905
1922
|
return 0;
|
|
1906
1923
|
}
|
|
1907
1924
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-12T04:27:43Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/payload/state/log.md
CHANGED
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.565.0",
|
|
4
|
+
"at": "2026-11-12T04:27:46.732Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1296,
|
|
9
|
+
"t": "Every surface shows the one stage; pmos workflow check finds a disagreement",
|
|
10
|
+
"s": "Every surface shows the one stage; pmos workflow check finds a disagreement",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.564.0",
|
|
4
17
|
"at": "2026-11-11T14:08:23.553Z",
|
package/workspace/guide/cli.md
CHANGED
|
@@ -353,6 +353,7 @@ An agent writes a draft or a reading with these commands, and moves an initiativ
|
|
|
353
353
|
- `pmos workflow of <initiative>` shows the workflow the initiative runs, its current stage, and each stage numbered as done, current or skipped. It reads the same row as the Board.
|
|
354
354
|
- `pmos workflow move <initiative> --stage <key|name|number>` moves the initiative to a stage of its own workflow. A number counts from 1 in the workflow's order, so `--stage 5` is the fifth stage. `--why` adds the reason. The move writes the same line as a move on the Board, under the agent's name. On a board whose columns join two stages, such as **Build & Deliver**, the initiative still goes to the stage you name, and the joined column name means its first stage.
|
|
355
355
|
- `pmos workflow switch <initiative> --to <workflow id>` puts the initiative on another workflow. `--stage` picks the stage it lands in; without it, the stage is the one the Board's switch picks.
|
|
356
|
+
- `pmos workflow check [<initiative>]` compares the stage that each surface shows: the Board, the Viewer and `pmos workflow of`, `pmos initiative list`, and the notes and report slides. It exits 1 and names the surfaces when two of them show different stages for one initiative. `scripts/workflow-state.js` shows the CI gate rung (`gate`), not the stage.
|
|
356
357
|
|
|
357
358
|
### pmos board
|
|
358
359
|
|
|
@@ -25,7 +25,7 @@ const USAGE = [
|
|
|
25
25
|
' pmos board --mine your own items',
|
|
26
26
|
' pmos board --init <initiative> one initiative',
|
|
27
27
|
' pmos board --json the answer of GET /api/board, for scripts',
|
|
28
|
-
'Done shows the last 14 days.
|
|
28
|
+
'Done shows the last 14 days. Tasks and breakdown items both show; `pmos task list <initiative>` lists one initiative\'s tasks with their dates.',
|
|
29
29
|
];
|
|
30
30
|
const BOOL = new Set(['json', 'mine', 'help']);
|
|
31
31
|
const VALUE = new Set(['init', 'root']);
|
|
@@ -63,6 +63,36 @@ function line(it, titleOf) {
|
|
|
63
63
|
return bits.join(' · ');
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/* The initiative's tasks (launch simulation W1, 2026-11-12). The fold above holds the breakdown items only, so `pmos board` printed 0 items
|
|
67
|
+
* while `pmos task list` printed 4. Each Board task joins its column as the Board page shows it: To do → Todo, In progress → Doing,
|
|
68
|
+
* Done → Done (the last 14 days; older ones are counted). Won't do and Archived are not on the Board. The breakdown items are already in
|
|
69
|
+
* the fold, so only the Board tasks are added here (lib/stage-read.js tasksOf, the reader of `pmos task list`). */
|
|
70
|
+
const TASK_COL = { 'To do': 'todo', 'In progress': 'doing', Done: 'done' };
|
|
71
|
+
const DONE_WINDOW_MS = 14 * 86400000;
|
|
72
|
+
function addTasks(out, root, now) {
|
|
73
|
+
let SR, sw, sctx;
|
|
74
|
+
try { SR = require('./stage-read.js'); ({ w: sw, ctx: sctx } = SR.cliCtx(root)); } catch { return; }
|
|
75
|
+
if (!sctx.stateDirFor()) return;
|
|
76
|
+
const at = Number.isFinite(now) ? now : Date.parse(out.now) || Date.now();
|
|
77
|
+
const only = out.filter.startsWith('init:') ? out.filter.slice(5) : null;
|
|
78
|
+
for (const ini of out.initiatives) {
|
|
79
|
+
if (only && ini.id !== only) continue;
|
|
80
|
+
let tasks = [];
|
|
81
|
+
try { tasks = SR.tasksOf(sctx, sw, ini.id).filter((t) => t.store !== 'item'); } catch { tasks = []; }
|
|
82
|
+
for (const t of tasks) {
|
|
83
|
+
const col = TASK_COL[t.state];
|
|
84
|
+
if (!col) continue;
|
|
85
|
+
if (out.filter === 'mine' && t.owner !== 'you') continue;
|
|
86
|
+
const last = Math.max(Date.parse(t.at) || 0, ...(t.history || []).map((h) => Date.parse(h && h.at) || 0));
|
|
87
|
+
if (col === 'done' && at - last > DONE_WINDOW_MS) { out.board.doneOlder++; continue; }
|
|
88
|
+
out.items[t.id] = { id: t.id, initiative: ini.id, title: t.title, state: col, owner: t.owner || '', stageLabel: t.stage || 'task', due: t.due || null, task: true };
|
|
89
|
+
out.board[col].push(t.id);
|
|
90
|
+
ini.shown = (ini.shown || 0) + 1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
out.counts = { todo: out.board.todo.length, doing: out.board.doing.length, review: out.board.review.length, done: out.board.done.length, doneOlder: out.board.doneOlder };
|
|
94
|
+
}
|
|
95
|
+
|
|
66
96
|
async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), now } = {}) {
|
|
67
97
|
const args = argv[0] === 'board' ? argv.slice(1) : argv.slice();
|
|
68
98
|
const { pos, flags } = parse(args);
|
|
@@ -87,6 +117,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), now
|
|
|
87
117
|
try { out = boardFold.boardFor({ id: 'cli', root }, { filter, now }); }
|
|
88
118
|
catch (e) { return fail('the Board could not be read: ' + String((e && e.message) || e).slice(0, 200)); }
|
|
89
119
|
if (!out.ok) return fail(out.error, out.status === 400 ? 2 : 1);
|
|
120
|
+
addTasks(out, root, now);
|
|
90
121
|
if (json) { say(JSON.stringify(out)); return 0; }
|
|
91
122
|
const titleOf = Object.fromEntries(out.initiatives.map((i) => [i.id, i.title]));
|
|
92
123
|
const label = out.filter === 'active' ? 'Active' : out.filter === 'mine' ? 'Mine' : out.filter.slice(5);
|
|
@@ -351,6 +351,14 @@ function buildRange(root, { spec, whole }) {
|
|
|
351
351
|
* ordering rule; "I cannot tell" is not, and collapsing the second into the first is exactly how a
|
|
352
352
|
* shallow clone would turn every order check into a silent pass.
|
|
353
353
|
*/
|
|
354
|
+
/** The unix seconds of the commit that first added `rel`, or null when git cannot say. */
|
|
355
|
+
function addedDate(root, rel) {
|
|
356
|
+
const out = git(root, ['log', '--diff-filter=A', '--format=%ct', '--', rel]);
|
|
357
|
+
const lines = out ? out.split('\n').map((x) => x.trim()).filter(Boolean) : [];
|
|
358
|
+
const t = lines.length ? Number(lines[lines.length - 1]) : NaN;
|
|
359
|
+
return Number.isFinite(t) ? t : null;
|
|
360
|
+
}
|
|
361
|
+
|
|
354
362
|
function firstAppearance(root, range, rel) {
|
|
355
363
|
const onDisk = fs.existsSync(path.join(root, rel));
|
|
356
364
|
if (!range.ok) return onDisk ? undefined : null;
|
|
@@ -685,7 +693,12 @@ function computeWorkflowDerived(id, opts) {
|
|
|
685
693
|
// would suddenly be enforced. So the commit DATE decides whenever the range can supply it, and
|
|
686
694
|
// -1 keeps its meaning for the gate's range. Same question, asked of evidence that survives both.
|
|
687
695
|
const recIdx = firstAppearance(root, range, recRel);
|
|
688
|
-
|
|
696
|
+
// An EMPTY range (a branch level with main, a fresh clone, a kit repository on its trunk) gates nothing, so -1 there only means "committed
|
|
697
|
+
// before HEAD". It used to read every record as legacy, a record written today too, which turned the order rules off on the ladder
|
|
698
|
+
// (launch simulation W1, 2026-11-12). With nothing to gate, the record's own first commit dates it.
|
|
699
|
+
const emptyRange = range.ok && Array.isArray(range.shas) && range.shas.length === 0;
|
|
700
|
+
const addedAt = (recIdx === -1 && emptyRange) ? addedDate(root, recRel) : null;
|
|
701
|
+
const recAt = (range.dates && typeof recIdx === 'number' && recIdx >= 0) ? range.dates[recIdx] : addedAt;
|
|
689
702
|
/*
|
|
690
703
|
* `reconstructed_from` — the merge date of work whose record was written afterwards.
|
|
691
704
|
*
|
|
@@ -698,7 +711,7 @@ function computeWorkflowDerived(id, opts) {
|
|
|
698
711
|
* genuinely skipped the loop still reports blocked, which is the point of writing it down.
|
|
699
712
|
*/
|
|
700
713
|
const recon = String(fm.reconstructed_from || '').trim().slice(0, 10);
|
|
701
|
-
const legacy = recIdx === -1 ? true
|
|
714
|
+
const legacy = (recIdx === -1 && !addedAt) ? true
|
|
702
715
|
: /^\d{4}-\d{2}-\d{2}$/.test(recon) ? recon < ENFORCED_FROM
|
|
703
716
|
: recAt ? new Date(recAt * 1000).toISOString().slice(0, 10) < ENFORCED_FROM
|
|
704
717
|
: String(fm.timestamp || generatedAt(fm.generated) || '').slice(0, 10) < ENFORCED_FROM; // fallback — see ENFORCED_FROM; D74: OKF v0.2 `generated.at` stands in for `timestamp`
|
|
@@ -1735,7 +1748,11 @@ function renderLadder(w) {
|
|
|
1735
1748
|
const head = `${c(1, w.id)} · ${w.lane}${w.laneKnown ? '' : c(33, ' (unknown lane — enforcing feature)')} · ${w.anchor ? brief(w.anchor, 46) : c(31, 'unanchored')}`;
|
|
1736
1749
|
out.push('');
|
|
1737
1750
|
out.push(` ${head}`);
|
|
1738
|
-
|
|
1751
|
+
// The gate rung, not the initiative's stage: the stage the pages and `pmos initiative list` show is the Board's one stage (PM moves,
|
|
1752
|
+
// Jira, dated plan items, then these files; workspace/lib/stage-read.js). Printing the rung as "stage" gave one record four stages
|
|
1753
|
+
// (launch simulation W1, 2026-11-12). The engine never reads the Board (X29), so it names the rung and says where the stage is.
|
|
1754
|
+
out.push(` ${c(90, 'gate')} ${c(1, w.stage)}${w.legacy ? c(33, ` legacy — record predates ${w.enforced_from}, order rules report but do not fail`) : ''}`);
|
|
1755
|
+
out.push(` ${c(90, 'stage')} ${c(90, `pmos workflow of ${w.id} — the stage every page shows`)}`);
|
|
1739
1756
|
out.push(` ${c(90, '─'.repeat(78))}`);
|
|
1740
1757
|
for (const s of w.steps) {
|
|
1741
1758
|
const label = s.label.padEnd(11);
|
|
@@ -1901,7 +1918,7 @@ function main(argv) {
|
|
|
1901
1918
|
}
|
|
1902
1919
|
if (w.legacy) process.stdout.write(`ℹ️ '${w.id}' is LEGACY (record predates ${ENFORCED_FROM}) — order rules reported, not enforced.\n`);
|
|
1903
1920
|
if (w.range.error) process.stdout.write(`⚠️ order checks degraded — ${w.range.error}\n`);
|
|
1904
|
-
process.stdout.write(`✅ workflow gate PASSED — '${w.id}' (${w.lane}) at
|
|
1921
|
+
process.stdout.write(`✅ workflow gate PASSED — '${w.id}' (${w.lane}) at gate rung ${w.stage}.\n`);
|
|
1905
1922
|
return 0;
|
|
1906
1923
|
}
|
|
1907
1924
|
|
|
@@ -161,7 +161,11 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
161
161
|
const o = order();
|
|
162
162
|
if (o.error) return fail(o.error);
|
|
163
163
|
const byRow = new Map(o.rows.map((r) => [r.id, r]));
|
|
164
|
-
|
|
164
|
+
// the one stage, as the Board row holds it (lib/stage-read.js): a workflow move and the PM's word count, as on every page
|
|
165
|
+
const SR = require('./stage-read.js');
|
|
166
|
+
const { w: sw, ctx: sctx } = SR.cliCtx(root);
|
|
167
|
+
const read = SR.stagesOf(sctx, sw, o.placed.ranked);
|
|
168
|
+
const stage = (id) => { const a = read.get(id); return a ? a.label : lifecycle.labelOf(byRow.get(id), root); };
|
|
165
169
|
if (json) {
|
|
166
170
|
say(JSON.stringify({ ok: true, ranked: o.placed.ranked, byInit: o.placed.byInit, stages: Object.fromEntries(o.placed.ranked.map((id) => [id, stage(id)])),
|
|
167
171
|
proposals: o.placed.proposals.map((p) => ({ ...p, by: actorLib.pageName(p.by) })), documents: documentsOf(o.rows) }));
|
|
@@ -489,12 +489,13 @@ function draftOf(root, { cadence, slot, now, health } = {}) {
|
|
|
489
489
|
const lab = stageCache.get(id).get(sid);
|
|
490
490
|
return lab || cap(String(sid || ''));
|
|
491
491
|
};
|
|
492
|
+
const oneStage = require('./stage-read.js').labelReader(main, (id) => lifecycle.labelOf(rows.find((r) => r.id === id), main));
|
|
492
493
|
const integratedAll = new Set();
|
|
493
494
|
for (const r of rows) for (const w of ((factoryJoin.factoryOf(fj, r.id) || {}).items || [])) if (w && w.integrated && w.plan_item) integratedAll.add(w.plan_item);
|
|
494
495
|
const slides = slidesData({
|
|
495
496
|
product: def.product || path.basename(main), cadence, slot: theSlot, nowMs, window, cycleDays: cycle,
|
|
496
497
|
blocks, rows, itemsOf,
|
|
497
|
-
stageLabel, lifecycleOf:
|
|
498
|
+
stageLabel, lifecycleOf: oneStage, // W1: the one stage, as the Board row holds it (lib/stage-read.js)
|
|
498
499
|
rankOf: (id) => (has(plc.byInit, id) && Number.isFinite(plc.byInit[id].rank) ? plc.byInit[id].rank : Infinity),
|
|
499
500
|
isDone: (it) => it.state === 'done' || integratedAll.has(it.id),
|
|
500
501
|
});
|
|
@@ -384,13 +384,15 @@ function openInitiativesOf(w) {
|
|
|
384
384
|
else if (got.ok) {
|
|
385
385
|
const rm = ri.roadmapOf(w, ri.frameOf(w, got.rows, { now: Date.now() }));
|
|
386
386
|
const byId = new Map(got.rows.map((r) => [r.id, r]));
|
|
387
|
+
// the one stage the Board row holds (lib/stage-read.js): a workflow move counts, as on every page
|
|
388
|
+
const stageLabel = require('./stage-read.js').labelReader(w.root, (id) => lifecycle.labelOf(byId.get(id), w.root));
|
|
387
389
|
let top = 0;
|
|
388
390
|
const add = (r, dormant) => {
|
|
389
391
|
const rec = byId.get(r.id);
|
|
390
392
|
if (rec && (rec.stopped || rec.accepted)) return;
|
|
391
393
|
const isTop = !dormant && top < PICKER_TOP;
|
|
392
394
|
if (isTop) top++;
|
|
393
|
-
ranked.push({ id: r.id, title: r.title, anchor: r.anchor, intent: '', stage:
|
|
395
|
+
ranked.push({ id: r.id, title: r.title, anchor: r.anchor, intent: '', stage: stageLabel(r.id), dormant, top: isTop });
|
|
394
396
|
};
|
|
395
397
|
for (const r of rm.rows) add(r, false);
|
|
396
398
|
for (const r of rm.dormant) add(r, true);
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* stage-read.js — the ONE stage and the tasks of an initiative outside HTTP, read the way the Board reads them (launch simulation W1,
|
|
3
|
+
* 2026-11-12).
|
|
4
|
+
*
|
|
5
|
+
* The launch simulation found four answers for one record: `pmos workflow of` and the Board said Evaluate, `pmos initiative list` said
|
|
6
|
+
* Triage, and the Viewer's gate line and the ladder said something else again. The Board row (lib/routes-boards.js boardRow) already
|
|
7
|
+
* holds the one stage (row.oneStage, lib/one-stage.js stageOf): the PM's word, a Board or workflow move, Jira, dated plan items, then
|
|
8
|
+
* the spec files. Every terminal reader now takes it from there, so a terminal line and a page cannot disagree.
|
|
9
|
+
*
|
|
10
|
+
* cliCtx(root, stateDir?) → { w, ctx } the Board's routes outside HTTP: this repository as the one workspace
|
|
11
|
+
* rowOf(ctx, w, id) → initiativeWorkflow's answer, deriving the rows first when they are still being read
|
|
12
|
+
* stageOf(ctx, w, id) → { label, stage, step, setBy, source, readAt, wf: { stage, n, of } | null } | null
|
|
13
|
+
* label is what every surface prints (row.oneStage.label); wf is the workflow's own stage beside it
|
|
14
|
+
* stagesOf(ctx, w, ids) → Map id → stageOf answer
|
|
15
|
+
* labelReader(root, fallback) → (id) → label for a server surface: never starts a read, falls back while the records are read
|
|
16
|
+
* tasksOf(ctx, w, id) → every task of an initiative: its Board tasks and its breakdown items (what `pmos task list` lists)
|
|
17
|
+
* disagreements(answers) → [{ id, surfaces: { name: label } }] the initiatives two surfaces name different stages for
|
|
18
|
+
* check(root, { ids }) → { ok, checked, disagree, stages } every surface's stage, compared (`pmos workflow check`)
|
|
19
|
+
*
|
|
20
|
+
* The CI Initiative Gate is not a stage: scripts/workflow-state.js reports the gate rung (spec, contract, build …), and the engine
|
|
21
|
+
* never requires this file (X29).
|
|
22
|
+
*/
|
|
23
|
+
const path = require('path');
|
|
24
|
+
|
|
25
|
+
function cliCtx(root, stateDir) {
|
|
26
|
+
const driver = require('./driver.js');
|
|
27
|
+
const dir = stateDir === undefined ? driver.stateDirOf(root) : stateDir;
|
|
28
|
+
const w = { id: driver.wsIdOf(root), name: path.basename(root), root };
|
|
29
|
+
return { w, ctx: { getWs: () => w, workspaceList: () => [w], stateDirFor: () => dir, selfRoot: path.resolve(__dirname, '..', '..') } };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function rowOf(ctx, w, id) {
|
|
33
|
+
const boards = require('./routes-boards.js');
|
|
34
|
+
const rowsLib = require('./initiative-rows.js');
|
|
35
|
+
const was = rowsLib.setBackground(false);
|
|
36
|
+
try {
|
|
37
|
+
let r = boards.initiativeWorkflow(ctx, w, id);
|
|
38
|
+
if (r.pending) { try { rowsLib.deriveNow(w.root); } catch { /* answered below */ } r = boards.initiativeWorkflow(ctx, w, id); }
|
|
39
|
+
return r;
|
|
40
|
+
} finally { rowsLib.setBackground(was); }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The stage a Board row shows → the stageOf answer. The same rule the stage card and the chip draw. */
|
|
44
|
+
function fromRow(row) {
|
|
45
|
+
if (!row) return null;
|
|
46
|
+
const one = row.oneStage || null;
|
|
47
|
+
const st = row.wfStage || null;
|
|
48
|
+
const wf = st && st.name ? { stage: st.name, key: st.key, n: st.n, of: st.of } : null;
|
|
49
|
+
if (row.ended) return { label: row.ended.as === 'wontdo' ? "Won't do" : 'Archived', stage: 'ended', step: one ? one.step : null, setBy: 'pm', source: 'the workflow', readAt: null, wf };
|
|
50
|
+
// the chip, the stage card and the Viewer's stage words all print row.oneStage.label (public/pm/stage-chip.js, lib/initiative-premium.js)
|
|
51
|
+
if (one && one.label) return { label: one.label, stage: one.stage, step: one.step, setBy: one.setBy, source: one.source, readAt: one.readAt, wf };
|
|
52
|
+
if (wf) return { label: wf.stage, stage: null, step: null, setBy: 'pm', source: 'the workflow', readAt: null, wf };
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function stageOf(ctx, w, id) {
|
|
57
|
+
const r = rowOf(ctx, w, id);
|
|
58
|
+
return r && r.ok ? fromRow(r.row) : null;
|
|
59
|
+
}
|
|
60
|
+
function stagesOf(ctx, w, ids) {
|
|
61
|
+
const out = new Map();
|
|
62
|
+
const pass = { ...ctx, boardsPass: new Map() }; // one fold of the Board ledger for the whole list
|
|
63
|
+
for (const id of ids || []) { try { out.set(id, stageOf(pass, w, id)); } catch { out.set(id, null); } }
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** A reader for a surface that holds only a repository root and its workflow rows (the notes picker, a report's slides): id → the
|
|
68
|
+
* one stage's label. It never starts a read of the records: while they are still being read it answers with `fallback(id)`. */
|
|
69
|
+
function labelReader(root, fallback) {
|
|
70
|
+
let pass = null, w = null;
|
|
71
|
+
try { const c = cliCtx(root); w = c.w; pass = { ...c.ctx, boardsPass: new Map() }; } catch { pass = null; }
|
|
72
|
+
const boards = require('./routes-boards.js');
|
|
73
|
+
return (id) => {
|
|
74
|
+
if (pass && pass.stateDirFor()) {
|
|
75
|
+
try { const r = boards.initiativeWorkflow(pass, w, id); const a = r && r.ok ? fromRow(r.row) : null; if (a) return a.label; } catch { /* the fallback answers */ }
|
|
76
|
+
}
|
|
77
|
+
return fallback ? fallback(id) : '';
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Every task of an initiative: its Board tasks (on any board of this workspace) and its breakdown items. */
|
|
82
|
+
function tasksOf(ctx, w, id) {
|
|
83
|
+
const boards = require('./routes-boards.js');
|
|
84
|
+
const TI = require('./task-items.js');
|
|
85
|
+
const r = rowOf(ctx, w, id);
|
|
86
|
+
const board = r.ok ? r.board.id : null;
|
|
87
|
+
const F = boards.foldOf(ctx, w), S = F.sections || new Map(), MS = F.milestones || new Map(), PN = F.pins || new Map();
|
|
88
|
+
const pinOf = (tid) => (PN.has(tid) ? { pinned: PN.get(tid) } : {}); // the PM's pin on the Board timeline (batch 13 item 4); unset = the rule
|
|
89
|
+
const msOf = (tid, own) => (MS.has(tid) ? MS.get(tid) : !!own); // the PM's ◇ flag (feedback batch 11 item 3)
|
|
90
|
+
// the group the Tasks section shows it under: a stage of the workflow it ran before a switch reads as the stage that switch put it in
|
|
91
|
+
// (row.wfMap, batch 24 item 5), as on the page
|
|
92
|
+
const keys = r.ok ? (r.row.wfStages || []).map((s) => s.key) : [], M = (r.ok && r.row.wfMap) || {};
|
|
93
|
+
const placed = (k) => (k && !keys.includes(k) && keys.includes(M[k]) ? M[k] : k);
|
|
94
|
+
const sec = (tid, from) => placed(S.has(tid) ? S.get(tid) : (from && from.stage) || '');
|
|
95
|
+
const own = [...(F.tasks || new Map()).values()].filter((t) => t.initiative === id).map((t) => ({ ...t, stage: sec(t.id, t.from), milestone: msOf(t.id), ...pinOf(t.id) }));
|
|
96
|
+
const items = TI.rowsOf(w.root, new Set([id]), board).map((x) => ({ id: x.uid, board, kind: 'Task', title: x.title, state: x.status, owner: x.owner, start: x.start || null, due: x.end, store: 'item', stage: sec(x.uid), milestone: msOf(x.uid, x.milestone), ...pinOf(x.uid) }));
|
|
97
|
+
return own.concat(items);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** answers: { <surface name>: Map id → label } → the initiatives whose surfaces name different stages. A surface with no answer for
|
|
101
|
+
* an id is left out of that id's comparison (it has not read it), never counted as a disagreement. */
|
|
102
|
+
function disagreements(answers) {
|
|
103
|
+
const ids = new Set();
|
|
104
|
+
for (const m of Object.values(answers || {})) for (const id of m.keys()) ids.add(id);
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const id of ids) {
|
|
107
|
+
const surfaces = {};
|
|
108
|
+
for (const [name, m] of Object.entries(answers)) { const v = m.get(id); if (v) surfaces[name] = v; }
|
|
109
|
+
if (new Set(Object.values(surfaces)).size > 1) out.push({ id, surfaces });
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Every surface's stage for the initiatives of a repository, compared (`pmos workflow check`). → { ok, checked, disagree: [{ id, surfaces }] }
|
|
115
|
+
* Surfaces: the Board's list of rows (the Board page and its chip), the one-initiative read (the Viewer, the stage card, `pmos workflow of`),
|
|
116
|
+
* `pmos initiative list`, and the notes picker and report slides. The Board's column name joins when it is one of the eight lifecycle
|
|
117
|
+
* words (a workflow of its own names its columns as it likes). The CI gate rung (scripts/workflow-state.js) is not a stage and is not read. */
|
|
118
|
+
function check(root, { ids: only } = {}) {
|
|
119
|
+
const boards = require('./routes-boards.js');
|
|
120
|
+
const OS = require('./one-stage.js');
|
|
121
|
+
const rowsLib = require('./initiative-rows.js');
|
|
122
|
+
const { w, ctx } = cliCtx(root);
|
|
123
|
+
if (!ctx.stateDirFor()) return { ok: false, error: 'this repository has no PMOS state folder (pmos/state, state or .pmos)' };
|
|
124
|
+
const was = rowsLib.setBackground(false);
|
|
125
|
+
try {
|
|
126
|
+
try { rowsLib.deriveNow(root); } catch { /* baseRows says what could not be read */ }
|
|
127
|
+
const pass = { ...ctx, boardsPass: new Map() };
|
|
128
|
+
const base = boards.baseRows(w, pass);
|
|
129
|
+
if (!base.ok) return { ok: false, error: base.error || 'the initiative records could not be read' };
|
|
130
|
+
const fr = boards.frameFor(pass, w);
|
|
131
|
+
const ids = base.rows.map((r) => r.id).filter((id) => !only || only.includes(id));
|
|
132
|
+
if (only) for (const id of only) if (!ids.includes(id)) return { ok: false, error: `no initiative ${id} on a board of this workspace` };
|
|
133
|
+
const board = new Map(), column = new Map();
|
|
134
|
+
for (const b of fr.boards) {
|
|
135
|
+
for (const r of boards.rowsOfBoard(fr, b, base.rows)) {
|
|
136
|
+
if (!ids.includes(r.id)) continue;
|
|
137
|
+
const a = fromRow(r);
|
|
138
|
+
if (a) board.set(r.id, a.label);
|
|
139
|
+
// a column joins when it names one of the eight steps and no PM word (Shipped, On hold, Cancelled) stands over it: a shipped
|
|
140
|
+
// initiative sits in its last column by design
|
|
141
|
+
const word = a && ['shipped', 'on-hold', 'cancelled', 'ended'].includes(a.stage);
|
|
142
|
+
if (!word && r.stage && OS.STEPS.some((k) => OS.LABELS[k] === r.stage) && !r.ended) column.set(r.id, r.stage);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const one = new Map();
|
|
146
|
+
for (const id of ids) { const r = boards.initiativeWorkflow(pass, w, id); const a = r && r.ok ? fromRow(r.row) : null; if (a) one.set(id, a.label); }
|
|
147
|
+
const list = new Map([...stagesOf(ctx, w, ids)].filter(([, a]) => a).map(([id, a]) => [id, a.label]));
|
|
148
|
+
const reader = labelReader(root, () => '');
|
|
149
|
+
const notes = new Map(ids.map((id) => [id, reader(id)]).filter(([, v]) => v));
|
|
150
|
+
const disagree = disagreements({ Board: board, 'Board column': column, 'Viewer and pmos workflow of': one, 'pmos initiative list': list, 'notes and reports': notes });
|
|
151
|
+
return { ok: true, checked: ids.length, disagree, stages: Object.fromEntries(ids.map((id) => [id, one.get(id) || board.get(id) || null])) };
|
|
152
|
+
} finally { rowsLib.setBackground(was); }
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
module.exports = { cliCtx, rowOf, fromRow, stageOf, stagesOf, labelReader, tasksOf, disagreements, check };
|
|
@@ -143,22 +143,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
143
143
|
|
|
144
144
|
const cli = { isTTY: isTTY === undefined ? !!(process.stdin.isTTY && process.stdout.isTTY) : isTTY, env: env === undefined ? process.env : env };
|
|
145
145
|
const g = { ok: true, actor: actorLib.fromCli(cli), cli };
|
|
146
|
-
/** Every task of an initiative: its Board tasks
|
|
147
|
-
const tasksOf = (id) =>
|
|
148
|
-
const r = rowOf(boards, ctx, w, id);
|
|
149
|
-
const board = r.ok ? r.board.id : null;
|
|
150
|
-
const F = boards.foldOf(ctx, w), S = F.sections || new Map(), MS = F.milestones || new Map(), PN = F.pins || new Map();
|
|
151
|
-
const pinOf = (tid) => (PN.has(tid) ? { pinned: PN.get(tid) } : {}); // the PM's pin on the Board timeline (batch 13 item 4); unset = the rule
|
|
152
|
-
const msOf = (tid, own) => (MS.has(tid) ? MS.get(tid) : !!own); // the PM's ◇ flag (feedback batch 11 item 3)
|
|
153
|
-
// the group the Tasks section shows it under: a stage of the workflow it ran before a switch reads as the stage that switch put it in
|
|
154
|
-
// (row.wfMap, batch 24 item 5), as on the page
|
|
155
|
-
const keys = r.ok ? (r.row.wfStages || []).map((s) => s.key) : [], M = (r.ok && r.row.wfMap) || {};
|
|
156
|
-
const placed = (k) => (k && !keys.includes(k) && keys.includes(M[k]) ? M[k] : k);
|
|
157
|
-
const stageOf = (tid, from) => placed(S.has(tid) ? S.get(tid) : (from && from.stage) || '');
|
|
158
|
-
const own = [...(F.tasks || new Map()).values()].filter((t) => t.initiative === id).map((t) => ({ ...t, stage: stageOf(t.id, t.from), milestone: msOf(t.id), ...pinOf(t.id) }));
|
|
159
|
-
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, start: x.start || null, due: x.end, store: 'item', stage: stageOf(x.uid), milestone: msOf(x.uid, x.milestone), ...pinOf(x.uid) }));
|
|
160
|
-
return own.concat(items);
|
|
161
|
-
};
|
|
146
|
+
/** Every task of an initiative: its Board tasks and its breakdown items (lib/stage-read.js, which `pmos board` reads too). */
|
|
147
|
+
const tasksOf = (id) => require('./stage-read.js').tasksOf(ctx, w, id);
|
|
162
148
|
|
|
163
149
|
if (verb === 'add') {
|
|
164
150
|
const [id, title] = pos;
|
|
@@ -25,12 +25,22 @@ const USAGE = [
|
|
|
25
25
|
'Without a server it reads the repository and prints the Today cards, ranked by kind (1 a gate is owed, 2 a session is',
|
|
26
26
|
'waiting, 3 a step was returned to you, 4 work to check, 5 a breakdown to keep, 6 a capture, 7 a cycle review, 8 needs',
|
|
27
27
|
'repair). It does not read sessions then.',
|
|
28
|
-
'Without a server the
|
|
29
|
-
'as pending
|
|
28
|
+
'Without a server it reads the initiative records first when there are up to 100. With more, the Cycle review and',
|
|
29
|
+
'missing-anchor cards show as pending: add --wait to read them now (about 5 s for 500 records).',
|
|
30
30
|
];
|
|
31
31
|
const BOOL = new Set(['json', 'help', 'wait']);
|
|
32
32
|
const VALUE = new Set(['ws', 'root']);
|
|
33
33
|
|
|
34
|
+
const AUTO_READ = 100;
|
|
35
|
+
/** How many initiative records the repository holds (the engine's layout), or Infinity when it cannot say. */
|
|
36
|
+
function recordCount(root) {
|
|
37
|
+
try {
|
|
38
|
+
const loaded = require('./console-state').loadEngine();
|
|
39
|
+
if (!loaded.ok) return Infinity;
|
|
40
|
+
return fs.readdirSync(loaded.engine.layout(root).initiatives).filter((n) => n.endsWith('.md') && n !== 'README.md').length;
|
|
41
|
+
} catch { return Infinity; }
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
function isDir(d) { try { return fs.statSync(d).isDirectory(); } catch { return false; } }
|
|
35
45
|
|
|
36
46
|
function repoRoot(cwd) {
|
|
@@ -85,7 +95,8 @@ function print(say, out, { sessions }) {
|
|
|
85
95
|
say(` ${c.act.label}${c.act.cli ? ' · ' + c.act.cli : ''}${c.initiative_id ? ' · ' + c.initiative_id : ''}`);
|
|
86
96
|
}
|
|
87
97
|
for (const b of out.banner || []) say(`! ${b.source}: ${b.error}`);
|
|
88
|
-
|
|
98
|
+
const unread = (out.banner || []).length > 0;
|
|
99
|
+
if (!out.count) say(unread ? 'Nothing needs you in what was read. The lines marked ! were not read.' : out.next ? `Nothing needs you. Next: ${out.next.label}.` : 'Nothing needs you.');
|
|
89
100
|
if (!sessions) say('No server is running, so waiting sessions were not read.');
|
|
90
101
|
}
|
|
91
102
|
|
|
@@ -125,11 +136,13 @@ async function run(argv, { say, call }) {
|
|
|
125
136
|
}
|
|
126
137
|
}
|
|
127
138
|
if (!out || !out.ok) {
|
|
128
|
-
// a local read: nothing in this process would read a background derivation, so none starts
|
|
139
|
+
// a local read: nothing in this process would read a background derivation, so none starts. A repository of up to AUTO_READ
|
|
140
|
+
// records is read now (a product repository, a fresh kit): without that it stopped at "still reading the initiative records"
|
|
141
|
+
// (launch simulation W1, 2026-11-12). A larger one answers at once with the pending line; --wait reads it (574 records, ~5 s).
|
|
129
142
|
const rowsLib = require('./initiative-rows.js');
|
|
130
143
|
const was = rowsLib.setBackground(false);
|
|
131
144
|
try {
|
|
132
|
-
if (f.wait) rowsLib.deriveNow(root);
|
|
145
|
+
if (f.wait || recordCount(root) <= AUTO_READ) { try { rowsLib.deriveNow(root); } catch { /* the banner says what could not be read */ } }
|
|
133
146
|
out = today.todayFor({ id: 'local', root }, {});
|
|
134
147
|
} finally { rowsLib.setBackground(was); }
|
|
135
148
|
}
|
|
@@ -351,6 +351,14 @@ function buildRange(root, { spec, whole }) {
|
|
|
351
351
|
* ordering rule; "I cannot tell" is not, and collapsing the second into the first is exactly how a
|
|
352
352
|
* shallow clone would turn every order check into a silent pass.
|
|
353
353
|
*/
|
|
354
|
+
/** The unix seconds of the commit that first added `rel`, or null when git cannot say. */
|
|
355
|
+
function addedDate(root, rel) {
|
|
356
|
+
const out = git(root, ['log', '--diff-filter=A', '--format=%ct', '--', rel]);
|
|
357
|
+
const lines = out ? out.split('\n').map((x) => x.trim()).filter(Boolean) : [];
|
|
358
|
+
const t = lines.length ? Number(lines[lines.length - 1]) : NaN;
|
|
359
|
+
return Number.isFinite(t) ? t : null;
|
|
360
|
+
}
|
|
361
|
+
|
|
354
362
|
function firstAppearance(root, range, rel) {
|
|
355
363
|
const onDisk = fs.existsSync(path.join(root, rel));
|
|
356
364
|
if (!range.ok) return onDisk ? undefined : null;
|
|
@@ -685,7 +693,12 @@ function computeWorkflowDerived(id, opts) {
|
|
|
685
693
|
// would suddenly be enforced. So the commit DATE decides whenever the range can supply it, and
|
|
686
694
|
// -1 keeps its meaning for the gate's range. Same question, asked of evidence that survives both.
|
|
687
695
|
const recIdx = firstAppearance(root, range, recRel);
|
|
688
|
-
|
|
696
|
+
// An EMPTY range (a branch level with main, a fresh clone, a kit repository on its trunk) gates nothing, so -1 there only means "committed
|
|
697
|
+
// before HEAD". It used to read every record as legacy, a record written today too, which turned the order rules off on the ladder
|
|
698
|
+
// (launch simulation W1, 2026-11-12). With nothing to gate, the record's own first commit dates it.
|
|
699
|
+
const emptyRange = range.ok && Array.isArray(range.shas) && range.shas.length === 0;
|
|
700
|
+
const addedAt = (recIdx === -1 && emptyRange) ? addedDate(root, recRel) : null;
|
|
701
|
+
const recAt = (range.dates && typeof recIdx === 'number' && recIdx >= 0) ? range.dates[recIdx] : addedAt;
|
|
689
702
|
/*
|
|
690
703
|
* `reconstructed_from` — the merge date of work whose record was written afterwards.
|
|
691
704
|
*
|
|
@@ -698,7 +711,7 @@ function computeWorkflowDerived(id, opts) {
|
|
|
698
711
|
* genuinely skipped the loop still reports blocked, which is the point of writing it down.
|
|
699
712
|
*/
|
|
700
713
|
const recon = String(fm.reconstructed_from || '').trim().slice(0, 10);
|
|
701
|
-
const legacy = recIdx === -1 ? true
|
|
714
|
+
const legacy = (recIdx === -1 && !addedAt) ? true
|
|
702
715
|
: /^\d{4}-\d{2}-\d{2}$/.test(recon) ? recon < ENFORCED_FROM
|
|
703
716
|
: recAt ? new Date(recAt * 1000).toISOString().slice(0, 10) < ENFORCED_FROM
|
|
704
717
|
: String(fm.timestamp || generatedAt(fm.generated) || '').slice(0, 10) < ENFORCED_FROM; // fallback — see ENFORCED_FROM; D74: OKF v0.2 `generated.at` stands in for `timestamp`
|
|
@@ -1735,7 +1748,11 @@ function renderLadder(w) {
|
|
|
1735
1748
|
const head = `${c(1, w.id)} · ${w.lane}${w.laneKnown ? '' : c(33, ' (unknown lane — enforcing feature)')} · ${w.anchor ? brief(w.anchor, 46) : c(31, 'unanchored')}`;
|
|
1736
1749
|
out.push('');
|
|
1737
1750
|
out.push(` ${head}`);
|
|
1738
|
-
|
|
1751
|
+
// The gate rung, not the initiative's stage: the stage the pages and `pmos initiative list` show is the Board's one stage (PM moves,
|
|
1752
|
+
// Jira, dated plan items, then these files; workspace/lib/stage-read.js). Printing the rung as "stage" gave one record four stages
|
|
1753
|
+
// (launch simulation W1, 2026-11-12). The engine never reads the Board (X29), so it names the rung and says where the stage is.
|
|
1754
|
+
out.push(` ${c(90, 'gate')} ${c(1, w.stage)}${w.legacy ? c(33, ` legacy — record predates ${w.enforced_from}, order rules report but do not fail`) : ''}`);
|
|
1755
|
+
out.push(` ${c(90, 'stage')} ${c(90, `pmos workflow of ${w.id} — the stage every page shows`)}`);
|
|
1739
1756
|
out.push(` ${c(90, '─'.repeat(78))}`);
|
|
1740
1757
|
for (const s of w.steps) {
|
|
1741
1758
|
const label = s.label.padEnd(11);
|
|
@@ -1901,7 +1918,7 @@ function main(argv) {
|
|
|
1901
1918
|
}
|
|
1902
1919
|
if (w.legacy) process.stdout.write(`ℹ️ '${w.id}' is LEGACY (record predates ${ENFORCED_FROM}) — order rules reported, not enforced.\n`);
|
|
1903
1920
|
if (w.range.error) process.stdout.write(`⚠️ order checks degraded — ${w.range.error}\n`);
|
|
1904
|
-
process.stdout.write(`✅ workflow gate PASSED — '${w.id}' (${w.lane}) at
|
|
1921
|
+
process.stdout.write(`✅ workflow gate PASSED — '${w.id}' (${w.lane}) at gate rung ${w.stage}.\n`);
|
|
1905
1922
|
return 0;
|
|
1906
1923
|
}
|
|
1907
1924
|
|
|
@@ -42,9 +42,9 @@ const { repoScript } = require('./repo-script.js');
|
|
|
42
42
|
const WF = require(repoScript('workflows.js'));
|
|
43
43
|
const stateRoot = require('./state-root.js');
|
|
44
44
|
|
|
45
|
-
const COMMANDS = { workflow: ['list', 'show', 'draft', 'show-draft', 'judge', 'of', 'move', 'switch'] };
|
|
45
|
+
const COMMANDS = { workflow: ['list', 'show', 'draft', 'show-draft', 'judge', 'of', 'move', 'switch', 'check'] };
|
|
46
46
|
const USAGE = [
|
|
47
|
-
'usage: pmos workflow list|show|draft|show-draft|judge|of|move|switch — the workflows each kind of initiative goes through (D99)',
|
|
47
|
+
'usage: pmos workflow list|show|draft|show-draft|judge|of|move|switch|check — the workflows each kind of initiative goes through (D99)',
|
|
48
48
|
' pmos workflow list every workflow the PM can pick: this repository\'s and the ones saved in Settings',
|
|
49
49
|
' pmos workflow show <id> one workflow, its stages numbered',
|
|
50
50
|
' The workflows are not files in the repository: never search the files for one, and never use a lane (feature, chore…) instead.',
|
|
@@ -59,6 +59,8 @@ const USAGE = [
|
|
|
59
59
|
' Move the initiative to a stage of its own workflow, when the PM asks. The stage card and the Board show it at once.',
|
|
60
60
|
' pmos workflow switch <initiative> --to <workflow id> [--stage <key|name>] [--why <text>]',
|
|
61
61
|
' Put the initiative on another workflow, when the PM asks. Without --stage it lands where the Board\'s switch puts it.',
|
|
62
|
+
' pmos workflow check [<initiative>] every surface\'s stage (Board, Viewer, initiative list, notes and reports) compared;',
|
|
63
|
+
' exits 1 and names the surfaces when two of them show different stages for one initiative',
|
|
62
64
|
' These are the initiative\'s workflow stages. They are not task stages: a task\'s only stage is its state (To do, In progress,',
|
|
63
65
|
' Done, Won\'t do, Archived), and moving the initiative never changes a task.',
|
|
64
66
|
' every command: [--json] [--root <dir>]. Nothing is sent.',
|
|
@@ -192,6 +194,20 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
192
194
|
else say(`✓ drafted ${r.draft.name} with ${r.draft.stages.length} stages. The Workflows page shows it beside the chat; the PM presses Create workflow. Nothing was sent.`);
|
|
193
195
|
return 0;
|
|
194
196
|
}
|
|
197
|
+
if (verb === 'check') {
|
|
198
|
+
if (pos.length > 1) { say('usage: pmos workflow check [<initiative>]'); return 2; }
|
|
199
|
+
const r = require('./stage-read.js').check(root, pos.length ? { ids: [pos[0]] } : {});
|
|
200
|
+
if (!r.ok) return fail(r.error);
|
|
201
|
+
if (json) { say(JSON.stringify(r)); return r.disagree.length ? 1 : 0; }
|
|
202
|
+
if (!r.disagree.length) {
|
|
203
|
+
say(`✓ every surface shows the same stage for ${r.checked === 1 ? 'the initiative' : 'all ' + r.checked + ' initiatives'}.`);
|
|
204
|
+
if (pos.length && r.stages[pos[0]]) say(` ${pos[0]} · ${r.stages[pos[0]]}`);
|
|
205
|
+
return 0;
|
|
206
|
+
}
|
|
207
|
+
say(`✗ ${r.disagree.length} of ${r.checked} initiatives show different stages on different surfaces:`);
|
|
208
|
+
for (const d of r.disagree) say(` ${d.id} · ` + Object.entries(d.surfaces).map(([k, v]) => `${k}: ${v}`).join(' · '));
|
|
209
|
+
return 1;
|
|
210
|
+
}
|
|
195
211
|
if (verb === 'of' || verb === 'move' || verb === 'switch') return onInitiative(verb, { pos, flags, json, say, fail, root, stateDir, actor, others });
|
|
196
212
|
// judge
|
|
197
213
|
if (!flags.board || !flags.id || !flags.stage) { say('usage: pmos workflow judge --board <id> --id <initiative> --stage <key> --runs yes|no|unsure --why <reason> [--cite <where>]'); return 2; }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.565.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.565.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "launch simulation W1 (2026-11-12): one stage on every surface (Board, Viewer, initiative list, notes and reports) and pmos workflow check; pmos board lists tasks; the ladder names its gate rung; an empty range dates a record by its own commit.",
|
|
3
|
+
"modules": ["stage-everywhere.test.js"],
|
|
4
|
+
"seconds": { "stage-everywhere.test.js": 3 }
|
|
5
|
+
}
|