[Windows] PowerShell tool guidance: prefer -LiteralPath for file paths (brackets are wildcards with -Path)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 74/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- powershell
- Área
- developer-experience
Línea de trabajo
Busca las instrucciones de la herramienta PowerShell integrada y lee los consejos existentes para Windows sobre && frente a ; y los here-documents. Añade instrucciones concisas para usar -LiteralPath con rutas de origen concretas cuando sea compatible y reservar -Path para la búsqueda intencionada con comodines. El trabajo estará terminado cuando las instrucciones cubran la diferencia y los cmdlets indicados para rutas de origen, sin dar a entender que se aplica a los parámetros de destino.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the feature or problem you'd like to solve
On Windows, the agent often passes file names containing [ ] to cmdlets via -Path (the default), so PowerShell treats them as wildcards: commands fail, Test-Path returns a false negative, and Remove-Item can delete a different file.
Proposed solution
Add a line to the built-in PowerShell tool guidance, alongside the existing Windows tips (&& vs ;, no heredoc), for example:
For concrete filesystem paths, prefer
-LiteralPathwhere supported; quoting-Pathdoes not disable wildcard expansion ([ ] * ?). Use-Pathonly when wildcard matching is intentional. (This applies to source paths such asGet-Content,Set-Content,Test-Path,Remove-Item,Copy-Item,Move-Item,Rename-Item,Get-ChildItem; not to destination parameters.)
Benefit: fewer failed tool calls and retries, and it reduces the risk of acting on the wrong file (data loss with Remove-Item / Move-Item / Set-Content).
Example prompts or workflows
- "Rename the scans in this folder to yyyy-MM-dd format": files like
scan[2].jpgfail with-Path; the agent then retries with-LiteralPath. - "Delete del[2].jpg":
Remove-Item -Path 'del[2].jpg'deletesdel2.jpgif it exists, and the requested file stays. - "Edit notes [draft].md":
Set-Content -Pathfails with "An object at the specified path ... does not exist".
Additional context
Repro (pwsh 7.6.9, Copilot CLI 1.0.105, Windows):
Set-Content -LiteralPath 'a[1].txt' x
Test-Path -Path 'a[1].txt' # False (file exists)
Get-Content -Path 'a[1].txt' # error: An object at the specified path a[1].txt does not exist...
Set-Content a1.txt y
Remove-Item -Path 'a[1].txt' # deletes a1.txt, keeps a[1].txt
Docs: about_Wildcards and Supporting Wildcard Characters in Cmdlet Parameters / -LiteralPath.
Filed as a feature request rather than a bug: PowerShell behaves as designed; the ask is guidance for the model. No existing issue found for "LiteralPath".
- Lenguaje dominante
- Python
- Estrellas
- 11.5k
- Forks
- 2k
- Merge medio
- 6 h 34 min
- PR fusionados (30 d)
- 3
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de github/copilot-cli
-
area:plugins
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
github/copilot-cli#5567 ·
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
github/copilot-cli#5489 ·
-
Built-in functions.view returns no content for large files despite documenting automatic truncationAbiertoarea:tools
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
github/copilot-cli#5476 ·
-
triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
github/copilot-cli#5377 ·
-
area:configuration area:models
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
github/copilot-cli#5287 ·
Todos los issues de github/copilot-cli
Issues similares
-
fidelity
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
backlog
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
sagemathinc/sagebrush#3434 ·
Los mantenedores suelen responder en 1 día
-
marketing
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
documentation good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
wuisabel-gif/MemWhale#576 ·
Los mantenedores suelen responder en 1 día
-
Status: Triage Suggestion
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
GTNewHorizons/GT-New-Horizons-Modpack#27957 ·
Los mantenedores suelen responder en 1 día