Adopt the tool adaptation standard and register the first instance matrix

Why: the library now defines requirement-level conformance for tool rules
and hooks (draft.8); the composition's existing gate mechanisms should be
honestly graded against A1-A7 rather than implicitly assumed compliant.
Evidence: matrix rows cite the 19/19 scratch suite negatives, the live data/
dirty-tree interception, and PR records; commit-msg python3 dependency
verified fail-closed by reading the hook's test path.
Impact: docs-only; guidelines gitlink advances to c9ab623 (draft.8); no
workflow or code change.
Refs: Development-Guidelines PR#2 (c9ab623); policy/adoption.md
This commit is contained in:
weichen
2026-09-30 03:35:07 +00:00
parent a6201700d6
commit 6fa07f3d15
3 changed files with 35 additions and 1 deletions
+1
View File
@@ -16,6 +16,7 @@
| standards/verification.md | 验收 | manual:make test(12 ok 行)+ scratch 19/19 为证 |
| standards/multi-repo.md | 跨仓/gitlink | manual;受控历史迁移通道已于 2026-09-30 行使一次(documents/records/2026-09-30-history-migration.md) |
| 工作区回收 | 交付终点 | advisory(task-finish);负例:合入前 finish 拒绝输出 |
| standards/tool-adaptation.md(draft.8) | 为工具创建规则/钩子实例 | 本组合 CLI/git 级实例已登记:policy/tool-adaptation-matrix.md(A1–A7 逐行定级+正负例证据) |
## 项目差异
+33
View File
@@ -0,0 +1,33 @@
# CLI/git 级门禁机制实例——能力矩阵
- 适配对象:任何经终端操作本仓的执行者(CLI Agent、IDE 内嵌终端);机制为工具无关的 shell + git hooks
- 依据:Development-Guidelines 0.1.0-draft.8(c9ab623)standards/tool-adaptation.md + policy/adoption.md
- 状态:verified(正负例见下);owner:weichen
- 实例位置:scripts/task.sh(precheck/start/sync/finish)、scripts/hooks/pre-commit、scripts/hooks/commit-msg、Makefile 目标、AGENTS.md 常驻条文
- 单一权威声明:本实例是上述规范的机制实现,语义以库与项目入口为准
## 能力矩阵
| 要求 | 等级 | 机制(执行时机) | 正例证据 | 负例证据 | 备注 |
|---|---|---|---|---|---|
| A1 启动门禁 | advisory(verdict 纪律)+ enforced(start 拒绝) | make precheck 任务首次写前;task-start 拒绝脏树(脚本退出码) | Dev PR#1 验证记录 case1 READY | 同套件 case2/4:BUSY exit 3、start-dirty exit 1;2026-09-30 实战拦截 data/ 脏树 | 「不得编辑」属执行者纪律,如实记 advisory |
| A2 节点同步 | advisory | make task-sync(验收/审核/合入前),落卡三字段 | PR#1/2/3 均经 sync | 实战两次拒绝脏树 sync(exit 1,不隐式 stash) | MUST 属流程义务,机制为建议级 |
| A3 集成分支保护 | enforced(local)+manual(平台) | pre-commit 拒绝 main 直提;Gitea 分支保护未配置 | 12 个 PR 全部经平台合入 | 套件 hook-main-refused exit 1 | 平台层待配置后升级本行 |
| A4 提交与任务记录格式 | enforced(local)(主题行)+manual(body 四段) | commit-msg 钩子查宽度/句点 | 本批提交全部通过 | 套件 hook-longsubject-refused exit 1 | body 四段结构无机器校验,如实 manual |
| A5 工作区回收 | advisory + enforced(未合入拒绝) | task-finish(合入核对→deinit→回收);abandon 双确认 | PR#3 后 worktree/分支回收 | 套件 finish-before-merge exit 1、abandon 需 FORCE_ABANDON | |
| A6 秘密边界 | manual | Gitea token 从 ~/.secrets/gitea 读取;会话/日志无明文 | 全程 API 自动化无泄漏 | 无构造负例(纪律项) | 凭证文件模式已验证 |
| A7 证据落盘 | manual | 完成声明附 precheck/sync/测试三段输出 | 各 PR body 携带 | 无构造负例 | |
## 降级与失败行为
| 机制 | 依赖缺失时行为 | 对应等级调整 | 解锁路径 |
|---|---|---|---|
| task.sh(bash+python3) | 脚本报错退出(fail-closed) | 不变 | 修复解释器后重跑 |
| commit-msg 宽度计算(python3) | 缺 python3 时宽度为空使比较失败→拒绝(fail-closed,报错信息可读性差) | 不变 | 安装 python3;改进报错文案待办 |
| Gitea API(网络/凭证) | 拒绝并打印 http 码(fail-closed) | 合入退化为人工网页操作 | 修凭证/网络 |
## 验证记录
- 正负例:2026-09-30 临时真实仓套件 19/19 PASS(precheck 三态、start/hook/sync/finish/abandon 拒绝与放行);执行者 weichen;证据摘录见 Dev PR#1 描述与 .task 卡
- 实战补充:data/ 脏树拦截、task-finish 子模块回收缺陷(PR#4 修复后重验)
- 证据复用:guidelines 升级到 draft.8 仅新增专题,A 表未变,本矩阵行级证据沿用(verification.md 证据复用条款)