import type { CursorPluginConfig } from "./config"; export interface GitRemote { name: string; url: string; cursorUrl?: string; } export type RepositoryIndexMetadataSource = "cursor-state" | "env-json" | "env-file" | "plugin-generated"; export interface RepositoryIndexMetadata { workspaceUri: string; pathEncryptionKey: string; orthogonalTransformSeed?: number; repoName?: string; repoOwner?: string; source?: RepositoryIndexMetadataSource; } export interface WorkspaceContext { workspacePath: string; worktreePath: string; relativeWorkspacePath: string; projectFolder: string; repository: { repoName: string; repoOwner: string; remotes: GitRemote[]; branchName: string; status: string; remoteUrl?: string; isTracked: boolean; isLocal: boolean; indexMetadata?: RepositoryIndexMetadata; }; } export interface WorkspaceContextOptions { directory?: string; worktree?: string; pluginConfig?: CursorPluginConfig; indexMetadata?: RepositoryIndexMetadata; indexMetadataProvider?: () => RepositoryIndexMetadata | undefined; accessTokenProvider?: () => string | undefined | Promise; } /** Parse `[remote "name"]` / `url =` from `.git/config` text. */ export declare function parseGitConfigRemotes(configText: string): GitRemote[]; /** * Branch (or short detached SHA) from `.git/HEAD`. * `ref: refs/heads/main` → `main`; bare SHA → first 7 hex chars. */ export declare function parseGitHeadBranch(headText: string): string; /** Extract branch from `git status --short --branch` header (`## …`). */ export declare function parseBranchFromStatus(status: string): string; export declare function collectWorkspaceContext(options?: WorkspaceContextOptions): WorkspaceContext; /** * Await a warm (or warming) workspace context. Joins any in-flight singleflight * refresh so index/boot paths share one git collection with the hot-path cache. */ export declare function awaitWorkspaceContext(options?: WorkspaceContextOptions): Promise; /** * Cached async collect — routes through the same singleflight Map as * `awaitWorkspaceContext` / background refresh (never starts a parallel uncached load). */ export declare function collectWorkspaceContextAsync(options?: WorkspaceContextOptions): Promise; /** * Cached, non-blocking workspace-context accessor for the request hot path. * Returns a fresh snapshot when available, a stale snapshot (while kicking off * an async background refresh) when the TTL has lapsed, and a cheap * synchronous snapshot (no git, no sqlite) on a cold cache — kicking off an * async background refresh so the next access gets real data. Never calls the * sync `collectWorkspaceContext` (which does blocking git spawns). */ export declare function getWorkspaceContextCached(options?: WorkspaceContextOptions): WorkspaceContext; /** Prime the workspace-context cache off the hot path (fire-and-forget). */ export declare function warmWorkspaceContext(options?: WorkspaceContextOptions): void; export interface ProjectLayoutEntry { path: string; isDirectory: boolean; } export declare function listProjectLayoutEntries(workspacePath: string, limit?: number): ProjectLayoutEntry[]; export declare function makeIndexSessionId(worktreePath: string): string;