// resources/process.ts — SDD process methodology resource
// Returns the SDD workflow steps and methodology description.
import { t } from '../i18n/index.js';
/**
 * The SDD (Spec Driven Development) process as a structured object.
 * This is static methodology data — it does not depend on project state.
 */
function getSddProcess() {
    return {
        name: 'Spec Driven Development (SDD)',
        version: '1.0',
        description: 'A methodology where every code change starts with a spec. ' +
            'The spec is the single source of truth for estimation, implementation, ' +
            'validation, and documentation.',
        phases: [
            {
                id: 'initializing',
                name: '1. Initialize',
                tools: ['init_project', 'init_constitution', 'detect_agent'],
                description: 'Detect project language, framework, architecture, and conventions. ' +
                    'Generate the project constitution. Detect the AI agent platform in use.',
            },
            {
                id: 'analyzing',
                name: '2. Analyze',
                tools: [
                    'clarify_requirements',
                    'suggest_stack',
                    'check_versions',
                    'consult_docs',
                    'discover_mcps',
                    'suggest_mcps',
                    'suggest_tooling',
                ],
                description: 'Clarify requirements, analyze the stack, check dependency versions, ' +
                    'discover available MCP servers, and assess dev lifecycle tooling.',
            },
            {
                id: 'creating-spec',
                name: '3. Create Spec',
                tools: ['create_spec', 'reverse_engineer', 'estimate'],
                description: 'Create a full SDD spec (HU.md + FICHA-TECNICA.md) from requirements or ' +
                    'reverse-engineer from existing code. Estimate effort, cost, and tokens.',
            },
            {
                id: 'filtering',
                name: '4. Filter & Enrich',
                tools: [
                    'generate_adr',
                    'design_schema',
                    'define_ui_contract',
                    'challenge_spec',
                    'generate_execution_plan',
                ],
                description: 'Enrich the spec with architecture decisions, database schema, UI contracts, ' +
                    'resilience analysis, and step-by-step execution plans.',
            },
            {
                id: 'reviewing',
                name: '5. Review',
                tools: [
                    'summarize_spec',
                    'generate_checklist',
                    'reconcile_spec',
                    'list_specs',
                    'update_status',
                ],
                description: 'Review specs via summaries and checklists. Reconcile with changes. ' +
                    'Transition spec status through the lifecycle.',
            },
            {
                id: 'implementing',
                name: '6. Implement',
                tools: [
                    'generate_skill',
                    'generate_sub_agent',
                    'generate_rules',
                    'manage_git',
                    'manage_context',
                    'orchestrate',
                ],
                description: 'Generate agent skills and rules. Manage git branches and PRs. ' +
                    'Orchestrate multi-agent workflows. Persist context across sessions.',
            },
            {
                id: 'validating',
                name: '7. Validate',
                tools: ['validate', 'detect_drift', 'audit', 'generate_tests'],
                description: 'Validate implementation against spec. Detect drift. Audit code quality. ' +
                    'Generate and run test plans.',
            },
            {
                id: 'documenting',
                name: '8. Document & Ship',
                tools: ['generate_docs', 'generate_docs_site', 'integrate_pm', 'learn_pattern'],
                description: 'Generate documentation. Sync with project management tools. ' +
                    'Learn patterns for future estimations.',
            },
        ],
        specLifecycle: ['draft', 'review', 'approved', 'implementing', 'done'],
        totalTools: 104,
    };
}
/**
 * MCP resource handler for planu://process
 */
export function handleProcessResource() {
    const process = getSddProcess();
    return Promise.resolve(JSON.stringify(process, null, 2));
}
export const processResourceDefinition = {
    uri: 'planu://process',
    name: 'SDD Process',
    description: t('resources.process.description'),
    mimeType: 'application/json',
};
//# sourceMappingURL=process.js.map