@adhdev/daemon-core 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
@@ -1262,13 +1262,16 @@ var init_provider_cli_adapter = __esm({
1262
1262
  let shellArgs;
1263
1263
  const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
1264
1264
  const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
1265
- const useShell = isWin ? !!spawnConfig.shell || isCmdShim : useShellUnix;
1265
+ const useShellWin = isCmdShim || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath);
1266
+ const useShell = isWin ? useShellWin : useShellUnix;
1266
1267
  if (useShell) {
1267
1268
  if (!spawnConfig.shell && !isWin) {
1268
1269
  LOG.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
1269
1270
  }
1270
1271
  if (isCmdShim) {
1271
1272
  LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
1273
+ } else if (isWin) {
1274
+ LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell on Windows: ${binaryPath}`);
1272
1275
  }
1273
1276
  shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
1274
1277
  if (isWin) {
@@ -1278,6 +1281,9 @@ var init_provider_cli_adapter = __esm({
1278
1281
  shellArgs = ["-l", "-c", fullCmd];
1279
1282
  }
1280
1283
  } else {
1284
+ if (isWin && spawnConfig.shell) {
1285
+ LOG.info("CLI", `[${this.cliType}] Spawning Windows binary directly without cmd.exe: ${binaryPath}`);
1286
+ }
1281
1287
  shellCmd = binaryPath;
1282
1288
  shellArgs = allArgs;
1283
1289
  }
@@ -7328,8 +7334,24 @@ function handleSetIdeExtension(h, args) {
7328
7334
 
7329
7335
  // src/commands/workspace-commands.ts
7330
7336
  init_config();
7337
+ function loadWorkspaceConfig() {
7338
+ try {
7339
+ return loadConfig();
7340
+ } catch (e) {
7341
+ return { error: `Could not load config: ${e?.message || "unknown error"}` };
7342
+ }
7343
+ }
7344
+ function persistWorkspaceConfig(config) {
7345
+ try {
7346
+ saveConfig(config);
7347
+ return { ok: true };
7348
+ } catch (e) {
7349
+ return { error: `Could not save config: ${e?.message || "unknown error"}` };
7350
+ }
7351
+ }
7331
7352
  function handleWorkspaceList() {
7332
- const config = loadConfig();
7353
+ const config = loadWorkspaceConfig();
7354
+ if ("error" in config) return { success: false, error: config.error };
7333
7355
  const state = getWorkspaceState(config);
7334
7356
  return {
7335
7357
  success: true,
@@ -7343,31 +7365,37 @@ function handleWorkspaceAdd(args) {
7343
7365
  const label = (args?.label || "").trim() || void 0;
7344
7366
  const createIfMissing = args?.createIfMissing === true;
7345
7367
  if (!rawPath) return { success: false, error: "path required" };
7346
- const config = loadConfig();
7368
+ const config = loadWorkspaceConfig();
7369
+ if ("error" in config) return { success: false, error: config.error };
7347
7370
  const result = addWorkspaceEntry(config, rawPath, label, { createIfMissing });
7348
7371
  if ("error" in result) return { success: false, error: result.error };
7349
- saveConfig(result.config);
7372
+ const saveResult = persistWorkspaceConfig(result.config);
7373
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
7350
7374
  const state = getWorkspaceState(result.config);
7351
7375
  return { success: true, entry: result.entry, ...state };
7352
7376
  }
7353
7377
  function handleWorkspaceRemove(args) {
7354
7378
  const id = (args?.id || "").trim();
7355
7379
  if (!id) return { success: false, error: "id required" };
7356
- const config = loadConfig();
7380
+ const config = loadWorkspaceConfig();
7381
+ if ("error" in config) return { success: false, error: config.error };
7357
7382
  const removed = (config.workspaces || []).find((w) => w.id === id);
7358
7383
  const result = removeWorkspaceEntry(config, id);
7359
7384
  if ("error" in result) return { success: false, error: result.error };
7360
- saveConfig(result.config);
7385
+ const saveResult = persistWorkspaceConfig(result.config);
7386
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
7361
7387
  const state = getWorkspaceState(result.config);
7362
7388
  return { success: true, removedId: id, ...state };
7363
7389
  }
7364
7390
  function handleWorkspaceSetDefault(args) {
7365
7391
  const clear = args?.clear === true || args?.id === null || args?.id === "";
7366
7392
  if (clear) {
7367
- const config2 = loadConfig();
7393
+ const config2 = loadWorkspaceConfig();
7394
+ if ("error" in config2) return { success: false, error: config2.error };
7368
7395
  const result2 = setDefaultWorkspaceId(config2, null);
7369
7396
  if ("error" in result2) return { success: false, error: result2.error };
7370
- saveConfig(result2.config);
7397
+ const saveResult2 = persistWorkspaceConfig(result2.config);
7398
+ if ("error" in saveResult2) return { success: false, error: saveResult2.error };
7371
7399
  const state2 = getWorkspaceState(result2.config);
7372
7400
  return {
7373
7401
  success: true,
@@ -7379,7 +7407,9 @@ function handleWorkspaceSetDefault(args) {
7379
7407
  if (!pathArg && !idArg) {
7380
7408
  return { success: false, error: "id or path required (or clear: true)" };
7381
7409
  }
7382
- let config = loadConfig();
7410
+ const configResult = loadWorkspaceConfig();
7411
+ if ("error" in configResult) return { success: false, error: configResult.error };
7412
+ let config = configResult;
7383
7413
  let nextId;
7384
7414
  if (pathArg) {
7385
7415
  let w = findWorkspaceByPath(config, pathArg);
@@ -7395,7 +7425,8 @@ function handleWorkspaceSetDefault(args) {
7395
7425
  }
7396
7426
  const result = setDefaultWorkspaceId(config, nextId);
7397
7427
  if ("error" in result) return { success: false, error: result.error };
7398
- saveConfig(result.config);
7428
+ const saveResult = persistWorkspaceConfig(result.config);
7429
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
7399
7430
  const state = getWorkspaceState(result.config);
7400
7431
  return { success: true, ...state };
7401
7432
  }