/** * Stage inference for GitHub jobs → GitLab stages. * * GitHub Actions has no `stages:` concept; jobs only declare optional * `needs:` edges. GitLab CI requires every job to belong to a stage. * * Approach (Kahn topological sort on the `needs:` DAG): * 1. Build adjacency from `needs:` (jobs without `needs:` are depth 0). * 2. Peel zero-indegree nodes; assign stage by depth + name heuristic. * 3. Map depths to stage names: * depth 0 → "lint" / "build" (by name heuristic, default "build") * depth 1 → "test" * depth 2 → "deploy" * depth N>2 → `post-${N-2}` * 4. If a cycle is detected, place each remaining job in its own stage * and append a needs-review record so the user notices. */ import type { ProvenanceRecord } from "./provenance.js"; export interface GhJobSummary { logicalId: string; needs: string[]; /** Original GH job key (kebab-case) for name heuristics */ originalName: string; } export interface StageInferenceResult { /** Map from job logicalId to assigned stage name */ stageByJob: Map; /** Ordered list of distinct stages, declaration-order */ stages: string[]; /** Any provenance records (cycles, synthesis events) */ provenance: ProvenanceRecord[]; } export declare function inferStages(jobs: GhJobSummary[]): StageInferenceResult; //# sourceMappingURL=stages.d.ts.map