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})`