Skip to content

feat: professionalize the plugin - spec-compliant skills, hardened CLI/hooks, consistency gate - #1

Merged
voidvec merged 5 commits into
masterfrom
feat/professionalization-and-review
Sep 24, 2026
Merged

voidvec merged 5 commits into
masterfrom
feat/professionalization-and-review

Conversation

@voidvec

@voidvec voidvec commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

概述

对一个成熟的 Drogon C++ coding-agent 插件仓库做了一轮专业化体检 + 两轮评审整改。不引入任何新工具链(运行时依赖仍为零),能固化的约束都固化成自动化门禁。

改了什么

技能层(22 个)

  • 移除 SKILL.md 的 version 字段——它不在 Agent Skills 规范的允许字段白名单内(规范对未知键是硬失败而非忽略),改用规范内的 license
  • description 统一为触发式写法并由测试强制
  • 22 份 code-guide.md 的禁止模式清单章节归一(16 处重命名 + 6 处补写),新增结构契约

CLI(PyPI 与 npm)

  • 技能数量改为从 skills/ 实枚举,消除 7 处常量 + 34 处文案硬编码
  • uninstall --host claude|zcode 曾是静默空操作(bundle 无卸载分支)→ 改为 kind 到动作的显式映射
  • 按宿主卸载不再误删其它宿主仍在使用的共享 AGENTS.md 与 .agents/skills(引用计数)
  • verify 新增资产漂移检测(被改动 / 缺失 / 未受管)
  • npm 回退源码树时不再把 .git 与 node_modules 整仓复制进用户项目

钩子

  • 规则带稳定 rule_id / severity / guide;每条规则都有正例和反例(此前 8 条规则误报无守护)
  • file_category 改为精确匹配,latest.cc 不再被当成测试文件而套用错规则集
  • SessionStart matcher 补 resume(修掉会话恢复时规则不注入)
  • session-start 剔除 C0 控制字符;并修掉无扩展名钩子脚本未固定 LF 的隐患(Windows 的 CRLF 会让 bash 静默失效)

工具链与 CI

  • 新增 scripts/check-consistency.py(12 项跨产物一致性检查)
  • 新增 scripts/plugin-capabilities.json(两个 CLI 的能力契约,差异必须显式登记)
  • 依赖固定在 requirements-dev.txt,开启 pip 缓存,门禁进 CI

文档

  • docs/PROFESSIONALIZATION-REVIEW.md、docs/SKILL-AUTHORING.md、docs/SPEC-CORRECTNESS-COMPAT-REVIEW.md

验证

  • 测试 47 → 127;一致性门禁 0 → 12 项
  • gen-host-artifacts.py --check、两侧 sync-assets --check、check-consistency.py、pytest 全绿

说明

  • 未改 VERSION(未要求发版),改动记入 CHANGELOG.md 的 Unreleased
  • 评审中 3 条推测被官方文档反证(Codex interface 必填字段等),已明确不修改并记录依据
  • 5 项需真机核实的行为(Codex shell 字段容忍度、MultiEdit matcher、Trae .mdc 等)列入 CONTRIBUTING.md 的人工核实清单,未盲改

第三轮评审整改(追加)

评审记录:docs/ROUND3-SPEC-HOST-PLATFORM-CORRECTNESS-REVIEW.md(四维度:规范符合性 / 宿主兼容性 / 平台兼容性 / 功能正确性,官方文档逐条二次核实)。按 §6 优先级三个批次全部落地:

钩子层(批次①)

  • Codex 上 PostToolUse 扫描必然空转(R3):canonical 工具名是 apply_patch(Write/Edit 只是 matcher 别名)→ 工具名白名单改黑名单,新增补丁文本解析(按 *** Update/Add File: 头逐文件扫 + 新增行);matcher 补 apply_patch
  • SessionStart matcher 补 fork(R2);测试与门禁由"子串含 resume"弱断言升级为全来源集合覆盖断言
  • Windows stdin 编码崩溃(R=P1):stdin 以 utf-8+replace 重配置,非法字节降级不丢扫描
  • 畸形 payload traceback 逃逸(R5):tool_input 非 dict / edits 字符串数组优雅降级 + 钩子分支整体 try 兜底

