@pushary/agent-hooks 0.88.0 → 0.89.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 (62) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/data/cursor-plugin/scripts/pushary-gate.mjs +63 -7
  3. package/data/vscode-plugin/scripts/pushary-gate.mjs +56 -18
  4. package/dist/bin/pushary-bell-hook.js +4 -4
  5. package/dist/bin/pushary-bell.js +7 -7
  6. package/dist/bin/pushary-claude.js +9 -9
  7. package/dist/bin/pushary-clean.js +11 -13
  8. package/dist/bin/pushary-codex-bridge.js +6 -6
  9. package/dist/bin/pushary-codex-hook.js +5 -5
  10. package/dist/bin/pushary-codex.js +4 -4
  11. package/dist/bin/pushary-connect.js +6 -6
  12. package/dist/bin/pushary-daemon.js +5 -5
  13. package/dist/bin/pushary-disconnect.js +9 -11
  14. package/dist/bin/pushary-doctor.js +15 -15
  15. package/dist/bin/pushary-elicitation-hook.js +7 -120
  16. package/dist/bin/pushary-gemini-bridge.js +6 -6
  17. package/dist/bin/pushary-gemini-hook.js +5 -5
  18. package/dist/bin/pushary-hook.js +6 -6
  19. package/dist/bin/pushary-login.js +4 -4
  20. package/dist/bin/pushary-logout.js +4 -4
  21. package/dist/bin/pushary-mode.js +3 -3
  22. package/dist/bin/pushary-notification-hook.js +4 -4
  23. package/dist/bin/pushary-opencode-hook.js +5 -5
  24. package/dist/bin/pushary-permission-denied-hook.js +6 -6
  25. package/dist/bin/pushary-permission-hook.js +6 -6
  26. package/dist/bin/pushary-post-hook.js +4 -4
  27. package/dist/bin/pushary-prompt-hook.js +4 -4
  28. package/dist/bin/pushary-session-end-hook.js +4 -4
  29. package/dist/bin/pushary-session-start-hook.js +4 -4
  30. package/dist/bin/pushary-setup.js +32 -29
  31. package/dist/bin/pushary-stats.js +2 -2
  32. package/dist/bin/pushary-status.js +5 -5
  33. package/dist/bin/pushary-stop-hook.js +4 -4
  34. package/dist/bin/pushary-stopfailure-hook.js +4 -4
  35. package/dist/bin/pushary-upgrade.js +10 -12
  36. package/dist/bin/pushary-wait.js +3 -3
  37. package/dist/{chunk-OULRSHFB.js → chunk-4FANZF2L.js} +2 -2
  38. package/dist/{chunk-DSTZ2RBU.js → chunk-4KMWTOBK.js} +4 -1
  39. package/dist/{chunk-LEYXXXRN.js → chunk-6GBQDZ7K.js} +1 -1
  40. package/dist/{chunk-B7ZBHWOW.js → chunk-AIGDBRIJ.js} +1 -1
  41. package/dist/{chunk-VSCSZ2LI.js → chunk-AJ4EMW5D.js} +1 -1
  42. package/dist/{chunk-DXBUFXPL.js → chunk-DLI5IXSD.js} +1 -1
  43. package/dist/{chunk-67TNJVJW.js → chunk-EKNFTIKO.js} +1 -1
  44. package/dist/{chunk-MY5A4EPQ.js → chunk-F3ZDPL6O.js} +187 -60
  45. package/dist/{chunk-VHHVGVFQ.js → chunk-FRH2QIMY.js} +1 -1
  46. package/dist/{chunk-XFHMGVMX.js → chunk-LNAQWWBP.js} +1 -1
  47. package/dist/{chunk-F5W3AY6L.js → chunk-LXTX5CT7.js} +1 -1
  48. package/dist/{chunk-T2XZH7D5.js → chunk-O7P7O4VY.js} +2 -2
  49. package/dist/{chunk-MNXG6IIM.js → chunk-OSE7X44J.js} +3 -3
  50. package/dist/{chunk-4VYELDAH.js → chunk-PXEFENML.js} +1 -1
  51. package/dist/{chunk-3JL64GVE.js → chunk-Q6MK2YKV.js} +120 -1
  52. package/dist/{chunk-ESARAYRI.js → chunk-SHVW5KFR.js} +1 -1
  53. package/dist/{chunk-RSUBLTMP.js → chunk-SUZF64M4.js} +2 -2
  54. package/dist/{chunk-3B3PYTKH.js → chunk-U44C3ULB.js} +1 -1
  55. package/dist/{chunk-UTQCV46U.js → chunk-U65EIMUJ.js} +4 -4
  56. package/dist/{chunk-6BOE5NJZ.js → chunk-WFFPWJN6.js} +1 -1
  57. package/dist/{chunk-WXCHB6BO.js → chunk-WPDMGNQR.js} +1 -1
  58. package/dist/{chunk-3PSEZOC4.js → chunk-ZPRF4YLA.js} +1 -1
  59. package/dist/src/index.js +6 -6
  60. package/package.json +1 -1
  61. package/dist/chunk-U6HRYNHC.js +0 -137
  62. /package/dist/{chunk-VT4IVERX.js → chunk-PZA7G4CN.js} +0 -0
