/** * Carve-out boundary analysis for the strangler-fig emit path (#197). * * The advisor (#214) ranks *what* is cheap to carve. This is the next step: * given a chosen resource, work out the boundary — every dependency edge the * carve would cut — so the surviving Terraform can be patched and the resource * handed off without destroying it. * * Pure analysis over the graph, like the scorer. Emitting the chant source * (via live import) and generating the TF patches live in the command/bridge * layers; this module just classifies the boundary. */ import type { TfGraph } from "./types.js"; /** One resource in the carve set (the selected node plus its folded sub-resources). */ export interface CarveMember { address: string; type?: string; /** Set when this member is a sub-resource inlined into the selected parent. */ foldedInto?: string; } export type BoundaryDirection = "inbound" | "outbound"; /** * A dependency edge the carve cuts. * - inbound → a survivor depends on the carve set. Bridge: rewrite that * reference to a Terraform `data` source. Required immediately, or the * surviving plan breaks. * - outbound → the carve set depends on a survivor. Bridge: the value enters * chant as a deploy-time input. Deferred until apply; only provenance is * recorded at the observe position. * * An inbound edge whose survivor is an `output` block (#1638) is the same * urgency and the same patch — the output's expression is rewritten onto the * data source — but it is called out as `tf-output-rewrite` so a reader can * tell a one-line output edit from a resource's rewiring. */ export interface BoundaryEdge { direction: BoundaryDirection; /** The survivor side of the edge. `output.` for an output block. */ survivor: string; /** The carve-set side of the edge. */ carved: string; attrs: string[]; /** * The referring block's own top-level attribute(s) the reference sits in * (#998). For an outbound edge this names the carved resource's attribute * that reads the survivor — what the deferred input's build parameter is * named after on emit. For an output edge it is `["value"]`. */ via: string[]; bridge: "tf-data-source" | "tf-output-rewrite" | "deferred-input"; required: "immediately" | "at-apply"; } export interface CarveReport { /** The selected resource address. */ target: string; carveSet: CarveMember[]; /** Peelability of the selected resource (from the #214 scorer). */ peelability: number; inbound: BoundaryEdge[]; outbound: BoundaryEdge[]; /** A carve never destroys/recreates; it is reversible via `terraform import`. */ reversible: true; diagnostics: string[]; } /** * The carve set for a selected address: the node itself plus any sub-resources * that fold into it (same name, a `FOLDS_INTO` child type whose parent is the * selection). Those are carried along and inlined, not left behind. */ export declare function resolveCarveSet(graph: TfGraph, target: string): CarveMember[]; /** * Classify the boundary of carving `target`: the inbound edges that need an * immediate data-source patch, and the outbound edges that become deferred * deploy-time inputs. Edges internal to the carve set (e.g. a folded * sub-resource pointing at its parent) are not boundary work. */ export declare function boundaryReport(graph: TfGraph, target: string): CarveReport | null; /** * The build-parameter name a deferred input's carrying attribute becomes on * emit (#998) — shared so bridge notes and emitted `buildParams` agree. */ export declare function deferredParamName(tfAttr: string): string; //# sourceMappingURL=carve.d.ts.map