Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ testdata/repos
testdata/jsons

src/lang/testdata
*.json
!ts-parser/**/*.json

tools
abcoder

!testdata/asts/*.json
178 changes: 88 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,101 +25,40 @@ see [UniAST Specification](docs/uniast-zh.md)


# Quick Start
## Use ABCoder as a MCP server

1. Install ABCoder:

```bash
go install github.com/cloudwego/abcoder@latest
```

2. Use ABCoder to parse a repository to UniAST (JSON)

```bash
abcoder parse {language} {repo-path} -o xxx.json
```

ABCoder will try to install any dependency automatically.
In case of failure (or if you want to customize installation), refer to the [docs](./docs/lsp-installation-en.md).

For example, to parse a Go repository:

```bash
git clone https://github.com/cloudwego/localsession.git localsession
abcoder parse go localsession -o /abcoder-asts/localsession.json
```


3. Integrate ABCoder's MCP tools into your AI agent.

```json
{
"mcpServers": {
"abcoder": {
"command": "abcoder",
"args": [
"mcp",
"{the-AST-directory}"
]
}
}
}
```


4. Enjoy it!

Try to click and watch the video below:

<div align="center">

[<img src="images/abcoder-hertz-trae.png" alt="MCP" width="500"/>](https://www.bilibili.com/video/BV14ggJzCEnK)

</div>


## Tips:

- You can add more repo ASTs into the AST directory without restarting abcoder MCP server.

- Try to use [the recommended prompt](llm/prompt/analyzer.md) and combine planning/memory tools like [sequential-thinking](https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking) in your AI agent.


## Claude Code Integration

ABCoder provides deep integration with [Claude Code](https://claude.ai/code) through the AST-Driven Coding workflow, enabling hallucination-free code analysis and precise execution.
ABCoder provides deep integration with [Claude Code](https://claude.ai/code) through the AST-Driven Coding workflow, enabling hallucination-free code analysis and precise execution. Check [Claude Code Specification](docs/claude-code-spec.md) for more details.

### Setup

1. **Install ABCoder Claude Configuration**

Copy [`docs/.claude/`](docs/.claude/) to your home directory or project root:
Use the `init-spec` command to automatically configure Claude Code integration for your project:

```bash
cp -r docs/.claude ~/
```
```bash
# Install ABCoder
go install github.com/cloudwego/abcoder@latest

2. **Configure ABCoder MCP Server**
# Run init-spec in your project directory (optional: specify target path)
cd /path/to/your/project
abcoder init-spec
```

Configure in Claude Code's `~/.claude.json` (the hook uses `abcoder parse go/ts . -o ~/.asts/repo.json` for the default AST folder):
The `init-spec` command will:
1. Copy `.claude` directory to your project root
2. Configure MCP servers in `~/.claude.json`:
- `abcoder`: for code analysis using AST
- `sequential-thinking`: for complex problem decomposition
3. Replace all `{{CLAUDE_HOME_PATH}}` placeholders with actual project paths

```json
{
"mcpServers": {
"abcoder": {
"command": "abcoder",
"args": ["mcp", "~/.asts"]
}
}
}
```
### Start Coding with Claude Code

3. **Configure Hooks**
Once setup, you can start coding with Claude Code:

Claude Code will automatically read hooks from [`~/.claude/settings.json`](docs/.claude/settings.json) to enable:
- Auto-detect language and generate AST before calling `mcp__abcoder` tools
- Display ABCoder workflow SOP to Claude after `list_repos`
- Remind to call `get_ast_node` recursively
1. Start Claude Code in your project directory
2. Use slash common `/abcoder:schedule <problem_desc>` to address your feature/requirement/issue, and ABCoder will help you analyze the codebase and design a technical solution.
3. Once all questions are set, use slash common `/abcoder:task <task_name>` to create a coding task(specification)
4. Recheck the task using `/abcoder:recheck <task_name>` before real implementation
5. Begin coding! Claude Code will process the task step by step according to the specification, leveraging the power of AST-driven analysis.

### AST-Driven Coding Workflow

Expand All @@ -137,7 +76,7 @@ list_repos → get_repo_structure → get_package_structure → get_file_structu

| Command | Function | Description |
|---------|----------|-------------|
| [`/abcoder:schd`](docs/.claude/commands/abcoder:schd.md) | Design implementation | Analyze codebase using ABCoder, design technical solution |
| [`/abcoder:schedule` <task_desc>](docs/.claude/commands/abcoder:schedule.md) | Design implementation | Analyze codebase by using ABCoder, design technical solution |
| [`/abcoder:task <name>`](docs/.claude/commands/abcoder:task.md) | Create coding task | Generate standardized CODE_TASK document |
| [`/abcoder:recheck <task>`](docs/.claude/commands/abcoder:recheck.md) | Verify solution | Critically check CODE_TASK feasibility, useful when a CODE_TASK contains external dependencies |

Expand All @@ -147,7 +86,7 @@ list_repos → get_repo_structure → get_package_structure → get_file_structu
User Request
/abcoder:schd ──────────→ Design Solution (ABCoder Analysis)
/abcoder:schedule ──────────→ Design Solution (ABCoder Analysis)
│ │
▼ ▼
/abcoder:task ─────────→ CODE_TASK (with Technical Specs, including accurate `get_ast_node` call args)
Expand All @@ -156,7 +95,7 @@ User Request
/abcoder:recheck ────→ Verify Solution (ABCoder Validation. After `/abcoder:task` Claude Code will tell you what the external dependencies CODE_TASK contains, use `/abcoder:recheck` to analyze external ast_node and technical detail with ABCoder)
│ │
▼ ▼
sub-agent ─────────→ Execute Implementation
Start coding(sub-agent) ─────────→ Execute Implementation
```

### Configuration Files
Expand All @@ -166,19 +105,78 @@ sub-agent ─────────→ Execute Implementation
| [`CLAUDE.md`](docs/.claude/CLAUDE.md) | Core AST-Driven Coder role definition |
| [`settings.json`](docs/.claude/settings.json) | Hooks and permissions configuration |
| [`hooks/`](docs/.claude/hooks/) | Automation scripts (parse/prompt/reminder) |
| [`commands/`](docs/.claude/commands/) | Slash command definitions (abcoder:task/abcoder:schd/abcoder:recheck) |
| [`tmpls/CODE_TASK.md`](docs/.claude/tmpls/CODE_TASK.md) | Coding task template |
| [`commands/`](docs/.claude/commands/) | Slash command definitions (abcoder:task/abcoder:schedule/abcoder:recheck) |
| [`tmpls/ABCODER_CODE_TASK.md`](docs/.claude/tmpls/ABCODER_CODE_TASK.md) | Coding task template |

### Dependencies

- Claude Code CLI
- abcoder MCP server (provides `mcp__abcoder` tools)
- sequential-thinking MCP server (provides `mcp__sequential_thinking` tools, optional)
- ABCoder MCP server (provides `mcp__abcoder` tools)
- Sequential-thinking MCP server (provides `mcp__sequential_thinking` tools, automatically configured by init-spec)

> For detailed configuration, see [docs/.claude/README.md](docs/.claude/README.md)

> Watch the demo video [here](https://github.com/cloudwego/abcoder/pull/141)

## Use ABCoder as a MCP server

1. Install ABCoder:

```bash
go install github.com/cloudwego/abcoder@latest
```

2. Use ABCoder to parse a repository to UniAST (JSON)

```bash
abcoder parse {language} {repo-path} -o xxx.json
```

ABCoder will try to install any dependency automatically.
In case of failure (or if you want to customize installation), refer to the [docs](./docs/lsp-installation-en.md).

For example, to parse a Go repository:

```bash
git clone https://github.com/cloudwego/localsession.git localsession
abcoder parse go localsession -o /abcoder-asts/localsession.json
```


3. Integrate ABCoder's MCP tools into your AI agent.

```json
{
"mcpServers": {
"abcoder": {
"command": "abcoder",
"args": [
"mcp",
"{the-AST-directory}"
]
}
}
}
```


4. Enjoy it!

Try to click and watch the video below:

<div align="center">

[<img src="images/abcoder-hertz-trae.png" alt="MCP" width="500"/>](https://www.bilibili.com/video/BV14ggJzCEnK)

</div>


## Tips:

- You can add more repo ASTs into the AST directory without restarting abcoder MCP server.

- Try to use [the recommended prompt](llm/prompt/analyzer.md) and combine planning/memory tools like [sequential-thinking](https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking) in your AI agent.


## Use ABCoder as an Agent (WIP)

Expand Down
11 changes: 0 additions & 11 deletions docs/.claude/hooks/abcoder/reminder.sh

This file was deleted.

43 changes: 0 additions & 43 deletions docs/.claude/settings.json

This file was deleted.

10 changes: 5 additions & 5 deletions docs/.claude/README.md → docs/claude-code-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Claude Code 的 AST 驱动开发配置,通过 MCP 工具、钩子和斜杠命
│ └── reminder.sh # 提醒递归调用 get_ast_node
├── commands/ # 斜杠命令定义
│ ├── abcoder:task.md # /abcoder:task - 创建编码任务
│ ├── abcoder:schd.md # /abcoder:schd - 设计实现方案
│ ├── abcoder:schedule.md # /abcoder:schedule - 设计实现方案
│ └── abcoder:recheck.md # /abcoder:recheck - 技术方案核对
└── tmpls/ # 文档模板
└── CODE_TASK.md # 编码任务模板
Expand Down Expand Up @@ -63,7 +63,7 @@ list_repos → get_repo_structure → get_package_structure → get_file_structu

## 斜杠命令

### /abcoder:task <名称>
### /abcoder:task <任务名称>

创建 CODE_TASK 文档,生成 `./task/{{MMDD}}/{{NAME}}__CODE_TASK.md`

Expand All @@ -73,7 +73,7 @@ list_repos → get_repo_structure → get_package_structure → get_file_structu
- 涉及 curl: 提供完整命令和响应结构
- 提供具体验证方法

### /abcoder:schd
### /abcoder:schedule <任务描述>

使用 mcp__abcoder 设计实现方案

Expand All @@ -82,7 +82,7 @@ list_repos → get_repo_structure → get_package_structure → get_file_structu
- 优先最小改动
- 禁止编写代码、禁止使用 agent

### /abcoder:recheck <任务>
### /abcoder:recheck <任务名称>

批判性检查 CODE_TASK 技术可行性

Expand All @@ -97,7 +97,7 @@ list_repos → get_repo_structure → get_package_structure → get_file_structu
用户需求
/abcoder:schd ──────────────→ 设计方案(abcoder分析)
/abcoder:schedule ──────────────→ 设计方案(abcoder分析)
│ │
▼ ▼
/abcoder:task ────────→ CODE_TASK(含技术规格)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Claude Code 斜杠命令定义,用于规范化和自动化开发工作流。

**执行流程**:
1. 创建 `./task/{{MMDD}}/` 目录
2. 读取模板 `~/.claude/tmpls/CODE_TASK.md`
2. 读取模板 `{{CLAUDE_HOME_PATH}}/.claude/tmpls/ABCODER_CODE_TASK.md`
3. 根据任务上下文填充模板,生成 `./task/{{MMDD}}/{{NAME}}__CODE_TASK.md`
4. 列出外部依赖包(如有)
5. 提示创建成功
Expand All @@ -30,7 +30,7 @@ Claude Code 斜杠命令定义,用于规范化和自动化开发工作流。

---

### /abcoder:schd - 设计实现方案
### /abcoder:schedule - 设计实现方案

使用 mcp__abcoder 分析代码库,设计技术实现方案。

Expand Down Expand Up @@ -66,7 +66,7 @@ Claude Code 斜杠命令定义,用于规范化和自动化开发工作流。

## 模板文件

### CODE_TASK.md
### ABCODER_CODE_TASK.md

编码任务模板,定义任务清单格式。

Expand All @@ -89,7 +89,7 @@ Claude Code 斜杠命令定义,用于规范化和自动化开发工作流。
用户需求
/abcoder:schd ──────────────→ 设计方案(abcoder分析)
/abcoder:schedule ──────────────→ 设计方案(abcoder分析)
│ │
▼ ▼
/abcoder:task ────────→ CODE_TASK(含技术规格)
Expand All @@ -104,11 +104,11 @@ coding-executor ──────→ 执行实现
## 文件位置

```
~/.claude/
{{CLAUDE_HOME_PATH}}/.claude/
├── commands/
│ ├── abcoder:task.md
│ ├── abcoder:schd.md
│ ├── abcoder:schedule.md
│ └── abcoder:recheck.md
└── tmpls/
└── CODE_TASK.md
└── ABCODER_CODE_TASK.md
```
Loading
Loading