AST-based structural code search and syntax outline tool powered by ast-grep.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-tool-ast-grep
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Jaylor-Wang/dsh-tool-ast-grep
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
English | 中文
AST-based structural code search and outline plugin for DeepSeek Harness (DSH), powered by ast-grep.
Provides structural code searching and outline inspection capabilities for coding agents, dramatically outperforming traditional regular expression search (grep) in token efficiency and semantic accuracy.
Features
ast_search: Search code structures using AST patterns and meta-variables ($NAME,$$$).- Finds structural patterns across multiple lines regardless of formatting or whitespace.
- Supports node kind queries (e.g.
function_declaration,interface_declaration,class_declaration). - Supports strictness modes (
smart,relaxed,ast,cst). - Supports file path and glob filtering.
ast_outline: Extract an ultra-compact structural outline (functions, classes, types, interfaces, exports) from a source file.- Saves 80%–95% tokens compared to reading the entire file.
- Supports depth control (top-level vs. nested methods).
- Zero Shell Quoting Issues: Invoked safely via child processes with JSON streaming — immune to Windows shell argument escaping and quoting pitfalls.
Prerequisites
This plugin requires ast-grep CLI installed on your machine:
- npm:
npm install -g @ast-grep/cli - pip:
pip install ast-grep-cli - cargo:
cargo install ast-grep --locked - brew (macOS/Linux):
brew install ast-grep
Verify with:
ast-grep --version
Tip for custom installations: If
ast-grepis installed in a non-standard location or custom npm prefix, the plugin will automatically probe directories in yourPATH. You can also set theAST_GREP_PATHenvironment variable to its full path directly.
Installation in DSH
Option 1: Via DSH Market (Recommended)
Once published and indexed, search for dsh-tool-ast-grep in Settings → Plugin Market and click Install.
Or run in terminal:
dsh plugin --profile web add dsh-tool-ast-grep
Option 2: Mount in an Agent Preset
In your agent configuration (e.g. ~/.dsh/.agent-presets/your-agent/agent.cordis.yml):
id: my-agent
name: My Agent
tools:
- id: tool-ast-grep
name: dsh-tool-ast-grep
config:
maxResults: 50
timeoutMs: 60000
Tool API Overview
1. ast_search
| Parameter | Type | Description |
|---|---|---|
pattern |
string |
AST pattern, e.g. function $NAME($$$) { $$$ } or $OBJ.push($ITEM) |
kind |
string |
AST node kind, e.g. class_declaration, function_declaration |
path |
string |
Directory or file path to search in (defaults to workspace root) |
lang |
string |
Language override (ts, tsx, js, jsx, python, rust, go, etc.) |
globs |
string |
File glob pattern to include/exclude (e.g. src/**/*.ts) |
limit |
integer |
Max matches to return (default: 50) |
2. ast_outline
| Parameter | Type | Description |
|---|---|---|
file_path |
string |
Path of the file to inspect |
lang |
string |
Language override (auto-detected if omitted) |
depth |
integer |
1 for top-level only (default), 2 to include class methods |
Supported Languages
TypeScript (ts, tsx), JavaScript (js, jsx), Python (py), Rust (rs), Go (go), Java (java), C (c, h), C++ (cpp, hpp, cc).
License
MIT © Jaylor Wang (Jaylor-Wang)
Links
More in this category
DayuanJiang/next-ai-draw-io#dsh-plugin★ 36548
Draws draw.io diagrams in DeepSeek Harness through the next-ai-drawio MCP server: the link in the reply opens a live preview in the right sidebar, you can edit the diagram by hand, and each AI change is a version you can restore. Node.js 18+; npx downloads the MCP server on first use.
Tencent/WeKnora#dsh-weknora★ 36201
Four read-only tools over a WeKnora knowledge base: list knowledge bases, hybrid passage search, reassemble one document's chunks in order, and WeKnora's own cited RAG or ReAct-agent answer with a resumable session id.
superdesigndev/treg★ 6962
Tool catalog for agents: search ~2,600 external endpoints (SEO and SERP, backlinks, social, people and company enrichment, ad libraries, scraping) by the task you want done, read each one's parameters and per-call price, then call it with the credential injected server-side. Ships the skill plus an MCP row that stays disabled until TREG_TOKEN is set.
T-Auto/dsh-ops★ 5011
Provides bash, PowerShell 7, and high-performance Rust tools for DSH on Windows to reduce token usage.
sixtysevenlf/dsh-blender-plugin★ 1536
Lets a DSH agent drive a local Blender over a direct TCP channel with 15 tools: viewport frames, custom-angle renders, Python execution, headless and job offload, transaction rollback, and a planning layer of 228 ops across 34 families.
TencentCloudBase/CloudBase-AI-Toolkit#dsh-plugin★ 1153
Tencent CloudBase backend for DeepSeek Harness — scaffold and deploy full-stack apps from chat, render query results as table cards with paging, sorting and CSV export, preview a deployment on its domain, and call the CloudBase MCP toolset (`mcp__cloudbase__*`) with device-code login.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.