@phren/cli 0.1.16 → 0.1.19

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.
@@ -22,19 +22,25 @@ import { readInstallPreferences } from "../init/preferences.js";
22
22
  import { logger } from "../logger.js";
23
23
  // ── Doctor ──────────────────────────────────────────────────────────────────
24
24
  function isWrapperActive(tool) {
25
- const wrapperPath = homePath(".local", "bin", tool);
25
+ const isWindows = process.platform === "win32";
26
+ const wrapperName = isWindows ? `${tool}.cmd` : tool;
27
+ const wrapperPath = homePath(".local", "bin", wrapperName);
26
28
  if (!fs.existsSync(wrapperPath))
27
29
  return false;
28
30
  try {
29
- const resolved = execFileSync("which", [tool], {
31
+ const whichCmd = isWindows ? "where.exe" : "which";
32
+ const whichArgs = isWindows ? [tool] : [tool];
33
+ const raw = execFileSync(whichCmd, whichArgs, {
30
34
  encoding: "utf8",
31
35
  stdio: ["ignore", "pipe", "ignore"],
32
36
  timeout: EXEC_TIMEOUT_QUICK_MS,
33
37
  }).trim();
34
- return path.resolve(resolved) === path.resolve(wrapperPath);
38
+ // `where.exe` can print multiple paths, one per line; check the first hit.
39
+ const first = raw.split(/\r?\n/).map((line) => line.trim()).find(Boolean) ?? "";
40
+ return path.resolve(first).toLowerCase() === path.resolve(wrapperPath).toLowerCase();
35
41
  }
36
42
  catch (err) {
37
- debugLog(`isWrapperActive: which ${tool} failed: ${errorMessage(err)}`);
43
+ debugLog(`isWrapperActive: resolve ${tool} failed: ${errorMessage(err)}`);
38
44
  return false;
39
45
  }
40
46
  }
@@ -434,6 +440,7 @@ export async function runDoctor(phrenPath, fix = false, checkData = false) {
434
440
  detail: codexWritable ? `writable: ${codexHooks}` : `not writable: ${codexHooks}`,
435
441
  });
436
442
  }
443
+ const wrapperSuffix = process.platform === "win32" ? ".cmd" : "";
437
444
  for (const tool of ["copilot", "cursor", "codex"]) {
438
445
  if (!detected.has(tool))
439
446
  continue;
@@ -442,7 +449,7 @@ export async function runDoctor(phrenPath, fix = false, checkData = false) {
442
449
  name: `wrapper:${tool}`,
443
450
  ok: active,
444
451
  detail: active
445
- ? `${tool} wrapper active via ~/.local/bin/${tool}`
452
+ ? `${tool} wrapper active via ~/.local/bin/${tool}${wrapperSuffix}`
446
453
  : `${tool} wrapper missing or not first in PATH`,
447
454
  });
448
455
  }
@@ -452,7 +459,7 @@ export async function runDoctor(phrenPath, fix = false, checkData = false) {
452
459
  name: "wrapper:phren-cli",
453
460
  ok: phrenCliActive,
454
461
  detail: phrenCliActive
455
- ? "phren CLI wrapper active via ~/.local/bin/phren"
462
+ ? `phren CLI wrapper active via ~/.local/bin/phren${wrapperSuffix}`
456
463
  : "phren CLI wrapper missing — run 'npx @phren/cli init' to install",
457
464
  });
458
465
  if (fix) {