@pushary/agent-hooks 1.9.7 → 1.9.8

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 (110) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +3 -3
  3. package/data/cursor-plugin/README.md +3 -7
  4. package/data/vscode-plugin/README.md +1 -1
  5. package/dist/bin/pushary-bell-hook.js +22 -23
  6. package/dist/bin/pushary-bell.js +9 -9
  7. package/dist/bin/pushary-claude.js +27 -28
  8. package/dist/bin/pushary-clean.js +101 -79
  9. package/dist/bin/pushary-codex-bridge.js +18 -18
  10. package/dist/bin/pushary-codex-hook.js +32 -33
  11. package/dist/bin/pushary-codex.js +13 -13
  12. package/dist/bin/pushary-connect.js +24 -21
  13. package/dist/bin/pushary-cowork.js +5 -5
  14. package/dist/bin/pushary-daemon.js +51 -39
  15. package/dist/bin/pushary-disconnect.js +189 -54
  16. package/dist/bin/pushary-doctor.js +67 -58
  17. package/dist/bin/pushary-elicitation-hook.js +24 -25
  18. package/dist/bin/pushary-gemini-bridge.js +13 -13
  19. package/dist/bin/pushary-gemini-hook.js +29 -30
  20. package/dist/bin/pushary-hook.js +30 -32
  21. package/dist/bin/pushary-login.js +12 -12
  22. package/dist/bin/pushary-logout.js +105 -42
  23. package/dist/bin/pushary-mcp.js +9 -9
  24. package/dist/bin/pushary-mode.js +28 -31
  25. package/dist/bin/pushary-notification-hook.js +26 -28
  26. package/dist/bin/pushary-opencode-hook.js +28 -29
  27. package/dist/bin/pushary-permission-denied-hook.js +30 -32
  28. package/dist/bin/pushary-permission-hook.js +29 -31
  29. package/dist/bin/pushary-post-hook.js +26 -28
  30. package/dist/bin/pushary-prompt-hook.js +26 -28
  31. package/dist/bin/pushary-session-end-hook.js +26 -28
  32. package/dist/bin/pushary-session-start-hook.js +31 -32
  33. package/dist/bin/pushary-setup.js +91 -101
  34. package/dist/bin/pushary-stats.js +5 -5
  35. package/dist/bin/pushary-status.js +34 -18
  36. package/dist/bin/pushary-stop-hook.js +26 -28
  37. package/dist/bin/pushary-stopfailure-hook.js +26 -28
  38. package/dist/bin/pushary-suggestions.js +19 -21
  39. package/dist/bin/pushary-transcript-register.js +18 -19
  40. package/dist/bin/pushary-transcripts.js +7 -7
  41. package/dist/bin/pushary-upgrade.js +55 -25
  42. package/dist/bin/pushary-wait.js +23 -19
  43. package/dist/bin/pushary.js +15 -14
  44. package/dist/{chunk-R3YW55MY.js → chunk-2A53H4S6.js} +17 -15
  45. package/dist/{chunk-4YO4T5FV.js → chunk-2QGYMY7A.js} +83 -3
  46. package/dist/{chunk-MBK7N46B.js → chunk-2QTO5YIT.js} +6 -6
  47. package/dist/{chunk-D6S5EKXA.js → chunk-2VZAALEJ.js} +5 -9
  48. package/dist/chunk-2WXF3QJR.js +49 -0
  49. package/dist/{chunk-JCWZ23MJ.js → chunk-3I6IVOZV.js} +3 -3
  50. package/dist/chunk-3Z3A37WD.js +77 -0
  51. package/dist/{chunk-Z6HPS67T.js → chunk-5QUPKDI5.js} +1 -1
  52. package/dist/{chunk-JWKBDSPF.js → chunk-6TE27XZR.js} +2 -2
  53. package/dist/{chunk-STQRUH3S.js → chunk-7DVNSQWF.js} +59 -15
  54. package/dist/{chunk-QTO6HEZD.js → chunk-7PT35RY2.js} +2 -2
  55. package/dist/{chunk-7OIWWZAD.js → chunk-B64KHETR.js} +3 -3
  56. package/dist/chunk-BEJRK4DF.js +94 -0
  57. package/dist/chunk-BXET3ALR.js +46 -0
  58. package/dist/{chunk-6DJTDHBI.js → chunk-CD47ZFFZ.js} +1 -1
  59. package/dist/{chunk-UFVGSEWH.js → chunk-CKV3UPMU.js} +2 -2
  60. package/dist/{chunk-4FK6RZVJ.js → chunk-CLOSJ4ES.js} +1 -1
  61. package/dist/{chunk-AVNKVF7N.js → chunk-DKMD6AWR.js} +4 -4
  62. package/dist/{chunk-SBLPHUEB.js → chunk-DL7XWKYV.js} +7 -5
  63. package/dist/{chunk-BTQGAXZ3.js → chunk-DPGSLWOS.js} +8 -8
  64. package/dist/{chunk-KYO45G5L.js → chunk-DUZVXBBU.js} +1 -1
  65. package/dist/{chunk-EB4XGVBG.js → chunk-EUW7JL2K.js} +0 -32
  66. package/dist/{chunk-4D2AYNSE.js → chunk-FQ2GORVG.js} +2 -2
  67. package/dist/{chunk-W2KI5KPD.js → chunk-HRULIYDU.js} +2 -2
  68. package/dist/{chunk-QR6VE5ME.js → chunk-I5IJRMNV.js} +58 -8
  69. package/dist/{chunk-T7Y5EADL.js → chunk-I6MJXLMY.js} +2 -2
  70. package/dist/{chunk-N4EUSDKX.js → chunk-IAD2RT4L.js} +14 -14
  71. package/dist/{chunk-H37L7TT3.js → chunk-IHFDPV7C.js} +2 -2
  72. package/dist/{chunk-3GNUXXDZ.js → chunk-IHO3YQAN.js} +2 -2
  73. package/dist/{chunk-JWQZSYCK.js → chunk-KF3UZLYI.js} +1 -1
  74. package/dist/chunk-KFF7G225.js +599 -0
  75. package/dist/{chunk-MZPXVH4A.js → chunk-KHNFLYJO.js} +204 -28
  76. package/dist/{chunk-QFEM7R6T.js → chunk-KRCR2CRQ.js} +9 -9
  77. package/dist/{chunk-VXRXFU6Q.js → chunk-LKLVTG3V.js} +14 -7
  78. package/dist/{chunk-KFKL3FHS.js → chunk-LWOO567I.js} +4 -3
  79. package/dist/{chunk-HPRZJKRO.js → chunk-M6BZZFVQ.js} +1 -1
  80. package/dist/{chunk-X5NXPCIC.js → chunk-MFF3ONG5.js} +16 -2
  81. package/dist/{chunk-H7MMU64M.js → chunk-MGRFDGWU.js} +2 -2
  82. package/dist/{chunk-L76HTPU6.js → chunk-MKTJEXZ3.js} +3 -3
  83. package/dist/{chunk-NIBFSARF.js → chunk-MXHTGVFZ.js} +33 -9
  84. package/dist/{chunk-ADSQDYYG.js → chunk-N4QSPI3B.js} +54 -5
  85. package/dist/{chunk-AQ55ZSSS.js → chunk-NWDG3MSW.js} +1 -1
  86. package/dist/chunk-OP7IHC2I.js +24 -0
  87. package/dist/{chunk-KT5E2RLS.js → chunk-QOLITCIP.js} +1 -1
  88. package/dist/{chunk-JXISQ7DT.js → chunk-TCQ43LSG.js} +3 -3
  89. package/dist/chunk-TCWKTUAE.js +50 -0
  90. package/dist/{chunk-RQGODFQN.js → chunk-V5HPPF3E.js} +1 -1
  91. package/dist/{chunk-7264S5HZ.js → chunk-WG3K4TCH.js} +1 -1
  92. package/dist/{chunk-GKI6LFAV.js → chunk-WS4H76EP.js} +2 -2
  93. package/dist/{chunk-XWAYAO3V.js → chunk-WWOHTTVP.js} +2 -2
  94. package/dist/{chunk-SD3272LS.js → chunk-YIG2R3BJ.js} +9 -7
  95. package/dist/{chunk-ZUTU43FT.js → chunk-ZBHUHJG6.js} +4 -4
  96. package/dist/{chunk-AUUXS44H.js → chunk-ZBK6E2OR.js} +1 -1
  97. package/dist/{chunk-QQ4HBXZC.js → chunk-ZN3C6GBG.js} +84 -673
  98. package/dist/{chunk-CBQACHKY.js → chunk-ZSTSEBG7.js} +1 -1
  99. package/dist/{chunk-3PVDOCFI.js → chunk-ZW3XZLJC.js} +5 -5
  100. package/dist/{global-upgrade-E2HUEB4B.js → global-upgrade-I56HNM23.js} +6 -6
  101. package/dist/{paths-QVTEGNZV.js → paths-AGY43CXS.js} +2 -2
  102. package/dist/reapply-IA5XUKWW.js +57 -0
  103. package/dist/src/index.d.ts +1 -0
  104. package/dist/src/index.js +19 -20
  105. package/dist/{upgrade-lock-JCIDZMHF.js → upgrade-lock-B34TAUKV.js} +3 -3
  106. package/package.json +1 -1
  107. package/dist/chunk-ANEAA37E.js +0 -197
  108. package/dist/chunk-MNWRUGMH.js +0 -86
  109. package/dist/chunk-RQSOEB4S.js +0 -44
  110. package/dist/reapply-5QVKM6LA.js +0 -38
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSafeReadOnlyCommand
3
- } from "./chunk-QR6VE5ME.js";
3
+ } from "./chunk-I5IJRMNV.js";
4
4
 
