// tools/ci-planu-handler.ts — Handle generate_planu_ci tool calls (SPEC-066 AC-02..07)
import { generatePlanuCI } from '../engine/ci-generator/planu-steps.js';
/**
 * Handle the generate_planu_ci tool.
 * Generates a GitHub Actions workflow YAML for Planu spec validation in CI,
 * including drift detection, PR comments, badge, and .planu.yml config.
 */
export function handleGeneratePlanuCI(args) {
    const result = generatePlanuCI(args);
    const lines = [
        '## Planu CI Workflow Generated',
        '',
        `**Features enabled**: ${result.features.join(', ')}`,
        `**Workflow path**: \`${result.workflowPath}\``,
        '',
        '### Generated Workflow YAML',
        '',
        '```yaml',
        result.workflowYaml.trimEnd(),
        '```',
        '',
    ];
    // .planu.yml config
    lines.push('### Generated .planu.yml Configuration');
    lines.push('');
    lines.push('```yaml');
    lines.push(result.planuConfigYaml.trimEnd());
    lines.push('```');
    lines.push('');
    // Badge
    lines.push('### Badge for README');
    lines.push('');
    lines.push('Add this to your README.md (replace `{owner}` and `{repo}` with your values):');
    lines.push('');
    lines.push('```markdown');
    lines.push(result.badgeMarkdown);
    lines.push('```');
    lines.push('');
    lines.push(`> Save the workflow to \`${result.workflowPath}\` and the config to \`.planu.yml\` in your project root.`);
    return {
        content: [{ type: 'text', text: lines.join('\n') }],
    };
}
//# sourceMappingURL=ci-planu-handler.js.map