export class FallbackGenerator {
    generate(request) {
        const sourceDescription = normalizeSourceDescription(request.description, request.title);
        const contextLine = buildContextLine(request);
        const technicalSection = '';
        const specBody = [
            '## Problem',
            sourceDescription,
            '',
            '## Solution',
            'Use the preserved source description above as the authoritative requirements body.',
            contextLine,
        ].join('\n');
        return Promise.resolve({
            specBody,
            technicalSection,
            generatedWithModel: 'deterministic-fallback',
            generatedAt: new Date().toISOString(),
            qualityWarnings: [
                'Fallback generator used. Source description was preserved; technical ownership must come from explicit source paths or local project analysis.',
            ],
            fallbackReason: 'No external model generator is configured for create_spec.',
        });
    }
}
function normalizeSourceDescription(description, title) {
    const compact = description.replace(/\r\n/g, '\n').trim();
    if (compact.length > 0) {
        return compact;
    }
    return `The project needs ${title} defined with enough implementation detail to proceed safely.`;
}
function buildContextLine(request) {
    const parts = [
        request.projectContext?.language,
        request.projectContext?.framework,
        request.projectContext?.architecture,
    ].filter((part) => part !== undefined && part.trim().length > 0);
    if (parts.length === 0) {
        return 'Use the existing project architecture and conventions.';
    }
    return `Use the existing ${parts.join(' / ')} project conventions.`;
}
//# sourceMappingURL=fallback-generator.js.map