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.
- package/dist/bin.js +1033 -219
- package/package.json +2 -2
- package/resources/harness/general/.harness-build.json +1 -1
- package/resources/harness/general/harness-archive/SKILL.md +215 -215
- package/resources/harness/general/harness-codebase-map/SKILL.md +112 -112
- package/resources/harness/general/harness-codebase-map/templates/map-summary.md +3 -3
- package/resources/harness/general/harness-knowledge-ingest/SKILL.md +246 -246
- package/resources/harness/general/harness-knowledge-query/SKILL.md +164 -164
- package/resources/harness/general/harness-plan/SKILL.md +127 -127
- package/resources/harness/general/harness-review/SKILL.md +156 -156
- package/resources/harness/general/harness-run/SKILL.md +132 -132
- package/resources/harness/general/harness-submit/SKILL.md +159 -159
- package/resources/harness/general/harness-sync/SKILL.md +82 -82
- package/resources/harness/general/harness-test/SKILL.md +180 -180
- package/resources/harness/general/scripts/harness_deploy.py +580 -580
- package/resources/harness/java/.harness-build.json +1 -1
- package/resources/harness/java/harness-apidoc/SKILL.md +86 -86
- package/resources/harness/java/harness-archive/SKILL.md +215 -215
- package/resources/harness/java/harness-codebase-map/SKILL.md +112 -112
- package/resources/harness/java/harness-codebase-map/templates/map-summary.md +3 -3
- package/resources/harness/java/harness-knowledge-ingest/SKILL.md +246 -246
- package/resources/harness/java/harness-knowledge-query/SKILL.md +164 -164
- package/resources/harness/java/harness-package/SKILL.md +87 -87
- package/resources/harness/java/harness-plan/SKILL.md +127 -127
- package/resources/harness/java/harness-review/SKILL.md +156 -156
- package/resources/harness/java/harness-run/SKILL.md +148 -148
- package/resources/harness/java/harness-submit/SKILL.md +166 -166
- package/resources/harness/java/harness-sync/SKILL.md +82 -82
- package/resources/harness/java/harness-test/SKILL.md +192 -192
- package/resources/harness/java/scripts/harness_deploy.py +580 -580
- package/resources/harness/manifests/general.json +13 -33
- package/resources/harness/manifests/java.json +15 -35
- package/resources/harness/migrations/0.1.1/general.json +358 -0
- package/resources/harness/migrations/0.1.1/java.json +398 -0
- package/resources/bootstrap-ir/manifest.json +0 -19
- package/resources/bootstrap-ir/skills/harness-apidoc.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-archive.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-codebase-map.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-knowledge-ingest.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-package.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-plan.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-review.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-run.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-skill-optimizer.yaml +0 -28
- package/resources/bootstrap-ir/skills/harness-submit.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-sync.yaml +0 -24
- package/resources/bootstrap-ir/skills/harness-test.yaml +0 -24
- package/resources/bootstrap-ir/templates/claude-code-skill.md +0 -12
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +0 -43
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-02-14-ledger-snapshot-followup/reports/final/summary-data.json +0 -38
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +0 -36
- package/resources/harness/general/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +0 -1
- package/resources/harness/general/harness-knowledge-ingest/tests/test_harness_knowledge.py +0 -1792
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-01-10-ledger-reconciliation/reports/final/summary-data.json +0 -43
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-02-14-ledger-snapshot-followup/reports/final/summary-data.json +0 -38
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/archive/2026-03-05-webhook-contract/reports/final/summary-data.json +0 -36
- package/resources/harness/java/harness-knowledge-ingest/tests/fixtures/mcp-eval-project/.harness/project.yaml +0 -1
- package/resources/harness/java/harness-knowledge-ingest/tests/test_harness_knowledge.py +0 -1792
- package/resources/manifest.json +0 -19
- package/resources/skills/harness-apidoc/SKILL.md +0 -50
- package/resources/skills/harness-archive/SKILL.md +0 -48
- package/resources/skills/harness-codebase-map/SKILL.md +0 -53
- package/resources/skills/harness-knowledge-ingest/SKILL.md +0 -48
- package/resources/skills/harness-package/SKILL.md +0 -48
- package/resources/skills/harness-plan/SKILL.md +0 -51
- package/resources/skills/harness-review/SKILL.md +0 -50
- package/resources/skills/harness-run/SKILL.md +0 -48
- package/resources/skills/harness-skill-optimizer/SKILL.md +0 -54
- package/resources/skills/harness-submit/SKILL.md +0 -47
- package/resources/skills/harness-sync/SKILL.md +0 -48
- package/resources/skills/harness-test/SKILL.md +0 -50
|
@@ -1,164 +1,164 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: harness-knowledge-query
|
|
3
|
-
description: "根据新需求、设计任务、代码修改请求或问题排查,在规划和编码前查询 .harness/knowledge 历史上下文。适用场景:query knowledge、查找历史需求、根据归档理解需求、继续之前类似开发、生成需求上下文包。"
|
|
4
|
-
argument-hint: "<需求文本> [--file <path>] [--status active|candidate|stale]"
|
|
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=
|
|
24
|
-
# harness-knowledge-query
|
|
25
|
-
|
|
26
|
-
根据用户的新需求或排查问题,从项目本地 `.harness/knowledge` 中检索历史需求、决策、实现、风险和测试证据,并生成 AI 可读的 context pack。
|
|
27
|
-
|
|
28
|
-
此 skill 只负责查询和使用知识。整理、同步和 promote 条目由 `harness-knowledge-ingest` 负责。
|
|
29
|
-
|
|
30
|
-
## Triggers
|
|
31
|
-
|
|
32
|
-
- query knowledge
|
|
33
|
-
- knowledge query
|
|
34
|
-
- 查找相关历史需求
|
|
35
|
-
- 根据历史归档理解这个需求
|
|
36
|
-
- 结合之前做过的内容
|
|
37
|
-
- 继续之前类似开发
|
|
38
|
-
- 生成需求上下文包
|
|
39
|
-
- 在规划前查历史
|
|
40
|
-
|
|
41
|
-
## Automatic Use
|
|
42
|
-
|
|
43
|
-
当用户提出新功能、改造、排查、设计方案、继续历史任务,且项目存在 `.harness/archive` 或 `.harness/knowledge` 时,AI 应主动运行本 skill,不需要等用户提醒。
|
|
44
|
-
|
|
45
|
-
如果 `.harness/knowledge/index.json` 不存在或已过期,先运行:
|
|
46
|
-
|
|
47
|
-
```powershell
|
|
48
|
-
powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>' --update"
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
然后再查询。
|
|
52
|
-
|
|
53
|
-
## Commands
|
|
54
|
-
|
|
55
|
-
`<ingest-skill-dir>` 指同级 `harness-knowledge-ingest/` 目录;查询逻辑复用其脚本。所有 python 脚本命令通过 `powershell.exe -Command "..."` 执行,避开 Bash 在 Windows 中文路径下的编码/参数问题。
|
|
56
|
-
|
|
57
|
-
### Query by requirement
|
|
58
|
-
|
|
59
|
-
```powershell
|
|
60
|
-
powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<project-root>' --query '<用户需求原文>'"
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Query with metadata filters
|
|
64
|
-
|
|
65
|
-
```powershell
|
|
66
|
-
powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<project-root>' --query '<需求或关键词>' --file '<source-file>' --status active"
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
可重复使用:
|
|
70
|
-
|
|
71
|
-
- `--file <path>`:只返回关联到指定文件的知识。
|
|
72
|
-
- `--status active|candidate|stale|superseded|conflicted`:按生命周期过滤。
|
|
73
|
-
- `--type requirement|decision|implementation|risk|test-evidence|pitfall|api-contract`:按知识类型过滤。
|
|
74
|
-
- `--limit <n>`:限制返回数量。
|
|
75
|
-
|
|
76
|
-
## Workflow
|
|
77
|
-
|
|
78
|
-
1. 确认项目根目录。
|
|
79
|
-
2. 运行 `sync --project <root>`。
|
|
80
|
-
3. 如果 `upToDate=false`,运行 `sync --update`。
|
|
81
|
-
4. 用用户原始需求作为 `--query` 查询。
|
|
82
|
-
5. 如已知道相关文件,追加 `--file` 过滤。
|
|
83
|
-
6. 读取 JSON 输出中的 `contextPack`。
|
|
84
|
-
7. 在 `harness-plan`、设计、代码探索或实现前,把 context pack 当作必读输入。
|
|
85
|
-
|
|
86
|
-
## Output Contract
|
|
87
|
-
|
|
88
|
-
查询输出 JSON 包含:
|
|
89
|
-
|
|
90
|
-
- `matchCount`
|
|
91
|
-
- `contextPack`
|
|
92
|
-
- `filters`
|
|
93
|
-
- `planInput`
|
|
94
|
-
- `matches`
|
|
95
|
-
|
|
96
|
-
`planInput.kind` 必须为 `harness-knowledge-context-pack`。后续 `harness-plan` 应读取 `planInput.path`。
|
|
97
|
-
|
|
98
|
-
每次查询还会更新稳定指针:
|
|
99
|
-
|
|
100
|
-
```text
|
|
101
|
-
.harness/knowledge/context-packs/latest.json
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
该文件包含最新 query、context pack 路径和 `matchIds`,供后续流程快速读取最近一次知识上下文。
|
|
105
|
-
|
|
106
|
-
## Interpretation Rules
|
|
107
|
-
|
|
108
|
-
- `active`:可优先采用,但仍要结合当前代码验证。
|
|
109
|
-
- `candidate`:有参考价值,不是当前事实。
|
|
110
|
-
- `stale`:只能作为历史线索,必须重新检查代码和归档。
|
|
111
|
-
- `superseded` / `conflicted`:必须显式提示风险,不得静默采用。
|
|
112
|
-
|
|
113
|
-
## Forbidden Actions
|
|
114
|
-
|
|
115
|
-
- rebuild_index_without_need
|
|
116
|
-
- treat_candidate_as_current_fact
|
|
117
|
-
- treat_stale_as_current_fact
|
|
118
|
-
- skip_context_pack_before_planning
|
|
119
|
-
- copy_large_archive_content_into_prompt
|
|
120
|
-
|
|
121
|
-
## Verification
|
|
122
|
-
|
|
123
|
-
```powershell
|
|
124
|
-
powershell.exe -Command "python -m unittest '<ingest-skill-dir>\tests\test_harness_knowledge.py'"
|
|
125
|
-
powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<real-project-root>' --query '<真实需求>'"
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
确认输出中存在 `contextPack`、`planInput.kind=harness-knowledge-context-pack`,且 context pack 文件包含 `Before planning`。
|
|
129
|
-
|
|
130
|
-
## P0 执行可信度规则
|
|
131
|
-
|
|
132
|
-
- 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
|
|
133
|
-
- 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
|
|
134
|
-
- 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
|
|
135
|
-
|
|
136
|
-
## Output Format
|
|
137
|
-
|
|
138
|
-
执行完成后展示:
|
|
139
|
-
|
|
140
|
-
- 用户需求原文与生效的过滤条件(`--file`/`--status`/`--type`/`--limit`)。
|
|
141
|
-
- `matchCount` 与按状态分组的命中数(active/candidate/stale/superseded/conflicted)。
|
|
142
|
-
- `contextPack` 路径与 `latest.json` 指针。
|
|
143
|
-
- 命中 stale/superseded/conflicted 时显式提示风险。
|
|
144
|
-
- 下一步建议(context pack 已就绪 → 进入 `/harness-plan`;索引过期 → 先 `sync --update`)。
|
|
145
|
-
|
|
146
|
-
## 渐进披露
|
|
147
|
-
|
|
148
|
-
- 本 skill 暂无 `checklist.md` / `reference.md` 支持文件,规则全部在 SKILL.md。若 Output Contract / Interpretation Rules 后续扩展变重,应拆到 `reference.md`。
|
|
149
|
-
|
|
150
|
-
## 交互白名单
|
|
151
|
-
|
|
152
|
-
**无** AskUserQuestion;`stale`/`conflicted` 命中记 `issue`,不阻断 query。
|
|
153
|
-
|
|
154
|
-
## 执行日志
|
|
155
|
-
|
|
156
|
-
`events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
|
|
157
|
-
|
|
158
|
-
```powershell
|
|
159
|
-
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
> **脚本接线**:`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 护栏解读。
|
|
163
|
-
|
|
164
|
-
> **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-knowledge-query
|
|
3
|
+
description: "根据新需求、设计任务、代码修改请求或问题排查,在规划和编码前查询 .harness/knowledge 历史上下文。适用场景:query knowledge、查找历史需求、根据归档理解需求、继续之前类似开发、生成需求上下文包。"
|
|
4
|
+
argument-hint: "<需求文本> [--file <path>] [--status active|candidate|stale]"
|
|
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-knowledge-query
|
|
25
|
+
|
|
26
|
+
根据用户的新需求或排查问题,从项目本地 `.harness/knowledge` 中检索历史需求、决策、实现、风险和测试证据,并生成 AI 可读的 context pack。
|
|
27
|
+
|
|
28
|
+
此 skill 只负责查询和使用知识。整理、同步和 promote 条目由 `harness-knowledge-ingest` 负责。
|
|
29
|
+
|
|
30
|
+
## Triggers
|
|
31
|
+
|
|
32
|
+
- query knowledge
|
|
33
|
+
- knowledge query
|
|
34
|
+
- 查找相关历史需求
|
|
35
|
+
- 根据历史归档理解这个需求
|
|
36
|
+
- 结合之前做过的内容
|
|
37
|
+
- 继续之前类似开发
|
|
38
|
+
- 生成需求上下文包
|
|
39
|
+
- 在规划前查历史
|
|
40
|
+
|
|
41
|
+
## Automatic Use
|
|
42
|
+
|
|
43
|
+
当用户提出新功能、改造、排查、设计方案、继续历史任务,且项目存在 `.harness/archive` 或 `.harness/knowledge` 时,AI 应主动运行本 skill,不需要等用户提醒。
|
|
44
|
+
|
|
45
|
+
如果 `.harness/knowledge/index.json` 不存在或已过期,先运行:
|
|
46
|
+
|
|
47
|
+
```powershell
|
|
48
|
+
powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>' --update"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
然后再查询。
|
|
52
|
+
|
|
53
|
+
## Commands
|
|
54
|
+
|
|
55
|
+
`<ingest-skill-dir>` 指同级 `harness-knowledge-ingest/` 目录;查询逻辑复用其脚本。所有 python 脚本命令通过 `powershell.exe -Command "..."` 执行,避开 Bash 在 Windows 中文路径下的编码/参数问题。
|
|
56
|
+
|
|
57
|
+
### Query by requirement
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<project-root>' --query '<用户需求原文>'"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Query with metadata filters
|
|
64
|
+
|
|
65
|
+
```powershell
|
|
66
|
+
powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<project-root>' --query '<需求或关键词>' --file '<source-file>' --status active"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
可重复使用:
|
|
70
|
+
|
|
71
|
+
- `--file <path>`:只返回关联到指定文件的知识。
|
|
72
|
+
- `--status active|candidate|stale|superseded|conflicted`:按生命周期过滤。
|
|
73
|
+
- `--type requirement|decision|implementation|risk|test-evidence|pitfall|api-contract`:按知识类型过滤。
|
|
74
|
+
- `--limit <n>`:限制返回数量。
|
|
75
|
+
|
|
76
|
+
## Workflow
|
|
77
|
+
|
|
78
|
+
1. 确认项目根目录。
|
|
79
|
+
2. 运行 `sync --project <root>`。
|
|
80
|
+
3. 如果 `upToDate=false`,运行 `sync --update`。
|
|
81
|
+
4. 用用户原始需求作为 `--query` 查询。
|
|
82
|
+
5. 如已知道相关文件,追加 `--file` 过滤。
|
|
83
|
+
6. 读取 JSON 输出中的 `contextPack`。
|
|
84
|
+
7. 在 `harness-plan`、设计、代码探索或实现前,把 context pack 当作必读输入。
|
|
85
|
+
|
|
86
|
+
## Output Contract
|
|
87
|
+
|
|
88
|
+
查询输出 JSON 包含:
|
|
89
|
+
|
|
90
|
+
- `matchCount`
|
|
91
|
+
- `contextPack`
|
|
92
|
+
- `filters`
|
|
93
|
+
- `planInput`
|
|
94
|
+
- `matches`
|
|
95
|
+
|
|
96
|
+
`planInput.kind` 必须为 `harness-knowledge-context-pack`。后续 `harness-plan` 应读取 `planInput.path`。
|
|
97
|
+
|
|
98
|
+
每次查询还会更新稳定指针:
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
.harness/knowledge/context-packs/latest.json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
该文件包含最新 query、context pack 路径和 `matchIds`,供后续流程快速读取最近一次知识上下文。
|
|
105
|
+
|
|
106
|
+
## Interpretation Rules
|
|
107
|
+
|
|
108
|
+
- `active`:可优先采用,但仍要结合当前代码验证。
|
|
109
|
+
- `candidate`:有参考价值,不是当前事实。
|
|
110
|
+
- `stale`:只能作为历史线索,必须重新检查代码和归档。
|
|
111
|
+
- `superseded` / `conflicted`:必须显式提示风险,不得静默采用。
|
|
112
|
+
|
|
113
|
+
## Forbidden Actions
|
|
114
|
+
|
|
115
|
+
- rebuild_index_without_need
|
|
116
|
+
- treat_candidate_as_current_fact
|
|
117
|
+
- treat_stale_as_current_fact
|
|
118
|
+
- skip_context_pack_before_planning
|
|
119
|
+
- copy_large_archive_content_into_prompt
|
|
120
|
+
|
|
121
|
+
## Verification
|
|
122
|
+
|
|
123
|
+
```powershell
|
|
124
|
+
powershell.exe -Command "python -m unittest '<ingest-skill-dir>\tests\test_harness_knowledge.py'"
|
|
125
|
+
powershell.exe -Command "python '<ingest-skill-dir>\scripts\harness_knowledge.py' query --project '<real-project-root>' --query '<真实需求>'"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
确认输出中存在 `contextPack`、`planInput.kind=harness-knowledge-context-pack`,且 context pack 文件包含 `Before planning`。
|
|
129
|
+
|
|
130
|
+
## P0 执行可信度规则
|
|
131
|
+
|
|
132
|
+
- 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
|
|
133
|
+
- 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
|
|
134
|
+
- 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
|
|
135
|
+
|
|
136
|
+
## Output Format
|
|
137
|
+
|
|
138
|
+
执行完成后展示:
|
|
139
|
+
|
|
140
|
+
- 用户需求原文与生效的过滤条件(`--file`/`--status`/`--type`/`--limit`)。
|
|
141
|
+
- `matchCount` 与按状态分组的命中数(active/candidate/stale/superseded/conflicted)。
|
|
142
|
+
- `contextPack` 路径与 `latest.json` 指针。
|
|
143
|
+
- 命中 stale/superseded/conflicted 时显式提示风险。
|
|
144
|
+
- 下一步建议(context pack 已就绪 → 进入 `/harness-plan`;索引过期 → 先 `sync --update`)。
|
|
145
|
+
|
|
146
|
+
## 渐进披露
|
|
147
|
+
|
|
148
|
+
- 本 skill 暂无 `checklist.md` / `reference.md` 支持文件,规则全部在 SKILL.md。若 Output Contract / Interpretation Rules 后续扩展变重,应拆到 `reference.md`。
|
|
149
|
+
|
|
150
|
+
## 交互白名单
|
|
151
|
+
|
|
152
|
+
**无** AskUserQuestion;`stale`/`conflicted` 命中记 `issue`,不阻断 query。
|
|
153
|
+
|
|
154
|
+
## 执行日志
|
|
155
|
+
|
|
156
|
+
`events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
|
|
157
|
+
|
|
158
|
+
```powershell
|
|
159
|
+
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
> **脚本接线**:`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 护栏解读。
|
|
163
|
+
|
|
164
|
+
> **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,87 +1,87 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: harness-package
|
|
3
|
-
description: "增量模块打包:拉取最新→编译验证→mvn package→汇总 jar/war。使用场景:打包、package、发版准备"
|
|
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=
|
|
24
|
-
# harness-package — 增量模块打包(Java overlay)
|
|
25
|
-
|
|
26
|
-
## Purpose
|
|
27
|
-
|
|
28
|
-
基于 final pushed commit 识别变更模块 → 增量 `mvn package` → 汇总 jar/war 路径与大小。
|
|
29
|
-
|
|
30
|
-
> 默认时序:`submit → package → archive`。test 已通过且 ledger 有效时可 `-DskipTests`。
|
|
31
|
-
|
|
32
|
-
## When to Use
|
|
33
|
-
|
|
34
|
-
- submit 已推送,准备发版打包
|
|
35
|
-
- 触发语:"打包""package""发版准备"
|
|
36
|
-
|
|
37
|
-
## 前置条件
|
|
38
|
-
|
|
39
|
-
- 推荐已完成 `/harness-submit`;`baseCommit` 以 submit 最终 hash 为准
|
|
40
|
-
- test 报告存在或 ledger 可复用;读 `meta/worktree.json` 决定 worktree 目录
|
|
41
|
-
|
|
42
|
-
## 统一读取协议
|
|
43
|
-
|
|
44
|
-
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
45
|
-
2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
46
|
-
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
47
|
-
4. **spec** — 设计真相源:`spec/<change>-design.md`
|
|
48
|
-
5. **plan** — 任务真相源:`plans/<change>-plan.md`
|
|
49
|
-
6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
|
|
50
|
-
7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
|
|
51
|
-
8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
|
|
52
|
-
|
|
53
|
-
状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
|
|
54
|
-
|
|
55
|
-
## Workflow
|
|
56
|
-
|
|
57
|
-
1. 读 ledger + build-profile 的 `buildCommands.package`
|
|
58
|
-
2. 识别变更模块(git diff + pom 结构)
|
|
59
|
-
3. `mvn package -DskipTests`(ledger 不可复用时先跑必要测试)
|
|
60
|
-
4. 写打包报告 + append 事件
|
|
61
|
-
|
|
62
|
-
## P0 执行可信度规则
|
|
63
|
-
|
|
64
|
-
- 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
|
|
65
|
-
- 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
|
|
66
|
-
- 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
|
|
67
|
-
|
|
68
|
-
## 渐进披露
|
|
69
|
-
|
|
70
|
-
- **Read `reference.md`** — 模块识别与报告格式
|
|
71
|
-
- **Read `checklist.md`** — 逐步勾选
|
|
72
|
-
|
|
73
|
-
## 交互白名单
|
|
74
|
-
|
|
75
|
-
**无** AskUserQuestion;冲突/失败记 `issue`/`decision`。
|
|
76
|
-
|
|
77
|
-
## 执行日志
|
|
78
|
-
|
|
79
|
-
`events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
|
|
80
|
-
|
|
81
|
-
```powershell
|
|
82
|
-
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
> **脚本接线**:`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 护栏解读。
|
|
86
|
-
|
|
87
|
-
> **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-package
|
|
3
|
+
description: "增量模块打包:拉取最新→编译验证→mvn package→汇总 jar/war。使用场景:打包、package、发版准备"
|
|
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-package — 增量模块打包(Java overlay)
|
|
25
|
+
|
|
26
|
+
## Purpose
|
|
27
|
+
|
|
28
|
+
基于 final pushed commit 识别变更模块 → 增量 `mvn package` → 汇总 jar/war 路径与大小。
|
|
29
|
+
|
|
30
|
+
> 默认时序:`submit → package → archive`。test 已通过且 ledger 有效时可 `-DskipTests`。
|
|
31
|
+
|
|
32
|
+
## When to Use
|
|
33
|
+
|
|
34
|
+
- submit 已推送,准备发版打包
|
|
35
|
+
- 触发语:"打包""package""发版准备"
|
|
36
|
+
|
|
37
|
+
## 前置条件
|
|
38
|
+
|
|
39
|
+
- 推荐已完成 `/harness-submit`;`baseCommit` 以 submit 最终 hash 为准
|
|
40
|
+
- test 报告存在或 ledger 可复用;读 `meta/worktree.json` 决定 worktree 目录
|
|
41
|
+
|
|
42
|
+
## 统一读取协议
|
|
43
|
+
|
|
44
|
+
1. **`.harness/changes/<change-name>/` 是唯一真相源** — 所有输入从该目录读取,产物写入对应子目录
|
|
45
|
+
2. **change-name 优先从 frontmatter 读取** — `spec/*-design.md`、`plans/*-plan.md` 的 YAML `change-name`
|
|
46
|
+
3. **frontmatter 缺失时兼容旧格式** — 从路径推断,标记 `🟡 legacy-plan`,不失败
|
|
47
|
+
4. **spec** — 设计真相源:`spec/<change>-design.md`
|
|
48
|
+
5. **plan** — 任务真相源:`plans/<change>-plan.md`
|
|
49
|
+
6. **implementation-detail** — 自适应执行参考;legacy 缺失 🟡WARN,不阻断
|
|
50
|
+
7. **test-scenarios** — 测试真相源:`plans/<change>-test-scenarios.md`
|
|
51
|
+
8. **禁止读取 `docs/superpowers/` 作为正式输入** — 旧草稿仅人工线索
|
|
52
|
+
|
|
53
|
+
状态目录分层:新路径优先,旧路径兼容 → [[../protocols/state-layout-protocol.md|state-layout-protocol]]
|
|
54
|
+
|
|
55
|
+
## Workflow
|
|
56
|
+
|
|
57
|
+
1. 读 ledger + build-profile 的 `buildCommands.package`
|
|
58
|
+
2. 识别变更模块(git diff + pom 结构)
|
|
59
|
+
3. `mvn package -DskipTests`(ledger 不可复用时先跑必要测试)
|
|
60
|
+
4. 写打包报告 + append 事件
|
|
61
|
+
|
|
62
|
+
## P0 执行可信度规则
|
|
63
|
+
|
|
64
|
+
- 命令结果不得靠猜测;普通 Bash 被拒 → 立即改用等价 PowerShell 重试一次
|
|
65
|
+
- 仅 PowerShell 成功且有明确证据(构建/git/测试输出、文件存在、exit 0)时可标 ✅OK;否则 ❌FAIL 或 🟡WARN
|
|
66
|
+
- 禁止把 hook 拒绝、静态验证、无输出、用户跳过说成成功 → 详见 [[../protocols/powershell-protocol.md|powershell-protocol]]、[[../protocols/evidence-based-reporting-protocol.md|evidence-based-reporting-protocol]]
|
|
67
|
+
|
|
68
|
+
## 渐进披露
|
|
69
|
+
|
|
70
|
+
- **Read `reference.md`** — 模块识别与报告格式
|
|
71
|
+
- **Read `checklist.md`** — 逐步勾选
|
|
72
|
+
|
|
73
|
+
## 交互白名单
|
|
74
|
+
|
|
75
|
+
**无** AskUserQuestion;冲突/失败记 `issue`/`decision`。
|
|
76
|
+
|
|
77
|
+
## 执行日志
|
|
78
|
+
|
|
79
|
+
`events.ndjson` 为唯一事实源(schema_version 2,`note` 承载人类可读摘要);`logs/execution-log.md` 由 `harness_events.py` 渲染,**禁止手工 Edit**。结构 → [[../protocols/report-pipeline-protocol.md|report-pipeline-protocol]]
|
|
80
|
+
|
|
81
|
+
```powershell
|
|
82
|
+
python <skills-root>/scripts/harness_events.py append --change-dir ".harness/changes/<change-name>" --phase <phase> --type phase.start --note "<触发指令>"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> **脚本接线**:`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 护栏解读。
|
|
86
|
+
|
|
87
|
+
> **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 边界保持最新。
|