UNPKG

@ace-sdk/cli

Version:

ACE CLI - Command-line tool for intelligent pattern learning and playbook management

128 lines 3.89 kB
/** * InitializationService - Offline learning from existing codebase * * Implements ACE Paper Section 4.1: Offline Adaptation * Analyzes git history and existing code to build initial playbook */ import { StructuredPlaybook } from '../types/pattern.js'; export interface InitOptions { /** * Analysis mode * @default 'hybrid' */ mode?: 'hybrid' | 'both' | 'local-files' | 'git-history' | 'docs-only'; /** * Number of recent commits to analyze * @default 500 (NEW: was 100) */ commitLimit?: number; /** * Days of history to analyze * @default 90 (NEW: was 30) */ daysBack?: number; /** * Maximum files to analyze (-1 for unlimited) * @default 5000 (NEW: was 1000) */ maxFiles?: number; /** * File patterns to analyze (glob patterns) * @default ['*.ts', '*.js', '*.py', '*.java', '*.tsx', '*.jsx'] */ filePatterns?: string[]; /** * Skip commits with these patterns in message * @default ['merge', 'wip', 'temp'] */ skipPatterns?: string[]; } export declare class InitializationService { private languageDetector; constructor(); /** * Initialize playbook from existing codebase * * SUPPORTS MULTIPLE MODES: * - hybrid: Docs + Git + Local files (NEW DEFAULT - intelligent fallback) * - both: Git + Local files (legacy behavior) * - docs-only: Only documentation files * - git-history: Only git commits * - local-files: Only source files * * USES LINGUIST: Automatically detects ALL programming languages (no hardcoded extensions!) */ initializeFromCodebase(repoPath: string, options?: InitOptions): Promise<StructuredPlaybook>; /** * Check if directory has git repository */ private hasGitRepo; /** * Analyze git history to extract meaningful commits */ private analyzeGitHistory; /** * Analyze documentation files for best practices, troubleshooting, and architectural guidance * * Scans: CLAUDE.md, README.md, ARCHITECTURE.md, docs/ directory, and root markdown files */ private analyzeDocumentation; /** * Find markdown files in a directory */ private findMarkdownFiles; /** * Extract patterns from markdown documentation */ private extractPatternsFromMarkdown; /** * Classify documentation section into playbook category */ private classifyDocSection; /** * Analyze local source files using GitHub Linguist (NEW - replaces hardcoded extensions!) * * Automatically detects ALL programming languages using Linguist * Supports: TypeScript, JavaScript, Python, Java, Go, Rust, Ruby, PHP, C#, Kotlin, Swift, and 100+ more! */ private analyzeSourceFilesWithLinguist; /** * Analyze dependency files (package.json, requirements.txt, Cargo.toml, etc.) */ private analyzeDependencyFiles; /** * OLD METHOD: Analyze local source files for patterns (FALLBACK ONLY) * * @deprecated Use analyzeSourceFilesWithLinguist instead */ private analyzeSourceFiles; /** * Find source files matching patterns */ private findSourceFiles; /** * Extract import statements from source code */ private extractImports; /** * Extract patterns from commit analysis */ private extractPatternsFromCommits; /** * Find files that frequently change together */ private analyzeFileCoOccurrence; /** * Extract error patterns from commit messages */ private extractErrorPatterns; /** * Build initial playbook from extracted patterns */ private buildInitialPlaybook; /** * Generate bullet ID: ctx-{timestamp}-{random} */ private generateBulletId; } //# sourceMappingURL=initialization.d.ts.map