@node9/proxy 1.31.0 → 1.32.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/dist/cli.js +92 -17
- package/dist/cli.mjs +92 -17
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7235,7 +7235,7 @@ function writeJson(filePath, data) {
|
|
|
7235
7235
|
}
|
|
7236
7236
|
function isNode9Hook(cmd) {
|
|
7237
7237
|
if (!cmd) return false;
|
|
7238
|
-
return /(?:^|[\s/\\"])node9 (?:check|log)/.test(cmd) || /(?:^|[\s/\\
|
|
7238
|
+
return /(?:^|[\s/\\"])node9"? (?:check|log)/.test(cmd) || /(?:^|[\s/\\])cli\.js"? (?:check|log)/.test(cmd);
|
|
7239
7239
|
}
|
|
7240
7240
|
function teardownClaude() {
|
|
7241
7241
|
const homeDir2 = import_os12.default.homedir();
|
|
@@ -20860,8 +20860,33 @@ var import_chalk15 = __toESM(require("chalk"));
|
|
|
20860
20860
|
var import_fs39 = __toESM(require("fs"));
|
|
20861
20861
|
var import_path40 = __toESM(require("path"));
|
|
20862
20862
|
var import_os35 = __toESM(require("os"));
|
|
20863
|
+
var yaml2 = __toESM(require("yaml"));
|
|
20863
20864
|
init_core();
|
|
20864
20865
|
init_daemon();
|
|
20866
|
+
init_setup();
|
|
20867
|
+
function readHermesHooks(configPath) {
|
|
20868
|
+
if (!import_fs39.default.existsSync(configPath)) return null;
|
|
20869
|
+
let raw;
|
|
20870
|
+
try {
|
|
20871
|
+
raw = import_fs39.default.readFileSync(configPath, "utf-8");
|
|
20872
|
+
} catch {
|
|
20873
|
+
return null;
|
|
20874
|
+
}
|
|
20875
|
+
try {
|
|
20876
|
+
const cfg = yaml2.parse(raw);
|
|
20877
|
+
const has = (event) => (cfg?.hooks?.[event] ?? []).some(
|
|
20878
|
+
(e) => typeof e?.command === "string" && isNode9Hook(e.command)
|
|
20879
|
+
);
|
|
20880
|
+
return { pre: has("pre_tool_call"), post: has("post_tool_call") };
|
|
20881
|
+
} catch {
|
|
20882
|
+
console.error(
|
|
20883
|
+
import_chalk15.default.yellow(
|
|
20884
|
+
` \u26A0\uFE0F Hermes config.yaml at ${configPath} is not valid YAML \u2014 showing as unwired.`
|
|
20885
|
+
)
|
|
20886
|
+
);
|
|
20887
|
+
return { pre: false, post: false };
|
|
20888
|
+
}
|
|
20889
|
+
}
|
|
20865
20890
|
function readJson2(filePath) {
|
|
20866
20891
|
try {
|
|
20867
20892
|
if (import_fs39.default.existsSync(filePath)) return JSON.parse(import_fs39.default.readFileSync(filePath, "utf-8"));
|
|
@@ -20869,9 +20894,11 @@ function readJson2(filePath) {
|
|
|
20869
20894
|
}
|
|
20870
20895
|
return null;
|
|
20871
20896
|
}
|
|
20872
|
-
function
|
|
20873
|
-
|
|
20874
|
-
|
|
20897
|
+
function matchersHaveNode9Hook(matchers) {
|
|
20898
|
+
return (matchers ?? []).some((m) => (m.hooks ?? []).some((h) => isNode9Hook(h.command)));
|
|
20899
|
+
}
|
|
20900
|
+
function flatHaveNode9Hook(entries) {
|
|
20901
|
+
return (Array.isArray(entries) ? entries : []).some((h) => isNode9Hook(h.command));
|
|
20875
20902
|
}
|
|
20876
20903
|
function wrappedMcpServers(servers) {
|
|
20877
20904
|
if (!servers) return [];
|
|
@@ -20886,6 +20913,7 @@ function printAgentSection(label, hookPairs, wrapped) {
|
|
|
20886
20913
|
console.log(import_chalk15.default.red(` \u2717 ${name}`) + import_chalk15.default.gray(" (not wired)"));
|
|
20887
20914
|
}
|
|
20888
20915
|
}
|
|
20916
|
+
if (wrapped === null) return;
|
|
20889
20917
|
if (wrapped.length > 0) {
|
|
20890
20918
|
console.log(import_chalk15.default.cyan(` MCP proxied:`));
|
|
20891
20919
|
for (const entry of wrapped) {
|
|
@@ -20951,18 +20979,29 @@ function registerStatusCommand(program2) {
|
|
|
20951
20979
|
import_path40.default.join(homeDir2, ".gemini", "settings.json")
|
|
20952
20980
|
);
|
|
20953
20981
|
const cursorConfig = readJson2(import_path40.default.join(homeDir2, ".cursor", "mcp.json"));
|
|
20954
|
-
const
|
|
20982
|
+
const antigravityHooks = readJson2(
|
|
20983
|
+
import_path40.default.join(homeDir2, ".gemini", "config", "hooks.json")
|
|
20984
|
+
);
|
|
20985
|
+
const antigravityMcp = readJson2(
|
|
20986
|
+
import_path40.default.join(homeDir2, ".gemini", "config", "mcp_config.json")
|
|
20987
|
+
);
|
|
20988
|
+
const antigravityPresent = antigravityHooks !== null || import_fs39.default.existsSync(import_path40.default.join(homeDir2, ".gemini", "antigravity-cli")) || import_fs39.default.existsSync(import_path40.default.join(homeDir2, ".gemini", "antigravity-ide"));
|
|
20989
|
+
const copilotHooks = readJson2(
|
|
20990
|
+
import_path40.default.join(homeDir2, ".copilot", "hooks", "node9.json")
|
|
20991
|
+
);
|
|
20992
|
+
const copilotMcp = readJson2(
|
|
20993
|
+
import_path40.default.join(homeDir2, ".copilot", "mcp-config.json")
|
|
20994
|
+
);
|
|
20995
|
+
const copilotPresent = import_fs39.default.existsSync(import_path40.default.join(homeDir2, ".copilot"));
|
|
20996
|
+
const hermesHooks = readHermesHooks(hermesConfigPath(homeDir2));
|
|
20997
|
+
const agentFound = claudeSettings || claudeConfig || geminiSettings || cursorConfig || antigravityPresent || copilotPresent || hermesHooks;
|
|
20955
20998
|
if (agentFound) {
|
|
20956
20999
|
console.log("");
|
|
20957
21000
|
console.log(import_chalk15.default.bold(" Agent Wiring:"));
|
|
20958
21001
|
console.log("");
|
|
20959
21002
|
if (claudeSettings || claudeConfig) {
|
|
20960
|
-
const preHook = claudeSettings?.hooks?.PreToolUse
|
|
20961
|
-
|
|
20962
|
-
) ?? false;
|
|
20963
|
-
const postHook = claudeSettings?.hooks?.PostToolUse?.some(
|
|
20964
|
-
(m) => m.hooks.some((h) => isNode9Hook2(h.command))
|
|
20965
|
-
) ?? false;
|
|
21003
|
+
const preHook = matchersHaveNode9Hook(claudeSettings?.hooks?.PreToolUse);
|
|
21004
|
+
const postHook = matchersHaveNode9Hook(claudeSettings?.hooks?.PostToolUse);
|
|
20966
21005
|
printAgentSection(
|
|
20967
21006
|
"Claude Code",
|
|
20968
21007
|
[
|
|
@@ -20974,12 +21013,8 @@ function registerStatusCommand(program2) {
|
|
|
20974
21013
|
console.log("");
|
|
20975
21014
|
}
|
|
20976
21015
|
if (geminiSettings) {
|
|
20977
|
-
const beforeHook = geminiSettings.hooks?.BeforeTool
|
|
20978
|
-
|
|
20979
|
-
) ?? false;
|
|
20980
|
-
const afterHook = geminiSettings.hooks?.AfterTool?.some(
|
|
20981
|
-
(m) => m.hooks.some((h) => isNode9Hook2(h.command))
|
|
20982
|
-
) ?? false;
|
|
21016
|
+
const beforeHook = matchersHaveNode9Hook(geminiSettings.hooks?.BeforeTool);
|
|
21017
|
+
const afterHook = matchersHaveNode9Hook(geminiSettings.hooks?.AfterTool);
|
|
20983
21018
|
printAgentSection(
|
|
20984
21019
|
"Gemini CLI",
|
|
20985
21020
|
[
|
|
@@ -20990,10 +21025,50 @@ function registerStatusCommand(program2) {
|
|
|
20990
21025
|
);
|
|
20991
21026
|
console.log("");
|
|
20992
21027
|
}
|
|
21028
|
+
if (antigravityPresent) {
|
|
21029
|
+
const preHook = matchersHaveNode9Hook(antigravityHooks?.hooks?.PreToolUse);
|
|
21030
|
+
const postHook = matchersHaveNode9Hook(antigravityHooks?.hooks?.PostToolUse);
|
|
21031
|
+
printAgentSection(
|
|
21032
|
+
"Antigravity",
|
|
21033
|
+
[
|
|
21034
|
+
{ name: "PreToolUse (node9 check)", present: preHook },
|
|
21035
|
+
{ name: "PostToolUse (node9 log)", present: postHook }
|
|
21036
|
+
],
|
|
21037
|
+
wrappedMcpServers(antigravityMcp?.mcpServers)
|
|
21038
|
+
);
|
|
21039
|
+
console.log("");
|
|
21040
|
+
}
|
|
21041
|
+
if (copilotPresent) {
|
|
21042
|
+
const preHook = flatHaveNode9Hook(copilotHooks?.hooks?.PreToolUse);
|
|
21043
|
+
const postHook = flatHaveNode9Hook(copilotHooks?.hooks?.PostToolUse);
|
|
21044
|
+
const promptHook = flatHaveNode9Hook(copilotHooks?.hooks?.UserPromptSubmit);
|
|
21045
|
+
printAgentSection(
|
|
21046
|
+
"GitHub Copilot",
|
|
21047
|
+
[
|
|
21048
|
+
{ name: "PreToolUse (node9 check)", present: preHook },
|
|
21049
|
+
{ name: "PostToolUse (node9 log)", present: postHook },
|
|
21050
|
+
{ name: "UserPromptSubmit (node9 check)", present: promptHook }
|
|
21051
|
+
],
|
|
21052
|
+
wrappedMcpServers(copilotMcp?.mcpServers)
|
|
21053
|
+
);
|
|
21054
|
+
console.log("");
|
|
21055
|
+
}
|
|
20993
21056
|
if (cursorConfig) {
|
|
20994
21057
|
printAgentSection("Cursor", [], wrappedMcpServers(cursorConfig.mcpServers));
|
|
20995
21058
|
console.log("");
|
|
20996
21059
|
}
|
|
21060
|
+
if (hermesHooks) {
|
|
21061
|
+
printAgentSection(
|
|
21062
|
+
"Hermes Agent",
|
|
21063
|
+
[
|
|
21064
|
+
{ name: "pre_tool_call (node9 check)", present: hermesHooks.pre },
|
|
21065
|
+
{ name: "post_tool_call (node9 log)", present: hermesHooks.post }
|
|
21066
|
+
],
|
|
21067
|
+
null
|
|
21068
|
+
// Hermes has no MCP surface
|
|
21069
|
+
);
|
|
21070
|
+
console.log("");
|
|
21071
|
+
}
|
|
20997
21072
|
}
|
|
20998
21073
|
const pauseState = checkPause();
|
|
20999
21074
|
if (pauseState.paused) {
|
package/dist/cli.mjs
CHANGED
|
@@ -7216,7 +7216,7 @@ function writeJson(filePath, data) {
|
|
|
7216
7216
|
}
|
|
7217
7217
|
function isNode9Hook(cmd) {
|
|
7218
7218
|
if (!cmd) return false;
|
|
7219
|
-
return /(?:^|[\s/\\"])node9 (?:check|log)/.test(cmd) || /(?:^|[\s/\\
|
|
7219
|
+
return /(?:^|[\s/\\"])node9"? (?:check|log)/.test(cmd) || /(?:^|[\s/\\])cli\.js"? (?:check|log)/.test(cmd);
|
|
7220
7220
|
}
|
|
7221
7221
|
function teardownClaude() {
|
|
7222
7222
|
const homeDir2 = os12.homedir();
|
|
@@ -20829,10 +20829,35 @@ function registerDaemonCommand(program2) {
|
|
|
20829
20829
|
// src/cli/commands/status.ts
|
|
20830
20830
|
init_core();
|
|
20831
20831
|
init_daemon();
|
|
20832
|
+
init_setup();
|
|
20832
20833
|
import chalk15 from "chalk";
|
|
20833
20834
|
import fs39 from "fs";
|
|
20834
20835
|
import path40 from "path";
|
|
20835
20836
|
import os35 from "os";
|
|
20837
|
+
import * as yaml2 from "yaml";
|
|
20838
|
+
function readHermesHooks(configPath) {
|
|
20839
|
+
if (!fs39.existsSync(configPath)) return null;
|
|
20840
|
+
let raw;
|
|
20841
|
+
try {
|
|
20842
|
+
raw = fs39.readFileSync(configPath, "utf-8");
|
|
20843
|
+
} catch {
|
|
20844
|
+
return null;
|
|
20845
|
+
}
|
|
20846
|
+
try {
|
|
20847
|
+
const cfg = yaml2.parse(raw);
|
|
20848
|
+
const has = (event) => (cfg?.hooks?.[event] ?? []).some(
|
|
20849
|
+
(e) => typeof e?.command === "string" && isNode9Hook(e.command)
|
|
20850
|
+
);
|
|
20851
|
+
return { pre: has("pre_tool_call"), post: has("post_tool_call") };
|
|
20852
|
+
} catch {
|
|
20853
|
+
console.error(
|
|
20854
|
+
chalk15.yellow(
|
|
20855
|
+
` \u26A0\uFE0F Hermes config.yaml at ${configPath} is not valid YAML \u2014 showing as unwired.`
|
|
20856
|
+
)
|
|
20857
|
+
);
|
|
20858
|
+
return { pre: false, post: false };
|
|
20859
|
+
}
|
|
20860
|
+
}
|
|
20836
20861
|
function readJson2(filePath) {
|
|
20837
20862
|
try {
|
|
20838
20863
|
if (fs39.existsSync(filePath)) return JSON.parse(fs39.readFileSync(filePath, "utf-8"));
|
|
@@ -20840,9 +20865,11 @@ function readJson2(filePath) {
|
|
|
20840
20865
|
}
|
|
20841
20866
|
return null;
|
|
20842
20867
|
}
|
|
20843
|
-
function
|
|
20844
|
-
|
|
20845
|
-
|
|
20868
|
+
function matchersHaveNode9Hook(matchers) {
|
|
20869
|
+
return (matchers ?? []).some((m) => (m.hooks ?? []).some((h) => isNode9Hook(h.command)));
|
|
20870
|
+
}
|
|
20871
|
+
function flatHaveNode9Hook(entries) {
|
|
20872
|
+
return (Array.isArray(entries) ? entries : []).some((h) => isNode9Hook(h.command));
|
|
20846
20873
|
}
|
|
20847
20874
|
function wrappedMcpServers(servers) {
|
|
20848
20875
|
if (!servers) return [];
|
|
@@ -20857,6 +20884,7 @@ function printAgentSection(label, hookPairs, wrapped) {
|
|
|
20857
20884
|
console.log(chalk15.red(` \u2717 ${name}`) + chalk15.gray(" (not wired)"));
|
|
20858
20885
|
}
|
|
20859
20886
|
}
|
|
20887
|
+
if (wrapped === null) return;
|
|
20860
20888
|
if (wrapped.length > 0) {
|
|
20861
20889
|
console.log(chalk15.cyan(` MCP proxied:`));
|
|
20862
20890
|
for (const entry of wrapped) {
|
|
@@ -20922,18 +20950,29 @@ function registerStatusCommand(program2) {
|
|
|
20922
20950
|
path40.join(homeDir2, ".gemini", "settings.json")
|
|
20923
20951
|
);
|
|
20924
20952
|
const cursorConfig = readJson2(path40.join(homeDir2, ".cursor", "mcp.json"));
|
|
20925
|
-
const
|
|
20953
|
+
const antigravityHooks = readJson2(
|
|
20954
|
+
path40.join(homeDir2, ".gemini", "config", "hooks.json")
|
|
20955
|
+
);
|
|
20956
|
+
const antigravityMcp = readJson2(
|
|
20957
|
+
path40.join(homeDir2, ".gemini", "config", "mcp_config.json")
|
|
20958
|
+
);
|
|
20959
|
+
const antigravityPresent = antigravityHooks !== null || fs39.existsSync(path40.join(homeDir2, ".gemini", "antigravity-cli")) || fs39.existsSync(path40.join(homeDir2, ".gemini", "antigravity-ide"));
|
|
20960
|
+
const copilotHooks = readJson2(
|
|
20961
|
+
path40.join(homeDir2, ".copilot", "hooks", "node9.json")
|
|
20962
|
+
);
|
|
20963
|
+
const copilotMcp = readJson2(
|
|
20964
|
+
path40.join(homeDir2, ".copilot", "mcp-config.json")
|
|
20965
|
+
);
|
|
20966
|
+
const copilotPresent = fs39.existsSync(path40.join(homeDir2, ".copilot"));
|
|
20967
|
+
const hermesHooks = readHermesHooks(hermesConfigPath(homeDir2));
|
|
20968
|
+
const agentFound = claudeSettings || claudeConfig || geminiSettings || cursorConfig || antigravityPresent || copilotPresent || hermesHooks;
|
|
20926
20969
|
if (agentFound) {
|
|
20927
20970
|
console.log("");
|
|
20928
20971
|
console.log(chalk15.bold(" Agent Wiring:"));
|
|
20929
20972
|
console.log("");
|
|
20930
20973
|
if (claudeSettings || claudeConfig) {
|
|
20931
|
-
const preHook = claudeSettings?.hooks?.PreToolUse
|
|
20932
|
-
|
|
20933
|
-
) ?? false;
|
|
20934
|
-
const postHook = claudeSettings?.hooks?.PostToolUse?.some(
|
|
20935
|
-
(m) => m.hooks.some((h) => isNode9Hook2(h.command))
|
|
20936
|
-
) ?? false;
|
|
20974
|
+
const preHook = matchersHaveNode9Hook(claudeSettings?.hooks?.PreToolUse);
|
|
20975
|
+
const postHook = matchersHaveNode9Hook(claudeSettings?.hooks?.PostToolUse);
|
|
20937
20976
|
printAgentSection(
|
|
20938
20977
|
"Claude Code",
|
|
20939
20978
|
[
|
|
@@ -20945,12 +20984,8 @@ function registerStatusCommand(program2) {
|
|
|
20945
20984
|
console.log("");
|
|
20946
20985
|
}
|
|
20947
20986
|
if (geminiSettings) {
|
|
20948
|
-
const beforeHook = geminiSettings.hooks?.BeforeTool
|
|
20949
|
-
|
|
20950
|
-
) ?? false;
|
|
20951
|
-
const afterHook = geminiSettings.hooks?.AfterTool?.some(
|
|
20952
|
-
(m) => m.hooks.some((h) => isNode9Hook2(h.command))
|
|
20953
|
-
) ?? false;
|
|
20987
|
+
const beforeHook = matchersHaveNode9Hook(geminiSettings.hooks?.BeforeTool);
|
|
20988
|
+
const afterHook = matchersHaveNode9Hook(geminiSettings.hooks?.AfterTool);
|
|
20954
20989
|
printAgentSection(
|
|
20955
20990
|
"Gemini CLI",
|
|
20956
20991
|
[
|
|
@@ -20961,10 +20996,50 @@ function registerStatusCommand(program2) {
|
|
|
20961
20996
|
);
|
|
20962
20997
|
console.log("");
|
|
20963
20998
|
}
|
|
20999
|
+
if (antigravityPresent) {
|
|
21000
|
+
const preHook = matchersHaveNode9Hook(antigravityHooks?.hooks?.PreToolUse);
|
|
21001
|
+
const postHook = matchersHaveNode9Hook(antigravityHooks?.hooks?.PostToolUse);
|
|
21002
|
+
printAgentSection(
|
|
21003
|
+
"Antigravity",
|
|
21004
|
+
[
|
|
21005
|
+
{ name: "PreToolUse (node9 check)", present: preHook },
|
|
21006
|
+
{ name: "PostToolUse (node9 log)", present: postHook }
|
|
21007
|
+
],
|
|
21008
|
+
wrappedMcpServers(antigravityMcp?.mcpServers)
|
|
21009
|
+
);
|
|
21010
|
+
console.log("");
|
|
21011
|
+
}
|
|
21012
|
+
if (copilotPresent) {
|
|
21013
|
+
const preHook = flatHaveNode9Hook(copilotHooks?.hooks?.PreToolUse);
|
|
21014
|
+
const postHook = flatHaveNode9Hook(copilotHooks?.hooks?.PostToolUse);
|
|
21015
|
+
const promptHook = flatHaveNode9Hook(copilotHooks?.hooks?.UserPromptSubmit);
|
|
21016
|
+
printAgentSection(
|
|
21017
|
+
"GitHub Copilot",
|
|
21018
|
+
[
|
|
21019
|
+
{ name: "PreToolUse (node9 check)", present: preHook },
|
|
21020
|
+
{ name: "PostToolUse (node9 log)", present: postHook },
|
|
21021
|
+
{ name: "UserPromptSubmit (node9 check)", present: promptHook }
|
|
21022
|
+
],
|
|
21023
|
+
wrappedMcpServers(copilotMcp?.mcpServers)
|
|
21024
|
+
);
|
|
21025
|
+
console.log("");
|
|
21026
|
+
}
|
|
20964
21027
|
if (cursorConfig) {
|
|
20965
21028
|
printAgentSection("Cursor", [], wrappedMcpServers(cursorConfig.mcpServers));
|
|
20966
21029
|
console.log("");
|
|
20967
21030
|
}
|
|
21031
|
+
if (hermesHooks) {
|
|
21032
|
+
printAgentSection(
|
|
21033
|
+
"Hermes Agent",
|
|
21034
|
+
[
|
|
21035
|
+
{ name: "pre_tool_call (node9 check)", present: hermesHooks.pre },
|
|
21036
|
+
{ name: "post_tool_call (node9 log)", present: hermesHooks.post }
|
|
21037
|
+
],
|
|
21038
|
+
null
|
|
21039
|
+
// Hermes has no MCP surface
|
|
21040
|
+
);
|
|
21041
|
+
console.log("");
|
|
21042
|
+
}
|
|
20968
21043
|
}
|
|
20969
21044
|
const pauseState = checkPause();
|
|
20970
21045
|
if (pauseState.paused) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node9/proxy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "The Sudo Command for AI Agents. Execution Security for Claude Code, Codex, Gemini, Cursor, Opencode, Pi, and any MCP server.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|