feat: added github copilot agent plugin#286
Conversation
|
@cachemoney is attempting to deploy a commit to the plgeek Team on Vercel. A member of the Team first needs to authorize it. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a new GithubCopilotAgentPlugin implementation with tests, docs, registry export and a skill-installer mapping; includes detection (copilot --version), arg/stdin construction, sandbox requirements, setup questions and preflight guidance. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In `@src/plugins/agents/builtin/github-copilot.test.ts`:
- Around line 20-52: Rename the failing test description to reflect the actual
assertion: update the test with description "has structured output format
'jsonl'" (or similar) so it matches the expectation
plugin.meta.structuredOutputFormat === 'jsonl'; locate the test under the
describe('meta') block that references plugin.meta and change its string from
"has no structured output format" to the new matching text.
In `@src/plugins/agents/builtin/github-copilot.ts`:
- Around line 23-43: The meta object for the GitHub Copilot plugin incorrectly
sets structuredOutputFormat: 'jsonl' while supportsSubagentTracing is false;
update the AgentPluginMeta in the GitHub Copilot plugin (the readonly meta
block) to remove or set structuredOutputFormat to undefined (or delete that
property) so it matches supportsSubagentTracing: false and the plugin reality,
and then update the corresponding test expectations in github-copilot.test.ts to
assert no structured output format (or change supportsSubagentTracing to true
only if you implement JSONL parsing for the plugin).
- Around line 183-203: In buildArgs (method buildArgs in the GitHub Copilot
agent) replace the unsupported '--yes' flag pushed when this.autoApprove is true
with a supported auto-approve flag such as '--allow-all' (or
'--allow-all-tools'/'--yolo' if you prefer); update the args.push call that
currently uses '--yes' so it pushes '--allow-all' when this.autoApprove is
truthy, leaving the rest of the logic (including the '--model' handling)
unchanged.
In `@website/content/docs/plugins/agents/github-copilot.mdx`:
- Around line 16-26: The docs incorrectly suggest installing the Copilot CLI via
the GitHub CLI extension ("gh extension install github/gh-copilot"), which only
provides a "gh copilot" subcommand rather than a standalone "copilot" executable
required by the plugin; update the installation block (the lines showing the
GitHub CLI and Copilot install commands) to instruct users to install a
standalone Copilot CLI (examples: Homebrew `brew install copilot-cli`, npm `npm
install -g `@github/copilot``, winget `GitHub.Copilot`, or the official install
script URL) and remove or clearly separate the `gh extension install
github/gh-copilot` line so the README refers to the actual `copilot` binary on
PATH.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In `@src/plugins/agents/builtin/github-copilot.test.ts`:
- Around line 159-169: The tests expect the CLI flag to be '--yes' but the
implementation in buildArgs (github-copilot.ts) currently pushes '--yolo' when
autoApprove is true; update buildArgs to push '--yes' instead (and ensure
TestableGithubCopilotPlugin.testBuildArgs and plugin.initialize behavior remain
consistent with the autoApprove true/false paths) so the tests asserting args
include/omit '--yes' will pass.
In `@src/plugins/agents/builtin/github-copilot.ts`:
- Around line 61-71: Update the getSandboxRequirements() implementation to
include the GitHub CLI config directory in authPaths: add '~/.config/gh'
alongside '~/.config/github-copilot' and '~/.gitconfig' so the sandbox covers
gh's hosts.yml fallback; modify the authPaths array returned by
getSandboxRequirements() in the github-copilot agent to include this path.
In `@website/content/docs/plugins/agents/github-copilot.mdx`:
- Around line 139-148: Update the troubleshooting block that runs the `which
copilot` check so it no longer instructs users to install the GitHub CLI
extension `gh extension install github/gh-copilot`; instead list the correct
ways to install the standalone Copilot CLI expected by the plugin (for example
`brew install copilot-cli`, `npm install -g `@github/copilot``, or the official
curl installer `curl -fsSL https://gh.io/copilot-install | bash`) so the `which
copilot` check will find the actual `copilot` binary.
- Around line 14-24: Wrap the installation lines under the "## Prerequisites"
section in a fenced shell code block so they render as a single bash snippet:
insert a starting ```bash fence immediately before the first comment line "#
Install GitHub CLI" and a closing ``` fence immediately after the final command
"curl -fsSL https://gh.io/copilot-install | bash". Update the block that
contains the Copilot/GitHub CLI install commands (the lines under the "##
Prerequisites" header) to be enclosed by these fences so comments starting with
# render correctly as shell comments.
🧹 Nitpick comments (4)
src/plugins/agents/builtin/github-copilot.ts (2)
45-59:initializedoes not reject invalidtimeoutvalues (e.g. negative numbers or zero).The guard
config.timeout > 0correctly filters non-positive values, so this is fine. However, themodelguard does not trim whitespace — a config value of" "(spaces only) would pass thelength > 0check and be stored, which could produce an invalid--model " "argument. Consider trimming:Suggested fix
- if (typeof config.model === 'string' && config.model.length > 0) { - this.model = config.model; + if (typeof config.model === 'string' && config.model.trim().length > 0) { + this.model = config.model.trim(); }
232-240: Preflight suggestion referencescopilot --versionbut also suggests installing GitHub CLI and runninggh auth login.The mix of standalone
copilotCLI andghCLI references could confuse users. If the plugin targets the standalonecopilotbinary (asmeta.defaultCommandindicates), step 2 ("Install GitHub CLI") is only a prerequisite for authentication, not for getting thecopilotbinary itself. Consider clarifying this distinction, e.g. "Install Copilot CLI: https://docs.github.com/copilot/..." as a separate step.src/plugins/agents/builtin/github-copilot.test.ts (1)
141-149: Theunknowncast is unnecessary —buildArgsandgetStdinInputareprotected, so a subclass can call them directly.Proposed simplification
class TestableGithubCopilotPlugin extends GithubCopilotAgentPlugin { testBuildArgs(prompt: string): string[] { - return (this as unknown as { buildArgs: (p: string) => string[] }).buildArgs(prompt); + return this.buildArgs(prompt); } testGetStdinInput(prompt: string): string | undefined { - return (this as unknown as { getStdinInput: (p: string) => string | undefined }).getStdinInput(prompt); + return this.getStdinInput(prompt); } }website/content/docs/plugins/agents/github-copilot.mdx (1)
115-123: Minor grammar nit flagged by static analysis.Line 122: "Handle exit" reads slightly awkwardly. Consider "Handle exits" or "Handle exit code" for clarity.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@website/content/docs/plugins/agents/github-copilot.mdx`:
- Around line 16-25: Remove the inline backticks around the npm package name in
the bash fenced block so the line reads "npm install -g `@github/copilot`"
(replace the token `` `@github/copilot` ``), and adjust the GitHub CLI note so
it is clearly optional for authentication only—either move the "Install GitHub
CLI" comment to a troubleshooting/authentication section or add a parenthetical
"(Optional) Install GitHub CLI for authentication: gh auth login" directly under
the copilot install lines; ensure the bash fence remains intact and the npm
package appears as plain text.
- Around line 164-171: Replace the incorrect `gh auth login` instruction (which
applies to the GitHub CLI `gh copilot` extension) with the correct
authentication steps for the standalone `copilot` binary: document the
interactive method (run `copilot` and use the `/login` command at the prompt)
and the non-interactive method (set `GH_TOKEN` or `GITHUB_TOKEN` to a
fine-grained PAT that includes the "Copilot Requests" permission); update the
block containing `gh auth login` to list these two methods and remove the
misleading `gh` command.
🧹 Nitpick comments (2)
website/content/docs/plugins/agents/github-copilot.mdx (2)
95-103: Options reference looks good overall — minor point ontimeoutdefaults.The table states the default timeout is
0(no timeout), while the full config example on line 88 usestimeout = 300000. This is fine as an override example, but it could be worth adding a brief inline comment in the full config example (e.g.,# default: 0 (no timeout)) to avoid confusion for readers scanning the examples without reading the table.
119-125: Minor grammar nit: "Handle exit" reads better as "Handle exit codes" or with a preposition.Static analysis flagged a possible missing word. Consider:
-4. **Handle exit**: Reports success, failure, or timeout +4. **Handle exit codes**: Reports success, failure, or timeout
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/plugins/agents/builtin/github-copilot.ts`:
- Around line 73-102: The detect() error message incorrectly points to the
GitHub CLI repo; update the error returned when findResult.found is false in
detect() to reference the Copilot CLI install instructions and make it clear
we're looking for the standalone 'copilot' binary (adjust the URL and message
text in the return object that currently references https://github.com/cli/cli);
locate this in the detect() method (symbols: detect, commandPath,
meta.defaultCommand, findCommandPath) and replace the install link/message with
the correct Copilot CLI installation URL and wording.
🧹 Nitpick comments (1)
src/plugins/agents/builtin/github-copilot.test.ts (1)
142-150: Consider simplifying the protected method access pattern.The double cast through
unknown(this as unknown as { buildArgs: ... }) is noisy. Since you already control the subclass, you can call the protected methods directly — TypeScript allows subclasses to access protected members.♻️ Simplified test subclass
class TestableGithubCopilotPlugin extends GithubCopilotAgentPlugin { testBuildArgs(prompt: string): string[] { - return (this as unknown as { buildArgs: (p: string) => string[] }).buildArgs(prompt); + return this.buildArgs(prompt); } testGetStdinInput(prompt: string): string | undefined { - return (this as unknown as { getStdinInput: (p: string) => string | undefined }).getStdinInput(prompt); + return this.getStdinInput(prompt); } }
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/plugins/agents/builtin/github-copilot.ts`:
- Around line 161-181: Update the help text for the 'model' setup question in
the override getSetupQuestions() method of the GitHub Copilot agent: remove the
OpenAI-specific examples ("gpt-4, gpt-3.5-turbo") and replace them with a
generic instruction telling users to check available models via the Copilot CLI
(e.g., run the `/model` command) and that available models may vary by account;
locate the entry with id: 'model' in getSetupQuestions() and update its help
string accordingly.
- Around line 22-43: The skills discovery path in GithubCopilotAgentPlugin.meta
is wrong: update the skillsPaths object (inside the meta property of the
GithubCopilotAgentPlugin class) to use the repo path '.github/skills' instead of
'.copilot/skills' so repository-level skills are discovered; leave personal
('~/.copilot/skills') and the other meta flags unchanged.
🧹 Nitpick comments (1)
src/plugins/agents/builtin/github-copilot.ts (1)
228-240: Preflight suggestion mixes standalonecopilotandghCLI guidance — consider clarifying.
detect()looks for the standalonecopilotbinary, but the preflight on line 236 directs users to install theghCLI. Both are valid approaches, but the mix could confuse users who don't know the relationship between the two. A brief note distinguishing the standalone CLI from theghextension path would help.Suggested clarification
protected override getPreflightSuggestion(): string { return ( 'Common fixes for GitHub Copilot CLI:\n' + ' 1. Test copilot directly: copilot --version\n' + - ' 2. Install GitHub CLI: https://github.com/cli/cli\n' + - ' 3. Authenticate with GitHub: gh auth login\n' + + ' 2. Install standalone: npm install -g `@github/copilot-cli`\n' + + ' Or via GitHub CLI extension: gh extension install github/gh-copilot\n' + + ' 3. Authenticate: gh auth login\n' + ' 4. Verify GitHub Copilot subscription is active' ); }
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #286 +/- ##
==========================================
+ Coverage 44.52% 44.76% +0.23%
==========================================
Files 96 97 +1
Lines 30345 30543 +198
==========================================
+ Hits 13512 13673 +161
- Misses 16833 16870 +37
🚀 New features to boost your workflow:
|
|
@cachemoney thanks for this - mad e aminor docs fix but otherwise good to go - will be in the next release |
Summary
Adds support for github copilot cli agent as a new agent plugin
Summary by CodeRabbit
New Features
Documentation
Tests
Chores