github / github/copilot-cli

$TOOL_INPUT_FILE_PATH for chat hooks doesn't work

未關閉
#3,223 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:plugins
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### Describe the bug

https://code.visualstudio.com/docs/copilot/customization/hooks#_quick-start-your-first-hook

I tested the exact script provided there (prettier) and it complains
`2026-05-10 19:33:34.811 [info] [#38] [PostToolUse] Output: [error] No parser and no file path given, couldn't infer a parser.`

So I did a print of that variable, it doesn't seem to parse/pass correctly.

```
{
"hooks": {
"PostToolUse": [
{
"type": "command",
"command": "echo \"file path is $TOOL_INPUT_FILE_PATH\"",
}
]
}
}
```

2026-05-10 20:24:19.441 [info] [#42] [PostToolUse] Output: file path is

### Affected version

VS 1.119.0

### Steps to reproduce the behavior

Literally https://code.visualstudio.com/docs/copilot/customization/hooks#_quick-start-your-first-hook
And then tell copilot to make an edit and watch the github copilot chat hooks output

### Expected behavior

$TOOL_INPUT_FILE_PATH to be populated with the path of the file edited by copilot.

### Additional context

_No response_

貢獻指南

開啟貢獻指南

研究方向

從連結的 VS Code Copilot hooks quick-start 開始,並在 VS 1.119.0 上重現 Prettier 指令。檢查 PostToolUse hook 的輸出是否包含 TOOL_INPUT_FILE_PATH,並將其與已編輯檔案的路徑進行比較。當該變數在編輯操作中有值,且文件中的 script 執行時沒有 parser 錯誤或缺少路徑錯誤時,即表示完成。

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

評估

技術堆疊
shell, vscode
領域
cli, tooling
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
55/100

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

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