create-pmos 0.847.0 → 0.848.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 +28 -44
- 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/state/discoveries.md +1 -1
- package/workspace/changelog.json +27 -12
- package/workspace/guide/cli.md +11 -0
- package/workspace/lib/change-request-cli.js +160 -0
- package/workspace/lib/change-requests.js +136 -0
- package/workspace/lib/features.json +1 -0
- package/workspace/lib/needs-providers.js +1 -0
- package/workspace/lib/pmos-verbs.js +2 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/test-lists/change-requests.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.848.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,30 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.848.0",
|
|
38
|
+
"at": "2026-11-25T18:33:59.152Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 2037,
|
|
43
|
+
"t": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
|
|
44
|
+
"s": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
|
|
45
|
+
"k": "new",
|
|
46
|
+
"h": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
|
|
47
|
+
"try": {
|
|
48
|
+
"steps": [
|
|
49
|
+
"On Today, find the row in Your move for an open change request: who asked, what they asked and what it would break",
|
|
50
|
+
"Press its ✦ to approve, then press Undo",
|
|
51
|
+
"Open the chat (Ask PMOS). On a desk the chat opens from the menu button at the bottom left, then the speech bubble. Say: Dana asks to move…"
|
|
52
|
+
],
|
|
53
|
+
"see": "Each open change request is a Today row by itself, naming who asked and what it would break. Approve records your answer and Undo takes it back. A new ask from the chat is recorded with an id and…",
|
|
54
|
+
"open": "/today.html"
|
|
55
|
+
},
|
|
56
|
+
"i": "change-requests"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
36
60
|
{
|
|
37
61
|
"v": "0.847.0",
|
|
38
62
|
"at": "2026-11-25T18:22:14.213Z",
|
|
@@ -49,6 +73,7 @@
|
|
|
49
73
|
"t": "One RAID list per initiative, read from its own records (A101)",
|
|
50
74
|
"s": "One RAID list per initiative, read from its own records (A101)",
|
|
51
75
|
"k": "new",
|
|
76
|
+
"i": "raid-fold",
|
|
52
77
|
"h": "One RAID list per initiative, read from its own records (A101)",
|
|
53
78
|
"try": {
|
|
54
79
|
"steps": [
|
|
@@ -58,24 +83,14 @@
|
|
|
58
83
|
],
|
|
59
84
|
"see": "The Overview has one RAID line, for example '2 of 5 have not moved in 14 days: Late: Ship the copy (due 12 Nov)'. An initiative where everything moved has no RAID line. The chat shows each risk,…",
|
|
60
85
|
"open": "/premium-board.html"
|
|
61
|
-
}
|
|
62
|
-
"i": "raid-fold"
|
|
86
|
+
}
|
|
63
87
|
},
|
|
64
88
|
{
|
|
65
89
|
"n": 2044,
|
|
66
90
|
"t": "Work checks for new rows instead of re-reading the board every 2 s",
|
|
67
91
|
"s": "Work checks for new rows instead of re-reading the board every 2 s",
|
|
68
92
|
"k": "imp",
|
|
69
|
-
"i": "page-open-200ms"
|
|
70
|
-
"try": {
|
|
71
|
-
"steps": [
|
|
72
|
-
"Open Today, then Work, then an initiative from Work.",
|
|
73
|
-
"Change something on the initiative (a task title), wait a second, then open Work again.",
|
|
74
|
-
"Open the same initiative again."
|
|
75
|
-
],
|
|
76
|
-
"see": "each page shows its rows at once, in about the blink of an eye; the change you made shows on Work and on the initiative.",
|
|
77
|
-
"open": "/premium-board.html"
|
|
78
|
-
}
|
|
93
|
+
"i": "page-open-200ms"
|
|
79
94
|
}
|
|
80
95
|
]
|
|
81
96
|
},
|
|
@@ -1075,37 +1090,6 @@
|
|
|
1075
1090
|
}
|
|
1076
1091
|
}
|
|
1077
1092
|
]
|
|
1078
|
-
},
|
|
1079
|
-
{
|
|
1080
|
-
"v": "0.824.0",
|
|
1081
|
-
"at": "2026-11-25T09:50:46.868Z",
|
|
1082
|
-
"f": 4,
|
|
1083
|
-
"prs": [
|
|
1084
|
-
{
|
|
1085
|
-
"n": 1945,
|
|
1086
|
-
"t": "Job-graph lists report-variants, so main is green again",
|
|
1087
|
-
"s": "Job-graph lists report-variants, so main is green again",
|
|
1088
|
-
"k": "fix",
|
|
1089
|
-
"i": "report-three-audiences"
|
|
1090
|
-
},
|
|
1091
|
-
{
|
|
1092
|
-
"n": 1922,
|
|
1093
|
-
"t": "Balance meter on Work's Initiatives and Backlog lists (job #1859, board BalanceDS)",
|
|
1094
|
-
"s": "Balance meter on Work's Initiatives and Backlog lists (job #1859, board BalanceDS)",
|
|
1095
|
-
"k": "new",
|
|
1096
|
-
"i": "balance-meter",
|
|
1097
|
-
"h": "Balance meter on Work's Initiatives and Backlog lists (job #1859, board BalanceDS)",
|
|
1098
|
-
"try": {
|
|
1099
|
-
"steps": [
|
|
1100
|
-
"Open Work and look under the Initiatives header",
|
|
1101
|
-
"Press a kind in the bar's legend, then press it again",
|
|
1102
|
-
"Open the Backlog tab in Work and look under its header"
|
|
1103
|
-
],
|
|
1104
|
-
"see": "On Work, the bar and its counts sit under each list header, largest first. A press shows only that kind, and a second press shows all of them again. A ✦ note shows only when one kind is over 60% of…",
|
|
1105
|
-
"open": "/premium-board.html"
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
]
|
|
1109
1093
|
}
|
|
1110
1094
|
]
|
|
1111
1095
|
}
|
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-25T18:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T18:33:55Z"}
|
|
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-25T18:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T18:33:55Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -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-25T18:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T18:33:55Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.848.0",
|
|
4
|
+
"at": "2026-11-25T18:33:59.152Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 2037,
|
|
9
|
+
"t": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
|
|
10
|
+
"s": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
|
|
11
|
+
"k": "new",
|
|
12
|
+
"h": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
|
|
13
|
+
"try": {
|
|
14
|
+
"steps": [
|
|
15
|
+
"On Today, find the row in Your move for an open change request: who asked, what they asked and what it would break",
|
|
16
|
+
"Press its ✦ to approve, then press Undo",
|
|
17
|
+
"Open the chat (Ask PMOS). On a desk the chat opens from the menu button at the bottom left, then the speech bubble. Say: Dana asks to move…"
|
|
18
|
+
],
|
|
19
|
+
"see": "Each open change request is a Today row by itself, naming who asked and what it would break. Approve records your answer and Undo takes it back. A new ask from the chat is recorded with an id and…",
|
|
20
|
+
"open": "/today.html"
|
|
21
|
+
},
|
|
22
|
+
"i": "change-requests"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
2
26
|
{
|
|
3
27
|
"v": "0.847.0",
|
|
4
28
|
"at": "2026-11-25T18:22:14.213Z",
|
|
@@ -15,6 +39,7 @@
|
|
|
15
39
|
"t": "One RAID list per initiative, read from its own records (A101)",
|
|
16
40
|
"s": "One RAID list per initiative, read from its own records (A101)",
|
|
17
41
|
"k": "new",
|
|
42
|
+
"i": "raid-fold",
|
|
18
43
|
"h": "One RAID list per initiative, read from its own records (A101)",
|
|
19
44
|
"try": {
|
|
20
45
|
"steps": [
|
|
@@ -24,24 +49,14 @@
|
|
|
24
49
|
],
|
|
25
50
|
"see": "The Overview has one RAID line, for example '2 of 5 have not moved in 14 days: Late: Ship the copy (due 12 Nov)'. An initiative where everything moved has no RAID line. The chat shows each risk,…",
|
|
26
51
|
"open": "/premium-board.html"
|
|
27
|
-
}
|
|
28
|
-
"i": "raid-fold"
|
|
52
|
+
}
|
|
29
53
|
},
|
|
30
54
|
{
|
|
31
55
|
"n": 2044,
|
|
32
56
|
"t": "Work checks for new rows instead of re-reading the board every 2 s",
|
|
33
57
|
"s": "Work checks for new rows instead of re-reading the board every 2 s",
|
|
34
58
|
"k": "imp",
|
|
35
|
-
"i": "page-open-200ms"
|
|
36
|
-
"try": {
|
|
37
|
-
"steps": [
|
|
38
|
-
"Open Today, then Work, then an initiative from Work.",
|
|
39
|
-
"Change something on the initiative (a task title), wait a second, then open Work again.",
|
|
40
|
-
"Open the same initiative again."
|
|
41
|
-
],
|
|
42
|
-
"see": "each page shows its rows at once, in about the blink of an eye; the change you made shows on Work and on the initiative.",
|
|
43
|
-
"open": "/premium-board.html"
|
|
44
|
-
}
|
|
59
|
+
"i": "page-open-200ms"
|
|
45
60
|
}
|
|
46
61
|
]
|
|
47
62
|
},
|
package/workspace/guide/cli.md
CHANGED
|
@@ -688,6 +688,17 @@ Once a week Today shows how many initiatives had no change in 30 days or more. T
|
|
|
688
688
|
|
|
689
689
|
Every command takes `--json` and `--root <repository>`. Exit codes: 0 done, 1 off or refused, 2 usage.
|
|
690
690
|
|
|
691
|
+
### pmos change-request: record a stakeholder's ask
|
|
692
|
+
|
|
693
|
+
- `pmos change-request add <initiative> "<ask>" --from <name>` — records the ask, who asked and the initiative. Add the change it asks for and PMOS works out what it would break or help, each effect with its source: `--end YYYY-MM-DD` (the initiative's end), `--move <task> --by <days>` (or `--start` / `--due`), or `--cut [task]` (the whole initiative, or one task).
|
|
694
|
+
- `pmos change-request decide <id> approve|reject [--note "…"]` — records the PM's answer. Approve records the answer only: make the change with `pmos task set` or `pmos task state`.
|
|
695
|
+
- `pmos change-request undo <id>` — takes the last answer back. The request is open again.
|
|
696
|
+
- `pmos change-request list [--all]` — open requests first. `--all` shows the answered ones too.
|
|
697
|
+
- `pmos change-request show <id>` — the ask, its effects with their sources, and the answer.
|
|
698
|
+
- `pmos change-request count [--days N]` — the requests recorded in the last N days (7).
|
|
699
|
+
|
|
700
|
+
A change request never changes a date, a task or an initiative, and PMOS sends nothing. Every command takes `--json`. Exit codes: 0 done, 1 refused, 2 usage.
|
|
701
|
+
|
|
691
702
|
### pmos metrics: metric drafts and readings
|
|
692
703
|
|
|
693
704
|
PMOS's background run files its drafts with these commands. The server pins the product, program or initiative and the run, so the commands refuse outside that run. You keep and drop drafts on the page.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* change-request-cli.js — `pmos change-request`: a stakeholder's ask, recorded with what it would break or help (initiative change-requests).
|
|
3
|
+
*
|
|
4
|
+
* pmos change-request add <initiative> "<ask>" --from <name> [--end YYYY-MM-DD | --move <task> --by <days> | --cut [task]]
|
|
5
|
+
* pmos change-request decide <id> approve|reject [--note "…"]
|
|
6
|
+
* pmos change-request undo <id>
|
|
7
|
+
* pmos change-request list [--all]
|
|
8
|
+
* pmos change-request show <id>
|
|
9
|
+
* pmos change-request count [--days N]
|
|
10
|
+
* every command takes --json; add also takes --root <repository> and --today YYYY-MM-DD
|
|
11
|
+
*
|
|
12
|
+
* The store is lib/change-requests.js. With a date or a cut, add runs the rehearse engine (lib/rehearse.js) through its guard
|
|
13
|
+
* (lib/rehearse-guard.js), so every effect it keeps names its source. Nothing here changes a date, a task or an initiative, and
|
|
14
|
+
* nothing is sent. Exit codes: 0 done, 1 refused, 2 usage. */
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
const CR = require('./change-requests.js');
|
|
18
|
+
|
|
19
|
+
const COMMANDS = { 'change-request': ['add', 'decide', 'undo', 'list', 'show', 'count'] };
|
|
20
|
+
const USAGE = [
|
|
21
|
+
'usage: pmos change-request add|decide|undo|list|show|count — a stakeholder\'s ask, recorded with what it would break or help. Nothing changes.',
|
|
22
|
+
' pmos change-request add <initiative> "<ask>" --from <name> record the ask, and who asked',
|
|
23
|
+
' [--end YYYY-MM-DD | --move <task> --by <days> | --cut [task]] the change it asks for: PMOS works out what it breaks or helps',
|
|
24
|
+
' pmos change-request decide <id> approve|reject [--note "…"] the PM\'s answer (it records the answer only)',
|
|
25
|
+
' pmos change-request undo <id> take the last answer back; the request is open again',
|
|
26
|
+
' pmos change-request list [--all] open requests first',
|
|
27
|
+
' pmos change-request show <id> the ask, its effects and the answer',
|
|
28
|
+
' pmos change-request count [--days N] requests recorded in the last N days (7)',
|
|
29
|
+
'Approve does not make the change. Make it with `pmos task set` or `pmos task state` after the PM says yes.',
|
|
30
|
+
];
|
|
31
|
+
const VALUE = new Set(['from', 'end', 'move', 'by', 'start', 'due', 'cut', 'note', 'root', 'today', 'days']);
|
|
32
|
+
const BOOL = new Set(['json', 'all']);
|
|
33
|
+
|
|
34
|
+
function parse(args) {
|
|
35
|
+
const pos = [], flags = {};
|
|
36
|
+
for (let i = 0; i < args.length; i++) {
|
|
37
|
+
const m = /^--([a-z-]+)(?:=(.*))?$/.exec(args[i]);
|
|
38
|
+
if (!m) { pos.push(args[i]); continue; }
|
|
39
|
+
if (m[2] !== undefined) flags[m[1]] = m[2];
|
|
40
|
+
else if (VALUE.has(m[1]) && args[i + 1] !== undefined && !/^--[a-z]/.test(args[i + 1])) flags[m[1]] = args[++i];
|
|
41
|
+
else flags[m[1]] = true;
|
|
42
|
+
}
|
|
43
|
+
return { pos, flags };
|
|
44
|
+
}
|
|
45
|
+
/** The repository this runs in: the nearest folder up from cwd that holds .git (no program is run), else cwd. */
|
|
46
|
+
function repoRoot(cwd) {
|
|
47
|
+
let d = path.resolve(cwd);
|
|
48
|
+
for (;;) {
|
|
49
|
+
if (fs.existsSync(path.join(d, '.git'))) return d;
|
|
50
|
+
const up = path.dirname(d);
|
|
51
|
+
if (up === d) return path.resolve(cwd);
|
|
52
|
+
d = up;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const day = (s) => String(s || '').slice(0, 16).replace('T', ' ');
|
|
56
|
+
const STATE = { open: 'open', approved: 'approved', rejected: 'rejected' };
|
|
57
|
+
|
|
58
|
+
function lineOf(r) {
|
|
59
|
+
const fx = r.change ? (r.counts ? `${r.counts.breaks || 0} breaks · ${r.counts.helps || 0} helps` : 'no effect') : 'no date';
|
|
60
|
+
return `${r.id} · ${STATE[r.state]} · ${r.ini} · "${r.ask}" — ${r.from} · ${fx}`;
|
|
61
|
+
}
|
|
62
|
+
function showOf(r) {
|
|
63
|
+
const out = [`${r.id} · ${STATE[r.state]}`, `Ask: "${r.ask}"`, `From: ${r.from} · initiative ${r.ini} · ${day(r.at)}`];
|
|
64
|
+
if (!r.change) out.push('No date effect was worked out: the ask names no date or cut.');
|
|
65
|
+
else if (!r.effects.length) out.push('Nothing else moves.');
|
|
66
|
+
else for (const e of r.effects) out.push(`${e.tone === 'breaks' ? '✗' : e.tone === 'helps' ? '✓' : '·'} ${e.text}${e.evidence && e.evidence.length ? ' (' + e.evidence.map((s) => s.ref).join(', ') + ')' : ''}`);
|
|
67
|
+
if (r.answer) out.push(`Answer: ${r.answer.answer} · ${r.answer.by} · ${day(r.answer.at)}${r.answer.note ? ' · ' + r.answer.note : ''}`);
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), env = process.env, stateDir = null, snapshot = null, root: rootIn = null, actor = null } = {}) {
|
|
72
|
+
const args = argv[0] === 'change-request' ? argv.slice(1) : argv.slice();
|
|
73
|
+
const verb = args[0];
|
|
74
|
+
if (!verb || ['help', '--help', '-h'].includes(verb)) { for (const l of USAGE) say(l); return verb ? 0 : 1; }
|
|
75
|
+
if (!COMMANDS['change-request'].includes(verb)) { say(`unknown change-request command "${verb}" — one of ${COMMANDS['change-request'].join(', ')}`); return 2; }
|
|
76
|
+
const { pos, flags } = parse(args.slice(1));
|
|
77
|
+
for (const k of Object.keys(flags)) if (!VALUE.has(k) && !BOOL.has(k)) { say(`unknown option --${k}`); return 2; }
|
|
78
|
+
for (const k of Object.keys(flags)) if (VALUE.has(k) && k !== 'cut' && flags[k] === true) { say(`--${k} needs a value`); return 2; }
|
|
79
|
+
const json = !!flags.json, runtime = stateDir || require('./state-root.js').defaultRoot({ env });
|
|
80
|
+
const by = (actor || require('./actor.js').fromCli({ env })).by;
|
|
81
|
+
const fail = (error, code = 1) => { if (json) say(JSON.stringify({ ok: false, error })); else say('✗ ' + error); return code; };
|
|
82
|
+
const done = (o, text) => { if (json) say(JSON.stringify({ ok: true, ...o })); else for (const l of text) say(l); return 0; };
|
|
83
|
+
|
|
84
|
+
if (verb === 'count') {
|
|
85
|
+
const days = Math.max(1, Number(flags.days) || 7);
|
|
86
|
+
const n = CR.count(runtime, { days });
|
|
87
|
+
return done({ count: n, days }, [`${n} change request${n === 1 ? '' : 's'} recorded in the last ${days} days.`]);
|
|
88
|
+
}
|
|
89
|
+
if (verb === 'list') {
|
|
90
|
+
const all = CR.read(runtime), shown = flags.all ? all : all.filter((r) => r.state === 'open');
|
|
91
|
+
if (!shown.length) return done({ requests: [] }, [flags.all || !all.length ? 'No change request yet.' : `No open change request. ${all.length} answered: \`pmos change-request list --all\`.`]);
|
|
92
|
+
return done({ requests: shown }, shown.map(lineOf));
|
|
93
|
+
}
|
|
94
|
+
if (verb === 'show') {
|
|
95
|
+
if (pos.length !== 1) return fail('usage: pmos change-request show <id>', 2);
|
|
96
|
+
const r = CR.find(runtime, pos[0]);
|
|
97
|
+
return r ? done({ request: r }, showOf(r)) : fail(`no change request ${pos[0]}`);
|
|
98
|
+
}
|
|
99
|
+
if (verb === 'decide') {
|
|
100
|
+
if (pos.length !== 2 || !CR.ANSWERS.includes(pos[1])) return fail('usage: pmos change-request decide <id> approve|reject [--note "…"]', 2);
|
|
101
|
+
const got = CR.decide(runtime, pos[0], pos[1], { by, note: typeof flags.note === 'string' ? flags.note : '' });
|
|
102
|
+
if (!got.ok) return fail(got.error);
|
|
103
|
+
const tail = pos[1] === 'approve' ? 'Recorded. Nothing changed yet: make the change with `pmos task set` or `pmos task state`.' : 'Recorded. Tell ' + got.request.from + ' in your own words.';
|
|
104
|
+
return done({ request: got.request, changed: false }, [`✓ ${got.request.id} ${got.request.state}. ${tail}`, `Undo: pmos change-request undo ${got.request.id}`]);
|
|
105
|
+
}
|
|
106
|
+
if (verb === 'undo') {
|
|
107
|
+
if (pos.length !== 1) return fail('usage: pmos change-request undo <id>', 2);
|
|
108
|
+
const got = CR.undo(runtime, pos[0], { by });
|
|
109
|
+
return got.ok ? done({ request: got.request }, [`✓ ${got.request.id} is ${got.request.state} again.`]) : fail(got.error);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// add
|
|
113
|
+
const [ini, ...rest] = pos, ask = rest.join(' ').trim();
|
|
114
|
+
if (!ini || !ask) return fail('usage: pmos change-request add <initiative> "<ask>" --from <name> [--end YYYY-MM-DD | --move <task> --by <days> | --cut [task]]', 2);
|
|
115
|
+
if (typeof flags.from !== 'string' || !flags.from.trim()) return fail('say who asked, with --from <name>', 2);
|
|
116
|
+
const asks = ['end', 'move', 'cut'].filter((k) => flags[k] !== undefined);
|
|
117
|
+
if (asks.length > 1) return fail('one change per request: --end, --move or --cut', 2);
|
|
118
|
+
if (flags.by !== undefined && flags.move === undefined) return fail('--by goes with --move <task>', 2);
|
|
119
|
+
const root = rootIn || (flags.root ? path.resolve(cwd, flags.root) : repoRoot(cwd));
|
|
120
|
+
const snap = snapshot || require('./rehearse-read.js').snapshotOf(root, { today: typeof flags.today === 'string' ? flags.today : undefined });
|
|
121
|
+
const known = (snap.rows || []).some((r) => r.id === ini) || fs.existsSync(path.join(root, 'planning', 'initiatives', ini + '.md'));
|
|
122
|
+
if (!known) return fail(`no initiative ${ini}. \`pmos initiative list\` names them.`);
|
|
123
|
+
|
|
124
|
+
let change = null, effects = [], counts = null, missing = [], dropped = 0;
|
|
125
|
+
if (asks.length) {
|
|
126
|
+
if (flags.end !== undefined) change = { kind: 'end', ini, to: flags.end };
|
|
127
|
+
else if (flags.move !== undefined) {
|
|
128
|
+
if (flags.by === undefined && !flags.start && !flags.due) return fail('say how far: --by <days>, --start or --due', 2);
|
|
129
|
+
if (flags.by !== undefined && !/^-?\d+$/.test(String(flags.by))) return fail('--by takes whole days, e.g. --by 3 or --by -2', 2);
|
|
130
|
+
change = { kind: 'move', task: flags.move, ...(flags.by !== undefined ? { days: Number(flags.by) } : {}), ...(flags.start ? { start: flags.start } : {}), ...(flags.due ? { due: flags.due } : {}) };
|
|
131
|
+
} else change = flags.cut === true ? { kind: 'cut', ini } : { kind: 'cut', task: flags.cut };
|
|
132
|
+
const RH = require('./rehearse.js'), G = require('./rehearse-guard.js');
|
|
133
|
+
const r = RH.rehearse(snap, change);
|
|
134
|
+
if (!r.ok) return fail(r.error, /^(say how|--)/.test(r.error) ? 2 : 1);
|
|
135
|
+
const g = await G.guarded(r, { root, stateDir: runtime, env });
|
|
136
|
+
if (g.off) missing.push('the rehearsal (off: ' + g.off + ')');
|
|
137
|
+
else if (g.held) missing.push('the rehearsal (its replay did not pass)');
|
|
138
|
+
else {
|
|
139
|
+
effects = g.effects.map((e) => ({ tone: e.tone, kind: e.kind, ini: e.ini || null, text: e.text, evidence: (e.evidence || []).map((s) => ({ label: s.label, ref: s.ref, quote: s.quote || '' })) }));
|
|
140
|
+
counts = { breaks: 0, helps: 0, moves: 0 };
|
|
141
|
+
for (const e of effects) counts[e.tone]++;
|
|
142
|
+
dropped = g.dropped.length;
|
|
143
|
+
}
|
|
144
|
+
missing.push(...(r.missing || []));
|
|
145
|
+
}
|
|
146
|
+
const got = CR.add(runtime, { ask, from: flags.from, ini, change, effects, counts, missing, by, root });
|
|
147
|
+
if (!got.ok) return fail(got.error, 2);
|
|
148
|
+
const q = got.request, text = [`✓ ${q.id} recorded: "${q.ask}" — ${q.from}, on ${q.ini}.`];
|
|
149
|
+
if (!change) text.push('No date effect was worked out: the ask names no date or cut.');
|
|
150
|
+
else if (!counts) text.push('No effect was worked out: ' + missing[0] + '.');
|
|
151
|
+
else {
|
|
152
|
+
text.push(effects.length ? `It would break ${counts.breaks} and help ${counts.helps}:` : 'Nothing else moves.');
|
|
153
|
+
for (const e of effects) text.push(` ${e.tone === 'breaks' ? '✗' : e.tone === 'helps' ? '✓' : '·'} ${e.text}`);
|
|
154
|
+
if (dropped) text.push(`${dropped === 1 ? '1 effect is' : dropped + ' effects are'} not kept: PMOS could not find its source.`);
|
|
155
|
+
}
|
|
156
|
+
text.push(`Nothing changed. Answer with pmos change-request decide ${q.id} approve|reject`);
|
|
157
|
+
return done({ request: q, changed: false }, text);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* change-requests.js — a stakeholder's ask, recorded as a change request (initiative change-requests, idea A105).
|
|
3
|
+
*
|
|
4
|
+
* Someone outside the team asks for a change ("can checkout end on the 30th?"). PMOS records who asked, on which initiative, what
|
|
5
|
+
* they asked and, when the ask names a date or a cut, what it would break or help, from the rehearse engine (lib/rehearse.js) with
|
|
6
|
+
* the source of each effect. The PM answers approve or reject; Undo takes the answer back.
|
|
7
|
+
*
|
|
8
|
+
* A change request never changes a date, a task or an initiative, and never sends anything. Approve records the answer only: the PM
|
|
9
|
+
* (or the session, after the PM says yes) makes the change with `pmos task set`, `pmos task state` or the PM's own act.
|
|
10
|
+
*
|
|
11
|
+
* fileOf(runtime) <runtime>/change-requests.jsonl (append-only: add, decide, undo)
|
|
12
|
+
* read(runtime) → [request] every request folded from its lines, open first, then newest first
|
|
13
|
+
* add(runtime, o) → { ok, request } | { ok:false, error }
|
|
14
|
+
* o: { ask, from, ini, change?, effects?, counts?, missing?, by, at? } change is a rehearse change, or null for an ask with no date
|
|
15
|
+
* decide(runtime, id, answer, o) → { ok, request } | { ok:false, error } answer: approve | reject; o: { by, note?, at? }
|
|
16
|
+
* undo(runtime, id, o) → { ok, request } | { ok:false, error } the last answer back; the request is open again
|
|
17
|
+
* count(runtime, { days, now }) → number requests recorded in the last N days (the health number)
|
|
18
|
+
*
|
|
19
|
+
* node lib/change-requests.js count --days 7 prints that number (health_read)
|
|
20
|
+
*
|
|
21
|
+
* needs provider (lib/needs-providers.js): kinds ['change-request'] · rowsFor(w, { lead }) · sig(w)
|
|
22
|
+
* Each open request recorded for workspace w's repository is one Today row (kind 1) by itself, with no typed ask: who asked,
|
|
23
|
+
* what, and what it would break. Its ✦ approves (records the answer only), with Undo. rowsOf(ws, requests, root) is the pure part.
|
|
24
|
+
*
|
|
25
|
+
* Each write logs one `[change-requests]` line to stderr. Nothing is sent. */
|
|
26
|
+
const fs = require('fs');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
const crypto = require('crypto');
|
|
29
|
+
|
|
30
|
+
const FILE = 'change-requests.jsonl';
|
|
31
|
+
const ANSWERS = ['approve', 'reject'];
|
|
32
|
+
const fileOf = (runtime) => path.join(runtime, FILE);
|
|
33
|
+
const log = (s) => { try { process.stderr.write('[change-requests] ' + s + '\n'); } catch { /* a closed stream */ } };
|
|
34
|
+
|
|
35
|
+
function lines(runtime) {
|
|
36
|
+
let raw = '';
|
|
37
|
+
try { raw = fs.readFileSync(fileOf(runtime), 'utf8'); } catch { return []; }
|
|
38
|
+
const out = [];
|
|
39
|
+
for (const l of raw.split('\n')) { if (!l.trim()) continue; try { out.push(JSON.parse(l)); } catch { /* a torn line */ } }
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
function append(runtime, line) {
|
|
43
|
+
fs.mkdirSync(runtime, { recursive: true });
|
|
44
|
+
fs.appendFileSync(fileOf(runtime), JSON.stringify(line) + '\n');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Every request, folded from its lines: open requests first, then the newest first. */
|
|
48
|
+
function read(runtime) {
|
|
49
|
+
const byId = new Map();
|
|
50
|
+
for (const l of lines(runtime)) {
|
|
51
|
+
if (l.ev === 'add' && l.id && !byId.has(l.id)) {
|
|
52
|
+
byId.set(l.id, { id: l.id, at: l.at, by: l.by, root: l.root || null, from: l.from, ini: l.ini, ask: l.ask, change: l.change || null, effects: l.effects || [], counts: l.counts || null, missing: l.missing || [], state: 'open', answers: [] });
|
|
53
|
+
} else if (l.ev === 'decide' && byId.has(l.id)) {
|
|
54
|
+
const r = byId.get(l.id);
|
|
55
|
+
r.answers.push({ answer: l.answer, by: l.by, at: l.at, note: l.note || '' });
|
|
56
|
+
r.state = l.answer === 'approve' ? 'approved' : 'rejected';
|
|
57
|
+
} else if (l.ev === 'undo' && byId.has(l.id)) {
|
|
58
|
+
const r = byId.get(l.id);
|
|
59
|
+
r.answers.pop();
|
|
60
|
+
const last = r.answers[r.answers.length - 1];
|
|
61
|
+
r.state = last ? (last.answer === 'approve' ? 'approved' : 'rejected') : 'open';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const all = [...byId.values()];
|
|
65
|
+
for (const r of all) r.answer = r.answers[r.answers.length - 1] || null;
|
|
66
|
+
return all.sort((a, b) => (a.state === 'open' ? 0 : 1) - (b.state === 'open' ? 0 : 1) || String(b.at).localeCompare(String(a.at)));
|
|
67
|
+
}
|
|
68
|
+
const find = (runtime, id) => read(runtime).find((r) => r.id === id) || null;
|
|
69
|
+
|
|
70
|
+
function add(runtime, o = {}) {
|
|
71
|
+
const ask = String(o.ask || '').trim(), from = String(o.from || '').trim(), ini = String(o.ini || '').trim();
|
|
72
|
+
if (!ask) return { ok: false, error: 'say what was asked, e.g. pmos change-request add checkout "End on the 30th" --from Dana' };
|
|
73
|
+
if (!from) return { ok: false, error: 'say who asked, with --from <name>' };
|
|
74
|
+
if (!ini) return { ok: false, error: 'say which initiative the ask is about' };
|
|
75
|
+
const id = 'cr-' + crypto.randomBytes(3).toString('hex');
|
|
76
|
+
const line = { ev: 'add', id, at: o.at || new Date().toISOString(), by: o.by || 'agent:unknown', root: o.root ? path.resolve(o.root) : null, from, ini, ask, change: o.change || null, effects: o.effects || [], counts: o.counts || null, missing: o.missing || [] };
|
|
77
|
+
append(runtime, line);
|
|
78
|
+
log(`add ${id} ${ini} from ${from}${line.change ? ' · ' + line.effects.length + ' effects' : ' · no date effect'}`);
|
|
79
|
+
return { ok: true, request: find(runtime, id) };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function decide(runtime, id, answer, o = {}) {
|
|
83
|
+
if (!ANSWERS.includes(answer)) return { ok: false, error: 'answer approve or reject' };
|
|
84
|
+
const r = find(runtime, id);
|
|
85
|
+
if (!r) return { ok: false, error: `no change request ${id}` };
|
|
86
|
+
if (r.state !== 'open') return { ok: false, error: `${id} is already ${r.state}. \`pmos change-request undo ${id}\` takes that answer back first.` };
|
|
87
|
+
append(runtime, { ev: 'decide', id, at: o.at || new Date().toISOString(), by: o.by || 'agent:unknown', answer, note: String(o.note || '').trim() });
|
|
88
|
+
log(`decide ${id} ${answer}`);
|
|
89
|
+
return { ok: true, request: find(runtime, id) };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function undo(runtime, id, o = {}) {
|
|
93
|
+
const r = find(runtime, id);
|
|
94
|
+
if (!r) return { ok: false, error: `no change request ${id}` };
|
|
95
|
+
if (!r.answers.length) return { ok: false, error: `${id} has no answer to take back` };
|
|
96
|
+
append(runtime, { ev: 'undo', id, at: o.at || new Date().toISOString(), by: o.by || 'agent:unknown' });
|
|
97
|
+
log(`undo ${id}`);
|
|
98
|
+
return { ok: true, request: find(runtime, id) };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function count(runtime, { days = 7, now = Date.now() } = {}) {
|
|
102
|
+
const since = now - days * 86400000;
|
|
103
|
+
return read(runtime).filter((r) => Date.parse(r.at) >= since).length;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* ── the needs provider: an open request is a Today row by itself ─────────────────────────────────────────────────── */
|
|
107
|
+
const KIND = 'change-request';
|
|
108
|
+
const clip = (x, n) => String(x == null ? '' : x).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
109
|
+
/** The Today rows for workspace `ws` at repository `root`: one per open request recorded there. Pure. */
|
|
110
|
+
function rowsOf(ws, requests, root) {
|
|
111
|
+
const at = root ? path.resolve(root) : null;
|
|
112
|
+
return (requests || []).filter((r) => r.state === 'open' && (!r.root || !at || r.root === at)).map((r) => {
|
|
113
|
+
const fx = !r.change ? 'It names no date or cut.' : r.counts && r.counts.breaks ? `It would break ${r.counts.breaks}${r.counts.helps ? ' and help ' + r.counts.helps : ''}: ${clip((r.effects.find((e) => e.tone === 'breaks') || {}).text, 120)}` : 'Nothing else moves.';
|
|
114
|
+
const cause = `${clip(r.from, 40)} asks: "${clip(r.ask, 120)}" on ${r.ini}. ${fx}`;
|
|
115
|
+
return {
|
|
116
|
+
run_id: `${KIND}:${ws}:${r.id}`, kind: KIND, initiative_id: r.ini, question: cause, doc: null, ws,
|
|
117
|
+
today: { kind: 1, source: 'change-requests', cause, evidence: `Change request ${r.id} · ${String(r.at).slice(0, 10)}${r.effects.length ? ' · ' + r.effects.length + ' effects with sources' : ''}`,
|
|
118
|
+
act: { label: 'Approve', cli: `pmos change-request decide ${r.id} approve`, undo: `pmos change-request undo ${r.id}` } },
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
const runtimeNow = () => require('./state-root.js').defaultRoot({ env: process.env });
|
|
123
|
+
function rowsFor(w, { lead } = {}) {
|
|
124
|
+
if (!lead || !w || !w.root) return [];
|
|
125
|
+
return rowsOf(w.id, read(runtimeNow()), w.root);
|
|
126
|
+
}
|
|
127
|
+
function sig() { try { const st = fs.statSync(fileOf(runtimeNow())); return st.size + ':' + st.mtimeMs; } catch { return '-'; } }
|
|
128
|
+
|
|
129
|
+
module.exports = { FILE, ANSWERS, KIND, kinds: [KIND], fileOf, read, find, add, decide, undo, count, rowsOf, rowsFor, sig };
|
|
130
|
+
|
|
131
|
+
if (require.main === module) {
|
|
132
|
+
const a = process.argv.slice(2);
|
|
133
|
+
if (a[0] !== 'count') { console.log('usage: node lib/change-requests.js count [--days N]'); process.exit(2); }
|
|
134
|
+
const i = a.indexOf('--days'), days = i >= 0 ? Math.max(1, Number(a[i + 1]) || 7) : 7;
|
|
135
|
+
console.log(String(count(require('./state-root.js').defaultRoot({ env: process.env }), { days })));
|
|
136
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
{"id": "goal", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Give PMOS a goal", "say": "PMOS asks a few questions, then works on the goal after you press Start.", "cmd": "/goal", "phrases": ["work on this until", "keep going until", "make it happen"], "since": "0.560.0"},
|
|
6
6
|
{"id": "why", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Why this work exists", "say": "Three lines on an initiative or a task: its goal, its problem and the evidence.", "cmd": "/why", "verb": "why", "hint": "<initiative or task>", "phrases": ["why does this exist", "why are we doing", "why are we building", "what is the point of", "reason for this work", "why this initiative"], "phone": true, "since": "0.700.0", "ask": ["initiative", "task"]},
|
|
7
7
|
{"id": "rehearse", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Rehearse a change", "say": "Move a task by some days and see what else slips, before anything changes.", "cmd": "/rehearse", "verb": "rehearse", "sub": "move", "hint": "<task> <days>", "ask": ["task"], "place": "board", "phrases": ["what if slips", "what happens if slips", "what if move", "push back", "delay by", "slips a week", "what breaks if", "move the date", "what if we cut"], "since": "0.600.0"},
|
|
8
|
+
{"id": "change-request", "audience": "user", "status": "beta", "group": "Plan and decide", "name": "Record a change request", "say": "Record a stakeholder's ask with who asked and what it would break, then approve or reject it.", "cmd": "/change-request", "verb": "change-request"},
|
|
8
9
|
{"id": "decisions", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Decision journal", "say": "Write one line per decision, with what you expect and the date to check it.", "cmd": "/decide", "verb": "decisions", "sub": "add", "hint": "<the decision>", "phrases": ["we decided", "log a decision", "record a decision", "note the decision", "decision journal", "list decisions"], "since": "0.640.0"},
|
|
9
10
|
{"id": "questions", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Open questions", "say": "Every question nobody has answered yet, oldest first, in one list.", "cmd": "/questions", "verb": "questions", "phrases": ["open questions", "unanswered questions", "what is still open", "questions nobody answered", "what do we not know"], "phone": true, "since": "0.660.0"},
|
|
10
11
|
{"id": "press-release", "audience": "user", "status": "ga", "group": "Plan and decide", "name": "Press release and FAQ", "say": "A one-page press release and FAQ for a bet, drafted from its record, for you to edit.", "cmd": "/press-release", "verb": "press-release", "hint": "<initiative>", "phrases": ["press release", "working backwards", "write the faq", "announce this"], "since": "0.690.0", "ask": ["initiative"]},
|
|
@@ -44,6 +44,7 @@ const PROVIDERS = Object.freeze([
|
|
|
44
44
|
'team-slips', // team-slips (bet A15): another team your work waits on will likely slip, with the one ✦ move (kind 7)
|
|
45
45
|
'setup-station', // setup-station: a product that has not passed Setup (tracker read, agreed goal, owner), with the next ✦ (kind 7)
|
|
46
46
|
'critical-needs', // critical-moved (bet A103): a task on an initiative's critical path moved its start or due date, with go-live (kind 7)
|
|
47
|
+
'change-requests', // change-requests (bet A105): a stakeholder's open change request, with what it would break; ✦ approves with Undo (kind 1)
|
|
47
48
|
]);
|
|
48
49
|
/** Kinds that already mean something in the needs queue. A provider may not reuse one. */
|
|
49
50
|
const RESERVED_KINDS = Object.freeze(['question', 'accept', 'outcome', 'keep', 'evidence', 'plan-flag', 'provider-error']);
|
|
@@ -113,6 +113,8 @@ const VERBS = Object.freeze({
|
|
|
113
113
|
ai: Object.freeze({ module: 'ai-cli.js', run: null, guide: 'cli.md',
|
|
114
114
|
help: 'pmos ai status|off|on|log … — the AI jobs: their kill switch, replay state and audit (pmos ai help)' }),
|
|
115
115
|
// Not a pm-os-absorb verb (run: null): the AI-ideas round (2026-11-03, feature 5, plan-rehearsal) added it through the same table.
|
|
116
|
+
'change-request': Object.freeze({ module: 'change-request-cli.js', run: null, guide: 'cli.md',
|
|
117
|
+
help: 'pmos change-request add|decide|undo|list|show|count … — a stakeholder\'s ask, recorded with what it would break or help; approve records the answer only (pmos change-request help)' }),
|
|
116
118
|
rehearse: Object.freeze({ module: 'rehearse-cli.js', run: null, guide: 'cli.md',
|
|
117
119
|
help: 'pmos rehearse move|end|cut|log … — what a change would break or help in other initiatives, goals and dates, before the PM approves it (pmos rehearse help)' }),
|
|
118
120
|
// Not a pm-os-absorb verb (run: null): Grill and Forecast part G-A (Claude grills an initiative by itself) added it through the same table.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.848.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.848.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "change-requests (bet A105, job #2024): a stakeholder's ask recorded as a change request. The store, `pmos change-request` on the recorded rehearse snapshot, and the must-nots (no date, task or initiative write, nothing sent). No browser, no model.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"change-requests.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"change-requests.test.js": 3
|
|
8
|
+
}
|
|
9
|
+
}
|