薯饼
一个语义代码搜索引擎,使用嵌入和AST感知分块对代码库进行索引和搜索。
快速入门
go install github.com/owner/hashbrown/cmd/hashbrown@latest
cd /path/to/your/repo
export VOYAGE_API_KEY=your-key-here
hashbrown init
hashbrown "how does authentication work"特性
- 混合搜索 --将语义(基于嵌入)和关键字(BM25)搜索与互序融合相结合
- AST感知分块 --树保姆解析源文件,以创建与函数、类和方法对齐的语义上有意义的块
- 11种语言 --Go、Python、Rust、TypeScript、JavaScript、C、C++、Java、Ruby、Kotlin、Swift
- 调用图 --提取函数调用关系和与搜索结果相关的代码
- 增量更新 —
hashbrown update仅使用git diff重新索引更改的文件 - MCP服务器 —
hashbrown mcp通过模型上下文协议为AI编码助手提供搜索和索引工具 - 平行索引 -对于大型存储库,树型对象解析和嵌入API调用是并行的
- 诊断 —
hashbrown doctor检查配置、API连接和索引运行状况
命令
| 命令 | 描述 |
|---|---|
hashbrown init | 为当前存储库建立索引 |
hashbrown "query" | 搜索(隐式搜索命令) |
hashbrown search "query" | 使用显式命令搜索 |
hashbrown update | 逐步更新索引 |
hashbrown status | 显示索引状态 |
hashbrown gc | 垃圾回收未使用的嵌入 |
hashbrown doctor | 诊断配置和连接 |
hashbrown mcp | 启动MCP服务器进行AI代理集成 |
回购拓扑
配置
配置存储在 .hashbrown/config.toml。由自动创建 hashbrown init.
嵌入
| 关键字 | 类型 | 默认值 | 描述 |
|---|---|---|---|
embedding.provider | 字符串 | "voyage" | 嵌入提供程序: voyage, openai, ollama, custom |
embedding.model | 字符串 | "voyage-code-3" | 型号标识符 |
embedding.endpoint | 字符串 | (提供程序默认值) | API端点URL |
embedding.api_key_env | string | (提供程序默认值) | API键的环境变量名称 |
embedding.dimensions | int | 1024 | 嵌入向量维度 |
embedding.concurrency | int | 1 | 并发嵌入API请求数 |
搜索
| 关键字 | 类型 | 默认值 | 描述 |
|---|---|---|---|
search.top_k | int | 10 | 最大结果数 |
search.mode | 字符串 | "hybrid" | 搜索模式: hybrid, semantic, keyword |
search.rrf_k | int | 60 | 互易秩融合常数 |
分块
| 关键字 | 类型 | 默认值 | 描述 |
|---|---|---|---|
chunking.max_chunk_tokens | int | 1500 | 每个区块的最大令牌数 |
chunking.min_chunk_tokens | int | 20 | 每个块的最小令牌(较小的块被丢弃) |
回购协议
| 关键字 | 类型 | 默认值 | 描述 |
|---|---|---|---|
repos.paths | 列表 | [] | 保留用于未来的多仓库编排。 hashbrown 当前仅索引/搜索当前存储库路径。 |
MCP集成
看 docs/agent-setup.md 有关将hashbrown与Claude Code、Cursor和Windsurf等AI编码助手集成的说明。
嵌入提供者
看 docs/providers.md 了解每个支持的嵌入提供程序的设置说明。
运营
看 文档/操作.md 用于操作说明,包括SQLite锁定注意事项。
