@pushary/agent-hooks 0.99.0 → 1.1.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 (84) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/data/SKILL.md +250 -49
  3. package/data/cursor-plugin/scripts/pushary-gate.mjs +24 -0
  4. package/data/cursor-plugin/skills/pushary/SKILL.md +250 -49
  5. package/data/vscode-plugin/scripts/pushary-gate.mjs +24 -0
  6. package/data/vscode-plugin/skills/pushary/SKILL.md +250 -49
  7. package/dist/bin/pushary-bell-hook.js +18 -18
  8. package/dist/bin/pushary-bell.js +6 -6
  9. package/dist/bin/pushary-claude.js +22 -24
  10. package/dist/bin/pushary-clean.js +60 -18
  11. package/dist/bin/pushary-codex-bridge.js +10 -10
  12. package/dist/bin/pushary-codex-hook.js +33 -35
  13. package/dist/bin/pushary-codex.js +6 -7
  14. package/dist/bin/pushary-connect.js +6 -6
  15. package/dist/bin/pushary-cowork.js +3 -3
  16. package/dist/bin/pushary-daemon.js +22 -22
  17. package/dist/bin/pushary-disconnect.js +48 -7
  18. package/dist/bin/pushary-doctor.js +88 -19
  19. package/dist/bin/pushary-elicitation-hook.js +17 -17
  20. package/dist/bin/pushary-gemini-bridge.js +9 -9
  21. package/dist/bin/pushary-gemini-hook.js +25 -27
  22. package/dist/bin/pushary-hook.js +61 -33
  23. package/dist/bin/pushary-login.js +7 -7
  24. package/dist/bin/pushary-logout.js +4 -4
  25. package/dist/bin/pushary-mode.js +3 -3
  26. package/dist/bin/pushary-notification-hook.js +26 -21
  27. package/dist/bin/pushary-opencode-hook.js +27 -29
  28. package/dist/bin/pushary-permission-denied-hook.js +24 -23
  29. package/dist/bin/pushary-permission-hook.js +32 -24
  30. package/dist/bin/pushary-post-hook.js +30 -22
  31. package/dist/bin/pushary-prompt-hook.js +26 -21
  32. package/dist/bin/pushary-session-end-hook.js +26 -21
  33. package/dist/bin/pushary-session-start-hook.js +30 -25
  34. package/dist/bin/pushary-setup.js +145 -37
  35. package/dist/bin/pushary-stats.js +2 -2
  36. package/dist/bin/pushary-status.js +10 -10
  37. package/dist/bin/pushary-stop-hook.js +27 -22
  38. package/dist/bin/pushary-stopfailure-hook.js +26 -21
  39. package/dist/bin/pushary-transcript-register.js +16 -16
  40. package/dist/bin/pushary-transcripts.js +4 -4
  41. package/dist/bin/pushary-upgrade.js +14 -14
  42. package/dist/bin/pushary-wait.js +3 -3
  43. package/dist/{chunk-ID5FDKDZ.js → chunk-2MOQUNFL.js} +1 -1
  44. package/dist/{chunk-CRFLU455.js → chunk-6JUCFMSF.js} +3 -3
  45. package/dist/{chunk-QS55LDX4.js → chunk-6T4OINZB.js} +16 -16
  46. package/dist/{chunk-6C6MS57P.js → chunk-76ZCJZBK.js} +1 -1
  47. package/dist/{chunk-JXELRCU5.js → chunk-AH5OO2YZ.js} +3 -3
  48. package/dist/{chunk-XPPXOKIG.js → chunk-BBUZD7MU.js} +1 -1
  49. package/dist/{chunk-T3JZZUAR.js → chunk-DKTFZCLQ.js} +30 -29
  50. package/dist/{chunk-RALVI7OF.js → chunk-DZYIAMKR.js} +9 -6
  51. package/dist/{chunk-GCD3SQSV.js → chunk-E3WQMDCE.js} +1 -1
  52. package/dist/{chunk-JBJBVERL.js → chunk-EWQZISYV.js} +1 -1
  53. package/dist/{chunk-LWKPMSBB.js → chunk-EZ3GX3NS.js} +5 -5
  54. package/dist/{chunk-5KLAETSU.js → chunk-FO4HHPMO.js} +1 -1
  55. package/dist/{chunk-6KLCP7VF.js → chunk-IH7YUPFN.js} +3 -3
  56. package/dist/{chunk-OPR2BPD4.js → chunk-INBTKFT6.js} +1 -1
  57. package/dist/{chunk-K4XFCEVI.js → chunk-IPDBFJ2M.js} +1 -1
  58. package/dist/{chunk-6IFUXNFX.js → chunk-ISELLVBP.js} +1 -1
  59. package/dist/{chunk-562UJ2DA.js → chunk-J7PJALS2.js} +1 -1
  60. package/dist/{chunk-O3LZQEQP.js → chunk-LQ3BHPPZ.js} +1 -1
  61. package/dist/{chunk-3RVCQDC4.js → chunk-LUYYB6V2.js} +1 -1
  62. package/dist/{chunk-V262ATS5.js → chunk-MR2PWE62.js} +17 -3
  63. package/dist/{chunk-WGV3VY7O.js → chunk-MZUXTN7X.js} +2 -2
  64. package/dist/{chunk-LBNAGGLV.js → chunk-OYYQHJAO.js} +3 -2
  65. package/dist/{chunk-4C4XFAGJ.js → chunk-PHJOSAXW.js} +2 -2
  66. package/dist/{chunk-SI7GYBQP.js → chunk-PQG6NTPT.js} +1 -1
  67. package/dist/{chunk-3ZAEUPM4.js → chunk-PUDQJ772.js} +1 -1
  68. package/dist/{chunk-NSFNEDCT.js → chunk-PWIMJP4U.js} +6 -6
  69. package/dist/{chunk-JL33EDN7.js → chunk-QACXZYDA.js} +4 -4
  70. package/dist/{chunk-CP34FI4B.js → chunk-RZTH4MIY.js} +2 -2
  71. package/dist/{chunk-HB2KB7QL.js → chunk-S2BNTXP6.js} +1 -1
  72. package/dist/{chunk-EXHXR2X5.js → chunk-SA6UB3GD.js} +1 -1
  73. package/dist/{chunk-IRLTW6KF.js → chunk-SLEWDZOA.js} +1 -1
  74. package/dist/chunk-SM54HHVY.js +224 -0
  75. package/dist/{chunk-4PBCNVI3.js → chunk-UP7NZXJU.js} +1 -1
  76. package/dist/{chunk-XOOWC62T.js → chunk-VACFOGF3.js} +1 -1
  77. package/dist/{chunk-OUAE3GKO.js → chunk-VQYARC2K.js} +279 -1
  78. package/dist/{chunk-64WARXGV.js → chunk-WTT24AUA.js} +698 -43
  79. package/dist/{chunk-K6BASBQJ.js → chunk-XIHKSZHL.js} +1 -1
  80. package/dist/{chunk-PD6JY33P.js → chunk-YM4G6CFN.js} +4 -3
  81. package/dist/{reapply-HQ264ZTR.js → reapply-STSGYPF2.js} +8 -8
  82. package/dist/src/index.js +12 -10
  83. package/package.json +1 -1
  84. package/dist/chunk-A76GNRIK.js +0 -608
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  readMachineReadiness,
11
11
  readManagedControlEvidence
