Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

permissionRequest hook: the input payload is not documented

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

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1-3 小時
新手友好度
72/100
Issue 類型
文件
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
json, markdown
領域
documentation

研究方向

缺少的內容應放在 hooks-reference.md 中,緊接在現有的「Hook event input payloads」一節之後,該節涵蓋 sessionStart 至 agentStop。請先閱讀這些子小節的結構,然後新增一個 permissionRequest 子小節,其中包含 issue 中列出的 payload 欄位。完成標準是:頁面記錄了 toolName、toolInput 和 permissionSuggestions(包括 bash 和 powershell 的值),且行為說明已對照 issue 中的重現步驟進行核對。

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

描述

builder persona content copilot

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 (bash on Unix, powershell on Windows).
  • toolInput — the arguments for that tool; for shell tools the command is toolInput.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:

  • permissionRequest does not fire for the read and hook permission kinds.
  • Exit code 2 denies; any other non-zero exit is logged and falls through (fail-open), unlike preToolUse, 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

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

從這裡開始

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

github/docs 的其他 Issue

查看 github/docs 的全部 Issue

相似的 Issue

更多 TypeScript Issue

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

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