初始化仓库分析
(&mut self)
| 45 | |
| 46 | /// 初始化仓库分析 |
| 47 | pub fn initialize(&mut self) -> Result<(), String> { |
| 48 | info!("Initializing repository analysis for: {}", self.repository_path.display()); |
| 49 | |
| 50 | // 扫描所有文件 |
| 51 | let files = self.parser.scan_directory(&self.repository_path); |
| 52 | info!("Found {} files to analyze", files.len()); |
| 53 | |
| 54 | // 分析每个文件 |
| 55 | for file_path in files { |
| 56 | if let Err(e) = self.refresh_file(&file_path) { |
| 57 | warn!("Failed to analyze file {}: {}", file_path.display(), e); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | // 预热代码片段缓存 |
| 62 | if let Err(e) = self.warm_snippet_cache() { |
| 63 | warn!("Failed to warm snippet cache: {}", e); |
| 64 | } |
| 65 | |
| 66 | info!("Repository analysis completed"); |
| 67 | Ok(()) |
| 68 | } |
| 69 | |
| 70 | /// 增量更新单个文件 |
| 71 | pub fn refresh_file(&mut self, file_path: &PathBuf) -> Result<(), String> { |
no test coverage detected