@modootoday/pmcp 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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-QJ6MGLBX.js → apply-6FLMTJDV.js} +57 -23
- package/dist/{available-HYSDAFYH.js → available-BFXLII4A.js} +7 -7
- package/dist/{broadcast-LYOA6BEW.js → broadcast-ZALGUJVR.js} +4 -4
- package/dist/chunk-2GI5RM3M.js +53 -0
- package/dist/{chunk-ICF2JZSN.js → chunk-2MAD4WNZ.js} +2 -2
- package/dist/{chunk-YDICIB2A.js → chunk-33KGCJB2.js} +2 -2
- package/dist/{chunk-FQAJSNNU.js → chunk-3X5JQYKN.js} +3 -3
- package/dist/{chunk-IQD4W53M.js → chunk-57Q75MS4.js} +18 -18
- package/dist/{chunk-EKPMVEIA.js → chunk-5FW7A6TG.js} +7 -4
- package/dist/chunk-5YCKFU5Q.js +1672 -0
- package/dist/{chunk-QYH2NR6G.js → chunk-7FV2LORT.js} +2 -2
- package/dist/{chunk-66F3HLW4.js → chunk-DEY23WTH.js} +122 -4
- package/dist/chunk-DJZPPCJP.js +274 -0
- package/dist/{chunk-MZEMLFFD.js → chunk-G6JXCUSK.js} +2 -2
- package/dist/{chunk-T6GOWHK6.js → chunk-GFOQDLPL.js} +6 -1
- package/dist/{chunk-OAIQ7A3R.js → chunk-GQP4GWU4.js} +5 -5
- package/dist/chunk-H4ZOKIER.js +7 -0
- package/dist/{chunk-RBNMNKNN.js → chunk-JQVSDPFL.js} +3 -3
- package/dist/{chunk-OG7QR2DP.js → chunk-KEHB4FZP.js} +17 -2
- package/dist/chunk-KUBHGVTD.js +126 -0
- package/dist/{chunk-IZABPDAO.js → chunk-KVNNVLJR.js} +2 -2
- package/dist/chunk-LFFIQBNY.js +115 -0
- package/dist/{chunk-PQTM27GU.js → chunk-MR5IBS6L.js} +6 -7
- package/dist/{chunk-M2RYXWX2.js → chunk-NHUMPEPV.js} +2 -2
- package/dist/{chunk-ONP6JRFZ.js → chunk-OFJIMBTL.js} +2 -2
- package/dist/{chunk-J6HNP6HA.js → chunk-OFPNCLG7.js} +2 -2
- package/dist/{chunk-FD6VGFYZ.js → chunk-OS5DF3LL.js} +207 -15
- package/dist/{chunk-L4MFGGSI.js → chunk-POTI2RJ6.js} +2 -2
- package/dist/{chunk-RMHZFWHF.js → chunk-R3MVL67T.js} +33 -33
- package/dist/{chunk-YN5GQCHN.js → chunk-RHJEGLYM.js} +6 -1
- package/dist/{chunk-4VK5G3SV.js → chunk-TBKVC2TA.js} +3 -5
- package/dist/{chunk-K2C3KFGB.js → chunk-UFWQTZDX.js} +29 -17
- package/dist/{chunk-JBHGJKSL.js → chunk-VBDDFO2V.js} +2 -2
- package/dist/{chunk-QOFSPFJ6.js → chunk-VUM6LO77.js} +3417 -3395
- package/dist/{chunk-CQZYQAAV.js → chunk-YLITJLTR.js} +3 -3
- package/dist/{chunk-O2JWF7ZM.js → chunk-Z4Q6RYJH.js} +2 -2
- package/dist/{chunk-QSIADSMQ.js → chunk-Z6WRFOFT.js} +3 -3
- package/dist/{chunk-5JPD6VIH.js → chunk-ZIJ5IUXH.js} +9 -3
- package/dist/{claude-GT2BPXEL.js → claude-XVLF4N4S.js} +3 -3
- package/dist/{cli-IV5DJCXU.js → cli-6FWRBCWM.js} +8 -8
- package/dist/{cli-6HTAJ54L.js → cli-RVPR3MH3.js} +7 -7
- package/dist/cli.js +11 -11
- package/dist/{completion-PPM7MEI2.js → completion-YTPHEVEW.js} +7 -7
- package/dist/{diagnostics-EWU2ROTG.js → diagnostics-IW54MLFK.js} +5 -6
- package/dist/{doctor-ZWZQMDKZ.js → doctor-EN4JPSKV.js} +35 -35
- package/dist/{entry-NDICBQ2F.js → entry-TQWSDTJ4.js} +14 -15
- package/dist/{exec-mcp-AG4G7SG7.js → exec-mcp-KKQ75N5O.js} +15 -13
- package/dist/{harness-JABSZCAA.js → harness-EB76F6BG.js} +6 -6
- package/dist/harness-launch-gate.js +3 -4
- package/dist/harness-worker.js +5 -6
- package/dist/hook-body.js +247 -86
- package/dist/{hook-spec-C7umArqw.d.ts → hook-spec-hZL4MSgi.d.ts} +8 -3
- package/dist/hooks-YWSHUNLM.js +24 -0
- package/dist/{host-2SZRMHZX.js → host-LSVITS6M.js} +6 -7
- package/dist/{host-BWZ5LA4Q.js → host-OGGADMBT.js} +17 -15
- package/dist/{host-run-SXLV4LHI.js → host-run-XO2TS4JC.js} +5 -7
- package/dist/http.js +1 -1
- package/dist/{import-mcp-2M7SZRVQ.js → import-mcp-BJDJTPVS.js} +14 -11
- package/dist/index.d.ts +11 -2
- package/dist/index.js +24 -24
- package/dist/{init-HOOIFBAD.js → init-773PTQM5.js} +3 -3
- package/dist/{install-HF6CROQP.js → install-7V6NIA7W.js} +4 -4
- package/dist/{invoke-JP4MILYY.js → invoke-Y7XH5S2L.js} +7 -8
- package/dist/{list-UBSBUZKS.js → list-5W65XVES.js} +20 -17
- package/dist/{logout-OO3DERRK.js → logout-XO6ALD45.js} +15 -12
- package/dist/{logs-K3QXKRD4.js → logs-74JGLQG6.js} +4 -4
- package/dist/{mailbox-DAJV6VAI.js → mailbox-VK5AVTHI.js} +7 -7
- package/dist/{mainline-6K5BA3WX.js → mainline-M2NSTAGC.js} +70 -24
- package/dist/{mcp-JXNTKRJG.js → mcp-R62ZNVGJ.js} +2 -2
- package/dist/{pause-GRVTSKOK.js → pause-CZ2OZYLC.js} +4 -4
- package/dist/project/hook-adapter.d.ts +1 -1
- package/dist/{project-M672MKQH.js → project-W5DQIZA6.js} +5 -5
- package/dist/{pty-LHKJKY2E.js → pty-CDLQ4NP2.js} +3 -3
- package/dist/report-Z3JV2PCT.js +105 -0
- package/dist/{resume-6DMPGG3N.js → resume-DFIHT2RO.js} +4 -4
- package/dist/{run-5W566T3V.js → run-OZLGSRHF.js} +14 -11
- package/dist/{run-ORBIERI3.js → run-WYJMTLX7.js} +4 -4
- package/dist/{serve-73SRPAV4.js → serve-DCQGAGB7.js} +3 -3
- package/dist/{session-XM2CR425.js → session-YZVX4NGN.js} +4 -4
- package/dist/{setup-ULKDPF5B.js → setup-D3KEJBGO.js} +4 -4
- package/dist/smoke-FQQJOQBD.js +16 -0
- package/dist/{start-login-BGFAMCZL.js → start-login-EKXM75XQ.js} +15 -12
- package/dist/{status-YCW6YJ3S.js → status-23UDIYYP.js} +39 -22
- package/dist/{status-YHXEAJ7U.js → status-3RTGDN2K.js} +10 -10
- package/dist/{status-73FEFQUQ.js → status-EDSEG32U.js} +15 -12
- package/dist/stdio.js +2 -2
- package/dist/{sweep-XF2HG3EO.js → sweep-EPJMEZR6.js} +4 -4
- package/dist/{test-IMNBXOYW.js → test-TM6PIZTV.js} +30 -20
- package/dist/{tui-5GDA22TB.js → tui-EQNJIDN5.js} +4 -4
- package/dist/{unbroadcast-XP3OCVN3.js → unbroadcast-NTOC3PY3.js} +4 -4
- package/dist/{worker-RV6NGSXT.js → worker-7X6WBPEI.js} +9 -10
- package/dist/{worktree-list-4PLE7K6L.js → worktree-list-EMKUMCTQ.js} +2 -2
- package/dist/{worktree-sync-GQVYAXGJ.js → worktree-sync-T6C5YEYS.js} +3 -3
- package/docs/commands.md +13 -6
- package/docs/git-workflow.md +28 -9
- package/docs/hooks.md +138 -10
- package/docs/project-configuration.md +27 -1
- package/docs/upgrading.md +42 -0
- 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/mod/sessions/format.ts +2 -2
- package/plugins/pmcp/plugin.json +1 -1
- package/dist/chunk-7SDOSTW7.js +0 -130
- package/dist/chunk-AWZF72SH.js +0 -1025
- package/dist/chunk-FGYFA6JY.js +0 -7
- package/dist/chunk-ISNRDHSD.js +0 -74
- package/dist/chunk-QDY6BWE6.js +0 -396
- package/dist/hooks-YVQSDQV3.js +0 -21
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HOST_MANIFEST,
|
|
3
3
|
HOST_POLICY
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DEY23WTH.js";
|
|
5
5
|
import {
|
|
6
6
|
projectStateDir
|
|
7
7
|
} from "./chunk-OEH47H6A.js";
|
|
@@ -99,4 +99,4 @@ export {
|
|
|
99
99
|
hostApprovalDoctor,
|
|
100
100
|
writeApproval
|
|
101
101
|
};
|
|
102
|
-
//# sourceMappingURL=chunk-
|
|
102
|
+
//# sourceMappingURL=chunk-KVNNVLJR.js.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// src/hooks/inspection/report.ts
|
|
2
|
+
function readReportTable(value) {
|
|
3
|
+
if (value === void 0) return { excludeSessions: [] };
|
|
4
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
5
|
+
throw new Error("[hooks.report] must be a table");
|
|
6
|
+
const table = value;
|
|
7
|
+
const unknown = Object.keys(table).find((key) => key !== "exclude_sessions");
|
|
8
|
+
if (unknown) throw new Error(`unknown [hooks.report] key ${unknown}`);
|
|
9
|
+
const list = table["exclude_sessions"] ?? [];
|
|
10
|
+
if (!Array.isArray(list) || !list.every((item) => typeof item === "string"))
|
|
11
|
+
throw new Error(
|
|
12
|
+
"[hooks.report] exclude_sessions must be a list of regexes"
|
|
13
|
+
);
|
|
14
|
+
return {
|
|
15
|
+
excludeSessions: list.map((source) => {
|
|
16
|
+
try {
|
|
17
|
+
return new RegExp(source, "u");
|
|
18
|
+
} catch {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`[hooks.report] exclude_sessions has an invalid regex ${source}`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function guardLines(lines, settings) {
|
|
27
|
+
const kept = [];
|
|
28
|
+
let excluded = 0;
|
|
29
|
+
for (const line of lines) {
|
|
30
|
+
if (line.component !== "hooks.entry" || line["msg"] !== "policy") continue;
|
|
31
|
+
const data = line["data"] ?? {};
|
|
32
|
+
if (typeof line["policy"] !== "string" || typeof data["raw"] !== "string")
|
|
33
|
+
continue;
|
|
34
|
+
const session = String(line["session"] ?? "");
|
|
35
|
+
if (settings.excludeSessions.some((pattern) => pattern.test(session))) {
|
|
36
|
+
excluded += 1;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
kept.push({
|
|
40
|
+
ts: String(line.ts ?? ""),
|
|
41
|
+
policy: line["policy"],
|
|
42
|
+
runtime: String(line["runtime"] ?? ""),
|
|
43
|
+
session,
|
|
44
|
+
mode: String(data["mode"] ?? ""),
|
|
45
|
+
raw: data["raw"],
|
|
46
|
+
verdict: String(line["verdict"] ?? "allow"),
|
|
47
|
+
...typeof data["tool"] === "string" ? { tool: data["tool"] } : {},
|
|
48
|
+
durationMs: Number(line["duration_ms"] ?? 0)
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return { kept, excluded };
|
|
52
|
+
}
|
|
53
|
+
function percentile(sorted, share) {
|
|
54
|
+
if (sorted.length === 0) return 0;
|
|
55
|
+
const index = Math.min(
|
|
56
|
+
sorted.length - 1,
|
|
57
|
+
Math.max(0, Math.ceil(share * sorted.length) - 1)
|
|
58
|
+
);
|
|
59
|
+
return sorted[index];
|
|
60
|
+
}
|
|
61
|
+
var count = (into, key) => {
|
|
62
|
+
into[key] = (into[key] ?? 0) + 1;
|
|
63
|
+
};
|
|
64
|
+
function report(lines, excluded) {
|
|
65
|
+
const groups = /* @__PURE__ */ new Map();
|
|
66
|
+
for (const line of lines) {
|
|
67
|
+
const key = `${line.policy}\0${line.runtime}`;
|
|
68
|
+
groups.set(key, [...groups.get(key) ?? [], line]);
|
|
69
|
+
}
|
|
70
|
+
const guards = [...groups.values()].map((group) => {
|
|
71
|
+
const raw = {};
|
|
72
|
+
const verdict = {};
|
|
73
|
+
for (const line of group) {
|
|
74
|
+
count(raw, line.raw);
|
|
75
|
+
count(verdict, line.verdict);
|
|
76
|
+
}
|
|
77
|
+
const durations = group.map((line) => line.durationMs).sort((a, b) => a - b);
|
|
78
|
+
return {
|
|
79
|
+
policy: group[0].policy,
|
|
80
|
+
runtime: group[0].runtime,
|
|
81
|
+
calls: group.length,
|
|
82
|
+
raw,
|
|
83
|
+
verdict,
|
|
84
|
+
modes: [...new Set(group.map((line) => line.mode))].sort(),
|
|
85
|
+
sessions: new Set(group.map((line) => line.session)).size,
|
|
86
|
+
durationMs: {
|
|
87
|
+
p50: percentile(durations, 0.5),
|
|
88
|
+
p95: percentile(durations, 0.95),
|
|
89
|
+
max: durations.at(-1) ?? 0
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
guards.sort(
|
|
94
|
+
(a, b) => a.policy.localeCompare(b.policy) || a.runtime.localeCompare(b.runtime)
|
|
95
|
+
);
|
|
96
|
+
return {
|
|
97
|
+
lines: lines.length,
|
|
98
|
+
sessions: new Set(lines.map((line) => line.session)).size,
|
|
99
|
+
excluded,
|
|
100
|
+
guards
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function wouldRefuse(lines, policy) {
|
|
104
|
+
return lines.filter(
|
|
105
|
+
(line) => line.policy === policy && line.raw !== "allow" && line.verdict !== "deny" && line.verdict !== line.raw
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export {
|
|
110
|
+
readReportTable,
|
|
111
|
+
guardLines,
|
|
112
|
+
report,
|
|
113
|
+
wouldRefuse
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=chunk-LFFIQBNY.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
isLive,
|
|
10
10
|
latestRecord,
|
|
11
11
|
leaseFile
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Z6WRFOFT.js";
|
|
13
13
|
import {
|
|
14
14
|
expandPath,
|
|
15
15
|
projectStateDir
|
|
@@ -414,10 +414,9 @@ import { readdirSync as readdirSync2, rmSync as rmSync5 } from "fs";
|
|
|
414
414
|
import { join as join5 } from "path";
|
|
415
415
|
var SESSION_ID = /^[A-Za-z0-9_-]{8,64}$/u;
|
|
416
416
|
function filesRegistry(dir, staleMs) {
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
);
|
|
420
|
-
const pathsOf = (session) => dirs.map((records) => join5(records, `${session}.json`));
|
|
417
|
+
const records = join5(dir, STATE_FILES.records);
|
|
418
|
+
const dirs = [records, join5(dir, STATE_FILES.legacyRecords)];
|
|
419
|
+
const pathsOf = (session) => dirs.map((records2) => join5(records2, `${session}.json`));
|
|
421
420
|
const get = (session) => {
|
|
422
421
|
if (!SESSION_ID.test(session)) return null;
|
|
423
422
|
return latestRecord(
|
|
@@ -463,7 +462,7 @@ function filesRegistry(dir, staleMs) {
|
|
|
463
462
|
next["worktree"] = checkout?.root ?? "";
|
|
464
463
|
next["branch"] = checkout?.branch ?? "";
|
|
465
464
|
}
|
|
466
|
-
|
|
465
|
+
writeJson(join5(records, `${session}.json`), next);
|
|
467
466
|
return next;
|
|
468
467
|
},
|
|
469
468
|
sweep(now = Date.now()) {
|
|
@@ -698,4 +697,4 @@ export {
|
|
|
698
697
|
readStoreSettings,
|
|
699
698
|
openStore
|
|
700
699
|
};
|
|
701
|
-
//# sourceMappingURL=chunk-
|
|
700
|
+
//# sourceMappingURL=chunk-MR5IBS6L.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
alive
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Z6WRFOFT.js";
|
|
4
4
|
|
|
5
5
|
// src/sessions/wake/claude-socket.ts
|
|
6
6
|
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
@@ -27,4 +27,4 @@ function claudeSocket(session, home) {
|
|
|
27
27
|
export {
|
|
28
28
|
claudeSocket
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-NHUMPEPV.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ancestors
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Z6WRFOFT.js";
|
|
4
4
|
|
|
5
5
|
// src/sessions/wake/pty-ref.ts
|
|
6
6
|
import { existsSync } from "fs";
|
|
@@ -29,4 +29,4 @@ export {
|
|
|
29
29
|
ptyRef,
|
|
30
30
|
ptyReachable
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-OFJIMBTL.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-RPCIROW7.js";
|
|
4
4
|
import {
|
|
5
5
|
readSpec
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VUM6LO77.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-OFPNCLG7.js.map
|
|
@@ -2,17 +2,16 @@ import {
|
|
|
2
2
|
backupFiles
|
|
3
3
|
} from "./chunk-P4N7DBD5.js";
|
|
4
4
|
import {
|
|
5
|
-
BUNDLE_NATIVE_FILES,
|
|
6
|
-
HOOK_DIRECTORY,
|
|
7
5
|
checkProject,
|
|
6
|
+
guardVersionProblems,
|
|
8
7
|
prepare,
|
|
9
8
|
present,
|
|
10
9
|
writeNative
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
ANTIGRAVITY_MCP_PLUGIN
|
|
14
|
-
} from "./chunk-QDY6BWE6.js";
|
|
10
|
+
} from "./chunk-DJZPPCJP.js";
|
|
15
11
|
import {
|
|
12
|
+
ANTIGRAVITY_MCP_PLUGIN,
|
|
13
|
+
BUNDLE_NATIVE_FILES,
|
|
14
|
+
HOOK_DIRECTORY as HOOK_DIRECTORY2,
|
|
16
15
|
changedSincePlan,
|
|
17
16
|
exists,
|
|
18
17
|
getKey,
|
|
@@ -22,17 +21,20 @@ import {
|
|
|
22
21
|
same,
|
|
23
22
|
splitKeyed,
|
|
24
23
|
withoutBlock
|
|
25
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-VUM6LO77.js";
|
|
26
25
|
import {
|
|
27
26
|
RULES_DIR,
|
|
28
27
|
legacyLinks
|
|
29
28
|
} from "./chunk-NRBQK6UX.js";
|
|
29
|
+
import {
|
|
30
|
+
HOOK_DIRECTORY
|
|
31
|
+
} from "./chunk-5YCKFU5Q.js";
|
|
30
32
|
import {
|
|
31
33
|
LOCK_FILE,
|
|
32
34
|
replaceFile,
|
|
33
35
|
replaceLink,
|
|
34
36
|
writeLock
|
|
35
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-DEY23WTH.js";
|
|
36
38
|
|
|
37
39
|
// src/project/apply/files.ts
|
|
38
40
|
import { mkdirSync } from "fs";
|
|
@@ -162,13 +164,13 @@ function backupBeforeWrite(spec, outputs, stale) {
|
|
|
162
164
|
".agents/hooks.json"
|
|
163
165
|
]),
|
|
164
166
|
...outputs.filter(
|
|
165
|
-
(output) => output.kind === "file" && output.path.startsWith(`${
|
|
167
|
+
(output) => output.kind === "file" && output.path.startsWith(`${HOOK_DIRECTORY2}/`)
|
|
166
168
|
).map((output) => output.path),
|
|
167
|
-
...stale.filter((entry) => entry.path.startsWith(`${
|
|
169
|
+
...stale.filter((entry) => entry.path.startsWith(`${HOOK_DIRECTORY2}/`)).map((entry) => entry.path)
|
|
168
170
|
];
|
|
169
171
|
const changedHooks = outputs.some(
|
|
170
|
-
(output) => (output.kind === "json" && output.managed !== void 0 || output.kind === "file" && output.path.startsWith(`${
|
|
171
|
-
) || stale.some((entry) => entry.path.startsWith(`${
|
|
172
|
+
(output) => (output.kind === "json" && output.managed !== void 0 || output.kind === "file" && output.path.startsWith(`${HOOK_DIRECTORY2}/`)) && !present(spec.root, output)
|
|
173
|
+
) || stale.some((entry) => entry.path.startsWith(`${HOOK_DIRECTORY2}/`));
|
|
172
174
|
if (!changedMcp && !staleMcp && !changedHooks) return void 0;
|
|
173
175
|
return backupFiles(spec.root, [
|
|
174
176
|
...MCP_PATHS,
|
|
@@ -187,7 +189,8 @@ function project(spec, options) {
|
|
|
187
189
|
}
|
|
188
190
|
const conflicts = [
|
|
189
191
|
...permissionConflicts(spec),
|
|
190
|
-
...changedSincePlan(spec.root, basis)
|
|
192
|
+
...changedSincePlan(spec.root, basis),
|
|
193
|
+
...guardVersionProblems(spec)
|
|
191
194
|
];
|
|
192
195
|
if (conflicts.length > 0) {
|
|
193
196
|
return { code: 3, problems: conflicts, outputs: outputs.length, pruned: 0 };
|
|
@@ -205,7 +208,196 @@ function project(spec, options) {
|
|
|
205
208
|
};
|
|
206
209
|
}
|
|
207
210
|
|
|
211
|
+
// src/project/unmanaged-hooks.ts
|
|
212
|
+
import { spawnSync } from "child_process";
|
|
213
|
+
import {
|
|
214
|
+
accessSync,
|
|
215
|
+
constants,
|
|
216
|
+
existsSync as existsSync3,
|
|
217
|
+
readFileSync as readFileSync2,
|
|
218
|
+
statSync
|
|
219
|
+
} from "fs";
|
|
220
|
+
import { dirname as dirname2, isAbsolute, join as join4, relative, resolve } from "path";
|
|
221
|
+
var SETTINGS = [
|
|
222
|
+
".claude/settings.json",
|
|
223
|
+
".claude/settings.local.json",
|
|
224
|
+
".codex/hooks.json"
|
|
225
|
+
];
|
|
226
|
+
var INTERPRETERS = /* @__PURE__ */ new Set([
|
|
227
|
+
"node",
|
|
228
|
+
"bun",
|
|
229
|
+
"deno",
|
|
230
|
+
"tsx",
|
|
231
|
+
"python",
|
|
232
|
+
"python3",
|
|
233
|
+
"bash",
|
|
234
|
+
"sh",
|
|
235
|
+
"zsh",
|
|
236
|
+
"dash",
|
|
237
|
+
"ruby",
|
|
238
|
+
"perl"
|
|
239
|
+
]);
|
|
240
|
+
function commands(value) {
|
|
241
|
+
const hooks = value?.["hooks"];
|
|
242
|
+
if (!hooks || typeof hooks !== "object" || Array.isArray(hooks)) return [];
|
|
243
|
+
const found = [];
|
|
244
|
+
for (const [event, groups] of Object.entries(hooks)) {
|
|
245
|
+
if (!Array.isArray(groups)) continue;
|
|
246
|
+
for (const group of groups) {
|
|
247
|
+
const entries = group?.["hooks"];
|
|
248
|
+
if (!Array.isArray(entries)) continue;
|
|
249
|
+
for (const entry of entries) {
|
|
250
|
+
const command = entry?.["command"];
|
|
251
|
+
if (typeof command === "string") found.push({ event, command });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return found;
|
|
256
|
+
}
|
|
257
|
+
function firstWords(command) {
|
|
258
|
+
const words = [];
|
|
259
|
+
let word = "";
|
|
260
|
+
let quote = null;
|
|
261
|
+
let started = false;
|
|
262
|
+
for (const char of command) {
|
|
263
|
+
if (quote) {
|
|
264
|
+
if (char === quote) quote = null;
|
|
265
|
+
else word += char;
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (char === "'" || char === '"') {
|
|
269
|
+
quote = char;
|
|
270
|
+
started = true;
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
if (/\s/u.test(char)) {
|
|
274
|
+
if (started) words.push(word);
|
|
275
|
+
word = "";
|
|
276
|
+
started = false;
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
if (";|&<>()".includes(char)) break;
|
|
280
|
+
word += char;
|
|
281
|
+
started = true;
|
|
282
|
+
}
|
|
283
|
+
if (started) words.push(word);
|
|
284
|
+
return words;
|
|
285
|
+
}
|
|
286
|
+
function expand(word, vars) {
|
|
287
|
+
let unknown = null;
|
|
288
|
+
const path = word.replace(/^~(?=\/|$)/u, vars["HOME"] ?? "~").replace(/\$\{(\w+)\}|\$(\w+)/gu, (_, braced, bare) => {
|
|
289
|
+
const name = braced ?? bare;
|
|
290
|
+
const value = vars[name];
|
|
291
|
+
if (value === void 0) unknown ??= name;
|
|
292
|
+
return value ?? "";
|
|
293
|
+
});
|
|
294
|
+
if (unknown === "CLAUDE_PLUGIN_ROOT")
|
|
295
|
+
return { problem: "${CLAUDE_PLUGIN_ROOT} outside a plugin" };
|
|
296
|
+
if (unknown !== null) return { skip: true };
|
|
297
|
+
return { path };
|
|
298
|
+
}
|
|
299
|
+
function scriptProblem(path, direct) {
|
|
300
|
+
if (!existsSync3(path)) return "the script does not exist";
|
|
301
|
+
if (!statSync(path).isFile()) return "the script is not a file";
|
|
302
|
+
if (!direct) return null;
|
|
303
|
+
try {
|
|
304
|
+
accessSync(path, constants.X_OK);
|
|
305
|
+
} catch {
|
|
306
|
+
return "the script is not executable";
|
|
307
|
+
}
|
|
308
|
+
const head = readFileSync2(path).subarray(0, 2).toString("latin1");
|
|
309
|
+
if (head !== "#!") return "the script has no shebang";
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
function commandProblem(command, cwd, vars) {
|
|
313
|
+
const words = firstWords(command).filter(
|
|
314
|
+
(word, index, all) => !(/^\w+=/u.test(word) && all.slice(0, index).every((w) => /^\w+=/u.test(w)))
|
|
315
|
+
);
|
|
316
|
+
const program = words[0];
|
|
317
|
+
if (program === void 0) return "the command is empty";
|
|
318
|
+
const base = program.slice(program.lastIndexOf("/") + 1);
|
|
319
|
+
let target = program;
|
|
320
|
+
let direct = true;
|
|
321
|
+
if (INTERPRETERS.has(base)) {
|
|
322
|
+
const script = words.slice(1).find((word) => !word.startsWith("-"));
|
|
323
|
+
if (script === void 0 || words.slice(1).some((w) => /^-[ec]$/u.test(w)))
|
|
324
|
+
return null;
|
|
325
|
+
target = script;
|
|
326
|
+
direct = false;
|
|
327
|
+
}
|
|
328
|
+
if (!target.includes("/") && !target.includes("$")) return null;
|
|
329
|
+
const expanded = expand(target, vars);
|
|
330
|
+
if ("skip" in expanded) return null;
|
|
331
|
+
if ("problem" in expanded) return expanded.problem;
|
|
332
|
+
const path = isAbsolute(expanded.path) ? expanded.path : resolve(cwd, expanded.path);
|
|
333
|
+
return scriptProblem(path, direct);
|
|
334
|
+
}
|
|
335
|
+
function readHooksFile(path) {
|
|
336
|
+
try {
|
|
337
|
+
return JSON.parse(readFileSync2(path, "utf8"));
|
|
338
|
+
} catch {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function pluginHookFiles(root) {
|
|
343
|
+
const listed = spawnSync(
|
|
344
|
+
"git",
|
|
345
|
+
["ls-files", "-z", "--", ":(glob)**/.claude-plugin/plugin.json"],
|
|
346
|
+
{ cwd: root, encoding: "utf8" }
|
|
347
|
+
);
|
|
348
|
+
if (listed.status !== 0) return [];
|
|
349
|
+
const found = [];
|
|
350
|
+
for (const manifest of listed.stdout.split("\0").filter(Boolean)) {
|
|
351
|
+
const plugin = dirname2(dirname2(join4(root, manifest)));
|
|
352
|
+
const declared = readHooksFile(join4(root, manifest))?.["hooks"];
|
|
353
|
+
const file = resolve(
|
|
354
|
+
plugin,
|
|
355
|
+
typeof declared === "string" ? declared : "hooks/hooks.json"
|
|
356
|
+
);
|
|
357
|
+
if (existsSync3(file)) found.push({ file, plugin });
|
|
358
|
+
}
|
|
359
|
+
return found;
|
|
360
|
+
}
|
|
361
|
+
function unmanagedHookProblems(root, env = process.env) {
|
|
362
|
+
return unmanagedHooks(root, env).problems;
|
|
363
|
+
}
|
|
364
|
+
function unmanagedHooks(root, env = process.env) {
|
|
365
|
+
let checked = 0;
|
|
366
|
+
const sources = [
|
|
367
|
+
...SETTINGS.map((file) => ({ file: join4(root, file), plugin: void 0 })),
|
|
368
|
+
...pluginHookFiles(root)
|
|
369
|
+
];
|
|
370
|
+
const problems = [];
|
|
371
|
+
for (const source of sources) {
|
|
372
|
+
if (!existsSync3(source.file)) continue;
|
|
373
|
+
const vars = {
|
|
374
|
+
...env,
|
|
375
|
+
CLAUDE_PROJECT_DIR: root,
|
|
376
|
+
CLAUDE_PLUGIN_ROOT: source.plugin
|
|
377
|
+
};
|
|
378
|
+
for (const { event, command } of commands(readHooksFile(source.file))) {
|
|
379
|
+
if (command.includes(`${HOOK_DIRECTORY}/`)) continue;
|
|
380
|
+
checked += 1;
|
|
381
|
+
const problem = commandProblem(command, root, vars);
|
|
382
|
+
if (problem)
|
|
383
|
+
problems.push({
|
|
384
|
+
file: relative(root, source.file),
|
|
385
|
+
event,
|
|
386
|
+
command,
|
|
387
|
+
problem
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return { checked, problems };
|
|
392
|
+
}
|
|
393
|
+
function describeHookProblem(problem) {
|
|
394
|
+
return `${problem.file} ${problem.event}: ${problem.command}: ${problem.problem}`;
|
|
395
|
+
}
|
|
396
|
+
|
|
208
397
|
export {
|
|
209
|
-
project
|
|
398
|
+
project,
|
|
399
|
+
unmanagedHookProblems,
|
|
400
|
+
unmanagedHooks,
|
|
401
|
+
describeHookProblem
|
|
210
402
|
};
|
|
211
|
-
//# sourceMappingURL=chunk-
|
|
403
|
+
//# sourceMappingURL=chunk-OS5DF3LL.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-34DECPVC.js";
|
|
7
7
|
import {
|
|
8
8
|
ptyBinary
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DEY23WTH.js";
|
|
10
10
|
|
|
11
11
|
// src/harness/adapters/systemd/admission.ts
|
|
12
12
|
var nativeHostTools = ["systemctl", "systemd-run"];
|
|
@@ -36,4 +36,4 @@ export {
|
|
|
36
36
|
nativeHostTools,
|
|
37
37
|
assertNativeHost
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-POTI2RJ6.js.map
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
marketplaceSpec
|
|
3
3
|
} from "./chunk-2P4Z2NUX.js";
|
|
4
|
+
import {
|
|
5
|
+
mailboxSpec
|
|
6
|
+
} from "./chunk-JWRZDYB5.js";
|
|
4
7
|
import {
|
|
5
8
|
harnessSpec,
|
|
6
9
|
tuiSpec
|
|
7
10
|
} from "./chunk-3Y3HDMHA.js";
|
|
11
|
+
import {
|
|
12
|
+
gitSpec
|
|
13
|
+
} from "./chunk-GFOQDLPL.js";
|
|
8
14
|
import {
|
|
9
15
|
mcpSpec
|
|
10
16
|
} from "./chunk-E3DQB5LS.js";
|
|
11
|
-
import {
|
|
12
|
-
mailboxSpec
|
|
13
|
-
} from "./chunk-JWRZDYB5.js";
|
|
14
17
|
import {
|
|
15
18
|
sessionsSpec
|
|
16
19
|
} from "./chunk-LMUBBIE2.js";
|
|
@@ -18,12 +21,15 @@ import {
|
|
|
18
21
|
logsSpec
|
|
19
22
|
} from "./chunk-YGOWIJPE.js";
|
|
20
23
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
availableSpec,
|
|
25
|
+
installSpec,
|
|
26
|
+
previewSpec,
|
|
27
|
+
syncSpec
|
|
28
|
+
} from "./chunk-ABTJQ4QV.js";
|
|
23
29
|
import {
|
|
24
30
|
doctorSpec,
|
|
25
31
|
projectSpec
|
|
26
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-RHJEGLYM.js";
|
|
27
33
|
import {
|
|
28
34
|
serveSpec
|
|
29
35
|
} from "./chunk-LLT5FQBE.js";
|
|
@@ -38,17 +44,11 @@ import {
|
|
|
38
44
|
logoutSpec,
|
|
39
45
|
whoamiSpec
|
|
40
46
|
} from "./chunk-EIDIVIAD.js";
|
|
41
|
-
import {
|
|
42
|
-
availableSpec,
|
|
43
|
-
installSpec,
|
|
44
|
-
previewSpec,
|
|
45
|
-
syncSpec
|
|
46
|
-
} from "./chunk-ABTJQ4QV.js";
|
|
47
47
|
import {
|
|
48
48
|
hooksSpec,
|
|
49
49
|
initSpec,
|
|
50
50
|
statusSpec
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-KEHB4FZP.js";
|
|
52
52
|
|
|
53
53
|
// src/commands/specs/completion.ts
|
|
54
54
|
var completionSpec = {
|
|
@@ -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-23UDIYYP.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-773PTQM5.js")).initCommand },
|
|
67
|
+
{ ...hooksSpec, load: async () => (await import("./hooks-YWSHUNLM.js")).hooksCommand },
|
|
68
|
+
{ ...serveSpec, load: async () => (await import("./serve-DCQGAGB7.js")).serveCommand },
|
|
69
69
|
{ ...listSpec, load: async () => (await import("./list-WK2IYUK7.js")).listCommand },
|
|
70
70
|
{
|
|
71
71
|
...indexSpec,
|
|
@@ -77,19 +77,19 @@ var COMMANDS = [
|
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
...loginSpec,
|
|
80
|
-
load: async () => (await import("./session-
|
|
80
|
+
load: async () => (await import("./session-YZVX4NGN.js")).loginCommand
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
...logoutSpec,
|
|
84
|
-
load: async () => (await import("./session-
|
|
84
|
+
load: async () => (await import("./session-YZVX4NGN.js")).logoutCommand
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
...whoamiSpec,
|
|
88
|
-
load: async () => (await import("./session-
|
|
88
|
+
load: async () => (await import("./session-YZVX4NGN.js")).whoamiCommand
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
...availableSpec,
|
|
92
|
-
load: async () => (await import("./available-
|
|
92
|
+
load: async () => (await import("./available-BFXLII4A.js")).availableCommand
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
...previewSpec,
|
|
@@ -97,24 +97,24 @@ var COMMANDS = [
|
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
...installSpec,
|
|
100
|
-
load: async () => (await import("./install-
|
|
100
|
+
load: async () => (await import("./install-7V6NIA7W.js")).installCommand
|
|
101
101
|
},
|
|
102
|
-
{ ...syncSpec, load: async () => (await import("./install-
|
|
102
|
+
{ ...syncSpec, load: async () => (await import("./install-7V6NIA7W.js")).syncCommand },
|
|
103
103
|
{
|
|
104
104
|
...projectSpec,
|
|
105
|
-
load: async () => (await import("./project-
|
|
105
|
+
load: async () => (await import("./project-W5DQIZA6.js")).projectCommand
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
...doctorSpec,
|
|
109
|
-
load: async () => (await import("./doctor-
|
|
109
|
+
load: async () => (await import("./doctor-EN4JPSKV.js")).doctorCommand
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
...sessionsSpec,
|
|
113
|
-
load: async () => (await import("./cli-
|
|
113
|
+
load: async () => (await import("./cli-6FWRBCWM.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-74JGLQG6.js")).logsCommand },
|
|
116
|
+
{ ...gitSpec, load: async () => (await import("./cli-RVPR3MH3.js")).gitCommand },
|
|
117
|
+
{ ...mcpSpec, load: async () => (await import("./mcp-R62ZNVGJ.js")).mcpCommand },
|
|
118
118
|
{
|
|
119
119
|
...validateSpec,
|
|
120
120
|
load: async () => (await import("./validate-KFBCUFI4.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-EB76F6BG.js")).harnessCommand
|
|
129
129
|
},
|
|
130
|
-
{ ...tuiSpec, load: async () => (await import("./tui-
|
|
130
|
+
{ ...tuiSpec, load: async () => (await import("./tui-EQNJIDN5.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-YTPHEVEW.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-R3MVL67T.js.map
|
|
@@ -36,6 +36,11 @@ var projectSpec = {
|
|
|
36
36
|
name: "check",
|
|
37
37
|
describe: "Write nothing; exit 2 when an output drifted, went stale or is undeclared.",
|
|
38
38
|
boolean: true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "smoke",
|
|
42
|
+
describe: "With --check, also run the [hooks.test] fixtures through the projected hooks.",
|
|
43
|
+
boolean: true
|
|
39
44
|
}
|
|
40
45
|
]
|
|
41
46
|
};
|
|
@@ -64,4 +69,4 @@ export {
|
|
|
64
69
|
projectSpec,
|
|
65
70
|
doctorSpec
|
|
66
71
|
};
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
72
|
+
//# sourceMappingURL=chunk-RHJEGLYM.js.map
|