@ranger1/dx 0.1.15 → 0.1.17
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/@opencode/agents/claude-reviewer.md +57 -0
- package/@opencode/agents/codex-reviewer.md +58 -0
- package/@opencode/agents/gemini-reviewer.md +57 -0
- package/@opencode/agents/pr-context.md +195 -0
- package/@opencode/agents/pr-fix.md +173 -0
- package/@opencode/agents/pr-precheck.md +57 -0
- package/@opencode/agents/pr-review-aggregate.md +118 -0
- package/@opencode/commands/doctor.md +235 -0
- package/@opencode/commands/git-commit-and-pr.md +276 -0
- package/@opencode/commands/git-release.md +642 -0
- package/@opencode/commands/pr-review-loop.md +74 -0
- package/bin/dx.js +31 -0
- package/lib/cli/dx-cli.js +1 -4
- package/lib/cli/help.js +1 -37
- package/lib/opencode-initial.js +108 -0
- package/opencode/agents/claude-reviewer.md +57 -0
- package/opencode/agents/codex-reviewer.md +58 -0
- package/opencode/agents/gemini-reviewer.md +57 -0
- package/opencode/agents/pr-context.md +195 -0
- package/opencode/agents/pr-fix.md +173 -0
- package/opencode/agents/pr-precheck.md +57 -0
- package/opencode/agents/pr-review-aggregate.md +118 -0
- package/opencode/commands/doctor.md +235 -0
- package/opencode/commands/git-commit-and-pr.md +276 -0
- package/opencode/commands/git-release.md +642 -0
- package/opencode/commands/pr-review-loop.md +74 -0
- package/package.json +3 -1
- package/lib/cli/commands/ai.js +0 -215
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: aggregate PR reviews + create fix file
|
|
3
|
+
mode: subagent
|
|
4
|
+
model: openai/gpt-5.1-codex-mini
|
|
5
|
+
temperature: 0.1
|
|
6
|
+
tools:
|
|
7
|
+
write: true
|
|
8
|
+
edit: false
|
|
9
|
+
bash: true
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# PR Review Aggregator
|
|
13
|
+
|
|
14
|
+
## 输入(两种模式)
|
|
15
|
+
|
|
16
|
+
### 模式 A:评审聚合 + 生成 fixFile + 发布评审评论
|
|
17
|
+
|
|
18
|
+
- `PR #<number>`
|
|
19
|
+
- `round: <number>`
|
|
20
|
+
- `runId: <string>`
|
|
21
|
+
- `contextFile: <path>`
|
|
22
|
+
- `reviewFile: <path>`(三行,分别对应 CDX/CLD/GMN)
|
|
23
|
+
|
|
24
|
+
### 模式 B:发布修复评论(基于 fixReportFile)
|
|
25
|
+
|
|
26
|
+
- `PR #<number>`
|
|
27
|
+
- `round: <number>`
|
|
28
|
+
- `runId: <string>`
|
|
29
|
+
- `fixReportFile: <path>`
|
|
30
|
+
|
|
31
|
+
示例:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
PR #123
|
|
35
|
+
round: 1
|
|
36
|
+
runId: abcdef123456
|
|
37
|
+
contextFile: ~/.opencode/cache/pr-context-pr123-r1-abcdef123456.md
|
|
38
|
+
reviewFile: ~/.opencode/cache/review-CDX-pr123-r1-abcdef123456.md
|
|
39
|
+
reviewFile: ~/.opencode/cache/review-CLD-pr123-r1-abcdef123456.md
|
|
40
|
+
reviewFile: ~/.opencode/cache/review-GMN-pr123-r1-abcdef123456.md
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 你要做的事(按模式执行)
|
|
44
|
+
|
|
45
|
+
模式 A:
|
|
46
|
+
|
|
47
|
+
1. Read `contextFile` 与全部 `reviewFile`
|
|
48
|
+
2. 计算 needsFix(P0/P1/P2 任意 > 0)
|
|
49
|
+
3. 发布评审评论到 GitHub(gh pr comment),必须带 marker,评论正文必须内联包含:
|
|
50
|
+
- Summary(P0/P1/P2/P3 统计)
|
|
51
|
+
- P0/P1/P2 问题列表(至少 id/title/file:line/suggestion)
|
|
52
|
+
- 三个 reviewer 的 reviewFile 原文(建议放到 <details>)
|
|
53
|
+
4. 若 needsFix:生成 `fixFile`(Markdown)并返回;否则发布“完成”评论并返回 stop
|
|
54
|
+
|
|
55
|
+
模式 B:
|
|
56
|
+
|
|
57
|
+
1. Read `fixReportFile`
|
|
58
|
+
2. 发布修复评论到 GitHub(gh pr comment),必须带 marker,评论正文必须内联 fixReportFile 内容
|
|
59
|
+
3. 输出 `{"ok":true}`
|
|
60
|
+
|
|
61
|
+
## 输出(强制)
|
|
62
|
+
|
|
63
|
+
模式 A:只输出一个 JSON 对象(很小):
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"stop": false,
|
|
68
|
+
"fixFile": "~/.opencode/cache/fix-pr123-r1-abcdef123456.md"
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
字段:
|
|
73
|
+
|
|
74
|
+
- `stop`: boolean
|
|
75
|
+
- `fixFile`: string(仅 stop=false 时必须提供)
|
|
76
|
+
|
|
77
|
+
模式 B:只输出:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{ "ok": true }
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 规则
|
|
84
|
+
|
|
85
|
+
- 不要输出 ReviewResult JSON
|
|
86
|
+
- 不要校验/要求 reviewer 的 JSON
|
|
87
|
+
- 不要生成/输出任何时间字段
|
|
88
|
+
- `fixFile` 只包含 P0/P1/P2
|
|
89
|
+
- `id` 必须使用 reviewer 给出的 findingId(例如 `CDX-001`),不要再改前缀
|
|
90
|
+
|
|
91
|
+
## 评论要求
|
|
92
|
+
|
|
93
|
+
- 每条评论必须包含:`<!-- pr-review-loop-marker -->`
|
|
94
|
+
- body 必须是最终字符串(用 `--body-file` 读取文件),不要依赖 heredoc 变量展开
|
|
95
|
+
- 禁止在评论里出现本地缓存文件路径(例如 `~/.opencode/cache/...`)
|
|
96
|
+
|
|
97
|
+
## fixFile 输出路径与格式
|
|
98
|
+
|
|
99
|
+
- 路径:`~/.opencode/cache/fix-pr<PR_NUMBER>-r<ROUND>-<RUN_ID>.md`
|
|
100
|
+
- 格式:
|
|
101
|
+
|
|
102
|
+
```md
|
|
103
|
+
# Fix File
|
|
104
|
+
|
|
105
|
+
PR: <PR_NUMBER>
|
|
106
|
+
Round: <ROUND>
|
|
107
|
+
|
|
108
|
+
## IssuesToFix
|
|
109
|
+
|
|
110
|
+
- id: CDX-001
|
|
111
|
+
priority: P1
|
|
112
|
+
category: quality
|
|
113
|
+
file: <path>
|
|
114
|
+
line: <number|null>
|
|
115
|
+
title: <short>
|
|
116
|
+
description: <text>
|
|
117
|
+
suggestion: <text>
|
|
118
|
+
```
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
---
|
|
2
|
+
allowed-tools: [Bash, AskUserQuestion, Edit, Read, Write]
|
|
3
|
+
description: '环境诊断'
|
|
4
|
+
agent: sisyphus
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 0: 强制安装 dx CLI
|
|
10
|
+
|
|
11
|
+
**无论当前是否安装,必须执行:**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm i -g @ranger1/dx
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Step 1: 并行检测
|
|
20
|
+
|
|
21
|
+
**同时执行以下 3 个 Bash 调用(真正并行):**
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 批次 1: CLI 版本检测
|
|
25
|
+
echo "=== CLI_VERSIONS ===";
|
|
26
|
+
echo "opencode:" && (which opencode && opencode --version 2>/dev/null || echo "NOT_FOUND");
|
|
27
|
+
echo "dx:" && (which dx && dx --version 2>/dev/null || echo "NOT_FOUND");
|
|
28
|
+
echo "agent-browser:" && (which agent-browser && agent-browser --version 2>/dev/null || echo "NOT_FOUND");
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# 批次 2: 项目文件检测
|
|
33
|
+
echo "=== PROJECT_FILES ===";
|
|
34
|
+
echo "AGENTS.md:" && (test -f AGENTS.md && echo "FOUND" || echo "NOT_FOUND");
|
|
35
|
+
echo "opencode.json:" && (test -f opencode.json && echo "CONFIGURED" || echo "NOT_FOUND");
|
|
36
|
+
echo "instructions:" && (if [ -f opencode.json ]; then grep -q '"AGENTS.md"' opencode.json && grep -q '"ruler/' opencode.json && echo "VALID" || echo "INVALID"; else echo "SKIP"; fi);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# 批次 3: OpenCode 插件检测
|
|
41
|
+
# 注意:插件名可能带版本号(如 @1.3.0),使用模糊匹配
|
|
42
|
+
echo "=== OPENCODE_PLUGINS ===";
|
|
43
|
+
echo "oh-my-opencode:" && (grep -q 'oh-my-opencode' ~/.config/opencode/opencode.json 2>/dev/null && echo "INSTALLED" || echo "NOT_INSTALLED");
|
|
44
|
+
echo "opencode-openai-codex-auth:" && (grep -q 'opencode-openai-codex-auth' ~/.config/opencode/opencode.json 2>/dev/null && echo "INSTALLED" || echo "NOT_INSTALLED");
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 批次 4: oh-my-opencode.json 配置检测
|
|
49
|
+
echo "=== OMO_CONFIG ===";
|
|
50
|
+
echo "sisyphus_agent:" && (grep -q '"sisyphus_agent"' ~/.config/opencode/oh-my-opencode.json 2>/dev/null && echo "CONFIGURED" || echo "NOT_CONFIGURED");
|
|
51
|
+
echo "categories.quick:" && (grep -q '"quick"' ~/.config/opencode/oh-my-opencode.json 2>/dev/null && echo "CONFIGURED" || echo "NOT_CONFIGURED");
|
|
52
|
+
echo "categories.middle:" && (grep -q '"middle"' ~/.config/opencode/oh-my-opencode.json 2>/dev/null && echo "CONFIGURED" || echo "NOT_CONFIGURED");
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Step 2: 输出报告
|
|
58
|
+
|
|
59
|
+
汇总结果,输出表格:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
工具 | 状态 | 版本
|
|
63
|
+
opencode | <状态> | <版本>
|
|
64
|
+
dx | <状态> | <版本>
|
|
65
|
+
AGENTS.md | <状态> | -
|
|
66
|
+
opencode.json | <状态> | -
|
|
67
|
+
配置指令 | <状态> | -
|
|
68
|
+
oh-my-opencode | <状态> | -
|
|
69
|
+
opencode-openai-codex-auth | <状态> | -
|
|
70
|
+
agent-browser | <状态> | <版本>
|
|
71
|
+
sisyphus_agent 配置 | <状态> | -
|
|
72
|
+
categories.quick 配置 | <状态> | -
|
|
73
|
+
categories.middle 配置 | <状态> | -
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Step 3: 统一处理缺失项
|
|
79
|
+
|
|
80
|
+
**如检测到任何缺失项,统一询问一次:**
|
|
81
|
+
|
|
82
|
+
`AskUserQuestion`: 检测到以下缺失项,是否自动安装/配置所有?
|
|
83
|
+
|
|
84
|
+
确认后按顺序处理:
|
|
85
|
+
|
|
86
|
+
### 3.1 opencode CLI 未安装
|
|
87
|
+
|
|
88
|
+
执行安装:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# brew 优先
|
|
92
|
+
brew install opencode || npm install -g opencode
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 3.2 AGENTS.md 未找到
|
|
96
|
+
|
|
97
|
+
提示用户:
|
|
98
|
+
|
|
99
|
+
- AGENTS.md 文件不存在,OpenCode 需要此文件作为项目指令入口
|
|
100
|
+
- 建议创建或检查文件路径
|
|
101
|
+
|
|
102
|
+
### 3.3 opencode.json 未配置
|
|
103
|
+
|
|
104
|
+
使用 Write 工具创建配置文件:
|
|
105
|
+
|
|
106
|
+
文件路径:`<项目根目录>/opencode.json`
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"$schema": "https://opencode.ai/config.json",
|
|
111
|
+
"instructions": ["AGENTS.md", "ruler/**/*.md"]
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 3.4 配置指令无效
|
|
116
|
+
|
|
117
|
+
使用 Edit 工具修复 opencode.json,确保包含:
|
|
118
|
+
|
|
119
|
+
- `"AGENTS.md"`: 主配置文件
|
|
120
|
+
- `"ruler/**/*.md"`: 自动加载 ruler 目录下所有 .md 文件(因 OpenCode 不支持 @ 引用)
|
|
121
|
+
|
|
122
|
+
### 3.5 OpenCode 插件安装
|
|
123
|
+
|
|
124
|
+
**OpenCode 插件通过编辑 `~/.config/opencode/opencode.json` 的 `plugin` 数组安装。**
|
|
125
|
+
|
|
126
|
+
1. 先读取现有配置:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
cat ~/.config/opencode/opencode.json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
2. 使用 Edit 工具在 `plugin` 数组中添加缺失的插件:
|
|
133
|
+
- `oh-my-opencode`
|
|
134
|
+
- `opencode-openai-codex-auth`
|
|
135
|
+
|
|
136
|
+
示例 plugin 配置:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
"plugin": [
|
|
140
|
+
"oh-my-opencode",
|
|
141
|
+
"opencode-openai-codex-auth"
|
|
142
|
+
]
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
3. 验证安装:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
grep -E 'oh-my-opencode|opencode-openai-codex-auth' ~/.config/opencode/opencode.json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 3.6 agent-browser 未安装
|
|
152
|
+
|
|
153
|
+
执行安装:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npm install -g agent-browser && agent-browser install
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 3.7 oh-my-opencode.json 配置缺失
|
|
160
|
+
|
|
161
|
+
**检查并修复 `~/.config/opencode/oh-my-opencode.json` 配置。**
|
|
162
|
+
|
|
163
|
+
1. 先读取现有配置:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
cat ~/.config/opencode/oh-my-opencode.json
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
2. 使用 Edit 工具添加缺失的配置节点:
|
|
170
|
+
|
|
171
|
+
#### 3.7.1 sisyphus_agent 配置缺失
|
|
172
|
+
|
|
173
|
+
如果根节点缺少 `sisyphus_agent`,使用 Edit 工具添加:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"sisyphus_agent": {
|
|
178
|
+
"disabled": false,
|
|
179
|
+
"default_builder_enabled": true,
|
|
180
|
+
"planner_enabled": true,
|
|
181
|
+
"replace_plan": false
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
注意:这是根节点配置,应添加到 JSON 的第一层级。
|
|
187
|
+
|
|
188
|
+
#### 3.7.2 categories.quick 或 categories.middle 缺失
|
|
189
|
+
|
|
190
|
+
如果 `categories` 节点缺少 `quick` 或 `middle`,使用 Edit 工具添加:
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"categories": {
|
|
195
|
+
"quick": {
|
|
196
|
+
"model": "github-copilot/claude-haiku-4.5"
|
|
197
|
+
},
|
|
198
|
+
"middle": {
|
|
199
|
+
"model": "github-copilot/claude-sonnet-4.5"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
3. 验证配置:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# 检查 sisyphus_agent
|
|
209
|
+
grep -q '"sisyphus_agent"' ~/.config/opencode/oh-my-opencode.json && echo "✅ sisyphus_agent 已配置" || echo "❌ sisyphus_agent 缺失"
|
|
210
|
+
|
|
211
|
+
# 检查 categories.quick
|
|
212
|
+
grep -q '"quick"' ~/.config/opencode/oh-my-opencode.json && echo "✅ quick 已配置" || echo "❌ quick 缺失"
|
|
213
|
+
|
|
214
|
+
# 检查 categories.middle
|
|
215
|
+
grep -q '"middle"' ~/.config/opencode/oh-my-opencode.json && echo "✅ middle 已配置" || echo "❌ middle 缺失"
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 输出格式
|
|
221
|
+
|
|
222
|
+
**全部就绪:**
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
✅ 所有依赖已就绪
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**有缺失:**
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
⚠️ <工具> 未安装/未配置
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**修复完成后:**
|
|
235
|
+
输出最终状态表格,确认所有项目均为 ✅
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
2
|
+
allowed-tools: [Bash, Read, Glob, TodoWrite, Edit, Grep]
|
|
3
|
+
description: 'Git 工作流:Issue/Commit/PR 自动化'
|
|
4
|
+
agent: quick
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 用法
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
/git-commit-and-pr # 自动检测并执行所需阶段
|
|
11
|
+
/git-commit-and-pr --issue <ID> # 指定关联 Issue
|
|
12
|
+
/git-commit-and-pr --issue-only # 仅创建 Issue
|
|
13
|
+
/git-commit-and-pr --pr --base <BRANCH> # 仅创建 PR
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 执行流程
|
|
19
|
+
|
|
20
|
+
### Step 1: 状态检测
|
|
21
|
+
|
|
22
|
+
并行执行:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git status --short
|
|
26
|
+
git branch --show-current
|
|
27
|
+
git log -1 --format='%H %s' 2>/dev/null || echo "no-commits"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
根据状态决定执行阶段:
|
|
31
|
+
|
|
32
|
+
- 无 Issue 或 `--issue-only` → 执行 Issue 创建
|
|
33
|
+
- 有未提交修改 → 执行 Commit 流程
|
|
34
|
+
- 工作树干净且在功能分支 → 执行 PR 创建
|
|
35
|
+
|
|
36
|
+
**禁止在 main/master 直接提交。**
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### Step 2: Issue 创建(可选)
|
|
41
|
+
|
|
42
|
+
#### 2.1 信息收集与分析
|
|
43
|
+
|
|
44
|
+
**代码变更分析(并行执行):**
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
git status --short
|
|
48
|
+
git diff --stat
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**重复检查(可选):**
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
gh issue list --search "<关键词>" --limit 5
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**上下文提炼:**
|
|
58
|
+
|
|
59
|
+
- 从对话历史中提取问题描述和需求背景
|
|
60
|
+
- 识别受影响的模块(backend/front/admin/shared)
|
|
61
|
+
- 确认是否涉及数据库、API 或基础设施变更
|
|
62
|
+
|
|
63
|
+
#### 2.2 Issue 内容生成
|
|
64
|
+
|
|
65
|
+
**标题生成策略:**
|
|
66
|
+
|
|
67
|
+
- 格式:`[模块] 简洁描述` 或 `[类型] 功能/问题描述`
|
|
68
|
+
- 示例:
|
|
69
|
+
- `[Backend] 优化用户认证流程性能`
|
|
70
|
+
- `[Bug] 修复聊天消息丢失问题`
|
|
71
|
+
- `[规范] 统一错误码命名规范`
|
|
72
|
+
- 优先使用用户提供的 `--title` 参数
|
|
73
|
+
|
|
74
|
+
**标签选择(基于内容自动添加):**
|
|
75
|
+
|
|
76
|
+
- `bug` - Bug 修复
|
|
77
|
+
- `enhancement` - 功能增强
|
|
78
|
+
- `documentation` - 文档相关
|
|
79
|
+
- `performance` - 性能优化
|
|
80
|
+
- `refactor` - 代码重构
|
|
81
|
+
- `backend` / `frontend` - 模块标签
|
|
82
|
+
- `infrastructure` - 基础设施
|
|
83
|
+
|
|
84
|
+
**正文结构模板:**
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
## 背景
|
|
88
|
+
|
|
89
|
+
[当前场景、讨论来源、为什么需要这个改动]
|
|
90
|
+
|
|
91
|
+
## 现状/问题
|
|
92
|
+
|
|
93
|
+
[观察到的问题、现有实现的不足、需要改进的地方]
|
|
94
|
+
|
|
95
|
+
## 期望行为
|
|
96
|
+
|
|
97
|
+
[目标状态、期望结果、验收标准]
|
|
98
|
+
|
|
99
|
+
## 执行计划
|
|
100
|
+
|
|
101
|
+
- [ ] 步骤 1
|
|
102
|
+
- [ ] 步骤 2
|
|
103
|
+
- [ ] 步骤 3
|
|
104
|
+
|
|
105
|
+
## 影响范围
|
|
106
|
+
|
|
107
|
+
[受影响的模块、可能的风险、需要通知的团队]
|
|
108
|
+
|
|
109
|
+
## 相关资源
|
|
110
|
+
|
|
111
|
+
[相关 Issue、PR、文档链接]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### 2.3 执行 Issue 创建
|
|
115
|
+
|
|
116
|
+
使用 heredoc 格式执行 gh CLI:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
gh issue create \
|
|
120
|
+
--title "[模块] 问题摘要" \
|
|
121
|
+
--label label1 --label label2 \
|
|
122
|
+
--body-file - <<'MSG'
|
|
123
|
+
## 背景
|
|
124
|
+
|
|
125
|
+
[从对话历史提炼的背景信息]
|
|
126
|
+
|
|
127
|
+
## 现状/问题
|
|
128
|
+
|
|
129
|
+
[代码变更分析结果和问题描述]
|
|
130
|
+
|
|
131
|
+
## 期望行为
|
|
132
|
+
|
|
133
|
+
[目标状态和验收标准]
|
|
134
|
+
|
|
135
|
+
## 执行计划
|
|
136
|
+
|
|
137
|
+
- [ ] 步骤 1
|
|
138
|
+
- [ ] 步骤 2
|
|
139
|
+
|
|
140
|
+
## 影响范围
|
|
141
|
+
|
|
142
|
+
[受影响模块列表]
|
|
143
|
+
MSG
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**质量检查清单:**
|
|
147
|
+
|
|
148
|
+
- [ ] 标题简洁明确(≤ 80 字符)
|
|
149
|
+
- [ ] 背景信息完整
|
|
150
|
+
- [ ] 问题/需求描述清晰
|
|
151
|
+
- [ ] 执行步骤可操作
|
|
152
|
+
- [ ] 影响范围已标注
|
|
153
|
+
- [ ] 标签选择准确
|
|
154
|
+
- [ ] 无敏感信息(.env、密钥等)
|
|
155
|
+
|
|
156
|
+
#### 2.4 输出 Issue 信息
|
|
157
|
+
|
|
158
|
+
成功创建后,解析 gh 输出获取 Issue 编号:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
✅ Issue 创建成功
|
|
162
|
+
|
|
163
|
+
Issue: #<编号>
|
|
164
|
+
标题: <标题>
|
|
165
|
+
链接: <GitHub URL>
|
|
166
|
+
标签: <标签列表>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
存储 Issue ID 供后续 commit 和 PR 使用。
|
|
170
|
+
|
|
171
|
+
`--issue-only` 时在此终止。
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### Step 3: Commit 流程
|
|
176
|
+
|
|
177
|
+
#### 3.1 暂存变更
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
git add -A
|
|
181
|
+
git diff --cached --stat
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### 3.2 生成提交
|
|
185
|
+
|
|
186
|
+
分析 `git diff --cached` 内容,生成 commit message:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
git commit -F - <<'EOF'
|
|
190
|
+
<type>: <概要>
|
|
191
|
+
|
|
192
|
+
变更说明:
|
|
193
|
+
- <变更项1>
|
|
194
|
+
- <变更项2>
|
|
195
|
+
|
|
196
|
+
Refs: #<issue-id>
|
|
197
|
+
EOF
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
type 类型:feat/fix/refactor/docs/chore/test
|
|
201
|
+
|
|
202
|
+
#### 3.3 确认提交
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
git status
|
|
206
|
+
git log -1 --oneline
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### Step 4: PR 创建
|
|
212
|
+
|
|
213
|
+
#### 4.1 推送分支
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
git push -u origin HEAD
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
#### 4.2 分析变更
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
git log origin/master..HEAD --oneline
|
|
223
|
+
git diff origin/master...HEAD --stat
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
#### 4.3 创建 PR
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
gh pr create --title '<type>: <概要>' --body-file - <<'EOF'
|
|
230
|
+
## 变更说明
|
|
231
|
+
|
|
232
|
+
- <变更项>
|
|
233
|
+
|
|
234
|
+
## 测试
|
|
235
|
+
|
|
236
|
+
- [ ] 本地测试通过
|
|
237
|
+
|
|
238
|
+
Closes: #<issue-id>
|
|
239
|
+
EOF
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### 4.4 提示评审
|
|
243
|
+
|
|
244
|
+
创建 PR 成功后,提醒用户运行自动评审流程:
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
💡 提示:运行以下命令启动自动评审
|
|
248
|
+
/dx:pr-review-loop --pr <PR_NUMBER>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 输出格式
|
|
254
|
+
|
|
255
|
+
**成功:**
|
|
256
|
+
|
|
257
|
+
```
|
|
258
|
+
✅ 完成
|
|
259
|
+
|
|
260
|
+
Issue: #<编号> <标题>
|
|
261
|
+
Commit: <hash> <主题>
|
|
262
|
+
PR: #<编号> → <URL>
|
|
263
|
+
|
|
264
|
+
💡 下一步:运行以下命令启动自动评审
|
|
265
|
+
/dx:pr-review-loop --pr <编号>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**部分完成:**
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
⚠️ 停止于 [阶段]
|
|
272
|
+
|
|
273
|
+
已完成:<列表>
|
|
274
|
+
阻塞:<原因>
|
|
275
|
+
继续:/dx:git-commit-and-pr --issue <编号>
|
|
276
|
+
```
|