Skip to content

fix: detect the active Windows shell - #179

Open
huyua9 wants to merge 1 commit into
BuilderIO:mainfrom
huyua9:fix/windows-shell-detection
Open

fix: detect the active Windows shell#179
huyua9 wants to merge 1 commit into
BuilderIO:mainfrom
huyua9:fix/windows-shell-detection

Conversation

@huyua9

@huyua9 huyua9 commented Aug 30, 2026

Copy link
Copy Markdown

Problem

On Windows, ai-shell always reports PowerShell to the model even when it is launched from cmd, Git Bash, or an MSYS terminal. That can produce commands for the wrong shell.

What changed

  • Prefer SHELL when it identifies the active shell, including Windows paths and .exe names.
  • Recognize Git Bash/MSYS through MSYSTEM when SHELL is unavailable.
  • Fall back to ComSpec/COMSPEC and distinguish cmd from PowerShell.
  • Add regression checks for Git Bash, MSYS, cmd, and PowerShell cases.

Validation

  • ./node_modules/.bin/jiti tests/os-detect.test.ts
  • npm run typecheck
  • npx prettier --check src/helpers/os-detect.ts tests/os-detect.test.ts
  • npx eslint src/helpers/os-detect.ts tests/os-detect.test.ts
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants