import { Result } from "better-result";
import { type ComputeFramework, type ComputeRegion } from "./types.ts";
export interface ComputeDeployTargetBuild {
    /** Build command, null to skip the build step, undefined when not configured. */
    command: string | null | undefined;
    /** Normalized output path relative to the app root, undefined when not configured. */
    outputDirectory: string | undefined;
    /**
     * Normalized configured entrypoint. With outputDirectory it is relative to
     * that output directory; otherwise it is relative to the app root.
     */
    entrypoint: string | undefined;
}
export interface ComputeDeployTarget {
    /** `apps` map key, or null for a single-app `app` config. */
    key: string | null;
    name: string | null;
    /** Region used when creating a new app, or null to use the consumer default. */
    region: ComputeRegion | null;
    /** Normalized app directory relative to the config file, or null for the config directory. */
    root: string | null;
    framework: ComputeFramework | null;
    /** Runtime/source entrypoint normalized from `entry` or an entrypoint-backed `build.entrypoint`. */
    entry: string | null;
    httpPort: number | null;
    /** Env inputs in deploy order: dotenv file paths first, then NAME=VALUE assignments. */
    envInputs: string[];
    /** Build settings; non-null means the config owns build configuration. */
    build: ComputeDeployTargetBuild | null;
}
export interface LoadedComputeConfig {
    configPath: string;
    /** Directory containing the config file. Config-relative paths resolve from here. */
    configDir: string;
    relativeConfigPath: string;
    kind: "single" | "multi";
    targets: ComputeDeployTarget[];
}
declare const ComputeConfigInvalidError_base: import("better-result").TaggedErrorClass<"ComputeConfigInvalidError", {
    message: string;
    configPath: string;
    issues: string[];
}>;
export declare class ComputeConfigInvalidError extends ComputeConfigInvalidError_base {
    constructor(configPath: string, issues: string[]);
}
declare const ComputeConfigTargetRequiredError_base: import("better-result").TaggedErrorClass<"ComputeConfigTargetRequiredError", {
    message: string;
    configPath: string;
    availableTargets: string[];
}>;
export declare class ComputeConfigTargetRequiredError extends ComputeConfigTargetRequiredError_base {
    constructor(configPath: string, availableTargets: string[]);
}
declare const ComputeConfigTargetUnknownError_base: import("better-result").TaggedErrorClass<"ComputeConfigTargetUnknownError", {
    message: string;
    configPath: string;
    requestedTarget: string;
    availableTargets: string[];
}>;
export declare class ComputeConfigTargetUnknownError extends ComputeConfigTargetUnknownError_base {
    constructor(configPath: string, requestedTarget: string, availableTargets: string[]);
}
export type ComputeConfigTargetError = ComputeConfigTargetRequiredError | ComputeConfigTargetUnknownError;
export declare const KNOWN_APP_KEYS: readonly ["name", "region", "root", "framework", "entry", "httpPort", "env", "build"];
export declare const KNOWN_TOP_LEVEL_KEYS: readonly ["app", "apps", "region"];
export declare const KNOWN_ENV_KEYS: readonly ["file", "vars"];
export declare const KNOWN_BUILD_KEYS: readonly ["command", "outputDirectory", "entrypoint"];
/**
 * Validates and normalizes a config module's default export. Reports every
 * issue at once so authors fix the file in one pass.
 */
export declare function normalizeComputeConfig(exported: unknown, configPath: string): Result<LoadedComputeConfig, ComputeConfigInvalidError>;
/** Absolute app directory of a config target. */
export declare function computeTargetAppDir(config: LoadedComputeConfig, target: ComputeDeployTarget): string;
/**
 * Selects a deploy target. Single-app configs return their app (a requested
 * target must then match the configured `name`); multi-app configs require a
 * matching key unless they hold exactly one target.
 */
export declare function selectComputeDeployTarget(config: LoadedComputeConfig, requestedTarget: string | undefined): Result<ComputeDeployTarget, ComputeConfigTargetError>;
/**
 * Infers the deploy target whose app directory contains `cwd`, so commands
 * run from inside a target's root select it without a target argument. The
 * deepest matching root wins; an ambiguous tie infers nothing.
 */
export declare function inferComputeTargetFromCwd(config: LoadedComputeConfig, cwd: string): string | undefined;
export {};
//# sourceMappingURL=normalize.d.ts.map