UNPKG

ripbug-ai-detector

Version:

šŸ”„ RipBug AI Bug Detector - Built by an AI that rips its own bugs. Destroy AI-generated bugs before you commit.

77 lines • 3.02 kB
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const commander_1 = require("commander"); const chalk_1 = __importDefault(require("chalk")); const fs_1 = require("fs"); const path_1 = require("path"); const validate_1 = require("./commands/validate"); const init_1 = require("./commands/init"); const auth_1 = require("./commands/auth"); const upgrade_1 = require("./commands/upgrade"); // Read version from package.json const packageJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../package.json'), 'utf8')); const version = packageJson.version; const program = new commander_1.Command(); // ASCII Art Banner const banner = ` šŸ”„ ${chalk_1.default.bold.red('RipBug AI Bug Detector')} ${chalk_1.default.gray('Rip AI-generated bugs before you commit')} `; program .name('ripbug') .description('AI Bug Detector - Built by an AI that rips its own bugs') .version(version) .addHelpText('beforeAll', banner); // Main validate command program .command('validate') .description('Analyze staged files for AI-generated bugs') .option('-f, --format <type>', 'output format (console|json)', 'console') .option('--files <files...>', 'specific files to validate') .option('--all', 'validate all files (not just staged)') .option('--tree-sitter-mode', 'force tree-sitter parsing mode') .option('--compare-methods', 'compare tree-sitter vs regex methods') .option('--experimental', 'enable experimental features') .option('--report-differences', 'report differences between parsing methods') .action(validate_1.validateCommand); // Initialize project program .command('init') .description('Initialize RipBug in current project') .action(init_1.initCommand); // Authentication commands program .command('auth') .description('Manage authentication') .addCommand(new commander_1.Command('login') .description('Login with license key') .argument('<key>', 'license key') .action(auth_1.authCommand.login)) .addCommand(new commander_1.Command('status') .description('Check authentication status') .action(auth_1.authCommand.status)) .addCommand(new commander_1.Command('logout') .description('Logout and clear credentials') .action(auth_1.authCommand.logout)); // Upgrade command program .command('upgrade') .description('Upgrade to Pro plan') .action(upgrade_1.upgradeCommand); // Handle unknown commands program.on('command:*', () => { console.error(chalk_1.default.red(`Unknown command: ${program.args.join(' ')}`)); console.log(chalk_1.default.gray('Run "ripbug --help" for available commands')); process.exit(1); }); // Parse arguments program.parse(); // Show help if no command provided if (!process.argv.slice(2).length) { program.outputHelp(); } //# sourceMappingURL=cli.js.map