secure-scan-js
Version:
A JavaScript implementation of Yelp's detect-secrets tool - no Python required
36 lines (31 loc) • 1.01 kB
JavaScript
import { program } from 'commander';
import chalk from 'chalk';
import ora from 'ora';
import path from 'path';
import fs from 'fs';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import auth from '../src/auth.mjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Set up the CLI
program
.name("secure-scan-js")
.description("JavaScript secret scanner with Gitleaks integration")
.version("1.0.0");
program
.command("login")
.description("Authenticate with the service")
.action(async () => {
const spinner = ora("Starting authentication...").start();
try {
await auth.authenticate();
spinner.succeed(chalk.green("Successfully authenticated!"));
} catch (error) {
spinner.fail(chalk.red("Authentication failed"));
console.error(chalk.red(error.message));
process.exit(1);
}
});
program.parse();