import { login } from "../../auth/login.js";
/**
 * Handle the `pocketcoder login` CLI command.
 * Triggers OAuth flow with GitHub and shows the result.
 */
export async function loginCommand() {
    console.log("Opening browser for GitHub authentication...");
    try {
        const result = await login();
        const displayName = result.email ?? result.user_id;
        console.log(`Logged in as ${displayName}`);
    }
    catch (err) {
        const message = err instanceof Error ? err.message : String(err);
        console.error(`Login failed: ${message}`);
        process.exitCode = 1;
    }
}
//# sourceMappingURL=login.js.map