feat(github): add in-IDE GitHub account sign-in in Settings, Pull Requests, and Clone (#6642)

Settings › Version Control › GitHub only listed accounts already signed in with gh, Clone Repository › GitHub told signed-out users to run gh auth login in a terminal, and Pull Requests opened a raw terminal tab.

The PTY sign-in dialog and OAuth device-code parser move from features/agents to src/workbench/CliSignInDialog.tsx and src/platform/deviceCode.ts, so agents and GitHub share them without a cross-feature import. GitHub settings get Sign In… / Add account… (selecting a newly added second account for the project) and Install GitHub CLI when gh is missing; the Pull Requests tool window signs in in-IDE and reconnects, with Add account… in its error state, repository selector and account menu; Clone › GitHub gets Sign In… and Add account…. The merge with main carries the dialog's terminal-reply filtering and FIFO input over to the moved file.

Co-authored-by: dengliu <[email protected]>
Цей коміт міститься в:
Deng Liuтаdengliu authored and GitHub committed 2026-11-29 12:29:38 +08:00
1 джерело 90734775b9
коміт 4c5f4fa1e1
25 files changed
+784 -86

No files matched your search

+18
Переглянути файл
@@ -62,6 +62,24 @@ export async function setProjectGithubAccount(account: string): Promise<GhProjec
}
}
/**
* Reloads GitHub CLI accounts after an in-IDE `gh auth login`. When the user already
* had at least one account and added a new one, selects it for the project immediately.
*/
export async function refreshAfterGithubSignIn(
prevLogins: ReadonlySet<string>,
): Promise<GhProjectAccountStatus | null> {
const fresh = await loadProjectGithubAccount();
if (!fresh) return null;
if (prevLogins.size > 0) {
const added = fresh.accounts.find((entry) => !prevLogins.has(entry.login));
if (added) {
return (await setProjectGithubAccount(added.login)) ?? fresh;
}
}
return fresh;
}
export function projectAccountOptions(status: GhProjectAccountStatus | null): SelectOption[] {
const accounts = status?.accounts ?? [];
const configured = status?.configuredAccount ?? "";