@pushary/agent-hooks 0.25.0 → 0.27.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.
- package/data/cursor-plugin/scripts/pushary-gate.mjs +21 -1
- package/dist/bin/pushary-clean.js +3 -2
- package/dist/bin/pushary-codex-hook.js +37 -12
- package/dist/bin/pushary-codex.js +2 -1
- package/dist/bin/pushary-doctor.js +52 -10
- package/dist/bin/pushary-gemini-hook.js +36 -11
- package/dist/bin/pushary-hook.js +3 -2
- package/dist/bin/pushary-mode.js +5 -3
- package/dist/bin/pushary-post-hook.js +8 -2
- package/dist/bin/pushary-prompt-hook.js +8 -2
- package/dist/bin/pushary-setup.js +11 -21
- package/dist/bin/pushary-stop-hook.js +2 -1
- package/dist/bin/pushary-wait.d.ts +1 -0
- package/dist/bin/pushary-wait.js +86 -0
- package/dist/bin/pushary.js +4 -0
- package/dist/{chunk-WPVL6VIT.js → chunk-FDR5WYT7.js} +50 -2
- package/dist/chunk-IIENZE2J.js +15 -0
- package/dist/{chunk-5MA3CPZB.js → chunk-MVNOP5IZ.js} +5 -1
- package/dist/{chunk-GYPPVD3P.js → chunk-TUILTFLS.js} +74 -184
- package/dist/{chunk-O2QL6U6G.js → chunk-VHD3GMZ3.js} +40 -3
- package/dist/{chunk-JPRRYC5X.js → chunk-WXWHRXDK.js} +32 -3
- package/dist/src/index.d.ts +7 -1
- package/dist/src/index.js +3 -2
- package/package.json +4 -3
- package/dist/chunk-22CV7V7A.js +0 -38
- package/dist/chunk-2BE2IPMO.js +0 -315
- package/dist/chunk-2CRLBMOX.js +0 -244
- package/dist/chunk-2HMNOZPY.js +0 -109
- package/dist/chunk-2I6DLXJN.js +0 -219
- package/dist/chunk-2Q6XPZ4Q.js +0 -395
- package/dist/chunk-3LC4YUMA.js +0 -194
- package/dist/chunk-3MIR7ODJ.js +0 -112
- package/dist/chunk-3QZESA66.js +0 -222
- package/dist/chunk-4Z4MB37G.js +0 -96
- package/dist/chunk-5GFUI5N6.js +0 -132
- package/dist/chunk-5JEDLXEC.js +0 -99
- package/dist/chunk-5LTQNC7R.js +0 -824
- package/dist/chunk-5QHQVXWN.js +0 -174
- package/dist/chunk-6A3WCJO2.js +0 -416
- package/dist/chunk-6QWFMVCD.js +0 -328
- package/dist/chunk-6SRXMZAN.js +0 -99
- package/dist/chunk-7PTU7TGE.js +0 -96
- package/dist/chunk-AB4KX4XT.js +0 -109
- package/dist/chunk-AC4UYAGX.js +0 -136
- package/dist/chunk-ACE77TKQ.js +0 -328
- package/dist/chunk-BHAMEPOP.js +0 -323
- package/dist/chunk-BYNYYZWW.js +0 -412
- package/dist/chunk-C5TFTNHG.js +0 -244
- package/dist/chunk-CH53PBQN.js +0 -265
- package/dist/chunk-DF3BM6BF.js +0 -195
- package/dist/chunk-DKZVKEOW.js +0 -175
- package/dist/chunk-EMPL27ZV.js +0 -96
- package/dist/chunk-EQJXMEIR.js +0 -175
- package/dist/chunk-FGZZRCOG.js +0 -194
- package/dist/chunk-FXYTRZHC.js +0 -177
- package/dist/chunk-GTJGZBTQ.js +0 -328
- package/dist/chunk-HJMFYDWY.js +0 -222
- package/dist/chunk-HRQEECB6.js +0 -315
- package/dist/chunk-HWEMAAOY.js +0 -370
- package/dist/chunk-IBWCHA5M.js +0 -10
- package/dist/chunk-KTM4ZQ3W.js +0 -96
- package/dist/chunk-KTP2EPVB.js +0 -27
- package/dist/chunk-KYARP7KP.js +0 -97
- package/dist/chunk-M2N5DYWN.js +0 -247
- package/dist/chunk-M4GDBGXF.js +0 -824
- package/dist/chunk-M5F2L4KF.js +0 -177
- package/dist/chunk-M6S3M6E3.js +0 -244
- package/dist/chunk-N7VXDBQU.js +0 -6
- package/dist/chunk-O6A5RHWY.js +0 -122
- package/dist/chunk-ODUXELPM.js +0 -219
- package/dist/chunk-OF5WIOYS.js +0 -129
- package/dist/chunk-OP4QAN23.js +0 -99
- package/dist/chunk-P4JH2Q7Z.js +0 -102
- package/dist/chunk-PMD5JSV3.js +0 -242
- package/dist/chunk-PSSHNBEL.js +0 -177
- package/dist/chunk-QEPRH7JB.js +0 -315
- package/dist/chunk-QRXWPZKN.js +0 -308
- package/dist/chunk-QY4L6XHN.js +0 -384
- package/dist/chunk-RNWPCELY.js +0 -176
- package/dist/chunk-RSHN2AQ7.js +0 -29
- package/dist/chunk-RZLVE57X.js +0 -38
- package/dist/chunk-SDCIKREA.js +0 -241
- package/dist/chunk-SDREQWNI.js +0 -175
- package/dist/chunk-SH26ZOHU.js +0 -159
- package/dist/chunk-TRLBBLSS.js +0 -176
- package/dist/chunk-U6OXZPYC.js +0 -384
- package/dist/chunk-UIBTFZUD.js +0 -314
- package/dist/chunk-USUCPCUC.js +0 -156
- package/dist/chunk-V4GLWPD7.js +0 -174
- package/dist/chunk-VC6U3QGF.js +0 -142
- package/dist/chunk-VIST7ACL.js +0 -88
- package/dist/chunk-VUNL35KE.js +0 -16
- package/dist/chunk-VWBNI4SC.js +0 -174
- package/dist/chunk-W5KRWUNE.js +0 -262
- package/dist/chunk-WCGKLHCL.js +0 -154
- package/dist/chunk-WNXGIEX7.js +0 -219
- package/dist/chunk-XPVSZIA3.js +0 -315
- package/dist/chunk-Y633ZIJF.js +0 -384
- package/dist/chunk-YCL4GUFR.js +0 -222
- package/dist/chunk-YTMKB44I.js +0 -220
- package/dist/chunk-ZWBS3T7Q.js +0 -244
- package/dist/pushary-mode-T7XOPI6Z.js +0 -83
package/dist/chunk-5GFUI5N6.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// src/claude-config.ts
|
|
2
|
-
import { join } from "path";
|
|
3
|
-
var PUSHARY_MCP_URL = "https://pushary.com/api/mcp/mcp";
|
|
4
|
-
var PUSHARY_PERMISSION_RULE = "mcp__pushary__*";
|
|
5
|
-
var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
6
|
-
var ensureRecord = (target, key) => {
|
|
7
|
-
const existing = asRecord(target[key]);
|
|
8
|
-
if (existing) return existing;
|
|
9
|
-
const created = {};
|
|
10
|
-
target[key] = created;
|
|
11
|
-
return created;
|
|
12
|
-
};
|
|
13
|
-
var isPusharyPermission = (rule) => typeof rule === "string" && (rule.includes("pushary") || rule.includes("MCP(pushary"));
|
|
14
|
-
var isPusharyHook = (entry) => {
|
|
15
|
-
const hooks = asRecord(entry)?.hooks;
|
|
16
|
-
if (!Array.isArray(hooks)) return false;
|
|
17
|
-
return hooks.some((hook) => {
|
|
18
|
-
const command = String(asRecord(hook)?.command ?? "");
|
|
19
|
-
return command.includes("pushary-hook") || command.includes("pushary-post-hook") || command.includes("pushary-stop-hook");
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var addClaudeMcpServer = (config, apiKey) => {
|
|
23
|
-
const mcpServers = ensureRecord(config, "mcpServers");
|
|
24
|
-
mcpServers.pushary = {
|
|
25
|
-
type: "http",
|
|
26
|
-
url: PUSHARY_MCP_URL,
|
|
27
|
-
headers: { Authorization: `Bearer ${apiKey}` }
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
var removeClaudeMcpServers = (config) => {
|
|
31
|
-
let changed = false;
|
|
32
|
-
const removeFrom = (target) => {
|
|
33
|
-
const mcpServers = asRecord(target.mcpServers);
|
|
34
|
-
if (!mcpServers?.pushary) return;
|
|
35
|
-
delete mcpServers.pushary;
|
|
36
|
-
if (Object.keys(mcpServers).length === 0) delete target.mcpServers;
|
|
37
|
-
changed = true;
|
|
38
|
-
};
|
|
39
|
-
removeFrom(config);
|
|
40
|
-
const projects = asRecord(config.projects);
|
|
41
|
-
if (projects) {
|
|
42
|
-
for (const project of Object.values(projects)) {
|
|
43
|
-
const projectConfig = asRecord(project);
|
|
44
|
-
if (projectConfig) removeFrom(projectConfig);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return changed;
|
|
48
|
-
};
|
|
49
|
-
var addPusharyToolPermissions = (settings) => {
|
|
50
|
-
const permissions = ensureRecord(settings, "permissions");
|
|
51
|
-
const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
|
|
52
|
-
const filtered = allow.filter((rule) => !isPusharyPermission(rule));
|
|
53
|
-
if (!filtered.includes(PUSHARY_PERMISSION_RULE)) {
|
|
54
|
-
filtered.push(PUSHARY_PERMISSION_RULE);
|
|
55
|
-
}
|
|
56
|
-
permissions.allow = filtered;
|
|
57
|
-
};
|
|
58
|
-
var addPusharyHooks = (settings, binDir) => {
|
|
59
|
-
const resolve = (name) => binDir ? join(binDir, name) : name;
|
|
60
|
-
const hooks = ensureRecord(settings, "hooks");
|
|
61
|
-
const preToolUse = (Array.isArray(hooks.PreToolUse) ? hooks.PreToolUse : []).filter((entry) => !isPusharyHook(entry));
|
|
62
|
-
preToolUse.push({
|
|
63
|
-
matcher: "Bash|Write|Edit",
|
|
64
|
-
hooks: [{
|
|
65
|
-
type: "command",
|
|
66
|
-
command: resolve("pushary-hook"),
|
|
67
|
-
timeout: 120
|
|
68
|
-
}]
|
|
69
|
-
});
|
|
70
|
-
hooks.PreToolUse = preToolUse;
|
|
71
|
-
const postToolUse = (Array.isArray(hooks.PostToolUse) ? hooks.PostToolUse : []).filter((entry) => !isPusharyHook(entry));
|
|
72
|
-
postToolUse.push({
|
|
73
|
-
matcher: "Bash|Write|Edit",
|
|
74
|
-
hooks: [{
|
|
75
|
-
type: "command",
|
|
76
|
-
command: resolve("pushary-post-hook"),
|
|
77
|
-
timeout: 10
|
|
78
|
-
}]
|
|
79
|
-
});
|
|
80
|
-
hooks.PostToolUse = postToolUse;
|
|
81
|
-
const stop = (Array.isArray(hooks.Stop) ? hooks.Stop : []).filter((entry) => !isPusharyHook(entry));
|
|
82
|
-
stop.push({
|
|
83
|
-
hooks: [{
|
|
84
|
-
type: "command",
|
|
85
|
-
command: resolve("pushary-stop-hook"),
|
|
86
|
-
timeout: 10
|
|
87
|
-
}]
|
|
88
|
-
});
|
|
89
|
-
hooks.Stop = stop;
|
|
90
|
-
};
|
|
91
|
-
var removePusharySettings = (settings) => {
|
|
92
|
-
let changed = removeClaudeMcpServers(settings);
|
|
93
|
-
const permissions = asRecord(settings.permissions);
|
|
94
|
-
if (permissions && Array.isArray(permissions.allow)) {
|
|
95
|
-
const filtered = permissions.allow.filter((rule) => !isPusharyPermission(rule));
|
|
96
|
-
if (filtered.length !== permissions.allow.length) {
|
|
97
|
-
if (filtered.length === 0) {
|
|
98
|
-
delete permissions.allow;
|
|
99
|
-
} else {
|
|
100
|
-
permissions.allow = filtered;
|
|
101
|
-
}
|
|
102
|
-
if (Object.keys(permissions).length === 0) delete settings.permissions;
|
|
103
|
-
changed = true;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
const hooks = asRecord(settings.hooks);
|
|
107
|
-
if (hooks) {
|
|
108
|
-
for (const key of ["PreToolUse", "PostToolUse", "Stop"]) {
|
|
109
|
-
const entries = hooks[key];
|
|
110
|
-
if (!Array.isArray(entries)) continue;
|
|
111
|
-
const filtered = entries.filter((entry) => !isPusharyHook(entry));
|
|
112
|
-
if (filtered.length !== entries.length) {
|
|
113
|
-
if (filtered.length === 0) {
|
|
114
|
-
delete hooks[key];
|
|
115
|
-
} else {
|
|
116
|
-
hooks[key] = filtered;
|
|
117
|
-
}
|
|
118
|
-
changed = true;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
if (Object.keys(hooks).length === 0) delete settings.hooks;
|
|
122
|
-
}
|
|
123
|
-
return changed;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export {
|
|
127
|
-
addClaudeMcpServer,
|
|
128
|
-
removeClaudeMcpServers,
|
|
129
|
-
addPusharyToolPermissions,
|
|
130
|
-
addPusharyHooks,
|
|
131
|
-
removePusharySettings
|
|
132
|
-
};
|
package/dist/chunk-5JEDLXEC.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cancelQuestion,
|
|
3
|
-
describeToolCall,
|
|
4
|
-
listPendingQuestions,
|
|
5
|
-
removePendingQuestion
|
|
6
|
-
} from "./chunk-EMPL27ZV.js";
|
|
7
|
-
import {
|
|
8
|
-
withRetry
|
|
9
|
-
} from "./chunk-3MIR7ODJ.js";
|
|
10
|
-
import {
|
|
11
|
-
getApiKey,
|
|
12
|
-
getBaseUrl
|
|
13
|
-
} from "./chunk-VUNL35KE.js";
|
|
14
|
-
|
|
15
|
-
// src/events.ts
|
|
16
|
-
import { hostname } from "os";
|
|
17
|
-
import { basename } from "path";
|
|
18
|
-
var cleanupPendingQuestions = async () => {
|
|
19
|
-
try {
|
|
20
|
-
const files = listPendingQuestions();
|
|
21
|
-
const apiKey = getApiKey();
|
|
22
|
-
for (const correlationId of files) {
|
|
23
|
-
try {
|
|
24
|
-
await cancelQuestion(apiKey, correlationId);
|
|
25
|
-
} catch {
|
|
26
|
-
}
|
|
27
|
-
removePendingQuestion(correlationId);
|
|
28
|
-
}
|
|
29
|
-
} catch {
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
var reportEvent = async (event) => {
|
|
33
|
-
const apiKey = getApiKey();
|
|
34
|
-
const baseUrl = getBaseUrl();
|
|
35
|
-
await withRetry(async () => {
|
|
36
|
-
await fetch(`${baseUrl}/api/agent/event`, {
|
|
37
|
-
method: "POST",
|
|
38
|
-
headers: {
|
|
39
|
-
"Content-Type": "application/json",
|
|
40
|
-
"Authorization": `Bearer ${apiKey}`
|
|
41
|
-
},
|
|
42
|
-
body: JSON.stringify({
|
|
43
|
-
...event,
|
|
44
|
-
machineId: event.machineId ?? hostname()
|
|
45
|
-
}),
|
|
46
|
-
signal: AbortSignal.timeout(1e4)
|
|
47
|
-
});
|
|
48
|
-
}, { maxAttempts: 2, baseDelayMs: 300 });
|
|
49
|
-
};
|
|
50
|
-
var handlePostToolUse = async (input) => {
|
|
51
|
-
try {
|
|
52
|
-
const projectName = basename(input.cwd ?? process.cwd());
|
|
53
|
-
const action = describeToolCall(input.tool_name, input.tool_input, "event");
|
|
54
|
-
const isError = input.tool_result && ("error" in input.tool_result || "is_error" in input.tool_result);
|
|
55
|
-
await Promise.allSettled([
|
|
56
|
-
cleanupPendingQuestions(),
|
|
57
|
-
reportEvent({
|
|
58
|
-
event: isError ? "tool_error" : "tool_complete",
|
|
59
|
-
agentType: "claude_code",
|
|
60
|
-
agentName: `Claude Code - ${projectName}`,
|
|
61
|
-
action,
|
|
62
|
-
error: isError ? String(input.tool_result?.error ?? input.tool_result?.stderr ?? "").slice(0, 500) : void 0
|
|
63
|
-
})
|
|
64
|
-
]);
|
|
65
|
-
} catch {
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
var handleStop = async (input) => {
|
|
69
|
-
try {
|
|
70
|
-
const projectName = basename(input.cwd ?? process.cwd());
|
|
71
|
-
await reportEvent({
|
|
72
|
-
event: "session_end",
|
|
73
|
-
agentType: "claude_code",
|
|
74
|
-
agentName: `Claude Code - ${projectName}`,
|
|
75
|
-
action: "Session ended"
|
|
76
|
-
});
|
|
77
|
-
} catch {
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
var handleNotification = async (input) => {
|
|
81
|
-
try {
|
|
82
|
-
const projectName = basename(input.cwd ?? process.cwd());
|
|
83
|
-
await reportEvent({
|
|
84
|
-
event: input.type === "error" ? "error" : "notification",
|
|
85
|
-
agentType: "claude_code",
|
|
86
|
-
agentName: `Claude Code - ${projectName}`,
|
|
87
|
-
action: input.title ?? input.message ?? "Notification",
|
|
88
|
-
error: input.type === "error" ? input.message : void 0
|
|
89
|
-
});
|
|
90
|
-
} catch {
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export {
|
|
95
|
-
reportEvent,
|
|
96
|
-
handlePostToolUse,
|
|
97
|
-
handleStop,
|
|
98
|
-
handleNotification
|
|
99
|
-
};
|