// engine/ai-integration/continue/config-generator.ts — .continue/config.json generator (SPEC-271)
import { writeFileSync, mkdirSync, existsSync } from 'node:fs';
import { join } from 'node:path';
function buildContextProviders() {
    return [
        { name: 'diff', params: {} },
        { name: 'codebase', params: {} },
        { name: 'docs', params: {} },
        { name: 'open', params: {} },
        { name: 'terminal', params: {} },
        {
            name: 'folder',
            params: { folderPath: 'planu/specs' },
        },
    ];
}
function buildRules(options) {
    const rules = [
        'Never write production code without an approved Planu spec.',
        'Use mcp__planu__create_spec to create specs before implementation.',
        'After implementation, run mcp__planu__validate to check compliance.',
        `Project: ${options.projectName}`,
    ];
    if (options.stack.length > 0) {
        rules.push(`Stack: ${options.stack.join(', ')}`);
    }
    if (options.activeSpecId) {
        rules.push(`Active spec: ${options.activeSpecId} — implement this next following all criteria exactly.`);
    }
    return rules;
}
export function generateContinueConfig(options) {
    return {
        models: [
            {
                title: 'Claude Sonnet',
                provider: 'anthropic',
                model: 'claude-sonnet-4-5',
            },
        ],
        contextProviders: buildContextProviders(),
        rules: buildRules(options),
    };
}
export function writeContinueConfig(projectPath, options) {
    const continueDir = join(projectPath, '.continue');
    /* v8 ignore start */
    if (!existsSync(continueDir)) {
        mkdirSync(continueDir, { recursive: true });
    }
    /* v8 ignore stop */
    const configPath = join(continueDir, 'config.json');
    const config = generateContinueConfig(options);
    writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8');
}
//# sourceMappingURL=config-generator.js.map