5
5
  // src/ledger.ts
6
6
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync } from "fs";
@@ -4,7 +4,7 @@ import {
4
4
  forkFinishWithUpgradeLock,
5
5
  installWithUpgradeLock,
6
6
  releaseAutoUpdateLock
7
- } from "./chunk-RQGODFQN.js";
7
+ } from "./chunk-V5HPPF3E.js";
8
8
  import {
9
9
  describeAutoUpdateCheck,
10
10
  globalInstallLocation,
@@ -14,7 +14,7 @@ import {
14
14
  readAutoUpdateState,
15
15
  updateAutoUpdateState,
16
16
  upgradeEntryFor
17
- } from "./chunk-QTO6HEZD.js";
17
+ } from "./chunk-7PT35RY2.js";
18
18
  import {
19
19
  EXIT
20
20
  } from "./chunk-KZERVKTD.js";
@@ -27,10 +27,10 @@ import {
27
27
  npmErrorMessage,
28
28
  readGlobalCliInstallAt,
29
29
  readGlobalPrefix
30
- } from "./chunk-ZUTU43FT.js";
30
+ } from "./chunk-ZBHUHJG6.js";
31
31
  import {
32
32
  NPX_LATEST_COMMAND
33
- } from "./chunk-STQRUH3S.js";
33
+ } from "./chunk-7DVNSQWF.js";
34
34
  import {
35
35
  commandsPackage,
36
36
  globalUpgradeEntry,
@@ -39,7 +39,7 @@ import {
39
39
  isSameMajorVersion,
40
40
  ownPackageRoot,
41
41
  packageVersionAt
42
- } from "./chunk-QR6VE5ME.js";
42
+ } from "./chunk-I5IJRMNV.js";
43
43
 
