create-pmos 0.571.0 → 0.573.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 +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/gate-initiative.sh +12 -2
- package/payload/scripts/work-item.js +2 -1
- package/payload/scripts/workflow-state.js +60 -5
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/cli.md +1 -1
- package/workspace/lib/ai-cli.js +11 -0
- package/workspace/lib/build-cli.js +12 -4
- package/workspace/lib/build-engine.js +35 -1
- package/workspace/lib/engine/workflow-state.js +60 -5
- package/workspace/lib/factory-rollout.js +15 -2
- package/workspace/lib/vendor/scripts/workflow-state.js +60 -5
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.573.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,32 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.573.0",
|
|
38
|
+
"at": "2026-11-16T04:53:10.251Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1304,
|
|
43
|
+
"t": "The kill switch reaches open factory PRs; clearer build help, policy and next",
|
|
44
|
+
"s": "The kill switch reaches open factory PRs; clearer build help, policy and next",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"v": "0.572.0",
|
|
51
|
+
"at": "2026-11-16T04:39:30.480Z",
|
|
52
|
+
"f": 4,
|
|
53
|
+
"prs": [
|
|
54
|
+
{
|
|
55
|
+
"n": 1305,
|
|
56
|
+
"t": "A Project's dated tasks with a ◇ milestone are its dated plan",
|
|
57
|
+
"s": "A Project's dated tasks with a ◇ milestone are its dated plan",
|
|
58
|
+
"k": "new"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
36
62
|
{
|
|
37
63
|
"v": "0.571.0",
|
|
38
64
|
"at": "2026-11-16T04:26:43.356Z",
|
|
@@ -284,32 +310,6 @@
|
|
|
284
310
|
"k": "fix"
|
|
285
311
|
}
|
|
286
312
|
]
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
"v": "0.553.0",
|
|
290
|
-
"at": "2026-11-10T22:27:26.069Z",
|
|
291
|
-
"f": 4,
|
|
292
|
-
"prs": [
|
|
293
|
-
{
|
|
294
|
-
"n": 1282,
|
|
295
|
-
"t": "The Board groups By goal in every view and on a shared Board link",
|
|
296
|
-
"s": "The Board groups By goal in every view and on a shared Board link",
|
|
297
|
-
"k": "new"
|
|
298
|
-
}
|
|
299
|
-
]
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
"v": "0.552.0",
|
|
303
|
-
"at": "2026-11-10T22:15:08.780Z",
|
|
304
|
-
"f": 4,
|
|
305
|
-
"prs": [
|
|
306
|
-
{
|
|
307
|
-
"n": 1280,
|
|
308
|
-
"t": "Phone menu button clears the chat box; the PM can clear an Intent line",
|
|
309
|
-
"s": "Phone menu button clears the chat box; the PM can clear an Intent line",
|
|
310
|
-
"k": "fix"
|
|
311
|
-
}
|
|
312
|
-
]
|
|
313
313
|
}
|
|
314
314
|
]
|
|
315
315
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -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-16T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-16T04:53:07Z"}
|
|
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-16T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-16T04:53:07Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -90,7 +90,7 @@ anchor="$(frontval parent_kr)"
|
|
|
90
90
|
# In both profiles, as .github/scripts/initiative-gate.sh does for PMOS itself: a record that names its done test and kill condition is
|
|
91
91
|
# an experiment and passes in any lane (the done test is the spec, D13 as amended by D107). The kind of work sets the gate (W5): Full
|
|
92
92
|
# SDLC needs a done test and a kill condition, never a PRD or a brief; a Project needs a dated plan (plan_path: milestones with dates
|
|
93
|
-
# and owners), never a PRD or a brief. A PRD or brief already on the record still passes: a gate passed stays passed. `pmos artefacts
|
|
93
|
+
# and owners, or dated tasks with a ◇ milestone in the task store), never a PRD or a brief. A PRD or brief already on the record still passes: a gate passed stays passed. `pmos artefacts
|
|
94
94
|
# set experiment:<id> done-test …` writes done_test_path and kill: for you (lib/artefact-mirror.js).
|
|
95
95
|
done_test="$(frontval done_test_path)"
|
|
96
96
|
kill_cond="$(frontval kill)"
|
|
@@ -108,7 +108,17 @@ fi
|
|
|
108
108
|
if [ "$kind" = project ]; then
|
|
109
109
|
plan="$(frontval plan_path)"
|
|
110
110
|
if [ -n "$plan" ] || [ -z "$had_spec" ]; then
|
|
111
|
-
[ -
|
|
111
|
+
if [ -z "$plan" ]; then
|
|
112
|
+
# Dated tasks with a dated ◇ milestone in the task store ARE the dated plan (pmos task add --due … / pmos task set --milestone): the
|
|
113
|
+
# reader is workflow-state.js --task-plan, shipped next to this script (scripts/ in the PMOS repository itself).
|
|
114
|
+
here="$(cd "$(dirname "$0")" && pwd)"; ws=""; tp=""
|
|
115
|
+
for c in "$here/workflow-state.js" "$here/../../scripts/workflow-state.js"; do [ -f "$c" ] && { ws="$c"; break; }; done
|
|
116
|
+
if [ -n "$ws" ] && command -v node >/dev/null 2>&1 && tp="$(node "$ws" --task-plan "$id" --root . 2>/dev/null)"; then
|
|
117
|
+
echo "✅ initiative gate PASSED — '$id' (Project): $init_file exists and the dated plan is in the task store ($tp)."
|
|
118
|
+
exit 0
|
|
119
|
+
fi
|
|
120
|
+
fail "initiative '$id' is a Project: it needs a dated plan, never a PRD or a brief. Add dated tasks with at least one dated ◇ milestone (pmos task add --due …, pmos task set <task> --milestone), or set plan_path in $init_file to the plan (milestones with dates and owners), or give it a done test.${tp:+ The task store has $tp.}"
|
|
121
|
+
fi
|
|
112
122
|
[ -f "$plan" ] || fail "plan_path '$plan' (from $init_file) does not exist in the repo."
|
|
113
123
|
echo "✅ initiative gate PASSED — '$id' (Project): $init_file exists and the dated plan ($plan) is present."
|
|
114
124
|
exit 0
|
|
@@ -1409,7 +1409,8 @@ function cliMain(argv) {
|
|
|
1409
1409
|
const ledger = path.join(__dirname, '..', 'planning', 'work-items.jsonl');
|
|
1410
1410
|
const read = () => { try { return readLedgerSafely(ledger); } catch (e) { if (e && e.code === 'ENOENT') return ''; throw e; } };
|
|
1411
1411
|
const usage = () => {
|
|
1412
|
-
console.log('usage: node scripts/work-item.js declare <initiative> --type <t> --blast <b> --criterion "<text>" --check <kind> --ref "<ref>" [--plan-item <id>] [--agent <who>] [--hours N]');
|
|
1412
|
+
console.log('usage: node scripts/work-item.js declare <initiative> --type <t> --blast <b> --criterion "<text>" --check <kind> --ref "<ref>" [--plan-item <id>] [--agent <who>] [--hours N] [--no-claim]');
|
|
1413
|
+
console.log(' declare claims the item for you; add --no-claim to leave it for the Builder (pmos build next lists only unclaimed items)');
|
|
1413
1414
|
console.log(' [--scope <path,…>] [--flag <name> [--metric <name> --budget <max>] | --no-user-facing] [--kr] (D108: what the merge guardrail reads)');
|
|
1414
1415
|
console.log(' node scripts/work-item.js verify <item> --evidence "<what passed>"');
|
|
1415
1416
|
console.log(' node scripts/work-item.js claim <item> [--agent <who>] [--hours N]');
|
|
@@ -231,6 +231,48 @@ function layout(root) {
|
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
// ── A Project's dated plan in the task store (launch simulation W6 follow-up) ─────────────────────
|
|
235
|
+
// `pmos task add/link/set --milestone` writes a Project's plan as task lines in <runsDir>/initiative-tasks.jsonl (lib/task-store.js; lines
|
|
236
|
+
// not yet moved there still sit in boards.jsonl). Dated tasks with at least one dated ◇ milestone ARE the dated plan, so plan_path is not
|
|
237
|
+
// needed: the gate (kit/scripts/gate-initiative.sh, through --task-plan) and both ladders read them here. The fold is the task part of
|
|
238
|
+
// scripts/boards.js fold: the first task line makes the task, task-update moves or re-dates it, task-remove and task-restore take it out and
|
|
239
|
+
// back, and the last task-milestone line wins. → { ok, dated, milestones, file, evidence }
|
|
240
|
+
const DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
241
|
+
function taskPlanOf(root, id) {
|
|
242
|
+
const L = layout(root);
|
|
243
|
+
const files = ['boards.jsonl', 'initiative-tasks.jsonl'].map((f) => path.join(L.runsDir, f));
|
|
244
|
+
const tasks = new Map(); const removed = new Map(); const milestones = new Map();
|
|
245
|
+
for (const file of files) {
|
|
246
|
+
let text = '';
|
|
247
|
+
try { text = fs.readFileSync(file, 'utf8'); } catch { continue; }
|
|
248
|
+
for (const raw of text.split('\n')) {
|
|
249
|
+
const t = raw.trim();
|
|
250
|
+
if (!t || t[0] !== '{' || !t.includes('"task')) continue;
|
|
251
|
+
let e; try { e = JSON.parse(t); } catch { continue; }
|
|
252
|
+
if (!e || typeof e.task !== 'string' || !e.task) continue;
|
|
253
|
+
if (e.kind === 'task' && typeof e.initiative === 'string' && !tasks.has(e.task) && !removed.has(e.task)) {
|
|
254
|
+
tasks.set(e.task, { initiative: e.initiative, due: typeof e.due === 'string' ? e.due : '' });
|
|
255
|
+
} else if (e.kind === 'task-update' && tasks.has(e.task)) {
|
|
256
|
+
const x = tasks.get(e.task);
|
|
257
|
+
if (typeof e.initiative === 'string' && e.initiative) x.initiative = e.initiative;
|
|
258
|
+
if (typeof e.due === 'string') x.due = e.due;
|
|
259
|
+
} else if (e.kind === 'task-milestone' && typeof e.milestone === 'boolean') milestones.set(e.task, e.milestone);
|
|
260
|
+
else if (e.kind === 'task-remove' && tasks.has(e.task)) { removed.set(e.task, tasks.get(e.task)); tasks.delete(e.task); }
|
|
261
|
+
else if (e.kind === 'task-restore' && removed.has(e.task) && !tasks.has(e.task)) { tasks.set(e.task, removed.get(e.task)); removed.delete(e.task); }
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
let dated = 0; let ms = 0;
|
|
265
|
+
for (const [tid, x] of tasks) {
|
|
266
|
+
if (x.initiative !== id || !DAY_RE.test(x.due)) continue;
|
|
267
|
+
dated++;
|
|
268
|
+
if (milestones.get(tid) === true) ms++;
|
|
269
|
+
}
|
|
270
|
+
const file = path.relative(root, path.join(L.runsDir, 'initiative-tasks.jsonl')).split(path.sep).join('/');
|
|
271
|
+
const ok = ms > 0;
|
|
272
|
+
const evidence = `${dated} dated task${dated === 1 ? '' : 's'}, ${ms} dated milestone${ms === 1 ? '' : 's'} in ${file}`;
|
|
273
|
+
return { ok, dated, milestones: ms, file, evidence };
|
|
274
|
+
}
|
|
275
|
+
|
|
234
276
|
// ── Git ────────────────────────────────────────────────────────────────────────────────────────
|
|
235
277
|
function git(root, args) {
|
|
236
278
|
try {
|
|
@@ -973,9 +1015,12 @@ function computeWorkflowDerived(id, opts) {
|
|
|
973
1015
|
`write the done test (okf/core/templates/done-test-template.md), set done_test_path and kill: in ${recRel}`, { blocking: true, rule: 'R2' }));
|
|
974
1016
|
} else if (!doneTest && workKind === 'project' && (planPath || !prd)) {
|
|
975
1017
|
const planIdx = planPath ? firstAppearance(root, range, planPath) : null;
|
|
976
|
-
|
|
1018
|
+
const taskPlan = planPath ? null : taskPlanOf(root, id);
|
|
1019
|
+
if (taskPlan && taskPlan.ok) {
|
|
1020
|
+
steps.push(step('spec', 'spec', 'done', `dated plan in the task store: ${taskPlan.evidence}`));
|
|
1021
|
+
} else if (!planPath) {
|
|
977
1022
|
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' }));
|
|
1023
|
+
`write the plan (milestones with dates and owners, go-live matching the KR date) and set plan_path in ${recRel}, or add dated tasks with a ◇ milestone (pmos task add --due … / pmos task set --milestone), or a done test`, { blocking: true, rule: 'R2' }));
|
|
979
1024
|
} else if (planIdx === null) {
|
|
980
1025
|
steps.push(step('spec', 'spec', 'blocked', `plan_path '${planPath}' does not exist in the repo`,
|
|
981
1026
|
'create the plan the record points at, or correct plan_path', { blocking: true, rule: 'R2' }));
|
|
@@ -1605,14 +1650,16 @@ function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, re
|
|
|
1605
1650
|
const workKind = (() => { const k = String(fm.kind || '').trim().replace(/^["']|["']$/g, ''); return k === 'sdlc' || k === 'project' ? k : 'product'; })();
|
|
1606
1651
|
const planPath = String(fm.plan_path || '').trim();
|
|
1607
1652
|
const kindSpec = !doneTest && !exists(briefPath) && !foundBrief && (workKind === 'sdlc' || (workKind === 'project'));
|
|
1653
|
+
const tasksPlan = kindSpec && workKind === 'project' && !planPath ? taskPlanOf(root, id) : null;
|
|
1608
1654
|
if (doneTest && dtPresent && killCond) steps.push(step('brief', def.brief_label, 'done', `done test ${doneTest} + kill condition (D107)`));
|
|
1609
1655
|
else if (kindSpec && workKind === 'sdlc') steps.push(step('brief', 'done test', legacy ? 'pending' : 'blocked',
|
|
1610
1656
|
'Full SDLC needs a done test and a kill condition before the first pull request — never a brief or a PRD',
|
|
1611
1657
|
`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
1658
|
else if (kindSpec && exists(planPath)) steps.push(step('brief', 'dated plan', 'done', `plan ${planPath} present`));
|
|
1659
|
+
else if (kindSpec && !planPath && tasksPlan && tasksPlan.ok) steps.push(step('brief', 'dated plan', 'done', `dated plan in the task store: ${tasksPlan.evidence}`));
|
|
1613
1660
|
else if (kindSpec) steps.push(step('brief', 'dated plan', legacy ? 'pending' : 'blocked',
|
|
1614
1661
|
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`,
|
|
1662
|
+
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 add dated tasks with a ◇ milestone (pmos task add --due … / pmos task set --milestone), or a done test`,
|
|
1616
1663
|
{ blocking: !legacy, rule: 'R2' }));
|
|
1617
1664
|
else if (doneTest && dtPresent) steps.push(step('brief', def.brief_label, 'blocked', 'no kill condition — an experiment states what would stop it (D107)',
|
|
1618
1665
|
`write kill: "<the result that would make us stop>" in ${recRel}`, { blocking: !legacy, rule: 'R2' }));
|
|
@@ -1896,7 +1943,7 @@ function listInitiatives(root) {
|
|
|
1896
1943
|
// ── CLI ────────────────────────────────────────────────────────────────────────────────────────
|
|
1897
1944
|
function main(argv) {
|
|
1898
1945
|
const args = argv.slice(2);
|
|
1899
|
-
let root = process.cwd(); let json = false; let gate = false; let all = false; let lanes = false;
|
|
1946
|
+
let root = process.cwd(); let json = false; let gate = false; let all = false; let lanes = false; let taskPlan = null;
|
|
1900
1947
|
const rest = [];
|
|
1901
1948
|
for (let i = 0; i < args.length; i++) {
|
|
1902
1949
|
const a = args[i];
|
|
@@ -1905,6 +1952,7 @@ function main(argv) {
|
|
|
1905
1952
|
if (a === '--gate') { gate = true; continue; }
|
|
1906
1953
|
if (a === '--all') { all = true; continue; }
|
|
1907
1954
|
if (a === '--lanes') { lanes = true; continue; }
|
|
1955
|
+
if (a === '--task-plan') { taskPlan = args[++i] || ''; continue; }
|
|
1908
1956
|
if (a === '--open') { continue; } // the board is in-flight-only by default now
|
|
1909
1957
|
if (a === '--help' || a === '-h') {
|
|
1910
1958
|
process.stdout.write([
|
|
@@ -1914,12 +1962,19 @@ function main(argv) {
|
|
|
1914
1962
|
' --gate <id> CI mode — exit 1 on a blocking order violation, with the next action',
|
|
1915
1963
|
' --all the board without the 12-row cap',
|
|
1916
1964
|
' --lanes every lane this repository offers: when to use it, input, output, done',
|
|
1965
|
+
' --task-plan <id> exit 0 when the task store holds a Project\'s dated plan (dated tasks with a ◇ milestone)',
|
|
1917
1966
|
' --json machine-readable (what an agent reads at session start)', '',
|
|
1918
1967
|
].join('\n') + '\n');
|
|
1919
1968
|
return 0;
|
|
1920
1969
|
}
|
|
1921
1970
|
rest.push(a);
|
|
1922
1971
|
}
|
|
1972
|
+
if (taskPlan !== null) {
|
|
1973
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/.test(taskPlan)) { process.stdout.write('--task-plan needs an initiative id\n'); return 2; }
|
|
1974
|
+
const tp = taskPlanOf(root, taskPlan);
|
|
1975
|
+
process.stdout.write(json ? JSON.stringify(tp) + '\n' : tp.evidence + '\n');
|
|
1976
|
+
return tp.ok ? 0 : 1;
|
|
1977
|
+
}
|
|
1923
1978
|
if (lanes) {
|
|
1924
1979
|
const info = lanesFor(root);
|
|
1925
1980
|
if (json) { process.stdout.write(JSON.stringify(info, null, 2) + '\n'); return 0; }
|
|
@@ -1987,7 +2042,7 @@ function main(argv) {
|
|
|
1987
2042
|
}
|
|
1988
2043
|
|
|
1989
2044
|
module.exports = {
|
|
1990
|
-
computeWorkflow, declaredLane: laneDefs.declaredLane, readLifecycle, STOPPED_STATES, renderLadder, renderBoard, listInitiatives, layout, inFlight, BOARD_CAP,
|
|
2045
|
+
computeWorkflow, taskPlanOf, declaredLane: laneDefs.declaredLane, readLifecycle, STOPPED_STATES, renderLadder, renderBoard, listInitiatives, layout, inFlight, BOARD_CAP,
|
|
1991
2046
|
parseLeadingFrontmatter, specimenRoute, surfaceRoute, priorsCitation, isBuildPath, commitRange,
|
|
1992
2047
|
// the board's trunk range, exported so the suite can assert the split: the same record is legacy
|
|
1993
2048
|
// under BOTH ranges, and `in this change` is false under the trunk one.
|
|
@@ -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-16T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-16T04:53:07Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.573.0",
|
|
4
|
+
"at": "2026-11-16T04:53:10.251Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1304,
|
|
9
|
+
"t": "The kill switch reaches open factory PRs; clearer build help, policy and next",
|
|
10
|
+
"s": "The kill switch reaches open factory PRs; clearer build help, policy and next",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.572.0",
|
|
17
|
+
"at": "2026-11-16T04:39:30.480Z",
|
|
18
|
+
"f": 4,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1305,
|
|
22
|
+
"t": "A Project's dated tasks with a ◇ milestone are its dated plan",
|
|
23
|
+
"s": "A Project's dated tasks with a ◇ milestone are its dated plan",
|
|
24
|
+
"k": "new"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.571.0",
|
|
4
30
|
"at": "2026-11-16T04:26:43.356Z",
|
package/workspace/guide/cli.md
CHANGED
|
@@ -461,7 +461,7 @@ For each pull request on a `pmos/` branch, the check runs the default branch's c
|
|
|
461
461
|
- **AUTO.** The item is verified in the default branch's records, every changed file is inside the item's declared scope, the change reads its flag (or the item has no user-facing effect), and no trigger fires. The check marks the pull request ready and turns on auto-merge. GitHub merges when every required check is green.
|
|
462
462
|
- **HUMAN.** The check names every reason and turns auto-merge off. You merge.
|
|
463
463
|
|
|
464
|
-
These triggers always make the answer HUMAN: migrations or data deletion; auth, permissions, payments, personal data or secrets; CI, gates, the guardrail or PMOS records; a new dependency; a public API or contract; anything sent outward; a new agent path; a changed existing test, test configuration or the item's own check; an item that failed before; a revert on the default branch in the last 14 days; a folder untouched for 90 days. When agents are switched off (`pmos ai off`) or the factory is back to propose-only after a revert, PMOS writes `PMOS-Merge: human` in the pull request, and the check reads HUMAN. To stop one merge yourself, add that line to the pull request's description. A pull request from a fork always reads HUMAN.
|
|
464
|
+
These triggers always make the answer HUMAN: migrations or data deletion; auth, permissions, payments, personal data or secrets; CI, gates, the guardrail or PMOS records; a new dependency; a public API or contract; anything sent outward; a new agent path; a changed existing test, test configuration or the item's own check; an item that failed before; a revert on the default branch in the last 14 days; a folder untouched for 90 days. When agents are switched off (`pmos ai off`) or the factory is back to propose-only after a revert, PMOS writes `PMOS-Merge: human` in the pull request, and the check reads HUMAN. `pmos ai off` also reaches pull requests that are already open: PMOS turns each open pull request on a `pmos/` branch back into a draft, which drops GitHub's auto-merge, and adds `PMOS-Merge: human` to its description. The server does the same when the factory goes back to propose-only. To stop one merge yourself, add that line to the pull request's description. A pull request from a fork always reads HUMAN.
|
|
465
465
|
|
|
466
466
|
`pmos build policy <item>` shows the answer on this computer before the check runs.
|
|
467
467
|
|
package/workspace/lib/ai-cli.js
CHANGED
|
@@ -100,6 +100,17 @@ function run(argv, { say = (s) => console.log(s), env = process.env, stateDir =
|
|
|
100
100
|
if (!r || !r.ok) { say('✗ ' + ((r && r.error) || 'could not save')); return 1; }
|
|
101
101
|
const envWins = verb === 'on' && AG.off(job, { env, settingsDir: null });
|
|
102
102
|
say(`${job || 'every AI job'}: ${verb}${envWins ? ' in Settings, but ' + envWins + ' wins' : ''}`);
|
|
103
|
+
// D108: off reaches the factory's pull requests that are already open (they go back to draft with PMOS-Merge: human)
|
|
104
|
+
if (verb === 'off' && !job) {
|
|
105
|
+
const WK = require('./work-kind.js');
|
|
106
|
+
for (const root of roots || rootsOf(dir, cwd)) {
|
|
107
|
+
if (!WK.factoryDir(root)) continue;
|
|
108
|
+
let r;
|
|
109
|
+
try { r = require('./factory-rollout.js').holdOnce(root, 'agents are off (pmos ai off)', { now: Date.now(), env }); } catch (e) { r = { ok: false, error: e.message }; }
|
|
110
|
+
if (r && r.held && r.held.length) say(` ${path.basename(root)}: held ${r.held.map((n) => '#' + n).join(', ')} for a person (draft, PMOS-Merge: human)`);
|
|
111
|
+
else if (r && r.ok === false) say(` ${path.basename(root)}: ${r.error}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
103
114
|
return 0;
|
|
104
115
|
}
|
|
105
116
|
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* pmos build claim <item> [--json] claim one, on a new branch pmos/<item> in a worktree of its own
|
|
7
7
|
* pmos build propose <item> "<what it does>" --evidence "<the check that passed>" [--json]
|
|
8
8
|
* commit, mark verified, and file "Open a draft pull request" under the ✦
|
|
9
|
-
*
|
|
9
|
+
* (PMOS opens it by itself, D108 point 6; with agents off it waits for the ✓)
|
|
10
|
+
* pmos build open <item> [--json] never a role run: push the branch and open the DRAFT pull request
|
|
10
11
|
* pmos build status [--json] every work item, its branch and whether its worktree is here
|
|
11
12
|
* pmos build policy <item> [--json] what the merge guardrail reads for it now: auto or human, and why (D108)
|
|
12
13
|
* pmos build rollout [<item> [--to <percent>]] [--json] no item: where every flag stands; an item: the PM's own next step
|
|
@@ -28,8 +29,9 @@ const USAGE = [
|
|
|
28
29
|
' pmos build next [<initiative>] the declared work items no Builder has taken',
|
|
29
30
|
' pmos build claim <item> claim one; PMOS makes the branch pmos/<item> in a worktree outside this folder',
|
|
30
31
|
' pmos build propose <item> "<what it does>" --evidence "<the check that passed>"',
|
|
31
|
-
' commit it
|
|
32
|
-
' pmos build open <item>
|
|
32
|
+
' commit it; PMOS then opens the draft pull request by itself (Undo closes it)',
|
|
33
|
+
' pmos build open <item> open it now yourself: push pmos/<item> and open the draft pull request',
|
|
34
|
+
' (with pmos ai off, the pull request waits for this or your ✓)',
|
|
33
35
|
' pmos build status every work item and its branch',
|
|
34
36
|
' pmos build policy <item> auto or human: whether its pull request merges by itself, and why',
|
|
35
37
|
' pmos build rollout [<item> [--to <percent>]] where every flag stands; with an item, take its flag to the next step',
|
|
@@ -70,7 +72,13 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
|
|
|
70
72
|
if (verb === 'next' || verb === 'status') {
|
|
71
73
|
const list = verb === 'next' ? BE.next(root, pos[0]) : BE.status(root);
|
|
72
74
|
if (json) return ok({ items: list });
|
|
73
|
-
if (!list.length) {
|
|
75
|
+
if (!list.length) {
|
|
76
|
+
if (verb !== 'next') { say('No work items.'); return 0; }
|
|
77
|
+
const taken = BE.itemsOf(root).filter((x) => x.state === 'claimed' && (!pos[0] || x.initiative_id === pos[0]));
|
|
78
|
+
say('No declared work item waits for a Builder.');
|
|
79
|
+
if (taken.length) say(`${taken.length === 1 ? '1 item is' : taken.length + ' items are'} claimed already: ${taken.slice(0, 5).map((x) => `${x.item_id} by ${(x.claim && x.claim.agent) || 'someone'}`).join(', ')}. To leave an item for the Builder, declare it with --no-claim.`);
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
74
82
|
for (const x of list) say(verb === 'next' ? `${x.item_id} ${x.type || ''} ${(x.criterion && x.criterion.text) || ''}` : `${x.item} ${x.state} ${x.branch}${x.here ? ' (worktree here)' : ''}`);
|
|
75
83
|
return 0;
|
|
76
84
|
}
|
|
@@ -56,6 +56,9 @@ function mergePolicy(root, it, { env = process.env } = {}) {
|
|
|
56
56
|
if (k) return human(`A person merges this pull request: ${k}.`, [{ rule: 'autonomy-off', detail: k }], true);
|
|
57
57
|
if (typeof root !== 'string' || !it || !it.item_id) return human('A person merges this pull request.');
|
|
58
58
|
const top = topOf(root) || root;
|
|
59
|
+
if (!git(top, ['rev-parse', '--verify', '--quiet', 'refs/heads/' + branchOf(it.item_id)]).ok) {
|
|
60
|
+
return human(`There is no branch ${branchOf(it.item_id)} yet, so there is nothing to judge. The guardrail reads it after pmos build claim and propose.`, [{ rule: 'no-branch', detail: `no branch ${branchOf(it.item_id)} yet` }]);
|
|
61
|
+
}
|
|
59
62
|
try {
|
|
60
63
|
const sd = require('./driver.js').stateDirOf(top, { create: false });
|
|
61
64
|
const dm = sd ? A.demotedNow(A.fold(A.read(sd)), FACTORY_JOB, null) : null;
|
|
@@ -248,6 +251,37 @@ function revert(root, item, { env = process.env, why = 'its guard metric left it
|
|
|
248
251
|
return o.ok ? { ok: true, branch, url: o.url } : { ok: false, branch, error: o.error };
|
|
249
252
|
}
|
|
250
253
|
|
|
254
|
+
function ghEnvOf(top, env) {
|
|
255
|
+
const login = require('./git-identity.js').pushLogin(top);
|
|
256
|
+
if (!login) return { ...env };
|
|
257
|
+
const t = cp.spawnSync('gh', ['auth', 'token', '--user', login], { encoding: 'utf8', env });
|
|
258
|
+
return t.status === 0 && String(t.stdout).trim() ? { ...env, GH_TOKEN: String(t.stdout).trim() } : { ...env };
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** The kill switch reaches pull requests already open (D108 point 5). For every open pull request on a pmos/ branch whose description
|
|
262
|
+
* lacks the line, PMOS turns it back into a draft (GitHub drops auto-merge from a draft) and adds `PMOS-Merge: human` to the
|
|
263
|
+
* description, so the guardrail reads HUMAN when it runs again. It closes and merges nothing. → { ok, held: [number] } | { ok: false, error } */
|
|
264
|
+
function holdOpen(root, { env = process.env, why = 'agents are off' } = {}) {
|
|
265
|
+
if (env.PMOS_TEAM_RUN) return { ok: false, error: 'a role run cannot change pull requests' };
|
|
266
|
+
const top = topOf(root) || root;
|
|
267
|
+
const ghEnv = ghEnvOf(top, env);
|
|
268
|
+
const l = cp.spawnSync('gh', ['pr', 'list', '--state', 'open', '--limit', '100', '--json', 'number,headRefName,body,isDraft'], { cwd: top, encoding: 'utf8', env: ghEnv });
|
|
269
|
+
if (l.error || l.status !== 0) return { ok: false, error: `gh could not list the open pull requests: ${one(l.stderr || (l.error && l.error.message), 200)}. Turn auto-merge off on PMOS's pull requests by hand` };
|
|
270
|
+
let list = [];
|
|
271
|
+
try { list = JSON.parse(l.stdout || '[]'); } catch { list = []; }
|
|
272
|
+
const held = [], failed = [];
|
|
273
|
+
for (const p of Array.isArray(list) ? list : []) {
|
|
274
|
+
if (!p || !/^pmos\//.test(String(p.headRefName || '')) || !/^[0-9]+$/.test(String(p.number))) continue;
|
|
275
|
+
if (/^PMOS-Merge:\s*human\s*$/mi.test(String(p.body || ''))) continue;
|
|
276
|
+
const n = String(p.number);
|
|
277
|
+
if (!p.isDraft) cp.spawnSync('gh', ['pr', 'ready', n, '--undo'], { cwd: top, encoding: 'utf8', env: ghEnv });
|
|
278
|
+
const body = `${String(p.body || '').replace(/\s+$/, '')}\n\nPMOS-Merge: human\n(${one(why, 160)})`;
|
|
279
|
+
const e = cp.spawnSync('gh', ['pr', 'edit', n, '--body', body], { cwd: top, encoding: 'utf8', env: ghEnv });
|
|
280
|
+
if (e.error || e.status !== 0) failed.push(n); else held.push(Number(n));
|
|
281
|
+
}
|
|
282
|
+
return failed.length ? { ok: false, held, error: `could not hold pull request ${failed.map((x) => '#' + x).join(', ')}` } : { ok: true, held };
|
|
283
|
+
}
|
|
284
|
+
|
|
251
285
|
/** Undo of an opened pull request (D108): close it with gh, comment why, leave the branch. → { ok } | { ok: false, error } */
|
|
252
286
|
function close(root, item, { url = '', env = process.env } = {}) {
|
|
253
287
|
if (env.PMOS_TEAM_RUN) return { ok: false, error: 'a role run cannot close a pull request' };
|
|
@@ -264,4 +298,4 @@ function status(root) {
|
|
|
264
298
|
return itemsOf(root).map((x) => { const wt = worktreeOf(root, x.item_id); return { item: x.item_id, state: x.state, branch: branchOf(x.item_id), worktree: wt, here: fs.existsSync(wt) }; });
|
|
265
299
|
}
|
|
266
300
|
|
|
267
|
-
module.exports = { POLICY, FACTORY_JOB, FORBIDDEN, mergePolicy, forbiddenIn, branchOf, revertBranchOf, worktreeOf, defaultBranch, itemsOf, next, claim, propose, open, revert, close, status };
|
|
301
|
+
module.exports = { POLICY, FACTORY_JOB, FORBIDDEN, mergePolicy, forbiddenIn, branchOf, revertBranchOf, worktreeOf, defaultBranch, itemsOf, next, claim, propose, open, revert, close, holdOpen, status };
|
|
@@ -231,6 +231,48 @@ function layout(root) {
|
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
// ── A Project's dated plan in the task store (launch simulation W6 follow-up) ─────────────────────
|
|
235
|
+
// `pmos task add/link/set --milestone` writes a Project's plan as task lines in <runsDir>/initiative-tasks.jsonl (lib/task-store.js; lines
|
|
236
|
+
// not yet moved there still sit in boards.jsonl). Dated tasks with at least one dated ◇ milestone ARE the dated plan, so plan_path is not
|
|
237
|
+
// needed: the gate (kit/scripts/gate-initiative.sh, through --task-plan) and both ladders read them here. The fold is the task part of
|
|
238
|
+
// scripts/boards.js fold: the first task line makes the task, task-update moves or re-dates it, task-remove and task-restore take it out and
|
|
239
|
+
// back, and the last task-milestone line wins. → { ok, dated, milestones, file, evidence }
|
|
240
|
+
const DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
241
|
+
function taskPlanOf(root, id) {
|
|
242
|
+
const L = layout(root);
|
|
243
|
+
const files = ['boards.jsonl', 'initiative-tasks.jsonl'].map((f) => path.join(L.runsDir, f));
|
|
244
|
+
const tasks = new Map(); const removed = new Map(); const milestones = new Map();
|
|
245
|
+
for (const file of files) {
|
|
246
|
+
let text = '';
|
|
247
|
+
try { text = fs.readFileSync(file, 'utf8'); } catch { continue; }
|
|
248
|
+
for (const raw of text.split('\n')) {
|
|
249
|
+
const t = raw.trim();
|
|
250
|
+
if (!t || t[0] !== '{' || !t.includes('"task')) continue;
|
|
251
|
+
let e; try { e = JSON.parse(t); } catch { continue; }
|
|
252
|
+
if (!e || typeof e.task !== 'string' || !e.task) continue;
|
|
253
|
+
if (e.kind === 'task' && typeof e.initiative === 'string' && !tasks.has(e.task) && !removed.has(e.task)) {
|
|
254
|
+
tasks.set(e.task, { initiative: e.initiative, due: typeof e.due === 'string' ? e.due : '' });
|
|
255
|
+
} else if (e.kind === 'task-update' && tasks.has(e.task)) {
|
|
256
|
+
const x = tasks.get(e.task);
|
|
257
|
+
if (typeof e.initiative === 'string' && e.initiative) x.initiative = e.initiative;
|
|
258
|
+
if (typeof e.due === 'string') x.due = e.due;
|
|
259
|
+
} else if (e.kind === 'task-milestone' && typeof e.milestone === 'boolean') milestones.set(e.task, e.milestone);
|
|
260
|
+
else if (e.kind === 'task-remove' && tasks.has(e.task)) { removed.set(e.task, tasks.get(e.task)); tasks.delete(e.task); }
|
|
261
|
+
else if (e.kind === 'task-restore' && removed.has(e.task) && !tasks.has(e.task)) { tasks.set(e.task, removed.get(e.task)); removed.delete(e.task); }
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
let dated = 0; let ms = 0;
|
|
265
|
+
for (const [tid, x] of tasks) {
|
|
266
|
+
if (x.initiative !== id || !DAY_RE.test(x.due)) continue;
|
|
267
|
+
dated++;
|
|
268
|
+
if (milestones.get(tid) === true) ms++;
|
|
269
|
+
}
|
|
270
|
+
const file = path.relative(root, path.join(L.runsDir, 'initiative-tasks.jsonl')).split(path.sep).join('/');
|
|
271
|
+
const ok = ms > 0;
|
|
272
|
+
const evidence = `${dated} dated task${dated === 1 ? '' : 's'}, ${ms} dated milestone${ms === 1 ? '' : 's'} in ${file}`;
|
|
273
|
+
return { ok, dated, milestones: ms, file, evidence };
|
|
274
|
+
}
|
|
275
|
+
|
|
234
276
|
// ── Git ────────────────────────────────────────────────────────────────────────────────────────
|
|
235
277
|
function git(root, args) {
|
|
236
278
|
try {
|
|
@@ -973,9 +1015,12 @@ function computeWorkflowDerived(id, opts) {
|
|
|
973
1015
|
`write the done test (okf/core/templates/done-test-template.md), set done_test_path and kill: in ${recRel}`, { blocking: true, rule: 'R2' }));
|
|
974
1016
|
} else if (!doneTest && workKind === 'project' && (planPath || !prd)) {
|
|
975
1017
|
const planIdx = planPath ? firstAppearance(root, range, planPath) : null;
|
|
976
|
-
|
|
1018
|
+
const taskPlan = planPath ? null : taskPlanOf(root, id);
|
|
1019
|
+
if (taskPlan && taskPlan.ok) {
|
|
1020
|
+
steps.push(step('spec', 'spec', 'done', `dated plan in the task store: ${taskPlan.evidence}`));
|
|
1021
|
+
} else if (!planPath) {
|
|
977
1022
|
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' }));
|
|
1023
|
+
`write the plan (milestones with dates and owners, go-live matching the KR date) and set plan_path in ${recRel}, or add dated tasks with a ◇ milestone (pmos task add --due … / pmos task set --milestone), or a done test`, { blocking: true, rule: 'R2' }));
|
|
979
1024
|
} else if (planIdx === null) {
|
|
980
1025
|
steps.push(step('spec', 'spec', 'blocked', `plan_path '${planPath}' does not exist in the repo`,
|
|
981
1026
|
'create the plan the record points at, or correct plan_path', { blocking: true, rule: 'R2' }));
|
|
@@ -1605,14 +1650,16 @@ function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, re
|
|
|
1605
1650
|
const workKind = (() => { const k = String(fm.kind || '').trim().replace(/^["']|["']$/g, ''); return k === 'sdlc' || k === 'project' ? k : 'product'; })();
|
|
1606
1651
|
const planPath = String(fm.plan_path || '').trim();
|
|
1607
1652
|
const kindSpec = !doneTest && !exists(briefPath) && !foundBrief && (workKind === 'sdlc' || (workKind === 'project'));
|
|
1653
|
+
const tasksPlan = kindSpec && workKind === 'project' && !planPath ? taskPlanOf(root, id) : null;
|
|
1608
1654
|
if (doneTest && dtPresent && killCond) steps.push(step('brief', def.brief_label, 'done', `done test ${doneTest} + kill condition (D107)`));
|
|
1609
1655
|
else if (kindSpec && workKind === 'sdlc') steps.push(step('brief', 'done test', legacy ? 'pending' : 'blocked',
|
|
1610
1656
|
'Full SDLC needs a done test and a kill condition before the first pull request — never a brief or a PRD',
|
|
1611
1657
|
`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
1658
|
else if (kindSpec && exists(planPath)) steps.push(step('brief', 'dated plan', 'done', `plan ${planPath} present`));
|
|
1659
|
+
else if (kindSpec && !planPath && tasksPlan && tasksPlan.ok) steps.push(step('brief', 'dated plan', 'done', `dated plan in the task store: ${tasksPlan.evidence}`));
|
|
1613
1660
|
else if (kindSpec) steps.push(step('brief', 'dated plan', legacy ? 'pending' : 'blocked',
|
|
1614
1661
|
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`,
|
|
1662
|
+
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 add dated tasks with a ◇ milestone (pmos task add --due … / pmos task set --milestone), or a done test`,
|
|
1616
1663
|
{ blocking: !legacy, rule: 'R2' }));
|
|
1617
1664
|
else if (doneTest && dtPresent) steps.push(step('brief', def.brief_label, 'blocked', 'no kill condition — an experiment states what would stop it (D107)',
|
|
1618
1665
|
`write kill: "<the result that would make us stop>" in ${recRel}`, { blocking: !legacy, rule: 'R2' }));
|
|
@@ -1896,7 +1943,7 @@ function listInitiatives(root) {
|
|
|
1896
1943
|
// ── CLI ────────────────────────────────────────────────────────────────────────────────────────
|
|
1897
1944
|
function main(argv) {
|
|
1898
1945
|
const args = argv.slice(2);
|
|
1899
|
-
let root = process.cwd(); let json = false; let gate = false; let all = false; let lanes = false;
|
|
1946
|
+
let root = process.cwd(); let json = false; let gate = false; let all = false; let lanes = false; let taskPlan = null;
|
|
1900
1947
|
const rest = [];
|
|
1901
1948
|
for (let i = 0; i < args.length; i++) {
|
|
1902
1949
|
const a = args[i];
|
|
@@ -1905,6 +1952,7 @@ function main(argv) {
|
|
|
1905
1952
|
if (a === '--gate') { gate = true; continue; }
|
|
1906
1953
|
if (a === '--all') { all = true; continue; }
|
|
1907
1954
|
if (a === '--lanes') { lanes = true; continue; }
|
|
1955
|
+
if (a === '--task-plan') { taskPlan = args[++i] || ''; continue; }
|
|
1908
1956
|
if (a === '--open') { continue; } // the board is in-flight-only by default now
|
|
1909
1957
|
if (a === '--help' || a === '-h') {
|
|
1910
1958
|
process.stdout.write([
|
|
@@ -1914,12 +1962,19 @@ function main(argv) {
|
|
|
1914
1962
|
' --gate <id> CI mode — exit 1 on a blocking order violation, with the next action',
|
|
1915
1963
|
' --all the board without the 12-row cap',
|
|
1916
1964
|
' --lanes every lane this repository offers: when to use it, input, output, done',
|
|
1965
|
+
' --task-plan <id> exit 0 when the task store holds a Project\'s dated plan (dated tasks with a ◇ milestone)',
|
|
1917
1966
|
' --json machine-readable (what an agent reads at session start)', '',
|
|
1918
1967
|
].join('\n') + '\n');
|
|
1919
1968
|
return 0;
|
|
1920
1969
|
}
|
|
1921
1970
|
rest.push(a);
|
|
1922
1971
|
}
|
|
1972
|
+
if (taskPlan !== null) {
|
|
1973
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/.test(taskPlan)) { process.stdout.write('--task-plan needs an initiative id\n'); return 2; }
|
|
1974
|
+
const tp = taskPlanOf(root, taskPlan);
|
|
1975
|
+
process.stdout.write(json ? JSON.stringify(tp) + '\n' : tp.evidence + '\n');
|
|
1976
|
+
return tp.ok ? 0 : 1;
|
|
1977
|
+
}
|
|
1923
1978
|
if (lanes) {
|
|
1924
1979
|
const info = lanesFor(root);
|
|
1925
1980
|
if (json) { process.stdout.write(JSON.stringify(info, null, 2) + '\n'); return 0; }
|
|
@@ -1987,7 +2042,7 @@ function main(argv) {
|
|
|
1987
2042
|
}
|
|
1988
2043
|
|
|
1989
2044
|
module.exports = {
|
|
1990
|
-
computeWorkflow, declaredLane: laneDefs.declaredLane, readLifecycle, STOPPED_STATES, renderLadder, renderBoard, listInitiatives, layout, inFlight, BOARD_CAP,
|
|
2045
|
+
computeWorkflow, taskPlanOf, declaredLane: laneDefs.declaredLane, readLifecycle, STOPPED_STATES, renderLadder, renderBoard, listInitiatives, layout, inFlight, BOARD_CAP,
|
|
1991
2046
|
parseLeadingFrontmatter, specimenRoute, surfaceRoute, priorsCitation, isBuildPath, commitRange,
|
|
1992
2047
|
// the board's trunk range, exported so the suite can assert the split: the same record is legacy
|
|
1993
2048
|
// under BOTH ranges, and `in this change` is false under the trunk one.
|
|
@@ -102,7 +102,12 @@ function flagged(root) {
|
|
|
102
102
|
function tick(root, { now = Date.now(), env = process.env } = {}) {
|
|
103
103
|
const A = require('./autonomy.js');
|
|
104
104
|
const k = A.killed({ env });
|
|
105
|
-
if (k) return { acted: [], why: k };
|
|
105
|
+
if (k) { holdOnce(root, k, { now, env }); return { acted: [], why: k }; }
|
|
106
|
+
try {
|
|
107
|
+
const sd0 = stateDir(root), st = sd0 ? A.fold(A.read(sd0)) : null;
|
|
108
|
+
const dm = st && (A.demotedNow(st, JOB, null, now) || A.demotedNow(st, OPEN_JOB, null, now));
|
|
109
|
+
if (dm) holdOnce(root, `the factory is back to propose-only until ${String(dm.until).slice(0, 10)}`, { now, env });
|
|
110
|
+
} catch { /* no autonomy ledger: nothing demoted */ }
|
|
106
111
|
const items = flagged(root);
|
|
107
112
|
if (!items.length) return { acted: [] };
|
|
108
113
|
const cfg = configOf(root);
|
|
@@ -149,6 +154,14 @@ function tick(root, { now = Date.now(), env = process.env } = {}) {
|
|
|
149
154
|
return { acted };
|
|
150
155
|
}
|
|
151
156
|
|
|
157
|
+
/** Once per reason: hold the factory's open pull requests (lib/build-engine.js holdOpen). Logged without an item, so no rollout reads it. */
|
|
158
|
+
function holdOnce(root, why, { now, env }) {
|
|
159
|
+
const prev = lines(root).filter((l) => l.step === 'hold-prs').pop();
|
|
160
|
+
if (prev && prev.why === why && prev.ok) return null;
|
|
161
|
+
const r = require('./build-engine.js').holdOpen(root, { env, why });
|
|
162
|
+
return log(root, { step: 'hold-prs', why, ok: !!r.ok, held: r.held || [], ...(r.ok ? {} : { error: r.error }) }, now);
|
|
163
|
+
}
|
|
164
|
+
|
|
152
165
|
function itemFlag(root, item) {
|
|
153
166
|
const it = require('./build-engine.js').itemsOf(root).find((x) => x.item_id === item);
|
|
154
167
|
if (!it) return { error: `${item} is not a work item here` };
|
|
@@ -187,4 +200,4 @@ function statusOf(root) {
|
|
|
187
200
|
return [...lastOf(root).values()].map((l) => ({ item: l.item, flag: l.flag, percent: Number(l.percent) || 0, step: l.step, at: l.at, why: l.why }));
|
|
188
201
|
}
|
|
189
202
|
|
|
190
|
-
module.exports = { STEPS, JOB, LEDGER, configOf, tick, rollout, rollback, statusOf };
|
|
203
|
+
module.exports = { STEPS, JOB, OPEN_JOB, LEDGER, configOf, tick, rollout, rollback, statusOf, holdOnce };
|
|
@@ -231,6 +231,48 @@ function layout(root) {
|
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
// ── A Project's dated plan in the task store (launch simulation W6 follow-up) ─────────────────────
|
|
235
|
+
// `pmos task add/link/set --milestone` writes a Project's plan as task lines in <runsDir>/initiative-tasks.jsonl (lib/task-store.js; lines
|
|
236
|
+
// not yet moved there still sit in boards.jsonl). Dated tasks with at least one dated ◇ milestone ARE the dated plan, so plan_path is not
|
|
237
|
+
// needed: the gate (kit/scripts/gate-initiative.sh, through --task-plan) and both ladders read them here. The fold is the task part of
|
|
238
|
+
// scripts/boards.js fold: the first task line makes the task, task-update moves or re-dates it, task-remove and task-restore take it out and
|
|
239
|
+
// back, and the last task-milestone line wins. → { ok, dated, milestones, file, evidence }
|
|
240
|
+
const DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
241
|
+
function taskPlanOf(root, id) {
|
|
242
|
+
const L = layout(root);
|
|
243
|
+
const files = ['boards.jsonl', 'initiative-tasks.jsonl'].map((f) => path.join(L.runsDir, f));
|
|
244
|
+
const tasks = new Map(); const removed = new Map(); const milestones = new Map();
|
|
245
|
+
for (const file of files) {
|
|
246
|
+
let text = '';
|
|
247
|
+
try { text = fs.readFileSync(file, 'utf8'); } catch { continue; }
|
|
248
|
+
for (const raw of text.split('\n')) {
|
|
249
|
+
const t = raw.trim();
|
|
250
|
+
if (!t || t[0] !== '{' || !t.includes('"task')) continue;
|
|
251
|
+
let e; try { e = JSON.parse(t); } catch { continue; }
|
|
252
|
+
if (!e || typeof e.task !== 'string' || !e.task) continue;
|
|
253
|
+
if (e.kind === 'task' && typeof e.initiative === 'string' && !tasks.has(e.task) && !removed.has(e.task)) {
|
|
254
|
+
tasks.set(e.task, { initiative: e.initiative, due: typeof e.due === 'string' ? e.due : '' });
|
|
255
|
+
} else if (e.kind === 'task-update' && tasks.has(e.task)) {
|
|
256
|
+
const x = tasks.get(e.task);
|
|
257
|
+
if (typeof e.initiative === 'string' && e.initiative) x.initiative = e.initiative;
|
|
258
|
+
if (typeof e.due === 'string') x.due = e.due;
|
|
259
|
+
} else if (e.kind === 'task-milestone' && typeof e.milestone === 'boolean') milestones.set(e.task, e.milestone);
|
|
260
|
+
else if (e.kind === 'task-remove' && tasks.has(e.task)) { removed.set(e.task, tasks.get(e.task)); tasks.delete(e.task); }
|
|
261
|
+
else if (e.kind === 'task-restore' && removed.has(e.task) && !tasks.has(e.task)) { tasks.set(e.task, removed.get(e.task)); removed.delete(e.task); }
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
let dated = 0; let ms = 0;
|
|
265
|
+
for (const [tid, x] of tasks) {
|
|
266
|
+
if (x.initiative !== id || !DAY_RE.test(x.due)) continue;
|
|
267
|
+
dated++;
|
|
268
|
+
if (milestones.get(tid) === true) ms++;
|
|
269
|
+
}
|
|
270
|
+
const file = path.relative(root, path.join(L.runsDir, 'initiative-tasks.jsonl')).split(path.sep).join('/');
|
|
271
|
+
const ok = ms > 0;
|
|
272
|
+
const evidence = `${dated} dated task${dated === 1 ? '' : 's'}, ${ms} dated milestone${ms === 1 ? '' : 's'} in ${file}`;
|
|
273
|
+
return { ok, dated, milestones: ms, file, evidence };
|
|
274
|
+
}
|
|
275
|
+
|
|
234
276
|
// ── Git ────────────────────────────────────────────────────────────────────────────────────────
|
|
235
277
|
function git(root, args) {
|
|
236
278
|
try {
|
|
@@ -973,9 +1015,12 @@ function computeWorkflowDerived(id, opts) {
|
|
|
973
1015
|
`write the done test (okf/core/templates/done-test-template.md), set done_test_path and kill: in ${recRel}`, { blocking: true, rule: 'R2' }));
|
|
974
1016
|
} else if (!doneTest && workKind === 'project' && (planPath || !prd)) {
|
|
975
1017
|
const planIdx = planPath ? firstAppearance(root, range, planPath) : null;
|
|
976
|
-
|
|
1018
|
+
const taskPlan = planPath ? null : taskPlanOf(root, id);
|
|
1019
|
+
if (taskPlan && taskPlan.ok) {
|
|
1020
|
+
steps.push(step('spec', 'spec', 'done', `dated plan in the task store: ${taskPlan.evidence}`));
|
|
1021
|
+
} else if (!planPath) {
|
|
977
1022
|
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' }));
|
|
1023
|
+
`write the plan (milestones with dates and owners, go-live matching the KR date) and set plan_path in ${recRel}, or add dated tasks with a ◇ milestone (pmos task add --due … / pmos task set --milestone), or a done test`, { blocking: true, rule: 'R2' }));
|
|
979
1024
|
} else if (planIdx === null) {
|
|
980
1025
|
steps.push(step('spec', 'spec', 'blocked', `plan_path '${planPath}' does not exist in the repo`,
|
|
981
1026
|
'create the plan the record points at, or correct plan_path', { blocking: true, rule: 'R2' }));
|
|
@@ -1605,14 +1650,16 @@ function pmLadder({ id, fm, lane, effLane, knownLane, legacy, steps, root, L, re
|
|
|
1605
1650
|
const workKind = (() => { const k = String(fm.kind || '').trim().replace(/^["']|["']$/g, ''); return k === 'sdlc' || k === 'project' ? k : 'product'; })();
|
|
1606
1651
|
const planPath = String(fm.plan_path || '').trim();
|
|
1607
1652
|
const kindSpec = !doneTest && !exists(briefPath) && !foundBrief && (workKind === 'sdlc' || (workKind === 'project'));
|
|
1653
|
+
const tasksPlan = kindSpec && workKind === 'project' && !planPath ? taskPlanOf(root, id) : null;
|
|
1608
1654
|
if (doneTest && dtPresent && killCond) steps.push(step('brief', def.brief_label, 'done', `done test ${doneTest} + kill condition (D107)`));
|
|
1609
1655
|
else if (kindSpec && workKind === 'sdlc') steps.push(step('brief', 'done test', legacy ? 'pending' : 'blocked',
|
|
1610
1656
|
'Full SDLC needs a done test and a kill condition before the first pull request — never a brief or a PRD',
|
|
1611
1657
|
`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
1658
|
else if (kindSpec && exists(planPath)) steps.push(step('brief', 'dated plan', 'done', `plan ${planPath} present`));
|
|
1659
|
+
else if (kindSpec && !planPath && tasksPlan && tasksPlan.ok) steps.push(step('brief', 'dated plan', 'done', `dated plan in the task store: ${tasksPlan.evidence}`));
|
|
1613
1660
|
else if (kindSpec) steps.push(step('brief', 'dated plan', legacy ? 'pending' : 'blocked',
|
|
1614
1661
|
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`,
|
|
1662
|
+
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 add dated tasks with a ◇ milestone (pmos task add --due … / pmos task set --milestone), or a done test`,
|
|
1616
1663
|
{ blocking: !legacy, rule: 'R2' }));
|
|
1617
1664
|
else if (doneTest && dtPresent) steps.push(step('brief', def.brief_label, 'blocked', 'no kill condition — an experiment states what would stop it (D107)',
|
|
1618
1665
|
`write kill: "<the result that would make us stop>" in ${recRel}`, { blocking: !legacy, rule: 'R2' }));
|
|
@@ -1896,7 +1943,7 @@ function listInitiatives(root) {
|
|
|
1896
1943
|
// ── CLI ────────────────────────────────────────────────────────────────────────────────────────
|
|
1897
1944
|
function main(argv) {
|
|
1898
1945
|
const args = argv.slice(2);
|
|
1899
|
-
let root = process.cwd(); let json = false; let gate = false; let all = false; let lanes = false;
|
|
1946
|
+
let root = process.cwd(); let json = false; let gate = false; let all = false; let lanes = false; let taskPlan = null;
|
|
1900
1947
|
const rest = [];
|
|
1901
1948
|
for (let i = 0; i < args.length; i++) {
|
|
1902
1949
|
const a = args[i];
|
|
@@ -1905,6 +1952,7 @@ function main(argv) {
|
|
|
1905
1952
|
if (a === '--gate') { gate = true; continue; }
|
|
1906
1953
|
if (a === '--all') { all = true; continue; }
|
|
1907
1954
|
if (a === '--lanes') { lanes = true; continue; }
|
|
1955
|
+
if (a === '--task-plan') { taskPlan = args[++i] || ''; continue; }
|
|
1908
1956
|
if (a === '--open') { continue; } // the board is in-flight-only by default now
|
|
1909
1957
|
if (a === '--help' || a === '-h') {
|
|
1910
1958
|
process.stdout.write([
|
|
@@ -1914,12 +1962,19 @@ function main(argv) {
|
|
|
1914
1962
|
' --gate <id> CI mode — exit 1 on a blocking order violation, with the next action',
|
|
1915
1963
|
' --all the board without the 12-row cap',
|
|
1916
1964
|
' --lanes every lane this repository offers: when to use it, input, output, done',
|
|
1965
|
+
' --task-plan <id> exit 0 when the task store holds a Project\'s dated plan (dated tasks with a ◇ milestone)',
|
|
1917
1966
|
' --json machine-readable (what an agent reads at session start)', '',
|
|
1918
1967
|
].join('\n') + '\n');
|
|
1919
1968
|
return 0;
|
|
1920
1969
|
}
|
|
1921
1970
|
rest.push(a);
|
|
1922
1971
|
}
|
|
1972
|
+
if (taskPlan !== null) {
|
|
1973
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/.test(taskPlan)) { process.stdout.write('--task-plan needs an initiative id\n'); return 2; }
|
|
1974
|
+
const tp = taskPlanOf(root, taskPlan);
|
|
1975
|
+
process.stdout.write(json ? JSON.stringify(tp) + '\n' : tp.evidence + '\n');
|
|
1976
|
+
return tp.ok ? 0 : 1;
|
|
1977
|
+
}
|
|
1923
1978
|
if (lanes) {
|
|
1924
1979
|
const info = lanesFor(root);
|
|
1925
1980
|
if (json) { process.stdout.write(JSON.stringify(info, null, 2) + '\n'); return 0; }
|
|
@@ -1987,7 +2042,7 @@ function main(argv) {
|
|
|
1987
2042
|
}
|
|
1988
2043
|
|
|
1989
2044
|
module.exports = {
|
|
1990
|
-
computeWorkflow, declaredLane: laneDefs.declaredLane, readLifecycle, STOPPED_STATES, renderLadder, renderBoard, listInitiatives, layout, inFlight, BOARD_CAP,
|
|
2045
|
+
computeWorkflow, taskPlanOf, declaredLane: laneDefs.declaredLane, readLifecycle, STOPPED_STATES, renderLadder, renderBoard, listInitiatives, layout, inFlight, BOARD_CAP,
|
|
1991
2046
|
parseLeadingFrontmatter, specimenRoute, surfaceRoute, priorsCitation, isBuildPath, commitRange,
|
|
1992
2047
|
// the board's trunk range, exported so the suite can assert the split: the same record is legacy
|
|
1993
2048
|
// under BOTH ranges, and `in this change` is false under the trunk one.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.573.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.573.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED