adhdev 0.8.13 → 0.8.14

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
@@ -5459,8 +5459,24 @@ var init_stream_commands = __esm({
5459
5459
  });
5460
5460
 
5461
5461
  // ../../oss/packages/daemon-core/src/commands/workspace-commands.ts
5462
+ function loadWorkspaceConfig() {
5463
+ try {
5464
+ return loadConfig();
5465
+ } catch (e) {
5466
+ return { error: `Could not load config: ${e?.message || "unknown error"}` };
5467
+ }
5468
+ }
5469
+ function persistWorkspaceConfig(config2) {
5470
+ try {
5471
+ saveConfig(config2);
5472
+ return { ok: true };
5473
+ } catch (e) {
5474
+ return { error: `Could not save config: ${e?.message || "unknown error"}` };
5475
+ }
5476
+ }
5462
5477
  function handleWorkspaceList() {
5463
- const config2 = loadConfig();
5478
+ const config2 = loadWorkspaceConfig();
5479
+ if ("error" in config2) return { success: false, error: config2.error };
5464
5480
  const state = getWorkspaceState(config2);
5465
5481
  return {
5466
5482
  success: true,
@@ -5474,31 +5490,37 @@ function handleWorkspaceAdd(args) {
5474
5490
  const label = (args?.label || "").trim() || void 0;
5475
5491
  const createIfMissing = args?.createIfMissing === true;
5476
5492
  if (!rawPath) return { success: false, error: "path required" };
5477
- const config2 = loadConfig();
5493
+ const config2 = loadWorkspaceConfig();
5494
+ if ("error" in config2) return { success: false, error: config2.error };
5478
5495
  const result = addWorkspaceEntry(config2, rawPath, label, { createIfMissing });
5479
5496
  if ("error" in result) return { success: false, error: result.error };
5480
- saveConfig(result.config);
5497
+ const saveResult = persistWorkspaceConfig(result.config);
5498
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
5481
5499
  const state = getWorkspaceState(result.config);
5482
5500
  return { success: true, entry: result.entry, ...state };
5483
5501
  }
5484
5502
  function handleWorkspaceRemove(args) {
5485
5503
  const id = (args?.id || "").trim();
5486
5504
  if (!id) return { success: false, error: "id required" };
5487
- const config2 = loadConfig();
5505
+ const config2 = loadWorkspaceConfig();
5506
+ if ("error" in config2) return { success: false, error: config2.error };
5488
5507
  const removed = (config2.workspaces || []).find((w) => w.id === id);
5489
5508
  const result = removeWorkspaceEntry(config2, id);
5490
5509
  if ("error" in result) return { success: false, error: result.error };
5491
- saveConfig(result.config);
5510
+ const saveResult = persistWorkspaceConfig(result.config);
5511
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
5492
5512
  const state = getWorkspaceState(result.config);
5493
5513
  return { success: true, removedId: id, ...state };
5494
5514
  }
5495
5515
  function handleWorkspaceSetDefault(args) {
5496
5516
  const clear = args?.clear === true || args?.id === null || args?.id === "";
5497
5517
  if (clear) {
5498
- const config3 = loadConfig();
5518
+ const config3 = loadWorkspaceConfig();
5519
+ if ("error" in config3) return { success: false, error: config3.error };
5499
5520
  const result2 = setDefaultWorkspaceId(config3, null);
5500
5521
  if ("error" in result2) return { success: false, error: result2.error };
5501
- saveConfig(result2.config);
5522
+ const saveResult2 = persistWorkspaceConfig(result2.config);
5523
+ if ("error" in saveResult2) return { success: false, error: saveResult2.error };
5502
5524
  const state2 = getWorkspaceState(result2.config);
5503
5525
  return {
5504
5526
  success: true,
@@ -5510,7 +5532,9 @@ function handleWorkspaceSetDefault(args) {
5510
5532
  if (!pathArg && !idArg) {
5511
5533
  return { success: false, error: "id or path required (or clear: true)" };
5512
5534
  }
5513
- let config2 = loadConfig();
5535
+ const configResult = loadWorkspaceConfig();
5536
+ if ("error" in configResult) return { success: false, error: configResult.error };
5537
+ let config2 = configResult;
5514
5538
  let nextId;
5515
5539
  if (pathArg) {
5516
5540
  let w = findWorkspaceByPath(config2, pathArg);
@@ -5526,7 +5550,8 @@ function handleWorkspaceSetDefault(args) {
5526
5550
  }
5527
5551
  const result = setDefaultWorkspaceId(config2, nextId);
5528
5552
  if ("error" in result) return { success: false, error: result.error };
5529
- saveConfig(result.config);
5553
+ const saveResult = persistWorkspaceConfig(result.config);
5554
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
5530
5555
  const state = getWorkspaceState(result.config);
5531
5556
  return { success: true, ...state };
5532
5557
  }
@@ -7053,13 +7078,16 @@ var init_provider_cli_adapter = __esm({
7053
7078
  let shellArgs;
7054
7079
  const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
7055
7080
  const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
7056
- const useShell = isWin ? !!spawnConfig.shell || isCmdShim : useShellUnix;
7081
+ const useShellWin = isCmdShim || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath);
7082
+ const useShell = isWin ? useShellWin : useShellUnix;
7057
7083
  if (useShell) {
7058
7084
  if (!spawnConfig.shell && !isWin) {
7059
7085
  LOG.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
7060
7086
  }
7061
7087
  if (isCmdShim) {
7062
7088
  LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
7089
+ } else if (isWin) {
7090
+ LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell on Windows: ${binaryPath}`);
7063
7091
  }
7064
7092
  shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
7065
7093
  if (isWin) {
@@ -7069,6 +7097,9 @@ var init_provider_cli_adapter = __esm({
7069
7097
  shellArgs = ["-l", "-c", fullCmd];
7070
7098
  }
7071
7099
  } else {
7100
+ if (isWin && spawnConfig.shell) {
7101
+ LOG.info("CLI", `[${this.cliType}] Spawning Windows binary directly without cmd.exe: ${binaryPath}`);
7102
+ }
7072
7103
  shellCmd = binaryPath;
7073
7104
  shellArgs = allArgs;
7074
7105
  }
@@ -45833,7 +45864,7 @@ function getSessionHostPidFile() {
45833
45864
  function killPid2(pid) {
45834
45865
  try {
45835
45866
  if (process.platform === "win32") {
45836
- (0, import_child_process11.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore" });
45867
+ (0, import_child_process11.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
45837
45868
  } else {
45838
45869
  process.kill(pid, "SIGTERM");
45839
45870
  }
@@ -45851,7 +45882,7 @@ function getWindowsProcessCommandLine(pid) {
45851
45882
  pidFilter,
45852
45883
  "get",
45853
45884
  "CommandLine"
45854
- ], { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "ignore"] });
45885
+ ], { encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
45855
45886
  const text = wmicOut.trim();
45856
45887
  if (text) return text;
45857
45888
  } catch {
@@ -45864,7 +45895,7 @@ function getWindowsProcessCommandLine(pid) {
45864
45895
  "Bypass",
45865
45896
  "-Command",
45866
45897
  `(Get-CimInstance Win32_Process -Filter "${pidFilter}").CommandLine`
45867
- ], { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "ignore"] });
45898
+ ], { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
45868
45899
  const text = psOut.trim();
45869
45900
  if (text) return text;
45870
45901
  } catch {
@@ -45893,7 +45924,8 @@ function stopSessionHost() {
45893
45924
  const raw = (0, import_child_process11.execFileSync)("tasklist", ["/FO", "CSV", "/NH", "/FI", "IMAGENAME eq node.exe"], {
45894
45925
  encoding: "utf8",
45895
45926
  timeout: 5e3,
45896
- stdio: ["ignore", "pipe", "ignore"]
45927
+ stdio: ["ignore", "pipe", "ignore"],
45928
+ windowsHide: true
45897
45929
  }).trim();
45898
45930
  for (const line of raw.split(/\r?\n/)) {
45899
45931
  const match = line.match(/^"node\.exe","(\d+)"/i);
@@ -46077,7 +46109,7 @@ var init_adhdev_daemon = __esm({
46077
46109
  import_ws3 = require("ws");
46078
46110
  import_chalk2 = __toESM(require("chalk"));
46079
46111
  init_version();
46080
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.13" });
46112
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.14" });
46081
46113
  DANGEROUS_PATTERNS = [
46082
46114
  /\brm\s+(-[a-z]*f|-[a-z]*r|--force|--recursive)/i,
46083
46115
  /\bsudo\b/i,