@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.mjs CHANGED
@@ -1260,13 +1260,16 @@ var init_provider_cli_adapter = __esm({
1260
1260
  let shellArgs;
1261
1261
  const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
1262
1262
  const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
1263
- const useShell = isWin ? !!spawnConfig.shell || isCmdShim : useShellUnix;
1263
+ const useShellWin = isCmdShim || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath);
1264
+ const useShell = isWin ? useShellWin : useShellUnix;
1264
1265
  if (useShell) {
1265
1266
  if (!spawnConfig.shell && !isWin) {
1266
1267
  LOG.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
1267
1268
  }
1268
1269
  if (isCmdShim) {
1269
1270
  LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
1271
+ } else if (isWin) {
1272
+ LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell on Windows: ${binaryPath}`);
1270
1273
  }
1271
1274
  shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
1272
1275
  if (isWin) {
@@ -1276,6 +1279,9 @@ var init_provider_cli_adapter = __esm({
1276
1279
  shellArgs = ["-l", "-c", fullCmd];
1277
1280
  }
1278
1281
  } else {
1282
+ if (isWin && spawnConfig.shell) {
1283
+ LOG.info("CLI", `[${this.cliType}] Spawning Windows binary directly without cmd.exe: ${binaryPath}`);
1284
+ }
1279
1285
  shellCmd = binaryPath;
1280
1286
  shellArgs = allArgs;
1281
1287
  }
@@ -7247,8 +7253,24 @@ function handleSetIdeExtension(h, args) {
7247
7253
 
7248
7254
  // src/commands/workspace-commands.ts
7249
7255
  init_config();
7256
+ function loadWorkspaceConfig() {
7257
+ try {
7258
+ return loadConfig();
7259
+ } catch (e) {
7260
+ return { error: `Could not load config: ${e?.message || "unknown error"}` };
7261
+ }
7262
+ }
7263
+ function persistWorkspaceConfig(config) {
7264
+ try {
7265
+ saveConfig(config);
7266
+ return { ok: true };
7267
+ } catch (e) {
7268
+ return { error: `Could not save config: ${e?.message || "unknown error"}` };
7269
+ }
7270
+ }
7250
7271
  function handleWorkspaceList() {
7251
- const config = loadConfig();
7272
+ const config = loadWorkspaceConfig();
7273
+ if ("error" in config) return { success: false, error: config.error };
7252
7274
  const state = getWorkspaceState(config);
7253
7275
  return {
7254
7276
  success: true,
@@ -7262,31 +7284,37 @@ function handleWorkspaceAdd(args) {
7262
7284
  const label = (args?.label || "").trim() || void 0;
7263
7285
  const createIfMissing = args?.createIfMissing === true;
7264
7286
  if (!rawPath) return { success: false, error: "path required" };
7265
- const config = loadConfig();
7287
+ const config = loadWorkspaceConfig();
7288
+ if ("error" in config) return { success: false, error: config.error };
7266
7289
  const result = addWorkspaceEntry(config, rawPath, label, { createIfMissing });
7267
7290
  if ("error" in result) return { success: false, error: result.error };
7268
- saveConfig(result.config);
7291
+ const saveResult = persistWorkspaceConfig(result.config);
7292
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
7269
7293
  const state = getWorkspaceState(result.config);
7270
7294
  return { success: true, entry: result.entry, ...state };
7271
7295
  }
7272
7296
  function handleWorkspaceRemove(args) {
7273
7297
  const id = (args?.id || "").trim();
7274
7298
  if (!id) return { success: false, error: "id required" };
7275
- const config = loadConfig();
7299
+ const config = loadWorkspaceConfig();
7300
+ if ("error" in config) return { success: false, error: config.error };
7276
7301
  const removed = (config.workspaces || []).find((w) => w.id === id);
7277
7302
  const result = removeWorkspaceEntry(config, id);
7278
7303
  if ("error" in result) return { success: false, error: result.error };
7279
- saveConfig(result.config);
7304
+ const saveResult = persistWorkspaceConfig(result.config);
7305
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
7280
7306
  const state = getWorkspaceState(result.config);
7281
7307
  return { success: true, removedId: id, ...state };
7282
7308
  }
7283
7309
  function handleWorkspaceSetDefault(args) {
7284
7310
  const clear = args?.clear === true || args?.id === null || args?.id === "";
7285
7311
  if (clear) {
7286
- const config2 = loadConfig();
7312
+ const config2 = loadWorkspaceConfig();
7313
+ if ("error" in config2) return { success: false, error: config2.error };
7287
7314
  const result2 = setDefaultWorkspaceId(config2, null);
7288
7315
  if ("error" in result2) return { success: false, error: result2.error };
7289
- saveConfig(result2.config);
7316
+ const saveResult2 = persistWorkspaceConfig(result2.config);
7317
+ if ("error" in saveResult2) return { success: false, error: saveResult2.error };
7290
7318
  const state2 = getWorkspaceState(result2.config);
7291
7319
  return {
7292
7320
  success: true,
@@ -7298,7 +7326,9 @@ function handleWorkspaceSetDefault(args) {
7298
7326
  if (!pathArg && !idArg) {
7299
7327
  return { success: false, error: "id or path required (or clear: true)" };
7300
7328
  }
7301
- let config = loadConfig();
7329
+ const configResult = loadWorkspaceConfig();
7330
+ if ("error" in configResult) return { success: false, error: configResult.error };
7331
+ let config = configResult;
7302
7332
  let nextId;
7303
7333
  if (pathArg) {
7304
7334
  let w = findWorkspaceByPath(config, pathArg);
@@ -7314,7 +7344,8 @@ function handleWorkspaceSetDefault(args) {
7314
7344
  }
7315
7345
  const result = setDefaultWorkspaceId(config, nextId);
7316
7346
  if ("error" in result) return { success: false, error: result.error };
7317
- saveConfig(result.config);
7347
+ const saveResult = persistWorkspaceConfig(result.config);
7348
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
7318
7349
  const state = getWorkspaceState(result.config);
7319
7350
  return { success: true, ...state };
7320
7351
  }