Skip to content

Commit 06cb182

Browse files
committed
feat: add Claude Code plugin workflow enforcement
- add Claude Code plugin manifest, default agent, hooks, and workflow guard - document remote third-party marketplace usage and local testing path - add plugin and workflow guard tests and clean subprocess shutdown handling
1 parent b128912 commit 06cb182

18 files changed

Lines changed: 965 additions & 29 deletions

.claude-plugin/plugin.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "autocode-mcp",
3+
"version": "0.4.1",
4+
"description": "Claude Code plugin for competitive programming problem-setting workflows.",
5+
"author": {
6+
"name": "SummerOneTwo",
7+
"url": "https://github.com/SummerOneTwo"
8+
},
9+
"homepage": "https://github.com/SummerOneTwo/AutoCode",
10+
"repository": "https://github.com/SummerOneTwo/AutoCode",
11+
"license": "MIT",
12+
"keywords": ["claude-code", "plugin", "competitive-programming", "mcp", "autocode"]
13+
}

.mcp.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"mcpServers": {
3+
"autocode": {
4+
"command": "uvx",
5+
"args": ["autocode-mcp"],
6+
"description": "AutoCode MCP Server for competitive programming problem creation"
7+
}
8+
}
9+
}

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Project Instructions
2+
3+
- In this project, `plugin` means a Claude Code plugin unless the user explicitly says otherwise.
4+
- Do not use Codex/Codex marketplace structures such as `.codex-plugin` or `.agents/plugins/marketplace.json` for Claude plugin requests.
5+
- When the user wants stronger workflow enforcement, implement it with Claude Code plugin features such as `skills`, `hooks`, local plugin config, and MCP integration.
6+
- In user-facing Chinese documentation, use `推荐` instead of `主推` unless the user explicitly asks for different wording.

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [0.4.0] - 2026-04-09
99

10+
## [0.4.1] - 2026-04-09
11+
12+
### Features
13+
14+
- 按官方 Claude Code plugin 结构补全插件:`.claude-plugin/plugin.json``settings.json``agents/``hooks/`
15+
- 新增工作流强制 hook,会拦截跳过 `problem_create/solution_build/validator_build/generator_build/stress_test_run/problem_generate_tests/problem_pack_polygon` 的调用
16+
- 将 README / README_CN 的默认安装路径调整为 Claude Code plugin 安装,其它 MCP 客户端作为兼容入口
17+
18+
### Design Rationale
19+
20+
- 用 Claude Code 官方插件结构替代错误的 Codex 插件结构
21+
- 不再只提供 MCP 包装,而是同时提供默认 agent、skills 与 hooks,对工作流做硬约束
22+
23+
### Notes & Caveats
24+
25+
- 当前插件仍依赖本地 `stdio` MCP server 提供实际工具执行能力
26+
- Claude Code 的 workflow enforcement 依赖 plugin agent 与 hooks,其它 MCP 客户端不会自动获得这部分能力
27+
1028
### Breaking Changes
1129

1230
- **配置单位变更**

README.md

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,30 @@ AutoCode MCP Server provides 15 atomic tools that enable AI assistants to create
2424

2525
## Installation
2626

27+
### Claude Code Plugin (Recommended)
28+
29+
This repository is structured as an official Claude Code plugin:
30+
31+
- [`.claude-plugin/plugin.json`](.claude-plugin/plugin.json)
32+
- [`settings.json`](settings.json)
33+
- [`agents/autocode-workflow.md`](agents/autocode-workflow.md)
34+
- [`hooks/hooks.json`](hooks/hooks.json)
35+
- [`.mcp.json`](.mcp.json)
36+
37+
The plugin does not only expose an MCP server. It also ships:
38+
39+
- a default workflow agent
40+
- automatic workflow skills
41+
- enforcement hooks that block skipped AutoCode steps
42+
43+
For a personal third-party marketplace setup, use the sibling repository at `../autocode-marketplace`. That marketplace is configured for remote GitHub-based installation of this plugin, not official marketplace publication.
44+
45+
When you are ready to distribute it, Anthropic’s docs indicate plugin distribution goes through a marketplace, and official marketplace submission is done via the Claude.ai or Console submission forms.
46+
47+
```bash
48+
claude mcp add autocode -- uvx autocode-mcp
49+
```
50+
2751
### From PyPI (Recommended)
2852

