import type { Project, SourceFile } from 'ts-morph';
import type { CodeWriter } from '../engine/code-writer/code-writer.js';
/**
 * Context passed to each frontend package install script.
 *
 * Mirrors `PackageInstallerContext` (backend) but surfaces `codeWriterFor`
 * instead of `install`, because frontend wiring is driven by the three
 * idempotent `CodeWriter` methods rather than by raw ts-morph source-file
 * access (design D3).
 */
export interface FrontPackageInstallerContext {
    /**
     * Factory: build a `CodeWriter` bound to the given member bounded context.
     *
     * The three reuse methods (`declareFrontBoundedContext`,
     * `registerFrontNavigation`, `registerBcAggregatorInNavMain`) read only
     * `boundedContextName` and `srcDirectory` from the CodeWriter; the factory
     * supplies inert placeholders for the schema-derived fields those methods
     * never touch.
     */
    codeWriterFor: (boundedContextName: string) => CodeWriter;
    /**
     * Resolved absolute path to the frontend workspace root (<root>/frontend).
     * Use this for file-system operations on non-`src/` files and as the
     * Prettier cwd.
     */
    cwd: string;
    /**
     * Execute a shell command in the frontend workspace directory.
     * Used for the consumer-Prettier format pass.
     */
    exec: (cmd: string, args: string[]) => Promise<void>;
    /**
     * ts-morph Project pre-configured with the frontend tsconfig.
     * Used by `swapCurrentAccountAdapter` and other one-off source-file ops.
     */
    project: Project;
    /**
     * Open a source file under `<frontendDir>/src/<...segments>`.
     * Throws if the file does not exist (same contract as the backend equivalent).
     */
    sourceFile: (...segments: string[]) => SourceFile;
    /**
     * The srcDirectory token the CodeWriter expects (e.g. `'frontend/src'`).
     * Stored here so installer helpers can pass it to `registerBcAggregatorInNavMain`.
     */
    srcDirectory: string;
}
/**
 * Default export signature every frontend package `install.ts` must implement.
 * Returns an optional post-install message surfaced by the `add` command after
 * `spinner.succeed()`.
 */
export type FrontPackageInstaller = (ctx: FrontPackageInstallerContext) => Promise<string | undefined>;
