import { homedir } from 'node:os';
import path from 'node:path';
/** Store schema written by `openCodeIndexStore`. */
export const CODE_INDEX_CACHE_SCHEMA_VERSION = 5;
/** Schema directory used only by the deprecated monolithic index helper. */
export const LEGACY_CODE_INDEX_CACHE_SCHEMA_VERSION = 4;
/**
 * Cache directory for entity history, always outside the analyzed repository
 * unless a caller deliberately supplies an explicit path.
 */
export function resolveEntityCacheDir(explicit) {
    if (explicit)
        return path.resolve(explicit);
    const configured = process.env.OCC_CACHE_DIR;
    if (configured)
        return path.resolve(configured, 'entity');
    const xdg = process.env.XDG_CACHE_HOME;
    if (xdg)
        return path.resolve(xdg, 'occ', 'entity');
    return path.join(homedir(), '.cache', 'occ', 'entity');
}
/** Code indexes share the entity-cache base but stay in their own partition. */
export function resolveCodeIndexCacheDir(explicitEntityCacheDir) {
    return path.join(resolveEntityCacheDir(explicitEntityCacheDir), 'code-index');
}
//# sourceMappingURL=cache-paths.js.map