@pushary/agent-hooks 0.95.8 → 0.98.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/CHANGELOG.md +27 -0
- package/dist/bin/pushary-bell-hook.js +19 -21
- package/dist/bin/pushary-bell.js +6 -8
- package/dist/bin/pushary-claude.js +21 -23
- package/dist/bin/pushary-clean.js +19 -22
- package/dist/bin/pushary-codex-bridge.js +13 -14
- package/dist/bin/pushary-codex-hook.js +452 -104
- package/dist/bin/pushary-codex.js +8 -8
- package/dist/bin/pushary-connect.js +6 -6
- package/dist/bin/pushary-cowork.js +3 -3
- package/dist/bin/pushary-daemon.js +25 -27
- package/dist/bin/pushary-disconnect.js +6 -8
- package/dist/bin/pushary-doctor.js +28 -23
- package/dist/bin/pushary-elicitation-hook.js +19 -21
- package/dist/bin/pushary-gemini-bridge.js +11 -12
- package/dist/bin/pushary-gemini-hook.js +22 -24
- package/dist/bin/pushary-hook.js +24 -26
- package/dist/bin/pushary-login.js +7 -8
- package/dist/bin/pushary-logout.js +4 -4
- package/dist/bin/pushary-mode.js +3 -3
- package/dist/bin/pushary-notification-hook.js +21 -23
- package/dist/bin/pushary-opencode-hook.js +22 -24
- package/dist/bin/pushary-permission-denied-hook.js +28 -27
- package/dist/bin/pushary-permission-hook.js +24 -26
- package/dist/bin/pushary-post-hook.js +21 -23
- package/dist/bin/pushary-prompt-hook.js +21 -23
- package/dist/bin/pushary-session-end-hook.js +21 -23
- package/dist/bin/pushary-session-start-hook.js +24 -26
- package/dist/bin/pushary-setup.js +45 -40
- package/dist/bin/pushary-stats.js +2 -2
- package/dist/bin/pushary-status.js +10 -11
- package/dist/bin/pushary-stop-hook.js +21 -23
- package/dist/bin/pushary-stopfailure-hook.js +21 -23
- package/dist/bin/pushary-transcript-register.js +17 -19
- package/dist/bin/pushary-transcripts.js +5 -5
- package/dist/bin/pushary-upgrade.js +17 -20
- package/dist/bin/pushary-wait.js +3 -3
- package/dist/{chunk-GOPIMNVC.js → chunk-2GLOHBYB.js} +1 -1
- package/dist/{chunk-BQL7UDIB.js → chunk-3RVCQDC4.js} +1 -1
- package/dist/chunk-53QCTSWY.js +202 -0
- package/dist/{chunk-3YFJGKJQ.js → chunk-5B5QV3KC.js} +8 -8
- package/dist/{chunk-FRXZMCVA.js → chunk-5KLAETSU.js} +1 -1
- package/dist/{chunk-SDNTRS76.js → chunk-6C6MS57P.js} +1 -1
- package/dist/{chunk-A22VQ5ZL.js → chunk-6CYB77VD.js} +111 -55
- package/dist/{chunk-QD73WATQ.js → chunk-6LRGZJFB.js} +21 -21
- package/dist/{chunk-Z4JVEL7R.js → chunk-A76GNRIK.js} +191 -2
- package/dist/{chunk-RE25RJ5A.js → chunk-B35OCFXH.js} +4 -4
- package/dist/{chunk-UKMLSQXA.js → chunk-CP34FI4B.js} +2 -2
- package/dist/{chunk-I7LKI4WO.js → chunk-DOD3A6EU.js} +6 -8
- package/dist/{chunk-N6FAXQDD.js → chunk-FAJ4R7IB.js} +1 -1
- package/dist/{chunk-U5RIXR7I.js → chunk-HB2KB7QL.js} +1 -1
- package/dist/{chunk-QV266EGS.js → chunk-HFQ7WSHZ.js} +11 -14
- package/dist/{chunk-QJPYJVL3.js → chunk-IRLTW6KF.js} +1 -1
- package/dist/{chunk-Y6SCMXR6.js → chunk-J44RPHUZ.js} +2 -2
- package/dist/{chunk-R6LBGKWQ.js → chunk-JQU6PMH4.js} +17 -15
- package/dist/{chunk-4DUEIUUO.js → chunk-K6CH5NVW.js} +1 -1
- package/dist/{chunk-XZWUOCJZ.js → chunk-LBNAGGLV.js} +1 -1
- package/dist/{chunk-XS33QBJA.js → chunk-LGXUGYUH.js} +50 -1
- package/dist/{chunk-XO3JR3OP.js → chunk-LX4NNYII.js} +2 -2
- package/dist/{chunk-XEVOPOKT.js → chunk-M4TVEMLH.js} +1 -1
- package/dist/{chunk-TY6IJY6I.js → chunk-NIXVMMJM.js} +1 -1
- package/dist/{chunk-VERXHIQF.js → chunk-NQGYPTJQ.js} +1 -1
- package/dist/{chunk-EMGGUO2Q.js → chunk-OBYC6SN4.js} +1 -1
- package/dist/{chunk-XUTSZYYJ.js → chunk-OPR2BPD4.js} +1 -4
- package/dist/{chunk-MC5WUOJJ.js → chunk-OUAE3GKO.js} +75 -1
- package/dist/{chunk-ATKGKAP6.js → chunk-QXIF6R4P.js} +16 -13
- package/dist/chunk-SI7GYBQP.js +15 -0
- package/dist/{chunk-VMQU7YEJ.js → chunk-SJLGOVC6.js} +1 -1
- package/dist/{chunk-54W7ELDQ.js → chunk-TZHDKRMG.js} +2 -2
- package/dist/{chunk-F4TMY6XI.js → chunk-V47GITZV.js} +3 -3
- package/dist/{chunk-L7NOG547.js → chunk-VZD2GEKB.js} +1 -1
- package/dist/{chunk-R3OZ5ISU.js → chunk-W2MG2P46.js} +4 -4
- package/dist/{chunk-E47WV7BJ.js → chunk-WU6LSXJ6.js} +2 -2
- package/dist/{chunk-NOVA7KZ2.js → chunk-XL3RKJYQ.js} +308 -35
- package/dist/{chunk-5GKNAQTG.js → chunk-XOOWC62T.js} +1 -1
- package/dist/{chunk-SKPXQRKN.js → chunk-XPPXOKIG.js} +1 -1
- package/dist/{chunk-HUGIKB5O.js → chunk-YJDRHQLG.js} +6 -6
- package/dist/src/index.js +11 -11
- package/package.json +1 -1
- package/dist/chunk-3AJIK5AO.js +0 -57
- package/dist/chunk-L4ZCFMWW.js +0 -177
- package/dist/chunk-VDI645ZX.js +0 -18
package/dist/chunk-L4ZCFMWW.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
// src/npm.ts
|
|
2
|
-
import { execFileSync, execSync } from "child_process";
|
|
3
|
-
import { existsSync, readFileSync, realpathSync } from "fs";
|
|
4
|
-
import { dirname, isAbsolute, join, relative, resolve } from "path";
|
|
5
|
-
var cleanNpmEnv = () => {
|
|
6
|
-
const env = {};
|
|
7
|
-
for (const [key, value] of Object.entries(process.env)) {
|
|
8
|
-
if (key.toLowerCase().startsWith("npm_config_workspace")) continue;
|
|
9
|
-
env[key] = value;
|
|
10
|
-
}
|
|
11
|
-
return env;
|
|
12
|
-
};
|
|
13
|
-
var npmErrorMessage = (err) => {
|
|
14
|
-
const e = err;
|
|
15
|
-
const text = [e?.stderr, e?.stdout].map((part) => part ? part.toString() : "").join("\n");
|
|
16
|
-
const line = text.split("\n").map((l) => l.replace(/^npm error\s*/i, "").trim()).find((l) => l && !l.startsWith("A complete log") && !/^code\s/i.test(l));
|
|
17
|
-
return line || e?.message || String(err);
|
|
18
|
-
};
|
|
19
|
-
var execNpm = (args, options = {}) => {
|
|
20
|
-
return execSync(`npm ${args}`, {
|
|
21
|
-
timeout: 12e4,
|
|
22
|
-
stdio: "pipe",
|
|
23
|
-
...options,
|
|
24
|
-
env: { ...cleanNpmEnv(), ...options.env ?? {} }
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
var resolveGlobalBinary = (name) => {
|
|
28
|
-
try {
|
|
29
|
-
const prefix = execNpm("prefix -g --no-workspaces", { timeout: 5e3 }).toString().trim();
|
|
30
|
-
const candidates = process.platform === "win32" ? [join(prefix, `${name}.cmd`), join(prefix, name)] : [join(prefix, "bin", name)];
|
|
31
|
-
return candidates.find(existsSync);
|
|
32
|
-
} catch {
|
|
33
|
-
return void 0;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var resolvePathBinary = (name, platform = process.platform) => {
|
|
37
|
-
try {
|
|
38
|
-
return execFileSync(platform === "win32" ? "where" : "which", [name], {
|
|
39
|
-
encoding: "utf8",
|
|
40
|
-
stdio: "pipe",
|
|
41
|
-
timeout: 5e3
|
|
42
|
-
}).split(/\r?\n/, 1)[0]?.trim() || void 0;
|
|
43
|
-
} catch {
|
|
44
|
-
return void 0;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
var resolveBinary = (name) => resolveGlobalBinary(name) ?? resolvePathBinary(name);
|
|
48
|
-
var resolvePackageVersionFromBinary = (binary, packageName) => {
|
|
49
|
-
try {
|
|
50
|
-
let dir = dirname(realpathSync(binary));
|
|
51
|
-
const packagePath = packageName.split("/");
|
|
52
|
-
for (let depth = 0; depth < 8; depth++) {
|
|
53
|
-
for (const manifest of [
|
|
54
|
-
join(dir, "package.json"),
|
|
55
|
-
join(dir, "node_modules", ...packagePath, "package.json")
|
|
56
|
-
]) {
|
|
57
|
-
try {
|
|
58
|
-
const value = JSON.parse(readFileSync(manifest, "utf8"));
|
|
59
|
-
if (value.name === packageName && typeof value.version === "string") return value.version;
|
|
60
|
-
} catch {
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
const parent = dirname(dir);
|
|
64
|
-
if (parent === dir) break;
|
|
65
|
-
dir = parent;
|
|
66
|
-
}
|
|
67
|
-
} catch {
|
|
68
|
-
}
|
|
69
|
-
return void 0;
|
|
70
|
-
};
|
|
71
|
-
var resolveGlobalPackageVersion = (name) => {
|
|
72
|
-
try {
|
|
73
|
-
const result = JSON.parse(execNpm("list -g --depth=0 --json --no-workspaces", { timeout: 5e3 }).toString());
|
|
74
|
-
const value = result.dependencies?.[name]?.version;
|
|
75
|
-
return typeof value === "string" ? value : void 0;
|
|
76
|
-
} catch {
|
|
77
|
-
return void 0;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
var localImportsPresent = (entry, packageDir, seen = /* @__PURE__ */ new Set()) => {
|
|
81
|
-
if (seen.has(entry)) return true;
|
|
82
|
-
seen.add(entry);
|
|
83
|
-
try {
|
|
84
|
-
const source = readFileSync(entry, "utf8");
|
|
85
|
-
for (const match of source.matchAll(/\b(?:import|export)\s+(?:[^"'()]*?\s+from\s+)?["'](\.{1,2}\/[^"']+)["']|\bimport\s*\(\s*["'](\.{1,2}\/[^"']+)["']/g)) {
|
|
86
|
-
const dependency = resolve(dirname(entry), match[1] ?? match[2]);
|
|
87
|
-
const localPath = relative(packageDir, dependency);
|
|
88
|
-
if (localPath.startsWith("..") || isAbsolute(localPath) || !existsSync(dependency)) return false;
|
|
89
|
-
if (/\.[cm]?js$/.test(dependency) && !localImportsPresent(dependency, packageDir, seen)) return false;
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
} catch {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
var packageBinsPresent = (packageDir, prefix, platform = process.platform, requiredFiles = []) => {
|
|
97
|
-
try {
|
|
98
|
-
const manifest = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf8"));
|
|
99
|
-
if (!manifest.bin || typeof manifest.bin !== "object" || Array.isArray(manifest.bin)) return false;
|
|
100
|
-
const bins = Object.entries(manifest.bin);
|
|
101
|
-
if (bins.length === 0) return false;
|
|
102
|
-
if (!requiredFiles.every((path) => existsSync(join(packageDir, path)))) return false;
|
|
103
|
-
const seen = /* @__PURE__ */ new Set();
|
|
104
|
-
return bins.every(([name, target]) => {
|
|
105
|
-
if (typeof target !== "string") return false;
|
|
106
|
-
const shims = platform === "win32" ? [join(prefix, `${name}.cmd`), join(prefix, name)] : [join(prefix, "bin", name)];
|
|
107
|
-
const entry = join(packageDir, target);
|
|
108
|
-
return existsSync(entry) && shims.some(existsSync) && localImportsPresent(entry, packageDir, seen);
|
|
109
|
-
});
|
|
110
|
-
} catch {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
var AGENT_HOOKS_RUNTIME_FILES = [
|
|
115
|
-
"data/SKILL.md",
|
|
116
|
-
"data/cursor-plugin/.cursor-plugin/plugin.json",
|
|
117
|
-
"data/cursor-plugin/hooks/hooks.json",
|
|
118
|
-
"data/cursor-plugin/mcp.json",
|
|
119
|
-
"data/cursor-plugin/scripts/pushary-gate.mjs",
|
|
120
|
-
"data/vscode-plugin/.claude-plugin/plugin.json",
|
|
121
|
-
"data/vscode-plugin/hooks/hooks.json",
|
|
122
|
-
"data/vscode-plugin/.mcp.json",
|
|
123
|
-
"data/vscode-plugin/scripts/pushary-gate.mjs"
|
|
124
|
-
];
|
|
125
|
-
var globalPackageBinsPresent = (name) => {
|
|
126
|
-
try {
|
|
127
|
-
const root = execNpm("root -g --no-workspaces", { timeout: 5e3 }).toString().trim();
|
|
128
|
-
const prefix = execNpm("prefix -g --no-workspaces", { timeout: 5e3 }).toString().trim();
|
|
129
|
-
return packageBinsPresent(join(root, ...name.split("/")), prefix, process.platform, AGENT_HOOKS_RUNTIME_FILES);
|
|
130
|
-
} catch {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
var resolveGlobalBinDir = (probe) => {
|
|
135
|
-
if (process.platform === "win32") return void 0;
|
|
136
|
-
const resolved = resolveGlobalBinary(probe);
|
|
137
|
-
return resolved ? resolved.slice(0, resolved.length - probe.length - 1) : void 0;
|
|
138
|
-
};
|
|
139
|
-
var quoteIfNeeded = (path) => /\s/.test(path) ? `"${path}"` : path;
|
|
140
|
-
var needsGlobalInstall = (requested, installed, binaryPresent) => requested !== installed || !binaryPresent;
|
|
141
|
-
var installState;
|
|
142
|
-
var installGlobally = (options) => {
|
|
143
|
-
if (installState) {
|
|
144
|
-
return installState.then((result) => result === "installed" ? "cached" : result);
|
|
145
|
-
}
|
|
146
|
-
const started = (async () => {
|
|
147
|
-
const pinned = process.env.PUSHARY_PIN_GLOBAL_VERSION !== "0";
|
|
148
|
-
if (pinned && !needsGlobalInstall(
|
|
149
|
-
options.version,
|
|
150
|
-
resolveGlobalPackageVersion("@pushary/agent-hooks"),
|
|
151
|
-
globalPackageBinsPresent("@pushary/agent-hooks")
|
|
152
|
-
)) {
|
|
153
|
-
return "skipped";
|
|
154
|
-
}
|
|
155
|
-
const spec = pinned && options.version && options.version !== "0.0.0" ? `@pushary/agent-hooks@${options.version}` : "@pushary/agent-hooks@latest";
|
|
156
|
-
execNpm(`install -g --no-workspaces ${spec}`, { timeout: options.timeoutMs ?? 12e4 });
|
|
157
|
-
return "installed";
|
|
158
|
-
})();
|
|
159
|
-
installState = started;
|
|
160
|
-
started.catch(() => {
|
|
161
|
-
if (installState === started) installState = void 0;
|
|
162
|
-
});
|
|
163
|
-
return started;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export {
|
|
167
|
-
npmErrorMessage,
|
|
168
|
-
execNpm,
|
|
169
|
-
resolveGlobalBinary,
|
|
170
|
-
resolvePathBinary,
|
|
171
|
-
resolveBinary,
|
|
172
|
-
resolvePackageVersionFromBinary,
|
|
173
|
-
resolveGlobalPackageVersion,
|
|
174
|
-
resolveGlobalBinDir,
|
|
175
|
-
quoteIfNeeded,
|
|
176
|
-
installGlobally
|
|
177
|
-
};
|
package/dist/chunk-VDI645ZX.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
shouldDeferToNativeMode
|
|
3
|
-
} from "./chunk-MC5WUOJJ.js";
|
|
4
|
-
|
|
5
|
-
// src/native-defer.ts
|
|
6
|
-
var nativeDeferOptions = () => {
|
|
7
|
-
const respect = process.env.PUSHARY_RESPECT_PERMISSION_MODE;
|
|
8
|
-
const bypass = process.env.PUSHARY_DEFER_BYPASS;
|
|
9
|
-
return {
|
|
10
|
-
respectPermissionMode: !(respect === "0" || respect === "false"),
|
|
11
|
-
deferBypass: bypass === "1" || bypass === "true"
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
var defersToNativeMode = (permissionMode, toolName) => shouldDeferToNativeMode(permissionMode, toolName, nativeDeferOptions());
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
defersToNativeMode
|
|
18
|
-
};
|