From 3bf61fe32e5bc9497bb8f2d2d47b8f95fd6f78df Mon Sep 17 00:00:00 2001 From: Rhuan Barreto Date: Mon, 23 Mar 2026 02:18:14 +0100 Subject: [PATCH] fix: use marketplace add + install pattern for copilot CLI plugin The copilot CLI `plugin install ` command expects plugin.json at the repo root, but our repo is a marketplace (marketplace.json at root, plugins nested under plugins/archgate/). This caused "No plugin.json found" errors. Fix both the auto-install path and manual fallback to: 1. Use archgate-vscode.git URL (.github/plugin/ format copilot expects) 2. Run two-step marketplace add + install (matching the Claude Code pattern) Co-Authored-By: Claude Opus 4.6 (1M context) --- src/commands/plugin/install.ts | 7 +++++-- src/helpers/plugin-install.ts | 20 +++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/commands/plugin/install.ts b/src/commands/plugin/install.ts index d7a14a03..0719d17f 100644 --- a/src/commands/plugin/install.ts +++ b/src/commands/plugin/install.ts @@ -65,12 +65,15 @@ export function registerPluginInstallCommand(plugin: Command) { await installCopilotPlugin(); logInfo(`Archgate plugin installed for ${label}.`); } else { - const url = buildMarketplaceUrl(); + const url = buildVscodeMarketplaceUrl(); logWarn( "Copilot CLI not found. To install the plugin manually, run:" ); console.log( - ` ${styleText("bold", "copilot plugin install")} ${url}` + ` ${styleText("bold", "copilot plugin marketplace add")} ${url}` + ); + console.log( + ` ${styleText("bold", "copilot plugin install")} archgate@archgate` ); } break; diff --git a/src/helpers/plugin-install.ts b/src/helpers/plugin-install.ts index b4df6d3c..d97d9b2a 100644 --- a/src/helpers/plugin-install.ts +++ b/src/helpers/plugin-install.ts @@ -164,16 +164,30 @@ export async function isCopilotCliAvailable(): Promise { * Install the archgate plugin via the `copilot` CLI. * * Runs: - * copilot plugin install + * copilot plugin marketplace add + * copilot plugin install archgate@archgate * * Throws on failure so the caller can fall back to manual instructions. */ export async function installCopilotPlugin(): Promise { - const url = buildMarketplaceUrl(); + const url = buildVscodeMarketplaceUrl(); const cmd = (await resolveCommand("copilot")) ?? "copilot"; + logDebug("Adding archgate marketplace to copilot CLI"); + const addResult = await run([cmd, "plugin", "marketplace", "add", url]); + if (addResult.exitCode !== 0) { + throw new Error( + `copilot plugin marketplace add failed (exit ${addResult.exitCode})` + ); + } + logDebug("Installing archgate plugin via copilot CLI"); - const installResult = await run([cmd, "plugin", "install", url]); + const installResult = await run([ + cmd, + "plugin", + "install", + "archgate@archgate", + ]); if (installResult.exitCode !== 0) { throw new Error( `copilot plugin install failed (exit ${installResult.exitCode})`