hunter-harness 0.1.0 → 0.1.2

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 (71) hide show
  1. package/dist/bin.js +1033 -219
  2. package/package.json +2 -2
  3. package/resources/harness/general/.harness-build.json +1 -1
  4. package/resources/harness/general/harness-archive/SKILL.md +215 -215
  5. package/resources/harness/general/harness-codebase-map/SKILL.md +112 -112
  6. package/resources/harness/general/harness-codebase-map/templates/map-summary.md +3 -3
  7. package/resources/harness/general/harness-knowledge-ingest/SKILL.md +246 -246
  8. package/resources/harness/general/harness-knowledge-query/SKILL.md +164 -164
  9. package/resources/harness/general/harness-plan/SKILL.md +127 -127
  10. package/resources/harness/general/harness-review/SKILL.md +156 -156
  11. package/resources/harness/general/harness-run/SKILL.md +132 -132
  12. package/resources/harness/general/harness-submit/SKILL.md +159 -159
  13. package/resources/harness/general/harness-sync/SKILL.md +82 -82
  14. package/resources/harness/general/harness-test/SKILL.md +180 -180
  15. package/resources/harness/general/scripts/harness_deploy.py +580 -580
  16. package/resources/harness/java/.harness-build.json +1 -1
  17. package/resources/harness/java/harness-apidoc/SKILL.md +86 -86
  18. package/resources/harness/java/harness-archive/SKILL.md +215 -215
  19. package/resources/harness/java/harness-codebase-map/SKILL.md +112 -112
  20. package/resources/harness/java/harness-codebase-map/templates/map-summary.md +3 -3
  21. package/resources/harness/java/harness-knowledge-ingest/SKILL.md +246 -246
  22. package/resources/harness/java/harness-knowledge-query/SKILL.md +164 -164
  23. package/resources/harness/java/harness-package/SKILL.md +87 -87
  24. package/resources/harness/java/harness-plan/SKILL.md +127 -127
  25. package/resources/harness/java/harness-review/SKILL.md +156 -156
  26. package/resources/harness/java/harness-run/SKILL.md +148 -148
  27. package/resources/harness/java/harness-submit/SKILL.md +166 -166
  28. package/resources/harness/java/harness-sync/SKILL.md +82 -82
  29. package/resources/harness/java/harness-test/SKILL.md +192 -192
  30. package/resources/harness/java/scripts/harness_deploy.py +580 -580
  31. package/resources/harness/manifests/general.json +13 -33
  32. package/resources/harness/manifests/java.json +15 -35
  33. package/resources/harness/migrations/0.1.1/general.json +358 -0
  34. package/resources/harness/migrations/0.1.1/java.json +398 -0
  35. package/resources/bootstrap-ir/manifest.json +0 -19
  36. package/resources/bootstrap-ir/skills/harness-apidoc.yaml +0 -24
  37. package/resources/bootstrap-ir/skills/harness-archive.yaml +0 -24
  38. package/resources/bootstrap-ir/skills/harness-codebase-map.yaml +0 -24
  39. package/resources/bootstrap-ir/skills/harness-knowledge-ingest.yaml +0 -24
  40. package/resources/bootstrap-ir/skills/harness-package.yaml +0 -24
  41. package/resources/bootstrap-ir/skills/harness-plan.yaml +0 -24
  42. package/resources/bootstrap-ir/skills/harness-review.yaml +0 -24
  43. package/resources/bootstrap-ir/skills/harness-run.yaml +0 -24
  44. package/resources/bootstrap-ir/skills/harness-skill-optimizer.yaml +0 -28
  45. package/resources/bootstrap-ir/skills/harness-submit.yaml +0 -24
  46. package/resources/bootstrap-ir/skills/harness-sync.yaml +0 -24
  47. package/resources/bootstrap-ir/skills/harness-test.yaml +0 -24
  48. package/resources/bootstrap-ir/templates/claude-code-skill.md +0 -12
  49. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +0 -43
  50. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-02-14-ledger-snapshot-followup/reports/final/summary-data.json +0 -38
  51. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +0 -36
  52. package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +0 -1
  53. package/resources/harness/general/harness-knowledge-ingest/tests/test_harness_knowledge.py +0 -1792
  54. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +0 -43
  55. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-02-14-ledger-snapshot-followup/reports/final/summary-data.json +0 -38
  56. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +0 -36
  57. package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +0 -1
  58. package/resources/harness/java/harness-knowledge-ingest/tests/test_harness_knowledge.py +0 -1792
  59. package/resources/manifest.json +0 -19
  60. package/resources/skills/harness-apidoc/SKILL.md +0 -50
  61. package/resources/skills/harness-archive/SKILL.md +0 -48
  62. package/resources/skills/harness-codebase-map/SKILL.md +0 -53
  63. package/resources/skills/harness-knowledge-ingest/SKILL.md +0 -48
  64. package/resources/skills/harness-package/SKILL.md +0 -48
  65. package/resources/skills/harness-plan/SKILL.md +0 -51
  66. package/resources/skills/harness-review/SKILL.md +0 -50
  67. package/resources/skills/harness-run/SKILL.md +0 -48
  68. package/resources/skills/harness-skill-optimizer/SKILL.md +0 -54
  69. package/resources/skills/harness-submit/SKILL.md +0 -47
  70. package/resources/skills/harness-sync/SKILL.md +0 -48
  71. package/resources/skills/harness-test/SKILL.md +0 -50