package/dist/src/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  handlePreToolUse
3
- } from "../chunk-UTQCV46U.js";
3
+ } from "../chunk-U65EIMUJ.js";
4
4
  import "../chunk-ATBKJNWS.js";
5
- import "../chunk-4VYELDAH.js";
5
+ import "../chunk-PXEFENML.js";
6
6
  import "../chunk-YHG74UFF.js";
7
7
  import {
8
8
  fetchModeOverride,
@@ -12,17 +12,17 @@ import {
12
12
  handlePostToolUse,
13
13
  handleStop,
14
14
  reportEvent
15
- } from "../chunk-MNXG6IIM.js";
15
+ } from "../chunk-OSE7X44J.js";
16
16
  import {
17
17
  askUser,
18
18
  cancelQuestion,
19
19
  waitForAnswer
20
20
  } from "../chunk-J3YDT4HM.js";
21
- import "../chunk-F5W3AY6L.js";
21
+ import "../chunk-LXTX5CT7.js";
22
22
  import "../chunk-RN3NOEJF.js";
23
23
  import "../chunk-BSZYIAZL.js";
24
24
  import "../chunk-SAF6HGAA.js";
25
- import "../chunk-VSCSZ2LI.js";
25
+ import "../chunk-AJ4EMW5D.js";
26
26
  import "../chunk-7QLSKOSU.js";
27
27
  import "../chunk-KZERVKTD.js";
