CLI cannot execute hooks shipped with plugins
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
### Describe the bug
As of 1.0.57, I am unable to issue any prompts to GHCP CLI w/o them failing on preToolUse hook exceptions.
Logs show myriad failures like:
```plaintext
2026-06-03T18:51:15.906Z [DEBUG] [hook stderr] The argument '.github/hooks/governance-audit/audit-session-start.ps1' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2026-06-03T18:51:15.907Z [DEBUG] [hook stdout]
Usage: pwsh[.exe] [-Login] [[-File] [args]]
[-Command { - | [-args ]
| [] } ]
[-CommandWithArgs []
[-ConfigurationName ] [-ConfigurationFile ]
[-CustomPipeName ] [-EncodedCommand ]
[-ExecutionPolicy ] [-InputFormat {Text | XML}]
[-Interactive] [-MTA] [-NoExit] [-NoLogo] [-NonInteractive] [-NoProfile]
[-NoProfileLoadTime] [-OutputFormat {Text | XML}]
[-SettingsFile ] [-SSHServerMode] [-STA]
[-Version] [-WindowStyle ]
[-WorkingDirectory <directoryPath>]
pwsh[.exe] -h | -Help | -? | /?
PowerShell Online Help https://aka.ms/powershell-docs
All parameters are case-insensitive.
2026-06-03T18:51:16.068Z [ERROR] Hook execution failed: HookExitCodeError: Hook command failed with code 1
```
across numerous hook files.
### Affected version
1.0.57+
### Steps to reproduce the behavior
Install one or more plugins (which ship hooks as part of their functionality) into the CLI.
Send a prompt to the CLI with the plugin active & loaded
### Expected behavior
Prompt is processed
### Additional context
I have my Copilot Home and cache dirs set to my dev drive (`d:\.copilot` and `d:\.copilot\cache`, respectively)
贡献指南
调研方向
在 Windows 上使用提供 hooks 的 plugin 复现问题,重点关注 CLI 如何通过 pwsh 调用 plugin 提供的 .ps1 文件。将失败的调用与记录中的 pwsh 用法进行比较,并验证 prompt 能够在没有 preToolUse hook 异常的情况下完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- powershell
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100