feat(coding-agent): show login status in OAuth provider selector

Display '✓ logged in' indicator next to providers where the user is already authenticated. This makes it clear at a glance whether you're using your Claude Pro/Max subscription.
This commit is contained in:
Peter Steinberger 2025-12-02 07:35:00 +00:00
parent 7a1884f85c
commit 87b7343b00

View file

@ -1,5 +1,6 @@
import { Container, Spacer, Text } from "@mariozechner/pi-tui";
import { getOAuthProviders, type OAuthProviderInfo } from "../oauth/index.js";
import { loadOAuthCredentials } from "../oauth/storage.js";
import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";
@ -61,14 +62,19 @@ export class OAuthSelectorComponent extends Container {
const isSelected = i === this.selectedIndex;
const isAvailable = provider.available;
// Check if user is logged in for this provider
const credentials = loadOAuthCredentials(provider.id);
const isLoggedIn = credentials !== null;
const statusIndicator = isLoggedIn ? theme.fg("success", " ✓ logged in") : "";
let line = "";
if (isSelected) {
const prefix = theme.fg("accent", "→ ");
const text = isAvailable ? theme.fg("accent", provider.name) : theme.fg("dim", provider.name);
line = prefix + text;
line = prefix + text + statusIndicator;
} else {
const text = isAvailable ? ` ${provider.name}` : theme.fg("dim", ` ${provider.name}`);
line = text;
line = text + statusIndicator;
}
this.listContainer.addChild(new Text(line, 0, 0));