github / github/copilot-cli

Cross-tool  .claude/settings.local.json  hooks with shell operators ( || ,  && ) break on Windows PowerShell

Abierto
#4,399 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

area:configuration area:platform-windows
Lenguaje dominante
Shell
Estrellas
11.2k
Forks
1.9k
Merge medio
14 h 16 min
PR fusionados (30 d)
6

Descripción

Describe the bug

When a repository contains a Claude Code hook config ( .claude/settings.local.json  or  .claude/settings.json ) with a  PreToolUse  hook defined via a single cross-platform  command  string containing POSIX shell operators (e.g.  ... || echo {} ), Copilot CLI fails to execute that hook correctly on Windows, which can block all subsequent tool calls gated by that hook.

Root cause hypothesis:
Claude Code executes these same hook commands via git-bash on Windows, so  || / &&  work there. Copilot CLI's cross-tool compatibility layer, per the hooks reference, reads  .claude/settings*.json  files but runs the single  command  string as the native Windows  powershell  fallback rather than replicating Claude Code's git-bash execution context. This makes any Claude hook authored with POSIX-only shell syntax silently non-functional (and blocking) on Windows.

Affected version

No response

Steps to reproduce the behavior
  1. On Windows, in a repo, create  .claude/settings.local.json  with:
    {
    "hooks": {
    "PreToolUse": [
    {
    "matcher": "Bash",
    "hooks": [
    { "type": "command", "command": ""C:\path\to\tool.exe" some-check || echo {}" }
    ]
    }
    ]
    }
    }
  2. Launch  copilot  in a native Windows PowerShell (5.1) terminal in that repo.
  3. Attempt any shell/Bash tool call.
Expected behavior

Expected behavior:
The hook executes successfully and either allows or blocks the tool call based on its actual logic, consistent with how the same config works under Claude Code.

Actual behavior:
The tool call is blocked.  /env  confirms the hook is loaded ("preToolUse: N hooks, source: repo settings"), but the underlying command fails silently, because  ||  is invalid syntax in Windows PowerShell 5.1 — the shell that Copilot CLI uses to run the hook (per the docs, the  command  field is used as a fallback for both  bash  and  powershell  execution).

Additional context

Windows 11 Enterprise, PowerShell terminal (Windows PowerShell 5.1, not  pwsh  7+)

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el problema con .claude/settings.local.json o .claude/settings.json, un comando PreToolUse que use || y Copilot CLI en Windows PowerShell 5.1. Comprueba /env para confirmar el origen del hook y observa si el comando falla durante una llamada a la herramienta Bash. Se considera completado cuando el hook se ejecuta correctamente y permite o bloquea la llamada a la herramienta según su resultado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
powershell, shell
Área
cli
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.