export declare const BEGIN_MARKER = "# --- BEGIN managed by worktree-env (do not edit) ---"; export declare const END_MARKER = "# --- END managed by worktree-env ---"; export interface PortEntry { name: string; base: number; } export interface StringEntry { name: string; value: string; } export interface EnvBaseResult { ports: PortEntry[]; strings: StringEntry[]; } export interface WorktreeEnvResult { worktreeName: string | null; offset: number; ports: Record; strings: Record; } export interface WorktreeInfo { worktreeName: string | null; siblingPaths: string[]; } /** * Count trailing zeros of a number. * e.g. 27000 → 3, 6300 → 2, 3140 → 1, 3141 → 0 */ export declare function countTrailingZeros(n: number): number; /** * Validate base ports. Returns { errors, warnings }. */ export declare function validateBasePorts(ports: PortEntry[]): { errors: string[]; warnings: string[]; }; /** * Parse .env.base file content into port entries (numeric values) and * string entries (non-numeric values like COMPOSE_PROJECT_NAME). */ export declare function parseEnvBase(content: string): EnvBaseResult; /** * Find the lowest unused positive integer offset by scanning * sibling worktree .port-offset files. */ export declare function findLowestUnusedOffset(siblingPaths: string[]): number; /** * Compute the worktree env: assign offset, compute ports. * String entries (like COMPOSE_PROJECT_NAME) get a `--` * suffix appended when inside a worktree, truncated to 60 characters. */ export declare function computeWorktreeEnv(repoRoot: string, basePorts: PortEntry[], baseStrings?: StringEntry[], worktreeInfo?: WorktreeInfo): WorktreeEnvResult; /** * Update the .env file with the managed section. * Preserves any content outside the BEGIN/END markers. */ export declare function updateEnvFile(envFilePath: string, result: WorktreeEnvResult): void; /** * Parse the output of `git worktree list --porcelain` into an array of * worktree root paths. */ export declare function parseWorktreeList(porcelainOutput: string): string[]; /** * Detect worktree info from git command outputs (pure — no subprocess calls). * * @param gitDir Output of `git rev-parse --git-dir` (trimmed) * @param gitCommonDir Output of `git rev-parse --git-common-dir` (trimmed) * @param worktreeListOutput Output of `git worktree list --porcelain` * @param currentPath The current worktree root (from `git rev-parse --show-toplevel`) */ export declare function detectWorktreeInfo(gitDir: string, gitCommonDir: string, worktreeListOutput: string, currentPath: string): WorktreeInfo; //# sourceMappingURL=worktree-env.d.ts.map