hunter-harness 0.1.3 → 0.2.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/LICENSE +21 -21
- package/README.md +11 -0
- package/dist/bin.js +1540 -491
- package/package.json +9 -7
- package/resources/harness/general/.harness-build.json +0 -5
- package/resources/harness/general/CONTEXT.md +0 -65
- package/resources/harness/general/README.md +0 -478
- package/resources/harness/general/agents/harness-evaluator.md +0 -96
- package/resources/harness/general/agents/harness-explorer.md +0 -72
- package/resources/harness/general/agents/harness-reviewer.md +0 -69
- package/resources/harness/general/harness-archive/SKILL.md +0 -215
- package/resources/harness/general/harness-archive/checklist.md +0 -52
- package/resources/harness/general/harness-archive/reference.md +0 -103
- package/resources/harness/general/harness-archive/scripts/gen-manifest.ps1 +0 -31
- package/resources/harness/general/harness-archive/templates/render-summary.mjs +0 -171
- package/resources/harness/general/harness-archive/templates/summary-data-template.json +0 -128
- package/resources/harness/general/harness-codebase-map/SKILL.md +0 -112
- package/resources/harness/general/harness-codebase-map/checklist.md +0 -126
- package/resources/harness/general/harness-codebase-map/reference.md +0 -364
- package/resources/harness/general/harness-codebase-map/templates/ARCHITECTURE.md +0 -57
- package/resources/harness/general/harness-codebase-map/templates/CONCERNS.md +0 -49
- package/resources/harness/general/harness-codebase-map/templates/CONVENTIONS.md +0 -57
- package/resources/harness/general/harness-codebase-map/templates/INTEGRATIONS.md +0 -52
- package/resources/harness/general/harness-codebase-map/templates/STACK.md +0 -55
- package/resources/harness/general/harness-codebase-map/templates/STRUCTURE.md +0 -69
- package/resources/harness/general/harness-codebase-map/templates/TESTING.md +0 -64
- package/resources/harness/general/harness-codebase-map/templates/map-manifest.schema.json +0 -73
- package/resources/harness/general/harness-codebase-map/templates/map-summary.md +0 -64
- package/resources/harness/general/harness-knowledge-ingest/SKILL.md +0 -246
- package/resources/harness/general/harness-knowledge-ingest/design.md +0 -842
- package/resources/harness/general/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +0 -42
- package/resources/harness/general/harness-knowledge-ingest/mcp-config.example.json +0 -10
- package/resources/harness/general/harness-knowledge-ingest/reference.md +0 -309
- package/resources/harness/general/harness-knowledge-ingest/scripts/harness_knowledge.py +0 -4082
- package/resources/harness/general/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +0 -273
- package/resources/harness/general/harness-knowledge-query/SKILL.md +0 -164
- package/resources/harness/general/harness-plan/SKILL.md +0 -127
- package/resources/harness/general/harness-plan/checklist.md +0 -243
- package/resources/harness/general/harness-plan/protocols.md +0 -124
- package/resources/harness/general/harness-plan/reference.md +0 -376
- package/resources/harness/general/harness-review/SKILL.md +0 -156
- package/resources/harness/general/harness-review/checklist.md +0 -124
- package/resources/harness/general/harness-review/protocols.md +0 -68
- package/resources/harness/general/harness-review/reference.md +0 -86
- package/resources/harness/general/harness-run/SKILL.md +0 -132
- package/resources/harness/general/harness-run/checklist.md +0 -259
- package/resources/harness/general/harness-run/protocols.md +0 -78
- package/resources/harness/general/harness-run/reference.md +0 -834
- package/resources/harness/general/harness-submit/SKILL.md +0 -159
- package/resources/harness/general/harness-submit/checklist.md +0 -407
- package/resources/harness/general/harness-submit/reference.md +0 -152
- package/resources/harness/general/harness-sync/SKILL.md +0 -82
- package/resources/harness/general/harness-sync/reference.md +0 -153
- package/resources/harness/general/harness-test/SKILL.md +0 -180
- package/resources/harness/general/harness-test/checklist.md +0 -319
- package/resources/harness/general/harness-test/pitfalls.md +0 -260
- package/resources/harness/general/harness-test/reference.md +0 -791
- package/resources/harness/general/protocols/archive-report-protocol.md +0 -175
- package/resources/harness/general/protocols/evidence-based-reporting-protocol.md +0 -134
- package/resources/harness/general/protocols/ledger-protocol.md +0 -270
- package/resources/harness/general/protocols/powershell-protocol.md +0 -181
- package/resources/harness/general/protocols/report-pipeline-protocol.md +0 -150
- package/resources/harness/general/protocols/sensitive-info-protocol.md +0 -92
- package/resources/harness/general/protocols/state-layout-protocol.md +0 -131
- package/resources/harness/general/protocols/submit-protocol.md +0 -78
- package/resources/harness/general/scripts/harness_archive.py +0 -2319
- package/resources/harness/general/scripts/harness_deploy.py +0 -613
- package/resources/harness/general/scripts/harness_events.py +0 -680
- package/resources/harness/general/scripts/harness_ledger.py +0 -671
- package/resources/harness/general/scripts/harness_preflight.py +0 -780
- package/resources/harness/general/scripts/harness_service.py +0 -1331
- package/resources/harness/java/.harness-build.json +0 -5
- package/resources/harness/java/CONTEXT.md +0 -65
- package/resources/harness/java/README.md +0 -478
- package/resources/harness/java/agents/harness-evaluator.md +0 -96
- package/resources/harness/java/agents/harness-explorer.md +0 -72
- package/resources/harness/java/agents/harness-reviewer.md +0 -69
- package/resources/harness/java/harness-apidoc/SKILL.md +0 -86
- package/resources/harness/java/harness-apidoc/checklist.md +0 -142
- package/resources/harness/java/harness-apidoc/reference.md +0 -233
- package/resources/harness/java/harness-archive/SKILL.md +0 -215
- package/resources/harness/java/harness-archive/checklist.md +0 -52
- package/resources/harness/java/harness-archive/reference.md +0 -103
- package/resources/harness/java/harness-archive/scripts/gen-manifest.ps1 +0 -31
- package/resources/harness/java/harness-archive/templates/render-summary.mjs +0 -171
- package/resources/harness/java/harness-archive/templates/summary-data-template.json +0 -128
- package/resources/harness/java/harness-codebase-map/SKILL.md +0 -112
- package/resources/harness/java/harness-codebase-map/checklist.md +0 -126
- package/resources/harness/java/harness-codebase-map/reference.md +0 -364
- package/resources/harness/java/harness-codebase-map/templates/ARCHITECTURE.md +0 -57
- package/resources/harness/java/harness-codebase-map/templates/CONCERNS.md +0 -49
- package/resources/harness/java/harness-codebase-map/templates/CONVENTIONS.md +0 -57
- package/resources/harness/java/harness-codebase-map/templates/INTEGRATIONS.md +0 -52
- package/resources/harness/java/harness-codebase-map/templates/STACK.md +0 -55
- package/resources/harness/java/harness-codebase-map/templates/STRUCTURE.md +0 -69
- package/resources/harness/java/harness-codebase-map/templates/TESTING.md +0 -64
- package/resources/harness/java/harness-codebase-map/templates/map-manifest.schema.json +0 -73
- package/resources/harness/java/harness-codebase-map/templates/map-summary.md +0 -64
- package/resources/harness/java/harness-knowledge-ingest/SKILL.md +0 -246
- package/resources/harness/java/harness-knowledge-ingest/design.md +0 -842
- package/resources/harness/java/harness-knowledge-ingest/evaluations/harness_knowledge_evaluation.xml +0 -42
- package/resources/harness/java/harness-knowledge-ingest/mcp-config.example.json +0 -10
- package/resources/harness/java/harness-knowledge-ingest/reference.md +0 -309
- package/resources/harness/java/harness-knowledge-ingest/scripts/harness_knowledge.py +0 -4082
- package/resources/harness/java/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +0 -273
- package/resources/harness/java/harness-knowledge-query/SKILL.md +0 -164
- package/resources/harness/java/harness-package/SKILL.md +0 -87
- package/resources/harness/java/harness-package/checklist.md +0 -322
- package/resources/harness/java/harness-package/reference.md +0 -210
- package/resources/harness/java/harness-plan/SKILL.md +0 -127
- package/resources/harness/java/harness-plan/checklist.md +0 -243
- package/resources/harness/java/harness-plan/protocols.md +0 -124
- package/resources/harness/java/harness-plan/reference.md +0 -376
- package/resources/harness/java/harness-review/SKILL.md +0 -156
- package/resources/harness/java/harness-review/checklist.md +0 -124
- package/resources/harness/java/harness-review/protocols.md +0 -68
- package/resources/harness/java/harness-review/reference.md +0 -86
- package/resources/harness/java/harness-run/SKILL.md +0 -148
- package/resources/harness/java/harness-run/checklist.md +0 -250
- package/resources/harness/java/harness-run/protocols.md +0 -78
- package/resources/harness/java/harness-run/reference.md +0 -814
- package/resources/harness/java/harness-submit/SKILL.md +0 -166
- package/resources/harness/java/harness-submit/checklist.md +0 -407
- package/resources/harness/java/harness-submit/reference.md +0 -152
- package/resources/harness/java/harness-sync/SKILL.md +0 -82
- package/resources/harness/java/harness-sync/reference.md +0 -153
- package/resources/harness/java/harness-test/SKILL.md +0 -192
- package/resources/harness/java/harness-test/checklist.md +0 -317
- package/resources/harness/java/harness-test/pitfalls-java.md +0 -16
- package/resources/harness/java/harness-test/pitfalls.md +0 -260
- package/resources/harness/java/harness-test/reference.md +0 -788
- package/resources/harness/java/protocols/archive-report-protocol.md +0 -175
- package/resources/harness/java/protocols/evidence-based-reporting-protocol.md +0 -134
- package/resources/harness/java/protocols/ledger-protocol.md +0 -270
- package/resources/harness/java/protocols/powershell-protocol.md +0 -181
- package/resources/harness/java/protocols/report-pipeline-protocol.md +0 -150
- package/resources/harness/java/protocols/sensitive-info-protocol.md +0 -92
- package/resources/harness/java/protocols/state-layout-protocol.md +0 -131
- package/resources/harness/java/protocols/submit-protocol.md +0 -78
- package/resources/harness/java/scripts/harness_archive.py +0 -2319
- package/resources/harness/java/scripts/harness_deploy.py +0 -613
- package/resources/harness/java/scripts/harness_events.py +0 -680
- package/resources/harness/java/scripts/harness_ledger.py +0 -671
- package/resources/harness/java/scripts/harness_preflight.py +0 -780
- package/resources/harness/java/scripts/harness_service.py +0 -1331
- package/resources/harness/manifests/general.json +0 -276
- package/resources/harness/manifests/java.json +0 -304
- package/resources/harness/migrations/0.1.1/general.json +0 -358
- package/resources/harness/migrations/0.1.1/java.json +0 -398
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: harness-package 的8步工作流详细步骤、模块识别方法和执行日志记录格式。仅在执行打包流程时读取。
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# harness-package 检查清单
|
|
6
|
-
|
|
7
|
-
## 步骤 0:启动准备
|
|
8
|
-
|
|
9
|
-
确定变更名:用 Glob 搜索 `.harness/changes/*/plans/*-plan.md`(**排除 `.harness/archive/*/`**),读取 frontmatter 提取 `change-name`。默认最多一个未归档变更;如有多个,优先取最近修改的,或用 AskUserQuestion 询问用户。
|
|
10
|
-
|
|
11
|
-
如果 `$ARGUMENTS` 非空且与检测到的变更名不一致,以 `$ARGUMENTS` 为准。
|
|
12
|
-
|
|
13
|
-
**读取 worktree 状态并切换**:读 `.harness/changes/<change-name>/meta/worktree.json`(旧路径 `worktree.json` 兼容)。`requested=true` 且 `.claude/worktrees/<change-name>/` 已创建 → cd 到该 worktree 目录;`requested=true` 但 worktree 不存在 → 停止,提示先修复 `harness-run`,不得静默回主目录;`requested=false` → 在主目录执行。切换后检查构建配置文件(`.mvn/maven.config`、`settings-*.xml` 等)是否完整,缺失时从主目录复制。
|
|
14
|
-
|
|
15
|
-
**强制前置检查 — harness-test(硬门禁)和 harness-review(参考性)**:
|
|
16
|
-
|
|
17
|
-
通过 Glob 检查:
|
|
18
|
-
- `.harness/changes/<change-name>/reports/test/test-report-*.md` 是否存在(旧路径 `tests/` 兼容)
|
|
19
|
-
- `.harness/changes/<change-name>/reports/review/review-report-*.md` 是否存在(参考性,不阻塞;旧路径 `reviews/` 兼容)
|
|
20
|
-
|
|
21
|
-
如果缺失 test 报告,使用 `AskUserQuestion` 询问用户:
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
检测到 harness-test 尚未运行(缺少测试报告):
|
|
25
|
-
- 测试报告: <存在/缺失>
|
|
26
|
-
- 审查报告: <存在/缺失>(参考性,不阻塞)
|
|
27
|
-
|
|
28
|
-
打包前建议先运行测试。请选择:
|
|
29
|
-
1. 先运行 harness-test — 退出 package 流程,运行 harness-test 后再 package(推荐)
|
|
30
|
-
2. 跳过测试继续打包 — 风险自担,报告中明确标记
|
|
31
|
-
3. 取消 package
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
**默认不跳过 test**。用户确认跳过时,必须在执行日志和 package-report 中明确写明:
|
|
35
|
-
- 执行日志:`- **跳过**: 用户确认跳过 harness-test`
|
|
36
|
-
- package-report:`> ⚠️ 用户确认跳过 harness-test,打包结果未经测试验证`
|
|
37
|
-
|
|
38
|
-
**review 报告**:如果存在,记录路径和摘要供参考;如果不存在,不阻塞 package。review 结果不作为硬门禁。
|
|
39
|
-
|
|
40
|
-
**读取 verification-ledger + 确定 baseCommit**:
|
|
41
|
-
|
|
42
|
-
1. 读取 `.harness/changes/<change-name>/evidence/verification-ledger.json`(旧路径 `verification-ledger.json` 兼容),记录 `unitTest`/`apiTest` 的 status、`diffHash`、`currentHead`
|
|
43
|
-
2. 确定 `baseCommit`:优先取 `.harness/changes/<change-name>/logs/execution-log.md` 中 harness-submit 阶段的 `final pushed hash`(旧路径 `execution-log.md` 兼容);无 submit 记录时取当前 `git rev-parse HEAD`
|
|
44
|
-
3. 判断 ledger 是否有效(全部满足才算有效):
|
|
45
|
-
- `unitTest.status=OK` 且 `apiTest.status=OK`
|
|
46
|
-
- `diffHash` 与当前提交一致
|
|
47
|
-
- submit 后无新提交(`git log <baseCommit>..HEAD` 为空)
|
|
48
|
-
- 无行为性 post-test 修改(`postTestClassification` ∈ {无, NON_BEHAVIORAL_CLEANUP, COMMENT_ONLY, TEST_ONLY})
|
|
49
|
-
4. ledger 有效 → 默认 `mvn package -DskipTests` 复用测试;ledger 无效 → 带测试打包或要求先跑 `/harness-test`
|
|
50
|
-
|
|
51
|
-
**append `phase.start`**(含 worktree/baseCommit/ledger 摘要于 `note`):
|
|
52
|
-
|
|
53
|
-
```powershell
|
|
54
|
-
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase package --type phase.start --note "<触发指令>"
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## 步骤 1:拉取最新代码
|
|
58
|
-
|
|
59
|
-
> **分支名自动读取**:不硬编码 `master` 或 `main`,使用 `git rev-parse --abbrev-ref @{u}` 自动读取 upstream 分支。
|
|
60
|
-
|
|
61
|
-
合并他人提交,确保打包基于最新代码:
|
|
62
|
-
|
|
63
|
-
```powershell
|
|
64
|
-
# 0. 自动读取当前分支的 upstream
|
|
65
|
-
powershell.exe -Command "git -C '<项目路径>' rev-parse --abbrev-ref @{u}"
|
|
66
|
-
# 输出示例:origin/master 或 origin/develop
|
|
67
|
-
|
|
68
|
-
# 1. 暂存当前变更
|
|
69
|
-
powershell.exe -Command "git -C '<项目路径>' stash"
|
|
70
|
-
|
|
71
|
-
# 2. 拉取远程最新代码(使用读取到的 upstream)
|
|
72
|
-
powershell.exe -Command "git -C '<项目路径>' pull"
|
|
73
|
-
|
|
74
|
-
# 3. 恢复暂存的变更
|
|
75
|
-
powershell.exe -Command "git -C '<项目路径>' stash pop"
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
**冲突处理**:
|
|
79
|
-
- `git stash pop` 产生冲突 → **停止打包流程**,提示用户手动解决冲突
|
|
80
|
-
- `git pull` 失败(网络问题)→ 提示用户检查网络,询问是否继续(基于本地代码打包)
|
|
81
|
-
- 无冲突 → 继续步骤 2
|
|
82
|
-
|
|
83
|
-
**Shell 安全规则(强制)**:
|
|
84
|
-
- 如果 `git stash` / `git pull` 命令被 hook 拒绝(输出含 `Denied` / `PreToolUse:Bash hook error`),**必须停止流程**或重试 PowerShell 调用
|
|
85
|
-
- **不得基于被拒绝的输出继续后续步骤**(不能假装"拉取成功")
|
|
86
|
-
- 拉取成功的判断证据:git 输出包含 `Already up to date.` 或 `Fast-forward`、`Updating <hash>..<hash>`,且 exit code 为 0
|
|
87
|
-
|
|
88
|
-
## 步骤 2:合并后重新验证(ledger 复用优先)
|
|
89
|
-
|
|
90
|
-
合并后必须重新编译;测试是否重跑按 ledger 有效性决定。
|
|
91
|
-
|
|
92
|
-
**ledger 有效时**(步骤 0 已判定):跳过 `mvn test`,仅执行 `mvn compile` 确认合并后可编译,测试结果复用 ledger。
|
|
93
|
-
|
|
94
|
-
**ledger 无效时**:执行 `mvn compile` + `mvn test`,结果写回 ledger。
|
|
95
|
-
|
|
96
|
-
**合并后重新验证前,先检查依赖模块**:
|
|
97
|
-
```powershell
|
|
98
|
-
# 检查上游依赖模块是否已 install 到本地仓库
|
|
99
|
-
powershell.exe -Command "Test-Path '$env:USERPROFILE\.m2\repository\<group-path>\<module>\*\*.jar'"
|
|
100
|
-
```
|
|
101
|
-
如果缺失,先安装:
|
|
102
|
-
```powershell
|
|
103
|
-
powershell.exe -Command "mvn install -pl <upstream-modules> -am -DskipTests -nsu"
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
```powershell
|
|
107
|
-
# 编译验证(始终执行)
|
|
108
|
-
powershell.exe -Command "mvn compile -pl <module> -am"
|
|
109
|
-
|
|
110
|
-
# 测试验证(仅 ledger 无效或用户要求 package-with-tests 时执行)
|
|
111
|
-
powershell.exe -Command "mvn test -pl <module> -am"
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**编译/测试成功必须有明确证据**:
|
|
115
|
-
- `mvn compile` 输出必须包含 `BUILD SUCCESS`
|
|
116
|
-
- `mvn test` 输出必须包含 `Tests run: N, Failures: 0, Errors: 0`
|
|
117
|
-
- 命令被 hook 拒绝或 exit code 非 0 → 标记为 ❌ 失败,停止流程
|
|
118
|
-
|
|
119
|
-
**pull 后远程变更检查**:
|
|
120
|
-
```powershell
|
|
121
|
-
# 检查 pull 是否引入了他人提交
|
|
122
|
-
powershell.exe -Command "git -C '<项目路径>' log HEAD@{1}..HEAD --oneline"
|
|
123
|
-
```
|
|
124
|
-
- 如果有他人提交(输出非空),**ledger 失效**,必须重新 compile + test,即使 pull 前已验证过
|
|
125
|
-
- 如果没有他人提交(输出为空),ledger 仍然有效,可基于已有验证结果继续
|
|
126
|
-
|
|
127
|
-
**验证失败处理**:
|
|
128
|
-
- 编译失败 → 分析是否与本次变更相关。相关则修复后重试;无关(他人引入的问题)则记录并询问用户是否继续
|
|
129
|
-
- 测试失败 → 分析失败原因。如果是他人代码破坏了本次功能,记录冲突点并提示用户
|
|
130
|
-
|
|
131
|
-
> **为什么合并后必须重新编译**:他人代码可能引入新依赖(编译失败)、修改公共接口(调用点断裂)、修改数据库结构(测试数据不匹配)。即使 git 自动合并无冲突,语义层面可能存在冲突。ledger 复用仅在 pull 未引入他人提交时成立。
|
|
132
|
-
|
|
133
|
-
## 步骤 3:变更模块识别
|
|
134
|
-
|
|
135
|
-
**变更模块识别必须区分四种来源,不得把远程他人变更误判为本次变更**:
|
|
136
|
-
|
|
137
|
-
| 来源 | git 命令 | 用途 |
|
|
138
|
-
|------|---------|------|
|
|
139
|
-
| a. 本地未提交变更(工作区) | `git diff --name-only` | 当前正在编辑但未 add 的变更 |
|
|
140
|
-
| b. staged 变更 | `git diff --cached --name-only` | 已 add 但未 commit 的变更 |
|
|
141
|
-
| c. 已提交但未推送变更 | `git log @{u}..HEAD --name-only --pretty=format:` | 本次开发的本地提交 |
|
|
142
|
-
| d. 远程 pull 进来的他人变更 | `git log HEAD@{1}..HEAD --name-only --pretty=format:` | pull 引入的他人提交,**不得纳入本次变更模块** |
|
|
143
|
-
|
|
144
|
-
**识别本次变更模块的标准来源**:
|
|
145
|
-
- 本次开发涉及的变更 = a + b + c(工作区 + staged + 本地未推送提交)
|
|
146
|
-
- 远程 pull 进来的 d 是他人变更,仅作为"合并验证"对象,不写入本次打包变更模块清单
|
|
147
|
-
|
|
148
|
-
1. **确定本次变更比较基线**:使用 upstream(不硬编码 master/main):
|
|
149
|
-
|
|
150
|
-
```powershell
|
|
151
|
-
# 自动读取 upstream 名称
|
|
152
|
-
powershell.exe -Command "git -C '<项目路径>' rev-parse --abbrev-ref @{u}"
|
|
153
|
-
# 输出示例:origin/master
|
|
154
|
-
|
|
155
|
-
# 计算 merge-base
|
|
156
|
-
powershell.exe -Command "git -C '<项目路径>' merge-base HEAD '@{u}'"
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
2. **获取本次变更文件列表(排除 pull 进来的他人变更)**:
|
|
160
|
-
|
|
161
|
-
```powershell
|
|
162
|
-
# 获取本地未提交+本地已提交(不含远程拉入的他人提交)
|
|
163
|
-
powershell.exe -Command "git -C '<项目路径>' diff '@{u}'...HEAD --name-only"
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
> 注意 `...HEAD`(三点)会自动排除从 upstream 合并进来的他人提交,只保留本地分叉后的变更。
|
|
167
|
-
|
|
168
|
-
3. **映射到 Maven 模块**:逐个检查变更文件的路径,判断其所属的 Maven 模块:
|
|
169
|
-
- 找到变更文件所在目录及其父目录中的 `pom.xml`
|
|
170
|
-
- 模块路径 = `pom.xml` 所在目录的相对路径(如 `module-a/sub-module-b`)
|
|
171
|
-
- 同一模块的多个变更文件只记录一次
|
|
172
|
-
- 根目录 `pom.xml` 的变更属于父项目本身(用根路径 `.` 表示)
|
|
173
|
-
|
|
174
|
-
4. **识别依赖链**:对每个变更模块,检查哪些其他模块依赖它:
|
|
175
|
-
- 扫描其他模块的 `pom.xml` 中 `<dependency>` 引用了变更模块的 `<groupId>:<artifactId>`
|
|
176
|
-
- 这些下游模块也需要打包(对应 Maven `-amd` 参数)
|
|
177
|
-
- 上游依赖模块(变更模块自身依赖的模块)由 `-am` 自动包含
|
|
178
|
-
|
|
179
|
-
5. **输出模块清单**:汇总所有变更模块 + 依赖链涉及模块,展示给用户:
|
|
180
|
-
|
|
181
|
-
```markdown
|
|
182
|
-
## 变更模块识别结果
|
|
183
|
-
|
|
184
|
-
### 直接变更模块 (N 个)
|
|
185
|
-
- `module-a` — 变更文件: 5 (src/main/java/..., src/main/resources/...)
|
|
186
|
-
- `module-b/sub-b` — 变更文件: 2
|
|
187
|
-
|
|
188
|
-
### 依赖链涉及模块
|
|
189
|
-
- 上游(-am): parent-pom, module-common
|
|
190
|
-
- 下游(-amd): module-web (依赖 module-a)
|
|
191
|
-
|
|
192
|
-
### 未变更模块(将跳过)
|
|
193
|
-
- module-c, module-d
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
## 步骤 4:打包模式选择
|
|
197
|
-
|
|
198
|
-
使用 AskUserQuestion 向用户展示选项:
|
|
199
|
-
|
|
200
|
-
```markdown
|
|
201
|
-
已识别 N 个变更模块及其依赖链,请选择打包模式:
|
|
202
|
-
|
|
203
|
-
1. 增量打包 — 只打包变更模块 + 上游依赖(-pl <modules> -am)
|
|
204
|
-
适用:日常发版,构建速度快
|
|
205
|
-
命令:mvn package -pl module-a,module-b/sub-b -am
|
|
206
|
-
|
|
207
|
-
2. 增量打包(含下游) — 打包变更模块 + 上游 + 下游(-pl <modules> -am -amd)
|
|
208
|
-
适用:需要验证下游模块兼容性
|
|
209
|
-
|
|
210
|
-
3. 全量打包 — 打包所有模块
|
|
211
|
-
适用:首次发版、重大重构、不确定依赖关系时
|
|
212
|
-
命令:mvn package
|
|
213
|
-
|
|
214
|
-
4. 自定义 — 手动指定模块列表
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
降级策略:用户无明确偏好时,默认选择选项 1(增量打包 + 上游依赖)。
|
|
218
|
-
|
|
219
|
-
## 步骤 5:执行打包
|
|
220
|
-
|
|
221
|
-
根据步骤 4 的选择构建 Maven 命令。**是否带 `-DskipTests` 由 ledger 有效性决定**:
|
|
222
|
-
|
|
223
|
-
**ledger 有效时(默认)**:复用 test 阶段验证,跳过测试
|
|
224
|
-
|
|
225
|
-
```powershell
|
|
226
|
-
# 增量打包(选项 1)
|
|
227
|
-
powershell.exe -Command "mvn package -pl <module-list> -am -DskipTests"
|
|
228
|
-
# 增量打包含下游(选项 2)
|
|
229
|
-
powershell.exe -Command "mvn package -pl <module-list> -am -amd -DskipTests"
|
|
230
|
-
# 全量打包(选项 3)
|
|
231
|
-
powershell.exe -Command "mvn package -DskipTests"
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
**ledger 无效时或用户要求 package-with-tests**:去掉 `-DskipTests`
|
|
235
|
-
|
|
236
|
-
```powershell
|
|
237
|
-
powershell.exe -Command "mvn package -pl <module-list> -am"
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
**关键规则**:
|
|
241
|
-
- **ledger 有效时默认 `-DskipTests`**,复用 test 阶段的 unitTest + apiTest 结果(不是"跳过测试",是"复用已验证结果")
|
|
242
|
-
- ledger 无效 / 用户要求 `package-with-tests` / test 报告缺失 → 必须带测试打包
|
|
243
|
-
- `-pl` 中的模块路径使用相对于根 pom.xml 的路径,多模块用逗号分隔
|
|
244
|
-
- 记录开始时间用于计算耗时
|
|
245
|
-
- 打包失败时**立即停止**,不继续后续步骤,转入错误处理
|
|
246
|
-
|
|
247
|
-
**失败处理**:
|
|
248
|
-
- 输出失败模块名称和错误信息
|
|
249
|
-
- 提示用户检查:
|
|
250
|
-
1. 依赖是否完整(是否需要先 `mvn install` 安装上游模块)
|
|
251
|
-
2. 版本冲突(参考 `reference.md` 常见问题)
|
|
252
|
-
3. 编译错误(是否遗漏了某个变更文件)
|
|
253
|
-
- 用 AskUserQuestion 询问用户:重试 / 调整模块范围 / 停止
|
|
254
|
-
|
|
255
|
-
## 步骤 6:结果收集
|
|
256
|
-
|
|
257
|
-
打包成功后,逐模块扫描产物(**必须通过 Glob 实际扫描确认,不能仅根据 Maven 输出猜测**):
|
|
258
|
-
|
|
259
|
-
1. **扫描 target/ 目录**:对每个打包模块,用 **Glob 工具实际扫描**:
|
|
260
|
-
|
|
261
|
-
```
|
|
262
|
-
<module-path>/target/*.jar
|
|
263
|
-
<module-path>/target/*.war
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
2. **收集信息**(基于 Glob 实际返回的文件):
|
|
267
|
-
- 产物文件名
|
|
268
|
-
- 产物相对路径(相对于项目根目录)
|
|
269
|
-
- 文件大小(用 `powershell.exe -Command "Get-Item '<path>' | Select-Object Length"` 获取)
|
|
270
|
-
- **sha256**(必填,用于 ledger 和部署校验:`powershell.exe -Command "Get-FileHash '<path>' -Algorithm SHA256"`)
|
|
271
|
-
|
|
272
|
-
3. **构建状态判定(必须基于实际证据)**:
|
|
273
|
-
- ✅ SUCCESS — Glob 扫描确认 target/ 中存在预期的 jar/war 文件 + Maven 输出含 `BUILD SUCCESS`
|
|
274
|
-
- 🟡 SKIPPED — 模块不含主产物(如 parent-pom 模块只有 pom.xml)
|
|
275
|
-
- ❌ FAILED — 打包命令报错(已在步骤 5 处理)/ Glob 扫描未找到产物 / Maven 输出含 `BUILD FAILURE`
|
|
276
|
-
|
|
277
|
-
4. **汇总产物表**:
|
|
278
|
-
|
|
279
|
-
```markdown
|
|
280
|
-
| 模块 | 产物 | 路径 | 大小 | 状态 |
|
|
281
|
-
|------|------|------|------|------|
|
|
282
|
-
| module-a | xxx-service.jar | module-a/target/xxx-service-1.0.jar | 12.5 MB | ✅ SUCCESS |
|
|
283
|
-
| module-web | xxx-web.war | module-web/target/xxx-web-1.0.war | 45.2 MB | ✅ SUCCESS |
|
|
284
|
-
| parent-pom | — | — | — | 🟡 SKIPPED |
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
## 步骤 7:持久化报告 + 写回 ledger
|
|
288
|
-
|
|
289
|
-
将打包报告写入 `.harness/changes/<change-name>/reports/package/package-report-YYYYMMDD-HHmm.md`。
|
|
290
|
-
|
|
291
|
-
时间戳取当前时间,格式 `YYYYMMDD-HHmm`(如 `20260617-1430`)。
|
|
292
|
-
|
|
293
|
-
报告内容格式见 `reference.md` 的"报告格式示例"。报告必须包含「测试执行策略」段落(见 reference.md)。
|
|
294
|
-
|
|
295
|
-
**写回 `evidence/verification-ledger.json` 的 `package` 项**:
|
|
296
|
-
|
|
297
|
-
```json
|
|
298
|
-
"package": {
|
|
299
|
-
"status": "OK",
|
|
300
|
-
"command": "mvn package -pl <module> -am -DskipTests",
|
|
301
|
-
"baseCommit": "<final pushed hash 或当前 HEAD>",
|
|
302
|
-
"deployArtifact": "<module>/target/<artifact>.jar",
|
|
303
|
-
"sha256": "<artifact sha256>",
|
|
304
|
-
"testsExecuted": false,
|
|
305
|
-
"testsReusedFrom": "unitTest+apiTest",
|
|
306
|
-
"evidence": "BUILD SUCCESS + Glob 扫描确认 jar 存在",
|
|
307
|
-
"startedAt": "...",
|
|
308
|
-
"finishedAt": "...",
|
|
309
|
-
"durationMs": 0
|
|
310
|
-
}
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
- `testsExecuted`:本次 package 是否真实跑了测试(ledger 有效且用了 `-DskipTests` → false)
|
|
314
|
-
- `testsReusedFrom`:`testsExecuted=false` 时必须指明复用来源(`unitTest+apiTest`)
|
|
315
|
-
|
|
316
|
-
## 步骤 8:events 结束
|
|
317
|
-
|
|
318
|
-
**append `phase.complete`**(`note` 含 baseCommit/打包策略/结果/报告路径):
|
|
319
|
-
|
|
320
|
-
```powershell
|
|
321
|
-
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase package --type phase.complete --note "OK|WARN|FAIL — <摘要>"
|
|
322
|
-
```
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: harness-package 的Maven打包参数速查、增量vs全量对比、常见问题处理和报告格式示例。仅在需要参考参数细节或处理问题时读取。
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# harness-package 参考 — 参数、问题与格式
|
|
6
|
-
|
|
7
|
-
## Maven 打包参数速查
|
|
8
|
-
|
|
9
|
-
| 参数 | 说明 | 示例 |
|
|
10
|
-
|------|------|------|
|
|
11
|
-
| `-pl <modules>` | 指定构建模块列表(逗号分隔) | `-pl module-a,module-b/sub-b` |
|
|
12
|
-
| `-am` | 同时构建指定模块的上游依赖(Also Make) | `-pl module-a -am` |
|
|
13
|
-
| `-amd` | 同时构建依赖指定模块的下游模块(Also Make Dependents) | `-pl module-a -amd` |
|
|
14
|
-
| `-DskipTests` | 跳过测试执行(**ledger 有效时默认使用**,复用 test 阶段验证) | `mvn package -DskipTests` |
|
|
15
|
-
| `-Dmaven.test.skip=true` | 跳过测试编译和执行(更激进,连测试代码都不编译) | 不推荐使用 |
|
|
16
|
-
| `-T 4` | 并行构建,4个线程 | `mvn package -T 4` |
|
|
17
|
-
| `-o` | 离线模式(不从远程仓库下载) | `mvn package -o` |
|
|
18
|
-
| `-DfinalName=<name>` | 指定最终产物名称 | `-DfinalName=my-app` |
|
|
19
|
-
| `--batch-mode` | 非交互模式(CI 场景) | `mvn package --batch-mode` |
|
|
20
|
-
|
|
21
|
-
## 可选配置(package 时序与测试策略)
|
|
22
|
-
|
|
23
|
-
在 `.harness/config/harness-test-config.md` 中可配置 package 行为:
|
|
24
|
-
|
|
25
|
-
```yaml
|
|
26
|
-
package:
|
|
27
|
-
preferred-order: after-submit # 默认:package 在 submit 之后运行
|
|
28
|
-
allow-before-submit: true # 允许发版前打包(submit 之前);false 时 package 启动检查 submit 是否已运行
|
|
29
|
-
reuse-ledger-tests: true # 默认:ledger 有效时用 -DskipTests 复用 test 阶段验证
|
|
30
|
-
force-with-tests: false # 强制带测试打包(等同 package-with-tests)
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
- `preferred-order: after-submit`:package 的 `baseCommit` 取 submit 日志的 final pushed hash
|
|
34
|
-
- `allow-before-submit: true`:允许在 submit 之前运行 package,此时 `baseCommit` 为当前 HEAD;submit 后若 pull 引入新提交,须重新 package
|
|
35
|
-
- `reuse-ledger-tests: true`:ledger 有效时默认 `-DskipTests`,报告标明复用来源;ledger 无效时自动改为带测试打包
|
|
36
|
-
|
|
37
|
-
> 未配置时使用上述默认值。
|
|
38
|
-
|
|
39
|
-
## 增量 vs 全量对比
|
|
40
|
-
|
|
41
|
-
| 维度 | 增量打包 | 全量打包 |
|
|
42
|
-
|------|----------|----------|
|
|
43
|
-
| **命令** | `mvn package -pl <modules> -am` | `mvn package` |
|
|
44
|
-
| **适用场景** | 日常发版、局部变更、迭代开发 | 首次发版、重大重构、不确定依赖关系 |
|
|
45
|
-
| **构建范围** | 变更模块 + 上游依赖 | 所有模块 |
|
|
46
|
-
| **构建速度** | 快(只构建相关模块) | 慢(全量构建) |
|
|
47
|
-
| **风险** | 可能遗漏间接依赖 | 无遗漏风险 |
|
|
48
|
-
| **产物数量** | 只产出相关模块的 jar/war | 产出所有模块的 jar/war |
|
|
49
|
-
| **推荐优先级** | 首选(默认模式) | 增量失败时的降级方案 |
|
|
50
|
-
|
|
51
|
-
**何时选择全量**:
|
|
52
|
-
- 首次部署或项目初始化
|
|
53
|
-
- pom.xml 结构发生重大变更
|
|
54
|
-
- 依赖关系不确定或增量打包出现版本冲突
|
|
55
|
-
- 用户明确要求全量构建
|
|
56
|
-
|
|
57
|
-
## 常见问题处理
|
|
58
|
-
|
|
59
|
-
| 问题 | 原因 | 处理方法 |
|
|
60
|
-
|------|------|----------|
|
|
61
|
-
| **合并冲突** | 他人代码与本次变更有重叠 | 停止打包流程,提示用户手动解决冲突后重新运行 |
|
|
62
|
-
| **合并后编译失败** | 他人代码引入新依赖或修改公共接口 | 分析错误是否与本次变更相关,相关则修复,无关则记录并询问用户 |
|
|
63
|
-
| **合并后测试失败** | 他人代码破坏了本次功能 | 记录冲突点,提示用户协调解决 |
|
|
64
|
-
| **打包失败:找不到依赖** | 上游模块未安装到本地仓库 | 先执行 `mvn install -pl <upstream> -am`,再打包 |
|
|
65
|
-
| **打包失败:版本冲突** | 同一依赖多个版本,SNAPSHOT 冲突 | 检查 pom.xml 版本号,统一版本;或用 `-DallowConflictingSnapshots=true` |
|
|
66
|
-
| **打包失败:编译错误** | 变更文件有语法错误或类型不匹配 | 先执行 `mvn compile` 定位错误,修复后重新打包 |
|
|
67
|
-
| **打包失败:测试失败** | 单元测试或集成测试报错 | 检查测试日志,修复测试或用户确认后加 `-DskipTests` |
|
|
68
|
-
| **打包失败:离线依赖缺失** | `-o` 模式下本地仓库缺少依赖 | 去掉 `-o`,加 `-nsu` 联网下载(见 `.claude/rules/maven-offline.md`) |
|
|
69
|
-
| **target/ 目录不存在** | 模块未被打包命令包含 | 检查 `-pl` 参数是否遗漏该模块,或改用全量打包 |
|
|
70
|
-
| **增量打包遗漏产物** | `-am` 未包含足够的上游模块 | 检查依赖链,补充遗漏模块到 `-pl` 列表,或改用全量打包 |
|
|
71
|
-
| **parent-pom 模块无 jar 产物** | 父 pom 模块只做依赖管理,不生成 jar | 正常行为,状态标记为 SKIPPED |
|
|
72
|
-
| **war 包过大** | 包含了不必要的依赖或资源 | 检查 pom.xml 的依赖范围(scope),排除 provided/test 依赖 |
|
|
73
|
-
| **并行构建报错** | 模块间存在循环依赖或线程竞争 | 去掉 `-T` 参数,改用串行构建 |
|
|
74
|
-
|
|
75
|
-
**依赖缺失的典型解决流程**:
|
|
76
|
-
|
|
77
|
-
```powershell
|
|
78
|
-
# 1. 先安装所有上游依赖到本地仓库
|
|
79
|
-
powershell.exe -Command "mvn install -pl module-common,module-parent -am"
|
|
80
|
-
|
|
81
|
-
# 2. 再对变更模块执行增量打包
|
|
82
|
-
powershell.exe -Command "mvn package -pl module-a -am"
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## 报告格式示例
|
|
86
|
-
|
|
87
|
-
```markdown
|
|
88
|
-
---
|
|
89
|
-
change-name: user-auth-feature
|
|
90
|
-
package-mode: incremental
|
|
91
|
-
generated-at: 2026-06-17 14:30:00
|
|
92
|
-
base-commit: abc1234
|
|
93
|
-
base-commit-source: submit final pushed hash
|
|
94
|
-
maven-command: mvn package -pl module-auth,module-api -am -DskipTests
|
|
95
|
-
tests-executed: false
|
|
96
|
-
tests-reused-from: unitTest+apiTest
|
|
97
|
-
ledger-diff-hash: sha256:...
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
# 打包报告 — user-auth-feature
|
|
101
|
-
|
|
102
|
-
## 打包概要
|
|
103
|
-
|
|
104
|
-
| 项目 | 值 |
|
|
105
|
-
|------|-----|
|
|
106
|
-
| 变更名 | user-auth-feature |
|
|
107
|
-
| 打包模式 | 增量(-pl + -am) |
|
|
108
|
-
| Maven 命令 | `mvn package -pl module-auth,module-api -am -DskipTests` |
|
|
109
|
-
| 基准 commit | abc1234(来源:submit final pushed hash) |
|
|
110
|
-
| 开始时间 | 2026-06-17 14:25:00 |
|
|
111
|
-
| 结束时间 | 2026-06-17 14:30:00 |
|
|
112
|
-
| 构建耗时 | 5分0秒 |
|
|
113
|
-
| 构建结果 | SUCCESS |
|
|
114
|
-
|
|
115
|
-
## 测试执行策略
|
|
116
|
-
|
|
117
|
-
- package 本次是否执行 tests: **否**(`-DskipTests`)
|
|
118
|
-
- 复用来源: verification-ledger 的 `unitTest` + `apiTest`(status=OK)
|
|
119
|
-
- ledger diffHash: sha256:...
|
|
120
|
-
- 复用成立条件: diffHash 一致 + submit 后无新提交 + 无行为性 post-test 修改
|
|
121
|
-
- 若 ledger 无效: 改为"是(带测试打包)"并说明原因(test 未跑 / diffHash 不一致 / submit 后有新提交 / 行为性 post-test 修改)
|
|
122
|
-
|
|
123
|
-
## 变更模块
|
|
124
|
-
|
|
125
|
-
### 直接变更模块 (2 个)
|
|
126
|
-
|
|
127
|
-
| 模块 | 变更文件数 | 变更类型 |
|
|
128
|
-
|------|-----------|----------|
|
|
129
|
-
| module-auth | 5 | 新增+修改 |
|
|
130
|
-
| module-api | 2 | 修改 |
|
|
131
|
-
|
|
132
|
-
### 依赖链模块
|
|
133
|
-
|
|
134
|
-
| 类型 | 模块 |
|
|
135
|
-
|------|------|
|
|
136
|
-
| 上游依赖 (-am) | parent-pom, module-common |
|
|
137
|
-
| 下游依赖 (-amd) | 未包含 |
|
|
138
|
-
|
|
139
|
-
## 产物清单
|
|
140
|
-
|
|
141
|
-
| 模块 | 产物文件名 | 相对路径 | 大小 | 状态 |
|
|
142
|
-
|------|-----------|----------|------|------|
|
|
143
|
-
| module-auth | auth-service-1.0.0.jar | module-auth/target/auth-service-1.0.0.jar | 12.5 MB | SUCCESS |
|
|
144
|
-
| module-api | api-model-1.0.0.jar | module-api/target/api-model-1.0.0.jar | 3.2 MB | SUCCESS |
|
|
145
|
-
| module-common | common-utils-1.0.0.jar | module-common/target/common-utils-1.0.0.jar | 8.1 MB | SUCCESS |
|
|
146
|
-
| parent-pom | — | — | — | SKIPPED |
|
|
147
|
-
|
|
148
|
-
**产物总计**: 3 个 jar, 总大小 23.8 MB
|
|
149
|
-
|
|
150
|
-
## 构建日志摘要
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
[INFO] Reactor Build Order:
|
|
154
|
-
parent-pom .................................. SKIPPED
|
|
155
|
-
module-common ................................ SUCCESS [8.1s]
|
|
156
|
-
module-api ................................... SUCCESS [3.2s]
|
|
157
|
-
module-auth .................................. SUCCESS [12.5s]
|
|
158
|
-
[INFO] BUILD SUCCESS
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## 部署建议
|
|
162
|
-
|
|
163
|
-
- 部署顺序:common-utils → api-model → auth-service(按依赖顺序)
|
|
164
|
-
- 注意:auth-service 依赖 common-utils 和 api-model,确保目标环境已有这两个依赖
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## 变更模块识别方法
|
|
168
|
-
|
|
169
|
-
### 方法 1:git diff + pom.xml 映射(推荐)
|
|
170
|
-
|
|
171
|
-
```powershell
|
|
172
|
-
# 1. 获取基准 commit
|
|
173
|
-
powershell.exe -Command "git -C '<项目路径>' merge-base HEAD origin/master"
|
|
174
|
-
|
|
175
|
-
# 2. 获取变更文件列表
|
|
176
|
-
powershell.exe -Command "git -C '<项目路径>' diff <base-commit> --name-only"
|
|
177
|
-
|
|
178
|
-
# 3. 对每个变更文件,向上查找 pom.xml 所在目录
|
|
179
|
-
# 变更文件: module-a/src/main/java/com/example/Service.java
|
|
180
|
-
# → pom.xml 在: module-a/pom.xml
|
|
181
|
-
# → 模块路径: module-a
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### 方法 2:git diff + Maven Reactor 映射
|
|
185
|
-
|
|
186
|
-
```powershell
|
|
187
|
-
# 1. 获取变更文件列表
|
|
188
|
-
powershell.exe -Command "git -C '<项目路径>' diff <base-commit> --name-only"
|
|
189
|
-
|
|
190
|
-
# 2. 对变更目录执行 Maven 列出模块
|
|
191
|
-
powershell.exe -Command "mvn -f <项目路径>/pom.xml help:active-profiles -pl :<module-artifactId>"
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### 依赖链识别
|
|
195
|
-
|
|
196
|
-
**上游依赖(-am)**:变更模块 pom.xml 中 `<dependencies>` 引用的同项目模块,由 Maven `-am` 参数自动处理。
|
|
197
|
-
|
|
198
|
-
**下游依赖(-amd)**:需要扫描其他模块的 pom.xml,找出 `<dependency>` 中引用了变更模块 `<groupId>:<artifactId>` 的模块:
|
|
199
|
-
|
|
200
|
-
```powershell
|
|
201
|
-
# 扫描所有子模块 pom.xml 中对变更模块的引用(使用 Grep 工具更高效)
|
|
202
|
-
Grep("<artifactId>module-a</artifactId>", "<项目路径>/", glob="**/pom.xml")
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### 边界情况
|
|
206
|
-
|
|
207
|
-
- **根 pom.xml 变更**:属于父项目,需全量打包
|
|
208
|
-
- **多模块同一变更**:合并到 `-pl` 列表,用逗号分隔
|
|
209
|
-
- **无变更文件**:提示用户确认是否需要全量打包
|
|
210
|
-
- **新增模块**:pom.xml 本身是新增文件,需全量打包确保 Reactor 顺序正确
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: harness-plan
|
|
3
|
-
description: "将需求转化为设计文档+实施计划+完整测试场景表,必须在编码前完成。使用场景:需求分析、feature plan、技术方案设计、实现方案规划"
|
|
4
|
-
argument-hint: "需求描述 | --adversarial"
|
|
5
|
-
effort: high
|
|
6
|
-
allowed-tools: [Read, Glob, Grep, Edit, Write, 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
|
-
---
|
|
23
|
-
<!-- generated by harness_deploy.py; core=47a5159f5c4b49b8; overlay=java; do not edit -->
|
|
24
|
-
# harness-plan — 需求规划
|
|
25
|
-
|
|
26
|
-
## Purpose
|
|
27
|
-
|
|
28
|
-
需求 → 设计文档 → 任务拆分 → 测试场景表(编码/测试唯一真相源)。存在 `.harness/archive/` 或 `.harness/knowledge/` 时须先 `harness-knowledge-query`。
|
|
29
|
-
|
|
30
|
-
## When to Use
|
|
31
|
-
|
|
32
|
-
`/harness-plan`、新功能设计、技术方案、测试场景表规划。
|
|
33
|
-
|
|
34
|
-
## 统一读取协议
|
|
35
|
-
|
|
36
|
-
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
37
|
-
2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
38
|
-
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
39
|
-
4. **spec** — 设计真相源:`spec/<change>-design.md`
|
|
40
|
-
5. **plan** — 任务真相源:`plans/<change>-plan.md`
|
|
41
|
-
6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
|
|
42
|
-
7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
|
|
43
|
-
8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
|
|
44
|
-
|
|
45
|
-
状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
|
|
46
|
-
|
|
47
|
-
## Worktree 门禁
|
|
48
|
-
|
|
49
|
-
读取 `meta/worktree.json`(兼容旧路径 `worktree.json`):
|
|
50
|
-
|
|
51
|
-
| 条件 | 行为 |
|
|
52
|
-
|------|------|
|
|
53
|
-
| `requested=false` | 主目录执行 |
|
|
54
|
-
| `requested=true` + path 存在 | 切换 worktree 执行 |
|
|
55
|
-
| `requested=true` + path 不存在 | **必须创建**(run)或 **停止**(test/review/submit) |
|
|
56
|
-
|
|
57
|
-
**严禁** `requested=true` 时静默回主目录。创建失败 → 停止或 AskUserQuestion 降级(须 🟡WARN + 用户确认)。
|
|
58
|
-
|
|
59
|
-
**状态与代码分离**:代码/编译/测试在 `worktreeRoot`;`stateDir`(logs/events/ledger/reports)写回 `.harness/changes/<change-name>/`。
|
|
60
|
-
|
|
61
|
-
创建命令与 JSON 模板 → 各 skill `reference.md`(plan 写决策,run 创建/更新)。
|
|
62
|
-
|
|
63
|
-
## 原生规划协议
|
|
64
|
-
|
|
65
|
-
内化为 `protocols.md`:`clarification-protocol`、`decision-grilling-protocol`、`implementation-planning-protocol`。不运行时调用 Superpowers/grill-me。
|
|
66
|
-
|
|
67
|
-
## Subagent 委派
|
|
68
|
-
|
|
69
|
-
- **阶段 3 探索**:`check-agents --agent harness-explorer` → 可用则委派,否则主会话探索;无效返回不 retry
|
|
70
|
-
- **阶段 7.5**:仅 `--adversarial`;`check-agents --agent harness-evaluator` → `reports/plan-review/`
|
|
71
|
-
|
|
72
|
-
## Workflow 概要
|
|
73
|
-
|
|
74
|
-
| 阶段 | 动作 |
|
|
75
|
-
|------|------|
|
|
76
|
-
| 0 | git status;脏工作区 → baseline 隔离 + `decision`,不询问 |
|
|
77
|
-
| 0.5 | `harness-knowledge-query`(失败记 `issue`) |
|
|
78
|
-
| 1 | 自动生成 change-name + 初始化 logs/events |
|
|
79
|
-
| 2–3 | 代码探索 + 需求澄清(高风险 → 交互白名单 ②) |
|
|
80
|
-
| 4 | **设计审批包** AskUserQuestion → 写 `spec/*-design.md` + `meta/worktree.json` |
|
|
81
|
-
| 5–6 | plan + implementation-detail + test-scenarios → `plans/` |
|
|
82
|
-
| 7.5 | 仅 `--adversarial` 对抗评审 |
|
|
83
|
-
| 8 | 产物完整性必检 → `checklist.md` |
|
|
84
|
-
|
|
85
|
-
change-name 范围变更 → 提示重命名或记 🟡WARN(→ `reference.md`)
|
|
86
|
-
|
|
87
|
-
## P0 执行可信度规则
|
|
88
|
-
|
|
89
|
-
- 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
|
|
90
|
-
- 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
|
|
91
|
-
- 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
|
|
92
|
-
|
|
93
|
-
## 关键规则
|
|
94
|
-
|
|
95
|
-
| 规则 | 要点 |
|
|
96
|
-
|------|------|
|
|
97
|
-
| 产物路径 | 只写 `.harness/changes/<cn>/`;禁止 superpowers 输入 |
|
|
98
|
-
| 设计审批包 | 一次 AskUserQuestion 含 worktree(读 `harness.json` `defaultWorktree`) |
|
|
99
|
-
| 阶段 8 | spec/plan/detail/scenarios/worktree.json/logs/events 缺一不可 → ❌FAIL |
|
|
100
|
-
| Plan 结束 | **禁止**询问执行模式;只提示 `/harness-run` |
|
|
101
|
-
| 知识查询 | 0.5 失败不得假装已读历史 |
|
|
102
|
-
| 协议 | sensitive-info / evidence-based-reporting / state-layout |
|
|
103
|
-
|
|
104
|
-
产出物表、frontmatter、legacy 兼容、结束输出模板 → `reference.md`
|
|
105
|
-
|
|
106
|
-
## 渐进披露
|
|
107
|
-
|
|
108
|
-
- **Read `checklist.md`** — 阶段检查与覆盖表
|
|
109
|
-
- **Read `protocols.md`** — 阶段 4/6 原生协议
|
|
110
|
-
- **Read `reference.md`** — 模板与 worktree JSON
|
|
111
|
-
|
|
112
|
-
## 交互白名单
|
|
113
|
-
|
|
114
|
-
1. **设计审批包**(阶段 4):设计 + 场景表 + worktree + change-name
|
|
115
|
-
2. **decision-grilling**(阶段 3 澄清):高风险业务裁决(一次一问)
|
|
116
|
-
|
|
117
|
-
## 执行日志
|
|
118
|
-
|
|
119
|
-
`events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
|
|
120
|
-
|
|
121
|
-
```powershell
|
|
122
|
-
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
> **脚本接线**:`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 护栏解读。
|
|
126
|
-
|
|
127
|
-
> **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 边界保持最新。
|