# Windows Setup

## Install and run

Install Node.js 22.19.0 or newer, then run this in PowerShell or Command Prompt:

```powershell
npm install -g @selesai/code
sai
```

npm installs both `sai` and `selesai`, including `.cmd` launchers for Command Prompt and `.ps1` launchers for PowerShell. Both commands use the same options, settings, and sessions; no manual alias is required.

```powershell
sai -c
sai -p "Review this diff"
selesai --version
sai --version
```

The alias is available after installing a version containing it. To try a source checkout before publication, run `npm install -g .` from the repository root.

If PowerShell blocks `sai.ps1` because of its execution policy, use `sai.cmd` instead. This does not require changing your execution policy.

If the command is not found, ensure the global npm prefix (shown by `npm prefix -g`, normally `%APPDATA%\npm`) is on your user `PATH`, then reopen your terminal.

## Bash shell

Selesai requires a bash shell for its bash tool on Windows. Checked locations (in order):

1. Custom path from `~/.selesai/agent/settings.json`
2. Git Bash at `%ProgramFiles%\Git\bin\bash.exe`
3. Git Bash at `%ProgramFiles(x86)%\Git\bin\bash.exe`
4. `bash.exe` on PATH (Cygwin, MSYS2, WSL)

For most users, [Git for Windows](https://git-scm.com/download/win) is sufficient.

If Selesai cannot find Bash, it reports the locations it checked.

## PowerShell

The `powershell` tool finds its shell in this order:

1. `pwsh.exe` on PATH
2. `%ProgramFiles%\PowerShell\7\pwsh.exe`
3. `powershell.exe` on PATH
4. `%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe`

### Custom shell path

```json
{
  "shellPath": "C:\\cygwin64\\bin\\bash.exe"
}
```
