@pushary/agent-hooks 1.9.7 → 1.9.9
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/CHANGELOG.md +18 -0
- package/README.md +3 -3
- package/data/cursor-plugin/README.md +3 -7
- package/data/vscode-plugin/README.md +1 -1
- package/dist/bin/pushary-bell-hook.js +22 -24
- package/dist/bin/pushary-bell.js +13 -13
- package/dist/bin/pushary-claude.js +28 -30
- package/dist/bin/pushary-clean.js +113 -94
- package/dist/bin/pushary-codex-bridge.js +20 -20
- package/dist/bin/pushary-codex-hook.js +36 -38
- package/dist/bin/pushary-codex.js +13 -13
- package/dist/bin/pushary-connect.js +48 -22
- package/dist/bin/pushary-cowork.js +5 -5
- package/dist/bin/pushary-daemon.js +50 -40
- package/dist/bin/pushary-disconnect.js +188 -56
- package/dist/bin/pushary-doctor.js +105 -85
- package/dist/bin/pushary-elicitation-hook.js +25 -27
- package/dist/bin/pushary-gemini-bridge.js +13 -13
- package/dist/bin/pushary-gemini-hook.js +31 -33
- package/dist/bin/pushary-hook.js +36 -39
- package/dist/bin/pushary-login.js +12 -12
- package/dist/bin/pushary-logout.js +105 -42
- package/dist/bin/pushary-mcp.js +9 -9
- package/dist/bin/pushary-mode.js +28 -31
- package/dist/bin/pushary-notification-hook.js +29 -32
- package/dist/bin/pushary-opencode-hook.js +30 -32
- package/dist/bin/pushary-permission-denied-hook.js +30 -33
- package/dist/bin/pushary-permission-hook.js +33 -36
- package/dist/bin/pushary-post-hook.js +30 -33
- package/dist/bin/pushary-prompt-hook.js +29 -32
- package/dist/bin/pushary-session-end-hook.js +29 -32
- package/dist/bin/pushary-session-start-hook.js +33 -36
- package/dist/bin/pushary-setup.js +168 -160
- package/dist/bin/pushary-stats.js +5 -5
- package/dist/bin/pushary-status.js +65 -19
- package/dist/bin/pushary-stop-hook.js +29 -32
- package/dist/bin/pushary-stopfailure-hook.js +29 -32
- package/dist/bin/pushary-suggestions.js +19 -21
- package/dist/bin/pushary-transcript-register.js +18 -20
- package/dist/bin/pushary-transcripts.js +7 -7
- package/dist/bin/pushary-upgrade.js +50 -26
- package/dist/bin/pushary-wait.js +23 -19
- package/dist/bin/pushary.js +15 -14
- package/dist/{chunk-4FK6RZVJ.js → chunk-462EQA6K.js} +1 -1
- package/dist/{chunk-STQRUH3S.js → chunk-5DCDQ5VW.js} +59 -15
- package/dist/{chunk-JXISQ7DT.js → chunk-5N5L6DNN.js} +3 -3
- package/dist/{chunk-QR6VE5ME.js → chunk-5RGA636G.js} +79 -17
- package/dist/{chunk-L76HTPU6.js → chunk-6AYSKVLL.js} +3 -3
- package/dist/{chunk-NIBFSARF.js → chunk-6EBGOHDJ.js} +33 -13
- package/dist/{chunk-QQ4HBXZC.js → chunk-6W5M3MSE.js} +84 -673
- package/dist/{chunk-R3YW55MY.js → chunk-AI7RMFVV.js} +29 -26
- package/dist/{chunk-AUUXS44H.js → chunk-APP43AW7.js} +1 -1
- package/dist/{chunk-RQGODFQN.js → chunk-AZOKPWVI.js} +1 -1
- package/dist/{chunk-3GNUXXDZ.js → chunk-B5NMSP3V.js} +2 -2
- package/dist/{chunk-4D2AYNSE.js → chunk-BNSKVIAW.js} +2 -2
- package/dist/chunk-BYLKCZ2G.js +367 -0
- package/dist/{chunk-X5NXPCIC.js → chunk-BZLHTMT6.js} +89 -7
- package/dist/{chunk-BTQGAXZ3.js → chunk-COQ64C4F.js} +10 -10
- package/dist/{chunk-N4EUSDKX.js → chunk-DCCSULXK.js} +14 -14
- package/dist/{chunk-JWKBDSPF.js → chunk-DP3WX7FW.js} +2 -2
- package/dist/chunk-E5HOHIUV.js +52 -0
- package/dist/{chunk-GU3EJCVV.js → chunk-EA5NWDK7.js} +4 -0
- package/dist/chunk-EIAEUG7G.js +46 -0
- package/dist/{chunk-EB4XGVBG.js → chunk-EUW7JL2K.js} +0 -32
- package/dist/{chunk-T7Y5EADL.js → chunk-F7R3SZ4Q.js} +2 -2
- package/dist/{chunk-H37L7TT3.js → chunk-G7RIDXAT.js} +2 -2
- package/dist/{chunk-W2KI5KPD.js → chunk-H5T27W7M.js} +2 -2
- package/dist/chunk-HBWYMRR5.js +94 -0
- package/dist/{chunk-CBQACHKY.js → chunk-IIVZZMSO.js} +1 -1
- package/dist/{chunk-Z6HPS67T.js → chunk-IRHABAQT.js} +1 -1
- package/dist/{chunk-QTO6HEZD.js → chunk-K545B734.js} +2 -2
- package/dist/{chunk-KYO45G5L.js → chunk-KOWFRUIT.js} +1 -1
- package/dist/{chunk-QFEM7R6T.js → chunk-KQFTBQ66.js} +11 -11
- package/dist/chunk-LENBKYRB.js +50 -0
- package/dist/{chunk-JCWZ23MJ.js → chunk-M3STIAGU.js} +3 -3
- package/dist/{chunk-6DJTDHBI.js → chunk-MD4SVNT6.js} +1 -1
- package/dist/{chunk-7264S5HZ.js → chunk-MLGIVVSG.js} +1 -1
- package/dist/{chunk-H7MMU64M.js → chunk-NGKUXZID.js} +2 -2
- package/dist/{chunk-JWQZSYCK.js → chunk-NUVGDBZC.js} +1 -1
- package/dist/{chunk-AQ55ZSSS.js → chunk-OAYWO5NP.js} +1 -1
- package/dist/chunk-Q6C6ILUS.js +49 -0
- package/dist/{chunk-MBK7N46B.js → chunk-QIOIO7VN.js} +6 -6
- package/dist/{chunk-KFKL3FHS.js → chunk-QRXPWW3M.js} +4 -3
- package/dist/{chunk-7OIWWZAD.js → chunk-QTIUJZRX.js} +3 -3
- package/dist/{chunk-XWAYAO3V.js → chunk-R5RIVOPL.js} +2 -2
- package/dist/{chunk-ADSQDYYG.js → chunk-REU2VQPH.js} +54 -5
- package/dist/{chunk-GKI6LFAV.js → chunk-RQ32ADJP.js} +2 -2
- package/dist/{chunk-VXRXFU6Q.js → chunk-SZ4Q6ZVS.js} +14 -7
- package/dist/{chunk-KT5E2RLS.js → chunk-T6ZN4TEF.js} +1 -1
- package/dist/{chunk-UFVGSEWH.js → chunk-TO3PS646.js} +2 -2
- package/dist/chunk-UAP5DS6P.js +599 -0
- package/dist/{chunk-MZPXVH4A.js → chunk-UF6RBP5V.js} +204 -28
- package/dist/{chunk-AVNKVF7N.js → chunk-UPIZSCYD.js} +4 -4
- package/dist/{chunk-3PVDOCFI.js → chunk-VHPFNLRS.js} +5 -5
- package/dist/{chunk-HPRZJKRO.js → chunk-VIIHC42X.js} +1 -1
- package/dist/{chunk-D6S5EKXA.js → chunk-WRPYCIV2.js} +8 -12
- package/dist/{chunk-ZUTU43FT.js → chunk-Z23ZBYDW.js} +6 -4
- package/dist/{chunk-SBLPHUEB.js → chunk-ZGADIZDS.js} +8 -6
- package/dist/{global-upgrade-E2HUEB4B.js → global-upgrade-H272QOGD.js} +6 -6
- package/dist/{paths-QVTEGNZV.js → paths-HMVOTFUN.js} +2 -2
- package/dist/reapply-Q5NHDTVU.js +55 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +19 -20
- package/dist/{upgrade-lock-JCIDZMHF.js → upgrade-lock-L3GHFIRW.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-4YO4T5FV.js +0 -149
- package/dist/chunk-ANEAA37E.js +0 -197
- package/dist/chunk-MNWRUGMH.js +0 -86
- package/dist/chunk-RQSOEB4S.js +0 -44
- package/dist/chunk-SD3272LS.js +0 -143
- package/dist/reapply-5QVKM6LA.js +0 -38
package/dist/chunk-SD3272LS.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AGENT_CHOICES
|
|
3
|
-
} from "./chunk-SBLPHUEB.js";
|
|
4
|
-
import {
|
|
5
|
-
isBridgeLocator
|
|
6
|
-
} from "./chunk-MNWRUGMH.js";
|
|
7
|
-
import {
|
|
8
|
-
pusharyHookExecutable
|
|
9
|
-
} from "./chunk-4YO4T5FV.js";
|
|
10
|
-
import {
|
|
11
|
-
BELL_HOOK_BINARY
|
|
12
|
-
} from "./chunk-7264S5HZ.js";
|
|
13
|
-
|
|
14
|
-
// src/setup/hook-ownership.ts
|
|
15
|
-
var commandsIn = (value) => {
|
|
16
|
-
if (Array.isArray(value)) return value.flatMap(commandsIn);
|
|
17
|
-
if (!value || typeof value !== "object") return [];
|
|
18
|
-
return Object.entries(value).flatMap(([key, item]) => key === "command" && typeof item === "string" ? [item] : commandsIn(item));
|
|
19
|
-
};
|
|
20
|
-
var isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
21
|
-
var hasPaidPusharyCommand = (value) => commandsIn(value).some((command) => {
|
|
22
|
-
const executable = pusharyHookExecutable(command);
|
|
23
|
-
const name = executable?.split(/[/\\]/).pop()?.replace(/\.(cmd|exe|mjs)$/i, "");
|
|
24
|
-
return executable !== null && !isBridgeLocator(executable) && name !== BELL_HOOK_BINARY;
|
|
25
|
-
});
|
|
26
|
-
var hasAppCommand = (value) => commandsIn(value).some((command) => {
|
|
27
|
-
const executable = pusharyHookExecutable(command);
|
|
28
|
-
return executable !== null && isBridgeLocator(executable);
|
|
29
|
-
});
|
|
30
|
-
var mcpBearerKey = (document, containerKey, headersKey) => {
|
|
31
|
-
const servers = isRecord(document?.[containerKey]) ? document[containerKey] : null;
|
|
32
|
-
const pushary = isRecord(servers?.pushary) ? servers.pushary : null;
|
|
33
|
-
const headers = isRecord(pushary?.[headersKey]) ? pushary[headersKey] : null;
|
|
34
|
-
const authorization = headers?.Authorization;
|
|
35
|
-
const match = typeof authorization === "string" ? authorization.trim().match(/^Bearer\s+(\S+)$/) : null;
|
|
36
|
-
return match?.[1] ?? null;
|
|
37
|
-
};
|
|
38
|
-
var captureMcpServer = (document, containerKey) => {
|
|
39
|
-
const container = document[containerKey];
|
|
40
|
-
const servers = isRecord(container) ? container : null;
|
|
41
|
-
if (!servers && Object.hasOwn(document, containerKey)) {
|
|
42
|
-
return { present: false, containerValue: structuredClone(container) };
|
|
43
|
-
}
|
|
44
|
-
return servers && Object.hasOwn(servers, "pushary") ? { present: true, value: structuredClone(servers.pushary) } : { present: false };
|
|
45
|
-
};
|
|
46
|
-
var restoreMcpServer = (document, containerKey, snapshot) => {
|
|
47
|
-
const before = JSON.stringify(document);
|
|
48
|
-
const existing = isRecord(document[containerKey]) ? document[containerKey] : null;
|
|
49
|
-
if (snapshot.present) {
|
|
50
|
-
const servers = existing ?? {};
|
|
51
|
-
servers.pushary = structuredClone(snapshot.value);
|
|
52
|
-
document[containerKey] = servers;
|
|
53
|
-
} else if (Object.hasOwn(snapshot, "containerValue")) {
|
|
54
|
-
document[containerKey] = structuredClone(snapshot.containerValue);
|
|
55
|
-
} else if (existing && Object.hasOwn(existing, "pushary")) {
|
|
56
|
-
delete existing.pushary;
|
|
57
|
-
if (Object.keys(existing).length === 0) delete document[containerKey];
|
|
58
|
-
}
|
|
59
|
-
return JSON.stringify(document) !== before;
|
|
60
|
-
};
|
|
61
|
-
var captureHookTakeover = (agent, document) => {
|
|
62
|
-
const hooks = isRecord(document?.hooks) ? document.hooks : null;
|
|
63
|
-
if (!hooks) return null;
|
|
64
|
-
const captured = {};
|
|
65
|
-
for (const [event, entries] of Object.entries(hooks)) {
|
|
66
|
-
if (!Array.isArray(entries)) continue;
|
|
67
|
-
const appEntries = entries.flatMap((value, index) => isRecord(value) && hasAppCommand(value) ? [{ index, value: structuredClone(value) }] : []);
|
|
68
|
-
if (appEntries.length > 0) captured[event] = appEntries;
|
|
69
|
-
}
|
|
70
|
-
return Object.keys(captured).length > 0 ? { version: 1, agent, hooks: captured } : null;
|
|
71
|
-
};
|
|
72
|
-
var isHookTakeoverReceipt = (value) => {
|
|
73
|
-
if (!isRecord(value) || value.version !== 1 || typeof value.agent !== "string" || !AGENT_CHOICES.includes(value.agent) || !isRecord(value.hooks)) return false;
|
|
74
|
-
const expectsMcp = ["claude_code", "codex", "gemini_cli", "vscode"].includes(value.agent);
|
|
75
|
-
if (value.mcpServer !== void 0 !== expectsMcp) return false;
|
|
76
|
-
if (value.codexTrust !== void 0 !== (value.agent === "codex")) return false;
|
|
77
|
-
if (value.codexTrust !== void 0 && !isRecord(value.codexTrust)) return false;
|
|
78
|
-
if (value.mcpServer !== void 0 && (!isRecord(value.mcpServer) || typeof value.mcpServer.present !== "boolean" || value.mcpServer.present && !Object.hasOwn(value.mcpServer, "value"))) return false;
|
|
79
|
-
return Object.values(value.hooks).every((entries) => Array.isArray(entries) && entries.length > 0 && entries.every((item) => isRecord(item) && Number.isInteger(item.index) && item.index >= 0 && isRecord(item.value)));
|
|
80
|
-
};
|
|
81
|
-
var restoreHookTakeover = (document, receipt) => {
|
|
82
|
-
const before = JSON.stringify(document);
|
|
83
|
-
const appOwnsNow = hookOwnerOf(document) === "app";
|
|
84
|
-
const hooks = isRecord(document.hooks) ? document.hooks : {};
|
|
85
|
-
for (const [event, value] of Object.entries(hooks)) {
|
|
86
|
-
if (!Array.isArray(value)) continue;
|
|
87
|
-
const kept = value.filter((entry) => !hasPaidPusharyCommand(entry));
|
|
88
|
-
if (kept.length === 0) delete hooks[event];
|
|
89
|
-
else hooks[event] = kept;
|
|
90
|
-
}
|
|
91
|
-
if (!appOwnsNow) {
|
|
92
|
-
for (const [event, snapshots] of Object.entries(receipt.hooks)) {
|
|
93
|
-
const entries = Array.isArray(hooks[event]) ? [...hooks[event]] : [];
|
|
94
|
-
for (const snapshot of snapshots) {
|
|
95
|
-
entries.splice(Math.min(snapshot.index, entries.length), 0, structuredClone(snapshot.value));
|
|
96
|
-
}
|
|
97
|
-
hooks[event] = entries;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
document.hooks = hooks;
|
|
101
|
-
return JSON.stringify(document) !== before;
|
|
102
|
-
};
|
|
103
|
-
var hookOwnerOf = (document, appAvailable = true, hooksKeyPath = ["hooks"]) => {
|
|
104
|
-
const hooks = hooksKeyPath.reduce(
|
|
105
|
-
(node, key) => node && typeof node === "object" ? node[key] : void 0,
|
|
106
|
-
document
|
|
107
|
-
);
|
|
108
|
-
const executables = commandsIn(hooks).map(pusharyHookExecutable).filter((executable) => executable !== null);
|
|
109
|
-
if (appAvailable && executables.some(isBridgeLocator)) return "app";
|
|
110
|
-
if (executables.some((executable) => !isBridgeLocator(executable))) return "cli";
|
|
111
|
-
return "none";
|
|
112
|
-
};
|
|
113
|
-
var planHooks = (context) => {
|
|
114
|
-
if (context.owner !== "app") return "install";
|
|
115
|
-
if (context.takeOverHooks) return "install";
|
|
116
|
-
return "keep";
|
|
117
|
-
};
|
|
118
|
-
var describeAppOwnership = (agentName) => `The Pushary Mac app owns ${agentName}'s hooks.`;
|
|
119
|
-
var KEEP_HINT = "Kept with the app's account. Pass --take-over-hooks to have the CLI own them instead.";
|
|
120
|
-
var OWNER_LABELS = {
|
|
121
|
-
app: "the Pushary Mac app",
|
|
122
|
-
cli: "the CLI"
|
|
123
|
-
};
|
|
124
|
-
var describeHookOwnership = (entries, names) => {
|
|
125
|
-
const owned = entries.filter((entry) => entry.owner !== "none");
|
|
126
|
-
if (owned.length === 0) return null;
|
|
127
|
-
const parts = owned.map((entry) => `${names[entry.agent]} by ${OWNER_LABELS[entry.owner]}${entry.kept ? " (kept)" : ""}`);
|
|
128
|
-
return `Hooks: ${parts.join(", ")}.`;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export {
|
|
132
|
-
mcpBearerKey,
|
|
133
|
-
captureMcpServer,
|
|
134
|
-
restoreMcpServer,
|
|
135
|
-
captureHookTakeover,
|
|
136
|
-
isHookTakeoverReceipt,
|
|
137
|
-
restoreHookTakeover,
|
|
138
|
-
hookOwnerOf,
|
|
139
|
-
planHooks,
|
|
140
|
-
describeAppOwnership,
|
|
141
|
-
KEEP_HINT,
|
|
142
|
-
describeHookOwnership
|
|
143
|
-
};
|
package/dist/reapply-5QVKM6LA.js
DELETED
|
@@ -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
|
-
};
|