/** * @fileoverview Utilities for Claude Code directory and project path handling. * Provides functions to get Claude configuration directories respecting the * CLAUDE_CONFIG_DIR environment variable and convert worktree paths to Claude's * project naming convention. */ import { Effect, Either } from 'effect'; import { ValidationError, FileSystemError } from '../types/errors.js'; /** * Get the Claude directory path using Either for synchronous validation * Returns Either with ValidationError if HOME directory cannot be determined */ export declare function getClaudeDir(): Either.Either; /** * Get the Claude projects directory path using Either * * Propagates ValidationError from getClaudeDir if HOME directory cannot be determined. * * @returns {Either.Either} Either containing projects directory path or ValidationError * * @example * ```typescript * import {Either} from 'effect'; * import {getClaudeProjectsDir} from './utils/claudeDir.js'; * * const projectsDirEither = getClaudeProjectsDir(); * * if (Either.isRight(projectsDirEither)) { * console.log(`Projects directory: ${projectsDirEither.right}`); * } else { * console.error(`Failed to get directory: ${projectsDirEither.left.field} ${projectsDirEither.left.constraint}`); * } * ``` */ export declare function getClaudeProjectsDir(): Either.Either; /** * Convert a worktree path to Claude's project naming convention * Pure transformation, cannot fail * @param worktreePath The path to the worktree * @returns The project name used by Claude */ export declare function pathToClaudeProjectName(worktreePath: string): string; /** * Check if Claude project directory exists using Effect * * Returns false for ENOENT (directory doesn't exist), fails with FileSystemError for other errors. * * @param {string} projectName - Claude project name to check * @returns {Effect.Effect} Effect containing boolean indicating existence or FileSystemError * * @example * ```typescript * import {Effect} from 'effect'; * import {claudeDirExists, pathToClaudeProjectName} from './utils/claudeDir.js'; * * const projectName = pathToClaudeProjectName('/path/to/worktree'); * * // Check if directory exists with error handling * const exists = await Effect.runPromise( * Effect.catchAll( * claudeDirExists(projectName), * (error) => { * console.error(`Failed to check directory: ${error.cause}`); * return Effect.succeed(false); // Assume doesn't exist on error * } * ) * ); * * if (exists) { * console.log('Claude project directory exists'); * } * ``` */ export declare function claudeDirExists(projectName: string): Effect.Effect;