@adhdev/daemon-standalone 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
@@ -29061,13 +29061,16 @@ var require_dist2 = __commonJS({
29061
29061
  let shellArgs;
29062
29062
  const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
29063
29063
  const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
29064
- const useShell = isWin ? !!spawnConfig.shell || isCmdShim : useShellUnix;
29064
+ const useShellWin = isCmdShim || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath);
29065
+ const useShell = isWin ? useShellWin : useShellUnix;
29065
29066
  if (useShell) {
29066
29067
  if (!spawnConfig.shell && !isWin) {
29067
29068
  LOG2.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
29068
29069
  }
29069
29070
  if (isCmdShim) {
29070
29071
  LOG2.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
29072
+ } else if (isWin) {
29073
+ LOG2.info("CLI", `[${this.cliType}] Using cmd.exe shell on Windows: ${binaryPath}`);
29071
29074
  }
29072
29075
  shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
29073
29076
  if (isWin) {
@@ -29077,6 +29080,9 @@ var require_dist2 = __commonJS({
29077
29080
  shellArgs = ["-l", "-c", fullCmd];
29078
29081
  }
29079
29082
  } else {
29083
+ if (isWin && spawnConfig.shell) {
29084
+ LOG2.info("CLI", `[${this.cliType}] Spawning Windows binary directly without cmd.exe: ${binaryPath}`);
29085
+ }
29080
29086
  shellCmd = binaryPath;
29081
29087
  shellArgs = allArgs;
29082
29088
  }
@@ -35079,8 +35085,24 @@ ${data.message || ""}`.trim();
35079
35085
  return { success: false, error: "Failed to save setting" };
35080
35086
  }
35081
35087
  init_config();
35088
+ function loadWorkspaceConfig() {
35089
+ try {
35090
+ return loadConfig2();
35091
+ } catch (e) {
35092
+ return { error: `Could not load config: ${e?.message || "unknown error"}` };
35093
+ }
35094
+ }
35095
+ function persistWorkspaceConfig(config2) {
35096
+ try {
35097
+ saveConfig(config2);
35098
+ return { ok: true };
35099
+ } catch (e) {
35100
+ return { error: `Could not save config: ${e?.message || "unknown error"}` };
35101
+ }
35102
+ }
35082
35103
  function handleWorkspaceList() {
35083
- const config2 = loadConfig2();
35104
+ const config2 = loadWorkspaceConfig();
35105
+ if ("error" in config2) return { success: false, error: config2.error };
35084
35106
  const state = getWorkspaceState2(config2);
35085
35107
  return {
35086
35108
  success: true,
@@ -35094,31 +35116,37 @@ ${data.message || ""}`.trim();
35094
35116
  const label = (args?.label || "").trim() || void 0;
35095
35117
  const createIfMissing = args?.createIfMissing === true;
35096
35118
  if (!rawPath) return { success: false, error: "path required" };
35097
- const config2 = loadConfig2();
35119
+ const config2 = loadWorkspaceConfig();
35120
+ if ("error" in config2) return { success: false, error: config2.error };
35098
35121
  const result = addWorkspaceEntry(config2, rawPath, label, { createIfMissing });
35099
35122
  if ("error" in result) return { success: false, error: result.error };
35100
- saveConfig(result.config);
35123
+ const saveResult = persistWorkspaceConfig(result.config);
35124
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
35101
35125
  const state = getWorkspaceState2(result.config);
35102
35126
  return { success: true, entry: result.entry, ...state };
35103
35127
  }
35104
35128
  function handleWorkspaceRemove(args) {
35105
35129
  const id = (args?.id || "").trim();
35106
35130
  if (!id) return { success: false, error: "id required" };
35107
- const config2 = loadConfig2();
35131
+ const config2 = loadWorkspaceConfig();
35132
+ if ("error" in config2) return { success: false, error: config2.error };
35108
35133
  const removed = (config2.workspaces || []).find((w) => w.id === id);
35109
35134
  const result = removeWorkspaceEntry(config2, id);
35110
35135
  if ("error" in result) return { success: false, error: result.error };
35111
- saveConfig(result.config);
35136
+ const saveResult = persistWorkspaceConfig(result.config);
35137
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
35112
35138
  const state = getWorkspaceState2(result.config);
35113
35139
  return { success: true, removedId: id, ...state };
35114
35140
  }
35115
35141
  function handleWorkspaceSetDefault(args) {
35116
35142
  const clear = args?.clear === true || args?.id === null || args?.id === "";
35117
35143
  if (clear) {
35118
- const config22 = loadConfig2();
35144
+ const config22 = loadWorkspaceConfig();
35145
+ if ("error" in config22) return { success: false, error: config22.error };
35119
35146
  const result2 = setDefaultWorkspaceId(config22, null);
35120
35147
  if ("error" in result2) return { success: false, error: result2.error };
35121
- saveConfig(result2.config);
35148
+ const saveResult2 = persistWorkspaceConfig(result2.config);
35149
+ if ("error" in saveResult2) return { success: false, error: saveResult2.error };
35122
35150
  const state2 = getWorkspaceState2(result2.config);
35123
35151
  return {
35124
35152
  success: true,
@@ -35130,7 +35158,9 @@ ${data.message || ""}`.trim();
35130
35158
  if (!pathArg && !idArg) {
35131
35159
  return { success: false, error: "id or path required (or clear: true)" };
35132
35160
  }
35133
- let config2 = loadConfig2();
35161
+ const configResult = loadWorkspaceConfig();
35162
+ if ("error" in configResult) return { success: false, error: configResult.error };
35163
+ let config2 = configResult;
35134
35164
  let nextId;
35135
35165
  if (pathArg) {
35136
35166
  let w = findWorkspaceByPath(config2, pathArg);
@@ -35146,7 +35176,8 @@ ${data.message || ""}`.trim();
35146
35176
  }
35147
35177
  const result = setDefaultWorkspaceId(config2, nextId);
35148
35178
  if ("error" in result) return { success: false, error: result.error };
35149
- saveConfig(result.config);
35179
+ const saveResult = persistWorkspaceConfig(result.config);
35180
+ if ("error" in saveResult) return { success: false, error: saveResult.error };
35150
35181
  const state = getWorkspaceState2(result.config);
35151
35182
  return { success: true, ...state };
35152
35183
  }