@evident-ai/cli 3.5.2-dev.43244a2 → 3.5.2-dev.7947d6c

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/index.js CHANGED
@@ -1158,7 +1158,7 @@ import ora4 from "ora";
1158
1158
  import { select as select4 } from "@inquirer/prompts";
1159
1159
 
1160
1160
  // src/lib/telemetry.ts
1161
- var CLI_VERSION = (true ? "3.5.2-dev.43244a2" : void 0) ?? process.env.npm_package_version ?? "unknown";
1161
+ var CLI_VERSION = (true ? "3.5.2-dev.7947d6c" : void 0) ?? process.env.npm_package_version ?? "unknown";
1162
1162
  function getCliVersion() {
1163
1163
  return CLI_VERSION;
1164
1164
  }
@@ -4493,12 +4493,15 @@ function findProcessesByPattern(pgrepPattern, psPattern) {
4493
4493
  }
4494
4494
  } catch {
4495
4495
  try {
4496
- const psOutput = execSync(`ps aux | grep -E "${psPattern}" | grep -v grep`, {
4496
+ const psOutput = execSync("ps aux", {
4497
4497
  encoding: "utf-8",
4498
- stdio: ["pipe", "pipe", "pipe"]
4498
+ stdio: ["pipe", "pipe", "pipe"],
4499
+ // The whole table reaches Node; the 1 MiB default would surface a spurious failure.
4500
+ maxBuffer: 16 * 1024 * 1024
4499
4501
  }).trim();
4500
4502
  if (psOutput) {
4501
4503
  for (const line of psOutput.split("\n")) {
4504
+ if (!psPattern.test(line)) continue;
4502
4505
  const parts = line.trim().split(/\s+/);
4503
4506
  if (parts.length >= 2) {
4504
4507
  const pid = parseInt(parts[1], 10);
@@ -4507,8 +4510,9 @@ function findProcessesByPattern(pgrepPattern, psPattern) {
4507
4510
  }
4508
4511
  }
4509
4512
  } catch (err) {
4513
+ const reason = (typeof err === "object" && err !== null && "stderr" in err && typeof err.stderr === "string" ? err.stderr : "").split("\n").map((line) => line.trim()).find(Boolean) ?? (err instanceof Error ? err.message : String(err)).split("\n").map((line) => line.trim()).find(Boolean) ?? "no error detail available";
4510
4514
  console.warn(
4511
- `findOpenCodeProcesses: ps fallback failed: ${err instanceof Error ? err.message : String(err)}`
4515
+ `Could not list running processes, so an already-running OpenCode may not be detected: ${reason}`
4512
4516
  );
4513
4517
  }
4514
4518
  }
@@ -4540,7 +4544,7 @@ function findProcessesByPattern(pgrepPattern, psPattern) {
4540
4544
  return instances;
4541
4545
  }
4542
4546
  function findOpenCodeProcesses() {
4543
- return findProcessesByPattern("opencode serve|opencode-serve", "opencode (serve|--port)");
4547
+ return findProcessesByPattern("opencode serve|opencode-serve", /opencode (serve|--port)/);
4544
4548
  }
4545
4549
  async function scanPortsForOpenCode() {
4546
4550
  const instances = [];