2953
```bash
@@ -65,9 +89,28 @@ uv run pytest tests/ -v
6589

6690
## Quick Start
6791

68-
### 1. Configure Your MCP Client
92+
### 1. Install the Plugin
93+
94+
Recommended:
95+
96+
- Install this repository as a Claude Code plugin.
97+
- For local development, test it with `claude --plugin-dir .`.
98+
- For personal marketplace usage, add the sibling marketplace and install from it:
99+
100+
```bash
101+
claude plugin marketplace add ../autocode-marketplace
102+
claude plugin install autocode-mcp@autocode-marketplace
103+
```
69104

70-
Add to your Claude Code configuration (`~/.config/claude-code/config.json`):
105+
Note: marketplace installs pull from `SummerOneTwo/AutoCode`, so push plugin changes before testing remote installation.
106+
107+
Fallback for direct Claude Code MCP setup:
108+
109+
```bash
110+
claude mcp add autocode -- uvx autocode-mcp
111+
```
112+
113+
Project-local alternative:
71114

72115
```json
73116
{
@@ -108,10 +151,12 @@ solution_build(
108151
stress_test_run(problem_dir="problems/ab", trials=100)
109152
```
110153

111-
## MCP Client Setup
154+
## Client Setup
112155

113156
### Transport & Compatibility
114157

158+
**Recommended**: Install as a Claude Code plugin.
159+
115160
**Current Support**: Local stdio transport only. The server communicates via standard input/output streams and is designed for local trusted environments.
116161

117162
| Client | Status | Notes |
@@ -122,9 +167,22 @@ stress_test_run(problem_dir="problems/ab", trials=100)
122167

123168
**Not Supported**: HTTP/SSE transport, remote connections, or multi-tenant environments.
124169

125-
### Claude Code
170+
### Claude Code Plugin
171+
172+
Recommended plugin files:
126173

127-
Edit `~/.config/claude-code/config.json`:
174+
- [`.claude-plugin/plugin.json`](.claude-plugin/plugin.json)
175+
- [`settings.json`](settings.json)
176+
- [`agents/autocode-workflow.md`](agents/autocode-workflow.md)
177+
- [`hooks/hooks.json`](hooks/hooks.json)
178+
179+
Direct MCP fallback:
180+
181+
```bash
182+
claude mcp add autocode -- uvx autocode-mcp
183+
```
184+
185+
Manual config:
128186

129187
```json
130188
{
@@ -136,6 +194,10 @@ Edit `~/.config/claude-code/config.json`:
136194
}
137195
```
138196

197+
### Other MCP Clients
198+
199+
The same MCP server also works with other local MCP clients, but the workflow-enforcement agent and hooks are Claude Code plugin features.
200+
139201
### Cursor
140202

141203
Add to your Cursor settings (Settings → MCP):

README_CN.md

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,30 @@ AutoCode MCP Server 提供 15 个原子工具,让 AI 助手能够创建、验
2424

2525
## 安装
2626

27+
### Claude Code 插件安装(推荐)
28+
29+
本仓库已经按官方 Claude Code plugin 结构组织:
30+
31+
- [`.claude-plugin/plugin.json`](.claude-plugin/plugin.json)
32+
- [`settings.json`](settings.json)
33+
- [`agents/autocode-workflow.md`](agents/autocode-workflow.md)
34+
- [`hooks/hooks.json`](hooks/hooks.json)
35+
- [`.mcp.json`](.mcp.json)
36+
37+
这个插件不只是暴露 MCP server,还会一起安装:
38+
39+
- 默认工作流 agent
40+
- AutoCode 工作流 skill
41+
- 用于阻止跳步的 hooks
42+
43+
如果你要做个人第三方 marketplace,可直接使用同级仓库 `../autocode-marketplace`。它默认走 GitHub 远程安装,不需要上官方市场。
44+
45+
如果当前环境不走 Claude Code 插件安装,也可以直接在 Claude Code 中添加 MCP server:
46+
47+
```bash
48+
claude mcp add autocode -- uvx autocode-mcp
49+
```
50+
2751
### 从 PyPI 安装(推荐)
2852

2953
```bash
@@ -65,9 +89,28 @@ uv run pytest tests/ -v
6589

6690
## 快速开始
6791

68-
### 1. 配置 MCP 客户端
92+
### 1. 安装插件
93+
94+
推荐方式:
95+
96+
- 以 Claude Code plugin 方式安装本仓库。
97+
- 本地开发时可用 `claude --plugin-dir .` 测试插件行为。
98+
- 如果走个人 marketplace,可直接执行:
99+
100+
```bash
101+
claude plugin marketplace add ../autocode-marketplace
102+
claude plugin install autocode-mcp@autocode-marketplace
103+
```
69104

70-
添加到 Claude Code 配置(`~/.config/claude-code/config.json`):
105+
注意:marketplace 默认从 `SummerOneTwo/AutoCode` 远程安装,所以测试远程安装前需要先把插件改动推到 GitHub。
106+
107+
直接接入 Claude Code 的备用方式:
108+
109+
```bash
110+
claude mcp add autocode -- uvx autocode-mcp
111+
```
112+
113+
项目级备用方式:
71114

72115
```json
73116
{
@@ -108,10 +151,12 @@ solution_build(
108151
stress_test_run(problem_dir="problems/ab", trials=100)
109152
```
110153

111-
## MCP 客户端配置
154+
## 客户端配置
112155

113156
### 传输层与兼容性
114157

158+
**推荐方式**:直接作为 Claude Code plugin 安装。
159+
115160
**当前支持**:仅支持本地 stdio 传输。服务器通过标准输入/输出流通信,适用于本地可信环境。
116161

117162
| 客户端 | 状态 | 说明 |
@@ -122,9 +167,22 @@ stress_test_run(problem_dir="problems/ab", trials=100)
122167

123168
**不支持**:HTTP/SSE 传输、远程连接或多租户环境。
124169

125-
### Claude Code
170+
### Claude Code Plugin
171+
172+
推荐的插件文件:
126173

127-
编辑 `~/.config/claude-code/config.json`
174+
- [`.claude-plugin/plugin.json`](.claude-plugin/plugin.json)
175+
- [`settings.json`](settings.json)
176+
- [`agents/autocode-workflow.md`](agents/autocode-workflow.md)
177+
- [`hooks/hooks.json`](hooks/hooks.json)
178+
179+
直接 MCP 接入的备用方式:
180+
181+
```bash
182+
claude mcp add autocode -- uvx autocode-mcp
183+
```
184+
185+
手动配置方式:
128186

129187
```json
130188
{
@@ -136,6 +194,10 @@ stress_test_run(problem_dir="problems/ab", trials=100)
136194
}
137195
```
138196

197+
### 其他 MCP 客户端
198+
199+
同一个 MCP server 也可用于其他本地 MCP 客户端,但工作流强制约束的 agent 和 hooks 是 Claude Code plugin 能力。
200+
139201
### Cursor
140202

141203
添加到 Cursor 设置(Settings → MCP):

agents/autocode-workflow.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: autocode-workflow
3+
description: Coordinates AutoCode problem creation and enforces the full validator-generator-checker workflow. Use proactively for any competitive programming problem-setting task.
4+
skills:
5+
- autocode-workflow
6+
model: inherit
7+
---
8+
9+
You are the default main-thread agent for the AutoCode Claude Code plugin.
10+
11+
Your job is to enforce the complete AutoCode workflow. Do not skip required steps. Do not package or generate final tests until the workflow state proves the prerequisites are complete.
12+
13+
Always work through this sequence unless the task is explicitly outside problem creation:
14+
15+
1. `problem_create`
16+
2. `solution_build` for `sol`
17+
3. `solution_build` for `brute`
18+
4. `validator_build`
19+
5. `generator_build`
20+
6. `stress_test_run`
21+
7. `checker_build` when the problem requires a non-exact checker
22+
8. `problem_generate_tests`
23+
9. `problem_pack_polygon`
24+
25+
When the user asks for a later step directly, explain which prerequisite step is missing and complete the missing work first.
26+
27+
Treat hook feedback as authoritative. If a hook denies a tool call, fix the workflow gap instead of retrying the same call.

hooks/hooks.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"hooks": {
3+
"SessionStart": [
4+
{
5+
"matcher": "",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "python hooks/workflow_guard.py session"
10+
}
11+
]
12+
}
13+
],
14+
"PreToolUse": [
15+
{
16+
"matcher": "mcp__autocode__.*",
17+
"hooks": [
18+
{
19+
"type": "command",
20+
"command": "python hooks/workflow_guard.py pre"
21+
}
22+
]
23+
}
24+
],
25+
"PostToolUse": [
26+
{
27+
"matcher": "mcp__autocode__.*",
28+
"hooks": [
29+
{
30+
"type": "command",
31+
"command": "python hooks/workflow_guard.py post"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
}

0 commit comments

Comments
 (0)