ailock
Version:
AI-Proof File Guard - Protect sensitive files from accidental AI modifications
60 lines • 2.16 kB
TypeScript
import { ProjectUnit, ProjectType } from './user-config.js';
/**
* Project detection and management utilities for the new quota system
*/
/**
* Detect if a path belongs to a Git repository and return the repo root
*/
export declare function detectGitRepository(filePath: string): Promise<{
isGitRepo: boolean;
repoRoot: string | null;
}>;
/**
* Generate a display name for a project
*/
export declare function generateProjectName(rootPath: string, type: ProjectType): string;
/**
* Create a new ProjectUnit from a file path
*/
export declare function createProjectFromPath(filePath: string, existingProject?: ProjectUnit): Promise<ProjectUnit>;
/**
* Find the project root for a given file path
* Returns the Git repository root if in a repo, otherwise the file's directory
*/
export declare function findProjectRoot(filePath: string): Promise<string>;
/**
* Check if a file path belongs to an existing project
*/
export declare function findMatchingProject(filePath: string, projects: ProjectUnit[]): Promise<ProjectUnit | null>;
/**
* Check if two paths belong to the same project
*/
export declare function belongsToSameProject(path1: string, path2: string): Promise<boolean>;
/**
* Filter out temp/test directories from a list of paths
* This helps clean up quota counting by ignoring temporary directories
*/
export declare function filterTempDirectories(paths: string[]): string[];
/**
* Validate that a project root path is legitimate (not temp/test)
*/
export declare function isValidProjectRoot(rootPath: string): boolean;
/**
* Clean up and consolidate project paths
* Removes duplicates and merges projects with the same root
*/
export declare function consolidateProjects(projects: ProjectUnit[]): ProjectUnit[];
/**
* Generate a user-friendly project display path
*/
export declare function getProjectDisplayPath(projectPath: string): string;
/**
* Get project statistics for display
*/
export declare function getProjectStats(projects: ProjectUnit[]): {
total: number;
gitProjects: number;
directoryProjects: number;
totalProtectedPaths: number;
};
//# sourceMappingURL=project-utils.d.ts.map