Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 34 additions & 15 deletions packages/opencode/src/cli/cmd/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ export const GithubInstallCommand = cmd({
await addWorkflowFiles()
printNextSteps()

const copilotSetupLink = "https://kilo.ai/docs/getting-started/setup-authentication"
Copy link
Contributor

Choose a reason for hiding this comment

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

CRITICAL: copilotSetupLink is declared here on line 209, but promptProvider() is called on line 202 — before this const is initialized. Since const declarations are in the temporal dead zone until execution reaches them, any error/cancel path in promptProvider() that references copilotSetupLink (lines 278, 289, 295) will throw a ReferenceError: Cannot access 'copilotSetupLink' before initialization.

This variable needs to be moved before the promptProvider() call (e.g., before line 202) so it's initialized when the function body executes.


Comment on lines +209 to +210
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

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

copilotSetupLink is declared after promptProvider() has already been awaited. Since promptProvider() references copilotSetupLink on cancel/invalid/empty-option paths, those flows will currently throw a ReferenceError due to the temporal dead zone. Move the copilotSetupLink declaration above the await promptProvider() call (or define it inside promptProvider).

Copilot uses AI. Check for mistakes.
function printNextSteps() {
let step2
if (provider === "amazon-bedrock") {
Expand Down Expand Up @@ -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
}
Expand Down
Loading