Skip to content

fix(setup,aliases): detect new standalone Copilot CLI v2 (BUG-003)#48

Merged
mlorentedev merged 1 commit into
mainfrom
fix/BUG-003-copilot-cli-v2-detection
May 18, 2026
Merged

fix(setup,aliases): detect new standalone Copilot CLI v2 (BUG-003)#48
mlorentedev merged 1 commit into
mainfrom
fix/BUG-003-copilot-cli-v2-detection

Conversation

@mlorentedev
Copy link
Copy Markdown
Owner

Summary

  • BUG-003 fix: dotfiles only knew about the legacy gh extension install github/gh-copilot path. GitHub shipped a new standalone copilot CLI (winget GitHub.Copilot) that is agentic — closer to Claude Code than to the v1 wrappers. On machines with the new CLI installed, setup said "extension not installed, skipping" and never deployed copilot-instructions.md — the AI-013 pointer-style refactor was functionally inert there.
  • Detection swap, auto-install on Windows via winget, idempotent cleanup of the stale eval line on Linux, alias rename ghcs/ghcecop/cops (old semantics dead in v2, same names would be a cognitive trap), env-contract update, parity bats asserts.

Why

Empirical discovery on the admin Windows machine on 2026-05-18, while validating BUG-001 (#40). The vault entry for BUG-001 explicitly flagged Windows empirical validation as pending — this PR closes that loop AND modernises the integration surface.

Same class as PR #47 (BUG-002): a deploy invariant silently broken by an upstream product change, not surfaced until empirical exercise.

Test plan

  • PSScriptAnalyzer clean on setup-windows.ps1 + powershell/profile.ps1 (Error+Warning)
  • bash -n clean on setup-linux.sh + .zsh/aliases.zsh
  • jq empty env-contract.json valid
  • Bats asserts (simulated locally via grep): all 9 new asserts green
  • Empirical smoke on admin Windows machine: setup output shows [INFO] GitHub Copilot CLI already installed[INFO] GitHub Copilot CLI detected at ...copilot.exe, deploying configuration...[SUCCESS] copilot-instructions.md deployed successfully (verified pointer to AGENTS.md)[SUCCESS] GitHub Copilot CLI configured (aliases cop/cops in profile.ps1). WIN-003 + BUG-002 regression-free in the same run.
  • CI: bats + PSScriptAnalyzer + shellcheck jobs green
  • Post-merge: open a fresh PowerShell, run cop --version (sanity); cops "list 3 largest files in cwd" (agentic smoke — requires copilot login previously, which the user has confirmed)

Out of scope (deferred to future work)

  • AWS Copilot CLI (Amazon.CopilotCLI) shares the binary name copilot. If both installed, Get-Command resolves to the first on PATH. Documented as inline comment; <1% population, BUG-004 if it surfaces.
  • Linux auto-install — distro variance. The detect-and-act info message points to docs.
  • copilot init repo integration vs our init-repo-agents.sh/.ps1 convivencia — needs its own spec when relevant.

Empirical discovery on the admin Windows machine while validating BUG-001 (#40):
GitHub shipped a new standalone `copilot` CLI (winget GitHub.Copilot) that is
agentic in nature (closer to Claude Code than to the legacy gh-copilot
extension's suggest/explain wrappers). The dotfiles setup only knew about
the v1 extension path, so on machines with the new CLI installed and operative
it would log "extension not installed, skipping" and never deploy
copilot-instructions.md -- the AI-013 pointer-style refactor was functionally
inert on those machines.

Changes:
- setup-windows.ps1: drop `gh extension list` detection; detect via
  `Get-Command copilot`; auto-install GitHub.Copilot via winget in the dev
  tools block; refresh PATH after the winget loop so newly-installed tools
  (Copilot included) are visible to subsequent blocks of the same run.
- setup-linux.sh: same detection swap (`command -v copilot`); no auto-install
  (distros vary); idempotent cleanup of the stale
  `eval "$(gh copilot alias -- bash)"` line that the previous setup added to
  .zshrc/.bashrc (the subcommand does not exist in the v2 CLI and errors on
  every shell startup).
- powershell/profile.ps1 + .zsh/aliases.zsh: rename ghcs/ghce to cop/cops.
  Reason: old aliases wrapped `gh copilot suggest/explain` which no longer
  exist; same names with different semantics would be a cognitive trap.
  cop = interactive agent (tool use confirmed); cops = single-shot
  non-interactive with --allow-all-tools (required by the v2 CLI for -p mode).
- env-contract.json: add `copilot` to optional_binaries, update `gh` purpose
  string to reflect that Copilot is no longer a gh extension.
- tests: parity asserts in setup-windows.bats and aliases.bats lock in the
  new detection + alias names + absence of legacy references.

Verification (empirical, this machine, 2026-05-18):
- winget GitHub.Copilot recognises pre-installed v1.0.48 (no re-install)
- PATH refresh exposes `copilot.exe` to the subsequent setup block
- `Get-Command copilot` returns the WinGet packages path; deploy succeeds;
  copilot-instructions.md verified pointer to AGENTS.md
- WIN-003 SessionStart hook self-heal and BUG-002 CLAUDE/GEMINI verify-strings
  regression-free in same setup run

Out of scope (deferred):
- AWS Copilot CLI (Amazon.CopilotCLI) name collision -- documented in inline
  comment; <1% population, BUG-004 if it surfaces.
- Linux auto-install -- distros vary; manual install documented in the
  detect-and-act info message.
@mlorentedev mlorentedev merged commit 49bb58e into main May 18, 2026
5 checks passed
@mlorentedev mlorentedev deleted the fix/BUG-003-copilot-cli-v2-detection branch May 18, 2026 17:40
mlorentedev added a commit that referenced this pull request May 18, 2026
chore(specs): retroactive archive for BUG-003 (PR #48)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant