#!/usr/bin/env node

import { runOrchestrator } from '../orchestrator/orchestratorAgent';

const args = process.argv.slice(2);

const getArgValue = (argName: string) => {
  const argIndex = args.indexOf(argName);
  return argIndex !== -1 && args[argIndex + 1] ? args[argIndex + 1] : null;
};

const feature = getArgValue('--feature');
const protocol = getArgValue('--protocol') as any;
const resume = getArgValue('--resume');

if (!feature && !resume) {
  console.error('Please provide a feature description using the --feature flag, or a specId to resume using the --resume flag.');
  process.exit(1);
}

const voice = args.includes('--voice');

runOrchestrator({ feature: feature || '', protocol, voice, resume: resume || undefined });
