Add /ai command to run GitHub Copilot Agents #36
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements a new
/ai <prompt>
command that creates GitHub Copilot Agent tasks directly from issue and PR comments.Overview
This PR adds support for the
/ai
command which allows users with write access to create GitHub Copilot Agent tasks on the repository. The command intelligently handles context based on where it's invoked:Usage Examples
Implementation Details
For PR comments, the command:
Related: <PR_URL>
for contextgithub.createAgent(prompt, sourceBranch)
to create the task on the appropriate branchFor issue comments, it simply creates an agent task with the provided prompt.
For example, if a user runs
/ai fix the errors in the pr
on PR #33 that's merging branchbump
intomaster
, the command calls:Changes
gh-helpers
dependency from^0.3.1
to^1.1.0
to access the newcreateAgent
APIsrc/commands/ai.js
implementing the command handlersrc/index.js
Testing
All tests pass (11/11), including 3 new tests specifically for the
/ai
command:Closes #[issue_number]
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.