import { spawn } from 'node:child_process' const commands = { codex: ['codex'], 'claude-code': ['claude'], gemini: ['gemini'] } export function resolveAgentCommand(agent) { return commands[agent] ?? [agent] } export async function commandExists(command) { return new Promise((resolve) => { const child = spawn('which', [command], { stdio: 'ignore' }) child.on('close', (code) => resolve(code === 0)) child.on('error', () => resolve(false)) }) }