12
- } from "../chunk-JL33EDN7.js";
12
+ } from "../chunk-QACXZYDA.js";
13
13
  import {
14
14
  CURSOR_GATE_SCRIPT
15
15
  } from "../chunk-KBITFQST.js";
@@ -20,29 +20,37 @@ import {
20
20
  hasInstructionBlock,
21
21
  isDetected,
22
22
  isPluginRegistered,
23
+ shortenHome,
23
24
  vscodeSettingsTargets
24
- } from "../chunk-V262ATS5.js";
25
+ } from "../chunk-MR2PWE62.js";
25
26
  import {
26
27
  OPENCODE_PLUGIN_PLACEHOLDER,
27
28
  openCodePluginDir,
28
29
  openCodePluginFile,
29
30
  openCodeWired
30
- } from "../chunk-HB2KB7QL.js";
31
- import "../chunk-QS55LDX4.js";
31
+ } from "../chunk-S2BNTXP6.js";
32
+ import {
33
+ compatibleConfigFile,
34
+ compatibleInstructionsFile,
35
+ compatibleMcpFile,
36
+ hasCompatibleHooks,
37
+ missingCompatibleHookEvents
38
+ } from "../chunk-SM54HHVY.js";
39
+ import "../chunk-6T4OINZB.js";
32
40
  import {
33
41
  detectProviderLiveCapabilities,
34
42
  hasSpawnProvider,
35
43
  resolveControlPolicy
36
- } from "../chunk-WGV3VY7O.js";
44
+ } from "../chunk-MZUXTN7X.js";
37
45
  import {
38
46
  readLedgerSummary
39
- } from "../chunk-XOOWC62T.js";
47
+ } from "../chunk-VACFOGF3.js";
40
48
  import {
41
49
  describeBridgeResolution,
42
50
  isBridgeLocator,
43
51
  liveBridgeProbe,
44
52
  resolveBridgeStub
45
- } from "../chunk-IRLTW6KF.js";
53
+ } from "../chunk-SLEWDZOA.js";
46
54
  import {
47
55
  claudeOtherHolders,
48
56
  claudeUnprovenHolds,
@@ -59,7 +67,7 @@ import {
59
67
  geminiWired,
60
68
  holdsLong,
61
69
  pusharyHookExecutable
62
- } from "../chunk-JXELRCU5.js";
70
+ } from "../chunk-AH5OO2YZ.js";
63
71
  import {
64
72
  daemonHasRemoteProof,
65
73
  daemonServiceManagerAvailable,
@@ -68,18 +76,19 @@ import {
68
76
  readDaemonNeedsLogin,
69
77
  readDaemonStatus,
70
78
  readInstalledDaemonService
71
- } from "../chunk-CRFLU455.js";
79
+ } from "../chunk-6JUCFMSF.js";
72
80
  import {
73
81
  GEMINI_HOOK_BINARY,
74
82
  hasGeminiHooks,
75
83
  missingGeminiHookEvents
76
- } from "../chunk-PD6JY33P.js";
84
+ } from "../chunk-YM4G6CFN.js";
77
85
  import "../chunk-XHKBHWLX.js";
