From a0b367bda0d4fd7e3f82941aacbf39605901e9a7 Mon Sep 17 00:00:00 2001 From: Olusammytee Date: Sun, 22 Feb 2026 13:31:50 -0500 Subject: [PATCH] fix(cli): add copilot guidance on github install cancel --- packages/opencode/src/cli/cmd/github.ts | 49 +++++++++++++++++-------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/packages/opencode/src/cli/cmd/github.ts b/packages/opencode/src/cli/cmd/github.ts index 8ba7667007..ad4d45c28d 100644 --- a/packages/opencode/src/cli/cmd/github.ts +++ b/packages/opencode/src/cli/cmd/github.ts @@ -206,6 +206,8 @@ export const GithubInstallCommand = cmd({ await addWorkflowFiles() printNextSteps() + const copilotSetupLink = "https://kilo.ai/docs/getting-started/setup-authentication" + function printNextSteps() { let step2 if (provider === "amazon-bedrock") { @@ -257,25 +259,42 @@ export const GithubInstallCommand = cmd({ openai: 2, google: 3, } - let provider = await prompts.select({ + const options = pipe( + providers, + values(), + sortBy( + (x) => priority[x.id] ?? 99, + (x) => x.name ?? x.id, + ), + map((x) => ({ + label: x.name, + value: x.id, + hint: priority[x.id] === 0 ? "recommended" : undefined, + })), + ) + + if (options.length === 0) { + prompts.log.warn("No providers are currently available for GitHub install.") + prompts.log.message(`GitHub Copilot is available. See setup docs: ${copilotSetupLink}`) + throw new UI.CancelledError() + } + + const provider = await prompts.select({ message: "Select provider", maxItems: 8, - options: pipe( - providers, - values(), - sortBy( - (x) => priority[x.id] ?? 99, - (x) => x.name ?? x.id, - ), - map((x) => ({ - label: x.name, - value: x.id, - hint: priority[x.id] === 0 ? "recommended" : undefined, - })), - ), + options, }) - if (prompts.isCancel(provider)) throw new UI.CancelledError() + if (prompts.isCancel(provider)) { + prompts.log.message(`GitHub Copilot is available. See setup docs: ${copilotSetupLink}`) + throw new UI.CancelledError() + } + + if (!providers[provider]) { + prompts.log.warn("Invalid provider selection.") + prompts.log.message(`GitHub Copilot is available. See setup docs: ${copilotSetupLink}`) + throw new UI.CancelledError() + } return provider }