Skip to content

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

fix(cli): Correctly pass manual task data in add-task command

Eyal Toledano96aeeffc1953
diff --git a/.changeset/gentle-views-jump.md b/.changeset/gentle-views-jump.md
new file mode 100644
index 00000000..94c074d5
--- /dev/null
+++ b/.changeset/gentle-views-jump.md
@@ -0,0 +1,5 @@
+---
+'task-master-ai': patch
+---
+
+Fixes an issue with add-task which did not use the manually defined properties and still needlessly hit the AI endpoint.
diff --git a/mcp-server/src/tools/add-task.js b/mcp-server/src/tools/add-task.js
index 70c82e7f..7c726995 100644
--- a/mcp-server/src/tools/add-task.js
+++ b/mcp-server/src/tools/add-task.js
@@ -99,6 +99,10 @@ export function registerAddTaskTool(server) {
tasksJsonPath: tasksJsonPath,
// Pass other relevant args
prompt: args.prompt,
+ title: args.title,
+ description: args.description,
+ details: args.details,
+ testStrategy: args.testStrategy,
dependencies: args.dependencies,
priority: args.priority,
research: args.research
diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js
index 9a574e21..b235de5e 100644
--- a/scripts/modules/commands.js
+++ b/scripts/modules/commands.js
@@ -913,14 +913,16 @@ function registerCommands(programInstance) {
// Pass mcpLog and session for MCP mode
const newTaskId = await addTask(
options.file,
- options.prompt,
+ options.prompt, // Pass prompt (will be null/undefined if not provided)
dependencies,
options.priority,
{
- session: process.env // Pass environment as session for CLI
+ // For CLI, session context isn't directly available like MCP
+ // We don't need to pass session here for CLI API key resolution
+ // as dotenv loads .env, and utils.resolveEnvVariable checks process.env
},
'text', // outputFormat
- null, // manualTaskData
+ manualTaskData, // Pass the potentially created manualTaskData object
options.research || false // Pass the research flag value
);
diff --git a/scripts/modules/task-manager/add-task.js b/scripts/modules/task-manager/add-task.js
index 1a17ddde..05855767 100644
--- a/scripts/modules/task-manager/add-task.js
+++ b/scripts/modules/task-manager/add-task.js
@@ -131,6 +131,7 @@ async function addTask(
if (manualTaskData) {
report('Using manually provided task data', 'info');
taskData = manualTaskData;
+ report('DEBUG: Taking MANUAL task data path.', 'debug');
// Basic validation for manual data
if (
@@ -144,6 +145,7 @@ async function addTask(
);
}
} else {
+ report('DEBUG: Taking AI task generation path.', 'debug');
// --- Refactored AI Interaction ---
report('Generating task data with AI...', 'info');
@@ -180,12 +182,26 @@ async function addTask(
"testStrategy": "Detailed approach for verifying task completion."
}`;
+ // Add any manually provided details to the prompt for context
+ let contextFromArgs = '';
+ if (manualTaskData?.title)
+ contextFromArgs += `\n- Suggested Title: "${manualTaskData.title}"`;
+ if (manualTaskData?.description)
+ contextFromArgs += `\n- Suggested Description: "${manualTaskData.description}"`;
+ if (manualTaskData?.details)
+ contextFromArgs += `\n- Additional Details Context: "${manualTaskData.details}"`;
+ if (manualTaskData?.testStrategy)
+ contextFromArgs += `\n- Additional Test Strategy Context: "${manualTaskData.testStrategy}"`;
+
// User Prompt
const userPrompt = `Create a comprehensive new task (Task #${newTaskId}) for a software development project based on this description: "${prompt}"
${contextTasks}
+ ${contextFromArgs ? `\nConsider these additional details provided by the user:${contextFromArgs}` : ''}
+
+ Return your answer as a single JSON object matching the schema precisely:
+ ${taskStructureDesc}
- Return your answer as a single JSON object matching the schema precisely.
Make sure the details and test strategy are thorough and specific.`;
// Start the loading indicator - only for text mode
diff --git a/tasks/task_061.txt b/tasks/task_061.txt
index 17564647..6798ce2f 100644
--- a/tasks/task_061.txt
+++ b/tasks/task_061.txt
@@ -1425,37 +1425,37 @@ function checkProviderCapability(provider, capability) {
```
</info added on 2025-04-20T03:52:13.065Z>
-## 24. Implement `google.js` Provider Module using Vercel AI SDK [deferred]
+## 24. Implement `google.js` Provider Module using Vercel AI SDK [pending]
### Dependencies: None
### Description: Create and implement the `google.js` module within `src/ai-providers/`. This module should contain functions to interact with Google AI models (e.g., Gemini) using the **Vercel AI SDK (`@ai-sdk/google`)**, adhering to the standardized input/output format defined for `ai-services-unified.js`.
### Details:
-## 25. Implement `ollama.js` Provider Module [deferred]
+## 25. Implement `ollama.js` Provider Module [pending]
### Dependencies: None
### Description: Create and implement the `ollama.js` module within `src/ai-providers/`. This module should contain functions to interact with local Ollama models using the **`ollama-ai-provider` library**, adhering to the standardized input/output format defined for `ai-services-unified.js`. Note the specific library used.
### Details:
-## 26. Implement `mistral.js` Provider Module using Vercel AI SDK [deferred]
+## 26. Implement `mistral.js` Provider Module using Vercel AI SDK [pending]
### Dependencies: None
### Description: Create and implement the `mistral.js` module within `src/ai-providers/`. This module should contain functions to interact with Mistral AI models using the **Vercel AI SDK (`@ai-sdk/mistral`)**, adhering to the standardized input/output format defined for `ai-services-unified.js`.
### Details:
-## 27. Implement `azure.js` Provider Module using Vercel AI SDK [deferred]
+## 27. Implement `azure.js` Provider Module using Vercel AI SDK [pending]
### Dependencies: None
### Description: Create and implement the `azure.js` module within `src/ai-providers/`. This module should contain functions to interact with Azure OpenAI models using the **Vercel AI SDK (`@ai-sdk/azure`)**, adhering to the standardized input/output format defined for `ai-services-unified.js`.
### Details:
-## 28. Implement `openrouter.js` Provider Module [deferred]
+## 28. Implement `openrouter.js` Provider Module [pending]
### Dependencies: None
### Description: Create and implement the `openrouter.js` module within `src/ai-providers/`. This module should contain functions to interact with various models via OpenRouter using the **`@openrouter/ai-sdk-provider` library**, adhering to the standardized input/output format defined for `ai-services-unified.js`. Note the specific library used.
### Details:
-## 29. Implement `xai.js` Provider Module using Vercel AI SDK [deferred]
+## 29. Implement `xai.js` Provider Module using Vercel AI SDK [pending]
### Dependencies: None
### Description: Create and implement the `xai.js` module within `src/ai-providers/`. This module should contain functions to interact with xAI models (e.g., Grok) using the **Vercel AI SDK (`@ai-sdk/xai`)**, adhering to the standardized input/output format defined for `ai-services-unified.js`.
### Details:
diff --git a/tasks/task_067.txt b/tasks/task_067.txt
new file mode 100644
index 00000000..d6e3e586
--- /dev/null
+++ b/tasks/task_067.txt
@@ -0,0 +1,11 @@
+# Task ID: 67
+# Title: Add CLI JSON output and Cursor keybindings integration
+# Status: pending
+# Dependencies: None
+# Priority: high
+# Description: Enhance Taskmaster CLI with JSON output option and add a new command to install pre-configured Cursor keybindings
+# Details:
+This task has two main components:\n\n1. Add `--json` flag to all relevant CLI commands:\n - Modify the CLI command handlers to check for a `--json` flag\n - When the flag is present, output the raw data from the MCP tools in JSON format instead of formatting for human readability\n - Ensure consistent JSON schema across all commands\n - Add documentation for this feature in the help text for each command\n - Test with common scenarios like `task-master next --json` and `task-master show <id> --json`\n\n2. Create a new `install-keybindings` command:\n - Create a new CLI command that installs pre-configured Taskmaster keybindings to Cursor\n - Detect the user's OS to determine the correct path to Cursor's keybindings.json\n - Check if the file exists; create it if it doesn't\n - Add useful Taskmaster keybindings like:\n - Quick access to next task with output to clipboard\n - Task status updates\n - Opening new agent chat with context from the current task\n - Implement safeguards to prevent duplicate keybindings\n - Add undo functionality or backup of previous keybindings\n - Support custom key combinations via command flags
+
+# Test Strategy:
+1. JSON output testing:\n - Unit tests for each command with the --json flag\n - Verify JSON schema consistency across commands\n - Validate that all necessary task data is included in the JSON output\n - Test piping output to other commands like jq\n\n2. Keybindings command testing:\n - Test on different OSes (macOS, Windows, Linux)\n - Verify correct path detection for Cursor's keybindings.json\n - Test behavior when file doesn't exist\n - Test behavior when existing keybindings conflict\n - Validate the installed keybindings work as expected\n - Test uninstall/restore functionality
diff --git a/tasks/tasks.json b/tasks/tasks.json
index 641b3f71..666f2941 100644
--- a/tasks/tasks.json
+++ b/tasks/tasks.json
@@ -3252,7 +3252,7 @@
"title": "Implement `google.js` Provider Module using Vercel AI SDK",
"description": "Create and implement the `google.js` module within `src/ai-providers/`. This module should contain functions to interact with Google AI models (e.g., Gemini) using the **Vercel AI SDK (`@ai-sdk/google`)**, adhering to the standardized input/output format defined for `ai-services-unified.js`.",
"details": "",
- "status": "deferred",
+ "status": "pending",
"dependencies": [],
"parentTaskId": 61
},
@@ -3261,7 +3261,7 @@
"title": "Implement `ollama.js` Provider Module",
"description": "Create and implement the `ollama.js` module within `src/ai-providers/`. This module should contain functions to interact with local Ollama models using the **`ollama-ai-provider` library**, adhering to the standardized input/output format defined for `ai-services-unified.js`. Note the specific library used.",
"details": "",
- "status": "deferred",
+ "status": "pending",
"dependencies": [],
"parentTaskId": 61
},
@@ -3270,7 +3270,7 @@
"title": "Implement `mistral.js` Provider Module using Vercel AI SDK",
"description": "Create and implement the `mistral.js` module within `src/ai-providers/`. This module should contain functions to interact with Mistral AI models using the **Vercel AI SDK (`@ai-sdk/mistral`)**, adhering to the standardized input/output format defined for `ai-services-unified.js`.",
"details": "",
- "status": "deferred",
+ "status": "pending",
"dependencies": [],
"parentTaskId": 61
},
@@ -3279,7 +3279,7 @@
"title": "Implement `azure.js` Provider Module using Vercel AI SDK",
"description": "Create and implement the `azure.js` module within `src/ai-providers/`. This module should contain functions to interact with Azure OpenAI models using the **Vercel AI SDK (`@ai-sdk/azure`)**, adhering to the standardized input/output format defined for `ai-services-unified.js`.",
"details": "",
- "status": "deferred",
+ "status": "pending",
"dependencies": [],
"parentTaskId": 61
},
@@ -3288,7 +3288,7 @@
"title": "Implement `openrouter.js` Provider Module",
"description": "Create and implement the `openrouter.js` module within `src/ai-providers/`. This module should contain functions to interact with various models via OpenRouter using the **`@openrouter/ai-sdk-provider` library**, adhering to the standardized input/output format defined for `ai-services-unified.js`. Note the specific library used.",
"details": "",
- "status": "deferred",
+ "status": "pending",
"dependencies": [],
"parentTaskId": 61
},
@@ -3297,7 +3297,7 @@
"title": "Implement `xai.js` Provider Module using Vercel AI SDK",
"description": "Create and implement the `xai.js` module within `src/ai-providers/`. This module should contain functions to interact with xAI models (e.g., Grok) using the **Vercel AI SDK (`@ai-sdk/xai`)**, adhering to the standardized input/output format defined for `ai-services-unified.js`.",
"details": "",
- "status": "deferred",
+ "status": "pending",
"dependencies": [],
"parentTaskId": 61
},
@@ -3791,6 +3791,17 @@
"dependencies": [],
"priority": "medium",
"subtasks": []
+ },
+ {
+ "id": 67,
+ "title": "Add CLI JSON output and Cursor keybindings integration",
+ "description": "Enhance Taskmaster CLI with JSON output option and add a new command to install pre-configured Cursor keybindings",
+ "details": "This task has two main components:\\n\\n1. Add `--json` flag to all relevant CLI commands:\\n - Modify the CLI command handlers to check for a `--json` flag\\n - When the flag is present, output the raw data from the MCP tools in JSON format instead of formatting for human readability\\n - Ensure consistent JSON schema across all commands\\n - Add documentation for this feature in the help text for each command\\n - Test with common scenarios like `task-master next --json` and `task-master show <id> --json`\\n\\n2. Create a new `install-keybindings` command:\\n - Create a new CLI command that installs pre-configured Taskmaster keybindings to Cursor\\n - Detect the user's OS to determine the correct path to Cursor's keybindings.json\\n - Check if the file exists; create it if it doesn't\\n - Add useful Taskmaster keybindings like:\\n - Quick access to next task with output to clipboard\\n - Task status updates\\n - Opening new agent chat with context from the current task\\n - Implement safeguards to prevent duplicate keybindings\\n - Add undo functionality or backup of previous keybindings\\n - Support custom key combinations via command flags",
+ "testStrategy": "1. JSON output testing:\\n - Unit tests for each command with the --json flag\\n - Verify JSON schema consistency across commands\\n - Validate that all necessary task data is included in the JSON output\\n - Test piping output to other commands like jq\\n\\n2. Keybindings command testing:\\n - Test on different OSes (macOS, Windows, Linux)\\n - Verify correct path detection for Cursor's keybindings.json\\n - Test behavior when file doesn't exist\\n - Test behavior when existing keybindings conflict\\n - Validate the installed keybindings work as expected\\n - Test uninstall/restore functionality",
+ "status": "pending",
+ "dependencies": [],
+ "priority": "high",
+ "subtasks": []
}
]
}
\ No newline at end of file