28
28
  import {
@@ -31,7 +31,7 @@ import {
31
31
  } from "../chunk-2UMNXADU.js";
32
32
  import {
33
33
  resolvePolicy
34
- } from "../chunk-3JL64GVE.js";
34
+ } from "../chunk-Q6MK2YKV.js";
35
35
  export {
36
36
  askUser,
37
37
  cancelQuestion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushary/agent-hooks",
3
- "version": "0.88.0",
3
+ "version": "0.89.0",
4
4
  "description": "Permission hooks for AI coding agents: route tool approvals through Pushary push notifications",
5
5
  "keywords": [
6
6
  "pushary",
@@ -1,137 +0,0 @@
1
- import {
2
- CLAUDE_HOOK_EVENTS,
3
- supportedClaudeEvents
4
- } from "./chunk-MY5A4EPQ.js";
5
- import {
6
- guardBinary
7
- } from "./chunk-B7ZBHWOW.js";
8
- import {
9
- HOOK_LOCATOR_BINARY
10
- } from "./chunk-3JL64GVE.js";
11
-
12
- // src/claude-config.ts
13
- import { join } from "path";
14
- var PUSHARY_MCP_URL = "https://pushary.com/api/mcp/mcp";
15
- var PUSHARY_PERMISSION_RULE = "mcp__pushary__*";
16
- var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
17
- var ensureRecord = (target, key) => {
18
- const existing = asRecord(target[key]);
19
- if (existing) return existing;
20
- const created = {};
21
- target[key] = created;
22
- return created;
23
- };
24
- var isPusharyPermission = (rule) => typeof rule === "string" && (rule.includes("pushary") || rule.includes("MCP(pushary"));
25
- var HOOK_BINARIES = /* @__PURE__ */ new Set([
26
- ...CLAUDE_HOOK_EVENTS.map((hook) => hook.binary),
27
- HOOK_LOCATOR_BINARY
28
- ]);
29
- var namesPusharyBinary = (command) => command.split(/[\s/\\"']+/).some((segment) => HOOK_BINARIES.has(segment.replace(/\.(cmd|exe)$/i, "")));
30
- var isPusharyHook = (entry2) => {
31
- const hooks = asRecord(entry2)?.hooks;
32
- if (!Array.isArray(hooks)) return false;
33
- return hooks.some((hook) => namesPusharyBinary(String(asRecord(hook)?.command ?? "")));
34
- };
35
- var addClaudeMcpServer = (config, apiKey) => {
36
- const mcpServers = ensureRecord(config, "mcpServers");
37
- mcpServers.pushary = {
38
- type: "http",
39
- url: PUSHARY_MCP_URL,
40
- headers: { Authorization: `Bearer ${apiKey}` }
41
- };
42
- };
43
- var removeClaudeMcpServers = (config) => {
44
- let changed = false;
45
- const removeFrom = (target) => {
46
- const mcpServers = asRecord(target.mcpServers);
47
- if (!mcpServers?.pushary) return;
48
- delete mcpServers.pushary;
49
- if (Object.keys(mcpServers).length === 0) delete target.mcpServers;
50
- changed = true;
51
- };
52
- removeFrom(config);
53
- const projects = asRecord(config.projects);
54
- if (projects) {
55
- for (const project of Object.values(projects)) {
56
- const projectConfig = asRecord(project);
57
- if (projectConfig) removeFrom(projectConfig);
58
- }
59
- }
60
- return changed;
61
- };
62
- var addPusharyToolPermissions = (settings) => {
63
- const permissions = ensureRecord(settings, "permissions");
64
- const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
65
- const filtered = allow.filter((rule) => !isPusharyPermission(rule));
66
- if (!filtered.includes(PUSHARY_PERMISSION_RULE)) {
67
- filtered.push(PUSHARY_PERMISSION_RULE);
68
- }
69
- permissions.allow = filtered;
70
- };
71
- var addPusharyHooks = (settings, binDir, version = null) => {
72
- const resolve = (name) => guardBinary(binDir ? join(binDir, name) : name);
73
- const hooks = ensureRecord(settings, "hooks");
74
- const supported = new Map(supportedClaudeEvents(version).map((hook) => [hook.event, hook]));
75
- for (const known of CLAUDE_HOOK_EVENTS) {
76
- const current = hooks[known.event];
77
- const others = (Array.isArray(current) ? current : []).filter((item) => !isPusharyHook(item));
78
- const definition = supported.get(known.event);
79
- if (definition) {
80
- hooks[known.event] = [...others, entry(definition, resolve)];
81
- } else if (others.length > 0) {
82
- hooks[known.event] = others;
83
- } else {
84
- delete hooks[known.event];
85
- }
86
- }
87
- };
88
- var entry = (definition, resolve) => ({
89
- ...definition.matcher ? { matcher: definition.matcher } : {},
90
- hooks: [{
91
- type: "command",
92
- command: resolve(definition.binary),
93
- timeout: definition.timeout
94
- }]
95
- });
96
- var removePusharySettings = (settings) => {
97
- let changed = removeClaudeMcpServers(settings);
98
- const permissions = asRecord(settings.permissions);
99
- if (permissions && Array.isArray(permissions.allow)) {
100
- const filtered = permissions.allow.filter((rule) => !isPusharyPermission(rule));
101
- if (filtered.length !== permissions.allow.length) {
102
- if (filtered.length === 0) {
103
- delete permissions.allow;
104
- } else {
105
- permissions.allow = filtered;
106
- }
107
- if (Object.keys(permissions).length === 0) delete settings.permissions;
108
- changed = true;
109
- }
110
- }
111
- const hooks = asRecord(settings.hooks);
112
- if (hooks) {
113
- for (const { event: key } of CLAUDE_HOOK_EVENTS) {
114
- const entries = hooks[key];
115
- if (!Array.isArray(entries)) continue;
116
- const filtered = entries.filter((entry2) => !isPusharyHook(entry2));
117
- if (filtered.length !== entries.length) {
118
- if (filtered.length === 0) {
119
- delete hooks[key];
120
- } else {
121
- hooks[key] = filtered;
122
- }
123
- changed = true;
124
- }
125
- }
126
- if (Object.keys(hooks).length === 0) delete settings.hooks;
127
- }
128
- return changed;
129
- };
130
-
131
- export {
132
- addClaudeMcpServer,
133
- removeClaudeMcpServers,
134
- addPusharyToolPermissions,
135
- addPusharyHooks,
136
- removePusharySettings
137
- };
File without changes