@modootoday/pmcp 0.19.1 → 0.19.3
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-IPTASVRS.js → apply-3GVOB5SB.js} +16 -15
- package/dist/{chunk-Y65MO2SS.js → chunk-27RQE4X5.js} +32 -17
- package/dist/{chunk-YTSJRA4Z.js → chunk-3PFBFW5K.js} +2 -2
- package/dist/{chunk-G7NN23YK.js → chunk-6NAOPDEL.js} +2 -2
- package/dist/{chunk-J5XQW2CM.js → chunk-7B2KRL2H.js} +14 -3
- package/dist/{chunk-XS2QM6AT.js → chunk-A2A2QEGQ.js} +5 -5
- package/dist/{chunk-7FAA32PB.js → chunk-AKZ3TZF6.js} +3 -3
- package/dist/{chunk-MFPQDXUQ.js → chunk-BU5QVZD7.js} +5 -5
- package/dist/{chunk-OWW5VY4D.js → chunk-DJX3T6OQ.js} +3 -3
- package/dist/{chunk-JJBSYUSQ.js → chunk-DXJZ2ZCX.js} +2 -2
- package/dist/{chunk-UOLV2AWA.js → chunk-E4RHRBN4.js} +3 -3
- package/dist/{chunk-D5D3V6RU.js → chunk-ICF2JZSN.js} +15 -1
- package/dist/{chunk-2W6CEJD7.js → chunk-IITLKKLW.js} +2 -2
- package/dist/{chunk-MB72PZH7.js → chunk-INAQADYF.js} +8 -8
- package/dist/{chunk-3BLHIEAK.js → chunk-IRE5CH3V.js} +2 -2
- package/dist/{chunk-IKJOXDCF.js → chunk-JKUO3SES.js} +2 -2
- package/dist/chunk-JUV4AO7M.js +7 -0
- package/dist/{chunk-2DAC45ZT.js → chunk-JWYZE3QX.js} +2 -2
- package/dist/chunk-P6LNYYYH.js +95 -0
- package/dist/{chunk-XKGS2FNF.js → chunk-QESM25BF.js} +2 -2
- package/dist/{chunk-JAICIL6H.js → chunk-QWFXAUTC.js} +8 -8
- package/dist/{chunk-3CLLHFP7.js → chunk-TA7STTID.js} +2 -2
- package/dist/{chunk-ZYMJV7YX.js → chunk-VNNHEB6B.js} +23 -23
- package/dist/{chunk-3H5FZCKX.js → chunk-VVFEFQSO.js} +3 -3
- package/dist/{chunk-U2FPMGEM.js → chunk-WXKUV52B.js} +2 -2
- package/dist/{chunk-WIW772I3.js → chunk-XLXDXJY2.js} +4 -4
- package/dist/{chunk-LLBPVZXM.js → chunk-YN5GQCHN.js} +4 -4
- package/dist/{chunk-OKW7VKNQ.js → chunk-Z7OYA467.js} +2 -2
- package/dist/{cli-T5LHBUY2.js → cli-BTPTJWCC.js} +3 -3
- package/dist/{cli-MUP2NSXT.js → cli-UFCFDIVI.js} +7 -6
- package/dist/cli.js +7 -7
- package/dist/{completion-ZY5P443T.js → completion-S5RXYRE6.js} +6 -6
- package/dist/{diagnostics-KUNS6LCZ.js → diagnostics-IWZ44B3T.js} +6 -6
- package/dist/{doctor-UH7KEOSO.js → doctor-6OM2CW6Y.js} +21 -19
- package/dist/{entry-DOUDMRO2.js → entry-OP6P6JIE.js} +10 -10
- package/dist/{exec-mcp-TGW6FXGC.js → exec-mcp-VEHKAWE4.js} +10 -9
- package/dist/{harness-7HC6UR2D.js → harness-5IIU5JUZ.js} +3 -3
- package/dist/harness-launch-gate.js +4 -4
- package/dist/harness-worker.js +6 -6
- package/dist/hook-body.js +155 -56
- package/dist/{hook-spec-0aGt29Pg.d.ts → hook-spec-C7umArqw.d.ts} +1 -1
- package/dist/{hooks-L2MKB75Z.js → hooks-ZSA4DLUZ.js} +3 -3
- package/dist/{host-OAQZTYII.js → host-BWSHEN3G.js} +12 -11
- package/dist/{host-QSBXKTWT.js → host-CU5YGXUO.js} +7 -7
- package/dist/{host-run-HFOADX32.js → host-run-MCYOHAV4.js} +5 -5
- package/dist/http.js +1 -1
- package/dist/{import-mcp-BCYXJAIU.js → import-mcp-FC7HCWRT.js} +8 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -16
- package/dist/{init-NVJVNZOD.js → init-ADQO2QTV.js} +2 -2
- package/dist/{invoke-KVTEPXSC.js → invoke-P6GHAPFV.js} +8 -8
- package/dist/{list-2VRPMASP.js → list-YXCHN33G.js} +10 -9
- package/dist/{logout-6T5ZDLHQ.js → logout-J4YFUKXJ.js} +9 -8
- package/dist/{mailbox-O3MX6QPF.js → mailbox-UECKDZ3Q.js} +1 -1
- package/dist/{mainline-DG75NLBS.js → mainline-FPK4HWFF.js} +47 -14
- package/dist/{mcp-7UKG5TD3.js → mcp-DGQR4FRE.js} +2 -2
- package/dist/modes-COBVV7RA.js +14 -0
- package/dist/project/hook-adapter.d.ts +1 -1
- package/dist/{project-BPKQOSKQ.js → project-VZV5ZJ7Q.js} +6 -6
- package/dist/{run-WGIRM6Z7.js → run-6D7XVMOA.js} +4 -4
- package/dist/{run-5JD62E7R.js → run-OHZHE2GN.js} +8 -7
- package/dist/{serve-J575WVIU.js → serve-6ZL6SR5O.js} +6 -6
- package/dist/{setup-T6T2PFC4.js → setup-63E3TVJK.js} +4 -4
- package/dist/{start-login-2AYCHWLV.js → start-login-G63U6RT2.js} +9 -8
- package/dist/{status-425ZKIE6.js → status-6YMXYFE6.js} +9 -8
- package/dist/{status-GPSLH4VO.js → status-CM753VKY.js} +3 -3
- package/dist/{status-2YWTJOMH.js → status-KXTLD7EN.js} +13 -12
- package/dist/stdio.js +2 -2
- package/dist/{test-XBLZOX52.js → test-W3P5F5ML.js} +15 -10
- package/dist/{tui-WNVBHP65.js → tui-7R7TVPGT.js} +4 -4
- package/dist/{worker-CGF3UIJE.js → worker-SD2CHGC7.js} +8 -8
- package/dist/{worktree-sync-W4BDDLRO.js → worktree-sync-GQVYAXGJ.js} +4 -2
- package/docs/git-workflow.md +6 -5
- package/docs/hooks.md +19 -14
- package/docs/project-configuration.md +3 -1
- 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-GPSOPGJA.js +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
invoke
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-A2A2QEGQ.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureStartupDirectory,
|
|
6
6
|
readStartup,
|
|
@@ -10,27 +10,27 @@ import {
|
|
|
10
10
|
} from "./chunk-J5ZS7GLA.js";
|
|
11
11
|
import {
|
|
12
12
|
requireTerminal
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DJX3T6OQ.js";
|
|
14
14
|
import "./chunk-5ZABTVSW.js";
|
|
15
15
|
import {
|
|
16
16
|
runTui
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VVFEFQSO.js";
|
|
18
18
|
import {
|
|
19
19
|
lockFile
|
|
20
20
|
} from "./chunk-DZ2MRTYT.js";
|
|
21
21
|
import "./chunk-LMT3PPXJ.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-AKZ3TZF6.js";
|
|
23
|
+
import "./chunk-6NAOPDEL.js";
|
|
24
24
|
import {
|
|
25
25
|
locateExecutable
|
|
26
26
|
} from "./chunk-R2GPCZUX.js";
|
|
27
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-JKUO3SES.js";
|
|
28
28
|
import "./chunk-34DECPVC.js";
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-E4RHRBN4.js";
|
|
30
|
+
import "./chunk-QESM25BF.js";
|
|
31
31
|
import "./chunk-OEH47H6A.js";
|
|
32
32
|
import "./chunk-IJBSOWHK.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-JUV4AO7M.js";
|
|
34
34
|
import "./chunk-QPL7E2HW.js";
|
|
35
35
|
import "./chunk-PMJG2CXF.js";
|
|
36
36
|
import {
|
|
@@ -303,4 +303,4 @@ export {
|
|
|
303
303
|
launchStartup,
|
|
304
304
|
planStartup
|
|
305
305
|
};
|
|
306
|
-
//# sourceMappingURL=entry-
|
|
306
|
+
//# sourceMappingURL=entry-OP6P6JIE.js.map
|
|
@@ -8,19 +8,18 @@ import {
|
|
|
8
8
|
} from "./chunk-UPQTAHUK.js";
|
|
9
9
|
import {
|
|
10
10
|
specFrom
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-Z7OYA467.js";
|
|
12
12
|
import "./chunk-7DLZC73N.js";
|
|
13
13
|
import {
|
|
14
14
|
launch
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-TA7STTID.js";
|
|
16
|
+
import "./chunk-27RQE4X5.js";
|
|
17
17
|
import "./chunk-HQOB7OQS.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-7B2KRL2H.js";
|
|
19
19
|
import "./chunk-2Q6MNGU5.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-ICF2JZSN.js";
|
|
21
21
|
import "./chunk-UD3BEEBQ.js";
|
|
22
22
|
import "./chunk-ISNRDHSD.js";
|
|
23
|
-
import "./chunk-G7JONWL4.js";
|
|
24
23
|
import "./chunk-EATCUWGG.js";
|
|
25
24
|
import {
|
|
26
25
|
ProjectError
|
|
@@ -28,15 +27,17 @@ import {
|
|
|
28
27
|
import "./chunk-3PW4FI7U.js";
|
|
29
28
|
import "./chunk-DHAPQUEF.js";
|
|
30
29
|
import "./chunk-C4NHQGHL.js";
|
|
30
|
+
import "./chunk-P6LNYYYH.js";
|
|
31
|
+
import "./chunk-G7JONWL4.js";
|
|
31
32
|
import {
|
|
32
33
|
McpAuthError
|
|
33
34
|
} from "./chunk-Q5H3L6Y4.js";
|
|
34
35
|
import "./chunk-A4PKLESO.js";
|
|
35
36
|
import "./chunk-V4NPDK6X.js";
|
|
36
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-QESM25BF.js";
|
|
37
38
|
import "./chunk-OEH47H6A.js";
|
|
38
39
|
import "./chunk-IJBSOWHK.js";
|
|
39
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-JUV4AO7M.js";
|
|
40
41
|
import "./chunk-QPL7E2HW.js";
|
|
41
42
|
import "./chunk-PMJG2CXF.js";
|
|
42
43
|
import "./chunk-J6KL3COD.js";
|
|
@@ -362,4 +363,4 @@ function runExecMcp(context, name) {
|
|
|
362
363
|
export {
|
|
363
364
|
runExecMcp
|
|
364
365
|
};
|
|
365
|
-
//# sourceMappingURL=exec-mcp-
|
|
366
|
+
//# sourceMappingURL=exec-mcp-VEHKAWE4.js.map
|
|
@@ -151,12 +151,12 @@ var harnessCommand = {
|
|
|
151
151
|
return runPtyMcp(context);
|
|
152
152
|
}
|
|
153
153
|
if (context.args.positional[0] === "host") {
|
|
154
|
-
const { runHost } = await import("./host-
|
|
154
|
+
const { runHost } = await import("./host-BWSHEN3G.js");
|
|
155
155
|
return runHost(context);
|
|
156
156
|
}
|
|
157
157
|
try {
|
|
158
158
|
const operation = parseInvocation(context);
|
|
159
|
-
const { invoke } = await import("./invoke-
|
|
159
|
+
const { invoke } = await import("./invoke-P6GHAPFV.js");
|
|
160
160
|
const receipt = await invoke(operation);
|
|
161
161
|
context.ui.data(`${JSON.stringify(receipt)}
|
|
162
162
|
`);
|
|
@@ -174,4 +174,4 @@ var harnessCommand = {
|
|
|
174
174
|
export {
|
|
175
175
|
harnessCommand
|
|
176
176
|
};
|
|
177
|
-
//# sourceMappingURL=harness-
|
|
177
|
+
//# sourceMappingURL=harness-5IIU5JUZ.js.map
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
assertProof,
|
|
8
8
|
assertResourceFresh,
|
|
9
9
|
createProof
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JKUO3SES.js";
|
|
11
11
|
import "./chunk-34DECPVC.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-E4RHRBN4.js";
|
|
13
|
+
import "./chunk-QESM25BF.js";
|
|
14
14
|
import "./chunk-OEH47H6A.js";
|
|
15
15
|
import "./chunk-IJBSOWHK.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-JUV4AO7M.js";
|
|
17
17
|
import "./chunk-QPL7E2HW.js";
|
|
18
18
|
import "./chunk-PMJG2CXF.js";
|
|
19
19
|
import {
|
package/dist/harness-worker.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runOperation
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-AKZ3TZF6.js";
|
|
4
|
+
import "./chunk-6NAOPDEL.js";
|
|
5
5
|
import "./chunk-R2GPCZUX.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-JKUO3SES.js";
|
|
7
7
|
import "./chunk-34DECPVC.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-E4RHRBN4.js";
|
|
9
|
+
import "./chunk-QESM25BF.js";
|
|
10
10
|
import "./chunk-OEH47H6A.js";
|
|
11
11
|
import "./chunk-IJBSOWHK.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-JUV4AO7M.js";
|
|
13
13
|
import "./chunk-QPL7E2HW.js";
|
|
14
14
|
import "./chunk-PMJG2CXF.js";
|
|
15
15
|
import {
|
package/dist/hook-body.js
CHANGED
|
@@ -15,6 +15,7 @@ var NEUTRAL_EVENTS = [
|
|
|
15
15
|
// src/hooks/dispatch/compose.ts
|
|
16
16
|
var RANK = { allow: 0, ask: 1, deny: 2 };
|
|
17
17
|
function applyMode(id, decision, mode) {
|
|
18
|
+
if (mode === "observe") return {};
|
|
18
19
|
if (!decision.verdict || decision.verdict === "allow") return decision;
|
|
19
20
|
if (mode === "off") return {};
|
|
20
21
|
if (mode === "graded") return decision;
|
|
@@ -761,7 +762,10 @@ async function runPolicy(selected, input, deps) {
|
|
|
761
762
|
}
|
|
762
763
|
const decision = applyMode(policy.id, raw, mode);
|
|
763
764
|
log.debug("policy", {
|
|
764
|
-
|
|
765
|
+
raw: raw.verdict ?? "allow",
|
|
766
|
+
mode,
|
|
767
|
+
verdict: decision.verdict ?? "allow",
|
|
768
|
+
...input.tool ? { tool: input.tool.kind, native: input.tool.native } : {},
|
|
765
769
|
duration_ms: deps.now() - started
|
|
766
770
|
});
|
|
767
771
|
return finish(decision);
|
|
@@ -769,7 +773,7 @@ async function runPolicy(selected, input, deps) {
|
|
|
769
773
|
log.error("policy failed", {
|
|
770
774
|
error: error instanceof Error ? error.message : String(error)
|
|
771
775
|
});
|
|
772
|
-
if (policy.fail === "open") return finish({});
|
|
776
|
+
if (policy.fail === "open" || mode === "observe") return finish({});
|
|
773
777
|
if (deps.failure) {
|
|
774
778
|
const cause = error instanceof Timeout ? error.message : `error: ${(error instanceof Error ? error.message : String(error)).split("\n")[0]}`;
|
|
775
779
|
return finish(afterFailure(policy.id, cause, input, deps.failure));
|
|
@@ -2703,13 +2707,96 @@ function detect(cwd, prefs = {}) {
|
|
|
2703
2707
|
};
|
|
2704
2708
|
}
|
|
2705
2709
|
|
|
2710
|
+
// src/git/modes.ts
|
|
2711
|
+
import { join as join6 } from "node:path";
|
|
2712
|
+
function withUmask(mask, run3) {
|
|
2713
|
+
if (mask === void 0) return run3();
|
|
2714
|
+
let before2;
|
|
2715
|
+
try {
|
|
2716
|
+
before2 = process.umask(mask);
|
|
2717
|
+
} catch {
|
|
2718
|
+
return run3();
|
|
2719
|
+
}
|
|
2720
|
+
try {
|
|
2721
|
+
return run3();
|
|
2722
|
+
} finally {
|
|
2723
|
+
process.umask(before2);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
var INDEX_MODES = {
|
|
2727
|
+
"100644": 420,
|
|
2728
|
+
"100755": 493
|
|
2729
|
+
};
|
|
2730
|
+
function restoreModes(root, from, to) {
|
|
2731
|
+
const paths = from === null ? null : gitText(root, ["diff", "--name-only", "--no-renames", "-z", from, to]).split("\0").filter(Boolean);
|
|
2732
|
+
if (paths !== null && paths.length === 0) return [];
|
|
2733
|
+
const listed = gitText(root, [
|
|
2734
|
+
"ls-files",
|
|
2735
|
+
"-s",
|
|
2736
|
+
"-z",
|
|
2737
|
+
...paths === null ? [] : ["--", ...paths]
|
|
2738
|
+
]);
|
|
2739
|
+
const fixed = [];
|
|
2740
|
+
for (const entry of listed.split("\0")) {
|
|
2741
|
+
const tab = entry.indexOf(" ");
|
|
2742
|
+
if (tab < 0) continue;
|
|
2743
|
+
const want = INDEX_MODES[entry.slice(0, 6)];
|
|
2744
|
+
if (want === void 0) continue;
|
|
2745
|
+
const path = entry.slice(tab + 1);
|
|
2746
|
+
const file2 = join6(root, path);
|
|
2747
|
+
let mode;
|
|
2748
|
+
try {
|
|
2749
|
+
const stat3 = lstatSync(file2);
|
|
2750
|
+
if (!stat3.isFile()) continue;
|
|
2751
|
+
mode = stat3.mode & 511;
|
|
2752
|
+
} catch {
|
|
2753
|
+
continue;
|
|
2754
|
+
}
|
|
2755
|
+
if (mode === want) continue;
|
|
2756
|
+
chmodSync(file2, want);
|
|
2757
|
+
fixed.push(path);
|
|
2758
|
+
}
|
|
2759
|
+
return fixed;
|
|
2760
|
+
}
|
|
2761
|
+
var GITLINK = /^:(?:160000|000000) 160000 ([0-9a-f]{40}) ([0-9a-f]{40}) [AM]\t(.+)$/u;
|
|
2762
|
+
function restoreSubmoduleModes(root, from, to) {
|
|
2763
|
+
const raw = gitText(root, [
|
|
2764
|
+
"diff",
|
|
2765
|
+
"--raw",
|
|
2766
|
+
"--abbrev=40",
|
|
2767
|
+
"--no-renames",
|
|
2768
|
+
from,
|
|
2769
|
+
to
|
|
2770
|
+
]);
|
|
2771
|
+
const fixed = [];
|
|
2772
|
+
for (const line of raw.split("\n")) {
|
|
2773
|
+
const match = GITLINK.exec(line);
|
|
2774
|
+
if (!match) continue;
|
|
2775
|
+
const [, before2, after, path] = match;
|
|
2776
|
+
const dir = join6(root, path);
|
|
2777
|
+
if (gitText(dir, ["rev-parse", "HEAD"]) !== after) continue;
|
|
2778
|
+
const old = /^0+$/u.test(before2) ? null : before2;
|
|
2779
|
+
for (const file2 of restoreModes(dir, old, after))
|
|
2780
|
+
fixed.push(`${path}/${file2}`);
|
|
2781
|
+
}
|
|
2782
|
+
return fixed;
|
|
2783
|
+
}
|
|
2784
|
+
function reportModes(report2, fixed) {
|
|
2785
|
+
if (fixed.length === 0) return;
|
|
2786
|
+
const shown = fixed.slice(0, 5).join(", ");
|
|
2787
|
+
const more = fixed.length > 5 ? `, and ${fixed.length - 5} more` : "";
|
|
2788
|
+
report2.info(
|
|
2789
|
+
`gave ${fixed.length} rewritten tracked file(s) their index mode back: ${shown}${more}`
|
|
2790
|
+
);
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2706
2793
|
// src/git/install.ts
|
|
2707
|
-
import { dirname as dirname6, join as
|
|
2794
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
2708
2795
|
function lockHash(root, paths) {
|
|
2709
2796
|
const hash = createHash("sha256");
|
|
2710
2797
|
let found = false;
|
|
2711
2798
|
for (const path of paths) {
|
|
2712
|
-
const file2 =
|
|
2799
|
+
const file2 = join7(root, path);
|
|
2713
2800
|
if (!existsSync(file2)) continue;
|
|
2714
2801
|
found = true;
|
|
2715
2802
|
hash.update(`${path}\0`).update(readFileSync(file2));
|
|
@@ -2719,7 +2806,7 @@ function lockHash(root, paths) {
|
|
|
2719
2806
|
}
|
|
2720
2807
|
function installedHash(root, spec) {
|
|
2721
2808
|
if (spec.stamp?.hash !== "plain") return lockHash(root, spec.when);
|
|
2722
|
-
const file2 =
|
|
2809
|
+
const file2 = join7(root, spec.when[0] ?? "");
|
|
2723
2810
|
if (!existsSync(file2)) return null;
|
|
2724
2811
|
return createHash("sha256").update(readFileSync(file2)).digest("hex");
|
|
2725
2812
|
}
|
|
@@ -2729,7 +2816,7 @@ function stampFile(root, spec) {
|
|
|
2729
2816
|
return spec.stamp.path.replace("${git_dir}", gitDir);
|
|
2730
2817
|
}
|
|
2731
2818
|
const key = createHash("sha256").update([root, ...spec.when].join("\0")).digest("hex");
|
|
2732
|
-
return
|
|
2819
|
+
return join7(spec.stateDir, "installed", key);
|
|
2733
2820
|
}
|
|
2734
2821
|
function readStamp(path) {
|
|
2735
2822
|
if (!existsSync(path)) return null;
|
|
@@ -2777,7 +2864,7 @@ function distance(cwd, upstream) {
|
|
|
2777
2864
|
}
|
|
2778
2865
|
|
|
2779
2866
|
// src/git/submodules.ts
|
|
2780
|
-
import { join as
|
|
2867
|
+
import { join as join8 } from "node:path";
|
|
2781
2868
|
function clean(dir) {
|
|
2782
2869
|
return git(dir, ["status", "--porcelain"]).stdout.trim() === "";
|
|
2783
2870
|
}
|
|
@@ -2787,8 +2874,8 @@ function hasCommit(dir, sha) {
|
|
|
2787
2874
|
function movableSubmodules(root) {
|
|
2788
2875
|
const listed = git(root, ["submodule", "status"]).stdout;
|
|
2789
2876
|
return listed.split("\n").filter((line) => /^[ +]/u.test(line)).map((line) => line.trim().split(/\s+/u)[1] ?? "").filter((path) => {
|
|
2790
|
-
const dir =
|
|
2791
|
-
if (!path || !existsSync(
|
|
2877
|
+
const dir = join8(root, path);
|
|
2878
|
+
if (!path || !existsSync(join8(dir, ".git"))) return false;
|
|
2792
2879
|
const local = gitText(dir, [
|
|
2793
2880
|
"rev-list",
|
|
2794
2881
|
"--count",
|
|
@@ -2803,7 +2890,7 @@ function updateToPins(root, paths) {
|
|
|
2803
2890
|
const lines = [];
|
|
2804
2891
|
for (const path of paths) {
|
|
2805
2892
|
const pin = gitText(root, ["rev-parse", `HEAD:${path}`]);
|
|
2806
|
-
const dir =
|
|
2893
|
+
const dir = join8(root, path);
|
|
2807
2894
|
if (!pin || !hasCommit(dir, pin)) {
|
|
2808
2895
|
lines.push(
|
|
2809
2896
|
`${path}: left alone, ${pin.slice(0, 10) || "its pin"} is not in its checkout`
|
|
@@ -2834,6 +2921,9 @@ function heldBy(root, upstream, ahead) {
|
|
|
2834
2921
|
return null;
|
|
2835
2922
|
}
|
|
2836
2923
|
function syncWorktree(options2) {
|
|
2924
|
+
return withUmask(options2.umask, () => syncOnce(options2));
|
|
2925
|
+
}
|
|
2926
|
+
function syncOnce(options2) {
|
|
2837
2927
|
const { ctx, report: report2 } = options2;
|
|
2838
2928
|
if (!ctx.linked)
|
|
2839
2929
|
throw new Error(
|
|
@@ -2874,6 +2964,11 @@ function syncWorktree(options2) {
|
|
|
2874
2964
|
`moved ${before2.slice(0, 10)} -> ${after.slice(0, 10)}, ${counted.behind} commit(s)`
|
|
2875
2965
|
);
|
|
2876
2966
|
for (const line of updateToPins(ctx.root, submodules)) report2.info(line);
|
|
2967
|
+
if (options2.umask !== void 0)
|
|
2968
|
+
reportModes(report2, [
|
|
2969
|
+
...restoreModes(ctx.root, before2, after),
|
|
2970
|
+
...restoreSubmoduleModes(ctx.root, before2, after)
|
|
2971
|
+
]);
|
|
2877
2972
|
if (options2.install !== void 0)
|
|
2878
2973
|
installIfStale(ctx.root, options2.install, report2);
|
|
2879
2974
|
return "moved";
|
|
@@ -2906,12 +3001,15 @@ function changed(root, from, paths, to = "HEAD") {
|
|
|
2906
3001
|
if (paths.length === 0) return [];
|
|
2907
3002
|
return gitText(root, ["diff", "--name-only", from, to, "--", ...paths]).split("\n").filter(Boolean);
|
|
2908
3003
|
}
|
|
2909
|
-
function backgroundInstall(root, command6) {
|
|
2910
|
-
const child =
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
3004
|
+
function backgroundInstall(root, command6, umask) {
|
|
3005
|
+
const child = withUmask(
|
|
3006
|
+
umask,
|
|
3007
|
+
() => spawn(command6[0], command6.slice(1), {
|
|
3008
|
+
cwd: root,
|
|
3009
|
+
detached: true,
|
|
3010
|
+
stdio: "ignore"
|
|
3011
|
+
})
|
|
3012
|
+
);
|
|
2915
3013
|
child.on("error", () => void 0);
|
|
2916
3014
|
child.unref();
|
|
2917
3015
|
}
|
|
@@ -2941,13 +3039,14 @@ function move(input, ctx, git2) {
|
|
|
2941
3039
|
followSubmodules: opts.followSubmodules,
|
|
2942
3040
|
fetch,
|
|
2943
3041
|
report: report2,
|
|
2944
|
-
...install
|
|
3042
|
+
...install,
|
|
3043
|
+
...opts.umask !== void 0 ? { umask: opts.umask } : {}
|
|
2945
3044
|
});
|
|
2946
3045
|
if (result === "current") return [];
|
|
2947
3046
|
if (result === "held")
|
|
2948
3047
|
return lines.map((line) => `Desk ${git2.root}: ${line}`);
|
|
2949
3048
|
if (opts.install && opts.installAfterMove === "background" && changed(git2.root, before2, opts.installWhen).length > 0) {
|
|
2950
|
-
backgroundInstall(git2.root, opts.install);
|
|
3049
|
+
backgroundInstall(git2.root, opts.install, opts.umask);
|
|
2951
3050
|
lines.push(`installing in the background: ${opts.install.join(" ")}`);
|
|
2952
3051
|
}
|
|
2953
3052
|
const rules = changed(git2.root, before2, opts.noticePaths);
|
|
@@ -4525,18 +4624,18 @@ async function dispatch(raw, compiled, deps) {
|
|
|
4525
4624
|
}
|
|
4526
4625
|
|
|
4527
4626
|
// src/hooks/entry/fail-closed.ts
|
|
4528
|
-
import { join as
|
|
4627
|
+
import { join as join11 } from "node:path";
|
|
4529
4628
|
|
|
4530
4629
|
// src/hooks/compiled.ts
|
|
4531
|
-
import { join as
|
|
4630
|
+
import { join as join10 } from "node:path";
|
|
4532
4631
|
|
|
4533
4632
|
// src/hooks/integrity-cache.ts
|
|
4534
4633
|
import { homedir as homedir2 } from "node:os";
|
|
4535
|
-
import { dirname as dirname7, join as
|
|
4634
|
+
import { dirname as dirname7, join as join9 } from "node:path";
|
|
4536
4635
|
var LIMIT = 64;
|
|
4537
4636
|
function cacheFile() {
|
|
4538
|
-
const base = process.env["XDG_CACHE_HOME"] ||
|
|
4539
|
-
return
|
|
4637
|
+
const base = process.env["XDG_CACHE_HOME"] || join9(homedir2(), ".cache");
|
|
4638
|
+
return join9(base, "pmcp", "hook-verified.json");
|
|
4540
4639
|
}
|
|
4541
4640
|
function readCache() {
|
|
4542
4641
|
try {
|
|
@@ -4588,8 +4687,8 @@ var PolicyIntegrityError = class extends Error {
|
|
|
4588
4687
|
};
|
|
4589
4688
|
var MISMATCH = "policy.json does not match pmcp.lock; review the change and run pmcp project";
|
|
4590
4689
|
function readCompiled(root) {
|
|
4591
|
-
const policyPath =
|
|
4592
|
-
const files2 = [policyPath,
|
|
4690
|
+
const policyPath = join10(root, POLICY_FILE);
|
|
4691
|
+
const files2 = [policyPath, join10(root, LOCK_FILE)];
|
|
4593
4692
|
const before2 = stampOf(files2);
|
|
4594
4693
|
const text9 = readFileSync(policyPath, "utf8");
|
|
4595
4694
|
const lock = JSON.parse(readFileSync(files2[1], "utf8"));
|
|
@@ -4612,7 +4711,7 @@ function readCompiled(root) {
|
|
|
4612
4711
|
var FAILED_CLOSED = "pmcp hook could not evaluate this call and refused it";
|
|
4613
4712
|
function rawFailure(root) {
|
|
4614
4713
|
try {
|
|
4615
|
-
const raw = JSON.parse(readFileSync(
|
|
4714
|
+
const raw = JSON.parse(readFileSync(join11(root, POLICY_FILE), "utf8"))["failure"];
|
|
4616
4715
|
if (!raw || typeof raw.timeoutMs !== "number" || typeof raw.retry !== "number" || !Array.isArray(raw.pass) || !raw.pass.every(
|
|
4617
4716
|
(kind) => PASS_KINDS.includes(kind)
|
|
4618
4717
|
))
|
|
@@ -4647,7 +4746,7 @@ function failClosed(adapter, event, root, error, stated = false) {
|
|
|
4647
4746
|
}
|
|
4648
4747
|
|
|
4649
4748
|
// src/hooks/entry/logger.ts
|
|
4650
|
-
import { dirname as dirname8, join as
|
|
4749
|
+
import { dirname as dirname8, join as join14 } from "node:path";
|
|
4651
4750
|
|
|
4652
4751
|
// src/logging/levels.ts
|
|
4653
4752
|
var LEVEL_RANK = {
|
|
@@ -4771,11 +4870,11 @@ var silentLogger = createLogger(() => {
|
|
|
4771
4870
|
});
|
|
4772
4871
|
|
|
4773
4872
|
// src/logging/sinks/file.ts
|
|
4774
|
-
import { join as
|
|
4873
|
+
import { join as join12 } from "node:path";
|
|
4775
4874
|
var FILE = /^pmcp-(\d{8})(?:\.\d+)?\.jsonl$/u;
|
|
4776
4875
|
function dailyLogFile(dir, now = /* @__PURE__ */ new Date()) {
|
|
4777
4876
|
const day = now.toISOString().slice(0, 10).replaceAll("-", "");
|
|
4778
|
-
return
|
|
4877
|
+
return join12(dir, `pmcp-${day}.jsonl`);
|
|
4779
4878
|
}
|
|
4780
4879
|
function roll(file2) {
|
|
4781
4880
|
let index = 1;
|
|
@@ -4806,7 +4905,7 @@ function logFiles(dir) {
|
|
|
4806
4905
|
const part = (name) => Number(/\.(\d+)\.jsonl$/u.exec(name)?.[1] ?? Number.MAX_SAFE_INTEGER);
|
|
4807
4906
|
return names2.sort(
|
|
4808
4907
|
(a, b) => a.slice(5, 13).localeCompare(b.slice(5, 13)) || part(a) - part(b)
|
|
4809
|
-
).map((name) =>
|
|
4908
|
+
).map((name) => join12(dir, name));
|
|
4810
4909
|
}
|
|
4811
4910
|
function pruneLogs(dir, keepDays, now = /* @__PURE__ */ new Date()) {
|
|
4812
4911
|
const cutoff = new Date(now.getTime() - keepDays * 864e5).toISOString().slice(0, 10).replaceAll("-", "");
|
|
@@ -4822,13 +4921,13 @@ function pruneLogs(dir, keepDays, now = /* @__PURE__ */ new Date()) {
|
|
|
4822
4921
|
|
|
4823
4922
|
// src/sessions/state-dir.ts
|
|
4824
4923
|
import { homedir as homedir3 } from "node:os";
|
|
4825
|
-
import { join as
|
|
4924
|
+
import { join as join13 } from "node:path";
|
|
4826
4925
|
function projectStateDir(root, override, env = process.env) {
|
|
4827
4926
|
if (override) return expandPath(root, override);
|
|
4828
4927
|
const anchor = gitCommonDir(root) ?? realpathSync(root);
|
|
4829
4928
|
const id = createHash("sha256").update(anchor).digest("hex").slice(0, 16);
|
|
4830
|
-
const base = env["XDG_STATE_HOME"] ||
|
|
4831
|
-
return
|
|
4929
|
+
const base = env["XDG_STATE_HOME"] || join13(homedir3(), ".local", "state");
|
|
4930
|
+
return join13(base, "pmcp", "projects", id);
|
|
4832
4931
|
}
|
|
4833
4932
|
|
|
4834
4933
|
// src/hooks/entry/logger.ts
|
|
@@ -4843,7 +4942,7 @@ function hookLogger(root, compiled, runtime2, event) {
|
|
|
4843
4942
|
process.env["PMCP_LOG"]
|
|
4844
4943
|
);
|
|
4845
4944
|
const file2 = compiled?.logFile ? expandPath(root, compiled.logFile) : void 0;
|
|
4846
|
-
const dir = file2 ? dirname8(file2) :
|
|
4945
|
+
const dir = file2 ? dirname8(file2) : join14(projectStateDir(root, compiled?.stateDir), "logs");
|
|
4847
4946
|
const sink = fileSink({
|
|
4848
4947
|
dir,
|
|
4849
4948
|
...file2 ? { file: file2 } : {},
|
|
@@ -4903,7 +5002,7 @@ var gitProbe = {
|
|
|
4903
5002
|
};
|
|
4904
5003
|
|
|
4905
5004
|
// src/sessions/files/broadcast.ts
|
|
4906
|
-
import { join as
|
|
5005
|
+
import { join as join15 } from "node:path";
|
|
4907
5006
|
|
|
4908
5007
|
// src/sessions/files/json.ts
|
|
4909
5008
|
import { dirname as dirname9 } from "node:path";
|
|
@@ -4950,8 +5049,8 @@ function writeLines(path, values) {
|
|
|
4950
5049
|
|
|
4951
5050
|
// src/sessions/files/broadcast.ts
|
|
4952
5051
|
function filesBroadcast(dir, keep, registry2) {
|
|
4953
|
-
const latestPath =
|
|
4954
|
-
const historyPath =
|
|
5052
|
+
const latestPath = join15(dir, STATE_FILES.broadcast);
|
|
5053
|
+
const historyPath = join15(dir, STATE_FILES.history);
|
|
4955
5054
|
const list = () => {
|
|
4956
5055
|
const latest = asBroadcast(readJson3(latestPath));
|
|
4957
5056
|
if (!latest) return [];
|
|
@@ -4995,9 +5094,9 @@ function filesBroadcast(dir, keep, registry2) {
|
|
|
4995
5094
|
}
|
|
4996
5095
|
|
|
4997
5096
|
// src/sessions/files/leases.ts
|
|
4998
|
-
import { dirname as dirname10, join as
|
|
5097
|
+
import { dirname as dirname10, join as join16 } from "node:path";
|
|
4999
5098
|
function filesLeases(dir, files2 = {}) {
|
|
5000
|
-
const leasePath = (name) => files2[name]?.file ??
|
|
5099
|
+
const leasePath = (name) => files2[name]?.file ?? join16(dir, leaseFile(name));
|
|
5001
5100
|
const read3 = (name) => {
|
|
5002
5101
|
const lease = asLease(readJson3(leasePath(name)));
|
|
5003
5102
|
if (!lease || !alive(lease.pid)) return null;
|
|
@@ -5047,28 +5146,28 @@ function filesLeases(dir, files2 = {}) {
|
|
|
5047
5146
|
}
|
|
5048
5147
|
|
|
5049
5148
|
// src/sessions/files/mailbox.ts
|
|
5050
|
-
import { join as
|
|
5149
|
+
import { join as join17 } from "node:path";
|
|
5051
5150
|
var ID = /^\d{13}-[0-9a-f]{8}$/u;
|
|
5052
5151
|
var SAFE_KEY = /^@?[\w.-]+$/u;
|
|
5053
5152
|
function filesMailbox(dir, settings) {
|
|
5054
|
-
const messages =
|
|
5055
|
-
const inbox =
|
|
5056
|
-
const pathOf = (id) =>
|
|
5153
|
+
const messages = join17(dir, "messages");
|
|
5154
|
+
const inbox = join17(dir, "inbox");
|
|
5155
|
+
const pathOf = (id) => join17(messages, `${id}.json`);
|
|
5057
5156
|
const marker = (key, id, kind) => {
|
|
5058
5157
|
if (!SAFE_KEY.test(key) || !ID.test(id))
|
|
5059
5158
|
throw new Error(`invalid mailbox key ${key} or id ${id}`);
|
|
5060
|
-
return
|
|
5159
|
+
return join17(inbox, key, `${id}.${kind}`);
|
|
5061
5160
|
};
|
|
5062
5161
|
const audit = (event, fields2) => {
|
|
5063
5162
|
if (!settings.audit) return;
|
|
5064
5163
|
const line = { at: (/* @__PURE__ */ new Date()).toISOString(), event, ...fields2 };
|
|
5065
|
-
appendFileSync(
|
|
5164
|
+
appendFileSync(join17(dir, "messages.jsonl"), `${JSON.stringify(line)}
|
|
5066
5165
|
`, {
|
|
5067
5166
|
mode: 384
|
|
5068
5167
|
});
|
|
5069
5168
|
};
|
|
5070
5169
|
const touch = (path) => {
|
|
5071
|
-
mkdirSync(
|
|
5170
|
+
mkdirSync(join17(path, ".."), { recursive: true, mode: 448 });
|
|
5072
5171
|
try {
|
|
5073
5172
|
writeFileSync(path, "", { flag: "wx", mode: 384 });
|
|
5074
5173
|
return true;
|
|
@@ -5085,7 +5184,7 @@ function filesMailbox(dir, settings) {
|
|
|
5085
5184
|
if (existsSync(inbox))
|
|
5086
5185
|
for (const key of readdirSync(inbox))
|
|
5087
5186
|
for (const kind of ["ack", "delivered"])
|
|
5088
|
-
rmSync(
|
|
5187
|
+
rmSync(join17(inbox, key, `${message.id}.${kind}`), { force: true });
|
|
5089
5188
|
audit(event, { id: message.id });
|
|
5090
5189
|
};
|
|
5091
5190
|
return {
|
|
@@ -5161,9 +5260,9 @@ function filesMailbox(dir, settings) {
|
|
|
5161
5260
|
}
|
|
5162
5261
|
|
|
5163
5262
|
// src/sessions/files/pause.ts
|
|
5164
|
-
import { join as
|
|
5263
|
+
import { join as join18 } from "node:path";
|
|
5165
5264
|
function filesPause(dir) {
|
|
5166
|
-
const path =
|
|
5265
|
+
const path = join18(dir, STATE_FILES.pause);
|
|
5167
5266
|
return {
|
|
5168
5267
|
read: () => asPause(readJson3(path)),
|
|
5169
5268
|
write(pause2) {
|
|
@@ -5181,11 +5280,11 @@ function filesPause(dir) {
|
|
|
5181
5280
|
}
|
|
5182
5281
|
|
|
5183
5282
|
// src/sessions/files/registry.ts
|
|
5184
|
-
import { join as
|
|
5283
|
+
import { join as join19 } from "node:path";
|
|
5185
5284
|
var SESSION_ID = /^[A-Za-z0-9_-]{8,64}$/u;
|
|
5186
5285
|
function filesRegistry(dir, staleMs) {
|
|
5187
|
-
const fleetDir =
|
|
5188
|
-
const pathOf = (session) =>
|
|
5286
|
+
const fleetDir = join19(dir, STATE_FILES.records);
|
|
5287
|
+
const pathOf = (session) => join19(fleetDir, `${session}.json`);
|
|
5189
5288
|
const get = (session) => SESSION_ID.test(session) ? asRecord(readJson3(pathOf(session))) : null;
|
|
5190
5289
|
const list = (now = Date.now()) => {
|
|
5191
5290
|
let names2 = [];
|
|
@@ -5194,7 +5293,7 @@ function filesRegistry(dir, staleMs) {
|
|
|
5194
5293
|
} catch {
|
|
5195
5294
|
return [];
|
|
5196
5295
|
}
|
|
5197
|
-
return names2.map((name) => asRecord(readJson3(
|
|
5296
|
+
return names2.map((name) => asRecord(readJson3(join19(fleetDir, name)))).filter((record) => record !== null).map((record) => ({ ...record, live: isLive(record, now, staleMs) }));
|
|
5198
5297
|
};
|
|
5199
5298
|
const remove = (session) => {
|
|
5200
5299
|
if (SESSION_ID.test(session)) rmSync(pathOf(session), { force: true });
|
|
@@ -5268,15 +5367,15 @@ function createFilesStore(dir, options2 = {}) {
|
|
|
5268
5367
|
}
|
|
5269
5368
|
|
|
5270
5369
|
// src/sessions/lease-files.ts
|
|
5271
|
-
import { dirname as dirname11, isAbsolute as isAbsolute13, join as
|
|
5370
|
+
import { dirname as dirname11, isAbsolute as isAbsolute13, join as join20 } from "node:path";
|
|
5272
5371
|
var GATE_DIR = "${gate_dir}/";
|
|
5273
5372
|
function gateTree(root, stateDir, gate, env) {
|
|
5274
5373
|
const override = gate.treeEnv ? env[gate.treeEnv] : void 0;
|
|
5275
5374
|
if (override) return override;
|
|
5276
|
-
return gate.tree ? expandPath(root, gate.tree) :
|
|
5375
|
+
return gate.tree ? expandPath(root, gate.tree) : join20(stateDir, "gate", "tree");
|
|
5277
5376
|
}
|
|
5278
5377
|
function resolveLeaseFiles(files2, gateDir) {
|
|
5279
|
-
const resolve20 = (path) => path?.startsWith(GATE_DIR) ?
|
|
5378
|
+
const resolve20 = (path) => path?.startsWith(GATE_DIR) ? join20(gateDir, path.slice(GATE_DIR.length)) : path;
|
|
5280
5379
|
return Object.fromEntries(
|
|
5281
5380
|
Object.entries(files2 ?? {}).map(([name, f]) => {
|
|
5282
5381
|
const file2 = resolve20(f.file);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type RuntimeId = "claude" | "codex" | "gemini" | "antigravity" | "grok" | "opencode";
|
|
2
|
-
type Mode = "deny" | "ask" | "warn" | "off" | "graded";
|
|
2
|
+
type Mode = "deny" | "ask" | "warn" | "observe" | "off" | "graded";
|
|
3
3
|
|
|
4
4
|
declare const PASS_KINDS: readonly ["read", "edit-own-worktree"];
|
|
5
5
|
type PassKind = (typeof PASS_KINDS)[number];
|
|
@@ -10,12 +10,12 @@ import {
|
|
|
10
10
|
async function run(context) {
|
|
11
11
|
const [verb = "list", ...extra] = context.args.positional;
|
|
12
12
|
if (extra.length) throw new ArgumentError("Use hooks list or hooks test");
|
|
13
|
-
if (verb === "list") return (await import("./list-
|
|
14
|
-
if (verb === "test") return (await import("./test-
|
|
13
|
+
if (verb === "list") return (await import("./list-YXCHN33G.js")).run(context);
|
|
14
|
+
if (verb === "test") return (await import("./test-W3P5F5ML.js")).run(context);
|
|
15
15
|
throw new ArgumentError("Use hooks list or hooks test");
|
|
16
16
|
}
|
|
17
17
|
var hooksCommand = { ...hooksSpec, run };
|
|
18
18
|
export {
|
|
19
19
|
hooksCommand
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=hooks-
|
|
21
|
+
//# sourceMappingURL=hooks-ZSA4DLUZ.js.map
|