Summary
resolveScriptInterpreter in src/cron/exec-script.ts maps file extensions to interpreter binaries, but Windows-native script formats (.cmd, .bat, .ps1) are not covered. On Windows, these require explicit interpreters — cmd.exe /C for .cmd/.bat and powershell.exe -NoProfile -ExecutionPolicy Bypass -File for .ps1.
Problem
A user on Windows who creates a cron script job with a .bat, .cmd, or .ps1 command path gets a spawn error or ENOENT because the function returns null (direct execution), which requires the executable bit — a concept that doesn't exist on Windows. The script will not run.
Acceptance Criteria
Implementation Plan
- In
resolveScriptInterpreter, add a platform guard (process.platform === "win32") for Windows-specific cases:
.cmd, .bat → ["cmd.exe", "/C"] (interpreter + leading args)
.ps1 → ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File"]
- The return type needs to change from
string | null to { cmd: string; leadingArgs?: string[] } | null (or similar) so the caller can prepend interpreter args before the script path.
- Update the
execCmd/execArgs construction in execCronScript to handle the new shape.
- Add platform-conditional test cases.
Files Affected
src/cron/exec-script.ts — resolveScriptInterpreter + call site
src/cron/exec-script.test.ts — new test cases with platform guard
Notes
cmd /C <path> runs a .bat/.cmd script and exits after completion — correct semantics for cron.
- PowerShell's
-ExecutionPolicy Bypass is needed because the default policy blocks unsigned scripts; consistent with the OC Windows smoke harness pattern (CLAUDE.md).
- Cross-platform scripts (
.js, .py, etc.) already work on Windows via the existing mappings since node and python3 are in PATH when properly installed.
Summary
resolveScriptInterpreterinsrc/cron/exec-script.tsmaps file extensions to interpreter binaries, but Windows-native script formats (.cmd,.bat,.ps1) are not covered. On Windows, these require explicit interpreters —cmd.exe /Cfor.cmd/.batandpowershell.exe -NoProfile -ExecutionPolicy Bypass -Filefor.ps1.Problem
A user on Windows who creates a cron script job with a
.bat,.cmd, or.ps1command path gets a spawn error or ENOENT because the function returnsnull(direct execution), which requires the executable bit — a concept that doesn't exist on Windows. The script will not run.Acceptance Criteria
.cmdand.batextensions map tocmd.exewith/Cflag (or equivalent) on Windows.ps1extension maps topowershell.exewith-NoProfile -ExecutionPolicy Bypass -Fileon Windowsnull(not applicable; user gets a clear error if they try).sh,.bash,.zsh,.js,.py, etc.) are unaffectedprocess.platformmocking or platform guard)pnpm build && pnpm check && pnpm test -- src/cron/exec-script.test.tspassesImplementation Plan
resolveScriptInterpreter, add a platform guard (process.platform === "win32") for Windows-specific cases:.cmd,.bat→["cmd.exe", "/C"](interpreter + leading args).ps1→["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File"]string | nullto{ cmd: string; leadingArgs?: string[] } | null(or similar) so the caller can prepend interpreter args before the script path.execCmd/execArgsconstruction inexecCronScriptto handle the new shape.Files Affected
src/cron/exec-script.ts—resolveScriptInterpreter+ call sitesrc/cron/exec-script.test.ts— new test cases with platform guardNotes
cmd /C <path>runs a.bat/.cmdscript and exits after completion — correct semantics for cron.-ExecutionPolicy Bypassis needed because the default policy blocks unsigned scripts; consistent with the OC Windows smoke harness pattern (CLAUDE.md)..js,.py, etc.) already work on Windows via the existing mappings sincenodeandpython3are in PATH when properly installed.