feat: 添加 AST RepoMap 代码仓库地图功能

- 实现基于 Tree-sitter 的代码符号提取 (支持 TS/JS/Python)
- 实现 PageRank 算法进行符号相关性排序
- 支持个性化权重调整 (提及的标识符、聊天文件等)
- 添加磁盘缓存避免重复解析
- 集成 repo_map 工具到工具系统
- 添加 15 个单元测试
This commit is contained in:
2025-12-11 22:26:43 +08:00
parent 4beaf088d0
commit 9818e02ed1
19 changed files with 2352 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
Generate a repository map showing the most relevant code symbols (functions, classes, methods) based on AST analysis and PageRank ranking.
This tool analyzes the codebase structure using Tree-sitter AST parsing and ranks symbols by their relevance using the PageRank algorithm. It helps AI understand the code structure by showing:
- Important function and class definitions
- Their relationships through references
- Prioritized by relevance to the current context
Parameters:
- directory: Directory to analyze (default: current working directory)
- chat_files: Files currently being discussed (excluded from map output)
- mentioned_files: File names mentioned in conversation (boost relevance)
- mentioned_identifiers: Symbol names mentioned (boost relevance)
- max_tokens: Maximum output token count (default: 1024)
The output shows relevant code symbols organized by file, helping to understand:
- What functions/classes exist in the codebase
- How different parts of the code relate to each other
- Which symbols are most important based on usage patterns
Use this tool when you need to understand the overall structure of a codebase or find relevant code locations for a task.