devibe
Version:
Intelligent repository cleanup with auto mode, AI learning, markdown consolidation, auto-consolidate workflow, context-aware classification, and cost optimization
127 lines • 3.84 kB
TypeScript
/**
* Project Convention Analyzer
*
* Intelligently analyzes existing project structure and conventions to ensure
* devibe respects and follows existing patterns rather than imposing new ones.
*
* Features:
* - Detects existing folder structures (docs, scripts, tests, etc.)
* - Analyzes documentation organization patterns
* - Identifies where root files (README, CHANGELOG, etc.) are placed
* - Uses AI to understand project-specific conventions
* - Falls back to best practices when no conventions exist
*/
import type { GitRepository } from './types.js';
export interface ProjectConventions {
docsFolder?: {
path: string;
exists: boolean;
structure?: {
hasSpecifications?: boolean;
hasImplementation?: boolean;
hasGuides?: boolean;
hasAPI?: boolean;
customFolders?: string[];
};
};
scriptsFolder?: {
path: string;
exists: boolean;
types?: string[];
};
rootFileConventions?: {
readmeInRoot: boolean;
changelogInRoot: boolean;
contributingInRoot: boolean;
licenseInRoot: boolean;
customRootFiles?: string[];
};
testConventions?: {
location: 'colocated' | 'centralized' | 'per-package' | 'mixed';
folderName?: string;
};
recommendations?: {
shouldCreateDocsFolder: boolean;
shouldCreateScriptsFolder: boolean;
recommendedDocsStructure?: string[];
keepFilesInRoot?: string[];
};
analyzedAt: string;
}
export declare class ProjectConventionAnalyzer {
private aiAvailable;
initialize(): Promise<void>;
/**
* Analyze project conventions comprehensively
*/
analyze(rootPath: string, repositories: GitRepository[]): Promise<ProjectConventions>;
/**
* Analyze documentation folder structure
*/
private analyzeDocsFolder;
/**
* Analyze the internal structure of docs folder
*/
private analyzeDocsFolderStructure;
/**
* Analyze scripts folder
*/
private analyzeScriptsFolder;
/**
* Categorize existing scripts by type
*/
private categorizeScripts;
/**
* Analyze root file placement conventions
*/
private analyzeRootFiles;
/**
* Analyze test organization conventions
*/
private analyzeTestConventions;
/**
* Check if directory has colocated test files
*/
private hasColocatedTests;
/**
* Check if filename indicates a test file
*/
private isTestFile;
/**
* Generate recommendations based on analysis
*/
private generateRecommendations;
/**
* Use AI to enhance convention understanding
*/
private enhanceWithAI;
/**
* Build context string for AI analysis
*/
private buildConventionsContext;
/**
* Get human-readable summary of conventions
*/
getSummary(conventions: ProjectConventions): string;
/**
* Check if a file should be placed in root based on conventions
*/
shouldKeepInRoot(fileName: string, conventions: ProjectConventions): boolean;
/**
* Get target folder for a file based on conventions
*/
getTargetFolder(fileName: string, fileType: 'doc' | 'script' | 'test', conventions: ProjectConventions): string | null;
/**
* Save conventions to cache file
*/
saveToCache(rootPath: string, conventions: ProjectConventions): Promise<void>;
/**
* Load conventions from cache if available
*/
loadFromCache(rootPath: string): Promise<ProjectConventions | null>;
/**
* Analyze with caching support
*/
analyzeWithCache(rootPath: string, repositories: GitRepository[]): Promise<ProjectConventions>;
}
//# sourceMappingURL=project-convention-analyzer.d.ts.map