(args: string)
| 16 | | { type: 'usage' } |
| 17 | |
| 18 | export function parseAutonomyArgs(args: string): ParsedAutonomyCommand { |
| 19 | const [subcommand = 'status', arg1, arg2] = args.trim().split(/\s+/, 3) |
| 20 | |
| 21 | if (subcommand === '' || subcommand === 'status') { |
| 22 | return { type: 'status', deep: arg1 === '--deep' } |
| 23 | } |
| 24 | |
| 25 | if (subcommand === 'runs') { |
| 26 | return { type: 'runs', limit: arg1 } |
| 27 | } |
| 28 | |
| 29 | if (subcommand === 'flows') { |
| 30 | return { type: 'flows', limit: arg1 } |
| 31 | } |
| 32 | |
| 33 | if (subcommand === 'flow') { |
| 34 | if (arg1 === 'cancel') { |
| 35 | return arg2 ? { type: 'flow-cancel', flowId: arg2 } : { type: 'usage' } |
| 36 | } |
| 37 | if (arg1 === 'resume') { |
| 38 | return arg2 ? { type: 'flow-resume', flowId: arg2 } : { type: 'usage' } |
| 39 | } |
| 40 | return arg1 ? { type: 'flow-detail', flowId: arg1 } : { type: 'usage' } |
| 41 | } |
| 42 | |
| 43 | return { type: 'usage' } |
| 44 | } |
no outgoing calls
no test coverage detected