@@ -1,166 +1,166 @@
1
- ---
2
- name: harness-submit
3
- description: "最终提交封装:验证→中文 commit→提交/推送;worktree 模式含 --no-ff 合并回主分支。使用场景:提交代码、commit、push、合并分支、merge to main、完成开发"
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-submit — 最终提交(含 worktree 合并)
25
-
26
- ## Purpose
27
-
28
- 合并最新代码→最终验证→生成中文 commit→提交/推送;worktree 模式在本地 commit 后**自动接续** `--no-ff` 合并回主分支、push、清理 worktree,完成开发闭环。
29
-
30
- ## When to Use
31
-
32
- - 代码开发完成,准备提交
33
- - 用户说「提交代码」「commit」「push」「完成开发」
34
- - worktree 模式:用户说「合并分支」「merge to main」「合入主分支」「/harness-merge」(别名,从合并阶段重入亦可)
35
- - review 和 test 已通过或已明确跳过
36
-
37
- > **主目录模式**(`worktree.json` requested=false):commit+push 主分支后直接 `/harness-archive`。**worktree 模式**(requested=true):worktree 内仅本地 commit,随后本 skill 自动执行合并流程;**push 只在主分支发生一次**。
38
-
39
- ## 前置条件
40
-
41
- - test 已通过、无未暂存修改
42
- - 读取 `meta/worktree.json`:`requested=true` 且 worktree 已创建 → 在 worktree 目录执行提交段;不存在 → 停止并提示修复,不得静默回主目录
43
- - review 报告可读作参考,不得阻塞提交
44
-
45
- ## Inputs
46
-
47
- - `$ARGUMENTS`:变更名(可选,Glob `.harness/changes/*/plans/` 自动检测)
48
- - 相关文件:`plans/*-plan.md`、`evidence/verification-ledger.json`、`meta/worktree.json`
49
-
50
- ## 统一读取协议
51
-
52
- 1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
53
- 2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
54
- 3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
55
- 4. **spec** — 设计真相源:`spec/<change>-design.md`
56
- 5. **plan** — 任务真相源:`plans/<change>-plan.md`
57
- 6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
58
- 7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
59
- 8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
60
-
61
- 状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
62
-
63
- ## 状态目录分层
64
-
65
- 新产物遵循 `../protocols/state-layout-protocol.md`;读取时先新路径后兼容旧路径。
66
-
67
- ## Workflow
68
-
69
- **模式判定**:读 `meta/worktree.json`。`requested=false` → 步骤 0–7(主目录);`requested=true` → 步骤 0–6 在 worktree 执行,成功后**不结束**,接续「worktree 合并流程」。用户仅调用 `/harness-merge` 且 worktree 已有本地 commit 时,从合并流程步骤 M0 重入。
70
-
71
- ### 提交流程(步骤 0–7)
72
-
73
- 0. **启动准备** — 确定变更名;读 ledger + 计算 diffHash + post-test 7 类分类;append `phase.start`
74
- 1. **合并最新代码** — 主目录:`stash` → `pull --rebase` → `stash pop`;**worktree:N/A**(远端同步在合并段主分支完成)
75
- 2. **最终验证** — ledger 复用优先;**提交前最终门禁**:`harness_ledger.py can-reuse --verification unitTestFull --scope module --project . --profile-input unitTestFull --command <build-profile.json buildCommands.unitTestFull>`(`--profile-input unitTestFull` 从 `build-profile.json` 的 `verificationInputs.unitTestFull` 展开依赖闭包文件集,**禁止用仅含 staged 文件的 `--files` 快捷方式**冒充全量闭包;`<command>` 直接读 `buildCommands.unitTestFull`,不复制示例模块名)。不可复用则执行 `buildCommands.unitTestFull` 模块级全量单元测试,成功后用同一文件集、command、`scope=module` 写回 ledger 的 `unitTestFull` 项。增量 `unitTest` 永远不能冒充 `unitTestFull` 门禁。
76
- 3. **.gitignore + 暂存** ⚠️ — 检查 `.harness/` 在 `.gitignore`;**禁止 `git add -A`**
77
- 4. **提交方式** — 主目录:AskUserQuestion 三选项(commit+push / 仅本地 / 取消);**worktree:固定仅本地 commit**
78
- 5. **commit-message.txt** ⚠️ — 展示 staged、diff stat、完整中文 message;用户确认
79
- 6. **commit / push** — `git commit -F`;主目录按选项 push(push 前 fetch 检查远端);**worktree:只 commit,记录 local hash**
80
- 7. **收尾引导** — 主目录:可选 worktree 清理 + 提示 `/harness-archive`;**worktree:接续下方合并流程**
81
-
82
- 详细步骤见 `checklist.md`。
83
-
84
- ### worktree 合并流程(requested=true,commit 后自动执行)
85
-
86
- M0. append `phase.start`(phase=merge,若从 `/harness-merge` 重入则 note 标注重入)
87
- M1. **切回主目录主分支** — `symbolic-ref origin/HEAD` 读主分支名;必要时 stash;确认 checkout 主分支
88
- M2. **fetch + pull --rebase** — 记录是否引入他人提交(决定 M4 是否重跑验证)
89
- M3. **`git merge --no-ff worktree/<change-name>`** — 合并消息可让用户改文案,**方式固定 --no-ff**
90
- M4. **冲突处理** — 若 `CONFLICT` → **停下**,列出冲突文件,提示用户手动解决后重跑;**禁止 `checkout --theirs/--ours`**;状态 🟡WARN,不得宣称合并成功
91
- M5. **合并后验证** — 他人提交引入 → 必须重跑构建+测试;否则 ledger 复用 🔁REUSED
92
- M6. **push 主分支** — fetch 后 `log HEAD..@{u}` 非空则回 M2;否则 push,记录 `mergeFinalHash`
93
- M7. **清理 worktree** — `worktree remove` + `branch -D`(Windows 兜底见 `reference.md`);更新 `worktree.json`(`created=false` + removedAt 等)
94
- M8. **ledger + 收尾** — 写入 `mergeFinalHash`;append `phase.end`;提示 `/harness-archive`
95
-
96
- ### Java 提交前验证补充
97
-
98
- 通用 `harness-submit` 的最终门禁已统一为 `unitTestFull`(见通用 SKILL.md 步骤 2 / checklist 步骤 2)。Java overlay **不重复定义门禁规则**,只补两点:
99
-
100
- - **Maven 命令来源**:`--command` 取 `build-profile.json` 的 `buildCommands.unitTestFull`,典型 `mvn test -pl <module> -o`。`mvn test` 不带 `-Dtest=` 即模块级全量 → 记 `scope=module` 可复用;带 `-Dtest=<类>` 是增量 `unitTest`,**不能**冒充 `unitTestFull`。
101
- - **Java 依赖闭包**:`verificationInputs.unitTestFull` 必须覆盖完整编译+测试依赖闭包,建议 `["pom.xml", "<module>/pom.xml", "<module>/src/main/**", "<module>/src/test/**"]`,避免只哈希 staged 文件而漏掉 pom 依赖变化导致误复用。`harness_preflight.py detect` 对单模块项目写入根级默认 `["pom.xml", "src/main/**", "src/test/**"]`,多模块项目需手工改为 module 专属 glob。
102
- - **可选 package 前置**:若团队发版前需 jar 验证,在 submit 后接 `/harness-package`(默认时序 submit → package → archive)
103
- ## P0 执行可信度规则
104
-
105
- - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
106
- - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
107
- - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
108
-
109
- ## 关键规则(硬门禁速查)
110
-
111
- > 细则见 `checklist.md`、`reference.md` 与各 protocol。
112
-
113
- ### 一、提交方式固定三选项(主目录)
114
-
115
- commit+push / 仅本地 commit / 取消;**不调用 Superpowers 呈现 PR/丢弃选项**。
116
-
117
- ### 二、中文 commit 永远用文件
118
-
119
- `.harness/changes/<change>/runtime/commit-message.txt` + `git commit -F`;禁止 amend 英文、禁止 `--no-verify`、禁止 AI footer。
120
-
121
- ### 三、.gitignore / 远程新提交 / ledger 复用
122
-
123
- 见 `checklist.md` 与 `../protocols/ledger-protocol.md`、`../protocols/submit-protocol.md`。
124
-
125
- ### 四、worktree 合并硬规则
126
-
127
- - **push 只在主分支**;worktree 分支不 push
128
- - **`git merge --no-ff` 固定**;禁止 fast-forward
129
- - **冲突不自动解** → 停下 → 用户手动解 → 确认后继续
130
- - **`mergeFinalHash`** = 主分支 push 后 HEAD;archive 优先读此字段
131
-
132
- ### 五、Shell 安全 / 敏感信息 / 证据化
133
-
134
- git 经 PowerShell;commit/报告不得含明文密钥。遵循 `../protocols/sensitive-info-protocol.md`、`../protocols/evidence-based-reporting-protocol.md`。
135
-
136
- ## Submit 决策所有权
137
-
138
- 确定性 Git 流程;验证基线由 ledger、`git diff --cached`、远端检查与必要构建/测试决定;Superpowers 仅人工参考。
139
-
140
- ## Output Format
141
-
142
- 主目录:commit hash、分支、变更统计、archive 建议。worktree:merge commit、push 范围、`mergeFinalHash`、worktree 清理状态、archive 建议。详见 `reference.md`。
143
-
144
- ## 渐进披露
145
-
146
- - **Read `checklist.md`** — 提交流程 + worktree 合并详细步骤
147
- - **Read `reference.md`** — commit 模板、Windows worktree 清理兜底、输出示例
148
-
149
- ## 交互白名单
150
-
151
- 本 skill **仅允许**以下 AskUserQuestion;其余默认值 + `decision` 事件:
152
-
153
- 1. **提交方式 + commit message**(主目录一次确认);worktree 固定仅本地 commit,仅确认 message
154
- 2. **远程有新提交**(push 前):重新验证 / 停止 push
155
-
156
- ## 执行日志
157
-
158
- `events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
159
-
160
- ```powershell
161
- python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
162
- ```
163
-
164
- > **脚本接线**:`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 护栏解读。
165
-
166
- > **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
1
+ ---
2
+ name: harness-submit
3
+ description: "最终提交封装:验证→中文 commit→提交/推送;worktree 模式含 --no-ff 合并回主分支。使用场景:提交代码、commit、push、合并分支、merge to main、完成开发"
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=47a5159f5c4b49b8; overlay=java; do not edit -->
24
+ # harness-submit — 最终提交(含 worktree 合并)
25
+
26
+ ## Purpose
27
+
28
+ 合并最新代码→最终验证→生成中文 commit→提交/推送;worktree 模式在本地 commit 后**自动接续** `--no-ff` 合并回主分支、push、清理 worktree,完成开发闭环。
29
+
30
+ ## When to Use
31
+
32
+ - 代码开发完成,准备提交
33
+ - 用户说「提交代码」「commit」「push」「完成开发」
34
+ - worktree 模式:用户说「合并分支」「merge to main」「合入主分支」「/harness-merge」(别名,从合并阶段重入亦可)
35
+ - review 和 test 已通过或已明确跳过
36
+
37
+ > **主目录模式**(`worktree.json` requested=false):commit+push 主分支后直接 `/harness-archive`。**worktree 模式**(requested=true):worktree 内仅本地 commit,随后本 skill 自动执行合并流程;**push 只在主分支发生一次**。
38
+
39
+ ## 前置条件
40
+
41
+ - test 已通过、无未暂存修改
42
+ - 读取 `meta/worktree.json`:`requested=true` 且 worktree 已创建 → 在 worktree 目录执行提交段;不存在 → 停止并提示修复,不得静默回主目录
43
+ - review 报告可读作参考,不得阻塞提交
44
+
45
+ ## Inputs
46
+
47
+ - `$ARGUMENTS`:变更名(可选,Glob `.harness/changes/*/plans/` 自动检测)
48
+ - 相关文件:`plans/*-plan.md`、`evidence/verification-ledger.json`、`meta/worktree.json`
49
+
50
+ ## 统一读取协议
51
+
52
+ 1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
53
+ 2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
54
+ 3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
55
+ 4. **spec** — 设计真相源:`spec/<change>-design.md`
56
+ 5. **plan** — 任务真相源:`plans/<change>-plan.md`
57
+ 6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
58
+ 7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
59
+ 8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
60
+
61
+ 状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
62
+
63
+ ## 状态目录分层
64
+
65
+ 新产物遵循 `../protocols/state-layout-protocol.md`;读取时先新路径后兼容旧路径。
66
+
67
+ ## Workflow
68
+
69
+ **模式判定**:读 `meta/worktree.json`。`requested=false` → 步骤 0–7(主目录);`requested=true` → 步骤 0–6 在 worktree 执行,成功后**不结束**,接续「worktree 合并流程」。用户仅调用 `/harness-merge` 且 worktree 已有本地 commit 时,从合并流程步骤 M0 重入。
70
+
71
+ ### 提交流程(步骤 0–7)
72
+
73
+ 0. **启动准备** — 确定变更名;读 ledger + 计算 diffHash + post-test 7 类分类;append `phase.start`
74
+ 1. **合并最新代码** — 主目录:`stash` → `pull --rebase` → `stash pop`;**worktree:N/A**(远端同步在合并段主分支完成)
75
+ 2. **最终验证** — ledger 复用优先;**提交前最终门禁**:`harness_ledger.py can-reuse --verification unitTestFull --scope module --project . --profile-input unitTestFull --command <build-profile.json buildCommands.unitTestFull>`(`--profile-input unitTestFull` 从 `build-profile.json` 的 `verificationInputs.unitTestFull` 展开依赖闭包文件集,**禁止用仅含 staged 文件的 `--files` 快捷方式**冒充全量闭包;`<command>` 直接读 `buildCommands.unitTestFull`,不复制示例模块名)。不可复用则执行 `buildCommands.unitTestFull` 模块级全量单元测试,成功后用同一文件集、command、`scope=module` 写回 ledger 的 `unitTestFull` 项。增量 `unitTest` 永远不能冒充 `unitTestFull` 门禁。
76
+ 3. **.gitignore + 暂存** ⚠️ — 检查 `.harness/` 在 `.gitignore`;**禁止 `git add -A`**
77
+ 4. **提交方式** — 主目录:AskUserQuestion 三选项(commit+push / 仅本地 / 取消);**worktree:固定仅本地 commit**
78
+ 5. **commit-message.txt** ⚠️ — 展示 staged、diff stat、完整中文 message;用户确认
79
+ 6. **commit / push** — `git commit -F`;主目录按选项 push(push 前 fetch 检查远端);**worktree:只 commit,记录 local hash**
80
+ 7. **收尾引导** — 主目录:可选 worktree 清理 + 提示 `/harness-archive`;**worktree:接续下方合并流程**
81
+
82
+ 详细步骤见 `checklist.md`。
83
+
84
+ ### worktree 合并流程(requested=true,commit 后自动执行)
85
+
86
+ M0. append `phase.start`(phase=merge,若从 `/harness-merge` 重入则 note 标注重入)
87
+ M1. **切回主目录主分支** — `symbolic-ref origin/HEAD` 读主分支名;必要时 stash;确认 checkout 主分支
88
+ M2. **fetch + pull --rebase** — 记录是否引入他人提交(决定 M4 是否重跑验证)
89
+ M3. **`git merge --no-ff worktree/<change-name>`** — 合并消息可让用户改文案,**方式固定 --no-ff**
90
+ M4. **冲突处理** — 若 `CONFLICT` → **停下**,列出冲突文件,提示用户手动解决后重跑;**禁止 `checkout --theirs/--ours`**;状态 🟡WARN,不得宣称合并成功
91
+ M5. **合并后验证** — 他人提交引入 → 必须重跑构建+测试;否则 ledger 复用 🔁REUSED
92
+ M6. **push 主分支** — fetch 后 `log HEAD..@{u}` 非空则回 M2;否则 push,记录 `mergeFinalHash`
93
+ M7. **清理 worktree** — `worktree remove` + `branch -D`(Windows 兜底见 `reference.md`);更新 `worktree.json`(`created=false` + removedAt 等)
94
+ M8. **ledger + 收尾** — 写入 `mergeFinalHash`;append `phase.end`;提示 `/harness-archive`
95
+
96
+ ### Java 提交前验证补充
97
+
98
+ 通用 `harness-submit` 的最终门禁已统一为 `unitTestFull`(见通用 SKILL.md 步骤 2 / checklist 步骤 2)。Java overlay **不重复定义门禁规则**,只补两点:
99
+
100
+ - **Maven 命令来源**:`--command` 取 `build-profile.json` 的 `buildCommands.unitTestFull`,典型 `mvn test -pl <module> -o`。`mvn test` 不带 `-Dtest=` 即模块级全量 → 记 `scope=module` 可复用;带 `-Dtest=<类>` 是增量 `unitTest`,**不能**冒充 `unitTestFull`。
101
+ - **Java 依赖闭包**:`verificationInputs.unitTestFull` 必须覆盖完整编译+测试依赖闭包,建议 `["pom.xml", "<module>/pom.xml", "<module>/src/main/**", "<module>/src/test/**"]`,避免只哈希 staged 文件而漏掉 pom 依赖变化导致误复用。`harness_preflight.py detect` 对单模块项目写入根级默认 `["pom.xml", "src/main/**", "src/test/**"]`,多模块项目需手工改为 module 专属 glob。
102
+ - **可选 package 前置**:若团队发版前需 jar 验证,在 submit 后接 `/harness-package`(默认时序 submit → package → archive)
103
+ ## P0 执行可信度规则
104
+
105
+ - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
106
+ - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
107
+ - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
108
+
109
+ ## 关键规则(硬门禁速查)
110
+
111
+ > 细则见 `checklist.md`、`reference.md` 与各 protocol。
112
+
113
+ ### 一、提交方式固定三选项(主目录)
114
+
115
+ commit+push / 仅本地 commit / 取消;**不调用 Superpowers 呈现 PR/丢弃选项**。
116
+
117
+ ### 二、中文 commit 永远用文件
118
+
119
+ `.harness/changes/<change>/runtime/commit-message.txt` + `git commit -F`;禁止 amend 英文、禁止 `--no-verify`、禁止 AI footer。
120
+
121
+ ### 三、.gitignore / 远程新提交 / ledger 复用
122
+
123
+ 见 `checklist.md` 与 `../protocols/ledger-protocol.md`、`../protocols/submit-protocol.md`。
124
+
125
+ ### 四、worktree 合并硬规则
126
+
127
+ - **push 只在主分支**;worktree 分支不 push
128
+ - **`git merge --no-ff` 固定**;禁止 fast-forward
129
+ - **冲突不自动解** → 停下 → 用户手动解 → 确认后继续
130
+ - **`mergeFinalHash`** = 主分支 push 后 HEAD;archive 优先读此字段
131
+
132
+ ### 五、Shell 安全 / 敏感信息 / 证据化
133
+
134
+ git 经 PowerShell;commit/报告不得含明文密钥。遵循 `../protocols/sensitive-info-protocol.md`、`../protocols/evidence-based-reporting-protocol.md`。
135
+
136
+ ## Submit 决策所有权
137
+
138
+ 确定性 Git 流程;验证基线由 ledger、`git diff --cached`、远端检查与必要构建/测试决定;Superpowers 仅人工参考。
139
+
140
+ ## Output Format
141
+
142
+ 主目录:commit hash、分支、变更统计、archive 建议。worktree:merge commit、push 范围、`mergeFinalHash`、worktree 清理状态、archive 建议。详见 `reference.md`。
143
+
144
+ ## 渐进披露
145
+
146
+ - **Read `checklist.md`** — 提交流程 + worktree 合并详细步骤
147
+ - **Read `reference.md`** — commit 模板、Windows worktree 清理兜底、输出示例
148
+
149
+ ## 交互白名单
150
+
151
+ 本 skill **仅允许**以下 AskUserQuestion;其余默认值 + `decision` 事件:
152
+
153
+ 1. **提交方式 + commit message**(主目录一次确认);worktree 固定仅本地 commit,仅确认 message
154
+ 2. **远程有新提交**(push 前):重新验证 / 停止 push
155
+
156
+ ## 执行日志
157
+
158
+ `events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
159
+
160
+ ```powershell
161
+ python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
162
+ ```
163
+
164
+ > **脚本接线**:`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 护栏解读。
165
+
166
+ > **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
@@ -1,82 +1,82 @@
1
- ---
2
- name: harness-sync
3
- description: "检查并更新项目AI元数据(CodeGraph索引、harness-codebase-map分析、CLAUDE.md、AGENTS.md、.harness/完整性),确保Claude对代码库的理解与最新代码一致。当用户说'同步/更新索引/刷新元数据/检查一致性'时使用"
4
- argument-hint: "项目路径或留空使用当前目录"
5
- effort: medium
6
- allowed-tools: [Read, Glob, Grep, Edit, Write, 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(mv *)
15
- - Bash(rm *)
16
- - Bash(mkdir *)
17
- - Bash(touch *)
18
- - Bash(sed *)
19
- - Bash(awk *)
20
- - Bash(curl *)
21
- ---
22
- <!-- generated by harness_deploy.py; core=8917528f7dfdc5ca; overlay=java; do not edit -->
23
- # harness-sync — 元数据同步
24
-
25
- ## Purpose
26
-
27
- 检查并更新 AI 元数据(CodeGraph、codebase map、knowledge 索引、CLAUDE.md、AGENTS.md、`.harness/`),使理解与代码一致。
28
-
29
- ## When to Use
30
-
31
- 「同步/更新索引/刷新元数据」、提交前校准、archive/knowledge 变化后。跳过:刚 sync 且无新提交。
32
-
33
- ## Workflow(薄编排)
34
-
35
- | Phase | 检查 → 动作 |
36
- |-------|-------------|
37
- | 0 | 读 SKILL + `reference.md` + protocols |
38
- | 1 | git log/diff 感知变更量 |
39
- | 2 | CodeGraph 索引是否需重建 |
40
- | 3 | `.harness/codebase/map/` 是否过期 → 报告建议 `/harness-codebase-map` |
41
- | 3.5 | `harness_knowledge.py sync`;可 `sync --update`;失败不得假装可用 |
42
- | 3.6 | 扫描 `.harness/knowledge/maintenance-outbox/{pending,failed}`;对每项运行 `harness_knowledge.py maintain --project . --archive-id <id> --json`(§8.2:archive close 只 enqueue,sync 异步推进 outbox 到 completed/completed_rules_pending_judge) |
43
- | 4 | CLAUDE.md 完整性/行数 → 超限 AskUserQuestion 瘦身 |
44
- | 5 | AGENTS.md 与 CLAUDE.md 一致 |
45
- | 6 | `.harness/` 结构(init 规程 → `reference.md` 第 6 步);可选 `harness_deploy.py diff` 检查已装 skill 是否过期 |
46
- | 7–9 | `.claude/rules/`、构建配置、测试目录 — **只提示不自动修复** |
47
-
48
- 状态判断表格、修复动作、输出示例 → `reference.md`
49
-
50
- ## P0 执行可信度规则
51
-
52
- - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
53
- - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
54
- - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
55
-
56
- ## 关键规则
57
-
58
- 变更量先行 · CodeGraph 依赖编译产物 · map 与 Repomix 互斥 · CLAUDE 瘦身须用户确认 · Phase 7–9 只提示 · knowledge sync 失败记 WARN/FAIL
59
-
60
- ## Output Format
61
-
62
- 各组件状态表格 + 操作摘要 → `reference.md`
63
-
64
- ## 渐进披露
65
-
66
- - **Read `reference.md`** — 10 步详细判定与修复
67
-
68
- ## 交互白名单
69
-
70
- **仅** CLAUDE.md/AGENTS.md 瘦身拆分确认
71
-
72
- ## 执行日志
73
-
74
- `events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
75
-
76
- ```powershell
77
- python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
78
- ```
79
-
80
- > **脚本接线**:`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 护栏解读。
81
-
82
- > **Task 4 §6.1 写入契约**:普通 `append` = 加锁 -> 追加一行 -> fsync -> 解锁,**不 load 历史、不渲染**(O(1),跨进程锁 `events.ndjson.lock`,UUID 用完整 `uuid4().hex` 无需去重扫描)。仅 `--type phase.end` append 在追加成功后渲染一次 `execution-log.md`;显式 `harness_events.py render` 随时从完整 events 重建;`harness_archive.py finalize` 在 collect 前强制 render 一次。高频 command append 期间 log 可能滞后,phase 边界保持最新。
1
+ ---
2
+ name: harness-sync
3
+ description: "检查并更新项目AI元数据(CodeGraph索引、harness-codebase-map分析、CLAUDE.md、AGENTS.md、.harness/完整性),确保Claude对代码库的理解与最新代码一致。当用户说'同步/更新索引/刷新元数据/检查一致性'时使用"
4
+ argument-hint: "项目路径或留空使用当前目录"
5
+ effort: medium
6
+ allowed-tools: [Read, Glob, Grep, Edit, Write, 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(mv *)
15
+ - Bash(rm *)
16
+ - Bash(mkdir *)
17
+ - Bash(touch *)
18
+ - Bash(sed *)
19
+ - Bash(awk *)
20
+ - Bash(curl *)
21
+ ---
22
+ <!-- generated by harness_deploy.py; core=47a5159f5c4b49b8; overlay=java; do not edit -->
23
+ # harness-sync — 元数据同步
24
+
25
+ ## Purpose
26
+
27
+ 检查并更新 AI 元数据(CodeGraph、codebase map、knowledge 索引、CLAUDE.md、AGENTS.md、`.harness/`),使理解与代码一致。
28
+
29
+ ## When to Use
30
+
31
+ 「同步/更新索引/刷新元数据」、提交前校准、archive/knowledge 变化后。跳过:刚 sync 且无新提交。
32
+
33
+ ## Workflow(薄编排)
34
+
35
+ | Phase | 检查 → 动作 |
36
+ |-------|-------------|
37
+ | 0 | 读 SKILL + `reference.md` + protocols |
38
+ | 1 | git log/diff 感知变更量 |
39
+ | 2 | CodeGraph 索引是否需重建 |
40
+ | 3 | `.harness/codebase/map/` 是否过期 → 报告建议 `/harness-codebase-map` |
41
+ | 3.5 | `harness_knowledge.py sync`;可 `sync --update`;失败不得假装可用 |
42
+ | 3.6 | 扫描 `.harness/knowledge/maintenance-outbox/{pending,failed}`;对每项运行 `harness_knowledge.py maintain --project . --archive-id <id> --json`(§8.2:archive close 只 enqueue,sync 异步推进 outbox 到 completed/completed_rules_pending_judge) |
43
+ | 4 | CLAUDE.md 完整性/行数 → 超限 AskUserQuestion 瘦身 |
44
+ | 5 | AGENTS.md 与 CLAUDE.md 一致 |
45
+ | 6 | `.harness/` 结构(init 规程 → `reference.md` 第 6 步);可选 `harness_deploy.py diff` 检查已装 skill 是否过期 |
46
+ | 7–9 | `.claude/rules/`、构建配置、测试目录 — **只提示不自动修复** |
47
+
48
+ 状态判断表格、修复动作、输出示例 → `reference.md`
49
+
50
+ ## P0 执行可信度规则
51
+
52
+ - 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
53
+ - 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
54
+ - 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
55
+
56
+ ## 关键规则
57
+
58
+ 变更量先行 · CodeGraph 依赖编译产物 · map 与 Repomix 互斥 · CLAUDE 瘦身须用户确认 · Phase 7–9 只提示 · knowledge sync 失败记 WARN/FAIL
59
+
60
+ ## Output Format
61
+
62
+ 各组件状态表格 + 操作摘要 → `reference.md`
63
+
64
+ ## 渐进披露
65
+
66
+ - **Read `reference.md`** — 10 步详细判定与修复
67
+
68
+ ## 交互白名单
69
+
70
+ **仅** CLAUDE.md/AGENTS.md 瘦身拆分确认
71
+
72
+ ## 执行日志
73
+
74
+ `events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
75
+
76
+ ```powershell
77
+ python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
78
+ ```
79
+
80
+ > **脚本接线**:`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 护栏解读。
81
+
82
+ > **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 边界保持最新。