78
- import "../chunk-A76GNRIK.js";
79
- import "../chunk-OPR2BPD4.js";
86
+ import "../chunk-WTT24AUA.js";
87
+ import "../chunk-INBTKFT6.js";
88
+ import "../chunk-LGXUGYUH.js";
80
89
  import {
81
90
  getMachineId
82
- } from "../chunk-562UJ2DA.js";
91
+ } from "../chunk-J7PJALS2.js";
83
92
  import {
84
93
  CODEX_HOOK_EVENTS,
85
94
  claudeJson,
@@ -102,7 +111,7 @@ import {
102
111
  pusharyConfigFile,
103
112
  readCodexMcpAuth,
104
113
  vscodePluginDir
105
- } from "../chunk-JBJBVERL.js";
114
+ } from "../chunk-EWQZISYV.js";
106
115
  import {
107
116
  describeReach,
108
117
  describeRoundTrip,
@@ -110,12 +119,12 @@ import {
110
119
  reachVerdict,
111
120
  roundTripEvidence,
112
121
  verifyRoundTrip
113
- } from "../chunk-4C4XFAGJ.js";
122
+ } from "../chunk-PHJOSAXW.js";
114
123
  import "../chunk-3EGEA4KH.js";
115
124
  import {
116
125
  checkApiKey,
117
126
  describeKeyCheck
118
- } from "../chunk-3RVCQDC4.js";
127
+ } from "../chunk-LUYYB6V2.js";
119
128
  import "../chunk-QCGNGEGE.js";
