// engine/platform-engineering/golden-path-generator.ts — SPEC-048
// Generates Golden Path acceptance criteria and self-service deployment requirements.
// Golden Path acceptance criteria for platform engineering candidates
const GOLDEN_PATH_CRITERIA = [
    '- [ ] Existe plantilla de nuevo servicio con estructura estándar (CI/CD, Dockerfile, README, tests, observabilidad básica configurada)',
    '- [ ] Un nuevo desarrollador puede tener el proyecto corriendo localmente en menos de 15 minutos siguiendo el README',
    '- [ ] La plantilla de nuevo servicio incluye: estructura de carpetas, Dockerfile multi-stage, pipeline CI, health check endpoint, y logging estructurado',
    '- [ ] El golden path está documentado en el developer portal con pasos numerados y screenshots',
];
// Self-service deployment criteria
const SELF_SERVICE_CRITERIA = [
    '- [ ] Los developers pueden crear un nuevo servicio completo (repo + CI + infraestructura base + observabilidad) sin ticket al Platform team',
    '- [ ] Los deploys a staging son self-service — no requieren aprobación del Platform team',
    '- [ ] El rollback es self-service en menos de 5 minutos desde el developer portal o CLI',
    '- [ ] La creación de bases de datos en staging/dev es self-service via Crossplane o similar',
];
// Platform Contract template
const PLATFORM_CONTRACT_TEMPLATE = {
    platformResponsibilities: [
        'Runtime infrastructure (Kubernetes clusters, VMs)',
        'Networking (service mesh, ingress, DNS)',
        'Secrets management (Vault, cloud KMS)',
        'CI/CD base pipeline templates',
        'Observability platform (Prometheus, Grafana, OTel collector)',
        'Security scanning base configuration',
    ],
    productResponsibilities: [
        'Application code and business logic',
        'Unit and integration tests',
        'Database schema and migrations',
        'Feature flags configuration',
        'Application-level logging (structured, with correlation IDs)',
        'API contracts and versioning',
    ],
};
/**
 * Returns Golden Path acceptance criteria lines for the HU.md.
 */
export function getGoldenPathCriteria() {
    return ['', '## Golden Path Requirements', '', ...GOLDEN_PATH_CRITERIA];
}
/**
 * Returns self-service deployment acceptance criteria for the HU.md.
 */
export function getSelfServiceCriteria() {
    return ['', '## Self-Service Deployment Requirements', '', ...SELF_SERVICE_CRITERIA];
}
/**
 * Returns the Platform Contract section for FICHA-TECNICA.md.
 * Only included when teamScale is 'platform-engineering-candidate'.
 */
export function getPlatformContractSection(teamScale) {
    if (teamScale !== 'platform-engineering-candidate') {
        return [];
    }
    const platformLines = PLATFORM_CONTRACT_TEMPLATE.platformResponsibilities.map((r) => `  - ${r}`);
    const productLines = PLATFORM_CONTRACT_TEMPLATE.productResponsibilities.map((r) => `  - ${r}`);
    return [
        '',
        '## Platform Contract',
        '',
        '> This section defines the responsibility boundary between Platform team and Product teams.',
        '> Generated because project signals indicate Platform Engineering context.',
        '',
        '### Platform Team Responsibilities',
        '',
        ...platformLines,
        '',
        '### Product Team Responsibilities',
        '',
        ...productLines,
        '',
        '### IDP Tool',
        '',
        '| Option | Type | Best For |',
        '|--------|------|----------|',
        '| Backstage (CNCF) | Open-source | Teams ≥20, full customization |',
        '| Port.io | SaaS | Teams 5–20, fast adoption |',
        '| Cortex | SaaS | Engineering intelligence focus |',
        '',
        '### Golden Path Status',
        '',
        '- [ ] Service template exists with CI/CD, Dockerfile, observability',
        '- [ ] New service creation is self-service (< 15 min)',
        '- [ ] Rollback is self-service (< 5 min)',
        '',
    ];
}
/**
 * Returns IDP tooling recommendation lines for suggest_tooling output.
 */
export function buildIdpToolingLines(teamScale) {
    if (teamScale !== 'platform-engineering-candidate' && teamScale !== 'multi-team') {
        return [];
    }
    const lines = [
        '## Internal Developer Platform (IDP) Recommendation',
        '',
        '**Multi-team project detected.** An IDP reduces onboarding time by 40% and OpEx by 50%.',
        '',
        '### Developer Portals',
        '',
        '| Tool | Type | Best For | Team Size |',
        '|------|------|----------|-----------|',
        '| [Backstage](https://backstage.io) | Open-source (CNCF) | Full customization, plugin ecosystem | ≥20 devs |',
        '| [Port](https://getport.io) | SaaS | Fast adoption, API-driven | 5–50 devs |',
        '| [Cortex](https://cortex.io) | SaaS | Engineering intelligence, service maturity | Any |',
        '',
        '**Recommended:** Port (fastest to adopt) → Backstage (when you need full control)',
        '',
        '### Self-Service Infrastructure',
        '',
        '| Tool | Use Case |',
        '|------|----------|',
        '| [Crossplane](https://crossplane.io) | Kubernetes-native IaC — databases, queues, storage as K8s resources |',
        '| [ArgoCD + ApplicationSets](https://argocd-applicationset.readthedocs.io) | GitOps multi-tenant deployments |',
        '| [Backstage Software Templates](https://backstage.io/docs/features/software-templates/) | Service scaffolding |',
        '',
    ];
    if (teamScale === 'platform-engineering-candidate') {
        lines.push('### Humanitec Platform Orchestrator', '', '**For enterprise scale:** Humanitec provides fully managed Platform Orchestration', 'with dynamic configuration management across environments and teams.', '');
    }
    return lines;
}
//# sourceMappingURL=golden-path-generator.js.map