Skip to content

An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.

Fix duplicate output on CLI help screen (#496)

Joe Danzigerefce37469bc5
diff --git a/.changeset/wide-eyes-relax.md b/.changeset/wide-eyes-relax.md
new file mode 100644
index 00000000..1684d1a5
--- /dev/null
+++ b/.changeset/wide-eyes-relax.md
@@ -0,0 +1,11 @@
+---
+'task-master-ai': patch
+---
+
+Fix duplicate output on CLI help screen
+
+- Prevent the Task Master CLI from printing the help screen more than once when using `-h` or `--help`.
+- Removed redundant manual event handlers and guards for help output; now only the Commander `.helpInformation` override is used for custom help.
+- Simplified logic so that help is only shown once for both "no arguments" and help flag flows.
+- Ensures a clean, branded help experience with no repeated content.
+- Fixes #339
diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js
index 0e60642b..5d62b5e7 100644
--- a/scripts/modules/commands.js
+++ b/scripts/modules/commands.js
@@ -486,11 +486,6 @@ function registerCommands(programInstance) {
process.exit(1);
});
- // Default help
- programInstance.on('--help', function () {
- displayHelp();
- });
-
// parse-prd command
programInstance
.command('parse-prd')
@@ -2366,14 +2361,7 @@ function setupCLI() {
return 'unknown'; // Default fallback if package.json fails
})
.helpOption('-h, --help', 'Display help')
- .addHelpCommand(false) // Disable default help command
- .on('--help', () => {
- displayHelp(); // Use your custom help display instead
- })
- .on('-h', () => {
- displayHelp();
- process.exit(0);
- });
+ .addHelpCommand(false); // Disable default help command
// Modify the help option to use your custom display
programInstance.helpInformation = () => {