Context
When using GitHub Copilot CLI in a trusted, git-tracked repo, every file create/edit triggers a manual "accept" prompt. For routine edits this is a lot of clicking, and git already provides the safety net (/diff, /rewind, git restore).
Copilot CLI can pre-approve the non-shell file-modifying tools via the write permission:
copilot --allow-tool='write'
This pre-approves file create/edit only. Shell (shell/bash) stays gated, and MCP tools (e.g. WorkIQ) are unaffected, so it stays least-privilege.
Proposal
Add a copilot wrapper (function + alias) that always passes --allow-tool='write' (optionally plus read-only git), so interactive sessions stop prompting on every edit.
Suggested default:
copilot --allow-tool='write,shell(git status),shell(git diff)'
Where
- Simple version: a function in
home/dot_config/powershell/aliases.ps1.
- Preferred (matches the existing
CopilotSsh.ps1 pattern): an Invoke-Copilot function in home/dot_config/powershell/modules/DotfilesHelpers/Public/Copilot.ps1 with a copilot alias, documented in docs/copilot-cli.md.
Implementation notes
-
Avoid infinite recursion. A function named copilot must call the real executable, not itself. Resolve it explicitly:
function Invoke-Copilot {
$exe = Get-Command copilot.exe -CommandType Application -ErrorAction SilentlyContinue |
Select-Object -First 1
if (-not $exe) { throw 'copilot CLI not found on PATH' }
& $exe.Source --allow-tool="$($env:COPILOT_ALLOW_TOOLS ?? 'write')" @args
}
Set-Alias copilot Invoke-Copilot
-
Keep an escape hatch. Allow running the raw CLI (e.g. copilot.exe ..., or a -Raw switch) when you deliberately want every prompt.
-
Make the allowed tools configurable via an env var (e.g. $env:COPILOT_ALLOW_TOOLS, default write) so the list can be widened/narrowed without editing the function.
-
Do NOT use --allow-all-tools / --yolo — too broad (grants shell + URLs).
Acceptance criteria
References
Context
When using GitHub Copilot CLI in a trusted, git-tracked repo, every file create/edit triggers a manual "accept" prompt. For routine edits this is a lot of clicking, and git already provides the safety net (
/diff,/rewind,git restore).Copilot CLI can pre-approve the non-shell file-modifying tools via the
writepermission:This pre-approves file create/edit only. Shell (
shell/bash) stays gated, and MCP tools (e.g. WorkIQ) are unaffected, so it stays least-privilege.Proposal
Add a
copilotwrapper (function + alias) that always passes--allow-tool='write'(optionally plus read-only git), so interactive sessions stop prompting on every edit.Suggested default:
Where
home/dot_config/powershell/aliases.ps1.CopilotSsh.ps1pattern): anInvoke-Copilotfunction inhome/dot_config/powershell/modules/DotfilesHelpers/Public/Copilot.ps1with acopilotalias, documented indocs/copilot-cli.md.Implementation notes
Avoid infinite recursion. A function named
copilotmust call the real executable, not itself. Resolve it explicitly:Keep an escape hatch. Allow running the raw CLI (e.g.
copilot.exe ..., or a-Rawswitch) when you deliberately want every prompt.Make the allowed tools configurable via an env var (e.g.
$env:COPILOT_ALLOW_TOOLS, defaultwrite) so the list can be widened/narrowed without editing the function.Do NOT use
--allow-all-tools/--yolo— too broad (grants shell + URLs).Acceptance criteria
copilotinteractively no longer prompts for each file create/edit.home/Documents/PowerShell/profile.ps1).docs/copilot-cli.md.References
--allow-tool/--deny-tool): https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli#allowed-toolshome/dot_config/powershell/modules/DotfilesHelpers/Public/CopilotSsh.ps1