Skip to content

feat(hosts): add GitHub Copilot CLI as 11th supported host#1291

Open
Bharath-varma-p wants to merge 4 commits intogarrytan:mainfrom
Bharath-varma-p:feat/copilot-host
Open

feat(hosts): add GitHub Copilot CLI as 11th supported host#1291
Bharath-varma-p wants to merge 4 commits intogarrytan:mainfrom
Bharath-varma-p:feat/copilot-host

Conversation

@Bharath-varma-p
Copy link
Copy Markdown

@Bharath-varma-p Bharath-varma-p commented May 1, 2026

What

Adds GitHub Copilot CLI as the 11th supported host in gstack, following the declarative ADDING_A_HOST.md pattern. Closes the gap that opened in Copilot CLI v1.0.36 (Apr 24, 2026) when ~/.claude/ skills stopped being auto-loaded.

After this PR, users on the standalone copilot CLI can:

./setup --host copilot
copilot
> /skills list   # all 43 gstack skills, namespaced as /gstack-*

Why

How (4 commits, ~450 lines, 9 files)

  1. feat(hosts): add GitHub Copilot CLI as 11th supported host

    • New hosts/copilot.ts declarative HostConfig
    • Registers in hosts/index.ts, bumps host count assertion (10 -> 11)
    • cliCommand: 'copilot' (the standalone npm @github/copilot binary, not the older gh copilot extension)
    • globalRoot: '.copilot/skills/gstack', localSkillRoot: '.copilot/skills'
    • frontmatter allowlist of {name, description} (strips Claude's allowed-tools array which Copilot's shell field would reject)
    • skipSkills: ['codex', 'pair-agent'] (codex is a Claude wrapper around codex exec; pair-agent depends on Claude streaming)
    • suppressedResolvers: REVIEW_ARMY, ADVERSARIAL_STEP, DESIGN_OUTSIDE_VOICES, CODEX_SECOND_OPINION, CODEX_PLAN_REVIEW, GBRAIN_* (these expand to Claude subagent_type blocks that don't translate)
    • boundaryInstruction scoped to FOREIGN home dirs only (~/.claude, ~/.codex, etc.); the repo-local .claude/skills/ is allowed since Copilot officially reads it.
  2. feat(hosts): add tool name rewrites for Copilot CLI compatibility

    • Comprehensive toolRewrites covers 3 patterns per tool: use the X tool, the X tool, bare X tool (catches (Read tool), (via Agent tool) parenthesized usages).
    • Mapping: Bash -> bash, Read -> view, Write -> create, Edit -> edit, Agent -> task, Grep -> grep, Glob -> glob, AskUserQuestion -> ask_user.
    • WebSearch is intentionally not rewritten (semantically wrong: web_fetch retrieves URLs, not searches).
    • Verified post-rewrite: zero Read tool|Write tool|Bash tool|Agent tool|... substrings remain in the generated 47k-line ~/.copilot/skills/ tree.
  3. feat(setup): add --host copilot install support

    • --host copilot validation, INSTALL_COPILOT plumbing, generation step (1e), helper functions create_copilot_runtime_root + link_copilot_skill_dirs, install dispatcher block (6d).
    • Mirrors the opencode pattern exactly.
    • Verified end-to-end: ./setup --host copilot linked 43 skills into ~/.copilot/skills/; copilot then shows them under /skills list.
  4. docs(copilot): README install section, gstack-uninstall coverage, docs/COPILOT.md

    • README: bumps host count, adds Copilot row to the host table, adds dedicated install subsection (npm/brew/winget) with v1 scope notes.
    • bin/gstack-uninstall: adds ~/.copilot/skills/gstack* to the cleanup block and confirmation prompt (mirrors Kiro).
    • docs/COPILOT.md: integration guide with tool-name translation table, v1 scope rationale, custom-instructions location matrix, troubleshooting.

Differences vs PR #1044

I learned from #1044's groundwork; here are the deltas:

Concern #1044 This PR
cliAliases ['gh'] none (the gh copilot extension is a different product; this is the standalone copilot binary)
Tool rewrites 2 patterns 3 patterns (adds bare X tool to catch (Read tool) parenthesized refs)
pair-agent not skipped skipped (depends on Claude streaming)
Orchestration resolvers (REVIEW_ARMY etc.) inherited verbatim suppressedResolvers (Claude subagent_type syntax doesn't run on Copilot)
WebSearch rewritten to web_fetch intentionally left alone (semantic mismatch)
localSkillRoot .github/skills/gstack .copilot/skills (avoids creating tracked-by-default git noise; Copilot reads .copilot/skills/ natively)
Branch base ~32 commits behind main rebased on current main

Validation

  • bun run scripts/host-config-export.ts validate -> "All 11 configs valid"
  • bun test test/host-config.test.ts test/gen-skill-docs.test.ts -> 455 tests, 0 fail, 5623 expects
  • bun test (full suite) -> 2217 pass / 8 fail. The 8 failures are pre-existing baseline (doc-inventory cross-check for AGENTS.md/skills.md, ship-version-sync VERSION/pkg drift, read_secret_to_env var-name validation, port-detection race tests). Zero regressions.
  • Real install: ./setup --host copilot -> 43 skills linked into ~/.copilot/skills/; copilot -> /skills list shows them.
  • bun run gen:skill-docs --host all -> 47074 lines, 541k tokens, no host-specific errors.

v1 scope (intentional)

This PR ships a focused v1. The following are deferred to a follow-up once Copilot CLI's orchestration story matures:

  • Skipped: /codex, /pair-agent (Claude-streaming-specific).
  • Suppressed orchestration resolvers (/review, /qa, /plan-*-review, /cso, /design-*, /setup-gbrain) still install but the Claude subagent_type blocks are stripped, so they run as single-pass sessions instead of fan-out reviews. docs/COPILOT.md documents this and points users to the Claude or Codex hosts if they need the multi-agent reviews.

Test plan for reviewers

git fetch origin pull/<this-pr>/head:copilot-pr && git checkout copilot-pr
bun install
bun test                         # confirm same 8 baseline failures, no new ones
bun run scripts/host-config-export.ts validate   # 11 configs valid
./setup --host copilot           # if you have Copilot CLI installed
ls ~/.copilot/skills/            # 43 entries
copilot                          # then /skills list

Acknowledgements


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Bharath added 4 commits May 1, 2026 14:51
Adds a declarative host config for the standalone GitHub Copilot CLI
(`copilot` binary, GA Feb 2026), following docs/ADDING_A_HOST.md exactly.

Why this matters
- Issue garrytan#393 has been open since March with 20 reactions and active
  community demand. As of Copilot CLI v1.0.36 (April 24, 2026), Copilot
  no longer auto-loads ~/.claude/ skills, so a dedicated host install
  is required to use gstack with Copilot.

What this commit adds
- hosts/copilot.ts - declarative config: paths, frontmatter, suppressed
  resolvers, runtime root assets, boundary instruction.
- hosts/index.ts - registers copilot in ALL_HOST_CONFIGS.
- test/host-config.test.ts - bumps host count assertion 10 -> 11.
- .gitignore - excludes generated .copilot/ host subdir.

Conservative v1 scope
- frontmatter: allowlist {name, description} only - strips Claude's
  allowed-tools array since 'shell' is the only valid Copilot value
  and Copilot's per-tool approval flow handles this safely.
- suppressedResolvers: REVIEW_ARMY, ADVERSARIAL_STEP,
  DESIGN_OUTSIDE_VOICES are suppressed for v1 (Claude Agent dispatch
  semantics don't translate cleanly). Can be re-enabled in a follow-up
  after validating Copilot's /fleet + task tool semantics.
- skipSkills: codex (Claude wrapper around `codex exec`) and pair-agent
  (depends on Claude streaming).
- boundaryInstruction: scoped to foreign home dirs only - repo-local
  .claude/skills, .agents/skills, .github/skills are intentionally
  allowed since Copilot officially supports those project paths.

Verification
- bun run scripts/host-config-export.ts validate -> All 11 configs valid
- bun test test/host-config.test.ts -> 73 pass, 0 fail

Refs
- https://docs.github.com/copilot/concepts/agents/about-agent-skills
- https://docs.github.com/copilot/how-tos/copilot-cli/customize-copilot/add-skills
- garrytan#393
Maps Claude Code tool names to GitHub Copilot CLI equivalents using the
official tool catalog (docs.github.com/copilot/concepts/agents/about-copilot-cli):

  Bash -> bash, Read -> view, Write -> create, Edit -> edit,
  Agent -> task, Grep -> grep, Glob -> glob, AskUserQuestion -> ask_user

Covers three call patterns to match how skills phrase tool references:
  - 'use the X tool'   (imperative)
  - 'the X tool'       (declarative)
  - 'X tool'           (parenthesized: '(Read tool)', '(via Agent tool)')

The bare form is necessary to catch parenthesized usages that leak through
'the' / 'use the' rewrites. Verified ~30 occurrences across gstack-autoplan,
gstack-design-html, and gstack-design-consultation.

The plural form 'X tools' is intentionally left alone. It appears in the
freeze skill as 'Edit and Write tools only', where lowercase reads correctly
('Edit and create tools') without the rewrite changing semantics.

WebSearch is intentionally not rewritten: Copilot's web_fetch retrieves a
specific URL while WebSearch performs a search; the closer match would be
web_search, but rewriting risks misleading skills. Left for follow-up after
real Copilot session validation.
Mirrors the opencode integration pattern (the cleanest precedent for a
non-Claude host with allowlist frontmatter):

- COPILOT_SKILLS / COPILOT_GSTACK path env vars
- --host copilot CLI argument acceptance and case-statement validation
- INSTALL_COPILOT auto-detection via 'command -v copilot'
- Generation step (1e): bun run gen:skill-docs --host copilot
- create_copilot_runtime_root() symlinks bin, browse/dist, ETHOS.md,
  review specialists, qa templates and references, dx-hall-of-fame.md
  into ~/.copilot/skills/gstack/
- link_copilot_skill_dirs() symlinks each generated gstack-* skill dir
  into ~/.copilot/skills/ where Copilot CLI auto-discovers them as
  /gstack-* slash commands
- Install dispatch block (6d) wires it all together with success message

Tests:
- setup supports --host auto|claude|codex|kiro|opencode|copilot
- auto mode detects copilot binary alongside the others
- INSTALL_COPILOT, COPILOT_SKILLS, COPILOT_GSTACK env vars present
- create_copilot_runtime_root + link_copilot_skill_dirs hooked up

Verification:
  ./setup --host copilot
  -> 'gstack ready (copilot).'
  -> 43 skills linked into ~/.copilot/skills/
  -> ~/.copilot/skills/gstack/ has bin, browse, design, ETHOS.md,
     gstack-upgrade, plan-devex-review, qa, review, SKILL.md

Full test suite: 2220 pass, 8 fail (same 8 pre-existing failures as
baseline before our changes - none introduced by this PR).
…s/COPILOT.md

README updates:
- Bumps host count 10 -> 11 in the 'Other AI Agents' section
- Adds GitHub Copilot CLI to the agent table with install path
- Adds a dedicated 'GitHub Copilot CLI' subsection with quick install
  steps (npm/brew/winget) and usage example
- Mentions v1 scope (which orchestration features are suppressed and why)
- Adds ~/.copilot/skills/gstack* to the manual uninstall instructions

bin/gstack-uninstall updates:
- Adds Copilot CLI to the file-header asset list
- Adds 'Remove Copilot CLI skills' block (mirrors the Kiro block)
- Lists ~/.copilot/skills/gstack* in the interactive confirmation prompt

docs/COPILOT.md (new):
- Why a dedicated host (post-v1.0.36 ~/.claude/ removal)
- Detailed install instructions with verification steps
- What gets installed and where
- Tool-name translation table (Claude -> Copilot)
- v1 scope: suppressed resolvers, skipped skills, what works
- Custom instructions (.github/copilot-instructions.md, AGENTS.md, etc.)
- Uninstall instructions
- Troubleshooting section (binary not found, /skills not showing,
  tool name leaks, getting orchestration features back)
@Bharath-varma-p Bharath-varma-p marked this pull request as ready for review May 2, 2026 20:10
@vishnud05
Copy link
Copy Markdown

you should also add "copilot" at line 59 in setup file. there is a static check for all the agents in the setup file, and it is failing.

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.

2 participants