@erzhe/harness-kit 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erzhe/harness-kit",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "AI-friendly repo harness: a manifest.yaml single source of truth that generates AGENTS.md / CLAUDE.md / Cursor rules and enforces invariants, contracts and drift via `harness-kit verify`.",
6
6
  "keywords": [
@@ -62,6 +62,10 @@ harness-kit init --repo .
62
62
  - 每个 `owns` / `tests` / `required_coverage` 正向 glob 写入前都要对仓库文件清单实际求值并确认命中;不得套用惯例路径、发明 glob 或使用 `!` 否定 glob。真实不存在的测试/检查要报 GAP,不能造一个来过门禁。
63
63
  - `checks` 只能引用已声明、可终止、无副作用且亲自验证可运行的 capability 动词。用 `plan-checks` / `run-checks` 验证真实改动能选中预期模块、测试与检查。
64
64
  - `test_touch` 按实际风险设为 `required | advisory | off`;公共接口、核心业务、安全边界优先 `required`,不能全仓拍脑袋一刀切。
65
+ - 做一次**用户可观察行为的验证面审计**:从真实 scripts、测试配置与测试文件识别浏览器用户流、桌面进程边界、main/preload/renderer/IPC、CLI/API smoke 等项目实际存在的 acceptance/E2E 检查。领域名称由项目定义,Harness 核心不内置 taxonomy。
66
+ - 已有可终止、无副作用的 E2E/acceptance 命令时,先把 manifest 升为 `spec: ai-harness/v1`,再用 `validation.gates` 声明 mandatory checks,并由有真实 `owns` 的相关 `modules[].gates` 直接引用;不能只放在 `routing.verify` 或可选 profile。v1 让旧 CLI fail closed;gate 会在普通 Stop 中自动执行,profile 也不能绕过。
67
+ - gate 的 `acceptance.tests` 必须只覆盖该层验收 case,并显式声明 `test_touch`。不要把 unit 与 acceptance glob 混在一起;修改 unit test 不能满足 gate 的 acceptance touch。
68
+ - 没有真实 E2E/acceptance runner 或 case 时不得发明命令、文件或 glob 来做绿;先判断能否在本次 onboarding 内安全补一个自启动、自清理的最小关键旅程。若不能,必须把触发范围、操作步骤和成功标准持久化为 `invariants[].manual: true`,并从相关 module 的 playbook/pitfall 指向它;不能只在最终聊天里报告,也不得宣称用户路径已自动覆盖。
65
69
  7. **routing**:按常见改动类型写 `read`、`entry`、`dont_assume`、`verify`。`routing.verify` 是给 agent 读的最小提示;`modules.checks` 是供 `run-checks` 执行的 capability,别混用。
66
70
  8. **knowledge**:把第 1 步的文档按 `root` / `authority` 注册;只新增代码推不出的领域知识、坑和决策,重要决策写 journal ADR。`binds` 必须是实际源文件,用于新鲜度检查。
67
71
 
@@ -10,6 +10,7 @@ description: 在一个已接入 harness-kit 的仓库里实现需求 / 修 bug
10
10
  harness-kit 只提供确定性弹药,不替你判断功能对不对:
11
11
  - `plan-checks` —— 按 `modules[].owns` 把改动映射到模块,算出该跑哪些 `checks`,并列出**诚实的 gap**(哪块没测、没碰测试、没命中任何模块…)。只算不跑。
12
12
  - `run-checks` —— 把 `plan-checks` 选出的 **capability check** 真跑一遍,持久化 passed/failed/gaps/waivers;没有实际执行的 check 不能算绿。
13
+ - **validation gate** —— 项目自定义的强制验证义务;模块命中后 gate checks 一定加入计划,显式 profile 也不能绕过。gate 可把 acceptance test touch 与普通 unit test touch 分开。
13
14
  - `verify` —— 再查 manifest、生成物、不变量和契约,和 `run-checks` 分工互补。
14
15
  - **SessionStart + Stop 钩子**(若已 `install-hooks --stop`)会记住会话开始时的代码基线,并在你**每次尝试结束时**重跑两道门禁;会话中已经 commit 的改动也不会漏。
15
16
 
@@ -41,7 +42,9 @@ harness-kit 只提供确定性弹药,不替你判断功能对不对:
41
42
  - 有失败 / blocking gap → 进第 4 步。
42
43
  4. **按证据收敛**(你自己闭环,别丢回给人):
43
44
  - `check FAILED` → 读日志尾巴,定位并修,重跑。
44
- - `missing-test-touch` → 在该模块 `tests` 里补覆盖本次改动的用例,重跑。
45
+ - `missing-test-touch` 且 scope 是 `gate:<id>` → 补该 gate 的 acceptance case;只改 unit test 不能满足这条用户路径义务。确属不需要新 case 的重构才允许带精确理由豁免。
46
+ - `missing-test-touch` 且 scope 是 module → 在该模块 `tests` 里补覆盖本次改动的用例,重跑。
47
+ - `validation-gate-invalid` → 修复空 acceptance、owns 零匹配或 unit/prod overlap;这是不可豁免的配置/覆盖失效。
45
48
  - `module-without-tests` → 该模块没有回归网:补 `tests` glob + 基础用例(参考模块的 `playbook`)。
46
49
  - `unmapped-file` / `unmapped-required-file` → 改动落在没人 `owns/tests` 的文件:若属已有模块,补映射;若是新模块,补一张模块卡。required 范围不能静默跳过。
47
50
  - `no-checks-selected` → 命中模块没声明 `checks`:补 `checks`(capability 动词)。
@@ -66,4 +69,5 @@ harness-kit 只提供确定性弹药,不替你判断功能对不对:
66
69
  - ❌ 为了消 gap 造假测试(`assert true`、把断言删了、无意义豁免)——那是把回归网变成安慰剂。
67
70
  - ❌ 把 `run-checks` 的失败当噪音绕过去。红灯是"还没交付",不是"可选项"。
68
71
  - ❌ 明明加了新行为却只跑老回归、不补新用例。
72
+ - ❌ 用一份 unit test 改动冒充 `gate:<id>` 的 acceptance 覆盖,或用 profile 绕过 validation gate。
69
73
  - ❌ 把手动 `no-change` 当成“已验收 commit”。它只说明当前工作区没差异,不知道任务从哪里开始。