@node9/proxy 2.2.1 → 2.2.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/cli.js CHANGED
@@ -48029,6 +48029,20 @@ function buildReviewMessage(blockedByLabel, ruleDescription, reason) {
48029
48029
  return `Node9 flagged this for your review: ${why}. Approve to proceed, or deny to cancel.`;
48030
48030
  }
48031
48031
 
48032
+ // src/utils/platform-shell.ts
48033
+ function locatorCommand() {
48034
+ return process.platform === "win32" ? "where" : "which";
48035
+ }
48036
+ function shellInvocation(command) {
48037
+ if (process.platform === "win32") {
48038
+ return {
48039
+ file: process.env.ComSpec || "cmd.exe",
48040
+ args: ["/d", "/s", "/c", command]
48041
+ };
48042
+ }
48043
+ return { file: "/bin/bash", args: ["-c", command] };
48044
+ }
48045
+
48032
48046
  // src/proxy/index.ts
48033
48047
  function sanitize(value) {
48034
48048
  return value.replace(/[\x00-\x1F\x7F]/g, "");
@@ -48040,14 +48054,16 @@ async function runProxy(targetCommand) {
48040
48054
  let executable = cmd;
48041
48055
  let useShell = false;
48042
48056
  try {
48043
- const { stdout } = await (0, import_execa.execa)("which", [cmd]);
48044
- if (stdout) executable = stdout.trim();
48057
+ const { stdout } = await (0, import_execa.execa)(locatorCommand(), [cmd]);
48058
+ const first = stdout.split(/\r?\n/)[0]?.trim();
48059
+ if (first) executable = first;
48045
48060
  } catch {
48046
48061
  useShell = true;
48047
48062
  }
48048
48063
  console.error(import_chalk8.default.green(`\u{1F680} Node9 Proxy Active: Monitoring [${targetCommand}]`));
48049
48064
  const spawnEnv = { ...process.env, FORCE_COLOR: "1" };
48050
- const child = useShell ? (0, import_child_process4.spawn)("/bin/bash", ["-c", targetCommand], {
48065
+ const shell = shellInvocation(targetCommand);
48066
+ const child = useShell ? (0, import_child_process4.spawn)(shell.file, shell.args, {
48051
48067
  stdio: ["pipe", "pipe", "inherit"],
48052
48068
  shell: false,
48053
48069
  env: spawnEnv
@@ -48111,6 +48127,17 @@ async function runProxy(targetCommand) {
48111
48127
  child.stdin.write(line + "\n");
48112
48128
  });
48113
48129
  child.stdout.pipe(process.stdout);
48130
+ child.on("error", (err2) => {
48131
+ const what = useShell ? shell.file : executable;
48132
+ console.error(
48133
+ import_chalk8.default.red(
48134
+ err2.code === "ENOENT" ? `
48135
+ \u274C Node9 could not run "${targetCommand}": ${what} was not found on this machine.` : `
48136
+ \u274C Node9 could not run "${targetCommand}": ${err2.message}`
48137
+ )
48138
+ );
48139
+ process.exit(127);
48140
+ });
48114
48141
  child.on("exit", (code) => process.exit(code || 0));
48115
48142
  }
48116
48143
 
@@ -50232,8 +50259,10 @@ function registerDoctorCommand(program2, version2) {
50232
50259
  `));
50233
50260
  section("Binary");
50234
50261
  try {
50235
- const locator = process.platform === "win32" ? "where node9" : "which node9";
50236
- const found = (0, import_child_process8.execSync)(locator, { encoding: "utf-8", timeout: 3e3 }).split(/\r?\n/)[0].trim();
50262
+ const found = (0, import_child_process8.execSync)(`${locatorCommand()} node9`, {
50263
+ encoding: "utf-8",
50264
+ timeout: 3e3
50265
+ }).split(/\r?\n/)[0].trim();
50237
50266
  pass(`node9 found at ${found}`);
50238
50267
  } catch {
50239
50268
  warn("node9 not found in $PATH \u2014 hooks may not find it", "Run: npm install -g node9-ai");
package/dist/cli.mjs CHANGED
@@ -48022,6 +48022,20 @@ function buildReviewMessage(blockedByLabel, ruleDescription, reason) {
48022
48022
  return `Node9 flagged this for your review: ${why}. Approve to proceed, or deny to cancel.`;
48023
48023
  }
48024
48024
 
48025
+ // src/utils/platform-shell.ts
48026
+ function locatorCommand() {
48027
+ return process.platform === "win32" ? "where" : "which";
48028
+ }
48029
+ function shellInvocation(command) {
48030
+ if (process.platform === "win32") {
48031
+ return {
48032
+ file: process.env.ComSpec || "cmd.exe",
48033
+ args: ["/d", "/s", "/c", command]
48034
+ };
48035
+ }
48036
+ return { file: "/bin/bash", args: ["-c", command] };
48037
+ }
48038
+
48025
48039
  // src/proxy/index.ts
48026
48040
  function sanitize(value) {
48027
48041
  return value.replace(/[\x00-\x1F\x7F]/g, "");
@@ -48033,14 +48047,16 @@ async function runProxy(targetCommand) {
48033
48047
  let executable = cmd;
48034
48048
  let useShell = false;
48035
48049
  try {
48036
- const { stdout } = await execa("which", [cmd]);
48037
- if (stdout) executable = stdout.trim();
48050
+ const { stdout } = await execa(locatorCommand(), [cmd]);
48051
+ const first = stdout.split(/\r?\n/)[0]?.trim();
48052
+ if (first) executable = first;
48038
48053
  } catch {
48039
48054
  useShell = true;
48040
48055
  }
48041
48056
  console.error(chalk8.green(`\u{1F680} Node9 Proxy Active: Monitoring [${targetCommand}]`));
48042
48057
  const spawnEnv = { ...process.env, FORCE_COLOR: "1" };
48043
- const child = useShell ? spawn2("/bin/bash", ["-c", targetCommand], {
48058
+ const shell = shellInvocation(targetCommand);
48059
+ const child = useShell ? spawn2(shell.file, shell.args, {
48044
48060
  stdio: ["pipe", "pipe", "inherit"],
48045
48061
  shell: false,
48046
48062
  env: spawnEnv
@@ -48104,6 +48120,17 @@ async function runProxy(targetCommand) {
48104
48120
  child.stdin.write(line + "\n");
48105
48121
  });
48106
48122
  child.stdout.pipe(process.stdout);
48123
+ child.on("error", (err2) => {
48124
+ const what = useShell ? shell.file : executable;
48125
+ console.error(
48126
+ chalk8.red(
48127
+ err2.code === "ENOENT" ? `
48128
+ \u274C Node9 could not run "${targetCommand}": ${what} was not found on this machine.` : `
48129
+ \u274C Node9 could not run "${targetCommand}": ${err2.message}`
48130
+ )
48131
+ );
48132
+ process.exit(127);
48133
+ });
48107
48134
  child.on("exit", (code) => process.exit(code || 0));
48108
48135
  }
48109
48136
 
@@ -50225,8 +50252,10 @@ function registerDoctorCommand(program2, version2) {
50225
50252
  `));
50226
50253
  section("Binary");
50227
50254
  try {
50228
- const locator = process.platform === "win32" ? "where node9" : "which node9";
50229
- const found = execSync(locator, { encoding: "utf-8", timeout: 3e3 }).split(/\r?\n/)[0].trim();
50255
+ const found = execSync(`${locatorCommand()} node9`, {
50256
+ encoding: "utf-8",
50257
+ timeout: 3e3
50258
+ }).split(/\r?\n/)[0].trim();
50230
50259
  pass(`node9 found at ${found}`);
50231
50260
  } catch {
50232
50261
  warn("node9 not found in $PATH \u2014 hooks may not find it", "Run: npm install -g node9-ai");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node9/proxy",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
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",