dsh-tgrep
huuthuan-nguyen/dsh-tgrep
用 Microsoft tgrep 的 trigram 索引搜索 shadow 内置 grep,显著加速中大型仓库代码搜索,兼容 Web 搜索结果卡与 PTC
安装
dsh plugin --profile web add github:huuthuan-nguyen/dsh-tgrepREADME
dsh-tgrep
Shadow the built-in grep tool in DeepSeek Harness with Microsoft tgrep (trigram-indexed fast regex search).
Provides orders-of-magnitude faster code searches on medium-to-large repositories while retaining full compatibility with DeepSeek Harness's interactive Web GUI search cards and Programmatic Tool Calling (PTC) mode.
Features
- Trigram-indexed search: Instant query latency across millions of lines of code using
tgrep. - Full Web GUI integration: Generates structured search metadata so DeepSeek Harness renders native expandable file groups, match counters, and quick jumps.
- Graceful degradation: Searches directly if no index is built yet; automatically utilizes
tgrep servebackground daemon if running. - PTC & agent-plane shadowing: Scoped to each agent so it cleanly replaces built-in ripgrep without modifying stock system presets.
- Safe parameter handling: Immune to CLI flag injection (
--regexpand--boundaries); supports regex,includeglob filters, and case-insensitive flags. - Zero build steps: Pure modern ESM JavaScript — installs and runs directly without compiling.
Prerequisites
- Node.js:
>= 22.19.0 - Microsoft tgrep: Must be installed and available on
PATH.- macOS (Homebrew):
brew install tgrep - Cargo (Any platform with Rust):
cargo install tgrep - Pre-built binaries: Download from Microsoft tgrep Releases.
- macOS (Homebrew):
Installation
You do not need to clone or compile this repository manually. DeepSeek Harness installs it directly into any profile:
Method 1: Directly from NPM Registry (Recommended)
# For Web GUI profile
dsh plugin --profile web add dsh-tgrep
# Or for headless / TUI profile
dsh plugin --profile tui add dsh-tgrep
Method 2: Directly from GitHub (Without manual git clone)
You can also install straight from GitHub, optionally pinned to a release tag:
# Latest from default branch
dsh plugin --profile web add github:huuthuan-nguyen/dsh-tgrep
# Or pinned to a specific release tag
dsh plugin --profile web add github:huuthuan-nguyen/dsh-tgrep#v0.1.1
Method 3: From Local Checkout (For development/contributors)
dsh plugin --profile web add ./dsh-tgrep
Note: After installing, simply restart your DeepSeek Harness profile (e.g.
dsh webordsh --profile web).
Configuration
When installed, dsh-tgrep contributes a default configuration layer. You can customize settings in your profile's cordis.patch.yml or $DSH_HOME/cordis.patch.yml:
- insert:
- id: tgrep
name: dsh-tgrep
config:
# Enable or disable the plugin
enabled: true
# Prefer connecting to a running tgrep serve instance or local index
preferServer: true
# Soft limit on returned matches (model context protection)
maxLines: 300
# Extra CLI flags passed to tgrep (e.g. ["--hidden"])
extraArgs: []
Indexing Your Codebase (Optional but Recommended)
tgrep works out-of-the-box without an index by scanning files. For maximum speed in large workspaces:
- Build a local index:
cd /path/to/your/project tgrep index . - Or run a persistent search daemon:
tgrep servetgrepwill automatically connect to the background server for sub-millisecond queries.
Verification
To verify that the plugin is active:
- Start DeepSeek Harness:
dsh web - In the chat, ask the model:
Search for "name" in package.json using grep. - The model will invoke
greppowered bytgrep, and the matches will render inside the native Search card.
Uninstallation
To remove dsh-tgrep from your profile:
dsh plugin --profile web remove dsh-tgrep
License
MIT © 2025-present Thuan Nguyen