MCPcopy Create free account
hub / github.com/CodeBendKit/codeseek / run_analyze

Function run_analyze

rust-core/src/cli/analyze.rs:30–92  ·  view source on GitHub ↗
(args: &AnalyzeArgs)

Source from the content-addressed store, hash-verified

28}
29
30pub fn run_analyze(args: &AnalyzeArgs) -> Result<(), Box<dyn std::error::Error>> {
31 info!("Starting repository analysis for: {}", args.path.display());
32
33 // 创建仓库管理器
34 let mut repo_manager = RepositoryManager::new(args.path.clone());
35
36 // 尝试加载现有状态
37 if args.state_dir.exists() {
38 if let Err(e) = repo_manager.load_state(&args.state_dir) {
39 warn!("Failed to load existing state: {}", e);
40 info!("Starting fresh analysis...");
41 } else {
42 info!("Loaded existing state from: {}", args.state_dir.display());
43 }
44 }
45
46 if args.incremental {
47 // 增量更新模式
48 info!("Running in incremental mode");
49 // 这里可以实现文件监控和增量更新逻辑
50 } else {
51 // 全量分析模式
52 info!("Running full repository analysis");
53 repo_manager.initialize()?;
54 }
55
56 // 显示统计信息
57 if args.stats {
58 let _stats = repo_manager.get_repository_stats();
59
60 }
61
62 // 执行搜索
63 if let Some(query) = &args.search {
64 info!("Searching for: {}", query);
65 let results = repo_manager.search_entities(query);
66
67 if results.is_empty() {
68 // No results found
69 } else {
70 for result in results {
71 println!(" {} [{}] - {}:{}:{} ({})",
72 result.name,
73 result.entity_type,
74 result.file_path.display(),
75 result.line_start,
76 result.line_end,
77 result.language
78 );
79 }
80 }
81 }
82
83 // 保存状态
84 if let Err(e) = repo_manager.save_state(&args.state_dir) {
85 warn!("Failed to save state: {}", e);
86 } else {
87 info!("Repository state saved to: {}", args.state_dir.display());

Callers

nothing calls this directly

Calls 5

initializeMethod · 0.80
get_repository_statsMethod · 0.80
search_entitiesMethod · 0.80
load_stateMethod · 0.45
save_stateMethod · 0.45

Tested by

no test coverage detected