Make warn-plugin-cache-walk's fast exit test the command, not the whole payload
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 70/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- bash, git, shell
- 領域
- performance, testing, tooling
研究方向
Start with plugins/guardrails/hooks/warn-plugin-cache-walk.sh, especially lines 18, 23, and 26, and inspect the existing tests for this hook. Feed JSON on stdin with a realistic transcript_path under ~/.claude; verify a command without .claude/ or CLAUDE_CONFIG_DIR exits before jq and that verdicts stay unchanged. Measure per-call time before and after on Windows Git Bash and record it in the PR.
由索引模型根據 Issue 內容生成。
描述
Problem
plugins/guardrails/hooks/warn-plugin-cache-walk.sh:18 is meant to exit early when a call cannot touch
~/.claude, before jq runs. It tests the whole PreToolUse payload for .claude/ or
claude_config_dir. Every payload carries transcript_path, which sits under ~/.claude/projects/,
so the test always matches and the early exit never fires. Every Bash call then pays for the jq
parse at :23; the real check on the command at :26 still decides correctly.
Evidence
- Read on
origin/mainthis pass: the test at:18runs on${INPUT,,}, the raw payload;:26
repeats it on.tool_input.command. - Inferred, not measured: the per-call cost of the extra
jqparse on Windows.
Proposed approach
Make the fast test ignore transcript_path and cwd (for example, match only text after
"command":), or drop :18 if it cannot be made cheaper than the jq parse. Measure before and
after on Windows Git Bash.
Acceptance criteria
- A Bash call whose command does not mention
.claude/orCLAUDE_CONFIG_DIRexits beforejqruns, with a transcript path under~/.claudein the payload. - Verdicts unchanged: existing tests pass, plus a test with a realistic
transcript_path. - Measured per-call time before and after, recorded in the PR.
Constraints and gotchas
- Never loosen the guard; this is a speed change with verdict parity.
- Test only by feeding JSON on stdin.
Context
Found while researching #21019 (closed). Part of the hook-speed work under #20549.
- 主要語言
- Shell
- 星號
- 22
- 分支
- 2
- 平均合併
- 3 小時 20 分鐘
- 30 天內合併 PR
- 956
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
melodic-software/claude-code-plugins 的其他 Issue
-
host-run needs-research
難度 2/5 1-3 小時 新手友好度 66/100
melodic-software/claude-code-plugins#21140 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
melodic-software/claude-code-plugins#21103 · 4 則留言 ·
維護者通常 1 天內回覆
-
host-run
難度 2/5 1-3 小時 新手友好度 72/100
melodic-software/claude-code-plugins#21053 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
melodic-software/claude-code-plugins#21021 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
melodic-software/claude-code-plugins#20960 · 5 則留言 ·
維護者通常 1 天內回覆
查看 melodic-software/claude-code-plugins 的全部 Issue
相似的 Issue
-
documentation enhancement
難度 2/5 1-3 小時 新手友好度 82/100
aws/aws-networking-best-practices#256 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
fossi-foundation/globalfoundries-pdk-libs-gf180mcu_fd_pv#61 ·
-
openai-directory
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 68/100
smores56/homelab-platform#289 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
omacom/omarchy#21787 · 3 則留言 ·
維護者通常 1 天內回覆