create-pmos 0.572.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.572.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,19 @@
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
+ },
36
49
  {
37
50
  "v": "0.572.0",
38
51
  "at": "2026-11-16T04:39:30.480Z",
@@ -297,19 +310,6 @@
297
310
  "k": "fix"
298
311
  }
299
312
  ]
300
- },
301
- {
302
- "v": "0.553.0",
303
- "at": "2026-11-10T22:27:26.069Z",
304
- "f": 4,
305
- "prs": [
306
- {
307
- "n": 1282,
308
- "t": "The Board groups By goal in every view and on a shared Board link",
309
- "s": "The Board groups By goal in every view and on a shared Board link",
310
- "k": "new"
311
- }
312
- ]
313
313
  }
314
314
  ]
315
315
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@3421561f
1
+ kernel-source: pmos@9d571f33
2
2
  assembled: 2026-11-16
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-16T04:39:26Z"}
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:39:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-16T04:53:07Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -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]');
@@ -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:39:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-16T04:53:07Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,17 @@
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
+ },
2
15
  {
3
16
  "v": "0.572.0",
4
17
  "at": "2026-11-16T04:39:30.480Z",
@@ -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
 
@@ -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
- * pmos build open <item> [--json] the PM only: push the branch and open the DRAFT pull request
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 and file "Open a draft pull request" under the initiative\'s ✦',
32
- ' pmos build open <item> you only (the ✓ runs it): push pmos/<item> and open the draft pull request',
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) { say(verb === 'next' ? 'No declared work item waits for a Builder.' : 'No work items.'); return 0; }
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 };
@@ -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 };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.572.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.572.0",
9
+ "version": "0.573.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.572.0",
3
+ "version": "0.573.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",