promptmic 0.1.4 → 0.1.5

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.
@@ -26,6 +26,23 @@ function isExecutable(filePath, platform) {
26
26
  return false;
27
27
  }
28
28
  }
29
+ function resolveUserShell(env, platform, explicitShell) {
30
+ if (explicitShell)
31
+ return explicitShell;
32
+ const envShell = getEnvValue(env, 'SHELL', platform);
33
+ if (envShell)
34
+ return envShell;
35
+ if (platform === 'win32') {
36
+ return getEnvValue(env, 'ComSpec', platform) ?? 'cmd.exe';
37
+ }
38
+ if (platform === 'darwin') {
39
+ return '/bin/zsh';
40
+ }
41
+ if (isExecutable('/bin/bash', platform)) {
42
+ return '/bin/bash';
43
+ }
44
+ return '/bin/sh';
45
+ }
29
46
  function resolveDirectExecutable(command, envPath, platform = process.platform, pathExt = process.env.PATHEXT) {
30
47
  const expandedCommand = expandTilde(command);
31
48
  const hasPathSeparator = expandedCommand.includes('/') || expandedCommand.includes('\\');
@@ -202,7 +219,7 @@ function formatSpawnError(entry, error, commandFound = true) {
202
219
  }
203
220
  return new Error(`Could not start "${entry.label}".`);
204
221
  }
205
- export function resolveProviderCommand(config, providerId, userShell = process.env.SHELL || '/bin/bash') {
222
+ export function resolveProviderCommand(config, providerId, userShell = resolveUserShell(process.env, process.platform)) {
206
223
  const entry = config.providers[providerId];
207
224
  if (!entry)
208
225
  throw new Error(`Provider "${providerId}" not found`);
@@ -229,8 +246,8 @@ export function resolveProviderCommand(config, providerId, userShell = process.e
229
246
  export function createPtySpawner(options = {}) {
230
247
  const baseEnv = Object.fromEntries(Object.entries(options.env ?? process.env).filter((entry) => typeof entry[1] === 'string'));
231
248
  const spawn = options.spawn ?? pty.spawn;
232
- const shell = options.shell ?? process.env.SHELL ?? '/bin/bash';
233
249
  const platform = options.platform ?? process.platform;
250
+ const shell = resolveUserShell(baseEnv, platform, options.shell);
234
251
  const execFileSyncFn = options.execFileSync ?? execFileSync;
235
252
  return ({ provider, cwd, config }) => {
236
253
  const entry = config.providers[provider];
@@ -243,6 +260,16 @@ export function createPtySpawner(options = {}) {
243
260
  const spawnTarget = command.executionMode === 'direct'
244
261
  ? resolveDirectSpawnTarget(command.file, command.args, env, platform, shell, execFileSyncFn)
245
262
  : { file: command.file, args: command.args, commandFound: true };
263
+ console.log('[term-speak] spawn debug:', {
264
+ executionMode: command.executionMode,
265
+ file: spawnTarget.file,
266
+ args: spawnTarget.args,
267
+ commandFound: spawnTarget.commandFound,
268
+ cwd,
269
+ shell,
270
+ platform,
271
+ envPath: getEnvValue(env, 'PATH', platform)?.split(platform === 'win32' ? ';' : ':').slice(0, 5),
272
+ });
246
273
  try {
247
274
  return spawn(spawnTarget.file, spawnTarget.args, {
248
275
  name: 'xterm-256color',
@@ -253,6 +280,11 @@ export function createPtySpawner(options = {}) {
253
280
  });
254
281
  }
255
282
  catch (error) {
283
+ console.error('[term-speak] spawn error:', {
284
+ errorMessage: error instanceof Error ? error.message : String(error),
285
+ errorCode: error && typeof error === 'object' && 'code' in error ? error.code : undefined,
286
+ errorStack: error instanceof Error ? error.stack : undefined,
287
+ });
256
288
  throw formatSpawnError(entry, error, spawnTarget.commandFound);
257
289
  }
258
290
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptmic",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Voice-first local UI for terminal-based AI coding assistants.",
5
5
  "license": "MIT",
6
6
  "keywords": [