ripbug-ai-detector
Version:
🔥 RipBug AI Bug Detector - Built by an AI that rips its own bugs. Destroy AI-generated bugs before you commit.
70 lines • 3.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.authCommand = void 0;
const logger_1 = require("../utils/logger");
const auth_manager_1 = require("../auth/auth-manager");
exports.authCommand = {
async login(licenseKey) {
try {
logger_1.logger.header();
logger_1.logger.startSpinner('Validating license key...');
const authManager = new auth_manager_1.AuthManager();
const result = await authManager.login(licenseKey);
logger_1.logger.stopSpinner(true, 'License validated successfully');
logger_1.logger.success(`Welcome, ${result.user.email}!`);
logger_1.logger.info(`Plan: ${result.user.plan}`);
logger_1.logger.info(`Validations: ${result.limits.currentUsage}/${result.limits.validationsPerMonth}`);
if (result.user.plan === 'free') {
logger_1.logger.tip('Upgrade to Pro for unlimited validations: ripbug.dev/pro');
}
}
catch (error) {
logger_1.logger.stopSpinner(false, 'License validation failed');
logger_1.logger.error(`Authentication failed: ${error instanceof Error ? error.message : 'Invalid license key'}`);
logger_1.logger.tip('Get a license key at: ripple.dev/pricing');
process.exit(1);
}
},
async status() {
try {
const authManager = new auth_manager_1.AuthManager();
const status = await authManager.getStatus();
logger_1.logger.header();
if (status.authenticated) {
logger_1.logger.success('Authenticated');
logger_1.logger.info(`Email: ${status.user?.email}`);
logger_1.logger.info(`Plan: ${status.user?.plan}`);
logger_1.logger.info(`License: ${status.licenseKey?.substring(0, 8)}...`);
if (status.usage) {
logger_1.logger.usageStatus(status.usage.current, status.usage.limit);
}
if (status.user?.plan === 'free') {
logger_1.logger.tip('Upgrade to Pro: ripbug.dev/pro');
}
}
else {
logger_1.logger.warning('Not authenticated');
logger_1.logger.tip('Login with: ripbug auth login <license-key>');
logger_1.logger.tip('Get a license: ripbug.dev/pricing');
}
}
catch (error) {
logger_1.logger.error(`Status check failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
process.exit(1);
}
},
async logout() {
try {
const authManager = new auth_manager_1.AuthManager();
await authManager.logout();
logger_1.logger.success('Logged out successfully');
logger_1.logger.info('Your local credentials have been cleared');
logger_1.logger.tip('Login again with: ripple auth login <license-key>');
}
catch (error) {
logger_1.logger.error(`Logout failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
process.exit(1);
}
}
};
//# sourceMappingURL=auth.js.map