Skills Plugins MCP Prompt Model 导航 博客 资讯 我的中心

dsh-tool-ast-grep

基于 ast-grep 的语法级 AST 代码结构检索与大纲提取工具。

jaylor-wang @jaylor-wang ⬇ 2 ★ 1 main

安装

dsh plugin --profile web add github:jaylor-wang/dsh-tool-ast-grep
下载安装清单

需要可复现安装时,可在仓库后追加 #commit 固定提交。

基于 ast-grep 的语法级 AST 代码结构检索与大纲提取工具。

该插件未提供要点说明,请参考仓库 README。

  1. 安装并启动 DeepSeek Harness:npx @deepseek-ai/dsh web
  2. 在终端执行上面的安装命令(CLI 会解析插件并核验来源)
  3. 用 dsh plugins list 确认已安装,必要时重启 Harness 生效

插件以当前 dsh 进程的权限运行,安装时可能执行代码。请先通读仓库源码与许可证,确认无破坏性命令与越权访问;本站只做索引,不对第三方插件安全性作担保。

代码仓库github.com/jaylor-wang/dsh-tool-ast-grep
许可证MIT
主要语言main
下载量2
GitHub 星标1
最近推送2026-09-18
收录日期2026-09-19
分类工具与能力

事实信息来自公开插件目录快照(2026-10-01),介绍文案由本站再加工。

以下为插件仓库 README 全文(原始内容,由公开目录抓取整理)。

# dsh-tool-ast-grep

English | [中文](README.zh.md)

[![npm version](https://img.shields.io/npm/v/dsh-tool-ast-grep.svg)](https://www.npmjs.com/package/dsh-tool-ast-grep)
[![license](https://img.shields.io/github/license/Jaylor-Wang/dsh-tool-ast-grep.svg)](LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/Jaylor-Wang/dsh-tool-ast-grep.svg)](https://github.com/Jaylor-Wang/dsh-tool-ast-grep/releases)

**AST-based structural code search and outline plugin for DeepSeek Harness (DSH)**, powered by [ast-grep](https://ast-grep.github.io/).

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**:
  ```bash
  npm install -g @ast-grep/cli
  ```
- **pip**:
  ```bash
  pip install ast-grep-cli
  ```
- **cargo**:
  ```bash
  cargo install ast-grep --locked
  ```
- **brew** (macOS/Linux):
  ```bash
  brew install ast-grep
  ```

Verify with:
```bash
ast-grep --version
```

---

## 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:
```bash
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`):

```yaml
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)

数据来源:公开的 DeepSeek Harness 插件目录与各插件 GitHub 仓库。本站为独立第三方目录,与 DeepSeek、幻方(High-Flyer)及插件作者均无隶属或背书关系。

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

提交后我们会发送一封确认邮件,点击邮件里的链接才会开始收信。

完全免费,取消任意时间。我们不会发送垃圾邮件。