Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

permissionRequest hook: the input payload is not documented

Aberta Para iniciantes
#46,334 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
1/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
72/100
Tipo de issue
Documentação
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
json, markdown
Domínio
documentation

Direção de pesquisa

O material que falta pertence a hooks-reference.md, ao lado da seção existente "Hook event input payloads", que cobre de sessionStart até agentStop. Leia como essas subseções estão organizadas e depois adicione uma subseção permissionRequest com os campos de payload listados na issue. Está concluído quando a página documenta toolName, toolInput e permissionSuggestions com os valores bash e powershell, e as notas de comportamento foram conferidas com o repro da issue.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
21k
Forks
69.1k
Merge médio
10h 32min
PRs com merge (30d)
103

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de github/docs

Todas as issues de github/docs

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.