BC

boyter/cs

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

1080 stars 23 forks 质量 76 趋势 43MIT

codespelunker - CLI 代码搜索工具,理解代码结构并按相关性排序结果。支持 CLI、TUI、MCP 和 HTTP 无需索引。

概览

CS Powers searchcode.com——基于任何仓库的结构化代码智能,专为人工智能代理打造。 你有没有搜索过认证,结果从配置文件、评论和测试存根里找到了200个结果,才找到真正的实现?CS解决了这个问题。 它结合了CLI工具的速度和通常为Sourcegraph或Zoekt等重度索引搜索引擎保留的相关性排序,但无需维护索引。 [//]: # ([![asciicast](https://asciinema.org/a/589640.svg)](https://asciinema.org/a/589640)) https://github.com/user-attachments/assets/3b7f4bb2-d542-406d-9c53-29c0430dd60a 大多数搜索工具把代码当作纯文本。CS不会。 它会实时解析每个文件,以区分哪些是注释、哪些是字符串、哪些是代码,然后利用这些结构按相关性排序,而不仅仅是按出现次数列出。 它配备了 TUI 和 HTTP 模式,用于交互式探索。

概述(AI 翻译)

计算机科学的优势是 searchcode.com——构建结构化代码智能,适用于任何仓库,面向人工智能代理。

CLI 代码搜索工具,理解代码结构并按相关性排序结果。无需索引

你有没有搜索过authenticate,结果从配置文件、评论和测试存根中得到200个结果,才找到实际实现?cs解决了这个问题。

它结合了CLI工具的速度和通常只用于重度索引搜索引擎的相关性排序 类似Sourcegraph或Zoekt,但不需要维护索引。

在麻省理工学院获得执照。

CS TUI 演示

Pitch:为什么要用计算机?

大多数搜索工具将代码视为纯文本。cs 不会。

它会实时解析每个文件,以区分什么是注释、什么是字符串、什么是代码 然后用这个结构按相关性排序,而不仅仅是按发生次数列出。

它配备了 TUI 和 HTTP 模式,用于交互式探索。

它和ripgrep或grep有什么不同?

ripgrep 是一个快速的文本匹配器。它能找到行并打印出来。它是它所做事情中最的。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

codespelunker (cs)

cs powers searchcode.com — structured code intelligence over any repo, built for AI agents.

CLI code search tool that understands code structure and ranks results by relevance. No indexing required

Ever searched for authenticate and gotten 200 results from config files, comments, and test stubs before finding the actual implementation? cs fixes that.

It combines the speed of CLI tools with the relevance ranking usually reserved for heavy indexed search engines like Sourcegraph or Zoekt, but without needing to maintain an index.

cs "authenticate" --gravity=brain           # Find the complex implementation, not the interface
cs "FIXME OR TODO OR HACK" --only-comments  # Search only in comments, not code or strings
cs "error" --only-strings                   # Find where error messages are defined
cs "handleRequest" --only-declarations      # Jump straight to where it's defined
cs "handleRequest" --only-usages            # Find every call site, skip the definition
cs "error" --dedup                          # Collapse duplicated matches into one result

Licensed under MIT.

cs TUI demo

Pitch: Why use cs?

Most search tools treat code as plain text. cs doesn’t.

It parses every file on the fly to understand what is a comment, what is a string, and what is code then uses that structure to rank by relevance, not just list them by occurrence.

cs "authenticate"                    # BM25-ranked variant results, best match first
cs "authenticate" --gravity=brain    # Boost complex implementations over interfaces
cs "TODO" --only-comments            # Only matches inside comments
cs "error" --only-strings            # Only matches inside string literals
cs "config OR setup" lang:go         # Boolean queries with language filters
cs "handleRequest" --only-declarations  # Jump to definitions (func, class, def, etc.)
cs "config" --dedup                     # Collapse byte-identical matches

It comes with a TUI and HTTP mode for Interactive Exploration.

cs      # enter TUI mode from this location
cs -d   # enter HTTP mode on port 8080 by default

What makes it different from ripgrep or grep?

ripgrep is a fast text matcher. It finds lines and prints them. It’s the best at what it does.

cs is a search engine. It finds files, ranks by relevance, extracts the best snippet, and shows the most relevant results. Think Sourcegraph-quality ranked search as a CLI tool, no index required.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "codespelunker": { "command": "/path/to/cs", "args": ["--mcp", "--dir", "/path/to/codebase"] } } }