120
129
  import {
121
130
  createIo
@@ -134,7 +143,7 @@ import {
134
143
  keyPrefix,
135
144
  readControlMode,
136
145
  readKeySource
137
- } from "../chunk-4PBCNVI3.js";
146
+ } from "../chunk-UP7NZXJU.js";
138
147
  import {
139
148
  callMcpTool,
140
149
  sendMcpRequest
@@ -146,7 +155,7 @@ import {
146
155
  import {
147
156
  EXIT
148
157
  } from "../chunk-KZERVKTD.js";
149
- import "../chunk-GCD3SQSV.js";
158
+ import "../chunk-E3WQMDCE.js";
150
159
  import "../chunk-4LL6LG5X.js";
151
160
  import {
152
161
  getBaseUrl
@@ -154,10 +163,11 @@ import {
154
163
  import {
155
164
  AGENTS,
156
165
  CURSOR_GATE_EVENTS,
166
+ HOOK_COMPATIBLE_PROFILES,
157
167
  HOOK_LOCATOR_BINARY,
158
168
  hookActivationResult,
159
169
  isHookActivationReport
160
- } from "../chunk-OUAE3GKO.js";
170
+ } from "../chunk-VQYARC2K.js";
161
171
 
162
172
  // bin/pushary-doctor.ts
163
173
  import { existsSync, readFileSync, writeFileSync } from "fs";
@@ -220,6 +230,25 @@ var resolveDoctorExit = ({ keyExit, failures }) => {
220
230
  return EXIT.PROBLEMS_FOUND;
221
231
  };
222
232
 
233
+ // src/diagnostics/config-rewriters.ts
234
+ var CONFIG_REWRITERS = Object.freeze([
235
+ {
236
+ id: "cc-switch",
237
+ label: "cc-switch",
238
+ markers: [[".cc-switch", "cc-switch.db"], [".cc-switch", "config.json"]],
239
+ rewrites: ["Claude Code"],
240
+ what: "replaces ~/.claude/settings.json with what that provider stored plus your common config, rather than merging into the file on disk"
241
+ }
242
+ ]);
243
+ var rewriterFindings = ({ present, agentState }, rewriters = CONFIG_REWRITERS) => rewriters.filter(present).flatMap((rewriter) => rewriter.rewrites.flatMap((agent) => {
244
+ const state = agentState(agent);
245
+ if (!state?.wired) return [];
246
+ return [{ rewriter, agent, state: state.hooksIntact ? "armed" : "suspect" }];
247
+ }));
248
+ var describeRewriterFinding = ({ rewriter, agent, state }) => state === "armed" ? `${rewriter.label} is installed, and a provider switch can take ${agent}'s Pushary hooks out of settings.json` : `${agent}'s Pushary hooks are gone from settings.json, and ${rewriter.label} is one way that happens`;
249
+ var rewriterMechanism = ({ rewriter }) => `${rewriter.label} ${rewriter.what}.`;
250
+ var rewriterRemedy = ({ state }) => state === "armed" ? 'Tick "Apply Common Config" on the provider so a switch keeps them, or re-run setup after each switch' : 'Re-run setup to put them back, then tick "Apply Common Config" on the provider so a switch keeps them';
251
+
223
252
  // src/diagnostics/activation.ts
224
253
  var readHookActivation = async (apiKey, agentType, target, deps = {}) => {
225
254
  const machineId = deps.machineId ?? getMachineId();
@@ -477,6 +506,7 @@ var main = async () => {
477
506
  }
478
507
  }
479
508
  const settings = claudeInPlay ? readJson(CLAUDE_SETTINGS) : null;
509
+ let claudeHooksPresent = false;
480
510
  if (settings) {
481
511
  const hooks = settings.hooks;
482
512
  const CLAUDE_HOOK_CHECKS = [
@@ -494,6 +524,7 @@ var main = async () => {
494
524
  for (const { event, needle, label } of CLAUDE_HOOK_CHECKS) {
495
525
  const configured = JSON.stringify(hooks?.[event] ?? []);
496
526
  const present = configured.includes(needle) || configured.includes(HOOK_LOCATOR_BINARY);
527
+ if (present) claudeHooksPresent = true;
497
528
  check(present, `Claude Code: ${label}`, present ? void 0 : "missing \u2014 run npx @pushary/agent-hooks@latest upgrade");
498
529
  }
499
530
  for (const event of claudeUnprovenHolds(settings)) {
@@ -516,6 +547,15 @@ var main = async () => {
516
547
  } else if (claudeInPlay) {
517
548
  check(false, "Claude Code: settings.json", "not found");
518
549
  }
550
+ const claudeHookState = { wired: claudeInPlay, hooksIntact: claudeHooksPresent };
551
+ for (const finding of rewriterFindings({
552
+ present: (rewriter) => rewriter.markers.some((marker) => existsSync(join(homedir2(), ...marker))),
553
+ agentState: (agent) => agent === "Claude Code" ? claudeHookState : void 0
554
+ })) {
555
+ console.log(` ${warn} ${describeRewriterFinding(finding)}`);
556
+ console.log(` ${dim(rewriterMechanism(finding))}`);
557
+ console.log(` ${dim(rewriterRemedy(finding))}`);
558
+ }
519
559
  const codexConfigPath = codexConfigToml();
520
560
  const codexHooksPath = codexHooksJson();
521
561
  const codexHooksConfig = readJson(codexHooksPath);
@@ -662,6 +702,35 @@ var main = async () => {
662
702
  } else {
663
703
  skipped("Gemini CLI", installed("gemini_cli") ? "installed, but Pushary is not set up for it" : "not installed");
664
704
  }
705
+ for (const profile of HOOK_COMPATIBLE_PROFILES) {
706
+ const configPath = compatibleConfigFile(profile);
707
+ const config = readJson(configPath);
708
+ if (!config || !hasCompatibleHooks(config, profile)) {
709
+ skipped(profile.label, installed(profile.agentType) ? "installed, but Pushary is not set up for it" : "not installed");
710
+ continue;
711
+ }
712
+ checking(profile.label);
713
+ const missing = missingCompatibleHookEvents(config, profile);
714
+ check(
715
+ missing.length === 0,
716
+ `${profile.label}: native hooks installed`,
717
+ missing.length === 0 ? shortenHome(configPath) : `missing ${missing.join(", ")} \u2014 re-run setup`
718
+ );
719
+ const mcpPath = compatibleMcpFile(profile);
720
+ if (mcpPath) {
721
+ const hasServer = Boolean(readJson(mcpPath)?.mcpServers?.pushary);
722
+ check(hasServer, `${profile.label}: MCP server`, hasServer ? shortenHome(mcpPath) : "missing \u2014 re-run setup");
723
+ }
724
+ const instructionsPath = compatibleInstructionsFile(profile);
725
+ if (instructionsPath) {
726
+ const present = hasInstructionBlock(instructionsPath);
727
+ check(
728
+ present,
729
+ `${profile.label}: proactive instructions`,
730
+ present ? shortenHome(instructionsPath) : "missing \u2014 re-run setup so it asks via push, not the terminal"
731
+ );
732
+ }
733
+ }
665
734
  const configuredManagedProviders = [
666
735
  ...claudeInPlay ? ["claude"] : [],
667
736
  ...codexInPlay ? ["codex"] : [],
@@ -1,24 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readHookInput
4
- } from "../chunk-O3LZQEQP.js";
4
+ } from "../chunk-LQ3BHPPZ.js";
5
5
  import {
6
6
  isDeferAnswer
7
7
  } from "../chunk-YHG74UFF.js";
8
- import "../chunk-NSFNEDCT.js";
8
+ import "../chunk-PWIMJP4U.js";
9
9
  import "../chunk-YKLCWWEI.js";
10
- import "../chunk-RALVI7OF.js";
11
- import "../chunk-LBNAGGLV.js";
12
- import "../chunk-IRLTW6KF.js";
13
- import "../chunk-JXELRCU5.js";
14
- import "../chunk-CRFLU455.js";
15
- import "../chunk-PD6JY33P.js";
16
- import "../chunk-EXHXR2X5.js";
17
- import "../chunk-XPPXOKIG.js";
10
+ import "../chunk-DZYIAMKR.js";
11
+ import "../chunk-OYYQHJAO.js";
12
+ import "../chunk-SLEWDZOA.js";
13
+ import "../chunk-AH5OO2YZ.js";
14
+ import "../chunk-6JUCFMSF.js";
15
+ import "../chunk-YM4G6CFN.js";
16
+ import "../chunk-SA6UB3GD.js";
17
+ import "../chunk-BBUZD7MU.js";
18
18
  import "../chunk-EQRS3SGM.js";
19
- import "../chunk-ID5FDKDZ.js";
19
+ import "../chunk-2MOQUNFL.js";
20
20
  import "../chunk-XHKBHWLX.js";
21
- import "../chunk-OPR2BPD4.js";
21
+ import "../chunk-INBTKFT6.js";
22
22
  import {
23
23
  askUser,
24
24
  isDecisionStopped,
@@ -26,16 +26,16 @@ import {
26
26
  } from "../chunk-LGXUGYUH.js";
27
27
  import {
28
28
  getMachineId
29
- } from "../chunk-562UJ2DA.js";
30
- import "../chunk-JBJBVERL.js";
29
+ } from "../chunk-J7PJALS2.js";
30
+ import "../chunk-EWQZISYV.js";
31
31
  import "../chunk-GMXKITVA.js";
32
32
  import "../chunk-DINDL2CF.js";
33
- import "../chunk-4PBCNVI3.js";
33
+ import "../chunk-UP7NZXJU.js";
34
34
  import "../chunk-EYRGBYZG.js";
35
35
  import "../chunk-SAF6HGAA.js";
36
36
  import "../chunk-7QLSKOSU.js";
37
37
  import "../chunk-KZERVKTD.js";
38
- import "../chunk-GCD3SQSV.js";
38
+ import "../chunk-E3WQMDCE.js";
39
39
  import "../chunk-4LL6LG5X.js";
40
40
  import {
41
41
  getApiKey
@@ -50,7 +50,7 @@ import {
50
50
  planElicitationAsk,
51
51
  readElicitationFields,
52
52
  renderElicitationOutput
53
- } from "../chunk-OUAE3GKO.js";
53
+ } from "../chunk-VQYARC2K.js";
54
54
 
55
55
  // bin/pushary-elicitation-hook.ts
56
56
  import { basename } from "path";
@@ -5,36 +5,36 @@ import {
5
5
  postLiveSession,
6
6
  postLiveSessionUntilAccepted,
7
7
  startLiveSessionHeartbeat
8
- } from "../chunk-5KLAETSU.js";
8
+ } from "../chunk-FO4HHPMO.js";
9
9
  import {
10
10
  SESSION_IDLE_TIMEOUT_MS,
11
11
  describeIdleWindow,
12
12
  idleDeadlinePassed,
13
13
  startProcessOwnership,
14
14
  withSpawnProcessOwnership
15
- } from "../chunk-6IFUXNFX.js";
16
- import "../chunk-XPPXOKIG.js";
15
+ } from "../chunk-ISELLVBP.js";
16
+ import "../chunk-BBUZD7MU.js";
17
17
  import "../chunk-EQRS3SGM.js";
18
18
  import {
19
19
  transcriptsEnabled
20
- } from "../chunk-ID5FDKDZ.js";
20
+ } from "../chunk-2MOQUNFL.js";
21
21
  import {
22
22
  spawnClaude
23
23
  } from "../chunk-XHKBHWLX.js";
24
24
  import {
25
25
  getMachineId
26
- } from "../chunk-562UJ2DA.js";
26
+ } from "../chunk-J7PJALS2.js";
27
27
  import {
28
28
  resolveBinary
29
- } from "../chunk-JBJBVERL.js";
30
- import "../chunk-4PBCNVI3.js";
31
- import "../chunk-GCD3SQSV.js";
29
+ } from "../chunk-EWQZISYV.js";
30
+ import "../chunk-UP7NZXJU.js";
31
+ import "../chunk-E3WQMDCE.js";
32
32
  import "../chunk-4LL6LG5X.js";
33
33
  import {
34
34
  getApiKey,
35
35
  getBaseUrl
36
36
  } from "../chunk-2UMNXADU.js";
37
- import "../chunk-OUAE3GKO.js";
37
+ import "../chunk-VQYARC2K.js";
38
38
 
39
39
  // bin/pushary-gemini-bridge.ts
40
40
  import { existsSync } from "fs";
@@ -2,29 +2,34 @@
2
2
  import {
3
3
  isGatingMoment,
4
4
  recordKeylessMoment
5
- } from "../chunk-XOOWC62T.js";
5
+ } from "../chunk-VACFOGF3.js";
6
6
  import {
7
7
  readHookInput
8
- } from "../chunk-O3LZQEQP.js";
8
+ } from "../chunk-LQ3BHPPZ.js";
9
9
  import {
10
10
  denyReasonFrom,
11
11
  isDeferAnswer
12
12
  } from "../chunk-YHG74UFF.js";
