@heihei0299/matt-skills 2.1.0 → 2.1.3
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/.agents/skills/tdd-implement/SKILL.md +15 -9
- package/.agents/skills/tdd-implement/references/finalize.md +27 -0
- package/.agents/skills/tdd-implement/references/orchestration.md +14 -12
- package/.agents/skills/tdd-implement/references/stages.md +25 -41
- package/.agents/skills/tdd-implement/references/verify.md +7 -7
- package/package.json +1 -1
- package/template/.agents/skills/tdd-implement/SKILL.md +15 -9
- package/template/.agents/skills/tdd-implement/references/finalize.md +27 -0
- package/template/.agents/skills/tdd-implement/references/orchestration.md +14 -12
- package/template/.agents/skills/tdd-implement/references/stages.md +25 -41
- package/template/.agents/skills/tdd-implement/references/verify.md +7 -7
- package/template/.opencode/docs/agents/skill-design.md +1 -1
- package/template/.pi/docs/agents/skill-design.md +1 -1
- package/template/AGENTS.md +0 -2
- package/.agents/skills/tdd-implement/references/deliver.md +0 -33
- package/.agents/skills/tdd-implement/scripts/scan-sensitive.sh +0 -37
- package/template/.agents/skills/tdd-implement/references/deliver.md +0 -33
- package/template/.agents/skills/tdd-implement/scripts/scan-sensitive.sh +0 -37
|
@@ -6,19 +6,19 @@ disable-model-invocation: true
|
|
|
6
6
|
|
|
7
7
|
# TDD Implement
|
|
8
8
|
|
|
9
|
-
`seam` + `red-green` 是本技能的领衔词。它把一个 spec 或 task issue
|
|
9
|
+
`seam` + `red-green` 是本技能的领衔词。它把一个 spec 或 task issue 编排成三个交付阶段,并在 Verify 后执行一次非阶段的 Finalize 收尾;TDD 的红-绿语义、测试质量和 mock 边界以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为唯一事实源,本技能只定义交付编排。
|
|
10
10
|
|
|
11
11
|
本技能是 **Long-Horizon Skill**:阶段按顺序连续执行,并自带 **Turn Continuity** 与 **Chunking**。术语见 `CONTEXT.md`,技能设计规则见 `docs/agents/skill-design.md`。
|
|
12
12
|
|
|
13
13
|
## 入口与分支
|
|
14
14
|
|
|
15
|
-
- **单 issue**:单个 `.scratch/<feature>/spec.md`、等价 spec 或 `Type: task` issue
|
|
15
|
+
- **单 issue**:单个 `.scratch/<feature>/spec.md`、等价 spec 或 `Type: task` issue,按下方三个 Steps 完成验证,再执行 Finalize 收尾。
|
|
16
16
|
- **多 issue**:`.scratch/<feature>/issues/` 下存在多个 `Type: task` 文件时,先读取 [orchestration.md](references/orchestration.md),按 `Blocked by` 构建 DAG、Kahn 分层,再由主代理按层串行完成各 issue。
|
|
17
17
|
- `Type: research`、`prototype`、`grilling` 分流到对应技能,不进入本技能。
|
|
18
18
|
|
|
19
19
|
多 issue 的 A0-A5 是编排控制活动,不是额外的产品交付阶段:依赖图、分层、串行调度、层收敛、全量收敛和回退/冲突处理的详规只在 [orchestration.md](references/orchestration.md) 中维护。
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## 三阶段 Steps
|
|
22
22
|
|
|
23
23
|
按序执行;每步达到可验证出口条件后立即进入下一步。每步只读取自己的轻量 reference,避免在每个阶段重复注入完整 `stages.md`。
|
|
24
24
|
|
|
@@ -26,15 +26,20 @@ disable-model-invocation: true
|
|
|
26
26
|
|---|---|---|---|
|
|
27
27
|
| ① **Contract** | [contract.md](references/contract.md) | 读取入口,提取 Acceptance Criteria,建立 Scope Ledger、Preflight、验证矩阵和 Behavior/Seam 边界 | 需求无待决歧义,验证命令已确定;知道做什么、从哪里验证、什么不做 |
|
|
28
28
|
| ② **Red-Green** | [red-green.md](references/red-green.md) | 以 Behavior 为粒度执行有效 Red → 最小 Green → formatter/typecheck → 最小相关测试 | 所有 Behaviors 均有有效 Red、实现全绿,formatter/typecheck 和最小相关测试通过 |
|
|
29
|
-
| ③ **Verify** | [verify.md](references/verify.md) | 运行当前 issue 影响范围测试、必要 build
|
|
30
|
-
|
|
29
|
+
| ③ **Verify** | [verify.md](references/verify.md) | 运行当前 issue 影响范围测试、必要 build、要求的真实运行验证;在最终 diff 稳定后调用一次 [code-review](.agents/skills/code-review/SKILL.md) | 最终 diff 的相关证据通过,真实运行验证完成(如要求),code-review 已完成且无 blocking finding |
|
|
30
|
+
|
|
31
|
+
## Finalize(非阶段)
|
|
32
|
+
|
|
33
|
+
Verify 出口满足后读取 [finalize.md](references/finalize.md) 并立即收尾。Finalize 不计入交付阶段,只负责必要的 docs/README 对齐、直接创建当前 issue 的独立 commit 与 Tracker/progress 更新;不执行额外安全扫描、staged diff 复核或 commit message 门禁。若发现实现、测试或文档证据不完整,回到对应阶段修复后再 Finalize。
|
|
34
|
+
|
|
35
|
+
Finalize 出口:commit 已创建、Acceptance Criteria 全部通过,Tracker 与工作区反映真实完成状态。
|
|
31
36
|
|
|
32
37
|
## 运行时纪律
|
|
33
38
|
|
|
34
|
-
-
|
|
39
|
+
- 三个阶段都从入口连续执行到自身出口;Verify 出口满足后立即进入 Finalize:预告下一步后立即执行;进度输出并入工具调用序列,输出后继续执行。只有合规交互点、明确的外部阻塞或阶段出口条件结束当前回合。
|
|
35
40
|
- 一个 seam 是公共可观察边界;一个 Behavior 是一个红-绿 cycle;一个 seam 可以包含多个 Behaviors。Seam/Behavior 的细节和 Todo 粒度只在进入 Step ② 时读取 [red-green.md](references/red-green.md)。
|
|
36
|
-
-
|
|
37
|
-
- 当前 issue 的范围、Acceptance Criteria、Out of Scope、测试/typecheck/build/真实运行证据和最终 commit 必须可追溯。Seam 或专项测试绿色不代表 issue
|
|
41
|
+
- 每个 issue 只在 Verify 的最终 diff 稳定后调用一次 `code-review`;审查维度、reviewer 数量、提示词和输出格式全部由 `code-review` 自己定义,`tdd-implement` 不复制这些规则。`code-review` 未完成或存在 blocking finding 时 issue 不得收敛;A3 层收敛不再次调用 review。
|
|
42
|
+
- 当前 issue 的范围、Acceptance Criteria、Out of Scope、测试/typecheck/build/真实运行证据和最终 commit 必须可追溯。Seam 或专项测试绿色不代表 issue 完成;三个阶段出口与 Finalize 全部满足后才可标记 `resolved`。
|
|
38
43
|
- 多 issue 模式中,每个 issue 只提交一个独立 commit;issue 影响范围测试在 Step ③ 执行,全仓测试由 orchestration 的 A4 在全部 issue 完成后执行一次。
|
|
39
44
|
|
|
40
45
|
## 引用
|
|
@@ -45,6 +50,7 @@ disable-model-invocation: true
|
|
|
45
50
|
- Contract:[contract.md](references/contract.md)
|
|
46
51
|
- Red-Green:[red-green.md](references/red-green.md)
|
|
47
52
|
- Verify:[verify.md](references/verify.md)
|
|
48
|
-
-
|
|
53
|
+
- Review 方法:[code-review](.agents/skills/code-review/SKILL.md)
|
|
54
|
+
- Finalize:[finalize.md](references/finalize.md)
|
|
49
55
|
- 完整兼容规范:[stages.md](references/stages.md)
|
|
50
56
|
- 多 issue 编排:[orchestration.md](references/orchestration.md)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Finalize(非阶段)
|
|
2
|
+
|
|
3
|
+
仅在 `tdd-implement` Step ③ Verify 通过后读取。Finalize 不计入交付阶段;开始后不新增产品 Behavior,发现实现、测试或文档遗漏时回到对应阶段。
|
|
4
|
+
|
|
5
|
+
## Commit
|
|
6
|
+
|
|
7
|
+
1. 如本次实现要求 README/docs/config/package 同步,完成必要更新。
|
|
8
|
+
2. 按当前 issue 范围直接创建一个独立 commit。
|
|
9
|
+
3. 不执行额外敏感信息/安全扫描,不做 `git diff --cached` 复核,也不设置额外 commit message 门禁。
|
|
10
|
+
|
|
11
|
+
仓库级 Git 安全与历史保护规则仍然适用;Finalize 不重复定义或扩展这些规则。
|
|
12
|
+
|
|
13
|
+
## Tracker 收尾
|
|
14
|
+
|
|
15
|
+
Commit 成功后:
|
|
16
|
+
|
|
17
|
+
- 勾选 Acceptance Criteria;
|
|
18
|
+
- issue 标记 `resolved`;
|
|
19
|
+
- 写实施总结并同步 `.scratch/<feature>/progress.md` 的 Status/Commit/Review/Tests;
|
|
20
|
+
- 记录 commit hash/message、最终测试和真实运行结果;
|
|
21
|
+
- 确认后续 blockers 是否解除。
|
|
22
|
+
|
|
23
|
+
## 出口
|
|
24
|
+
|
|
25
|
+
- 当前 issue 的独立 commit 已创建;
|
|
26
|
+
- Acceptance Criteria 全部通过;
|
|
27
|
+
- Tracker/progress 与真实完成度一致。
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# 多 issue 编排(按依赖分层串行)
|
|
2
2
|
|
|
3
|
-
本文件仅在 `.scratch/<feature>/issues/` 下存在多个 `Type: task` issue 时生效。单 `spec` / 单 `task` 直接按 [stages.md](stages.md)
|
|
3
|
+
本文件仅在 `.scratch/<feature>/issues/` 下存在多个 `Type: task` issue 时生效。单 `spec` / 单 `task` 直接按 [stages.md](stages.md) 的三个交付阶段执行,并在 Verify 后 Finalize。A0-A5 是编排控制活动,不是额外的产品交付阶段。
|
|
4
4
|
|
|
5
|
-
主代理按依赖分层、层内按编号串行执行;每个 issue 由同一个主代理完成 Contract → Red-Green → Verify
|
|
5
|
+
主代理按依赖分层、层内按编号串行执行;每个 issue 由同一个主代理完成 Contract → Red-Green → Verify,再执行非阶段 Finalize 并创建一个独立 commit。实现细节以 [stages.md](stages.md) 为准,TDD 语义以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为准。
|
|
6
6
|
|
|
7
7
|
## 目录
|
|
8
8
|
|
|
@@ -69,22 +69,22 @@ Ln = 最后一层
|
|
|
69
69
|
```text
|
|
70
70
|
for each layer Li in L1..Ln:
|
|
71
71
|
for each issue in Li(按编号顺序):
|
|
72
|
-
|
|
72
|
+
主代理执行三个阶段:
|
|
73
73
|
① Contract
|
|
74
74
|
② Red-Green
|
|
75
|
-
③ Verify(当前 issue
|
|
76
|
-
|
|
75
|
+
③ Verify(当前 issue 影响范围 + 当前 issue review)
|
|
76
|
+
执行 Finalize(非阶段:独立 commit + Tracker 收尾)
|
|
77
77
|
产出回执卡片并回写 issue
|
|
78
78
|
强制更新 progress.md 的 Status/Commit/Review/Tests
|
|
79
79
|
通过 A3 层收敛后进入下一层
|
|
80
80
|
全部层完成后进入 A4
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
每个 issue 的 Verify 只运行当前 issue 影响范围内的完整测试;全仓测试不在每个 issue
|
|
83
|
+
每个 issue 的 Verify 只运行当前 issue 影响范围内的完整测试;全仓测试不在每个 issue 中重复执行。当前 issue 的最终 diff 稳定后只调用一次 `code-review`;review 的内部方法完全由 `code-review` 定义。修复 blocking finding 后执行受影响验证和 finding delta recheck,不重复调用完整 `code-review`。
|
|
84
84
|
|
|
85
|
-
主代理在层内和层间连续调度:一个 issue 的
|
|
85
|
+
主代理在层内和层间连续调度:一个 issue 的 Finalize 出口满足后,立即取下一个 issue,直到全部层完成或发生明确外部阻塞。进度输出并入执行序列,不在正常切换点等待用户“继续”。
|
|
86
86
|
|
|
87
|
-
进入 A2 前记录的 `BASE_HEAD` 必须在每个 issue
|
|
87
|
+
进入 A2 前记录的 `BASE_HEAD` 必须在每个 issue 的三个阶段出口和 Finalize commit 前校验:
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
90
|
git merge-base --is-ancestor $BASE_HEAD HEAD
|
|
@@ -102,7 +102,7 @@ Status: resolved
|
|
|
102
102
|
Commit: <hash> — <message>
|
|
103
103
|
Behaviors: <completed list>
|
|
104
104
|
Acceptance Criteria: <checkbox result>
|
|
105
|
-
Review:
|
|
105
|
+
Review: code-review completed once, no blocking finding
|
|
106
106
|
Tests: <targeted command and actual result>
|
|
107
107
|
Runtime: <actual request/page-visible result or not required>
|
|
108
108
|
Docs: <updated files or no update required>
|
|
@@ -110,13 +110,15 @@ Docs: <updated files or no update required>
|
|
|
110
110
|
|
|
111
111
|
### A2 出口
|
|
112
112
|
|
|
113
|
-
- 当前层每个 issue
|
|
113
|
+
- 当前层每个 issue 均完成三个阶段与 Finalize 并有独立 commit;
|
|
114
114
|
- issue、回执卡片和 `progress.md` 一致;
|
|
115
115
|
- 相关测试通过,工作区卫生和历史校验通过;
|
|
116
116
|
- 没有未记录的跨 issue 改动。
|
|
117
117
|
|
|
118
118
|
## A3:层收敛
|
|
119
119
|
|
|
120
|
+
A3 只做编排收敛,不再次调用 `code-review`;正式 review 已在每个 issue 的 Verify 中完成。
|
|
121
|
+
|
|
120
122
|
每层全部 issue 串行完成后检查以下项目,全部通过才进入下一层:
|
|
121
123
|
|
|
122
124
|
1. 所有 issue `Status: resolved`,实施总结已落盘,`progress.md` 对应行已为 `done`;
|
|
@@ -153,13 +155,13 @@ A5 负责所有编排级失败,不把失败静默吞掉,也不把不相关
|
|
|
153
155
|
| Contract 歧义、验收缺口、范围变化 | 回到该 issue 的 Contract,补 Scope Ledger、Behavior 和验证矩阵 |
|
|
154
156
|
| Red-Green 的有效 Red、实现、typecheck 或 targeted test 失败 | 回到该 issue 的 Red-Green,修复当前 Behavior 并重新验证 |
|
|
155
157
|
| Verify 的测试、build、真实运行或 review blocking finding 失败 | 回到受影响 issue 的对应阶段;修复后只做受影响检查和 delta review |
|
|
156
|
-
|
|
|
158
|
+
| Finalize 的必要 docs、commit 或 Tracker 失败 | 保持 issue 未 resolved,修复 Finalize 问题后重新验证 |
|
|
157
159
|
| 全量测试失败 | 定位到引入失败的 issue,按上述路径修复;只在修复后重跑必要范围和全量测试 |
|
|
158
160
|
| `Blocked by` 依赖未完成 | 后续 issue 保持 `blocked`,前置 issue resolved 后自动解阻 |
|
|
159
161
|
| 多 issue 预期修改同一文件 | 记录冲突,按编号串行;无法安全归属时暂停并请求用户决定 |
|
|
160
162
|
| Git 历史祖先校验失败 | 立即停止写入,使用 `git reflog` 找回 `BASE_HEAD` 之后的提交,校验通过后继续 |
|
|
161
163
|
|
|
162
|
-
主代理不跨 issue
|
|
164
|
+
主代理不跨 issue 无记录改动;不通过第二次完整 `code-review` 来掩盖定向修复。外部权限、model、browser 或 tool 不可用时遵循 [stages.md](stages.md) 的 Tool Failure Budget,最多一次有依据的 fallback,仍失败则标记 `blocked/unavailable` 并报告实际状态。
|
|
163
165
|
|
|
164
166
|
### A5 出口
|
|
165
167
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 三阶段详细定义 + Finalize
|
|
2
2
|
|
|
3
|
-
单 `spec` / 单 `task` 与多 `task`
|
|
3
|
+
单 `spec` / 单 `task` 与多 `task` 共用下列三个交付阶段;Verify 通过后执行 Finalize 收尾,Finalize 不计入阶段。多 issue 的依赖图、Kahn 分层、层收敛、全量收敛和回退/冲突处理见 [orchestration.md](orchestration.md)。TDD 语义以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为唯一事实源,不在此重写。
|
|
4
4
|
|
|
5
5
|
## 目录
|
|
6
6
|
|
|
7
7
|
- [① Contract:明确交付契约](#阶段-①-contract明确交付契约)
|
|
8
8
|
- [② Red-Green:行为级 TDD](#阶段-②-red-green行为级-tdd)
|
|
9
9
|
- [③ Verify:最终验证与审查](#阶段-③-verify最终验证与审查)
|
|
10
|
-
- [
|
|
10
|
+
- [Finalize:非阶段交付收尾](#finalize非阶段交付收尾)
|
|
11
11
|
- [跨阶段运行纪律](#跨阶段运行纪律)
|
|
12
12
|
- [状态统一](#状态统一)
|
|
13
13
|
- [回退路由](#回退路由)
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
2. 产品实现之前存在有效 Red;
|
|
22
22
|
3. 最终 diff 对应的相关测试和 typecheck 通过;
|
|
23
23
|
4. ticket 要求真实运行时,真实运行验证已完成;
|
|
24
|
-
5.
|
|
24
|
+
5. 当前稳定 diff 已完成一次 `code-review` 且无 blocking finding;
|
|
25
25
|
6. README/docs 与实现一致;
|
|
26
26
|
7. 每个 issue 形成独立、可追溯的 commit;
|
|
27
27
|
8. Tracker 状态与真实完成度一致。
|
|
28
28
|
|
|
29
|
-
Seam 或专项测试绿色不等于 issue
|
|
29
|
+
Seam 或专项测试绿色不等于 issue 完成;只有三个阶段与 Finalize 全部通过,issue 才能标记为 `resolved`。
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
## 阶段 ① Contract:明确交付契约
|
|
@@ -58,11 +58,10 @@ Seam 或专项测试绿色不等于 issue 完成;只有四个阶段全部通
|
|
|
58
58
|
5. 完成一次 **Preflight** 并记录真实结果:
|
|
59
59
|
- 当前 `HEAD`、工作区状态和 `BASE_HEAD=$(git rev-parse HEAD)`;
|
|
60
60
|
- 可用的 test、typecheck、build 命令;
|
|
61
|
-
-
|
|
61
|
+
- `code-review` 可用性;
|
|
62
62
|
- 可用的 browser 或 Playwright 路径;
|
|
63
|
-
- 可用的敏感信息扫描脚本;
|
|
64
63
|
- ticket 要求的真实运行验证方式。
|
|
65
|
-
6. 建立一次验证矩阵,列出 targeted tests、typecheck、全量测试、必要 build、smoke/package
|
|
64
|
+
6. 建立一次验证矩阵,列出 targeted tests、typecheck、全量测试、必要 build、smoke/package check 和真实运行验证,并记录各项的触发条件,后续只复用这份矩阵。
|
|
66
65
|
7. 识别公共测试边界和 Behaviors。一个 Seam 是一个公共可观察边界;一个 Behavior 是一个红-绿 cycle;一个 Seam 可以包含多个 Behaviors。每个 Behavior 明确输入、可观察输出、对应 Acceptance Criterion 和验证层级。
|
|
67
66
|
8. spec 已确认且未变化的 Seam 直接复用;只有出现需求歧义、验收缺口、范围变化、破坏性操作或互斥方案时才请求用户确认。
|
|
68
67
|
|
|
@@ -137,7 +136,7 @@ Seam 或专项测试绿色不等于 issue 完成;只有四个阶段全部通
|
|
|
137
136
|
当前 issue 影响范围测试
|
|
138
137
|
→ 必要 build
|
|
139
138
|
→ 必要真实运行验证
|
|
140
|
-
→
|
|
139
|
+
→ 当前稳定 diff 调用一次 code-review
|
|
141
140
|
→ 修复 blocking finding 后的定向复核
|
|
142
141
|
```
|
|
143
142
|
|
|
@@ -150,48 +149,36 @@ Seam 或专项测试绿色不等于 issue 完成;只有四个阶段全部通
|
|
|
150
149
|
|
|
151
150
|
### Review
|
|
152
151
|
|
|
153
|
-
1.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
3. 两个轴独立输出、互不掩盖;每个轴明确限制输出,例如 `≤ 400 words / ≤ 40 行`。
|
|
159
|
-
4. findings 分类为:当前 issue blocking、后续 ticket、advisory、out of scope。只处理当前 issue blocking finding;其余记录而不扩大范围。
|
|
160
|
-
5. 修复 blocking finding 后只运行受影响测试、typecheck 和 finding 的 delta recheck,不重新启动完整双轴 review。审查结果只在对话输出,不生成 `review-*.md` 等书面报告文件。
|
|
152
|
+
1. 当前 issue 的最终 diff 稳定后,调用一次 [code-review](.agents/skills/code-review/SKILL.md)。
|
|
153
|
+
2. `tdd-implement` 只负责 **何时调用 review**;审查维度、reviewer 数量、提示词、上下文与输出格式全部以 `code-review` 为唯一事实源,不在这里复制或弱化。
|
|
154
|
+
3. `code-review` 未完成或存在 blocking finding 时,issue 保持未完成。只修当前 issue blocking finding;其余 findings 按 `code-review` 的分类与输出处理,不无记录地扩大范围。
|
|
155
|
+
4. 修复 blocking finding 后,只运行受影响测试/typecheck 与 finding delta recheck,不再次调用完整 `code-review`。若修复引入新的 Behavior、改变 Scope 或使原 Review 对象不再成立,则回到 Contract/Red-Green,重新形成稳定最终 diff 后再进入 Verify。
|
|
156
|
+
5. Review 结果只在对话/运行记录中消费,不由 `tdd-implement` 额外生成自己的 review 报告格式。
|
|
161
157
|
|
|
162
158
|
### 出口条件
|
|
163
159
|
|
|
164
160
|
- 最终 diff 对应的相关测试通过;
|
|
165
161
|
- 必要 typecheck/build 通过;
|
|
166
162
|
- ticket 要求的真实运行验证已完成并记录实际结果;
|
|
167
|
-
-
|
|
163
|
+
- 当前稳定 diff 已完成一次 `code-review`;
|
|
168
164
|
- 无 blocking finding;
|
|
169
165
|
- 受影响范围的最后一次证据对应当前 diff。
|
|
170
166
|
|
|
171
167
|
---
|
|
172
168
|
|
|
173
|
-
##
|
|
169
|
+
## Finalize:非阶段交付收尾
|
|
174
170
|
|
|
175
171
|
### 入口条件
|
|
176
172
|
|
|
177
173
|
- Verify 出口条件满足。
|
|
178
174
|
|
|
179
|
-
### Commit
|
|
175
|
+
### Commit
|
|
180
176
|
|
|
181
|
-
|
|
177
|
+
1. 如本次实现要求 README/docs/config/package 同步,完成必要更新。
|
|
178
|
+
2. 按当前 issue 范围直接创建一个独立 commit。
|
|
179
|
+
3. 不执行额外敏感信息/安全扫描,不做 `git diff --cached` 复核,也不设置额外 commit message 门禁。
|
|
182
180
|
|
|
183
|
-
|
|
184
|
-
2. 检查 README/docs/config/package 与实现一致;
|
|
185
|
-
3. 复核 Scope Ledger,确认没有未记录的范围扩张;
|
|
186
|
-
4. 确认证据对应最后一次代码或测试修改;
|
|
187
|
-
5. 检查临时文件、构建产物和未跟踪文件;
|
|
188
|
-
6. 对 staged diff 执行敏感信息检查;
|
|
189
|
-
7. 执行 `git merge-base --is-ancestor $BASE_HEAD HEAD`;
|
|
190
|
-
8. 检查 commit message;
|
|
191
|
-
9. 确认暂存区只包含当前 issue;
|
|
192
|
-
10. 执行 `git diff --cached`,再创建当前 issue 的独立 commit。
|
|
193
|
-
|
|
194
|
-
执行敏感信息扫描脚本(`bash .agents/skills/tdd-implement/scripts/scan-sensitive.sh --staged-only`),检查 staged diff、commit message 和 Git history preservation,全部通过后创建当前 issue 的独立 commit。
|
|
181
|
+
仓库级 Git 安全与历史保护规则仍然适用;Finalize 不重复定义或扩展这些规则。
|
|
195
182
|
|
|
196
183
|
### Tracker 收尾
|
|
197
184
|
|
|
@@ -202,19 +189,16 @@ Commit 成功后:
|
|
|
202
189
|
- 追加实施总结;
|
|
203
190
|
- 更新 `.scratch/<feature>/progress.md` 的 `Status`、`Commit`、`Review`、`Tests`;
|
|
204
191
|
- 记录 commit hash、message、最终测试命令/数量/结果和真实运行结果;
|
|
205
|
-
- 清理本次产生的临时进程、目录和一次性文件;
|
|
206
192
|
- 确认下一 issue 的 blockers 已解除。
|
|
207
193
|
|
|
208
|
-
|
|
194
|
+
Finalize 开始后不新增产品 Behavior。若实现、测试或文档不完整,回到对应阶段;只有三个阶段与 Finalize 全部通过,才可把 issue 标记为 `resolved`。
|
|
209
195
|
|
|
210
196
|
### 出口条件
|
|
211
197
|
|
|
212
198
|
- commit 已创建且为当前 issue 的独立提交;
|
|
213
199
|
- Acceptance Criteria 全部通过;
|
|
214
200
|
- issue 状态为 `resolved`(无关联 issue 的直接 spec 则在会话中输出总结);
|
|
215
|
-
- 实施总结和 `progress.md`
|
|
216
|
-
- 工作区符合预期,无本次临时产物或残留未跟踪文件;
|
|
217
|
-
- 文档与实现一致,Git 历史保护校验通过。
|
|
201
|
+
- 实施总结和 `progress.md` 已同步。
|
|
218
202
|
|
|
219
203
|
---
|
|
220
204
|
|
|
@@ -233,7 +217,7 @@ Commit 成功后:
|
|
|
233
217
|
|
|
234
218
|
### 验证证据失效
|
|
235
219
|
|
|
236
|
-
任何产品代码或测试文件再次变化,旧的测试、typecheck、build
|
|
220
|
+
任何产品代码或测试文件再次变化,旧的测试、typecheck、build 等受影响证据立即失效,必须重新验证受影响范围。正式 `code-review` 调用本身不因 finding 修复而重复;post-review 修复必须完成受影响验证和 finding delta recheck。若修改引入新的 Behavior、改变 Scope 或使原 Review 对象不再成立,则回到 Contract/Red-Green,重新形成稳定最终 diff 后再进入 Verify。
|
|
237
221
|
|
|
238
222
|
### Git History Preservation
|
|
239
223
|
|
|
@@ -255,7 +239,7 @@ Issue: ready-for-agent | in_progress | resolved | blocked
|
|
|
255
239
|
Progress: pending | in_progress | done | blocked
|
|
256
240
|
```
|
|
257
241
|
|
|
258
|
-
状态转换:Contract 完成后 Issue/Progress 为 `in_progress`;Red-Green 完成后 Behaviors 为 `completed`,Issue 仍为 `in_progress`;Verify 完成后 Issue 仍为 `in_progress`;
|
|
242
|
+
状态转换:Contract 完成后 Issue/Progress 为 `in_progress`;Red-Green 完成后 Behaviors 为 `completed`,Issue 仍为 `in_progress`;Verify 完成后 Issue 仍为 `in_progress`;Finalize 完成后 Issue 为 `resolved`、Progress 为 `done`。外部阻塞记录为 `blocked`,恢复后回到 `in_progress`。
|
|
259
243
|
|
|
260
244
|
---
|
|
261
245
|
|
|
@@ -266,6 +250,6 @@ Progress: pending | in_progress | done | blocked
|
|
|
266
250
|
| ① Contract | 需求歧义、验收缺口、范围变化 | → ① 补充契约和验证矩阵 |
|
|
267
251
|
| ② Red-Green | 有效 Red、实现、formatter、typecheck 或相关测试失败 | → ② 修复当前 Behavior |
|
|
268
252
|
| ③ Verify | 测试、build、真实运行或 review finding 失败 | → ② 修复 Behavior;需求偏差 → ① |
|
|
269
|
-
|
|
|
253
|
+
| Finalize | 必要 docs 未同步、commit 失败或 Tracker 信息不完整 | → ①/③ 修复对应问题;仍在 Finalize 完成前解决 |
|
|
270
254
|
|
|
271
255
|
多 issue 的层收敛、全量失败、依赖冲突和跨 issue 修改冲突按 [orchestration.md](orchestration.md) A5 回退,不跨 issue 无记录改动。
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
# Verify
|
|
2
2
|
|
|
3
|
-
仅在 `tdd-implement` Step ③ 读取。验证必须对应当前最终 diff
|
|
3
|
+
仅在 `tdd-implement` Step ③ 读取。验证必须对应当前最终 diff;产品代码或测试再次变化时,测试/typecheck/build 等受影响证据失效。
|
|
4
4
|
|
|
5
5
|
## 固定顺序
|
|
6
6
|
|
|
7
|
-
`影响范围测试 → 必要 build → 必要真实运行验证 → 一次
|
|
7
|
+
`影响范围测试 → 必要 build → 必要真实运行验证 → code-review 一次 → blocking 修复后的定向复核`
|
|
8
8
|
|
|
9
9
|
## 规则
|
|
10
10
|
|
|
11
11
|
- 单 issue / 单 spec:按 Contract 验证矩阵运行完整相关测试;多 issue:只跑当前 issue 影响范围,全仓测试留给 orchestration A4。
|
|
12
12
|
- ticket 要求真实运行时,优先专用 browser,其次项目已有 Playwright;HTTP/CLI 不能替代 WebUI 可见验证。
|
|
13
13
|
- 临时进程必须使用隔离配置/端口,记录 PID 与实际结果,结束后清理。
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- 修复 blocking
|
|
14
|
+
- 当前 issue 的最终 diff 稳定后,调用一次 [code-review](.agents/skills/code-review/SKILL.md)。`tdd-implement` 只规定调用时机;审查维度、reviewer 数量、提示词、上下文与输出格式以 `code-review` 为唯一事实源。
|
|
15
|
+
- `code-review` 未完成或返回 blocking finding 时,issue 保持未完成;只修当前 issue 的 blocking finding,其余按 review 结果记录。
|
|
16
|
+
- 修复 blocking finding 后,只重跑受影响测试/typecheck 并对该 finding 做 delta recheck;不再次调用完整 `code-review`。若修复引入新的 Behavior、改变 Scope 或使原 Review 对象不再成立,则回到 Contract/Red-Green,重新形成稳定最终 diff 后再进入 Verify。
|
|
17
17
|
|
|
18
18
|
## 出口
|
|
19
19
|
|
|
20
20
|
- 最终 diff 的相关测试/typecheck/build 通过;
|
|
21
21
|
- 要求的真实运行验证有实际证据;
|
|
22
|
-
-
|
|
22
|
+
- 当前稳定 diff 已完成一次 `code-review`;
|
|
23
23
|
- 无 blocking finding;
|
|
24
|
-
-
|
|
24
|
+
- post-review 修复(如有)的受影响验证与 finding delta recheck 已完成。
|
package/package.json
CHANGED
|
@@ -6,19 +6,19 @@ disable-model-invocation: true
|
|
|
6
6
|
|
|
7
7
|
# TDD Implement
|
|
8
8
|
|
|
9
|
-
`seam` + `red-green` 是本技能的领衔词。它把一个 spec 或 task issue
|
|
9
|
+
`seam` + `red-green` 是本技能的领衔词。它把一个 spec 或 task issue 编排成三个交付阶段,并在 Verify 后执行一次非阶段的 Finalize 收尾;TDD 的红-绿语义、测试质量和 mock 边界以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为唯一事实源,本技能只定义交付编排。
|
|
10
10
|
|
|
11
11
|
本技能是 **Long-Horizon Skill**:阶段按顺序连续执行,并自带 **Turn Continuity** 与 **Chunking**。术语见 `CONTEXT.md`,技能设计规则见 `docs/agents/skill-design.md`。
|
|
12
12
|
|
|
13
13
|
## 入口与分支
|
|
14
14
|
|
|
15
|
-
- **单 issue**:单个 `.scratch/<feature>/spec.md`、等价 spec 或 `Type: task` issue
|
|
15
|
+
- **单 issue**:单个 `.scratch/<feature>/spec.md`、等价 spec 或 `Type: task` issue,按下方三个 Steps 完成验证,再执行 Finalize 收尾。
|
|
16
16
|
- **多 issue**:`.scratch/<feature>/issues/` 下存在多个 `Type: task` 文件时,先读取 [orchestration.md](references/orchestration.md),按 `Blocked by` 构建 DAG、Kahn 分层,再由主代理按层串行完成各 issue。
|
|
17
17
|
- `Type: research`、`prototype`、`grilling` 分流到对应技能,不进入本技能。
|
|
18
18
|
|
|
19
19
|
多 issue 的 A0-A5 是编排控制活动,不是额外的产品交付阶段:依赖图、分层、串行调度、层收敛、全量收敛和回退/冲突处理的详规只在 [orchestration.md](references/orchestration.md) 中维护。
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## 三阶段 Steps
|
|
22
22
|
|
|
23
23
|
按序执行;每步达到可验证出口条件后立即进入下一步。每步只读取自己的轻量 reference,避免在每个阶段重复注入完整 `stages.md`。
|
|
24
24
|
|
|
@@ -26,15 +26,20 @@ disable-model-invocation: true
|
|
|
26
26
|
|---|---|---|---|
|
|
27
27
|
| ① **Contract** | [contract.md](references/contract.md) | 读取入口,提取 Acceptance Criteria,建立 Scope Ledger、Preflight、验证矩阵和 Behavior/Seam 边界 | 需求无待决歧义,验证命令已确定;知道做什么、从哪里验证、什么不做 |
|
|
28
28
|
| ② **Red-Green** | [red-green.md](references/red-green.md) | 以 Behavior 为粒度执行有效 Red → 最小 Green → formatter/typecheck → 最小相关测试 | 所有 Behaviors 均有有效 Red、实现全绿,formatter/typecheck 和最小相关测试通过 |
|
|
29
|
-
| ③ **Verify** | [verify.md](references/verify.md) | 运行当前 issue 影响范围测试、必要 build
|
|
30
|
-
|
|
29
|
+
| ③ **Verify** | [verify.md](references/verify.md) | 运行当前 issue 影响范围测试、必要 build、要求的真实运行验证;在最终 diff 稳定后调用一次 [code-review](.agents/skills/code-review/SKILL.md) | 最终 diff 的相关证据通过,真实运行验证完成(如要求),code-review 已完成且无 blocking finding |
|
|
30
|
+
|
|
31
|
+
## Finalize(非阶段)
|
|
32
|
+
|
|
33
|
+
Verify 出口满足后读取 [finalize.md](references/finalize.md) 并立即收尾。Finalize 不计入交付阶段,只负责必要的 docs/README 对齐、直接创建当前 issue 的独立 commit 与 Tracker/progress 更新;不执行额外安全扫描、staged diff 复核或 commit message 门禁。若发现实现、测试或文档证据不完整,回到对应阶段修复后再 Finalize。
|
|
34
|
+
|
|
35
|
+
Finalize 出口:commit 已创建、Acceptance Criteria 全部通过,Tracker 与工作区反映真实完成状态。
|
|
31
36
|
|
|
32
37
|
## 运行时纪律
|
|
33
38
|
|
|
34
|
-
-
|
|
39
|
+
- 三个阶段都从入口连续执行到自身出口;Verify 出口满足后立即进入 Finalize:预告下一步后立即执行;进度输出并入工具调用序列,输出后继续执行。只有合规交互点、明确的外部阻塞或阶段出口条件结束当前回合。
|
|
35
40
|
- 一个 seam 是公共可观察边界;一个 Behavior 是一个红-绿 cycle;一个 seam 可以包含多个 Behaviors。Seam/Behavior 的细节和 Todo 粒度只在进入 Step ② 时读取 [red-green.md](references/red-green.md)。
|
|
36
|
-
-
|
|
37
|
-
- 当前 issue 的范围、Acceptance Criteria、Out of Scope、测试/typecheck/build/真实运行证据和最终 commit 必须可追溯。Seam 或专项测试绿色不代表 issue
|
|
41
|
+
- 每个 issue 只在 Verify 的最终 diff 稳定后调用一次 `code-review`;审查维度、reviewer 数量、提示词和输出格式全部由 `code-review` 自己定义,`tdd-implement` 不复制这些规则。`code-review` 未完成或存在 blocking finding 时 issue 不得收敛;A3 层收敛不再次调用 review。
|
|
42
|
+
- 当前 issue 的范围、Acceptance Criteria、Out of Scope、测试/typecheck/build/真实运行证据和最终 commit 必须可追溯。Seam 或专项测试绿色不代表 issue 完成;三个阶段出口与 Finalize 全部满足后才可标记 `resolved`。
|
|
38
43
|
- 多 issue 模式中,每个 issue 只提交一个独立 commit;issue 影响范围测试在 Step ③ 执行,全仓测试由 orchestration 的 A4 在全部 issue 完成后执行一次。
|
|
39
44
|
|
|
40
45
|
## 引用
|
|
@@ -45,6 +50,7 @@ disable-model-invocation: true
|
|
|
45
50
|
- Contract:[contract.md](references/contract.md)
|
|
46
51
|
- Red-Green:[red-green.md](references/red-green.md)
|
|
47
52
|
- Verify:[verify.md](references/verify.md)
|
|
48
|
-
-
|
|
53
|
+
- Review 方法:[code-review](.agents/skills/code-review/SKILL.md)
|
|
54
|
+
- Finalize:[finalize.md](references/finalize.md)
|
|
49
55
|
- 完整兼容规范:[stages.md](references/stages.md)
|
|
50
56
|
- 多 issue 编排:[orchestration.md](references/orchestration.md)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Finalize(非阶段)
|
|
2
|
+
|
|
3
|
+
仅在 `tdd-implement` Step ③ Verify 通过后读取。Finalize 不计入交付阶段;开始后不新增产品 Behavior,发现实现、测试或文档遗漏时回到对应阶段。
|
|
4
|
+
|
|
5
|
+
## Commit
|
|
6
|
+
|
|
7
|
+
1. 如本次实现要求 README/docs/config/package 同步,完成必要更新。
|
|
8
|
+
2. 按当前 issue 范围直接创建一个独立 commit。
|
|
9
|
+
3. 不执行额外敏感信息/安全扫描,不做 `git diff --cached` 复核,也不设置额外 commit message 门禁。
|
|
10
|
+
|
|
11
|
+
仓库级 Git 安全与历史保护规则仍然适用;Finalize 不重复定义或扩展这些规则。
|
|
12
|
+
|
|
13
|
+
## Tracker 收尾
|
|
14
|
+
|
|
15
|
+
Commit 成功后:
|
|
16
|
+
|
|
17
|
+
- 勾选 Acceptance Criteria;
|
|
18
|
+
- issue 标记 `resolved`;
|
|
19
|
+
- 写实施总结并同步 `.scratch/<feature>/progress.md` 的 Status/Commit/Review/Tests;
|
|
20
|
+
- 记录 commit hash/message、最终测试和真实运行结果;
|
|
21
|
+
- 确认后续 blockers 是否解除。
|
|
22
|
+
|
|
23
|
+
## 出口
|
|
24
|
+
|
|
25
|
+
- 当前 issue 的独立 commit 已创建;
|
|
26
|
+
- Acceptance Criteria 全部通过;
|
|
27
|
+
- Tracker/progress 与真实完成度一致。
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# 多 issue 编排(按依赖分层串行)
|
|
2
2
|
|
|
3
|
-
本文件仅在 `.scratch/<feature>/issues/` 下存在多个 `Type: task` issue 时生效。单 `spec` / 单 `task` 直接按 [stages.md](stages.md)
|
|
3
|
+
本文件仅在 `.scratch/<feature>/issues/` 下存在多个 `Type: task` issue 时生效。单 `spec` / 单 `task` 直接按 [stages.md](stages.md) 的三个交付阶段执行,并在 Verify 后 Finalize。A0-A5 是编排控制活动,不是额外的产品交付阶段。
|
|
4
4
|
|
|
5
|
-
主代理按依赖分层、层内按编号串行执行;每个 issue 由同一个主代理完成 Contract → Red-Green → Verify
|
|
5
|
+
主代理按依赖分层、层内按编号串行执行;每个 issue 由同一个主代理完成 Contract → Red-Green → Verify,再执行非阶段 Finalize 并创建一个独立 commit。实现细节以 [stages.md](stages.md) 为准,TDD 语义以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为准。
|
|
6
6
|
|
|
7
7
|
## 目录
|
|
8
8
|
|
|
@@ -69,22 +69,22 @@ Ln = 最后一层
|
|
|
69
69
|
```text
|
|
70
70
|
for each layer Li in L1..Ln:
|
|
71
71
|
for each issue in Li(按编号顺序):
|
|
72
|
-
|
|
72
|
+
主代理执行三个阶段:
|
|
73
73
|
① Contract
|
|
74
74
|
② Red-Green
|
|
75
|
-
③ Verify(当前 issue
|
|
76
|
-
|
|
75
|
+
③ Verify(当前 issue 影响范围 + 当前 issue review)
|
|
76
|
+
执行 Finalize(非阶段:独立 commit + Tracker 收尾)
|
|
77
77
|
产出回执卡片并回写 issue
|
|
78
78
|
强制更新 progress.md 的 Status/Commit/Review/Tests
|
|
79
79
|
通过 A3 层收敛后进入下一层
|
|
80
80
|
全部层完成后进入 A4
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
每个 issue 的 Verify 只运行当前 issue 影响范围内的完整测试;全仓测试不在每个 issue
|
|
83
|
+
每个 issue 的 Verify 只运行当前 issue 影响范围内的完整测试;全仓测试不在每个 issue 中重复执行。当前 issue 的最终 diff 稳定后只调用一次 `code-review`;review 的内部方法完全由 `code-review` 定义。修复 blocking finding 后执行受影响验证和 finding delta recheck,不重复调用完整 `code-review`。
|
|
84
84
|
|
|
85
|
-
主代理在层内和层间连续调度:一个 issue 的
|
|
85
|
+
主代理在层内和层间连续调度:一个 issue 的 Finalize 出口满足后,立即取下一个 issue,直到全部层完成或发生明确外部阻塞。进度输出并入执行序列,不在正常切换点等待用户“继续”。
|
|
86
86
|
|
|
87
|
-
进入 A2 前记录的 `BASE_HEAD` 必须在每个 issue
|
|
87
|
+
进入 A2 前记录的 `BASE_HEAD` 必须在每个 issue 的三个阶段出口和 Finalize commit 前校验:
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
90
|
git merge-base --is-ancestor $BASE_HEAD HEAD
|
|
@@ -102,7 +102,7 @@ Status: resolved
|
|
|
102
102
|
Commit: <hash> — <message>
|
|
103
103
|
Behaviors: <completed list>
|
|
104
104
|
Acceptance Criteria: <checkbox result>
|
|
105
|
-
Review:
|
|
105
|
+
Review: code-review completed once, no blocking finding
|
|
106
106
|
Tests: <targeted command and actual result>
|
|
107
107
|
Runtime: <actual request/page-visible result or not required>
|
|
108
108
|
Docs: <updated files or no update required>
|
|
@@ -110,13 +110,15 @@ Docs: <updated files or no update required>
|
|
|
110
110
|
|
|
111
111
|
### A2 出口
|
|
112
112
|
|
|
113
|
-
- 当前层每个 issue
|
|
113
|
+
- 当前层每个 issue 均完成三个阶段与 Finalize 并有独立 commit;
|
|
114
114
|
- issue、回执卡片和 `progress.md` 一致;
|
|
115
115
|
- 相关测试通过,工作区卫生和历史校验通过;
|
|
116
116
|
- 没有未记录的跨 issue 改动。
|
|
117
117
|
|
|
118
118
|
## A3:层收敛
|
|
119
119
|
|
|
120
|
+
A3 只做编排收敛,不再次调用 `code-review`;正式 review 已在每个 issue 的 Verify 中完成。
|
|
121
|
+
|
|
120
122
|
每层全部 issue 串行完成后检查以下项目,全部通过才进入下一层:
|
|
121
123
|
|
|
122
124
|
1. 所有 issue `Status: resolved`,实施总结已落盘,`progress.md` 对应行已为 `done`;
|
|
@@ -153,13 +155,13 @@ A5 负责所有编排级失败,不把失败静默吞掉,也不把不相关
|
|
|
153
155
|
| Contract 歧义、验收缺口、范围变化 | 回到该 issue 的 Contract,补 Scope Ledger、Behavior 和验证矩阵 |
|
|
154
156
|
| Red-Green 的有效 Red、实现、typecheck 或 targeted test 失败 | 回到该 issue 的 Red-Green,修复当前 Behavior 并重新验证 |
|
|
155
157
|
| Verify 的测试、build、真实运行或 review blocking finding 失败 | 回到受影响 issue 的对应阶段;修复后只做受影响检查和 delta review |
|
|
156
|
-
|
|
|
158
|
+
| Finalize 的必要 docs、commit 或 Tracker 失败 | 保持 issue 未 resolved,修复 Finalize 问题后重新验证 |
|
|
157
159
|
| 全量测试失败 | 定位到引入失败的 issue,按上述路径修复;只在修复后重跑必要范围和全量测试 |
|
|
158
160
|
| `Blocked by` 依赖未完成 | 后续 issue 保持 `blocked`,前置 issue resolved 后自动解阻 |
|
|
159
161
|
| 多 issue 预期修改同一文件 | 记录冲突,按编号串行;无法安全归属时暂停并请求用户决定 |
|
|
160
162
|
| Git 历史祖先校验失败 | 立即停止写入,使用 `git reflog` 找回 `BASE_HEAD` 之后的提交,校验通过后继续 |
|
|
161
163
|
|
|
162
|
-
主代理不跨 issue
|
|
164
|
+
主代理不跨 issue 无记录改动;不通过第二次完整 `code-review` 来掩盖定向修复。外部权限、model、browser 或 tool 不可用时遵循 [stages.md](stages.md) 的 Tool Failure Budget,最多一次有依据的 fallback,仍失败则标记 `blocked/unavailable` 并报告实际状态。
|
|
163
165
|
|
|
164
166
|
### A5 出口
|
|
165
167
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 三阶段详细定义 + Finalize
|
|
2
2
|
|
|
3
|
-
单 `spec` / 单 `task` 与多 `task`
|
|
3
|
+
单 `spec` / 单 `task` 与多 `task` 共用下列三个交付阶段;Verify 通过后执行 Finalize 收尾,Finalize 不计入阶段。多 issue 的依赖图、Kahn 分层、层收敛、全量收敛和回退/冲突处理见 [orchestration.md](orchestration.md)。TDD 语义以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为唯一事实源,不在此重写。
|
|
4
4
|
|
|
5
5
|
## 目录
|
|
6
6
|
|
|
7
7
|
- [① Contract:明确交付契约](#阶段-①-contract明确交付契约)
|
|
8
8
|
- [② Red-Green:行为级 TDD](#阶段-②-red-green行为级-tdd)
|
|
9
9
|
- [③ Verify:最终验证与审查](#阶段-③-verify最终验证与审查)
|
|
10
|
-
- [
|
|
10
|
+
- [Finalize:非阶段交付收尾](#finalize非阶段交付收尾)
|
|
11
11
|
- [跨阶段运行纪律](#跨阶段运行纪律)
|
|
12
12
|
- [状态统一](#状态统一)
|
|
13
13
|
- [回退路由](#回退路由)
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
2. 产品实现之前存在有效 Red;
|
|
22
22
|
3. 最终 diff 对应的相关测试和 typecheck 通过;
|
|
23
23
|
4. ticket 要求真实运行时,真实运行验证已完成;
|
|
24
|
-
5.
|
|
24
|
+
5. 当前稳定 diff 已完成一次 `code-review` 且无 blocking finding;
|
|
25
25
|
6. README/docs 与实现一致;
|
|
26
26
|
7. 每个 issue 形成独立、可追溯的 commit;
|
|
27
27
|
8. Tracker 状态与真实完成度一致。
|
|
28
28
|
|
|
29
|
-
Seam 或专项测试绿色不等于 issue
|
|
29
|
+
Seam 或专项测试绿色不等于 issue 完成;只有三个阶段与 Finalize 全部通过,issue 才能标记为 `resolved`。
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
## 阶段 ① Contract:明确交付契约
|
|
@@ -58,11 +58,10 @@ Seam 或专项测试绿色不等于 issue 完成;只有四个阶段全部通
|
|
|
58
58
|
5. 完成一次 **Preflight** 并记录真实结果:
|
|
59
59
|
- 当前 `HEAD`、工作区状态和 `BASE_HEAD=$(git rev-parse HEAD)`;
|
|
60
60
|
- 可用的 test、typecheck、build 命令;
|
|
61
|
-
-
|
|
61
|
+
- `code-review` 可用性;
|
|
62
62
|
- 可用的 browser 或 Playwright 路径;
|
|
63
|
-
- 可用的敏感信息扫描脚本;
|
|
64
63
|
- ticket 要求的真实运行验证方式。
|
|
65
|
-
6. 建立一次验证矩阵,列出 targeted tests、typecheck、全量测试、必要 build、smoke/package
|
|
64
|
+
6. 建立一次验证矩阵,列出 targeted tests、typecheck、全量测试、必要 build、smoke/package check 和真实运行验证,并记录各项的触发条件,后续只复用这份矩阵。
|
|
66
65
|
7. 识别公共测试边界和 Behaviors。一个 Seam 是一个公共可观察边界;一个 Behavior 是一个红-绿 cycle;一个 Seam 可以包含多个 Behaviors。每个 Behavior 明确输入、可观察输出、对应 Acceptance Criterion 和验证层级。
|
|
67
66
|
8. spec 已确认且未变化的 Seam 直接复用;只有出现需求歧义、验收缺口、范围变化、破坏性操作或互斥方案时才请求用户确认。
|
|
68
67
|
|
|
@@ -137,7 +136,7 @@ Seam 或专项测试绿色不等于 issue 完成;只有四个阶段全部通
|
|
|
137
136
|
当前 issue 影响范围测试
|
|
138
137
|
→ 必要 build
|
|
139
138
|
→ 必要真实运行验证
|
|
140
|
-
→
|
|
139
|
+
→ 当前稳定 diff 调用一次 code-review
|
|
141
140
|
→ 修复 blocking finding 后的定向复核
|
|
142
141
|
```
|
|
143
142
|
|
|
@@ -150,48 +149,36 @@ Seam 或专项测试绿色不等于 issue 完成;只有四个阶段全部通
|
|
|
150
149
|
|
|
151
150
|
### Review
|
|
152
151
|
|
|
153
|
-
1.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
3. 两个轴独立输出、互不掩盖;每个轴明确限制输出,例如 `≤ 400 words / ≤ 40 行`。
|
|
159
|
-
4. findings 分类为:当前 issue blocking、后续 ticket、advisory、out of scope。只处理当前 issue blocking finding;其余记录而不扩大范围。
|
|
160
|
-
5. 修复 blocking finding 后只运行受影响测试、typecheck 和 finding 的 delta recheck,不重新启动完整双轴 review。审查结果只在对话输出,不生成 `review-*.md` 等书面报告文件。
|
|
152
|
+
1. 当前 issue 的最终 diff 稳定后,调用一次 [code-review](.agents/skills/code-review/SKILL.md)。
|
|
153
|
+
2. `tdd-implement` 只负责 **何时调用 review**;审查维度、reviewer 数量、提示词、上下文与输出格式全部以 `code-review` 为唯一事实源,不在这里复制或弱化。
|
|
154
|
+
3. `code-review` 未完成或存在 blocking finding 时,issue 保持未完成。只修当前 issue blocking finding;其余 findings 按 `code-review` 的分类与输出处理,不无记录地扩大范围。
|
|
155
|
+
4. 修复 blocking finding 后,只运行受影响测试/typecheck 与 finding delta recheck,不再次调用完整 `code-review`。若修复引入新的 Behavior、改变 Scope 或使原 Review 对象不再成立,则回到 Contract/Red-Green,重新形成稳定最终 diff 后再进入 Verify。
|
|
156
|
+
5. Review 结果只在对话/运行记录中消费,不由 `tdd-implement` 额外生成自己的 review 报告格式。
|
|
161
157
|
|
|
162
158
|
### 出口条件
|
|
163
159
|
|
|
164
160
|
- 最终 diff 对应的相关测试通过;
|
|
165
161
|
- 必要 typecheck/build 通过;
|
|
166
162
|
- ticket 要求的真实运行验证已完成并记录实际结果;
|
|
167
|
-
-
|
|
163
|
+
- 当前稳定 diff 已完成一次 `code-review`;
|
|
168
164
|
- 无 blocking finding;
|
|
169
165
|
- 受影响范围的最后一次证据对应当前 diff。
|
|
170
166
|
|
|
171
167
|
---
|
|
172
168
|
|
|
173
|
-
##
|
|
169
|
+
## Finalize:非阶段交付收尾
|
|
174
170
|
|
|
175
171
|
### 入口条件
|
|
176
172
|
|
|
177
173
|
- Verify 出口条件满足。
|
|
178
174
|
|
|
179
|
-
### Commit
|
|
175
|
+
### Commit
|
|
180
176
|
|
|
181
|
-
|
|
177
|
+
1. 如本次实现要求 README/docs/config/package 同步,完成必要更新。
|
|
178
|
+
2. 按当前 issue 范围直接创建一个独立 commit。
|
|
179
|
+
3. 不执行额外敏感信息/安全扫描,不做 `git diff --cached` 复核,也不设置额外 commit message 门禁。
|
|
182
180
|
|
|
183
|
-
|
|
184
|
-
2. 检查 README/docs/config/package 与实现一致;
|
|
185
|
-
3. 复核 Scope Ledger,确认没有未记录的范围扩张;
|
|
186
|
-
4. 确认证据对应最后一次代码或测试修改;
|
|
187
|
-
5. 检查临时文件、构建产物和未跟踪文件;
|
|
188
|
-
6. 对 staged diff 执行敏感信息检查;
|
|
189
|
-
7. 执行 `git merge-base --is-ancestor $BASE_HEAD HEAD`;
|
|
190
|
-
8. 检查 commit message;
|
|
191
|
-
9. 确认暂存区只包含当前 issue;
|
|
192
|
-
10. 执行 `git diff --cached`,再创建当前 issue 的独立 commit。
|
|
193
|
-
|
|
194
|
-
执行敏感信息扫描脚本(`bash .agents/skills/tdd-implement/scripts/scan-sensitive.sh --staged-only`),检查 staged diff、commit message 和 Git history preservation,全部通过后创建当前 issue 的独立 commit。
|
|
181
|
+
仓库级 Git 安全与历史保护规则仍然适用;Finalize 不重复定义或扩展这些规则。
|
|
195
182
|
|
|
196
183
|
### Tracker 收尾
|
|
197
184
|
|
|
@@ -202,19 +189,16 @@ Commit 成功后:
|
|
|
202
189
|
- 追加实施总结;
|
|
203
190
|
- 更新 `.scratch/<feature>/progress.md` 的 `Status`、`Commit`、`Review`、`Tests`;
|
|
204
191
|
- 记录 commit hash、message、最终测试命令/数量/结果和真实运行结果;
|
|
205
|
-
- 清理本次产生的临时进程、目录和一次性文件;
|
|
206
192
|
- 确认下一 issue 的 blockers 已解除。
|
|
207
193
|
|
|
208
|
-
|
|
194
|
+
Finalize 开始后不新增产品 Behavior。若实现、测试或文档不完整,回到对应阶段;只有三个阶段与 Finalize 全部通过,才可把 issue 标记为 `resolved`。
|
|
209
195
|
|
|
210
196
|
### 出口条件
|
|
211
197
|
|
|
212
198
|
- commit 已创建且为当前 issue 的独立提交;
|
|
213
199
|
- Acceptance Criteria 全部通过;
|
|
214
200
|
- issue 状态为 `resolved`(无关联 issue 的直接 spec 则在会话中输出总结);
|
|
215
|
-
- 实施总结和 `progress.md`
|
|
216
|
-
- 工作区符合预期,无本次临时产物或残留未跟踪文件;
|
|
217
|
-
- 文档与实现一致,Git 历史保护校验通过。
|
|
201
|
+
- 实施总结和 `progress.md` 已同步。
|
|
218
202
|
|
|
219
203
|
---
|
|
220
204
|
|
|
@@ -233,7 +217,7 @@ Commit 成功后:
|
|
|
233
217
|
|
|
234
218
|
### 验证证据失效
|
|
235
219
|
|
|
236
|
-
任何产品代码或测试文件再次变化,旧的测试、typecheck、build
|
|
220
|
+
任何产品代码或测试文件再次变化,旧的测试、typecheck、build 等受影响证据立即失效,必须重新验证受影响范围。正式 `code-review` 调用本身不因 finding 修复而重复;post-review 修复必须完成受影响验证和 finding delta recheck。若修改引入新的 Behavior、改变 Scope 或使原 Review 对象不再成立,则回到 Contract/Red-Green,重新形成稳定最终 diff 后再进入 Verify。
|
|
237
221
|
|
|
238
222
|
### Git History Preservation
|
|
239
223
|
|
|
@@ -255,7 +239,7 @@ Issue: ready-for-agent | in_progress | resolved | blocked
|
|
|
255
239
|
Progress: pending | in_progress | done | blocked
|
|
256
240
|
```
|
|
257
241
|
|
|
258
|
-
状态转换:Contract 完成后 Issue/Progress 为 `in_progress`;Red-Green 完成后 Behaviors 为 `completed`,Issue 仍为 `in_progress`;Verify 完成后 Issue 仍为 `in_progress`;
|
|
242
|
+
状态转换:Contract 完成后 Issue/Progress 为 `in_progress`;Red-Green 完成后 Behaviors 为 `completed`,Issue 仍为 `in_progress`;Verify 完成后 Issue 仍为 `in_progress`;Finalize 完成后 Issue 为 `resolved`、Progress 为 `done`。外部阻塞记录为 `blocked`,恢复后回到 `in_progress`。
|
|
259
243
|
|
|
260
244
|
---
|
|
261
245
|
|
|
@@ -266,6 +250,6 @@ Progress: pending | in_progress | done | blocked
|
|
|
266
250
|
| ① Contract | 需求歧义、验收缺口、范围变化 | → ① 补充契约和验证矩阵 |
|
|
267
251
|
| ② Red-Green | 有效 Red、实现、formatter、typecheck 或相关测试失败 | → ② 修复当前 Behavior |
|
|
268
252
|
| ③ Verify | 测试、build、真实运行或 review finding 失败 | → ② 修复 Behavior;需求偏差 → ① |
|
|
269
|
-
|
|
|
253
|
+
| Finalize | 必要 docs 未同步、commit 失败或 Tracker 信息不完整 | → ①/③ 修复对应问题;仍在 Finalize 完成前解决 |
|
|
270
254
|
|
|
271
255
|
多 issue 的层收敛、全量失败、依赖冲突和跨 issue 修改冲突按 [orchestration.md](orchestration.md) A5 回退,不跨 issue 无记录改动。
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
# Verify
|
|
2
2
|
|
|
3
|
-
仅在 `tdd-implement` Step ③ 读取。验证必须对应当前最终 diff
|
|
3
|
+
仅在 `tdd-implement` Step ③ 读取。验证必须对应当前最终 diff;产品代码或测试再次变化时,测试/typecheck/build 等受影响证据失效。
|
|
4
4
|
|
|
5
5
|
## 固定顺序
|
|
6
6
|
|
|
7
|
-
`影响范围测试 → 必要 build → 必要真实运行验证 → 一次
|
|
7
|
+
`影响范围测试 → 必要 build → 必要真实运行验证 → code-review 一次 → blocking 修复后的定向复核`
|
|
8
8
|
|
|
9
9
|
## 规则
|
|
10
10
|
|
|
11
11
|
- 单 issue / 单 spec:按 Contract 验证矩阵运行完整相关测试;多 issue:只跑当前 issue 影响范围,全仓测试留给 orchestration A4。
|
|
12
12
|
- ticket 要求真实运行时,优先专用 browser,其次项目已有 Playwright;HTTP/CLI 不能替代 WebUI 可见验证。
|
|
13
13
|
- 临时进程必须使用隔离配置/端口,记录 PID 与实际结果,结束后清理。
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- 修复 blocking
|
|
14
|
+
- 当前 issue 的最终 diff 稳定后,调用一次 [code-review](.agents/skills/code-review/SKILL.md)。`tdd-implement` 只规定调用时机;审查维度、reviewer 数量、提示词、上下文与输出格式以 `code-review` 为唯一事实源。
|
|
15
|
+
- `code-review` 未完成或返回 blocking finding 时,issue 保持未完成;只修当前 issue 的 blocking finding,其余按 review 结果记录。
|
|
16
|
+
- 修复 blocking finding 后,只重跑受影响测试/typecheck 并对该 finding 做 delta recheck;不再次调用完整 `code-review`。若修复引入新的 Behavior、改变 Scope 或使原 Review 对象不再成立,则回到 Contract/Red-Green,重新形成稳定最终 diff 后再进入 Verify。
|
|
17
17
|
|
|
18
18
|
## 出口
|
|
19
19
|
|
|
20
20
|
- 最终 diff 的相关测试/typecheck/build 通过;
|
|
21
21
|
- 要求的真实运行验证有实际证据;
|
|
22
|
-
-
|
|
22
|
+
- 当前稳定 diff 已完成一次 `code-review`;
|
|
23
23
|
- 无 blocking finding;
|
|
24
|
-
-
|
|
24
|
+
- post-review 修复(如有)的受影响验证与 finding delta recheck 已完成。
|
|
@@ -31,7 +31,7 @@ Every skill that touches git must preserve history after `BASE_HEAD`: history ma
|
|
|
31
31
|
|
|
32
32
|
To achieve "directory clean" (`git status` clean) the skill may only delete its own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files) — it must never use git-level destructive commands to reach a clean state. The following are forbidden without explicit user confirmation: `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked` (use `--keep-index` instead and `pop` with verification), `git push --force`, `git rebase -i` and any `reset`/`checkout` that moves `HEAD` backward.
|
|
33
33
|
|
|
34
|
-
Canonical enforcement: [`tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) checks `BASE_HEAD` at every
|
|
34
|
+
Canonical enforcement: [`tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) checks `BASE_HEAD` at every delivery-stage exit and before the Finalize commit; multi-issue enforcement lives in [`tdd-implement/references/orchestration.md`](.agents/skills/tdd-implement/references/orchestration.md) A2-A4. Repository-local commit gating remains a workspace-only concern and is not part of the distributable template.
|
|
35
35
|
## Long-horizon skills inventory
|
|
36
36
|
|
|
37
37
|
Skills currently classified as Long-Horizon, to be evolved against these rules as they are touched: `tdd-implement` (fixed), `diagnose-fix` (fixed — orchestration for diagnosis + TDD fix), `diagnosing-bugs`, `improve-codebase-architecture`, `wayfinder`, `grill-to-spec` (fixed — carries its own Turn Continuity rule), `to-spec`. Backfilling existing skill texts is out of scope for now — these rules bind new and edited skills going forward.
|
|
@@ -31,7 +31,7 @@ Every skill that touches git must preserve history after `BASE_HEAD`: history ma
|
|
|
31
31
|
|
|
32
32
|
To achieve "directory clean" (`git status` clean) the skill may only delete its own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files) — it must never use git-level destructive commands to reach a clean state. The following are forbidden without explicit user confirmation: `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked` (use `--keep-index` instead and `pop` with verification), `git push --force`, `git rebase -i` and any `reset`/`checkout` that moves `HEAD` backward.
|
|
33
33
|
|
|
34
|
-
Canonical enforcement: [`tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) checks `BASE_HEAD` at every
|
|
34
|
+
Canonical enforcement: [`tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) checks `BASE_HEAD` at every delivery-stage exit and before the Finalize commit; multi-issue enforcement lives in [`tdd-implement/references/orchestration.md`](.agents/skills/tdd-implement/references/orchestration.md) A2-A4. Repository-local commit gating remains a workspace-only concern and is not part of the distributable template.
|
|
35
35
|
## Long-horizon skills inventory
|
|
36
36
|
|
|
37
37
|
Skills currently classified as Long-Horizon, to be evolved against these rules as they are touched: `tdd-implement` (fixed), `diagnose-fix` (fixed — orchestration for diagnosis + TDD fix), `diagnosing-bugs`, `improve-codebase-architecture`, `wayfinder`, `grill-to-spec` (fixed — carries its own Turn Continuity rule), `to-spec`. Backfilling existing skill texts is out of scope for now — these rules bind new and edited skills going forward.
|
package/template/AGENTS.md
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* 原型 / PoC → `prototype`
|
|
6
6
|
* 简单修改 → 直接实现
|
|
7
7
|
* TDD / 集成测试 → `tdd`
|
|
8
|
-
* bug / 异常 / 性能 → `diagnose-fix`
|
|
9
8
|
* 代码审查 → `code-review`
|
|
10
9
|
* 设计质询 → `grilling`
|
|
11
10
|
* 领域建模 → `domain-modeling`
|
|
@@ -21,7 +20,6 @@ codegraph explore "<问题>"
|
|
|
21
20
|
codegraph init
|
|
22
21
|
codegraph explore "<问题>"
|
|
23
22
|
```
|
|
24
|
-
* 优先于 `Read`、`grep`、`rg`、`find` 和代码探索子代理。
|
|
25
23
|
* 从最小必要上下文开始;返回完整源码即视为已读。
|
|
26
24
|
* 信息不足时只针对缺口继续 `explore`;已锁定符号时使用 `codegraph node`。
|
|
27
25
|
* CodeGraph 无法提供必要信息时,才降级到最小必要的读取 / 搜索。
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Deliver
|
|
2
|
-
|
|
3
|
-
仅在 `tdd-implement` Step ④ 读取。阶段开始后不新增产品 Behavior;发现实现/测试/文档遗漏时回到对应阶段。
|
|
4
|
-
|
|
5
|
-
## Commit 前门禁
|
|
6
|
-
|
|
7
|
-
1. 逐条复核 Acceptance Criteria、Scope Ledger 与 Out of Scope。
|
|
8
|
-
2. 确认 README/docs/config/package 与实现一致,且证据对应最后一次修改。
|
|
9
|
-
3. 清理本次临时文件和进程;工作区只保留预期改动。
|
|
10
|
-
4. 对 staged diff 执行敏感信息扫描。
|
|
11
|
-
5. 执行 `git merge-base --is-ancestor $BASE_HEAD HEAD`。
|
|
12
|
-
6. 确认 commit message 与暂存区都只覆盖当前 issue,并检查 `git diff --cached`。
|
|
13
|
-
7. 创建当前 issue 的独立 commit。
|
|
14
|
-
|
|
15
|
-
## Tracker 收尾
|
|
16
|
-
|
|
17
|
-
- 勾选 Acceptance Criteria;
|
|
18
|
-
- issue 标记 `resolved`;
|
|
19
|
-
- 写实施总结并同步 `.scratch/<feature>/progress.md` 的 Status/Commit/Review/Tests;
|
|
20
|
-
- 记录 commit hash/message、最终测试和真实运行结果;
|
|
21
|
-
- 清理一次性资源,确认后续 blockers 是否解除。
|
|
22
|
-
|
|
23
|
-
## Git 安全
|
|
24
|
-
|
|
25
|
-
历史只能在 `BASE_HEAD` 之后追加;未经用户明确确认不使用 `git reset --hard`、`git checkout .`、`git clean -fd`、`git stash push --include-untracked`、force push 或交互式 rebase 来“清理”目录。
|
|
26
|
-
|
|
27
|
-
## 出口
|
|
28
|
-
|
|
29
|
-
- 独立 commit 已创建;
|
|
30
|
-
- Acceptance Criteria 全部通过;
|
|
31
|
-
- Tracker/progress 与真实完成度一致;
|
|
32
|
-
- 工作区无本次临时残留;
|
|
33
|
-
- 文档与实现一致,Git history 校验通过。
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Deterministic staged-diff secret scan for the tdd-implement deliver gate.
|
|
3
|
-
# Only ADDED lines are inspected: removing a leaked secret must never be blocked.
|
|
4
|
-
# Match contents are never echoed, so detected credentials do not leak into agent/log output.
|
|
5
|
-
# FAIL: structured assignments and private-key blocks.
|
|
6
|
-
# WARN: bare keywords that may legitimately appear in documentation.
|
|
7
|
-
set -euo pipefail
|
|
8
|
-
|
|
9
|
-
if [[ $# -gt 1 || ( $# -eq 1 && "$1" != "--staged-only" ) ]]; then
|
|
10
|
-
echo "usage: $0 [--staged-only]" >&2
|
|
11
|
-
exit 2
|
|
12
|
-
fi
|
|
13
|
-
|
|
14
|
-
fail_patterns='(api[_-]?key|secret|token|passwd|password)[[:space:]]*[=:][[:space:]]*[^[:space:]]{8,}|BEGIN (RSA|OPENSSH|EC|DSA) PRIVATE KEY'
|
|
15
|
-
warn_patterns='(api[_-]?key|secret|token|passwd|password|\.env)'
|
|
16
|
-
|
|
17
|
-
# Strip diff metadata and deletions. The scanner cares only about content that the
|
|
18
|
-
# commit would introduce, not secrets that the commit is removing.
|
|
19
|
-
added_lines=$(
|
|
20
|
-
git diff --cached --unified=0 --no-color \
|
|
21
|
-
| awk '/^\+\+\+ / { next } /^\+/ { print substr($0, 2) }'
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
fail=0
|
|
25
|
-
|
|
26
|
-
if grep -qiE "$fail_patterns" <<< "$added_lines"; then
|
|
27
|
-
echo "❌ Possible structured secret found in ADDED staged content — remove or redact it before committing." >&2
|
|
28
|
-
fail=1
|
|
29
|
-
else
|
|
30
|
-
echo "✅ No structured secrets in added staged content."
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
if grep -qiE "$warn_patterns" <<< "$added_lines"; then
|
|
34
|
-
echo "⚠ Sensitive keyword found in ADDED staged content — inspect the staged diff manually." >&2
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
exit "$fail"
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Deliver
|
|
2
|
-
|
|
3
|
-
仅在 `tdd-implement` Step ④ 读取。阶段开始后不新增产品 Behavior;发现实现/测试/文档遗漏时回到对应阶段。
|
|
4
|
-
|
|
5
|
-
## Commit 前门禁
|
|
6
|
-
|
|
7
|
-
1. 逐条复核 Acceptance Criteria、Scope Ledger 与 Out of Scope。
|
|
8
|
-
2. 确认 README/docs/config/package 与实现一致,且证据对应最后一次修改。
|
|
9
|
-
3. 清理本次临时文件和进程;工作区只保留预期改动。
|
|
10
|
-
4. 对 staged diff 执行敏感信息扫描。
|
|
11
|
-
5. 执行 `git merge-base --is-ancestor $BASE_HEAD HEAD`。
|
|
12
|
-
6. 确认 commit message 与暂存区都只覆盖当前 issue,并检查 `git diff --cached`。
|
|
13
|
-
7. 创建当前 issue 的独立 commit。
|
|
14
|
-
|
|
15
|
-
## Tracker 收尾
|
|
16
|
-
|
|
17
|
-
- 勾选 Acceptance Criteria;
|
|
18
|
-
- issue 标记 `resolved`;
|
|
19
|
-
- 写实施总结并同步 `.scratch/<feature>/progress.md` 的 Status/Commit/Review/Tests;
|
|
20
|
-
- 记录 commit hash/message、最终测试和真实运行结果;
|
|
21
|
-
- 清理一次性资源,确认后续 blockers 是否解除。
|
|
22
|
-
|
|
23
|
-
## Git 安全
|
|
24
|
-
|
|
25
|
-
历史只能在 `BASE_HEAD` 之后追加;未经用户明确确认不使用 `git reset --hard`、`git checkout .`、`git clean -fd`、`git stash push --include-untracked`、force push 或交互式 rebase 来“清理”目录。
|
|
26
|
-
|
|
27
|
-
## 出口
|
|
28
|
-
|
|
29
|
-
- 独立 commit 已创建;
|
|
30
|
-
- Acceptance Criteria 全部通过;
|
|
31
|
-
- Tracker/progress 与真实完成度一致;
|
|
32
|
-
- 工作区无本次临时残留;
|
|
33
|
-
- 文档与实现一致,Git history 校验通过。
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Deterministic staged-diff secret scan for the tdd-implement deliver gate.
|
|
3
|
-
# Only ADDED lines are inspected: removing a leaked secret must never be blocked.
|
|
4
|
-
# Match contents are never echoed, so detected credentials do not leak into agent/log output.
|
|
5
|
-
# FAIL: structured assignments and private-key blocks.
|
|
6
|
-
# WARN: bare keywords that may legitimately appear in documentation.
|
|
7
|
-
set -euo pipefail
|
|
8
|
-
|
|
9
|
-
if [[ $# -gt 1 || ( $# -eq 1 && "$1" != "--staged-only" ) ]]; then
|
|
10
|
-
echo "usage: $0 [--staged-only]" >&2
|
|
11
|
-
exit 2
|
|
12
|
-
fi
|
|
13
|
-
|
|
14
|
-
fail_patterns='(api[_-]?key|secret|token|passwd|password)[[:space:]]*[=:][[:space:]]*[^[:space:]]{8,}|BEGIN (RSA|OPENSSH|EC|DSA) PRIVATE KEY'
|
|
15
|
-
warn_patterns='(api[_-]?key|secret|token|passwd|password|\.env)'
|
|
16
|
-
|
|
17
|
-
# Strip diff metadata and deletions. The scanner cares only about content that the
|
|
18
|
-
# commit would introduce, not secrets that the commit is removing.
|
|
19
|
-
added_lines=$(
|
|
20
|
-
git diff --cached --unified=0 --no-color \
|
|
21
|
-
| awk '/^\+\+\+ / { next } /^\+/ { print substr($0, 2) }'
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
fail=0
|
|
25
|
-
|
|
26
|
-
if grep -qiE "$fail_patterns" <<< "$added_lines"; then
|
|
27
|
-
echo "❌ Possible structured secret found in ADDED staged content — remove or redact it before committing." >&2
|
|
28
|
-
fail=1
|
|
29
|
-
else
|
|
30
|
-
echo "✅ No structured secrets in added staged content."
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
if grep -qiE "$warn_patterns" <<< "$added_lines"; then
|
|
34
|
-
echo "⚠ Sensitive keyword found in ADDED staged content — inspect the staged diff manually." >&2
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
exit "$fail"
|