Ccc

作者 cocoindex-iob883be0b5d76无许可证2.7K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库昨天更新

This skill should be used when code search is needed (whether explicitly requested or as part of completing a task), when indexing the codebase after changes, or when the user asks about ccc, cocoindex-code, or the codebase index. Trigger phrases include 'search the codebase', 'find code related to', 'update the index', 'ccc', 'cocoindex-code'.

AI 生成的概览

指导智能体使用 ccc 命令行工具进行语义化代码搜索和代码库索引管理。

功能
该技能指导智能体操作 CocoIndex Code 的 ccc 命令行工具,用于对项目代码库进行语义搜索并管理索引生命周期。内容包括用自然语言查询执行搜索、按语言或路径过滤结果、分页获取更多结果,以及初始化和刷新索引。它还指向随附的参考文件,用于安装、设置和故障排查。
适用场景
当需要代码搜索时使用,无论是用户明确要求还是作为其他任务的一部分;也适用于代码变更后需要创建或刷新代码库索引的场景。当用户提到 ccc、cocoindex-code 或代码库索引时同样适用。
运行要求
需要安装 ccc 命令行工具(CocoIndex Code)并可在命令行中调用,同时需要一个可初始化并建立索引的项目目录。该技能不包含脚本,仅附带两份关于管理和设置的参考文档;安装说明以引用方式提供,而非由技能执行。

ccc - Semantic Code Search & Indexing

ccc is the CLI for CocoIndex Code, providing semantic search over the current codebase and index management.

Ownership

The agent owns the ccc lifecycle for the current project — initialization, indexing, and searching. Do not ask the user to perform these steps; handle them automatically.

  • Initialization: If ccc search or ccc index fails with an initialization error (e.g., "Not in an initialized project directory"), run ccc init from the project root directory, then ccc index to build the index, then retry the original command.
    • Exception: if ccc index refuses because the directory holds ccc's user settings directory (usually your home directory), do not run ccc init there. Run ccc from inside the project instead, or ask the user which project to use.
    • Exception: if a ccc note says the project in use is that directory (a repo below it has no project of its own), tell the user. Do not run ccc reset there yourself: whether it should stay a project is the user's call.
  • Index freshness: Keep the index up to date by running ccc index (or ccc search --refresh) when the index may be stale — e.g., at the start of a session, or after making significant code changes (new files, refactors, renamed modules). There is no need to re-index between consecutive searches if no code was changed in between.
  • Installation: If ccc itself is not found (command not found), refer to management.md [blocked] for installation instructions and inform the user.

Searching 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 poolingccc search user authentication flowccc search error handling retry logic

Filtering Results

  • By language (--lang, repeatable): restrict results to specific languages.

    bash
    ccc search --lang python --lang markdown database schema
  • By path (--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).

    bash
    ccc 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 schema

If all returned results look relevant, use --offset to fetch the next page — there are likely more useful matches beyond the first page.

Working 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 Read tool) to load the matched file and read lines around the returned range for full context.
  • When working in a terminal without a file-reading tool, use sed -n '<start>,<end>p' <file> to extract a specific line range.

Settings

To view or edit embedding model configuration, include/exclude patterns, or language overrides, see settings.md [blocked].

Management & Troubleshooting

For installation, initialization, daemon management, troubleshooting, and cleanup commands, see management.md [blocked].

来源与署名

来源:cocoindex-io/cocoindex-code位于skills/ccc提交b883be0

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架