@devcxl/opencode-cabbage 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +36 -0
- package/README.md +53 -25
- package/README.zh.md +23 -23
- package/assets/agents/dev-lifecycle.md +208 -68
- package/assets/agents/team/architect.md +22 -7
- package/assets/agents/team/developer.md +13 -6
- package/assets/agents/team/goal-verify.md +4 -1
- package/assets/agents/team/researcher.md +59 -0
- package/assets/agents/team/reviewer.md +34 -18
- package/assets/commands/setup.md +1 -1
- package/assets/prompts/bootstrap.md +10 -9
- package/assets/prompts/stage-contract.md +25 -25
- package/assets/skills/flow-code/SKILL.md +23 -25
- package/assets/skills/flow-design/SKILL.md +94 -26
- package/assets/skills/flow-release/SKILL.md +41 -17
- package/assets/skills/flow-requirements/SKILL.md +19 -13
- package/assets/skills/flow-research/SKILL.md +77 -0
- package/assets/skills/flow-review/SKILL.md +55 -25
- package/assets/skills/flow-setup/SKILL.md +27 -24
- package/assets/skills/flow-tasks/SKILL.md +178 -35
- package/assets/skills/flow-tdd/SKILL.md +68 -40
- package/codex-skills/agent-architect/SKILL.md +79 -0
- package/codex-skills/agent-dev-lifecycle/SKILL.md +309 -0
- package/codex-skills/agent-developer/SKILL.md +51 -0
- package/codex-skills/agent-goal-verify/SKILL.md +45 -0
- package/codex-skills/agent-researcher/SKILL.md +32 -0
- package/codex-skills/agent-reviewer/SKILL.md +109 -0
- package/codex-skills/flow-code/SKILL.md +71 -0
- package/codex-skills/flow-design/SKILL.md +146 -0
- package/codex-skills/flow-release/SKILL.md +90 -0
- package/codex-skills/flow-requirements/SKILL.md +90 -0
- package/codex-skills/flow-research/SKILL.md +77 -0
- package/codex-skills/flow-review/SKILL.md +110 -0
- package/codex-skills/flow-setup/SKILL.md +75 -0
- package/codex-skills/flow-tasks/SKILL.md +220 -0
- package/codex-skills/flow-tdd/SKILL.md +235 -0
- package/dist/hooks/session-start.d.ts +1 -0
- package/dist/hooks/session-start.js +72 -0
- package/dist/hooks/session-start.js.map +1 -0
- package/dist/kernel/session-index.d.ts +8 -25
- package/dist/kernel/session-index.js +5 -55
- package/dist/kernel/session-index.js.map +1 -1
- package/dist/plugin/bootstrap.d.ts +0 -1
- package/dist/plugin/bootstrap.js +0 -3
- package/dist/plugin/bootstrap.js.map +1 -1
- package/dist/plugin/goal-store.d.ts +71 -0
- package/dist/plugin/goal-store.js +54 -0
- package/dist/plugin/goal-store.js.map +1 -0
- package/dist/plugin/goal.d.ts +47 -13
- package/dist/plugin/goal.js +228 -128
- package/dist/plugin/goal.js.map +1 -1
- package/dist/plugin/prompt-lint.js +3 -11
- package/dist/plugin/prompt-lint.js.map +1 -1
- package/dist/plugin/prompts.d.ts +0 -1
- package/dist/plugin/prompts.js +0 -4
- package/dist/plugin/prompts.js.map +1 -1
- package/dist/plugin/server.d.ts +3 -5
- package/dist/plugin/server.js +247 -155
- package/dist/plugin/server.js.map +1 -1
- package/dist/plugin/skills.d.ts +7 -1
- package/dist/plugin/skills.js +75 -12
- package/dist/plugin/skills.js.map +1 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/plugin.js +1 -4
- package/dist/plugin.js.map +1 -1
- package/dist/util/gh.d.ts +0 -11
- package/dist/util/gh.js +0 -14
- package/dist/util/gh.js.map +1 -1
- package/dist/util/paths.d.ts +0 -14
- package/dist/util/paths.js +0 -69
- package/dist/util/paths.js.map +1 -1
- package/hooks/hooks.json +17 -0
- package/package.json +12 -4
- package/assets/prompts/ADR-FORMAT.md +0 -45
- package/assets/prompts/PRD-FORMAT.md +0 -17
- package/assets/templates/gitignore +0 -5
- package/dist/kernel/caller.d.ts +0 -48
- package/dist/kernel/caller.js +0 -88
- package/dist/kernel/caller.js.map +0 -1
- package/dist/kernel/flow.d.ts +0 -175
- package/dist/kernel/flow.js +0 -467
- package/dist/kernel/flow.js.map +0 -1
- package/dist/kernel/legacy.d.ts +0 -19
- package/dist/kernel/legacy.js +0 -34
- package/dist/kernel/legacy.js.map +0 -1
- package/dist/kernel/records.d.ts +0 -103
- package/dist/kernel/records.js +0 -240
- package/dist/kernel/records.js.map +0 -1
- package/dist/kernel/release.d.ts +0 -106
- package/dist/kernel/release.js +0 -241
- package/dist/kernel/release.js.map +0 -1
- package/dist/kernel/review.d.ts +0 -34
- package/dist/kernel/review.js +0 -82
- package/dist/kernel/review.js.map +0 -1
- package/dist/kernel/setup.d.ts +0 -95
- package/dist/kernel/setup.js +0 -401
- package/dist/kernel/setup.js.map +0 -1
- package/dist/kernel/slug.d.ts +0 -23
- package/dist/kernel/slug.js +0 -67
- package/dist/kernel/slug.js.map +0 -1
- package/dist/kernel/task.d.ts +0 -213
- package/dist/kernel/task.js +0 -873
- package/dist/kernel/task.js.map +0 -1
- package/dist/kernel/tdd/adapter.d.ts +0 -49
- package/dist/kernel/tdd/adapter.js +0 -294
- package/dist/kernel/tdd/adapter.js.map +0 -1
- package/dist/kernel/tdd/digest.d.ts +0 -18
- package/dist/kernel/tdd/digest.js +0 -303
- package/dist/kernel/tdd/digest.js.map +0 -1
- package/dist/kernel/tdd/evaluator.d.ts +0 -38
- package/dist/kernel/tdd/evaluator.js +0 -185
- package/dist/kernel/tdd/evaluator.js.map +0 -1
- package/dist/kernel/tdd/evidence.d.ts +0 -42
- package/dist/kernel/tdd/evidence.js +0 -48
- package/dist/kernel/tdd/evidence.js.map +0 -1
- package/dist/kernel/tdd/state.d.ts +0 -79
- package/dist/kernel/tdd/state.js +0 -363
- package/dist/kernel/tdd/state.js.map +0 -1
- package/dist/kernel/types.d.ts +0 -180
- package/dist/kernel/types.js +0 -2
- package/dist/kernel/types.js.map +0 -1
- package/dist/kernel/worktree.d.ts +0 -45
- package/dist/kernel/worktree.js +0 -156
- package/dist/kernel/worktree.js.map +0 -1
- package/dist/plugin/flow-control.d.ts +0 -91
- package/dist/plugin/flow-control.js +0 -287
- package/dist/plugin/flow-control.js.map +0 -1
- package/dist/plugin/release-control.d.ts +0 -39
- package/dist/plugin/release-control.js +0 -343
- package/dist/plugin/release-control.js.map +0 -1
- package/dist/plugin/setup-control.d.ts +0 -59
- package/dist/plugin/setup-control.js +0 -111
- package/dist/plugin/setup-control.js.map +0 -1
- package/dist/plugin/task-control.d.ts +0 -90
- package/dist/plugin/task-control.js +0 -208
- package/dist/plugin/task-control.js.map +0 -1
- package/dist/plugin/tdd-checkpoint.d.ts +0 -128
- package/dist/plugin/tdd-checkpoint.js +0 -664
- package/dist/plugin/tdd-checkpoint.js.map +0 -1
- package/dist/util/shell.d.ts +0 -1
- package/dist/util/shell.js +0 -4
- package/dist/util/shell.js.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-cabbage",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "全流程开发编排插件 — 需求→设计→任务→编码→测试→审查→自动合并,支持 OpenCode 与 Codex 双平台",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "devcxl",
|
|
7
|
+
"url": "https://github.com/devcxl"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://devcxl.github.io/opencode-cabbage/",
|
|
10
|
+
"repository": "https://github.com/devcxl/opencode-cabbage",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"development-workflow",
|
|
14
|
+
"orchestration",
|
|
15
|
+
"tdd",
|
|
16
|
+
"codex",
|
|
17
|
+
"codex-plugin",
|
|
18
|
+
"opencode",
|
|
19
|
+
"opencode-plugin"
|
|
20
|
+
],
|
|
21
|
+
"skills": "./codex-skills/",
|
|
22
|
+
"interface": {
|
|
23
|
+
"displayName": "OpenCode Cabbage",
|
|
24
|
+
"shortDescription": "全流程开发编排 — 需求到自动合并,双平台兼容",
|
|
25
|
+
"longDescription": "覆盖需求、设计、DAG 任务拆解、并行编码(TDD)、审查与自动合并的全流程开发编排插件。兼容 OpenCode 与 Codex 双平台,提供 9 个 flow skills 和 6 个 agent skills。",
|
|
26
|
+
"developerName": "devcxl",
|
|
27
|
+
"category": "Developer Tools",
|
|
28
|
+
"capabilities": ["Read", "Write"],
|
|
29
|
+
"defaultPrompt": [
|
|
30
|
+
"使用 OpenCode Cabbage 初始化项目开发环境 — 加载 flow-setup skill",
|
|
31
|
+
"使用 OpenCode Cabbage 的 flow-setup skill 初始化项目开发环境",
|
|
32
|
+
"使用 OpenCode Cabbage 的 agent-dev-lifecycle skill 编排全流程"
|
|
33
|
+
],
|
|
34
|
+
"brandColor": "#00bcd4"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/README.md
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
<h1>@devcxl/opencode-cabbage</h1>
|
|
3
3
|
<p>A full-lifecycle development plugin for OpenCode, covering requirements, design, tasks, coding, testing, review, and release with automated orchestration and parallel subagents.</p>
|
|
4
4
|
<p>
|
|
5
|
-
<a href="https://www.npmjs.com/package/@devcxl/opencode-cabbage"><img src="https://img.shields.io/npm/v/@devcxl/opencode-cabbage" alt="npm version"></a>
|
|
6
5
|
<a href="https://github.com/devcxl/opencode-cabbage/actions/workflows/ci.yml"><img src="https://github.com/devcxl/opencode-cabbage/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
|
|
6
|
+
<a href="https://github.com/devcxl/opencode-cabbage/actions/workflows/release-draft.yml"><img src="https://github.com/devcxl/opencode-cabbage/actions/workflows/release-draft.yml/badge.svg" alt="Release"></a>
|
|
7
|
+
<a href="https://github.com/devcxl/opencode-cabbage/actions/workflows/release-publish.yml"><img src="https://github.com/devcxl/opencode-cabbage/actions/workflows/release-publish.yml/badge.svg" alt="Publish to npm"></a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/@devcxl/opencode-cabbage"><img src="https://img.shields.io/npm/v/@devcxl/opencode-cabbage" alt="npm version"></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@devcxl/opencode-cabbage"><img src="https://img.shields.io/npm/dm/@devcxl/opencode-cabbage" alt="npm downloads"></a>
|
|
7
10
|
<a href="https://devcxl.github.io/opencode-cabbage"><img src="https://github.com/devcxl/opencode-cabbage/actions/workflows/pages.yml/badge.svg?branch=main" alt="GitHub Pages"></a>
|
|
8
11
|
</p>
|
|
9
12
|
<p>English | <a href="README.zh.md">简体中文</a></p>
|
|
@@ -11,6 +14,10 @@
|
|
|
11
14
|
|
|
12
15
|
---
|
|
13
16
|
|
|
17
|
+
## OpenCode Compatibility
|
|
18
|
+
|
|
19
|
+
> **OpenCode v2 is not currently supported.** This plugin still uses the OpenCode v1 plugin API (`@opencode-ai/plugin` 1.x). OpenCode v2 introduces breaking changes to its plugin API and SDK, and this plugin has not yet been migrated or end-to-end tested on v2. If you rely on cabbage, stay on OpenCode v1 for now; do not upgrade to OpenCode v2 until support is announced.
|
|
20
|
+
|
|
14
21
|
## Installation
|
|
15
22
|
|
|
16
23
|
```json
|
|
@@ -20,7 +27,33 @@
|
|
|
20
27
|
}
|
|
21
28
|
```
|
|
22
29
|
|
|
23
|
-
Once started, the plugin automatically injects 7 slash commands,
|
|
30
|
+
Once started, the plugin automatically injects 7 slash commands, 9 flow skills, 6 agents, and 1 goal tool.
|
|
31
|
+
|
|
32
|
+
> **⚠️ Plugin conflict — do not combine with other goal plugins.** cabbage ships its own `goal` tool with an idle-driven auto-continuation loop. Installing it together with another goal / auto-continue plugin (e.g. `@prevalentware/opencode-goal-plugin`, `opencode-goal-mode`) risks both loops listening for session idle events and injecting continuation prompts: work gets continued twice, continuation counts and token budgets drift out of sync, and abort handling interferes across plugins. Use exactly one goal engine per session — if you rely on an external goal plugin, do not trigger cabbage's goal tool (it is restricted to the `dev-lifecycle` / `goal-verify` agents).
|
|
33
|
+
|
|
34
|
+
## Codex Installation (Compatibility Layer)
|
|
35
|
+
|
|
36
|
+
This package also ships a Codex plugin compatibility layer (`codex-skills/` + `hooks/` + `.codex-plugin/`) so the flow skills and agent prompts work in Codex as well.
|
|
37
|
+
|
|
38
|
+
The repository is a Codex marketplace: add it as a marketplace source, then install the plugin from it.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# 1. Add this repository as a Codex marketplace
|
|
42
|
+
codex plugin marketplace add devcxl/opencode-cabbage
|
|
43
|
+
|
|
44
|
+
# 2. Confirm the plugin is available
|
|
45
|
+
codex plugin list --available
|
|
46
|
+
|
|
47
|
+
# 3. Install the plugin (pulled from the npm package, which bundles all Codex files)
|
|
48
|
+
codex plugin add opencode-cabbage@cabbage
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Notes:
|
|
52
|
+
|
|
53
|
+
- **Build artifact included**: the SessionStart hook (`dist/hooks/session-start.js`) ships inside the published npm package — no local build required.
|
|
54
|
+
- **Hook trust review**: Codex requires interactive trust approval for hooks (`/hooks` command) on first run — approve the `SessionStart` hook to enable context injection.
|
|
55
|
+
- **Marketplace name**: the marketplace is named `cabbage` (see `.agents/plugins/marketplace.json`); use `opencode-cabbage@cabbage` as the plugin selector.
|
|
56
|
+
- **Platform differences**: the Codex layer is a pure-Prompt downgrade — no `goal` tool, no slash commands, no automatic continuation. Agents are plain skills (referenced as `@agent-*`), and flow state is tracked via GitHub Issue checklists. See `codex-skills/agent-dev-lifecycle/SKILL.md` for details.
|
|
24
57
|
|
|
25
58
|
## Command Overview
|
|
26
59
|
|
|
@@ -30,8 +63,8 @@ Once started, the plugin automatically injects 7 slash commands, 8 flow skills,
|
|
|
30
63
|
| `/requirements` | Requirements | PRD → `docs/prd/` + Draft Parent Issue |
|
|
31
64
|
| `/design` | Design | Technical specification + necessary ADR → `docs/dev/specs/` + `docs/adr/` |
|
|
32
65
|
| `/tasks` | Task decomposition | DAG tasks + Sub Issues (GitHub 权威源) |
|
|
33
|
-
| `/code` | Coding | Task +
|
|
34
|
-
| `/review` | Review | Dual-axis review +
|
|
66
|
+
| `/code` | Coding | Task + PR (TDD enforced by CI) |
|
|
67
|
+
| `/review` | Review | Dual-axis review + merge |
|
|
35
68
|
| `/release` | ⚠️ Manual release | Version proposal → Release PR → tag push → workflow monitor |
|
|
36
69
|
|
|
37
70
|
## Quick Start
|
|
@@ -58,37 +91,32 @@ npm install @devcxl/opencode-cabbage
|
|
|
58
91
|
src/ # Thin TypeScript layer
|
|
59
92
|
├── index.ts # Plugin entry point
|
|
60
93
|
├── plugin.ts # Package root resolution
|
|
61
|
-
├── plugin/ # Loaders + tool
|
|
62
|
-
│ ├── server.ts # Main factory: injects skills,
|
|
94
|
+
├── plugin/ # Loaders + goal tool
|
|
95
|
+
│ ├── server.ts # Main factory: injects skills/commands/agents, goal tool, context, auto-continuation
|
|
96
|
+
│ ├── goal.ts # goal tool (status + goal-verify authorization)
|
|
63
97
|
│ ├── commands.ts # Command loader
|
|
64
98
|
│ ├── skills.ts # Skill loader
|
|
65
99
|
│ ├── prompts.ts # Prompt loader
|
|
66
100
|
│ ├── bootstrap.ts # Startup guidance
|
|
67
101
|
│ ├── agents.ts # Agent injection
|
|
68
|
-
│ ├──
|
|
69
|
-
│
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
│ └── release-control.ts # release_control tool
|
|
73
|
-
└── kernel/ # Deterministic thin kernel
|
|
74
|
-
├── slug.ts # Functional slug derivation/validation
|
|
75
|
-
├── records.ts # Flow/Task Record CRUD (GitHub authoritative)
|
|
76
|
-
├── worktree.ts # Worktree lifecycle (no --force)
|
|
77
|
-
├── tdd/ # Runtime TDD pure functions + evidence
|
|
78
|
-
├── review.ts # Merge gates (CI/protection/risk/approval)
|
|
79
|
-
├── release.ts # Version proposal + tag immutability
|
|
80
|
-
├── context.ts # Root CONTEXT.md discovery/injection
|
|
102
|
+
│ ├── shell.ts # Agent shell env isolation
|
|
103
|
+
│ └── prompt-lint.ts # Prompt asset consistency checks
|
|
104
|
+
└── kernel/ # Minimal supporting modules
|
|
105
|
+
├── context.ts # root CONTEXT.md discovery/injection
|
|
81
106
|
├── profile.ts # AGENTS.md Project Profile parsing
|
|
82
|
-
├── session-index.ts # Flow→session index +
|
|
83
|
-
├── caller.ts # Caller role matrix
|
|
107
|
+
├── session-index.ts # Flow→session index (goal binding + auto-resume)
|
|
84
108
|
├── permission.ts # Permission matching semantics
|
|
85
|
-
└──
|
|
109
|
+
└── mutex.ts # Keyed async mutex
|
|
86
110
|
|
|
87
|
-
assets/ # Runtime assets
|
|
111
|
+
assets/ # Runtime assets (pure Prompt flows)
|
|
88
112
|
├── commands/ # 7 slash commands
|
|
89
|
-
├── skills/ #
|
|
90
|
-
├── agents/ #
|
|
113
|
+
├── skills/ # 9 flow-* skills (Prompt-driven, direct git/gh)
|
|
114
|
+
├── agents/ # 6 agent definitions
|
|
91
115
|
└── prompts/ # Guidance prompts and templates
|
|
116
|
+
|
|
117
|
+
codex-skills/ # Codex compatibility layer (mirrors assets/, agent-* prefixed)
|
|
118
|
+
hooks/ # Codex SessionStart hook (hooks.json + compiled dist/hooks/)
|
|
119
|
+
.codex-plugin/ # Codex plugin manifest (plugin.json)
|
|
92
120
|
```
|
|
93
121
|
|
|
94
122
|
## Documentation
|
package/README.zh.md
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
<h1>@devcxl/opencode-cabbage</h1>
|
|
3
3
|
<p>全流程开发 OpenCode 插件 — 覆盖需求、设计、任务、编码、测试、审查和发布完整开发生命周期,支持自动编排与并行 Subagent。</p>
|
|
4
4
|
<p>
|
|
5
|
-
<a href="https://www.npmjs.com/package/@devcxl/opencode-cabbage"><img src="https://img.shields.io/npm/v/@devcxl/opencode-cabbage" alt="npm version"></a>
|
|
6
5
|
<a href="https://github.com/devcxl/opencode-cabbage/actions/workflows/ci.yml"><img src="https://github.com/devcxl/opencode-cabbage/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
|
|
6
|
+
<a href="https://github.com/devcxl/opencode-cabbage/actions/workflows/release-draft.yml"><img src="https://github.com/devcxl/opencode-cabbage/actions/workflows/release-draft.yml/badge.svg" alt="Release"></a>
|
|
7
|
+
<a href="https://github.com/devcxl/opencode-cabbage/actions/workflows/release-publish.yml"><img src="https://github.com/devcxl/opencode-cabbage/actions/workflows/release-publish.yml/badge.svg" alt="Publish to npm"></a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/@devcxl/opencode-cabbage"><img src="https://img.shields.io/npm/v/@devcxl/opencode-cabbage" alt="npm version"></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@devcxl/opencode-cabbage"><img src="https://img.shields.io/npm/dm/@devcxl/opencode-cabbage" alt="npm downloads"></a>
|
|
7
10
|
<a href="https://devcxl.github.io/opencode-cabbage"><img src="https://github.com/devcxl/opencode-cabbage/actions/workflows/pages.yml/badge.svg?branch=main" alt="GitHub Pages"></a>
|
|
8
11
|
</p>
|
|
9
12
|
<p><a href="README.md">English</a> | 简体中文</p>
|
|
@@ -11,6 +14,10 @@
|
|
|
11
14
|
|
|
12
15
|
---
|
|
13
16
|
|
|
17
|
+
## OpenCode 兼容性
|
|
18
|
+
|
|
19
|
+
> **目前暂不支持 OpenCode v2。** 本插件当前仍使用 OpenCode v1 插件 API(`@opencode-ai/plugin` 1.x)。OpenCode v2 的插件 API 和 SDK 存在不兼容变更,本插件尚未完成迁移,也未通过 v2 端到端验证。依赖本插件时请暂时继续使用 OpenCode v1;在正式公布支持前,请勿升级到 OpenCode v2。
|
|
20
|
+
|
|
14
21
|
## 安装
|
|
15
22
|
|
|
16
23
|
```json
|
|
@@ -20,7 +27,9 @@
|
|
|
20
27
|
}
|
|
21
28
|
```
|
|
22
29
|
|
|
23
|
-
插件启动后自动注入 7 个 slash command、
|
|
30
|
+
插件启动后自动注入 7 个 slash command、9 个 flow skill、6 个 agent 与 1 个 goal 工具。
|
|
31
|
+
|
|
32
|
+
> **⚠️ 插件冲突——不要与其他 goal 插件同时安装。** cabbage 自带 `goal` 工具与 idle 驱动的自动续接循环。若与其他 goal / 自动续接类插件(如 `@prevalentware/opencode-goal-plugin`、`opencode-goal-mode`)同时安装,存在双方都监听会话 idle 事件并注入续接 prompt 的风险:任务被重复续接、续接计数与 token 预算互不同步、abort 处理互相干扰。同一会话只能保留一个 goal 引擎——若使用外部 goal 插件,请勿触发 cabbage 的 goal 工具(仅 `dev-lifecycle` / `goal-verify` agent 可调用)。
|
|
24
33
|
|
|
25
34
|
## 命令一览
|
|
26
35
|
|
|
@@ -30,7 +39,7 @@
|
|
|
30
39
|
| `/requirements` | 需求 | PRD → `docs/prd/` + Draft Parent Issue |
|
|
31
40
|
| `/design` | 设计 | 技术方案 + 必要 ADR → `docs/dev/specs/` + `docs/adr/` |
|
|
32
41
|
| `/tasks` | 任务拆解 | DAG 任务 + Sub Issues(GitHub 权威源) |
|
|
33
|
-
| `/code` | 编码 | Task +
|
|
42
|
+
| `/code` | 编码 | Task + PR(TDD 由 CI 把关) |
|
|
34
43
|
| `/review` | 审查 | 双轴审查 + 自动合并 |
|
|
35
44
|
| `/release` | ⚠️ 手动发布 | 版本提议 → Release PR → tag push → workflow 监控 |
|
|
36
45
|
|
|
@@ -58,36 +67,27 @@ npm install @devcxl/opencode-cabbage
|
|
|
58
67
|
src/ # TypeScript 薄层
|
|
59
68
|
├── index.ts # 插件入口
|
|
60
69
|
├── plugin.ts # 包路径解析
|
|
61
|
-
├── plugin/ # 加载器 +
|
|
62
|
-
│ ├── server.ts # 主工厂:注入 skills/commands/agents
|
|
70
|
+
├── plugin/ # 加载器 + goal 工具
|
|
71
|
+
│ ├── server.ts # 主工厂:注入 skills/commands/agents、goal 工具、Context、自动续接
|
|
72
|
+
│ ├── goal.ts # goal 工具(状态管理 + goal-verify 授权)
|
|
63
73
|
│ ├── commands.ts # Command 加载器
|
|
64
74
|
│ ├── skills.ts # Skill 加载器
|
|
65
75
|
│ ├── prompts.ts # Prompt 加载器
|
|
66
76
|
│ ├── bootstrap.ts # 启动引导
|
|
67
77
|
│ ├── agents.ts # Agent 注入
|
|
68
|
-
│ ├──
|
|
69
|
-
│
|
|
70
|
-
|
|
71
|
-
│ ├── tdd-checkpoint.ts # tdd_checkpoint 工具
|
|
72
|
-
│ └── release-control.ts # release_control 工具
|
|
73
|
-
└── kernel/ # 确定性薄内核
|
|
74
|
-
├── slug.ts # Functional Slug 派生/校验
|
|
75
|
-
├── records.ts # Flow/Task Record CRUD(GitHub 权威源)
|
|
76
|
-
├── worktree.ts # Worktree 生命周期(无 --force)
|
|
77
|
-
├── tdd/ # Runtime TDD 纯函数 + evidence
|
|
78
|
-
├── review.ts # 合并门禁(CI/分支保护/风险/approval)
|
|
79
|
-
├── release.ts # 版本提议 + tag 不可变校验
|
|
78
|
+
│ ├── shell.ts # Agent shell 环境隔离
|
|
79
|
+
│ └── prompt-lint.ts # Prompt 资产一致性检查
|
|
80
|
+
└── kernel/ # 最小支撑模块
|
|
80
81
|
├── context.ts # 根 CONTEXT.md 发现/注入
|
|
81
82
|
├── profile.ts # AGENTS.md Project Profile 解析
|
|
82
|
-
├── session-index.ts # Flow→session
|
|
83
|
-
├── caller.ts # 调用者角色矩阵
|
|
83
|
+
├── session-index.ts # Flow→session 索引(goal 绑定 + 重启恢复)
|
|
84
84
|
├── permission.ts # 权限匹配语义
|
|
85
|
-
└──
|
|
85
|
+
└── mutex.ts # 按键异步互斥
|
|
86
86
|
|
|
87
|
-
assets/ #
|
|
87
|
+
assets/ # 运行时资源(纯 Prompt 流程)
|
|
88
88
|
├── commands/ # 7 个 slash command
|
|
89
|
-
├── skills/ #
|
|
90
|
-
├── agents/ #
|
|
89
|
+
├── skills/ # 9 个 flow-* skill(Prompt 驱动,直接 git/gh)
|
|
90
|
+
├── agents/ # 6 个 agent 定义
|
|
91
91
|
└── prompts/ # 引导提示词 + 模板
|
|
92
92
|
```
|
|
93
93
|
|
|
@@ -1,55 +1,62 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dev-lifecycle
|
|
3
|
-
description: 全流程开发编排器 —
|
|
3
|
+
description: 全流程开发编排器 — 按输入场景分诊并编排(功能/Bug/紧急修复/业务调整/重构/技术债/基础设施/文档/回滚)
|
|
4
4
|
mode: primary
|
|
5
5
|
color: '#00bcd4'
|
|
6
6
|
permission:
|
|
7
7
|
bash:
|
|
8
8
|
"*": "allow"
|
|
9
|
-
"git push*": "deny"
|
|
10
|
-
"git worktree remove*": "deny"
|
|
11
|
-
"git worktree add*": "deny"
|
|
12
|
-
"git checkout -b*": "deny"
|
|
13
|
-
"git tag*": "deny"
|
|
14
|
-
"gh pr create*": "deny"
|
|
15
|
-
"gh pr merge*": "deny"
|
|
16
|
-
"gh issue close*": "deny"
|
|
17
|
-
"gh issue create*": "deny"
|
|
18
|
-
"gh release create*": "deny"
|
|
19
|
-
"npm publish*": "deny"
|
|
20
9
|
---
|
|
21
10
|
|
|
22
11
|
<system-reminder>
|
|
23
12
|
你是全流程开发编排器(dev-lifecycle)。
|
|
24
13
|
|
|
25
|
-
|
|
14
|
+
你的目标:先对用户输入做场景分诊,选择对应流程路径;功能流自动串联设计 → 任务拆解 → Sub Issues 创建 → 并行编码实现 → 审查 → 合并,其余场景按对应轻量路径执行。
|
|
26
15
|
|
|
27
16
|
使用 `goal` 工具管理 flow 状态。Plugin 会在你每次 idle 时自动注入 continuation prompt,你只需做好当前 step 即可。
|
|
28
17
|
|
|
29
18
|
无需用户逐步骤确认,仅在遇到非预期错误时暂停并告知。
|
|
30
19
|
|
|
31
|
-
**TDD 约束**:编码阶段引用 `flow-tdd` skill 作为 TDD
|
|
20
|
+
**TDD 约束**:编码阶段引用 `flow-tdd` skill 作为 TDD 协议唯一来源(advisory,测试质量由 CI 把关)。
|
|
32
21
|
</system-reminder>
|
|
33
22
|
|
|
34
23
|
## 开始工作
|
|
35
24
|
|
|
36
|
-
1.
|
|
37
|
-
2. 调用 `
|
|
38
|
-
3.
|
|
39
|
-
4.
|
|
25
|
+
1. 场景分诊:按 Phase 0 判定用户输入所属场景,选择流程路径
|
|
26
|
+
2. 调用 `goal({op:"create", parent_issue_number:<Flow Record 编号>})` 建立会话运行控制(目标/验收从 Flow Record 读取)
|
|
27
|
+
3. 读取 Flow Record(Parent Issue body)获取目标与验收标准,按选定路径推进
|
|
28
|
+
4. 每个阶段完成后,Plugin 会自动 continuation,进入下一阶段
|
|
29
|
+
5. 最终全部完成后,直接使用 Task 工具派发 `@goal-verify` 做独立验证
|
|
40
30
|
|
|
41
31
|
## 调度团队
|
|
42
32
|
|
|
43
33
|
- @architect:技术方案、ADR、DAG 任务拆解
|
|
44
|
-
- @developer:技术栈无关代码 TDD 实现(加载 `flow-tdd` skill,遵循 RED→GREEN cycle,编码 + 测试 + 本地 commit
|
|
34
|
+
- @developer:技术栈无关代码 TDD 实现(加载 `flow-tdd` skill,遵循 RED→GREEN cycle,编码 + 测试 + 本地 commit)
|
|
45
35
|
- @reviewer:只读代码审查,输出结构化审查报告(不操作 git/GitHub,不写文件)
|
|
46
36
|
- @goal-verify:独立验证 Goal 完成状态(**只有它可以调用 goal({op:"complete"})**)
|
|
47
37
|
|
|
48
38
|
## 全局约束
|
|
49
39
|
|
|
50
|
-
###
|
|
51
|
-
-
|
|
52
|
-
-
|
|
40
|
+
### 阶段契约
|
|
41
|
+
- 阶段顺序:requirements → design → tasks → code → review → release
|
|
42
|
+
- 每个阶段完成后,在 Flow Record body 的 checklist 勾选对应阶段(`- [x] <stage>`)
|
|
43
|
+
- requirements 完成需用户确认;高风险 Flow 的 design→tasks 需用户确认
|
|
44
|
+
- 上述阶段顺序与 checklist 适用于功能流;非功能路径按 Phase 0 轻量路径执行,完成标准见各路径要点
|
|
45
|
+
|
|
46
|
+
### Testing Decisions 存量兼容门
|
|
47
|
+
|
|
48
|
+
功能流进入或恢复 tasks、code、review 时,先检查相关行为是否在技术方案中具有完整的 `Testing Decisions`。
|
|
49
|
+
|
|
50
|
+
如果完整,直接继续当前步骤。如果缺失:
|
|
51
|
+
|
|
52
|
+
1. 记录当前 stage,不调用 goal 改回 design,也不修改已完成阶段的 checklist。
|
|
53
|
+
2. 在创建 Sub Issue、派发 developer 或输出 review 结论前停止当前动作,汇总一个 Design Gap:Design 文件、缺失行为、已有 Interface / 测试惯例、需要补充的决策。
|
|
54
|
+
3. 在**当前 stage 内**委派 `@architect` 加载 `flow-design` 执行 Design Amendment:只向原技术方案补充缺失的 Test Seam、Observable Result 与 Test Level。
|
|
55
|
+
4. 读回并在当前 stage 保存修改后的 Design;补齐后从头重新执行当前 Task Planning、developer 派发或 review,不重复已完成的 lifecycle stage。
|
|
56
|
+
5. 一轮 amendment 后仍无法确定稳定 Seam,或出现新的高风险架构取舍 → 保持当前 stage 并暂停,请用户决策;禁止自动循环重试。
|
|
57
|
+
|
|
58
|
+
兼容门不得创建新 lifecycle 状态,不得重复发布 Sub Issue,不得让 developer/reviewer 临时发明 Test Seam。已有完整 Testing Decisions 时不得重写。
|
|
59
|
+
如果当前 code/review worktree 尚不包含 amended Design,重新派发时必须把补充后的 Testing Decisions 明确放入 agent 上下文,不能让 agent 继续读取旧版本并再次触发 Design Gap。
|
|
53
60
|
|
|
54
61
|
### 文档目录
|
|
55
62
|
- PRD → `docs/prd/`
|
|
@@ -62,6 +69,100 @@ permission:
|
|
|
62
69
|
- 禁止在 `/tmp/` 下创建或调试文件;临时产物放入 worktree 内
|
|
63
70
|
- 文档产出必须遵循目录规范
|
|
64
71
|
|
|
72
|
+
### 上下文管理(内化 handoff)
|
|
73
|
+
长时间运行时主动管理上下文,不需要用户手动触发:
|
|
74
|
+
- **上下文压力大**(接近模型上下文上限、阶段跨度大、等待外部输入)→ 自动产出交接文档:
|
|
75
|
+
```markdown
|
|
76
|
+
# Handoff: <flow-slug> <date>
|
|
77
|
+
## 当前阶段 / 已完成 / 待办 / 下一步 / 关键产出(Issue·PR·文件)
|
|
78
|
+
```
|
|
79
|
+
保存到 `docs/dev/handoff-<YYYY-MM-DD>.md` 并在回复中告知用户可引用恢复。
|
|
80
|
+
- **会话恢复**:autoResume 后先读最近 handoff 文件(`ls docs/dev/handoff-*.md` 取最新),
|
|
81
|
+
结合 Parent Issue 状态恢复进度,继续剩余阶段,而不是从头重读全部文档。
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Phase 0:场景分诊(Dispatch)
|
|
86
|
+
|
|
87
|
+
根据用户当前输入(结合会话上下文与仓库状态)判定所属场景,选择对应流程路径。下表为本编排器的**权威分派逻辑**:
|
|
88
|
+
|
|
89
|
+
| 输入特征 | 场景 | 路径 | 关键动作 |
|
|
90
|
+
|---------|------|------|----------|
|
|
91
|
+
| 新功能 / 新需求 | 功能流 | 完整 Phase 1-4 | requirements→design→tasks→code→review→release |
|
|
92
|
+
| 已合并代码回归 / 缺陷 / bug | Bug 修复 | 轻量 | 复现→失败测试→最小修复→回归→review→merge |
|
|
93
|
+
| 线上 P0/P1,需立即发版 | 紧急修复 | 最短路径 | 生产基线→最小修复→patch 发版→回滚预案 |
|
|
94
|
+
| 既有功能行为/字段/交互调整 | 业务调整 | 变更管理 | 影响分析→兼容/迁移→更新验收→实现 |
|
|
95
|
+
| 只改结构不改行为 | 重构 | 行为保持 | 测试安全网→小步重构→行为对比→merge |
|
|
96
|
+
| 死代码 / 技术债清理 | 技术债清理 | 行为保持移除 | 盘点→核验消费者→删除→回归 |
|
|
97
|
+
| CI / 依赖 / 配置 / 构建链路 | 基础设施变更 | CI 即验收 | 小步变更→CI 验证→回归 |
|
|
98
|
+
| 纯文档新增/修改 | 文档更新 | Docs-as-Code | 术语一致→构建校验→review |
|
|
99
|
+
| 发布失败需回滚 / Flow 异常 | 回滚与异常收尾 | 受控收尾 | revert→根治 Corrective Flow→清理 |
|
|
100
|
+
| 需调研 / 事实核查 / 技术可行性不确定 | 调研 | flow-research | 派发 @researcher 产出调研文档 |
|
|
101
|
+
|
|
102
|
+
**分诊原则**:
|
|
103
|
+
- 功能流完整走原 Phase 1-4;非功能路径按下述轻量路径执行,复用 `flow-tdd`/`flow-code`/`flow-review`/`flow-release` 与 goal 工具。
|
|
104
|
+
- 非功能路径**跳过 requirements/design/tasks 的重量模型**(除非根因指向设计缺陷,如 bug 根因是架构问题 → 修复后单独开重构/功能 Flow)。
|
|
105
|
+
- 非功能路径只需用到的角色(多为 @developer/@reviewer/@goal-verify),不强制全团队。
|
|
106
|
+
- 无法确定场景 → 暂停询问用户澄清,不擅自选择。
|
|
107
|
+
|
|
108
|
+
### 轻量路径执行要点
|
|
109
|
+
|
|
110
|
+
**Bug 修复(Corrective Flow)**
|
|
111
|
+
1. 分诊严重度;创建 goal 绑定 Flow Record,链接导致回归的原 Flow(不改其完成状态)
|
|
112
|
+
2. 建立反馈回路(失败测试/脚本/夹具),确认复现用户描述的**同一**故障
|
|
113
|
+
3. 生成 3-5 个可证伪假设,按优先级验证;一次只改一个变量
|
|
114
|
+
4. 先写失败回归测试(RED)→ 最小修复(GREEN)→ 重跑原始复现场景确认不再复发
|
|
115
|
+
5. 分支 `fix/<slug>`,复用 `flow-review` 双轴审查 + CI 绿后 `--match-head-commit` 合并
|
|
116
|
+
6. 清理调试插桩/临时产物、销毁 worktree;复盘根因,架构问题转重构/功能 Flow
|
|
117
|
+
|
|
118
|
+
**紧急修复(Hotfix)**
|
|
119
|
+
1. 确认 P0/P1,否则回退常规 Bug 修复
|
|
120
|
+
2. 从最近发布 tag 拉 `hotfix/<slug>` worktree(不夹带未发布改动)
|
|
121
|
+
3. 最小修复 + 针对性测试;PR 指默认分支,CI 绿 + 快速审查(`flow-review`)合并
|
|
122
|
+
4. patch 发版(版本规则 fix→patch:版本文件 + Release PR + tag + 项目 GitHub Actions release workflow),监控成功
|
|
123
|
+
5. 修复同步回开发主干;发布前确认回滚预案,失败按回滚路径处理
|
|
124
|
+
|
|
125
|
+
**业务调整**
|
|
126
|
+
1. 分诊:新增能力→新 Flow;既有微调→复用/重开 Flow Record 更新验收;破坏性变更→评估迁移
|
|
127
|
+
2. 影响分析(模块/调用方/兼容性);一次澄清一个关键决策
|
|
128
|
+
3. 更新验收标准;需要时补设计基线;实现 + 回归
|
|
129
|
+
4. 文档同步;新领域术语写回 CONTEXT.md
|
|
130
|
+
|
|
131
|
+
**重构**
|
|
132
|
+
1. 前置:目标区域测试存在且绿,否则先补关键路径测试
|
|
133
|
+
2. 识别重构机会;与用户确认行为保持边界
|
|
134
|
+
3. 小步重构(RED→GREEN→refactor),每步提交并保持测试绿
|
|
135
|
+
4. 全量回归 + 行为对比(快照/差分)确认无行为差异
|
|
136
|
+
5. 审查轴改为行为保持(非 PRD 规格);CI 绿后合并
|
|
137
|
+
|
|
138
|
+
**技术债清理**
|
|
139
|
+
1. 盘点无引用代码/死资源;区分内部死代码与可能被外部消费的公开接口
|
|
140
|
+
2. 核验消费者后再删;删除后全量回归绿
|
|
141
|
+
3. 可选登记技术债清单;审查确认行为保持
|
|
142
|
+
|
|
143
|
+
**基础设施变更**
|
|
144
|
+
1. 确认范围(CI/依赖/配置/构建链路);小步一次一类
|
|
145
|
+
2. CI 即验收:push 触发 CI 验证;发布链路变更走项目 release workflow 验证
|
|
146
|
+
3. 依赖升级:记录前版本→升级→兼容性检查→全量回归→安全检查
|
|
147
|
+
4. 更新配置/迁移文档
|
|
148
|
+
|
|
149
|
+
**文档更新**
|
|
150
|
+
1. 明确独立文档 vs 随代码文档(后者随对应功能 PR)
|
|
151
|
+
2. 术语以 CONTEXT.md 为准,新术语先写回;单一事实源(引用而非复制)
|
|
152
|
+
3. 涉文档站跑 docs 构建校验;`flow-review` 审查合并
|
|
153
|
+
|
|
154
|
+
**调研(Research)**
|
|
155
|
+
1. 明确调研问题、范围与输出形式;若属某 Flow,创建 goal 绑定 Flow Record
|
|
156
|
+
2. 派发 `@researcher` 加载 `flow-research` skill,产出 `docs/dev/research/<topic>.md`
|
|
157
|
+
3. 读回调研结论:更新决策映射/PRD、确认技术可行性,或阻断后续阶段
|
|
158
|
+
4. 若属于 requirements 阶段 Research 型 Ticket → 关联并解决该 Ticket
|
|
159
|
+
|
|
160
|
+
**回滚与异常收尾**
|
|
161
|
+
1. 回滚优先 revert PR(保留历史);回滚≠修复,根因转 Corrective Flow + 新版本
|
|
162
|
+
2. Flow 放弃→`goal({op:"cancel"})` + 清理 worktree/session-index;阻塞→标记 blocked 停下游
|
|
163
|
+
3. 范围变更→新增范围开新 Flow,原意澄清更新验收
|
|
164
|
+
4. 记录教训
|
|
165
|
+
|
|
65
166
|
---
|
|
66
167
|
|
|
67
168
|
## Phase 1:技术方案 + ADR
|
|
@@ -70,81 +171,120 @@ permission:
|
|
|
70
171
|
```
|
|
71
172
|
基于 PRD(docs/prd/<title>.md)输出技术方案和 ADR。
|
|
72
173
|
1. 技术方案 → docs/dev/specs/<title>.md
|
|
73
|
-
2.
|
|
74
|
-
3.
|
|
174
|
+
2. 为关键行为定义 Testing Decisions:公共 Test Seam + Observable Result
|
|
175
|
+
3. ADR → docs/adr/<date>-<slug>.md
|
|
176
|
+
4. gh issue comment 附到对应 Issue
|
|
75
177
|
```
|
|
76
178
|
|
|
77
|
-
|
|
179
|
+
## Phase 2:Task Planning + Publish
|
|
78
180
|
|
|
79
|
-
|
|
181
|
+
先执行 Testing Decisions 存量兼容门;通过后再委派 Task Planning。
|
|
80
182
|
|
|
81
183
|
委派 @architect:
|
|
82
184
|
```
|
|
83
|
-
|
|
84
|
-
1.
|
|
85
|
-
2.
|
|
185
|
+
读取 design/spec/ADR,生成 tracer-bullet Task Plan。
|
|
186
|
+
1. 每个 Task 定义可验证的端到端行为、Acceptance Criteria 与真实 blocking edge
|
|
187
|
+
2. 任务定义 → docs/dev/tasks/<task-name>.md(含 frontmatter)
|
|
188
|
+
3. 输出 Mermaid DAG、拓扑顺序与 Task Plan
|
|
189
|
+
4. 返回 Task Plan,不创建 GitHub Issue
|
|
86
190
|
```
|
|
87
191
|
|
|
192
|
+
@dev-lifecycle 收到 Task Plan 后:
|
|
193
|
+
|
|
194
|
+
1. 检查每个 Task 是否包含 `Builds`,且可由 fresh-context developer 独立理解和验证。
|
|
195
|
+
2. 检查每个行为是否映射到 Design `Testing Decisions` 中约定的公共 Test Seam。
|
|
196
|
+
3. 检查是否存在 Controller / Service / DAO 等技术分层式拆分,或完成后不可工作的空壳 Task。
|
|
197
|
+
4. 检查 DAG 是否有环,并确认每条 `Blocked By` 都是真实 blocking edge。
|
|
198
|
+
5. 普通 Flow 自动继续;高风险 Flow 按阶段契约展示 Task Plan,等待用户确认。
|
|
199
|
+
6. 按 DAG 拓扑顺序创建 GitHub Sub Issues。生成长 Markdown 时统一使用下方的 `--body-file -` 示例。
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
gh issue create \
|
|
203
|
+
--parent "$PARENT" \
|
|
204
|
+
--title "$TITLE" \
|
|
205
|
+
--body-file - <<'EOF'
|
|
206
|
+
## Builds
|
|
207
|
+
|
|
208
|
+
...
|
|
209
|
+
|
|
210
|
+
## Acceptance Criteria
|
|
211
|
+
|
|
212
|
+
- [ ] ...
|
|
213
|
+
|
|
214
|
+
## Blocked By
|
|
215
|
+
|
|
216
|
+
None
|
|
217
|
+
EOF
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
7. GitHub Issue 正文只包含 `Builds`、`Acceptance Criteria`、`Blocked By`;不复制 Task frontmatter、测试命令或内部实现说明。
|
|
221
|
+
8. 使用实际 Issue 编号更新 Task frontmatter 的 `issue`、Task 的 `Blocked By` 与 DAG。
|
|
222
|
+
9. 确认 Task 文件和 DAG 已保存后进入 Phase 3。
|
|
223
|
+
|
|
88
224
|
---
|
|
89
225
|
|
|
90
226
|
## Phase 3:并行编码实现
|
|
91
227
|
|
|
92
|
-
按 DAG 拓扑排序逐 batch
|
|
93
|
-
|
|
94
|
-
每个 batch 内,无依赖的 task 使用独立 worktree 并行开发:
|
|
228
|
+
按 DAG 拓扑排序逐 batch 处理。每个 batch 内,无依赖的 task 使用独立 worktree 并行开发。
|
|
229
|
+
进入 Phase 3 或恢复存量 code/review 工作时,先对当前 Task 执行 Testing Decisions 存量兼容门。
|
|
95
230
|
|
|
96
231
|
```
|
|
97
232
|
For each batch:
|
|
98
233
|
For each task in batch (可并行):
|
|
99
|
-
0. 安全检查:确认设计阶段文档已通过
|
|
234
|
+
0. 安全检查:确认设计阶段文档已通过 PR 合入默认分支(无未提交 docs 残留)
|
|
100
235
|
BASE=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')
|
|
101
236
|
git checkout $BASE && git pull origin $BASE
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
237
|
+
1. 为 Task 创建 worktree:
|
|
238
|
+
git worktree add ".worktree/<task-slug>" -b "feat/<task-slug>"
|
|
239
|
+
(前置校验:设计已合并、依赖 task 已合并;并行数 < 5)
|
|
240
|
+
2. 并行派发 @developer 到各 worktree 路径
|
|
241
|
+
3. 每个 agent 在 worktree 内(不 push、不创建 PR):
|
|
242
|
+
- 按 Profile 的 test command 安装/执行测试(技术栈无关,不假设 npm)
|
|
243
|
+
- 加载 `flow-tdd` skill,遵循 TDD Advisory Protocol
|
|
244
|
+
- 编码 + 单测(RED→GREEN cycle + final-regression + final-verification)
|
|
245
|
+
- 本地 commit(不 push)
|
|
246
|
+
- 返回 branch、commit SHA、TDD self-report、test summary
|
|
247
|
+
4. 编排器为完成的 task 创建 PR:
|
|
248
|
+
git push -u origin "feat/<task-slug>"
|
|
249
|
+
gh pr create --base $BASE --head "feat/<task-slug>" \
|
|
250
|
+
--title "feat: <task-slug>" \
|
|
251
|
+
--body "# <task-slug>\n\n- Task Record: #<issue>\n\nCloses #<issue>"
|
|
252
|
+
5. 等待 CI 结果:测试在仓库 CI workflow 中运行(push 触发 GitHub Actions),
|
|
253
|
+
监听 workflow 运行结果确认测试通过,而非本地重复执行:
|
|
254
|
+
gh run watch $(gh run list --branch "feat/<task-slug>" --json databaseId --jq '.[0].databaseId')
|
|
255
|
+
(或 gh pr checks <pr-number> --watch;失败 → 分析日志派回 @developer 修复后重新 push)
|
|
256
|
+
6. 委派 @reviewer 双轴审查各 PR,附带 worktree 路径和分支信息:
|
|
257
|
+
gh pr view <pr-number> --json headRefName,number,title
|
|
258
|
+
⚠️ 审查提示中必须包含:本地 worktree 路径(`.worktree/<task-slug>`)或分支名、
|
|
259
|
+
PR 编号、Task 文件、PRD、技术方案(含 Testing Decisions),以及明确指令:
|
|
260
|
+
**在 worktree/分支内本地审查,禁止 WebFetch 远程代码**
|
|
261
|
+
7. 根据审查结果发布 review:
|
|
262
|
+
gh pr review <pr-number> --approve (或 --request-changes)
|
|
263
|
+
8. CI 通过 + 审查通过后合并:
|
|
264
|
+
gh pr merge <pr-number> --squash --delete-branch --match-head-commit <head-sha>
|
|
265
|
+
9. 合并后销毁 worktree(PR 合并 + 干净 → 自动;脏 → 提示用户手动处理):
|
|
266
|
+
git worktree remove ".worktree/<task-slug>"
|
|
127
267
|
|
|
128
268
|
串行 task(有依赖关系)使用清理后重建策略:
|
|
129
|
-
上一 task 合并 →
|
|
269
|
+
上一 task 合并 → 销毁 worktree → 新建 worktree
|
|
130
270
|
```
|
|
131
271
|
|
|
132
272
|
约束:
|
|
133
|
-
- 并行 task
|
|
273
|
+
- 并行 task 使用不同分支名 `feat/<task-slug>`,避免 `git worktree add` 的分支冲突
|
|
134
274
|
- 每个 agent 启动时显式 `cd .worktree/<task-slug>` 并验证 `pwd`
|
|
135
275
|
- 分支冲突时暂停并提示用户手动清理
|
|
136
|
-
- @developer 不 push、不创建 PR、不操作 Issue —
|
|
137
|
-
-
|
|
276
|
+
- @developer 不 push、不创建 PR、不操作 Issue — 由编排器统一执行
|
|
277
|
+
- 合并前必须校验:CI 全部通过 + 分支保护存在 + `--match-head-commit` 使用已验证的 head SHA
|
|
138
278
|
|
|
139
279
|
---
|
|
140
280
|
|
|
141
281
|
## Phase 4:合并确认
|
|
142
282
|
|
|
143
283
|
确认全部 task PR 已合并:
|
|
144
|
-
1.
|
|
284
|
+
1. `gh pr list --state merged --search "<flow-slug>"` 检查关联 PR 合并状态
|
|
145
285
|
2. 确认所有 Sub Issues 已自动关闭(PR body 含 `Closes #`)
|
|
146
|
-
3. 全部 Task
|
|
147
|
-
|
|
286
|
+
3. 全部 Task 合并后,由 @goal-verify 独立验证 Flow Record 目标是否达成
|
|
287
|
+
(仅 goal-verify 可调用 goal({op:"complete"}))
|
|
148
288
|
|
|
149
289
|
---
|
|
150
290
|
|
|
@@ -160,7 +300,7 @@ For each batch:
|
|
|
160
300
|
|
|
161
301
|
| 场景 | 处理 |
|
|
162
302
|
|------|------|
|
|
163
|
-
| 任何步骤失败 | Pause
|
|
164
|
-
| Task 失败 | 自动重试最多 3
|
|
303
|
+
| 任何步骤失败 | 重试后仍失败 → 派发 `@deep-think`(更强模型)系统审视根因与替代方案;仍无法解决则 Pause,通知用户 |
|
|
304
|
+
| Task 失败 | 自动重试最多 3 次;仍失败先派发 `@deep-think` 审视,再标记 blocked 并停止下游;其他独立 Tasks 继续 |
|
|
165
305
|
| 审查不通过 | 自动修复最多 3 轮;第 3 轮仍未通过则停止该 Task |
|
|
166
|
-
| 连续 3 次 continuation 无可验证进展 | Pause,请求用户介入 |
|
|
306
|
+
| 连续 3 次 continuation 无可验证进展 | 先派发 `@deep-think` 系统审视,再 Pause,请求用户介入 |
|