@thegitai/cli 1.0.0-preview.22 → 1.0.0-preview.23

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.
@@ -1,6 +1,6 @@
1
1
  import chalk from './colors.js';
2
2
  import { spawn } from 'child_process';
3
- import { buildCommandEnv, commandUsesSudo, sanitizeCommandText, terminateChild, } from './executor.js';
3
+ import { buildCommandEnv, commandUsesSudo, resolveCommandShell, sanitizeCommandText, terminateChild, } from './executor.js';
4
4
  import { isTuiMode } from './runtime-mode.js';
5
5
  import { redactConnectionStringCredentials } from './secret-preview.js';
6
6
  const MAX_RUNNING_JOBS = 8;
@@ -196,7 +196,7 @@ export async function startBackgroundJob(command, cwd, { startupWaitMs, sessionI
196
196
  const id = `bg_${++jobCounter}`;
197
197
  const child = spawn(command, {
198
198
  cwd,
199
- shell: true,
199
+ shell: resolveCommandShell(),
200
200
  detached: process.platform !== 'win32',
201
201
  stdio: ['pipe', 'pipe', 'pipe'],
202
202
  env: buildCommandEnv(cwd),
@@ -1,6 +1,6 @@
1
1
  import chalk from './colors.js';
2
2
  import { execFileSync, spawn } from 'child_process';
3
- import { existsSync, statSync } from 'fs';
3
+ import { accessSync, constants as fsConstants, existsSync, statSync } from 'fs';
4
4
  import { createRequire } from 'node:module';
5
5
  import os from 'os';
6
6
  import path from 'path';
@@ -637,6 +637,28 @@ export function buildCommandEnv(cwd) {
637
637
  THEGITAI_SCRATCH_DIR: ensureSessionScratchDir(),
638
638
  };
639
639
  }
640
+ let cachedCommandShell;
641
+ function findBashPath() {
642
+ const fromPath = (process.env.PATH ?? '')
643
+ .split(path.delimiter)
644
+ .filter(Boolean)
645
+ .map((dir) => path.join(dir, 'bash'));
646
+ for (const candidate of [...fromPath, '/bin/bash', '/usr/bin/bash']) {
647
+ try {
648
+ accessSync(candidate, fsConstants.X_OK);
649
+ return candidate;
650
+ }
651
+ catch { }
652
+ }
653
+ return null;
654
+ }
655
+ export function resolveCommandShell() {
656
+ if (cachedCommandShell !== undefined)
657
+ return cachedCommandShell;
658
+ cachedCommandShell =
659
+ process.platform === 'win32' ? true : (findBashPath() ?? true);
660
+ return cachedCommandShell;
661
+ }
640
662
  function sanitizePtyOutput(command, output, cwd, secrets) {
641
663
  return sanitizeCommandText(command, stripSudoPromptText(redactSecrets(output, secrets)), cwd);
642
664
  }
@@ -822,7 +844,7 @@ export async function runCommand(command, cwd, { requestSudoPassword, timeout, }
822
844
  let killTimer = null;
823
845
  const child = spawn(command, {
824
846
  cwd,
825
- shell: true,
847
+ shell: resolveCommandShell(),
826
848
  detached: process.platform !== 'win32',
827
849
  stdio: ['pipe', 'pipe', 'pipe'],
828
850
  env: buildCommandEnv(cwd),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thegitai/cli",
3
- "version": "1.0.0-preview.22",
3
+ "version": "1.0.0-preview.23",
4
4
  "description": "TheGitAI is an AI coding agent for your terminal. It indexes your repository, writes and edits files, runs commands, and builds features with you.",
5
5
  "keywords": [
6
6
  "ai",
@@ -37,10 +37,10 @@
37
37
  "@lydell/node-pty-linux-x64": "1.1.0",
38
38
  "@lydell/node-pty-win32-arm64": "1.1.0",
39
39
  "@lydell/node-pty-win32-x64": "1.1.0",
40
- "@thegitai/tui-darwin-arm64": "1.0.0-preview.22",
41
- "@thegitai/tui-darwin-x64": "1.0.0-preview.22",
42
- "@thegitai/tui-linux-x64": "1.0.0-preview.22",
43
- "@thegitai/tui-win32-x64": "1.0.0-preview.22",
40
+ "@thegitai/tui-darwin-arm64": "1.0.0-preview.23",
41
+ "@thegitai/tui-darwin-x64": "1.0.0-preview.23",
42
+ "@thegitai/tui-linux-x64": "1.0.0-preview.23",
43
+ "@thegitai/tui-win32-x64": "1.0.0-preview.23",
44
44
  "@vscode/ripgrep": "1.18.0"
45
45
  },
46
46
  "publishConfig": {