UNPKG

@craftapit/tester

Version:

A focused, LLM-powered testing framework for natural language test scenarios

61 lines (60 loc) 2.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CLI = void 0; const commander_1 = require("commander"); const run_scenario_1 = require("./commands/run-scenario"); const run_scenarios_1 = require("./commands/run-scenarios"); const init_1 = require("./commands/init"); const run_tests_1 = require("./commands/run-tests"); const logger_1 = require("../utils/logger"); class CLI { constructor(version) { this.program = new commander_1.Command(); this.logger = new logger_1.Logger('CLI'); this.program .version(version) .description('A focused, LLM-powered testing framework for natural language test scenarios'); this.registerCommands(); } registerCommands() { // Run single scenario command this.program .command('run <scenario>') .description('Run a single test scenario') .option('-c, --config <path>', 'Path to config file') .option('-h, --headless', 'Run browser in headless mode') .option('-m, --model <model>', 'LLM model to use') .option('-p, --provider <provider>', 'LLM provider to use') .option('-k, --api-key <key>', 'API key for LLM provider') .action(run_scenario_1.runScenario); // Run all scenarios command this.program .command('run-all <directory>') .description('Run all test scenarios in a directory') .option('-c, --config <path>', 'Path to config file') .option('-h, --headless', 'Run browser in headless mode') .option('-m, --model <model>', 'LLM model to use') .option('-p, --provider <provider>', 'LLM provider to use') .option('-k, --api-key <key>', 'API key for LLM provider') .option('-r, --recursive', 'Search for scenarios recursively') .action(run_scenarios_1.runScenarios); // Initialize project command this.program .command('init') .description('Initialize a new craft-a-tester project') .option('-d, --directory <path>', 'Project directory', '.') .action(init_1.init); // Add the new run-tests command (0, run_tests_1.addRunTestsCommand)(this.program); } parse(argv) { try { this.program.parse(argv); } catch (error) { this.logger.error('Command execution failed', error); process.exit(1); } } } exports.CLI = CLI;