@pushary/agent-hooks 0.84.0 → 0.85.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +24 -0
  3. package/dist/bin/pushary-bell-hook.js +5 -3
  4. package/dist/bin/pushary-bell.js +8 -7
  5. package/dist/bin/pushary-claude.js +29 -20
  6. package/dist/bin/pushary-clean.js +6 -5
  7. package/dist/bin/pushary-codex-bridge.js +8 -7
  8. package/dist/bin/pushary-codex-hook.js +11 -14
  9. package/dist/bin/pushary-codex.js +1 -1
  10. package/dist/bin/pushary-connect.js +5 -5
  11. package/dist/bin/pushary-daemon.js +36 -18
  12. package/dist/bin/pushary-disconnect.d.ts +1 -0
  13. package/dist/bin/pushary-disconnect.js +125 -0
  14. package/dist/bin/pushary-doctor.js +9 -9
  15. package/dist/bin/pushary-gemini-bridge.js +8 -7
  16. package/dist/bin/pushary-gemini-hook.js +12 -15
  17. package/dist/bin/pushary-hook.js +13 -20
  18. package/dist/bin/pushary-login.js +2 -2
  19. package/dist/bin/pushary-logout.js +3 -3
  20. package/dist/bin/pushary-mode.js +2 -2
  21. package/dist/bin/pushary-notification-hook.js +6 -9
  22. package/dist/bin/pushary-permission-denied-hook.js +11 -9
  23. package/dist/bin/pushary-permission-hook.js +11 -9
  24. package/dist/bin/pushary-post-hook.js +6 -9
  25. package/dist/bin/pushary-prompt-hook.js +6 -9
  26. package/dist/bin/pushary-session-end-hook.js +6 -6
  27. package/dist/bin/pushary-session-start-hook.js +6 -6
  28. package/dist/bin/pushary-setup.js +23 -24
  29. package/dist/bin/pushary-stats.js +2 -2
  30. package/dist/bin/pushary-status.js +2 -2
  31. package/dist/bin/pushary-stop-hook.js +6 -6
  32. package/dist/bin/pushary-stopfailure-hook.js +6 -6
  33. package/dist/bin/pushary-suggestions.js +2 -2
  34. package/dist/bin/pushary-upgrade.js +13 -8
  35. package/dist/bin/pushary-wait.js +2 -2
  36. package/dist/bin/pushary.js +2 -1
  37. package/dist/{chunk-HZNOAJGB.js → chunk-4QPOMJUB.js} +1 -1
  38. package/dist/chunk-64PXDATC.js +187 -0
  39. package/dist/chunk-6CUUA7HO.js +59 -0
  40. package/dist/{chunk-UXWEE3QI.js → chunk-ADISVXZL.js} +1 -1
  41. package/dist/chunk-AXRATIS6.js +70 -0
  42. package/dist/{chunk-YJCMI5GF.js → chunk-ERYKGH4J.js} +11 -4
  43. package/dist/{chunk-OPMSMF5R.js → chunk-EXMUM226.js} +21 -8
  44. package/dist/{chunk-NWYGW7HY.js → chunk-GCKAWHFP.js} +9 -2
  45. package/dist/{chunk-QNBA5OXQ.js → chunk-GFM3STWO.js} +3 -3
  46. package/dist/{chunk-MGJBC6DD.js → chunk-GOEXZ5QJ.js} +1 -0
  47. package/dist/{chunk-37AD5K7W.js → chunk-GXIFADGD.js} +1 -1
  48. package/dist/{chunk-SEAHGHCE.js → chunk-HVZIHTOO.js} +33 -0
  49. package/dist/chunk-PWTKKQQI.js +27 -0
  50. package/dist/{chunk-J4KFVOCQ.js → chunk-SQOFGPNX.js} +1 -1
  51. package/dist/{chunk-CCH775Y6.js → chunk-WEAQQSHQ.js} +1 -1
  52. package/dist/{chunk-EVJ6ULHN.js → chunk-YKW6JCWI.js} +68 -29
  53. package/dist/src/index.d.ts +1 -1
  54. package/dist/src/index.js +6 -4
  55. package/package.json +3 -2
  56. package/dist/chunk-UKSQWTBH.js +0 -208
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ removeGeminiSettings
4
+ } from "../chunk-DOXSWT4Q.js";
5
+ import {
6
+ removeClaudeMcpServers,
7
+ removePusharySettings
8
+ } from "../chunk-64PXDATC.js";
9
+ import "../chunk-PWTKKQQI.js";
10
+ import "../chunk-VT4IVERX.js";
11
+ import {
12
+ claudeJson,
13
+ claudeSettings,
14
+ claudeSettingsLocal,
15
+ codexConfigToml,
16
+ codexHooksJson,
17
+ cursorUserHooks,
18
+ cursorUserMcp,
19
+ geminiSettings,
20
+ removeCodexHooks,
21
+ removeCodexSettings
22
+ } from "../chunk-HVZIHTOO.js";
23
+ import {
24
+ exitOnHelpFlag
25
+ } from "../chunk-SQOFGPNX.js";
26
+ import "../chunk-GOEXZ5QJ.js";
27
+ import "../chunk-DINDL2CF.js";
28
+ import "../chunk-KZERVKTD.js";
29
+ import "../chunk-MQMPG5X4.js";
30
+
31
+ // bin/pushary-disconnect.ts
32
+ import { readFileSync, writeFileSync } from "fs";
33
+ import { parse as parseTOML, stringify as stringifyTOML } from "smol-toml";
34
+
35
+ // src/disconnect.ts
36
+ var DISCONNECTABLE_AGENTS = ["claude", "codex", "gemini", "cursor"];
37
+ var isDisconnectableAgent = (value) => DISCONNECTABLE_AGENTS.includes(value);
38
+ var removeCursorHooks = (config) => {
39
+ const hooks = config.hooks;
40
+ if (!hooks) return false;
41
+ let changed = false;
42
+ for (const [event, entries] of Object.entries(hooks)) {
43
+ if (!Array.isArray(entries)) continue;
44
+ const kept = entries.filter((entry) => !String(entry?.command ?? "").includes("pushary"));
45
+ if (kept.length === entries.length) continue;
46
+ changed = true;
47
+ if (kept.length === 0) delete hooks[event];
48
+ else hooks[event] = kept;
49
+ }
50
+ if (changed && Object.keys(hooks).length === 0) delete config.hooks;
51
+ return changed;
52
+ };
53
+ var disconnectPlan = (agent) => {
54
+ switch (agent) {
55
+ case "claude":
56
+ return [
57
+ { path: claudeSettings(), format: "json", remove: removePusharySettings },
58
+ { path: claudeSettingsLocal(), format: "json", remove: removePusharySettings },
59
+ { path: claudeJson(), format: "json", remove: removeClaudeMcpServers }
60
+ ];
61
+ case "codex":
62
+ return [
63
+ { path: codexHooksJson(), format: "json", remove: removeCodexHooks },
64
+ { path: codexConfigToml(), format: "toml", remove: (config) => removeCodexSettings(config, codexHooksJson()) }
65
+ ];
66
+ case "gemini":
67
+ return [{ path: geminiSettings(), format: "json", remove: removeGeminiSettings }];
68
+ case "cursor":
69
+ return [
70
+ { path: cursorUserHooks(), format: "json", remove: removeCursorHooks },
71
+ { path: cursorUserMcp(), format: "json", remove: removeClaudeMcpServers }
72
+ ];
73
+ }
74
+ };
75
+ var disconnectAgent = (agent, io) => {
76
+ const changed = [];
77
+ const untouched = [];
78
+ for (const edit of disconnectPlan(agent)) {
79
+ const raw = io.read(edit.path);
80
+ if (raw === null) continue;
81
+ try {
82
+ const config = edit.format === "toml" ? io.parseToml(raw) : JSON.parse(raw);
83
+ if (!edit.remove(config)) {
84
+ untouched.push(edit.path);
85
+ continue;
86
+ }
87
+ io.write(
88
+ edit.path,
89
+ edit.format === "toml" ? io.stringifyToml(config) : `${JSON.stringify(config, null, 2)}
90
+ `
91
+ );
92
+ changed.push(edit.path);
93
+ } catch {
94
+ untouched.push(edit.path);
95
+ }
96
+ }
97
+ return { agent, changed, untouched };
98
+ };
99
+
100
+ // bin/pushary-disconnect.ts
101
+ exitOnHelpFlag("disconnect");
102
+ var rest = process.argv.slice(2);
103
+ var requested = rest[0] === "disconnect" ? rest[1] : rest[0];
104
+ if (!requested || !isDisconnectableAgent(requested)) {
105
+ console.error(`Usage: pushary disconnect <${DISCONNECTABLE_AGENTS.join("|")}>`);
106
+ process.exit(1);
107
+ }
108
+ var result = disconnectAgent(requested, {
109
+ read: (path) => {
110
+ try {
111
+ return readFileSync(path, "utf-8");
112
+ } catch {
113
+ return null;
114
+ }
115
+ },
116
+ write: (path, contents) => writeFileSync(path, contents, "utf-8"),
117
+ parseToml: (raw) => parseTOML(raw),
118
+ stringifyToml: (config) => stringifyTOML(config)
119
+ });
120
+ if (result.changed.length === 0) {
121
+ console.log(`${requested} was not connected.`);
122
+ } else {
123
+ console.log(`Disconnected ${requested}:`);
124
+ for (const path of result.changed) console.log(` ${path}`);
125
+ }
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- describeWaitLadder
4
- } from "../chunk-IIENZE2J.js";
5
2
  import {
6
3
  claudeWired,
7
4
  codexWired,
8
5
  geminiWired
9
- } from "../chunk-HZNOAJGB.js";
6
+ } from "../chunk-4QPOMJUB.js";
7
+ import {
8
+ describeWaitLadder
9
+ } from "../chunk-IIENZE2J.js";
10
10
  import {
11
11
  readDaemonStatus
12
- } from "../chunk-CCH775Y6.js";
12
+ } from "../chunk-WEAQQSHQ.js";
13
13
  import {
14
14
  agentProbes,
15
15
  detectAgent,
@@ -18,7 +18,7 @@ import {
18
18
  isDetected,
19
19
  isPluginRegistered,
20
20
  vscodeSettingsTargets
21
- } from "../chunk-UXWEE3QI.js";
21
+ } from "../chunk-ADISVXZL.js";
22
22
  import {
23
23
  GEMINI_HOOK_BINARY,
24
24
  hasGeminiHooks,
@@ -46,7 +46,7 @@ import {
46
46
  readCodexMcpAuth,
47
47
  untrustedCodexHookEvents,
48
48
  vscodePluginDir
49
- } from "../chunk-SEAHGHCE.js";
49
+ } from "../chunk-HVZIHTOO.js";
50
50
  import {
51
51
  readLedgerSummary
52
52
  } from "../chunk-NJ7JT26G.js";
