Implements the `paseo agent ps` command for listing agents:
- Lists running agents by default
- `-a, --all` flag to include archived agents
- `--status <status>` filter by agent status
- `--cwd <path>` filter by working directory
- Supports all output formats (table, json, yaml, quiet)
- Graceful error handling when daemon not running
Output format:
AGENT ID NAME PROVIDER STATUS CWD CREATED
a1b2c3d 🎭 Test fixer claude running ~/dev/paseo 2 minutes ago
Phase 3 of CLI implementation (TDD checklist 3.1-3.5)
19 lines
619 B
TypeScript
19 lines
619 B
TypeScript
import { Command } from 'commander'
|
|
import { runPsCommand } from './ps.js'
|
|
import { withOutput } from '../../output/index.js'
|
|
|
|
export function createAgentCommand(): Command {
|
|
const agent = new Command('agent').description('Manage agents')
|
|
|
|
agent
|
|
.command('ps')
|
|
.description('List agents')
|
|
.option('-a, --all', 'include archived agents')
|
|
.option('--status <status>', 'filter by status (running, idle, error)')
|
|
.option('--cwd <path>', 'filter by working directory')
|
|
.option('--host <host>', 'Daemon host:port (default: localhost:6767)')
|
|
.action(withOutput(runPsCommand))
|
|
|
|
return agent
|
|
}
|