@modootoday/pmcp 0.18.4 → 0.19.1
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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.mcp.json +1 -1
- package/dist/{apply-75UWIUVQ.js → apply-IPTASVRS.js} +16 -17
- package/dist/{broadcast-CBMVOV3G.js → broadcast-56NPEJWM.js} +3 -4
- package/dist/{chunk-ARA4VDHD.js → chunk-2DAC45ZT.js} +2 -2
- package/dist/{chunk-JS5RTH4I.js → chunk-2Q6MNGU5.js} +2 -2
- package/dist/{chunk-ZWLUH3F2.js → chunk-2W6CEJD7.js} +2 -2
- package/dist/{chunk-YRGDWUFY.js → chunk-3BLHIEAK.js} +2 -2
- package/dist/{chunk-R26RWSFW.js → chunk-3CLLHFP7.js} +2 -2
- package/dist/{chunk-HE2C2S5A.js → chunk-3H5FZCKX.js} +3 -3
- package/dist/{chunk-TFRJ5QOS.js → chunk-7FAA32PB.js} +3 -3
- package/dist/{chunk-DCU2EXQV.js → chunk-D5D3V6RU.js} +4 -4
- package/dist/{chunk-LTZH5E3G.js → chunk-DHAPQUEF.js} +235 -30
- package/dist/{chunk-LBXO4VPG.js → chunk-E4FJOLPJ.js} +6 -3
- package/dist/{chunk-OPYFEHKG.js → chunk-G7JONWL4.js} +29 -1
- package/dist/{chunk-4JUSGIMX.js → chunk-G7NN23YK.js} +2 -2
- package/dist/chunk-GPSOPGJA.js +7 -0
- package/dist/{chunk-LGO2SZAS.js → chunk-IKJOXDCF.js} +2 -2
- package/dist/{chunk-QEW4J3IZ.js → chunk-ISNRDHSD.js} +2 -2
- package/dist/{chunk-S3PIAMXV.js → chunk-J5XQW2CM.js} +68 -8
- package/dist/{chunk-LFR245MZ.js → chunk-JAICIL6H.js} +5 -5
- package/dist/{chunk-GZHHEHKY.js → chunk-JJBSYUSQ.js} +19 -7
- package/dist/{chunk-YSUINA5Q.js → chunk-MB72PZH7.js} +8 -8
- package/dist/{chunk-3CA3NNVH.js → chunk-MFPQDXUQ.js} +5 -5
- package/dist/{chunk-VQ2HEGWH.js → chunk-OKW7VKNQ.js} +2 -2
- package/dist/{chunk-6UXJ62XJ.js → chunk-OWW5VY4D.js} +3 -3
- package/dist/{chunk-OB3P5RMN.js → chunk-U2FPMGEM.js} +2 -2
- package/dist/{chunk-XELAZAIM.js → chunk-UD3BEEBQ.js} +54 -12
- package/dist/{chunk-EAWPJHJ7.js → chunk-UGODVKBJ.js} +2 -2
- package/dist/{chunk-MSOZPOPX.js → chunk-UOLV2AWA.js} +7 -3
- package/dist/{chunk-FBIDDE3N.js → chunk-XKGS2FNF.js} +71 -51
- package/dist/{chunk-XMXBE5IQ.js → chunk-XS2QM6AT.js} +5 -5
- package/dist/{chunk-45Y3KZ3Q.js → chunk-Y65MO2SS.js} +87 -20
- package/dist/{chunk-DAR6RGRN.js → chunk-YTSJRA4Z.js} +2 -2
- package/dist/{chunk-QBJC4DRP.js → chunk-ZYMJV7YX.js} +14 -14
- package/dist/{cli-ZN7ZVDEZ.js → cli-MUP2NSXT.js} +10 -9
- package/dist/{cli-MI4ZCAZ3.js → cli-T5LHBUY2.js} +8 -8
- package/dist/cli.js +3 -3
- package/dist/{completion-WYJAKJE4.js → completion-ZY5P443T.js} +2 -2
- package/dist/{diagnostics-ADIVFSBW.js → diagnostics-KUNS6LCZ.js} +12 -12
- package/dist/{doctor-BBCS4DF5.js → doctor-UH7KEOSO.js} +18 -19
- package/dist/{entry-DMOTX4SS.js → entry-DOUDMRO2.js} +10 -10
- package/dist/{exec-mcp-OBUM3DVW.js → exec-mcp-TGW6FXGC.js} +13 -14
- package/dist/{harness-6AUE3I4Q.js → harness-7HC6UR2D.js} +3 -3
- package/dist/harness-launch-gate.js +4 -4
- package/dist/harness-worker.js +6 -6
- package/dist/hook-body.js +446 -278
- package/dist/{hook-spec-C5fWTSCH.d.ts → hook-spec-0aGt29Pg.d.ts} +22 -2
- package/dist/{hooks-HLPQPVRY.js → hooks-L2MKB75Z.js} +3 -3
- package/dist/{host-5Q3X6OY7.js → host-OAQZTYII.js} +15 -16
- package/dist/{host-LGSWU3PJ.js → host-QSBXKTWT.js} +7 -7
- package/dist/{host-run-4NMQQASQ.js → host-run-HFOADX32.js} +10 -6
- package/dist/http.js +1 -1
- package/dist/{import-mcp-WU7TO2RT.js → import-mcp-BCYXJAIU.js} +11 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -18
- package/dist/{init-XA6XXLGA.js → init-NVJVNZOD.js} +2 -2
- package/dist/{invoke-CYQZYU5T.js → invoke-KVTEPXSC.js} +8 -8
- package/dist/{list-FNGXY5D7.js → list-2VRPMASP.js} +13 -14
- package/dist/{logout-N753FBZP.js → logout-6T5ZDLHQ.js} +12 -13
- package/dist/{logs-TBUA4UWU.js → logs-H3RPKNTE.js} +3 -4
- package/dist/{mailbox-BMTZOSZ7.js → mailbox-O3MX6QPF.js} +3 -4
- package/dist/{mainline-KAD2ERLP.js → mainline-DG75NLBS.js} +306 -57
- package/dist/{mcp-GR4VXKTG.js → mcp-7UKG5TD3.js} +2 -2
- package/dist/{pause-7LILUVGL.js → pause-2HQ7CKMR.js} +3 -4
- package/dist/project/hook-adapter.d.ts +1 -1
- package/dist/{project-OEBACWEX.js → project-BPKQOSKQ.js} +4 -4
- package/dist/{resume-26VFAAMH.js → resume-ETFTR5V3.js} +3 -4
- package/dist/{run-MDRUOEFL.js → run-5JD62E7R.js} +11 -12
- package/dist/{run-7XNGPU2I.js → run-WGIRM6Z7.js} +4 -4
- package/dist/{serve-HXHNWKEK.js → serve-J575WVIU.js} +3 -3
- package/dist/setup-T6T2PFC4.js +20 -0
- package/dist/{start-login-PWCEKNED.js → start-login-2AYCHWLV.js} +12 -13
- package/dist/{status-QFOBQ42J.js → status-2YWTJOMH.js} +20 -27
- package/dist/{status-54IYX2FN.js → status-425ZKIE6.js} +12 -13
- package/dist/{status-RO55QPKV.js → status-GPSLH4VO.js} +3 -4
- package/dist/stdio.js +2 -2
- package/dist/{sweep-35LGQTTO.js → sweep-VY2TNOO5.js} +3 -4
- package/dist/{test-36ZUVALT.js → test-XBLZOX52.js} +50 -15
- package/dist/{tui-CSRW4DN2.js → tui-WNVBHP65.js} +4 -4
- package/dist/{unbroadcast-5QNGAJR2.js → unbroadcast-RKTBP57G.js} +3 -4
- package/dist/{worker-EODWT4KK.js → worker-CGF3UIJE.js} +8 -8
- package/dist/{worktree-create-PZSRB7PH.js → worktree-create-NO4UOOEP.js} +2 -2
- package/dist/{worktree-list-JYB6VXLW.js → worktree-list-NEIDD66X.js} +4 -4
- package/dist/{worktree-sync-UF5CXPWV.js → worktree-sync-W4BDDLRO.js} +8 -9
- package/docs/commands.md +1 -1
- package/docs/git-workflow.md +58 -1
- package/docs/hooks.md +29 -0
- package/docs/project-configuration.md +7 -7
- package/gemini-extension.json +2 -2
- package/mcp.json +1 -1
- package/package.json +5 -5
- package/plugin.json +1 -1
- package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
- package/plugins/pmcp/.mcp.json +1 -1
- package/plugins/pmcp/gemini-extension.json +2 -2
- package/plugins/pmcp/mcp.json +1 -1
- package/plugins/pmcp/plugin.json +1 -1
- package/dist/chunk-26WLNWDG.js +0 -93
- package/dist/chunk-MZCRCMEY.js +0 -7
- package/dist/setup-DTKZLZUT.js +0 -18
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-OEH47H6A.js";
|
|
4
4
|
import {
|
|
5
5
|
VERSION
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GPSOPGJA.js";
|
|
7
7
|
import {
|
|
8
8
|
ConfigError
|
|
9
9
|
} from "./chunk-QPL7E2HW.js";
|
|
@@ -11,9 +11,69 @@ import {
|
|
|
11
11
|
envNames
|
|
12
12
|
} from "./chunk-J6KL3COD.js";
|
|
13
13
|
|
|
14
|
+
// src/native/binary.ts
|
|
15
|
+
import { accessSync, constants, statSync } from "fs";
|
|
16
|
+
import { createRequire } from "module";
|
|
17
|
+
import { delimiter, dirname, join } from "path";
|
|
18
|
+
function executable(path) {
|
|
19
|
+
try {
|
|
20
|
+
accessSync(path, constants.X_OK);
|
|
21
|
+
return statSync(path).isFile();
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function packagedBinary(name, from = import.meta.url) {
|
|
27
|
+
const platform = `pmcp-${process.platform}-${process.arch}`;
|
|
28
|
+
let manifest;
|
|
29
|
+
try {
|
|
30
|
+
manifest = createRequire(from).resolve(
|
|
31
|
+
`@modootoday/${platform}/package.json`
|
|
32
|
+
);
|
|
33
|
+
} catch {
|
|
34
|
+
return { reason: `no @modootoday/${platform} package is installed` };
|
|
35
|
+
}
|
|
36
|
+
const path = join(dirname(manifest), "bin", name);
|
|
37
|
+
return executable(path) ? { path } : { reason: `@modootoday/${platform} has no ${name}` };
|
|
38
|
+
}
|
|
39
|
+
var BUILT = {
|
|
40
|
+
"linux-x64": ["pmcp-pty", "pmcp-tui", "pmcp-browser", "pmcp-desktop"],
|
|
41
|
+
"linux-arm64": ["pmcp-pty", "pmcp-tui", "pmcp-browser", "pmcp-desktop"],
|
|
42
|
+
"darwin-x64": ["pmcp-pty", "pmcp-tui"],
|
|
43
|
+
"darwin-arm64": ["pmcp-pty", "pmcp-tui"]
|
|
44
|
+
};
|
|
45
|
+
function missingBinary(name, variable, version, from = import.meta.url) {
|
|
46
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
47
|
+
const pkg = `@modootoday/pmcp-${platform}@${version}`;
|
|
48
|
+
const own = `, or set ${variable} to a ${name} you built`;
|
|
49
|
+
if (!BUILT[platform]?.includes(name))
|
|
50
|
+
return `${name} is not built for ${platform}; set ${variable} to a ${name} you built`;
|
|
51
|
+
const found = packagedBinary(name, from);
|
|
52
|
+
if ("path" in found)
|
|
53
|
+
return `${name} at ${found.path} is not executable${own}`;
|
|
54
|
+
if (found.reason.startsWith("no "))
|
|
55
|
+
return `${name} not found: the platform package ${pkg} is not installed; reinstall @modootoday/pmcp (npm installs it as an optional dependency)${own}`;
|
|
56
|
+
return `${name} not found: ${found.reason}; reinstall @modootoday/pmcp${own}`;
|
|
57
|
+
}
|
|
58
|
+
function packaged(name) {
|
|
59
|
+
const found = packagedBinary(name);
|
|
60
|
+
return "path" in found ? found.path : null;
|
|
61
|
+
}
|
|
62
|
+
function nativeBinary(name, variable, env) {
|
|
63
|
+
const given = env[variable];
|
|
64
|
+
if (given) return executable(given) ? given : null;
|
|
65
|
+
const found = packaged(name);
|
|
66
|
+
if (found) return found;
|
|
67
|
+
for (const dir of (env["PATH"] ?? "").split(delimiter).filter(Boolean)) {
|
|
68
|
+
const candidate = join(dir, name);
|
|
69
|
+
if (executable(candidate)) return candidate;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
14
74
|
// src/project/projector.ts
|
|
15
75
|
import { existsSync, mkdirSync, readFileSync, realpathSync } from "fs";
|
|
16
|
-
import { join } from "path";
|
|
76
|
+
import { join as join2 } from "path";
|
|
17
77
|
|
|
18
78
|
// src/project/write.ts
|
|
19
79
|
import { randomUUID } from "crypto";
|
|
@@ -28,7 +88,7 @@ import {
|
|
|
28
88
|
symlinkSync,
|
|
29
89
|
writeFileSync
|
|
30
90
|
} from "fs";
|
|
31
|
-
import { dirname } from "path";
|
|
91
|
+
import { dirname as dirname2 } from "path";
|
|
32
92
|
function fileMode(path) {
|
|
33
93
|
try {
|
|
34
94
|
const stat = lstatSync(path);
|
|
@@ -40,7 +100,7 @@ function fileMode(path) {
|
|
|
40
100
|
}
|
|
41
101
|
function syncDirectory(path) {
|
|
42
102
|
if (process.platform === "win32") return;
|
|
43
|
-
const descriptor = openSync(
|
|
103
|
+
const descriptor = openSync(dirname2(path), "r");
|
|
44
104
|
try {
|
|
45
105
|
fsyncSync(descriptor);
|
|
46
106
|
} finally {
|
|
@@ -80,7 +140,7 @@ function replaceLink(path, target) {
|
|
|
80
140
|
var LOCK_VERSION_KEY = "pmcp_version";
|
|
81
141
|
var PROJECTOR_FILE = "projector.json";
|
|
82
142
|
function lockVersionProblem(root) {
|
|
83
|
-
const path =
|
|
143
|
+
const path = join2(root, "pmcp.lock");
|
|
84
144
|
if (!existsSync(path)) return null;
|
|
85
145
|
const lock = JSON.parse(readFileSync(path, "utf8"));
|
|
86
146
|
const recorded = lock[LOCK_VERSION_KEY];
|
|
@@ -95,7 +155,7 @@ function recordProjector(spec, entry = process.argv[1]) {
|
|
|
95
155
|
const cli = realpathSync(entry);
|
|
96
156
|
if (!CLI_ENTRY.test(cli)) return;
|
|
97
157
|
const dir = projectStateDir(spec.root, policy.stateDir);
|
|
98
|
-
const file =
|
|
158
|
+
const file = join2(dir, PROJECTOR_FILE);
|
|
99
159
|
const known = existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : {};
|
|
100
160
|
mkdirSync(dir, { recursive: true });
|
|
101
161
|
replaceFile(
|
|
@@ -110,11 +170,11 @@ function recordProjector(spec, entry = process.argv[1]) {
|
|
|
110
170
|
// src/project/apply/lock.ts
|
|
111
171
|
import { createHash } from "crypto";
|
|
112
172
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
113
|
-
import { join as
|
|
173
|
+
import { join as join3 } from "path";
|
|
114
174
|
var LOCK_FILE = "pmcp.lock";
|
|
115
175
|
var sha = (text2) => createHash("sha256").update(text2).digest("hex");
|
|
116
176
|
function readLock(root) {
|
|
117
|
-
const path =
|
|
177
|
+
const path = join3(root, LOCK_FILE);
|
|
118
178
|
if (!existsSync2(path)) return [];
|
|
119
179
|
const lock = JSON.parse(readFileSync2(path, "utf8"));
|
|
120
180
|
return lock.outputs ?? [];
|
|
@@ -138,53 +198,12 @@ function lockEntry(output) {
|
|
|
138
198
|
}
|
|
139
199
|
function writeLock(root, outputs) {
|
|
140
200
|
replaceFile(
|
|
141
|
-
|
|
201
|
+
join3(root, LOCK_FILE),
|
|
142
202
|
`${JSON.stringify({ version: 1, [LOCK_VERSION_KEY]: VERSION, outputs: outputs.filter((output) => output.kind !== "json" || output.managed === void 0 || output.managed.length > 0).map(lockEntry) }, null, 2)}
|
|
143
203
|
`
|
|
144
204
|
);
|
|
145
205
|
}
|
|
146
206
|
|
|
147
|
-
// src/native/binary.ts
|
|
148
|
-
import { accessSync, constants, statSync } from "fs";
|
|
149
|
-
import { createRequire } from "module";
|
|
150
|
-
import { delimiter, dirname as dirname2, join as join3 } from "path";
|
|
151
|
-
function executable(path) {
|
|
152
|
-
try {
|
|
153
|
-
accessSync(path, constants.X_OK);
|
|
154
|
-
return statSync(path).isFile();
|
|
155
|
-
} catch {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function packagedBinary(name, from = import.meta.url) {
|
|
160
|
-
const platform = `pmcp-${process.platform}-${process.arch}`;
|
|
161
|
-
let manifest;
|
|
162
|
-
try {
|
|
163
|
-
manifest = createRequire(from).resolve(
|
|
164
|
-
`@modootoday/${platform}/package.json`
|
|
165
|
-
);
|
|
166
|
-
} catch {
|
|
167
|
-
return { reason: `no @modootoday/${platform} package is installed` };
|
|
168
|
-
}
|
|
169
|
-
const path = join3(dirname2(manifest), "bin", name);
|
|
170
|
-
return executable(path) ? { path } : { reason: `@modootoday/${platform} has no ${name}` };
|
|
171
|
-
}
|
|
172
|
-
function packaged(name) {
|
|
173
|
-
const found = packagedBinary(name);
|
|
174
|
-
return "path" in found ? found.path : null;
|
|
175
|
-
}
|
|
176
|
-
function nativeBinary(name, variable, env) {
|
|
177
|
-
const given = env[variable];
|
|
178
|
-
if (given) return executable(given) ? given : null;
|
|
179
|
-
const found = packaged(name);
|
|
180
|
-
if (found) return found;
|
|
181
|
-
for (const dir of (env["PATH"] ?? "").split(delimiter).filter(Boolean)) {
|
|
182
|
-
const candidate = join3(dir, name);
|
|
183
|
-
if (executable(candidate)) return candidate;
|
|
184
|
-
}
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
207
|
// src/project/host-spec.ts
|
|
189
208
|
import { isAbsolute, normalize } from "path";
|
|
190
209
|
|
|
@@ -418,6 +437,7 @@ function readHost(path, raw) {
|
|
|
418
437
|
|
|
419
438
|
export {
|
|
420
439
|
packagedBinary,
|
|
440
|
+
missingBinary,
|
|
421
441
|
nativeBinary,
|
|
422
442
|
replaceFile,
|
|
423
443
|
replaceLink,
|
|
@@ -428,4 +448,4 @@ export {
|
|
|
428
448
|
writeLock,
|
|
429
449
|
readHost
|
|
430
450
|
};
|
|
431
|
-
//# sourceMappingURL=chunk-
|
|
451
|
+
//# sourceMappingURL=chunk-XKGS2FNF.js.map
|
|
@@ -7,20 +7,20 @@ import {
|
|
|
7
7
|
observeSession,
|
|
8
8
|
openGroup,
|
|
9
9
|
runOperation
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7FAA32PB.js";
|
|
11
11
|
import {
|
|
12
12
|
nativeHostTools
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-G7NN23YK.js";
|
|
14
14
|
import {
|
|
15
15
|
locateExecutable
|
|
16
16
|
} from "./chunk-R2GPCZUX.js";
|
|
17
17
|
import {
|
|
18
18
|
artifact,
|
|
19
19
|
stateDirectory
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IKJOXDCF.js";
|
|
21
21
|
import {
|
|
22
22
|
ptyBinary
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-UOLV2AWA.js";
|
|
24
24
|
import {
|
|
25
25
|
GroupStore,
|
|
26
26
|
privateJson
|
|
@@ -249,4 +249,4 @@ async function invoke(operation) {
|
|
|
249
249
|
export {
|
|
250
250
|
invoke
|
|
251
251
|
};
|
|
252
|
-
//# sourceMappingURL=chunk-
|
|
252
|
+
//# sourceMappingURL=chunk-XS2QM6AT.js.map
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
} from "./chunk-HQOB7OQS.js";
|
|
4
4
|
import {
|
|
5
5
|
readGitConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-J5XQW2CM.js";
|
|
7
7
|
import {
|
|
8
8
|
detect
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2Q6MNGU5.js";
|
|
10
10
|
import {
|
|
11
11
|
syncWorktree
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-D5D3V6RU.js";
|
|
13
13
|
import {
|
|
14
14
|
gitText
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-G7JONWL4.js";
|
|
16
16
|
import {
|
|
17
17
|
localCli,
|
|
18
18
|
pmcpCommand,
|
|
@@ -25,13 +25,11 @@ import {
|
|
|
25
25
|
ptyFields,
|
|
26
26
|
ptyRef
|
|
27
27
|
} from "./chunk-3PW4FI7U.js";
|
|
28
|
-
import {
|
|
29
|
-
readStoreSettings
|
|
30
|
-
} from "./chunk-26WLNWDG.js";
|
|
31
28
|
import {
|
|
32
29
|
inboxKey,
|
|
33
|
-
noticeOf
|
|
34
|
-
|
|
30
|
+
noticeOf,
|
|
31
|
+
readStoreSettings
|
|
32
|
+
} from "./chunk-DHAPQUEF.js";
|
|
35
33
|
import {
|
|
36
34
|
STATE_FILES,
|
|
37
35
|
leaseFile,
|
|
@@ -47,7 +45,7 @@ import {
|
|
|
47
45
|
packagedBinary,
|
|
48
46
|
readHost,
|
|
49
47
|
readLock
|
|
50
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-XKGS2FNF.js";
|
|
51
49
|
import {
|
|
52
50
|
checkoutOf,
|
|
53
51
|
hasLinkedWorktrees
|
|
@@ -2633,7 +2631,7 @@ var leases = {
|
|
|
2633
2631
|
options(raw) {
|
|
2634
2632
|
return Object.entries(raw).map(([name, value]) => {
|
|
2635
2633
|
const table3 = value ?? {};
|
|
2636
|
-
onlyKeys(table3, ["path", "blocks"]);
|
|
2634
|
+
onlyKeys(table3, ["path", "blocks", "file", "events"]);
|
|
2637
2635
|
if (table3["path"] !== void 0 && typeof table3["path"] !== "string")
|
|
2638
2636
|
throw new Error(`${name}.path must be a string`);
|
|
2639
2637
|
return {
|
|
@@ -3825,6 +3823,7 @@ var POLICIES = {
|
|
|
3825
3823
|
|
|
3826
3824
|
// src/hooks/compile/bindings.ts
|
|
3827
3825
|
var BASE_TIMEOUT_SEC = 10;
|
|
3826
|
+
var STARTUP_MS = 3e3;
|
|
3828
3827
|
function listening(policy, options2) {
|
|
3829
3828
|
const events = policy.eventsFor ? policy.eventsFor(policy.options(options2)) : policy.events;
|
|
3830
3829
|
return { events, tools: policy.tools };
|
|
@@ -3849,8 +3848,15 @@ function bindingsFor(policy, id) {
|
|
|
3849
3848
|
want(event, listener.tools ?? ["other"]);
|
|
3850
3849
|
}
|
|
3851
3850
|
if (policy.emergencyOffFile) want("before_tool", ["shell", "edit"]);
|
|
3852
|
-
const
|
|
3853
|
-
const
|
|
3851
|
+
const tries = policy.failure ? policy.failure.timeoutMs * (policy.failure.retry + 1) : 0;
|
|
3852
|
+
const slowest = Math.max(
|
|
3853
|
+
tries,
|
|
3854
|
+
...policy.custom.map((entry) => entry.timeoutMs)
|
|
3855
|
+
);
|
|
3856
|
+
const timeoutSec = Math.max(
|
|
3857
|
+
BASE_TIMEOUT_SEC,
|
|
3858
|
+
Math.ceil((slowest + STARTUP_MS) / 1e3)
|
|
3859
|
+
);
|
|
3854
3860
|
return [...wanted].flatMap(
|
|
3855
3861
|
([event, tools]) => adapter.bindings(event, [...tools], timeoutSec)
|
|
3856
3862
|
);
|
|
@@ -4044,6 +4050,59 @@ function readChecks(raw) {
|
|
|
4044
4050
|
});
|
|
4045
4051
|
}
|
|
4046
4052
|
|
|
4053
|
+
// src/hooks/dispatch/failure.ts
|
|
4054
|
+
import { isAbsolute as isAbsolute11, relative as relative6, resolve as resolve13 } from "path";
|
|
4055
|
+
var PASS_KINDS = ["read", "edit-own-worktree"];
|
|
4056
|
+
function readFailure(value) {
|
|
4057
|
+
if (value === void 0) return void 0;
|
|
4058
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
4059
|
+
throw new Error("[hooks.failure] must be a table");
|
|
4060
|
+
const table3 = value;
|
|
4061
|
+
for (const key of Object.keys(table3))
|
|
4062
|
+
if (!["timeout_ms", "retry", "pass"].includes(key))
|
|
4063
|
+
throw new Error(`[hooks.failure] unknown key ${key}`);
|
|
4064
|
+
const integer = (key, fallback3, min, max) => {
|
|
4065
|
+
const v = table3[key] ?? fallback3;
|
|
4066
|
+
if (typeof v !== "number" || !Number.isInteger(v) || v < min || v > max)
|
|
4067
|
+
throw new Error(
|
|
4068
|
+
`[hooks.failure] ${key} must be an integer from ${min} to ${max}`
|
|
4069
|
+
);
|
|
4070
|
+
return v;
|
|
4071
|
+
};
|
|
4072
|
+
const pass2 = table3["pass"] ?? [];
|
|
4073
|
+
if (!Array.isArray(pass2) || !pass2.every((kind) => PASS_KINDS.includes(kind)))
|
|
4074
|
+
throw new Error(
|
|
4075
|
+
`[hooks.failure] pass must list ${PASS_KINDS.join(" or ")}`
|
|
4076
|
+
);
|
|
4077
|
+
return {
|
|
4078
|
+
timeoutMs: integer("timeout_ms", 2e3, 100, 6e4),
|
|
4079
|
+
retry: integer("retry", 1, 0, 3),
|
|
4080
|
+
pass: [...new Set(pass2)]
|
|
4081
|
+
};
|
|
4082
|
+
}
|
|
4083
|
+
function ownWorktree(input) {
|
|
4084
|
+
const checkout = checkoutOf(input.cwd);
|
|
4085
|
+
if (!checkout || checkout.main) return false;
|
|
4086
|
+
const paths = input.tool?.paths ?? [];
|
|
4087
|
+
return paths.length > 0 && paths.every((path) => {
|
|
4088
|
+
const rest = relative6(checkout.root, resolve13(input.cwd, path));
|
|
4089
|
+
return rest !== "" && !rest.startsWith("..") && !isAbsolute11(rest);
|
|
4090
|
+
});
|
|
4091
|
+
}
|
|
4092
|
+
function passes(input, pass2) {
|
|
4093
|
+
const kind = input.tool?.kind;
|
|
4094
|
+
if (kind === "read") return pass2.includes("read");
|
|
4095
|
+
if (kind === "edit")
|
|
4096
|
+
return pass2.includes("edit-own-worktree") && ownWorktree(input);
|
|
4097
|
+
return false;
|
|
4098
|
+
}
|
|
4099
|
+
function afterFailure(policy, cause, input, failure) {
|
|
4100
|
+
const head = `pmcp hooks: ${policy} failed (${cause})`;
|
|
4101
|
+
if (passes(input, failure.pass))
|
|
4102
|
+
return { context: [`${head}; passed with a warning`] };
|
|
4103
|
+
return { verdict: "deny", reason: `${head}; refused` };
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4047
4106
|
// src/hooks/compile/hooks-table.ts
|
|
4048
4107
|
var KEYS2 = [
|
|
4049
4108
|
"targets",
|
|
@@ -4053,7 +4112,8 @@ var KEYS2 = [
|
|
|
4053
4112
|
"guards",
|
|
4054
4113
|
"checks",
|
|
4055
4114
|
"shell",
|
|
4056
|
-
"edit"
|
|
4115
|
+
"edit",
|
|
4116
|
+
"failure"
|
|
4057
4117
|
];
|
|
4058
4118
|
var LEGACY = /* @__PURE__ */ new Set(["shell", "edit"]);
|
|
4059
4119
|
var FALLBACKS = ["deny", "warn", "refuse"];
|
|
@@ -4093,13 +4153,15 @@ function readHooksTable(table3, tools) {
|
|
|
4093
4153
|
}
|
|
4094
4154
|
const log = errorLog(table3["error_log"]);
|
|
4095
4155
|
const emergencyOffFile = offFile(table3["emergency_off_file"]);
|
|
4156
|
+
const failure = readFailure(table3["failure"]);
|
|
4096
4157
|
return {
|
|
4097
4158
|
enabled,
|
|
4098
4159
|
targets: [...new Set(targets)],
|
|
4099
4160
|
askFallback,
|
|
4100
4161
|
logEnabled: log.enabled,
|
|
4101
4162
|
...log.file ? { errorLog: log.file } : {},
|
|
4102
|
-
...emergencyOffFile ? { emergencyOffFile } : {}
|
|
4163
|
+
...emergencyOffFile ? { emergencyOffFile } : {},
|
|
4164
|
+
...failure ? { failure } : {}
|
|
4103
4165
|
};
|
|
4104
4166
|
}
|
|
4105
4167
|
|
|
@@ -4141,11 +4203,11 @@ function registryCheck(raw) {
|
|
|
4141
4203
|
const unknown = Object.keys(rest).find((key) => key !== "stale_minutes");
|
|
4142
4204
|
if (unknown) throw new Error(`[sessions.registry] unknown key ${unknown}`);
|
|
4143
4205
|
}
|
|
4144
|
-
function readSessions(raw) {
|
|
4206
|
+
function readSessions(raw, git) {
|
|
4145
4207
|
const table3 = asTable(raw, "[sessions]");
|
|
4146
4208
|
const unknown = Object.keys(table3).find((key) => !KEYS3.includes(key));
|
|
4147
4209
|
if (unknown) throw new Error(`[sessions] unknown key ${unknown}`);
|
|
4148
|
-
const settings = readStoreSettings(raw);
|
|
4210
|
+
const settings = readStoreSettings(raw, git);
|
|
4149
4211
|
registryCheck(table3["registry"]);
|
|
4150
4212
|
const guards = [];
|
|
4151
4213
|
if (table3["registry"] !== void 0)
|
|
@@ -4295,7 +4357,7 @@ function compileHooks(tables, options2) {
|
|
|
4295
4357
|
const table3 = readHooksTable(hooks, options2.tools);
|
|
4296
4358
|
const guardsTable = asTable(hooks["guards"], "[hooks.guards]");
|
|
4297
4359
|
const entries = readCustom(options2.root, hooks, guardsTable);
|
|
4298
|
-
const sessions = readSessions(tables.sessions);
|
|
4360
|
+
const sessions = readSessions(tables.sessions, tables.git);
|
|
4299
4361
|
const workspace = readWorkspace(tables.git, options2.root);
|
|
4300
4362
|
const deskSync = readWorktreeSync(tables, options2.root);
|
|
4301
4363
|
const directPush = readMainlineDeliver(tables, options2.root);
|
|
@@ -4327,6 +4389,7 @@ function compileHooks(tables, options2) {
|
|
|
4327
4389
|
contract: 2,
|
|
4328
4390
|
targets: table3.targets,
|
|
4329
4391
|
...table3.emergencyOffFile ? { emergencyOffFile: table3.emergencyOffFile } : {},
|
|
4392
|
+
...table3.failure ? { failure: table3.failure } : {},
|
|
4330
4393
|
...sessions.stateDir ? { stateDir: sessions.stateDir } : {},
|
|
4331
4394
|
...table3.errorLog ? { logFile: table3.errorLog } : {},
|
|
4332
4395
|
log: { ...readLoggingTable(tables.logging), enabled: table3.logEnabled },
|
|
@@ -4334,7 +4397,10 @@ function compileHooks(tables, options2) {
|
|
|
4334
4397
|
staleMs: sessions.staleMs,
|
|
4335
4398
|
keepBroadcasts: sessions.keepBroadcasts,
|
|
4336
4399
|
// Only when on, so projects without a mailbox keep the same policy.json and hash.
|
|
4337
|
-
...sessions.mailbox?.enabled ? { mailbox: sessions.mailbox } : {}
|
|
4400
|
+
...sessions.mailbox?.enabled ? { mailbox: sessions.mailbox } : {},
|
|
4401
|
+
// Only when declared, like the mailbox, so other projects keep the same policy.json.
|
|
4402
|
+
...sessions.leaseFiles ? { leaseFiles: sessions.leaseFiles } : {},
|
|
4403
|
+
...sessions.gate ? { gate: sessions.gate } : {}
|
|
4338
4404
|
},
|
|
4339
4405
|
guards,
|
|
4340
4406
|
custom: pinnedEntries(options2.root, entries, table3.targets),
|
|
@@ -4976,6 +5042,7 @@ export {
|
|
|
4976
5042
|
climbCommand,
|
|
4977
5043
|
RUNTIMES,
|
|
4978
5044
|
NATIVE_HOOK_FILES,
|
|
5045
|
+
afterFailure,
|
|
4979
5046
|
uiClaudeOutputs,
|
|
4980
5047
|
uiClaudeDoctor,
|
|
4981
5048
|
linkOf,
|
|
@@ -5002,4 +5069,4 @@ export {
|
|
|
5002
5069
|
permissionDoctor,
|
|
5003
5070
|
readSpec
|
|
5004
5071
|
};
|
|
5005
|
-
//# sourceMappingURL=chunk-
|
|
5072
|
+
//# sourceMappingURL=chunk-Y65MO2SS.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-7DLZC73N.js";
|
|
4
4
|
import {
|
|
5
5
|
readSpec
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Y65MO2SS.js";
|
|
7
7
|
import {
|
|
8
8
|
ArgumentError
|
|
9
9
|
} from "./chunk-A4PKLESO.js";
|
|
@@ -25,4 +25,4 @@ function serverFrom(context) {
|
|
|
25
25
|
export {
|
|
26
26
|
serverFrom
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-YTSJRA4Z.js.map
|
|
@@ -61,11 +61,11 @@ var completionSpec = {
|
|
|
61
61
|
var COMMANDS = [
|
|
62
62
|
{
|
|
63
63
|
...statusSpec,
|
|
64
|
-
load: async () => (await import("./status-
|
|
64
|
+
load: async () => (await import("./status-2YWTJOMH.js")).statusCommand
|
|
65
65
|
},
|
|
66
|
-
{ ...initSpec, load: async () => (await import("./init-
|
|
67
|
-
{ ...hooksSpec, load: async () => (await import("./hooks-
|
|
68
|
-
{ ...serveSpec, load: async () => (await import("./serve-
|
|
66
|
+
{ ...initSpec, load: async () => (await import("./init-NVJVNZOD.js")).initCommand },
|
|
67
|
+
{ ...hooksSpec, load: async () => (await import("./hooks-L2MKB75Z.js")).hooksCommand },
|
|
68
|
+
{ ...serveSpec, load: async () => (await import("./serve-J575WVIU.js")).serveCommand },
|
|
69
69
|
{ ...listSpec, load: async () => (await import("./list-FB6RNYYB.js")).listCommand },
|
|
70
70
|
{
|
|
71
71
|
...indexSpec,
|
|
@@ -102,19 +102,19 @@ var COMMANDS = [
|
|
|
102
102
|
{ ...syncSpec, load: async () => (await import("./install-MQ7QSJQ7.js")).syncCommand },
|
|
103
103
|
{
|
|
104
104
|
...projectSpec,
|
|
105
|
-
load: async () => (await import("./project-
|
|
105
|
+
load: async () => (await import("./project-BPKQOSKQ.js")).projectCommand
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
...doctorSpec,
|
|
109
|
-
load: async () => (await import("./doctor-
|
|
109
|
+
load: async () => (await import("./doctor-UH7KEOSO.js")).doctorCommand
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
...sessionsSpec,
|
|
113
|
-
load: async () => (await import("./cli-
|
|
113
|
+
load: async () => (await import("./cli-T5LHBUY2.js")).sessionsCommand
|
|
114
114
|
},
|
|
115
|
-
{ ...logsSpec, load: async () => (await import("./logs-
|
|
116
|
-
{ ...gitSpec, load: async () => (await import("./cli-
|
|
117
|
-
{ ...mcpSpec, load: async () => (await import("./mcp-
|
|
115
|
+
{ ...logsSpec, load: async () => (await import("./logs-H3RPKNTE.js")).logsCommand },
|
|
116
|
+
{ ...gitSpec, load: async () => (await import("./cli-MUP2NSXT.js")).gitCommand },
|
|
117
|
+
{ ...mcpSpec, load: async () => (await import("./mcp-7UKG5TD3.js")).mcpCommand },
|
|
118
118
|
{
|
|
119
119
|
...validateSpec,
|
|
120
120
|
load: async () => (await import("./validate-AVM2VHMM.js")).validateCommand
|
|
@@ -125,16 +125,16 @@ var COMMANDS = [
|
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
...harnessSpec,
|
|
128
|
-
load: async () => (await import("./harness-
|
|
128
|
+
load: async () => (await import("./harness-7HC6UR2D.js")).harnessCommand
|
|
129
129
|
},
|
|
130
|
-
{ ...tuiSpec, load: async () => (await import("./tui-
|
|
130
|
+
{ ...tuiSpec, load: async () => (await import("./tui-WNVBHP65.js")).tuiCommand },
|
|
131
131
|
{
|
|
132
132
|
...marketplaceSpec,
|
|
133
133
|
load: async () => (await import("./marketplace-G4VQET5W.js")).marketplaceCommand
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
136
|
...completionSpec,
|
|
137
|
-
load: async () => (await import("./completion-
|
|
137
|
+
load: async () => (await import("./completion-ZY5P443T.js")).completionCommand
|
|
138
138
|
}
|
|
139
139
|
];
|
|
140
140
|
var PLANNED = [];
|
|
@@ -148,4 +148,4 @@ export {
|
|
|
148
148
|
PLANNED,
|
|
149
149
|
commandNamed
|
|
150
150
|
};
|
|
151
|
-
//# sourceMappingURL=chunk-
|
|
151
|
+
//# sourceMappingURL=chunk-ZYMJV7YX.js.map
|
|
@@ -11,23 +11,24 @@ import {
|
|
|
11
11
|
async function action(positional) {
|
|
12
12
|
const [verb, sub] = positional;
|
|
13
13
|
if (verb === "deliver")
|
|
14
|
-
return (await import("./mainline-
|
|
15
|
-
if (verb === "sync") return (await import("./mainline-
|
|
14
|
+
return (await import("./mainline-DG75NLBS.js")).mainlineDeliver;
|
|
15
|
+
if (verb === "sync") return (await import("./mainline-DG75NLBS.js")).mainlineSync;
|
|
16
16
|
if (verb !== "worktree")
|
|
17
17
|
throw new ArgumentError("Use worktree, deliver or sync");
|
|
18
18
|
if (sub === "create")
|
|
19
|
-
return (await import("./worktree-create-
|
|
19
|
+
return (await import("./worktree-create-NO4UOOEP.js")).worktreeCreate;
|
|
20
20
|
if (sub === "list")
|
|
21
|
-
return (await import("./worktree-list-
|
|
21
|
+
return (await import("./worktree-list-NEIDD66X.js")).worktreeList;
|
|
22
22
|
if (sub === "sync")
|
|
23
|
-
return (await import("./worktree-sync-
|
|
23
|
+
return (await import("./worktree-sync-W4BDDLRO.js")).worktreeSync;
|
|
24
24
|
throw new ArgumentError("Use worktree create, list or sync");
|
|
25
25
|
}
|
|
26
26
|
async function run(context) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const [verb, sub] = context.args.positional;
|
|
28
|
+
if (context.args.flags.has("json") && !(verb === "worktree" && sub === "list") && verb !== "deliver")
|
|
29
|
+
throw new ArgumentError("--json requires git worktree list or git deliver");
|
|
29
30
|
const act = await action(context.args.positional);
|
|
30
|
-
const { loadGit } = await import("./setup-
|
|
31
|
+
const { loadGit } = await import("./setup-T6T2PFC4.js");
|
|
31
32
|
const setup = loadGit(context.cwd, one(context.args, "config"), context.env);
|
|
32
33
|
if (setup instanceof Error) {
|
|
33
34
|
context.ui.error(setup.message);
|
|
@@ -43,4 +44,4 @@ var gitCommand = { ...gitSpec, run };
|
|
|
43
44
|
export {
|
|
44
45
|
gitCommand
|
|
45
46
|
};
|
|
46
|
-
//# sourceMappingURL=cli-
|
|
47
|
+
//# sourceMappingURL=cli-MUP2NSXT.js.map
|
|
@@ -16,26 +16,26 @@ async function run(context) {
|
|
|
16
16
|
`unknown verb ${verb}; use ${SESSION_VERBS.join(", ")}`
|
|
17
17
|
);
|
|
18
18
|
if (verb === "status")
|
|
19
|
-
return (await import("./status-
|
|
19
|
+
return (await import("./status-GPSLH4VO.js")).status(context);
|
|
20
20
|
if (context.args.flags.has("json") && !JSON_VERBS.includes(verb))
|
|
21
21
|
throw new ArgumentError(`--json works with ${JSON_VERBS.join(", ")}`);
|
|
22
22
|
if (["send", "inbox", "ack", "reply"].includes(verb)) {
|
|
23
|
-
const mailbox = await import("./mailbox-
|
|
23
|
+
const mailbox = await import("./mailbox-O3MX6QPF.js");
|
|
24
24
|
if (verb === "send") return mailbox.send(context);
|
|
25
25
|
if (verb === "inbox") return mailbox.inbox(context);
|
|
26
26
|
if (verb === "ack") return mailbox.ack(context);
|
|
27
27
|
return mailbox.reply(context);
|
|
28
28
|
}
|
|
29
|
-
if (verb === "pause") return (await import("./pause-
|
|
30
|
-
if (verb === "resume") return (await import("./resume-
|
|
29
|
+
if (verb === "pause") return (await import("./pause-2HQ7CKMR.js")).run(context);
|
|
30
|
+
if (verb === "resume") return (await import("./resume-ETFTR5V3.js")).run(context);
|
|
31
31
|
if (verb === "broadcast")
|
|
32
|
-
return (await import("./broadcast-
|
|
32
|
+
return (await import("./broadcast-56NPEJWM.js")).run(context);
|
|
33
33
|
if (verb === "unbroadcast")
|
|
34
|
-
return (await import("./unbroadcast-
|
|
35
|
-
return (await import("./sweep-
|
|
34
|
+
return (await import("./unbroadcast-RKTBP57G.js")).run(context);
|
|
35
|
+
return (await import("./sweep-VY2TNOO5.js")).run(context);
|
|
36
36
|
}
|
|
37
37
|
var sessionsCommand = { ...sessionsSpec, run };
|
|
38
38
|
export {
|
|
39
39
|
sessionsCommand
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=cli-
|
|
41
|
+
//# sourceMappingURL=cli-T5LHBUY2.js.map
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
COMMANDS,
|
|
4
4
|
PLANNED,
|
|
5
5
|
commandNamed
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZYMJV7YX.js";
|
|
7
7
|
import "./chunk-2P4Z2NUX.js";
|
|
8
8
|
import "./chunk-3Y3HDMHA.js";
|
|
9
9
|
import {
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import "./chunk-V4NPDK6X.js";
|
|
33
33
|
import {
|
|
34
34
|
VERSION
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-GPSOPGJA.js";
|
|
36
36
|
|
|
37
37
|
// src/cli/ui.ts
|
|
38
38
|
var ESC = String.fromCharCode(27);
|
|
@@ -185,7 +185,7 @@ async function defaultEntry(options, context) {
|
|
|
185
185
|
});
|
|
186
186
|
if (mode === "server") return run(required("serve"), [], context);
|
|
187
187
|
if (mode === "terminal") {
|
|
188
|
-
const { terminalSupport } = await import("./host-
|
|
188
|
+
const { terminalSupport } = await import("./host-QSBXKTWT.js");
|
|
189
189
|
const support = terminalSupport();
|
|
190
190
|
if (support.supported) return run(required("tui"), [], context);
|
|
191
191
|
context.ui.info(`Terminal workspace unavailable: ${support.reason}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
COMMANDS,
|
|
3
3
|
completionSpec
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZYMJV7YX.js";
|
|
5
5
|
import "./chunk-2P4Z2NUX.js";
|
|
6
6
|
import "./chunk-3Y3HDMHA.js";
|
|
7
7
|
import "./chunk-E3DQB5LS.js";
|
|
@@ -139,4 +139,4 @@ var completionCommand = {
|
|
|
139
139
|
export {
|
|
140
140
|
completionCommand
|
|
141
141
|
};
|
|
142
|
-
//# sourceMappingURL=completion-
|
|
142
|
+
//# sourceMappingURL=completion-ZY5P443T.js.map
|