hunter-harness 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/bin.js +3356 -0
- package/package.json +34 -0
- package/resources/bootstrap-ir/manifest.json +19 -0
- package/resources/bootstrap-ir/skills/harness-apidoc.yaml +24 -0
- package/resources/bootstrap-ir/skills/harness-archive.yaml +24 -0
- package/resources/bootstrap-ir/skills/harness-codebase-map.yaml +24 -0
- package/resources/bootstrap-ir/skills/harness-knowledge-ingest.yaml +24 -0
- package/resources/bootstrap-ir/skills/harness-package.yaml +24 -0
- package/resources/bootstrap-ir/skills/harness-plan.yaml +24 -0
- package/resources/bootstrap-ir/skills/harness-review.yaml +24 -0
- package/resources/bootstrap-ir/skills/harness-run.yaml +24 -0
- package/resources/bootstrap-ir/skills/harness-skill-optimizer.yaml +28 -0
- package/resources/bootstrap-ir/skills/harness-submit.yaml +24 -0
- package/resources/bootstrap-ir/skills/harness-sync.yaml +24 -0
- package/resources/bootstrap-ir/skills/harness-test.yaml +24 -0
- package/resources/bootstrap-ir/templates/claude-code-skill.md +12 -0
- package/resources/harness/general/.harness-build.json +5 -0
- package/resources/harness/general/CONTEXT.md +65 -0
- package/resources/harness/general/README.md +478 -0
- package/resources/harness/general/agents/harness-evaluator.md +96 -0
- package/resources/harness/general/agents/harness-explorer.md +72 -0
- package/resources/harness/general/agents/harness-reviewer.md +69 -0
- package/resources/harness/general/harness-archive/SKILL.md +215 -0
- package/resources/harness/general/harness-archive/checklist.md +52 -0
- package/resources/harness/general/harness-archive/reference.md +103 -0
- package/resources/harness/general/harness-archive/scripts/gen-manifest.ps1 +31 -0
- package/resources/harness/general/harness-archive/templates/render-summary.mjs +171 -0
- package/resources/harness/general/harness-archive/templates/summary-data-template.json +128 -0
- package/resources/harness/general/harness-codebase-map/SKILL.md +112 -0
- package/resources/harness/general/harness-codebase-map/checklist.md +126 -0
- package/resources/harness/general/harness-codebase-map/reference.md +364 -0
- package/resources/harness/general/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
- package/resources/harness/general/harness-codebase-map/templates/CONCERNS.md +49 -0
- package/resources/harness/general/harness-codebase-map/templates/CONVENTIONS.md +57 -0
- package/resources/harness/general/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
- package/resources/harness/general/harness-codebase-map/templates/STACK.md +55 -0
- package/resources/harness/general/harness-codebase-map/templates/STRUCTURE.md +69 -0
- package/resources/harness/general/harness-codebase-map/templates/TESTING.md +64 -0
- package/resources/harness/general/harness-codebase-map/templates/map-manifest.schema.json +73 -0
- package/resources/harness/general/harness-codebase-map/templates/map-summary.md +64 -0
- package/resources/harness/general/harness-knowledge-ingest/SKILL.md +246 -0
- package/resources/harness/general/harness-knowledge-ingest/design.md +842 -0
- package/resources/harness/general/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
- package/resources/harness/general/harness-knowledge-ingest/mcp-config.example.json +10 -0
- package/resources/harness/general/harness-knowledge-ingest/reference.md +309 -0
- package/resources/harness/general/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
- package/resources/harness/general/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +43 -0
- 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 +38 -0
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +36 -0
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +1 -0
- package/resources/harness/general/harness-knowledge-ingest/tests/test_harness_knowledge.py +1792 -0
- package/resources/harness/general/harness-knowledge-query/SKILL.md +164 -0
- package/resources/harness/general/harness-plan/SKILL.md +127 -0
- package/resources/harness/general/harness-plan/checklist.md +243 -0
- package/resources/harness/general/harness-plan/protocols.md +124 -0
- package/resources/harness/general/harness-plan/reference.md +376 -0
- package/resources/harness/general/harness-review/SKILL.md +156 -0
- package/resources/harness/general/harness-review/checklist.md +124 -0
- package/resources/harness/general/harness-review/protocols.md +68 -0
- package/resources/harness/general/harness-review/reference.md +86 -0
- package/resources/harness/general/harness-run/SKILL.md +132 -0
- package/resources/harness/general/harness-run/checklist.md +259 -0
- package/resources/harness/general/harness-run/protocols.md +78 -0
- package/resources/harness/general/harness-run/reference.md +834 -0
- package/resources/harness/general/harness-submit/SKILL.md +159 -0
- package/resources/harness/general/harness-submit/checklist.md +407 -0
- package/resources/harness/general/harness-submit/reference.md +152 -0
- package/resources/harness/general/harness-sync/SKILL.md +82 -0
- package/resources/harness/general/harness-sync/reference.md +153 -0
- package/resources/harness/general/harness-test/SKILL.md +180 -0
- package/resources/harness/general/harness-test/checklist.md +319 -0
- package/resources/harness/general/harness-test/pitfalls.md +260 -0
- package/resources/harness/general/harness-test/reference.md +791 -0
- package/resources/harness/general/protocols/archive-report-protocol.md +175 -0
- package/resources/harness/general/protocols/evidence-based-reporting-protocol.md +134 -0
- package/resources/harness/general/protocols/ledger-protocol.md +270 -0
- package/resources/harness/general/protocols/powershell-protocol.md +181 -0
- package/resources/harness/general/protocols/report-pipeline-protocol.md +150 -0
- package/resources/harness/general/protocols/sensitive-info-protocol.md +92 -0
- package/resources/harness/general/protocols/state-layout-protocol.md +131 -0
- package/resources/harness/general/protocols/submit-protocol.md +78 -0
- package/resources/harness/general/scripts/harness_archive.py +2319 -0
- package/resources/harness/general/scripts/harness_deploy.py +613 -0
- package/resources/harness/general/scripts/harness_events.py +680 -0
- package/resources/harness/general/scripts/harness_ledger.py +671 -0
- package/resources/harness/general/scripts/harness_preflight.py +780 -0
- package/resources/harness/general/scripts/harness_service.py +1331 -0
- package/resources/harness/java/.harness-build.json +5 -0
- package/resources/harness/java/CONTEXT.md +65 -0
- package/resources/harness/java/README.md +478 -0
- package/resources/harness/java/agents/harness-evaluator.md +96 -0
- package/resources/harness/java/agents/harness-explorer.md +72 -0
- package/resources/harness/java/agents/harness-reviewer.md +69 -0
- package/resources/harness/java/harness-apidoc/SKILL.md +86 -0
- package/resources/harness/java/harness-apidoc/checklist.md +142 -0
- package/resources/harness/java/harness-apidoc/reference.md +233 -0
- package/resources/harness/java/harness-archive/SKILL.md +215 -0
- package/resources/harness/java/harness-archive/checklist.md +52 -0
- package/resources/harness/java/harness-archive/reference.md +103 -0
- package/resources/harness/java/harness-archive/scripts/gen-manifest.ps1 +31 -0
- package/resources/harness/java/harness-archive/templates/render-summary.mjs +171 -0
- package/resources/harness/java/harness-archive/templates/summary-data-template.json +128 -0
- package/resources/harness/java/harness-codebase-map/SKILL.md +112 -0
- package/resources/harness/java/harness-codebase-map/checklist.md +126 -0
- package/resources/harness/java/harness-codebase-map/reference.md +364 -0
- package/resources/harness/java/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
- package/resources/harness/java/harness-codebase-map/templates/CONCERNS.md +49 -0
- package/resources/harness/java/harness-codebase-map/templates/CONVENTIONS.md +57 -0
- package/resources/harness/java/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
- package/resources/harness/java/harness-codebase-map/templates/STACK.md +55 -0
- package/resources/harness/java/harness-codebase-map/templates/STRUCTURE.md +69 -0
- package/resources/harness/java/harness-codebase-map/templates/TESTING.md +64 -0
- package/resources/harness/java/harness-codebase-map/templates/map-manifest.schema.json +73 -0
- package/resources/harness/java/harness-codebase-map/templates/map-summary.md +64 -0
- package/resources/harness/java/harness-knowledge-ingest/SKILL.md +246 -0
- package/resources/harness/java/harness-knowledge-ingest/design.md +842 -0
- package/resources/harness/java/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
- package/resources/harness/java/harness-knowledge-ingest/mcp-config.example.json +10 -0
- package/resources/harness/java/harness-knowledge-ingest/reference.md +309 -0
- package/resources/harness/java/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
- package/resources/harness/java/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +43 -0
- 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 +38 -0
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +36 -0
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +1 -0
- package/resources/harness/java/harness-knowledge-ingest/tests/test_harness_knowledge.py +1792 -0
- package/resources/harness/java/harness-knowledge-query/SKILL.md +164 -0
- package/resources/harness/java/harness-package/SKILL.md +87 -0
- package/resources/harness/java/harness-package/checklist.md +322 -0
- package/resources/harness/java/harness-package/reference.md +210 -0
- package/resources/harness/java/harness-plan/SKILL.md +127 -0
- package/resources/harness/java/harness-plan/checklist.md +243 -0
- package/resources/harness/java/harness-plan/protocols.md +124 -0
- package/resources/harness/java/harness-plan/reference.md +376 -0
- package/resources/harness/java/harness-review/SKILL.md +156 -0
- package/resources/harness/java/harness-review/checklist.md +124 -0
- package/resources/harness/java/harness-review/protocols.md +68 -0
- package/resources/harness/java/harness-review/reference.md +86 -0
- package/resources/harness/java/harness-run/SKILL.md +148 -0
- package/resources/harness/java/harness-run/checklist.md +250 -0
- package/resources/harness/java/harness-run/protocols.md +78 -0
- package/resources/harness/java/harness-run/reference.md +814 -0
- package/resources/harness/java/harness-submit/SKILL.md +166 -0
- package/resources/harness/java/harness-submit/checklist.md +407 -0
- package/resources/harness/java/harness-submit/reference.md +152 -0
- package/resources/harness/java/harness-sync/SKILL.md +82 -0
- package/resources/harness/java/harness-sync/reference.md +153 -0
- package/resources/harness/java/harness-test/SKILL.md +192 -0
- package/resources/harness/java/harness-test/checklist.md +317 -0
- package/resources/harness/java/harness-test/pitfalls-java.md +16 -0
- package/resources/harness/java/harness-test/pitfalls.md +260 -0
- package/resources/harness/java/harness-test/reference.md +788 -0
- package/resources/harness/java/protocols/archive-report-protocol.md +175 -0
- package/resources/harness/java/protocols/evidence-based-reporting-protocol.md +134 -0
- package/resources/harness/java/protocols/ledger-protocol.md +270 -0
- package/resources/harness/java/protocols/powershell-protocol.md +181 -0
- package/resources/harness/java/protocols/report-pipeline-protocol.md +150 -0
- package/resources/harness/java/protocols/sensitive-info-protocol.md +92 -0
- package/resources/harness/java/protocols/state-layout-protocol.md +131 -0
- package/resources/harness/java/protocols/submit-protocol.md +78 -0
- package/resources/harness/java/scripts/harness_archive.py +2319 -0
- package/resources/harness/java/scripts/harness_deploy.py +613 -0
- package/resources/harness/java/scripts/harness_events.py +680 -0
- package/resources/harness/java/scripts/harness_ledger.py +671 -0
- package/resources/harness/java/scripts/harness_preflight.py +780 -0
- package/resources/harness/java/scripts/harness_service.py +1331 -0
- package/resources/harness/manifests/general.json +296 -0
- package/resources/harness/manifests/java.json +324 -0
- package/resources/manifest.json +19 -0
- package/resources/skills/harness-apidoc/SKILL.md +50 -0
- package/resources/skills/harness-archive/SKILL.md +48 -0
- package/resources/skills/harness-codebase-map/SKILL.md +53 -0
- package/resources/skills/harness-knowledge-ingest/SKILL.md +48 -0
- package/resources/skills/harness-package/SKILL.md +48 -0
- package/resources/skills/harness-plan/SKILL.md +51 -0
- package/resources/skills/harness-review/SKILL.md +50 -0
- package/resources/skills/harness-run/SKILL.md +48 -0
- package/resources/skills/harness-skill-optimizer/SKILL.md +54 -0
- package/resources/skills/harness-submit/SKILL.md +47 -0
- package/resources/skills/harness-sync/SKILL.md +48 -0
- package/resources/skills/harness-test/SKILL.md +50 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: harness-review 的6维度审查检查项详细列表。仅在执行完整代码审查时读取。
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# harness-review 检查清单
|
|
6
|
+
|
|
7
|
+
## 启动准备:确定变更名
|
|
8
|
+
|
|
9
|
+
用 Glob 搜索 `.harness/changes/*/plans/*-plan.md`(**排除 `.harness/archive/*/`**),读取 frontmatter 提取 `change-name`。默认最多一个未归档变更;如有多个,优先取最近修改的,或询问用户。后续所有路径基于此变更名。
|
|
10
|
+
|
|
11
|
+
**读取 worktree 状态**:读 `.harness/changes/<change-name>/meta/worktree.json`。`requested=true` 且 worktree 已创建 → 后续 `git diff` 的 `<项目路径>` 用 worktree 路径(`.claude/worktrees/<change-name>`);`requested=true` 但 worktree 不存在 → 停止,提示先修复 `harness-run`,不得静默回主目录。
|
|
12
|
+
|
|
13
|
+
## 审查流程
|
|
14
|
+
|
|
15
|
+
### 1. 获取变更范围
|
|
16
|
+
|
|
17
|
+
```powershell
|
|
18
|
+
powershell.exe -Command "git -C '<项目路径>' diff --stat"
|
|
19
|
+
powershell.exe -Command "git -C '<项目路径>' diff"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 2. 六维度逐文件审查
|
|
23
|
+
|
|
24
|
+
#### 维度 1:架构
|
|
25
|
+
|
|
26
|
+
| 检查项 | 为什么重要 |
|
|
27
|
+
|--------|------------|
|
|
28
|
+
| 接口层中有业务逻辑 | 破坏分层,后续修改影响面不可控 |
|
|
29
|
+
| 业务层间循环依赖 | 启动失败或运行时 StackOverflow |
|
|
30
|
+
| 接口层跨模块调用业务层 | 破坏模块边界,耦合扩散 |
|
|
31
|
+
| 业务层抛异常、接口层 try-catch | 异常处理应在全局异常处理器统一 |
|
|
32
|
+
| 写操作无事务边界 | 数据不一致(部分写入成功、部分失败) |
|
|
33
|
+
|
|
34
|
+
#### 维度 2:安全
|
|
35
|
+
|
|
36
|
+
| 检查项 | 为什么重要 |
|
|
37
|
+
|--------|------------|
|
|
38
|
+
| 硬编码密码/Token/密钥 | 代码泄露 = 凭据泄露 |
|
|
39
|
+
| 字符串拼接 SQL | SQL 注入风险 |
|
|
40
|
+
| 用户输入直接返回前端 | XSS 风险 |
|
|
41
|
+
| 对生产库执行写操作 | 数据丢失/破坏 |
|
|
42
|
+
| 日志打印敏感信息 | 日志泄露 Token/身份证号 |
|
|
43
|
+
| 新增接口无权限校验 | 未授权访问 |
|
|
44
|
+
|
|
45
|
+
#### 维度 3:编码规范
|
|
46
|
+
|
|
47
|
+
| 检查项 | 严重度 |
|
|
48
|
+
|--------|:------:|
|
|
49
|
+
| 数据类暴露不必要可变 setter(应改只读访问器) | YELLOW |
|
|
50
|
+
| 控制台输出替代日志框架 | YELLOW |
|
|
51
|
+
| 集合方法返回 null 而非空集合 | YELLOW |
|
|
52
|
+
| 魔法值未定义常量 | YELLOW |
|
|
53
|
+
| 公共 API 无文档注释 | YELLOW |
|
|
54
|
+
|
|
55
|
+
#### 维度 4:兼容性
|
|
56
|
+
|
|
57
|
+
| 检查项 | 为什么重要 |
|
|
58
|
+
|--------|------------|
|
|
59
|
+
| 删除/修改已发布接口的字段 | 旧前端/调用方立即报错 |
|
|
60
|
+
| 删除/重命名数据库已有字段 | 数据丢失 |
|
|
61
|
+
| 删除/修改已有枚举值 | 存量数据无法解析 |
|
|
62
|
+
| 新增字段不为 nullable | 旧数据无法查询/写入 |
|
|
63
|
+
|
|
64
|
+
#### 维度 5:测试
|
|
65
|
+
|
|
66
|
+
对照场景表检查覆盖。重点看新增业务方法是否有对应单元测试,异常场景是否有覆盖。
|
|
67
|
+
|
|
68
|
+
#### 维度 6:性能
|
|
69
|
+
|
|
70
|
+
| 检查项 | 信号 |
|
|
71
|
+
|--------|------|
|
|
72
|
+
| N+1 查询 | 循环体内调用数据访问层查询 |
|
|
73
|
+
| 缺少索引 | 新增 WHERE 条件无对应索引 |
|
|
74
|
+
| 大事务 | 事务内含远程调用或文件 IO |
|
|
75
|
+
| 逐条 insert | 循环内单条 insert 而非批量 |
|
|
76
|
+
|
|
77
|
+
### 3. 对照 .claude/rules/ 检查
|
|
78
|
+
|
|
79
|
+
逐个规则文件检查变更是否违规。违规项标注对应规则文件名和行号。
|
|
80
|
+
|
|
81
|
+
### 4. 对照场景表检查
|
|
82
|
+
|
|
83
|
+
如果场景表存在,逐条确认代码是否覆盖。未覆盖的标记为「测试缺口」。
|
|
84
|
+
|
|
85
|
+
## 输出格式
|
|
86
|
+
|
|
87
|
+
审查报告保存到 `.harness/changes/<change-name>/reports/review/review-report-YYYYMMDD-HHmm.md`(时间戳格式:日期+时分),同时在控制台输出摘要。完整报告模板见 `reference.md`「输出报告完整模板」,本文不再重复。
|
|
88
|
+
|
|
89
|
+
## 原生修复反馈检查
|
|
90
|
+
|
|
91
|
+
### fixback 生成确认(按需)
|
|
92
|
+
|
|
93
|
+
如果用户需要修复任务清单,确认以下事项:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
□ 已读取 harness-review/protocols.md
|
|
97
|
+
□ 已执行 review-fixback-protocol(不调用外部 receiving-code-review)
|
|
98
|
+
□ RED/YELLOW 问题已转化为结构化修复任务清单
|
|
99
|
+
□ 修复任务清单含严重级别、位置、风险、修复建议、验证方式、submit 影响
|
|
100
|
+
□ fixback 已落盘到 .harness/changes/<change-name>/reports/review/fixback-YYYYMMDD-HHmm.md
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
> 如果没有 RED/YELLOW 问题,记录 `review-fixback-protocol: skipped(no findings)`,不要生成空 fixback。`harness-review` 不检查 Superpowers 是否安装,也不记录外部 skill 降级。
|
|
104
|
+
|
|
105
|
+
### 代码探索效率检查
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
□ 审查代码时优先使用 codegraph_explore(一次获取多个符号源码)
|
|
109
|
+
□ 未逐个 Read 文件(违反 .claude/rules/codegraph.md 规则)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 关键原则
|
|
113
|
+
|
|
114
|
+
- 只审查 `git diff` 中的变更部分,不审查已有代码
|
|
115
|
+
- 对照 `.claude/rules/` 是审查的基准线
|
|
116
|
+
- 区分严重级别:RED=高风险建议(强烈建议处理),YELLOW=中低风险建议
|
|
117
|
+
- 每个问题给出具体修复建议(文件:行号 + 建议做法)
|
|
118
|
+
- 如果 diff 为空,直接返回"无变更可审查"
|
|
119
|
+
- **review 结果仅供参考,不阻塞后续 submit/archive**
|
|
120
|
+
|
|
121
|
+
## 事件记录
|
|
122
|
+
|
|
123
|
+
- [ ] append `phase.start` 事件(步骤 0 启动准备之前;`note` 含触发指令)
|
|
124
|
+
- [ ] append `phase.end` 事件(`note` 含耗时、结果、落盘 path、RED/YELLOW 统计摘要)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: harness-review 的原生修复反馈协议。内化 receiving-code-review 能力,但不运行时依赖外部 skill。
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# harness-review 原生修复反馈协议
|
|
6
|
+
|
|
7
|
+
本文件定义 `/harness-review` 的 `review-fixback-protocol`。它把 RED/YELLOW 审查建议转成结构化修复反馈,不调用 Superpowers `receiving-code-review`。
|
|
8
|
+
|
|
9
|
+
## review-fixback-protocol
|
|
10
|
+
|
|
11
|
+
用于 review 报告生成之后。目标是让 RED/YELLOW 问题可以被后续 run 或人工修复直接消费,同时保持 harness-review 的 advisory 定位。
|
|
12
|
+
|
|
13
|
+
### 输入
|
|
14
|
+
|
|
15
|
+
- `reports/review/review-report-YYYYMMDD-HHmm.md`
|
|
16
|
+
- 当前 diff 的 RED/YELLOW 问题清单
|
|
17
|
+
- `plans/<change-name>-test-scenarios.md`
|
|
18
|
+
- `evidence/verification-ledger.json` 与 `evidence/run-task-status.md`(如存在)
|
|
19
|
+
|
|
20
|
+
### 输出规则
|
|
21
|
+
|
|
22
|
+
如果存在 RED/YELLOW 问题,必须单独生成结构化 fixback 并写入:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
.harness/changes/<change-name>/reports/review/fixback-YYYYMMDD-HHmm.md
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
每条 fixback 必须包含:
|
|
29
|
+
|
|
30
|
+
| 字段 | 要求 |
|
|
31
|
+
|------|------|
|
|
32
|
+
| 等级 | RED / YELLOW |
|
|
33
|
+
| 影响位置 | 文件路径 + 行号或最小可定位区域 |
|
|
34
|
+
| 风险说明 | 说明为什么值得处理 |
|
|
35
|
+
| 推荐修复 | 可执行的修复方向,不写空泛建议 |
|
|
36
|
+
| 验证方式 | 构建、测试、场景编号或人工确认方式 |
|
|
37
|
+
| submit 影响 | 默认 advisory;仅 strict-review-gate=true 时标记阻塞 |
|
|
38
|
+
|
|
39
|
+
如果没有 RED/YELLOW,必须明确写:
|
|
40
|
+
|
|
41
|
+
```markdown
|
|
42
|
+
无需 fixback:本次 review 未发现 RED/YELLOW 问题。
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 定位边界
|
|
46
|
+
|
|
47
|
+
- harness-review 默认仅供参考,不阻塞 submit/archive。
|
|
48
|
+
- `review-fixback-protocol` 只生成修复反馈,不自动修改代码。
|
|
49
|
+
- 不得把 YELLOW 写成必须阻塞 submit。
|
|
50
|
+
- 只有配置 `strict-review-gate: true` 时,RED 才可标记为阻塞 submit。
|
|
51
|
+
|
|
52
|
+
### 模板
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
# Review Fixback — <change-name>
|
|
56
|
+
|
|
57
|
+
## 摘要
|
|
58
|
+
|
|
59
|
+
- RED: N
|
|
60
|
+
- YELLOW: M
|
|
61
|
+
- strict-review-gate: true/false
|
|
62
|
+
|
|
63
|
+
## 修复反馈
|
|
64
|
+
|
|
65
|
+
| # | 等级 | 影响位置 | 风险说明 | 推荐修复 | 验证方式 | submit 影响 |
|
|
66
|
+
|:--:|:----:|----------|----------|----------|----------|-------------|
|
|
67
|
+
| 1 | RED | `path/to/file:123` | ... | ... | `test-scenarios.md` API-001 + 构建命令 | advisory / blocking |
|
|
68
|
+
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: harness-review 的审查标准说明和输出报告完整模板。仅在需要理解审查标准或生成详细报告时读取。
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# harness-review 参考 — 审查标准
|
|
6
|
+
|
|
7
|
+
## 为什么需要审查
|
|
8
|
+
|
|
9
|
+
即使有 TDD 和场景覆盖,仍然可能遗漏一些只在"阅读代码"时才能发现的问题:
|
|
10
|
+
- 违反架构约束(TDD 关注行为,不关注结构)
|
|
11
|
+
- 安全漏洞(测试通常不会故意测试安全攻击)
|
|
12
|
+
- 编码规范偏离(IDE 自动格式化可能产生不一致的风格)
|
|
13
|
+
- 性能隐患(N+1 查询在单元测试中不起眼,但在生产环境是灾难)
|
|
14
|
+
|
|
15
|
+
> 维度检查项的详细列表和重要性说明见 `checklist.md`,本文件保留"为什么需要审查"概述、严重级别判定标准和输出报告模板。
|
|
16
|
+
|
|
17
|
+
## 严重级别判定标准
|
|
18
|
+
|
|
19
|
+
RED/YELLOW/OK 三态的判定原则——结论必须基于实际 diff 内容,不得凭印象;每条建议给出文件:行号 + 修复做法。
|
|
20
|
+
|
|
21
|
+
| 级别 | 判定原则 | 典型场景 |
|
|
22
|
+
|:----:|------|------|
|
|
23
|
+
| RED | 高风险,强烈建议处理——生产环境会直接造成损失或数据破坏 | 硬编码密码/Token/密钥;SQL 字符串拼接(注入);新增接口无权限校验;删除/修改已发布接口字段或数据库字段;写操作无事务边界;业务层间循环依赖;接口层跨模块调用;对生产库执行写操作 |
|
|
24
|
+
| YELLOW | 中低风险,建议处理——影响可维护性或存在隐患,但不会立即造成损失 | 数据类暴露不必要可变 setter(应改只读访问器);控制台输出替代日志框架;集合返回 null 而非空集合;魔法值未定义常量;公共 API 无文档注释;N+1 查询;缺少索引;大事务;逐条 insert;新增非空字段;新增业务方法无对应单元测试 |
|
|
25
|
+
| OK | 该维度在本次 diff 中无问题 | —— |
|
|
26
|
+
|
|
27
|
+
**判定要点**:
|
|
28
|
+
- 敏感信息(明文 token/密码/密钥)一律 RED,并在报告中以 `<TOKEN_REDACTED>` 等占位符引用
|
|
29
|
+
- 占位符与脱敏做法遵循 `../protocols/sensitive-info-protocol.md`;结论须基于实际 diff 证据,见 `../protocols/evidence-based-reporting-protocol.md`
|
|
30
|
+
- 安全维度的问题默认 RED(除非确属误报)
|
|
31
|
+
- 兼容性维度:删除/修改已发布契约为 RED,新增字段提醒为 YELLOW
|
|
32
|
+
- 测试维度:核心业务方法无任何测试覆盖为 YELLOW(建议补充),不判 RED(review 不阻塞)
|
|
33
|
+
- 当界限模糊时,倾向 YELLOW 并在建议中说明判断依据,让用户决定
|
|
34
|
+
|
|
35
|
+
## 输出报告完整模板
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
## 代码审查报告 — <功能名>
|
|
39
|
+
|
|
40
|
+
### 变更摘要
|
|
41
|
+
- 变更文件: N 个 | +xxx / -xxx
|
|
42
|
+
|
|
43
|
+
### 审查结果
|
|
44
|
+
|
|
45
|
+
| 维度 | RED 高风险 | YELLOW 中低风险 | OK 通过 |
|
|
46
|
+
|------|:------:|:------:|:------:|
|
|
47
|
+
| 架构 | 0 | 1 | 4 |
|
|
48
|
+
| 安全 | 0 | 0 | 5 |
|
|
49
|
+
| 编码规范 | 0 | 2 | 4 |
|
|
50
|
+
| 兼容性 | 0 | 0 | 4 |
|
|
51
|
+
| 测试 | 0 | 1 | 3 |
|
|
52
|
+
| 性能 | 0 | 0 | 3 |
|
|
53
|
+
|
|
54
|
+
### RED 高风险建议(强烈建议处理)
|
|
55
|
+
| # | 文件:行 | 维度 | 问题 | 建议 | 参考优先级 |
|
|
56
|
+
|:--:|---------|------|------|------|:--------:|
|
|
57
|
+
| (列出所有高风险问题) |
|
|
58
|
+
|
|
59
|
+
### YELLOW 中低风险建议(建议处理)
|
|
60
|
+
| # | 文件:行 | 维度 | 问题 | 建议 | 参考优先级 |
|
|
61
|
+
|:--:|---------|------|------|------|:--------:|
|
|
62
|
+
| 1 | xxx:396 | 架构 | ... | ... | 建议优先处理 |
|
|
63
|
+
| 2 | xxx:25 | 规范 | 数据类暴露可变 setter | 改为只读访问器 | 建议在 submit 前人工确认 |
|
|
64
|
+
|
|
65
|
+
### 规则对照
|
|
66
|
+
| 规则文件 | 结果 |
|
|
67
|
+
|----------|:----:|
|
|
68
|
+
| architecture.md | OK / FAIL |
|
|
69
|
+
| 项目编码规范(按技术栈,示例:Java 项目的 `java-coding-standards.md`,前端项目按项目实际规则文件) | OK / FAIL |
|
|
70
|
+
| 项目框架规范(按技术栈,示例:Java 项目的 `spring-boot-patterns.md`,其他技术栈按项目实际) | OK / FAIL |
|
|
71
|
+
| testing-conventions.md | OK / FAIL |
|
|
72
|
+
| database-safety.md | OK / FAIL |
|
|
73
|
+
|
|
74
|
+
### 总结
|
|
75
|
+
RED 高风险建议: N | YELLOW 中低风险建议: M | 仅供参考,不阻塞后续 harness 流程
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Fixback 输出关系
|
|
79
|
+
|
|
80
|
+
当审查报告包含 RED 或 YELLOW 问题时,执行 `protocols.md` 的 `review-fixback-protocol`,另行生成:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
.harness/changes/<change-name>/reports/review/fixback-YYYYMMDD-HHmm.md
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
fixback 是给后续修复循环使用的结构化清单,不替代 review-report;无 RED/YELLOW 时记录跳过原因,不生成空文件。
|
|
@@ -0,0 +1,148 @@
|
|
|
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=8917528f7dfdc5ca; overlay=java; 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
|
+
### Java 构建验证(Maven)
|
|
85
|
+
|
|
86
|
+
- 所有 `mvn`/`git` 经 `powershell.exe -NoProfile -Command`;命令读 `.harness/config/build-profile.json` 的 `buildCommands`(**禁止 hardcode 模块名/端口**)
|
|
87
|
+
- 增量编译:`buildCommands.compile`(典型 `mvn compile -pl <module> -o -q`)
|
|
88
|
+
- 变更簇 TDD:多测试类合并一次 `mvn test -pl <module> -Dtest=A,B,C -o`;每簇最多一次 RED + 一次 GREEN Maven
|
|
89
|
+
- **轻量 run**:默认只 compile;全量 `mvn test` 仅当改了 mapper/sql/权限/controller/公共模块或用户要求 full-run-validation
|
|
90
|
+
- **install -am**:仅 worktree 首建或上游模块文件变化时(见 ledger-protocol);非每次 run 强制
|
|
91
|
+
- worktree 中确认 `.mvn/maven.config` 等构建配置存在;缺失时从主目录复制
|
|
92
|
+
## P0 执行可信度规则
|
|
93
|
+
|
|
94
|
+
- 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
|
|
95
|
+
- 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
|
|
96
|
+
- 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
|
|
97
|
+
|
|
98
|
+
## 关键规则(硬门禁速查)
|
|
99
|
+
|
|
100
|
+
> 全文判定、示例、模板 → `reference.md`;ledger → `../protocols/ledger-protocol.md`
|
|
101
|
+
|
|
102
|
+
| 域 | 要点 |
|
|
103
|
+
|----|------|
|
|
104
|
+
| **文档输入** | 只读 `.harness/changes/<cn>/`;禁止 `docs/superpowers/` |
|
|
105
|
+
| **变更簇 TDD** | 一簇一次 RED/GREEN;低价值项豁免;新分支必须 RED |
|
|
106
|
+
| **RED/GREEN** | RED 须有效;静态验证 ≠ 测试通过;greenfield 大重写豁免见 reference |
|
|
107
|
+
| **Mapper/DB** | 纯 Mock 不得宣称 DB 验证通过;迁移脚本**永不自动执行** |
|
|
108
|
+
| **探测/ledger** | 基础设施先探测;每次构建/测试写 ledger;三部分 diffHash |
|
|
109
|
+
| **预存变更** | 保留 → baseline 隔离;存在则最终 ≥ 🟡WARN |
|
|
110
|
+
| **关门/状态** | 10 项关门检查;持久化 run-task-status;P0 静态-only 不得建议 submit |
|
|
111
|
+
| **Worktree** | `requested=true` 时代码只写 worktree |
|
|
112
|
+
| **PowerShell** | 所有 git/构建经 `powershell.exe -NoProfile -Command` |
|
|
113
|
+
|
|
114
|
+
### Java TDD / 数据访问补充
|
|
115
|
+
|
|
116
|
+
| 项 | 规则 |
|
|
117
|
+
|----|------|
|
|
118
|
+
| **低价值豁免** | ErrorCode 常量、VO/DTO 字段、注释、import 清理、格式化、SQL 脚本、配置模板、文档 — 不单独建测试类;禁止为单个错误码单独跑 Maven |
|
|
119
|
+
| **Mapper / LambdaQueryWrapper / SQL** | 纯 Mock 返回值**不得**宣称 DB 验证通过 → 🟡 静态验证,交 harness-test 真实 DB |
|
|
120
|
+
| **行为性新分支** | 正则/条件/分支逻辑变更新增分支须 RED→GREEN;不属于低价值豁免 |
|
|
121
|
+
| **ledger** | compile 必写;执行了 test 写 unitTest,否则 `NOT_RUN_BY_RUN`;diffHash 三部分合并(见 reference) |
|
|
122
|
+
## Output Format
|
|
123
|
+
|
|
124
|
+
变更文件表 + 构建/测试证据 + 场景覆盖摘要 + 最终状态(✅OK / 🟡WARN / ❌FAIL)。→ `reference.md`
|
|
125
|
+
|
|
126
|
+
## 渐进披露
|
|
127
|
+
|
|
128
|
+
- **Read `protocols.md`** — run-tdd + change-cluster-review
|
|
129
|
+
- **Read `reference.md`** — Step 0–5 细节、TDD/RED/ledger/迁移/安全矩阵
|
|
130
|
+
- **Read `checklist.md`** — 逐步勾选
|
|
131
|
+
|
|
132
|
+
## 交互白名单
|
|
133
|
+
|
|
134
|
+
1. **预存变更**:保留 / 暂存 / 终止
|
|
135
|
+
2. **数据库迁移**:展示审查清单并确认(**永不自动执行**)
|
|
136
|
+
3. **worktree 创建失败**:是否改主目录
|
|
137
|
+
|
|
138
|
+
## 执行日志
|
|
139
|
+
|
|
140
|
+
`events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
|
|
141
|
+
|
|
142
|
+
```powershell
|
|
143
|
+
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
> **脚本接线**:`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 护栏解读。
|
|
147
|
+
|
|
148
|
+
> **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 边界保持最新。
|