@pushary/agent-hooks 0.84.1 → 0.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/README.md +24 -0
- package/data/cursor-plugin/CHANGELOG.md +21 -0
- package/data/cursor-plugin/scripts/pushary-gate.mjs +54 -222
- package/data/cursor-plugin/scripts/pushary-gate.test.mjs +11 -106
- package/data/vscode-plugin/CHANGELOG.md +26 -0
- package/data/vscode-plugin/scripts/pushary-gate.mjs +66 -74
- package/dist/bin/pushary-bell-hook.js +9 -7
- package/dist/bin/pushary-bell.js +12 -11
- package/dist/bin/pushary-claude.js +12 -11
- package/dist/bin/pushary-clean.js +8 -7
- package/dist/bin/pushary-codex-bridge.js +5 -5
- package/dist/bin/pushary-codex-hook.js +14 -20
- package/dist/bin/pushary-codex.js +3 -3
- package/dist/bin/pushary-connect.js +10 -10
- package/dist/bin/pushary-daemon.js +6 -6
- package/dist/bin/pushary-disconnect.d.ts +1 -0
- package/dist/bin/pushary-disconnect.js +125 -0
- package/dist/bin/pushary-doctor.js +16 -16
- package/dist/bin/pushary-gemini-bridge.js +5 -5
- package/dist/bin/pushary-gemini-hook.js +14 -20
- package/dist/bin/pushary-hook.js +16 -23
- package/dist/bin/pushary-login.js +6 -6
- package/dist/bin/pushary-logout.js +6 -6
- package/dist/bin/pushary-mode.js +5 -5
- package/dist/bin/pushary-notification-hook.js +8 -11
- package/dist/bin/pushary-permission-denied-hook.js +14 -12
- package/dist/bin/pushary-permission-hook.js +14 -12
- package/dist/bin/pushary-post-hook.js +8 -11
- package/dist/bin/pushary-prompt-hook.js +8 -11
- package/dist/bin/pushary-session-end-hook.js +8 -8
- package/dist/bin/pushary-session-start-hook.js +8 -8
- package/dist/bin/pushary-setup.js +29 -30
- package/dist/bin/pushary-stats.js +4 -4
- package/dist/bin/pushary-status.js +7 -7
- package/dist/bin/pushary-stop-hook.js +8 -8
- package/dist/bin/pushary-stopfailure-hook.js +8 -8
- package/dist/bin/pushary-suggestions.js +2 -2
- package/dist/bin/pushary-upgrade.js +15 -10
- package/dist/bin/pushary-wait.js +5 -5
- package/dist/bin/pushary.js +2 -1
- package/dist/{chunk-ILB6UOAF.js → chunk-55656H4Q.js} +1 -1
- package/dist/chunk-6CUUA7HO.js +59 -0
- package/dist/{chunk-6LC4WSCL.js → chunk-BZKTCOZQ.js} +1 -1
- package/dist/{chunk-K7CSRGKZ.js → chunk-CIVG746V.js} +1 -1
- package/dist/{chunk-FBGBJXVC.js → chunk-DNSIVHIA.js} +1 -1
- package/dist/{chunk-437T77TY.js → chunk-ES3FAX5X.js} +1 -1
- package/dist/chunk-EZPRY2ZY.js +70 -0
- package/dist/{chunk-MQMPG5X4.js → chunk-G3LXA2ZP.js} +207 -10
- package/dist/chunk-GM54KC62.js +187 -0
- package/dist/{chunk-MGJBC6DD.js → chunk-GOEXZ5QJ.js} +1 -0
- package/dist/chunk-HSGEEBBL.js +37 -0
- package/dist/{chunk-UXWEE3QI.js → chunk-IGV4KL7B.js} +1 -1
- package/dist/{chunk-GCKAWHFP.js → chunk-JDQY47OW.js} +1 -1
- package/dist/{chunk-7PZPJSWI.js → chunk-KTKIZEFT.js} +1 -1
- package/dist/{chunk-YR5TSPXB.js → chunk-LB6RSCLL.js} +12 -10
- package/dist/{chunk-DOXSWT4Q.js → chunk-OZKRF7MS.js} +6 -6
- package/dist/{chunk-SEAHGHCE.js → chunk-PHXEADSL.js} +40 -7
- package/dist/{chunk-F52SIIDG.js → chunk-QDKJTPAT.js} +1 -1
- package/dist/{chunk-J4KFVOCQ.js → chunk-SQOFGPNX.js} +1 -1
- package/dist/{chunk-NJ7JT26G.js → chunk-VGADRFG6.js} +1 -1
- package/dist/{chunk-HZNOAJGB.js → chunk-VKJUVPTJ.js} +2 -2
- package/dist/{chunk-ERYKGH4J.js → chunk-XIR6N66V.js} +1 -1
- package/dist/{chunk-CCH775Y6.js → chunk-XLM6COJA.js} +1 -1
- package/dist/{chunk-CCCJ6BPW.js → chunk-Y7BALRVB.js} +73 -134
- package/dist/chunk-YHG74UFF.js +12 -0
- package/dist/src/index.d.ts +7 -22
- package/dist/src/index.js +11 -8
- package/package.json +6 -3
- package/dist/chunk-BLDDXHHA.js +0 -66
- package/dist/chunk-UKSQWTBH.js +0 -208
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
readHookInput
|
|
4
|
+
} from "../chunk-6CUUA7HO.js";
|
|
2
5
|
import {
|
|
3
6
|
handleUserPrompt
|
|
4
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-Y7BALRVB.js";
|
|
5
8
|
import "../chunk-RN3NOEJF.js";
|
|
6
9
|
import "../chunk-BSZYIAZL.js";
|
|
7
10
|
import "../chunk-SAF6HGAA.js";
|
|
8
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-ES3FAX5X.js";
|
|
9
12
|
import "../chunk-7QLSKOSU.js";
|
|
10
13
|
import "../chunk-KZERVKTD.js";
|
|
11
14
|
import "../chunk-2UMNXADU.js";
|
|
12
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-G3LXA2ZP.js";
|
|
13
16
|
|
|
14
17
|
// bin/pushary-prompt-hook.ts
|
|
15
18
|
var main = async () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
rawInput += chunk;
|
|
19
|
-
}
|
|
20
|
-
if (!rawInput.trim()) {
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
19
|
+
const input = await readHookInput("claude", "UserPromptSubmit");
|
|
20
|
+
if (!input) return;
|
|
23
21
|
try {
|
|
24
|
-
const input = JSON.parse(rawInput);
|
|
25
22
|
const additionalContext = await handleUserPrompt(input);
|
|
26
23
|
if (additionalContext) {
|
|
27
24
|
process.stdout.write(JSON.stringify({
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
readHookInput
|
|
4
|
+
} from "../chunk-6CUUA7HO.js";
|
|
2
5
|
import {
|
|
3
6
|
handleSessionEnd
|
|
4
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-Y7BALRVB.js";
|
|
5
8
|
import "../chunk-RN3NOEJF.js";
|
|
6
9
|
import "../chunk-BSZYIAZL.js";
|
|
7
10
|
import "../chunk-SAF6HGAA.js";
|
|
8
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-ES3FAX5X.js";
|
|
9
12
|
import "../chunk-7QLSKOSU.js";
|
|
10
13
|
import "../chunk-KZERVKTD.js";
|
|
11
14
|
import "../chunk-2UMNXADU.js";
|
|
12
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-G3LXA2ZP.js";
|
|
13
16
|
|
|
14
17
|
// bin/pushary-session-end-hook.ts
|
|
15
18
|
var main = async () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
rawInput += chunk;
|
|
19
|
-
}
|
|
19
|
+
const input = await readHookInput("claude", "SessionEnd");
|
|
20
|
+
if (!input) return;
|
|
20
21
|
try {
|
|
21
|
-
const input = rawInput.trim() ? JSON.parse(rawInput) : {};
|
|
22
22
|
await handleSessionEnd(input);
|
|
23
23
|
} catch {
|
|
24
24
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
readHookInput
|
|
4
|
+
} from "../chunk-6CUUA7HO.js";
|
|
2
5
|
import {
|
|
3
6
|
handleSessionStart
|
|
4
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-Y7BALRVB.js";
|
|
5
8
|
import "../chunk-RN3NOEJF.js";
|
|
6
9
|
import "../chunk-BSZYIAZL.js";
|
|
7
10
|
import "../chunk-SAF6HGAA.js";
|
|
8
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-ES3FAX5X.js";
|
|
9
12
|
import "../chunk-7QLSKOSU.js";
|
|
10
13
|
import "../chunk-KZERVKTD.js";
|
|
11
14
|
import "../chunk-2UMNXADU.js";
|
|
12
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-G3LXA2ZP.js";
|
|
13
16
|
|
|
14
17
|
// bin/pushary-session-start-hook.ts
|
|
15
18
|
var main = async () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
rawInput += chunk;
|
|
19
|
-
}
|
|
19
|
+
const input = await readHookInput("claude", "SessionStart");
|
|
20
|
+
if (!input) return;
|
|
20
21
|
try {
|
|
21
|
-
const input = rawInput.trim() ? JSON.parse(rawInput) : {};
|
|
22
22
|
await handleSessionStart(input);
|
|
23
23
|
} catch {
|
|
24
24
|
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
detectClaudeVersion
|
|
4
|
+
} from "../chunk-EZPRY2ZY.js";
|
|
2
5
|
import {
|
|
3
6
|
claudeWired,
|
|
4
7
|
codexWired,
|
|
5
8
|
geminiWired
|
|
6
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-VKJUVPTJ.js";
|
|
7
10
|
import {
|
|
8
11
|
runBrowserLogin
|
|
9
12
|
} from "../chunk-Z3Z4VK5F.js";
|
|
10
13
|
import {
|
|
11
14
|
ensureDaemonRunning
|
|
12
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-XLM6COJA.js";
|
|
13
16
|
import {
|
|
14
17
|
describeDetection,
|
|
15
18
|
detectAllAgents,
|
|
@@ -21,22 +24,27 @@ import {
|
|
|
21
24
|
shortenHome,
|
|
22
25
|
vscodeSettingsTargets,
|
|
23
26
|
writeInstructionBlock
|
|
24
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-IGV4KL7B.js";
|
|
25
28
|
import {
|
|
26
29
|
GEMINI_HOOK_BINARY,
|
|
27
30
|
addGeminiHooks,
|
|
28
31
|
addGeminiMcpServer
|
|
29
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-OZKRF7MS.js";
|
|
30
33
|
import {
|
|
31
34
|
addClaudeMcpServer,
|
|
32
35
|
addPusharyHooks,
|
|
33
|
-
addPusharyToolPermissions
|
|
34
|
-
|
|
36
|
+
addPusharyToolPermissions,
|
|
37
|
+
compareVersion,
|
|
38
|
+
parseVersion
|
|
39
|
+
} from "../chunk-GM54KC62.js";
|
|
40
|
+
import {
|
|
41
|
+
guardBinary,
|
|
42
|
+
guardNodeScript
|
|
43
|
+
} from "../chunk-HSGEEBBL.js";
|
|
35
44
|
import "../chunk-XHKBHWLX.js";
|
|
36
45
|
import {
|
|
37
46
|
installGlobally,
|
|
38
47
|
npmErrorMessage,
|
|
39
|
-
quoteIfNeeded,
|
|
40
48
|
resolveGlobalBinDir,
|
|
41
49
|
resolveGlobalBinary
|
|
42
50
|
} from "../chunk-VT4IVERX.js";
|
|
@@ -57,10 +65,10 @@ import {
|
|
|
57
65
|
geminiSettings,
|
|
58
66
|
pusharyConfigFile,
|
|
59
67
|
vscodePluginDir
|
|
60
|
-
} from "../chunk-
|
|
68
|
+
} from "../chunk-PHXEADSL.js";
|
|
61
69
|
import {
|
|
62
70
|
reportEvent
|
|
63
|
-
} from "../chunk-
|
|
71
|
+
} from "../chunk-Y7BALRVB.js";
|
|
64
72
|
import "../chunk-RN3NOEJF.js";
|
|
65
73
|
import {
|
|
66
74
|
confirmAppConnection,
|
|
@@ -70,12 +78,12 @@ import {
|
|
|
70
78
|
printConnectInstructions,
|
|
71
79
|
setHumanStream,
|
|
72
80
|
verifyRoundTrip
|
|
73
|
-
} from "../chunk-
|
|
81
|
+
} from "../chunk-BZKTCOZQ.js";
|
|
74
82
|
import "../chunk-3EGEA4KH.js";
|
|
75
83
|
import {
|
|
76
84
|
checkApiKey,
|
|
77
85
|
describeKeyCheck
|
|
78
|
-
} from "../chunk-
|
|
86
|
+
} from "../chunk-QDKJTPAT.js";
|
|
79
87
|
import {
|
|
80
88
|
useColor
|
|
81
89
|
} from "../chunk-5RUIFDTP.js";
|
|
@@ -86,13 +94,13 @@ import {
|
|
|
86
94
|
readConfigFileKey,
|
|
87
95
|
readKeySource,
|
|
88
96
|
writeKey
|
|
89
|
-
} from "../chunk-
|
|
97
|
+
} from "../chunk-CIVG746V.js";
|
|
90
98
|
import {
|
|
91
99
|
parseFlags
|
|
92
100
|
} from "../chunk-GMXKITVA.js";
|
|
93
101
|
import {
|
|
94
102
|
renderCommandHelp
|
|
95
|
-
} from "../chunk-
|
|
103
|
+
} from "../chunk-GOEXZ5QJ.js";
|
|
96
104
|
import {
|
|
97
105
|
installClaudeAlias,
|
|
98
106
|
resolveShellRc
|
|
@@ -109,7 +117,7 @@ import {
|
|
|
109
117
|
} from "../chunk-6MTNS63X.js";
|
|
110
118
|
import "../chunk-BSZYIAZL.js";
|
|
111
119
|
import "../chunk-SAF6HGAA.js";
|
|
112
|
-
import "../chunk-
|
|
120
|
+
import "../chunk-ES3FAX5X.js";
|
|
113
121
|
import {
|
|
114
122
|
UsageError
|
|
115
123
|
} from "../chunk-7QLSKOSU.js";
|
|
@@ -119,7 +127,7 @@ import {
|
|
|
119
127
|
import "../chunk-2UMNXADU.js";
|
|
120
128
|
import {
|
|
121
129
|
isValidApiKey
|
|
122
|
-
} from "../chunk-
|
|
130
|
+
} from "../chunk-G3LXA2ZP.js";
|
|
123
131
|
|
|
124
132
|
// bin/pushary-setup.ts
|
|
125
133
|
import { existsSync, readFileSync, writeFileSync, mkdirSync, cpSync, rmSync, renameSync, realpathSync, readdirSync, statSync } from "fs";
|
|
@@ -234,17 +242,8 @@ var describeClosing = (facts) => {
|
|
|
234
242
|
|
|
235
243
|
// src/setup/codex-version.ts
|
|
236
244
|
import { dirname, join } from "path";
|
|
237
|
-
var parseCodexVersion =
|
|
238
|
-
|
|
239
|
-
if (!match) return null;
|
|
240
|
-
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
241
|
-
};
|
|
242
|
-
var compareCodexVersion = (a, b) => {
|
|
243
|
-
for (let i = 0; i < 3; i++) {
|
|
244
|
-
if (a[i] !== b[i]) return a[i] < b[i] ? -1 : 1;
|
|
245
|
-
}
|
|
246
|
-
return 0;
|
|
247
|
-
};
|
|
245
|
+
var parseCodexVersion = parseVersion;
|
|
246
|
+
var compareCodexVersion = compareVersion;
|
|
248
247
|
var versionFromManifest = (probe, binPath) => {
|
|
249
248
|
let dir = dirname(binPath);
|
|
250
249
|
for (let depth = 0; depth < 4; depth++) {
|
|
@@ -714,7 +713,7 @@ var setupClaudeCode = async (apiKey) => {
|
|
|
714
713
|
addPusharyToolPermissions(settings);
|
|
715
714
|
});
|
|
716
715
|
await spinner("Adding hooks (approvals, activity, presence, and lifecycle events)", async () => {
|
|
717
|
-
addPusharyHooks(settings, resolveGlobalBinDir("pushary-hook"));
|
|
716
|
+
addPusharyHooks(settings, resolveGlobalBinDir("pushary-hook"), detectClaudeVersion());
|
|
718
717
|
});
|
|
719
718
|
await spinner(`Writing ${CLAUDE_JSON}`, async () => {
|
|
720
719
|
writeJsonAtomic(CLAUDE_JSON, claudeJson2, 384);
|
|
@@ -940,7 +939,7 @@ var setupCodex = async (apiKey) => {
|
|
|
940
939
|
const trustAuto = codexTrustAutoSupported(codexVersion);
|
|
941
940
|
let trusted = false;
|
|
942
941
|
if (hooksSupported) {
|
|
943
|
-
const hookCommand =
|
|
942
|
+
const hookCommand = guardBinary(resolveGlobalBinary("pushary-codex-hook") ?? "pushary-codex-hook");
|
|
944
943
|
await spinner("Adding native hooks (~/.codex/hooks.json)", async () => {
|
|
945
944
|
const hooksConfig = readAgentJson(CODEX_HOOKS_JSON);
|
|
946
945
|
addCodexHooks(hooksConfig, hookCommand);
|
|
@@ -1022,7 +1021,7 @@ var resolveBundledPlugin = () => {
|
|
|
1022
1021
|
var installCursorUserHooks = (gateScript) => {
|
|
1023
1022
|
const template = readJson(join2(CURSOR_PLUGIN_DIR, "hooks", "hooks.json")).hooks?.beforeShellExecution?.[0];
|
|
1024
1023
|
if (!template) throw new Error("bundled Cursor hooks.json missing a beforeShellExecution entry");
|
|
1025
|
-
const entry = { ...template, command:
|
|
1024
|
+
const entry = { ...template, command: guardNodeScript(gateScript) };
|
|
1026
1025
|
let userHooks = {};
|
|
1027
1026
|
if (existsSync(CURSOR_USER_HOOKS)) {
|
|
1028
1027
|
try {
|
|
@@ -1286,7 +1285,7 @@ var setupGemini = async (apiKey) => {
|
|
|
1286
1285
|
addGeminiMcpServer(settings, apiKey);
|
|
1287
1286
|
});
|
|
1288
1287
|
await spinner("Adding hooks (BeforeTool, AfterTool, BeforeAgent, SessionStart, SessionEnd)", async () => {
|
|
1289
|
-
addGeminiHooks(settings,
|
|
1288
|
+
addGeminiHooks(settings, guardBinary(resolveGlobalBinary(GEMINI_HOOK_BINARY) ?? GEMINI_HOOK_BINARY));
|
|
1290
1289
|
});
|
|
1291
1290
|
await spinner(`Writing ${GEMINI_SETTINGS}`, async () => {
|
|
1292
1291
|
writeJsonAtomic(GEMINI_SETTINGS, settings, KEY_FILE_MODE);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
readLedgerSummary
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-VGADRFG6.js";
|
|
5
5
|
import {
|
|
6
6
|
exitOnHelpFlag
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-SQOFGPNX.js";
|
|
8
|
+
import "../chunk-GOEXZ5QJ.js";
|
|
9
9
|
import "../chunk-DINDL2CF.js";
|
|
10
10
|
import "../chunk-KZERVKTD.js";
|
|
11
11
|
import {
|
|
12
12
|
getApiKey
|
|
13
13
|
} from "../chunk-2UMNXADU.js";
|
|
14
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-G3LXA2ZP.js";
|
|
15
15
|
|
|
16
16
|
// bin/pushary-stats.ts
|
|
17
17
|
exitOnHelpFlag("stats");
|
|
@@ -8,31 +8,31 @@ import {
|
|
|
8
8
|
describeReach,
|
|
9
9
|
fetchChannels,
|
|
10
10
|
reachVerdict
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-BZKTCOZQ.js";
|
|
12
12
|
import "../chunk-3EGEA4KH.js";
|
|
13
13
|
import {
|
|
14
14
|
checkApiKey,
|
|
15
15
|
describeKeyCheck
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-QDKJTPAT.js";
|
|
17
17
|
import {
|
|
18
18
|
createIo
|
|
19
19
|
} from "../chunk-5RUIFDTP.js";
|
|
20
20
|
import {
|
|
21
21
|
readKeySource
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-CIVG746V.js";
|
|
23
23
|
import {
|
|
24
24
|
rejectUnknownFlags
|
|
25
25
|
} from "../chunk-GMXKITVA.js";
|
|
26
26
|
import {
|
|
27
27
|
exitOnHelpFlag
|
|
28
|
-
} from "../chunk-
|
|
29
|
-
import "../chunk-
|
|
28
|
+
} from "../chunk-SQOFGPNX.js";
|
|
29
|
+
import "../chunk-GOEXZ5QJ.js";
|
|
30
30
|
import "../chunk-BC3VCZ3E.js";
|
|
31
31
|
import "../chunk-DINDL2CF.js";
|
|
32
32
|
import "../chunk-6MTNS63X.js";
|
|
33
33
|
import "../chunk-BSZYIAZL.js";
|
|
34
34
|
import "../chunk-SAF6HGAA.js";
|
|
35
|
-
import "../chunk-
|
|
35
|
+
import "../chunk-ES3FAX5X.js";
|
|
36
36
|
import {
|
|
37
37
|
UsageError
|
|
38
38
|
} from "../chunk-7QLSKOSU.js";
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
EXIT
|
|
41
41
|
} from "../chunk-KZERVKTD.js";
|
|
42
42
|
import "../chunk-2UMNXADU.js";
|
|
43
|
-
import "../chunk-
|
|
43
|
+
import "../chunk-G3LXA2ZP.js";
|
|
44
44
|
|
|
45
45
|
// src/status.ts
|
|
46
46
|
var keySourceLine = (source) => {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
readHookInput
|
|
4
|
+
} from "../chunk-6CUUA7HO.js";
|
|
2
5
|
import {
|
|
3
6
|
handleStop
|
|
4
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-Y7BALRVB.js";
|
|
5
8
|
import "../chunk-RN3NOEJF.js";
|
|
6
9
|
import "../chunk-BSZYIAZL.js";
|
|
7
10
|
import "../chunk-SAF6HGAA.js";
|
|
8
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-ES3FAX5X.js";
|
|
9
12
|
import "../chunk-7QLSKOSU.js";
|
|
10
13
|
import "../chunk-KZERVKTD.js";
|
|
11
14
|
import "../chunk-2UMNXADU.js";
|
|
12
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-G3LXA2ZP.js";
|
|
13
16
|
|
|
14
17
|
// bin/pushary-stop-hook.ts
|
|
15
18
|
var main = async () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
rawInput += chunk;
|
|
19
|
-
}
|
|
19
|
+
const input = await readHookInput("claude", "Stop");
|
|
20
|
+
if (!input) return;
|
|
20
21
|
try {
|
|
21
|
-
const input = rawInput.trim() ? JSON.parse(rawInput) : {};
|
|
22
22
|
const output = await handleStop(input);
|
|
23
23
|
if (output) process.stdout.write(JSON.stringify(output));
|
|
24
24
|
} catch {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
readHookInput
|
|
4
|
+
} from "../chunk-6CUUA7HO.js";
|
|
2
5
|
import {
|
|
3
6
|
handleStopFailure
|
|
4
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-Y7BALRVB.js";
|
|
5
8
|
import "../chunk-RN3NOEJF.js";
|
|
6
9
|
import "../chunk-BSZYIAZL.js";
|
|
7
10
|
import "../chunk-SAF6HGAA.js";
|
|
8
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-ES3FAX5X.js";
|
|
9
12
|
import "../chunk-7QLSKOSU.js";
|
|
10
13
|
import "../chunk-KZERVKTD.js";
|
|
11
14
|
import "../chunk-2UMNXADU.js";
|
|
12
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-G3LXA2ZP.js";
|
|
13
16
|
|
|
14
17
|
// bin/pushary-stopfailure-hook.ts
|
|
15
18
|
var main = async () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
rawInput += chunk;
|
|
19
|
-
}
|
|
19
|
+
const input = await readHookInput("claude", "StopFailure");
|
|
20
|
+
if (!input) return;
|
|
20
21
|
try {
|
|
21
|
-
const input = rawInput.trim() ? JSON.parse(rawInput) : {};
|
|
22
22
|
await handleStopFailure(input);
|
|
23
23
|
} catch {
|
|
24
24
|
}
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
} from "../chunk-GMXKITVA.js";
|
|
8
8
|
import {
|
|
9
9
|
exitOnHelpFlag
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-SQOFGPNX.js";
|
|
11
|
+
import "../chunk-GOEXZ5QJ.js";
|
|
12
12
|
import "../chunk-DINDL2CF.js";
|
|
13
13
|
import {
|
|
14
14
|
UsageError
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
detectClaudeVersion
|
|
4
|
+
} from "../chunk-EZPRY2ZY.js";
|
|
2
5
|
import {
|
|
3
6
|
GEMINI_HOOK_BINARY,
|
|
4
7
|
addGeminiHooks,
|
|
5
8
|
addGeminiMcpServer,
|
|
6
9
|
hasGeminiHooks
|
|
7
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-OZKRF7MS.js";
|
|
8
11
|
import {
|
|
9
12
|
addClaudeMcpServer,
|
|
10
13
|
addPusharyHooks,
|
|
11
14
|
addPusharyToolPermissions
|
|
12
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-GM54KC62.js";
|
|
16
|
+
import {
|
|
17
|
+
guardBinary
|
|
18
|
+
} from "../chunk-HSGEEBBL.js";
|
|
13
19
|
import {
|
|
14
20
|
execNpm,
|
|
15
21
|
npmErrorMessage,
|
|
16
|
-
quoteIfNeeded,
|
|
17
22
|
resolveGlobalBinDir,
|
|
18
23
|
resolveGlobalBinary
|
|
19
24
|
} from "../chunk-VT4IVERX.js";
|
|
@@ -30,11 +35,11 @@ import {
|
|
|
30
35
|
hasCodexHooks,
|
|
31
36
|
vscodePluginDir,
|
|
32
37
|
vscodePluginMcp
|
|
33
|
-
} from "../chunk-
|
|
38
|
+
} from "../chunk-PHXEADSL.js";
|
|
34
39
|
import {
|
|
35
40
|
exitOnHelpFlag
|
|
36
|
-
} from "../chunk-
|
|
37
|
-
import "../chunk-
|
|
41
|
+
} from "../chunk-SQOFGPNX.js";
|
|
42
|
+
import "../chunk-GOEXZ5QJ.js";
|
|
38
43
|
import {
|
|
39
44
|
isNewerVersion
|
|
40
45
|
} from "../chunk-DINDL2CF.js";
|
|
@@ -45,7 +50,7 @@ import "../chunk-KZERVKTD.js";
|
|
|
45
50
|
import {
|
|
46
51
|
getApiKey
|
|
47
52
|
} from "../chunk-2UMNXADU.js";
|
|
48
|
-
import "../chunk-
|
|
53
|
+
import "../chunk-G3LXA2ZP.js";
|
|
49
54
|
|
|
50
55
|
// bin/pushary-upgrade.ts
|
|
51
56
|
import { existsSync as existsSync2 } from "fs";
|
|
@@ -87,7 +92,7 @@ var reapplyClaudeSettings = (apiKey, paths = {}) => {
|
|
|
87
92
|
if (!settingsWritable) throw new Error("settings.json could not be parsed");
|
|
88
93
|
const s = settings;
|
|
89
94
|
addPusharyToolPermissions(s);
|
|
90
|
-
addPusharyHooks(s, resolveGlobalBinDir("pushary-hook"));
|
|
95
|
+
addPusharyHooks(s, resolveGlobalBinDir("pushary-hook"), detectClaudeVersion());
|
|
91
96
|
writeJson(settingsPath, s);
|
|
92
97
|
hooks = true;
|
|
93
98
|
} catch {
|
|
@@ -119,7 +124,7 @@ var reapplyCodexSettings = (apiKey, paths = {}) => {
|
|
|
119
124
|
const hooksConfig = readJson(hooksPath);
|
|
120
125
|
const configured = config != null && !!config.mcp_servers?.pushary || hooksConfig != null && hasCodexHooks(hooksConfig);
|
|
121
126
|
if (!configured) return { reapplied: false, hooks: false, mcp: false };
|
|
122
|
-
const command =
|
|
127
|
+
const command = guardBinary(resolveGlobalBinary(CODEX_HOOK_BINARY) ?? CODEX_HOOK_BINARY);
|
|
123
128
|
let hooks = false;
|
|
124
129
|
let mcp = false;
|
|
125
130
|
if (hooksConfig != null) {
|
|
@@ -152,7 +157,7 @@ var reapplyGeminiSettings = (apiKey, paths = {}) => {
|
|
|
152
157
|
let hooks = false;
|
|
153
158
|
let mcp = false;
|
|
154
159
|
try {
|
|
155
|
-
addGeminiHooks(settings,
|
|
160
|
+
addGeminiHooks(settings, guardBinary(resolveGlobalBinary(GEMINI_HOOK_BINARY) ?? GEMINI_HOOK_BINARY));
|
|
156
161
|
hooks = true;
|
|
157
162
|
if (apiKey) {
|
|
158
163
|
addGeminiMcpServer(settings, apiKey);
|
package/dist/bin/pushary-wait.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "../chunk-IIENZE2J.js";
|
|
5
5
|
import {
|
|
6
6
|
exitOnFailedResponse
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-DNSIVHIA.js";
|
|
8
|
+
import "../chunk-QDKJTPAT.js";
|
|
9
9
|
import {
|
|
10
10
|
createIo
|
|
11
11
|
} from "../chunk-5RUIFDTP.js";
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
} from "../chunk-GMXKITVA.js";
|
|
15
15
|
import {
|
|
16
16
|
exitOnHelpFlag
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import "../chunk-
|
|
17
|
+
} from "../chunk-SQOFGPNX.js";
|
|
18
|
+
import "../chunk-GOEXZ5QJ.js";
|
|
19
19
|
import "../chunk-DINDL2CF.js";
|
|
20
20
|
import "../chunk-SAF6HGAA.js";
|
|
21
21
|
import {
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
getApiKey,
|
|
29
29
|
getBaseUrl
|
|
30
30
|
} from "../chunk-2UMNXADU.js";
|
|
31
|
-
import "../chunk-
|
|
31
|
+
import "../chunk-G3LXA2ZP.js";
|
|
32
32
|
|
|
33
33
|
// bin/pushary-wait.ts
|
|
34
34
|
exitOnHelpFlag("wait");
|
package/dist/bin/pushary.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
COMMANDS,
|
|
4
4
|
isCommandName,
|
|
5
5
|
renderHelp
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-GOEXZ5QJ.js";
|
|
7
7
|
import {
|
|
8
8
|
getPackageVersion
|
|
9
9
|
} from "../chunk-DINDL2CF.js";
|
|
@@ -26,6 +26,7 @@ var LOADERS = {
|
|
|
26
26
|
connect: () => import("./pushary-connect.js"),
|
|
27
27
|
bell: () => import("./pushary-bell.js"),
|
|
28
28
|
doctor: () => import("./pushary-doctor.js"),
|
|
29
|
+
disconnect: () => import("./pushary-disconnect.js"),
|
|
29
30
|
clean: () => import("./pushary-clean.js"),
|
|
30
31
|
mode: () => import("./pushary-mode.js"),
|
|
31
32
|
wait: () => import("./pushary-wait.js"),
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// src/admission.ts
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { homedir } from "os";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
var NO_RULES = { version: 1, disabled: [] };
|
|
6
|
+
var SUPPORTED_VERSION = 1;
|
|
7
|
+
var parseAdmissionRules = (raw) => {
|
|
8
|
+
if (!raw) return NO_RULES;
|
|
9
|
+
try {
|
|
10
|
+
const parsed = JSON.parse(raw);
|
|
11
|
+
if (parsed.version !== SUPPORTED_VERSION) return NO_RULES;
|
|
12
|
+
if (!Array.isArray(parsed.disabled)) return NO_RULES;
|
|
13
|
+
return {
|
|
14
|
+
version: SUPPORTED_VERSION,
|
|
15
|
+
disabled: parsed.disabled.filter((rule) => typeof rule === "string")
|
|
16
|
+
};
|
|
17
|
+
} catch {
|
|
18
|
+
return NO_RULES;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var admissionRulesFile = () => process.env.PUSHARY_ADMISSION_FILE?.trim() || join(homedir(), ".pushary", "admission-rules.json");
|
|
22
|
+
var readAdmissionRules = () => {
|
|
23
|
+
try {
|
|
24
|
+
return parseAdmissionRules(readFileSync(admissionRulesFile(), "utf-8"));
|
|
25
|
+
} catch {
|
|
26
|
+
return NO_RULES;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var matches = (rule, source, event) => {
|
|
30
|
+
const colon = rule.indexOf(":");
|
|
31
|
+
if (colon <= 0 || colon === rule.length - 1) return false;
|
|
32
|
+
const ruleSource = rule.slice(0, colon);
|
|
33
|
+
const ruleEvent = rule.slice(colon + 1);
|
|
34
|
+
return (ruleSource === "*" || ruleSource === source) && (ruleEvent === "*" || ruleEvent === event);
|
|
35
|
+
};
|
|
36
|
+
var isAdmitted = (rules, source, event) => !rules.disabled.some((rule) => matches(rule, source, event));
|
|
37
|
+
var readHookInput = async (source, fallbackEvent = "", stdin = process.stdin) => {
|
|
38
|
+
let raw = "";
|
|
39
|
+
for await (const chunk of stdin) raw += chunk;
|
|
40
|
+
if (!raw.trim()) return null;
|
|
41
|
+
let parsed;
|
|
42
|
+
try {
|
|
43
|
+
parsed = JSON.parse(raw);
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
48
|
+
const event = eventNameOf(parsed) ?? fallbackEvent;
|
|
49
|
+
return isAdmitted(readAdmissionRules(), source, event) ? parsed : null;
|
|
50
|
+
};
|
|
51
|
+
var eventNameOf = (input) => {
|
|
52
|
+
if (!("hook_event_name" in input)) return void 0;
|
|
53
|
+
const name = input.hook_event_name;
|
|
54
|
+
return typeof name === "string" && name.length > 0 ? name : void 0;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
readHookInput
|
|
59
|
+
};
|