/**
 * Types and logic for the wizard's project-level Amplitude binding.
 *
 * The canonical on-disk location is `<installDir>/.amplitude/project-binding.json`.
 * Legacy `ampli.json` in the project root remains readable (and is written
 * during transition) for older workflows.
 *
 * UNIT-TESTABLE SURFACE (pure, no I/O):
 *   parseAmpliConfig, validateAmpliConfig, mergeAmpliConfig,
 *   isConfigured, isMinimllyConfigured
 *
 * I/O SURFACE:
 *   readAmpliConfig, writeAmpliConfig, ampliConfigExists
 */
import type { AmplitudeZone } from './constants.js';
export declare const AMPLI_CONFIG_FILENAME = "ampli.json";
/**
 * The shape of a project-level ampli.json file.
 * All fields are optional because the file may be partially initialised.
 */
export interface AmpliConfig {
    /** UUID of the Amplitude organization */
    OrgId?: string;
    /** UUID of the Amplitude project (formerly "workspace") */
    ProjectId?: string;
    /** @deprecated use ProjectId — kept for read-time back-compat migration */
    WorkspaceId?: string;
    /** UUID of the data source (tracking plan source) */
    SourceId?: string;
    /** Branch name in the tracking plan (e.g. "main") */
    Branch?: string;
    /** Path where the generated Ampli SDK lives (e.g. "./src/ampli") */
    Path?: string;
    /** Semantic version of the current tracking plan (e.g. "42.0.0") */
    Version?: string;
    /** UUID identifying the current tracking plan version */
    VersionId?: string;
    /** Amplitude data zone ("us" | "eu") */
    Zone?: AmplitudeZone;
    /** Runtime code as used by the ampli CLI (e.g. "node.js:typescript-ampli") */
    Runtime?: string;
    /** Platform display name (e.g. "Node.js") */
    Platform?: string;
    /** Language display name (e.g. "TypeScript") */
    Language?: string;
    /** SDK package specifier (e.g. "@amplitude/analytics-node@^1.0") */
    SDK?: string;
    /** When true, generated code omits API keys */
    OmitApiKeys?: boolean;
    /** Source directories to scan for Ampli usage */
    SourceDirs?: string[];
    /** Named Amplitude SDK instances to generate */
    InstanceNames?: string[];
    /**
     * Numeric Amplitude app id (a.k.a. "Project ID" in the Amplitude UI).
     * Stored as a string for forward compat with non-numeric ids and
     * because JSON has no integer-vs-string distinction at this scale.
     * Persisted by the wizard at the end of a successful run so a follow-up
     * agent session can read it back without re-running env selection —
     * the source of truth for "which Amplitude app does this codebase
     * write events into."
     */
    AppId?: string;
    /** Display name for `AppId`. Diagnostic only — `AppId` is the join key. */
    AppName?: string;
    /** Amplitude environment label that `AppId` resolved against (Production/Dev/etc). */
    EnvName?: string;
    /** Last dashboard URL the wizard created during this codebase's setup. */
    DashboardUrl?: string;
    /** Convenience id parsed from `DashboardUrl`. */
    DashboardId?: string;
}
export type AmpliConfigParseResult = {
    ok: true;
    config: AmpliConfig;
} | {
    ok: false;
    error: 'not_found' | 'read_error' | 'invalid_json' | 'merge_conflicts';
};
/**
 * Parse a raw JSON string into an AmpliConfig.
 * Returns a typed result rather than throwing.
 *
 * Read-time migration: if a legacy `WorkspaceId` field is present and the new
 * `ProjectId` is absent, the value is copied to `ProjectId` and `WorkspaceId`
 * is dropped from the returned object. When both are present, `ProjectId`
 * wins. This keeps the rest of the codebase unaware of the legacy key;
 * `writeAmpliConfig` only ever emits `ProjectId`, so files auto-migrate on
 * the user's next save.
 */
export declare function parseAmpliConfig(raw: string): AmpliConfigParseResult;
/**
 * Returns true when the config contains the fields required to query Amplitude
 * for event data (i.e. the project has been linked to an Amplitude source).
 */
export declare function isMinimallyConfigured(config: AmpliConfig): boolean;
/**
 * Returns true when the config is considered fully configured: it has an org,
 * a project, and a source linked.
 */
export declare function isConfigured(config: AmpliConfig): boolean;
/**
 * Shallow-merge an update into an existing config. Undefined update values are
 * ignored so callers can safely spread partial objects.
 */
export declare function mergeAmpliConfig(existing: AmpliConfig, updates: Partial<AmpliConfig>): AmpliConfig;
/**
 * Detect git merge conflict markers in a file's content.
 * Mirrors the check in the ampli CLI (ampli/src/util/git/mergeConflicts.ts).
 */
export declare function hasMergeConflicts(text: string): boolean;
/**
 * Returns the full path to ampli.json in the given directory.
 */
export declare function ampliConfigPath(dir: string): string;
/**
 * Returns true if ampli.json exists in the given directory.
 */
export declare function ampliConfigExists(dir: string): boolean;
/**
 * Read project binding from `.amplitude/project-binding.json`, falling back to
 * legacy root `ampli.json`, merging when both exist (binding overrides).
 */
export declare function readAmpliConfig(dir: string): AmpliConfigParseResult;
/**
 * Write an AmpliConfig to the canonical binding path and mirror to legacy
 * `ampli.json` for transition compatibility.
 *
 * @returns true if at least one destination was written successfully.
 */
export declare function writeAmpliConfig(dir: string, config: AmpliConfig): boolean;
/**
 * Remove org/project/zone bindings from a project's ampli.json. Called on
 * logout so a subsequent login doesn't auto-select the previous user's org
 * and project. Tracking-plan fields (SourceId, Branch, Version, etc.) are
 * preserved — they're not auth state. No-op if ampli.json is missing or
 * malformed.
 *
 * Also deletes the legacy `WorkspaceId` field as a belt-and-suspenders
 * cleanup — parseAmpliConfig normalizes it away, but if the raw file still
 * carries it (e.g. someone edited it by hand), we strip it here too.
 */
export declare function clearAuthFieldsInAmpliConfig(dir: string): void;
