@pushary/agent-hooks 0.89.6 → 0.89.7
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 +26 -0
- package/dist/bin/pushary-bell.js +1 -1
- package/dist/bin/pushary-claude.js +5 -5
- package/dist/bin/pushary-clean.js +128 -24
- package/dist/bin/pushary-codex-bridge.js +3 -3
- package/dist/bin/pushary-codex-hook.js +3 -3
- package/dist/bin/pushary-codex.js +3 -3
- package/dist/bin/pushary-daemon.js +9 -9
- package/dist/bin/pushary-disconnect.js +2 -2
- package/dist/bin/pushary-doctor.js +6 -6
- package/dist/bin/pushary-elicitation-hook.js +2 -2
- package/dist/bin/pushary-gemini-bridge.js +3 -3
- package/dist/bin/pushary-gemini-hook.js +3 -3
- package/dist/bin/pushary-hook.js +4 -4
- package/dist/bin/pushary-logout.js +1 -1
- package/dist/bin/pushary-notification-hook.js +3 -3
- package/dist/bin/pushary-opencode-hook.js +3 -3
- package/dist/bin/pushary-permission-denied-hook.js +4 -4
- package/dist/bin/pushary-permission-hook.js +4 -4
- package/dist/bin/pushary-post-hook.js +3 -3
- package/dist/bin/pushary-prompt-hook.js +3 -3
- package/dist/bin/pushary-session-end-hook.js +3 -3
- package/dist/bin/pushary-session-start-hook.js +3 -3
- package/dist/bin/pushary-setup.js +8 -8
- package/dist/bin/pushary-status.js +3 -3
- package/dist/bin/pushary-stop-hook.js +3 -3
- package/dist/bin/pushary-stopfailure-hook.js +3 -3
- package/dist/bin/pushary-upgrade.js +7 -7
- package/dist/{chunk-2HYPZLYY.js → chunk-2M66JVZM.js} +1 -1
- package/dist/{chunk-5TASNKRX.js → chunk-2MEJBUOI.js} +4 -4
- package/dist/{chunk-4ZHQNBDP.js → chunk-42TTFZLV.js} +1 -1
- package/dist/{chunk-MZBT2LXW.js → chunk-5YUVKPTS.js} +2 -2
- package/dist/{chunk-QH4AA7QV.js → chunk-A4O5ROZK.js} +1 -1
- package/dist/{chunk-OBI4YMCT.js → chunk-BAE45YLP.js} +2 -2
- package/dist/{chunk-NFI2K2ZQ.js → chunk-BPKMGE7L.js} +1 -1
- package/dist/{chunk-V37ZXMH3.js → chunk-GMI5QZLG.js} +15 -9
- package/dist/{chunk-475T3XIO.js → chunk-J2JZJZKB.js} +1 -1
- package/dist/{chunk-VP7SDXYG.js → chunk-TESGYWEM.js} +1 -1
- package/dist/{chunk-7TS2G4QG.js → chunk-VA7VUNRD.js} +22 -14
- package/dist/{chunk-NQNCSPEH.js → chunk-ZH7TWAYK.js} +2 -2
- package/dist/src/index.js +4 -4
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handlePermissionDenied
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-5YUVKPTS.js";
|
|
5
5
|
import "../chunk-ATBKJNWS.js";
|
|
6
6
|
import "../chunk-VZKXBFUA.js";
|
|
7
7
|
import {
|
|
8
8
|
readHookInput
|
|
9
9
|
} from "../chunk-6CUUA7HO.js";
|
|
10
10
|
import "../chunk-YHG74UFF.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-BPKMGE7L.js";
|
|
12
12
|
import "../chunk-GKAKAOKC.js";
|
|
13
13
|
import "../chunk-KOPUTJQC.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-2M66JVZM.js";
|
|
15
|
+
import "../chunk-GMI5QZLG.js";
|
|
16
16
|
import "../chunk-BSZYIAZL.js";
|
|
17
17
|
import "../chunk-SAF6HGAA.js";
|
|
18
18
|
import "../chunk-OFRNZWC4.js";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
handlePermissionRequest
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-5YUVKPTS.js";
|
|
5
5
|
import "../chunk-ATBKJNWS.js";
|
|
6
6
|
import "../chunk-VZKXBFUA.js";
|
|
7
7
|
import {
|
|
8
8
|
readHookInput
|
|
9
9
|
} from "../chunk-6CUUA7HO.js";
|
|
10
10
|
import "../chunk-YHG74UFF.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-BPKMGE7L.js";
|
|
12
12
|
import "../chunk-GKAKAOKC.js";
|
|
13
13
|
import "../chunk-KOPUTJQC.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-2M66JVZM.js";
|
|
15
|
+
import "../chunk-GMI5QZLG.js";
|
|
16
16
|
import "../chunk-BSZYIAZL.js";
|
|
17
17
|
import "../chunk-SAF6HGAA.js";
|
|
18
18
|
import "../chunk-OFRNZWC4.js";
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "../chunk-6CUUA7HO.js";
|
|
5
5
|
import {
|
|
6
6
|
handlePostToolUse
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-BPKMGE7L.js";
|
|
8
8
|
import "../chunk-GKAKAOKC.js";
|
|
9
9
|
import "../chunk-KOPUTJQC.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-2M66JVZM.js";
|
|
11
|
+
import "../chunk-GMI5QZLG.js";
|
|
12
12
|
import "../chunk-BSZYIAZL.js";
|
|
13
13
|
import "../chunk-SAF6HGAA.js";
|
|
14
14
|
import "../chunk-OFRNZWC4.js";
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "../chunk-6CUUA7HO.js";
|
|
5
5
|
import {
|
|
6
6
|
handleUserPrompt
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-BPKMGE7L.js";
|
|
8
8
|
import "../chunk-GKAKAOKC.js";
|
|
9
9
|
import "../chunk-KOPUTJQC.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-2M66JVZM.js";
|
|
11
|
+
import "../chunk-GMI5QZLG.js";
|
|
12
12
|
import "../chunk-BSZYIAZL.js";
|
|
13
13
|
import "../chunk-SAF6HGAA.js";
|
|
14
14
|
import "../chunk-OFRNZWC4.js";
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "../chunk-6CUUA7HO.js";
|
|
5
5
|
import {
|
|
6
6
|
handleSessionEnd
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-BPKMGE7L.js";
|
|
8
8
|
import "../chunk-GKAKAOKC.js";
|
|
9
9
|
import "../chunk-KOPUTJQC.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-2M66JVZM.js";
|
|
11
|
+
import "../chunk-GMI5QZLG.js";
|
|
12
12
|
import "../chunk-BSZYIAZL.js";
|
|
13
13
|
import "../chunk-SAF6HGAA.js";
|
|
14
14
|
import "../chunk-OFRNZWC4.js";
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "../chunk-6CUUA7HO.js";
|
|
5
5
|
import {
|
|
6
6
|
handleSessionStart
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-BPKMGE7L.js";
|
|
8
8
|
import "../chunk-GKAKAOKC.js";
|
|
9
9
|
import "../chunk-KOPUTJQC.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-2M66JVZM.js";
|
|
11
|
+
import "../chunk-GMI5QZLG.js";
|
|
12
12
|
import "../chunk-BSZYIAZL.js";
|
|
13
13
|
import "../chunk-SAF6HGAA.js";
|
|
14
14
|
import "../chunk-OFRNZWC4.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
detectClaudeVersion
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-J2JZJZKB.js";
|
|
5
5
|
import {
|
|
6
6
|
claudeWired,
|
|
7
7
|
codexWired,
|
|
8
8
|
geminiWired
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-BAE45YLP.js";
|
|
10
10
|
import {
|
|
11
11
|
runBrowserLogin
|
|
12
12
|
} from "../chunk-Z3Z4VK5F.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
shortenHome,
|
|
22
22
|
vscodeSettingsTargets,
|
|
23
23
|
writeInstructionBlock
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-A4O5ROZK.js";
|
|
25
25
|
import {
|
|
26
26
|
OPENCODE_HOOK_BINARY,
|
|
27
27
|
addOpenCodeMcpServer,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
addPusharyToolPermissions,
|
|
43
43
|
compareVersion,
|
|
44
44
|
parseVersion
|
|
45
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-VA7VUNRD.js";
|
|
46
46
|
import "../chunk-ATBKJNWS.js";
|
|
47
47
|
import {
|
|
48
48
|
guardBinary,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
readDaemonStatus,
|
|
58
58
|
replaceDaemonService,
|
|
59
59
|
stopDaemonService
|
|
60
|
-
} from "../chunk-
|
|
60
|
+
} from "../chunk-ZH7TWAYK.js";
|
|
61
61
|
import {
|
|
62
62
|
detectProviderLiveCapabilities,
|
|
63
63
|
hasSpawnProvider,
|
|
@@ -72,10 +72,10 @@ import {
|
|
|
72
72
|
} from "../chunk-PZA7G4CN.js";
|
|
73
73
|
import {
|
|
74
74
|
reportEvent
|
|
75
|
-
} from "../chunk-
|
|
75
|
+
} from "../chunk-BPKMGE7L.js";
|
|
76
76
|
import "../chunk-GKAKAOKC.js";
|
|
77
77
|
import "../chunk-KOPUTJQC.js";
|
|
78
|
-
import "../chunk-
|
|
78
|
+
import "../chunk-2M66JVZM.js";
|
|
79
79
|
import {
|
|
80
80
|
addCodexHookTrust,
|
|
81
81
|
addCodexHooks,
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
geminiSettings,
|
|
96
96
|
pusharyConfigFile,
|
|
97
97
|
vscodePluginDir
|
|
98
|
-
} from "../chunk-
|
|
98
|
+
} from "../chunk-GMI5QZLG.js";
|
|
99
99
|
import {
|
|
100
100
|
confirmAppConnection,
|
|
101
101
|
connectDevice,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
describeLastSeen,
|
|
4
4
|
listMachines
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-TESGYWEM.js";
|
|
6
|
+
import "../chunk-2M66JVZM.js";
|
|
7
|
+
import "../chunk-GMI5QZLG.js";
|
|
8
8
|
import {
|
|
9
9
|
describeReach,
|
|
10
10
|
fetchChannels,
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "../chunk-6CUUA7HO.js";
|
|
5
5
|
import {
|
|
6
6
|
handleStop
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-BPKMGE7L.js";
|
|
8
8
|
import "../chunk-GKAKAOKC.js";
|
|
9
9
|
import "../chunk-KOPUTJQC.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-2M66JVZM.js";
|
|
11
|
+
import "../chunk-GMI5QZLG.js";
|
|
12
12
|
import "../chunk-BSZYIAZL.js";
|
|
13
13
|
import "../chunk-SAF6HGAA.js";
|
|
14
14
|
import "../chunk-OFRNZWC4.js";
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "../chunk-6CUUA7HO.js";
|
|
5
5
|
import {
|
|
6
6
|
handleStopFailure
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-BPKMGE7L.js";
|
|
8
8
|
import "../chunk-GKAKAOKC.js";
|
|
9
9
|
import "../chunk-KOPUTJQC.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-2M66JVZM.js";
|
|
11
|
+
import "../chunk-GMI5QZLG.js";
|
|
12
12
|
import "../chunk-BSZYIAZL.js";
|
|
13
13
|
import "../chunk-SAF6HGAA.js";
|
|
14
14
|
import "../chunk-OFRNZWC4.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
reapplyAllAgents
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-2MEJBUOI.js";
|
|
5
|
+
import "../chunk-J2JZJZKB.js";
|
|
6
|
+
import "../chunk-BAE45YLP.js";
|
|
7
|
+
import "../chunk-VA7VUNRD.js";
|
|
8
8
|
import "../chunk-ATBKJNWS.js";
|
|
9
9
|
import "../chunk-AIGDBRIJ.js";
|
|
10
10
|
import {
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
readDaemonStatus,
|
|
16
16
|
replaceDaemonService,
|
|
17
17
|
stopDaemonService
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-ZH7TWAYK.js";
|
|
19
19
|
import {
|
|
20
20
|
detectProviderLiveCapabilities,
|
|
21
21
|
hasSpawnProvider,
|
|
@@ -29,14 +29,14 @@ import {
|
|
|
29
29
|
npmErrorMessage,
|
|
30
30
|
resolveGlobalBinary
|
|
31
31
|
} from "../chunk-PZA7G4CN.js";
|
|
32
|
-
import "../chunk-
|
|
32
|
+
import "../chunk-2M66JVZM.js";
|
|
33
33
|
import {
|
|
34
34
|
claudeJson,
|
|
35
35
|
codexConfigToml,
|
|
36
36
|
cursorPluginDir,
|
|
37
37
|
geminiSettings,
|
|
38
38
|
vscodePluginDir
|
|
39
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-GMI5QZLG.js";
|
|
40
40
|
import {
|
|
41
41
|
readControlMode
|
|
42
42
|
} from "../chunk-L3YUHEB6.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detectClaudeVersion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J2JZJZKB.js";
|
|
4
4
|
import {
|
|
5
5
|
claudeWired,
|
|
6
6
|
codexWired,
|
|
7
7
|
geminiWired
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BAE45YLP.js";
|
|
9
9
|
import {
|
|
10
10
|
GEMINI_HOOK_BINARY,
|
|
11
11
|
addClaudeMcpServer,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
addPusharyHooks,
|
|
15
15
|
addPusharyToolPermissions,
|
|
16
16
|
hasGeminiHooks
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VA7VUNRD.js";
|
|
18
18
|
import {
|
|
19
19
|
guardBinary
|
|
20
20
|
} from "./chunk-AIGDBRIJ.js";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
codexHooksJson,
|
|
33
33
|
hasCodexHooks,
|
|
34
34
|
vscodePluginMcp
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-GMI5QZLG.js";
|
|
36
36
|
import {
|
|
37
37
|
readJsonSafe
|
|
38
38
|
} from "./chunk-6MTNS63X.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
readLastUserPrompt,
|
|
18
18
|
repoKeyFor,
|
|
19
19
|
throttlePass
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-BPKMGE7L.js";
|
|
21
21
|
import {
|
|
22
22
|
DEFAULT_SESSION,
|
|
23
23
|
askUser,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "./chunk-KOPUTJQC.js";
|
|
37
37
|
import {
|
|
38
38
|
getMachineId
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-2M66JVZM.js";
|
|
40
40
|
import {
|
|
41
41
|
getApiKey,
|
|
42
42
|
getBaseUrl
|
|
@@ -8,6 +8,10 @@ import { createHash } from "crypto";
|
|
|
8
8
|
import { homedir } from "os";
|
|
9
9
|
import { join } from "path";
|
|
10
10
|
|
|
11
|
+
// src/removal-scope.ts
|
|
12
|
+
var namesAppLocator = (command) => command.includes(HOOK_LOCATOR_BINARY);
|
|
13
|
+
var isProtectedByScope = (command, scope) => scope?.keepAppWiring === true && namesAppLocator(command);
|
|
14
|
+
|
|
11
15
|
// src/canonical-json.ts
|
|
12
16
|
var canonicalJson = (value) => {
|
|
13
17
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
@@ -77,13 +81,14 @@ var readCodexMcpAuth = (config) => {
|
|
|
77
81
|
if (typeof pushary.bearer_token === "string") return { method: "legacy-bearer" };
|
|
78
82
|
return void 0;
|
|
79
83
|
};
|
|
80
|
-
var isPusharyCommand = (hook) => {
|
|
84
|
+
var isPusharyCommand = (hook, scope) => {
|
|
81
85
|
const command = String(asRecord(hook)?.command ?? "");
|
|
86
|
+
if (isProtectedByScope(command, scope)) return false;
|
|
82
87
|
return command.includes(CODEX_HOOK_BINARY) || command.includes(HOOK_LOCATOR_BINARY);
|
|
83
88
|
};
|
|
84
|
-
var isPusharyCodexHook = (entry) => {
|
|
89
|
+
var isPusharyCodexHook = (entry, scope) => {
|
|
85
90
|
const hooks = asRecord(entry)?.hooks;
|
|
86
|
-
return Array.isArray(hooks) && hooks.some(isPusharyCommand);
|
|
91
|
+
return Array.isArray(hooks) && hooks.some((hook) => isPusharyCommand(hook, scope));
|
|
87
92
|
};
|
|
88
93
|
var addCodexHooks = (config, command) => {
|
|
89
94
|
const hooks = ensureRecord(config, "hooks");
|
|
@@ -102,14 +107,14 @@ var addCodexHooks = (config, command) => {
|
|
|
102
107
|
hooks[definition.event] = entries;
|
|
103
108
|
}
|
|
104
109
|
};
|
|
105
|
-
var removeCodexHooks = (config) => {
|
|
110
|
+
var removeCodexHooks = (config, scope) => {
|
|
106
111
|
const hooks = asRecord(config.hooks);
|
|
107
112
|
if (!hooks) return false;
|
|
108
113
|
let changed = false;
|
|
109
114
|
for (const definition of CODEX_HOOK_EVENTS) {
|
|
110
115
|
const entries = hooks[definition.event];
|
|
111
116
|
if (!Array.isArray(entries)) continue;
|
|
112
|
-
const filtered = entries.filter((entry) => !isPusharyCodexHook(entry));
|
|
117
|
+
const filtered = entries.filter((entry) => !isPusharyCodexHook(entry, scope));
|
|
113
118
|
if (filtered.length !== entries.length) {
|
|
114
119
|
if (filtered.length === 0) {
|
|
115
120
|
delete hooks[definition.event];
|
|
@@ -127,14 +132,14 @@ var hasCodexHooks = (config) => {
|
|
|
127
132
|
if (!hooks) return false;
|
|
128
133
|
return CODEX_HOOK_EVENTS.some((definition) => {
|
|
129
134
|
const entries = hooks[definition.event];
|
|
130
|
-
return Array.isArray(entries) && entries.some(isPusharyCodexHook);
|
|
135
|
+
return Array.isArray(entries) && entries.some((entry) => isPusharyCodexHook(entry));
|
|
131
136
|
});
|
|
132
137
|
};
|
|
133
138
|
var missingCodexHookEvents = (config) => {
|
|
134
139
|
const hooks = asRecord(config.hooks);
|
|
135
140
|
return CODEX_HOOK_EVENTS.filter((definition) => {
|
|
136
141
|
const entries = hooks?.[definition.event];
|
|
137
|
-
return !Array.isArray(entries) || !entries.some(isPusharyCodexHook);
|
|
142
|
+
return !Array.isArray(entries) || !entries.some((entry) => isPusharyCodexHook(entry));
|
|
138
143
|
}).map((definition) => definition.event);
|
|
139
144
|
};
|
|
140
145
|
var codexHookTrustHash = (definition, command) => {
|
|
@@ -176,10 +181,10 @@ var codexHookPositions = (hooksConfig) => {
|
|
|
176
181
|
for (const definition of CODEX_HOOK_EVENTS) {
|
|
177
182
|
const entries = hooks?.[definition.event];
|
|
178
183
|
if (!Array.isArray(entries)) continue;
|
|
179
|
-
const entryIndex = entries.findIndex(isPusharyCodexHook);
|
|
184
|
+
const entryIndex = entries.findIndex((entry) => isPusharyCodexHook(entry));
|
|
180
185
|
if (entryIndex < 0) continue;
|
|
181
186
|
const inner = asRecord(entries[entryIndex])?.hooks;
|
|
182
|
-
const hookIndex = Array.isArray(inner) ? inner.findIndex(isPusharyCommand) : -1;
|
|
187
|
+
const hookIndex = Array.isArray(inner) ? inner.findIndex((hook) => isPusharyCommand(hook)) : -1;
|
|
183
188
|
positions[definition.event] = [entryIndex, Math.max(hookIndex, 0)];
|
|
184
189
|
}
|
|
185
190
|
return positions;
|
|
@@ -270,6 +275,7 @@ var geminiMd = () => join2(homedir2(), ".gemini", "GEMINI.md");
|
|
|
270
275
|
var pusharyConfigFile = () => join2(homedir2(), ".pushary", "config.json");
|
|
271
276
|
|
|
272
277
|
export {
|
|
278
|
+
isProtectedByScope,
|
|
273
279
|
canonicalJson,
|
|
274
280
|
CODEX_HOOK_BINARY,
|
|
275
281
|
codexHome,
|
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
guardBinary
|
|
7
7
|
} from "./chunk-AIGDBRIJ.js";
|
|
8
|
+
import {
|
|
9
|
+
isProtectedByScope
|
|
10
|
+
} from "./chunk-GMI5QZLG.js";
|
|
8
11
|
import {
|
|
9
12
|
HOOK_BUDGETS,
|
|
10
13
|
HOOK_LOCATOR_BINARY
|
|
@@ -73,10 +76,14 @@ var HOOK_BINARIES = /* @__PURE__ */ new Set([
|
|
|
73
76
|
HOOK_LOCATOR_BINARY
|
|
74
77
|
]);
|
|
75
78
|
var namesPusharyBinary = (command) => command.split(/[\s/\\"']+/).some((segment) => HOOK_BINARIES.has(segment.replace(/\.(cmd|exe)$/i, "")));
|
|
76
|
-
var isPusharyHook = (entry2) => {
|
|
79
|
+
var isPusharyHook = (entry2, scope) => {
|
|
77
80
|
const hooks = asRecord(entry2)?.hooks;
|
|
78
81
|
if (!Array.isArray(hooks)) return false;
|
|
79
|
-
return hooks.some((hook) =>
|
|
82
|
+
return hooks.some((hook) => {
|
|
83
|
+
const command = String(asRecord(hook)?.command ?? "");
|
|
84
|
+
if (isProtectedByScope(command, scope)) return false;
|
|
85
|
+
return namesPusharyBinary(command);
|
|
86
|
+
});
|
|
80
87
|
};
|
|
81
88
|
var addClaudeMcpServer = (config, apiKey) => {
|
|
82
89
|
const mcpServers = ensureRecord(config, "mcpServers");
|
|
@@ -139,9 +146,9 @@ var entry = (definition, resolve) => ({
|
|
|
139
146
|
timeout: definition.timeout
|
|
140
147
|
}]
|
|
141
148
|
});
|
|
142
|
-
var removePusharySettings = (settings) => {
|
|
143
|
-
let changed = removeClaudeMcpServers(settings);
|
|
144
|
-
const permissions = asRecord(settings.permissions);
|
|
149
|
+
var removePusharySettings = (settings, scope) => {
|
|
150
|
+
let changed = scope?.keepMcpServer === true ? false : removeClaudeMcpServers(settings);
|
|
151
|
+
const permissions = scope?.keepMcpServer === true ? void 0 : asRecord(settings.permissions);
|
|
145
152
|
if (permissions && Array.isArray(permissions.allow)) {
|
|
146
153
|
const filtered = permissions.allow.filter((rule) => !isPusharyPermission(rule));
|
|
147
154
|
if (filtered.length !== permissions.allow.length) {
|
|
@@ -159,7 +166,7 @@ var removePusharySettings = (settings) => {
|
|
|
159
166
|
for (const { event: key } of CLAUDE_HOOK_EVENTS) {
|
|
160
167
|
const entries = hooks[key];
|
|
161
168
|
if (!Array.isArray(entries)) continue;
|
|
162
|
-
const filtered = entries.filter((entry2) => !isPusharyHook(entry2));
|
|
169
|
+
const filtered = entries.filter((entry2) => !isPusharyHook(entry2, scope));
|
|
163
170
|
if (filtered.length !== entries.length) {
|
|
164
171
|
if (filtered.length === 0) {
|
|
165
172
|
delete hooks[key];
|
|
@@ -192,11 +199,12 @@ var ensureRecord2 = (target, key) => {
|
|
|
192
199
|
target[key] = created;
|
|
193
200
|
return created;
|
|
194
201
|
};
|
|
195
|
-
var isPusharyGeminiHook = (entry2) => {
|
|
202
|
+
var isPusharyGeminiHook = (entry2, scope) => {
|
|
196
203
|
const hooks = asRecord2(entry2)?.hooks;
|
|
197
204
|
if (!Array.isArray(hooks)) return false;
|
|
198
205
|
return hooks.some((hook) => {
|
|
199
206
|
const command = String(asRecord2(hook)?.command ?? "");
|
|
207
|
+
if (isProtectedByScope(command, scope)) return false;
|
|
200
208
|
return command.includes(GEMINI_HOOK_BINARY) || command.includes(HOOK_LOCATOR_BINARY);
|
|
201
209
|
});
|
|
202
210
|
};
|
|
@@ -225,14 +233,14 @@ var addGeminiHooks = (settings, command) => {
|
|
|
225
233
|
hooks[definition.event] = entries;
|
|
226
234
|
}
|
|
227
235
|
};
|
|
228
|
-
var removeGeminiHooks = (settings) => {
|
|
236
|
+
var removeGeminiHooks = (settings, scope) => {
|
|
229
237
|
const hooks = asRecord2(settings.hooks);
|
|
230
238
|
if (!hooks) return false;
|
|
231
239
|
let changed = false;
|
|
232
240
|
for (const definition of GEMINI_HOOK_EVENTS) {
|
|
233
241
|
const entries = hooks[definition.event];
|
|
234
242
|
if (!Array.isArray(entries)) continue;
|
|
235
|
-
const filtered = entries.filter((entry2) => !isPusharyGeminiHook(entry2));
|
|
243
|
+
const filtered = entries.filter((entry2) => !isPusharyGeminiHook(entry2, scope));
|
|
236
244
|
if (filtered.length !== entries.length) {
|
|
237
245
|
if (filtered.length === 0) {
|
|
238
246
|
delete hooks[definition.event];
|
|
@@ -252,9 +260,9 @@ var removeGeminiMcpServer = (settings) => {
|
|
|
252
260
|
if (Object.keys(mcpServers).length === 0) delete settings.mcpServers;
|
|
253
261
|
return true;
|
|
254
262
|
};
|
|
255
|
-
var removeGeminiSettings = (settings) => {
|
|
256
|
-
const mcpRemoved = removeGeminiMcpServer(settings);
|
|
257
|
-
const hooksRemoved = removeGeminiHooks(settings);
|
|
263
|
+
var removeGeminiSettings = (settings, scope) => {
|
|
264
|
+
const mcpRemoved = scope?.keepMcpServer === true ? false : removeGeminiMcpServer(settings);
|
|
265
|
+
const hooksRemoved = removeGeminiHooks(settings, scope);
|
|
258
266
|
return mcpRemoved || hooksRemoved;
|
|
259
267
|
};
|
|
260
268
|
var hasGeminiHooks = (settings) => {
|
|
@@ -262,14 +270,14 @@ var hasGeminiHooks = (settings) => {
|
|
|
262
270
|
if (!hooks) return false;
|
|
263
271
|
return GEMINI_HOOK_EVENTS.some((definition) => {
|
|
264
272
|
const entries = hooks[definition.event];
|
|
265
|
-
return Array.isArray(entries) && entries.some(isPusharyGeminiHook);
|
|
273
|
+
return Array.isArray(entries) && entries.some((entry2) => isPusharyGeminiHook(entry2));
|
|
266
274
|
});
|
|
267
275
|
};
|
|
268
276
|
var missingGeminiHookEvents = (settings) => {
|
|
269
277
|
const hooks = asRecord2(settings.hooks);
|
|
270
278
|
return GEMINI_HOOK_EVENTS.filter((definition) => {
|
|
271
279
|
const entries = hooks?.[definition.event];
|
|
272
|
-
return !Array.isArray(entries) || !entries.some(isPusharyGeminiHook);
|
|
280
|
+
return !Array.isArray(entries) || !entries.some((entry2) => isPusharyGeminiHook(entry2));
|
|
273
281
|
}).map((definition) => definition.event);
|
|
274
282
|
};
|
|
275
283
|
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "./chunk-PZA7G4CN.js";
|
|
8
8
|
import {
|
|
9
9
|
getMachineId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2M66JVZM.js";
|
|
11
11
|
import {
|
|
12
12
|
pusharyDir
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GMI5QZLG.js";
|
|
14
14
|
import {
|
|
15
15
|
getPackageVersion
|
|
16
16
|
} from "./chunk-DINDL2CF.js";
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handlePreToolUse
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-5YUVKPTS.js";
|
|
4
4
|
import "../chunk-ATBKJNWS.js";
|
|
5
5
|
import "../chunk-VZKXBFUA.js";
|
|
6
6
|
import "../chunk-YHG74UFF.js";
|
|
@@ -12,15 +12,15 @@ import {
|
|
|
12
12
|
handlePostToolUse,
|
|
13
13
|
handleStop,
|
|
14
14
|
reportEvent
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-BPKMGE7L.js";
|
|
16
16
|
import {
|
|
17
17
|
askUser,
|
|
18
18
|
cancelQuestion,
|
|
19
19
|
waitForAnswer
|
|
20
20
|
} from "../chunk-GKAKAOKC.js";
|
|
21
21
|
import "../chunk-KOPUTJQC.js";
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
22
|
+
import "../chunk-2M66JVZM.js";
|
|
23
|
+
import "../chunk-GMI5QZLG.js";
|
|
24
24
|
import "../chunk-BSZYIAZL.js";
|
|
25
25
|
import "../chunk-SAF6HGAA.js";
|
|
26
26
|
import "../chunk-OFRNZWC4.js";
|