13
- import "../chunk-NSFNEDCT.js";
13
+ import "../chunk-PWIMJP4U.js";
14
14
  import "../chunk-YKLCWWEI.js";
15
- import "../chunk-RALVI7OF.js";
16
- import "../chunk-LBNAGGLV.js";
17
- import "../chunk-IRLTW6KF.js";
18
- import "../chunk-JXELRCU5.js";
19
- import "../chunk-CRFLU455.js";
20
- import "../chunk-PD6JY33P.js";
21
- import "../chunk-EXHXR2X5.js";
22
- import "../chunk-XPPXOKIG.js";
15
+ import "../chunk-DZYIAMKR.js";
16
+ import "../chunk-OYYQHJAO.js";
17
+ import "../chunk-SLEWDZOA.js";
18
+ import "../chunk-AH5OO2YZ.js";
19
+ import "../chunk-6JUCFMSF.js";
20
+ import "../chunk-YM4G6CFN.js";
21
+ import "../chunk-SA6UB3GD.js";
22
+ import "../chunk-BBUZD7MU.js";
23
23
  import "../chunk-EQRS3SGM.js";
24
- import "../chunk-ID5FDKDZ.js";
24
+ import "../chunk-2MOQUNFL.js";
25
25
  import "../chunk-XHKBHWLX.js";
