/** * Project root detection and boundary validation. * * @packageDocumentation */ /** * Result of project root detection. * * @public * @since 0.4.0 */ export interface ProjectRootResult { /** Whether a project root was found. */ found: boolean; /** The resolved project root directory, or the original cwd if not found. */ root: string; /** Which marker file was found. */ marker?: string; /** Whether the directory has a VersionGuard config. */ hasConfig: boolean; /** Whether the directory is inside a git repository. */ hasGit: boolean; /** Whether a version manifest file exists. */ hasManifest: boolean; } /** * Walks up from `startDir` to find the nearest project root. * * @remarks * Checks for VersionGuard config files first, then `.git`, then manifest files. * Stops at the filesystem root if nothing is found. * * @param startDir - Directory to start searching from. * @returns Detection result with the project root path and what was found. * * @example * ```ts * import { findProjectRoot } from 'versionguard'; * * const result = findProjectRoot(process.cwd()); * if (!result.found) { * console.log('Not in a project directory'); * } * ``` * * @public * @since 0.4.0 */ export declare function findProjectRoot(startDir: string): ProjectRootResult; /** * Formats a helpful error message when a command can't find a project. * * @remarks * The message includes actionable hints such as running `versionguard init` or * changing to a project root directory. Useful for CLI commands that require a * VersionGuard-enabled project. * * @param cwd - The directory that was checked. * @param command - The command that was attempted. * @returns A formatted, helpful error message. * * @example * ```ts * import { formatNotProjectError } from 'versionguard'; * * const msg = formatNotProjectError('/tmp/empty', 'validate'); * console.error(msg); * ``` * * @public * @since 0.4.0 */ export declare function formatNotProjectError(cwd: string, command: string): string; //# sourceMappingURL=project-root.d.ts.map