Claude Code .po reminder hooks never fire: $CLAUDE_TOOL_INPUT is not set

未關閉 適合新手
#1,248 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
76/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
json, python
領域
tooling

研究方向

從 .claude/settings.json 和 issue 中連結的 Claude Code hooks 參考文件開始。檢查這三個 hook 如何讀取工具輸入並回傳上下文,接著確認針對 library/os.po 描述的 Edit payload 會觸發提醒,而編輯 .py 檔案則不會。完成條件是三則提醒都以 hook 上下文傳達給 Claude,且無關檔案不會產生任何提醒。

由索引模型根據 Issue 內容生成。

描述

The three hooks in .claude/settings.json grep $CLAUDE_TOOL_INPUT for .po". Claude Code doesn't set that variable; it sends the tool call as JSON on stdin (hooks reference: https://code.claude.com/docs/en/hooks). So the grep never matches and none of the reminders print.

Fixing the variable alone isn't enough: for PreToolUse and PostToolUse, plain stdout on exit 0 goes to the debug log, not to Claude. To reach Claude, the hook returns the text as additionalContext. For the PreToolUse one (needs jq):

"command": "case \"$(jq -r '.tool_input.file_path // empty')\" in *.po) echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"additionalContext\":\"[Translation Context] Remember: Use skills translate-po, terminology-check, validate-translation. Check doc-translate/references/terminology.md for terms.\"}}' ;; esac"

The two PostToolUse hooks are the same with "hookEventName":"PostToolUse" and their own text. Tested with the JSON Claude Code sends for an Edit to library/os.po: before, no output; after, the JSON above, and an edit to a .py file prints nothing.

Found this while testing Claude Code hooks for Paveo; uvx paveo doctor flags all three. Happy to open a PR with the fix.

主要語言
Python
星號
286
分支
229
平均合併
13 小時 7 分鐘
30 天內合併 PR
7

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

python/python-docs-zh-tw 的其他 Issue

查看 python/python-docs-zh-tw 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。