UNPKG

api-scout

Version:

🔍 Automatically scout, discover and generate beautiful interactive API documentation from your codebase. Supports Express.js, NestJS, FastAPI, Spring Boot with interactive testing and security analysis.

53 lines (45 loc) 2.05 kB
#!/usr/bin/env node const { program } = require('commander'); const chalk = require('chalk'); const { version } = require('../package.json'); const generateCommand = require('../src/cli/generate'); const serveCommand = require('../src/cli/serve'); const watchCommand = require('../src/cli/watch'); program .name('api-scout') .description('🔍 Scout and generate beautiful interactive API documentation from your codebase') .version(version); program .command('generate') .alias('gen') .description('Scout and generate API documentation from codebase') .option('-i, --input <path>', 'Input directory to scan', process.cwd()) .option('-o, --output <path>', 'Output directory for docs', './docs-output') .option('-f, --framework <type>', 'Target framework (express, nestjs, fastapi, spring, all)', 'all') .option('-t, --template <name>', 'Documentation template (swagger, redoc, custom)', 'swagger') .option('--config <path>', 'Configuration file path') .option('--exclude <patterns>', 'Exclude patterns (comma-separated)') .option('--include-private', 'Include private/internal APIs') .action(generateCommand); program .command('serve') .description('Serve generated documentation locally') .option('-p, --port <number>', 'Port to serve on', '3000') .option('-d, --docs <path>', 'Documentation directory', './docs-output') .action(serveCommand); program .command('watch') .description('Watch codebase and regenerate docs on changes') .option('-i, --input <path>', 'Input directory to watch', process.cwd()) .option('-o, --output <path>', 'Output directory for docs', './docs-output') .option('--debounce <ms>', 'Debounce time in milliseconds', '1000') .action(watchCommand); program.on('command:*', () => { console.error(chalk.red(`Invalid command: ${program.args.join(' ')}`)); console.log('See --help for available commands.'); process.exit(1); }); if (process.argv.length === 2) { program.help(); } program.parse(process.argv);