Add Devin CLI as a selectable agent backend in plan2code-loop

Upstream replaced GitHub Copilot CLI with Devin; Plan2Code keeps both, so
Claude Code, Copilot CLI and Devin are all selectable and existing Copilot
selections keep working.

AI Assisted
This commit is contained in:
2026-08-08 12:39:28 -07:00
parent 09aa565559
commit 161e424632
6 changed files with 232 additions and 144 deletions
+4 -2
View File
@@ -109,6 +109,7 @@ The scratchpad is managed by the LLM itself - after each task, the AI appends no
|-------|--------| |-------|--------|
| Claude Code | Supported | | Claude Code | Supported |
| GitHub Copilot CLI | Supported | | GitHub Copilot CLI | Supported |
| Devin CLI | Supported |
The loop uses your configured default model for each agent. The loop uses your configured default model for each agent.
@@ -119,7 +120,7 @@ $ plan2code-loop
╭──────────────────────────────────────╮ ╭──────────────────────────────────────╮
│ │ │ │
│ 🔮 Plany's Loop │ │ 🔮 Planny's Loop
│ Autonomous Implementation │ │ Autonomous Implementation │
│ │ │ │
╰──────────────────────────────────────╯ ╰──────────────────────────────────────╯
@@ -196,7 +197,8 @@ src/
├── cli.ts # Interactive prompts ├── cli.ts # Interactive prompts
├── agents/ # Agent implementations ├── agents/ # Agent implementations
│ ├── claude-code.ts │ ├── claude-code.ts
── copilot-cli.ts ── copilot-cli.ts
│ └── devin-cli.ts
├── prompt/ # Prompt building ├── prompt/ # Prompt building
│ ├── templates.ts │ ├── templates.ts
│ └── builder.ts │ └── builder.ts
+1
View File
@@ -20,6 +20,7 @@
"automation", "automation",
"claude", "claude",
"copilot", "copilot",
"devin",
"spec-driven" "spec-driven"
], ],
"license": "MIT", "license": "MIT",
+81
View File
@@ -0,0 +1,81 @@
import type { Agent, AgentConfig, AgentExecutionOptions, AgentExecutionResult } from './types.js';
import { executeCommand } from '../utils/process.js';
import { writeFileSync, unlinkSync } from 'fs';
import { join } from 'path';
import { tmpdir } from 'os';
const devinCliConfig: AgentConfig = {
name: 'devin-cli',
displayName: 'Devin CLI',
command: 'devin',
models: [
{ value: 'default', label: 'Default (use Devin config)' },
],
defaultModel: 'default',
flags: {
prompt: '--print',
promptFile: '--prompt-file',
model: '--model',
skipPermissions: '--permission-mode',
},
};
class DevinCliAgent implements Agent {
readonly config = devinCliConfig;
async execute(options: AgentExecutionOptions): Promise<AgentExecutionResult> {
// Devin CLI takes the prompt via --prompt-file rather than stdin
const tempFile = join(tmpdir(), `plan2code-prompt-${Date.now()}.txt`);
writeFileSync(tempFile, options.prompt, 'utf-8');
try {
const args: string[] = [
this.config.flags.prompt, // --print for non-interactive mode
this.config.flags.promptFile!, tempFile, // --prompt-file <path>
this.config.flags.skipPermissions, 'dangerous', // --permission-mode dangerous (auto-approve all tools)
];
// Only add --model if not using default
if (options.model && options.model !== 'default') {
args.push(this.config.flags.model, options.model);
}
const result = await executeCommand({
command: this.config.command,
args,
cwd: options.cwd,
timeout: options.timeout,
signal: options.signal,
});
return {
stdout: result.stdout,
stderr: result.stderr,
exitCode: result.exitCode,
timedOut: result.timedOut,
cancelled: result.cancelled,
duration: result.duration,
};
} finally {
// Clean up temp file
try {
unlinkSync(tempFile);
} catch {
// Ignore cleanup errors
}
}
}
async isAvailable(): Promise<boolean> {
// Run devin --version to verify it's actually installed and working
const result = await executeCommand({
command: this.config.command,
args: ['--version'],
cwd: process.cwd(),
timeout: 5000,
});
return result.exitCode === 0;
}
}
export const devinCliAgent = new DevinCliAgent();
+3
View File
@@ -9,11 +9,14 @@ export type {
export { agentRegistry } from './registry.js'; export { agentRegistry } from './registry.js';
export { claudeCodeAgent } from './claude-code.js'; export { claudeCodeAgent } from './claude-code.js';
export { copilotCliAgent } from './copilot-cli.js'; export { copilotCliAgent } from './copilot-cli.js';
export { devinCliAgent } from './devin-cli.js';
// Register all agents // Register all agents
import { agentRegistry } from './registry.js'; import { agentRegistry } from './registry.js';
import { claudeCodeAgent } from './claude-code.js'; import { claudeCodeAgent } from './claude-code.js';
import { copilotCliAgent } from './copilot-cli.js'; import { copilotCliAgent } from './copilot-cli.js';
import { devinCliAgent } from './devin-cli.js';
agentRegistry.register(claudeCodeAgent); agentRegistry.register(claudeCodeAgent);
agentRegistry.register(copilotCliAgent); agentRegistry.register(copilotCliAgent);
agentRegistry.register(devinCliAgent);
+1
View File
@@ -14,6 +14,7 @@ export interface AgentConfig {
model: string; model: string;
skipPermissions: string; skipPermissions: string;
silent?: string; silent?: string;
promptFile?: string;
}; };
} }
+1 -1
View File
@@ -1,7 +1,7 @@
export type LoopMode = 'task' | 'phase'; export type LoopMode = 'task' | 'phase';
export interface SessionConfig { export interface SessionConfig {
agent: string; // "claude-code" | "copilot-cli" agent: string; // "claude-code" | "copilot-cli" | "devin-cli"
model: string; // Selected model model: string; // Selected model
maxIterations: number; // 5-50 maxIterations: number; // 5-50
timeout: number; // Base timeout in minutes per iteration attempt timeout: number; // Base timeout in minutes per iteration attempt