@modootoday/pmcp 0.22.11 → 0.22.13

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.
Files changed (125) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.mcp.json +1 -1
  5. package/dist/affected-ZWO2F5EM.js +836 -0
  6. package/dist/{apply-DXM56NV3.js → apply-OIKQ5SIY.js} +21 -17
  7. package/dist/{available-BFXLII4A.js → available-Z5MIDFPH.js} +3 -3
  8. package/dist/{broadcast-DZGMSZRG.js → broadcast-BF2QL3O7.js} +6 -5
  9. package/dist/{chunk-TU2SG5BM.js → chunk-24L4MO7H.js} +2 -2
  10. package/dist/{chunk-7I7O7ZNT.js → chunk-3V37OZQH.js} +5 -3
  11. package/dist/{chunk-PEMMV5YQ.js → chunk-4O4ZOSBQ.js} +3 -3
  12. package/dist/{chunk-7ZWSCSZM.js → chunk-5IZFEVPW.js} +2 -2
  13. package/dist/{chunk-TQODDSIG.js → chunk-5KWDQFVY.js} +4 -4
  14. package/dist/{chunk-R5MT42JS.js → chunk-5OFQVW2K.js} +2 -2
  15. package/dist/{chunk-REFEJ4VJ.js → chunk-5PNS6V5C.js} +2 -2
  16. package/dist/chunk-65BW7Y6O.js +40 -0
  17. package/dist/{chunk-IATFWEAX.js → chunk-733WVP2R.js} +19 -7
  18. package/dist/{chunk-URCQLONP.js → chunk-737BENAU.js} +8 -8
  19. package/dist/{chunk-GFOQDLPL.js → chunk-74O7KZUH.js} +13 -3
  20. package/dist/{chunk-5ZUEPPFZ.js → chunk-7ZOQELXR.js} +9 -7
  21. package/dist/{chunk-ENOMRAFS.js → chunk-A6DARDQ4.js} +3 -3
  22. package/dist/{chunk-PUIWESU3.js → chunk-A7XCUR2C.js} +4 -4
  23. package/dist/{chunk-P4N7DBD5.js → chunk-ANJMLKBR.js} +2 -2
  24. package/dist/chunk-BN4XAXMQ.js +65 -0
  25. package/dist/chunk-FOLA4EUJ.js +261 -0
  26. package/dist/chunk-FQLCD4HU.js +24 -0
  27. package/dist/chunk-G4ATQPQI.js +35 -0
  28. package/dist/{chunk-TZWLT6FD.js → chunk-GNVME5AD.js} +2 -2
  29. package/dist/{chunk-OEH47H6A.js → chunk-GUHOEIHP.js} +3 -20
  30. package/dist/{chunk-PIVKGKMR.js → chunk-ISGBOJT7.js} +3 -3
  31. package/dist/{chunk-RPCIROW7.js → chunk-J3QUG6O5.js} +2 -2
  32. package/dist/{chunk-B2WRYGHJ.js → chunk-JW5NMQTU.js} +3 -3
  33. package/dist/{chunk-2GOR4ZKO.js → chunk-K2VU3B4W.js} +99 -27
  34. package/dist/{chunk-5QKXEWDB.js → chunk-MHKY6TNF.js} +6 -4
  35. package/dist/chunk-N7ANFMA5.js +171 -0
  36. package/dist/{chunk-URP3QIWI.js → chunk-NNGGNXF2.js} +2 -2
  37. package/dist/{chunk-7CSUKCU7.js → chunk-P5D6RKMT.js} +13 -94
  38. package/dist/{chunk-EA2OSLFJ.js → chunk-QBSJL3SP.js} +42 -31
  39. package/dist/chunk-SGFTHKKS.js +86 -0
  40. package/dist/{chunk-Z5RNKEHF.js → chunk-T4GVN7XO.js} +5 -5
  41. package/dist/chunk-T6C3TSTO.js +99 -0
  42. package/dist/{chunk-NRBQK6UX.js → chunk-TYY5TYHF.js} +14 -1
  43. package/dist/{chunk-VEOYGFEQ.js → chunk-UED3RH53.js} +2 -2
  44. package/dist/{chunk-37RGCHTK.js → chunk-VNZTULFD.js} +3 -3
  45. package/dist/chunk-VSTUKACC.js +7 -0
  46. package/dist/{chunk-A4PKLESO.js → chunk-WFY7ATSZ.js} +8 -4
  47. package/dist/{chunk-KPKMEUUH.js → chunk-XSWF7APE.js} +3 -3
  48. package/dist/{chunk-GIDKCJVZ.js → chunk-ZKB7ZNKY.js} +4 -4
  49. package/dist/{chunk-ZEERJLE5.js → chunk-ZS5IDQFJ.js} +6 -6
  50. package/dist/{cli-JXPJFHUA.js → cli-FSSYFCV3.js} +15 -9
  51. package/dist/{cli-34EDFXJA.js → cli-IHVNE3WL.js} +9 -9
  52. package/dist/cli.js +19 -13
  53. package/dist/{completion-25CHR7SR.js → completion-ZTTJVV4C.js} +8 -6
  54. package/dist/{diagnostics-4PQSTI2X.js → diagnostics-XC5L6Z3E.js} +11 -7
  55. package/dist/{doctor-MHFALEWR.js → doctor-FGDSUBR3.js} +21 -17
  56. package/dist/{entry-25VWXTCW.js → entry-NNB2CQLZ.js} +20 -16
  57. package/dist/{exec-mcp-OQP5OU26.js → exec-mcp-ZU3Z3XT6.js} +16 -12
  58. package/dist/{harness-DTXPIWKL.js → harness-B7ANLH5M.js} +5 -5
  59. package/dist/harness-launch-gate.js +9 -5
  60. package/dist/harness-worker.js +11 -7
  61. package/dist/heavy-IIZBO4YM.js +1909 -0
  62. package/dist/hook-body.js +69 -21
  63. package/dist/{hooks-E33GKFRS.js → hooks-IEJTW7BV.js} +5 -5
  64. package/dist/{host-4YG67ZQ2.js → host-5P4D7GSE.js} +18 -14
  65. package/dist/host-XXWQ23LD.js +28 -0
  66. package/dist/{host-run-AJR2THEY.js → host-run-AEWHFVQL.js} +11 -7
  67. package/dist/http.js +1 -1
  68. package/dist/{import-mcp-MGDRREMJ.js → import-mcp-BQM5DKYH.js} +16 -12
  69. package/dist/index.d.ts +1 -1
  70. package/dist/index.js +18 -14
  71. package/dist/{init-RMTFPDJQ.js → init-L6GUO3PW.js} +2 -2
  72. package/dist/{install-7V6NIA7W.js → install-OFVLR7TI.js} +3 -3
  73. package/dist/invoke-3BQ5NG3P.js +29 -0
  74. package/dist/{list-WJE6NS7Y.js → list-EU4MJOXA.js} +17 -13
  75. package/dist/{list-WK2IYUK7.js → list-WWYCGD3X.js} +4 -4
  76. package/dist/{logout-SZY5GBIH.js → logout-6DFDYJUI.js} +16 -12
  77. package/dist/{logs-UHJM7ZCL.js → logs-BRF6DBKG.js} +7 -6
  78. package/dist/{mailbox-YN6PG66A.js → mailbox-AQCTXO3H.js} +3 -3
  79. package/dist/{mailbox-NIMBOQPA.js → mailbox-QYA2LQSE.js} +9 -41
  80. package/dist/{mainline-74WCH4T4.js → mainline-O5AEHG3J.js} +69 -121
  81. package/dist/{marketplace-G4VQET5W.js → marketplace-TI5HFAHB.js} +2 -2
  82. package/dist/{mcp-AXHV547W.js → mcp-4R53HSGY.js} +2 -2
  83. package/dist/{mcp-BPTTJKWL.js → mcp-HR5JFUW7.js} +2 -2
  84. package/dist/{models-ISU4DCMA.js → models-63NQBSV3.js} +2 -2
  85. package/dist/{pause-CBZ3BTJL.js → pause-UF7FQDJX.js} +6 -5
  86. package/dist/{preview-DT7DWG5F.js → preview-WSESS2UN.js} +3 -3
  87. package/dist/{project-6GDQBLDC.js → project-JXXL24WN.js} +6 -6
  88. package/dist/{reindex-I7RYWCUR.js → reindex-3GPKAFBW.js} +5 -5
  89. package/dist/{report-ZHOHQ4PZ.js → report-JUSKQPAC.js} +7 -6
  90. package/dist/{resume-UJEWQ66P.js → resume-3WAROOQ3.js} +6 -5
  91. package/dist/{run-V4LBDW5O.js → run-VUUQS4WY.js} +5 -5
  92. package/dist/{run-5UM7WUTH.js → run-XRWU4L73.js} +14 -10
  93. package/dist/{serve-723OCAUT.js → serve-OEX5V5CD.js} +7 -7
  94. package/dist/{setup-SOUBEZ3H.js → setup-SWNAC2C7.js} +6 -4
  95. package/dist/{smoke-2FI5D74B.js → smoke-5BGJXAHX.js} +4 -4
  96. package/dist/{start-login-M425T4GS.js → start-login-MG26NDE3.js} +16 -12
  97. package/dist/{status-XAP66PLK.js → status-APADL7O2.js} +16 -12
  98. package/dist/{status-KN2ZE64O.js → status-GKCIVAAR.js} +6 -5
  99. package/dist/{status-QEFRBTOO.js → status-LH7Q255G.js} +18 -14
  100. package/dist/stdio.js +2 -2
  101. package/dist/{sweep-EPZCW63Q.js → sweep-VTVPDAPY.js} +6 -5
  102. package/dist/{test-TL7DRDMD.js → test-TK2J3IB7.js} +17 -13
  103. package/dist/{tui-DGGNATMI.js → tui-YTPHHKCW.js} +5 -5
  104. package/dist/{unbroadcast-N6LXHAMT.js → unbroadcast-CH7BAQ2G.js} +6 -5
  105. package/dist/{validate-KFBCUFI4.js → validate-5QVZBE6W.js} +4 -4
  106. package/dist/wait-4HYJJAWO.js +141 -0
  107. package/dist/{worker-N7EOJVI3.js → worker-RBXYAMR4.js} +13 -9
  108. package/dist/{worktree-create-KMXPQXIQ.js → worktree-create-FEZNQUQ6.js} +2 -2
  109. package/docs/commands.md +48 -12
  110. package/docs/git-workflow.md +51 -0
  111. package/docs/hooks.md +8 -1
  112. package/docs/project-configuration.md +134 -18
  113. package/docs/upgrading.md +11 -0
  114. package/gemini-extension.json +2 -2
  115. package/mcp.json +1 -1
  116. package/package.json +5 -5
  117. package/plugin.json +1 -1
  118. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  119. package/plugins/pmcp/.mcp.json +1 -1
  120. package/plugins/pmcp/gemini-extension.json +2 -2
  121. package/plugins/pmcp/mcp.json +1 -1
  122. package/plugins/pmcp/plugin.json +1 -1
  123. package/dist/chunk-L7LQEVTE.js +0 -7
  124. package/dist/host-W6B2O44Q.js +0 -24
  125. package/dist/invoke-JRFOK374.js +0 -25
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  ArgumentError,
10
10
  one