44
44
  // src/global-upgrade.ts
45
45
  import { existsSync } from "fs";
@@ -5,15 +5,15 @@ import {
5
5
  readGlobalUpgradeSubject,
6
6
  upgradeInstalledPackage,
7
7
  withUpgradeLock
8
- } from "./chunk-3PVDOCFI.js";
9
- import "./chunk-RQGODFQN.js";
10
- import "./chunk-QTO6HEZD.js";
8
+ } from "./chunk-ZW3XZLJC.js";
9
+ import "./chunk-V5HPPF3E.js";
10
+ import "./chunk-7PT35RY2.js";
11
11
  import "./chunk-POFBE6ZY.js";
12
12
  import "./chunk-KZERVKTD.js";
13
- import "./chunk-ZUTU43FT.js";
13
+ import "./chunk-ZBHUHJG6.js";
14
14
  import "./chunk-T7E75EKA.js";
15
- import "./chunk-STQRUH3S.js";
16
- import "./chunk-QR6VE5ME.js";
15
+ import "./chunk-7DVNSQWF.js";
16
+ import "./chunk-I5IJRMNV.js";
17
17
  export {
18
18
  finishGlobalUpgrade,
19
19
  finishUpgradeWithLock,
@@ -32,8 +32,8 @@ import {
32
32
  pusharyDir,
33
33
  vscodePluginDir,
34
34
  vscodePluginMcp
35
- } from "./chunk-ZUTU43FT.js";
36
- import "./chunk-QR6VE5ME.js";
35
+ } from "./chunk-ZBHUHJG6.js";
36
+ import "./chunk-I5IJRMNV.js";
37
37
  export {
38
38
  autoUpdateLock,
39
39
  autoUpdateLog,
@@ -0,0 +1,57 @@
1
+ import {
2
+ ensureCodexTrustAfterReapply,
3
+ inspectConfiguredManagedProviders,
4
+ reapplyAllAgents,
5
+ reapplyClaudeForVersion,
6
+ reapplyClaudeSettings,
7
+ reapplyCodexSettings,
8
+ reapplyCursorPlugin,
9
+ reapplyGeminiSettings,
10
+ reapplyOpenCodePlugin,
11
+ reapplyVsCodePlugin,
12
+ repairCodexHolds
13
+ } from "./chunk-MXHTGVFZ.js";
14
+ import "./chunk-3Z3A37WD.js";
15
+ import "./chunk-MGRFDGWU.js";
16
+ import "./chunk-MFF3ONG5.js";
17
+ import "./chunk-KHNFLYJO.js";
18
+ import "./chunk-RIVNNBEK.js";
19
+ import "./chunk-YIG2R3BJ.js";
20
+ import "./chunk-DL7XWKYV.js";
21
+ import "./chunk-2QGYMY7A.js";
22
+ import "./chunk-3I6IVOZV.js";
23
+ import "./chunk-WG3K4TCH.js";
24
+ import "./chunk-XHKBHWLX.js";
25
+ import "./chunk-6ICPEJY5.js";
26
+ import "./chunk-KRCR2CRQ.js";
27
+ import "./chunk-N6IOSZOE.js";
28
+ import "./chunk-CD47ZFFZ.js";
29
+ import "./chunk-2VZAALEJ.js";
30
+ import "./chunk-DKMD6AWR.js";
31
+ import "./chunk-POFBE6ZY.js";
32
+ import "./chunk-GMXKITVA.js";
33
+ import "./chunk-MKTJEXZ3.js";
34
+ import "./chunk-LWOO567I.js";
35
+ import "./chunk-TCQ43LSG.js";
36
+ import "./chunk-DUZVXBBU.js";
37
+ import "./chunk-7QLSKOSU.js";
38
+ import "./chunk-KZERVKTD.js";
39
+ import "./chunk-FQ2GORVG.js";
40
+ import "./chunk-ZBHUHJG6.js";
41
+ import "./chunk-T7E75EKA.js";
42
+ import "./chunk-5QUPKDI5.js";
43
+ import "./chunk-7DVNSQWF.js";
44
+ import "./chunk-I5IJRMNV.js";
45
+ export {
46
+ ensureCodexTrustAfterReapply,
47
+ inspectConfiguredManagedProviders,
48
+ reapplyAllAgents,
49
+ reapplyClaudeForVersion,
50
+ reapplyClaudeSettings,
51
+ reapplyCodexSettings,
52
+ reapplyCursorPlugin,
53
+ reapplyGeminiSettings,
54
+ reapplyOpenCodePlugin,
55
+ reapplyVsCodePlugin,
56
+ repairCodexHolds
57
+ };
@@ -183,6 +183,7 @@ interface AnswerResult {
183
183
  value?: string;
184
184
  note?: string;
185
185
  }
186
+
186
187
  declare const askUser: (apiKey: string, params: AskUserParams, timeoutMs?: number) => Promise<AskUserResponse>;
187
188
  declare const waitForAnswer: (apiKey: string, correlationId: string, timeoutMs?: number, signal?: AbortSignal) => Promise<AnswerResult>;
188
189
  declare const cancelQuestion: (apiKey: string, correlationId: string, signal?: AbortSignal) => Promise<{
package/dist/src/index.js CHANGED
@@ -1,15 +1,14 @@
1
1
  import {
2
2
  handlePreToolUse
3
- } from "../chunk-R3YW55MY.js";
4
- import "../chunk-MZPXVH4A.js";
5
- import "../chunk-ANEAA37E.js";
6
- import "../chunk-3GNUXXDZ.js";
7
- import "../chunk-CBQACHKY.js";
3
+ } from "../chunk-2A53H4S6.js";
4
+ import "../chunk-KHNFLYJO.js";
5
+ import "../chunk-IHO3YQAN.js";
6
+ import "../chunk-ZSTSEBG7.js";
8
7
  import "../chunk-5OP5MQI7.js";
9
- import "../chunk-JCWZ23MJ.js";
8
+ import "../chunk-3I6IVOZV.js";
10
9
  import {
11
10
  fetchAccountPublicKey
12
- } from "../chunk-4FK6RZVJ.js";
11
+ } from "../chunk-CLOSJ4ES.js";
13
12
  import "../chunk-6ICPEJY5.js";