26
26
  import {
27
27
  DEFAULT_SESSION,
28
+ UNNAMED_ACTION,
29
+ deriveActionBody,
30
+ deriveBlocker,
31
+ deriveToolTarget,
32
+ describeToolCall,
28
33
  fetchModeState,
29
34
  getPolicy,
30
35
  handlePostToolUse,
@@ -35,17 +40,10 @@ import {
35
40
  readLastPrompt,
36
41
  readLastUserPrompt,
37
42
  repoKeyFor,
38
- reportEvent
39
- } from "../chunk-64WARXGV.js";
40
- import {
41
- UNNAMED_ACTION,
42
- deriveActionBody,
43
- deriveBlocker,
44
- deriveToolTarget,
45
- describeToolCall,
43
+ reportEvent,
46
44
  scopePathFor
47
- } from "../chunk-A76GNRIK.js";
48
- import "../chunk-OPR2BPD4.js";
45
+ } from "../chunk-WTT24AUA.js";
46
+ import "../chunk-INBTKFT6.js";
49
47
  import {
50
48
  DECISION_STOP_REASON,
51
49
  askUser,
@@ -56,16 +54,16 @@ import {
56
54
  } from "../chunk-LGXUGYUH.js";
57
55
  import {
58
56
  getMachineId
59
- } from "../chunk-562UJ2DA.js";
60
- import "../chunk-JBJBVERL.js";
57
+ } from "../chunk-J7PJALS2.js";
58
+ import "../chunk-EWQZISYV.js";
61
59
  import "../chunk-GMXKITVA.js";
62
60
  import "../chunk-DINDL2CF.js";
63
- import "../chunk-4PBCNVI3.js";
61
+ import "../chunk-UP7NZXJU.js";
64
62
  import "../chunk-EYRGBYZG.js";
65
63
  import "../chunk-SAF6HGAA.js";
66
64
  import "../chunk-7QLSKOSU.js";
67
65
  import "../chunk-KZERVKTD.js";
68
- import "../chunk-GCD3SQSV.js";
66
+ import "../chunk-E3WQMDCE.js";
69
67
  import "../chunk-4LL6LG5X.js";
70
68
  import {
71
69
  getApiKey
@@ -78,7 +76,7 @@ import {
78
76
  hookWaitClamped,
79
77
  hookWaitDeadline,
80
78
  resolveGate
81
- } from "../chunk-OUAE3GKO.js";
79
+ } from "../chunk-VQYARC2K.js";
82
80
 
83
81
  // bin/pushary-gemini-hook.ts
84
82
  import { basename } from "path";
