forked from claude-code-best/claude-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresolveDefaultShell.ts
More file actions
25 lines (24 loc) · 907 Bytes
/
Copy pathresolveDefaultShell.ts
File metadata and controls
25 lines (24 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { getInitialSettings } from '../settings/settings.js'
import { getPlatform } from '../platform.js'
import { isPowerShellToolEnabled } from './shellToolUtils.js'
/**
* Resolve the default shell for input-box `!` commands and agent preference.
*
* Resolution order:
* 1. settings.defaultShell (explicit user/project setting)
* 2. Windows + PowerShell tool enabled → 'powershell'
* 3. otherwise → 'bash'
*
* Opt out of the Windows PowerShell default via settings.defaultShell=bash
* or CLAUDE_CODE_USE_POWERSHELL_TOOL=0 (disables the PowerShell tool entirely).
*/
export function resolveDefaultShell(): 'bash' | 'powershell' {
const configured = getInitialSettings().defaultShell
if (configured === 'bash' || configured === 'powershell') {
return configured
}
if (getPlatform() === 'windows' && isPowerShellToolEnabled()) {
return 'powershell'
}
return 'bash'
}