/** * Saga hierarchy audit primitive for `cleo doctor`. * * Walks every Saga (`type='epic'` + `label='saga'`) and surfaces violations * of the ADR-073 §1.2 invariant ladder: * * - **I5** — saga `parentId` MUST be NULL. * - **I7** — saga members MUST NOT themselves carry `label='saga'` * (no nested sagas). * - **depth** — saga → member → member-children depth ladder MUST * stay ≤ 3 hops (saga is hop 0, member-Epic is hop 1, the Epic's * direct task children are hop 2, subtasks are hop 3 — anything * deeper is structurally invalid for the saga hierarchy). * * Plus one soft-drift detector: * * - **auto-close-drift** — every member is `status='done'` but the * saga still says `pending` or `active`. ADR-073 §1.3 says a saga * auto-completes when all members do; T10116 implements that closure * hook at the rollup layer, so this branch becomes a regression * detector once T10116 ships. * * Each violation is actionable — the result carries the offending IDs and * the canonical `cleo` command an operator should run to repair it. The * doctor CLI converts these into one-line summary rows; the LAFS envelope * carries the full structured `SagaAuditResult` payload. * * Reuses the runtime guards in `packages/core/src/sagas/enforcement.ts` * (T10115) so the audit + runtime gate share one definition of "violation". * * @task T10119 * @saga T10113 — SG-SAGA-FIRST-CLASS * @epic T10209 — E-SAGA-ENFORCEMENT * @see ADR-073-above-epic-naming.md §1.2 */ import type { SagaAuditResult } from '@cleocode/contracts'; /** * Audit every Saga in the project's task store for ADR-073 §1.2 * invariant violations and auto-close drift. * * Read-only — performs zero writes. Safe to invoke from `cleo doctor` * without any `--fix`-style flag. * * @param projectRoot - Absolute path to the project root. * @returns Aggregated result. `count` is the I-invariant + depth * violation total (drives non-zero exit). `driftCount` is the * soft auto-close-drift warning total (does NOT drive exit on * its own). * * @example * ```typescript * const audit = await auditSagaHierarchy(projectRoot); * for (const v of audit.sagas.flatMap((s) => s.violations)) { * console.log(v.message); // includes offending IDs + repair command * } * if (audit.count > 0) process.exitCode = 2; * ``` */ export declare function auditSagaHierarchy(projectRoot: string): Promise; //# sourceMappingURL=saga-audit.d.ts.map