bugblaze
Version:
BugBlaze is a command-line tool that helps developers find and fix bugs in their code using AI.
63 lines (52 loc) ⢠2.54 kB
JavaScript
import chalk from 'chalk';
import figlet from 'figlet';
import fs from 'fs';
import path from 'path';
import os from 'os';
const configPath = path.join(process.cwd(), '.bugblazerc.json');
// Config creation handled elsewhere
function readConfig() {
try {
const configContent = fs.readFileSync(configPath, 'utf-8');
const parsed = JSON.parse(configContent);
return parsed;
} catch (error) {
return null;
}
}
figlet('Welcome to BugBlaze!', (err, data) => {
if (err) {
console.log(chalk.red('Error generating ASCII art'));
return;
}
console.log(chalk.green(data));
if (!fs.existsSync(configPath)) {
console.log(chalk.red('\nā Configuration file not found!'));
console.log(chalk.yellow('š” Set your GROQ API key using:'));
console.log(chalk.cyan(' bugblaze config set apikey <your-api-key>'));
process.exit(1);
}
const config = readConfig();
if (!config || !config.apikey) {
console.log(chalk.red('\nā API key not found in config!'));
console.log(chalk.yellow('š” Set your GROQ API key using:'));
console.log(chalk.cyan(' bugblaze config set apikey <your-api-key>'));
process.exit(1);
}
console.log(chalk.green('\nā API key found!'));
console.log(chalk.blue('\nYou are ready to use BugBlaze CLI!'));
// You can list available commands here if you want:
console.log(chalk.yellow('\nš Available commands:'));
console.log(chalk.cyan(' bugblaze analyze <file-path> Analyze code for issues'));
console.log(chalk.cyan(' bugblaze fun <file-path> Get AI explanations for errors'));
console.log(chalk.cyan(' bugblaze generate codebase <desc> Generate a new project structure'));
console.log(chalk.cyan(' bugblaze generate tests <file> Generate unit tests for code'));
console.log(chalk.cyan(' bugblaze generate docs <file> Generate documentation for code'));
console.log(chalk.cyan(' bugblaze generate refactor <file> Generate refactoring suggestions'));
console.log(chalk.cyan(' bugblaze health-scan Perform a health scan on codebase'));
console.log(chalk.cyan(' bugblaze mentor <file> Get AI mentorship for code issues'));
console.log(chalk.cyan(' bugblaze chat Start an interactive chat with the AI assistant'));
console.log(chalk.cyan(' bugblaze config Configure BugBlaze settings'));
process.exit(0);
});