WIP - Allow installPluginFromSource command to accept source and sha programmatically#302309
Open
JakeRadMSFT wants to merge 1 commit intomicrosoft:mainfrom
Open
WIP - Allow installPluginFromSource command to accept source and sha programmatically#302309JakeRadMSFT wants to merge 1 commit intomicrosoft:mainfrom
JakeRadMSFT wants to merge 1 commit intomicrosoft:mainfrom
Conversation
The InstallFromSourceAction command now accepts an optional args object
with `source` and `sha` properties. When provided, the source is used
directly instead of prompting the user, and the sha is threaded through
to the source descriptor so the plugin is pinned to a specific commit.
This enables extensions to programmatically install agent plugins at a
known-good revision via:
vscode.commands.executeCommand(
'workbench.action.chat.installPluginFromSource',
{ source: 'owner/repo', sha: 'abc123' }
)
When called without args (e.g. from the command palette), the interactive
prompt behavior is unchanged.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables programmatic usage of workbench.action.chat.installPluginFromSource by accepting an optional arguments object (source + commit SHA), and threads the SHA through the plugin install service so callers can pin installs to a specific revision.
Changes:
- Extend
InstallFromSourceAction.run()to accept optional{ source?, sha? }and skip the interactive prompt whensourceis provided. - Extend
IPluginInstallService.installPluginFromSourceto accept an optionalsha. - Thread
shainto the GitHub/GitUrlsourceDescriptorso the underlying git plugin source can checkout the pinned revision.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/plugins/pluginInstallService.ts | Updates service contract to accept an optional commit SHA. |
| src/vs/workbench/contrib/chat/browser/pluginInstallService.ts | Passes optional sha into git source descriptors during install-from-source. |
| src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.ts | Allows the command to be invoked non-interactively with { source, sha }. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
63
to
+76
| @@ -73,7 +73,7 @@ class InstallFromSourceAction extends Action2 { | |||
| return; | |||
| } | |||
|
|
|||
| await pluginInstallService.installPluginFromSource(source.trim()); | |||
| await pluginInstallService.installPluginFromSource(source.trim(), args?.sha); | |||
Comment on lines
58
to
80
| @@ -75,8 +75,8 @@ export class PluginInstallService implements IPluginInstallService { | |||
|
|
|||
| // Build a source descriptor for the git clone. | |||
| const sourceDescriptor = reference.kind === MarketplaceReferenceKind.GitHubShorthand | |||
| ? { kind: PluginSourceKind.GitHub as const, repo: reference.githubRepo! } | |||
| : { kind: PluginSourceKind.GitUrl as const, url: reference.cloneUrl }; | |||
| ? { kind: PluginSourceKind.GitHub as const, repo: reference.githubRepo!, sha } | |||
| : { kind: PluginSourceKind.GitUrl as const, url: reference.cloneUrl, sha }; | |||
|
|
|||
Member
|
Would including the skills in your extension suffice for this use case? https://code.visualstudio.com/docs/copilot/customization/agent-skills#_contribute-skills-from-extensions Alternatively, using the proposed API from microsoft/vscode-extension-samples#1259 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The
workbench.action.chat.installPluginFromSourcecommand currently always prompts the user interactively. This PR adds an optionalargsparameter so extensions can invoke it programmatically with a specific source and commit SHA.Motivation
Extensions like C# Dev Kit want to programmatically install agent plugins (e.g. from
dotnet/skills) at a known-good revision. Today there's no way to do this — the command always opens a quick input prompt, and theinstallPluginFromSourceservice method doesn't accept a SHA.The underlying infrastructure already supports
refandshaonIGitHubPluginSource/IGitUrlPluginSource, and_checkoutRevisioninpluginSources.tsalready handles checking out to a specific commit. This PR simply threads that capability up to the command layer.Changes
chatPluginActions.ts:InstallFromSourceAction.run()now accepts an optional{ source?: string; sha?: string }argument. Whensourceis provided, it skips the interactive prompt. Theshais forwarded to the install service.pluginInstallService.ts(common): Added optionalshaparameter to theinstallPluginFromSourceinterface method.pluginInstallService.ts(browser): Threadsshainto thesourceDescriptorbuilt for GitHub and GitUrl sources.Usage
Testing
{ source }: clones and installs without prompting{ source, sha }: clones and checks out the specified commit