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.
Files changed (184) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/dist/bin.js +3356 -0
  4. package/package.json +34 -0
  5. package/resources/bootstrap-ir/manifest.json +19 -0
  6. package/resources/bootstrap-ir/skills/harness-apidoc.yaml +24 -0
  7. package/resources/bootstrap-ir/skills/harness-archive.yaml +24 -0
  8. package/resources/bootstrap-ir/skills/harness-codebase-map.yaml +24 -0
  9. package/resources/bootstrap-ir/skills/harness-knowledge-ingest.yaml +24 -0
  10. package/resources/bootstrap-ir/skills/harness-package.yaml +24 -0
  11. package/resources/bootstrap-ir/skills/harness-plan.yaml +24 -0
  12. package/resources/bootstrap-ir/skills/harness-review.yaml +24 -0
  13. package/resources/bootstrap-ir/skills/harness-run.yaml +24 -0
  14. package/resources/bootstrap-ir/skills/harness-skill-optimizer.yaml +28 -0
  15. package/resources/bootstrap-ir/skills/harness-submit.yaml +24 -0
  16. package/resources/bootstrap-ir/skills/harness-sync.yaml +24 -0
  17. package/resources/bootstrap-ir/skills/harness-test.yaml +24 -0
  18. package/resources/bootstrap-ir/templates/claude-code-skill.md +12 -0
  19. package/resources/harness/general/.harness-build.json +5 -0
  20. package/resources/harness/general/CONTEXT.md +65 -0
  21. package/resources/harness/general/README.md +478 -0
  22. package/resources/harness/general/agents/harness-evaluator.md +96 -0
  23. package/resources/harness/general/agents/harness-explorer.md +72 -0
  24. package/resources/harness/general/agents/harness-reviewer.md +69 -0
  25. package/resources/harness/general/harness-archive/SKILL.md +215 -0
  26. package/resources/harness/general/harness-archive/checklist.md +52 -0
  27. package/resources/harness/general/harness-archive/reference.md +103 -0
  28. package/resources/harness/general/harness-archive/scripts/gen-manifest.ps1 +31 -0
  29. package/resources/harness/general/harness-archive/templates/render-summary.mjs +171 -0
  30. package/resources/harness/general/harness-archive/templates/summary-data-template.json +128 -0
  31. package/resources/harness/general/harness-codebase-map/SKILL.md +112 -0
  32. package/resources/harness/general/harness-codebase-map/checklist.md +126 -0
  33. package/resources/harness/general/harness-codebase-map/reference.md +364 -0
  34. package/resources/harness/general/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  35. package/resources/harness/general/harness-codebase-map/templates/CONCERNS.md +49 -0
  36. package/resources/harness/general/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  37. package/resources/harness/general/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  38. package/resources/harness/general/harness-codebase-map/templates/STACK.md +55 -0
  39. package/resources/harness/general/harness-codebase-map/templates/STRUCTURE.md +69 -0
  40. package/resources/harness/general/harness-codebase-map/templates/TESTING.md +64 -0
  41. package/resources/harness/general/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  42. package/resources/harness/general/harness-codebase-map/templates/map-summary.md +64 -0
  43. package/resources/harness/general/harness-knowledge-ingest/SKILL.md +246 -0
  44. package/resources/harness/general/harness-knowledge-ingest/design.md +842 -0
  45. package/resources/harness/general/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
  46. package/resources/harness/general/harness-knowledge-ingest/mcp-config.example.json +10 -0
  47. package/resources/harness/general/harness-knowledge-ingest/reference.md +309 -0
  48. package/resources/harness/general/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
  49. package/resources/harness/general/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
  50. 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
  51. 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
  52. 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
  53. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +1 -0
  54. package/resources/harness/general/harness-knowledge-ingest/tests/test_harness_knowledge.py +1792 -0
  55. package/resources/harness/general/harness-knowledge-query/SKILL.md +164 -0
  56. package/resources/harness/general/harness-plan/SKILL.md +127 -0
  57. package/resources/harness/general/harness-plan/checklist.md +243 -0
  58. package/resources/harness/general/harness-plan/protocols.md +124 -0
  59. package/resources/harness/general/harness-plan/reference.md +376 -0
  60. package/resources/harness/general/harness-review/SKILL.md +156 -0
  61. package/resources/harness/general/harness-review/checklist.md +124 -0
  62. package/resources/harness/general/harness-review/protocols.md +68 -0
  63. package/resources/harness/general/harness-review/reference.md +86 -0
  64. package/resources/harness/general/harness-run/SKILL.md +132 -0
  65. package/resources/harness/general/harness-run/checklist.md +259 -0
  66. package/resources/harness/general/harness-run/protocols.md +78 -0
  67. package/resources/harness/general/harness-run/reference.md +834 -0
  68. package/resources/harness/general/harness-submit/SKILL.md +159 -0
  69. package/resources/harness/general/harness-submit/checklist.md +407 -0
  70. package/resources/harness/general/harness-submit/reference.md +152 -0
  71. package/resources/harness/general/harness-sync/SKILL.md +82 -0
  72. package/resources/harness/general/harness-sync/reference.md +153 -0
  73. package/resources/harness/general/harness-test/SKILL.md +180 -0
  74. package/resources/harness/general/harness-test/checklist.md +319 -0
  75. package/resources/harness/general/harness-test/pitfalls.md +260 -0
  76. package/resources/harness/general/harness-test/reference.md +791 -0
  77. package/resources/harness/general/protocols/archive-report-protocol.md +175 -0
  78. package/resources/harness/general/protocols/evidence-based-reporting-protocol.md +134 -0
  79. package/resources/harness/general/protocols/ledger-protocol.md +270 -0
  80. package/resources/harness/general/protocols/powershell-protocol.md +181 -0
  81. package/resources/harness/general/protocols/report-pipeline-protocol.md +150 -0
  82. package/resources/harness/general/protocols/sensitive-info-protocol.md +92 -0
  83. package/resources/harness/general/protocols/state-layout-protocol.md +131 -0
  84. package/resources/harness/general/protocols/submit-protocol.md +78 -0
  85. package/resources/harness/general/scripts/harness_archive.py +2319 -0
  86. package/resources/harness/general/scripts/harness_deploy.py +613 -0
  87. package/resources/harness/general/scripts/harness_events.py +680 -0
  88. package/resources/harness/general/scripts/harness_ledger.py +671 -0
  89. package/resources/harness/general/scripts/harness_preflight.py +780 -0
  90. package/resources/harness/general/scripts/harness_service.py +1331 -0
  91. package/resources/harness/java/.harness-build.json +5 -0
  92. package/resources/harness/java/CONTEXT.md +65 -0
  93. package/resources/harness/java/README.md +478 -0
  94. package/resources/harness/java/agents/harness-evaluator.md +96 -0
  95. package/resources/harness/java/agents/harness-explorer.md +72 -0
  96. package/resources/harness/java/agents/harness-reviewer.md +69 -0
  97. package/resources/harness/java/harness-apidoc/SKILL.md +86 -0
  98. package/resources/harness/java/harness-apidoc/checklist.md +142 -0
  99. package/resources/harness/java/harness-apidoc/reference.md +233 -0
  100. package/resources/harness/java/harness-archive/SKILL.md +215 -0
  101. package/resources/harness/java/harness-archive/checklist.md +52 -0
  102. package/resources/harness/java/harness-archive/reference.md +103 -0
  103. package/resources/harness/java/harness-archive/scripts/gen-manifest.ps1 +31 -0
  104. package/resources/harness/java/harness-archive/templates/render-summary.mjs +171 -0
  105. package/resources/harness/java/harness-archive/templates/summary-data-template.json +128 -0
  106. package/resources/harness/java/harness-codebase-map/SKILL.md +112 -0
  107. package/resources/harness/java/harness-codebase-map/checklist.md +126 -0
  108. package/resources/harness/java/harness-codebase-map/reference.md +364 -0
  109. package/resources/harness/java/harness-codebase-map/templates/ARCHITECTURE.md +57 -0
  110. package/resources/harness/java/harness-codebase-map/templates/CONCERNS.md +49 -0
  111. package/resources/harness/java/harness-codebase-map/templates/CONVENTIONS.md +57 -0
  112. package/resources/harness/java/harness-codebase-map/templates/INTEGRATIONS.md +52 -0
  113. package/resources/harness/java/harness-codebase-map/templates/STACK.md +55 -0
  114. package/resources/harness/java/harness-codebase-map/templates/STRUCTURE.md +69 -0
  115. package/resources/harness/java/harness-codebase-map/templates/TESTING.md +64 -0
  116. package/resources/harness/java/harness-codebase-map/templates/map-manifest.schema.json +73 -0
  117. package/resources/harness/java/harness-codebase-map/templates/map-summary.md +64 -0
  118. package/resources/harness/java/harness-knowledge-ingest/SKILL.md +246 -0
  119. package/resources/harness/java/harness-knowledge-ingest/design.md +842 -0
  120. package/resources/harness/java/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +42 -0
  121. package/resources/harness/java/harness-knowledge-ingest/mcp-config.example.json +10 -0
  122. package/resources/harness/java/harness-knowledge-ingest/reference.md +309 -0
  123. package/resources/harness/java/harness-knowledge-ingest/scripts/harness_knowledge.py +4082 -0
  124. package/resources/harness/java/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +273 -0
  125. 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
  126. 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
  127. 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
  128. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +1 -0
  129. package/resources/harness/java/harness-knowledge-ingest/tests/test_harness_knowledge.py +1792 -0
  130. package/resources/harness/java/harness-knowledge-query/SKILL.md +164 -0
  131. package/resources/harness/java/harness-package/SKILL.md +87 -0
  132. package/resources/harness/java/harness-package/checklist.md +322 -0
  133. package/resources/harness/java/harness-package/reference.md +210 -0
  134. package/resources/harness/java/harness-plan/SKILL.md +127 -0
  135. package/resources/harness/java/harness-plan/checklist.md +243 -0
  136. package/resources/harness/java/harness-plan/protocols.md +124 -0
  137. package/resources/harness/java/harness-plan/reference.md +376 -0
  138. package/resources/harness/java/harness-review/SKILL.md +156 -0
  139. package/resources/harness/java/harness-review/checklist.md +124 -0
  140. package/resources/harness/java/harness-review/protocols.md +68 -0
  141. package/resources/harness/java/harness-review/reference.md +86 -0
  142. package/resources/harness/java/harness-run/SKILL.md +148 -0
  143. package/resources/harness/java/harness-run/checklist.md +250 -0
  144. package/resources/harness/java/harness-run/protocols.md +78 -0
  145. package/resources/harness/java/harness-run/reference.md +814 -0
  146. package/resources/harness/java/harness-submit/SKILL.md +166 -0
  147. package/resources/harness/java/harness-submit/checklist.md +407 -0
  148. package/resources/harness/java/harness-submit/reference.md +152 -0
  149. package/resources/harness/java/harness-sync/SKILL.md +82 -0
  150. package/resources/harness/java/harness-sync/reference.md +153 -0
  151. package/resources/harness/java/harness-test/SKILL.md +192 -0
  152. package/resources/harness/java/harness-test/checklist.md +317 -0
  153. package/resources/harness/java/harness-test/pitfalls-java.md +16 -0
  154. package/resources/harness/java/harness-test/pitfalls.md +260 -0
  155. package/resources/harness/java/harness-test/reference.md +788 -0
  156. package/resources/harness/java/protocols/archive-report-protocol.md +175 -0
  157. package/resources/harness/java/protocols/evidence-based-reporting-protocol.md +134 -0
  158. package/resources/harness/java/protocols/ledger-protocol.md +270 -0
  159. package/resources/harness/java/protocols/powershell-protocol.md +181 -0
  160. package/resources/harness/java/protocols/report-pipeline-protocol.md +150 -0
  161. package/resources/harness/java/protocols/sensitive-info-protocol.md +92 -0
  162. package/resources/harness/java/protocols/state-layout-protocol.md +131 -0
  163. package/resources/harness/java/protocols/submit-protocol.md +78 -0
  164. package/resources/harness/java/scripts/harness_archive.py +2319 -0
  165. package/resources/harness/java/scripts/harness_deploy.py +613 -0
  166. package/resources/harness/java/scripts/harness_events.py +680 -0
  167. package/resources/harness/java/scripts/harness_ledger.py +671 -0
  168. package/resources/harness/java/scripts/harness_preflight.py +780 -0
  169. package/resources/harness/java/scripts/harness_service.py +1331 -0
  170. package/resources/harness/manifests/general.json +296 -0
  171. package/resources/harness/manifests/java.json +324 -0
  172. package/resources/manifest.json +19 -0
  173. package/resources/skills/harness-apidoc/SKILL.md +50 -0
  174. package/resources/skills/harness-archive/SKILL.md +48 -0
  175. package/resources/skills/harness-codebase-map/SKILL.md +53 -0
  176. package/resources/skills/harness-knowledge-ingest/SKILL.md +48 -0
  177. package/resources/skills/harness-package/SKILL.md +48 -0
  178. package/resources/skills/harness-plan/SKILL.md +51 -0
  179. package/resources/skills/harness-review/SKILL.md +50 -0
  180. package/resources/skills/harness-run/SKILL.md +48 -0
  181. package/resources/skills/harness-skill-optimizer/SKILL.md +54 -0
  182. package/resources/skills/harness-submit/SKILL.md +47 -0
  183. package/resources/skills/harness-sync/SKILL.md +48 -0
  184. package/resources/skills/harness-test/SKILL.md +50 -0
