UNPKG

hai-modernize-cli

Version:

A CLI tool for modernization using agents

34 lines (27 loc) 925 B
#!/usr/bin/env node const fs = require("fs"); const path = require("path"); const { Command } = require("commander"); // Initialize Commander const program = new Command(); program .name("modernize") .description("A CLI tool for modernization using agents") .version("1.0.0") .requiredOption("--agent <type>", "Agent type to execute") .requiredOption("--output <path>", "Path to output file") .parse(process.argv); // Extract CLI options const options = program.opts(); const agent = options.agent.trim(); const outputPath = path.resolve(options.output.trim()); // Format message const message = `${agent.charAt(0).toUpperCase() + agent.slice(1)} agent executed successfully\n`; // Write to file try { fs.writeFileSync(outputPath, message); console.log(`✅ Success: Output written to ${outputPath}`); } catch (error) { console.error("❌ Error writing to file:", error.message); process.exit(1); }