Skip to content

feat(agent): add GitHub Copilot as an install target#194

Merged
zeshi-du merged 2 commits into
TestSprite:mainfrom
Davidson3556:feat/add-copilot-target
Jul 6, 2026
Merged

feat(agent): add GitHub Copilot as an install target#194
zeshi-du merged 2 commits into
TestSprite:mainfrom
Davidson3556:feat/add-copilot-target

Conversation

@Davidson3556

@Davidson3556 Davidson3556 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds GitHub Copilot as an agent install target — the most widely-used AI coding assistant, and the biggest remaining gap in the target set.

GitHub Copilot reads path-specific custom instructions from .github/instructions/*.instructions.md (VS Code, Visual Studio, Copilot Chat), with YAML frontmatter carrying an applyTo glob. This PR installs the verification-loop skill there the same way it's installed for Cursor/Cline/Windsurf:

  • Path: .github/instructions/testsprite-verify.instructions.md (+ testsprite-onboard.instructions.md).
  • Frontmatter: applyTo: '**' + description. Copilot instruction files have no on-demand "model decides" mode (unlike Cursor's alwaysApply: false or Windsurf's trigger: model_decision), so always-apply is the correct idiom.
  • Always-on ⇒ compact body: since applyTo: '**' injects the file into every Copilot request, the target renders the compact body (~6 KB) instead of the full ~23 KB body — the same reasoning behind windsurf's compact render, keeping the always-injected context cost small.

It slots into the existing TARGETS machinery, so agent list, setup --agent, and skill-nudge install-detection pick it up automatically.

Verified locally

$ testsprite agent install --target copilot --dir /tmp/x
$ cat /tmp/x/.github/instructions/testsprite-verify.instructions.md
---
description: TestSprite verification loop — ...
applyTo: '**'
---
...
# 6009 bytes (compact), under always-on budget

Related issue

Fixes #195

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Documentation only
  • Build / CI / chore

Checklist

  • PR targets the main branch.
  • Commits follow Conventional Commits.
  • npm run lint and npm run format:check pass.
  • npm run typecheck passes.
  • npm test passes and coverage stays at or above the 80% gate.
  • New behavior is covered by unit tests (mock-based; no network or credentials required).
  • No secrets, API keys, internal endpoints, or personal data are included.
  • User-facing changes are reflected in README.md / DOCUMENTATION.md.

Notes for reviewers

  • Follows the exact pattern established by the merged windsurf (feat(agent): add windsurf as an install target #29) and kiro (feat(agent): add kiro as an install target #10) targets: AgentTarget union, pathFor, TARGETS, help strings, README/DOCUMENTATION, both e2e matrix guards, and the regenerated help snapshot.
  • Renders through the content-integrity marker path (renderOwnFileWithMarker/buildSkillMarker), so agent status tracks copilot files like every other own-file target.
  • All gates green locally: typecheck, lint, format:check, 1825 unit tests, 55 e2e.
  • Scope note: I saw the "target policy settled this round" note from the windsurf/kiro/gemini triage. I'm proposing Copilot as the clear next-highest-value target (it's the single most-used assistant and unclaimed), but I'm happy to defer if the target set is closed for now — no hard feelings if this waits for a future round.

AI usage disclosure

Yes, I used AI assistance for this change — investigation, implementation, and tests. I reviewed and verified everything myself (installed the target, inspected the rendered file and its frontmatter/size, and ran the full gate suite).

Summary by CodeRabbit

  • New Features

    • Added support for the new Copilot agent target across the CLI and installation flow.
    • Copilot target now renders instruction files with description and applyTo: '**'.
  • Bug Fixes

    • Refreshed command help text, examples, and target listings so the supported target count and output matrix are accurate.
    • Updated backup/force behavior listings to include Copilot where applicable.
  • Documentation

    • Updated README and agent onboarding docs to include Copilot in supported targets and commands.
  • Tests

    • Updated unit and end-to-end tests to reflect the expanded target/skill matrix (including Copilot).

Adds `copilot` to the agent-install targets. GitHub Copilot reads
path-specific custom instructions from `.github/instructions/*.instructions.md`
(VS Code / Visual Studio / Copilot Chat), with YAML frontmatter carrying an
`applyTo` glob. The skill installs to
`.github/instructions/testsprite-verify.instructions.md` (and the onboard
skill alongside) with `applyTo: '**'` so the guidance attaches to every
request in the repo.

Because `applyTo: '**'` is always-on (Copilot has no on-demand 'model
decides' mode like Cursor/Windsurf), the target renders the COMPACT body —
the same reasoning behind windsurf's compact render — keeping the
always-injected context small (~6 KB vs the ~23 KB full body).

Slots into the existing TARGETS machinery, so `agent list`, `setup --agent`,
and skill-nudge install-detection pick it up automatically. Updates the
AgentTarget union, pathFor, TARGETS, help/docs, unit + e2e matrix guards,
and the help snapshot.

Fixes TestSprite#193
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR adds copilot as a new agent install target. It extends the AgentTarget type and TARGETS registry with own-file, compact-body rendering and YAML frontmatter, and updates CLI help, docs, and tests to reflect the expanded target matrix.

Changes

Copilot agent target support

Layer / File(s) Summary
Copilot target type, wrapper, and registry
src/lib/agent-targets.ts
Adds 'copilot' to the AgentTarget union, introduces wrapCopilot to render YAML frontmatter with description and applyTo: '**', adds a pathFor case for .github/instructions/<skill>.instructions.md, and registers a copilot entry in TARGETS as experimental, own-file, compact-body.
Unit test coverage for copilot target
src/lib/agent-targets.test.ts
Expands TARGETS key/experimental/own-file assertions to include copilot, adds a renderForTarget("copilot") suite for frontmatter and compact-body validation, and updates compact-body exclusions.
CLI help text and command tests
src/commands/agent.ts, src/commands/agent.test.ts
Updates help text for the agent command and --target option to list copilot, and updates runList/runInstall test expectations (target lists, row counts, would-write line counts).
End-to-end matrix and content-integrity checks
test/e2e/agent-install.e2e.test.ts, test/e2e/setup.e2e.test.ts
Adds copilot frontmatter assertions for verify/onboard skills, updates JSON row-count comments, and adds copilot to matrix coverage guard target lists.
Documentation updates
DOCUMENTATION.md, README.md
Adds copilot to supported target lists, install examples, target counts, and force/backup behavior descriptions.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: ruili-testsprite, zeshi-du

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation adds a copilot install target with .github/instructions output, compact body, frontmatter, and TARGETS integration as requested.
Out of Scope Changes check ✅ Passed The changes shown are all directly tied to the Copilot target feature, including docs, help text, tests, and TARGETS updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding GitHub Copilot as an install target.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/lib/agent-targets.ts (1)

153-165: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Unquoted description in YAML frontmatter risks breaking Copilot parsing.

wrapCopilot interpolates description raw (description: ${description}) with no quoting. If the skill description ever contains a colon, leading special character, or other YAML-significant sequence, this frontmatter becomes invalid YAML — a documented failure mode where GitHub Copilot (and other tools using this pattern, like YAML-based skill loaders) will silently skip or fail to parse the file. This mirrors the same unquoted pattern already in wrapWindsurf (line 150), so it's not a new class of bug, but it doubles the exposed surface.

🛡️ Proposed fix: quote the description
 function wrapCopilot(_name: string, description: string, body: string): string {
-  return `---\ndescription: ${description}\napplyTo: '**'\n---\n\n${body}\n`;
+  return `---\ndescription: ${JSON.stringify(description)}\napplyTo: '**'\n---\n\n${body}\n`;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/agent-targets.ts` around lines 153 - 165, The YAML frontmatter
generated by wrapCopilot is writing description unquoted, which can break
parsing when the text contains YAML-significant characters. Update wrapCopilot
so the description field is safely quoted/escaped before interpolation,
following the same pattern used for other instruction generators in this module,
and keep the existing applyTo and body formatting unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/commands/agent.ts`:
- Line 1064: The top-level agent command description is missing Kiro even though
it is a supported target. Update the description string in agent.ts where the
agent command metadata is defined so it matches the --target help text and docs
by including Kiro alongside the other supported editors/tools. Keep the wording
aligned with the existing list in the agent command definition.

---

Nitpick comments:
In `@src/lib/agent-targets.ts`:
- Around line 153-165: The YAML frontmatter generated by wrapCopilot is writing
description unquoted, which can break parsing when the text contains
YAML-significant characters. Update wrapCopilot so the description field is
safely quoted/escaped before interpolation, following the same pattern used for
other instruction generators in this module, and keep the existing applyTo and
body formatting unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b3efd0a7-3675-49de-ab25-396b1f6c3be4

📥 Commits

Reviewing files that changed from the base of the PR and between b9e9601 and f839518.

⛔ Files ignored due to path filters (1)
  • test/__snapshots__/help.snapshot.test.ts.snap is excluded by !**/*.snap, !**/*.snap
📒 Files selected for processing (8)
  • DOCUMENTATION.md
  • README.md
  • src/commands/agent.test.ts
  • src/commands/agent.ts
  • src/lib/agent-targets.test.ts
  • src/lib/agent-targets.ts
  • test/e2e/agent-install.e2e.test.ts
  • test/e2e/setup.e2e.test.ts

Comment thread src/commands/agent.ts Outdated
The top-level `agent` command description listed the other targets but
omitted Kiro (a pre-existing gap), leaving it inconsistent with the
`--target` help text and the docs. Align the description with the
`--target` list so every supported target is named.

@zeshi-du zeshi-du left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: scoped, tests included, CI green across the matrix.

@zeshi-du zeshi-du merged commit e819e45 into TestSprite:main Jul 6, 2026
9 checks passed
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.

[Hackathon] Add GitHub Copilot as an agent install target

2 participants