@every-env/cli
Version:
Multi-agent orchestrator for AI-powered development workflows
91 lines (72 loc) • 2.4 kB
Markdown
This patch shows how to add timeout support to the research command following the same pattern as the plan command.
In your `cli.ts` file, find where the research command is defined and add the timeout option:
```typescript
program
.command('research [query...]')
.description('Research codebase or features')
// ... other options ...
.option('--timeout <ms>', 'Process timeout in milliseconds (default: 300000)', parseInt)
.action(async (query: string[], options) => {
await runResearchCommand(query, options);
});
```
In the `runResearchCommand` function, add the timeout to the agent configuration:
```typescript
async function runResearchCommand(args: string[], options: any) {
// ... existing code ...
const task = {
pattern: {
name: 'research',
description: 'Research codebase or feature',
agents: []
},
agent: {
id: 'research-agent',
command: claudeCommand,
promptFile: promptPath,
output: outputFile,
promptMode: 'stdin' as const,
workingDir: process.cwd(),
flags: [],
timeout: options.timeout // Add this line
},
variables: {
// ... your variables ...
},
outputPath: outputFile
};
// ... rest of the function ...
}
```
The timeout can also be set via environment variable `EVERY_ENV_TIMEOUT`:
```bash
export EVERY_ENV_TIMEOUT=600000
every-env research "your query"
```
```bash
every-env research "complex feature analysis" --timeout 600000
export EVERY_ENV_TIMEOUT=600000
every-env research "analyze authentication system"
{
"agents": [{
"id": "research-agent",
"timeout": 600000,
// ... other config ...
}]
}
```
The timeout is applied in this priority order:
1. CLI option (`--timeout`)
2. Agent config (`agent.timeout` in config.json)
3. Environment variable (`EVERY_ENV_TIMEOUT`)
4. Default (5 minutes / 300000ms)
The timeout infrastructure is already in place in the base agent class, so you just need to pass the timeout value through the agent configuration.