@solongate/proxy 0.47.0 → 0.47.2
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/dist/global-install.js +4 -3
- package/dist/index.js +18 -7
- package/dist/init.js +8 -6
- package/dist/login.js +14 -4
- package/hooks/guard.bundled.mjs +7536 -7257
- package/hooks/guard.mjs +234 -27
- package/package.json +76 -76
package/dist/global-install.js
CHANGED
|
@@ -170,12 +170,13 @@ async function runGlobalInstall(opts = {}) {
|
|
|
170
170
|
const guardAbs = join(p.hooksDir, "guard.mjs").replace(/\\/g, "/");
|
|
171
171
|
const auditAbs = join(p.hooksDir, "audit.mjs").replace(/\\/g, "/");
|
|
172
172
|
const stopAbs = join(p.hooksDir, "stop.mjs").replace(/\\/g, "/");
|
|
173
|
+
const nodeBin = process.execPath.replace(/\\/g, "/");
|
|
173
174
|
const merged = {
|
|
174
175
|
...existing,
|
|
175
176
|
hooks: {
|
|
176
|
-
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
177
|
-
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
178
|
-
Stop: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
177
|
+
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${guardAbs}" claude-code "Claude Code"` }] }],
|
|
178
|
+
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${auditAbs}" claude-code "Claude Code"` }] }],
|
|
179
|
+
Stop: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${stopAbs}" claude-code "Claude Code"` }] }]
|
|
179
180
|
}
|
|
180
181
|
};
|
|
181
182
|
writeFileSync(p.settingsPath, JSON.stringify(merged, null, 2) + "\n");
|
package/dist/index.js
CHANGED
|
@@ -6747,12 +6747,13 @@ async function runGlobalInstall(opts = {}) {
|
|
|
6747
6747
|
const guardAbs = join3(p.hooksDir, "guard.mjs").replace(/\\/g, "/");
|
|
6748
6748
|
const auditAbs = join3(p.hooksDir, "audit.mjs").replace(/\\/g, "/");
|
|
6749
6749
|
const stopAbs = join3(p.hooksDir, "stop.mjs").replace(/\\/g, "/");
|
|
6750
|
+
const nodeBin = process.execPath.replace(/\\/g, "/");
|
|
6750
6751
|
const merged = {
|
|
6751
6752
|
...existing,
|
|
6752
6753
|
hooks: {
|
|
6753
|
-
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
6754
|
-
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
6755
|
-
Stop: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
6754
|
+
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${guardAbs}" claude-code "Claude Code"` }] }],
|
|
6755
|
+
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${auditAbs}" claude-code "Claude Code"` }] }],
|
|
6756
|
+
Stop: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${stopAbs}" claude-code "Claude Code"` }] }]
|
|
6756
6757
|
}
|
|
6757
6758
|
};
|
|
6758
6759
|
writeFileSync2(p.settingsPath, JSON.stringify(merged, null, 2) + "\n");
|
|
@@ -7047,9 +7048,10 @@ function installHooks(selectedTools = [], wrappedMcpConfig) {
|
|
|
7047
7048
|
for (const client of clients) {
|
|
7048
7049
|
const clientDir = resolve4(client.dir);
|
|
7049
7050
|
mkdirSync4(clientDir, { recursive: true });
|
|
7050
|
-
const
|
|
7051
|
-
const
|
|
7052
|
-
const
|
|
7051
|
+
const nodeBin = process.execPath.replace(/\\/g, "/");
|
|
7052
|
+
const guardCmd = `"${nodeBin}" .solongate/hooks/guard.mjs ${client.agentId} "${client.agentName}"`;
|
|
7053
|
+
const auditCmd = `"${nodeBin}" .solongate/hooks/audit.mjs ${client.agentId} "${client.agentName}"`;
|
|
7054
|
+
const stopCmd = `"${nodeBin}" .solongate/hooks/stop.mjs ${client.agentId} "${client.agentName}"`;
|
|
7053
7055
|
if (client.key === "gemini") {
|
|
7054
7056
|
const result = installGeminiConfig(clientDir, guardCmd, auditCmd, stopCmd, wrappedMcpConfig);
|
|
7055
7057
|
if (result === "skipped") skippedNames.push(client.name);
|
|
@@ -7508,7 +7510,10 @@ function openBrowser(url) {
|
|
|
7508
7510
|
try {
|
|
7509
7511
|
const cmd = process.platform === "win32" ? "cmd" : process.platform === "darwin" ? "open" : "xdg-open";
|
|
7510
7512
|
const args = process.platform === "win32" ? ["/c", "start", '""', url] : [url];
|
|
7511
|
-
spawn(cmd, args, { stdio: "ignore", detached: true })
|
|
7513
|
+
const child = spawn(cmd, args, { stdio: "ignore", detached: true });
|
|
7514
|
+
child.on("error", () => {
|
|
7515
|
+
});
|
|
7516
|
+
child.unref();
|
|
7512
7517
|
} catch {
|
|
7513
7518
|
}
|
|
7514
7519
|
}
|
|
@@ -7596,6 +7601,12 @@ async function main2() {
|
|
|
7596
7601
|
console.log(" \u2502 Restart Claude Code to apply. \u2502");
|
|
7597
7602
|
console.log(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
7598
7603
|
console.log("");
|
|
7604
|
+
console.log(` ${c.bold}${c.yellow}! Already-open terminals are NOT protected yet.${c.reset}`);
|
|
7605
|
+
console.log(` ${c.dim} Hooks load only when a session starts, so any terminal`);
|
|
7606
|
+
console.log(` (and the Claude Code running in it) that was already open`);
|
|
7607
|
+
console.log(` won't be caught. Open a NEW terminal and start Claude Code`);
|
|
7608
|
+
console.log(` there for the guard + audit logging to take effect.${c.reset}`);
|
|
7609
|
+
console.log("");
|
|
7599
7610
|
}
|
|
7600
7611
|
var sleep2, SPINNER_FRAMES2;
|
|
7601
7612
|
var init_login = __esm({
|
package/dist/init.js
CHANGED
|
@@ -209,12 +209,13 @@ async function runGlobalInstall(opts = {}) {
|
|
|
209
209
|
const guardAbs = join(p.hooksDir, "guard.mjs").replace(/\\/g, "/");
|
|
210
210
|
const auditAbs = join(p.hooksDir, "audit.mjs").replace(/\\/g, "/");
|
|
211
211
|
const stopAbs = join(p.hooksDir, "stop.mjs").replace(/\\/g, "/");
|
|
212
|
+
const nodeBin = process.execPath.replace(/\\/g, "/");
|
|
212
213
|
const merged = {
|
|
213
214
|
...existing,
|
|
214
215
|
hooks: {
|
|
215
|
-
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
216
|
-
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
217
|
-
Stop: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
216
|
+
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${guardAbs}" claude-code "Claude Code"` }] }],
|
|
217
|
+
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${auditAbs}" claude-code "Claude Code"` }] }],
|
|
218
|
+
Stop: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${stopAbs}" claude-code "Claude Code"` }] }]
|
|
218
219
|
}
|
|
219
220
|
};
|
|
220
221
|
writeFileSync(p.settingsPath, JSON.stringify(merged, null, 2) + "\n");
|
|
@@ -504,9 +505,10 @@ function installHooks(selectedTools = [], wrappedMcpConfig) {
|
|
|
504
505
|
for (const client of clients) {
|
|
505
506
|
const clientDir = resolve2(client.dir);
|
|
506
507
|
mkdirSync2(clientDir, { recursive: true });
|
|
507
|
-
const
|
|
508
|
-
const
|
|
509
|
-
const
|
|
508
|
+
const nodeBin = process.execPath.replace(/\\/g, "/");
|
|
509
|
+
const guardCmd = `"${nodeBin}" .solongate/hooks/guard.mjs ${client.agentId} "${client.agentName}"`;
|
|
510
|
+
const auditCmd = `"${nodeBin}" .solongate/hooks/audit.mjs ${client.agentId} "${client.agentName}"`;
|
|
511
|
+
const stopCmd = `"${nodeBin}" .solongate/hooks/stop.mjs ${client.agentId} "${client.agentName}"`;
|
|
510
512
|
if (client.key === "gemini") {
|
|
511
513
|
const result = installGeminiConfig(clientDir, guardCmd, auditCmd, stopCmd, wrappedMcpConfig);
|
|
512
514
|
if (result === "skipped") skippedNames.push(client.name);
|
package/dist/login.js
CHANGED
|
@@ -178,12 +178,13 @@ async function runGlobalInstall(opts = {}) {
|
|
|
178
178
|
const guardAbs = join(p.hooksDir, "guard.mjs").replace(/\\/g, "/");
|
|
179
179
|
const auditAbs = join(p.hooksDir, "audit.mjs").replace(/\\/g, "/");
|
|
180
180
|
const stopAbs = join(p.hooksDir, "stop.mjs").replace(/\\/g, "/");
|
|
181
|
+
const nodeBin = process.execPath.replace(/\\/g, "/");
|
|
181
182
|
const merged = {
|
|
182
183
|
...existing,
|
|
183
184
|
hooks: {
|
|
184
|
-
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
185
|
-
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
186
|
-
Stop: [{ matcher: "", hooks: [{ type: "command", command: `
|
|
185
|
+
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${guardAbs}" claude-code "Claude Code"` }] }],
|
|
186
|
+
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${auditAbs}" claude-code "Claude Code"` }] }],
|
|
187
|
+
Stop: [{ matcher: "", hooks: [{ type: "command", command: `"${nodeBin}" "${stopAbs}" claude-code "Claude Code"` }] }]
|
|
187
188
|
}
|
|
188
189
|
};
|
|
189
190
|
writeFileSync(p.settingsPath, JSON.stringify(merged, null, 2) + "\n");
|
|
@@ -232,7 +233,10 @@ function openBrowser(url) {
|
|
|
232
233
|
try {
|
|
233
234
|
const cmd = process.platform === "win32" ? "cmd" : process.platform === "darwin" ? "open" : "xdg-open";
|
|
234
235
|
const args = process.platform === "win32" ? ["/c", "start", '""', url] : [url];
|
|
235
|
-
spawn(cmd, args, { stdio: "ignore", detached: true })
|
|
236
|
+
const child = spawn(cmd, args, { stdio: "ignore", detached: true });
|
|
237
|
+
child.on("error", () => {
|
|
238
|
+
});
|
|
239
|
+
child.unref();
|
|
236
240
|
} catch {
|
|
237
241
|
}
|
|
238
242
|
}
|
|
@@ -320,6 +324,12 @@ async function main() {
|
|
|
320
324
|
console.log(" \u2502 Restart Claude Code to apply. \u2502");
|
|
321
325
|
console.log(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
322
326
|
console.log("");
|
|
327
|
+
console.log(` ${c.bold}${c.yellow}! Already-open terminals are NOT protected yet.${c.reset}`);
|
|
328
|
+
console.log(` ${c.dim} Hooks load only when a session starts, so any terminal`);
|
|
329
|
+
console.log(` (and the Claude Code running in it) that was already open`);
|
|
330
|
+
console.log(` won't be caught. Open a NEW terminal and start Claude Code`);
|
|
331
|
+
console.log(` there for the guard + audit logging to take effect.${c.reset}`);
|
|
332
|
+
console.log("");
|
|
323
333
|
}
|
|
324
334
|
main().catch((err) => {
|
|
325
335
|
console.log(`Fatal: ${err instanceof Error ? err.message : String(err)}`);
|