Skip to content

Commit 8226546

Browse files
committed
Add new context menu command to assign issues to coding agent
1 parent 1e148f0 commit 8226546

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,13 @@
16661666
"category": "%command.issues.category%",
16671667
"icon": "$(sparkle)"
16681668
},
1669+
{
1670+
"command": "issue.assignToCodingAgent",
1671+
"title": "%command.issue.assignToCodingAgent.title%",
1672+
"category": "%command.issues.category%",
1673+
"icon": "$(send-to-remote-agent)",
1674+
"enablement": "config.githubPullRequests.codingAgent.enabled"
1675+
},
16691676
{
16701677
"command": "issues.configureIssuesViewlet",
16711678
"title": "%command.issues.configureIssuesViewlet.title%",
@@ -2916,6 +2923,11 @@
29162923
"when": "view == issues:github && viewItem =~ /^(link)?(current|continue)?issue/ && github.copilot-chat.activated && config.githubPullRequests.experimental.chat",
29172924
"group": "issues_1@1"
29182925
},
2926+
{
2927+
"command": "issue.assignToCodingAgent",
2928+
"when": "view == issues:github && viewItem =~ /^(link)?(current|continue)?issue/ && config.githubPullRequests.codingAgent.enabled",
2929+
"group": "issues_1@2"
2930+
},
29192931
{
29202932
"command": "issue.copyIssueNumber",
29212933
"when": "view == issues:github && viewItem =~ /^(link)?(current|continue)?issue/",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@
308308
"command.issues.configureIssuesViewlet.title": "Configure...",
309309
"command.issue.chatSummarizeIssue.title": "Summarize With Copilot",
310310
"command.issue.chatSuggestFix.title": "Suggest a Fix with Copilot",
311+
"command.issue.assignToCodingAgent.title": "Assign to Coding Agent",
311312
"command.notifications.category": "GitHub Notifications",
312313
"command.notifications.refresh.title": "Refresh",
313314
"command.notifications.pri.title": "Prioritize",

src/issues/issueFeatureRegistrar.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,19 @@ export class IssueFeatureRegistrar extends Disposable {
155155
this,
156156
),
157157
);
158+
this._register(
159+
vscode.commands.registerCommand(
160+
'issue.assignToCodingAgent',
161+
(issueModel: any) => {
162+
/* __GDPR__
163+
"issue.assignToCodingAgent" : {}
164+
*/
165+
this.telemetry.sendTelemetryEvent('issue.assignToCodingAgent');
166+
return this.assignToCodingAgent(issueModel);
167+
},
168+
this,
169+
),
170+
);
158171
this._register(
159172
vscode.commands.registerCommand(
160173
'issue.copyGithubPermalink',
@@ -1498,4 +1511,28 @@ ${options?.body ?? ''}\n
14981511
vscode.window.showErrorMessage(vscode.l10n.t('Failed to start coding agent session: {0}', error.message));
14991512
}
15001513
}
1514+
1515+
async assignToCodingAgent(issueModel: any) {
1516+
if (!issueModel) {
1517+
return;
1518+
}
1519+
1520+
// Check if the issue model is an IssueModel
1521+
if (!(issueModel instanceof IssueModel)) {
1522+
return;
1523+
}
1524+
1525+
// Create a prompt for the coding agent based on the issue
1526+
const prompt = vscode.l10n.t('Work on GitHub issue #{0}: {1}', issueModel.number, issueModel.title);
1527+
1528+
// Start the coding agent session
1529+
try {
1530+
await this.copilotRemoteAgentManager.commandImpl({
1531+
userPrompt: prompt,
1532+
source: 'issue'
1533+
});
1534+
} catch (error) {
1535+
vscode.window.showErrorMessage(vscode.l10n.t('Failed to start coding agent session: {0}', error.message));
1536+
}
1537+
}
15011538
}

0 commit comments

Comments
 (0)