import { type WorkspaceMutationSnapshot } from './cli-add-shared.js'; /** * Paths captured before a workspace mutation so its filesystem changes can be rolled back. */ export interface WorkspaceMutationSnapshotPlan { /** Files to capture before the mutation starts. Missing files are restored as absent. */ filePaths: string[]; /** Snapshot directories created by the mutation, usually migration fixtures. */ snapshotDirs?: string[]; /** Created files or directories to remove if the mutation fails. */ targetPaths?: string[]; } /** * A workspace mutation snapshot plan paired with the operation to execute. */ export interface WorkspaceMutationPlan extends WorkspaceMutationSnapshotPlan { /** Mutating work to execute after the snapshot is captured. */ run: () => Promise; } /** * Error thrown when the mutation and its rollback both fail. */ export declare class WorkspaceMutationRollbackError extends Error { readonly mutationError: unknown; readonly rollbackError: unknown; constructor(mutationError: unknown, rollbackError: unknown); } /** * Capture the files and paths needed to roll back a workspace add mutation. */ export declare function createWorkspaceMutationSnapshot({ filePaths, snapshotDirs, targetPaths }: WorkspaceMutationSnapshotPlan): Promise; /** * Execute a workspace add mutation with rollback on any failure. */ export declare function executeWorkspaceMutationPlan(plan: WorkspaceMutationPlan): Promise; /** * Insert a PHP snippet before the workspace textdomain hook or closing tag. */ export declare function insertPhpSnippetBeforeWorkspaceAnchors(source: string, snippet: string): string; /** * Append a PHP snippet before the closing tag when one is present. */ export declare function appendPhpSnippetBeforeClosingTag(source: string, snippet: string): string;