/** * saga.migrate-containment — migrate legacy groups Saga membership to parent_id containment. * * Pre-T10638, Saga membership used `task_relations.type='groups'`. PM-Core V2 * makes `parent_id` containment canonical: member Epics carry `parentId` * pointing at the Saga. * * This migration: * 1. Finds legacy `groups` rows from Saga (`type='saga'`) to Epic (`type='epic`). * 2. Reparants each Epic under the Saga via `parent_id` containment. * 3. Removes the migrated legacy `groups` row. * 4. Documents non-Epic relation targets and conflicting parents for manual resolution. * * Audits every mutation to `.cleo/audit/saga-contain-migration.jsonl`. * * @task T10637 * @epic T10548 — E10-MIGRATION-CLEANUP-DOGFOOD-RELEASE * @saga T10538 — SG-PM-CORE-V2 * @see ADR-073-above-epic-naming.md §1.2 — invariant I5 */ import { type EngineResult } from '../engine-result.js'; import { SAGA_GROUPS_RELATION } from './constants.js'; /** Parameters for {@link migrateSagaContainment}. */ export interface MigrateSagaContainmentParams { /** * Specific Saga ID to migrate. When omitted, migrates ALL sagas. * Providing a specific ID is the idempotency-safe default for CLI usage. */ sagaId?: string; /** Dry-run mode: scan only, no mutations. */ dryRun?: boolean; } /** A single Epic that was successfully migrated. */ export interface MigratedEpic { epicId: string; sagaId: string; oldParentId: string | null; groupsRelation: { from: string; to: string; type: typeof SAGA_GROUPS_RELATION; }; } /** A Task (non-Epic) with a Saga parent that needs manual resolution. */ export interface ContainmentConflict { taskId: string; sagaId: string; taskType: string; taskTitle: string; reason: string; } /** Result of {@link migrateSagaContainment}. */ export interface MigrateSagaContainmentResult { /** Total sagas scanned. */ sagasScanned: number; /** Number of Epics successfully migrated (groups → parent_id). */ migrated: number; /** Number of already-correct Epics skipped (idempotent no-op). */ skipped: number; /** Detailed list of migrated Epics. */ migratedEpics: MigratedEpic[]; /** Tasks (non-epics) with Saga parents that need manual resolution. */ conflicts: ContainmentConflict[]; /** Whether this was a dry run (no mutations performed). */ dryRun: boolean; } /** * Migrate legacy `task_relations.type='groups'` Saga membership to parent_id containment. * * @param projectRoot - Absolute path to the CLEO project root. * @param params - Optional sagaId and dry-run flag. */ export declare function migrateSagaContainment(projectRoot: string, params?: MigrateSagaContainmentParams): Promise>; //# sourceMappingURL=migrate-containment.d.ts.map