permissionRequest hook: the input payload is not documented
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 1/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 72/100
- Issue 類型
- 文件
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- json, markdown
研究方向
缺少的內容應放在 hooks-reference.md 中,緊接在現有的「Hook event input payloads」一節之後,該節涵蓋 sessionStart 至 agentStop。請先閱讀這些子小節的結構,然後新增一個 permissionRequest 子小節,其中包含 issue 中列出的 payload 欄位。完成標準是:頁面記錄了 toolName、toolInput 和 permissionSuggestions(包括 bash 和 powershell 的值),且行為說明已對照 issue 中的重現步驟進行核對。
由索引模型根據 Issue 內容生成。
描述
What is missing
hooks-reference.md has a "Hook event input payloads" section that documents the stdin payload for sessionStart, sessionEnd, userPromptSubmitted, userPromptTransformed, preToolUse, postToolUse, postToolUseFailure and agentStop. permissionRequest is not among them, and it has no payload subsection anywhere else on the page.
Why it matters
permissionRequest is the only hook that can pre-approve a tool call — returning {"behavior":"allow"} short-circuits the permission service. Its decision-control section tells you to return behavior / message / interrupt, but to write a useful hook you need the tool name and the tool input, and neither field is documented. You have to discover them by writing a hook that dumps stdin to a file, which is how I obtained the payload below.
Payload actually received (CLI 1.0.98, Windows; toolName is powershell on Windows and bash on Unix):
{
"hookName": "permissionRequest",
"sessionId": "…",
"timestamp": 1792065216069,
"cwd": "C:\\src\\my-repo",
"toolName": "powershell",
"toolInput": { "command": "git status" },
"permissionSuggestions": []
}
Suggested addition — a subsection alongside the other events:
permissionRequest{ "hookName": "permissionRequest", "sessionId": "...", "timestamp": 0, "cwd": "/path/to/repo", "toolName": "bash", "toolInput": { "command": "git status" }, "permissionSuggestions": [] }
toolName— the tool being requested (bashon Unix,powershellon Windows).toolInput— the arguments for that tool; for shell tools the command istoolInput.command.permissionSuggestions— the permission rules the CLI would otherwise offer to save.
Two behaviours worth documenting on the same page, if they are not already:
permissionRequestdoes not fire for thereadandhookpermission kinds.- Exit code
2denies; any other non-zero exit is logged and falls through (fail-open), unlikepreToolUse, which is fail-closed. Timeouts are fail-open for every event.
Repro to capture the payload
{
"hooks": {
"permissionRequest": [
{ "type": "command", "bash": "cat > /tmp/perm-payload.json" }
]
}
}
Then run any shell tool and read /tmp/perm-payload.json.
- 主要語言
- TypeScript
- 星號
- 21k
- 分支
- 69.1k
- 平均合併
- 10 小時 32 分鐘
- 30 天內合併 PR
- 103
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
github/docs 的其他 Issue
-
triage
難度 2/5 1-3 小時 新手友好度 62/100
github/docs#46365 · 3 則留言 · 2 個 reaction ·
維護者通常 1 天內回覆
-
triage
難度 1/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
Incorrect Auto Tier Availability Information in Copilot Documentation可能已有人在做 @ashis-baral 於 2 天前認領。 未關閉content triage
難度 1/5 1 小時以內 新手友好度 73/100
維護者通常 1 天內回覆
-
Update VS Code instructions for creating a prompt file可能已有人在做 @ashis-baral 於 5 天前認領。 未關閉content
難度 1/5 1 小時以內 新手友好度 88/100
維護者通常 1 天內回覆
-
actions builder persona
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
Koenkk/zigbee-herdsman-converters#13540 ·
維護者通常 1 天內回覆
-
check:passed streams:add
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
area/busola/ux
難度 2/5 1-3 小時 新手友好度 68/100
kyma-project/busola#5442 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
vercel-labs/wterm#246 ·
維護者通常 1 天內回覆