feat(hook-enablement): add the shared layer-resolution helper and the count-script check

Đang mở
#19,284 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
shell, yaml
Lĩnh vực
tooling

Hướng nghiên cứu

Start with docs/contracts/hook-enablement/README.md and docs/contracts/hook-config-delivery/README.md to understand the layer precedence and hook configuration channel, then inspect plugins/session-flow/scripts/focus.py for the existing resolver. Define and test the shared helper across each supported runtime and git-hook path, and measure its hook-fire cost against the hook budget. Done means the helper, documentation, and CI check are in place, and the check initially lists the 11 plugins named in the issue.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Context

The hook-enablement convention (docs/contracts/hook-enablement/README.md, "The per-hook setting") has each hook's own script resolve the plugin default, the user layer and the repository layer before it does any work, with the user's explicit value winning over the repository value. Only plugins/session-flow/scripts/focus.py (enabled()) does this today. The other hook plugins read the user layer alone (for example plugins/bash-format/hooks/hooks.json launches through --run-if-unset-or-true BASH_FORMAT_ENABLED), and 11 plugins have no setting. Without one shared resolver, each per-plugin change would copy the precedence and drift.

Owner decision on #18921 (2026-11-25): build one shared layer-resolution helper first, commit the count script as the acceptance check, and file one issue per plugin.

Proposed work

Build the shared helper, then commit the count script as its check.

Acceptance criteria

  • A helper resolves one <name>_enabled key from the plugin default, the user layer and the repository layer, in the convention's precedence: an explicit user value wins; otherwise the repository value; otherwise the plugin default.
  • The user layer reads CLAUDE_PLUGIN_OPTION_<KEY> only when set (an unset option exports nothing), through the channel docs/contracts/hook-config-delivery/README.md picks for the hook.
  • The repository layer reads the key from docs/conventions/<plugin>.yaml (or the repository's bound convention home) under the project root Claude Code passes.
  • A value that is not an unquoted true or false is named with its file or option and dropped, per config-cascade "The layers".
  • The git-hook path reads the user layer from the plugin's pluginConfigs entry in the user's Claude Code settings and the repository layer from the top-level docs/conventions/<plugin>.yaml; unset when the settings file or entry is absent.
  • The security-control variant exists: for a guard whose off state loosens a security control, a repository false is ignored and only the user's own false turns the guard off.
  • Tests cover, per runtime the helper supports: user false over repository true; user true over repository false; user unset with repository false (off); user unset with repository true (on); both unset (plugin default); invalid value dropped and named; the security-control variant.
  • The helper's cost on a hook fire is measured and recorded against docs/contracts/hook-budget/README.md.
  • docs/contracts/hook-enablement/README.md names the helper and how a plugin consumes it, and the "Adopters" section still points at #18921.
  • The count script is committed as a check (a test or a script wired into CI) that, over plugins/*/hooks/hooks.json and each plugin's userConfig keys, lists every plugin with a hook lacking its <name>_enabled option; its starting output matches the 11-plugin list in #18921 (animation, context-budget, discovery, display-redaction, explainer-video, multi-agent, playwright, plugin-profiles, speech, themes, toolchain).
  • The check's documentation states how a hook maps to its key, so each per-plugin child can be verified against it.
  • #18921 states that the whole retrofit is accepted when the check lists no plugin.

Parent: #18921

Ngôn ngữ chính
Shell
Star
22
Fork
2
Merge trung bình
2 giờ 1 phút
Pull request đã merge (30 ngày)
972

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của melodic-software/claude-code-plugins

Tất cả issue của melodic-software/claude-code-plugins

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.