sourcebot
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSourcebot Guide
Sourcebot使用指南
Expert guidance for using Sourcebot MCP to search external libraries, frameworks, and code patterns.
为使用Sourcebot MCP搜索外部库、框架和代码模式提供专业指导。
When to Use
适用场景
- External library research: Finding code patterns in Effect-TS, TanStack, Vercel AI SDK, etc.
- API discovery: Understanding how external libraries implement specific features
- Documentation examples: Finding real-world usage examples from official repositories
- Framework patterns: Learning best practices from external framework codebases
- Migration guidance: Finding upgrade patterns and breaking changes in external libraries
- **外部库调研:**查找Effect-TS、TanStack、Vercel AI SDK等中的代码模式
- **API探索:**了解外部库如何实现特定功能
- **文档示例:**从官方仓库查找实际使用示例
- **框架模式:**从外部框架代码库学习最佳实践
- **迁移指导:**查找外部库的升级模式和破坏性变更
When NOT to Use
不适用场景
- Local project code: Use or
codebase_searchinsteadosgrep search - Local components: Use local search tools for project files
- Local utilities: Never use Sourcebot for your own codebase
- **本地项目代码:**请改用或
codebase_searchosgrep search - **本地组件:**使用本地搜索工具查找项目文件
- **本地工具函数:**绝对不要使用Sourcebot搜索你自己的代码库
Required Workflow
必选工作流
- First, call to get available repository IDs
list_repos - Identify relevant repository ID(s) for your search (e.g., "Effect-TS/effect" for EffectTS)
- Always include when calling
filterByRepoIdssearch_code - Use to fetch specific file contents when needed
get_file_source
- **首先调用**获取可用的仓库ID
list_repos - 确定你要搜索的相关仓库ID(例如EffectTS对应的是"Effect-TS/effect")
- 调用时必须传入
search_code参数filterByRepoIds - **需要时使用**获取指定文件的内容
get_file_source
Repository ID Format
仓库ID格式
- CRITICAL: Repository IDs must be in format (e.g.,
"owner/repo","Effect-TS/effect")"vercel/ai" - DO NOT include the prefix
github.com/ - The tool returns IDs like
list_repos- strip the prefix when using in"github.com/owner/repo"filterByRepoIds
- **重要提示:**仓库ID必须遵循格式(例如
"所有者/仓库名"、"Effect-TS/effect")"vercel/ai" - 不要包含前缀
github.com/ - 工具返回的ID格式为
list_repos——在"github.com/所有者/仓库名"中使用时需要去掉前缀filterByRepoIds
Usage Examples
使用示例
Searching EffectTS patterns
搜索EffectTS模式
json
{
"query": "Effect.gen yield",
"filterByRepoIds": ["Effect-TS/effect"],
"includeCodeSnippets": true
}json
{
"query": "Effect.gen yield",
"filterByRepoIds": ["Effect-TS/effect"],
"includeCodeSnippets": true
}Searching AI SDK
搜索AI SDK
json
{
"query": "streamText tool calling",
"filterByRepoIds": ["vercel/ai"],
"includeCodeSnippets": true
}json
{
"query": "streamText tool calling",
"filterByRepoIds": ["vercel/ai"],
"includeCodeSnippets": true
}Searching multiple repos
搜索多个仓库
json
{
"query": "error handling patterns",
"filterByRepoIds": ["Effect-TS/effect", "vercel/ai"],
"includeCodeSnippets": true
}json
{
"query": "error handling patterns",
"filterByRepoIds": ["Effect-TS/effect", "vercel/ai"],
"includeCodeSnippets": true
}Best Practices
最佳实践
- Use descriptive queries (not just keywords, but full descriptions)
- Always specify to scope searches
filterByRepoIds - Set when you need actual code examples
includeCodeSnippets: true - Use after finding relevant files to see full context
get_file_source
- 使用描述性的查询语句(不要只输入关键词,而是输入完整的描述)
- 始终指定来限定搜索范围
filterByRepoIds - 当你需要实际代码示例时,设置
includeCodeSnippets: true - 找到相关文件后使用查看完整上下文
get_file_source
Tool Hierarchy for Code Search
代码搜索工具优先级
- Sourcebot - For EXTERNAL libraries and frameworks only
- (if available) - For local project code
codebase_search - - For local code when codebase_search unavailable
osgrep search - /
grep- Last resort for exact string matchingfind
- Sourcebot - 仅适用于外部库和框架
- (如果可用) - 适用于本地项目代码
codebase_search - - 当codebase_search不可用时用于搜索本地代码
osgrep search - /
grep- 精确字符串匹配的最后选择find
Critical Requirements
关键要求
- MANDATORY: Use Sourcebot MCP 5-7 times when researching external libraries
- CRITICAL: NEVER use Sourcebot to search local project code
- CRITICAL: Always use on EVERY
filterByRepoIdscallsearch_code - TASK INVALIDATION: Task will be invalidated if you don't use Sourcebot 5-7 times when dealing with external libraries
- AFTER SOURCEBOT: Also use Perplexity and Context7 for updated information on external libraries
- **强制要求:**调研外部库时需要使用Sourcebot MCP 5-7次
- **重要提示:**绝对不要使用Sourcebot搜索本地项目代码
- **重要提示:**每次调用时都必须使用
search_codefilterByRepoIds - **任务失效规则:**处理外部库相关任务时如果未使用Sourcebot 5-7次,任务将被判定为无效
- **使用Sourcebot之后:**还可以使用Perplexity和Context7获取外部库的最新信息",