CLI 与扫描器(批次②)

  • upgrade 破坏安装契约(R4):不再无条件 ALL_HOSTS 重装 + 强推标记段;范围 = 安装戳已装宿主,--host/--force-agents 显式 opt-in
  • CFG 规则对 YAML 整体漏报(R6):JSON/YAML 双形态模式 + (?<![\w."]) 边界防误报
  • 技能模板 API 错误(R7):getEventLoopOfCurrentThread()->(必崩空指针)→ 捕获 req->getLoop();forwardCoro(req, host, port)(第三参是 timeout 非端口)→ "host:port";新增技能文档已知错误模式内容门禁

规范落点(批次③)

  • marketplace 本地 source "." → "./"(R1,官方硬约束)并进门禁
  • Trae 撤下宿主不读的 .trae/rules/*.mdc(R10,V4 证伪),改 .trae/skills + AGENTS.md 双通道,旧产物进无戳兜底清扫
  • npm copyFileSync 丢可执行位(P2):copyAssets 后对 4 个钩子文件 chmodSync(0o755)

门禁与 CI(批次⑤)

  • 一致性门禁 12 → 14 项,三项新/升级守卫做变异自测(人为破坏均被捕获)
  • ci.yml 加 py3.9/3.13 矩阵(requires-python >=3.9 上下界钉住);publish.yml 补 pre-publish 门禁(consistency + 双 sync-check + pytest)
  • 测试 127 → 150(+23 回归例,全程 RED→GREEN);CHANGELOG 登记第三轮整改全表

遗留(按报告批次④"按需"):N3/N4/N5(未投放宿主的技能通道)、L1–L7、真机核实项 V6–V8 未在本轮处理。

…I/hooks, consistency gate

Skills
- drop the non-spec "version" key from all 22 SKILL.md (it is not in the Agent Skills allow-list and would hard-fail packaging/upload) and use the allowed "license" key instead
- make every description trigger-first and enforce it in tests
- unify the forbidden-pattern section across all 22 code-guides (16 renames + 6 new) and enforce a structural contract

CLI
- derive the skill count by enumerating skills/ instead of hardcoding 22
- uninstall --host now handles the bundle kind (was a silent no-op) via an explicit kind -> action map, and removes the bundle group as a whole
- reference-count shared instruction files and shared skill dirs so uninstalling one host never deletes artifacts another host still uses
- verify detects asset drift (modified / missing / unmanaged) from recorded SHA-256
- scan errors also emit JSON when --format json is requested

Hooks
- rules carry a stable rule_id / severity / guide; every rule now has a positive AND a negative fixture (8 rules had no false-positive guard)
- file_category matches exact path segments and filename patterns, so latest.cc is no longer treated as a test file
- SessionStart matcher covers resume; session-start strips C0 control characters and degrades gracefully
- --scan --format without a value exits 2 instead of raising IndexError

Tooling and CI
- add scripts/check-consistency.py (12 cross-artifact checks) and scripts/plugin-capabilities.json (CLI capability contract)
- pin dev dependencies in requirements-dev.txt, enable the pip cache, run the gate in CI
- pin LF for the extensionless hook scripts; a Windows checkout with core.autocrlf would otherwise hand CRLF to bash and silently break both hooks

Tests: 47 -> 127. Gates: 0 -> 12. All green.
…d-2 three-axis review

docs/PROFESSIONALIZATION-REVIEW.md - quantified baseline, A/B/C/D gap list, weighted priorities, acceptance criteria and toolchain recommendations (diagnosis only, nothing installed)
docs/SKILL-AUTHORING.md - the how-to for adding or changing a skill: allowed frontmatter, trigger phrasing, code-guide contract, four-way sync checklist and the hook-rule workflow
docs/SPEC-CORRECTNESS-COMPAT-REVIEW.md - round-2 review across spec compliance, functional correctness and multi-host compatibility; records the claims refuted by official docs and the items that need real-host verification
README / CONTRIBUTING: document the CI gate, pinned dev requirements, the skill authoring manual and the manual verification checklist
CHANGELOG: record both rounds under Unreleased (no version bump)
Hook layer: whitelist to blacklist + Codex apply_patch patch parsing (R3),
fork in SessionStart matcher with set-coverage assertions (R2), stdin
reconfigured utf-8+replace so invalid bytes degrade without losing the
scan (P1), malformed payloads and unexpected errors never traceback
(R5). CLI: upgrade now scopes to stamped hosts and marker injection is
explicit opt-in (R4). Scanner: CFG rules match YAML key forms too (R6).
Skill templates: getEventLoopOfCurrentThread null-deref and forwardCoro
port/timeout misuse fixed, guarded by a content gate (R7). Spec:
marketplace local source "./" (R1), Trae moves from inert .mdc to
.trae/skills + AGENTS.md (R10), npm copy restores the exec bit on hook
scripts (P2). Consistency gate 12 to 14 checks with mutation-tested
guards; CI adds py3.9/3.13 matrix; publish.yml runs pre-publish gates.
pytest 9.x requires Python>=3.10; the ubuntu py3.9 job failed with
"No matching distribution found for pytest==9.1.1". Requirements-file
markers are evaluated by the installing interpreter, so the 3.9 runner
picks 8.4.2 (last 3.9-capable series) and >=3.10 runners keep 9.1.1.
@voidvec
voidvec requested a review from wangrh0909 September 24, 2026 04:40
@voidvec
voidvec merged commit 1faa0e6 into master Sep 24, 2026
9 checks passed
@voidvec
voidvec deleted the feat/professionalization-and-review branch September 24, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants