hunter-harness 0.1.0 → 0.1.1
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/dist/bin.js +127 -106
- package/package.json +2 -2
- package/resources/harness/general/.harness-build.json +1 -1
- package/resources/harness/general/harness-archive/SKILL.md +215 -215
- package/resources/harness/general/harness-codebase-map/SKILL.md +112 -112
- package/resources/harness/general/harness-codebase-map/templates/map-summary.md +3 -3
- package/resources/harness/general/harness-knowledge-ingest/SKILL.md +246 -246
- package/resources/harness/general/harness-knowledge-query/SKILL.md +164 -164
- package/resources/harness/general/harness-plan/SKILL.md +127 -127
- package/resources/harness/general/harness-review/SKILL.md +156 -156
- package/resources/harness/general/harness-run/SKILL.md +132 -132
- package/resources/harness/general/harness-submit/SKILL.md +159 -159
- package/resources/harness/general/harness-sync/SKILL.md +82 -82
- package/resources/harness/general/harness-test/SKILL.md +180 -180
- package/resources/harness/general/scripts/harness_deploy.py +580 -580
- package/resources/harness/java/.harness-build.json +1 -1
- package/resources/harness/java/harness-apidoc/SKILL.md +86 -86
- package/resources/harness/java/harness-archive/SKILL.md +215 -215
- package/resources/harness/java/harness-codebase-map/SKILL.md +112 -112
- package/resources/harness/java/harness-codebase-map/templates/map-summary.md +3 -3
- package/resources/harness/java/harness-knowledge-ingest/SKILL.md +246 -246
- package/resources/harness/java/harness-knowledge-query/SKILL.md +164 -164
- package/resources/harness/java/harness-package/SKILL.md +87 -87
- package/resources/harness/java/harness-plan/SKILL.md +127 -127
- package/resources/harness/java/harness-review/SKILL.md +156 -156
- package/resources/harness/java/harness-run/SKILL.md +148 -148
- package/resources/harness/java/harness-submit/SKILL.md +166 -166
- package/resources/harness/java/harness-sync/SKILL.md +82 -82
- package/resources/harness/java/harness-test/SKILL.md +192 -192
- package/resources/harness/java/scripts/harness_deploy.py +580 -580
- package/resources/harness/manifests/general.json +13 -33
- package/resources/harness/manifests/java.json +15 -35
- package/resources/bootstrap-ir/manifest.json +0 -19
- package/resources/bootstrap-ir/skills/harness-apidoc.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-archive.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-codebase-map.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-knowledge-ingest.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-package.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-plan.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-review.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-run.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-skill-optimizer.yaml +0 -28
- package/resources/bootstrap-ir/skills/harness-submit.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-sync.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-test.yaml +0 -24
- package/resources/bootstrap-ir/templates/claude-code-skill.md +0 -12
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +0 -43
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-02-14-ledger-snapshot-followup/reports/final/summary-data.json +0 -38
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +0 -36
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +0 -1
- package/resources/harness/general/harness-knowledge-ingest/tests/test_harness_knowledge.py +0 -1792
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +0 -43
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-02-14-ledger-snapshot-followup/reports/final/summary-data.json +0 -38
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +0 -36
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +0 -1
- package/resources/harness/java/harness-knowledge-ingest/tests/test_harness_knowledge.py +0 -1792
- package/resources/manifest.json +0 -19
- package/resources/skills/harness-apidoc/SKILL.md +0 -50
- package/resources/skills/harness-archive/SKILL.md +0 -48
- package/resources/skills/harness-codebase-map/SKILL.md +0 -53
- package/resources/skills/harness-knowledge-ingest/SKILL.md +0 -48
- package/resources/skills/harness-package/SKILL.md +0 -48
- package/resources/skills/harness-plan/SKILL.md +0 -51
- package/resources/skills/harness-review/SKILL.md +0 -50
- package/resources/skills/harness-run/SKILL.md +0 -48
- package/resources/skills/harness-skill-optimizer/SKILL.md +0 -54
- package/resources/skills/harness-submit/SKILL.md +0 -47
- package/resources/skills/harness-sync/SKILL.md +0 -48
- package/resources/skills/harness-test/SKILL.md +0 -50
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: harness-review
|
|
3
|
-
description: "6维度代码审查(架构/安全/规范/兼容/测试/性能),对照.claude/rules/和测试场景表,在隔离上下文运行。使用场景:代码审查、提交前检查、合并评审"
|
|
4
|
-
argument-hint: "变更名或留空自动检测"
|
|
5
|
-
effort: high
|
|
6
|
-
allowed-tools: [Read, Write, Edit, Glob, Grep, Agent, Bash(powershell.exe:*)]
|
|
7
|
-
disallowed-tools:
|
|
8
|
-
- Bash(git *)
|
|
9
|
-
- Bash(mvn *)
|
|
10
|
-
- Bash(ls *)
|
|
11
|
-
- Bash(find *)
|
|
12
|
-
- Bash(grep *)
|
|
13
|
-
- Bash(cat *)
|
|
14
|
-
- Bash(cp *)
|
|
15
|
-
- Bash(mv *)
|
|
16
|
-
- Bash(rm *)
|
|
17
|
-
- Bash(mkdir *)
|
|
18
|
-
- Bash(touch *)
|
|
19
|
-
- Bash(sed *)
|
|
20
|
-
- Bash(awk *)
|
|
21
|
-
- Bash(curl *)
|
|
22
|
-
- Bash(codegraph *)
|
|
23
|
-
---
|
|
24
|
-
<!-- generated by harness_deploy.py; core=
|
|
25
|
-
# harness-review — 代码审查
|
|
26
|
-
|
|
27
|
-
## Purpose
|
|
28
|
-
|
|
29
|
-
对 git diff 进行6维度审查,对照项目规则和测试场景表,输出分级报告。**审查结果仅供参考,默认不阻塞后续 submit/archive 流程。**
|
|
30
|
-
|
|
31
|
-
## When to Use
|
|
32
|
-
|
|
33
|
-
使用此 Skill 当:
|
|
34
|
-
- 代码变更完成后需要审查
|
|
35
|
-
- 提交前需要质量检查
|
|
36
|
-
- 合并评审时需要系统性检查
|
|
37
|
-
- 用户说"审查代码"、"review"、"检查代码质量"
|
|
38
|
-
|
|
39
|
-
## Inputs
|
|
40
|
-
|
|
41
|
-
- `$ARGUMENTS`:变更名(可选,留空时自动扫描 `.harness/changes/*/plans/` 确定)
|
|
42
|
-
- 相关文件:`.harness/changes/*/plans/*-plan.md`、`.claude/rules/`、测试场景表
|
|
43
|
-
|
|
44
|
-
## 前置条件
|
|
45
|
-
|
|
46
|
-
- `.harness/changes/<change-name>/plans/<change-name>-plan.md` 存在(任务真相源)
|
|
47
|
-
- 必须读取 `.harness/changes/<change-name>/meta/worktree.json`:`requested=true` 且 worktree 已创建 → 在 worktree 目录中执行审查;`requested=true` 但 worktree 不存在 → 停止,提示先修复 `harness-run`,不得静默回主目录
|
|
48
|
-
- **review 不阻塞后续流程**:test 报告缺失或未运行不阻止 review(review 是参考性阶段),但应在报告中标注 test 状态供参考
|
|
49
|
-
|
|
50
|
-
## 统一读取协议
|
|
51
|
-
|
|
52
|
-
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
53
|
-
2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
54
|
-
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
55
|
-
4. **spec** — 设计真相源:`spec/<change>-design.md`
|
|
56
|
-
5. **plan** — 任务真相源:`plans/<change>-plan.md`
|
|
57
|
-
6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
|
|
58
|
-
7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
|
|
59
|
-
8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
|
|
60
|
-
|
|
61
|
-
状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
|
|
62
|
-
|
|
63
|
-
## Workflow
|
|
64
|
-
|
|
65
|
-
0. **启动准备** — 确定变更名(Glob `.harness/changes/*/plans/*-plan.md`,排除 `.harness/archive/*/`,读 frontmatter 提取 change-name);**append `phase.start` 事件**(不得等审查完成才补)
|
|
66
|
-
1. **读取 worktree 状态(门禁检查)** — 读 `.harness/changes/<change-name>/meta/worktree.json`:`requested=true` 但 worktree 不存在 → 停止并提示先修复 `harness-run`,不得静默回主目录(否则 git diff 为空);`requested=true` 且 worktree 已创建 → spawned agent 用该 worktree 路径执行 `git diff`(确保审查 worktree 变更而非主目录);`requested=false` → 审查主目录变更
|
|
67
|
-
2. **委派 harness-reviewer** — 先运行 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-reviewer --json`。`usable=false` → **直接主会话审查**,记 `decision` 事件,**不委派**。`usable=true` 时用 Agent spawn `harness-reviewer`(只读, 6 维度)。返回空 / 无报告正文 → **不 retry**,降级主会话审查。
|
|
68
|
-
3. **持久化报告(强制,主会话)** — Agent 返回后主会话 Write 到 `reports/review/review-report-*.md`。未 Write → 🟡WARN,不得宣称 review 完成。
|
|
69
|
-
4. **生成修复反馈(原生协议)** — 若报告存在 RED/YELLOW 问题,执行 `protocols.md` 的 `review-fixback-protocol`,将问题转化为结构化 fixback 清单并落盘到 `.harness/changes/<change-name>/reports/review/fixback-YYYYMMDD-HHmm.md`。若无 RED/YELLOW,记录 `review-fixback-protocol: skipped(no findings)`。不调用 Superpowers `receiving-code-review`,也不记录外部 skill 降级。
|
|
70
|
-
5. **收尾** — append `phase.end` / `artifact` 事件;控制台输出摘要
|
|
71
|
-
|
|
72
|
-
## Review 定位(重要)
|
|
73
|
-
|
|
74
|
-
**harness-review 是参考性代码审查阶段,不是硬门禁。**
|
|
75
|
-
|
|
76
|
-
| 等级 | 含义 | 后续影响 |
|
|
77
|
-
|:----:|------|----------|
|
|
78
|
-
| RED | 高风险建议,强烈建议处理 | 不阻塞后续流程 |
|
|
79
|
-
| YELLOW | 中低风险建议 | 不阻塞后续流程 |
|
|
80
|
-
| OK | 无问题 | 不阻塞后续流程 |
|
|
81
|
-
|
|
82
|
-
- 审查结果默认只作为参考,不阻塞 `/harness-submit`、`/harness-archive`
|
|
83
|
-
- 除非用户显式要求"review 结果阻塞提交",否则 review 不参与硬门禁
|
|
84
|
-
- Review 报告中**禁止写**:阻塞 submit / 必须修复后才能继续
|
|
85
|
-
- Review 报告中**应写**:建议优先处理 / 建议在 submit 前人工确认 / 建议补充测试 / 仅供参考,不阻塞后续 harness 流程
|
|
86
|
-
|
|
87
|
-
### 可选 strict-review-gate 配置
|
|
88
|
-
|
|
89
|
-
如果团队希望 review 结果阻塞提交,可在 `.harness/config/harness-test-config.md` 中设置:
|
|
90
|
-
|
|
91
|
-
```yaml
|
|
92
|
-
review:
|
|
93
|
-
strict-review-gate: true # 默认 false
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
当且仅当 `strict-review-gate: true` 时,review RED 才阻塞 submit。默认行为是 `strict-review-gate: false`。
|
|
97
|
-
|
|
98
|
-
## Output Format
|
|
99
|
-
|
|
100
|
-
审查报告保存到 `.harness/changes/<change-name>/reports/review/review-report-YYYYMMDD-HHmm.md`(时间戳区分多次运行),同时在控制台输出摘要。报告格式详见 `reference.md` 的「输出报告完整模板」。
|
|
101
|
-
|
|
102
|
-
## 渐进披露
|
|
103
|
-
|
|
104
|
-
- **Read `checklist.md`** 仅在执行完整6维度审查时 — 含6维度检查项详细列表 + 输出格式 + 执行日志记录模板
|
|
105
|
-
- **Read `reference.md`** 仅在需要理解审查标准或生成详细报告时 — 含"为什么需要审查"概述 + 严重级别判定标准 + 输出报告完整模板
|
|
106
|
-
- **Read `protocols.md`** 仅在 RED/YELLOW 问题需要转化为修复反馈时 — 含 `review-fixback-protocol` 的结构化 fixback 字段与落盘要求
|
|
107
|
-
|
|
108
|
-
## 原生修复反馈协议
|
|
109
|
-
|
|
110
|
-
`/harness-review` 不再运行时调用 Superpowers `receiving-code-review`。审查后的修复反馈能力内化为 `protocols.md` 的 `review-fixback-protocol`:
|
|
111
|
-
|
|
112
|
-
1. RED/YELLOW 问题转成 fixback 条目:严重级别、位置、风险、建议、验证方式、对 submit 的影响。
|
|
113
|
-
2. fixback 落盘到 `.harness/changes/<change-name>/reports/review/fixback-YYYYMMDD-HHmm.md`。
|
|
114
|
-
3. 无 RED/YELLOW 时记录跳过原因,不制造空修复任务。
|
|
115
|
-
|
|
116
|
-
## P0 执行可信度规则
|
|
117
|
-
|
|
118
|
-
- 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
|
|
119
|
-
- 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
|
|
120
|
-
- 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
|
|
121
|
-
|
|
122
|
-
## 关键规则(硬门禁速查)
|
|
123
|
-
|
|
124
|
-
> 每条规则的详细判定、检查项见 `checklist.md` 对应章节;Shell 执行安全见 `../protocols/powershell-protocol.md`,敏感信息见 `../protocols/sensitive-info-protocol.md`,证据化报告见 `../protocols/evidence-based-reporting-protocol.md`,状态目录见 `../protocols/state-layout-protocol.md`,结构化报告事件见 `../protocols/report-pipeline-protocol.md`。
|
|
125
|
-
|
|
126
|
-
### 一、只审查 git diff 变更部分
|
|
127
|
-
|
|
128
|
-
只审查本次 `git diff` 中的变更,不审查已有代码;diff 为空 → 直接返回"无变更可审查"。每个问题给出具体修复建议(文件:行号 + 建议做法)。
|
|
129
|
-
|
|
130
|
-
### 二、严重级别三态
|
|
131
|
-
|
|
132
|
-
RED=高风险建议(强烈建议处理),YELLOW=中低风险建议,OK=无问题。6维度逐文件审查(架构/安全/规范/兼容/测试/性能)—— 检查项见 `checklist.md`。判定标准见 `reference.md`「严重级别判定标准」。
|
|
133
|
-
|
|
134
|
-
### 三、review 结果仅供参考(不阻塞后续流程)
|
|
135
|
-
|
|
136
|
-
review 结果默认只作参考,不阻塞 submit/archive;报告措辞遵循 `## Review 定位(重要)` 的“禁止写/应写”清单,不得出现“阻塞 submit / 必须修复后才能继续”。
|
|
137
|
-
|
|
138
|
-
### 四、Shell 安全 / 敏感信息 / 证据化报告 / CodeGraph 探索
|
|
139
|
-
|
|
140
|
-
git diff/log 命令通过 `powershell.exe -Command "..."` 执行;review-report 中如发现明文 token/密码/密钥,必须列入 RED 问题并在报告中以 `<TOKEN_REDACTED>` 等占位符引用;RED/YELLOW/OK 结论必须基于实际 diff 内容,不得凭印象判断。代码探索必须优先使用 CodeGraph MCP 工具(`mcp__codegraph__codegraph_explore`),不允许通过普通 Bash 调 codegraph 命令(已列入 `disallowed-tools`);MCP 不可用时降级为 Grep/Glob + Read,并在执行日志记录降级原因。遵循 `../protocols/powershell-protocol.md` / `sensitive-info-protocol.md` / `evidence-based-reporting-protocol.md`。
|
|
141
|
-
|
|
142
|
-
## 交互白名单
|
|
143
|
-
|
|
144
|
-
**无** AskUserQuestion(审查全自动)。委派失败 → 主会话审查 + `decision` 事件。
|
|
145
|
-
|
|
146
|
-
## 执行日志
|
|
147
|
-
|
|
148
|
-
`events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
|
|
149
|
-
|
|
150
|
-
```powershell
|
|
151
|
-
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
> **脚本接线**:`harness_events.py append`;`harness_archive.py finalize`;`harness_preflight.py check`;`harness_ledger.py can-reuse`;`harness_service.py ensure/stop`(须 `--files`/`serviceStart.inputFiles`)。JSON 输出按 D13 护栏解读。
|
|
155
|
-
|
|
156
|
-
> **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
|
|
1
|
+
---
|
|
2
|
+
name: harness-review
|
|
3
|
+
description: "6维度代码审查(架构/安全/规范/兼容/测试/性能),对照.claude/rules/和测试场景表,在隔离上下文运行。使用场景:代码审查、提交前检查、合并评审"
|
|
4
|
+
argument-hint: "变更名或留空自动检测"
|
|
5
|
+
effort: high
|
|
6
|
+
allowed-tools: [Read, Write, Edit, Glob, Grep, Agent, Bash(powershell.exe:*)]
|
|
7
|
+
disallowed-tools:
|
|
8
|
+
- Bash(git *)
|
|
9
|
+
- Bash(mvn *)
|
|
10
|
+
- Bash(ls *)
|
|
11
|
+
- Bash(find *)
|
|
12
|
+
- Bash(grep *)
|
|
13
|
+
- Bash(cat *)
|
|
14
|
+
- Bash(cp *)
|
|
15
|
+
- Bash(mv *)
|
|
16
|
+
- Bash(rm *)
|
|
17
|
+
- Bash(mkdir *)
|
|
18
|
+
- Bash(touch *)
|
|
19
|
+
- Bash(sed *)
|
|
20
|
+
- Bash(awk *)
|
|
21
|
+
- Bash(curl *)
|
|
22
|
+
- Bash(codegraph *)
|
|
23
|
+
---
|
|
24
|
+
<!-- generated by harness_deploy.py; core=76dd32302df53f0b; overlay=none; do not edit -->
|
|
25
|
+
# harness-review — 代码审查
|
|
26
|
+
|
|
27
|
+
## Purpose
|
|
28
|
+
|
|
29
|
+
对 git diff 进行6维度审查,对照项目规则和测试场景表,输出分级报告。**审查结果仅供参考,默认不阻塞后续 submit/archive 流程。**
|
|
30
|
+
|
|
31
|
+
## When to Use
|
|
32
|
+
|
|
33
|
+
使用此 Skill 当:
|
|
34
|
+
- 代码变更完成后需要审查
|
|
35
|
+
- 提交前需要质量检查
|
|
36
|
+
- 合并评审时需要系统性检查
|
|
37
|
+
- 用户说"审查代码"、"review"、"检查代码质量"
|
|
38
|
+
|
|
39
|
+
## Inputs
|
|
40
|
+
|
|
41
|
+
- `$ARGUMENTS`:变更名(可选,留空时自动扫描 `.harness/changes/*/plans/` 确定)
|
|
42
|
+
- 相关文件:`.harness/changes/*/plans/*-plan.md`、`.claude/rules/`、测试场景表
|
|
43
|
+
|
|
44
|
+
## 前置条件
|
|
45
|
+
|
|
46
|
+
- `.harness/changes/<change-name>/plans/<change-name>-plan.md` 存在(任务真相源)
|
|
47
|
+
- 必须读取 `.harness/changes/<change-name>/meta/worktree.json`:`requested=true` 且 worktree 已创建 → 在 worktree 目录中执行审查;`requested=true` 但 worktree 不存在 → 停止,提示先修复 `harness-run`,不得静默回主目录
|
|
48
|
+
- **review 不阻塞后续流程**:test 报告缺失或未运行不阻止 review(review 是参考性阶段),但应在报告中标注 test 状态供参考
|
|
49
|
+
|
|
50
|
+
## 统一读取协议
|
|
51
|
+
|
|
52
|
+
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
53
|
+
2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
54
|
+
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
55
|
+
4. **spec** — 设计真相源:`spec/<change>-design.md`
|
|
56
|
+
5. **plan** — 任务真相源:`plans/<change>-plan.md`
|
|
57
|
+
6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
|
|
58
|
+
7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
|
|
59
|
+
8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
|
|
60
|
+
|
|
61
|
+
状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
|
|
62
|
+
|
|
63
|
+
## Workflow
|
|
64
|
+
|
|
65
|
+
0. **启动准备** — 确定变更名(Glob `.harness/changes/*/plans/*-plan.md`,排除 `.harness/archive/*/`,读 frontmatter 提取 change-name);**append `phase.start` 事件**(不得等审查完成才补)
|
|
66
|
+
1. **读取 worktree 状态(门禁检查)** — 读 `.harness/changes/<change-name>/meta/worktree.json`:`requested=true` 但 worktree 不存在 → 停止并提示先修复 `harness-run`,不得静默回主目录(否则 git diff 为空);`requested=true` 且 worktree 已创建 → spawned agent 用该 worktree 路径执行 `git diff`(确保审查 worktree 变更而非主目录);`requested=false` → 审查主目录变更
|
|
67
|
+
2. **委派 harness-reviewer** — 先运行 `python <skills-root>/scripts/harness_preflight.py check-agents --skills-root <skills-root> --agent harness-reviewer --json`。`usable=false` → **直接主会话审查**,记 `decision` 事件,**不委派**。`usable=true` 时用 Agent spawn `harness-reviewer`(只读, 6 维度)。返回空 / 无报告正文 → **不 retry**,降级主会话审查。
|
|
68
|
+
3. **持久化报告(强制,主会话)** — Agent 返回后主会话 Write 到 `reports/review/review-report-*.md`。未 Write → 🟡WARN,不得宣称 review 完成。
|
|
69
|
+
4. **生成修复反馈(原生协议)** — 若报告存在 RED/YELLOW 问题,执行 `protocols.md` 的 `review-fixback-protocol`,将问题转化为结构化 fixback 清单并落盘到 `.harness/changes/<change-name>/reports/review/fixback-YYYYMMDD-HHmm.md`。若无 RED/YELLOW,记录 `review-fixback-protocol: skipped(no findings)`。不调用 Superpowers `receiving-code-review`,也不记录外部 skill 降级。
|
|
70
|
+
5. **收尾** — append `phase.end` / `artifact` 事件;控制台输出摘要
|
|
71
|
+
|
|
72
|
+
## Review 定位(重要)
|
|
73
|
+
|
|
74
|
+
**harness-review 是参考性代码审查阶段,不是硬门禁。**
|
|
75
|
+
|
|
76
|
+
| 等级 | 含义 | 后续影响 |
|
|
77
|
+
|:----:|------|----------|
|
|
78
|
+
| RED | 高风险建议,强烈建议处理 | 不阻塞后续流程 |
|
|
79
|
+
| YELLOW | 中低风险建议 | 不阻塞后续流程 |
|
|
80
|
+
| OK | 无问题 | 不阻塞后续流程 |
|
|
81
|
+
|
|
82
|
+
- 审查结果默认只作为参考,不阻塞 `/harness-submit`、`/harness-archive`
|
|
83
|
+
- 除非用户显式要求"review 结果阻塞提交",否则 review 不参与硬门禁
|
|
84
|
+
- Review 报告中**禁止写**:阻塞 submit / 必须修复后才能继续
|
|
85
|
+
- Review 报告中**应写**:建议优先处理 / 建议在 submit 前人工确认 / 建议补充测试 / 仅供参考,不阻塞后续 harness 流程
|
|
86
|
+
|
|
87
|
+
### 可选 strict-review-gate 配置
|
|
88
|
+
|
|
89
|
+
如果团队希望 review 结果阻塞提交,可在 `.harness/config/harness-test-config.md` 中设置:
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
review:
|
|
93
|
+
strict-review-gate: true # 默认 false
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
当且仅当 `strict-review-gate: true` 时,review RED 才阻塞 submit。默认行为是 `strict-review-gate: false`。
|
|
97
|
+
|
|
98
|
+
## Output Format
|
|
99
|
+
|
|
100
|
+
审查报告保存到 `.harness/changes/<change-name>/reports/review/review-report-YYYYMMDD-HHmm.md`(时间戳区分多次运行),同时在控制台输出摘要。报告格式详见 `reference.md` 的「输出报告完整模板」。
|
|
101
|
+
|
|
102
|
+
## 渐进披露
|
|
103
|
+
|
|
104
|
+
- **Read `checklist.md`** 仅在执行完整6维度审查时 — 含6维度检查项详细列表 + 输出格式 + 执行日志记录模板
|
|
105
|
+
- **Read `reference.md`** 仅在需要理解审查标准或生成详细报告时 — 含"为什么需要审查"概述 + 严重级别判定标准 + 输出报告完整模板
|
|
106
|
+
- **Read `protocols.md`** 仅在 RED/YELLOW 问题需要转化为修复反馈时 — 含 `review-fixback-protocol` 的结构化 fixback 字段与落盘要求
|
|
107
|
+
|
|
108
|
+
## 原生修复反馈协议
|
|
109
|
+
|
|
110
|
+
`/harness-review` 不再运行时调用 Superpowers `receiving-code-review`。审查后的修复反馈能力内化为 `protocols.md` 的 `review-fixback-protocol`:
|
|
111
|
+
|
|
112
|
+
1. RED/YELLOW 问题转成 fixback 条目:严重级别、位置、风险、建议、验证方式、对 submit 的影响。
|
|
113
|
+
2. fixback 落盘到 `.harness/changes/<change-name>/reports/review/fixback-YYYYMMDD-HHmm.md`。
|
|
114
|
+
3. 无 RED/YELLOW 时记录跳过原因,不制造空修复任务。
|
|
115
|
+
|
|
116
|
+
## P0 执行可信度规则
|
|
117
|
+
|
|
118
|
+
- 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
|
|
119
|
+
- 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
|
|
120
|
+
- 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
|
|
121
|
+
|
|
122
|
+
## 关键规则(硬门禁速查)
|
|
123
|
+
|
|
124
|
+
> 每条规则的详细判定、检查项见 `checklist.md` 对应章节;Shell 执行安全见 `../protocols/powershell-protocol.md`,敏感信息见 `../protocols/sensitive-info-protocol.md`,证据化报告见 `../protocols/evidence-based-reporting-protocol.md`,状态目录见 `../protocols/state-layout-protocol.md`,结构化报告事件见 `../protocols/report-pipeline-protocol.md`。
|
|
125
|
+
|
|
126
|
+
### 一、只审查 git diff 变更部分
|
|
127
|
+
|
|
128
|
+
只审查本次 `git diff` 中的变更,不审查已有代码;diff 为空 → 直接返回"无变更可审查"。每个问题给出具体修复建议(文件:行号 + 建议做法)。
|
|
129
|
+
|
|
130
|
+
### 二、严重级别三态
|
|
131
|
+
|
|
132
|
+
RED=高风险建议(强烈建议处理),YELLOW=中低风险建议,OK=无问题。6维度逐文件审查(架构/安全/规范/兼容/测试/性能)—— 检查项见 `checklist.md`。判定标准见 `reference.md`「严重级别判定标准」。
|
|
133
|
+
|
|
134
|
+
### 三、review 结果仅供参考(不阻塞后续流程)
|
|
135
|
+
|
|
136
|
+
review 结果默认只作参考,不阻塞 submit/archive;报告措辞遵循 `## Review 定位(重要)` 的“禁止写/应写”清单,不得出现“阻塞 submit / 必须修复后才能继续”。
|
|
137
|
+
|
|
138
|
+
### 四、Shell 安全 / 敏感信息 / 证据化报告 / CodeGraph 探索
|
|
139
|
+
|
|
140
|
+
git diff/log 命令通过 `powershell.exe -Command "..."` 执行;review-report 中如发现明文 token/密码/密钥,必须列入 RED 问题并在报告中以 `<TOKEN_REDACTED>` 等占位符引用;RED/YELLOW/OK 结论必须基于实际 diff 内容,不得凭印象判断。代码探索必须优先使用 CodeGraph MCP 工具(`mcp__codegraph__codegraph_explore`),不允许通过普通 Bash 调 codegraph 命令(已列入 `disallowed-tools`);MCP 不可用时降级为 Grep/Glob + Read,并在执行日志记录降级原因。遵循 `../protocols/powershell-protocol.md` / `sensitive-info-protocol.md` / `evidence-based-reporting-protocol.md`。
|
|
141
|
+
|
|
142
|
+
## 交互白名单
|
|
143
|
+
|
|
144
|
+
**无** AskUserQuestion(审查全自动)。委派失败 → 主会话审查 + `decision` 事件。
|
|
145
|
+
|
|
146
|
+
## 执行日志
|
|
147
|
+
|
|
148
|
+
`events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
|
|
149
|
+
|
|
150
|
+
```powershell
|
|
151
|
+
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
> **脚本接线**:`harness_events.py append`;`harness_archive.py finalize`;`harness_preflight.py check`;`harness_ledger.py can-reuse`;`harness_service.py ensure/stop`(须 `--files`/`serviceStart.inputFiles`)。JSON 输出按 D13 护栏解读。
|
|
155
|
+
|
|
156
|
+
> **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
|
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: harness-run
|
|
3
|
-
description: "按变更簇执行 TDD 编码循环(RED→GREEN→REFACTOR→编译验证),逐变更簇实现计划中的任务。使用场景:开始编码、实现功能、写代码、TDD 编码"
|
|
4
|
-
argument-hint: "变更名 | --subagent | --inline | --fixback | 留空自动检测"
|
|
5
|
-
effort: medium
|
|
6
|
-
allowed-tools: [Read, Edit, Write, Glob, Grep, Bash(powershell.exe:*)]
|
|
7
|
-
disallowed-tools:
|
|
8
|
-
- Bash(git *)
|
|
9
|
-
- Bash(mvn *)
|
|
10
|
-
- Bash(ls *)
|
|
11
|
-
- Bash(find *)
|
|
12
|
-
- Bash(grep *)
|
|
13
|
-
- Bash(cat *)
|
|
14
|
-
- Bash(cp *)
|
|
15
|
-
- Bash(mv *)
|
|
16
|
-
- Bash(rm *)
|
|
17
|
-
- Bash(mkdir *)
|
|
18
|
-
- Bash(touch *)
|
|
19
|
-
- Bash(sed *)
|
|
20
|
-
- Bash(awk *)
|
|
21
|
-
- Bash(curl *)
|
|
22
|
-
- Bash(codegraph *)
|
|
23
|
-
---
|
|
24
|
-
<!-- generated by harness_deploy.py; core=
|
|
25
|
-
# harness-run — 需求编码
|
|
26
|
-
|
|
27
|
-
## Purpose
|
|
28
|
-
|
|
29
|
-
基于 plan + test-scenarios,按**变更簇**执行 TDD(RED→GREEN→REFACTOR→构建验证),写入 verification-ledger。负责 worktree 创建/切换(见 [[shared/worktree-gate.md|worktree-gate]])。
|
|
30
|
-
|
|
31
|
-
## When to Use
|
|
32
|
-
|
|
33
|
-
触发语:"开始编码""实现功能""写代码""TDD编码"。参数:`--subagent` 强制 Subagent-Driven;`--inline` 等同默认;`--fixback` 读最新 review fixback。**默认 Inline,不询问执行模式**。
|
|
34
|
-
|
|
35
|
-
## 前置条件
|
|
36
|
-
|
|
37
|
-
- `spec/*-design.md`、`plans/*-plan.md`(含 frontmatter)存在且已审批
|
|
38
|
-
- 读 `meta/worktree.json`:`requested=true` 时 worktree 须存在或 run 负责创建
|
|
39
|
-
|
|
40
|
-
## Worktree 门禁
|
|
41
|
-
|
|
42
|
-
读取 `meta/worktree.json`(兼容旧路径 `worktree.json`):
|
|
43
|
-
|
|
44
|
-
| 条件 | 行为 |
|
|
45
|
-
|------|------|
|
|
46
|
-
| `requested=false` | 主目录执行 |
|
|
47
|
-
| `requested=true` + path 存在 | 切换 worktree 执行 |
|
|
48
|
-
| `requested=true` + path 不存在 | **必须创建**(run)或 **停止**(test/review/submit) |
|
|
49
|
-
|
|
50
|
-
**严禁** `requested=true` 时静默回主目录。创建失败 → 停止或 AskUserQuestion 降级(须 🟡WARN + 用户确认)。
|
|
51
|
-
|
|
52
|
-
**状态与代码分离**:代码/编译/测试在 `worktreeRoot`;`stateDir`(logs/events/ledger/reports)写回 `.harness/changes/<change-name>/`。
|
|
53
|
-
|
|
54
|
-
创建命令与 JSON 模板 → 各 skill `reference.md`(plan 写决策,run 创建/更新)。
|
|
55
|
-
|
|
56
|
-
## 统一读取协议
|
|
57
|
-
|
|
58
|
-
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
59
|
-
2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
60
|
-
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
61
|
-
4. **spec** — 设计真相源:`spec/<change>-design.md`
|
|
62
|
-
5. **plan** — 任务真相源:`plans/<change>-plan.md`
|
|
63
|
-
6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
|
|
64
|
-
7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
|
|
65
|
-
8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
|
|
66
|
-
|
|
67
|
-
状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
|
|
68
|
-
|
|
69
|
-
## 执行模式
|
|
70
|
-
|
|
71
|
-
默认 **Inline Execution**;仅 `--subagent` 切换 Subagent-Driven。
|
|
72
|
-
|
|
73
|
-
## Workflow 概要
|
|
74
|
-
|
|
75
|
-
0. 加载上下文(change-name、spec/plan/detail/scenarios/ledger/run-task-status/worktree;`--fixback` 读 fixback)→ append `phase.start`
|
|
76
|
-
0.5. **测试基础设施探测**(先写 `CHECKING`,四项证据齐备后再结论)→ `reference.md` Step 0.5
|
|
77
|
-
1. **变更簇 TDD** — `protocols.md` `run-tdd-protocol`;批量 RED/GREEN;按需 `change-cluster-review-protocol`(高风险 + reviewer 预检可用)
|
|
78
|
-
2. 构建验证 + 写 ledger(diffHash 三部分合并,`reference.md` Step 2c)
|
|
79
|
-
3. **场景覆盖检查**(场景表映射,禁止用用例数冒充场景数)
|
|
80
|
-
4. **关门检查**(10 项)+ 计划状态持久化
|
|
81
|
-
|
|
82
|
-
**Fixback**:`--fixback` 或用户要求时读 `reports/review/fixback-*.md`;RED 优先;未选用则记 `fixback: advisory-not-applied`。
|
|
83
|
-
|
|
84
|
-
## P0 执行可信度规则
|
|
85
|
-
|
|
86
|
-
- 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
|
|
87
|
-
- 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
|
|
88
|
-
- 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
|
|
89
|
-
|
|
90
|
-
## 关键规则(硬门禁速查)
|
|
91
|
-
|
|
92
|
-
> 全文判定、示例、模板 → `reference.md`;ledger → `../protocols/ledger-protocol.md`
|
|
93
|
-
|
|
94
|
-
| 域 | 要点 |
|
|
95
|
-
|----|------|
|
|
96
|
-
| **文档输入** | 只读 `.harness/changes/<cn>/`;禁止 `docs/superpowers/` |
|
|
97
|
-
| **变更簇 TDD** | 一簇一次 RED/GREEN;低价值项豁免;新分支必须 RED |
|
|
98
|
-
| **RED/GREEN** | RED 须有效;静态验证 ≠ 测试通过;greenfield 大重写豁免见 reference |
|
|
99
|
-
| **Mapper/DB** | 纯 Mock 不得宣称 DB 验证通过;迁移脚本**永不自动执行** |
|
|
100
|
-
| **探测/ledger** | 基础设施先探测;每次构建/测试写 ledger;三部分 diffHash |
|
|
101
|
-
| **预存变更** | 保留 → baseline 隔离;存在则最终 ≥ 🟡WARN |
|
|
102
|
-
| **关门/状态** | 10 项关门检查;持久化 run-task-status;P0 静态-only 不得建议 submit |
|
|
103
|
-
| **Worktree** | `requested=true` 时代码只写 worktree |
|
|
104
|
-
| **PowerShell** | 所有 git/构建经 `powershell.exe -NoProfile -Command` |
|
|
105
|
-
|
|
106
|
-
## Output Format
|
|
107
|
-
|
|
108
|
-
变更文件表 + 构建/测试证据 + 场景覆盖摘要 + 最终状态(✅OK / 🟡WARN / ❌FAIL)。→ `reference.md`
|
|
109
|
-
|
|
110
|
-
## 渐进披露
|
|
111
|
-
|
|
112
|
-
- **Read `protocols.md`** — run-tdd + change-cluster-review
|
|
113
|
-
- **Read `reference.md`** — Step 0–5 细节、TDD/RED/ledger/迁移/安全矩阵
|
|
114
|
-
- **Read `checklist.md`** — 逐步勾选
|
|
115
|
-
|
|
116
|
-
## 交互白名单
|
|
117
|
-
|
|
118
|
-
1. **预存变更**:保留 / 暂存 / 终止
|
|
119
|
-
2. **数据库迁移**:展示审查清单并确认(**永不自动执行**)
|
|
120
|
-
3. **worktree 创建失败**:是否改主目录
|
|
121
|
-
|
|
122
|
-
## 执行日志
|
|
123
|
-
|
|
124
|
-
`events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
|
|
125
|
-
|
|
126
|
-
```powershell
|
|
127
|
-
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
> **脚本接线**:`harness_events.py append`;`harness_archive.py finalize`;`harness_preflight.py check`;`harness_ledger.py can-reuse`;`harness_service.py ensure/stop`(须 `--files`/`serviceStart.inputFiles`)。JSON 输出按 D13 护栏解读。
|
|
131
|
-
|
|
132
|
-
> **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
|
|
1
|
+
---
|
|
2
|
+
name: harness-run
|
|
3
|
+
description: "按变更簇执行 TDD 编码循环(RED→GREEN→REFACTOR→编译验证),逐变更簇实现计划中的任务。使用场景:开始编码、实现功能、写代码、TDD 编码"
|
|
4
|
+
argument-hint: "变更名 | --subagent | --inline | --fixback | 留空自动检测"
|
|
5
|
+
effort: medium
|
|
6
|
+
allowed-tools: [Read, Edit, Write, Glob, Grep, Bash(powershell.exe:*)]
|
|
7
|
+
disallowed-tools:
|
|
8
|
+
- Bash(git *)
|
|
9
|
+
- Bash(mvn *)
|
|
10
|
+
- Bash(ls *)
|
|
11
|
+
- Bash(find *)
|
|
12
|
+
- Bash(grep *)
|
|
13
|
+
- Bash(cat *)
|
|
14
|
+
- Bash(cp *)
|
|
15
|
+
- Bash(mv *)
|
|
16
|
+
- Bash(rm *)
|
|
17
|
+
- Bash(mkdir *)
|
|
18
|
+
- Bash(touch *)
|
|
19
|
+
- Bash(sed *)
|
|
20
|
+
- Bash(awk *)
|
|
21
|
+
- Bash(curl *)
|
|
22
|
+
- Bash(codegraph *)
|
|
23
|
+
---
|
|
24
|
+
<!-- generated by harness_deploy.py; core=76dd32302df53f0b; overlay=none; do not edit -->
|
|
25
|
+
# harness-run — 需求编码
|
|
26
|
+
|
|
27
|
+
## Purpose
|
|
28
|
+
|
|
29
|
+
基于 plan + test-scenarios,按**变更簇**执行 TDD(RED→GREEN→REFACTOR→构建验证),写入 verification-ledger。负责 worktree 创建/切换(见 [[shared/worktree-gate.md|worktree-gate]])。
|
|
30
|
+
|
|
31
|
+
## When to Use
|
|
32
|
+
|
|
33
|
+
触发语:"开始编码""实现功能""写代码""TDD编码"。参数:`--subagent` 强制 Subagent-Driven;`--inline` 等同默认;`--fixback` 读最新 review fixback。**默认 Inline,不询问执行模式**。
|
|
34
|
+
|
|
35
|
+
## 前置条件
|
|
36
|
+
|
|
37
|
+
- `spec/*-design.md`、`plans/*-plan.md`(含 frontmatter)存在且已审批
|
|
38
|
+
- 读 `meta/worktree.json`:`requested=true` 时 worktree 须存在或 run 负责创建
|
|
39
|
+
|
|
40
|
+
## Worktree 门禁
|
|
41
|
+
|
|
42
|
+
读取 `meta/worktree.json`(兼容旧路径 `worktree.json`):
|
|
43
|
+
|
|
44
|
+
| 条件 | 行为 |
|
|
45
|
+
|------|------|
|
|
46
|
+
| `requested=false` | 主目录执行 |
|
|
47
|
+
| `requested=true` + path 存在 | 切换 worktree 执行 |
|
|
48
|
+
| `requested=true` + path 不存在 | **必须创建**(run)或 **停止**(test/review/submit) |
|
|
49
|
+
|
|
50
|
+
**严禁** `requested=true` 时静默回主目录。创建失败 → 停止或 AskUserQuestion 降级(须 🟡WARN + 用户确认)。
|
|
51
|
+
|
|
52
|
+
**状态与代码分离**:代码/编译/测试在 `worktreeRoot`;`stateDir`(logs/events/ledger/reports)写回 `.harness/changes/<change-name>/`。
|
|
53
|
+
|
|
54
|
+
创建命令与 JSON 模板 → 各 skill `reference.md`(plan 写决策,run 创建/更新)。
|
|
55
|
+
|
|
56
|
+
## 统一读取协议
|
|
57
|
+
|
|
58
|
+
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
59
|
+
2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
60
|
+
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
61
|
+
4. **spec** — 设计真相源:`spec/<change>-design.md`
|
|
62
|
+
5. **plan** — 任务真相源:`plans/<change>-plan.md`
|
|
63
|
+
6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
|
|
64
|
+
7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
|
|
65
|
+
8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
|
|
66
|
+
|
|
67
|
+
状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
|
|
68
|
+
|
|
69
|
+
## 执行模式
|
|
70
|
+
|
|
71
|
+
默认 **Inline Execution**;仅 `--subagent` 切换 Subagent-Driven。
|
|
72
|
+
|
|
73
|
+
## Workflow 概要
|
|
74
|
+
|
|
75
|
+
0. 加载上下文(change-name、spec/plan/detail/scenarios/ledger/run-task-status/worktree;`--fixback` 读 fixback)→ append `phase.start`
|
|
76
|
+
0.5. **测试基础设施探测**(先写 `CHECKING`,四项证据齐备后再结论)→ `reference.md` Step 0.5
|
|
77
|
+
1. **变更簇 TDD** — `protocols.md` `run-tdd-protocol`;批量 RED/GREEN;按需 `change-cluster-review-protocol`(高风险 + reviewer 预检可用)
|
|
78
|
+
2. 构建验证 + 写 ledger(diffHash 三部分合并,`reference.md` Step 2c)
|
|
79
|
+
3. **场景覆盖检查**(场景表映射,禁止用用例数冒充场景数)
|
|
80
|
+
4. **关门检查**(10 项)+ 计划状态持久化
|
|
81
|
+
|
|
82
|
+
**Fixback**:`--fixback` 或用户要求时读 `reports/review/fixback-*.md`;RED 优先;未选用则记 `fixback: advisory-not-applied`。
|
|
83
|
+
|
|
84
|
+
## P0 执行可信度规则
|
|
85
|
+
|
|
86
|
+
- 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
|
|
87
|
+
- 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
|
|
88
|
+
- 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
|
|
89
|
+
|
|
90
|
+
## 关键规则(硬门禁速查)
|
|
91
|
+
|
|
92
|
+
> 全文判定、示例、模板 → `reference.md`;ledger → `../protocols/ledger-protocol.md`
|
|
93
|
+
|
|
94
|
+
| 域 | 要点 |
|
|
95
|
+
|----|------|
|
|
96
|
+
| **文档输入** | 只读 `.harness/changes/<cn>/`;禁止 `docs/superpowers/` |
|
|
97
|
+
| **变更簇 TDD** | 一簇一次 RED/GREEN;低价值项豁免;新分支必须 RED |
|
|
98
|
+
| **RED/GREEN** | RED 须有效;静态验证 ≠ 测试通过;greenfield 大重写豁免见 reference |
|
|
99
|
+
| **Mapper/DB** | 纯 Mock 不得宣称 DB 验证通过;迁移脚本**永不自动执行** |
|
|
100
|
+
| **探测/ledger** | 基础设施先探测;每次构建/测试写 ledger;三部分 diffHash |
|
|
101
|
+
| **预存变更** | 保留 → baseline 隔离;存在则最终 ≥ 🟡WARN |
|
|
102
|
+
| **关门/状态** | 10 项关门检查;持久化 run-task-status;P0 静态-only 不得建议 submit |
|
|
103
|
+
| **Worktree** | `requested=true` 时代码只写 worktree |
|
|
104
|
+
| **PowerShell** | 所有 git/构建经 `powershell.exe -NoProfile -Command` |
|
|
105
|
+
|
|
106
|
+
## Output Format
|
|
107
|
+
|
|
108
|
+
变更文件表 + 构建/测试证据 + 场景覆盖摘要 + 最终状态(✅OK / 🟡WARN / ❌FAIL)。→ `reference.md`
|
|
109
|
+
|
|
110
|
+
## 渐进披露
|
|
111
|
+
|
|
112
|
+
- **Read `protocols.md`** — run-tdd + change-cluster-review
|
|
113
|
+
- **Read `reference.md`** — Step 0–5 细节、TDD/RED/ledger/迁移/安全矩阵
|
|
114
|
+
- **Read `checklist.md`** — 逐步勾选
|
|
115
|
+
|
|
116
|
+
## 交互白名单
|
|
117
|
+
|
|
118
|
+
1. **预存变更**:保留 / 暂存 / 终止
|
|
119
|
+
2. **数据库迁移**:展示审查清单并确认(**永不自动执行**)
|
|
120
|
+
3. **worktree 创建失败**:是否改主目录
|
|
121
|
+
|
|
122
|
+
## 执行日志
|
|
123
|
+
|
|
124
|
+
`events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
|
|
125
|
+
|
|
126
|
+
```powershell
|
|
127
|
+
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
> **脚本接线**:`harness_events.py append`;`harness_archive.py finalize`;`harness_preflight.py check`;`harness_ledger.py can-reuse`;`harness_service.py ensure/stop`(须 `--files`/`serviceStart.inputFiles`)。JSON 输出按 D13 护栏解读。
|
|
131
|
+
|
|
132
|
+
> **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
|