ubon
Version:
Security scanner for AI-generated React/Next.js and Python apps. Catches hardcoded secrets, accessibility issues, and vulnerabilities that traditional linters miss.
66 lines (65 loc) • 2.05 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
const chalk_1 = __importDefault(require("chalk"));
class Logger {
constructor(verbose = false, silent = false, colorMode = 'auto') {
this.verbose = verbose;
this.silent = silent;
this.useColor = this.shouldUseColor(colorMode);
}
shouldUseColor(mode) {
if (mode === 'always')
return true;
if (mode === 'never')
return false;
// auto: check if we're in a terminal that supports color
return process.stdout.isTTY && !process.env.NO_COLOR;
}
colorize(fn, text) {
return this.useColor ? fn(text) : text;
}
brand(text) {
return this.useColor ? chalk_1.default.hex('#c99cb3')(text) : text;
}
info(message) {
if (!this.silent) {
console.log(this.brand('🪷'), message);
}
}
success(message) {
if (!this.silent) {
console.log(this.colorize(chalk_1.default.green, '✓'), message);
}
}
warning(message) {
if (!this.silent) {
console.log(this.colorize(chalk_1.default.yellow, '⚠'), message);
}
}
error(message) {
if (!this.silent) {
console.log(this.colorize(chalk_1.default.red, '✗'), message);
}
}
debug(message) {
if (this.verbose && !this.silent) {
console.log(this.brand('🪷'), this.colorize(chalk_1.default.gray, message));
}
}
title(message) {
if (!this.silent) {
const titleText = this.useColor ? this.brand(chalk_1.default.bold('🪷 ' + message)) : '🪷 ' + message;
console.log('\n' + titleText);
}
}
separator() {
if (!this.silent) {
console.log(this.brand('─'.repeat(50)));
}
}
}
exports.Logger = Logger;