/**
 * Whoami Command
 *
 * Shows current authentication status and user info.
 */
import pc from 'picocolors';
import { isLoggedIn, getStoredUser } from '../lib/auth.js';
import { checkHealth } from '../lib/api-client.js';
export async function whoami() {
    console.log(pc.bold('\nQuickback Account\n'));
    const loggedIn = await isLoggedIn();
    if (!loggedIn) {
        console.log(pc.yellow('Not logged in'));
        console.log(pc.gray('\nRun `quickback login` to authenticate, or `quickback start` to scaffold a project.'));
        return;
    }
    const user = await getStoredUser();
    console.log(pc.green('Logged in'));
    console.log('');
    console.log(`  ${pc.gray('Email:')} ${user?.email || 'Unknown'}`);
    if (user?.name) {
        console.log(`  ${pc.gray('Name:')}  ${user.name}`);
    }
    if (user?.tier) {
        const tierLabel = user.tier === 'pro' ? pc.cyan('Pro') : 'Free';
        console.log(`  ${pc.gray('Tier:')}  ${tierLabel}`);
    }
    console.log('');
    // Check API connectivity
    try {
        const health = await checkHealth();
        console.log(pc.gray(`API: ${pc.green('●')} Connected (v${health.version})`));
    }
    catch {
        console.log(pc.gray(`API: ${pc.red('●')} Disconnected`));
    }
}
//# sourceMappingURL=whoami.js.map