@@ -1,70 +1,98 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  handlePreToolUse
4
- } from "../chunk-T3JZZUAR.js";
5
- import "../chunk-6KLCP7VF.js";
6
- import "../chunk-XOOWC62T.js";
4
+ } from "../chunk-DKTFZCLQ.js";
5
+ import {
6
+ activeHookSource,
7
+ normalizeToolCall,
8
+ profileFromArgv,
9
+ unreadablePathTool
10
+ } from "../chunk-SM54HHVY.js";
11
+ import "../chunk-6T4OINZB.js";
12
+ import "../chunk-IH7YUPFN.js";
13
+ import "../chunk-VACFOGF3.js";
7
14
  import {
8
15
  readHookInput
9
- } from "../chunk-O3LZQEQP.js";
16
+ } from "../chunk-LQ3BHPPZ.js";
10
17
  import "../chunk-YHG74UFF.js";
11
- import "../chunk-NSFNEDCT.js";
18
+ import "../chunk-PWIMJP4U.js";
12
19
  import "../chunk-YKLCWWEI.js";
13
- import "../chunk-RALVI7OF.js";
14
- import "../chunk-LBNAGGLV.js";
15
- import "../chunk-IRLTW6KF.js";
16
- import "../chunk-JXELRCU5.js";
17
- import "../chunk-CRFLU455.js";
18
- import "../chunk-PD6JY33P.js";
19
- import "../chunk-EXHXR2X5.js";
20
- import "../chunk-XPPXOKIG.js";
20
+ import "../chunk-DZYIAMKR.js";
21
+ import "../chunk-OYYQHJAO.js";
22
+ import "../chunk-SLEWDZOA.js";
23
+ import "../chunk-AH5OO2YZ.js";
24
+ import "../chunk-6JUCFMSF.js";
25
+ import "../chunk-YM4G6CFN.js";
26
+ import "../chunk-SA6UB3GD.js";
27
+ import "../chunk-BBUZD7MU.js";
21
28
  import "../chunk-EQRS3SGM.js";
22
- import "../chunk-ID5FDKDZ.js";
29
+ import "../chunk-2MOQUNFL.js";
23
30
  import "../chunk-XHKBHWLX.js";
24
- import "../chunk-64WARXGV.js";
25
- import "../chunk-A76GNRIK.js";
26
- import "../chunk-OPR2BPD4.js";
31
+ import "../chunk-WTT24AUA.js";
32
+ import "../chunk-INBTKFT6.js";
27
33
  import "../chunk-LGXUGYUH.js";
28
- import "../chunk-562UJ2DA.js";
29
- import "../chunk-JBJBVERL.js";
34
+ import "../chunk-J7PJALS2.js";
35
+ import "../chunk-EWQZISYV.js";
30
36
  import {
31
37
  exitOnHelpFlag
32
38
  } from "../chunk-GOQHN2UH.js";
33
39
  import "../chunk-LZQVAEWP.js";
34
40
  import "../chunk-GMXKITVA.js";
35
41
  import "../chunk-DINDL2CF.js";
36
- import "../chunk-4PBCNVI3.js";
42
+ import "../chunk-UP7NZXJU.js";
37
43
  import "../chunk-EYRGBYZG.js";
38
44
  import "../chunk-SAF6HGAA.js";
39
45
  import "../chunk-7QLSKOSU.js";
40
46
  import "../chunk-KZERVKTD.js";
41
- import "../chunk-GCD3SQSV.js";
47
+ import "../chunk-E3WQMDCE.js";
42
48
  import "../chunk-4LL6LG5X.js";
43
49
  import "../chunk-2UMNXADU.js";
44
- import "../chunk-OUAE3GKO.js";
50
+ import {
51
+ renderPreToolUseVerdict
52
+ } from "../chunk-VQYARC2K.js";
45
53
 
46
54
  // bin/pushary-hook.ts
47
55
  exitOnHelpFlag("hook");
