|
| 1 | +name = "env-detector" |
| 2 | +description = "One-shot environment probe. Detects OS, shell, WSL status, package managers, runtimes, and tool availability and writes environment.md. Run once at INIT before any other agent." |
| 3 | +sandbox_mode = "workspace-write" |
| 4 | + |
| 5 | +developer_instructions = ''' |
| 6 | +Probe the execution environment and write a complete |
| 7 | +`.codex/loops/<slug>/environment.md` using `.codex/templates/environment.md` |
| 8 | +as the template. Fill every section — do not leave placeholders. Adapt probe |
| 9 | +commands to what you discover as you go. You need `workspace-write` (not |
| 10 | +read-only) because this agent's whole job is to create that one file. |
| 11 | +
|
| 12 | +Detection steps (run the checks, then write the file): |
| 13 | +
|
| 14 | +1. **OS / kernel** |
| 15 | + - Try `uname -a` (present on Linux, macOS, WSL; absent on native Windows PowerShell). |
| 16 | + - If absent, run `pwsh -Command "[System.Environment]::OSVersion"`. |
| 17 | + - Check `/proc/version` for "Microsoft" → WSL. Run `wsl.exe --version` to |
| 18 | + distinguish WSL1 vs WSL2. |
| 19 | +
|
| 20 | +2. **Shell** |
| 21 | + - `echo $SHELL` (bash/zsh/fish on POSIX); `$env:ComSpec` + `$PSVersionTable` on Windows. |
| 22 | + - Note the shell Codex is actually invoking right now. |
| 23 | +
|
| 24 | +3. **Package managers** — test `which` / `Get-Command` for each: |
| 25 | + `npm`, `pnpm`, `yarn`, `bun`, `pip`, `pip3`, `uv`, `poetry`, `cargo`, `go`, |
| 26 | + `brew`, `winget`, `choco`, `scoop`, `apt`, `dnf`, `pacman`. |
| 27 | + Record name + version for each found. |
| 28 | +
|
| 29 | +4. **Language runtimes** — probe: `node -v`, `python3 --version`, `python --version`, |
| 30 | + `go version`, `rustc --version`, `java -version`, `ruby --version`, `php --version`. |
| 31 | + Record found ones only. |
| 32 | +
|
| 33 | +5. **Key tools** — `git --version`, `docker --version`, `podman --version`, |
| 34 | + `curl --version`, `jq --version`, `make --version`. Note absent ones. |
| 35 | +
|
| 36 | +6. **Path conventions** |
| 37 | + - Drive-letter paths (`C:\`) → native Windows. |
| 38 | + - `/mnt/c/` mounts → WSL. |
| 39 | + - `/home/` → Linux / macOS. |
| 40 | + - Record home directory and project root as absolute paths. |
| 41 | +
|
| 42 | +7. **Hook compatibility note** — state the shell invocation for hooks: |
| 43 | + - `bash` on Linux / macOS / WSL. |
| 44 | + - `pwsh -NonInteractive -File` on native Windows. |
| 45 | + - If bash is available via Git Bash on Windows, note the path. |
| 46 | + This is the value the orchestrator reads to adapt all hook commands. |
| 47 | +
|
| 48 | +Write the result to `.codex/loops/<slug>/environment.md` and return the path. |
| 49 | +''' |
0 commit comments