11
- } from "./chunk-A4PKLESO.js";
11
+ } from "./chunk-WFY7ATSZ.js";
12
12
  import {
13
13
  ConfigError
14
14
  } from "./chunk-GJXOFDJT.js";
@@ -112,10 +112,10 @@ var tuiCommand = {
112
112
  try {
113
113
  let receipt;
114
114
  if (invocation.action === "doctor") {
115
- const { inspectTerminalHost } = await import("./diagnostics-4PQSTI2X.js");
115
+ const { inspectTerminalHost } = await import("./diagnostics-XC5L6Z3E.js");
116
116
  receipt = inspectTerminalHost();
117
117
  } else if (invocation.action === "start-worker") {
118
- const { startWorkspaceWorker } = await import("./worker-N7EOJVI3.js");
118
+ const { startWorkspaceWorker } = await import("./worker-RBXYAMR4.js");
119
119
  receipt = await startWorkspaceWorker(
120
120
  { config: invocation.startup?.config, cwd: context.cwd },
121
121
  invocation.startup.runtime,
@@ -128,7 +128,7 @@ var tuiCommand = {
128
128
  cwd: context.cwd
129
129
  });
130
130
  } else {
131
- const { launchStartup, planStartup } = await import("./entry-25VWXTCW.js");
131
+ const { launchStartup, planStartup } = await import("./entry-NNB2CQLZ.js");
132
132
  const request = { ...invocation.startup, cwd: context.cwd };
133
133
  receipt = invocation.action === "plan" ? planStartup(request) : await launchStartup(
134
134
  request,
@@ -150,4 +150,4 @@ var tuiCommand = {
150
150
  export {
151
151
  tuiCommand
152
152
  };
153
- //# sourceMappingURL=tui-DGGNATMI.js.map
153
+ //# sourceMappingURL=tui-YTPHHKCW.js.map
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  change
3
- } from "./chunk-B2WRYGHJ.js";
4
- import "./chunk-7I7O7ZNT.js";
3
+ } from "./chunk-JW5NMQTU.js";
4
+ import "./chunk-3V37OZQH.js";
5
5
  import "./chunk-Z6WRFOFT.js";
6
- import "./chunk-A4PKLESO.js";
7
- import "./chunk-OEH47H6A.js";
6
+ import "./chunk-WFY7ATSZ.js";
7
+ import "./chunk-FQLCD4HU.js";
8
+ import "./chunk-GUHOEIHP.js";
8
9
  import "./chunk-IJBSOWHK.js";
9
10
  import "./chunk-GJXOFDJT.js";
10
11
  import "./chunk-PMJG2CXF.js";
@@ -14,4 +15,4 @@ var run = (context) => change(context, "unbroadcast");
14
15
  export {
15
16
  run
16
17
  };
17
- //# sourceMappingURL=unbroadcast-N6LXHAMT.js.map
18
+ //# sourceMappingURL=unbroadcast-CH7BAQ2G.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  catalogOptionsFrom
3
- } from "./chunk-PEMMV5YQ.js";
3
+ } from "./chunk-4O4ZOSBQ.js";
4
4
  import {
5
5
  configFrom
6
- } from "./chunk-RPCIROW7.js";
6
+ } from "./chunk-J3QUG6O5.js";
7
7
  import {
8
8
  validateCatalog,
9
9
  validateSkillDir
@@ -13,7 +13,7 @@ import {
13
13
  validateSpec
14
14
  } from "./chunk-INT7QLEU.js";
15
15
  import "./chunk-JEL35P7S.js";
16
- import "./chunk-A4PKLESO.js";
16
+ import "./chunk-WFY7ATSZ.js";
17
17
  import "./chunk-4CRRLDDS.js";
18
18
  import "./chunk-YSAWTGNA.js";
19
19
  import "./chunk-GJXOFDJT.js";
@@ -43,4 +43,4 @@ var validateCommand = {
43
43
  export {
44
44
  validateCommand
45
45
  };
46
- //# sourceMappingURL=validate-KFBCUFI4.js.map
46
+ //# sourceMappingURL=validate-5QVZBE6W.js.map
@@ -0,0 +1,141 @@
1
+ import {
2
+ waitSpec
3
+ } from "./chunk-G4ATQPQI.js";
4
+ import {
5
+ ArgumentError,
6
+ EXIT,
7
+ many,
8
+ one
9
+ } from "./chunk-WFY7ATSZ.js";
10
+ import {
11
+ pidAlive
12
+ } from "./chunk-N7ANFMA5.js";
13
+
14
+ // src/lease/wait.ts
15
+ import { existsSync, readFileSync, readdirSync } from "fs";
16
+ var CONDITION_FORMS = "exists:<path> | gone:<path> | load-below:<n> | no-process:<text>";
17
+ function parseCondition(text) {
18
+ const at = text.indexOf(":");
19
+ if (at <= 0) return null;
20
+ const kind = text.slice(0, at);
21
+ const value = text.slice(at + 1);
22
+ if (value === "") return null;
23
+ if (kind === "exists" || kind === "gone") return { kind, path: value };
24
+ if (kind === "no-process") return { kind, text: value };
25
+ if (kind === "load-below") {
26
+ const max = Number(value);
27
+ return max > 0 ? { kind, max } : null;
28
+ }
29
+ return null;
30
+ }
31
+ function ancestors(proc) {
32
+ const found = /* @__PURE__ */ new Set();
33
+ for (let pid = process.pid, hops = 0; pid > 1 && hops < 64; hops += 1) {
34
+ found.add(pid);
35
+ try {
36
+ const stat = readFileSync(`${proc}/${pid}/stat`, "utf8");
37
+ pid = Number(stat.slice(stat.lastIndexOf(")") + 2).split(" ")[1]);
38
+ } catch {
39
+ break;
40
+ }
41
+ }
42
+ return found;
43
+ }
44
+ function processMatching(text, proc = "/proc") {
45
+ const own = ancestors(proc);
46
+ let names;
47
+ try {
48
+ names = readdirSync(proc);
49
+ } catch {
50
+ return null;
51
+ }
52
+ for (const name of names) {
53
+ if (!/^\d+$/u.test(name) || own.has(Number(name))) continue;
54
+ try {
55
+ const line = readFileSync(`${proc}/${name}/cmdline`, "utf8");
56
+ if (line.split("\0").join(" ").includes(text)) return Number(name);
57
+ } catch {
58
+ }
59
+ }
60
+ return null;
61
+ }
62
+ function load1(file) {
63
+ try {
64
+ return Number(readFileSync(file, "utf8").split(" ")[0]);
65
+ } catch {
66
+ return null;
67
+ }
68
+ }
69
+ function met(condition, loadavg = "/proc/loadavg") {
70
+ switch (condition.kind) {
71
+ case "pid":
72
+ return condition.pid === process.pid || !pidAlive(condition.pid);
73
+ case "exists":
74
+ return existsSync(condition.path);
75
+ case "gone":
76
+ return !existsSync(condition.path);
77
+ case "load-below": {
78
+ const load = load1(loadavg);
79
+ return load === null || load < condition.max;
80
+ }
81
+ case "no-process":
82
+ return processMatching(condition.text) === null;
83
+ }
84
+ }
85
+ async function waitFor(options) {
86
+ const deadline = Date.now() + options.timeout * 1e3;
87
+ for (; ; ) {
88
+ if (options.conditions.every((c) => met(c, options.loadavg))) return true;
89
+ const left = deadline - Date.now();
90
+ if (left <= 0) return false;
91
+ const step = Math.min(options.interval * 1e3, left);
92
+ await new Promise((resolve) => setTimeout(resolve, step));
93
+ }
94
+ }
95
+
96
+ // src/commands/wait.ts
97
+ function seconds(context, name, fallback) {
98
+ const text = one(context.args, name);
99
+ if (text === void 0) return fallback;
100
+ const value = Number(text);
101
+ if (!(value > 0))
102
+ throw new ArgumentError(`--${name} must be a positive number`);
103
+ return value;
104
+ }
105
+ function conditions(context) {
106
+ const found = [];
107
+ for (const text of many(context.args, "pid")) {
108
+ const pid = Number(text);
109
+ if (!Number.isInteger(pid) || pid <= 0)
110
+ throw new ArgumentError(`--pid ${text} is not a process id`);
111
+ found.push({ kind: "pid", pid });
112
+ }
113
+ for (const text of many(context.args, "until")) {
114
+ const condition = parseCondition(text);
115
+ if (condition === null)
116
+ throw new ArgumentError(`--until ${text}: use ${CONDITION_FORMS}`);
117
+ found.push(condition);
118
+ }
119
+ if (found.length === 0) throw new ArgumentError("name --pid or --until");
120
+ if (context.args.positional.length > 0)
121
+ throw new ArgumentError(`unexpected ${context.args.positional[0]}`);
122
+ return found;
123
+ }
124
+ async function run(context) {
125
+ const timeout = seconds(context, "timeout", 3600);
126
+ const met2 = await waitFor({
127
+ conditions: conditions(context),
128
+ timeout,
129
+ interval: seconds(context, "interval", 5),
130
+ ...context.env["PMCP_HEAVY_LOADAVG_FILE"] ? { loadavg: context.env["PMCP_HEAVY_LOADAVG_FILE"] } : {},
131
+ say: (line) => context.ui.info(line)
132
+ });
133
+ if (met2) return EXIT.ok;
134
+ context.ui.error(`not met within ${timeout}s`);
135
+ return EXIT.busy;
136
+ }
137
+ var waitCommand = { ...waitSpec, run };
138
+ export {
139
+ waitCommand
140
+ };
141
+ //# sourceMappingURL=wait-4HYJJAWO.js.map
@@ -5,21 +5,25 @@ import {
5
5
  } from "./chunk-C3G75JH7.js";
6
6
  import {
7
7
  invoke
8
- } from "./chunk-Z5RNKEHF.js";
8
+ } from "./chunk-T4GVN7XO.js";
9
9
  import "./chunk-DZ2MRTYT.js";
10
- import "./chunk-PIVKGKMR.js";
11
- import "./chunk-7ZWSCSZM.js";
10
+ import "./chunk-ISGBOJT7.js";
11
+ import "./chunk-5IZFEVPW.js";
12
12
  import {
13
13
  locateExecutable
14
14
  } from "./chunk-R2GPCZUX.js";
15
- import "./chunk-TZWLT6FD.js";
15
+ import "./chunk-GNVME5AD.js";
16
16
  import "./chunk-34DECPVC.js";
17
- import "./chunk-IATFWEAX.js";
18
- import "./chunk-NRBQK6UX.js";
19
- import "./chunk-OEH47H6A.js";
17
+ import "./chunk-733WVP2R.js";
18
+ import "./chunk-FOLA4EUJ.js";
19
+ import "./chunk-N7ANFMA5.js";
20
+ import "./chunk-TYY5TYHF.js";
21
+ import "./chunk-T6C3TSTO.js";
22
+ import "./chunk-FQLCD4HU.js";
23
+ import "./chunk-GUHOEIHP.js";
20
24
  import "./chunk-IJBSOWHK.js";
21
25
  import "./chunk-XWLMZKH2.js";
22
- import "./chunk-L7LQEVTE.js";
26
+ import "./chunk-VSTUKACC.js";
23
27
  import "./chunk-GJXOFDJT.js";
24
28
  import "./chunk-PMJG2CXF.js";
25
29
  import {
@@ -79,4 +83,4 @@ async function startWorkspaceWorker(request, runtime, memoryMb) {
79
83
  export {
80
84
  startWorkspaceWorker
81
85
  };
82
- //# sourceMappingURL=worker-N7EOJVI3.js.map
86
+ //# sourceMappingURL=worker-RBXYAMR4.js.map
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  ArgumentError,
11
11
  one
12
- } from "./chunk-A4PKLESO.js";
12
+ } from "./chunk-WFY7ATSZ.js";
13
13
 
14
14
  // src/git/worktrees/create.ts
15
15
  import { existsSync, symlinkSync } from "fs";
@@ -86,4 +86,4 @@ var worktreeCreate = (setup, context, report) => {
86
86
  export {
87
87
  worktreeCreate
88
88
  };
89
- //# sourceMappingURL=worktree-create-KMXPQXIQ.js.map
89
+ //# sourceMappingURL=worktree-create-FEZNQUQ6.js.map
package/docs/commands.md CHANGED
@@ -55,17 +55,18 @@ pmcp hooks report --switch-check shell.heredoc [--since 2d] [--json]
55
55
 
56
56
  These opt-in snapshots write one JSON object and a newline to stdout, with `version: 1`. No color or human summary is mixed into stdout. Errors remain on stderr. Without the flag, existing human output is retained, including MCP status's original unversioned object and logs' JSONL stream. Schemas are named in [schemas.json](https://pmcp.build/commands/schemas.json); each entry under `schemas` uses the shared root `$defs`. Consumers must allow unknown fields inside session, decision and log records. Tokens are never part of an auth status object.
57
57
 
58
- | Command | Schema | Fields after version |
59
- | -------------------------- | ----------------- | --------------------------------------------------------------------- |
60
- | `status --json` | status | config, drift, features, projection, sessions, worktrees, mcp, errors |
61
- | `hooks list --json` | hooks-list | policies: runtime, event, policy, mode, source |
62
- | `hooks test --json` | hooks-test | runtime, event, payload, decision, policies, rendered |
63
- | `sessions status --json` | sessions-status | live, pause, leases, broadcasts with unseenBy session IDs |
64
- | `logs --json` | logs | records; filtered snapshot, incompatible with --follow and --pretty |
65
- | `git worktree list --json` | git-worktree-list | worktrees: path, main, optional alias, branch, behind and ahead |
66
- | `mcp status <name> --json` | mcp-status | name, present, expiresAt (UTC string or null), scopes |
67
-
68
- Feature rows have feature, enabled and source. Projection has drift, outputs and problems. Session snapshots include only live records; broadcasts include the IDs that have not yet seen each entry. Worktree counts are omitted when the upstream cannot be compared; absence does not assert equality. Status auth rows add a redacted error when credentials are unavailable or invalid. Errors are JSONL records with valid timestamps within the last hour, excluding future rows. Hooks test observations have policy, mode, decision, durationMs, skipped, source, verdict and reason; rendered has stdout and exitCode. The final decision includes runtime lowering, while each policy row retains its configured verdict. Mutating sessions, git and MCP verbs reject `--json`.
58
+ | Command | Schema | Fields after version |
59
+ | -------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
60
+ | `status --json` | status | config, drift, features, projection, sessions, worktrees, mcp, errors |
61
+ | `hooks list --json` | hooks-list | policies: runtime, event, policy, mode, source |
62
+ | `hooks test --json` | hooks-test | runtime, event, payload, decision, policies, rendered |
63
+ | `sessions status --json` | sessions-status | live, pause, leases, broadcasts with unseenBy session IDs |
64
+ | `logs --json` | logs | records; filtered snapshot, incompatible with --follow and --pretty |
65
+ | `git worktree list --json` | git-worktree-list | worktrees: path, main, optional alias, branch, behind and ahead |
66
+ | `mcp status <name> --json` | mcp-status | name, present, expiresAt (UTC string or null), scopes |
67
+ | `heavy status --json` | heavy-status | schema `pmcp.heavy.status.v1`, enabled, dir, budget, running_weight, legacy_holder, host, lanes with running jobs, waiters, tickets, grace_24h, outside, skip |
68
+
69
+ Feature rows have feature, enabled and source. Projection has drift, outputs and problems. Session snapshots include only live records; broadcasts include the IDs that have not yet seen each entry. Worktree counts are omitted when the upstream cannot be compared; absence does not assert equality. Status auth rows add a redacted error when credentials are unavailable or invalid. Errors are JSONL records with valid timestamps within the last hour, excluding future rows. Hooks test observations have policy, mode, decision, durationMs, skipped, source, verdict and reason; rendered has stdout and exitCode. The final decision includes runtime lowering, while each policy row retains its configured verdict. Heavy status jobs have pid, label, cwd, lane, weight, session, started, running_s, flags (grace, bypass, over_hold_warn, over_hold_max) and bypass_reason; waiters have pid, label, cwd, lane, weight, session, position, waited_s and eta_s (a rough estimate or null). It only reads: no record is pruned and nothing is written. Mutating sessions, git and MCP verbs reject `--json`.
69
70
 
70
71
  ## serve
71
72
 
@@ -182,6 +183,7 @@ pmcp git worktree list
182
183
  pmcp git worktree sync
183
184
  pmcp git deliver [<commit>...] [--during-pause] [--no-push] [--json]
184
185
  pmcp git sync
186
+ pmcp git affected --base <ref> [--head <ref>] [--tests-only] [--json]
185
187
  ```
186
188
 
187
189
  The git workflow configured by [`[git]`](git-workflow.md). Each subcommand needs its table; without it the command exits 1 and names the missing table.
@@ -189,8 +191,41 @@ The git workflow configured by [`[git]`](git-workflow.md). Each subcommand needs
189
191
  - `worktree create <alias>` makes a linked worktree under `[git.worktrees] root` on a new branch from the upstream (or `--base`), links the configured files from the main checkout, runs `bootstrap`, and prints the path.
190
192
  - `worktree list` prints alias, branch, behind/ahead and path for the main checkout and each linked worktree.
191
193
  - `worktree sync` moves the current worktree onto the mainline when that loses nothing; exit 1 when it is held back.
192
- - `deliver` fetches, replays the named commits (default: the ones the upstream lacks) onto the mainline, runs the gate in its own tree under a lock, and pushes; it replays again if the mainline moved. A delivery that touches a leased path holds that lease until it has pushed and installed, and it refuses during a pause unless `--during-pause` or `during_pause = "allow"`. `--no-push` replays and runs the gate command, then stops: it takes no lease and pushes, syncs and notifies nothing, and it refuses `gate = "pre-push"`, where the push is the gate. Exit 0 delivered, gated with `--no-push`, or nothing to deliver; 1 refused, gate failed or attempts exhausted; 2 fetch failed or `--no-push` with the pre-push gate.
194
+ - `deliver` fetches, replays the named commits (default: the ones the upstream lacks) onto the mainline, runs the gate in its own tree under a lock, and pushes; it replays again if the mainline moved. A delivery that touches a leased path holds that lease until it has pushed and installed, and it refuses during a pause unless `--during-pause` or `during_pause = "allow"`. `--no-push` replays and runs the gate command, then stops: it takes no lease and pushes, syncs and notifies nothing, and it refuses `gate = "pre-push"`, where the push is the gate. Deliver never takes the [host lease](project-configuration.md#host-lease): replay, gate tree, hooks and push run without it, and the gate wraps only its test stages in `pmcp heavy --profile gate`. Exit 0 delivered, gated with `--no-push`, or nothing to deliver; 1 refused, gate failed or attempts exhausted; 2 fetch failed or `--no-push` with the pre-push gate; 75 the gate command exited 75 because a test stage never got the host lease ("gate not run: host busy"), so nothing was pushed.
193
195
  - `sync` moves the main checkout to the mainline, installs when a listed file changed, and follows clean submodule pins. Exit 0 moved or already equal, 1 when local work would be lost, 2 when blocked (undelivered edits) or the fetch failed. Run in a desk (a linked worktree matching `[git.worktrees] desks`), it brings the desk up to date the same way without rebasing: exit 0 moved or current, 1 held (an unlanded commit, uncommitted tracked edits, a pause, another session's lease, a git operation in progress), with the reason. In any other linked worktree it exits 2.
196
+ - `affected --base <ref>` prints the workspace members the delta from `<ref>` to `--head` (default `HEAD`) touches, with their consumers when [`[git.affected]`](git-workflow.md#affected-members) `consumers` is on (`--tests-only` leaves them out), or `ALL`; unmapped files are named on stderr. It needs only `[git.affected]`, not an enabled workflow. Exit 0 with an answer, `ALL` included when the base does not resolve, equals the head or a manifest does not parse; 2 for a missing `--base` or an invalid table. `--json` prints `pmcp.git.affected.v1`: `all`, `reason`, `base`, `head`, `changed`, `members`, `unmapped` and `selected` (the printed list, or `"ALL"`).
197
+
198
+ ## heavy
199
+
200
+ ```sh
201
+ pmcp heavy -- npm test
202
+ pmcp heavy --lane bulk --weight 3 -- npm run build:all
203
+ pmcp heavy --profile gate --weight 2 -- npm run typecheck
204
+ pmcp heavy --profile hook -- npm run lint:staged
205
+ pmcp heavy --now --reason "prod is down" -- npm run deploy
206
+ pmcp heavy status [--json]
207
+ pmcp heavy stats [--json]
208
+ ticket=$(pmcp heavy submit --lane bulk -- npm run build:all)
209
+ pmcp heavy result "$ticket"
210
+ pmcp heavy wait "$ticket" --timeout 1800
211
+ pmcp heavy cancel "$ticket" [--force]
212
+ pmcp heavy queue [--json]
213
+ pmcp heavy promote <id> --now --reason "release blocker"
214
+ pmcp heavy priority <id> gate --reason "blocks a land"
215
+ pmcp heavy priority <id> +2 --reason "the session waits on it"
216
+ ```
217
+
218
+ Run a heavy command within the host-wide budget of [`[host.lease]`](project-configuration.md#host-lease), across every session and worktree on the host. A job starts once its lane has a free slot, its weight fits what the running jobs leave of the budget, and the host is under `max_load` and `max_io` (or, past `load_grace` and with nothing leased running, under `hard_factor` times them). Waiting jobs start by lane (gate, hook, interactive, bulk), oldest first within a lane, with a line on standard error every `heartbeat`; `--lane` and `--weight` override the profile and `[host.lease] commands`. The command runs with the lease marker set, so a nested `pmcp heavy` runs at once. Everything after `--` is the command, options included. `status` prints the lock, the host readings, when the host was last settled, the holder record, each waiter with its lane, weight, position and a rough wait estimate from the log's run times, the lanes' use and the running weight against the budget, each running job against `hold_warn` and `hold_max`, the IO average the check reads, how many jobs started on `load_grace` in the last day, and the busiest processes outside the lease. With the lease disabled, or with `PMCP_HEAVY_DISABLE=<reason>` set, the command runs at once. `--now --reason <text>` (or `PMCP_HEAVY_NOW=<reason>`) is the emergency bypass: it runs at once, logged and shown in status, and still counts its weight. Where the io controller reaches the user's scopes, each job runs in its own scope with its lane's `io.weight`. `submit` queues the command and returns a ticket at once, so the caller keeps working: a detached runner (its own session, so it outlives the caller) waits and runs it under the same rules, its output in the ticket's log and its exit code and usage record in the ticket's result. `result <ticket>` reads the state (queued with its position, running, done, or lost when the runner died), `--json` as data; `wait <ticket>` blocks until it is done, prints the log's tail and exits with the job's code (75 at `--timeout`); `cancel <ticket>` stops a queued job and, with `--force`, a running one. Tickets live under `<dir>/tickets/` and finished ones are removed after a week. Every waiting or running job has an id (a ticket's, or one made for a blocking run), shown by `status` and `queue`: `queue` lists the waiters with id, lane, position, waited and estimated time, weight, pid, session and label; `promote <id> --now --reason` starts a waiter at once as a bypass; `priority <id> <lane|+N|-N> --reason` moves it to another lane's end or N places within its lane; `cancel <id>` takes a waiter out of the queue (its run exits 130) and, with `--force`, stops a running job. The waiting process reads the change on its next poll; each change is made under the admission lock and logged as a `control` line with the uid, the session and the reason, and a waiter whose process died is removed instead of changed. `stats` lists each command signature's recorded runs with the median and 90th percentile of wall time, CPU time, peak RSS and IO, `--json` as data. Exit: the command's own code; 75 when nothing ran within `max_wait`, with the reason (the queue, the session's cap, a shell wrapper's hold, a host past `hard_factor`); 2 for a missing `--`, an unknown profile or lane, a bad weight, or `--now` without a reason.
219
+
220
+ ## wait
221
+
222
+ ```sh
223
+ pmcp wait --pid 4242
224
+ pmcp wait --until gone:/tmp/build.lock --until load-below:6 --timeout 900
225
+ pmcp wait --until no-process:"vitest run"
226
+ ```
227
+
228
+ Sleep until every condition holds: `--pid` until that process has exited, `--until exists:<path>`, `gone:<path>`, `load-below:<n>` (1-minute load average) or `no-process:<text>` (no command line contains the text). It never matches itself or the shells that started it, which a loop around `pgrep -f` does, and it sleeps between checks (`--interval`, default 5 s) instead of spinning. Exit 0 once met, 75 after `--timeout` (default 3600 s), 2 for an unreadable condition.
194
229
 
195
230
  ## completion
196
231
 
@@ -320,6 +355,7 @@ Options are parsed against the command's own list, so an unknown flag is an erro
320
355
  | `1` | it ran and found a problem | no skills under those roots, a partial index, no SQLite in this runtime to store vectors in, a refused or failed `git deliver` |
321
356
  | `2` | the arguments were unusable, or a check found drift | an unknown command, an unknown option, a missing value; `project --check` drift, stale or undeclared outputs; a `git` fetch that failed or a sync blocked by undelivered edits |
322
357
  | `3` | an optional dependency is missing | `index` without `@huggingface/transformers` |
358
+ | `75` | the host stayed busy, so nothing ran; retry later | `heavy` past `max_wait`, a `git deliver` gate whose test stage never got the host lease, `wait` past `--timeout` |
323
359
 
324
360
  The distinction between 1 and 3 is worth wiring into a script: 1 says the project is not what you expected, and 3 says the machine is missing something optional and the server still works without it.
325
361
 
@@ -84,6 +84,15 @@ delivery that holds the lock waits until the load is below it before the gate st
84
84
  checking every 15 seconds for up to `load_wait_seconds` (default `1800`), and then
85
85
  fails without running the gate; once started, a gate is never retried.
86
86
 
87
+ Deliver never takes the [host lease](project-configuration.md#host-lease):
88
+ replay, gate tree preparation, hooks and the push run without it, so a land never
89
+ queues behind other sessions' builds and never holds the gate lock while it
90
+ waits for capacity. The gate puts only its test stages under `pmcp heavy
91
+ --profile gate [--weight N] -- <command>`, which queue first, in the gate lane.
92
+ When such a stage gives up (exit 75), a gate command that exits 75 makes
93
+ `pmcp git deliver` stop with "gate not run: host busy, nothing pushed, retry
94
+ later" and exit 75.
95
+
87
96
  One delivery gates at a time: pmcp takes an exclusive `flock` on the file `lock`
88
97
  beside the gate tree (`<dir of tree>/lock`), so another tool that takes the same
89
98
  file with `flock` (a project's own landing script, say) and pmcp never gate together. With
@@ -195,6 +204,48 @@ branch (`branch` in `.gitmodules`, else `main`) as a fast-forward, never a later
195
204
  commit; if that branch has moved past the pin's base, delivery stops before
196
205
  anything else moves.
197
206
 
207
+ ## Affected members
208
+
209
+ `pmcp git affected --base <ref> [--head <ref>] [--tests-only] [--json]` maps the delta
210
+ `<base>...<head>` to the workspace members it touches, so a gate checks in proportion to the
211
+ change. It prints one member directory per line, or the single line `ALL`, and names each
212
+ changed file no member reads on stderr as `unmapped, not tested: <path>`. It always exits 0
213
+ with an answer and answers `ALL` (fail closed) when the base or head does not resolve, the
214
+ base equals the head, the root manifest or lockfile does not parse, or `[git.affected]` is
215
+ absent. Paths in the table are relative to the checkout root, so `--config` may name a file
216
+ outside the checkout. Membership is read from the checkout, which must be at the head.
217
+
218
+ `[git.affected]` describes the workspace; every key is optional:
219
+
220
+ | Key | Type | Default | Meaning |
221
+ | ------------------ | ------------------------ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
222
+ | `members` | `"workspaces"` | `"workspaces"` | Members are the directories the root `package.json` `workspaces` globs (or `workspaces.packages`) match; the last matching glob decides, so `!glob` excludes. |
223
+ | `shared_inputs` | globs | `[]` | A changed path matching one selects `ALL`. |
224
+ | `readers` | table: glob to members | `{}` | Members that read a path outside themselves which no adapter can derive (a test reading a file by path). The path counts as mapped. |
225
+ | `derive` | `"tsconfig"`, `"vitest"` | `[]` | Compute readers instead of listing them: files outside every member that a member's `tsconfig*.json` extends chain (relative or through a member package) or vitest config imports. |
226
+ | `owners` | table: glob to member | `{}` | Map a directory without a manifest to the member that runs it, before walking up to the nearest member. |
227
+ | `include` | globs, `!` excludes | `["**"]` | Paths that map to a member at all; a path outside `include` is neither selected nor reported. |
228
+ | `include_deleted` | globs | `[]` | A deleted path maps only when it matches here; deleting a file cannot break its member. |
229
+ | `ignore` | globs | `[]` | Paths read by no member: never selected, never reported. |
230
+ | `on_member_change` | members | `[]` | Selected when a member manifest is added or removed (suites that assert something about the whole workspace). |
231
+ | `unmapped` | `"all"`, `"report"` | `"all"` | What an included path outside every member and reader does: widen to `ALL`, or only be reported. |
232
+ | `consumers` | boolean | `false` | Add every member that depends on a selected one (typecheck semantics). `--tests-only` prints the selection without them. |
233
+
234
+ `[git.affected.lockfile]` reads the package manager's lockfile at both revisions when it or the
235
+ root `package.json` changed, and selects the members whose resolved dependencies moved, with
236
+ their consumers. `adapter = "bun"` is the one implemented. `toolchain` lists package names (a
237
+ trailing `*` matches a prefix) every member builds with: a change to one selects `ALL`, as does a
238
+ root field outside the dependency fields and `inert_root_fields` (default `scripts`,
239
+ `description`, `version`) or a lockfile that does not parse.
240
+
241
+ Consumer edges are a member's `dependencies`, `peerDependencies` and `optionalDependencies`, the
242
+ `devDependencies` its production source under `src/` imports (all of them when its
243
+ `tsconfig.json` `exclude` names no tests), the member whose tsconfig preset it extends, and
244
+ relative imports from `src/` that leave the package.
245
+
246
+ `node scripts/affected-shadow.mjs` compares this answer with a project's own selector over
247
+ recent commits in a disposable clone before a gate switches to it.
248
+
198
249
  ## Shared file formats
199
250
 
200
251
  Delivery and sync coordinate through plain files, so any tool, a project's own
package/docs/hooks.md CHANGED
@@ -41,7 +41,14 @@ where they apply: declared `[git]` features detect git (`enabled = "auto"`), and
41
41
  logging falls back to its defaults rather than to no logging. The bundle is
42
42
  projected only when `[hooks]` declares guards or checks, a `[sessions.*]`
43
43
  feature table is declared, `[git.shared_checkout]` or `[git.worktrees.sync]` is
44
- declared, or `[git.mainline.deliver]` keeps `refuse_direct_push`.
44
+ declared, `[git.mainline.deliver]` keeps `refuse_direct_push`, or
45
+ `[host.lease]` lists `heavy` commands.
46
+
47
+ The `host.lease` guard holds agents to the [host lease](project-configuration.md#host-lease):
48
+ a shell step whose argv starts with a `[host.lease] heavy` prefix and is not
49
+ wrapped in `pmcp heavy --` is reported, in the mode `[host.lease] guard` names
50
+ (`observe` by default; `deny` refuses with the wrapped command to run instead).
51
+ A step that sets `PMCP_HEAVY_DISABLE=<reason>` passes.
45
52
 
46
53
  ## `[hooks]`
47
54