feat: doc-blocker を slop パターン拒否方式に反転(#112、v0.62.0)#127
Conversation
- allowlist 外全拒否 + exit 2 を撤廃し、SUMMARY/REPORT 系のアドホック文書名のみ permissionDecision: ask に降格 - 一般文書(CHANGELOG.md / LICENSE.txt / docs/** / ADR 等)は素通し - キット出力先 allowlist は常時許可として維持(slop 名でも許可、評価順序テスト付き) - 確認メッセージに対象パス・復帰手段を明記 Closes #112
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b23efe0e69
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return "$matched" | ||
| } | ||
|
|
||
| if [[ "$file_path" =~ \.(md|txt)$ ]] && ! _doc_blocker_allowed_path "$file_path"; then |
There was a problem hiding this comment.
Match uppercase doc extensions before allowing slop files
When the Write target is a slop filename with an uppercase extension such as SUMMARY.MD or NOTES.TXT, this outer case-sensitive \.(md|txt)$ guard fails before _doc_blocker_slop_name can run its nocasematch regex, so the hook falls through and allows the write instead of returning the intended permissionDecision: "ask". This leaves a simple filename casing bypass for the new case-insensitive deny-by-pattern behavior.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR modernizes the doc-blocker hook by inverting it from a strict allowlist + hard block to a deny-by-pattern guard that only intervenes on “slop” doc filenames (e.g., SUMMARY/REPORT/FINDINGS…), and it downgrades intervention from blocking (exit 2) to an interactive permission ask.
Changes:
- Update
check-doc-write.shto allow most documentation writes and emitpermissionDecision: "ask"only for slop-pattern doc names (while keeping existing always-allowed kit output paths). - Update unit tests/fixtures to assert the new “ask” behavior and ensure allowlist precedence over slop detection.
- Refresh user-facing documentation/strings and add a v0.62.0 changelog entry describing the behavior change.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| features/doc-blocker/scripts/check-doc-write.sh | Implements deny-by-pattern detection and emits permissionDecision: ask for slop doc names instead of exiting 2 |
| tests/unit/test-doc-blocker.sh | Updates unit coverage for allow/pass/ask behavior and verifies exit-2 hard blocks are removed |
| tests/unit/test-hook-fixtures.sh | Adjusts fixture smoke test to expect permissionDecision: ask output for the doc write fixture |
| features/doc-blocker/feature.json | Updates feature description to reflect ask-only behavior for slop-pattern docs |
| README.md | Updates hook table description for doc-blocker’s new behavior |
| README.en.md | English README update for doc-blocker’s new behavior |
| i18n/ja/strings.sh | Updates Japanese wizard hook description string for doc-blocker |
| i18n/en/strings.sh | Updates English wizard hook description string for doc-blocker |
| docs/wizard-config-mapping.md | Updates config mapping doc for doc-blocker behavior |
| docs/wizard-config-mapping.en.md | English mapping doc update for doc-blocker behavior |
| CHANGELOG.md | Adds v0.62.0 entry documenting the behavioral inversion and ask downgrade |
| _doc_blocker_slop_name() { | ||
| local base="$1" | ||
| local matched=1 | ||
| shopt -s nocasematch | ||
| if [[ "$base" =~ ^(.*_)?(SUMMARY|REPORT|FINDINGS|ANALYSIS|NOTES|RESULTS|TAKEAWAYS)(_.*)?\.(md|txt)$ ]]; then | ||
| matched=0 | ||
| fi | ||
| shopt -u nocasematch | ||
| return "$matched" | ||
| } |
| return "$matched" | ||
| } | ||
|
|
||
| if [[ "$file_path" =~ \.(md|txt)$ ]] && ! _doc_blocker_allowed_path "$file_path"; then |
概要
LLM 性能監査計画 #121 の P2-06(#112)。doc-blocker を「allowlist 外は全拒否(exit 2)」から「slop パターンのみ確認に降格」へ反転する。
変更内容
hookSpecificOutput.permissionDecision: askを出力(公式 hooks 仕様の必須フィールド hookEventName 込み。仕様は code.claude.com/docs/en/hooks で確認済み)。ユーザーが明示依頼した文書なら 1 確認で通せる検証
Closes #112