@@ -77,8 +77,8 @@ import {
77
77
  } from "../chunk-GMXKITVA.js";
78
78
  import {
79
79
  exitOnHelpFlag
80
- } from "../chunk-J4KFVOCQ.js";
81
- import "../chunk-MGJBC6DD.js";
80
+ } from "../chunk-SQOFGPNX.js";
81
+ import "../chunk-GOEXZ5QJ.js";
82
82
  import "../chunk-BC3VCZ3E.js";
83
83
  import {
84
84
  getPackageVersion
@@ -5,18 +5,19 @@ import {
5
5
  postLiveSession,
6
6
  postLiveSessionUntilAccepted,
7
7
  startLiveSessionHeartbeat
8
- } from "../chunk-YJCMI5GF.js";
9
- import "../chunk-NWYGW7HY.js";
8
+ } from "../chunk-ERYKGH4J.js";
9
+ import "../chunk-GCKAWHFP.js";
10
10
  import {
11
- startProcessOwnership
12
- } from "../chunk-EVJ6ULHN.js";
11
+ startProcessOwnership,
12
+ withSpawnProcessOwnership
13
+ } from "../chunk-YKW6JCWI.js";
13
14
  import {
14
15
  spawnClaude
15
16
  } from "../chunk-XHKBHWLX.js";
