// tools/ci-generator.ts — Handle generate_ci tool calls (SPEC-066)
import { generateCI } from '../engine/ci-generator/index.js';
/**
 * Handle the generate_ci tool.
 * Generates a GitHub Actions CI workflow YAML for the given project.
 */
export async function handleGenerateCI(args) {
    const result = await generateCI(args);
    const lines = [
        '## GitHub Actions CI Workflow Generated',
        '',
        `**Ecosystem**: ${result.ecosystem}`,
        `**Package manager**: ${result.stackContext.packageManager}`,
        `**Jobs included**: ${result.jobs.join(', ')}`,
        `**Triggers**: ${result.stackContext.ecosystem}`,
        `**Output path**: \`${result.workflowPath}\``,
        '',
    ];
    if (result.stackContext.nodeVersion) {
        lines.push(`**Node.js version**: ${result.stackContext.nodeVersion}`);
    }
    if (result.stackContext.pythonVersion) {
        lines.push(`**Python version**: ${result.stackContext.pythonVersion}`);
    }
    if (result.stackContext.goVersion) {
        lines.push(`**Go version**: ${result.stackContext.goVersion}`);
    }
    if (result.stackContext.rustChannel) {
        lines.push(`**Rust channel**: ${result.stackContext.rustChannel}`);
    }
    if (result.stackContext.javaVersion) {
        lines.push(`**Java version**: ${result.stackContext.javaVersion} (${result.stackContext.javaDistribution ?? 'temurin'})`);
    }
    if (result.stackContext.hasDocker) {
        lines.push(`**Docker**: detected — deploy job includes Docker build step`);
    }
    lines.push('');
    lines.push('### Generated Workflow YAML');
    lines.push('');
    lines.push('```yaml');
    lines.push(result.yamlContent.trimEnd());
    lines.push('```');
    lines.push('');
    lines.push(`> Save this content to \`${result.workflowPath}\` in your project repository.`);
    return {
        content: [{ type: 'text', text: lines.join('\n') }],
    };
}
//# sourceMappingURL=ci-generator.js.map