// tools/generate-orchestration-script.ts — SPEC-022 TD: 3-layer parallel automation script generator
// Generates a bash orchestration script for parallel multi-agent execution via git worktrees.
import { t } from '../i18n/index.js';
import { generateOrchestrationScript } from './suggest-tooling/orchestration-generator.js';
export function handleGenerateOrchestrationScript(args) {
    const { specIds, projectPath, mainBranch, baseBranch } = args;
    if (specIds.length === 0) {
        return {
            content: [
                {
                    type: 'text',
                    text: 'Error: specIds must contain at least one spec ID.',
                },
            ],
            isError: true,
        };
    }
    const script = generateOrchestrationScript({ specIds, projectPath, mainBranch, baseBranch });
    const lines = [
        `## ${t('tools.generate_orchestration_script.description')}`,
        '',
        `**Specs:** ${specIds.join(', ')}`,
        `**Project path:** ${projectPath}`,
        `**Base branch:** ${baseBranch ?? 'develop'}`,
        '',
        '### Usage',
        '',
        '1. Save the script below to `scripts/parallel-specs.sh`',
        '2. Make it executable: `chmod +x scripts/parallel-specs.sh`',
        '3. Run: `bash scripts/parallel-specs.sh`',
        '',
        '### Generated Script',
        '',
        '```bash',
        script,
        '```',
        '',
        '### Architecture (3 Layers)',
        '',
        '- **Layer 1 — Skills**: Claude Code skill files (`.claude/skills/*.md`) define agent workflows',
        '- **Layer 2 — Sub-agents**: Scoped agents generated by `generate_sub_agent` handle delegated tasks',
        '- **Layer 3 — Orchestration**: This script coordinates parallel instances via git worktrees',
        '',
        '_Each sub-agent operates in isolation — no commits, no push, no tracking. The skill parent handles those steps._',
    ];
    return {
        content: [{ type: 'text', text: lines.join('\n') }],
    };
}
//# sourceMappingURL=generate-orchestration-script.js.map