sourcebot

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sourcebot 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
    codebase_search
    or
    osgrep search
    instead
  • Local components: Use local search tools for project files
  • Local utilities: Never use Sourcebot for your own codebase
  • **本地项目代码:**请改用
    codebase_search
    osgrep search
  • **本地组件:**使用本地搜索工具查找项目文件
  • **本地工具函数:**绝对不要使用Sourcebot搜索你自己的代码库

Required Workflow

必选工作流

  1. First, call
    list_repos
    to get available repository IDs
  2. Identify relevant repository ID(s) for your search (e.g., "Effect-TS/effect" for EffectTS)
  3. Always include
    filterByRepoIds
    when calling
    search_code
  4. Use
    get_file_source
    to fetch specific file contents when needed
  1. **首先调用
    list_repos
    **获取可用的仓库ID
  2. 确定你要搜索的相关仓库ID(例如EffectTS对应的是"Effect-TS/effect")
  3. 调用
    search_code
    时必须传入
    filterByRepoIds
    参数
  4. **需要时使用
    get_file_source
    **获取指定文件的内容

Repository ID Format

仓库ID格式

  • CRITICAL: Repository IDs must be in format
    "owner/repo"
    (e.g.,
    "Effect-TS/effect"
    ,
    "vercel/ai"
    )
  • DO NOT include the
    github.com/
    prefix
  • The
    list_repos
    tool returns IDs like
    "github.com/owner/repo"
    - strip the prefix when using in
    filterByRepoIds
  • **重要提示:**仓库ID必须遵循
    "所有者/仓库名"
    格式(例如
    "Effect-TS/effect"
    "vercel/ai"
  • 不要包含
    github.com/
    前缀
  • list_repos
    工具返回的ID格式为
    "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
    filterByRepoIds
    to scope searches
  • Set
    includeCodeSnippets: true
    when you need actual code examples
  • Use
    get_file_source
    after finding relevant files to see full context
  • 使用描述性的查询语句(不要只输入关键词,而是输入完整的描述)
  • 始终指定
    filterByRepoIds
    来限定搜索范围
  • 当你需要实际代码示例时,设置
    includeCodeSnippets: true
  • 找到相关文件后使用
    get_file_source
    查看完整上下文

Tool Hierarchy for Code Search

代码搜索工具优先级

  1. Sourcebot - For EXTERNAL libraries and frameworks only
  2. codebase_search
    (if available) - For local project code
  3. osgrep search
    - For local code when codebase_search unavailable
  4. grep
    /
    find
    - Last resort for exact string matching
  1. Sourcebot - 仅适用于外部库和框架
  2. codebase_search
    (如果可用) - 适用于本地项目代码
  3. osgrep search
    - 当codebase_search不可用时用于搜索本地代码
  4. 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
    filterByRepoIds
    on EVERY
    search_code
    call
  • 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_code
    时都必须使用
    filterByRepoIds
  • **任务失效规则:**处理外部库相关任务时如果未使用Sourcebot 5-7次,任务将被判定为无效
  • **使用Sourcebot之后:**还可以使用Perplexity和Context7获取外部库的最新信息",