import type { Registry, RepoMeta } from "../types.js";
/**
 * Load the multi-repo registry from disk.
 * Returns an empty registry if the file doesn't exist or is invalid.
 */
export declare function loadRegistry(registryPath: string): Promise<Registry>;
/**
 * Save the registry atomically.
 * Writes to a temp file first, then renames to prevent partial reads.
 */
export declare function saveRegistry(registryPath: string, registry: Registry): Promise<void>;
/**
 * Register or update a repo in the registry.
 */
export declare function registerRepo(registryPath: string, meta: RepoMeta): Promise<void>;
/**
 * Get a single repo's metadata by name.
 * Returns null if the repo is not registered.
 */
export declare function getRepo(registryPath: string, name: string): Promise<RepoMeta | null>;
/**
 * List all registered repos.
 */
export declare function listRepos(registryPath: string): Promise<RepoMeta[]>;
/**
 * Partially update a repo's metadata (e.g., last_git_commit after freshness check).
 */
export declare function updateRepoMeta(registryPath: string, repoName: string, updates: Partial<Pick<RepoMeta, "last_git_commit" | "symbol_count" | "file_count" | "updated_at">>): Promise<void>;
/**
 * Remove a repo from the registry.
 * Returns true if the repo existed and was removed, false otherwise.
 */
export declare function removeRepo(registryPath: string, name: string): Promise<boolean>;
/**
 * Resolve registry metadata for a repo input string.
 * When `repoInput` is empty, uses CWD-based name then single-repo / root-path fallbacks.
 * When `repoInput` is non-empty but the exact key misses, falls back to:
 *   1. "local/<input>" (agents passing bare basename like "thepopebot")
 *   2. unique suffix match on "<prefix>/<input>" across all registered repos
 *   3. unique basename(root) === input match (handles .codesift.json overrides)
 * Ambiguous matches (>1 candidate) return null instead of guessing.
 */
export declare function resolveRegisteredRepoMeta(registryPath: string, repoInput: string): Promise<{
    resolvedName: string;
    meta: RepoMeta;
} | null>;
/**
 * Derive a repo name from its root path. Tried in order:
 *
 *   1. `.codesift.json` override file at the repo root (escape hatch for
 *      collisions or non-git repos that need a fixed name):
 *        { "name": "tgm-survey-platform" }      -> "local/tgm-survey-platform"
 *        { "name": "team/tgm-survey-platform" } -> "team/tgm-survey-platform"
 *
 *   2. `git remote.origin.url` parsed from `.git/config`. The same clone on
 *      any machine resolves to the same name regardless of CWD basename, so
 *      `~/workspace` on a VPS and `~/projects/tgm-survey-platform` locally
 *      both register as `local/tgm-survey-platform`. Supported URL forms:
 *        git@github.com:owner/repo.git
 *        https://github.com/owner/repo(.git)
 *        ssh://git@host/owner/repo.git
 *        git://host/owner/repo
 *      Subgroups (GitLab) collapse to the trailing repo segment.
 *
 *   3. Fallback `local/{basename(repoRoot)}` for non-git directories or
 *      git repos without an `origin` remote.
 *
 * Failures at each step (missing file, malformed JSON, unparseable URL) fall
 * through silently to the next step — derivation must never throw.
 */
export declare function getRepoName(repoRoot: string): string;
//# sourceMappingURL=registry.d.ts.map