aetherlight-analyzer
Version:
Code analysis tool to generate ÆtherLight sprint plans from any codebase
118 lines • 3.43 kB
TypeScript
/**
* ValidationConfigGenerator
*
* DESIGN DECISION: Auto-generate project-specific validation.toml configuration
* WHY: Validators need configuration to be effective, but manual config is error-prone
*
* REASONING CHAIN:
* 1. Analyze project structure (type, packages, dependencies)
* 2. Detect potential issues (native deps, runtime npm deps, version mismatches)
* 3. Generate intelligent defaults based on analysis
* 4. Communicate findings to user
* 5. Save configuration after confirmation
* 6. Result: Accurate, project-specific validation rules
*
* Pattern: Pattern-ANALYZER-001 (Auto-Configuration)
* Related: VAL-002, VAL-007, SYNC-001
*/
/**
* Project type classifications
*/
export type ProjectType = 'vscode-extension' | 'library' | 'application' | 'monorepo';
/**
* Package structure info
*/
export interface PackageStructure {
type: 'single' | 'monorepo';
packages: string[];
}
/**
* Detected issue with project
*/
export interface DetectedIssue {
type: 'native_dependencies' | 'runtime_npm_dependencies' | 'large_bundle' | 'missing_tests' | 'version_mismatch';
severity: 'critical' | 'warning' | 'info';
message: string;
packages?: string[];
suggestion?: string;
}
/**
* Validation configuration structure
*/
export interface ValidationConfig {
validation: {
enabled: boolean;
dependencies: {
allow_native_dependencies: boolean;
allow_runtime_npm_dependencies: boolean;
allowed_exceptions: string[];
};
version_sync?: {
mode: 'auto-discover' | 'explicit';
packages: string[];
require_exact_match: boolean;
};
test_coverage?: {
infrastructure_min: number;
api_min: number;
ui_min: number;
};
package_size?: {
max_size_mb: number;
warn_size_mb: number;
};
};
}
/**
* Analysis result
*/
export interface AnalysisResult {
projectType: ProjectType;
packageStructure: PackageStructure;
issues: DetectedIssue[];
config: ValidationConfig;
configSaved: boolean;
}
/**
* Save options
*/
export interface SaveOptions {
force?: boolean;
}
/**
* Generate options
*/
export interface GenerateOptions {
autoSave?: boolean;
}
export declare class ValidationConfigGenerator {
/**
* Detect project type by analyzing package.json and directory structure
*/
detectProjectType(projectRoot: string): ProjectType;
/**
* Detect package structure (single package or monorepo with multiple packages)
*/
detectPackageStructure(projectRoot: string): PackageStructure;
/**
* Detect potential issues in the project
*/
detectPotentialIssues(projectRoot: string): DetectedIssue[];
/**
* Generate validation config based on project analysis
*/
generateConfig(projectRoot: string): ValidationConfig;
/**
* Save config to .aetherlight/validation.toml
*/
saveConfig(projectRoot: string, config: ValidationConfig, options?: SaveOptions): Promise<void>;
/**
* Convert config object to TOML string
*/
private configToToml;
/**
* Full analysis and config generation workflow
*/
analyzeAndGenerateConfig(projectRoot: string, options?: GenerateOptions): Promise<AnalysisResult>;
}
//# sourceMappingURL=ValidationConfigGenerator.d.ts.map