56
+ var profile = profileFromArgv(process.argv);
57
+ var FALLBACK_TO_TERMINAL = {
58
+ hookSpecificOutput: {
59
+ hookEventName: "PreToolUse",
60
+ permissionDecision: "ask",
61
+ permissionDecisionReason: "Pushary hook error, falling back to terminal"
62
+ }
63
+ };
64
+ var askBecauseUnreadable = (toolName) => ({
65
+ hookSpecificOutput: {
66
+ hookEventName: "PreToolUse",
67
+ permissionDecision: "ask",
68
+ permissionDecisionReason: `Pushary could not read the path ${toolName} is writing to`
69
+ }
70
+ });
71
+ var emit = (verdict) => {
72
+ const output = verdict && profile ? renderPreToolUseVerdict(profile, verdict) : verdict;
73
+ if (output !== void 0) process.stdout.write(JSON.stringify(output));
74
+ };
48
75
  var main = async () => {
49
- const input = await readHookInput("claude", "PreToolUse");
50
- if (!input?.tool_name) {
76
+ const raw = await readHookInput(
77
+ activeHookSource(process.argv),
78
+ "PreToolUse"
79
+ );
80
+ if (!raw?.tool_name) {
51
81
  process.exit(0);
52
82
  }
53
83
  try {
54
- const output = await handlePreToolUse(input);
55
- if (output) process.stdout.write(JSON.stringify(output));
84
+ const unreadable = unreadablePathTool(profile, raw);
85
+ if (unreadable) {
86
+ emit(askBecauseUnreadable(unreadable));
87
+ return;
88
+ }
89
+ emit(await handlePreToolUse(normalizeToolCall(profile, raw)));
56
90
  } catch (err) {
57
91
  process.stderr.write(
58
92
  `[pushary-hook] Error: ${err instanceof Error ? err.message : String(err)}
59
93
  `
60
94
  );
61
- process.stdout.write(JSON.stringify({
62
- hookSpecificOutput: {
63
- hookEventName: "PreToolUse",
64
- permissionDecision: "ask",
65
- permissionDecisionReason: "Pushary hook error, falling back to terminal"
66
- }
67
- }));
95
+ emit(FALLBACK_TO_TERMINAL);
68
96
  }
69
97
  };
70
98
  main();
@@ -5,15 +5,15 @@ import {
5
5
  import "../chunk-PUZZELE6.js";
6
6
  import {
7
7
  recoverDaemonAfterLogin
8
- } from "../chunk-CRFLU455.js";
8
+ } from "../chunk-6JUCFMSF.js";
9
9
  import "../chunk-XHKBHWLX.js";
10
- import "../chunk-562UJ2DA.js";
11
- import "../chunk-JBJBVERL.js";
10
+ import "../chunk-J7PJALS2.js";
11
+ import "../chunk-EWQZISYV.js";
12
12
  import "../chunk-3EGEA4KH.js";
13
13
  import {
14
14
  checkApiKey,
15
15
  describeKeyCheck
16
- } from "../chunk-3RVCQDC4.js";
16
+ } from "../chunk-LUYYB6V2.js";
17
17
  import {
18
18
  createIo
19
19
  } from "../chunk-5RUIFDTP.js";
@@ -32,7 +32,7 @@ import {
32
32
  readControlMode,
33
33
  readKeySource,
34
34
  writeKey
35
- } from "../chunk-4PBCNVI3.js";
35
+ } from "../chunk-UP7NZXJU.js";
36
36
  import "../chunk-SAF6HGAA.js";
37
37
  import {
38
38
  UsageError
@@ -40,12 +40,12 @@ import {
40
40
  import {
41
41
  EXIT
42
42
  } from "../chunk-KZERVKTD.js";
43
- import "../chunk-GCD3SQSV.js";
43
+ import "../chunk-E3WQMDCE.js";
44
44
  import "../chunk-4LL6LG5X.js";
45
45
  import "../chunk-2UMNXADU.js";
46
46
  import {
47
47
  isValidApiKey
48
- } from "../chunk-OUAE3GKO.js";
48
+ } from "../chunk-VQYARC2K.js";
49
49
 
50
50
  // bin/pushary-login.ts
51
51
  exitOnHelpFlag("login");
@@ -4,7 +4,7 @@ import {
4
4
  codexConfigToml,
5
5
  cursorUserMcp,
6
6
  geminiSettings
7
- } from "../chunk-JBJBVERL.js";
7
+ } from "../chunk-EWQZISYV.js";
8
8
  import {
9
9
  createIo
10
10
  } from "../chunk-5RUIFDTP.js";
@@ -19,19 +19,19 @@ import "../chunk-DINDL2CF.js";
19
19
  import {
20
20
  clearKey,
21
21
  readKeySource
22
- } from "../chunk-4PBCNVI3.js";
22
+ } from "../chunk-UP7NZXJU.js";
23
23
  import {
24
24
  UsageError
25
25
  } from "../chunk-7QLSKOSU.js";
26
26
  import {
27
27
  EXIT
28
28
  } from "../chunk-KZERVKTD.js";
29
- import "../chunk-GCD3SQSV.js";
29
+ import "../chunk-E3WQMDCE.js";
30
30
  import "../chunk-4LL6LG5X.js";
31
31
  import {
32
32
  getBaseUrl
33
33
  } from "../chunk-2UMNXADU.js";
34
- import "../chunk-OUAE3GKO.js";
34
+ import "../chunk-VQYARC2K.js";
35
35
 
36
36
  // bin/pushary-logout.ts
37
37
  import { existsSync } from "fs";
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  exitOnFailedResponse
4
- } from "../chunk-6C6MS57P.js";
5
- import "../chunk-3RVCQDC4.js";
4
+ } from "../chunk-76ZCJZBK.js";
5
+ import "../chunk-LUYYB6V2.js";
6
6
  import {
7
7
  createIo
8
8
  } from "../chunk-5RUIFDTP.js";
@@ -25,7 +25,7 @@ import {
25
25
  getApiKey,
26
26
  getBaseUrl
27
27
  } from "../chunk-2UMNXADU.js";
28
- import "../chunk-OUAE3GKO.js";
28
+ import "../chunk-VQYARC2K.js";
29
29
 
30
30
  // src/cli/mode-request.ts
31
31
  var parseDuration = (value) => {