Skip to content

WIP - Allow installPluginFromSource command to accept source and sha programmatically#302309

Open
JakeRadMSFT wants to merge 1 commit intomicrosoft:mainfrom
JakeRadMSFT:jakerad/install-plugin-from-source-args
Open

WIP - Allow installPluginFromSource command to accept source and sha programmatically#302309
JakeRadMSFT wants to merge 1 commit intomicrosoft:mainfrom
JakeRadMSFT:jakerad/install-plugin-from-source-args

Conversation

@JakeRadMSFT
Copy link
Copy Markdown
Member

Summary

The workbench.action.chat.installPluginFromSource command currently always prompts the user interactively. This PR adds an optional args parameter 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 the installPluginFromSource service method doesn't accept a SHA.

The underlying infrastructure already supports ref and sha on IGitHubPluginSource / IGitUrlPluginSource, and _checkoutRevision in pluginSources.ts already 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. When source is provided, it skips the interactive prompt. The sha is forwarded to the install service.
  • pluginInstallService.ts (common): Added optional sha parameter to the installPluginFromSource interface method.
  • pluginInstallService.ts (browser): Threads sha into the sourceDescriptor built for GitHub and GitUrl sources.

Usage

// Programmatic — install at a specific commit
await vscode.commands.executeCommand(
  'workbench.action.chat.installPluginFromSource',
  { source: 'dotnet/skills', sha: 'abc123def456' }
);

// Programmatic — install latest (no sha)
await vscode.commands.executeCommand(
  'workbench.action.chat.installPluginFromSource',
  { source: 'dotnet/skills' }
);

// Interactive — unchanged behavior (no args)
await vscode.commands.executeCommand(
  'workbench.action.chat.installPluginFromSource'
);

Testing

  • Without args: interactive prompt still appears (no regression)
  • With { source }: clones and installs without prompting
  • With { source, sha }: clones and checks out the specified commit

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.
Copilot AI review requested due to automatic review settings March 17, 2026 00:32
@JakeRadMSFT JakeRadMSFT changed the title Allow installPluginFromSource command to accept source and sha programmatically WIP - Allow installPluginFromSource command to accept source and sha programmatically Mar 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 when source is provided.
  • Extend IPluginInstallService.installPluginFromSource to accept an optional sha.
  • Thread sha into the GitHub/GitUrl sourceDescriptor so 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 };

@connor4312
Copy link
Copy Markdown
Member

connor4312 commented Mar 17, 2026

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants