diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js index 2c403a55..f83272b7 100644 --- a/scripts/modules/commands.js +++ b/scripts/modules/commands.js @@ -3701,7 +3701,10 @@ Examples: programInstance .command('add-tag') .description('Create a new tag context for organizing tasks') - .argument('', 'Name of the new tag to create') + .argument( + '[tagName]', + 'Name of the new tag to create (optional when using --from-branch)' + ) .option( '-f, --file ', 'Path to the tasks file', @@ -3743,6 +3746,19 @@ Examples: process.exit(1); } + // Validate that either tagName is provided or --from-branch is used + if (!tagName && !options.fromBranch) { + console.error( + chalk.red( + 'Error: Either tagName argument or --from-branch option is required.' + ) + ); + console.log(chalk.yellow('Usage examples:')); + console.log(chalk.cyan(' task-master add-tag my-tag')); + console.log(chalk.cyan(' task-master add-tag --from-branch')); + process.exit(1); + } + const context = { projectRoot, commandName: 'add-tag',