accs-cli
Version:
ACCS CLI — Full-featured developer tool for scaffolding, running, building, and managing multi-language projects
84 lines (73 loc) • 2.76 kB
JavaScript
/**
* ACCS CLI - Main Entry Point
* A full-featured CLI tool for multi-language project management
*/
import { program } from 'commander';
import chalk from 'chalk';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import updateNotifier from 'update-notifier';
// Import command modules
import { initCommand } from '../src/commands/init.js';
import { runCommand } from '../src/commands/run.js';
import { buildCommand } from '../src/commands/build.js';
import { serveCommand } from '../src/commands/serve.js';
import { cleanCommand } from '../src/commands/clean.js';
import { doctorCommand } from '../src/commands/doctor.js';
import { watchCommand } from '../src/commands/watch.js';
import { deployCommand } from '../src/commands/deploy.js';
import { listTemplatesCommand } from '../src/commands/list-templates.js';
import { pluginCommand } from '../src/commands/plugin.js';
import { configCommand } from '../src/commands/config.js';
import { scanCommand } from '../src/commands/scan.js';
// Get package info for version
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf8'));
// Check for updates
const notifier = updateNotifier({ pkg: packageJson });
notifier.notify();
// Configure CLI
program
.name('accs')
.description(chalk.blue.bold('🚀 ACCS - Advanced Cross-platform Code Scaffolder'))
.version(packageJson.version, '-v, --version', 'output the current version')
.helpOption('-h, --help', 'display help for command');
// Global error handler
process.on('unhandledRejection', (err) => {
console.error(chalk.red.bold('✖ Unhandled Error:'), err.message);
process.exit(1);
});
process.on('uncaughtException', (err) => {
console.error(chalk.red.bold('✖ Uncaught Exception:'), err.message);
process.exit(1);
});
// Register all commands
initCommand(program);
runCommand(program);
buildCommand(program);
serveCommand(program);
cleanCommand(program);
doctorCommand(program);
watchCommand(program);
deployCommand(program);
listTemplatesCommand(program);
pluginCommand(program);
configCommand(program);
scanCommand(program);
// Custom help
program.on('--help', () => {
console.log('');
console.log(chalk.yellow.bold('Examples:'));
console.log(' $ accs init my-app --template react');
console.log(' $ accs run src/index.js');
console.log(' $ accs build --minify');
console.log(' $ accs serve --port 8080');
console.log(' $ accs watch --verbose');
console.log('');
console.log(chalk.cyan('For more information, visit: https://github.com/axhilxif/accs-cli'));
});
// Parse arguments
program.parse();