/** * Disk-backed carry-forward of anchored memory/decisions across a rename/move. * (change: add-symbol-identity-continuity) * * After a re-analysis, a symbol that was renamed or moved would orphan every * memory and decision anchored to it — accumulated, still-true knowledge silently * lost exactly when the codebase is being actively refactored. This module closes * that gap: it computes the deterministic continuity map between the symbols that * disappeared (anchors that no longer resolve) and the symbols that appeared (new * nodes absent before), then re-points the surviving anchors to their new symbol, * recording `carriedAcross` provenance so the move is auditable. * * Discipline: * - Carry forward ONLY on the unambiguous one-to-one matches from * {@link computeContinuity} (`exact-body` / `exact-signature`); ambiguity is * surfaced as `possiblyMovedTo`, never resolved by guessing. * - The anchor's `contentHash` baseline is preserved, NOT re-stamped: an * exact-body carry then recalls `fresh`, an exact-signature carry (the rename * changed the span) recalls `drifted` — both annotated as carried. This keeps * the existing freshness engine the single source of truth. * - Specs are not symbol-anchored in this codebase (they are regenerated, file- * level artifacts), so there is nothing to carry forward for them — out of scope * by construction, not by omission. * - Pure detection lives in `../analyzer/continuity.ts`; this module only does the * disk read/match/write. The re-anchor transform ({@link reanchorAnchors}) is a * pure function so it is unit-tested without disk. */ import type { StructuralAnchor } from '../../types/index.js'; import { type ContinuityPair, type AmbiguousContinuity } from '../analyzer/continuity.js'; /** Minimal view of an old (pre-re-analysis) node, snapshotted before the rebuild. */ export interface OldNodeSnapshot { id: string; stableId?: string; name: string; filePath: string; } export interface CarryForwardSummary { /** Confident `(old → new)` pairs whose anchors were carried. */ carried: ContinuityPair[]; /** Disappeared anchored symbols left ambiguous (disclosed via `possiblyMovedTo`). */ ambiguous: AmbiguousContinuity[]; memoriesUpdated: number; decisionsUpdated: number; } /** * Snapshot the minimal old-node view from a persisted graph BEFORE it is rebuilt. * Call this just before re-analysis overwrites the store; the result is the * `oldNodes` input to {@link carryForwardContinuity}. Returns `[]` when no prior * graph exists (the first analysis — nothing to carry from). */ export declare function snapshotOldNodes(storeDir: string): OldNodeSnapshot[]; /** * Re-point anchors across the continuity map (PURE). For each anchor that resolves * to a pair's `from` symbol, rewrite its identity fields to the `to` symbol and * stamp `carriedAcross` provenance (the `contentHash` baseline is preserved). For * each anchor whose old symbol was ambiguous, attach `possiblyMovedTo` candidates. * Returns the new anchor list and whether anything changed. */ export declare function reanchorAnchors(anchors: readonly StructuralAnchor[], pairByFrom: ReadonlyMap, ambiguousByFrom: ReadonlyMap, atCommit?: string): { anchors: StructuralAnchor[]; changed: boolean; }; /** * Carry anchored memory + decisions forward across renames/moves detected between * the pre-re-analysis `oldNodes` snapshot and the freshly persisted graph. Safe to * call on every `openlore analyze`: a cheap no-op when there are no anchored * symbols or no prior snapshot. Read-only on the call graph; writes only the * memory/decision stores, and only when something actually moved. */ export declare function carryForwardContinuity(rootPath: string, oldNodes: readonly OldNodeSnapshot[], storeDir?: string): Promise; //# sourceMappingURL=continuity-carry-forward.d.ts.map