fix: ensure CLI correctly handles kebab-case options

- Fixed CLI wrapper to convert camelCase options to kebab-case when passing to dev.js
- Added explicit support for --input option in parse-prd command
- Updated commands.mdc to clarify Commander.js camelCase/kebab-case behavior
This commit is contained in:
Eyal Toledano
2025-03-25 00:42:59 -04:00
parent 3be7920868
commit b3d6e61e6b
6 changed files with 42 additions and 14 deletions

View File

@@ -56,20 +56,26 @@ function registerCommands(programInstance) {
.command('parse-prd')
.description('Parse a PRD file and generate tasks')
.argument('[file]', 'Path to the PRD file')
.option('-i, --input <file>', 'Path to the PRD file (alternative to positional argument)')
.option('-o, --output <file>', 'Output file path', 'tasks/tasks.json')
.option('-n, --num-tasks <number>', 'Number of tasks to generate', '10')
.action(async (file, options) => {
if (!file) {
// Use input option if file argument not provided
const inputFile = file || options.input;
if (!inputFile) {
console.log(chalk.yellow('No PRD file specified.'));
console.log(boxen(
chalk.white.bold('Parse PRD Help') + '\n\n' +
chalk.cyan('Usage:') + '\n' +
` task-master parse-prd <prd-file.txt> [options]\n\n` +
chalk.cyan('Options:') + '\n' +
' -o, --output <file> Output file path (default: "tasks/tasks.json")\n' +
' -n, --num-tasks <number> Number of tasks to generate (default: 10)\n\n' +
' -i, --input <file> Path to the PRD file (alternative to positional argument)\n' +
' -o, --output <file> Output file path (default: "tasks/tasks.json")\n' +
' -n, --num-tasks <number> Number of tasks to generate (default: 10)\n\n' +
chalk.cyan('Example:') + '\n' +
' task-master parse-prd requirements.txt --num-tasks 15\n\n' +
' task-master parse-prd requirements.txt --num-tasks 15\n' +
' task-master parse-prd --input=requirements.txt\n\n' +
chalk.yellow('Note: This command will generate tasks from a PRD document and will overwrite any existing tasks.json file.'),
{ padding: 1, borderColor: 'blue', borderStyle: 'round' }
));
@@ -79,10 +85,10 @@ function registerCommands(programInstance) {
const numTasks = parseInt(options.numTasks, 10);
const outputPath = options.output;
console.log(chalk.blue(`Parsing PRD file: ${file}`));
console.log(chalk.blue(`Parsing PRD file: ${inputFile}`));
console.log(chalk.blue(`Generating ${numTasks} tasks...`));
await parsePRD(file, outputPath, numTasks);
await parsePRD(inputFile, outputPath, numTasks);
});
// update command