@flyin-ai/alloy 0.2.0-beta.1 → 0.2.0-beta.2
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/commands/alloy/apply.md +222 -430
- package/commands/alloy/archive.md +156 -132
- package/commands/alloy/discard.md +26 -11
- package/commands/alloy/finish.md +212 -116
- package/commands/alloy/fix.md +102 -247
- package/commands/alloy/plan.md +204 -301
- package/commands/alloy/references/apply-precheck.md +21 -0
- package/commands/alloy/references/apply-rationalizations.md +18 -0
- package/commands/alloy/references/apply-subagent-commit.md +49 -0
- package/commands/alloy/references/apply-worktree.md +130 -0
- package/commands/alloy/references/archive-rationalizations.md +16 -0
- package/commands/alloy/references/archive-worktree-cleanup.md +94 -0
- package/commands/alloy/references/artifact-hash-commit.md +49 -0
- package/commands/alloy/references/branch-naming.md +65 -0
- package/commands/alloy/references/branch-validation.md +36 -0
- package/commands/alloy/references/fix-precommit-check.md +58 -0
- package/commands/alloy/references/interaction-style.md +34 -1
- package/commands/alloy/references/main-branch-detection.md +3 -6
- package/commands/alloy/references/phase-downgrade-path.md +27 -0
- package/commands/alloy/references/plan-rollback.md +84 -0
- package/commands/alloy/references/spec-sync.md +62 -0
- package/commands/alloy/references/start-rationalizations.md +18 -0
- package/commands/alloy/start.md +178 -238
- package/dist/cli/commands/completion.js +13 -2
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/internal/artifact.d.ts +7 -0
- package/dist/cli/commands/internal/artifact.js +70 -0
- package/dist/cli/commands/internal/artifact.js.map +1 -0
- package/dist/cli/commands/internal/guard.js +204 -2
- package/dist/cli/commands/internal/guard.js.map +1 -1
- package/dist/cli/commands/internal/progress.d.ts +10 -0
- package/dist/cli/commands/internal/progress.js +70 -0
- package/dist/cli/commands/internal/progress.js.map +1 -0
- package/dist/cli/commands/internal/spec-audit.d.ts +42 -0
- package/dist/cli/commands/internal/spec-audit.js +363 -0
- package/dist/cli/commands/internal/spec-audit.js.map +1 -0
- package/dist/cli/commands/internal/state.js +4 -0
- package/dist/cli/commands/internal/state.js.map +1 -1
- package/dist/cli/index.js +30 -0
- package/dist/cli/index.js.map +1 -1
- package/package.json +2 -1
package/commands/alloy/fix.md
CHANGED
|
@@ -3,77 +3,67 @@ name: "Alloy: Fix"
|
|
|
3
3
|
description: Alloy Bug 修复入口 - 发现 bug 时调用
|
|
4
4
|
category: Workflow
|
|
5
5
|
tags: [alloy, workflow]
|
|
6
|
+
spec: 01-product-spec/06-fix-spec.md
|
|
7
|
+
behaviors:
|
|
8
|
+
stops: 8
|
|
9
|
+
hard_stops: 5
|
|
10
|
+
artifacts: []
|
|
11
|
+
transitions_to: ""
|
|
12
|
+
external_calls: [superpowers:systematic-debugging, superpowers:test-driven-development, superpowers:verification-before-completion]
|
|
6
13
|
---
|
|
7
14
|
|
|
8
15
|
# alloy-fix
|
|
9
16
|
|
|
10
|
-
你是 Alloy 的 Bug
|
|
17
|
+
你是 Alloy 的 Bug 修复入口。系统化诊断问题根因、根据是否需要变更 spec 进行分流,确认是代码 bug 后按 change 状态选择修复分支。
|
|
11
18
|
|
|
12
19
|
**核心原则:诊断先行——先判断是代码 bug 还是 spec 变更;分支后置——确认是代码 bug 后才选择分支策略。**
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
```
|
|
22
|
+
NO FIX WITHOUT DIAGNOSIS
|
|
23
|
+
先跑 systematic-debugging,再谈修复。跳诊的坏账率极高
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**交互规则:** `🔴 STOP` = 硬交互确认点,必须用 `AskUserQuestion`(`commands/alloy/references/interaction-style.md`,含"沉默 ≠ 授权"通用禁令——禁批量打包、禁基于内容跳过、禁 agent 回填精确字符串)。跳过任何 🔴 STOP = 违反 Iron Law。
|
|
15
27
|
|
|
16
28
|
**调用外部命令或技能前,先输出标题和状态描述,再执行操作。**
|
|
17
29
|
|
|
18
30
|
---
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
- 没跑 systematic-debugging 就凭直觉修——"一看就知道是哪的问题"——根因可能完全错误
|
|
22
|
-
- 诊断出需改 spec 但直接修代码不改 spec——spec 和代码从此分叉,下次换人(换 session)就断片
|
|
23
|
-
- spec 变更直接硬改代码——需求问题伪装成 bug 修复,后续 audit 无法追溯
|
|
24
|
-
|
|
25
|
-
**什么算"分支策略选错"(反例):**
|
|
26
|
-
- 在已 finish 的 change 上继续修——change 已交付,混入新修复破坏审计链
|
|
27
|
-
- 无归属 change 时直接在 main 上修——热修没有隔离分支,出问题无法回滚
|
|
28
|
-
- hotfix 分支不合并就丢弃——修复丢失,线上问题依然存在
|
|
29
|
-
|
|
30
|
-
### Red Flags——STOP,不要继续
|
|
31
|
-
|
|
32
|
-
以下任何一个念头出现,都意味着流程正在被绕过:
|
|
32
|
+
### Red Flags——STOP
|
|
33
33
|
|
|
34
34
|
| 借口 | 现实 |
|
|
35
35
|
|------|------|
|
|
36
|
-
| "就在 main 上修吧,反正就改一行" |
|
|
37
|
-
| "我知道 bug 在哪,不用诊断" | "一看就知道"
|
|
38
|
-
| "
|
|
39
|
-
| "继续在 login-feature
|
|
40
|
-
| "需求不对,我顺便改下 spec" | spec 问题 = 新 change
|
|
41
|
-
|
|
42
|
-
## 前置检查
|
|
36
|
+
| "就在 main 上修吧,反正就改一行" | 一行和千行保护等级一样。main 污染 = 所有人受影响。建分支只需 2 秒。 |
|
|
37
|
+
| "我知道 bug 在哪,不用诊断" | "一看就知道"是修复中最危险的错觉。跳诊 → 修错地方 → 引入新 bug → 回滚 → 重新排查。 |
|
|
38
|
+
| "用户很确定说是 X 的问题" | 没有堆栈和复现步骤的"诊断"只是猜测。证据驱动,不信任任何人(包括自己)。 |
|
|
39
|
+
| "继续在 login-feature 上修就行" | finished 是终态——已交付 change 混入新修复破坏审计链。代码在 main 上,不在 feature 分支。 |
|
|
40
|
+
| "需求不对,我顺便改下 spec" | spec 问题 = 新 change。修复中发现 spec 问题 → 不阻断修复,完成后提示开新 change。 |
|
|
41
|
+
| "性能/重构/优化也算 fix,不用开新 change" | 命中关键词必须经过 USER_GATE。fix 跳新 change = spec 与代码分叉的隐蔽路径。 |
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
---
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
skill: systematic-debugging test-driven-development verification-before-completion
|
|
45
|
+
## 前置检查
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
**1. Skill 预检:** skill: systematic-debugging test-driven-development verification-before-completion
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
读取 `commands/alloy/references/skill-precheck.md` 检测。任一缺失 → 引导 `alloy init` → STOP。
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
- phase = `applied` 且 worktree 已清理 → 标记"场景 2:feature 分支修复"
|
|
55
|
-
- phase = `planned` → 标记"场景 2:feature 分支修复"
|
|
56
|
-
- phase = `archived` 且 worktree 已清理 → 标记"场景 3:热修候选"
|
|
57
|
-
- phase = `finished` → 标记"场景 3:热修候选"
|
|
58
|
-
- 无活跃 change → 标记"场景 3:热修候选"
|
|
51
|
+
**2. Phase 校验与场景标记:** 检测活跃 change 的 phase:
|
|
59
52
|
|
|
60
|
-
|
|
53
|
+
- phase = `applied` 且 worktree 存在 → **场景 1:worktree 内修复**
|
|
54
|
+
- phase = `applied`(worktree 已清理)或 `planned` → **场景 2:feature 分支修复**
|
|
55
|
+
- phase = `archived` / `finished` / 无活跃 change → **场景 3:热修候选**
|
|
61
56
|
|
|
62
|
-
|
|
57
|
+
不阻断——fix 的用户可能不在任何 change 上下文中。
|
|
63
58
|
|
|
64
59
|
```
|
|
65
60
|
Alloy · Bug 修复
|
|
66
61
|
──────────────────────────────────────
|
|
67
62
|
```
|
|
68
63
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
[Step 1/3] 环境感知
|
|
73
|
-
──────────────────────────────────────
|
|
74
|
-
```
|
|
64
|
+
---
|
|
75
65
|
|
|
76
|
-
|
|
66
|
+
### [Step 1/3] 环境感知
|
|
77
67
|
|
|
78
68
|
```bash
|
|
79
69
|
# 检测是否在 worktree 中
|
|
@@ -84,20 +74,11 @@ IN_WORKTREE=$([ "$GIT_DIR" != "$GIT_COMMON" ] && echo "true" || echo "false")
|
|
|
84
74
|
# 检测活跃 change
|
|
85
75
|
alloy status --json 2>/dev/null
|
|
86
76
|
|
|
87
|
-
#
|
|
77
|
+
# 读取主分支配置
|
|
88
78
|
alloy _config read . main_branch 2>/dev/null
|
|
89
79
|
```
|
|
90
80
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
```
|
|
94
|
-
当前分支: <branch>
|
|
95
|
-
Worktree: <是/否>(<path>)
|
|
96
|
-
活跃 change: <name>(phase: <phase>)/ 无
|
|
97
|
-
主分支: <main_branch> / 待确认
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
如果检测到活跃 change,结合 Phase 校验的场景标记,在输出中标注场景编号,供 Step 3 使用。
|
|
81
|
+
输出:当前分支 / Worktree(是/否+路径) / 活跃 change(phase) / 主分支。结合场景标记标注场景编号。
|
|
101
82
|
|
|
102
83
|
---
|
|
103
84
|
|
|
@@ -106,253 +87,131 @@ Worktree: <是/否>(<path>)
|
|
|
106
87
|
```
|
|
107
88
|
[Step 2/3] 根因诊断 · superpowers:systematic-debugging
|
|
108
89
|
──────────────────────────────────────
|
|
109
|
-
|
|
110
|
-
正在系统化诊断问题...
|
|
111
90
|
```
|
|
112
91
|
|
|
113
|
-
|
|
92
|
+
加载 `superpowers:systematic-debugging` 技能。禁止跳过——普通对话无法替代系统化调试(复现 → 假设 → 验证 → 定位)。
|
|
114
93
|
|
|
115
|
-
如果 `superpowers:systematic-debugging` 不可用,引导用户运行 `alloy init` 完成环境初始化。
|
|
116
|
-
|
|
117
|
-
**技能加载后记录(仅在场景 1/2 有归属 change 时):**
|
|
118
94
|
```bash
|
|
119
95
|
[ -n "<name>" ] && alloy _skill log openspec/changes/<name> fix superpowers:systematic-debugging
|
|
120
96
|
```
|
|
121
97
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
**诊断确认与分流(阻塞点):**
|
|
98
|
+
诊断必须产出明确结论:**根因、涉及文件、是否偏离 spec。**
|
|
125
99
|
|
|
126
|
-
|
|
100
|
+
**诊断确认(阻塞点):** 🔴 STOP: 确认诊断结论(根因+涉及文件+是否偏离 spec)。确认后进入 Step 3 或回到 Step 2 重新诊断。
|
|
127
101
|
|
|
128
|
-
|
|
129
|
-
> - 根因:<根因描述>
|
|
130
|
-
> - 涉及文件:<文件列表>
|
|
131
|
-
> - 是否偏离 spec:<是 / 否>
|
|
102
|
+
**关键词二次 USER_GATE(⛔ HARD_STOP,task L6):** 用户原始描述或诊断结论命中下列关键词时,必须追加 🔴 USER_GATE 让用户物理确认"这是 bug 修复,不是新需求/重构"。命中关键词检测:
|
|
132
103
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
question: "确认以上诊断结论?",
|
|
138
|
-
header: "诊断确认",
|
|
139
|
-
options: [
|
|
140
|
-
{ label: "(a) 确认,进入修复", description: "根因确认无误,根据分流逻辑进入对应修复路径" },
|
|
141
|
-
{ label: "(b) 重新诊断", description: "诊断结论有误,回到 Step 2 重新分析" }
|
|
142
|
-
],
|
|
143
|
-
multiSelect: false
|
|
144
|
-
}]
|
|
145
|
-
}
|
|
104
|
+
```bash
|
|
105
|
+
# 输入:$USER_DESC(用户原始描述)+ $DIAGNOSIS(诊断结论)
|
|
106
|
+
KEYWORDS="优化|性能|performance|refactor|重构|改造|增强|enhancement|提升|更好|更快"
|
|
107
|
+
HIT=$(echo "$USER_DESC $DIAGNOSIS" | grep -Eo "$KEYWORDS" | sort -u | tr '\n' ' ')
|
|
146
108
|
```
|
|
147
109
|
|
|
148
|
-
|
|
149
|
-
```
|
|
150
|
-
> → (a) 确认,进入修复 — 根因确认无误,进入修复路径
|
|
151
|
-
> → (b) 重新诊断 — 回到 Step 2 重新分析
|
|
152
|
-
> 请输入 a 或 b:
|
|
153
|
-
```
|
|
110
|
+
`$HIT` 非空 → 🔴 USER_GATE(必须 AskUserQuestion):
|
|
154
111
|
|
|
155
|
-
|
|
112
|
+
> 检测到关键词:`$HIT`
|
|
113
|
+
> 这类工作通常不是 bug 修复——
|
|
114
|
+
> - **性能优化 / 重构 / 增强**:应走 `/alloy:start` 开新 change(spec 需描述新行为或性能契约)
|
|
115
|
+
> - **真正的 bug 修复**:spec 已定义的行为坏了 / 测试期望已存在
|
|
116
|
+
>
|
|
117
|
+
> 选项:
|
|
118
|
+
> (a) 这是真正的 bug 修复——spec 行为坏了(继续 fix)
|
|
119
|
+
> (b) 这是新需求 / 重构 / 优化——退出 fix,运行 `/alloy:start` 开新 change
|
|
120
|
+
> (c) 两者混合——退出 fix,先开 change 处理新需求,剩余 bug 再回 fix
|
|
156
121
|
|
|
157
|
-
|
|
158
|
-
- spec 没有描述这个边界情况,代码行为合理但 spec 需要补充
|
|
159
|
-
- spec 描述的行为本身就是错的(比如业务逻辑变更后 spec 没更新)
|
|
160
|
-
- 修复需要新增一个 spec 中没有的 capability
|
|
122
|
+
**[HARD_STOP]** agent 不得基于"用户用了 fix 命令所以一定是 bug"自动选 (a)——必须用户物理选择。命中关键词且未经 USER_GATE 直接进 Step 3 = 违反 Iron Law。
|
|
161
123
|
|
|
162
|
-
|
|
163
|
-
- 函数返回值与 spec 描述的行为不一致
|
|
164
|
-
- spec 说"空数组返回 []"但代码对空数组抛了异常
|
|
165
|
-
- 性能不达标,但 spec 没有性能要求
|
|
124
|
+
**违反字面 = 违反精神:** 哪怕"用户描述里说了 bug 字样"或"诊断结论看着像 bug",只要命中关键词就必须 USER_GATE。fix 流程跳过新 change 闸门 = spec 与代码分叉的隐蔽路径。
|
|
166
125
|
|
|
167
|
-
|
|
126
|
+
**"需改 spec"的判断:** spec 未描述此边界 / spec 行为本身有错 / 修复需新增 spec 中没有的 capability。
|
|
168
127
|
|
|
169
|
-
|
|
128
|
+
**"代码 bug"的判断:** 函数返回值与 spec 不一致 / spec 说 A 但代码做了 B / 性能不达标但 spec 没有性能要求。
|
|
170
129
|
|
|
171
|
-
|
|
130
|
+
---
|
|
172
131
|
|
|
173
|
-
|
|
132
|
+
### [Step 3/3] 分支选择 + 修复
|
|
174
133
|
|
|
175
|
-
|
|
176
|
-
> - 诊断完直接改代码,不创建分支——"反正就改一行"
|
|
177
|
-
> - 说"先改了再挪到分支"——commit 已经污染了 main
|
|
178
|
-
> - 用户说"就在 main 上修吧"——仍应明确拒绝并解释风险。一行和千行的保护等级完全一样
|
|
179
|
-
> - "项目没有 alloy init 过的,不用管吧"——主分支保护是工程常识,与是否初始化 alloy 无关
|
|
134
|
+
确认是代码 bug 后,根据场景编号走对应路径。**场景标记不可跳过。**
|
|
180
135
|
|
|
181
|
-
|
|
136
|
+
**[HARD STOP] 主分支保护:** 当前在主分支且无活跃 change → **禁止直接修改代码**。任何主分支上的 commit 都污染历史。必须先创建分支。一行和千行保护等级完全一样。
|
|
182
137
|
|
|
183
|
-
|
|
138
|
+
#### 场景 1:有归属 change + worktree 存在
|
|
184
139
|
|
|
185
140
|
```
|
|
186
141
|
[Step 3/3] 修复 · worktree 内修复
|
|
187
|
-
|
|
188
|
-
归属 change: <name>(phase: applied)
|
|
189
|
-
Worktree: <path>
|
|
190
|
-
在 worktree 内修复并提交
|
|
142
|
+
归属 change: <name>(phase: applied)Worktree: <path>
|
|
191
143
|
```
|
|
192
144
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
alloy _skill log openspec/changes/<name> fix superpowers:test-driven-development
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
2. 使用 Skill 工具加载 `superpowers:verification-before-completion` 技能 —— 验证修复
|
|
202
|
-
|
|
203
|
-
**技能加载后立即记录:**
|
|
204
|
-
```bash
|
|
205
|
-
alloy _skill log openspec/changes/<name> fix superpowers:verification-before-completion
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
3. 精确提交到 worktree 分支:
|
|
209
|
-
```bash
|
|
210
|
-
git add <精确路径>
|
|
211
|
-
git commit -m "fix: <描述>"
|
|
212
|
-
```
|
|
145
|
+
1. 加载 `test-driven-development` → 写失败测试 → 修代码
|
|
146
|
+
2. 加载 `verification-before-completion` → 验证修复
|
|
147
|
+
3. **⛔ HARD_STOP pre-commit 校验**(读取 `commands/alloy/references/fix-precommit-check.md`):commit 前必须确认 skill_usage[] 包含 `fix/test-driven-development` + `fix/verification-before-completion` 两条 `action=log` 记录。缺失 → 返回步骤 1-2 重做,**禁 agent 自动补 `_skill log` 后继续**。
|
|
148
|
+
4. 🔴 STOP: 确认修复内容(展示 `git diff --stat` 和关键变更摘要。确认提交 / 需要调整)
|
|
149
|
+
5. 精确提交:`git add <路径> && git commit -m "fix: <描述>"`
|
|
213
150
|
|
|
214
|
-
|
|
151
|
+
```bash
|
|
152
|
+
alloy _skill log openspec/changes/<name> fix superpowers:test-driven-development
|
|
153
|
+
alloy _skill log openspec/changes/<name> fix superpowers:verification-before-completion
|
|
154
|
+
```
|
|
215
155
|
|
|
216
|
-
|
|
156
|
+
#### 场景 2:有归属 change + worktree 已清理
|
|
217
157
|
|
|
218
158
|
```
|
|
219
159
|
[Step 3/3] 修复 · feature 分支修复
|
|
220
|
-
|
|
221
|
-
归属 change: <name>(phase: <phase>)
|
|
222
|
-
Feature 分支: <branch>
|
|
223
|
-
在 feature 分支修复并提交
|
|
160
|
+
归属 change: <name>(phase: <phase>)Feature 分支: <branch>
|
|
224
161
|
```
|
|
225
162
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
alloy _skill log openspec/changes/<name> fix superpowers:test-driven-development
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
2. 使用 Skill 工具加载 `superpowers:verification-before-completion` 技能
|
|
235
|
-
|
|
236
|
-
**技能加载后立即记录:**
|
|
237
|
-
```bash
|
|
238
|
-
alloy _skill log openspec/changes/<name> fix superpowers:verification-before-completion
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
3. 精确提交到 feature 分支:
|
|
242
|
-
```bash
|
|
243
|
-
git add <精确路径>
|
|
244
|
-
git commit -m "fix: <描述>"
|
|
245
|
-
```
|
|
163
|
+
1. 加载 `test-driven-development`
|
|
164
|
+
2. 加载 `verification-before-completion`
|
|
165
|
+
3. **⛔ HARD_STOP pre-commit 校验**(读取 `commands/alloy/references/fix-precommit-check.md`):与场景 1 相同——skill_usage[] 校验通过才能进入步骤 4。
|
|
166
|
+
4. 🔴 STOP: 确认修复内容(展示 `git diff --stat` 和关键变更摘要。确认提交 / 需要调整)
|
|
167
|
+
5. 精确提交到 feature 分支
|
|
246
168
|
|
|
247
|
-
|
|
169
|
+
```bash
|
|
170
|
+
alloy _skill log openspec/changes/<name> fix superpowers:test-driven-development
|
|
171
|
+
alloy _skill log openspec/changes/<name> fix superpowers:verification-before-completion
|
|
172
|
+
```
|
|
248
173
|
|
|
249
|
-
|
|
174
|
+
#### 场景 3:无归属 change / change 已 finish
|
|
250
175
|
|
|
251
176
|
```
|
|
252
177
|
[Step 3/3] 修复 · 热修分支
|
|
253
|
-
──────────────────────────────────────
|
|
254
178
|
无活跃归属 change,创建热修分支
|
|
255
179
|
```
|
|
256
180
|
|
|
257
|
-
**确认主分支(阻塞点):**
|
|
181
|
+
**确认主分支(阻塞点):** 🔴 STOP: 确认主分支。读取 `commands/alloy/references/main-branch-detection.md`,优先读 config,未配置时按 3 级优先级检测。确认后:`alloy _config write . main_branch <值>`
|
|
258
182
|
|
|
259
|
-
|
|
183
|
+
**⛔ PRECONDITION_FAIL 分支命名白名单**(读取 `commands/alloy/references/branch-naming.md`):默认热修分支名 `fix/<desc>`(**禁用历史 `hotfix/` prefix**——不在 CLAUDE.md 白名单内)。用户自定义时必须以 `feature/` `fix/` `docs/` `refactor/` `test/` `chore/` 之一开头,后缀 kebab-case,且不与主分支同名。校验失败 → USER_GATE 让用户重新输入。
|
|
260
184
|
|
|
261
|
-
|
|
185
|
+
创建热修分支:`git checkout -b fix/<desc> <MAIN_BRANCH>`
|
|
262
186
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
header: "主分支",
|
|
269
|
-
options: [
|
|
270
|
-
{ label: "(a) 确认", description: "<MAIN_BRANCH> 是主分支,写入配置并继续" },
|
|
271
|
-
{ label: "(b) 手动指定", description: "输入正确的主分支名" }
|
|
272
|
-
],
|
|
273
|
-
multiSelect: false
|
|
274
|
-
}]
|
|
275
|
-
}
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
**其他平台(降级为文本选项):**
|
|
279
|
-
```
|
|
280
|
-
> → (a) 确认 — <MAIN_BRANCH> 是主分支,写入配置并继续
|
|
281
|
-
> → (b) 手动指定 — 输入正确的主分支名
|
|
282
|
-
> 请输入 a 或 b:
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
确认后写入项目级配置:
|
|
286
|
-
```bash
|
|
287
|
-
alloy _config write . main_branch <确认的主分支名>
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
然后创建热修分支:
|
|
291
|
-
|
|
292
|
-
```bash
|
|
293
|
-
git checkout -b hotfix/<desc> <MAIN_BRANCH>
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
分支命名:`hotfix/` 前缀 + 简短描述(kebab-case),用户可修改。
|
|
187
|
+
1. 加载 `test-driven-development`
|
|
188
|
+
2. 加载 `verification-before-completion`
|
|
189
|
+
3. 精确提交(可追溯原 change 时注明 `fix-from: <change名>`)
|
|
190
|
+
4. **⛔ HARD_STOP merge 前 USER_GATE 校验**(读取 `commands/alloy/references/fix-precommit-check.md` 场景 3 章节):merge 精确字符串确认前必须追加 🔴 USER_GATE 让用户物理确认已加载 TDD + verification 两个 skill,禁 agent 基于 "diff 含测试代码" 自动跳过。
|
|
191
|
+
5. 合并确认(阻塞点):
|
|
297
192
|
|
|
298
|
-
|
|
299
|
-
|
|
193
|
+
> 确认合并:源 `fix/<desc>` → 目标 `<MAIN_BRANCH>`
|
|
194
|
+
> 输入 `merge fix/<desc> into <MAIN_BRANCH>` 确认,其他输入取消。
|
|
300
195
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
3. 精确提交。如果能追溯到原 change,在 commit message 中注明:
|
|
304
|
-
```bash
|
|
305
|
-
git add <精确路径>
|
|
306
|
-
git commit -m "fix: <描述>
|
|
196
|
+
**必须等待精确输入。** "好"、"可以"、"y"不算确认。**[HARD_STOP] agent 不得在工具调用中预填或模拟此精确字符串**(见 interaction-style.md "沉默 ≠ 授权"通用禁令)。
|
|
307
197
|
|
|
308
|
-
|
|
309
|
-
```
|
|
310
|
-
无法追溯时,普通提交即可:
|
|
311
|
-
```bash
|
|
312
|
-
git add <精确路径>
|
|
313
|
-
git commit -m "fix: <描述>"
|
|
314
|
-
```
|
|
315
|
-
4. 确认合并并合并回主分支:
|
|
316
|
-
|
|
317
|
-
在执行 merge 之前,先展示合并信息并等待用户确认:
|
|
318
|
-
|
|
319
|
-
> 确认合并
|
|
320
|
-
> ──────────────────────────────────────
|
|
321
|
-
>
|
|
322
|
-
> 即将合并热修分支到主分支:
|
|
323
|
-
>
|
|
324
|
-
> 源分支:`hotfix/<desc>`
|
|
325
|
-
> 目标分支:`<MAIN_BRANCH>`
|
|
326
|
-
>
|
|
327
|
-
> 提交:
|
|
328
|
-
> ```
|
|
329
|
-
> <git log <MAIN_BRANCH>..hotfix/<desc> --oneline 的输出>
|
|
330
|
-
> ```
|
|
331
|
-
>
|
|
332
|
-
> 合并后 hotfix 分支将被删除。
|
|
333
|
-
>
|
|
334
|
-
> 输入 merge hotfix/<desc> into <MAIN_BRANCH> 确认,或输入其他内容取消。
|
|
335
|
-
|
|
336
|
-
**必须等待用户精确输入确认语句。** "好"、"可以"、"y" 都不算确认。
|
|
337
|
-
|
|
338
|
-
用户确认后执行合并:
|
|
198
|
+
确认后:
|
|
339
199
|
```bash
|
|
340
200
|
git checkout <MAIN_BRANCH>
|
|
341
|
-
git merge
|
|
342
|
-
git branch -d
|
|
201
|
+
git merge fix/<desc> --no-ff
|
|
202
|
+
git branch -d fix/<desc>
|
|
343
203
|
```
|
|
344
|
-
|
|
204
|
+
取消则保留分支,提示手动合并。
|
|
345
205
|
|
|
346
206
|
---
|
|
347
207
|
|
|
348
208
|
### spec 变更兜底
|
|
349
209
|
|
|
350
|
-
|
|
210
|
+
修复中发现 spec 问题 → 不阻断修复。完成后提示:
|
|
351
211
|
|
|
352
|
-
>
|
|
353
|
-
> 是否需要运行 /alloy:start 开新 change 修正 spec?[Y/n]
|
|
212
|
+
> 修复中发现 spec 可能需要变更:<问题描述>。🔴 STOP: 是否开新 change?
|
|
354
213
|
|
|
355
|
-
|
|
214
|
+
正常修复完成 → 不提示。
|
|
356
215
|
|
|
357
216
|
---
|
|
358
217
|
|
|
@@ -360,9 +219,5 @@ fix-from: <原 change 名>"
|
|
|
360
219
|
|
|
361
220
|
```
|
|
362
221
|
Alloy · Bug 修复 — DONE
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
修复路径:<场景 1 / 场景 2 / 场景 3>
|
|
366
|
-
诊断结论:<根因摘要>
|
|
367
|
-
结果:<修复结果>
|
|
222
|
+
修复路径:<场景 1/2/3> 诊断:<根因摘要> 结果:<修复结果>
|
|
368
223
|
```
|