clawdie-ai/setup/agent-cli-check.ts
Clawdie AI 80d170a123 feat(harness): replace Codex controlplane runner with Aider+Pi (Sam & Claude)
The controlplane harness now uses Aider as the multi-agent orchestrator
instead of Codex. Aider launches via --message for non-interactive task
execution, with the same tmux glass-pane and log streaming as before.

Runtime changes:
- src/config.ts: ControlplaneRunner 'codex' -> 'aider', env vars renamed
- src/controlplane-codex-runner.ts -> controlplane-aider-runner.ts:
  CodexRunOptions -> AiderRunOptions, runCodexTask -> runAiderTask,
  adjusted CLI args for Aider (--message, --model)
- src/controlplane-heartbeat.ts: updated imports and branch logic
- setup/agent-cli-check.ts: pi and aider first, others optional
- setup/install.ts: added printAiderTip()
- scripts/glass.sh: right pane now launches aider instead of shell

Config:
- .env.example: CONTROLPLANE_CODEX_* -> CONTROLPLANE_AIDER_*

Docs:
- AGENTS.md: updated agent identity and CLI prerequisite
- README.md: Aider+Pi as primary driver
- doc/CONTROLPLANE-MESSAGE-CONTRACT.md: runner modes updated

Codex, Claude Code, and other CLIs remain installed and available
as optional tools. Only the harness default changed.

---
Build: pass | Tests: not run (Linux)
2026-04-12 08:26:20 +02:00

55 lines
1.6 KiB
TypeScript

/**
* setup/agent-cli-check.ts — Detect agent CLIs available on PATH.
*
* Clawdie's controlplane harness uses Aider+Pi as the primary driver.
* At least one agent CLI must be resolvable on PATH for onboarding to
* succeed. This mirrors the standard per-adapter command-resolvable
* pattern, but as a single fail-fast check at the top of `setup onboard`.
*
* No "hello probe" yet — `command -v` is enough.
*/
import { commandExists } from './platform.js';
export interface AgentCli {
name: string;
command: string;
present: boolean;
}
export const AGENT_CLIS: ReadonlyArray<{ name: string; command: string }> = [
{ name: 'pi', command: 'pi' },
{ name: 'aider', command: 'aider' },
{ name: 'claude', command: 'claude' },
{ name: 'codex', command: 'codex' },
{ name: 'gemini', command: 'gemini' },
];
export function detectAgentClis(): AgentCli[] {
return AGENT_CLIS.map(({ name, command }) => ({
name,
command,
present: commandExists(command),
}));
}
export class NoAgentCliError extends Error {
constructor() {
super(
[
'No agent CLI found on PATH.',
'Clawdie needs pi and aider for the Aider+Pi controlplane harness.',
'Install via the ISO bundle or: pkg install py311-aider_chat, npm install -g @mariozechner/pi-coding-agent.',
'Alternative CLIs (claude, codex, gemini) are also accepted.',
].join(' '),
);
this.name = 'NoAgentCliError';
}
}
export function requireAtLeastOneAgentCli(): AgentCli[] {
const clis = detectAgentClis();
if (!clis.some((c) => c.present)) {
throw new NoAgentCliError();
}
return clis;
}