@@ -0,0 +1,233 @@
1
+ ---
2
+ description: harness-apidoc 的文档7章节完整模板和增量接口文档差异说明。仅在生成文档需要参考模板结构时读取。
3
+ ---
4
+
5
+ # harness-apidoc 参考 — 文档模板
6
+
7
+ ## 文档7章节完整模板
8
+
9
+ ```markdown
10
+ # <模块名> — 前端接口文档
11
+
12
+ > **版本**:V<N> | **日期**:YYYY-MM-DD | **变更**:<change-name>
13
+ > **基础路径**:`/<模块路径>` | **认证**:Bearer Token | **Content-Type**:`application/json`
14
+
15
+ ---
16
+
17
+ ## ⚡ 前端改动清单
18
+
19
+ > 前端开发者请优先处理以下 🔴 BREAKING 项,其次处理 🟡 NEEDS-UPDATE 项。
20
+
21
+ | 优先级 | 接口 | 改动点 | 前端动作 |
22
+ |:------:|------|--------|----------|
23
+ | 🔴 | `GET /xxx/meta` | `code` 值从数字改为枚举编码 | Select 组件 value 改用 `projectType` 字段 |
24
+ | 🔴 | `POST /xxx/applicable` | 请求体 `sceneCode` 删除 | 改为传 `projectType` |
25
+ | 🟡 | `GET /xxx/enabled` | 新增 `projectType` 过滤参数 | 可选适配,传入可筛选适用数据 |
26
+ | 🟢 | `POST /xxx/list` | 后端自动 orgCode 过滤 | 无需处理,前端可删除传 orgCode 逻辑 |
27
+
28
+ > 影响级别:🔴 BREAKING(必须修改)| 🟡 NEEDS-UPDATE(建议修改)| 🟢 TRANSPARENT(无需处理)
29
+
30
+ ---
31
+
32
+ ## 一、接口变更概览
33
+
34
+ | # | 方法 | 路径 | 说明 | 变更 | 前端影响 |
35
+ |:--:|------|------|------|:----:|:--------:|
36
+ | 1 | GET | `/xxx/meta` | 获取下拉选项 | 🆕 新增 | — |
37
+ | 2 | POST | `/xxx/applicable` | 查询可用数据 | 🆕 新增 | — |
38
+ | 3 | POST | `/xxx/list/{pageNum}/{pageSize}` | 分页查询(新增字段) | 📝 扩展 | 🟡 |
39
+ | 4 | GET | `/xxx/{id}` | 详情(新增子表) | 📝 扩展 | 🟡 |
40
+ | 5 | DELETE | `/xxx/{ids}` | 批量删除 | — 不变 | 🟢 |
41
+
42
+ > 变更标记:🆕 新增 | 📝 扩展 | ❌ 删除 | — 不变 | ⚠️ 废弃
43
+ > 前端影响:🔴 BREAKING | 🟡 NEEDS-UPDATE | 🟢 TRANSPARENT
44
+
45
+ ---
46
+
47
+ ## 二、新增接口
48
+
49
+ ### 2.1 <接口名称>
50
+
51
+ > `GET /xxx/meta` | 用途:获取下拉选项
52
+
53
+ **路径参数**:无
54
+
55
+ **Query 参数**:
56
+
57
+ | 字段 | 类型 | 必填 | 说明 |
58
+ |------|------|:----:|------|
59
+ | `type` | String | 是 | 选项类型(见数据字典) |
60
+
61
+ **响应示例**:
62
+
63
+ ```json
64
+ {
65
+ "code": 0,
66
+ "msg": "成功",
67
+ "data": [
68
+ { "label": "选项A", "value": "A" }
69
+ ]
70
+ }
71
+ ```
72
+
73
+ **响应字段**:
74
+
75
+ | 字段 | 类型 | 说明 |
76
+ |------|------|------|
77
+ | `data[].label` | String | 选项显示文本 |
78
+ | `data[].value` | String | 选项值 |
79
+
80
+ **前端用法**:`type` → 下拉选择控件数据源
81
+
82
+ ---
83
+
84
+ ### 2.2 <接口名称>
85
+
86
+ > `POST /xxx/applicable` | 用途:查询可用数据
87
+
88
+ **请求体示例**:
89
+
90
+ ```json
91
+ {
92
+ "keyword": "张三",
93
+ "status": "ENABLED"
94
+ }
95
+ ```
96
+
97
+ **请求字段**:
98
+
99
+ | 字段 | 类型 | 必填 | 校验 | 说明 |
100
+ |------|------|:----:|------|------|
101
+ | `keyword` | String | 否 | ≤50字符 | 模糊搜索关键词 |
102
+ | `status` | String | 否 | 枚举 | 状态过滤(见数据字典) |
103
+
104
+ **响应字段**:
105
+
106
+ | 字段 | 类型 | 说明 |
107
+ |------|------|------|
108
+ | `data[].id` | Long | 数据ID |
109
+ | `data[].name` | String | 数据名称 |
110
+ | `data[].status` | String | 状态(见数据字典) |
111
+
112
+ **前端用法**:
113
+ - `keyword` → 搜索输入框,输入后实时查询
114
+ - `status` → 筛选下拉框,选中后过滤结果
115
+
116
+ ---
117
+
118
+ ## 三、扩展接口详情
119
+
120
+ ### 3.1 <接口名称>(新增字段)
121
+
122
+ > `POST /xxx/list/{pageNum}/{pageSize}` | 变更:新增 `status` 查询条件 + 响应新增 `status` 字段
123
+
124
+ > 🟡 **NEEDS-UPDATE**:前端可选适配新字段,不修改不影响现有功能
125
+
126
+ **新增请求字段**:
127
+
128
+ | 字段 | 类型 | 必填 | 说明 |
129
+ |------|------|:----:|------|
130
+ | `status` | String | 否 | 状态过滤(见数据字典) |
131
+
132
+ **新增响应字段**:
133
+
134
+ | 字段 | 类型 | 说明 |
135
+ |------|------|------|
136
+ | `data.list[].status` | String | 状态值(见数据字典) |
137
+
138
+ **行为变更**:分页结果默认按创建时间倒序(原为正序)
139
+
140
+ ---
141
+
142
+ ## 四、数据结构
143
+
144
+ ### VO 定义
145
+
146
+ #### <VOName>(<用途>)
147
+
148
+ ```typescript
149
+ interface <VOName> {
150
+ id: number; // 数据ID
151
+ name: string; // 数据名称
152
+ status: string; // 状态(见数据字典)
153
+ createTime: string | null; // 创建时间,ISO 8601
154
+ }
155
+ ```
156
+
157
+ ### 数据字典
158
+
159
+ #### status — 状态
160
+
161
+ | 值 | 说明 | 前端展示 |
162
+ |------|------|------|
163
+ | `ENABLED` | 启用 | 🟢 绿色标签 |
164
+ | `DISABLED` | 禁用 | 🔴 红色标签 |
165
+
166
+ #### type — 选项类型
167
+
168
+ | 值 | 说明 |
169
+ |------|------|
170
+ | `A` | 类型A |
171
+ | `B` | 类型B |
172
+
173
+ ---
174
+
175
+ ## 五、前端交互建议
176
+
177
+ ### <页面名称>
178
+
179
+ | 操作 | 调用接口 | 触发时机 | 交互效果 |
180
+ |------|----------|----------|----------|
181
+ | 页面加载 | `GET /xxx/meta` | `onMounted` | 填充筛选下拉框 |
182
+ | 搜索 | `POST /xxx/list` | 输入后防抖 300ms | 刷新表格数据 |
183
+ | 查看详情 | `GET /xxx/{id}` | 点击行 | 弹出详情抽屉 |
184
+
185
+ ---
186
+
187
+ ## 六、兼容性说明
188
+
189
+ | 场景 | 旧行为 | 新行为 | 前端处理 |
190
+ |------|--------|--------|----------|
191
+ | `status=null` 的历史数据 | 字段不存在 | 返回 `null` | 前端判空显示「未设置」 |
192
+ | 旧版分页响应 | 无 `status` 字段 | 新增 `status` 字段 | 前端可选渲染,不阻塞 |
193
+
194
+ ---
195
+
196
+ ## 七、错误码速查表
197
+
198
+ | 编码 | 常量 | 信息 | 触发场景 |
199
+ |------|------|------|----------|
200
+ | 1002001 | `XXX_NOT_FOUND` | 数据不存在 | 查询ID不存在 |
201
+ | 1002002 | `XXX_STATUS_INVALID` | 状态不允许操作 | 状态流转违规 |
202
+ ```
203
+
204
+ ## 增量接口文档差异
205
+
206
+ 增量文档与完整文档结构相同,但:
207
+
208
+ - **前端改动清单**:必须包含,放在文档开头,列出所有 🔴 和 🟡 项
209
+ - **接口变更概览**:只列出有变更的接口,必须包含「前端影响」列
210
+ - **新增接口**章节:只写新增的
211
+ - **扩展接口详情**:每个接口只展示新增/变更字段,用注释标注 `// ========== 新增字段 ==========`
212
+ - **前端影响标注**:每个扩展接口标题下方必须用 callout 标注影响级别:
213
+
214
+ ```markdown
215
+ > 🔴 **BREAKING**:请求体 `sceneCode` 字段已删除,前端必须改为传 `projectType`,否则接口无法正常工作
216
+
217
+ > 🟡 **NEEDS-UPDATE**:新增 `projectType` 可选参数,前端可选适配以使用筛选功能
218
+
219
+ > 🟢 **TRANSPARENT**:后端自动 orgCode 过滤,前端无需修改(可选删除旧的传 orgCode 逻辑)
220
+ ```
221
+
222
+ - **审查修复标注**:如果接口在 review 阶段被修改,在扩展接口详情中添加标注:
223
+
224
+ ```markdown
225
+ > ℹ️ **审查修复**:此接口在 harness-review 阶段有以下修改:
226
+ > - `code` 值从硬编码数字改为 `ProjectTypeEnum` 枚举编码
227
+ > - 前端依赖 `code` 字段需同步更新
228
+ ```
229
+
230
+ - **数据结构**:只写新增或变更的 VO 字段和数据字典
231
+ - **兼容性说明**:重点描述旧数据如何兼容新字段 + 审查修复引入的 breaking change,每行标注影响级别
232
+ - **错误码**:只列新增的错误码
233
+ - **前端交互建议**:只描述受变更影响的页面和操作
@@ -0,0 +1,215 @@
1
+ ---
2
+ name: harness-archive
3
+ description: "归档所有变更产出(计划/测试报告/审查/SQL/API文档)到 .harness/archive/,含归档元数据和可视化最终总结。使用场景:归档、完成归档、收尾、打包产出物"
4
+ argument-hint: "变更名或留空自动检测"
5
+ effort: medium
6
+ allowed-tools: [Bash(powershell.exe:*), Read, Write, Edit, Glob, Grep]
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
+ ---
23
+ <!-- generated by harness_deploy.py; core=8917528f7dfdc5ca; overlay=java; do not edit -->
24
+ # harness-archive — 变更归档
25
+
26
+ ## Purpose
27
+
28
+ 将 `.harness/changes/<change-name>/` 的所有产出移入 `.harness/archive/YYYY-MM-DD-<change-name>/`,生成归档元数据和可视化最终报告,释放工作区。
29
+
30
+ ## When to Use
31
+
32
+ 使用场景:
33
+
34
+ - 用户说"归档 / 完成归档 / 收尾 / 打包产出物"。
35
+ - submit 已推送、test/review 报告已就绪(或已明确标记跳过/未运行),需要封存变更产出。
36
+ - 变更闭环最后一站,归档后从工作区移除 `.harness/changes/<change-name>/`。
37
+
38
+ 跳过场景:
39
+
40
+ - 变更尚未 submit 推送(归档前 commit 必须已 push)。
41
+ - 仍存在未结清的 test/review 验证(除非已明确标记 CONDITIONAL_OK)。
42
+
43
+ 自动调用边界:
44
+
45
+ - 归档涉及移动/删除原变更目录,支持被其他 skill 调用,但调用前必须确保前置条件已满足;也支持用户显式 `/harness-archive` 调用。
46
+ - 归档前确认是强制阻断检查点,用户拒绝 → 终止流程,不执行任何操作。
47
+
48
+ ## 前置条件
49
+
50
+ - commit 已 push(`git log @{u}..HEAD` 输出为空)
51
+ - **最终 hash 来源**:worktree 模式(`meta/worktree.json` requested=true)下读 ledger 的 `mergeFinalHash`(由 `/harness-submit` 合并段写入);主目录模式读 submit 的 `final pushed hash`。当前 `git rev-parse HEAD` 须一致
52
+ - test 报告存在或标记"跳过";review 报告存在或标记"未运行 review"(review 不阻塞归档)
53
+
54
+ ## Inputs
55
+
56
+ - `$ARGUMENTS`:变更名(可选,留空时 Glob `.harness/changes/*/plans/*-plan.md` 自动检测,排除 `.harness/archive/`)
57
+ - 相关文件:`.harness/changes/<change-name>/logs/execution-log.md`、`.harness/changes/<change-name>/events.ndjson`、`evidence/verification-ledger.json`、各阶段 reports/
58
+
59
+ ## 统一读取协议
60
+
61
+ 1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
62
+ 2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
63
+ 3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
64
+ 4. **spec** — 设计真相源:`spec/<change>-design.md`
65
+ 5. **plan** — 任务真相源:`plans/<change>-plan.md`
66
+ 6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
67
+ 7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
68
+ 8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
69
+
70
+ 状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
71
+
72
+ ## Workflow
73
+
74
+ ### Phase 0:读取规则和上下文
75
+
76
+ 1. 读取本文件。
77
+ 2. 按需读取 `reference.md`(归档流程、manifest、summary-data、final-summary 渲染、目录结构与最终状态规则)。
78
+ 3. 读取共用约束:
79
+ - `../protocols/archive-report-protocol.md`
80
+ - `../protocols/state-layout-protocol.md`
81
+ - `../protocols/powershell-protocol.md`
82
+ - `../protocols/sensitive-info-protocol.md`
83
+ - `../protocols/evidence-based-reporting-protocol.md`
84
+ - `../protocols/report-pipeline-protocol.md`
85
+ 4. 解析 `$ARGUMENTS`:留空时 Glob 自动检测未归档变更,排除 `.harness/archive/`。
86
+
87
+ ### Phase 1:确认归档对象(扫描未归档变更)
88
+
89
+ 用 Glob 搜索 `.harness/changes/*/plans/*-plan.md`(排除 `.harness/archive/`),展示变更概要。
90
+
91
+ - **Read `checklist.md`** — 归档前检查项
92
+ - 发现多个未归档变更 → 让用户选择或终止
93
+
94
+ ### Phase 2:确认归档 ⚠️ 强制阻断
95
+
96
+ AskUserQuestion 让用户确认归档操作。**用户拒绝 → 终止流程,不执行任何操作。**
97
+
98
+ - **Read `reference.md`** — 确认对话框的内容格式
99
+
100
+ ### Phase 3:执行归档
101
+
102
+ 1. append `phase.start` 事件。
103
+ 2. 运行 `python <skills-root>/scripts/harness_archive.py status --change-dir ".harness/changes/<change-name>" --json` 前置检查。
104
+ 3. 运行 `python <skills-root>/scripts/harness_archive.py finalize --change-dir ".harness/changes/<change-name>" --archive-root ".harness/archive" --json`;读 JSON(移动、collect、render、validate、manifest 比对)。**finalize 不再同步执行知识维护**(§8.2):它写一个 `pending` maintenance-outbox 项即返回,`knowledgeMaintenance=QUEUED`;写 outbox 失败时 `NOT_QUEUED`(warning,不回滚 archive,总状态 CONDITIONAL)。后续由 `harness-sync` / `harness_knowledge.py maintain` 异步推进 outbox。
105
+ 4. 模型补写 `meta/archive-meta.md` 的维护者结论 / knownRisks / manualActions(脚本占位字段)。
106
+ 5. append `phase.end` 事件。**finalize 失败或 validate 报错时不删除原目录**。
107
+
108
+ - **Read `reference.md`** — finalize 输出字段、archive-meta 格式、CONDITIONAL_OK 规则
109
+ - **Read `templates/summary-data-template.json`** — summary-data 数据结构
110
+ - **Read `templates/render-summary.mjs`** — final-summary 渲染脚本(finalize 内嵌调用)
111
+
112
+ ### Phase 4:验证与提示
113
+
114
+ 验证归档目录完整 → 提示用户归档完成。
115
+
116
+ - **Read `checklist.md`** — 归档后验证项
117
+
118
+ ## P0 执行可信度规则
119
+
120
+ - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
121
+ - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
122
+ - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
123
+
124
+ ## 关键规则(硬门禁速查)
125
+
126
+ > 每条规则的详细判定、模板见 `reference.md` 对应章节;归档报告协议见 `../protocols/archive-report-protocol.md`,Shell 执行安全见 `../protocols/powershell-protocol.md`,敏感信息见 `../protocols/sensitive-info-protocol.md`,证据化报告见 `../protocols/evidence-based-reporting-protocol.md`,状态目录见 `../protocols/state-layout-protocol.md`。
127
+
128
+ ### 一、同一时间最多 1 个未归档变更
129
+
130
+ 扫描排除 `.harness/archive/`;多个未归档变更 → 让用户选择或终止,不批量归档。
131
+
132
+ ### 二、归档前确认是强制阻断检查点
133
+
134
+ AskUserQuestion 确认;用户拒绝 → 终止,不执行任何操作。
135
+
136
+ ### 三、文件移动只用内置工具或 PowerShell
137
+
138
+ 移动用 Read+Write+验证 或 PowerShell;**禁止 Bash mv/cp/rm**。移动失败时不删除原目录,报错退出让用户手动处理。
139
+
140
+ ### 四、数据化归档门禁(先数据后渲染)
141
+
142
+ 必须通过 `harness_archive.py finalize` 生成 `reports/final/summary-data.json` 与 `final-summary.html` 并完成 validate;**禁止模型临场写 500+ 行 HTML**。统计数字只能来自 summary-data、events、ledger 或 manifest。详见 `../protocols/report-pipeline-protocol.md`、`../protocols/archive-report-protocol.md`、`reference.md`。
143
+
144
+ ### 五、manifest/checksum 必须存在
145
+
146
+ 归档前后生成 `evidence/archive-manifest-before.json` / `archive-manifest-after.json`(path/size/sha256),before/after 不一致时**不得删除原目录**。复杂 PowerShell 写入 `scripts/*.ps1` 后 `-File` 执行,禁止内联 `$` / `$_` / `@{}`。详见 `reference.md`。
147
+
148
+ ### 六、归档前确认四项(缺一不可)
149
+
150
+ - commit 已 push(`git log @{u}..HEAD` 输出为空)
151
+ - **final hash 来源**:worktree 模式(requested=true)下读 ledger `mergeFinalHash`(submit 合并段);否则读 submit 日志 `final pushed hash`。当前 HEAD 须一致
152
+ - test 报告存在,或标记"跳过"/"未运行测试"
153
+ - review 报告:存在则作 📝ADVISORY 归档材料;不存在标记"📝ADVISORY:未运行 review"(review 不阻塞归档)
154
+
155
+ ### 七、verification-ledger 汇总状态
156
+
157
+ 归档前读 `evidence/verification-ledger.json`,提取各阶段 status、postTestClassification、复用关系,供 final-summary 真实展示状态演进。若 ledger 有 `postTestClassification`,final-summary 必须展示该分类及对应的复用/重测决策。
158
+
159
+ ### 八、final-summary 不得伪造且必须展示状态演进
160
+
161
+ 无测试报告 → 显示"未运行测试 / 静态验证",不得 100% 通过率;无 review → "📝ADVISORY:未运行 review"。状态用 ✅OK / 🟡WARN / 🔁REUSED / 🔁RETESTED / 📝ADVISORY / 🧹NON_BEHAVIORAL_CLEANUP,复用前一阶段结果显示 🔁REUSED,**不得伪装成重新执行,不得无脑全绿**。
162
+
163
+ **final-summary 必须产出**:Node 渲染器不可用/超时/exit 非 0/未产出文件时,`harness_archive.py` 自动用内置 Python fallback 渲染(含 changeName/finalStatus/commands/verification/changedFiles/archiveManifest/knownRisks/manualActions/maintenanceNotes,USER_SKIPPED/BLOCKED_BY_DBA/失败状态可见,全部 HTML 转义)。Node 与 Python fallback **都失败**时,finalize 立即恢复原 change 目录并 exit 非 0,**绝不归档一个没有 final-summary.html 的变更**。
164
+
165
+ ### 九、CONDITIONAL_OK 最终状态
166
+
167
+ API 测试 `USER_SKIPPED` 或 DB 兼容 `BLOCKED_BY_DBA` 时,最终状态必须是 `CONDITIONAL_OK`,不能显示纯 `OK`。
168
+
169
+ ### 十、未提交测试文件归档
170
+
171
+ 未提交但用于验证的测试文件必须归档到 `backups/uncommitted-tests/` 并在 final-summary 中展示。
172
+
173
+ ### 十一、phase.start 事件前置
174
+
175
+ 阶段 0 之前必须先 append `phase.start` 事件(`harness_events.py append`);不得等归档完成才补。归档后 events.ndjson 与自动渲染的 execution-log.md 一起移入 archive。
176
+
177
+ ### 十二、Shell 安全 / 敏感信息 / 证据化报告
178
+
179
+ git 命令通过 `powershell.exe -Command "..."` 执行;archive-meta.md 和 final-summary.html 不得含明文 token/密码/密钥;归档报告必须区分 ✅真实成功 / 🟡跳过·静态验证 / ❌失败。
180
+
181
+ ## Output Format
182
+
183
+ > 归档元数据格式见 `reference.md` 的 archive-meta 模板;最终报告由 `templates/summary-data-template.json` 数据结构 + `templates/render-summary.mjs` 固定脚本渲染。
184
+
185
+ 产出文件:
186
+
187
+ - `.harness/archive/YYYY-MM-DD-<change-name>/meta/archive-meta.md` — 归档元数据
188
+ - `.harness/archive/YYYY-MM-DD-<change-name>/events.ndjson` — 结构化事件层(新流程推荐;旧 archive 可缺失)
189
+ - `.harness/archive/YYYY-MM-DD-<change-name>/reports/final/summary-data.json` — 最终报告数据源
190
+ - `.harness/archive/YYYY-MM-DD-<change-name>/reports/final/final-summary.html` — 由 `render-summary.mjs` 渲染(Node 不可用或失败时由 `harness_archive.py` 内置 Python fallback 渲染);**始终必须存在**,否则 finalize 恢复原 change 目录并 exit 非 0
191
+ - `.harness/archive/YYYY-MM-DD-<change-name>/evidence/archive-manifest-before.json` / `archive-manifest-after.json` — 归档前后 manifest/checksum
192
+
193
+ ## 渐进披露
194
+
195
+ - **Read `checklist.md`** 仅在 Phase 1 归档前检查和 Phase 4 验证时 — 含归档前检查项和归档后验证项
196
+ - **Read `reference.md`** 仅在 Phase 0/2/3 时 — 含归档流程、archive-meta 格式、summary-data 字段说明、final-summary 渲染规则、目录结构与最终状态规则
197
+ - **Read `reference.md`** 仅在 Phase 3 finalize 时 — summary-data、final-summary 校验与 archive-meta 补写
198
+ - **Read `templates/summary-data-template.json`** 仅在 Phase 3 生成 `summary-data.json` 时 — 含最终报告数据结构
199
+ - **Read `templates/render-summary.mjs`** 仅在 Phase 3 渲染 `final-summary.html` 时 — 固定 HTML 渲染脚本
200
+
201
+ ## 交互白名单
202
+
203
+ **仅允许**归档确认(Phase 2 AskUserQuestion);拒绝 → 终止,不执行任何移动。
204
+
205
+ ## 执行日志
206
+
207
+ `events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
208
+
209
+ ```powershell
210
+ python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
211
+ ```
212
+
213
+ > **脚本接线**:`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 护栏解读。
214
+
215
+ > **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 边界保持最新。
@@ -0,0 +1,52 @@
1
+ ---
2
+ description: harness-archive 的归档前检查项和归档后验证项。仅在 Phase 1 检查和 Phase 4 验证时读取。
3
+ ---
4
+
5
+ # harness-archive 检查清单
6
+
7
+ ## P0 数据化归档门禁
8
+
9
+ 归档遵循 `../protocols/archive-report-protocol.md`,门禁要点见 SKILL.md `## 关键规则` 四/五/九:
10
+
11
+ - 先写 `reports/final/summary-data.json`,再渲染 `reports/final/final-summary.html`。
12
+ - 归档前生成 `evidence/archive-manifest-before.json`,移动后生成 `archive-manifest-after.json`。
13
+ - final-summary 的统计只能来自 summary-data 或 manifest。
14
+ - before/after checksum 不一致时,不得删除原目录。
15
+ - 默认渲染器 `templates/render-summary.mjs`(finalize 内嵌调用)。
16
+
17
+ ## 归档前检查(Phase 1)
18
+
19
+ > ⚠️ **phase.start 前置**:在归档前检查的第一项前,必须先 append `phase.start` 事件(见 SKILL.md `## 执行日志`)。不得等归档完成才补。
20
+
21
+ - [ ] 已 append `phase.start` 事件(`harness_events.py append --change-dir ".harness/changes/<change-name>"`)
22
+ - [ ] 只有一个未归档变更目录(多个时终止或让用户选择)
23
+ - [ ] 变更目录下有 plans/ 子目录(至少有计划文件)
24
+ - [ ] `logs/execution-log.md` 存在(需要追加归档记录;新路径缺失时兼容根目录 `execution-log.md`)
25
+ - [ ] 准备生成 `archive-manifest-before.json`(path/size/sha256)
26
+ - [ ] 准备生成 `summary-data.json`(业务目标、阶段状态、验证、产物、维护者结论)
27
+ - [ ] git status 无未提交的重要变更(归档应对应已提交的代码)
28
+ - [ ] **commit 已 push**:`powershell.exe -Command "git -C '<项目路径>' log @{u}..HEAD --oneline"` 输出为空(无未推送提交)
29
+ - [ ] **最终 hash 一致**:worktree 模式(requested=true)下读 `evidence/verification-ledger.json` 的 `mergeFinalHash`(submit 合并段写入),否则从 events/ledger 读取 `final pushed hash`,与当前 `git rev-parse HEAD` 比对
30
+ - [ ] **test/review 报告状态确认**:
31
+ - ✅ `.harness/changes/<change-name>/tests/test-report-*.md` 存在 → 归档正常
32
+ - 🟡 不存在 → 必须在 archive-meta.md 和 final-summary.html 中标记"跳过测试"或"未运行测试",不得伪造通过率
33
+ - ✅ `.harness/changes/<change-name>/reports/review/review-report-*.md` 存在(旧路径 `reviews/review-report-*.md` 兼容回退)→ 作为 📝ADVISORY 归档材料
34
+ - 📝 `.harness/changes/<change-name>/reports/review/fixback-*.md` 存在 → 随 review 报告一并归档;默认 advisory,除非 `strict-review-gate=true`
35
+ - 🟡 不存在但 `logs/execution-log.md` 有 harness-review 小节 → **review 已运行但未落盘**(harness-review `context:fork` 交接缝常见,见 `agent/case-candidates/2026-06-30-harness-review-forked-not-persisting-report.md`):从 execution-log/会话补落盘到 `reports/review/review-report-YYYYMMDD-HHmm.md` 再归档,**不得误标"未运行 review"**(实际跑过)
36
+ - 🟡 不存在且 execution-log 无 review 小节 → 在 archive-meta.md 和 final-summary.html 中标记"📝ADVISORY:未运行 review"
37
+
38
+ ## 归档后验证(Phase 4)
39
+
40
+ - [ ] `.harness/archive/YYYY-MM-DD-<change-name>/` 目录存在(通过 Glob 实际扫描确认)
41
+ - [ ] 所有子目录(plans/, tests/, reviews/, sqls/)已完整移入(通过 Glob 实际扫描确认,不仅看预期路径)
42
+ - [ ] before/after manifest 校验通过(排除 `logs/execution-log.md`——归档追加结束记录预期 sha256 变化;其他 moved 文件 sha256 必须一致,missing/mismatch=0)
43
+ - [ ] archive-meta.md 已创建,frontmatter 字段完整
44
+ - [ ] summary-data.json 已生成,且为合法 JSON
45
+ - [ ] final-summary.html 已由 `templates/render-summary.mjs` 渲染生成
46
+ - [ ] **final-summary.html 真实性检查**:
47
+ - 无测试报告时,`summary-data.json.verification.unitTests.status` / `summary-data.json.verification.apiTests.status` 必须标记为 `NOT_RUN`、`USER_SKIPPED`、`BLOCKED` 或 `STATIC_ONLY`,不得显示 100%
48
+ - 无 review 报告时,`summary-data.json.reviewSummary.status` 必须标记为 `ADVISORY_NOT_RUN`,不得显示 100%
49
+ - 跳过、复用、人工确认的部分必须明确标记,不伪装成 ✅
50
+ - final-summary.html 中不得残留 `{{...}}` 占位符
51
+ - [ ] 原目录 `.harness/changes/<change-name>/` 已删除(仅在前面所有验证通过后)
52
+ - [ ] .harness/ 下无残留未归档变更目录
@@ -0,0 +1,103 @@
1
+ ---
2
+ description: harness-archive 的归档流程、manifest、summary-data、final-summary 渲染、目录结构与最终状态规则。
3
+ ---
4
+
5
+ # harness-archive 参考
6
+
7
+ ## 归档流程(对齐 SKILL.md Workflow)
8
+
9
+ - **Phase 0 读取上下文**:读 SKILL.md / 本文件 / 共用协议(`../protocols/archive-report-protocol.md`、`../protocols/report-pipeline-protocol.md`、`../protocols/state-layout-protocol.md`、`../protocols/powershell-protocol.md`、`../protocols/sensitive-info-protocol.md`、`../protocols/evidence-based-reporting-protocol.md`)/ 解析 `$ARGUMENTS`。
10
+ - **Phase 1 确认归档对象**:Glob `.harness/changes/*/plans/*-plan.md`(排除 archive),展示概要;多变更让用户选择或终止。
11
+ - **Phase 2 确认归档(强制阻断)**:AskUserQuestion 确认,拒绝即终止。
12
+ - **Phase 3 执行归档**:
13
+ 1. append `phase.start` 事件(`harness_events.py append`)。
14
+ 2. 运行 `python <skills-root>/scripts/harness_archive.py status --change-dir ... --json` 做前置检查。
15
+ 3. 运行 `python <skills-root>/scripts/harness_archive.py finalize --change-dir ... --archive-root ".harness/archive" --json`;读 JSON 结果。
16
+ 4. 模型补写 `meta/archive-meta.md` 的 `maintenanceNotes` / `knownRisks` / `manualActions`(脚本留空占位)。
17
+ 5. append `phase.end` 事件。**finalize 报错或 validate 失败时不删除原 changes 目录**。
18
+ - **Phase 4 验证与提示**:见 `checklist.md` 归档后验证项。
19
+
20
+ ## manifest 生成
21
+
22
+ manifest 每项包含:
23
+
24
+ ```json
25
+ {"path":"...","size":123,"sha256":"...","lastModified":"..."}
26
+ ```
27
+
28
+ 建议使用固定脚本,禁止内联复杂 PowerShell(包含 `$`、`$_`、`@{}`、script block、管道 JSON 输出):
29
+
30
+ ```powershell
31
+ powershell.exe -NoProfile -ExecutionPolicy Bypass -File "harness-skills/harness-archive/scripts/gen-manifest.ps1" -RootPath ".harness/changes/<change>" -OutputPath ".harness/changes/<change>/evidence/archive-manifest-before.json"
32
+ ```
33
+
34
+ 移动到 archive 目录后,再生成 after manifest:
35
+
36
+ ```powershell
37
+ powershell.exe -NoProfile -ExecutionPolicy Bypass -File "harness-skills/harness-archive/scripts/gen-manifest.ps1" -RootPath ".harness/archive/<date-change>" -OutputPath ".harness/archive/<date-change>/evidence/archive-manifest-after.json"
38
+ ```
39
+
40
+ **校验 before/after 时排除 execution-log**(通用):`logs/execution-log.md` 在归档过程会追加结束记录(Phase 4),before(移动前含开始记录)与 after(含开始+结束记录)sha256 必然不同——这是预期追加,非文件损坏。校验脚本需跳过 `logs/execution-log.md`,其他 moved 文件 sha256 必须一致;若其他文件 missing/mismatch,才表示移动损坏,不得删除原目录。
41
+
42
+ ## summary-data.json 与 harness_archive.py
43
+
44
+ 默认由 `harness_archive.py finalize`(或 `replay`)生成/校验 `reports/final/summary-data.json`;CLI 不可用时按 `../protocols/report-pipeline-protocol.md` 与 `templates/summary-data-template.json`(schemaVersion 2.2)生成等价数据。必须保留原 final report 维度。必须包含:
45
+
46
+ - `businessGoal`:本次变更为了做什么;
47
+ - `stageStatus`:plan/run/test/review/submit/archive;
48
+ - `diffStat`:filesChanged/insertions/deletions/range —— 来自 `git diff --numstat` + `git diff --stat <base>..<head>`,不得手写;
49
+ - `durations`:totalMinutes + stages[{stage,skill,startedAt,endedAt,minutes,result}] —— 从 `logs/execution-log.md` 各 `[N] harness-<skill>` 小节的 `开始`/`结束`/`耗时` 解析;
50
+ - `skillCalls`:每个 skill 的调用次数(含重入)+ 结果 —— 从 execution-log 统计;
51
+ - `verification`:单元/API/覆盖展示,含 passRate —— 来自 `evidence/verification-ledger.json`;
52
+ - `changedFiles`:path/summary/insertions/deletions —— 来自 `git diff --numstat <base>..<head>`;
53
+ - `reviewSummary`:red/yellow + redFixed/redConfirmed/yellowFixed/yellowDeferred 修复进度;
54
+ - `maintenanceNotes`:给后续维护者看的结论;
55
+ - `knownRisks`:剩余风险或人工确认项。
56
+
57
+ 报告必须突出业务目标和维护者结论。所有统计数字只能来自 events、summary-data、ledger 或 manifest,不得手写另一套。历史 archive 没有 `events.ndjson` 时,允许从 ledger/log/manifest 回放,并在 `reportPipeline.sources` 中记录来源。
58
+
59
+ ## final-summary 渲染
60
+
61
+ 默认使用 Node.js 渲染器:
62
+
63
+ ```powershell
64
+ powershell.exe -NoProfile -Command "& '<node-path>' 'harness-skills/harness-archive/templates/render-summary.mjs' --summary '.harness/archive/<date-change>/reports/final/summary-data.json' --out '.harness/archive/<date-change>/reports/final/final-summary.html'"
65
+ ```
66
+
67
+ 如模板脚本位于 skill 目录,则先复制到 archive 目录或直接引用 skill 路径。
68
+
69
+ 禁止模型临场手写大段 HTML。确需临时修 HTML,只能修模板,不得让统计数字脱离 `summary-data.json`。
70
+
71
+ 渲染后必须执行:
72
+
73
+ ```powershell
74
+ powershell.exe -NoProfile -Command "npx hunter-harness report validate --change-id '<date-change>' --json"
75
+ ```
76
+
77
+ 存在 validate error 时,不得删除原 `.harness/changes/<change>` 目录。
78
+
79
+ ## archive-meta.md 模板
80
+
81
+ ```markdown
82
+ # Archive Meta — <change-name>
83
+
84
+ - archivedAt: YYYY-MM-DD HH:mm
85
+ - finalCommit: <hash>
86
+ - sourceDir: .harness/changes/<change-name>
87
+ - archiveDir: .harness/archive/YYYY-MM-DD-<change-name>
88
+ - movedFiles: <from manifest>
89
+ - generatedFiles: archive-meta.md, summary-data.json, final-summary.html, manifests
90
+ - totalArchiveFiles: <from after manifest>
91
+ ```
92
+
93
+ ## 目录结构与最终状态规则
94
+
95
+ - 默认渲染器:`templates/render-summary.mjs`,输入 `reports/final/summary-data.json`,输出 `reports/final/final-summary.html`。
96
+ - `render-summary.mjs` 是默认 UTF-8 渲染器;finalize 内嵌调用,不得由模型临场写 HTML。
97
+ - 新路径优先:`meta/`、`logs/`、`evidence/`、`reports/final/`、`scripts/`、`backups/uncommitted-tests/`。旧路径只做读取兼容,不再写大量根目录文件。
98
+ - 当 `summary-data.json.verification.apiTests.status=USER_SKIPPED` 或 `verification.dbCompatibility.status=BLOCKED_BY_DBA`,最终状态必须是 `CONDITIONAL_OK`。
99
+ - 复杂 PowerShell 命令写入 `scripts/*.ps1` 后 `-File` 执行,禁止内联 `$` / `$_`。
100
+
101
+ ## 执行日志记录
102
+
103
+ 归档只向 `events.ndjson` 追加事件(schema_version 2);`logs/execution-log.md` 由 `harness_events.py append` 自动渲染,禁止手工 Edit。事件类型与脚本用法见 SKILL.md `## 执行日志` 与 `../protocols/report-pipeline-protocol.md`。
@@ -0,0 +1,31 @@
1
+ param(
2
+ [Parameter(Mandatory=$true)][string]$RootPath,
3
+ [Parameter(Mandatory=$true)][string]$OutputPath
4
+ )
5
+
6
+ $ErrorActionPreference = 'Stop'
7
+ $root = (Resolve-Path $RootPath).Path
8
+ # 排除 OutputPath 自身:重新生成 manifest 时旧 manifest 文件会被扫到,导致递归(新 manifest 含旧 manifest 的 sha256,fileCount 虚高 +1)。
9
+ # OutputPath 不存在时(首次生成)$excludePath=$null,Where-Object 不过滤。
10
+ $excludePath = $null
11
+ if (Test-Path $OutputPath) {
12
+ $excludePath = (Resolve-Path $OutputPath).Path
13
+ }
14
+ $items = Get-ChildItem -Path $root -File -Recurse | Where-Object { $excludePath -eq $null -or $_.FullName -ne $excludePath } | Sort-Object FullName | ForEach-Object {
15
+ $relative = $_.FullName.Substring($root.Length).TrimStart('\','/') -replace '\\','/'
16
+ $hash = Get-FileHash -Path $_.FullName -Algorithm SHA256
17
+ [PSCustomObject]@{
18
+ path = $relative
19
+ sizeBytes = $_.Length
20
+ sha256 = $hash.Hash.ToLowerInvariant()
21
+ }
22
+ }
23
+ $result = [PSCustomObject]@{
24
+ root = $root
25
+ generatedAt = (Get-Date).ToString('s')
26
+ fileCount = @($items).Count
27
+ totalBytes = (@($items) | Measure-Object -Property sizeBytes -Sum).Sum
28
+ files = @($items)
29
+ }
30
+ $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
31
+ [System.IO.File]::WriteAllText((Resolve-Path (Split-Path $OutputPath -Parent)).Path + [System.IO.Path]::DirectorySeparatorChar + (Split-Path $OutputPath -Leaf), ($result | ConvertTo-Json -Depth 8), $utf8NoBom)