// engine/execution-plan/phases-b.ts — Execution phase generators (part B)
// SRP: testing and integration phase generators.
// OCP: extend without modifying the dispatcher in generate-execution-plan.ts.
export function generateTestingPhase(spec, knowledge, startOrder) {
    const steps = [];
    let order = startOrder;
    steps.push({
        order: order++,
        title: 'Write unit tests',
        description: 'Test business logic, validators, and utilities in isolation',
        files: [`tests/unit/${spec.slug}.test.ts`],
        dependsOn: [startOrder - 1],
        verification: `All unit tests pass: ${knowledge.testCommand ?? 'npm test'}`,
        estimatedMinutes: 30,
        canRollback: true,
    });
    if (spec.scope !== 'trivial') {
        steps.push({
            order: order++,
            title: 'Write integration tests',
            description: 'Test API endpoints and data layer together',
            files: [`tests/integration/${spec.slug}.test.ts`],
            dependsOn: [startOrder],
            verification: 'Integration tests pass against test database',
            estimatedMinutes: 30,
            canRollback: true,
        });
    }
    if (spec.target === 'frontend' || spec.target === 'fullstack') {
        steps.push({
            order: order,
            title: 'Write E2E tests',
            description: 'Test critical user flows end-to-end (Playwright/Cypress)',
            files: [`tests/e2e/${spec.slug}.spec.ts`],
            dependsOn: [startOrder],
            verification: 'E2E tests pass in headless browser',
            estimatedMinutes: 30,
            canRollback: true,
        });
    }
    return steps;
}
export function generateIntegrationPhase(_spec, knowledge, startOrder) {
    const steps = [];
    let order = startOrder;
    steps.push({
        order: order++,
        title: 'Run linting and formatting',
        description: 'Ensure code passes all lint rules and is properly formatted',
        files: [],
        dependsOn: [startOrder - 1],
        verification: `Lint passes: ${knowledge.linting.detectedLinters[0]?.tool ?? 'eslint'} runs clean`,
        estimatedMinutes: 10,
        canRollback: true,
    });
    steps.push({
        order: order++,
        title: 'Update documentation',
        description: 'Update README, API docs, and changelog if applicable',
        files: [],
        dependsOn: [startOrder],
        verification: 'Documentation reflects the new changes',
        estimatedMinutes: 15,
        canRollback: true,
    });
    steps.push({
        order: order++,
        title: 'Full build and test suite',
        description: 'Run complete build and all test suites to catch regressions',
        files: [],
        dependsOn: [order - 2, order - 1],
        verification: `Full build succeeds: ${knowledge.buildCommand ?? 'npm run build'} && ${knowledge.testCommand ?? 'npm test'}`,
        estimatedMinutes: 10,
        canRollback: true,
    });
    steps.push({
        order: order++,
        title: 'Create pull request',
        description: 'Push branch and create PR with spec reference and summary',
        files: [],
        dependsOn: [order - 2],
        verification: 'PR created with passing CI checks',
        estimatedMinutes: 10,
        canRollback: true,
    });
    return steps;
}
//# sourceMappingURL=phases-b.js.map