@pushary/agent-hooks 1.9.7 → 1.9.9
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/CHANGELOG.md +18 -0
- package/README.md +3 -3
- package/data/cursor-plugin/README.md +3 -7
- package/data/vscode-plugin/README.md +1 -1
- package/dist/bin/pushary-bell-hook.js +22 -24
- package/dist/bin/pushary-bell.js +13 -13
- package/dist/bin/pushary-claude.js +28 -30
- package/dist/bin/pushary-clean.js +113 -94
- package/dist/bin/pushary-codex-bridge.js +20 -20
- package/dist/bin/pushary-codex-hook.js +36 -38
- package/dist/bin/pushary-codex.js +13 -13
- package/dist/bin/pushary-connect.js +48 -22
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +50 -40
- package/dist/bin/pushary-disconnect.js +188 -56
- package/dist/bin/pushary-doctor.js +105 -85
- package/dist/bin/pushary-elicitation-hook.js +25 -27
- package/dist/bin/pushary-gemini-bridge.js +13 -13
- package/dist/bin/pushary-gemini-hook.js +31 -33
- package/dist/bin/pushary-hook.js +36 -39
- package/dist/bin/pushary-login.js +12 -12
- package/dist/bin/pushary-logout.js +105 -42
- package/dist/bin/pushary-mcp.js +9 -9
- package/dist/bin/pushary-mode.js +28 -31
- package/dist/bin/pushary-notification-hook.js +29 -32
- package/dist/bin/pushary-opencode-hook.js +30 -32
- package/dist/bin/pushary-permission-denied-hook.js +30 -33
- package/dist/bin/pushary-permission-hook.js +33 -36
- package/dist/bin/pushary-post-hook.js +30 -33
- package/dist/bin/pushary-prompt-hook.js +29 -32
- package/dist/bin/pushary-session-end-hook.js +29 -32
- package/dist/bin/pushary-session-start-hook.js +33 -36
- package/dist/bin/pushary-setup.js +168 -160
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +65 -19
- package/dist/bin/pushary-stop-hook.js +29 -32
- package/dist/bin/pushary-stopfailure-hook.js +29 -32
- package/dist/bin/pushary-suggestions.js +19 -21
- package/dist/bin/pushary-transcript-register.js +18 -20
- package/dist/bin/pushary-transcripts.js +7 -7
- package/dist/bin/pushary-upgrade.js +50 -26
- package/dist/bin/pushary-wait.js +23 -19
- package/dist/bin/pushary.js +15 -14
- package/dist/{chunk-4FK6RZVJ.js → chunk-462EQA6K.js} +1 -1
- package/dist/{chunk-STQRUH3S.js → chunk-5DCDQ5VW.js} +59 -15
- package/dist/{chunk-JXISQ7DT.js → chunk-5N5L6DNN.js} +3 -3
- package/dist/{chunk-QR6VE5ME.js → chunk-5RGA636G.js} +79 -17
- package/dist/{chunk-L76HTPU6.js → chunk-6AYSKVLL.js} +3 -3
- package/dist/{chunk-NIBFSARF.js → chunk-6EBGOHDJ.js} +33 -13
- package/dist/{chunk-QQ4HBXZC.js → chunk-6W5M3MSE.js} +84 -673
- package/dist/{chunk-R3YW55MY.js → chunk-AI7RMFVV.js} +29 -26
- package/dist/{chunk-AUUXS44H.js → chunk-APP43AW7.js} +1 -1
- package/dist/{chunk-RQGODFQN.js → chunk-AZOKPWVI.js} +1 -1
- package/dist/{chunk-3GNUXXDZ.js → chunk-B5NMSP3V.js} +2 -2
- package/dist/{chunk-4D2AYNSE.js → chunk-BNSKVIAW.js} +2 -2
- package/dist/chunk-BYLKCZ2G.js +367 -0
- package/dist/{chunk-X5NXPCIC.js → chunk-BZLHTMT6.js} +89 -7
- package/dist/{chunk-BTQGAXZ3.js → chunk-COQ64C4F.js} +10 -10
- package/dist/{chunk-N4EUSDKX.js → chunk-DCCSULXK.js} +14 -14
- package/dist/{chunk-JWKBDSPF.js → chunk-DP3WX7FW.js} +2 -2
- package/dist/chunk-E5HOHIUV.js +52 -0
- package/dist/{chunk-GU3EJCVV.js → chunk-EA5NWDK7.js} +4 -0
- package/dist/chunk-EIAEUG7G.js +46 -0
- package/dist/{chunk-EB4XGVBG.js → chunk-EUW7JL2K.js} +0 -32
- package/dist/{chunk-T7Y5EADL.js → chunk-F7R3SZ4Q.js} +2 -2
- package/dist/{chunk-H37L7TT3.js → chunk-G7RIDXAT.js} +2 -2
- package/dist/{chunk-W2KI5KPD.js → chunk-H5T27W7M.js} +2 -2
- package/dist/chunk-HBWYMRR5.js +94 -0
- package/dist/{chunk-CBQACHKY.js → chunk-IIVZZMSO.js} +1 -1
- package/dist/{chunk-Z6HPS67T.js → chunk-IRHABAQT.js} +1 -1
- package/dist/{chunk-QTO6HEZD.js → chunk-K545B734.js} +2 -2
- package/dist/{chunk-KYO45G5L.js → chunk-KOWFRUIT.js} +1 -1
- package/dist/{chunk-QFEM7R6T.js → chunk-KQFTBQ66.js} +11 -11
- package/dist/chunk-LENBKYRB.js +50 -0
- package/dist/{chunk-JCWZ23MJ.js → chunk-M3STIAGU.js} +3 -3
- package/dist/{chunk-6DJTDHBI.js → chunk-MD4SVNT6.js} +1 -1
- package/dist/{chunk-7264S5HZ.js → chunk-MLGIVVSG.js} +1 -1
- package/dist/{chunk-H7MMU64M.js → chunk-NGKUXZID.js} +2 -2
- package/dist/{chunk-JWQZSYCK.js → chunk-NUVGDBZC.js} +1 -1
- package/dist/{chunk-AQ55ZSSS.js → chunk-OAYWO5NP.js} +1 -1
- package/dist/chunk-Q6C6ILUS.js +49 -0
- package/dist/{chunk-MBK7N46B.js → chunk-QIOIO7VN.js} +6 -6
- package/dist/{chunk-KFKL3FHS.js → chunk-QRXPWW3M.js} +4 -3
- package/dist/{chunk-7OIWWZAD.js → chunk-QTIUJZRX.js} +3 -3
- package/dist/{chunk-XWAYAO3V.js → chunk-R5RIVOPL.js} +2 -2
- package/dist/{chunk-ADSQDYYG.js → chunk-REU2VQPH.js} +54 -5
- package/dist/{chunk-GKI6LFAV.js → chunk-RQ32ADJP.js} +2 -2
- package/dist/{chunk-VXRXFU6Q.js → chunk-SZ4Q6ZVS.js} +14 -7
- package/dist/{chunk-KT5E2RLS.js → chunk-T6ZN4TEF.js} +1 -1
- package/dist/{chunk-UFVGSEWH.js → chunk-TO3PS646.js} +2 -2
- package/dist/chunk-UAP5DS6P.js +599 -0
- package/dist/{chunk-MZPXVH4A.js → chunk-UF6RBP5V.js} +204 -28
- package/dist/{chunk-AVNKVF7N.js → chunk-UPIZSCYD.js} +4 -4
- package/dist/{chunk-3PVDOCFI.js → chunk-VHPFNLRS.js} +5 -5
- package/dist/{chunk-HPRZJKRO.js → chunk-VIIHC42X.js} +1 -1
- package/dist/{chunk-D6S5EKXA.js → chunk-WRPYCIV2.js} +8 -12
- package/dist/{chunk-ZUTU43FT.js → chunk-Z23ZBYDW.js} +6 -4
- package/dist/{chunk-SBLPHUEB.js → chunk-ZGADIZDS.js} +8 -6
- package/dist/{global-upgrade-E2HUEB4B.js → global-upgrade-H272QOGD.js} +6 -6
- package/dist/{paths-QVTEGNZV.js → paths-HMVOTFUN.js} +2 -2
- package/dist/reapply-Q5NHDTVU.js +55 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +19 -20
- package/dist/{upgrade-lock-JCIDZMHF.js → upgrade-lock-L3GHFIRW.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-4YO4T5FV.js +0 -149
- package/dist/chunk-ANEAA37E.js +0 -197
- package/dist/chunk-MNWRUGMH.js +0 -86
- package/dist/chunk-RQSOEB4S.js +0 -44
- package/dist/chunk-SD3272LS.js +0 -143
- package/dist/reapply-5QVKM6LA.js +0 -38
package/dist/src/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handlePreToolUse
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-3GNUXXDZ.js";
|
|
7
|
-
import "../chunk-CBQACHKY.js";
|
|
3
|
+
} from "../chunk-AI7RMFVV.js";
|
|
4
|
+
import "../chunk-B5NMSP3V.js";
|
|
5
|
+
import "../chunk-IIVZZMSO.js";
|
|
8
6
|
import "../chunk-5OP5MQI7.js";
|
|
9
|
-
import "../chunk-JCWZ23MJ.js";
|
|
10
7
|
import {
|
|
11
8
|
fetchAccountPublicKey
|
|
12
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-462EQA6K.js";
|
|
10
|
+
import "../chunk-UF6RBP5V.js";
|
|
11
|
+
import "../chunk-M3STIAGU.js";
|
|
13
12
|
import "../chunk-6ICPEJY5.js";
|
|
14
13
|
import {
|
|
15
14
|
fetchModeOverride,
|
|
@@ -19,33 +18,33 @@ import {
|
|
|
19
18
|
handlePostToolUse,
|
|
20
19
|
handleStop,
|
|
21
20
|
reportEvent
|
|
22
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-KQFTBQ66.js";
|
|
23
22
|
import "../chunk-N6IOSZOE.js";
|
|
24
|
-
import "../chunk-
|
|
23
|
+
import "../chunk-MD4SVNT6.js";
|
|
25
24
|
import {
|
|
26
25
|
askUser,
|
|
27
26
|
cancelQuestion,
|
|
28
27
|
waitForAnswer
|
|
29
|
-
} from "../chunk-
|
|
30
|
-
import "../chunk-
|
|
28
|
+
} from "../chunk-WRPYCIV2.js";
|
|
29
|
+
import "../chunk-6AYSKVLL.js";
|
|
30
|
+
import "../chunk-QRXPWW3M.js";
|
|
31
|
+
import "../chunk-UPIZSCYD.js";
|
|
31
32
|
import "../chunk-POFBE6ZY.js";
|
|
32
|
-
import "../chunk-
|
|
33
|
-
import "../chunk-
|
|
34
|
-
import "../chunk-JXISQ7DT.js";
|
|
35
|
-
import "../chunk-KYO45G5L.js";
|
|
33
|
+
import "../chunk-5N5L6DNN.js";
|
|
34
|
+
import "../chunk-KOWFRUIT.js";
|
|
36
35
|
import "../chunk-7QLSKOSU.js";
|
|
37
36
|
import "../chunk-KZERVKTD.js";
|
|
38
|
-
import "../chunk-
|
|
39
|
-
import "../chunk-
|
|
37
|
+
import "../chunk-BNSKVIAW.js";
|
|
38
|
+
import "../chunk-Z23ZBYDW.js";
|
|
40
39
|
import "../chunk-T7E75EKA.js";
|
|
41
40
|
import {
|
|
42
41
|
getApiKey,
|
|
43
42
|
getBaseUrl
|
|
44
|
-
} from "../chunk-
|
|
45
|
-
import "../chunk-
|
|
43
|
+
} from "../chunk-IRHABAQT.js";
|
|
44
|
+
import "../chunk-5DCDQ5VW.js";
|
|
46
45
|
import {
|
|
47
46
|
resolvePolicy
|
|
48
|
-
} from "../chunk-
|
|
47
|
+
} from "../chunk-5RGA636G.js";
|
|
49
48
|
export {
|
|
50
49
|
askUser,
|
|
51
50
|
cancelQuestion,
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
installWithUpgradeLock,
|
|
6
6
|
ownsUpgradeLock,
|
|
7
7
|
releaseAutoUpdateLock
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-AZOKPWVI.js";
|
|
9
|
+
import "./chunk-Z23ZBYDW.js";
|
|
10
10
|
import "./chunk-T7E75EKA.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-5RGA636G.js";
|
|
12
12
|
export {
|
|
13
13
|
claimUpgradeLock,
|
|
14
14
|
finishWithUpgradeLock,
|
package/package.json
CHANGED
package/dist/chunk-4YO4T5FV.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CLAUDE_HOOK_EVENTS,
|
|
3
|
-
GEMINI_HOOK_EVENTS,
|
|
4
|
-
hasGeminiHooks
|
|
5
|
-
} from "./chunk-JCWZ23MJ.js";
|
|
6
|
-
import {
|
|
7
|
-
CODEX_HOOK_EVENTS,
|
|
8
|
-
hasCodexHooks,
|
|
9
|
-
holdBudgetOf
|
|
10
|
-
} from "./chunk-ZUTU43FT.js";
|
|
11
|
-
import {
|
|
12
|
-
CURSOR_GATE_EVENTS,
|
|
13
|
-
HOOK_LOCATOR_BINARY,
|
|
14
|
-
hookCommandHoldBudget
|
|
15
|
-
} from "./chunk-QR6VE5ME.js";
|
|
16
|
-
|
|
17
|
-
// src/diagnostics/wiring.ts
|
|
18
|
-
var record = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
19
|
-
var CLAUDE_HOOK_BINARY = /pushary-[a-z-]*hook/;
|
|
20
|
-
var EXACT_HOOK_BINARY = /^pushary-[a-z-]*(hook|gate)$/;
|
|
21
|
-
var pusharyHookExecutable = (command) => {
|
|
22
|
-
const tokens = command.match(/"[^"]*"|'[^']*'|\S+/g) ?? [];
|
|
23
|
-
for (const raw of tokens.reverse()) {
|
|
24
|
-
const token = raw[0] === '"' && raw.at(-1) === '"' || raw[0] === "'" && raw.at(-1) === "'" ? raw.slice(1, -1) : raw;
|
|
25
|
-
const name = token.split(/[/\\]/).pop()?.replace(/\.(cmd|exe|mjs)$/i, "") ?? "";
|
|
26
|
-
if (name === HOOK_LOCATOR_BINARY || EXACT_HOOK_BINARY.test(name)) return token;
|
|
27
|
-
}
|
|
28
|
-
return null;
|
|
29
|
-
};
|
|
30
|
-
var claudeWired = ({ claudeJson, settings, skillExists }) => {
|
|
31
|
-
if (record(record(claudeJson)?.mcpServers)?.pushary) return true;
|
|
32
|
-
const s = record(settings);
|
|
33
|
-
if (s) {
|
|
34
|
-
const hooks = JSON.stringify(s.hooks ?? {});
|
|
35
|
-
if (CLAUDE_HOOK_BINARY.test(hooks) || hooks.includes(HOOK_LOCATOR_BINARY)) return true;
|
|
36
|
-
const allow = record(s.permissions)?.allow;
|
|
37
|
-
if (Array.isArray(allow) && allow.some((rule) => String(rule).includes("mcp__pushary__"))) return true;
|
|
38
|
-
}
|
|
39
|
-
return skillExists;
|
|
40
|
-
};
|
|
41
|
-
var codexWired = ({ config, hooks, skillExists }) => {
|
|
42
|
-
if (record(record(config)?.mcp_servers)?.pushary) return true;
|
|
43
|
-
const h = record(hooks);
|
|
44
|
-
if (h && hasCodexHooks(h)) return true;
|
|
45
|
-
return skillExists;
|
|
46
|
-
};
|
|
47
|
-
var geminiWired = ({ settings }) => {
|
|
48
|
-
const s = record(settings);
|
|
49
|
-
if (!s) return false;
|
|
50
|
-
if (record(s.mcpServers)?.pushary) return true;
|
|
51
|
-
return hasGeminiHooks(s);
|
|
52
|
-
};
|
|
53
|
-
var cursorWired = ({ userHooks, mcp, pluginDirExists }) => {
|
|
54
|
-
if (pluginDirExists) return true;
|
|
55
|
-
if (record(record(mcp)?.mcpServers)?.pushary) return true;
|
|
56
|
-
const hooks = record(record(userHooks)?.hooks);
|
|
57
|
-
if (!hooks) return false;
|
|
58
|
-
return Object.values(hooks).some((entries) => Array.isArray(entries) && entries.some((entry) => pusharyHookExecutable(String(record(entry)?.command ?? "")) !== null));
|
|
59
|
-
};
|
|
60
|
-
var cursorMcpAuthorization = (pluginMcp, userMcp) => {
|
|
61
|
-
const pluginServers = record(record(pluginMcp)?.mcpServers);
|
|
62
|
-
const usePlugin = pluginServers !== null && Object.hasOwn(pluginServers, "pushary");
|
|
63
|
-
const servers = usePlugin ? pluginServers : record(record(userMcp)?.mcpServers);
|
|
64
|
-
const headers = record(record(servers?.pushary)?.headers);
|
|
65
|
-
return {
|
|
66
|
-
authorization: typeof headers?.Authorization === "string" ? headers.Authorization : null,
|
|
67
|
-
source: usePlugin ? "plugin mcp.json" : "~/.cursor/mcp.json"
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
var LONG_HOLD_SECONDS = 600;
|
|
71
|
-
var toSeconds = (timeout, unit) => {
|
|
72
|
-
if (typeof timeout !== "number" || !Number.isFinite(timeout)) return null;
|
|
73
|
-
return unit === "milliseconds" ? timeout / 1e3 : timeout;
|
|
74
|
-
};
|
|
75
|
-
var registeredHooks = (entries, shape, unit) => {
|
|
76
|
-
if (!Array.isArray(entries)) return [];
|
|
77
|
-
return entries.flatMap((entry) => {
|
|
78
|
-
const container = record(entry);
|
|
79
|
-
if (!container) return [];
|
|
80
|
-
const hooks = shape === "nested" ? Array.isArray(container.hooks) ? container.hooks : [] : [container];
|
|
81
|
-
return hooks.flatMap((hook) => {
|
|
82
|
-
const command = record(hook)?.command;
|
|
83
|
-
if (typeof command !== "string" || command.trim() === "") return [];
|
|
84
|
-
return [{ command, timeoutSeconds: toSeconds(record(hook)?.timeout, unit) }];
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
var holdersOnEvent = (event, hooks) => {
|
|
89
|
-
if (!hooks.some((hook) => pusharyHookExecutable(hook.command) !== null)) return [];
|
|
90
|
-
return hooks.filter((hook) => pusharyHookExecutable(hook.command) === null).map((hook) => ({ event, command: hook.command, timeoutSeconds: hook.timeoutSeconds }));
|
|
91
|
-
};
|
|
92
|
-
var otherHolders = (hooks, events, shape, unit) => {
|
|
93
|
-
const table = record(hooks);
|
|
94
|
-
if (!table) return [];
|
|
95
|
-
return events.flatMap((event) => holdersOnEvent(event, registeredHooks(table[event], shape, unit)));
|
|
96
|
-
};
|
|
97
|
-
var approvalEvents = (table) => table.filter((hook) => hook.delivery === "approval").map((hook) => hook.event);
|
|
98
|
-
var CLAUDE_GATE_EVENTS = approvalEvents(CLAUDE_HOOK_EVENTS);
|
|
99
|
-
var CODEX_GATE_EVENTS = approvalEvents(CODEX_HOOK_EVENTS);
|
|
100
|
-
var GEMINI_GATE_EVENTS = approvalEvents(GEMINI_HOOK_EVENTS);
|
|
101
|
-
var claudeOtherHolders = (settings) => otherHolders(record(settings)?.hooks, CLAUDE_GATE_EVENTS, "nested", "seconds");
|
|
102
|
-
var codexOtherHolders = (hooks) => otherHolders(record(hooks)?.hooks, CODEX_GATE_EVENTS, "nested", "seconds");
|
|
103
|
-
var geminiOtherHolders = (settings) => otherHolders(record(settings)?.hooks, GEMINI_GATE_EVENTS, "nested", "milliseconds");
|
|
104
|
-
var cursorOtherHolders = (userHooks) => otherHolders(record(userHooks)?.hooks, CURSOR_GATE_EVENTS, "flat", "seconds");
|
|
105
|
-
var holdEvents = (table) => table.flatMap((hook) => {
|
|
106
|
-
const seconds = holdBudgetOf(hook);
|
|
107
|
-
return seconds === void 0 ? [] : [{ event: hook.event, seconds }];
|
|
108
|
-
});
|
|
109
|
-
var unprovenHolds = (hooks, events) => {
|
|
110
|
-
const table = record(hooks);
|
|
111
|
-
if (!table) return [];
|
|
112
|
-
return events.filter(({ event, seconds }) => registeredHooks(table[event], "nested", "seconds").some((hook) => pusharyHookExecutable(hook.command) !== null && hookCommandHoldBudget(hook.command) !== seconds)).map(({ event }) => event);
|
|
113
|
-
};
|
|
114
|
-
var claudeUnprovenHolds = (settings) => unprovenHolds(record(settings)?.hooks, holdEvents(CLAUDE_HOOK_EVENTS));
|
|
115
|
-
var codexUnprovenHolds = (hooks) => unprovenHolds(record(hooks)?.hooks, holdEvents(CODEX_HOOK_EVENTS));
|
|
116
|
-
var holdsLong = (holder) => holder.timeoutSeconds !== null && holder.timeoutSeconds > LONG_HOLD_SECONDS;
|
|
117
|
-
var SHELLS = /* @__PURE__ */ new Set(["/bin/sh", "/bin/bash", "/bin/zsh", "/usr/bin/env"]);
|
|
118
|
-
var holderExecutable = (command) => {
|
|
119
|
-
const pathLike = command.match(/[^\s"']*[/\\][^\s"']*/g) ?? [];
|
|
120
|
-
const target = pathLike.find((token) => !SHELLS.has(token));
|
|
121
|
-
return target ?? command.trim().split(/\s+/)[0] ?? command;
|
|
122
|
-
};
|
|
123
|
-
var describeHoldTimeout = (holder) => {
|
|
124
|
-
const seconds = holder.timeoutSeconds;
|
|
125
|
-
if (seconds === null) return "no timeout set, so the agent default applies";
|
|
126
|
-
if (seconds >= 3600 && seconds % 3600 === 0) return `${seconds / 3600}h timeout`;
|
|
127
|
-
if (seconds >= 60 && seconds % 60 === 0) return `${seconds / 60}m timeout`;
|
|
128
|
-
return `${seconds}s timeout`;
|
|
129
|
-
};
|
|
130
|
-
var describeOtherHolder = (holder) => `another hook also registered on ${holder.event}: ${holderExecutable(holder.command)} (${describeHoldTimeout(holder)})`;
|
|
131
|
-
var describeHoldSentence = (agentLabel) => `${agentLabel} waits for every hook on an event, so the terminal cannot move until that one returns, however fast your phone answered.`;
|
|
132
|
-
|
|
133
|
-
export {
|
|
134
|
-
pusharyHookExecutable,
|
|
135
|
-
claudeWired,
|
|
136
|
-
codexWired,
|
|
137
|
-
geminiWired,
|
|
138
|
-
cursorWired,
|
|
139
|
-
cursorMcpAuthorization,
|
|
140
|
-
claudeOtherHolders,
|
|
141
|
-
codexOtherHolders,
|
|
142
|
-
geminiOtherHolders,
|
|
143
|
-
cursorOtherHolders,
|
|
144
|
-
claudeUnprovenHolds,
|
|
145
|
-
codexUnprovenHolds,
|
|
146
|
-
holdsLong,
|
|
147
|
-
describeOtherHolder,
|
|
148
|
-
describeHoldSentence
|
|
149
|
-
};
|
package/dist/chunk-ANEAA37E.js
DELETED
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CLAUDE_HOOK_EVENTS,
|
|
3
|
-
supportedClaudeEvents
|
|
4
|
-
} from "./chunk-JCWZ23MJ.js";
|
|
5
|
-
import {
|
|
6
|
-
guardBinary,
|
|
7
|
-
holdBudgetOf,
|
|
8
|
-
isProtectedByScope,
|
|
9
|
-
registerHookEntry
|
|
10
|
-
} from "./chunk-ZUTU43FT.js";
|
|
11
|
-
import {
|
|
12
|
-
HOOK_LOCATOR_BINARY,
|
|
13
|
-
withHookHoldBudget
|
|
14
|
-
} from "./chunk-QR6VE5ME.js";
|
|
15
|
-
|
|
16
|
-
// src/claude-config.ts
|
|
17
|
-
import { join } from "path";
|
|
18
|
-
import { isDeepStrictEqual } from "util";
|
|
19
|
-
var PUSHARY_MCP_URL = "https://pushary.com/api/mcp/mcp";
|
|
20
|
-
var PUSHARY_PERMISSION_RULE = "mcp__pushary__*";
|
|
21
|
-
var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
22
|
-
var ensureRecord = (target, key) => {
|
|
23
|
-
const existing = asRecord(target[key]);
|
|
24
|
-
if (existing) return existing;
|
|
25
|
-
const created = {};
|
|
26
|
-
target[key] = created;
|
|
27
|
-
return created;
|
|
28
|
-
};
|
|
29
|
-
var isPusharyPermission = (rule) => typeof rule === "string" && (rule.includes("pushary") || rule.includes("MCP(pushary"));
|
|
30
|
-
var HOOK_BINARIES = /* @__PURE__ */ new Set([
|
|
31
|
-
...CLAUDE_HOOK_EVENTS.map((hook) => hook.binary),
|
|
32
|
-
HOOK_LOCATOR_BINARY
|
|
33
|
-
]);
|
|
34
|
-
var namesPusharyBinary = (command) => command.split(/[\s/\\"']+/).some((segment) => HOOK_BINARIES.has(segment.replace(/\.(cmd|exe)$/i, "")));
|
|
35
|
-
var isPusharyHook = (entry2, scope) => {
|
|
36
|
-
const hooks = asRecord(entry2)?.hooks;
|
|
37
|
-
if (!Array.isArray(hooks)) return false;
|
|
38
|
-
return hooks.some((hook) => {
|
|
39
|
-
const command = String(asRecord(hook)?.command ?? "");
|
|
40
|
-
if (isProtectedByScope(command, scope)) return false;
|
|
41
|
-
return namesPusharyBinary(command);
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var pusharyMcpServer = (apiKey) => ({
|
|
45
|
-
type: "http",
|
|
46
|
-
url: PUSHARY_MCP_URL,
|
|
47
|
-
headers: { Authorization: `Bearer ${apiKey}` }
|
|
48
|
-
});
|
|
49
|
-
var addClaudeMcpServer = (config, apiKey) => {
|
|
50
|
-
const mcpServers = ensureRecord(config, "mcpServers");
|
|
51
|
-
mcpServers.pushary = pusharyMcpServer(apiKey);
|
|
52
|
-
};
|
|
53
|
-
var isClaudeMcpSnapshot = (value) => {
|
|
54
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
55
|
-
const snapshot = value;
|
|
56
|
-
return typeof snapshot.hadMcpServers === "boolean" && typeof snapshot.mcpServersWasRecord === "boolean" && (!snapshot.hadMcpServers || snapshot.mcpServersWasRecord || Object.hasOwn(snapshot, "mcpServers")) && typeof snapshot.hadPushary === "boolean" && (!snapshot.hadPushary || Object.hasOwn(snapshot, "pushary")) && (!Object.hasOwn(snapshot, "installedPushary") || asRecord(snapshot.installedPushary)?.type === "http" && asRecord(snapshot.installedPushary)?.url === PUSHARY_MCP_URL);
|
|
57
|
-
};
|
|
58
|
-
var captureClaudeMcpServer = (config, apiKey) => {
|
|
59
|
-
const mcpServers = asRecord(config.mcpServers);
|
|
60
|
-
const hadMcpServers = Object.hasOwn(config, "mcpServers");
|
|
61
|
-
return {
|
|
62
|
-
hadMcpServers,
|
|
63
|
-
mcpServersWasRecord: Boolean(mcpServers),
|
|
64
|
-
...hadMcpServers && !mcpServers ? { mcpServers: structuredClone(config.mcpServers) } : {},
|
|
65
|
-
hadPushary: Boolean(mcpServers && Object.hasOwn(mcpServers, "pushary")),
|
|
66
|
-
...mcpServers && Object.hasOwn(mcpServers, "pushary") ? { pushary: structuredClone(mcpServers.pushary) } : {},
|
|
67
|
-
...apiKey ? { installedPushary: pusharyMcpServer(apiKey) } : {}
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
var updateClaudeMcpSnapshot = (snapshot, apiKey) => ({
|
|
71
|
-
...snapshot,
|
|
72
|
-
installedPushary: pusharyMcpServer(apiKey)
|
|
73
|
-
});
|
|
74
|
-
var restoreClaudeMcpServer = (config, snapshot) => {
|
|
75
|
-
const mcpServers = asRecord(config.mcpServers);
|
|
76
|
-
const current = asRecord(mcpServers?.pushary);
|
|
77
|
-
if (Object.hasOwn(snapshot, "installedPushary")) {
|
|
78
|
-
if (!isDeepStrictEqual(mcpServers?.pushary, snapshot.installedPushary)) return false;
|
|
79
|
-
} else if (current?.type !== "http" || current.url !== PUSHARY_MCP_URL) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
if (!snapshot.mcpServersWasRecord) {
|
|
83
|
-
if (Object.keys(mcpServers).length === 1) {
|
|
84
|
-
if (snapshot.hadMcpServers) config.mcpServers = structuredClone(snapshot.mcpServers);
|
|
85
|
-
else delete config.mcpServers;
|
|
86
|
-
} else {
|
|
87
|
-
delete mcpServers.pushary;
|
|
88
|
-
}
|
|
89
|
-
} else if (snapshot.hadPushary) {
|
|
90
|
-
mcpServers.pushary = structuredClone(snapshot.pushary);
|
|
91
|
-
} else {
|
|
92
|
-
delete mcpServers.pushary;
|
|
93
|
-
if (!snapshot.hadMcpServers && Object.keys(mcpServers).length === 0) delete config.mcpServers;
|
|
94
|
-
}
|
|
95
|
-
return true;
|
|
96
|
-
};
|
|
97
|
-
var removeClaudeMcpServers = (config) => {
|
|
98
|
-
let changed = false;
|
|
99
|
-
const removeFrom = (target) => {
|
|
100
|
-
const mcpServers = asRecord(target.mcpServers);
|
|
101
|
-
if (!mcpServers?.pushary) return;
|
|
102
|
-
delete mcpServers.pushary;
|
|
103
|
-
if (Object.keys(mcpServers).length === 0) delete target.mcpServers;
|
|
104
|
-
changed = true;
|
|
105
|
-
};
|
|
106
|
-
removeFrom(config);
|
|
107
|
-
const projects = asRecord(config.projects);
|
|
108
|
-
if (projects) {
|
|
109
|
-
for (const project of Object.values(projects)) {
|
|
110
|
-
const projectConfig = asRecord(project);
|
|
111
|
-
if (projectConfig) removeFrom(projectConfig);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return changed;
|
|
115
|
-
};
|
|
116
|
-
var removePusharyToolPermissions = (settings) => {
|
|
117
|
-
const permissions = asRecord(settings.permissions);
|
|
118
|
-
if (!permissions || !Array.isArray(permissions.allow)) return false;
|
|
119
|
-
const filtered = permissions.allow.filter((rule) => !isPusharyPermission(rule));
|
|
120
|
-
if (filtered.length === permissions.allow.length) return false;
|
|
121
|
-
if (filtered.length === 0) delete permissions.allow;
|
|
122
|
-
else permissions.allow = filtered;
|
|
123
|
-
if (Object.keys(permissions).length === 0) delete settings.permissions;
|
|
124
|
-
return true;
|
|
125
|
-
};
|
|
126
|
-
var addPusharyToolPermissions = (settings) => {
|
|
127
|
-
const permissions = ensureRecord(settings, "permissions");
|
|
128
|
-
const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
|
|
129
|
-
const filtered = allow.filter((rule) => !isPusharyPermission(rule));
|
|
130
|
-
if (!filtered.includes(PUSHARY_PERMISSION_RULE)) {
|
|
131
|
-
filtered.push(PUSHARY_PERMISSION_RULE);
|
|
132
|
-
}
|
|
133
|
-
permissions.allow = filtered;
|
|
134
|
-
};
|
|
135
|
-
var addPusharyHooks = (settings, binDir, version = null) => {
|
|
136
|
-
const resolve = (name) => guardBinary(binDir ? join(binDir, name) : name);
|
|
137
|
-
const hooks = ensureRecord(settings, "hooks");
|
|
138
|
-
const supported = new Map(supportedClaudeEvents(version).map((hook) => [hook.event, hook]));
|
|
139
|
-
for (const known of CLAUDE_HOOK_EVENTS) {
|
|
140
|
-
const current = Array.isArray(hooks[known.event]) ? hooks[known.event] : [];
|
|
141
|
-
const definition = supported.get(known.event);
|
|
142
|
-
if (definition) {
|
|
143
|
-
hooks[known.event] = registerHookEntry(current, isPusharyHook, entry(definition, resolve));
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
const others = current.filter((item) => !isPusharyHook(item));
|
|
147
|
-
if (others.length > 0) {
|
|
148
|
-
hooks[known.event] = others;
|
|
149
|
-
} else {
|
|
150
|
-
delete hooks[known.event];
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
var entry = (definition, resolve) => ({
|
|
155
|
-
...definition.matcher ? { matcher: definition.matcher } : {},
|
|
156
|
-
hooks: [{
|
|
157
|
-
type: "command",
|
|
158
|
-
command: withHookHoldBudget(resolve(definition.binary), holdBudgetOf(definition)),
|
|
159
|
-
timeout: definition.timeout
|
|
160
|
-
}]
|
|
161
|
-
});
|
|
162
|
-
var removePusharySettings = (settings, scope) => {
|
|
163
|
-
let changed = scope?.keepMcpServer === true ? false : removeClaudeMcpServers(settings);
|
|
164
|
-
if (scope?.keepMcpServer !== true && removePusharyToolPermissions(settings)) changed = true;
|
|
165
|
-
const hooks = asRecord(settings.hooks);
|
|
166
|
-
if (hooks) {
|
|
167
|
-
for (const { event: key } of CLAUDE_HOOK_EVENTS) {
|
|
168
|
-
const entries = hooks[key];
|
|
169
|
-
if (!Array.isArray(entries)) continue;
|
|
170
|
-
const filtered = entries.filter((entry2) => !isPusharyHook(entry2, scope));
|
|
171
|
-
if (filtered.length !== entries.length) {
|
|
172
|
-
if (filtered.length === 0) {
|
|
173
|
-
delete hooks[key];
|
|
174
|
-
} else {
|
|
175
|
-
hooks[key] = filtered;
|
|
176
|
-
}
|
|
177
|
-
changed = true;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (Object.keys(hooks).length === 0) delete settings.hooks;
|
|
181
|
-
}
|
|
182
|
-
return changed;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
export {
|
|
186
|
-
isPusharyHook,
|
|
187
|
-
addClaudeMcpServer,
|
|
188
|
-
isClaudeMcpSnapshot,
|
|
189
|
-
captureClaudeMcpServer,
|
|
190
|
-
updateClaudeMcpSnapshot,
|
|
191
|
-
restoreClaudeMcpServer,
|
|
192
|
-
removeClaudeMcpServers,
|
|
193
|
-
removePusharyToolPermissions,
|
|
194
|
-
addPusharyToolPermissions,
|
|
195
|
-
addPusharyHooks,
|
|
196
|
-
removePusharySettings
|
|
197
|
-
};
|
package/dist/chunk-MNWRUGMH.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HOOK_LOCATOR_BINARY
|
|
3
|
-
} from "./chunk-QR6VE5ME.js";
|
|
4
|
-
|
|
5
|
-
// src/diagnostics/bridge.ts
|
|
6
|
-
import { execFileSync } from "child_process";
|
|
7
|
-
import { existsSync, readFileSync } from "fs";
|
|
8
|
-
import { homedir } from "os";
|
|
9
|
-
import { dirname, join } from "path";
|
|
10
|
-
var BRIDGE_BUNDLE_IDENTIFIER = "com.pushary.app";
|
|
11
|
-
var BRIDGE_HELPER_SUFFIX = "/Contents/Helpers/pushary-bridge";
|
|
12
|
-
var BRIDGE_BUNDLE_ROOTS = ["/Applications/Pushary.app", "$HOME/Applications/Pushary.app"];
|
|
13
|
-
var expandHome = (path, home) => path.replaceAll("$HOME", home);
|
|
14
|
-
var parseBridgeStub = (contents, stubPath) => {
|
|
15
|
-
const helperSuffix = contents.match(/^H=(\S+)$/m)?.[1] ?? BRIDGE_HELPER_SUFFIX;
|
|
16
|
-
const cachePath = contents.match(/^C="([^"\n]+)"$/m)?.[1] ?? join(dirname(stubPath), ".bridge-cache");
|
|
17
|
-
const rootsLine = contents.match(/^for P in ((?:"[^"\n]*"\s*)+); do$/m)?.[1];
|
|
18
|
-
const bundleRoots = rootsLine ? [...rootsLine.matchAll(/"([^"]*)"/g)].map((match) => match[1]) : BRIDGE_BUNDLE_ROOTS;
|
|
19
|
-
const bundleIdentifier = contents.match(/kMDItemCFBundleIdentifier == "([^"]+)"/)?.[1] ?? BRIDGE_BUNDLE_IDENTIFIER;
|
|
20
|
-
return { helperSuffix, cachePath, bundleRoots, bundleIdentifier };
|
|
21
|
-
};
|
|
22
|
-
var resolveBridgeStub = (stubPath, probe) => {
|
|
23
|
-
const contents = probe.readFile(stubPath);
|
|
24
|
-
if (contents === null) return { kind: "no-stub", stub: stubPath };
|
|
25
|
-
const shape = parseBridgeStub(contents, stubPath);
|
|
26
|
-
const helperIn = (bundle) => `${bundle}${shape.helperSuffix}`;
|
|
27
|
-
const looked = [];
|
|
28
|
-
for (const root of shape.bundleRoots.map((root2) => expandHome(root2, probe.home))) {
|
|
29
|
-
looked.push(root);
|
|
30
|
-
if (probe.exists(helperIn(root))) return { kind: "bundle", helper: helperIn(root), via: "root" };
|
|
31
|
-
}
|
|
32
|
-
const cached = shape.cachePath ? probe.readFile(shape.cachePath)?.split("\n")[0]?.trim() : void 0;
|
|
33
|
-
if (cached) {
|
|
34
|
-
looked.push(cached);
|
|
35
|
-
if (probe.exists(helperIn(cached))) return { kind: "bundle", helper: helperIn(cached), via: "cache" };
|
|
36
|
-
}
|
|
37
|
-
for (const found of probe.mdfind(shape.bundleIdentifier)) {
|
|
38
|
-
looked.push(found);
|
|
39
|
-
if (probe.exists(helperIn(found))) return { kind: "bundle", helper: helperIn(found), via: "spotlight" };
|
|
40
|
-
}
|
|
41
|
-
return { kind: "missing", stub: stubPath, looked };
|
|
42
|
-
};
|
|
43
|
-
var BRIDGE_GONE_MESSAGE = "the Mac app is gone but its hooks remain; run pushary setup or reinstall the app";
|
|
44
|
-
var describeBridgeResolution = (resolution) => {
|
|
45
|
-
switch (resolution.kind) {
|
|
46
|
-
case "bundle":
|
|
47
|
-
return `${resolution.helper} (${resolution.via === "root" ? "installed" : resolution.via === "cache" ? "cached path" : "found by Spotlight"})`;
|
|
48
|
-
case "missing":
|
|
49
|
-
return BRIDGE_GONE_MESSAGE;
|
|
50
|
-
case "no-stub":
|
|
51
|
-
return `${resolution.stub} is not there; ${BRIDGE_GONE_MESSAGE}`;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
var isBridgeLocator = (executable) => executable !== null && executable.split(/[/\\]/).pop() === HOOK_LOCATOR_BINARY;
|
|
55
|
-
var spotlight = (bundleIdentifier) => {
|
|
56
|
-
if (process.platform !== "darwin") return [];
|
|
57
|
-
try {
|
|
58
|
-
return execFileSync("/usr/bin/mdfind", [`kMDItemCFBundleIdentifier == "${bundleIdentifier}"`], {
|
|
59
|
-
encoding: "utf-8",
|
|
60
|
-
timeout: 5e3,
|
|
61
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
62
|
-
}).split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
63
|
-
} catch {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var readOrNull = (path) => {
|
|
68
|
-
try {
|
|
69
|
-
return readFileSync(path, "utf-8");
|
|
70
|
-
} catch {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var liveBridgeProbe = () => ({
|
|
75
|
-
exists: existsSync,
|
|
76
|
-
readFile: readOrNull,
|
|
77
|
-
mdfind: spotlight,
|
|
78
|
-
home: homedir()
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
export {
|
|
82
|
-
resolveBridgeStub,
|
|
83
|
-
describeBridgeResolution,
|
|
84
|
-
isBridgeLocator,
|
|
85
|
-
liveBridgeProbe
|
|
86
|
-
};
|
package/dist/chunk-RQSOEB4S.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createIo
|
|
3
|
-
} from "./chunk-U4TMAANR.js";
|
|
4
|
-
import {
|
|
5
|
-
describeKeyCheck,
|
|
6
|
-
keyCheckFromResponse
|
|
7
|
-
} from "./chunk-KFKL3FHS.js";
|
|
8
|
-
import {
|
|
9
|
-
EXIT
|
|
10
|
-
} from "./chunk-KZERVKTD.js";
|
|
11
|
-
|
|
12
|
-
// src/cli/report-key.ts
|
|
13
|
-
var { dim, yellow } = createIo();
|
|
14
|
-
var printKeyCheck = (check, baseUrl) => {
|
|
15
|
-
const report = describeKeyCheck(check, baseUrl);
|
|
16
|
-
console.log(` ${yellow("!")} ${report.message}`);
|
|
17
|
-
for (const line of report.next) console.log(` ${dim(line)}`);
|
|
18
|
-
return report;
|
|
19
|
-
};
|
|
20
|
-
var exitIfKeyFailure = async (response, baseUrl) => {
|
|
21
|
-
const check = await keyCheckFromResponse(response, baseUrl);
|
|
22
|
-
if (!check) return;
|
|
23
|
-
const report = printKeyCheck(check, baseUrl);
|
|
24
|
-
process.exit(report.exitCode);
|
|
25
|
-
};
|
|
26
|
-
var responseDetail = async (response) => {
|
|
27
|
-
try {
|
|
28
|
-
const body = await response.json();
|
|
29
|
-
const text = [body.error, body.message].find((part) => typeof part === "string" && part);
|
|
30
|
-
if (typeof text === "string") return text;
|
|
31
|
-
} catch {
|
|
32
|
-
}
|
|
33
|
-
return response.statusText || `HTTP ${response.status}`;
|
|
34
|
-
};
|
|
35
|
-
var exitOnFailedResponse = async (response, baseUrl) => {
|
|
36
|
-
await exitIfKeyFailure(response, baseUrl);
|
|
37
|
-
console.log(` ${yellow("!")} Failed: ${await responseDetail(response)}`);
|
|
38
|
-
process.exit(EXIT.FAILED);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
printKeyCheck,
|
|
43
|
-
exitOnFailedResponse
|
|
44
|
-
};
|