ccc
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseccc - Semantic Code Search & Indexing
ccc - 语义代码搜索与索引
ccccccPrerequisites
前置条件
The current project must be initialized before or can be used. If either command fails with an error about missing initialization or the tool not being found, refer to management.md for installation and initialization instructions.
ccc searchccc index在使用或命令前,必须先初始化当前项目。如果任一命令因未初始化或未找到工具而报错,请参考management.md获取安装和初始化说明。
ccc searchccc indexSearching the Codebase
搜索代码库
To perform a semantic search:
bash
ccc search <query terms>The query should describe the concept, functionality, or behavior to find, not exact code syntax. For example:
bash
ccc search database connection pooling
ccc search user authentication flow
ccc search error handling retry logic要执行语义搜索:
bash
ccc search <query terms>查询语句应描述要查找的概念、功能或行为,而非精确的代码语法。例如:
bash
ccc search database connection pooling
ccc search user authentication flow
ccc search error handling retry logicFiltering Results
过滤结果
-
By language (, repeatable): restrict results to specific languages.
--langbashccc search --lang python --lang markdown database schema -
By path (): restrict results to a glob pattern relative to project root. If omitted, defaults to the current working directory (only results under that subdirectory are returned).
--pathbashccc search --path 'src/api/*' request validation
-
按语言筛选(,可重复使用):将结果限制为特定语言。
--langbashccc search --lang python --lang markdown database schema -
按路径筛选():将结果限制为相对于项目根目录的通配符模式。如果省略,默认使用当前工作目录(仅返回该子目录下的结果)。
--pathbashccc search --path 'src/api/*' request validation
Pagination
分页
Results default to the first page. To retrieve additional results:
bash
ccc search --offset 5 --limit 5 database schemaIf all returned results look relevant, use to fetch the next page — there are likely more useful matches beyond the first page.
--offset结果默认显示第一页。要获取更多结果:
bash
ccc search --offset 5 --limit 5 database schema如果返回的所有结果看起来都相关,使用参数获取下一页——第一页之外可能还有更多有用的匹配结果。
--offsetRefreshing the Index Before Search
搜索前刷新索引
To ensure the index reflects the latest code changes before searching:
bash
ccc search --refresh <query terms>This is equivalent to running followed by .
ccc indexccc search为确保搜索前索引反映最新的代码变更:
bash
ccc search --refresh <query terms>这等效于先运行,再运行。
ccc indexccc searchWorking with Search Results
处理搜索结果
Search results include file paths and line ranges. To explore a result in more detail:
- Use the editor's built-in file reading capabilities (e.g., the tool) to load the matched file and read lines around the returned range for full context.
Read - When working in a terminal without a file-reading tool, use to extract a specific line range.
sed -n '<start>,<end>p' <file>
搜索结果包含文件路径和行号范围。要更详细地查看结果:
- 使用编辑器内置的文件读取功能(例如工具)加载匹配的文件,并读取返回范围附近的行以获取完整上下文。
Read - 在没有文件读取工具的终端中,使用命令提取特定行范围。
sed -n '<start>,<end>p' <file>
Updating the Index
更新索引
After making code changes, update the index to keep search results current:
bash
ccc indexThis blocks until indexing completes, showing progress. If indexing is already in progress, it waits for completion.
Run proactively after significant code changes (new files, refactors, renamed modules) to ensure subsequent searches return accurate results.
ccc index代码变更后,更新索引以保持搜索结果的时效性:
bash
ccc index该命令会阻塞直到索引完成,并显示进度。如果索引已在进行中,它会等待完成。在重大代码变更(新增文件、重构、重命名模块)后,建议主动运行,以确保后续搜索返回准确结果。
ccc indexManagement & Troubleshooting
管理与故障排除
For installation, initialization, daemon management, troubleshooting, and cleanup commands, see management.md.
关于安装、初始化、守护进程管理、故障排除和清理命令,请参考management.md。