/**
 * NEXUS project registry - cross-project registration and management.
 *
 * SQLite-backed via nexus.db (Drizzle ORM). The global project registry
 * is stored in ~/.cleo/nexus.db in the project_registry table.
 *
 * Legacy JSON backend (projects-registry.json) is migrated on first init
 * via migrate-json-to-sqlite.ts.
 *
 * @task T5366
 * @epic T4540
 */
import { resetNexusDbState } from '../store/nexus-sqlite.js';
export type NexusPermissionLevel = 'read' | 'write' | 'execute';
export type NexusHealthStatus = 'unknown' | 'healthy' | 'degraded' | 'unreachable';
/** Domain representation of a registered Nexus project. */
export interface NexusProject {
    hash: string;
    projectId: string;
    path: string;
    name: string;
    registeredAt: string;
    lastSeen: string;
    healthStatus: NexusHealthStatus;
    healthLastCheck: string | null;
    permissions: NexusPermissionLevel;
    lastSync: string;
    taskCount: number;
    labels: string[];
}
/** Legacy registry file shape (pre-SQLite). Retained for migration compatibility. */
export interface NexusRegistryFile {
    $schema?: string;
    schemaVersion: string;
    lastUpdated: string;
    projects: Record<string, NexusProject>;
}
/** Get path to the NEXUS home directory (cache, etc.). */
export declare function getNexusHome(): string;
/** Get path to the NEXUS cache directory. */
export declare function getNexusCacheDir(): string;
/**
 * Get path to the legacy projects registry JSON file.
 * @deprecated Use nexus.db via getNexusDb() instead. Retained for JSON-to-SQLite migration.
 */
export declare function getRegistryPath(): string;
/**
 * Read all projects from nexus.db and return as a NexusRegistryFile.
 * Compatibility wrapper for consumers that expect the legacy JSON shape.
 * Returns null if nexus.db has not been initialized yet.
 */
export declare function readRegistry(): Promise<NexusRegistryFile | null>;
/**
 * Read the global registry, throwing if not initialized.
 */
export declare function readRegistryRequired(): Promise<NexusRegistryFile>;
/**
 * Initialize the NEXUS directory structure and nexus.db.
 * Idempotent -- safe to call multiple times.
 * Migrates legacy JSON registry on first run if present.
 */
export declare function nexusInit(): Promise<void>;
/**
 * Register a project in the global registry (nexus.db).
 * @returns The project hash.
 */
export declare function nexusRegister(projectPath: string, name?: string, permissions?: NexusPermissionLevel): Promise<string>;
/**
 * Unregister a project from the global registry.
 */
export declare function nexusUnregister(nameOrHash: string): Promise<void>;
/**
 * List all registered projects.
 */
export declare function nexusList(): Promise<NexusProject[]>;
/**
 * Get a project by name or hash.
 * Returns null if not found.
 */
export declare function nexusGetProject(nameOrHash: string): Promise<NexusProject | null>;
/**
 * Check if a project exists in the registry.
 */
export declare function nexusProjectExists(nameOrHash: string): Promise<boolean>;
/**
 * Sync project metadata (task count, labels) for a registered project.
 */
export declare function nexusSync(nameOrHash: string): Promise<void>;
/**
 * Sync all registered projects.
 * @returns Counts of synced and failed projects.
 */
export declare function nexusSyncAll(): Promise<{
    synced: number;
    failed: number;
}>;
/**
 * Update a project's permission level in the registry.
 * Used by permissions.ts to avoid direct JSON file writes.
 */
export declare function nexusSetPermission(nameOrHash: string, permission: NexusPermissionLevel): Promise<void>;
/**
 * Reconcile the current project's identity with the global nexus registry.
 *
 * 4-scenario policy:
 *   1. projectId in registry + path matches → update lastSeen, return {status:'ok'}
 *   2. projectId in registry + path changed → update path+hash, return {status:'path_updated'}
 *   3. projectId not in registry → auto-register, return {status:'auto_registered'}
 *   4. projectHash matches but different projectId → throw CleoError (identity conflict)
 *
 * Uses projectId as the stable identifier across project moves, since
 * projectHash is derived from the absolute path and changes when moved.
 *
 * @task T5368
 */
export declare function nexusReconcile(projectRoot: string): Promise<{
    status: 'ok' | 'path_updated' | 'auto_registered';
    oldPath?: string;
    newPath?: string;
}>;
/**
 * Reset the nexus database singleton state.
 * Re-exported from nexus-sqlite for test convenience.
 */
export { resetNexusDbState };
//# sourceMappingURL=registry.d.ts.map