14
13
  import {
15
14
  fetchModeOverride,
@@ -19,33 +18,33 @@ import {
19
18
  handlePostToolUse,
20
19
  handleStop,
21
20
  reportEvent
22
- } from "../chunk-QFEM7R6T.js";
21
+ } from "../chunk-KRCR2CRQ.js";
23
22
  import "../chunk-N6IOSZOE.js";
24
- import "../chunk-6DJTDHBI.js";
23
+ import "../chunk-CD47ZFFZ.js";
25
24
  import {
26
25
  askUser,
27
26
  cancelQuestion,
28
27
  waitForAnswer
29
- } from "../chunk-D6S5EKXA.js";
30
- import "../chunk-AVNKVF7N.js";
28
+ } from "../chunk-2VZAALEJ.js";
29
+ import "../chunk-DKMD6AWR.js";
31
30
  import "../chunk-POFBE6ZY.js";
32
- import "../chunk-L76HTPU6.js";
33
- import "../chunk-KFKL3FHS.js";
34
- import "../chunk-JXISQ7DT.js";
35
- import "../chunk-KYO45G5L.js";
31
+ import "../chunk-MKTJEXZ3.js";
32
+ import "../chunk-LWOO567I.js";
33
+ import "../chunk-TCQ43LSG.js";
34
+ import "../chunk-DUZVXBBU.js";
36
35
  import "../chunk-7QLSKOSU.js";
37
36
  import "../chunk-KZERVKTD.js";
38
- import "../chunk-4D2AYNSE.js";
39
- import "../chunk-ZUTU43FT.js";
37
+ import "../chunk-FQ2GORVG.js";
38
+ import "../chunk-ZBHUHJG6.js";
40
39
  import "../chunk-T7E75EKA.js";
