erosolar-cli
Version:
Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning
152 lines • 3.94 kB
TypeScript
/**
* Learn Tools - Codebase exploration and learning tools for understanding codebases.
*
* These tools enable deep codebase exploration without requiring external API calls
* for the core analysis. The AI can use these tools to build a comprehensive
* understanding of any codebase's architecture, patterns, and conventions.
*
* Features:
* - Codebase structure analysis
* - Pattern detection and learning
* - Architecture understanding
* - File relationship mapping
* - Topic-based exploration
*/
import type { ToolDefinition } from '../core/toolRuntime.js';
export interface CodebaseAnalysis {
rootDir: string;
totalFiles: number;
totalDirectories: number;
languages: LanguageBreakdown[];
structure: DirectoryNode;
patterns: DetectedPattern[];
architecture: ArchitectureInsights;
entryPoints: string[];
configFiles: ConfigFileInfo[];
dependencies: DependencyInfo;
}
export interface LanguageBreakdown {
language: string;
extension: string;
fileCount: number;
percentage: number;
}
export interface DirectoryNode {
name: string;
path: string;
type: 'file' | 'directory';
children?: DirectoryNode[];
size?: number;
language?: string;
}
export interface DetectedPattern {
name: string;
type: 'architectural' | 'design' | 'naming' | 'structural';
description: string;
evidence: string[];
confidence: 'high' | 'medium' | 'low';
}
export interface ArchitectureInsights {
type: string;
layers: string[];
components: ComponentInfo[];
dataFlow: string[];
}
export interface ComponentInfo {
name: string;
type: string;
path: string;
responsibilities: string[];
}
export interface ConfigFileInfo {
name: string;
path: string;
type: string;
purpose: string;
}
export interface DependencyInfo {
packageManager?: string;
dependencies: string[];
devDependencies: string[];
hasDependencyFile: boolean;
}
export interface FileAnalysis {
path: string;
language: string;
size: number;
lineCount: number;
purpose: string;
imports: ImportInfo[];
exports: ExportInfo[];
functions: FunctionSummary[];
classes: ClassSummary[];
patterns: string[];
relationships: FileRelationship[];
complexity: ComplexityMetrics;
}
export interface ImportInfo {
source: string;
specifiers: string[];
isRelative: boolean;
resolvedPath?: string;
}
export interface ExportInfo {
name: string;
type: 'default' | 'named' | 'type' | 'interface' | 'class' | 'function';
}
export interface FunctionSummary {
name: string;
line: number;
parameters: string[];
returnType?: string;
isAsync: boolean;
isExported: boolean;
complexity: number;
purpose?: string;
}
export interface ClassSummary {
name: string;
line: number;
methods: string[];
properties: string[];
extends?: string;
implements?: string[];
isExported: boolean;
}
export interface FileRelationship {
targetFile: string;
type: 'imports' | 'imported-by' | 'extends' | 'implements' | 'uses';
symbols: string[];
}
export interface ComplexityMetrics {
cyclomaticComplexity: number;
cognitiveComplexity: number;
maintainabilityIndex: number;
linesOfCode: number;
linesOfComments: number;
}
export interface TopicAnalysis {
topic: string;
relevantFiles: RelevantFile[];
patterns: TopicPattern[];
examples: CodeExample[];
summary: string;
}
export interface RelevantFile {
path: string;
relevance: number;
snippets: string[];
}
export interface TopicPattern {
name: string;
occurrences: number;
locations: string[];
}
export interface CodeExample {
file: string;
line: number;
code: string;
explanation: string;
}
export declare function createLearnTools(workingDir: string): ToolDefinition[];
//# sourceMappingURL=learnTools.d.ts.map