16
17
  import {
17
18
  resolveBinary
18
19
  } from "../chunk-VT4IVERX.js";
19
- import "../chunk-SEAHGHCE.js";
20
+ import "../chunk-HVZIHTOO.js";
20
21
  import {
21
22
  getMachineId
22
23
  } from "../chunk-RN3NOEJF.js";
@@ -280,7 +281,7 @@ var abort = new AbortController();
280
281
  var signals = process.platform === "win32" ? ["SIGINT", "SIGTERM"] : ["SIGINT", "SIGTERM", "SIGHUP"];
281
282
  var stop = () => abort.abort();
282
283
  for (const signal of signals) process.on(signal, stop);
283
- var outcome = await runGeminiBridge({
284
+ var outcome = await withSpawnProcessOwnership(spawnId, () => runGeminiBridge({
284
285
  apiKey: getApiKey(),
285
286
  baseUrl: getBaseUrl(),
286
287
  machineId: getMachineId(),
@@ -293,6 +294,6 @@ var outcome = await runGeminiBridge({
293
294
  command: { command: process.env.PUSHARY_GEMINI_COMMAND?.trim() || resolveBinary("gemini") || "gemini" },
294
295
  signal: abort.signal,
295
296
  transcripts: process.env.PUSHARY_TRANSCRIPTS === "1"
296
- });
297
+ }));
297
298
  for (const signal of signals) process.off(signal, stop);
298
299
  process.exit(outcome === "stopped" ? 0 : 1);
@@ -3,12 +3,15 @@ import {
3
3
  isGatingMoment,
4
4
  recordKeylessMoment
5
5
  } from "../chunk-NJ7JT26G.js";
6
+ import {
7
+ readHookInput
8
+ } from "../chunk-6CUUA7HO.js";
6
9
  import {
7
10
  KILL_REASON,
8
11
  denyReasonFrom,
9
12
  isDeferAnswer,
10
13
  resolveGate
11
- } from "../chunk-37AD5K7W.js";
14
+ } from "../chunk-GXIFADGD.js";
12
15
  import {
13
16
  DEFAULT_SESSION,
14
17
  askUser,
@@ -22,6 +25,7 @@ import {
22
25
  handlePostToolUse,
23
26
  handleStop,
24
27
  handleUserPrompt,
28
+ policyRequestFor,
25
29
  readLastPrompt,
26
30
  readLastUserPrompt,
27
31
  repoKeyFor,
@@ -30,7 +34,7 @@ import {
30
34
  scopePathFor,
31
35
  sendNotification,
32
36
  waitForAnswer
33
- } from "../chunk-OPMSMF5R.js";
37
+ } from "../chunk-EXMUM226.js";
34
38
  import {
35
39
  getMachineId
36
40
  } from "../chunk-RN3NOEJF.js";
@@ -127,7 +131,8 @@ var pushQuestion = async (apiKey, input, lookup, waitSeconds, mode, pollInterval
127
131
  intent: readLastPrompt(input.session_id || DEFAULT_SESSION) ?? (input.transcript_path ? readLastUserPrompt(input.transcript_path) : void 0),
128
132
  action: description.slice(0, DECISION_LINE_MAX),
129
133
  blocker: deriveBlocker(mode),
130
- actionBody: deriveActionBody(input.tool_name ?? "", input.tool_input ?? {})
134
+ actionBody: deriveActionBody(input.tool_name ?? "", input.tool_input ?? {}),
135
+ repoKey: repoKeyFor(input.cwd)
131
136
  });
132
137
  if (result.suppressed || result.noDevices) {
133
138
  return {
@@ -219,8 +224,9 @@ var decideBeforeTool = async (input) => {
219
224
  }
220
225
  try {
221
226
  const modeState = await fetchModeState(apiKey, input.session_id);
227
+ const policyRequest = policyRequestFor("gemini_cli");
222
228
  const lookup = toGeminiPolicyLookup(input.tool_name ?? "", input.tool_input ?? {}, input.cwd);
223
- const config = await getPolicy(apiKey, modeState.policyVersion, "gemini_cli", false, input.session_id);
229
+ const config = await getPolicy(apiKey, modeState.policyVersion, policyRequest.agent, policyRequest.repoAware, input.session_id);
224
230
  const scopePath = modeState.scope ? scopePathFor(lookup.tool, lookup.input, input.cwd) : void 0;
225
231
  const verdict = resolveGate({
226
232
  modeState,
@@ -275,17 +281,8 @@ var emit = (wire) => {
275
281
  if (wire) process.stdout.write(JSON.stringify(wire));
276
282
  };
277
283
  var main = async () => {
278
- let rawInput = "";
279
- for await (const chunk of process.stdin) {
280
- rawInput += chunk;
281
- }
282
- if (!rawInput.trim()) {
283
- process.exit(0);
284
- }
285
- let input;
286
- try {
287
- input = JSON.parse(rawInput);
288
- } catch {
284
+ const input = await readHookInput("gemini");
285
+ if (!input) {
289
286
  process.exit(0);
290
287
  }
291
288
  try {
@@ -1,16 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  handlePreToolUse
4
- } from "../chunk-QNBA5OXQ.js";
5
- import "../chunk-UKSQWTBH.js";
4
+ } from "../chunk-GFM3STWO.js";
5
+ import "../chunk-64PXDATC.js";
6
+ import "../chunk-PWTKKQQI.js";
7
+ import "../chunk-VT4IVERX.js";
6
8
  import "../chunk-NJ7JT26G.js";
7
- import "../chunk-37AD5K7W.js";
8
- import "../chunk-OPMSMF5R.js";
9
+ import {
10
+ readHookInput
11
+ } from "../chunk-6CUUA7HO.js";
12
+ import "../chunk-GXIFADGD.js";
13
+ import "../chunk-EXMUM226.js";
9
14
  import "../chunk-RN3NOEJF.js";
10
15
  import {
11
16
  exitOnHelpFlag
12
- } from "../chunk-J4KFVOCQ.js";
13
- import "../chunk-MGJBC6DD.js";
17
+ } from "../chunk-SQOFGPNX.js";
18
+ import "../chunk-GOEXZ5QJ.js";
14
19
  import "../chunk-DINDL2CF.js";
15
20
  import "../chunk-BSZYIAZL.js";
16
21
  import "../chunk-SAF6HGAA.js";
@@ -23,20 +28,8 @@ import "../chunk-MQMPG5X4.js";
23
28
  // bin/pushary-hook.ts
24
29
  exitOnHelpFlag("hook");
25
30
  var main = async () => {
26
- let rawInput = "";
27
- for await (const chunk of process.stdin) {
28
- rawInput += chunk;
29
- }
30
- if (!rawInput.trim()) {
31
- process.exit(0);
32
- }
33
- let input;
34
- try {
35
- input = JSON.parse(rawInput);
36
- } catch {
37
- process.exit(0);
38
- }
39
- if (!input.tool_name) {
31
+ const input = await readHookInput("claude", "PreToolUse");
32
+ if (!input?.tool_name) {
40
33
  process.exit(0);
41
34
  }
42
35
  try {
@@ -19,8 +19,8 @@ import {
19
19
  } from "../chunk-GMXKITVA.js";
20
20
  import {
21
21
  exitOnHelpFlag
22
- } from "../chunk-J4KFVOCQ.js";
23
- import "../chunk-MGJBC6DD.js";
22
+ } from "../chunk-SQOFGPNX.js";
23
+ import "../chunk-GOEXZ5QJ.js";
24
24
  import "../chunk-BC3VCZ3E.js";
25
25
  import {
26
26
  getPackageVersion
@@ -4,7 +4,7 @@ import {
4
4
  codexConfigToml,
5
5
  cursorUserMcp,
6
6
  geminiSettings
7
- } from "../chunk-SEAHGHCE.js";
7
+ } from "../chunk-HVZIHTOO.js";
8
8
  import {
9
9
  createIo
10
10
  } from "../chunk-5RUIFDTP.js";
@@ -17,8 +17,8 @@ import {
17
17
  } from "../chunk-GMXKITVA.js";
18
18
  import {
19
19
  exitOnHelpFlag
20
- } from "../chunk-J4KFVOCQ.js";
21
- import "../chunk-MGJBC6DD.js";
20
+ } from "../chunk-SQOFGPNX.js";
21
+ import "../chunk-GOEXZ5QJ.js";
22
22
  import "../chunk-BC3VCZ3E.js";
23
23
  import "../chunk-DINDL2CF.js";
24
24
  import "../chunk-6MTNS63X.js";
@@ -11,8 +11,8 @@ import {
11
11
  } from "../chunk-GMXKITVA.js";
12
12
  import {
13
13
  exitOnHelpFlag
14
- } from "../chunk-J4KFVOCQ.js";
15
- import "../chunk-MGJBC6DD.js";
14
+ } from "../chunk-SQOFGPNX.js";
15
+ import "../chunk-GOEXZ5QJ.js";
16
16
  import "../chunk-DINDL2CF.js";
17
17
  import "../chunk-SAF6HGAA.js";
18
18
  import {
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ readHookInput
4
+ } from "../chunk-6CUUA7HO.js";
2
5
  import {
3
6
  handleNotification
4
- } from "../chunk-OPMSMF5R.js";
7
+ } from "../chunk-EXMUM226.js";
5
8
  import "../chunk-RN3NOEJF.js";
6
9
  import "../chunk-BSZYIAZL.js";
7
10
  import "../chunk-SAF6HGAA.js";
@@ -13,15 +16,9 @@ import "../chunk-MQMPG5X4.js";
13
16
 
14
17
  // bin/pushary-notification-hook.ts
15
18
  var main = async () => {
16
- let rawInput = "";
17
- for await (const chunk of process.stdin) {
18
- rawInput += chunk;
19
- }
20
- if (!rawInput.trim()) {
21
- process.exit(0);
22
- }
19
+ const input = await readHookInput("claude", "Notification");
20
+ if (!input) return;
23
21
  try {
24
- const input = JSON.parse(rawInput);
25
22
  await handleNotification(input);
26
23
  } catch {
27
24
  }
@@ -1,11 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  handlePermissionDenied
4
- } from "../chunk-QNBA5OXQ.js";
5
- import "../chunk-UKSQWTBH.js";
4
+ } from "../chunk-GFM3STWO.js";
5
+ import "../chunk-64PXDATC.js";
6
+ import "../chunk-PWTKKQQI.js";
7
+ import "../chunk-VT4IVERX.js";
6
8
  import "../chunk-NJ7JT26G.js";
7
- import "../chunk-37AD5K7W.js";
8
- import "../chunk-OPMSMF5R.js";
9
+ import {
10
+ readHookInput
11
+ } from "../chunk-6CUUA7HO.js";
12
+ import "../chunk-GXIFADGD.js";
13
+ import "../chunk-EXMUM226.js";
9
14
  import "../chunk-RN3NOEJF.js";
10
15
  import "../chunk-BSZYIAZL.js";
11
16
  import "../chunk-SAF6HGAA.js";
@@ -17,12 +22,9 @@ import "../chunk-MQMPG5X4.js";
17
22
 
18
23
  // bin/pushary-permission-denied-hook.ts
19
24
  var main = async () => {
20
- let rawInput = "";
21
- for await (const chunk of process.stdin) {
22
- rawInput += chunk;
23
- }
25
+ const input = await readHookInput("claude", "PermissionDenied");
26
+ if (!input) return;
24
27
  try {
25
- const input = rawInput.trim() ? JSON.parse(rawInput) : {};
26
28
  const output = await handlePermissionDenied(input);
27
29
  if (output) process.stdout.write(JSON.stringify(output));
28
30
  } catch {
@@ -1,11 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  handlePermissionRequest
4
- } from "../chunk-QNBA5OXQ.js";
5
- import "../chunk-UKSQWTBH.js";
4
+ } from "../chunk-GFM3STWO.js";
5
+ import "../chunk-64PXDATC.js";
6
+ import "../chunk-PWTKKQQI.js";
7
+ import "../chunk-VT4IVERX.js";
6
8
  import "../chunk-NJ7JT26G.js";
7
- import "../chunk-37AD5K7W.js";
8
- import "../chunk-OPMSMF5R.js";
9
+ import {
10
+ readHookInput
11
+ } from "../chunk-6CUUA7HO.js";
12
+ import "../chunk-GXIFADGD.js";
13
+ import "../chunk-EXMUM226.js";
9
14
  import "../chunk-RN3NOEJF.js";
10
15
  import "../chunk-BSZYIAZL.js";
11
16
  import "../chunk-SAF6HGAA.js";
@@ -17,12 +22,9 @@ import "../chunk-MQMPG5X4.js";
17
22
 
18
23
  // bin/pushary-permission-hook.ts
19
24
  var main = async () => {
20
- let rawInput = "";
21
- for await (const chunk of process.stdin) {
22
- rawInput += chunk;
23
- }
25
+ const input = await readHookInput("claude", "PermissionRequest");
26
+ if (!input) return;
24
27
  try {
25
- const input = rawInput.trim() ? JSON.parse(rawInput) : {};
26
28
  const output = await handlePermissionRequest(input);
27
29
  if (output) process.stdout.write(JSON.stringify(output));
28
30
  } catch {
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ readHookInput
4
+ } from "../chunk-6CUUA7HO.js";
2
5
  import {
3
6
  handlePostToolUse
4
- } from "../chunk-OPMSMF5R.js";
7
+ } from "../chunk-EXMUM226.js";
5
8
  import "../chunk-RN3NOEJF.js";
6
9
  import "../chunk-BSZYIAZL.js";
7
10
  import "../chunk-SAF6HGAA.js";
@@ -13,15 +16,9 @@ import "../chunk-MQMPG5X4.js";
13
16
 
14
17
  // bin/pushary-post-hook.ts
15
18
  var main = async () => {
16
- let rawInput = "";
17
- for await (const chunk of process.stdin) {
18
- rawInput += chunk;
19
- }
20
- if (!rawInput.trim()) {
21
- process.exit(0);
22
- }
19
+ const input = await readHookInput("claude", "PostToolUse");
20
+ if (!input) return;
23
21
  try {
24
- const input = JSON.parse(rawInput);
25
22
  const additionalContext = await handlePostToolUse(input);
26
23
  if (additionalContext) {
27
24
  process.stdout.write(JSON.stringify({
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ readHookInput
4
+ } from "../chunk-6CUUA7HO.js";
2
5
  import {
3
6
  handleUserPrompt
4
- } from "../chunk-OPMSMF5R.js";
7
+ } from "../chunk-EXMUM226.js";
5
8
  import "../chunk-RN3NOEJF.js";
6
9
  import "../chunk-BSZYIAZL.js";
7
10
  import "../chunk-SAF6HGAA.js";
@@ -13,15 +16,9 @@ import "../chunk-MQMPG5X4.js";
13
16
 
14
17
  // bin/pushary-prompt-hook.ts
15
18
  var main = async () => {
16
- let rawInput = "";
17
- for await (const chunk of process.stdin) {
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,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ readHookInput
4
+ } from "../chunk-6CUUA7HO.js";
2
5
  import {
3
6
  handleSessionEnd
4
- } from "../chunk-OPMSMF5R.js";
7
+ } from "../chunk-EXMUM226.js";
5
8
  import "../chunk-RN3NOEJF.js";
6
9
  import "../chunk-BSZYIAZL.js";
7
10
  import "../chunk-SAF6HGAA.js";
@@ -13,12 +16,9 @@ import "../chunk-MQMPG5X4.js";
13
16
 
14
17
  // bin/pushary-session-end-hook.ts
15
18
  var main = async () => {
16
- let rawInput = "";
17
- for await (const chunk of process.stdin) {
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,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ readHookInput
4
+ } from "../chunk-6CUUA7HO.js";
2
5
  import {
3
6
  handleSessionStart
4
- } from "../chunk-OPMSMF5R.js";
7
+ } from "../chunk-EXMUM226.js";
5
8
  import "../chunk-RN3NOEJF.js";
6
9
  import "../chunk-BSZYIAZL.js";
7
10
  import "../chunk-SAF6HGAA.js";
@@ -13,12 +16,9 @@ import "../chunk-MQMPG5X4.js";
13
16
 
14
17
  // bin/pushary-session-start-hook.ts
15
18
  var main = async () => {
16
- let rawInput = "";
17
- for await (const chunk of process.stdin) {
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
  }