JohnXu22786/semantic-search2

dsh-semantic-search

用于本地语义代码搜索的 DSH 插件,支持构建代码片段级索引并回答自然语言查询。

AI 分析

核心用途是为本地工作区构建混合向量与 BM25 的代码索引,允许 Agent 进行语义搜索。适合需要快速定位代码实现、跨文件查找关联逻辑的开发任务。

套件
dsh-semantic-search
版本
0.1.0
授權
MIT
最近更新
2026年9月12日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:JohnXu22786/semantic-search

CLI usage

sema index                build the full index from the workspace
sema reindex [--full]     incremental refresh (or full rebuild with --full)
sema search     hybrid vector + BM25 search, prints top hits
sema stats [--json]       index health, provider, and sizing numbers

Global options:

--root           workspace root (default: current directory)
--data-dir       index storage directory (default: /.sema)
--provider      embedding provider: lexical | openai (default: lexical)
--dim              embedding dimension (lexical default: 4096; openai 0 = auto)
--base-url       OpenAI-compatible embeddings endpoint base URL
--model         embeddings model name (openai only)
--api-key        API key (openai only; env: SEMA_EMBEDDING_API_KEY)
--top              hits to print for search (default: 20)
--json                machine-readable output where supported
--help                show this help

CLI exit codes

  • 0 — success (including a search with zero hits and a --version/--help call).
  • 1 — a runtime failure (config error, build/index/search error).
  • 2 — a usage error: unknown command, unknown flag, or a missing query.

Configuration

The plugin is configurable through the bundle row's config (see cordis.patch.yml for an example), the CLI flags above, or defaults in code:

OptionDefaultMeaning
rootcwdworkspace root to index
dataDir.semaindex storage directory
provider.kindlexicallexical (offline) or openai
provider.dimension0 (lexical: 4096)embedding dimension; 0 = auto-infer from the endpoint
provider.baseUrlhttps://api.openai.com/v1OpenAI-compatible endpoint root
provider.modeltext-embedding-3-smallembedding model name
provider.apiKeyEnvSEMA_EMBEDDING_API_KEYenv var holding the API key
allowFallbacktruefall back to the lexical provider when a remote one fails
include / ignoredefaultsglob sets of files to index / skip
maxLinesPerChunk80hard chunk size upper bound
nGram2CJK n-gram size (1 disables n-gramming)
topK20hits returned by default
rrfK60RRF fusion constant
vectorK300candidates per channel before fusion
autosavetruepersist the index after builds
autoIndextruebuild lazily on first search
watchtruewatch the workspace for changes