Repository navigation
fix(worktrees): stop silently switching existing Windows setup scripts to Git Bash - #12406
Conversation
…s to Git Bash #6967 derived the Windows setup-runner shell from `terminalWindowsShell`. On upgrade, any Windows user whose terminal preference resolved to Git Bash had their existing `orca.yaml` setup script (and issue command) handed to bash instead of cmd.exe. Scripts authored against the cmd runner — `copy`, `xcopy`, `set VAR=value`, `if errorlevel 1`, `%VAR%`, backslash paths — broke with no migration and no warning, and the failure looked like Orca broke the project. The conflation is also wrong in the steady state: a terminal preference is per-user, so two people on the same repo got different interpreters for the same orca.yaml and no project could write a setup script that worked for all of its Windows contributors. The interpreter is now a property of the script, declared the standard way: a leading `#!` line. Native Windows keeps the historical `.cmd` runner unless the script declares a POSIX shell, so no existing script changes behavior. `resolveSetupRunnerShell` keeps its role as the feasibility gate — a bash runner still requires the terminal to resolve to Git Bash, since the launch command is typed into that shell and uses MSYS `/c/...` paths. `buildWindowsRunnerScript` now drops a leading `#!` line rather than `call`ing it, so a declared-bash script that falls back to cmd (Git Bash missing) fails on a real setup line instead of aborting on errorlevel at line one. WSL worktrees, POSIX platforms, and SSH hosts are untouched.
📝 WalkthroughWalkthroughAdded shebang parsing for setup scripts, including POSIX shell detection, option replay, and leading-shebang removal. Native Windows runner selection now uses script shebangs independently from terminal shell settings. POSIX scripts receive POSIX runners, while batch runners reject POSIX scripts. Git Bash launches Windows batch runners through encoded PowerShell commands. Tests cover runner generation, command resolution, completion signaling, and shell metadata. Documentation describes Windows setup-shell behavior. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…pane Adversarial review of this PR found that pinning the runner format per script reopened issue #6896 one layer down. - `WorktreeSetupLaunch.shell` had been redefined to mean "the format the runner file was written in". `resolveSetupRunnerCommand` consumes it as "the shell that types the launch command", so a Git Bash terminal with a batch setup script produced `cmd.exe /c "C:\...\setup-runner.cmd"` typed into a bash pane, where MSYS rewrites the `/c` switch into a drive path: cmd opens interactively and setup never runs. `shell` is the terminal's family again; the runner file's .cmd/.sh extension carries the format, and a batch runner launched from a POSIX pane reuses the existing PowerShell ProcessStartInfo launcher. - The cmd runner dropped a leading `#!` line and ran the rest as batch, so a bash script reaching cmd (PowerShell/cmd terminal, or any SSH-to-Windows host) got its interpreter-agnostic prefix executed before failing mid-way. It now prints why and exits 1 without running anything. - A `#!` line's option flags were discarded: `#!/usr/bin/env -S bash -euo pipefail` lost pipefail because the runner is launched as `bash <path>`. The generated posix runner now replays declared flags via `set` and drops the duplicate interpreter line. - Docs cover the per-user setup command in repository hook settings, which goes through the same `#!` rule, and describe what the `#!` line does and does not select. Tests: composed launch command for a POSIX pane + cmd runner (hooks, shared runner command, setup sequencing gate, observed-setup signal), the cmd runner's shebang refusal, and shebang flag replay. Each fails with the source reverted.
|
Adversarial review found the fix was correct at the runner-generation layer but reopened issue #6896 at the launch layer. Addressed: #1 (blocking) — #2 (should-fix) — untested composition. Added coverage for the newly-possible "posix pane + cmd runner" combination at every layer that builds a launch string: #3 (should-fix) — declared shebang only used as a boolean. #4 (should-fix) — partial execution of a bash body under cmd. Dropping the #5 (nit) — partial. Verification. Every new/updated test was proven to fail with only the source reverted ( |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9eee8f93-fa1f-4a17-abd7-ce58a6c04a8e
📒 Files selected for processing (12)
.gitignoreAGENTS.mddocs/reference/windows-setup-shell.mdsrc/main/hooks-runner.test.tssrc/main/hooks.test.tssrc/main/hooks.tssrc/main/runtime/orchestration/setup-completion-signal.test.tssrc/shared/setup-agent-sequencing.test.tssrc/shared/setup-runner-command.test.tssrc/shared/setup-runner-command.tssrc/shared/setup-script-shebang.test.tssrc/shared/setup-script-shebang.ts
| function parseShellOptions(tokens: string[]): string[] { | ||
| const options: string[] = [] | ||
| for (let index = 0; index < tokens.length; index++) { | ||
| const token = tokens[index] | ||
| if (!SHELL_OPTION_FLAG_PATTERN.test(token)) { | ||
| continue | ||
| } | ||
| options.push(token) | ||
| // Why: `-o`/`-euo` take the option name as a separate argument (`pipefail`). | ||
| const optionName = tokens[index + 1] | ||
| if (token.endsWith('o') && optionName && SHELL_OPTION_NAME_PATTERN.test(optionName)) { | ||
| options.push(optionName) | ||
| index++ | ||
| } | ||
| } | ||
| return options |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
bash -O extglob -c 'shopt -q extglob'
if bash -c 'set -O' >/dev/null 2>&1; then
echo 'Expected bash to reject set -O' >&2
exit 1
fiRepository: stablyai/orca
Length of output: 151
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Bash version:\n'
bash --version | head -1
printf '\nPattern and function definitions:\n'
rg -n "SHELL_OPTION_FLAG_PATTERN|SHELL_OPTION_NAME_PATTERN|function parseShellOptions|escapeShellOptions|parseSetupScriptShebang" src/shared/setup-script-shebang.ts src/main/hooks.ts src/shared/setup-script-shebang.test.ts
printf '\nsetup-script-shebang.ts relevant lines:\n'
cat -n src/shared/setup-script-shebang.ts | sed -n '1,120p'
printf '\nhooks.ts relevant lines:\n'
cat -n src/main/hooks.ts | sed -n '470,510p'
printf '\ntest relevant lines:\n'
cat -n src/shared/setup-script-shebang.test.ts | sed -n '1,90p'
printf '\nBehavior probe with shell-parsed patterns (no repo code execution):\n'
python3 - <<'PY'
import re, subprocess, textwrap
src=open('src/shared/setup-script-shebang.ts','r').read()
m=re.search(r"const\s+([A-Z_]+_PATTERN)=/([^/]+)/;|\n\\s*function\s+parseShellOptions\\s*\\(",src)
print('found patterns/functions:', [x.group(1) for x in re.finditer(r"const\s+([A-Z_]+_PATTERN)=/([^/]+)/;/\n",src)])
# Extract function via first line after assignment? Use exact line numbers for robustness by reading file.
PY
python3 - <<'PY'
import re
src=open('src/shared/setup-script-shebang.ts','r').read()
lines=src.splitlines()
for i,l in enumerate(lines,1):
if re.search(r"const\s+([A-Z_]+_PATTERN)=/",l):
print(i,l)
PYRepository: stablyai/orca
Length of output: 13050
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Bash version:\n'
bash --version | head -1
printf '\nPattern and function definitions:\n'
rg -n "SHELL_OPTION_FLAG_PATTERN|SHELL_OPTION_NAME_PATTERN|function parseShellOptions|escapeShellOptions|parseSetupScriptShebang" src/shared/setup-script-shebang.ts src/main/hooks.ts src/shared/setup-script-shebang.test.ts
printf '\nsetup-script-shebang.ts relevant lines:\n'
cat -n src/shared/setup-script-shebang.ts | sed -n '1,120p'
printf '\nhooks.ts relevant lines:\n'
cat -n src/main/hooks.ts | sed -n '470,510p'
printf '\ntest relevant lines:\n'
cat -n src/shared/setup-script-shebang.test.ts | sed -n '1,90p'
printf '\nBehavior probe with shell-parsed patterns (no repo code execution):\n'
python3 - <<'PY'
import re
src=open('src/shared/setup-script-shebang.ts','r').read()
lines=src.splitlines()
for i,l in enumerate(lines,1):
if re.search(r"const\s+([A-Z_]+_PATTERN)=/",l):
print(i,l)
PYRepository: stablyai/orca
Length of output: 12227
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'shellOptions for -O extglob:\n'
node --input-type=module <<'JS'
const SHELL_OPTION_FLAG_PATTERN = /^[-+][a-zA-Z]+$/
const SHELL_OPTION_NAME_PATTERN = /^[a-z_]+$/
function parseSetupScriptShebang(script) {
const firstLine = script.split('\n', 1)[0] ?? ''
if (!firstLine.trimStart().startsWith('#!')) {
return null
}
const tokens = firstLine.trim().slice(2).trim().split(/\s+/).filter(Boolean)
const interpreterIndex = findInterpreterIndex(tokens)
if (interpreterIndex === -1) {
return null
}
return {
interpreter: executableBasename(tokens[interpreterIndex]),
shellOptions: parseShellOptions(tokens.slice(interpreterIndex + 1))
}
}
function findInterpreterIndex(tokens) {
for (let index = 0; index < tokens.length; index++) {
const basename = executableBasename(tokens[index])
if (basename === '' || basename === 'env' || basename.startsWith('-')) {
continue
}
return index
}
return -1
}
function parseShellOptions(tokens) {
const options = []
for (let index = 0; index < tokens.length; index++) {
const token = tokens[index]
if (!SHELL_OPTION_FLAG_PATTERN.test(token)) {
continue
}
options.push(token)
const optionName = tokens[index + 1]
if (token.endsWith('o') && optionName && SHELL_OPTION_NAME_PATTERN.test(optionName)) {
options.push(optionName)
index++
}
}
return options
}
function executableBasename(token) {
return (
token
.replaceAll('\\', '/')
.split('/')
.pop()
?.toLowerCase()
.replace(/\.exe$/, '') ?? ''
)
}
for (const script of [
'#!/bin/bash -O extglob\nmake',
'#!/usr/bin/env -S bash -O extglob\nmake',
'#!/bin/bash -O extglob -e -x\nmake',
]) {
console.log(script.replace('\n', '\\n'))
console.log(parseSetupScriptShebang(script))
}
JS
printf '\nRunner emitted for -O extglob:\n'
node --input-type=module <<'JS'
const SHELL_OPTION_FLAG_PATTERN = /^[-+][a-zA-Z]+$/
const SHELL_OPTION_NAME_PATTERN = /^[a-z_]+$/
function parseSetupScriptShebang(script) {
const firstLine = script.split('\n', 1)[0] ?? ''
if (!firstLine.trimStart().startsWith('#!')) {
return null
}
const tokens = firstLine.trim().slice(2).trim().split(/\s+/).filter(Boolean)
const interpreterIndex = findInterpreterIndex(tokens)
if (interpreterIndex === -1) {
return null
}
return {
interpreter: executableBasename(tokens[interpreterIndex]),
shellOptions: parseShellOptions(tokens.slice(interpreterIndex + 1))
}
}
function findInterpreterIndex(tokens) {
for (let index = 0; index < tokens.length; index++) {
const basename = executableBasename(tokens[index])
if (basename === '' || basename === 'env' || basename.startsWith('-')) {
continue
}
return index
}
return -1
}
function parseShellOptions(tokens) {
const options = []
for (let index = 0; index < tokens.length; index++) {
const token = tokens[index]
if (!SHELL_OPTION_FLAG_PATTERN.test(token)) {
continue
}
options.push(token)
const optionName = tokens[index + 1]
if (token.endsWith('o') && optionName && SHELL_OPTION_NAME_PATTERN.test(optionName)) {
options.push(optionName)
index++
}
}
return options
}
function executableBasename(token) {
return (
token
.replaceAll('\\', '/')
.split('/')
.pop()
?.toLowerCase()
.replace(/\.exe$/, '') ?? ''
)
}
const script = '#!/bin/bash -O O pipefail -e\nmake'
const shebang = parseSetupScriptShebang(script)
const declaredOptions = shebang?.shellOptions.length ? `set ${shebang.shellOptions.join(' ')}\n` : ''
const body = shebang ? script.slice(script.indexOf('\n') + 1) : script
console.log(`#!/usr/bin/env bash\nset -e\n${declaredOptions}${body}\n`)
JSRepository: stablyai/orca
Length of output: 515
Do not replay Bash -O startup options through set.
#!/bin/bash -O extglob is valid Bash syntax. parseShellOptions() keeps -O, drops extglob, and buildPosixRunnerScript() emits set -O; Bash rejects set -O, so setup fails before the script body runs.
src/shared/setup-script-shebang.ts#L67-L82: Parse Bash-O <shopt>separately from flags thatsetsupports.src/main/hooks.ts#L493-L498: Replay-O <shopt>withshopt -s <shopt>, notset.src/shared/setup-script-shebang.test.ts: Add coverage for#!/usr/bin/env -S bash -O extglob.
📍 Affects 3 files
src/shared/setup-script-shebang.ts#L67-L82(this comment)src/main/hooks.ts#L493-L498src/shared/setup-script-shebang.test.ts#L38-L65
… pane's shell Two round-2 review findings: - `#!/bin/bash -l` replayed `set -l`, which exits 2 and aborted the runner under its own `set -e` before a single setup line ran (all platforms). Only the flags `set` documents are replayed now; a bare `-o` with no option name is dropped instead of dumping the shell-option table. - The wait-for-setup gate picked its language from the runner file, so a batch runner launched from a Git Bash pane got the PowerShell gate while the agent startup command was already POSIX-quoted — `Invoke-Expression` cannot parse `'\''`. The gate now follows the pane; the runner still launches through the ProcessStartInfo launcher, never through bash.
|
Round-2 findings addressed in def7374. #1 — #2 — sequencing gate language followed the runner file, not the pane (should-fix, confirmed). Reproduced: git-bash pane → No new timeouts, retries, or async paths. The Verification: touched-area vitest (10 files, 229 passed / 1 skipped), |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3a10d0db-f284-41e8-8f4a-411140a6c48d
📒 Files selected for processing (6)
docs/reference/windows-setup-shell.mdsrc/main/hooks-runner.test.tssrc/shared/setup-agent-sequencing.test.tssrc/shared/setup-agent-sequencing.tssrc/shared/setup-script-shebang.test.tssrc/shared/setup-script-shebang.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- docs/reference/windows-setup-shell.md
- src/shared/setup-script-shebang.ts
| expect(result.setupCommand).toContain( | ||
| 'powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -EncodedCommand' | ||
| ) | ||
| expect(result.setupCommand).not.toMatch(/bash\s+\S*setup-runner/) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the Bash-rejection assertion cover option-bearing invocations.
Line 236 only matches bash followed by a single token containing setup-runner. It misses a direct invocation such as bash -lc "C:\repo\.git\orca\setup-runner.cmd", so the test can pass while Bash still receives the batch runner. Assert that the raw runner path is absent from the generated command, or verify that the decoded PowerShell payload is the only runner invocation.
🧰 Tools
🪛 ast-grep (0.45.0)
[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: import { spawn } from 'node:child_process'
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
(detect-child-process-typescript)
| // Why: the gate is typed into the terminal pane and `startupCommand` is already quoted for that | ||
| // pane, so a batch runner launched from a Git Bash pane still needs the bash gate — PowerShell's | ||
| // `Invoke-Expression` cannot parse the POSIX `'\''` escaping the pane's quoting produces. The | ||
| // runner itself still launches through `resolution.command`, never through bash. | ||
| const posixGateForWindowsRunner = resolution.shell === 'windows' && args.shell?.family === 'posix' | ||
| const markerBasePath = posixGateForWindowsRunner | ||
| ? nativeWindowsPathToPosixShellPath(resolution.runnerScriptPathForShell) | ||
| : resolution.runnerScriptPathForShell | ||
| // Why: overlapping gated launches of the same setup runner must not race on | ||
| // a shared completion marker. | ||
| const markerPath = `${resolution.runnerScriptPathForShell}.${nonce}.done` | ||
| const markerPath = `${markerBasePath}.${nonce}.done` | ||
| const waitTimeoutSeconds = args.waitTimeoutSeconds ?? DEFAULT_WAIT_TIMEOUT_SECONDS | ||
|
|
||
| if (resolution.shell === 'windows') { | ||
| if (resolution.shell === 'windows' && !posixGateForWindowsRunner) { |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Preserve WSL marker-path handling.
Line 49 treats every POSIX pane as Git Bash. nativeWindowsPathToPosixShellPath converts C:\repo\... to /c/repo/..., but WSL uses its configured Windows-drive mount path, commonly /mnt/c.
When a .cmd runner launches from wsl.exe, the POSIX gate can write or poll a different marker path. The agent then waits until timeout. Apply the /c conversion only for the MSYS/Git Bash environment. Resolve the marker path through WSL for wsl.exe, and add coverage for a Windows .cmd runner from WSL.
As per coding guidelines, keep platform-dependent behavior behind runtime checks for macOS, Linux, and Windows.
Source: Coding guidelines
…s to Git Bash (stablyai#12406) * fix(worktrees): stop silently switching existing Windows setup scripts to Git Bash stablyai#6967 derived the Windows setup-runner shell from `terminalWindowsShell`. On upgrade, any Windows user whose terminal preference resolved to Git Bash had their existing `orca.yaml` setup script (and issue command) handed to bash instead of cmd.exe. Scripts authored against the cmd runner — `copy`, `xcopy`, `set VAR=value`, `if errorlevel 1`, `%VAR%`, backslash paths — broke with no migration and no warning, and the failure looked like Orca broke the project. The conflation is also wrong in the steady state: a terminal preference is per-user, so two people on the same repo got different interpreters for the same orca.yaml and no project could write a setup script that worked for all of its Windows contributors. The interpreter is now a property of the script, declared the standard way: a leading `#!` line. Native Windows keeps the historical `.cmd` runner unless the script declares a POSIX shell, so no existing script changes behavior. `resolveSetupRunnerShell` keeps its role as the feasibility gate — a bash runner still requires the terminal to resolve to Git Bash, since the launch command is typed into that shell and uses MSYS `/c/...` paths. `buildWindowsRunnerScript` now drops a leading `#!` line rather than `call`ing it, so a declared-bash script that falls back to cmd (Git Bash missing) fails on a real setup line instead of aborting on errorlevel at line one. WSL worktrees, POSIX platforms, and SSH hosts are untouched. * fix(worktrees): keep the cmd setup runner launchable from a Git Bash pane Adversarial review of this PR found that pinning the runner format per script reopened issue stablyai#6896 one layer down. - `WorktreeSetupLaunch.shell` had been redefined to mean "the format the runner file was written in". `resolveSetupRunnerCommand` consumes it as "the shell that types the launch command", so a Git Bash terminal with a batch setup script produced `cmd.exe /c "C:\...\setup-runner.cmd"` typed into a bash pane, where MSYS rewrites the `/c` switch into a drive path: cmd opens interactively and setup never runs. `shell` is the terminal's family again; the runner file's .cmd/.sh extension carries the format, and a batch runner launched from a POSIX pane reuses the existing PowerShell ProcessStartInfo launcher. - The cmd runner dropped a leading `#!` line and ran the rest as batch, so a bash script reaching cmd (PowerShell/cmd terminal, or any SSH-to-Windows host) got its interpreter-agnostic prefix executed before failing mid-way. It now prints why and exits 1 without running anything. - A `#!` line's option flags were discarded: `#!/usr/bin/env -S bash -euo pipefail` lost pipefail because the runner is launched as `bash <path>`. The generated posix runner now replays declared flags via `set` and drops the duplicate interpreter line. - Docs cover the per-user setup command in repository hook settings, which goes through the same `#!` rule, and describe what the `#!` line does and does not select. Tests: composed launch command for a POSIX pane + cmd runner (hooks, shared runner command, setup sequencing gate, observed-setup signal), the cmd runner's shebang refusal, and shebang flag replay. Each fails with the source reverted. * fix(worktrees): replay only real `set` flags and keep the gate in the pane's shell Two round-2 review findings: - `#!/bin/bash -l` replayed `set -l`, which exits 2 and aborted the runner under its own `set -e` before a single setup line ran (all platforms). Only the flags `set` documents are replayed now; a bare `-o` with no option name is dropped instead of dumping the shell-option table. - The wait-for-setup gate picked its language from the runner file, so a batch runner launched from a Git Bash pane got the PowerShell gate while the agent startup command was already POSIX-quoted — `Invoke-Expression` cannot parse `'\''`. The gate now follows the pane; the runner still launches through the ProcessStartInfo launcher, never through bash. --------- Co-authored-by: OrcaWin <[email protected]>
Defect
resolveSetupRunnerShell(src/main/hooks.ts) derives the native-Windows setup-runner shell from theterminalWindowsShellterminal preference. When that preference resolves to Git Bash it returns{ family: 'posix' }, andcreateWorktreeRunnerScriptwrites the project's setup script to a.shfile launched withbash.That was applied retroactively to setup scripts that already existed. Before #6967 every native-Windows setup script ran under
cmd.exe, so every pre-existing Windows setup script is cmd-authored.Concrete failure scenario
A Windows user has
terminalWindowsShellset to Git Bash — a perfectly reasonable terminal preference — and anorca.yamlsetup hook written in batch:They upgrade. The same script is now handed to bash:
copyandxcopydo not exist,set NODE_ENV=testsets positional parameters instead of an env var,if errorlevel 1is a syntax error, andassets distbackslash paths get eaten by bash escaping. Setup breaks with no migration and no warning, and it looks like Orca broke their project.There is a second, steady-state half of the same defect: because the interpreter came from a per-user preference, two contributors on the same repo got different interpreters for the same
orca.yaml. No project could write a Windows setup script that worked for all of its contributors.The fix
The interpreter is a property of the script, not of the terminal the user likes, so the script declares it the standard way — a leading
#!line..cmdrunner unless the script's first line is a#!naming a POSIX shell. No existing script changes behavior on upgrade.resolveSetupRunnerShellkeeps its existing role as the feasibility gate: a bash runner still requires the configured terminal to resolve to Git Bash, because the launch command is typed into that shell and the runner uses MSYS/c/...paths that Cygwin and the WSL shim reject. Its return value now means "a bash runner could launch here", and the per-script#!decides whether one is used.buildWindowsRunnerScriptdrops a leading#!line instead ofcalling it. A declared-bash script that falls back to cmd (Git Bash not installed) now fails on a real setup line rather than aborting on errorlevel at line one.src/shared/setup-script-shebang.tsparses the interpreter line:#!/usr/bin/env bash,#!/bin/sh -e,#!/usr/bin/env -S bash -euo pipefail, and Windowsbash.exepaths all count;node/python3and comment-only first lines do not.Issue-command runners go through the same code path and get the same rule, so an issue command authored for cmd is not flipped either.
Why this option
The alternatives were weighed:
pnpm install).#!line. Explicit, zero state, zero heuristics, standard, per-project, and identical for every contributor who checks the repo out. Chosen.Unchanged: WSL worktrees, macOS/Linux (always bash), and SSH hosts (runner format follows the remote path format, never local Windows preferences).
Verification
All tests use runtime platform overrides, so they run on any host.
New/changed tests:
src/shared/setup-script-shebang.test.ts— interpreter-line parsing, including CRLF,env -S, non-shell interpreters, and a non-first-line#!.src/main/hooks.test.ts— "keeps batch setup scripts on cmd.exe when the terminal is Git Bash" (the reported regression:{ family: 'posix' }+copy/xcopyscript still producessetup-runner.cmd), plus the issue-command equivalent, plus the existing POSIX-runner test updated to declare a shebang.src/main/hooks-runner.test.ts—buildWindowsRunnerScriptdrops a leading shebang instead ofcalling it.I reverted
src/main/hooks.ts(git stash push src/main/hooks.ts), confirmed all three new regression tests fail without the fix, then restored it (git stash pop) and confirmed they pass.