41
40
  import {
42
41
  getApiKey,
43
42
  getBaseUrl
44
- } from "../chunk-Z6HPS67T.js";
45
- import "../chunk-STQRUH3S.js";
43
+ } from "../chunk-5QUPKDI5.js";
44
+ import "../chunk-7DVNSQWF.js";
46
45
  import {
47
46
  resolvePolicy
48
- } from "../chunk-QR6VE5ME.js";
47
+ } from "../chunk-I5IJRMNV.js";
49
48
  export {
50
49
  askUser,
51
50
  cancelQuestion,
@@ -5,10 +5,10 @@ import {
5
5
  installWithUpgradeLock,
6
6
  ownsUpgradeLock,
7
7
  releaseAutoUpdateLock
8
- } from "./chunk-RQGODFQN.js";
9
- import "./chunk-ZUTU43FT.js";
8
+ } from "./chunk-V5HPPF3E.js";
9
+ import "./chunk-ZBHUHJG6.js";
10
10
  import "./chunk-T7E75EKA.js";
11
- import "./chunk-QR6VE5ME.js";
11
+ import "./chunk-I5IJRMNV.js";
12
12
  export {
13
13
  claimUpgradeLock,
14
14
  finishWithUpgradeLock,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushary/agent-hooks",
3
- "version": "1.9.7",
3
+ "version": "1.9.8",
4
4
  "description": "Permission hooks for AI coding agents: route tool approvals through Pushary push notifications",
5
5
  "keywords": [
6
6
  "pushary",
@@ -1,197 +0,0 @@
1
- import {
2
- CLAUDE_HOOK_EVENTS,
3
- supportedClaudeEvents
4
- } from "./chunk-JCWZ23MJ.js";
5
- import {
6
- guardBinary,
7
- holdBudgetOf,
8
- isProtectedByScope,
9
- registerHookEntry
10
- } from "./chunk-ZUTU43FT.js";
11
- import {
12
- HOOK_LOCATOR_BINARY,
13
- withHookHoldBudget
14
- } from "./chunk-QR6VE5ME.js";
15
-
16
- // src/claude-config.ts
17
- import { join } from "path";
18
- import { isDeepStrictEqual } from "util";
19
- var PUSHARY_MCP_URL = "https://pushary.com/api/mcp/mcp";
20
- var PUSHARY_PERMISSION_RULE = "mcp__pushary__*";
21
- var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
22
- var ensureRecord = (target, key) => {
23
- const existing = asRecord(target[key]);
24
- if (existing) return existing;
25
- const created = {};
26
- target[key] = created;
27
- return created;
28
- };
29
- var isPusharyPermission = (rule) => typeof rule === "string" && (rule.includes("pushary") || rule.includes("MCP(pushary"));
30
- var HOOK_BINARIES = /* @__PURE__ */ new Set([
31
- ...CLAUDE_HOOK_EVENTS.map((hook) => hook.binary),
32
- HOOK_LOCATOR_BINARY
33
- ]);
34
- var namesPusharyBinary = (command) => command.split(/[\s/\\"']+/).some((segment) => HOOK_BINARIES.has(segment.replace(/\.(cmd|exe)$/i, "")));
35
- var isPusharyHook = (entry2, scope) => {
36
- const hooks = asRecord(entry2)?.hooks;
37
- if (!Array.isArray(hooks)) return false;
38
- return hooks.some((hook) => {
39
- const command = String(asRecord(hook)?.command ?? "");
40
- if (isProtectedByScope(command, scope)) return false;
41
- return namesPusharyBinary(command);
42
- });
43
- };
44
- var pusharyMcpServer = (apiKey) => ({
45
- type: "http",
46
- url: PUSHARY_MCP_URL,
47
- headers: { Authorization: `Bearer ${apiKey}` }
48
- });
49
- var addClaudeMcpServer = (config, apiKey) => {
50
- const mcpServers = ensureRecord(config, "mcpServers");
51
- mcpServers.pushary = pusharyMcpServer(apiKey);
52
- };
53
- var isClaudeMcpSnapshot = (value) => {
54
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
55
- const snapshot = value;
56
- return typeof snapshot.hadMcpServers === "boolean" && typeof snapshot.mcpServersWasRecord === "boolean" && (!snapshot.hadMcpServers || snapshot.mcpServersWasRecord || Object.hasOwn(snapshot, "mcpServers")) && typeof snapshot.hadPushary === "boolean" && (!snapshot.hadPushary || Object.hasOwn(snapshot, "pushary")) && (!Object.hasOwn(snapshot, "installedPushary") || asRecord(snapshot.installedPushary)?.type === "http" && asRecord(snapshot.installedPushary)?.url === PUSHARY_MCP_URL);
57
- };
58
- var captureClaudeMcpServer = (config, apiKey) => {
59
- const mcpServers = asRecord(config.mcpServers);
60
- const hadMcpServers = Object.hasOwn(config, "mcpServers");
61
- return {
62
- hadMcpServers,
63
- mcpServersWasRecord: Boolean(mcpServers),
64
- ...hadMcpServers && !mcpServers ? { mcpServers: structuredClone(config.mcpServers) } : {},
65
- hadPushary: Boolean(mcpServers && Object.hasOwn(mcpServers, "pushary")),
66
- ...mcpServers && Object.hasOwn(mcpServers, "pushary") ? { pushary: structuredClone(mcpServers.pushary) } : {},
67
- ...apiKey ? { installedPushary: pusharyMcpServer(apiKey) } : {}
68
- };
69
- };
70
- var updateClaudeMcpSnapshot = (snapshot, apiKey) => ({
71
- ...snapshot,
72
- installedPushary: pusharyMcpServer(apiKey)
73
- });
74
- var restoreClaudeMcpServer = (config, snapshot) => {
75
- const mcpServers = asRecord(config.mcpServers);
76
- const current = asRecord(mcpServers?.pushary);
77
- if (Object.hasOwn(snapshot, "installedPushary")) {
78
- if (!isDeepStrictEqual(mcpServers?.pushary, snapshot.installedPushary)) return false;
79
- } else if (current?.type !== "http" || current.url !== PUSHARY_MCP_URL) {
80
- return false;
81
- }
82
- if (!snapshot.mcpServersWasRecord) {
83
- if (Object.keys(mcpServers).length === 1) {
84
- if (snapshot.hadMcpServers) config.mcpServers = structuredClone(snapshot.mcpServers);
85
- else delete config.mcpServers;
86
- } else {
87
- delete mcpServers.pushary;
88
- }
89
- } else if (snapshot.hadPushary) {
90
- mcpServers.pushary = structuredClone(snapshot.pushary);
91
- } else {
92
- delete mcpServers.pushary;
93
- if (!snapshot.hadMcpServers && Object.keys(mcpServers).length === 0) delete config.mcpServers;
94
- }
95
- return true;
96
- };
97
- var removeClaudeMcpServers = (config) => {
98
- let changed = false;
99
- const removeFrom = (target) => {
100
- const mcpServers = asRecord(target.mcpServers);
101
- if (!mcpServers?.pushary) return;
102
- delete mcpServers.pushary;
103
- if (Object.keys(mcpServers).length === 0) delete target.mcpServers;
104
- changed = true;
105
- };
106
- removeFrom(config);
107
- const projects = asRecord(config.projects);
108
- if (projects) {
109
- for (const project of Object.values(projects)) {
110
- const projectConfig = asRecord(project);
111
- if (projectConfig) removeFrom(projectConfig);
112
- }
113
- }
114
- return changed;
115
- };
116
- var removePusharyToolPermissions = (settings) => {
117
- const permissions = asRecord(settings.permissions);
118
- if (!permissions || !Array.isArray(permissions.allow)) return false;
119
- const filtered = permissions.allow.filter((rule) => !isPusharyPermission(rule));
120
- if (filtered.length === permissions.allow.length) return false;
121
- if (filtered.length === 0) delete permissions.allow;
122
- else permissions.allow = filtered;
123
- if (Object.keys(permissions).length === 0) delete settings.permissions;
124
- return true;
125
- };
126
- var addPusharyToolPermissions = (settings) => {
127
- const permissions = ensureRecord(settings, "permissions");
128
- const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
129
- const filtered = allow.filter((rule) => !isPusharyPermission(rule));
130
- if (!filtered.includes(PUSHARY_PERMISSION_RULE)) {
131
- filtered.push(PUSHARY_PERMISSION_RULE);
132
- }
133
- permissions.allow = filtered;
134
- };
135
- var addPusharyHooks = (settings, binDir, version = null) => {
136
- const resolve = (name) => guardBinary(binDir ? join(binDir, name) : name);
137
- const hooks = ensureRecord(settings, "hooks");
138
- const supported = new Map(supportedClaudeEvents(version).map((hook) => [hook.event, hook]));
139
- for (const known of CLAUDE_HOOK_EVENTS) {
140
- const current = Array.isArray(hooks[known.event]) ? hooks[known.event] : [];
141
- const definition = supported.get(known.event);
142
- if (definition) {
143
- hooks[known.event] = registerHookEntry(current, isPusharyHook, entry(definition, resolve));
144
- continue;
145
- }
146
- const others = current.filter((item) => !isPusharyHook(item));
147
- if (others.length > 0) {
148
- hooks[known.event] = others;
149
- } else {
150
- delete hooks[known.event];
151
- }
152
- }
153
- };
154
- var entry = (definition, resolve) => ({
155
- ...definition.matcher ? { matcher: definition.matcher } : {},
156
- hooks: [{
157
- type: "command",
158
- command: withHookHoldBudget(resolve(definition.binary), holdBudgetOf(definition)),
159
- timeout: definition.timeout
160
- }]
161
- });
162
- var removePusharySettings = (settings, scope) => {
163
- let changed = scope?.keepMcpServer === true ? false : removeClaudeMcpServers(settings);
164
- if (scope?.keepMcpServer !== true && removePusharyToolPermissions(settings)) changed = true;
165
- const hooks = asRecord(settings.hooks);
166
- if (hooks) {
167
- for (const { event: key } of CLAUDE_HOOK_EVENTS) {
168
- const entries = hooks[key];
169
- if (!Array.isArray(entries)) continue;
170
- const filtered = entries.filter((entry2) => !isPusharyHook(entry2, scope));
171
- if (filtered.length !== entries.length) {
172
- if (filtered.length === 0) {
173
- delete hooks[key];
174
- } else {
175
- hooks[key] = filtered;
176
- }
177
- changed = true;
178
- }
179
- }
180
- if (Object.keys(hooks).length === 0) delete settings.hooks;
181
- }
182
- return changed;
183
- };
184
-
185
- export {
186
- isPusharyHook,
187
- addClaudeMcpServer,
188
- isClaudeMcpSnapshot,
189
- captureClaudeMcpServer,
190
- updateClaudeMcpSnapshot,
191
- restoreClaudeMcpServer,
192
- removeClaudeMcpServers,
193
- removePusharyToolPermissions,
194
- addPusharyToolPermissions,
195
- addPusharyHooks,
196
- removePusharySettings
197
- };
@@ -1,86 +0,0 @@
1
- import {
2
- HOOK_LOCATOR_BINARY
3
- } from "./chunk-QR6VE5ME.js";
4
-
5
- // src/diagnostics/bridge.ts
6
- import { execFileSync } from "child_process";
7
- import { existsSync, readFileSync } from "fs";
8
- import { homedir } from "os";
9
- import { dirname, join } from "path";
10
- var BRIDGE_BUNDLE_IDENTIFIER = "com.pushary.app";
11
- var BRIDGE_HELPER_SUFFIX = "/Contents/Helpers/pushary-bridge";
12
- var BRIDGE_BUNDLE_ROOTS = ["/Applications/Pushary.app", "$HOME/Applications/Pushary.app"];
13
- var expandHome = (path, home) => path.replaceAll("$HOME", home);
14
- var parseBridgeStub = (contents, stubPath) => {
15
- const helperSuffix = contents.match(/^H=(\S+)$/m)?.[1] ?? BRIDGE_HELPER_SUFFIX;
16
- const cachePath = contents.match(/^C="([^"\n]+)"$/m)?.[1] ?? join(dirname(stubPath), ".bridge-cache");
17
- const rootsLine = contents.match(/^for P in ((?:"[^"\n]*"\s*)+); do$/m)?.[1];
18
- const bundleRoots = rootsLine ? [...rootsLine.matchAll(/"([^"]*)"/g)].map((match) => match[1]) : BRIDGE_BUNDLE_ROOTS;
19
- const bundleIdentifier = contents.match(/kMDItemCFBundleIdentifier == "([^"]+)"/)?.[1] ?? BRIDGE_BUNDLE_IDENTIFIER;
20
- return { helperSuffix, cachePath, bundleRoots, bundleIdentifier };
21
- };
22
- var resolveBridgeStub = (stubPath, probe) => {
23
- const contents = probe.readFile(stubPath);
24
- if (contents === null) return { kind: "no-stub", stub: stubPath };
25
- const shape = parseBridgeStub(contents, stubPath);
26
- const helperIn = (bundle) => `${bundle}${shape.helperSuffix}`;
27
- const looked = [];
28
- for (const root of shape.bundleRoots.map((root2) => expandHome(root2, probe.home))) {
29
- looked.push(root);
30
- if (probe.exists(helperIn(root))) return { kind: "bundle", helper: helperIn(root), via: "root" };
31
- }
32
- const cached = shape.cachePath ? probe.readFile(shape.cachePath)?.split("\n")[0]?.trim() : void 0;
33
- if (cached) {
34
- looked.push(cached);
35
- if (probe.exists(helperIn(cached))) return { kind: "bundle", helper: helperIn(cached), via: "cache" };
36
- }
37
- for (const found of probe.mdfind(shape.bundleIdentifier)) {
38
- looked.push(found);
39
- if (probe.exists(helperIn(found))) return { kind: "bundle", helper: helperIn(found), via: "spotlight" };
40
- }
41
- return { kind: "missing", stub: stubPath, looked };
42
- };
43
- var BRIDGE_GONE_MESSAGE = "the Mac app is gone but its hooks remain; run pushary setup or reinstall the app";
44
- var describeBridgeResolution = (resolution) => {
45
- switch (resolution.kind) {
46
- case "bundle":
47
- return `${resolution.helper} (${resolution.via === "root" ? "installed" : resolution.via === "cache" ? "cached path" : "found by Spotlight"})`;
48
- case "missing":
49
- return BRIDGE_GONE_MESSAGE;
50
- case "no-stub":
51
- return `${resolution.stub} is not there; ${BRIDGE_GONE_MESSAGE}`;
52
- }
53
- };
54
- var isBridgeLocator = (executable) => executable !== null && executable.split(/[/\\]/).pop() === HOOK_LOCATOR_BINARY;
55
- var spotlight = (bundleIdentifier) => {
56
- if (process.platform !== "darwin") return [];
57
- try {
58
- return execFileSync("/usr/bin/mdfind", [`kMDItemCFBundleIdentifier == "${bundleIdentifier}"`], {
59
- encoding: "utf-8",
60
- timeout: 5e3,
61
- stdio: ["ignore", "pipe", "ignore"]
62
- }).split("\n").map((line) => line.trim()).filter((line) => line !== "");
63
- } catch {
64
- return [];
65
- }
66
- };
67
- var readOrNull = (path) => {
68
- try {
69
- return readFileSync(path, "utf-8");
70
- } catch {
71
- return null;
72
- }
73
- };
74
- var liveBridgeProbe = () => ({
75
- exists: existsSync,
76
- readFile: readOrNull,
77
- mdfind: spotlight,
78
- home: homedir()
79
- });
80
-
81
- export {
82
- resolveBridgeStub,
83
- describeBridgeResolution,
84
- isBridgeLocator,
85
- liveBridgeProbe
86
- };
@@ -1,44 +0,0 @@
1
- import {
2
- createIo
3
- } from "./chunk-U4TMAANR.js";
4
- import {
5
- describeKeyCheck,
6
- keyCheckFromResponse
7
- } from "./chunk-KFKL3FHS.js";
8
- import {
9
- EXIT
10
- } from "./chunk-KZERVKTD.js";
11
-
12
- // src/cli/report-key.ts
13
- var { dim, yellow } = createIo();
14
- var printKeyCheck = (check, baseUrl) => {
15
- const report = describeKeyCheck(check, baseUrl);
16
- console.log(` ${yellow("!")} ${report.message}`);
17
- for (const line of report.next) console.log(` ${dim(line)}`);
18
- return report;
19
- };
20
- var exitIfKeyFailure = async (response, baseUrl) => {
21
- const check = await keyCheckFromResponse(response, baseUrl);
22
- if (!check) return;
23
- const report = printKeyCheck(check, baseUrl);
24
- process.exit(report.exitCode);
25
- };
26
- var responseDetail = async (response) => {
27
- try {
28
- const body = await response.json();
29
- const text = [body.error, body.message].find((part) => typeof part === "string" && part);
30
- if (typeof text === "string") return text;
31
- } catch {
32
- }
33
- return response.statusText || `HTTP ${response.status}`;
34
- };
35
- var exitOnFailedResponse = async (response, baseUrl) => {
36
- await exitIfKeyFailure(response, baseUrl);
37
- console.log(` ${yellow("!")} Failed: ${await responseDetail(response)}`);
38
- process.exit(EXIT.FAILED);
39
- };
40
-
41
- export {
42
- printKeyCheck,
43
- exitOnFailedResponse
44
- };
@@ -1,38 +0,0 @@
1
- import {
2
- ensureCodexTrustAfterReapply,
3
- inspectConfiguredManagedProviders,
4
- reapplyAllAgents,
5
- reapplyClaudeForVersion,
6
- reapplyClaudeSettings,
7
- reapplyCodexSettings,
8
- reapplyCursorPlugin,
9
- reapplyGeminiSettings,
10
- reapplyOpenCodePlugin,
11
- reapplyVsCodePlugin,
12
- repairCodexHolds
13
- } from "./chunk-NIBFSARF.js";
14
- import "./chunk-H7MMU64M.js";
15
- import "./chunk-X5NXPCIC.js";
16
- import "./chunk-ANEAA37E.js";
17
- import "./chunk-RIVNNBEK.js";
18
- import "./chunk-4YO4T5FV.js";
19
- import "./chunk-JCWZ23MJ.js";
20
- import "./chunk-XHKBHWLX.js";
21
- import "./chunk-6ICPEJY5.js";
22
- import "./chunk-6DJTDHBI.js";
23
- import "./chunk-ZUTU43FT.js";
24
- import "./chunk-T7E75EKA.js";
25
- import "./chunk-QR6VE5ME.js";
26
- export {
27
- ensureCodexTrustAfterReapply,
28
- inspectConfiguredManagedProviders,
29
- reapplyAllAgents,
30
- reapplyClaudeForVersion,
31
- reapplyClaudeSettings,
32
- reapplyCodexSettings,
33
- reapplyCursorPlugin,
34
- reapplyGeminiSettings,
35
- reapplyOpenCodePlugin,
36
- reapplyVsCodePlugin,
37
- repairCodexHolds
38
- };