ripple-ai-detector
Version:
đ Ripple AI Bug Detector - Built by an AI that knows its flaws. Catch AI-generated bugs before you commit.
112 lines (92 loc) âĸ 2.6 kB
text/typescript
import chalk from 'chalk';
import ora, { Ora } from 'ora';
export class Logger {
private spinner: Ora | null = null;
// Success messages
success(message: string): void {
console.log(chalk.green('â'), message);
}
// Error messages
error(message: string): void {
console.log(chalk.red('â'), message);
}
// Warning messages
warning(message: string): void {
console.log(chalk.yellow('â ī¸'), message);
}
// Info messages
info(message: string): void {
console.log(chalk.blue('âšī¸'), message);
}
// AI-specific messages
aiDetected(message: string, confidence: number): void {
const confidenceColor = confidence > 80 ? 'red' : confidence > 60 ? 'yellow' : 'blue';
console.log(
chalk.magenta('đ¤'),
message,
chalk[confidenceColor](`(${confidence}% confidence)`)
);
}
// Bug detection
bugFound(message: string): void {
console.log(chalk.red('đĨ'), message);
}
// Tips and suggestions
tip(message: string): void {
console.log(chalk.cyan('đĄ'), message);
}
// Upgrade prompts
upgrade(message: string): void {
console.log(chalk.green('đ'), message);
}
// Money/pricing messages
money(message: string): void {
console.log(chalk.green('đ°'), message);
}
// Spinner for loading
startSpinner(message: string): void {
this.spinner = ora(message).start();
}
updateSpinner(message: string): void {
if (this.spinner) {
this.spinner.text = message;
}
}
stopSpinner(success: boolean = true, message?: string): void {
if (this.spinner) {
if (success) {
this.spinner.succeed(message);
} else {
this.spinner.fail(message);
}
this.spinner = null;
}
}
// Usage tracking display
usageStatus(current: number, limit: number): void {
const percentage = (current / limit) * 100;
const color = percentage >= 100 ? 'red' : percentage >= 80 ? 'yellow' : 'green';
console.log(
chalk.gray(`Validation ${current}/${limit} this month`),
'âĸ',
chalk[color](`${percentage.toFixed(0)}% used`)
);
}
// Separator line
separator(): void {
console.log(chalk.gray('â'.repeat(50)));
}
// Empty line
newLine(): void {
console.log();
}
// Header with banner
header(): void {
console.log();
console.log(chalk.blue('đ ') + chalk.bold.blue('Ripple AI Bug Detector'));
console.log(chalk.gray(' Catch AI-generated bugs before you commit'));
console.log();
}
}
// Export singleton instance
export const logger = new Logger();