Compare commits
53 Commits
fix-update
...
crunchyman
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22ce57b221 | ||
|
|
8a23ba9b2c | ||
|
|
0393e0fb14 | ||
|
|
da317f2607 | ||
|
|
ed17cb0e0a | ||
|
|
e96734a6cc | ||
|
|
17294ff259 | ||
|
|
a96215a359 | ||
|
|
0a611843b5 | ||
|
|
a1f8d52474 | ||
|
|
c47deeb869 | ||
|
|
dd90c9cb5d | ||
|
|
c7042845d6 | ||
|
|
efce37469b | ||
|
|
4117f71c18 | ||
|
|
09d839fff5 | ||
|
|
90068348d3 | ||
|
|
02e347d2d7 | ||
|
|
0527c363e3 | ||
|
|
735135efe9 | ||
|
|
4fee667a05 | ||
|
|
01963af2cb | ||
|
|
0633895f3b | ||
|
|
10442c1119 | ||
|
|
734a4fdcfc | ||
|
|
8dace2186c | ||
|
|
095e373843 | ||
|
|
0bc9bac392 | ||
|
|
0a45f4329c | ||
|
|
c4b2f7e514 | ||
|
|
9684beafc3 | ||
|
|
302b916045 | ||
|
|
e7f18f65b9 | ||
|
|
655c7c225a | ||
|
|
e1218b3747 | ||
|
|
ffa621a37c | ||
|
|
cd32fd9edf | ||
|
|
590e4bd66d | ||
|
|
70d3f2f103 | ||
|
|
424aae10ed | ||
|
|
a48d1f13e2 | ||
|
|
25ca1a45a0 | ||
|
|
2e17437da3 | ||
|
|
1f44ea5299 | ||
|
|
d63964a10e | ||
|
|
33559e368c | ||
|
|
9f86306766 | ||
|
|
8f8a3dc45d | ||
|
|
d18351dc38 | ||
|
|
9d437f8594 | ||
|
|
ad89253e31 | ||
|
|
70c5097553 | ||
|
|
cd4d8e335f |
5
.changeset/beige-doodles-type.md
Normal file
5
.changeset/beige-doodles-type.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Resolve all issues related to MCP
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
- Add support for Google Gemini models via Vercel AI SDK integration.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Add xAI provider and Grok models support
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
feat(expand): Enhance `expand` and `expand-all` commands
|
|
||||||
|
|
||||||
- Integrate `task-complexity-report.json` to automatically determine the number of subtasks and use tailored prompts for expansion based on prior analysis. You no longer need to try copy-pasting the recommended prompt. If it exists, it will use it for you. You can just run `task-master update --id=[id of task] --research` and it will use that prompt automatically. No extra prompt needed.
|
|
||||||
- Change default behavior to *append* new subtasks to existing ones. Use the `--force` flag to clear existing subtasks before expanding. This is helpful if you need to add more subtasks to a task but you want to do it by the batch from a given prompt. Use force if you want to start fresh with a task's subtasks.
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
Adds support for the OpenRouter AI provider. Users can now configure models available through OpenRouter (requiring an `OPENROUTER_API_KEY`) via the `task-master models` command, granting access to a wide range of additional LLMs.
|
|
||||||
- IMPORTANT FYI ABOUT OPENROUTER: Taskmaster relies on AI SDK, which itself relies on tool use. It looks like **free** models sometimes do not include tool use. For example, Gemini 2.5 pro (free) failed via OpenRouter (no tool use) but worked fine on the paid version of the model. Custom model support for Open Router is considered experimental and likely will not be further improved for some time.
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Improve and adjust `init` command for robustness and updated dependencies.
|
|
||||||
|
|
||||||
- **Update Initialization Dependencies:** Ensure newly initialized projects (`task-master init`) include all required AI SDK dependencies (`@ai-sdk/*`, `ai`, provider wrappers) in their `package.json` for out-of-the-box AI feature compatibility. Remove unnecessary dependencies (e.g., `uuid`) from the init template.
|
|
||||||
- **Silence `npm install` during `init`:** Prevent `npm install` output from interfering with non-interactive/MCP initialization by suppressing its stdio in silent mode.
|
|
||||||
- **Improve Conditional Model Setup:** Reliably skip interactive `models --setup` during non-interactive `init` runs (e.g., `init -y` or MCP) by checking `isSilentMode()` instead of passing flags.
|
|
||||||
- **Refactor `init.js`:** Remove internal `isInteractive` flag logic.
|
|
||||||
- **Update `init` Instructions:** Tweak the "Getting Started" text displayed after `init`.
|
|
||||||
- **Fix MCP Server Launch:** Update `.cursor/mcp.json` template to use `node ./mcp-server/server.js` instead of `npx task-master-mcp`.
|
|
||||||
- **Update Default Model:** Change the default main model in the `.taskmasterconfig` template.
|
|
||||||
9
.changeset/floppy-plants-marry.md
Normal file
9
.changeset/floppy-plants-marry.md
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix CLI --force flag for parse-prd command
|
||||||
|
|
||||||
|
Previously, the --force flag was not respected when running `parse-prd`, causing the command to prompt for confirmation or fail even when --force was provided. This patch ensures that the flag is correctly passed and handled, allowing users to overwrite existing tasks.json files as intended.
|
||||||
|
|
||||||
|
- Fixes #477
|
||||||
5
.changeset/forty-plums-stay.md
Normal file
5
.changeset/forty-plums-stay.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
.taskmasterconfig now supports a baseUrl field per model role (main, research, fallback), allowing endpoint overrides for any provider.
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'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.
|
|
||||||
5
.changeset/many-wasps-sell.md
Normal file
5
.changeset/many-wasps-sell.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Task Master no longer tells you to update when you're already up to date
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
Adds model management and new configuration file .taskmasterconfig which houses the models used for main, research and fallback. Adds models command and setter flags. Adds a --setup flag with an interactive setup. We should be calling this during init. Shows a table of active and available models when models is called without flags. Includes SWE scores and token costs, which are manually entered into the supported_models.json, the new place where models are defined for support. Config-manager.js is the core module responsible for managing the new config."
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Fixes an issue that prevented remove-subtask with comma separated tasks/subtasks from being deleted (only the first ID was being deleted). Closes #140
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Improves next command to be subtask-aware
|
|
||||||
- The logic for determining the "next task" (findNextTask function, used by task-master next and the next_task MCP tool) has been significantly improved. Previously, it only considered top-level tasks, making its recommendation less useful when a parent task containing subtasks was already marked 'in-progress'.
|
|
||||||
- The updated logic now prioritizes finding the next available subtask within any 'in-progress' parent task, considering subtask dependencies and priority.
|
|
||||||
- If no suitable subtask is found within active parent tasks, it falls back to recommending the next eligible top-level task based on the original criteria (status, dependencies, priority).
|
|
||||||
|
|
||||||
This change makes the next command much more relevant and helpful during the implementation phase of complex tasks.
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
Adds custom model ID support for Ollama and OpenRouter providers.
|
|
||||||
- Adds the `--ollama` and `--openrouter` flags to `task-master models --set-<role>` command to set models for those providers outside of the support models list.
|
|
||||||
- Updated `task-master models --setup` interactive mode with options to explicitly enter custom Ollama or OpenRouter model IDs.
|
|
||||||
- Implemented live validation against OpenRouter API (`/api/v1/models`) when setting a custom OpenRouter model ID (via flag or setup).
|
|
||||||
- Refined logic to prioritize explicit provider flags/choices over internal model list lookups in case of ID conflicts.
|
|
||||||
- Added warnings when setting custom/unvalidated models.
|
|
||||||
- We obviously don't recommend going with a custom, unproven model. If you do and find performance is good, please let us know so we can add it to the list of supported models.
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Add `--status` flag to `show` command to filter displayed subtasks.
|
|
||||||
12
.changeset/pre.json
Normal file
12
.changeset/pre.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"mode": "exit",
|
||||||
|
"tag": "rc",
|
||||||
|
"initialVersions": {
|
||||||
|
"task-master-ai": "0.13.2"
|
||||||
|
},
|
||||||
|
"changesets": [
|
||||||
|
"beige-doodles-type",
|
||||||
|
"red-oranges-attend",
|
||||||
|
"red-suns-wash"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
Integrate OpenAI as a new AI provider.
|
|
||||||
- Enhance `models` command/tool to display API key status.
|
|
||||||
- Implement model-specific `maxTokens` override based on `supported-models.json` to save you if you use an incorrect max token value.
|
|
||||||
5
.changeset/red-oranges-attend.md
Normal file
5
.changeset/red-oranges-attend.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix ERR_MODULE_NOT_FOUND when trying to run MCP Server
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
'task-master-ai': patch
|
'task-master-ai': patch
|
||||||
---
|
---
|
||||||
|
|
||||||
Add integration for Roo Code
|
Add src directory to exports
|
||||||
5
.changeset/sharp-dingos-melt.md
Normal file
5
.changeset/sharp-dingos-melt.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix the error handling of task status settings
|
||||||
7
.changeset/six-cloths-happen.md
Normal file
7
.changeset/six-cloths-happen.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove caching layer from MCP direct functions for task listing, next task, and complexity report
|
||||||
|
|
||||||
|
- Fixes issues users where having where they were getting stale data
|
||||||
5
.changeset/slow-singers-swim.md
Normal file
5
.changeset/slow-singers-swim.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix for issue #409 LOG_LEVEL Pydantic validation error
|
||||||
7
.changeset/soft-zoos-flow.md
Normal file
7
.changeset/soft-zoos-flow.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix initial .env.example to work out of the box
|
||||||
|
|
||||||
|
- Closes #419
|
||||||
5
.changeset/ten-ways-mate.md
Normal file
5
.changeset/ten-ways-mate.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix default fallback model and maxTokens in Taskmaster initialization
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': minor
|
|
||||||
---
|
|
||||||
Tweaks Perplexity AI calls for research mode to max out input tokens and get day-fresh information
|
|
||||||
- Forces temp at 0.1 for highly deterministic output, no variations
|
|
||||||
- Adds a system prompt to further improve the output
|
|
||||||
- Correctly uses the maximum input tokens (8,719, used 8,700) for perplexity
|
|
||||||
- Specificies to use a high degree of research across the web
|
|
||||||
- Specifies to use information that is as fresh as today; this support stuff like capturing brand new announcements like new GPT models and being able to query for those in research. 🔥
|
|
||||||
5
.changeset/tricky-wombats-spend.md
Normal file
5
.changeset/tricky-wombats-spend.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'task-master-ai': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix bug when updating tasks on the MCP server (#412)
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Fix --task to --num-tasks in ui + related tests - issue #324
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
'task-master-ai': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Adds a 'models' CLI and MCP command to get the current model configuration, available models, and gives the ability to set main/research/fallback models."
|
|
||||||
- In the CLI, `task-master models` shows the current models config. Using the `--setup` flag launches an interactive set up that allows you to easily select the models you want to use for each of the three roles. Use `q` during the interactive setup to cancel the setup.
|
|
||||||
- In the MCP, responses are simplified in RESTful format (instead of the full CLI output). The agent can use the `models` tool with different arguments, including `listAvailableModels` to get available models. Run without arguments, it will return the current configuration. Arguments are available to set the model for each of the three roles. This allows you to manage Taskmaster AI providers and models directly from either the CLI or MCP or both.
|
|
||||||
- Updated the CLI help menu when you run `task-master` to include missing commands and .taskmasterconfig information.
|
|
||||||
- Adds `--research` flag to `add-task` so you can hit up Perplexity right from the add-task flow, rather than having to add a task and then update it.
|
|
||||||
11
.changeset/wide-eyes-relax.md
Normal file
11
.changeset/wide-eyes-relax.md
Normal file
@@ -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
|
||||||
@@ -65,8 +65,9 @@ alwaysApply: false
|
|||||||
- **[`mcp-server/`](mdc:mcp-server/): MCP Server Integration**
|
- **[`mcp-server/`](mdc:mcp-server/): MCP Server Integration**
|
||||||
- **Purpose**: Provides MCP interface using FastMCP.
|
- **Purpose**: Provides MCP interface using FastMCP.
|
||||||
- **Responsibilities** (See also: [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc)):
|
- **Responsibilities** (See also: [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc)):
|
||||||
- Registers tools (`mcp-server/src/tools/*.js`).
|
- Registers tools (`mcp-server/src/tools/*.js`). Tool `execute` methods **should be wrapped** with the `withNormalizedProjectRoot` HOF (from `tools/utils.js`) to ensure consistent path handling.
|
||||||
- Tool `execute` methods call **direct function wrappers** (`mcp-server/src/core/direct-functions/*.js`).
|
- The HOF provides a normalized `args.projectRoot` to the `execute` method.
|
||||||
|
- Tool `execute` methods call **direct function wrappers** (`mcp-server/src/core/direct-functions/*.js`), passing the normalized `projectRoot` and other args.
|
||||||
- Direct functions use path utilities (`mcp-server/src/core/utils/`) to resolve paths based on `projectRoot` from session.
|
- Direct functions use path utilities (`mcp-server/src/core/utils/`) to resolve paths based on `projectRoot` from session.
|
||||||
- Direct functions implement silent mode, logger wrappers, and call core logic functions from `scripts/modules/`.
|
- Direct functions implement silent mode, logger wrappers, and call core logic functions from `scripts/modules/`.
|
||||||
- Manages MCP caching and response formatting.
|
- Manages MCP caching and response formatting.
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ Taskmaster configuration is managed through two main mechanisms:
|
|||||||
* For MCP/Cursor integration, configure these keys in the `env` section of `.cursor/mcp.json`.
|
* For MCP/Cursor integration, configure these keys in the `env` section of `.cursor/mcp.json`.
|
||||||
* Available keys/variables: See `assets/env.example` or the Configuration section in the command reference (previously linked to `taskmaster.mdc`).
|
* Available keys/variables: See `assets/env.example` or the Configuration section in the command reference (previously linked to `taskmaster.mdc`).
|
||||||
|
|
||||||
**Important:** Non-API key settings (like model selections, `MAX_TOKENS`, `LOG_LEVEL`) are **no longer configured via environment variables**. Use the `task-master models` command (or `--setup` for interactive configuration) or the `models` MCP tool.
|
**Important:** Non-API key settings (like model selections, `MAX_TOKENS`, `TASKMASTER_LOG_LEVEL`) are **no longer configured via environment variables**. Use the `task-master models` command (or `--setup` for interactive configuration) or the `models` MCP tool.
|
||||||
**If AI commands FAIL in MCP** verify that the API key for the selected provider is present in the `env` section of `.cursor/mcp.json`.
|
**If AI commands FAIL in MCP** verify that the API key for the selected provider is present in the `env` section of `.cursor/mcp.json`.
|
||||||
**If AI commands FAIL in CLI** verify that the API key for the selected provider is present in the `.env` file in the root of the project.
|
**If AI commands FAIL in CLI** verify that the API key for the selected provider is present in the `.env` file in the root of the project.
|
||||||
|
|
||||||
|
|||||||
@@ -188,58 +188,70 @@ execute: async (args, { log, session }) => {
|
|||||||
- **args**: Validated parameters.
|
- **args**: Validated parameters.
|
||||||
- **context**: Contains `{ log, session }` from FastMCP. (Removed `reportProgress`).
|
- **context**: Contains `{ log, session }` from FastMCP. (Removed `reportProgress`).
|
||||||
|
|
||||||
### Standard Tool Execution Pattern
|
### Standard Tool Execution Pattern with Path Normalization (Updated)
|
||||||
|
|
||||||
The `execute` method within each MCP tool (in `mcp-server/src/tools/*.js`) should follow this standard pattern:
|
To ensure consistent handling of project paths across different client environments (Windows, macOS, Linux, WSL) and input formats (e.g., `file:///...`, URI encoded paths), all MCP tool `execute` methods that require access to the project root **MUST** be wrapped with the `withNormalizedProjectRoot` Higher-Order Function (HOF).
|
||||||
|
|
||||||
1. **Log Entry**: Log the start of the tool execution with relevant arguments.
|
This HOF, defined in [`mcp-server/src/tools/utils.js`](mdc:mcp-server/src/tools/utils.js), performs the following before calling the tool's core logic:
|
||||||
2. **Get Project Root**: Use the `getProjectRootFromSession(session, log)` utility (from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js)) to extract the project root path from the client session. Fall back to `args.projectRoot` if the session doesn't provide a root.
|
|
||||||
3. **Call Direct Function**: Invoke the corresponding `*Direct` function wrapper (e.g., `listTasksDirect` from [`task-master-core.js`](mdc:mcp-server/src/core/task-master-core.js)), passing an updated `args` object that includes the resolved `projectRoot`. Crucially, the third argument (context) passed to the direct function should **only include `{ log, session }`**. **Do NOT pass `reportProgress`**.
|
1. **Determines the Raw Root:** It prioritizes `args.projectRoot` if provided by the client, otherwise it calls `getRawProjectRootFromSession` to extract the path from the session.
|
||||||
```javascript
|
2. **Normalizes the Path:** It uses the `normalizeProjectRoot` helper to decode URIs, strip `file://` prefixes, fix potential Windows drive letter prefixes (e.g., `/C:/`), convert backslashes (`\`) to forward slashes (`/`), and resolve the path to an absolute path suitable for the server's OS.
|
||||||
// Example call (applies to both AI and non-AI direct functions now)
|
3. **Injects Normalized Path:** It updates the `args` object by replacing the original `projectRoot` (or adding it) with the normalized, absolute path.
|
||||||
const result = await someDirectFunction(
|
4. **Executes Original Logic:** It calls the original `execute` function body, passing the updated `args` object.
|
||||||
{ ...args, projectRoot }, // Args including resolved root
|
|
||||||
log, // MCP logger
|
**Implementation Example:**
|
||||||
{ session } // Context containing session
|
|
||||||
);
|
|
||||||
```
|
|
||||||
4. **Handle Result**: Receive the result object (`{ success, data/error, fromCache }`) from the `*Direct` function.
|
|
||||||
5. **Format Response**: Pass this result object to the `handleApiResult` utility (from [`tools/utils.js`](mdc:mcp-server/src/tools/utils.js)) for standardized MCP response formatting and error handling.
|
|
||||||
6. **Return**: Return the formatted response object provided by `handleApiResult`.
|
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// Example execute method structure for a tool calling an AI-based direct function
|
// In mcp-server/src/tools/your-tool.js
|
||||||
import { getProjectRootFromSession, handleApiResult, createErrorResponse } from './utils.js';
|
import {
|
||||||
import { someAIDirectFunction } from '../core/task-master-core.js';
|
handleApiResult,
|
||||||
|
createErrorResponse,
|
||||||
|
withNormalizedProjectRoot // <<< Import HOF
|
||||||
|
} from './utils.js';
|
||||||
|
import { yourDirectFunction } from '../core/task-master-core.js';
|
||||||
|
import { findTasksJsonPath } from '../core/utils/path-utils.js'; // If needed
|
||||||
|
|
||||||
// ... inside server.addTool({...})
|
export function registerYourTool(server) {
|
||||||
execute: async (args, { log, session }) => { // Note: reportProgress is omitted here
|
server.addTool({
|
||||||
try {
|
name: "your_tool",
|
||||||
log.info(`Starting AI tool execution with args: ${JSON.stringify(args)}`);
|
description: "...".
|
||||||
|
parameters: z.object({
|
||||||
|
// ... other parameters ...
|
||||||
|
projectRoot: z.string().optional().describe('...') // projectRoot is optional here, HOF handles fallback
|
||||||
|
}),
|
||||||
|
// Wrap the entire execute function
|
||||||
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
|
// args.projectRoot is now guaranteed to be normalized and absolute
|
||||||
|
const { /* other args */, projectRoot } = args;
|
||||||
|
|
||||||
// 1. Get Project Root
|
try {
|
||||||
let rootFolder = getProjectRootFromSession(session, log);
|
log.info(`Executing your_tool with normalized root: ${projectRoot}`);
|
||||||
if (!rootFolder && args.projectRoot) { // Fallback if needed
|
|
||||||
rootFolder = args.projectRoot;
|
|
||||||
log.info(`Using project root from args as fallback: ${rootFolder}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Call AI-Based Direct Function (passing only log and session in context)
|
// Resolve paths using the normalized projectRoot
|
||||||
const result = await someAIDirectFunction({
|
let tasksPath = findTasksJsonPath({ projectRoot, file: args.file }, log);
|
||||||
...args,
|
|
||||||
projectRoot: rootFolder // Ensure projectRoot is explicitly passed
|
|
||||||
}, log, { session }); // Pass session here, NO reportProgress
|
|
||||||
|
|
||||||
// 3. Handle and Format Response
|
// Call direct function, passing normalized projectRoot if needed by direct func
|
||||||
return handleApiResult(result, log);
|
const result = await yourDirectFunction(
|
||||||
|
{
|
||||||
|
/* other args */,
|
||||||
|
projectRoot // Pass it if direct function needs it
|
||||||
|
},
|
||||||
|
log,
|
||||||
|
{ session }
|
||||||
|
);
|
||||||
|
|
||||||
} catch (error) {
|
return handleApiResult(result, log);
|
||||||
log.error(`Error during AI tool execution: ${error.message}`);
|
} catch (error) {
|
||||||
return createErrorResponse(error.message);
|
log.error(`Error in your_tool: ${error.message}`);
|
||||||
}
|
return createErrorResponse(error.message);
|
||||||
|
}
|
||||||
|
}) // End HOF wrap
|
||||||
|
});
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
By using this HOF, the core logic within the `execute` method and any downstream functions (like `findTasksJsonPath` or direct functions) can reliably expect `args.projectRoot` to be a clean, absolute path suitable for the server environment.
|
||||||
|
|
||||||
### Project Initialization Tool
|
### Project Initialization Tool
|
||||||
|
|
||||||
The `initialize_project` tool allows integrated clients like Cursor to set up a new Task Master project:
|
The `initialize_project` tool allows integrated clients like Cursor to set up a new Task Master project:
|
||||||
|
|||||||
@@ -523,14 +523,24 @@ Integrating Task Master commands with the MCP server (for use by tools like Curs
|
|||||||
|
|
||||||
4. **Create MCP Tool (`mcp-server/src/tools/`)**:
|
4. **Create MCP Tool (`mcp-server/src/tools/`)**:
|
||||||
- Create a new file (e.g., `your-command.js`) using **kebab-case**.
|
- Create a new file (e.g., `your-command.js`) using **kebab-case**.
|
||||||
- Import `zod`, `handleApiResult`, `createErrorResponse`, **`getProjectRootFromSession`**, and your `yourCommandDirect` function.
|
- Import `zod`, `handleApiResult`, **`withNormalizedProjectRoot` HOF**, and your `yourCommandDirect` function.
|
||||||
- Implement `registerYourCommandTool(server)`.
|
- Implement `registerYourCommandTool(server)`.
|
||||||
- Define the tool `name` using **snake_case** (e.g., `your_command`).
|
- **Define parameters**: Make `projectRoot` optional (`z.string().optional().describe(...)`) as the HOF handles fallback.
|
||||||
- Define the `parameters` using `zod`. **Crucially, define `projectRoot` as optional**: `projectRoot: z.string().optional().describe(...)`. Include `file` if applicable.
|
- Consider if this operation should run in the background using `AsyncOperationManager`.
|
||||||
- Implement the standard `async execute(args, { log, reportProgress, session })` method:
|
- Implement the standard `execute` method **wrapped with `withNormalizedProjectRoot`**:
|
||||||
- Get `rootFolder` using `getProjectRootFromSession` (with fallback to `args.projectRoot`).
|
```javascript
|
||||||
- Call `yourCommandDirect({ ...args, projectRoot: rootFolder }, log)`.
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
- Pass the result to `handleApiResult(result, log, 'Error Message')`.
|
// args.projectRoot is now normalized
|
||||||
|
const { projectRoot /*, other args */ } = args;
|
||||||
|
// ... resolve tasks path if needed using normalized projectRoot ...
|
||||||
|
const result = await yourCommandDirect(
|
||||||
|
{ /* other args */, projectRoot /* if needed by direct func */ },
|
||||||
|
log,
|
||||||
|
{ session }
|
||||||
|
);
|
||||||
|
return handleApiResult(result, log);
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
5. **Register Tool**: Import and call `registerYourCommandTool` in `mcp-server/src/tools/index.js`.
|
5. **Register Tool**: Import and call `registerYourCommandTool` in `mcp-server/src/tools/index.js`.
|
||||||
|
|
||||||
@@ -618,8 +628,3 @@ When implementing project initialization commands:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ This document provides a detailed reference for interacting with Taskmaster, cov
|
|||||||
* **Usage (CLI):** Run without flags to view current configuration and available models. Use set flags to update specific roles. Use `--setup` for guided configuration, including custom models. To set a custom model via flags, use `--set-<role>=<model_id>` along with either `--ollama` or `--openrouter`.
|
* **Usage (CLI):** Run without flags to view current configuration and available models. Use set flags to update specific roles. Use `--setup` for guided configuration, including custom models. To set a custom model via flags, use `--set-<role>=<model_id>` along with either `--ollama` or `--openrouter`.
|
||||||
* **Notes:** Configuration is stored in `.taskmasterconfig` in the project root. This command/tool modifies that file. Use `listAvailableModels` or `task-master models` to see internally supported models. OpenRouter custom models are validated against their live API. Ollama custom models are not validated live.
|
* **Notes:** Configuration is stored in `.taskmasterconfig` in the project root. This command/tool modifies that file. Use `listAvailableModels` or `task-master models` to see internally supported models. OpenRouter custom models are validated against their live API. Ollama custom models are not validated live.
|
||||||
* **API note:** API keys for selected AI providers (based on their model) need to exist in the mcp.json file to be accessible in MCP context. The API keys must be present in the local .env file for the CLI to be able to read them.
|
* **API note:** API keys for selected AI providers (based on their model) need to exist in the mcp.json file to be accessible in MCP context. The API keys must be present in the local .env file for the CLI to be able to read them.
|
||||||
|
* **Model costs:** The costs in supported models are expressed in dollars. An input/output value of 3 is $3.00. A value of 0.8 is $0.80.
|
||||||
* **Warning:** DO NOT MANUALLY EDIT THE .taskmasterconfig FILE. Use the included commands either in the MCP or CLI format as needed. Always prioritize MCP tools when available and use the CLI as a fallback.
|
* **Warning:** DO NOT MANUALLY EDIT THE .taskmasterconfig FILE. Use the included commands either in the MCP or CLI format as needed. Always prioritize MCP tools when available and use the CLI as a fallback.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -428,36 +428,69 @@ Taskmaster configuration (excluding API keys) is primarily managed through the `
|
|||||||
|
|
||||||
## MCP Server Tool Utilities (`mcp-server/src/tools/utils.js`)
|
## MCP Server Tool Utilities (`mcp-server/src/tools/utils.js`)
|
||||||
|
|
||||||
- **Purpose**: These utilities specifically support the MCP server tools ([`mcp-server/src/tools/*.js`](mdc:mcp-server/src/tools/*.js)), handling MCP communication patterns, response formatting, caching integration, and the CLI fallback mechanism.
|
These utilities specifically support the implementation and execution of MCP tools.
|
||||||
- **Refer to [`mcp.mdc`](mdc:.cursor/rules/mcp.mdc)** for detailed usage patterns within the MCP tool `execute` methods and direct function wrappers.
|
|
||||||
|
|
||||||
- **`getProjectRootFromSession(session, log)`**:
|
- **`normalizeProjectRoot(rawPath, log)`**:
|
||||||
- ✅ **DO**: Call this utility **within the MCP tool's `execute` method** to extract the project root path from the `session` object.
|
- **Purpose**: Takes a raw project root path (potentially URI encoded, with `file://` prefix, Windows slashes) and returns a normalized, absolute path suitable for the server's OS.
|
||||||
- Decodes the `file://` URI and handles potential errors.
|
- **Logic**: Decodes URI, strips `file://`, handles Windows drive prefix (`/C:/`), replaces `\` with `/`, uses `path.resolve()`.
|
||||||
- Returns the project path string or `null`.
|
- **Usage**: Used internally by `withNormalizedProjectRoot` HOF.
|
||||||
- The returned path should then be passed in the `args` object when calling the corresponding `*Direct` function (e.g., `yourDirectFunction({ ...args, projectRoot: rootFolder }, log)`).
|
|
||||||
|
- **`getRawProjectRootFromSession(session, log)`**:
|
||||||
|
- **Purpose**: Extracts the *raw* project root URI string from the session object (`session.roots[0].uri` or `session.roots.roots[0].uri`) without performing normalization.
|
||||||
|
- **Usage**: Used internally by `withNormalizedProjectRoot` HOF as a fallback if `args.projectRoot` isn't provided.
|
||||||
|
|
||||||
|
- **`withNormalizedProjectRoot(executeFn)`**:
|
||||||
|
- **Purpose**: A Higher-Order Function (HOF) designed to wrap a tool's `execute` method.
|
||||||
|
- **Logic**:
|
||||||
|
1. Determines the raw project root (from `args.projectRoot` or `getRawProjectRootFromSession`).
|
||||||
|
2. Normalizes the raw path using `normalizeProjectRoot`.
|
||||||
|
3. Injects the normalized, absolute path back into the `args` object as `args.projectRoot`.
|
||||||
|
4. Calls the original `executeFn` with the updated `args`.
|
||||||
|
- **Usage**: Should wrap the `execute` function of *every* MCP tool that needs a reliable, normalized project root path.
|
||||||
|
- **Example**:
|
||||||
|
```javascript
|
||||||
|
// In mcp-server/src/tools/your-tool.js
|
||||||
|
import { withNormalizedProjectRoot } from './utils.js';
|
||||||
|
|
||||||
|
export function registerYourTool(server) {
|
||||||
|
server.addTool({
|
||||||
|
// ... name, description, parameters ...
|
||||||
|
execute: withNormalizedProjectRoot(async (args, context) => {
|
||||||
|
// args.projectRoot is now normalized here
|
||||||
|
const { projectRoot /*, other args */ } = args;
|
||||||
|
// ... rest of tool logic using normalized projectRoot ...
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
- **`handleApiResult(result, log, errorPrefix, processFunction)`**:
|
- **`handleApiResult(result, log, errorPrefix, processFunction)`**:
|
||||||
- ✅ **DO**: Call this from the MCP tool's `execute` method after receiving the result from the `*Direct` function wrapper.
|
- **Purpose**: Standardizes the formatting of responses returned by direct functions (`{ success, data/error, fromCache }`) into the MCP response format.
|
||||||
- Takes the standard `{ success, data/error, fromCache }` object.
|
- **Usage**: Call this at the end of the tool's `execute` method, passing the result from the direct function call.
|
||||||
- Formats the standard MCP success or error response, including the `fromCache` flag.
|
|
||||||
- Uses `processMCPResponseData` by default to filter response data.
|
|
||||||
|
|
||||||
- **`executeTaskMasterCommand(command, log, args, projectRootRaw)`**:
|
|
||||||
- Executes a Task Master CLI command as a child process.
|
|
||||||
- Handles fallback between global `task-master` and local `node scripts/dev.js`.
|
|
||||||
- ❌ **DON'T**: Use this as the primary method for MCP tools. Prefer direct function calls via `*Direct` wrappers.
|
|
||||||
|
|
||||||
- **`processMCPResponseData(taskOrData, fieldsToRemove)`**:
|
|
||||||
- Filters task data (e.g., removing `details`, `testStrategy`) before sending to the MCP client. Called by `handleApiResult`.
|
|
||||||
|
|
||||||
- **`createContentResponse(content)` / `createErrorResponse(errorMessage)`**:
|
- **`createContentResponse(content)` / `createErrorResponse(errorMessage)`**:
|
||||||
- Formatters for standard MCP success/error responses.
|
- **Purpose**: Helper functions to create the basic MCP response structure for success or error messages.
|
||||||
|
- **Usage**: Used internally by `handleApiResult` and potentially directly for simple responses.
|
||||||
|
|
||||||
|
- **`createLogWrapper(log)`**:
|
||||||
|
- **Purpose**: Creates a logger object wrapper with standard methods (`info`, `warn`, `error`, `debug`, `success`) mapping to the passed MCP `log` object's methods. Ensures compatibility when passing loggers to core functions.
|
||||||
|
- **Usage**: Used within direct functions before passing the `log` object down to core logic that expects the standard method names.
|
||||||
|
|
||||||
- **`getCachedOrExecute({ cacheKey, actionFn, log })`**:
|
- **`getCachedOrExecute({ cacheKey, actionFn, log })`**:
|
||||||
- ✅ **DO**: Use this utility *inside direct function wrappers* to implement caching.
|
- **Purpose**: Utility for implementing caching within direct functions. Checks cache for `cacheKey`; if miss, executes `actionFn`, caches successful result, and returns.
|
||||||
- Checks cache, executes `actionFn` on miss, stores result.
|
- **Usage**: Wrap the core logic execution within a direct function call.
|
||||||
- Returns standard `{ success, data/error, fromCache: boolean }`.
|
|
||||||
|
- **`processMCPResponseData(taskOrData, fieldsToRemove)`**:
|
||||||
|
- **Purpose**: Utility to filter potentially sensitive or large fields (like `details`, `testStrategy`) from task objects before sending the response back via MCP.
|
||||||
|
- **Usage**: Passed as the default `processFunction` to `handleApiResult`.
|
||||||
|
|
||||||
|
- **`getProjectRootFromSession(session, log)`**:
|
||||||
|
- **Purpose**: Legacy function to extract *and normalize* the project root from the session. Replaced by the HOF pattern but potentially still used.
|
||||||
|
- **Recommendation**: Prefer using the `withNormalizedProjectRoot` HOF in tools instead of calling this directly.
|
||||||
|
|
||||||
|
- **`executeTaskMasterCommand(...)`**:
|
||||||
|
- **Purpose**: Executes `task-master` CLI command as a fallback.
|
||||||
|
- **Recommendation**: Deprecated for most uses; prefer direct function calls.
|
||||||
|
|
||||||
## Export Organization
|
## Export Organization
|
||||||
|
|
||||||
|
|||||||
62
.github/workflows/pre-release.yml
vendored
Normal file
62
.github/workflows/pre-release.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
name: Pre-Release (RC)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # Allows manual triggering from GitHub UI/API
|
||||||
|
|
||||||
|
concurrency: pre-release-${{ github.ref }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
rc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Cache node_modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
node_modules
|
||||||
|
*/*/node_modules
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
timeout-minutes: 2
|
||||||
|
|
||||||
|
- name: Enter RC mode
|
||||||
|
run: |
|
||||||
|
npx changeset pre exit || true
|
||||||
|
npx changeset pre enter rc
|
||||||
|
|
||||||
|
- name: Version RC packages
|
||||||
|
run: npx changeset version
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create Release Candidate Pull Request or Publish Release Candidate to npm
|
||||||
|
uses: changesets/action@v1
|
||||||
|
with:
|
||||||
|
publish: npm run release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
|
- name: Exit RC mode
|
||||||
|
run: npx changeset pre exit
|
||||||
|
|
||||||
|
- name: Commit & Push changes
|
||||||
|
uses: actions-js/push@master
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
branch: ${{ github.ref }}
|
||||||
|
message: 'chore: rc version bump'
|
||||||
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -33,6 +33,9 @@ jobs:
|
|||||||
run: npm ci
|
run: npm ci
|
||||||
timeout-minutes: 2
|
timeout-minutes: 2
|
||||||
|
|
||||||
|
- name: Exit pre-release mode (safety check)
|
||||||
|
run: npx changeset pre exit || true
|
||||||
|
|
||||||
- name: Create Release Pull Request or Publish to npm
|
- name: Create Release Pull Request or Publish to npm
|
||||||
uses: changesets/action@v1
|
uses: changesets/action@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -61,3 +61,6 @@ dist
|
|||||||
*.debug
|
*.debug
|
||||||
init-debug.log
|
init-debug.log
|
||||||
dev-debug.log
|
dev-debug.log
|
||||||
|
|
||||||
|
# NPMRC
|
||||||
|
.npmrc
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"fallback": {
|
"fallback": {
|
||||||
"provider": "anthropic",
|
"provider": "anthropic",
|
||||||
"modelId": "claude-3-5-sonnet-20241022",
|
"modelId": "claude-3-7-sonnet-20250219",
|
||||||
"maxTokens": 120000,
|
"maxTokens": 120000,
|
||||||
"temperature": 0.2
|
"temperature": 0.2
|
||||||
}
|
}
|
||||||
|
|||||||
72
CHANGELOG.md
72
CHANGELOG.md
@@ -1,5 +1,77 @@
|
|||||||
# task-master-ai
|
# task-master-ai
|
||||||
|
|
||||||
|
## 0.13.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#399](https://github.com/eyaltoledano/claude-task-master/pull/399) [`734a4fd`](https://github.com/eyaltoledano/claude-task-master/commit/734a4fdcfc89c2e089255618cf940561ad13a3c8) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix ERR_MODULE_NOT_FOUND when trying to run MCP Server
|
||||||
|
|
||||||
|
## 0.13.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`ef782ff`](https://github.com/eyaltoledano/claude-task-master/commit/ef782ff5bd4ceb3ed0dc9ea82087aae5f79ac933) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - feat(expand): Enhance `expand` and `expand-all` commands
|
||||||
|
|
||||||
|
- Integrate `task-complexity-report.json` to automatically determine the number of subtasks and use tailored prompts for expansion based on prior analysis. You no longer need to try copy-pasting the recommended prompt. If it exists, it will use it for you. You can just run `task-master update --id=[id of task] --research` and it will use that prompt automatically. No extra prompt needed.
|
||||||
|
- Change default behavior to _append_ new subtasks to existing ones. Use the `--force` flag to clear existing subtasks before expanding. This is helpful if you need to add more subtasks to a task but you want to do it by the batch from a given prompt. Use force if you want to start fresh with a task's subtasks.
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`87d97bb`](https://github.com/eyaltoledano/claude-task-master/commit/87d97bba00d84e905756d46ef96b2d5b984e0f38) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Adds support for the OpenRouter AI provider. Users can now configure models available through OpenRouter (requiring an `OPENROUTER_API_KEY`) via the `task-master models` command, granting access to a wide range of additional LLMs. - IMPORTANT FYI ABOUT OPENROUTER: Taskmaster relies on AI SDK, which itself relies on tool use. It looks like **free** models sometimes do not include tool use. For example, Gemini 2.5 pro (free) failed via OpenRouter (no tool use) but worked fine on the paid version of the model. Custom model support for Open Router is considered experimental and likely will not be further improved for some time.
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`1ab836f`](https://github.com/eyaltoledano/claude-task-master/commit/1ab836f191cb8969153593a9a0bd47fc9aa4a831) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Adds model management and new configuration file .taskmasterconfig which houses the models used for main, research and fallback. Adds models command and setter flags. Adds a --setup flag with an interactive setup. We should be calling this during init. Shows a table of active and available models when models is called without flags. Includes SWE scores and token costs, which are manually entered into the supported_models.json, the new place where models are defined for support. Config-manager.js is the core module responsible for managing the new config."
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`c8722b0`](https://github.com/eyaltoledano/claude-task-master/commit/c8722b0a7a443a73b95d1bcd4a0b68e0fce2a1cd) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Adds custom model ID support for Ollama and OpenRouter providers.
|
||||||
|
|
||||||
|
- Adds the `--ollama` and `--openrouter` flags to `task-master models --set-<role>` command to set models for those providers outside of the support models list.
|
||||||
|
- Updated `task-master models --setup` interactive mode with options to explicitly enter custom Ollama or OpenRouter model IDs.
|
||||||
|
- Implemented live validation against OpenRouter API (`/api/v1/models`) when setting a custom OpenRouter model ID (via flag or setup).
|
||||||
|
- Refined logic to prioritize explicit provider flags/choices over internal model list lookups in case of ID conflicts.
|
||||||
|
- Added warnings when setting custom/unvalidated models.
|
||||||
|
- We obviously don't recommend going with a custom, unproven model. If you do and find performance is good, please let us know so we can add it to the list of supported models.
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`2517bc1`](https://github.com/eyaltoledano/claude-task-master/commit/2517bc112c9a497110f3286ca4bfb4130c9addcb) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Integrate OpenAI as a new AI provider. - Enhance `models` command/tool to display API key status. - Implement model-specific `maxTokens` override based on `supported-models.json` to save you if you use an incorrect max token value.
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`9a48278`](https://github.com/eyaltoledano/claude-task-master/commit/9a482789f7894f57f655fb8d30ba68542bd0df63) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Tweaks Perplexity AI calls for research mode to max out input tokens and get day-fresh information - Forces temp at 0.1 for highly deterministic output, no variations - Adds a system prompt to further improve the output - Correctly uses the maximum input tokens (8,719, used 8,700) for perplexity - Specificies to use a high degree of research across the web - Specifies to use information that is as fresh as today; this support stuff like capturing brand new announcements like new GPT models and being able to query for those in research. 🔥
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`842eaf7`](https://github.com/eyaltoledano/claude-task-master/commit/842eaf722498ddf7307800b4cdcef4ac4fd7e5b0) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - - Add support for Google Gemini models via Vercel AI SDK integration.
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`ed79d4f`](https://github.com/eyaltoledano/claude-task-master/commit/ed79d4f4735dfab4124fa189214c0bd5e23a6860) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Add xAI provider and Grok models support
|
||||||
|
|
||||||
|
- [#378](https://github.com/eyaltoledano/claude-task-master/pull/378) [`ad89253`](https://github.com/eyaltoledano/claude-task-master/commit/ad89253e313a395637aa48b9f92cc39b1ef94ad8) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Better support for file paths on Windows, Linux & WSL.
|
||||||
|
|
||||||
|
- Standardizes handling of different path formats (URI encoded, Windows, Linux, WSL).
|
||||||
|
- Ensures tools receive a clean, absolute path suitable for the server OS.
|
||||||
|
- Simplifies tool implementation by centralizing normalization logic.
|
||||||
|
|
||||||
|
- [#285](https://github.com/eyaltoledano/claude-task-master/pull/285) [`2acba94`](https://github.com/eyaltoledano/claude-task-master/commit/2acba945c0afee9460d8af18814c87e80f747e9f) Thanks [@neno-is-ooo](https://github.com/neno-is-ooo)! - Add integration for Roo Code
|
||||||
|
|
||||||
|
- [#378](https://github.com/eyaltoledano/claude-task-master/pull/378) [`d63964a`](https://github.com/eyaltoledano/claude-task-master/commit/d63964a10eed9be17856757661ff817ad6bacfdc) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Improved update-subtask - Now it has context about the parent task details - It also has context about the subtask before it and the subtask after it (if they exist) - Not passing all subtasks to stay token efficient
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`5f504fa`](https://github.com/eyaltoledano/claude-task-master/commit/5f504fafb8bdaa0043c2d20dee8bbb8ec2040d85) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Improve and adjust `init` command for robustness and updated dependencies.
|
||||||
|
|
||||||
|
- **Update Initialization Dependencies:** Ensure newly initialized projects (`task-master init`) include all required AI SDK dependencies (`@ai-sdk/*`, `ai`, provider wrappers) in their `package.json` for out-of-the-box AI feature compatibility. Remove unnecessary dependencies (e.g., `uuid`) from the init template.
|
||||||
|
- **Silence `npm install` during `init`:** Prevent `npm install` output from interfering with non-interactive/MCP initialization by suppressing its stdio in silent mode.
|
||||||
|
- **Improve Conditional Model Setup:** Reliably skip interactive `models --setup` during non-interactive `init` runs (e.g., `init -y` or MCP) by checking `isSilentMode()` instead of passing flags.
|
||||||
|
- **Refactor `init.js`:** Remove internal `isInteractive` flag logic.
|
||||||
|
- **Update `init` Instructions:** Tweak the "Getting Started" text displayed after `init`.
|
||||||
|
- **Fix MCP Server Launch:** Update `.cursor/mcp.json` template to use `node ./mcp-server/server.js` instead of `npx task-master-mcp`.
|
||||||
|
- **Update Default Model:** Change the default main model in the `.taskmasterconfig` template.
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`96aeeff`](https://github.com/eyaltoledano/claude-task-master/commit/96aeeffc195372722c6a07370540e235bfe0e4d8) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Fixes an issue with add-task which did not use the manually defined properties and still needlessly hit the AI endpoint.
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`5aea93d`](https://github.com/eyaltoledano/claude-task-master/commit/5aea93d4c0490c242d7d7042a210611977848e0a) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Fixes an issue that prevented remove-subtask with comma separated tasks/subtasks from being deleted (only the first ID was being deleted). Closes #140
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`66ac9ab`](https://github.com/eyaltoledano/claude-task-master/commit/66ac9ab9f66d006da518d6e8a3244e708af2764d) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Improves next command to be subtask-aware - The logic for determining the "next task" (findNextTask function, used by task-master next and the next_task MCP tool) has been significantly improved. Previously, it only considered top-level tasks, making its recommendation less useful when a parent task containing subtasks was already marked 'in-progress'. - The updated logic now prioritizes finding the next available subtask within any 'in-progress' parent task, considering subtask dependencies and priority. - If no suitable subtask is found within active parent tasks, it falls back to recommending the next eligible top-level task based on the original criteria (status, dependencies, priority).
|
||||||
|
|
||||||
|
This change makes the next command much more relevant and helpful during the implementation phase of complex tasks.
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`ca7b045`](https://github.com/eyaltoledano/claude-task-master/commit/ca7b0457f1dc65fd9484e92527d9fd6d69db758d) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Add `--status` flag to `show` command to filter displayed subtasks.
|
||||||
|
|
||||||
|
- [#328](https://github.com/eyaltoledano/claude-task-master/pull/328) [`5a2371b`](https://github.com/eyaltoledano/claude-task-master/commit/5a2371b7cc0c76f5e95d43921c1e8cc8081bf14e) Thanks [@knoxgraeme](https://github.com/knoxgraeme)! - Fix --task to --num-tasks in ui + related tests - issue #324
|
||||||
|
|
||||||
|
- [#240](https://github.com/eyaltoledano/claude-task-master/pull/240) [`6cb213e`](https://github.com/eyaltoledano/claude-task-master/commit/6cb213ebbd51116ae0688e35b575d09443d17c3b) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Adds a 'models' CLI and MCP command to get the current model configuration, available models, and gives the ability to set main/research/fallback models." - In the CLI, `task-master models` shows the current models config. Using the `--setup` flag launches an interactive set up that allows you to easily select the models you want to use for each of the three roles. Use `q` during the interactive setup to cancel the setup. - In the MCP, responses are simplified in RESTful format (instead of the full CLI output). The agent can use the `models` tool with different arguments, including `listAvailableModels` to get available models. Run without arguments, it will return the current configuration. Arguments are available to set the model for each of the three roles. This allows you to manage Taskmaster AI providers and models directly from either the CLI or MCP or both. - Updated the CLI help menu when you run `task-master` to include missing commands and .taskmasterconfig information. - Adds `--research` flag to `add-task` so you can hit up Perplexity right from the add-task flow, rather than having to add a task and then update it.
|
||||||
|
|
||||||
## 0.12.1
|
## 0.12.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ npm install task-master-ai
|
|||||||
task-master init
|
task-master init
|
||||||
|
|
||||||
# If installed locally
|
# If installed locally
|
||||||
npx task-master-init
|
npx task-master init
|
||||||
```
|
```
|
||||||
|
|
||||||
This will prompt you for project details and set up a new project with the necessary files and structure.
|
This will prompt you for project details and set up a new project with the necessary files and structure.
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
},
|
},
|
||||||
"fallback": {
|
"fallback": {
|
||||||
"provider": "anthropic",
|
"provider": "anthropic",
|
||||||
"modelId": "claude-3.5-sonnet-20240620",
|
"modelId": "claude-3-5-sonnet-20240620",
|
||||||
"maxTokens": 120000,
|
"maxTokens": 8192,
|
||||||
"temperature": 0.1
|
"temperature": 0.1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ alwaysApply: true
|
|||||||
- **MAX_TOKENS** (Default: `"4000"`): Maximum tokens for responses (Example: `MAX_TOKENS=8000`)
|
- **MAX_TOKENS** (Default: `"4000"`): Maximum tokens for responses (Example: `MAX_TOKENS=8000`)
|
||||||
- **TEMPERATURE** (Default: `"0.7"`): Temperature for model responses (Example: `TEMPERATURE=0.5`)
|
- **TEMPERATURE** (Default: `"0.7"`): Temperature for model responses (Example: `TEMPERATURE=0.5`)
|
||||||
- **DEBUG** (Default: `"false"`): Enable debug logging (Example: `DEBUG=true`)
|
- **DEBUG** (Default: `"false"`): Enable debug logging (Example: `DEBUG=true`)
|
||||||
- **LOG_LEVEL** (Default: `"info"`): Console output level (Example: `LOG_LEVEL=debug`)
|
- **TASKMASTER_LOG_LEVEL** (Default: `"info"`): Console output level (Example: `TASKMASTER_LOG_LEVEL=debug`)
|
||||||
- **DEFAULT_SUBTASKS** (Default: `"3"`): Default subtask count (Example: `DEFAULT_SUBTASKS=5`)
|
- **DEFAULT_SUBTASKS** (Default: `"3"`): Default subtask count (Example: `DEFAULT_SUBTASKS=5`)
|
||||||
- **DEFAULT_PRIORITY** (Default: `"medium"`): Default priority (Example: `DEFAULT_PRIORITY=high`)
|
- **DEFAULT_PRIORITY** (Default: `"medium"`): Default priority (Example: `DEFAULT_PRIORITY=high`)
|
||||||
- **PROJECT_NAME** (Default: `"MCP SaaS MVP"`): Project name in metadata (Example: `PROJECT_NAME=My Awesome Project`)
|
- **PROJECT_NAME** (Default: `"MCP SaaS MVP"`): Project name in metadata (Example: `PROJECT_NAME=My Awesome Project`)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# API Keys (Required to enable respective provider)
|
# API Keys (Required to enable respective provider)
|
||||||
ANTHROPIC_API_KEY=your_anthropic_api_key_here # Required: Format: sk-ant-api03-...
|
ANTHROPIC_API_KEY="your_anthropic_api_key_here" # Required: Format: sk-ant-api03-...
|
||||||
PERPLEXITY_API_KEY=your_perplexity_api_key_here # Optional: Format: pplx-...
|
PERPLEXITY_API_KEY="your_perplexity_api_key_here" # Optional: Format: pplx-...
|
||||||
OPENAI_API_KEY=your_openai_api_key_here # Optional, for OpenAI/OpenRouter models. Format: sk-proj-...
|
OPENAI_API_KEY="your_openai_api_key_here" # Optional, for OpenAI/OpenRouter models. Format: sk-proj-...
|
||||||
GOOGLE_API_KEY=your_google_api_key_here # Optional, for Google Gemini models.
|
GOOGLE_API_KEY="your_google_api_key_here" # Optional, for Google Gemini models.
|
||||||
MISTRAL_API_KEY=your_mistral_key_here # Optional, for Mistral AI models.
|
MISTRAL_API_KEY="your_mistral_key_here" # Optional, for Mistral AI models.
|
||||||
XAI_API_KEY=YOUR_XAI_KEY_HERE # Optional, for xAI AI models.
|
XAI_API_KEY="YOUR_XAI_KEY_HERE" # Optional, for xAI AI models.
|
||||||
AZURE_OPENAI_API_KEY=your_azure_key_here # Optional, for Azure OpenAI models (requires endpoint in .taskmasterconfig).
|
AZURE_OPENAI_API_KEY="your_azure_key_here" # Optional, for Azure OpenAI models (requires endpoint in .taskmasterconfig).
|
||||||
@@ -31,7 +31,7 @@ Task Master configuration is now managed through two primary methods:
|
|||||||
- Create a `.env` file in your project root for CLI usage.
|
- Create a `.env` file in your project root for CLI usage.
|
||||||
- See `assets/env.example` for required key names.
|
- See `assets/env.example` for required key names.
|
||||||
|
|
||||||
**Important:** Settings like `MODEL`, `MAX_TOKENS`, `TEMPERATURE`, `LOG_LEVEL`, etc., are **no longer set via `.env`**. Use `task-master models --setup` instead.
|
**Important:** Settings like `MODEL`, `MAX_TOKENS`, `TEMPERATURE`, `TASKMASTER_LOG_LEVEL`, etc., are **no longer set via `.env`**. Use `task-master models --setup` instead.
|
||||||
|
|
||||||
## How It Works
|
## How It Works
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ Task Master configuration is now managed through two primary methods:
|
|||||||
- Tasks can have `subtasks` for more detailed implementation steps.
|
- Tasks can have `subtasks` for more detailed implementation steps.
|
||||||
- Dependencies are displayed with status indicators (✅ for completed, ⏱️ for pending) to easily track progress.
|
- Dependencies are displayed with status indicators (✅ for completed, ⏱️ for pending) to easily track progress.
|
||||||
|
|
||||||
2. **CLI Commands**
|
2. **CLI Commands**
|
||||||
You can run the commands via:
|
You can run the commands via:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -200,7 +200,7 @@ Notes:
|
|||||||
|
|
||||||
## Logging
|
## Logging
|
||||||
|
|
||||||
The script supports different logging levels controlled by the `LOG_LEVEL` environment variable:
|
The script supports different logging levels controlled by the `TASKMASTER_LOG_LEVEL` environment variable:
|
||||||
|
|
||||||
- `debug`: Detailed information, typically useful for troubleshooting
|
- `debug`: Detailed information, typically useful for troubleshooting
|
||||||
- `info`: Confirmation that things are working as expected (default)
|
- `info`: Confirmation that things are working as expected (default)
|
||||||
|
|||||||
@@ -15,13 +15,15 @@ Taskmaster uses two primary methods for configuration:
|
|||||||
"provider": "anthropic",
|
"provider": "anthropic",
|
||||||
"modelId": "claude-3-7-sonnet-20250219",
|
"modelId": "claude-3-7-sonnet-20250219",
|
||||||
"maxTokens": 64000,
|
"maxTokens": 64000,
|
||||||
"temperature": 0.2
|
"temperature": 0.2,
|
||||||
|
"baseUrl": "https://api.anthropic.com/v1"
|
||||||
},
|
},
|
||||||
"research": {
|
"research": {
|
||||||
"provider": "perplexity",
|
"provider": "perplexity",
|
||||||
"modelId": "sonar-pro",
|
"modelId": "sonar-pro",
|
||||||
"maxTokens": 8700,
|
"maxTokens": 8700,
|
||||||
"temperature": 0.1
|
"temperature": 0.1,
|
||||||
|
"baseUrl": "https://api.perplexity.ai/v1"
|
||||||
},
|
},
|
||||||
"fallback": {
|
"fallback": {
|
||||||
"provider": "anthropic",
|
"provider": "anthropic",
|
||||||
@@ -56,8 +58,9 @@ Taskmaster uses two primary methods for configuration:
|
|||||||
- `AZURE_OPENAI_API_KEY`: Your Azure OpenAI API key (also requires `AZURE_OPENAI_ENDPOINT`).
|
- `AZURE_OPENAI_API_KEY`: Your Azure OpenAI API key (also requires `AZURE_OPENAI_ENDPOINT`).
|
||||||
- `OPENROUTER_API_KEY`: Your OpenRouter API key.
|
- `OPENROUTER_API_KEY`: Your OpenRouter API key.
|
||||||
- `XAI_API_KEY`: Your X-AI API key.
|
- `XAI_API_KEY`: Your X-AI API key.
|
||||||
- **Optional Endpoint Overrides (in .taskmasterconfig):**
|
- **Optional Endpoint Overrides:**
|
||||||
- `AZURE_OPENAI_ENDPOINT`: Required if using Azure OpenAI key.
|
- **Per-role `baseUrl` in `.taskmasterconfig`:** You can add a `baseUrl` property to any model role (`main`, `research`, `fallback`) to override the default API endpoint for that provider. If omitted, the provider's standard endpoint is used.
|
||||||
|
- `AZURE_OPENAI_ENDPOINT`: Required if using Azure OpenAI key (can also be set as `baseUrl` for the Azure model role).
|
||||||
- `OLLAMA_BASE_URL`: Override the default Ollama API URL (Default: `http://localhost:11434/api`).
|
- `OLLAMA_BASE_URL`: Override the default Ollama API URL (Default: `http://localhost:11434/api`).
|
||||||
|
|
||||||
**Important:** Settings like model ID selections (`main`, `research`, `fallback`), `maxTokens`, `temperature`, `logLevel`, `defaultSubtasks`, `defaultPriority`, and `projectName` are **managed in `.taskmasterconfig`**, not environment variables.
|
**Important:** Settings like model ID selections (`main`, `research`, `fallback`), `maxTokens`, `temperature`, `logLevel`, `defaultSubtasks`, `defaultPriority`, and `projectName` are **managed in `.taskmasterconfig`**, not environment variables.
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ Initialize a new project:
|
|||||||
task-master init
|
task-master init
|
||||||
|
|
||||||
# If installed locally
|
# If installed locally
|
||||||
npx task-master-init
|
npx task-master init
|
||||||
```
|
```
|
||||||
|
|
||||||
This will prompt you for project details and set up a new project with the necessary files and structure.
|
This will prompt you for project details and set up a new project with the necessary files and structure.
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
enableSilentMode,
|
enableSilentMode,
|
||||||
disableSilentMode
|
disableSilentMode
|
||||||
} from '../../../../scripts/modules/utils.js';
|
} from '../../../../scripts/modules/utils.js';
|
||||||
import { getCachedOrExecute } from '../../tools/utils.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Direct function wrapper for displaying the complexity report with error handling and caching.
|
* Direct function wrapper for displaying the complexity report with error handling and caching.
|
||||||
@@ -86,30 +85,20 @@ export async function complexityReportDirect(args, log) {
|
|||||||
|
|
||||||
// Use the caching utility
|
// Use the caching utility
|
||||||
try {
|
try {
|
||||||
const result = await getCachedOrExecute({
|
const result = await coreActionFn();
|
||||||
cacheKey,
|
log.info('complexityReportDirect completed');
|
||||||
actionFn: coreActionFn,
|
return result;
|
||||||
log
|
|
||||||
});
|
|
||||||
log.info(
|
|
||||||
`complexityReportDirect completed. From cache: ${result.fromCache}`
|
|
||||||
);
|
|
||||||
return result; // Returns { success, data/error, fromCache }
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Catch unexpected errors from getCachedOrExecute itself
|
|
||||||
// Ensure silent mode is disabled
|
// Ensure silent mode is disabled
|
||||||
disableSilentMode();
|
disableSilentMode();
|
||||||
|
|
||||||
log.error(
|
log.error(`Unexpected error during complexityReport: ${error.message}`);
|
||||||
`Unexpected error during getCachedOrExecute for complexityReport: ${error.message}`
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: {
|
error: {
|
||||||
code: 'UNEXPECTED_ERROR',
|
code: 'UNEXPECTED_ERROR',
|
||||||
message: error.message
|
message: error.message
|
||||||
},
|
}
|
||||||
fromCache: false
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
disableSilentMode
|
disableSilentMode
|
||||||
// isSilentMode // Not used directly here
|
// isSilentMode // Not used directly here
|
||||||
} from '../../../../scripts/modules/utils.js';
|
} from '../../../../scripts/modules/utils.js';
|
||||||
import { getProjectRootFromSession } from '../../tools/utils.js'; // Adjust path if necessary
|
|
||||||
import os from 'os'; // Import os module for home directory check
|
import os from 'os'; // Import os module for home directory check
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,60 +15,32 @@ import os from 'os'; // Import os module for home directory check
|
|||||||
* @returns {Promise<{success: boolean, data?: any, error?: {code: string, message: string}}>} - Standard result object.
|
* @returns {Promise<{success: boolean, data?: any, error?: {code: string, message: string}}>} - Standard result object.
|
||||||
*/
|
*/
|
||||||
export async function initializeProjectDirect(args, log, context = {}) {
|
export async function initializeProjectDirect(args, log, context = {}) {
|
||||||
const { session } = context;
|
const { session } = context; // Keep session if core logic needs it
|
||||||
const homeDir = os.homedir();
|
const homeDir = os.homedir();
|
||||||
let targetDirectory = null;
|
|
||||||
|
|
||||||
log.info(
|
|
||||||
`CONTEXT received in direct function: ${context ? JSON.stringify(Object.keys(context)) : 'MISSING or Falsy'}`
|
|
||||||
);
|
|
||||||
log.info(
|
|
||||||
`SESSION extracted in direct function: ${session ? 'Exists' : 'MISSING or Falsy'}`
|
|
||||||
);
|
|
||||||
log.info(`Args received in direct function: ${JSON.stringify(args)}`);
|
log.info(`Args received in direct function: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// --- Determine Target Directory ---
|
// --- Determine Target Directory ---
|
||||||
// 1. Prioritize projectRoot passed directly in args
|
// TRUST the projectRoot passed from the tool layer via args
|
||||||
// Ensure it's not null, '/', or the home directory
|
// The HOF in the tool layer already normalized and validated it came from a reliable source (args or session)
|
||||||
if (
|
const targetDirectory = args.projectRoot;
|
||||||
args.projectRoot &&
|
|
||||||
args.projectRoot !== '/' &&
|
|
||||||
args.projectRoot !== homeDir
|
|
||||||
) {
|
|
||||||
log.info(`Using projectRoot directly from args: ${args.projectRoot}`);
|
|
||||||
targetDirectory = args.projectRoot;
|
|
||||||
} else {
|
|
||||||
// 2. If args.projectRoot is missing or invalid, THEN try session (as a fallback)
|
|
||||||
log.warn(
|
|
||||||
`args.projectRoot ('${args.projectRoot}') is missing or invalid. Attempting to derive from session.`
|
|
||||||
);
|
|
||||||
const sessionDerivedPath = getProjectRootFromSession(session, log);
|
|
||||||
// Validate the session-derived path as well
|
|
||||||
if (
|
|
||||||
sessionDerivedPath &&
|
|
||||||
sessionDerivedPath !== '/' &&
|
|
||||||
sessionDerivedPath !== homeDir
|
|
||||||
) {
|
|
||||||
log.info(
|
|
||||||
`Using project root derived from session: ${sessionDerivedPath}`
|
|
||||||
);
|
|
||||||
targetDirectory = sessionDerivedPath;
|
|
||||||
} else {
|
|
||||||
log.error(
|
|
||||||
`Could not determine a valid project root. args.projectRoot='${args.projectRoot}', sessionDerivedPath='${sessionDerivedPath}'`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. Validate the final targetDirectory
|
// --- Validate the targetDirectory (basic sanity checks) ---
|
||||||
if (!targetDirectory) {
|
if (
|
||||||
// This error now covers cases where neither args.projectRoot nor session provided a valid path
|
!targetDirectory ||
|
||||||
|
typeof targetDirectory !== 'string' || // Ensure it's a string
|
||||||
|
targetDirectory === '/' ||
|
||||||
|
targetDirectory === homeDir
|
||||||
|
) {
|
||||||
|
log.error(
|
||||||
|
`Invalid target directory received from tool layer: '${targetDirectory}'`
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: {
|
error: {
|
||||||
code: 'INVALID_TARGET_DIRECTORY',
|
code: 'INVALID_TARGET_DIRECTORY',
|
||||||
message: `Cannot initialize project: Could not determine a valid target directory. Please ensure a workspace/folder is open or specify projectRoot.`,
|
message: `Cannot initialize project: Invalid target directory '${targetDirectory}' received. Please ensure a valid workspace/folder is open or specified.`,
|
||||||
details: `Attempted args.projectRoot: ${args.projectRoot}`
|
details: `Received args.projectRoot: ${args.projectRoot}` // Show what was received
|
||||||
},
|
},
|
||||||
fromCache: false
|
fromCache: false
|
||||||
};
|
};
|
||||||
@@ -86,11 +57,12 @@ export async function initializeProjectDirect(args, log, context = {}) {
|
|||||||
log.info(
|
log.info(
|
||||||
`Temporarily changing CWD to ${targetDirectory} for initialization.`
|
`Temporarily changing CWD to ${targetDirectory} for initialization.`
|
||||||
);
|
);
|
||||||
process.chdir(targetDirectory); // Change CWD to the *validated* targetDirectory
|
process.chdir(targetDirectory); // Change CWD to the HOF-provided root
|
||||||
|
|
||||||
enableSilentMode(); // Enable silent mode BEFORE calling the core function
|
enableSilentMode();
|
||||||
try {
|
try {
|
||||||
// Always force yes: true when called via MCP to avoid interactive prompts
|
// Construct options ONLY from the relevant flags in args
|
||||||
|
// The core initializeProject operates in the current CWD, which we just set
|
||||||
const options = {
|
const options = {
|
||||||
aliases: args.addAliases,
|
aliases: args.addAliases,
|
||||||
skipInstall: args.skipInstall,
|
skipInstall: args.skipInstall,
|
||||||
@@ -100,12 +72,11 @@ export async function initializeProjectDirect(args, log, context = {}) {
|
|||||||
log.info(`Initializing project with options: ${JSON.stringify(options)}`);
|
log.info(`Initializing project with options: ${JSON.stringify(options)}`);
|
||||||
const result = await initializeProject(options); // Call core logic
|
const result = await initializeProject(options); // Call core logic
|
||||||
|
|
||||||
// Format success result for handleApiResult
|
|
||||||
resultData = {
|
resultData = {
|
||||||
message: 'Project initialized successfully.',
|
message: 'Project initialized successfully.',
|
||||||
next_step:
|
next_step:
|
||||||
'Now that the project is initialized, the next step is to create the tasks by parsing a PRD. This will create the tasks folder and the initial task files (tasks folder will be created when parse-prd is run). The parse-prd tool will require a prd.txt file as input (typically found in the project root directory, scripts/ directory). You can create a prd.txt file by asking the user about their idea, and then using the scripts/example_prd.txt file as a template to genrate a prd.txt file in scripts/. You may skip all of this if the user already has a prd.txt file. You can THEN use the parse-prd tool to create the tasks. So: step 1 after initialization is to create a prd.txt file in scripts/prd.txt or confirm the user already has one. Step 2 is to use the parse-prd tool to create the tasks. Do not bother looking for tasks after initialization, just use the parse-prd tool to create the tasks after creating a prd.txt from which to parse the tasks. You do NOT need to reinitialize the project to parse-prd.',
|
'Now that the project is initialized, the next step is to create the tasks by parsing a PRD. This will create the tasks folder and the initial task files (tasks folder will be created when parse-prd is run). The parse-prd tool will require a prd.txt file as input (typically found in the project root directory, scripts/ directory). You can create a prd.txt file by asking the user about their idea, and then using the scripts/example_prd.txt file as a template to genrate a prd.txt file in scripts/. You may skip all of this if the user already has a prd.txt file. You can THEN use the parse-prd tool to create the tasks. So: step 1 after initialization is to create a prd.txt file in scripts/prd.txt or confirm the user already has one. Step 2 is to use the parse-prd tool to create the tasks. Do not bother looking for tasks after initialization, just use the parse-prd tool to create the tasks after creating a prd.txt from which to parse the tasks. You do NOT need to reinitialize the project to parse-prd.',
|
||||||
...result // Include details returned by initializeProject
|
...result
|
||||||
};
|
};
|
||||||
success = true;
|
success = true;
|
||||||
log.info(
|
log.info(
|
||||||
@@ -120,12 +91,11 @@ export async function initializeProjectDirect(args, log, context = {}) {
|
|||||||
};
|
};
|
||||||
success = false;
|
success = false;
|
||||||
} finally {
|
} finally {
|
||||||
disableSilentMode(); // ALWAYS disable silent mode in finally
|
disableSilentMode();
|
||||||
log.info(`Restoring original CWD: ${originalCwd}`);
|
log.info(`Restoring original CWD: ${originalCwd}`);
|
||||||
process.chdir(originalCwd); // Change back to original CWD
|
process.chdir(originalCwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return in format expected by handleApiResult
|
|
||||||
if (success) {
|
if (success) {
|
||||||
return { success: true, data: resultData, fromCache: false };
|
return { success: true, data: resultData, fromCache: false };
|
||||||
} else {
|
} else {
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { listTasks } from '../../../../scripts/modules/task-manager.js';
|
import { listTasks } from '../../../../scripts/modules/task-manager.js';
|
||||||
import { getCachedOrExecute } from '../../tools/utils.js';
|
|
||||||
import {
|
import {
|
||||||
enableSilentMode,
|
enableSilentMode,
|
||||||
disableSilentMode
|
disableSilentMode
|
||||||
@@ -36,7 +35,6 @@ export async function listTasksDirect(args, log) {
|
|||||||
// Use the explicit tasksJsonPath for cache key
|
// Use the explicit tasksJsonPath for cache key
|
||||||
const statusFilter = status || 'all';
|
const statusFilter = status || 'all';
|
||||||
const withSubtasksFilter = withSubtasks || false;
|
const withSubtasksFilter = withSubtasks || false;
|
||||||
const cacheKey = `listTasks:${tasksJsonPath}:${statusFilter}:${withSubtasksFilter}`;
|
|
||||||
|
|
||||||
// Define the action function to be executed on cache miss
|
// Define the action function to be executed on cache miss
|
||||||
const coreListTasksAction = async () => {
|
const coreListTasksAction = async () => {
|
||||||
@@ -88,25 +86,19 @@ export async function listTasksDirect(args, log) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Use the caching utility
|
|
||||||
try {
|
try {
|
||||||
const result = await getCachedOrExecute({
|
const result = await coreListTasksAction();
|
||||||
cacheKey,
|
log.info('listTasksDirect completed');
|
||||||
actionFn: coreListTasksAction,
|
return result;
|
||||||
log
|
|
||||||
});
|
|
||||||
log.info(`listTasksDirect completed. From cache: ${result.fromCache}`);
|
|
||||||
return result; // Returns { success, data/error, fromCache }
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Catch unexpected errors from getCachedOrExecute itself (though unlikely)
|
log.error(`Unexpected error during listTasks: ${error.message}`);
|
||||||
log.error(
|
|
||||||
`Unexpected error during getCachedOrExecute for listTasks: ${error.message}`
|
|
||||||
);
|
|
||||||
console.error(error.stack);
|
console.error(error.stack);
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: { code: 'CACHE_UTIL_ERROR', message: error.message },
|
error: {
|
||||||
fromCache: false
|
code: 'UNEXPECTED_ERROR',
|
||||||
|
message: error.message
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
import { findNextTask } from '../../../../scripts/modules/task-manager.js';
|
import { findNextTask } from '../../../../scripts/modules/task-manager.js';
|
||||||
import { readJSON } from '../../../../scripts/modules/utils.js';
|
import { readJSON } from '../../../../scripts/modules/utils.js';
|
||||||
import { getCachedOrExecute } from '../../tools/utils.js';
|
|
||||||
import {
|
import {
|
||||||
enableSilentMode,
|
enableSilentMode,
|
||||||
disableSilentMode
|
disableSilentMode
|
||||||
@@ -35,9 +34,6 @@ export async function nextTaskDirect(args, log) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate cache key using the provided task path
|
|
||||||
const cacheKey = `nextTask:${tasksJsonPath}`;
|
|
||||||
|
|
||||||
// Define the action function to be executed on cache miss
|
// Define the action function to be executed on cache miss
|
||||||
const coreNextTaskAction = async () => {
|
const coreNextTaskAction = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -71,24 +67,34 @@ export async function nextTaskDirect(args, log) {
|
|||||||
data: {
|
data: {
|
||||||
message:
|
message:
|
||||||
'No eligible next task found. All tasks are either completed or have unsatisfied dependencies',
|
'No eligible next task found. All tasks are either completed or have unsatisfied dependencies',
|
||||||
nextTask: null,
|
nextTask: null
|
||||||
allTasks: data.tasks
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if it's a subtask
|
||||||
|
const isSubtask =
|
||||||
|
typeof nextTask.id === 'string' && nextTask.id.includes('.');
|
||||||
|
|
||||||
|
const taskOrSubtask = isSubtask ? 'subtask' : 'task';
|
||||||
|
|
||||||
|
const additionalAdvice = isSubtask
|
||||||
|
? 'Subtasks can be updated with timestamped details as you implement them. This is useful for tracking progress, marking milestones and insights (of successful or successive falures in attempting to implement the subtask). Research can be used when updating the subtask to collect up-to-date information, and can be helpful to solve a repeating problem the agent is unable to solve. It is a good idea to get-task the parent task to collect the overall context of the task, and to get-task the subtask to collect the specific details of the subtask.'
|
||||||
|
: 'Tasks can be updated to reflect a change in the direction of the task, or to reformulate the task per your prompt. Research can be used when updating the task to collect up-to-date information. It is best to update subtasks as you work on them, and to update the task for more high-level changes that may affect pending subtasks or the general direction of the task.';
|
||||||
|
|
||||||
// Restore normal logging
|
// Restore normal logging
|
||||||
disableSilentMode();
|
disableSilentMode();
|
||||||
|
|
||||||
// Return the next task data with the full tasks array for reference
|
// Return the next task data with the full tasks array for reference
|
||||||
log.info(
|
log.info(
|
||||||
`Successfully found next task ${nextTask.id}: ${nextTask.title}`
|
`Successfully found next task ${nextTask.id}: ${nextTask.title}. Is subtask: ${isSubtask}`
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
nextTask,
|
nextTask,
|
||||||
allTasks: data.tasks
|
isSubtask,
|
||||||
|
nextSteps: `When ready to work on the ${taskOrSubtask}, use set-status to set the status to "in progress" ${additionalAdvice}`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -108,18 +114,11 @@ export async function nextTaskDirect(args, log) {
|
|||||||
|
|
||||||
// Use the caching utility
|
// Use the caching utility
|
||||||
try {
|
try {
|
||||||
const result = await getCachedOrExecute({
|
const result = await coreNextTaskAction();
|
||||||
cacheKey,
|
log.info(`nextTaskDirect completed.`);
|
||||||
actionFn: coreNextTaskAction,
|
return result;
|
||||||
log
|
|
||||||
});
|
|
||||||
log.info(`nextTaskDirect completed. From cache: ${result.fromCache}`);
|
|
||||||
return result; // Returns { success, data/error, fromCache }
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Catch unexpected errors from getCachedOrExecute itself
|
log.error(`Unexpected error during nextTask: ${error.message}`);
|
||||||
log.error(
|
|
||||||
`Unexpected error during getCachedOrExecute for nextTask: ${error.message}`
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: {
|
error: {
|
||||||
|
|||||||
@@ -34,18 +34,17 @@ export async function parsePRDDirect(args, log, context = {}) {
|
|||||||
projectRoot
|
projectRoot
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
|
// Create the standard logger wrapper
|
||||||
const logWrapper = createLogWrapper(log);
|
const logWrapper = createLogWrapper(log);
|
||||||
|
|
||||||
// --- Input Validation and Path Resolution ---
|
// --- Input Validation and Path Resolution ---
|
||||||
if (!projectRoot || !path.isAbsolute(projectRoot)) {
|
if (!projectRoot) {
|
||||||
logWrapper.error(
|
logWrapper.error('parsePRDDirect requires a projectRoot argument.');
|
||||||
'parsePRDDirect requires an absolute projectRoot argument.'
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: {
|
error: {
|
||||||
code: 'MISSING_ARGUMENT',
|
code: 'MISSING_ARGUMENT',
|
||||||
message: 'projectRoot is required and must be absolute.'
|
message: 'projectRoot is required.'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -57,7 +56,7 @@ export async function parsePRDDirect(args, log, context = {}) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve input and output paths relative to projectRoot if they aren't absolute
|
// Resolve input and output paths relative to projectRoot
|
||||||
const inputPath = path.resolve(projectRoot, inputArg);
|
const inputPath = path.resolve(projectRoot, inputArg);
|
||||||
const outputPath = outputArg
|
const outputPath = outputArg
|
||||||
? path.resolve(projectRoot, outputArg)
|
? path.resolve(projectRoot, outputArg)
|
||||||
@@ -101,7 +100,7 @@ export async function parsePRDDirect(args, log, context = {}) {
|
|||||||
// Ensure positive number
|
// Ensure positive number
|
||||||
numTasks = getDefaultNumTasks(projectRoot); // Fallback to default if parsing fails or invalid
|
numTasks = getDefaultNumTasks(projectRoot); // Fallback to default if parsing fails or invalid
|
||||||
logWrapper.warn(
|
logWrapper.warn(
|
||||||
`Invalid numTasks value: ${numTasksArg}. Using default: 10`
|
`Invalid numTasks value: ${numTasksArg}. Using default: ${numTasks}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,7 +146,6 @@ export async function parsePRDDirect(args, log, context = {}) {
|
|||||||
message: `Successfully parsed PRD and generated ${result.tasks.length} tasks.`,
|
message: `Successfully parsed PRD and generated ${result.tasks.length} tasks.`,
|
||||||
outputPath: outputPath,
|
outputPath: outputPath,
|
||||||
taskCount: result.tasks.length
|
taskCount: result.tasks.length
|
||||||
// Optionally include tasks if needed by client: tasks: result.tasks
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,151 +3,95 @@
|
|||||||
* Direct function implementation for showing task details
|
* Direct function implementation for showing task details
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { findTaskById } from '../../../../scripts/modules/utils.js';
|
import { findTaskById, readJSON } from '../../../../scripts/modules/utils.js';
|
||||||
import { readJSON } from '../../../../scripts/modules/utils.js';
|
import { findTasksJsonPath } from '../utils/path-utils.js';
|
||||||
import { getCachedOrExecute } from '../../tools/utils.js';
|
|
||||||
import {
|
|
||||||
enableSilentMode,
|
|
||||||
disableSilentMode
|
|
||||||
} from '../../../../scripts/modules/utils.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Direct function wrapper for showing task details with error handling and caching.
|
* Direct function wrapper for getting task details.
|
||||||
*
|
*
|
||||||
* @param {Object} args - Command arguments
|
* @param {Object} args - Command arguments.
|
||||||
* @param {string} args.tasksJsonPath - Explicit path to the tasks.json file.
|
* @param {string} args.id - Task ID to show.
|
||||||
* @param {string} args.id - The ID of the task or subtask to show.
|
* @param {string} [args.file] - Optional path to the tasks file (passed to findTasksJsonPath).
|
||||||
* @param {string} [args.status] - Optional status to filter subtasks by.
|
* @param {string} [args.status] - Optional status to filter subtasks by.
|
||||||
* @param {Object} log - Logger object
|
* @param {string} args.projectRoot - Absolute path to the project root directory (already normalized by tool).
|
||||||
* @returns {Promise<Object>} - Task details result { success: boolean, data?: any, error?: { code: string, message: string }, fromCache: boolean }
|
* @param {Object} log - Logger object.
|
||||||
|
* @param {Object} context - Context object containing session data.
|
||||||
|
* @returns {Promise<Object>} - Result object with success status and data/error information.
|
||||||
*/
|
*/
|
||||||
export async function showTaskDirect(args, log) {
|
export async function showTaskDirect(args, log) {
|
||||||
// Destructure expected args
|
// Destructure session from context if needed later, otherwise ignore
|
||||||
const { tasksJsonPath, id, status } = args;
|
// const { session } = context;
|
||||||
|
// Destructure projectRoot and other args. projectRoot is assumed normalized.
|
||||||
|
const { id, file, status, projectRoot } = args;
|
||||||
|
|
||||||
if (!tasksJsonPath) {
|
log.info(
|
||||||
log.error('showTaskDirect called without tasksJsonPath');
|
`Showing task direct function. ID: ${id}, File: ${file}, Status Filter: ${status}, ProjectRoot: ${projectRoot}`
|
||||||
|
);
|
||||||
|
|
||||||
|
// --- Path Resolution using the passed (already normalized) projectRoot ---
|
||||||
|
let tasksJsonPath;
|
||||||
|
try {
|
||||||
|
// Use the projectRoot passed directly from args
|
||||||
|
tasksJsonPath = findTasksJsonPath(
|
||||||
|
{ projectRoot: projectRoot, file: file },
|
||||||
|
log
|
||||||
|
);
|
||||||
|
log.info(`Resolved tasks path: ${tasksJsonPath}`);
|
||||||
|
} catch (error) {
|
||||||
|
log.error(`Error finding tasks.json: ${error.message}`);
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: {
|
error: {
|
||||||
code: 'MISSING_ARGUMENT',
|
code: 'TASKS_FILE_NOT_FOUND',
|
||||||
message: 'tasksJsonPath is required'
|
message: `Failed to find tasks.json: ${error.message}`
|
||||||
},
|
}
|
||||||
fromCache: false
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// --- End Path Resolution ---
|
||||||
|
|
||||||
// Validate task ID
|
// --- Rest of the function remains the same, using tasksJsonPath ---
|
||||||
const taskId = id;
|
try {
|
||||||
if (!taskId) {
|
const tasksData = readJSON(tasksJsonPath);
|
||||||
log.error('Task ID is required');
|
if (!tasksData || !tasksData.tasks) {
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
error: {
|
|
||||||
code: 'INPUT_VALIDATION_ERROR',
|
|
||||||
message: 'Task ID is required'
|
|
||||||
},
|
|
||||||
fromCache: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate cache key using the provided task path, ID, and status filter
|
|
||||||
const cacheKey = `showTask:${tasksJsonPath}:${taskId}:${status || 'all'}`;
|
|
||||||
|
|
||||||
// Define the action function to be executed on cache miss
|
|
||||||
const coreShowTaskAction = async () => {
|
|
||||||
try {
|
|
||||||
// Enable silent mode to prevent console logs from interfering with JSON response
|
|
||||||
enableSilentMode();
|
|
||||||
|
|
||||||
log.info(
|
|
||||||
`Retrieving task details for ID: ${taskId} from ${tasksJsonPath}${status ? ` (filtering by status: ${status})` : ''}`
|
|
||||||
);
|
|
||||||
|
|
||||||
// Read tasks data using the provided path
|
|
||||||
const data = readJSON(tasksJsonPath);
|
|
||||||
if (!data || !data.tasks) {
|
|
||||||
disableSilentMode(); // Disable before returning
|
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
error: {
|
|
||||||
code: 'INVALID_TASKS_FILE',
|
|
||||||
message: `No valid tasks found in ${tasksJsonPath}`
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the specific task, passing the status filter
|
|
||||||
const { task, originalSubtaskCount } = findTaskById(
|
|
||||||
data.tasks,
|
|
||||||
taskId,
|
|
||||||
status
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!task) {
|
|
||||||
disableSilentMode(); // Disable before returning
|
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
error: {
|
|
||||||
code: 'TASK_NOT_FOUND',
|
|
||||||
message: `Task with ID ${taskId} not found${status ? ` or no subtasks match status '${status}'` : ''}`
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore normal logging
|
|
||||||
disableSilentMode();
|
|
||||||
|
|
||||||
// Return the task data, the original subtask count (if applicable),
|
|
||||||
// and the full tasks array for reference (needed for formatDependenciesWithStatus function in UI)
|
|
||||||
log.info(
|
|
||||||
`Successfully found task ${taskId}${status ? ` (with status filter: ${status})` : ''}`
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: false,
|
||||||
data: {
|
error: { code: 'INVALID_TASKS_DATA', message: 'Invalid tasks data' }
|
||||||
task,
|
|
||||||
originalSubtaskCount,
|
|
||||||
allTasks: data.tasks
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
} catch (error) {
|
}
|
||||||
// Make sure to restore normal logging even if there's an error
|
|
||||||
disableSilentMode();
|
|
||||||
|
|
||||||
log.error(`Error showing task: ${error.message}`);
|
const { task, originalSubtaskCount } = findTaskById(
|
||||||
|
tasksData.tasks,
|
||||||
|
id,
|
||||||
|
status
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!task) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: {
|
error: {
|
||||||
code: 'CORE_FUNCTION_ERROR',
|
code: 'TASK_NOT_FOUND',
|
||||||
message: error.message || 'Failed to show task details'
|
message: `Task or subtask with ID ${id} not found`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// Use the caching utility
|
log.info(`Successfully retrieved task ${id}.`);
|
||||||
try {
|
|
||||||
const result = await getCachedOrExecute({
|
const returnData = { ...task };
|
||||||
cacheKey,
|
if (originalSubtaskCount !== null) {
|
||||||
actionFn: coreShowTaskAction,
|
returnData._originalSubtaskCount = originalSubtaskCount;
|
||||||
log
|
returnData._subtaskFilter = status;
|
||||||
});
|
}
|
||||||
log.info(`showTaskDirect completed. From cache: ${result.fromCache}`);
|
|
||||||
return result; // Returns { success, data/error, fromCache }
|
return { success: true, data: returnData };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Catch unexpected errors from getCachedOrExecute itself
|
log.error(`Error showing task ${id}: ${error.message}`);
|
||||||
disableSilentMode();
|
|
||||||
log.error(
|
|
||||||
`Unexpected error during getCachedOrExecute for showTask: ${error.message}`
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: {
|
error: {
|
||||||
code: 'UNEXPECTED_ERROR',
|
code: 'TASK_OPERATION_ERROR',
|
||||||
message: error.message
|
message: error.message
|
||||||
},
|
}
|
||||||
fromCache: false
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,130 +1,126 @@
|
|||||||
/**
|
/**
|
||||||
* update-tasks.js
|
* update-tasks.js
|
||||||
* Direct function implementation for updating tasks based on new context/prompt
|
* Direct function implementation for updating tasks based on new context
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
import { updateTasks } from '../../../../scripts/modules/task-manager.js';
|
import { updateTasks } from '../../../../scripts/modules/task-manager.js';
|
||||||
|
import { createLogWrapper } from '../../tools/utils.js';
|
||||||
import {
|
import {
|
||||||
enableSilentMode,
|
enableSilentMode,
|
||||||
disableSilentMode
|
disableSilentMode
|
||||||
} from '../../../../scripts/modules/utils.js';
|
} from '../../../../scripts/modules/utils.js';
|
||||||
import { createLogWrapper } from '../../tools/utils.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Direct function wrapper for updating tasks based on new context/prompt.
|
* Direct function wrapper for updating tasks based on new context.
|
||||||
*
|
*
|
||||||
* @param {Object} args - Command arguments containing from, prompt, research and tasksJsonPath.
|
* @param {Object} args - Command arguments containing projectRoot, from, prompt, research options.
|
||||||
* @param {Object} log - Logger object.
|
* @param {Object} log - Logger object.
|
||||||
* @param {Object} context - Context object containing session data.
|
* @param {Object} context - Context object containing session data.
|
||||||
* @returns {Promise<Object>} - Result object with success status and data/error information.
|
* @returns {Promise<Object>} - Result object with success status and data/error information.
|
||||||
*/
|
*/
|
||||||
export async function updateTasksDirect(args, log, context = {}) {
|
export async function updateTasksDirect(args, log, context = {}) {
|
||||||
const { session } = context; // Extract session
|
const { session } = context;
|
||||||
const { tasksJsonPath, from, prompt, research, projectRoot } = args;
|
const { from, prompt, research, file: fileArg, projectRoot } = args;
|
||||||
|
|
||||||
// Create the standard logger wrapper
|
// Create the standard logger wrapper
|
||||||
const logWrapper = {
|
const logWrapper = createLogWrapper(log);
|
||||||
info: (message, ...args) => log.info(message, ...args),
|
|
||||||
warn: (message, ...args) => log.warn(message, ...args),
|
|
||||||
error: (message, ...args) => log.error(message, ...args),
|
|
||||||
debug: (message, ...args) => log.debug && log.debug(message, ...args),
|
|
||||||
success: (message, ...args) => log.info(message, ...args)
|
|
||||||
};
|
|
||||||
|
|
||||||
// --- Input Validation (Keep existing checks) ---
|
// --- Input Validation ---
|
||||||
if (!tasksJsonPath) {
|
if (!projectRoot) {
|
||||||
log.error('updateTasksDirect called without tasksJsonPath');
|
logWrapper.error('updateTasksDirect requires a projectRoot argument.');
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
error: { code: 'MISSING_ARGUMENT', message: 'tasksJsonPath is required' },
|
|
||||||
fromCache: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (args.id !== undefined && from === undefined) {
|
|
||||||
// Keep 'from' vs 'id' check
|
|
||||||
const errorMessage =
|
|
||||||
"Use 'from' parameter, not 'id', or use 'update_task' tool.";
|
|
||||||
log.error(errorMessage);
|
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
error: { code: 'PARAMETER_MISMATCH', message: errorMessage },
|
|
||||||
fromCache: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (!from) {
|
|
||||||
log.error('Missing from ID.');
|
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
error: { code: 'MISSING_FROM_ID', message: 'No from ID specified.' },
|
|
||||||
fromCache: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (!prompt) {
|
|
||||||
log.error('Missing prompt.');
|
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
error: { code: 'MISSING_PROMPT', message: 'No prompt specified.' },
|
|
||||||
fromCache: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
let fromId;
|
|
||||||
try {
|
|
||||||
fromId = parseInt(from, 10);
|
|
||||||
if (isNaN(fromId) || fromId <= 0) throw new Error();
|
|
||||||
} catch {
|
|
||||||
log.error(`Invalid from ID: ${from}`);
|
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: {
|
error: {
|
||||||
code: 'INVALID_FROM_ID',
|
code: 'MISSING_ARGUMENT',
|
||||||
message: `Invalid from ID: ${from}. Must be a positive integer.`
|
message: 'projectRoot is required.'
|
||||||
},
|
}
|
||||||
fromCache: false
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const useResearch = research === true;
|
|
||||||
// --- End Input Validation ---
|
|
||||||
|
|
||||||
log.info(
|
if (!from) {
|
||||||
`Updating tasks from ID ${fromId}. Research: ${useResearch}. Project Root: ${projectRoot}`
|
logWrapper.error('updateTasksDirect called without from ID');
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: {
|
||||||
|
code: 'MISSING_ARGUMENT',
|
||||||
|
message: 'Starting task ID (from) is required'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prompt) {
|
||||||
|
logWrapper.error('updateTasksDirect called without prompt');
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: {
|
||||||
|
code: 'MISSING_ARGUMENT',
|
||||||
|
message: 'Update prompt is required'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resolve tasks file path
|
||||||
|
const tasksFile = fileArg
|
||||||
|
? path.resolve(projectRoot, fileArg)
|
||||||
|
: path.resolve(projectRoot, 'tasks', 'tasks.json');
|
||||||
|
|
||||||
|
logWrapper.info(
|
||||||
|
`Updating tasks via direct function. From: ${from}, Research: ${research}, File: ${tasksFile}, ProjectRoot: ${projectRoot}`
|
||||||
);
|
);
|
||||||
|
|
||||||
enableSilentMode(); // Enable silent mode
|
enableSilentMode(); // Enable silent mode
|
||||||
try {
|
try {
|
||||||
// Create logger wrapper using the utility
|
// Call the core updateTasks function
|
||||||
const mcpLog = createLogWrapper(log);
|
const result = await updateTasks(
|
||||||
|
tasksFile,
|
||||||
// Execute core updateTasks function, passing session context AND projectRoot
|
from,
|
||||||
await updateTasks(
|
|
||||||
tasksJsonPath,
|
|
||||||
fromId,
|
|
||||||
prompt,
|
prompt,
|
||||||
useResearch,
|
research,
|
||||||
// Pass context with logger wrapper, session, AND projectRoot
|
{
|
||||||
{ mcpLog, session, projectRoot },
|
session,
|
||||||
'json' // Explicitly request JSON format for MCP
|
mcpLog: logWrapper,
|
||||||
|
projectRoot
|
||||||
|
},
|
||||||
|
'json'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Since updateTasks modifies file and doesn't return data, create success message
|
// updateTasks returns { success: true, updatedTasks: [...] } on success
|
||||||
return {
|
if (result && result.success && Array.isArray(result.updatedTasks)) {
|
||||||
success: true,
|
logWrapper.success(
|
||||||
data: {
|
`Successfully updated ${result.updatedTasks.length} tasks.`
|
||||||
message: `Successfully initiated update for tasks from ID ${fromId} based on the prompt.`,
|
);
|
||||||
fromId,
|
return {
|
||||||
tasksPath: tasksJsonPath,
|
success: true,
|
||||||
useResearch
|
data: {
|
||||||
},
|
message: `Successfully updated ${result.updatedTasks.length} tasks.`,
|
||||||
fromCache: false // Modifies state
|
tasksFile,
|
||||||
};
|
updatedCount: result.updatedTasks.length
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Handle case where core function didn't return expected success structure
|
||||||
|
logWrapper.error(
|
||||||
|
'Core updateTasks function did not return a successful structure.'
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
error: {
|
||||||
|
code: 'CORE_FUNCTION_ERROR',
|
||||||
|
message:
|
||||||
|
result?.message ||
|
||||||
|
'Core function failed to update tasks or returned unexpected result.'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`Error executing core updateTasks: ${error.message}`);
|
logWrapper.error(`Error executing core updateTasks: ${error.message}`);
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: {
|
error: {
|
||||||
code: 'UPDATE_TASKS_CORE_ERROR',
|
code: 'UPDATE_TASKS_CORE_ERROR',
|
||||||
message: error.message || 'Unknown error updating tasks'
|
message: error.message || 'Unknown error updating tasks'
|
||||||
},
|
}
|
||||||
fromCache: false
|
|
||||||
};
|
};
|
||||||
} finally {
|
} finally {
|
||||||
disableSilentMode(); // Ensure silent mode is disabled
|
disableSilentMode(); // Ensure silent mode is disabled
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import { fixDependenciesDirect } from './direct-functions/fix-dependencies.js';
|
|||||||
import { complexityReportDirect } from './direct-functions/complexity-report.js';
|
import { complexityReportDirect } from './direct-functions/complexity-report.js';
|
||||||
import { addDependencyDirect } from './direct-functions/add-dependency.js';
|
import { addDependencyDirect } from './direct-functions/add-dependency.js';
|
||||||
import { removeTaskDirect } from './direct-functions/remove-task.js';
|
import { removeTaskDirect } from './direct-functions/remove-task.js';
|
||||||
import { initializeProjectDirect } from './direct-functions/initialize-project-direct.js';
|
import { initializeProjectDirect } from './direct-functions/initialize-project.js';
|
||||||
import { modelsDirect } from './direct-functions/models.js';
|
import { modelsDirect } from './direct-functions/models.js';
|
||||||
|
|
||||||
// Re-export utility functions
|
// Re-export utility functions
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
getProjectRootFromSession,
|
||||||
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { addDependencyDirect } from '../core/task-master-core.js';
|
import { addDependencyDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -35,28 +36,16 @@ export function registerAddDependencyTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(
|
log.info(
|
||||||
`Adding dependency for task ${args.id} to depend on ${args.dependsOn}`
|
`Adding dependency for task ${args.id} to depend on ${args.dependsOn}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get project root from args or session
|
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -92,6 +81,6 @@ export function registerAddDependencyTool(server) {
|
|||||||
log.error(`Error in addDependency tool: ${error.message}`);
|
log.error(`Error in addDependency tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { addSubtaskDirect } from '../core/task-master-core.js';
|
import { addSubtaskDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -60,24 +60,15 @@ export function registerAddSubtaskTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Adding subtask with args: ${JSON.stringify(args)}`);
|
log.info(`Adding subtask with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -113,6 +104,6 @@ export function registerAddSubtaskTool(server) {
|
|||||||
log.error(`Error in addSubtask tool: ${error.message}`);
|
log.error(`Error in addSubtask tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import {
|
import {
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession,
|
handleApiResult,
|
||||||
handleApiResult
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { addTaskDirect } from '../core/task-master-core.js';
|
import { addTaskDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -63,26 +63,15 @@ export function registerAddTaskTool(server) {
|
|||||||
.optional()
|
.optional()
|
||||||
.describe('Whether to use research capabilities for task creation')
|
.describe('Whether to use research capabilities for task creation')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Starting add-task with args: ${JSON.stringify(args)}`);
|
log.info(`Starting add-task with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -92,12 +81,10 @@ export function registerAddTaskTool(server) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the direct function
|
// Call the direct functionP
|
||||||
const result = await addTaskDirect(
|
const result = await addTaskDirect(
|
||||||
{
|
{
|
||||||
// Pass the explicitly resolved path
|
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
// Pass other relevant args
|
|
||||||
prompt: args.prompt,
|
prompt: args.prompt,
|
||||||
title: args.title,
|
title: args.title,
|
||||||
description: args.description,
|
description: args.description,
|
||||||
@@ -106,18 +93,17 @@ export function registerAddTaskTool(server) {
|
|||||||
dependencies: args.dependencies,
|
dependencies: args.dependencies,
|
||||||
priority: args.priority,
|
priority: args.priority,
|
||||||
research: args.research,
|
research: args.research,
|
||||||
projectRoot: rootFolder
|
projectRoot: args.projectRoot
|
||||||
},
|
},
|
||||||
log,
|
log,
|
||||||
{ session }
|
{ session }
|
||||||
);
|
);
|
||||||
|
|
||||||
// Return the result
|
|
||||||
return handleApiResult(result, log);
|
return handleApiResult(result, log);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`Error in add-task tool: ${error.message}`);
|
log.error(`Error in add-task tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import fs from 'fs'; // Import fs for directory check/creation
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession // Assuming this is in './utils.js' relative to this file
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { analyzeTaskComplexityDirect } from '../core/task-master-core.js'; // Assuming core functions are exported via task-master-core.js
|
import { analyzeTaskComplexityDirect } from '../core/task-master-core.js'; // Assuming core functions are exported via task-master-core.js
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -53,44 +53,34 @@ export function registerAnalyzeProjectComplexityTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
const toolName = 'analyze_project_complexity'; // Define tool name for logging
|
const toolName = 'analyze_project_complexity'; // Define tool name for logging
|
||||||
try {
|
try {
|
||||||
log.info(
|
log.info(
|
||||||
`Executing ${toolName} tool with args: ${JSON.stringify(args)}`
|
`Executing ${toolName} tool with args: ${JSON.stringify(args)}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// 1. Get Project Root (Mandatory for this tool)
|
|
||||||
const rootFolder = args.projectRoot;
|
|
||||||
if (!rootFolder || !path.isAbsolute(rootFolder)) {
|
|
||||||
log.error(
|
|
||||||
`${toolName}: projectRoot is required and must be absolute.`
|
|
||||||
);
|
|
||||||
return createErrorResponse(
|
|
||||||
'projectRoot is required and must be absolute.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
log.info(`${toolName}: Project root: ${rootFolder}`);
|
|
||||||
|
|
||||||
// 2. Resolve Paths relative to projectRoot
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
// Note: findTasksJsonPath expects 'file' relative to root, or absolute
|
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file }, // Pass root and optional relative file path
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
log.info(`${toolName}: Resolved tasks path: ${tasksJsonPath}`);
|
log.info(`${toolName}: Resolved tasks path: ${tasksJsonPath}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`${toolName}: Error finding tasks.json: ${error.message}`);
|
log.error(`${toolName}: Error finding tasks.json: ${error.message}`);
|
||||||
return createErrorResponse(
|
return createErrorResponse(
|
||||||
`Failed to find tasks.json within project root '${rootFolder}': ${error.message}`
|
`Failed to find tasks.json within project root '${args.projectRoot}': ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const outputPath = args.output
|
const outputPath = args.output
|
||||||
? path.resolve(rootFolder, args.output) // Resolve relative output path
|
? path.resolve(args.projectRoot, args.output)
|
||||||
: path.resolve(rootFolder, 'scripts', 'task-complexity-report.json'); // Default location resolved relative to root
|
: path.resolve(
|
||||||
|
args.projectRoot,
|
||||||
|
'scripts',
|
||||||
|
'task-complexity-report.json'
|
||||||
|
);
|
||||||
|
|
||||||
log.info(`${toolName}: Report output path: ${outputPath}`);
|
log.info(`${toolName}: Report output path: ${outputPath}`);
|
||||||
|
|
||||||
@@ -113,26 +103,21 @@ export function registerAnalyzeProjectComplexityTool(server) {
|
|||||||
// 3. Call Direct Function - Pass projectRoot in first arg object
|
// 3. Call Direct Function - Pass projectRoot in first arg object
|
||||||
const result = await analyzeTaskComplexityDirect(
|
const result = await analyzeTaskComplexityDirect(
|
||||||
{
|
{
|
||||||
// Pass resolved absolute paths and other args
|
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
outputPath: outputPath, // Pass resolved absolute path
|
outputPath: outputPath,
|
||||||
threshold: args.threshold,
|
threshold: args.threshold,
|
||||||
research: args.research,
|
research: args.research,
|
||||||
projectRoot: rootFolder // <<< Pass projectRoot HERE
|
projectRoot: args.projectRoot
|
||||||
},
|
},
|
||||||
log,
|
log,
|
||||||
{ session } // Pass context object with session
|
{ session }
|
||||||
);
|
);
|
||||||
|
|
||||||
// 4. Handle Result
|
// 4. Handle Result
|
||||||
log.info(
|
log.info(
|
||||||
`${toolName}: Direct function result: success=${result.success}`
|
`${toolName}: Direct function result: success=${result.success}`
|
||||||
);
|
);
|
||||||
return handleApiResult(
|
return handleApiResult(result, log, 'Error analyzing task complexity');
|
||||||
result,
|
|
||||||
log,
|
|
||||||
'Error analyzing task complexity' // Consistent error prefix
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(
|
log.error(
|
||||||
`Critical error in ${toolName} tool execute: ${error.message}`
|
`Critical error in ${toolName} tool execute: ${error.message}`
|
||||||
@@ -141,6 +126,6 @@ export function registerAnalyzeProjectComplexityTool(server) {
|
|||||||
`Internal tool error (${toolName}): ${error.message}`
|
`Internal tool error (${toolName}): ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { clearSubtasksDirect } from '../core/task-master-core.js';
|
import { clearSubtasksDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -41,26 +41,15 @@ export function registerClearSubtasksTool(server) {
|
|||||||
message: "Either 'id' or 'all' parameter must be provided",
|
message: "Either 'id' or 'all' parameter must be provided",
|
||||||
path: ['id', 'all']
|
path: ['id', 'all']
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Clearing subtasks with args: ${JSON.stringify(args)}`);
|
log.info(`Clearing subtasks with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -72,14 +61,11 @@ export function registerClearSubtasksTool(server) {
|
|||||||
|
|
||||||
const result = await clearSubtasksDirect(
|
const result = await clearSubtasksDirect(
|
||||||
{
|
{
|
||||||
// Pass the explicitly resolved path
|
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
// Pass other relevant args
|
|
||||||
id: args.id,
|
id: args.id,
|
||||||
all: args.all
|
all: args.all
|
||||||
},
|
},
|
||||||
log
|
log
|
||||||
// Remove context object as clearSubtasksDirect likely doesn't need session/reportProgress
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
@@ -93,6 +79,6 @@ export function registerClearSubtasksTool(server) {
|
|||||||
log.error(`Error in clearSubtasks tool: ${error.message}`);
|
log.error(`Error in clearSubtasks tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { complexityReportDirect } from '../core/task-master-core.js';
|
import { complexityReportDirect } from '../core/task-master-core.js';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
@@ -31,34 +31,24 @@ export function registerComplexityReportTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(
|
log.info(
|
||||||
`Getting complexity report with args: ${JSON.stringify(args)}`
|
`Getting complexity report with args: ${JSON.stringify(args)}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to the complexity report file
|
|
||||||
// Default to scripts/task-complexity-report.json relative to root
|
|
||||||
const reportPath = args.file
|
const reportPath = args.file
|
||||||
? path.resolve(rootFolder, args.file)
|
? path.resolve(args.projectRoot, args.file)
|
||||||
: path.resolve(rootFolder, 'scripts', 'task-complexity-report.json');
|
: path.resolve(
|
||||||
|
args.projectRoot,
|
||||||
|
'scripts',
|
||||||
|
'task-complexity-report.json'
|
||||||
|
);
|
||||||
|
|
||||||
const result = await complexityReportDirect(
|
const result = await complexityReportDirect(
|
||||||
{
|
{
|
||||||
// Pass the explicitly resolved path
|
|
||||||
reportPath: reportPath
|
reportPath: reportPath
|
||||||
// No other args specific to this tool
|
|
||||||
},
|
},
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
@@ -84,6 +74,6 @@ export function registerComplexityReportTool(server) {
|
|||||||
`Failed to retrieve complexity report: ${error.message}`
|
`Failed to retrieve complexity report: ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { expandAllTasksDirect } from '../core/task-master-core.js';
|
import { expandAllTasksDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -59,25 +59,16 @@ export function registerExpandAllTool(server) {
|
|||||||
'Absolute path to the project root directory (derived from session if possible)'
|
'Absolute path to the project root directory (derived from session if possible)'
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(
|
log.info(
|
||||||
`Tool expand_all execution started with args: ${JSON.stringify(args)}`
|
`Tool expand_all execution started with args: ${JSON.stringify(args)}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const rootFolder = getProjectRootFromSession(session, log);
|
|
||||||
if (!rootFolder) {
|
|
||||||
log.error('Could not determine project root from session.');
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root from session.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
log.info(`Project root determined: ${rootFolder}`);
|
|
||||||
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
log.info(`Resolved tasks.json path: ${tasksJsonPath}`);
|
log.info(`Resolved tasks.json path: ${tasksJsonPath}`);
|
||||||
@@ -95,7 +86,7 @@ export function registerExpandAllTool(server) {
|
|||||||
research: args.research,
|
research: args.research,
|
||||||
prompt: args.prompt,
|
prompt: args.prompt,
|
||||||
force: args.force,
|
force: args.force,
|
||||||
projectRoot: rootFolder
|
projectRoot: args.projectRoot
|
||||||
},
|
},
|
||||||
log,
|
log,
|
||||||
{ session }
|
{ session }
|
||||||
@@ -113,6 +104,6 @@ export function registerExpandAllTool(server) {
|
|||||||
`An unexpected error occurred: ${error.message}`
|
`An unexpected error occurred: ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { handleApiResult, createErrorResponse } from './utils.js';
|
import {
|
||||||
|
handleApiResult,
|
||||||
|
createErrorResponse,
|
||||||
|
withNormalizedProjectRoot
|
||||||
|
} from './utils.js';
|
||||||
import { expandTaskDirect } from '../core/task-master-core.js';
|
import { expandTaskDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the expand-task tool with the MCP server
|
* Register the expand-task tool with the MCP server
|
||||||
@@ -44,32 +47,21 @@ export function registerExpandTaskTool(server) {
|
|||||||
.default(false)
|
.default(false)
|
||||||
.describe('Force expansion even if subtasks exist')
|
.describe('Force expansion even if subtasks exist')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Starting expand-task with args: ${JSON.stringify(args)}`);
|
log.info(`Starting expand-task with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
const rootFolder = args.projectRoot;
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
if (!rootFolder || !path.isAbsolute(rootFolder)) {
|
|
||||||
log.error(
|
|
||||||
`expand-task: projectRoot is required and must be absolute.`
|
|
||||||
);
|
|
||||||
return createErrorResponse(
|
|
||||||
'projectRoot is required and must be absolute.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json using the utility
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
log.info(`expand-task: Resolved tasks path: ${tasksJsonPath}`);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`expand-task: Error finding tasks.json: ${error.message}`);
|
log.error(`Error finding tasks.json: ${error.message}`);
|
||||||
return createErrorResponse(
|
return createErrorResponse(
|
||||||
`Failed to find tasks.json within project root '${rootFolder}': ${error.message}`
|
`Failed to find tasks.json: ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,24 +73,17 @@ export function registerExpandTaskTool(server) {
|
|||||||
research: args.research,
|
research: args.research,
|
||||||
prompt: args.prompt,
|
prompt: args.prompt,
|
||||||
force: args.force,
|
force: args.force,
|
||||||
projectRoot: rootFolder
|
projectRoot: args.projectRoot
|
||||||
},
|
},
|
||||||
log,
|
log,
|
||||||
{ session }
|
{ session }
|
||||||
);
|
);
|
||||||
|
|
||||||
log.info(
|
|
||||||
`expand-task: Direct function result: success=${result.success}`
|
|
||||||
);
|
|
||||||
return handleApiResult(result, log, 'Error expanding task');
|
return handleApiResult(result, log, 'Error expanding task');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(
|
log.error(`Error in expand-task tool: ${error.message}`);
|
||||||
`Critical error in ${toolName} tool execute: ${error.message}`
|
return createErrorResponse(error.message);
|
||||||
);
|
|
||||||
return createErrorResponse(
|
|
||||||
`Internal tool error (${toolName}): ${error.message}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { fixDependenciesDirect } from '../core/task-master-core.js';
|
import { fixDependenciesDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -26,24 +26,15 @@ export function registerFixDependenciesTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Fixing dependencies with args: ${JSON.stringify(args)}`);
|
log.info(`Fixing dependencies with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -71,6 +62,6 @@ export function registerFixDependenciesTool(server) {
|
|||||||
log.error(`Error in fixDependencies tool: ${error.message}`);
|
log.error(`Error in fixDependencies tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { generateTaskFilesDirect } from '../core/task-master-core.js';
|
import { generateTaskFilesDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -32,26 +32,15 @@ export function registerGenerateTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Generating task files with args: ${JSON.stringify(args)}`);
|
log.info(`Generating task files with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -61,17 +50,14 @@ export function registerGenerateTool(server) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine output directory: use explicit arg or default to tasks.json directory
|
|
||||||
const outputDir = args.output
|
const outputDir = args.output
|
||||||
? path.resolve(rootFolder, args.output) // Resolve relative to root if needed
|
? path.resolve(args.projectRoot, args.output)
|
||||||
: path.dirname(tasksJsonPath);
|
: path.dirname(tasksJsonPath);
|
||||||
|
|
||||||
const result = await generateTaskFilesDirect(
|
const result = await generateTaskFilesDirect(
|
||||||
{
|
{
|
||||||
// Pass the explicitly resolved paths
|
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
outputDir: outputDir
|
outputDir: outputDir
|
||||||
// No other args specific to this tool
|
|
||||||
},
|
},
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
@@ -89,6 +75,6 @@ export function registerGenerateTool(server) {
|
|||||||
log.error(`Error in generate tool: ${error.message}`);
|
log.error(`Error in generate tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { showTaskDirect } from '../core/task-master-core.js';
|
import { showTaskDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -21,8 +21,10 @@ function processTaskResponse(data) {
|
|||||||
if (!data) return data;
|
if (!data) return data;
|
||||||
|
|
||||||
// If we have the expected structure with task and allTasks
|
// If we have the expected structure with task and allTasks
|
||||||
if (data.task) {
|
if (typeof data === 'object' && data !== null && data.id && data.title) {
|
||||||
// Return only the task object, removing the allTasks array
|
// If the data itself looks like the task object, return it
|
||||||
|
return data;
|
||||||
|
} else if (data.task) {
|
||||||
return data.task;
|
return data.task;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,44 +46,33 @@ export function registerShowTaskTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.optional()
|
.optional()
|
||||||
.describe("Filter subtasks by status (e.g., 'pending', 'done')"),
|
.describe("Filter subtasks by status (e.g., 'pending', 'done')"),
|
||||||
file: z.string().optional().describe('Absolute path to the tasks file'),
|
file: z
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.describe('Path to the tasks file relative to project root'),
|
||||||
projectRoot: z
|
projectRoot: z
|
||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.optional()
|
||||||
|
.describe(
|
||||||
|
'Absolute path to the project root directory (Optional, usually from session)'
|
||||||
|
)
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log }) => {
|
||||||
// Log the session right at the start of execute
|
const { id, file, status, projectRoot } = args;
|
||||||
log.info(
|
|
||||||
`Session object received in execute: ${JSON.stringify(session)}`
|
|
||||||
); // Use JSON.stringify for better visibility
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
log.info(
|
log.info(
|
||||||
`Getting task details for ID: ${args.id}${args.status ? ` (filtering subtasks by status: ${args.status})` : ''}`
|
`Getting task details for ID: ${id}${status ? ` (filtering subtasks by status: ${status})` : ''} in root: ${projectRoot}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Resolve the path to tasks.json using the NORMALIZED projectRoot from args
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info(`Attempting to use project root: ${rootFolder}`); // Log the final resolved root
|
|
||||||
|
|
||||||
log.info(`Root folder: ${rootFolder}`); // Log the final resolved root
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: projectRoot, file: file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
|
log.info(`Resolved tasks path: ${tasksJsonPath}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`Error finding tasks.json: ${error.message}`);
|
log.error(`Error finding tasks.json: ${error.message}`);
|
||||||
return createErrorResponse(
|
return createErrorResponse(
|
||||||
@@ -89,13 +80,13 @@ export function registerShowTaskTool(server) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info(`Attempting to use tasks file path: ${tasksJsonPath}`);
|
// Call the direct function, passing the normalized projectRoot
|
||||||
|
|
||||||
const result = await showTaskDirect(
|
const result = await showTaskDirect(
|
||||||
{
|
{
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
id: args.id,
|
id: id,
|
||||||
status: args.status
|
status: status,
|
||||||
|
projectRoot: projectRoot
|
||||||
},
|
},
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
@@ -108,7 +99,7 @@ export function registerShowTaskTool(server) {
|
|||||||
log.error(`Failed to get task: ${result.error.message}`);
|
log.error(`Failed to get task: ${result.error.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use our custom processor function to remove allTasks from the response
|
// Use our custom processor function
|
||||||
return handleApiResult(
|
return handleApiResult(
|
||||||
result,
|
result,
|
||||||
log,
|
log,
|
||||||
@@ -116,9 +107,9 @@ export function registerShowTaskTool(server) {
|
|||||||
processTaskResponse
|
processTaskResponse
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`Error in get-task tool: ${error.message}\n${error.stack}`); // Add stack trace
|
log.error(`Error in get-task tool: ${error.message}\n${error.stack}`);
|
||||||
return createErrorResponse(`Failed to get task: ${error.message}`);
|
return createErrorResponse(`Failed to get task: ${error.message}`);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { listTasksDirect } from '../core/task-master-core.js';
|
import { listTasksDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -42,31 +42,19 @@ export function registerListTasksTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Getting tasks with filters: ${JSON.stringify(args)}`);
|
log.info(`Getting tasks with filters: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`Error finding tasks.json: ${error.message}`);
|
log.error(`Error finding tasks.json: ${error.message}`);
|
||||||
// Use the error message from findTasksJsonPath for better context
|
|
||||||
return createErrorResponse(
|
return createErrorResponse(
|
||||||
`Failed to find tasks.json: ${error.message}`
|
`Failed to find tasks.json: ${error.message}`
|
||||||
);
|
);
|
||||||
@@ -89,7 +77,7 @@ export function registerListTasksTool(server) {
|
|||||||
log.error(`Error getting tasks: ${error.message}`);
|
log.error(`Error getting tasks: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { createErrorResponse, handleApiResult } from './utils.js';
|
import {
|
||||||
|
createErrorResponse,
|
||||||
|
handleApiResult,
|
||||||
|
withNormalizedProjectRoot
|
||||||
|
} from './utils.js';
|
||||||
import { initializeProjectDirect } from '../core/task-master-core.js';
|
import { initializeProjectDirect } from '../core/task-master-core.js';
|
||||||
|
|
||||||
export function registerInitializeProjectTool(server) {
|
export function registerInitializeProjectTool(server) {
|
||||||
@@ -33,19 +37,10 @@ export function registerInitializeProjectTool(server) {
|
|||||||
'The root directory for the project. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.'
|
'The root directory for the project. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.'
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
execute: async (args, context) => {
|
execute: withNormalizedProjectRoot(async (args, context) => {
|
||||||
const { log } = context;
|
const { log } = context;
|
||||||
const session = context.session;
|
const session = context.session;
|
||||||
|
|
||||||
log.info(
|
|
||||||
'>>> Full Context Received by Tool:',
|
|
||||||
JSON.stringify(context, null, 2)
|
|
||||||
);
|
|
||||||
log.info(`Context received in tool function: ${context}`);
|
|
||||||
log.info(
|
|
||||||
`Session received in tool function: ${session ? session : 'undefined'}`
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
log.info(
|
log.info(
|
||||||
`Executing initialize_project tool with args: ${JSON.stringify(args)}`
|
`Executing initialize_project tool with args: ${JSON.stringify(args)}`
|
||||||
@@ -59,6 +54,6 @@ export function registerInitializeProjectTool(server) {
|
|||||||
log.error(errorMessage, error);
|
log.error(errorMessage, error);
|
||||||
return createErrorResponse(errorMessage, { details: error.stack });
|
return createErrorResponse(errorMessage, { details: error.stack });
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import {
|
import {
|
||||||
getProjectRootFromSession,
|
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse
|
createErrorResponse,
|
||||||
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { modelsDirect } from '../core/task-master-core.js';
|
import { modelsDirect } from '../core/task-master-core.js';
|
||||||
|
|
||||||
@@ -42,7 +42,9 @@ export function registerModelsTool(server) {
|
|||||||
listAvailableModels: z
|
listAvailableModels: z
|
||||||
.boolean()
|
.boolean()
|
||||||
.optional()
|
.optional()
|
||||||
.describe('List all available models not currently in use.'),
|
.describe(
|
||||||
|
'List all available models not currently in use. Input/output costs values are in dollars (3 is $3.00).'
|
||||||
|
),
|
||||||
projectRoot: z
|
projectRoot: z
|
||||||
.string()
|
.string()
|
||||||
.optional()
|
.optional()
|
||||||
@@ -56,34 +58,22 @@ export function registerModelsTool(server) {
|
|||||||
.optional()
|
.optional()
|
||||||
.describe('Indicates the set model ID is a custom Ollama model.')
|
.describe('Indicates the set model ID is a custom Ollama model.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Starting models tool with args: ${JSON.stringify(args)}`);
|
log.info(`Starting models tool with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call the direct function
|
|
||||||
const result = await modelsDirect(
|
const result = await modelsDirect(
|
||||||
{ ...args, projectRoot: rootFolder },
|
{ ...args, projectRoot: args.projectRoot },
|
||||||
log,
|
log,
|
||||||
{ session }
|
{ session }
|
||||||
);
|
);
|
||||||
|
|
||||||
// Handle and return the result
|
|
||||||
return handleApiResult(result, log);
|
return handleApiResult(result, log);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`Error in models tool: ${error.message}`);
|
log.error(`Error in models tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { nextTaskDirect } from '../core/task-master-core.js';
|
import { nextTaskDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -27,26 +27,15 @@ export function registerNextTaskTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Finding next task with args: ${JSON.stringify(args)}`);
|
log.info(`Finding next task with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -58,9 +47,7 @@ export function registerNextTaskTool(server) {
|
|||||||
|
|
||||||
const result = await nextTaskDirect(
|
const result = await nextTaskDirect(
|
||||||
{
|
{
|
||||||
// Pass the explicitly resolved path
|
|
||||||
tasksJsonPath: tasksJsonPath
|
tasksJsonPath: tasksJsonPath
|
||||||
// No other args specific to this tool
|
|
||||||
},
|
},
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
@@ -80,6 +67,6 @@ export function registerNextTaskTool(server) {
|
|||||||
log.error(`Error in nextTask tool: ${error.message}`);
|
log.error(`Error in nextTask tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,11 @@
|
|||||||
|
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { handleApiResult, createErrorResponse } from './utils.js';
|
import {
|
||||||
|
handleApiResult,
|
||||||
|
createErrorResponse,
|
||||||
|
withNormalizedProjectRoot
|
||||||
|
} from './utils.js';
|
||||||
import { parsePRDDirect } from '../core/task-master-core.js';
|
import { parsePRDDirect } from '../core/task-master-core.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,42 +53,27 @@ export function registerParsePRDTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
const toolName = 'parse_prd';
|
const toolName = 'parse_prd';
|
||||||
try {
|
try {
|
||||||
log.info(
|
log.info(
|
||||||
`Executing ${toolName} tool with args: ${JSON.stringify(args)}`
|
`Executing ${toolName} tool with args: ${JSON.stringify(args)}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// 1. Get Project Root
|
// Call Direct Function - Pass relevant args including projectRoot
|
||||||
const rootFolder = args.projectRoot;
|
|
||||||
if (!rootFolder || !path.isAbsolute(rootFolder)) {
|
|
||||||
log.error(
|
|
||||||
`${toolName}: projectRoot is required and must be absolute.`
|
|
||||||
);
|
|
||||||
return createErrorResponse(
|
|
||||||
'projectRoot is required and must be absolute.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
log.info(`${toolName}: Project root: ${rootFolder}`);
|
|
||||||
|
|
||||||
// 2. Call Direct Function - Pass relevant args including projectRoot
|
|
||||||
// Path resolution (input/output) is handled within the direct function now
|
|
||||||
const result = await parsePRDDirect(
|
const result = await parsePRDDirect(
|
||||||
{
|
{
|
||||||
// Pass args directly needed by the direct function
|
input: args.input,
|
||||||
input: args.input, // Pass relative or absolute path
|
output: args.output,
|
||||||
output: args.output, // Pass relative or absolute path
|
numTasks: args.numTasks,
|
||||||
numTasks: args.numTasks, // Pass number (direct func handles default)
|
|
||||||
force: args.force,
|
force: args.force,
|
||||||
append: args.append,
|
append: args.append,
|
||||||
projectRoot: rootFolder
|
projectRoot: args.projectRoot
|
||||||
},
|
},
|
||||||
log,
|
log,
|
||||||
{ session } // Pass context object with session
|
{ session }
|
||||||
);
|
);
|
||||||
|
|
||||||
// 3. Handle Result
|
|
||||||
log.info(
|
log.info(
|
||||||
`${toolName}: Direct function result: success=${result.success}`
|
`${toolName}: Direct function result: success=${result.success}`
|
||||||
);
|
);
|
||||||
@@ -97,6 +86,6 @@ export function registerParsePRDTool(server) {
|
|||||||
`Internal tool error (${toolName}): ${error.message}`
|
`Internal tool error (${toolName}): ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { removeDependencyDirect } from '../core/task-master-core.js';
|
import { removeDependencyDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -33,28 +33,17 @@ export function registerRemoveDependencyTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(
|
log.info(
|
||||||
`Removing dependency for task ${args.id} from ${args.dependsOn} with args: ${JSON.stringify(args)}`
|
`Removing dependency for task ${args.id} from ${args.dependsOn} with args: ${JSON.stringify(args)}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -66,9 +55,7 @@ export function registerRemoveDependencyTool(server) {
|
|||||||
|
|
||||||
const result = await removeDependencyDirect(
|
const result = await removeDependencyDirect(
|
||||||
{
|
{
|
||||||
// Pass the explicitly resolved path
|
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
// Pass other relevant args
|
|
||||||
id: args.id,
|
id: args.id,
|
||||||
dependsOn: args.dependsOn
|
dependsOn: args.dependsOn
|
||||||
},
|
},
|
||||||
@@ -86,6 +73,6 @@ export function registerRemoveDependencyTool(server) {
|
|||||||
log.error(`Error in removeDependency tool: ${error.message}`);
|
log.error(`Error in removeDependency tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { removeSubtaskDirect } from '../core/task-master-core.js';
|
import { removeSubtaskDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -46,26 +46,15 @@ export function registerRemoveSubtaskTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Removing subtask with args: ${JSON.stringify(args)}`);
|
log.info(`Removing subtask with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -77,9 +66,7 @@ export function registerRemoveSubtaskTool(server) {
|
|||||||
|
|
||||||
const result = await removeSubtaskDirect(
|
const result = await removeSubtaskDirect(
|
||||||
{
|
{
|
||||||
// Pass the explicitly resolved path
|
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
// Pass other relevant args
|
|
||||||
id: args.id,
|
id: args.id,
|
||||||
convert: args.convert,
|
convert: args.convert,
|
||||||
skipGenerate: args.skipGenerate
|
skipGenerate: args.skipGenerate
|
||||||
@@ -98,6 +85,6 @@ export function registerRemoveSubtaskTool(server) {
|
|||||||
log.error(`Error in removeSubtask tool: ${error.message}`);
|
log.error(`Error in removeSubtask tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { removeTaskDirect } from '../core/task-master-core.js';
|
import { removeTaskDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -35,28 +35,15 @@ export function registerRemoveTaskTool(server) {
|
|||||||
.optional()
|
.optional()
|
||||||
.describe('Whether to skip confirmation prompt (default: false)')
|
.describe('Whether to skip confirmation prompt (default: false)')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Removing task(s) with ID(s): ${args.id}`);
|
log.info(`Removing task(s) with ID(s): ${args.id}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info(`Using project root: ${rootFolder}`);
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -68,7 +55,6 @@ export function registerRemoveTaskTool(server) {
|
|||||||
|
|
||||||
log.info(`Using tasks file path: ${tasksJsonPath}`);
|
log.info(`Using tasks file path: ${tasksJsonPath}`);
|
||||||
|
|
||||||
// Assume client has already handled confirmation if needed
|
|
||||||
const result = await removeTaskDirect(
|
const result = await removeTaskDirect(
|
||||||
{
|
{
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
@@ -88,6 +74,6 @@ export function registerRemoveTaskTool(server) {
|
|||||||
log.error(`Error in remove-task tool: ${error.message}`);
|
log.error(`Error in remove-task tool: ${error.message}`);
|
||||||
return createErrorResponse(`Failed to remove task: ${error.message}`);
|
return createErrorResponse(`Failed to remove task: ${error.message}`);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { setTaskStatusDirect } from '../core/task-master-core.js';
|
import { setTaskStatusDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
|
import { TASK_STATUS_OPTIONS } from '../../../src/constants/task-status.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the setTaskStatus tool with the MCP server
|
* Register the setTaskStatus tool with the MCP server
|
||||||
@@ -27,7 +28,7 @@ export function registerSetTaskStatusTool(server) {
|
|||||||
"Task ID or subtask ID (e.g., '15', '15.2'). Can be comma-separated to update multiple tasks/subtasks at once."
|
"Task ID or subtask ID (e.g., '15', '15.2'). Can be comma-separated to update multiple tasks/subtasks at once."
|
||||||
),
|
),
|
||||||
status: z
|
status: z
|
||||||
.string()
|
.enum(TASK_STATUS_OPTIONS)
|
||||||
.describe(
|
.describe(
|
||||||
"New status to set (e.g., 'pending', 'done', 'in-progress', 'review', 'deferred', 'cancelled'."
|
"New status to set (e.g., 'pending', 'done', 'in-progress', 'review', 'deferred', 'cancelled'."
|
||||||
),
|
),
|
||||||
@@ -36,26 +37,15 @@ export function registerSetTaskStatusTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Setting status of task(s) ${args.id} to: ${args.status}`);
|
log.info(`Setting status of task(s) ${args.id} to: ${args.status}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
// Ensure project root was determined
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve the path to tasks.json
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -65,19 +55,15 @@ export function registerSetTaskStatusTool(server) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the direct function with the resolved path
|
|
||||||
const result = await setTaskStatusDirect(
|
const result = await setTaskStatusDirect(
|
||||||
{
|
{
|
||||||
// Pass the explicitly resolved path
|
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
// Pass other relevant args
|
|
||||||
id: args.id,
|
id: args.id,
|
||||||
status: args.status
|
status: args.status
|
||||||
},
|
},
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
|
|
||||||
// Log the result
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
log.info(
|
log.info(
|
||||||
`Successfully updated status for task(s) ${args.id} to "${args.status}": ${result.data.message}`
|
`Successfully updated status for task(s) ${args.id} to "${args.status}": ${result.data.message}`
|
||||||
@@ -88,7 +74,6 @@ export function registerSetTaskStatusTool(server) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format and return the result
|
|
||||||
return handleApiResult(result, log, 'Error setting task status');
|
return handleApiResult(result, log, 'Error setting task status');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`Error in setTaskStatus tool: ${error.message}`);
|
log.error(`Error in setTaskStatus tool: ${error.message}`);
|
||||||
@@ -96,6 +81,6 @@ export function registerSetTaskStatusTool(server) {
|
|||||||
`Error setting task status: ${error.message}`
|
`Error setting task status: ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { handleApiResult, createErrorResponse } from './utils.js';
|
import {
|
||||||
|
handleApiResult,
|
||||||
|
createErrorResponse,
|
||||||
|
withNormalizedProjectRoot
|
||||||
|
} from './utils.js';
|
||||||
import { updateSubtaskByIdDirect } from '../core/task-master-core.js';
|
import { updateSubtaskByIdDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the update-subtask tool with the MCP server
|
* Register the update-subtask tool with the MCP server
|
||||||
@@ -34,45 +37,31 @@ export function registerUpdateSubtaskTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
const toolName = 'update_subtask';
|
const toolName = 'update_subtask';
|
||||||
try {
|
try {
|
||||||
log.info(`Updating subtask with args: ${JSON.stringify(args)}`);
|
log.info(`Updating subtask with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// 1. Get Project Root
|
|
||||||
const rootFolder = args.projectRoot;
|
|
||||||
if (!rootFolder || !path.isAbsolute(rootFolder)) {
|
|
||||||
log.error(
|
|
||||||
`${toolName}: projectRoot is required and must be absolute.`
|
|
||||||
);
|
|
||||||
return createErrorResponse(
|
|
||||||
'projectRoot is required and must be absolute.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
log.info(`${toolName}: Project root: ${rootFolder}`);
|
|
||||||
|
|
||||||
// 2. Resolve Tasks Path
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`${toolName}: Error finding tasks.json: ${error.message}`);
|
log.error(`${toolName}: Error finding tasks.json: ${error.message}`);
|
||||||
return createErrorResponse(
|
return createErrorResponse(
|
||||||
`Failed to find tasks.json within project root '${rootFolder}': ${error.message}`
|
`Failed to find tasks.json: ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Call Direct Function - Include projectRoot
|
|
||||||
const result = await updateSubtaskByIdDirect(
|
const result = await updateSubtaskByIdDirect(
|
||||||
{
|
{
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
id: args.id,
|
id: args.id,
|
||||||
prompt: args.prompt,
|
prompt: args.prompt,
|
||||||
research: args.research,
|
research: args.research,
|
||||||
projectRoot: rootFolder
|
projectRoot: args.projectRoot
|
||||||
},
|
},
|
||||||
log,
|
log,
|
||||||
{ session }
|
{ session }
|
||||||
@@ -95,6 +84,6 @@ export function registerUpdateSubtaskTool(server) {
|
|||||||
`Internal tool error (${toolName}): ${error.message}`
|
`Internal tool error (${toolName}): ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import path from 'path'; // Import path
|
|
||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { updateTaskByIdDirect } from '../core/task-master-core.js';
|
import { updateTaskByIdDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -40,58 +39,44 @@ export function registerUpdateTaskTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
const toolName = 'update_task';
|
const toolName = 'update_task';
|
||||||
try {
|
try {
|
||||||
log.info(
|
log.info(
|
||||||
`Executing ${toolName} tool with args: ${JSON.stringify(args)}`
|
`Executing ${toolName} tool with args: ${JSON.stringify(args)}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// 1. Get Project Root
|
|
||||||
const rootFolder = args.projectRoot;
|
|
||||||
if (!rootFolder || !path.isAbsolute(rootFolder)) {
|
|
||||||
log.error(
|
|
||||||
`${toolName}: projectRoot is required and must be absolute.`
|
|
||||||
);
|
|
||||||
return createErrorResponse(
|
|
||||||
'projectRoot is required and must be absolute.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
log.info(`${toolName}: Project root: ${rootFolder}`);
|
|
||||||
|
|
||||||
// 2. Resolve Tasks Path
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file }, // Pass root and optional relative file
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
log.info(`${toolName}: Resolved tasks path: ${tasksJsonPath}`);
|
log.info(`${toolName}: Resolved tasks path: ${tasksJsonPath}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`${toolName}: Error finding tasks.json: ${error.message}`);
|
log.error(`${toolName}: Error finding tasks.json: ${error.message}`);
|
||||||
return createErrorResponse(
|
return createErrorResponse(
|
||||||
`Failed to find tasks.json within project root '${rootFolder}': ${error.message}`
|
`Failed to find tasks.json: ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Call Direct Function - Include projectRoot
|
// 3. Call Direct Function - Include projectRoot
|
||||||
const result = await updateTaskByIdDirect(
|
const result = await updateTaskByIdDirect(
|
||||||
{
|
{
|
||||||
tasksJsonPath: tasksJsonPath, // Pass resolved path
|
tasksJsonPath: tasksJsonPath,
|
||||||
id: args.id,
|
id: args.id,
|
||||||
prompt: args.prompt,
|
prompt: args.prompt,
|
||||||
research: args.research,
|
research: args.research,
|
||||||
projectRoot: rootFolder // <<< Pass projectRoot HERE
|
projectRoot: args.projectRoot
|
||||||
},
|
},
|
||||||
log,
|
log,
|
||||||
{ session } // Pass context with session
|
{ session }
|
||||||
);
|
);
|
||||||
|
|
||||||
// 4. Handle Result
|
// 4. Handle Result
|
||||||
log.info(
|
log.info(
|
||||||
`${toolName}: Direct function result: success=${result.success}`
|
`${toolName}: Direct function result: success=${result.success}`
|
||||||
);
|
);
|
||||||
// Pass the actual data from the result (contains updated task or message)
|
|
||||||
return handleApiResult(result, log, 'Error updating task');
|
return handleApiResult(result, log, 'Error updating task');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(
|
log.error(
|
||||||
@@ -101,6 +86,6 @@ export function registerUpdateTaskTool(server) {
|
|||||||
`Internal tool error (${toolName}): ${error.message}`
|
`Internal tool error (${toolName}): ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { handleApiResult, createErrorResponse } from './utils.js';
|
import {
|
||||||
|
handleApiResult,
|
||||||
|
createErrorResponse,
|
||||||
|
withNormalizedProjectRoot
|
||||||
|
} from './utils.js';
|
||||||
import { updateTasksDirect } from '../core/task-master-core.js';
|
import { updateTasksDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the update tool with the MCP server
|
* Register the update tool with the MCP server
|
||||||
@@ -31,59 +34,61 @@ export function registerUpdateTool(server) {
|
|||||||
.boolean()
|
.boolean()
|
||||||
.optional()
|
.optional()
|
||||||
.describe('Use Perplexity AI for research-backed updates'),
|
.describe('Use Perplexity AI for research-backed updates'),
|
||||||
file: z.string().optional().describe('Absolute path to the tasks file'),
|
file: z
|
||||||
|
.string()
|
||||||
|
.optional()
|
||||||
|
.describe('Path to the tasks file relative to project root'),
|
||||||
projectRoot: z
|
projectRoot: z
|
||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.optional()
|
||||||
|
.describe(
|
||||||
|
'The directory of the project. (Optional, usually from session)'
|
||||||
|
)
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
|
const toolName = 'update';
|
||||||
|
const { from, prompt, research, file, projectRoot } = args;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
log.info(`Executing update tool with args: ${JSON.stringify(args)}`);
|
log.info(
|
||||||
|
`Executing ${toolName} tool with normalized root: ${projectRoot}`
|
||||||
|
);
|
||||||
|
|
||||||
// 1. Get Project Root
|
|
||||||
const rootFolder = args.projectRoot;
|
|
||||||
if (!rootFolder || !path.isAbsolute(rootFolder)) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'projectRoot is required and must be absolute.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
log.info(`Project root: ${rootFolder}`);
|
|
||||||
|
|
||||||
// 2. Resolve Path
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath({ projectRoot, file }, log);
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
log.info(`${toolName}: Resolved tasks path: ${tasksJsonPath}`);
|
||||||
log
|
|
||||||
);
|
|
||||||
log.info(`Resolved tasks path: ${tasksJsonPath}`);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`Error finding tasks.json: ${error.message}`);
|
log.error(`${toolName}: Error finding tasks.json: ${error.message}`);
|
||||||
return createErrorResponse(
|
return createErrorResponse(
|
||||||
`Failed to find tasks.json: ${error.message}`
|
`Failed to find tasks.json within project root '${projectRoot}': ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Call Direct Function
|
|
||||||
const result = await updateTasksDirect(
|
const result = await updateTasksDirect(
|
||||||
{
|
{
|
||||||
tasksJsonPath: tasksJsonPath,
|
tasksJsonPath: tasksJsonPath,
|
||||||
from: args.from,
|
from: from,
|
||||||
prompt: args.prompt,
|
prompt: prompt,
|
||||||
research: args.research,
|
research: research,
|
||||||
projectRoot: rootFolder
|
projectRoot: projectRoot
|
||||||
},
|
},
|
||||||
log,
|
log,
|
||||||
{ session }
|
{ session }
|
||||||
);
|
);
|
||||||
|
|
||||||
// 4. Handle Result
|
log.info(
|
||||||
log.info(`updateTasksDirect result: success=${result.success}`);
|
`${toolName}: Direct function result: success=${result.success}`
|
||||||
|
);
|
||||||
return handleApiResult(result, log, 'Error updating tasks');
|
return handleApiResult(result, log, 'Error updating tasks');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`Critical error in update tool execute: ${error.message}`);
|
log.error(
|
||||||
return createErrorResponse(`Internal tool error: ${error.message}`);
|
`Critical error in ${toolName} tool execute: ${error.message}`
|
||||||
|
);
|
||||||
|
return createErrorResponse(
|
||||||
|
`Internal tool error (${toolName}): ${error.message}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,10 +83,10 @@ function getProjectRoot(projectRootRaw, log) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the project root path from the FastMCP session object.
|
* Extracts and normalizes the project root path from the MCP session object.
|
||||||
* @param {Object} session - The FastMCP session object.
|
* @param {Object} session - The MCP session object.
|
||||||
* @param {Object} log - Logger object.
|
* @param {Object} log - The MCP logger object.
|
||||||
* @returns {string|null} - The absolute path to the project root, or null if not found.
|
* @returns {string|null} - The normalized absolute project root path or null if not found/invalid.
|
||||||
*/
|
*/
|
||||||
function getProjectRootFromSession(session, log) {
|
function getProjectRootFromSession(session, log) {
|
||||||
try {
|
try {
|
||||||
@@ -107,68 +107,87 @@ function getProjectRootFromSession(session, log) {
|
|||||||
})}`
|
})}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// ALWAYS ensure we return a valid path for project root
|
let rawRootPath = null;
|
||||||
|
let decodedPath = null;
|
||||||
|
let finalPath = null;
|
||||||
|
|
||||||
|
// Check primary location
|
||||||
|
if (session?.roots?.[0]?.uri) {
|
||||||
|
rawRootPath = session.roots[0].uri;
|
||||||
|
log.info(`Found raw root URI in session.roots[0].uri: ${rawRootPath}`);
|
||||||
|
}
|
||||||
|
// Check alternate location
|
||||||
|
else if (session?.roots?.roots?.[0]?.uri) {
|
||||||
|
rawRootPath = session.roots.roots[0].uri;
|
||||||
|
log.info(
|
||||||
|
`Found raw root URI in session.roots.roots[0].uri: ${rawRootPath}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawRootPath) {
|
||||||
|
// Decode URI and strip file:// protocol
|
||||||
|
decodedPath = rawRootPath.startsWith('file://')
|
||||||
|
? decodeURIComponent(rawRootPath.slice(7))
|
||||||
|
: rawRootPath; // Assume non-file URI is already decoded? Or decode anyway? Let's decode.
|
||||||
|
if (!rawRootPath.startsWith('file://')) {
|
||||||
|
decodedPath = decodeURIComponent(rawRootPath); // Decode even if no file://
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle potential Windows drive prefix after stripping protocol (e.g., /C:/...)
|
||||||
|
if (
|
||||||
|
decodedPath.startsWith('/') &&
|
||||||
|
/[A-Za-z]:/.test(decodedPath.substring(1, 3))
|
||||||
|
) {
|
||||||
|
decodedPath = decodedPath.substring(1); // Remove leading slash if it's like /C:/...
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info(`Decoded path: ${decodedPath}`);
|
||||||
|
|
||||||
|
// Normalize slashes and resolve
|
||||||
|
const normalizedSlashes = decodedPath.replace(/\\/g, '/');
|
||||||
|
finalPath = path.resolve(normalizedSlashes); // Resolve to absolute path for current OS
|
||||||
|
|
||||||
|
log.info(`Normalized and resolved session path: ${finalPath}`);
|
||||||
|
return finalPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback Logic (remains the same)
|
||||||
|
log.warn('No project root URI found in session. Attempting fallbacks...');
|
||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
|
|
||||||
// If we have a session with roots array
|
// Fallback 1: Use server path deduction (Cursor IDE)
|
||||||
if (session?.roots?.[0]?.uri) {
|
const serverPath = process.argv[1];
|
||||||
const rootUri = session.roots[0].uri;
|
|
||||||
log.info(`Found rootUri in session.roots[0].uri: ${rootUri}`);
|
|
||||||
const rootPath = rootUri.startsWith('file://')
|
|
||||||
? decodeURIComponent(rootUri.slice(7))
|
|
||||||
: rootUri;
|
|
||||||
log.info(`Decoded rootPath: ${rootPath}`);
|
|
||||||
return rootPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we have a session with roots.roots array (different structure)
|
|
||||||
if (session?.roots?.roots?.[0]?.uri) {
|
|
||||||
const rootUri = session.roots.roots[0].uri;
|
|
||||||
log.info(`Found rootUri in session.roots.roots[0].uri: ${rootUri}`);
|
|
||||||
const rootPath = rootUri.startsWith('file://')
|
|
||||||
? decodeURIComponent(rootUri.slice(7))
|
|
||||||
: rootUri;
|
|
||||||
log.info(`Decoded rootPath: ${rootPath}`);
|
|
||||||
return rootPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the server's location and try to find project root -- this is a fallback necessary in Cursor IDE
|
|
||||||
const serverPath = process.argv[1]; // This should be the path to server.js, which is in mcp-server/
|
|
||||||
if (serverPath && serverPath.includes('mcp-server')) {
|
if (serverPath && serverPath.includes('mcp-server')) {
|
||||||
// Find the mcp-server directory first
|
|
||||||
const mcpServerIndex = serverPath.indexOf('mcp-server');
|
const mcpServerIndex = serverPath.indexOf('mcp-server');
|
||||||
if (mcpServerIndex !== -1) {
|
if (mcpServerIndex !== -1) {
|
||||||
// Get the path up to mcp-server, which should be the project root
|
const projectRoot = path.dirname(
|
||||||
const projectRoot = serverPath.substring(0, mcpServerIndex - 1); // -1 to remove trailing slash
|
serverPath.substring(0, mcpServerIndex)
|
||||||
|
); // Go up one level
|
||||||
|
|
||||||
// Verify this looks like our project root by checking for key files/directories
|
|
||||||
if (
|
if (
|
||||||
fs.existsSync(path.join(projectRoot, '.cursor')) ||
|
fs.existsSync(path.join(projectRoot, '.cursor')) ||
|
||||||
fs.existsSync(path.join(projectRoot, 'mcp-server')) ||
|
fs.existsSync(path.join(projectRoot, 'mcp-server')) ||
|
||||||
fs.existsSync(path.join(projectRoot, 'package.json'))
|
fs.existsSync(path.join(projectRoot, 'package.json'))
|
||||||
) {
|
) {
|
||||||
log.info(`Found project root from server path: ${projectRoot}`);
|
log.info(
|
||||||
return projectRoot;
|
`Using project root derived from server path: ${projectRoot}`
|
||||||
|
);
|
||||||
|
return projectRoot; // Already absolute
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ALWAYS ensure we return a valid path as a last resort
|
// Fallback 2: Use CWD
|
||||||
log.info(`Using current working directory as ultimate fallback: ${cwd}`);
|
log.info(`Using current working directory as ultimate fallback: ${cwd}`);
|
||||||
return cwd;
|
return cwd; // Already absolute
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// If we have a server path, use it as a basis for project root
|
log.error(`Error in getProjectRootFromSession: ${e.message}`);
|
||||||
const serverPath = process.argv[1];
|
// Attempt final fallback to CWD on error
|
||||||
if (serverPath && serverPath.includes('mcp-server')) {
|
|
||||||
const mcpServerIndex = serverPath.indexOf('mcp-server');
|
|
||||||
return mcpServerIndex !== -1
|
|
||||||
? serverPath.substring(0, mcpServerIndex - 1)
|
|
||||||
: process.cwd();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only use cwd if it's not "/"
|
|
||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
return cwd !== '/' ? cwd : '/';
|
log.warn(
|
||||||
|
`Returning CWD (${cwd}) due to error during session root processing.`
|
||||||
|
);
|
||||||
|
return cwd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,6 +493,148 @@ function createLogWrapper(log) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves and normalizes a project root path from various formats.
|
||||||
|
* Handles URI encoding, Windows paths, and file protocols.
|
||||||
|
* @param {string | undefined | null} rawPath - The raw project root path.
|
||||||
|
* @param {object} [log] - Optional logger object.
|
||||||
|
* @returns {string | null} Normalized absolute path or null if input is invalid/empty.
|
||||||
|
*/
|
||||||
|
function normalizeProjectRoot(rawPath, log) {
|
||||||
|
if (!rawPath) return null;
|
||||||
|
try {
|
||||||
|
let pathString = Array.isArray(rawPath) ? rawPath[0] : String(rawPath);
|
||||||
|
if (!pathString) return null;
|
||||||
|
|
||||||
|
// 1. Decode URI Encoding
|
||||||
|
// Use try-catch for decoding as malformed URIs can throw
|
||||||
|
try {
|
||||||
|
pathString = decodeURIComponent(pathString);
|
||||||
|
} catch (decodeError) {
|
||||||
|
if (log)
|
||||||
|
log.warn(
|
||||||
|
`Could not decode URI component for path "${rawPath}": ${decodeError.message}. Proceeding with raw string.`
|
||||||
|
);
|
||||||
|
// Proceed with the original string if decoding fails
|
||||||
|
pathString = Array.isArray(rawPath) ? rawPath[0] : String(rawPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Strip file:// prefix (handle 2 or 3 slashes)
|
||||||
|
if (pathString.startsWith('file:///')) {
|
||||||
|
pathString = pathString.slice(7); // Slice 7 for file:///, may leave leading / on Windows
|
||||||
|
} else if (pathString.startsWith('file://')) {
|
||||||
|
pathString = pathString.slice(7); // Slice 7 for file://
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Handle potential Windows leading slash after stripping prefix (e.g., /C:/...)
|
||||||
|
// This checks if it starts with / followed by a drive letter C: D: etc.
|
||||||
|
if (
|
||||||
|
pathString.startsWith('/') &&
|
||||||
|
/[A-Za-z]:/.test(pathString.substring(1, 3))
|
||||||
|
) {
|
||||||
|
pathString = pathString.substring(1); // Remove the leading slash
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Normalize backslashes to forward slashes
|
||||||
|
pathString = pathString.replace(/\\/g, '/');
|
||||||
|
|
||||||
|
// 5. Resolve to absolute path using server's OS convention
|
||||||
|
const resolvedPath = path.resolve(pathString);
|
||||||
|
return resolvedPath;
|
||||||
|
} catch (error) {
|
||||||
|
if (log) {
|
||||||
|
log.error(
|
||||||
|
`Error normalizing project root path "${rawPath}": ${error.message}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null; // Return null on error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts the raw project root path from the session (without normalization).
|
||||||
|
* Used as a fallback within the HOF.
|
||||||
|
* @param {Object} session - The MCP session object.
|
||||||
|
* @param {Object} log - The MCP logger object.
|
||||||
|
* @returns {string|null} The raw path string or null.
|
||||||
|
*/
|
||||||
|
function getRawProjectRootFromSession(session, log) {
|
||||||
|
try {
|
||||||
|
// Check primary location
|
||||||
|
if (session?.roots?.[0]?.uri) {
|
||||||
|
return session.roots[0].uri;
|
||||||
|
}
|
||||||
|
// Check alternate location
|
||||||
|
else if (session?.roots?.roots?.[0]?.uri) {
|
||||||
|
return session.roots.roots[0].uri;
|
||||||
|
}
|
||||||
|
return null; // Not found in expected session locations
|
||||||
|
} catch (e) {
|
||||||
|
log.error(`Error accessing session roots: ${e.message}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Higher-order function to wrap MCP tool execute methods.
|
||||||
|
* Ensures args.projectRoot is present and normalized before execution.
|
||||||
|
* @param {Function} executeFn - The original async execute(args, context) function.
|
||||||
|
* @returns {Function} The wrapped async execute function.
|
||||||
|
*/
|
||||||
|
function withNormalizedProjectRoot(executeFn) {
|
||||||
|
return async (args, context) => {
|
||||||
|
const { log, session } = context;
|
||||||
|
let normalizedRoot = null;
|
||||||
|
let rootSource = 'unknown';
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Determine raw root: prioritize args, then session
|
||||||
|
let rawRoot = args.projectRoot;
|
||||||
|
if (!rawRoot) {
|
||||||
|
rawRoot = getRawProjectRootFromSession(session, log);
|
||||||
|
rootSource = 'session';
|
||||||
|
} else {
|
||||||
|
rootSource = 'args';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rawRoot) {
|
||||||
|
log.error('Could not determine project root from args or session.');
|
||||||
|
return createErrorResponse(
|
||||||
|
'Could not determine project root. Please provide projectRoot argument or ensure session contains root info.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalize the determined raw root
|
||||||
|
normalizedRoot = normalizeProjectRoot(rawRoot, log);
|
||||||
|
|
||||||
|
if (!normalizedRoot) {
|
||||||
|
log.error(
|
||||||
|
`Failed to normalize project root obtained from ${rootSource}: ${rawRoot}`
|
||||||
|
);
|
||||||
|
return createErrorResponse(
|
||||||
|
`Invalid project root provided or derived from ${rootSource}: ${rawRoot}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inject the normalized root back into args
|
||||||
|
const updatedArgs = { ...args, projectRoot: normalizedRoot };
|
||||||
|
|
||||||
|
// Execute the original function with normalized root in args
|
||||||
|
return await executeFn(updatedArgs, context);
|
||||||
|
} catch (error) {
|
||||||
|
log.error(
|
||||||
|
`Error within withNormalizedProjectRoot HOF (Normalized Root: ${normalizedRoot}): ${error.message}`
|
||||||
|
);
|
||||||
|
// Add stack trace if available and debug enabled
|
||||||
|
if (error.stack && log.debug) {
|
||||||
|
log.debug(error.stack);
|
||||||
|
}
|
||||||
|
// Return a generic error or re-throw depending on desired behavior
|
||||||
|
return createErrorResponse(`Operation failed: ${error.message}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure all functions are exported
|
// Ensure all functions are exported
|
||||||
export {
|
export {
|
||||||
getProjectRoot,
|
getProjectRoot,
|
||||||
@@ -484,5 +645,8 @@ export {
|
|||||||
processMCPResponseData,
|
processMCPResponseData,
|
||||||
createContentResponse,
|
createContentResponse,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
createLogWrapper
|
createLogWrapper,
|
||||||
|
normalizeProjectRoot,
|
||||||
|
getRawProjectRootFromSession,
|
||||||
|
withNormalizedProjectRoot
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|||||||
import {
|
import {
|
||||||
handleApiResult,
|
handleApiResult,
|
||||||
createErrorResponse,
|
createErrorResponse,
|
||||||
getProjectRootFromSession
|
withNormalizedProjectRoot
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { validateDependenciesDirect } from '../core/task-master-core.js';
|
import { validateDependenciesDirect } from '../core/task-master-core.js';
|
||||||
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
import { findTasksJsonPath } from '../core/utils/path-utils.js';
|
||||||
@@ -27,24 +27,15 @@ export function registerValidateDependenciesTool(server) {
|
|||||||
.string()
|
.string()
|
||||||
.describe('The directory of the project. Must be an absolute path.')
|
.describe('The directory of the project. Must be an absolute path.')
|
||||||
}),
|
}),
|
||||||
execute: async (args, { log, session }) => {
|
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||||
try {
|
try {
|
||||||
log.info(`Validating dependencies with args: ${JSON.stringify(args)}`);
|
log.info(`Validating dependencies with args: ${JSON.stringify(args)}`);
|
||||||
|
|
||||||
// Get project root from args or session
|
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||||
const rootFolder =
|
|
||||||
args.projectRoot || getProjectRootFromSession(session, log);
|
|
||||||
|
|
||||||
if (!rootFolder) {
|
|
||||||
return createErrorResponse(
|
|
||||||
'Could not determine project root. Please provide it explicitly or ensure your session contains valid root information.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let tasksJsonPath;
|
let tasksJsonPath;
|
||||||
try {
|
try {
|
||||||
tasksJsonPath = findTasksJsonPath(
|
tasksJsonPath = findTasksJsonPath(
|
||||||
{ projectRoot: rootFolder, file: args.file },
|
{ projectRoot: args.projectRoot, file: args.file },
|
||||||
log
|
log
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -74,6 +65,6 @@ export function registerValidateDependenciesTool(server) {
|
|||||||
log.error(`Error in validateDependencies tool: ${error.message}`);
|
log.error(`Error in validateDependencies tool: ${error.message}`);
|
||||||
return createErrorResponse(error.message);
|
return createErrorResponse(error.message);
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
34
package-lock.json
generated
34
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "task-master-ai",
|
"name": "task-master-ai",
|
||||||
"version": "0.12.1",
|
"version": "0.13.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "task-master-ai",
|
"name": "task-master-ai",
|
||||||
"version": "0.12.1",
|
"version": "0.13.2",
|
||||||
"license": "MIT WITH Commons-Clause",
|
"license": "MIT WITH Commons-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ai-sdk/anthropic": "^1.2.10",
|
"@ai-sdk/anthropic": "^1.2.10",
|
||||||
@@ -19,6 +19,9 @@
|
|||||||
"@anthropic-ai/sdk": "^0.39.0",
|
"@anthropic-ai/sdk": "^0.39.0",
|
||||||
"@openrouter/ai-sdk-provider": "^0.4.5",
|
"@openrouter/ai-sdk-provider": "^0.4.5",
|
||||||
"ai": "^4.3.10",
|
"ai": "^4.3.10",
|
||||||
|
"boxen": "^8.0.1",
|
||||||
|
"chalk": "^5.4.1",
|
||||||
|
"cli-table3": "^0.6.5",
|
||||||
"commander": "^11.1.0",
|
"commander": "^11.1.0",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
@@ -34,7 +37,8 @@
|
|||||||
"ollama-ai-provider": "^1.2.0",
|
"ollama-ai-provider": "^1.2.0",
|
||||||
"openai": "^4.89.0",
|
"openai": "^4.89.0",
|
||||||
"ora": "^8.2.0",
|
"ora": "^8.2.0",
|
||||||
"uuid": "^11.1.0"
|
"uuid": "^11.1.0",
|
||||||
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"task-master": "bin/task-master.js",
|
"task-master": "bin/task-master.js",
|
||||||
@@ -45,9 +49,6 @@
|
|||||||
"@changesets/changelog-github": "^0.5.1",
|
"@changesets/changelog-github": "^0.5.1",
|
||||||
"@changesets/cli": "^2.28.1",
|
"@changesets/cli": "^2.28.1",
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^29.5.14",
|
||||||
"boxen": "^8.0.1",
|
|
||||||
"chalk": "^5.4.1",
|
|
||||||
"cli-table3": "^0.6.5",
|
|
||||||
"execa": "^8.0.1",
|
"execa": "^8.0.1",
|
||||||
"ink": "^5.0.1",
|
"ink": "^5.0.1",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
@@ -57,8 +58,7 @@
|
|||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"supertest": "^7.1.0",
|
"supertest": "^7.1.0",
|
||||||
"tsx": "^4.16.2",
|
"tsx": "^4.16.2"
|
||||||
"zod": "^3.23.8"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
@@ -1238,7 +1238,6 @@
|
|||||||
"version": "1.5.0",
|
"version": "1.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
|
||||||
"integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",
|
"integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -3307,7 +3306,6 @@
|
|||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz",
|
||||||
"integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==",
|
"integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==",
|
||||||
"dev": true,
|
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"string-width": "^4.1.0"
|
"string-width": "^4.1.0"
|
||||||
@@ -3317,7 +3315,6 @@
|
|||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
@@ -3327,14 +3324,12 @@
|
|||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/ansi-align/node_modules/string-width": {
|
"node_modules/ansi-align/node_modules/string-width": {
|
||||||
"version": "4.2.3",
|
"version": "4.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"emoji-regex": "^8.0.0",
|
"emoji-regex": "^8.0.0",
|
||||||
@@ -3349,7 +3344,6 @@
|
|||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-regex": "^5.0.1"
|
"ansi-regex": "^5.0.1"
|
||||||
@@ -3699,7 +3693,6 @@
|
|||||||
"version": "8.0.1",
|
"version": "8.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz",
|
||||||
"integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==",
|
"integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-align": "^3.0.1",
|
"ansi-align": "^3.0.1",
|
||||||
@@ -3850,7 +3843,6 @@
|
|||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz",
|
||||||
"integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==",
|
"integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16"
|
"node": ">=16"
|
||||||
@@ -3935,7 +3927,6 @@
|
|||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz",
|
||||||
"integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==",
|
"integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
@@ -3975,7 +3966,6 @@
|
|||||||
"version": "0.6.5",
|
"version": "0.6.5",
|
||||||
"resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz",
|
"resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz",
|
||||||
"integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==",
|
"integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"string-width": "^4.2.0"
|
"string-width": "^4.2.0"
|
||||||
@@ -3991,7 +3981,6 @@
|
|||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
@@ -4001,14 +3990,12 @@
|
|||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/cli-table3/node_modules/string-width": {
|
"node_modules/cli-table3/node_modules/string-width": {
|
||||||
"version": "4.2.3",
|
"version": "4.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"emoji-regex": "^8.0.0",
|
"emoji-regex": "^8.0.0",
|
||||||
@@ -4023,7 +4010,6 @@
|
|||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-regex": "^5.0.1"
|
"ansi-regex": "^5.0.1"
|
||||||
@@ -9488,7 +9474,6 @@
|
|||||||
"version": "4.37.0",
|
"version": "4.37.0",
|
||||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.37.0.tgz",
|
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.37.0.tgz",
|
||||||
"integrity": "sha512-S/5/0kFftkq27FPNye0XM1e2NsnoD/3FS+pBmbjmmtLT6I+i344KoOf7pvXreaFsDamWeaJX55nczA1m5PsBDg==",
|
"integrity": "sha512-S/5/0kFftkq27FPNye0XM1e2NsnoD/3FS+pBmbjmmtLT6I+i344KoOf7pvXreaFsDamWeaJX55nczA1m5PsBDg==",
|
||||||
"dev": true,
|
|
||||||
"license": "(MIT OR CC0-1.0)",
|
"license": "(MIT OR CC0-1.0)",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16"
|
"node": ">=16"
|
||||||
@@ -9698,7 +9683,6 @@
|
|||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz",
|
||||||
"integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==",
|
"integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"string-width": "^7.0.0"
|
"string-width": "^7.0.0"
|
||||||
@@ -9714,7 +9698,6 @@
|
|||||||
"version": "9.0.0",
|
"version": "9.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz",
|
||||||
"integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==",
|
"integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-styles": "^6.2.1",
|
"ansi-styles": "^6.2.1",
|
||||||
@@ -9732,7 +9715,6 @@
|
|||||||
"version": "6.2.1",
|
"version": "6.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
|
||||||
"integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
|
"integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
|
|||||||
21
package.json
21
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "task-master-ai",
|
"name": "task-master-ai",
|
||||||
"version": "0.12.1",
|
"version": "0.13.2",
|
||||||
"description": "A task management system for ambitious AI-driven development that doesn't overwhelm and confuse Cursor.",
|
"description": "A task management system for ambitious AI-driven development that doesn't overwhelm and confuse Cursor.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -64,7 +64,11 @@
|
|||||||
"ollama-ai-provider": "^1.2.0",
|
"ollama-ai-provider": "^1.2.0",
|
||||||
"openai": "^4.89.0",
|
"openai": "^4.89.0",
|
||||||
"ora": "^8.2.0",
|
"ora": "^8.2.0",
|
||||||
"uuid": "^11.1.0"
|
"uuid": "^11.1.0",
|
||||||
|
"boxen": "^8.0.1",
|
||||||
|
"chalk": "^5.4.1",
|
||||||
|
"cli-table3": "^0.6.5",
|
||||||
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
@@ -78,15 +82,14 @@
|
|||||||
"url": "https://github.com/eyaltoledano/claude-task-master/issues"
|
"url": "https://github.com/eyaltoledano/claude-task-master/issues"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"scripts/init.js",
|
"scripts/**",
|
||||||
"scripts/dev.js",
|
|
||||||
"scripts/modules/**",
|
|
||||||
"assets/**",
|
"assets/**",
|
||||||
".cursor/**",
|
".cursor/**",
|
||||||
"README-task-master.md",
|
"README-task-master.md",
|
||||||
"index.js",
|
"index.js",
|
||||||
"bin/**",
|
"bin/**",
|
||||||
"mcp-server/**"
|
"mcp-server/**",
|
||||||
|
"src/**"
|
||||||
],
|
],
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"node-fetch": "^3.3.2",
|
"node-fetch": "^3.3.2",
|
||||||
@@ -96,9 +99,6 @@
|
|||||||
"@changesets/changelog-github": "^0.5.1",
|
"@changesets/changelog-github": "^0.5.1",
|
||||||
"@changesets/cli": "^2.28.1",
|
"@changesets/cli": "^2.28.1",
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^29.5.14",
|
||||||
"boxen": "^8.0.1",
|
|
||||||
"chalk": "^5.4.1",
|
|
||||||
"cli-table3": "^0.6.5",
|
|
||||||
"execa": "^8.0.1",
|
"execa": "^8.0.1",
|
||||||
"ink": "^5.0.1",
|
"ink": "^5.0.1",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
@@ -108,7 +108,6 @@
|
|||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"supertest": "^7.1.0",
|
"supertest": "^7.1.0",
|
||||||
"tsx": "^4.16.2",
|
"tsx": "^4.16.2"
|
||||||
"zod": "^3.23.8"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ The script can be configured through environment variables in a `.env` file at t
|
|||||||
- `PERPLEXITY_API_KEY`: Your Perplexity API key for research-backed subtask generation
|
- `PERPLEXITY_API_KEY`: Your Perplexity API key for research-backed subtask generation
|
||||||
- `PERPLEXITY_MODEL`: Specify which Perplexity model to use (default: "sonar-medium-online")
|
- `PERPLEXITY_MODEL`: Specify which Perplexity model to use (default: "sonar-medium-online")
|
||||||
- `DEBUG`: Enable debug logging (default: false)
|
- `DEBUG`: Enable debug logging (default: false)
|
||||||
- `LOG_LEVEL`: Log level - debug, info, warn, error (default: info)
|
- `TASKMASTER_LOG_LEVEL`: Log level - debug, info, warn, error (default: info)
|
||||||
- `DEFAULT_SUBTASKS`: Default number of subtasks when expanding (default: 3)
|
- `DEFAULT_SUBTASKS`: Default number of subtasks when expanding (default: 3)
|
||||||
- `DEFAULT_PRIORITY`: Default priority for generated tasks (default: medium)
|
- `DEFAULT_PRIORITY`: Default priority for generated tasks (default: medium)
|
||||||
- `PROJECT_NAME`: Override default project name in tasks.json
|
- `PROJECT_NAME`: Override default project name in tasks.json
|
||||||
@@ -47,7 +47,7 @@ The script can be configured through environment variables in a `.env` file at t
|
|||||||
- Tasks can have `subtasks` for more detailed implementation steps.
|
- Tasks can have `subtasks` for more detailed implementation steps.
|
||||||
- Dependencies are displayed with status indicators (✅ for completed, ⏱️ for pending) to easily track progress.
|
- Dependencies are displayed with status indicators (✅ for completed, ⏱️ for pending) to easily track progress.
|
||||||
|
|
||||||
2. **Script Commands**
|
2. **Script Commands**
|
||||||
You can run the script via:
|
You can run the script via:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -225,7 +225,7 @@ To use the Perplexity integration:
|
|||||||
|
|
||||||
## Logging
|
## Logging
|
||||||
|
|
||||||
The script supports different logging levels controlled by the `LOG_LEVEL` environment variable:
|
The script supports different logging levels controlled by the `TASKMASTER_LOG_LEVEL` environment variable:
|
||||||
|
|
||||||
- `debug`: Detailed information, typically useful for troubleshooting
|
- `debug`: Detailed information, typically useful for troubleshooting
|
||||||
- `info`: Confirmation that things are working as expected (default)
|
- `info`: Confirmation that things are working as expected (default)
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ const LOG_LEVELS = {
|
|||||||
success: 4
|
success: 4
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get log level from environment or default to info
|
// Determine log level from environment variable or default to 'info'
|
||||||
const LOG_LEVEL = process.env.LOG_LEVEL
|
const LOG_LEVEL = process.env.TASKMASTER_LOG_LEVEL
|
||||||
? LOG_LEVELS[process.env.LOG_LEVEL.toLowerCase()]
|
? LOG_LEVELS[process.env.TASKMASTER_LOG_LEVEL.toLowerCase()]
|
||||||
: LOG_LEVELS.info;
|
: LOG_LEVELS.info; // Default to info
|
||||||
|
|
||||||
// Create a color gradient for the banner
|
// Create a color gradient for the banner
|
||||||
const coolGradient = gradient(['#00b4d8', '#0077b6', '#03045e']);
|
const coolGradient = gradient(['#00b4d8', '#0077b6', '#03045e']);
|
||||||
@@ -180,9 +180,9 @@ function copyTemplateFile(templateName, targetPath, replacements = {}) {
|
|||||||
|
|
||||||
// Map template names to their actual source paths
|
// Map template names to their actual source paths
|
||||||
switch (templateName) {
|
switch (templateName) {
|
||||||
case 'scripts_README.md':
|
// case 'scripts_README.md':
|
||||||
sourcePath = path.join(__dirname, '..', 'assets', 'scripts_README.md');
|
// sourcePath = path.join(__dirname, '..', 'assets', 'scripts_README.md');
|
||||||
break;
|
// break;
|
||||||
case 'dev_workflow.mdc':
|
case 'dev_workflow.mdc':
|
||||||
sourcePath = path.join(
|
sourcePath = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
@@ -219,8 +219,8 @@ function copyTemplateFile(templateName, targetPath, replacements = {}) {
|
|||||||
'self_improve.mdc'
|
'self_improve.mdc'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'README-task-master.md':
|
// case 'README-task-master.md':
|
||||||
sourcePath = path.join(__dirname, '..', 'README-task-master.md');
|
// sourcePath = path.join(__dirname, '..', 'README-task-master.md');
|
||||||
break;
|
break;
|
||||||
case 'windsurfrules':
|
case 'windsurfrules':
|
||||||
sourcePath = path.join(__dirname, '..', 'assets', '.windsurfrules');
|
sourcePath = path.join(__dirname, '..', 'assets', '.windsurfrules');
|
||||||
@@ -351,18 +351,18 @@ async function initializeProject(options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Debug logging only if not in silent mode
|
// Debug logging only if not in silent mode
|
||||||
if (!isSilentMode()) {
|
// if (!isSilentMode()) {
|
||||||
console.log('===== DEBUG: INITIALIZE PROJECT OPTIONS RECEIVED =====');
|
// console.log('===== DEBUG: INITIALIZE PROJECT OPTIONS RECEIVED =====');
|
||||||
console.log('Full options object:', JSON.stringify(options));
|
// console.log('Full options object:', JSON.stringify(options));
|
||||||
console.log('options.yes:', options.yes);
|
// console.log('options.yes:', options.yes);
|
||||||
console.log('==================================================');
|
// console.log('==================================================');
|
||||||
}
|
// }
|
||||||
|
|
||||||
const skipPrompts = options.yes || (options.name && options.description);
|
const skipPrompts = options.yes || (options.name && options.description);
|
||||||
|
|
||||||
if (!isSilentMode()) {
|
// if (!isSilentMode()) {
|
||||||
console.log('Skip prompts determined:', skipPrompts);
|
// console.log('Skip prompts determined:', skipPrompts);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (skipPrompts) {
|
if (skipPrompts) {
|
||||||
if (!isSilentMode()) {
|
if (!isSilentMode()) {
|
||||||
@@ -565,12 +565,12 @@ function createProjectStructure(addAliases, dryRun) {
|
|||||||
path.join(targetDir, 'scripts', 'example_prd.txt')
|
path.join(targetDir, 'scripts', 'example_prd.txt')
|
||||||
);
|
);
|
||||||
|
|
||||||
// Create main README.md
|
// // Create main README.md
|
||||||
copyTemplateFile(
|
// copyTemplateFile(
|
||||||
'README-task-master.md',
|
// 'README-task-master.md',
|
||||||
path.join(targetDir, 'README-task-master.md'),
|
// path.join(targetDir, 'README-task-master.md'),
|
||||||
replacements
|
// replacements
|
||||||
);
|
// );
|
||||||
|
|
||||||
// Initialize git repository if git is available
|
// Initialize git repository if git is available
|
||||||
try {
|
try {
|
||||||
@@ -761,21 +761,22 @@ function setupMCPConfiguration(targetDir) {
|
|||||||
const newMCPServer = {
|
const newMCPServer = {
|
||||||
'task-master-ai': {
|
'task-master-ai': {
|
||||||
command: 'npx',
|
command: 'npx',
|
||||||
args: ['-y', 'task-master-mcp'],
|
args: ['-y', '--package=task-master-ai', 'task-master-ai'],
|
||||||
env: {
|
env: {
|
||||||
ANTHROPIC_API_KEY: 'YOUR_ANTHROPIC_API_KEY',
|
ANTHROPIC_API_KEY: 'ANTHROPIC_API_KEY_HERE',
|
||||||
PERPLEXITY_API_KEY: 'YOUR_PERPLEXITY_API_KEY',
|
PERPLEXITY_API_KEY: 'PERPLEXITY_API_KEY_HERE',
|
||||||
MODEL: 'claude-3-7-sonnet-20250219',
|
OPENAI_API_KEY: 'OPENAI_API_KEY_HERE',
|
||||||
PERPLEXITY_MODEL: 'sonar-pro',
|
GOOGLE_API_KEY: 'GOOGLE_API_KEY_HERE',
|
||||||
MAX_TOKENS: '64000',
|
XAI_API_KEY: 'XAI_API_KEY_HERE',
|
||||||
TEMPERATURE: '0.2',
|
OPENROUTER_API_KEY: 'OPENROUTER_API_KEY_HERE',
|
||||||
DEFAULT_SUBTASKS: '5',
|
MISTRAL_API_KEY: 'MISTRAL_API_KEY_HERE',
|
||||||
DEFAULT_PRIORITY: 'medium'
|
AZURE_OPENAI_API_KEY: 'AZURE_OPENAI_API_KEY_HERE',
|
||||||
|
OLLAMA_API_KEY: 'OLLAMA_API_KEY_HERE'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if mcp.json already exists
|
// Check if mcp.json already existsimage.png
|
||||||
if (fs.existsSync(mcpJsonPath)) {
|
if (fs.existsSync(mcpJsonPath)) {
|
||||||
log(
|
log(
|
||||||
'info',
|
'info',
|
||||||
@@ -795,14 +796,14 @@ function setupMCPConfiguration(targetDir) {
|
|||||||
(server) =>
|
(server) =>
|
||||||
server.args &&
|
server.args &&
|
||||||
server.args.some(
|
server.args.some(
|
||||||
(arg) => typeof arg === 'string' && arg.includes('task-master-mcp')
|
(arg) => typeof arg === 'string' && arg.includes('task-master-ai')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (hasMCPString) {
|
if (hasMCPString) {
|
||||||
log(
|
log(
|
||||||
'info',
|
'info',
|
||||||
'Found existing task-master-mcp configuration in mcp.json, leaving untouched'
|
'Found existing task-master-ai MCP configuration in mcp.json, leaving untouched'
|
||||||
);
|
);
|
||||||
return; // Exit early, don't modify the existing configuration
|
return; // Exit early, don't modify the existing configuration
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ import {
|
|||||||
getResearchModelId,
|
getResearchModelId,
|
||||||
getFallbackProvider,
|
getFallbackProvider,
|
||||||
getFallbackModelId,
|
getFallbackModelId,
|
||||||
getParametersForRole
|
getParametersForRole,
|
||||||
|
getBaseUrlForRole
|
||||||
} from './config-manager.js';
|
} from './config-manager.js';
|
||||||
import { log, resolveEnvVariable, findProjectRoot } from './utils.js';
|
import { log, resolveEnvVariable, findProjectRoot } from './utils.js';
|
||||||
|
|
||||||
@@ -284,7 +285,13 @@ async function _unifiedServiceRunner(serviceType, params) {
|
|||||||
'AI service call failed for all configured roles.';
|
'AI service call failed for all configured roles.';
|
||||||
|
|
||||||
for (const currentRole of sequence) {
|
for (const currentRole of sequence) {
|
||||||
let providerName, modelId, apiKey, roleParams, providerFnSet, providerApiFn;
|
let providerName,
|
||||||
|
modelId,
|
||||||
|
apiKey,
|
||||||
|
roleParams,
|
||||||
|
providerFnSet,
|
||||||
|
providerApiFn,
|
||||||
|
baseUrl;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
log('info', `New AI service call with role: ${currentRole}`);
|
log('info', `New AI service call with role: ${currentRole}`);
|
||||||
@@ -325,6 +332,7 @@ async function _unifiedServiceRunner(serviceType, params) {
|
|||||||
|
|
||||||
// Pass effectiveProjectRoot to getParametersForRole
|
// Pass effectiveProjectRoot to getParametersForRole
|
||||||
roleParams = getParametersForRole(currentRole, effectiveProjectRoot);
|
roleParams = getParametersForRole(currentRole, effectiveProjectRoot);
|
||||||
|
baseUrl = getBaseUrlForRole(currentRole, effectiveProjectRoot);
|
||||||
|
|
||||||
// 2. Get Provider Function Set
|
// 2. Get Provider Function Set
|
||||||
providerFnSet = PROVIDER_FUNCTIONS[providerName?.toLowerCase()];
|
providerFnSet = PROVIDER_FUNCTIONS[providerName?.toLowerCase()];
|
||||||
@@ -401,6 +409,7 @@ async function _unifiedServiceRunner(serviceType, params) {
|
|||||||
maxTokens: roleParams.maxTokens,
|
maxTokens: roleParams.maxTokens,
|
||||||
temperature: roleParams.temperature,
|
temperature: roleParams.temperature,
|
||||||
messages,
|
messages,
|
||||||
|
baseUrl,
|
||||||
...(serviceType === 'generateObject' && { schema, objectName }),
|
...(serviceType === 'generateObject' && { schema, objectName }),
|
||||||
...restApiParams
|
...restApiParams
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import boxen from 'boxen';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import https from 'https';
|
import https from 'https';
|
||||||
import inquirer from 'inquirer';
|
import inquirer from 'inquirer';
|
||||||
|
import ora from 'ora'; // Import ora
|
||||||
|
|
||||||
import { log, readJSON } from './utils.js';
|
import { log, readJSON } from './utils.js';
|
||||||
import {
|
import {
|
||||||
@@ -72,7 +73,11 @@ import {
|
|||||||
getApiKeyStatusReport
|
getApiKeyStatusReport
|
||||||
} from './task-manager/models.js';
|
} from './task-manager/models.js';
|
||||||
import { findProjectRoot } from './utils.js';
|
import { findProjectRoot } from './utils.js';
|
||||||
|
import {
|
||||||
|
isValidTaskStatus,
|
||||||
|
TASK_STATUS_OPTIONS
|
||||||
|
} from '../../src/constants/task-status.js';
|
||||||
|
import { getTaskMasterVersion } from '../../src/utils/getVersion.js';
|
||||||
/**
|
/**
|
||||||
* Runs the interactive setup process for model configuration.
|
* Runs the interactive setup process for model configuration.
|
||||||
* @param {string|null} projectRoot - The resolved project root directory.
|
* @param {string|null} projectRoot - The resolved project root directory.
|
||||||
@@ -485,11 +490,6 @@ function registerCommands(programInstance) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Default help
|
|
||||||
programInstance.on('--help', function () {
|
|
||||||
displayHelp();
|
|
||||||
});
|
|
||||||
|
|
||||||
// parse-prd command
|
// parse-prd command
|
||||||
programInstance
|
programInstance
|
||||||
.command('parse-prd')
|
.command('parse-prd')
|
||||||
@@ -514,80 +514,111 @@ function registerCommands(programInstance) {
|
|||||||
const outputPath = options.output;
|
const outputPath = options.output;
|
||||||
const force = options.force || false;
|
const force = options.force || false;
|
||||||
const append = options.append || false;
|
const append = options.append || false;
|
||||||
|
let useForce = force;
|
||||||
|
let useAppend = false;
|
||||||
|
|
||||||
// Helper function to check if tasks.json exists and confirm overwrite
|
// Helper function to check if tasks.json exists and confirm overwrite
|
||||||
async function confirmOverwriteIfNeeded() {
|
async function confirmOverwriteIfNeeded() {
|
||||||
if (fs.existsSync(outputPath) && !force && !append) {
|
if (fs.existsSync(outputPath) && !useForce && !useAppend) {
|
||||||
const shouldContinue = await confirmTaskOverwrite(outputPath);
|
const overwrite = await confirmTaskOverwrite(outputPath);
|
||||||
if (!shouldContinue) {
|
if (!overwrite) {
|
||||||
console.log(chalk.yellow('Operation cancelled by user.'));
|
log('info', 'Operation cancelled.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// If user confirms 'y', we should set useForce = true for the parsePRD call
|
||||||
|
// Only overwrite if not appending
|
||||||
|
useForce = true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no input file specified, check for default PRD location
|
let spinner;
|
||||||
if (!inputFile) {
|
|
||||||
if (fs.existsSync(defaultPrdPath)) {
|
|
||||||
console.log(chalk.blue(`Using default PRD file: ${defaultPrdPath}`));
|
|
||||||
|
|
||||||
// Check for existing tasks.json before proceeding
|
try {
|
||||||
if (!(await confirmOverwriteIfNeeded())) return;
|
if (!inputFile) {
|
||||||
|
if (fs.existsSync(defaultPrdPath)) {
|
||||||
|
console.log(
|
||||||
|
chalk.blue(`Using default PRD file path: ${defaultPrdPath}`)
|
||||||
|
);
|
||||||
|
if (!(await confirmOverwriteIfNeeded())) return;
|
||||||
|
|
||||||
console.log(chalk.blue(`Generating ${numTasks} tasks...`));
|
console.log(chalk.blue(`Generating ${numTasks} tasks...`));
|
||||||
await parsePRD(defaultPrdPath, outputPath, numTasks, { append });
|
spinner = ora('Parsing PRD and generating tasks...').start();
|
||||||
|
await parsePRD(defaultPrdPath, outputPath, numTasks, {
|
||||||
|
useAppend,
|
||||||
|
useForce
|
||||||
|
});
|
||||||
|
spinner.succeed('Tasks generated successfully!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
chalk.yellow(
|
||||||
|
'No PRD file specified and default PRD file not found at scripts/prd.txt.'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
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' +
|
||||||
|
' -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' +
|
||||||
|
' -f, --force Skip confirmation when overwriting existing tasks\n' +
|
||||||
|
' --append Append new tasks to existing tasks.json instead of overwriting\n\n' +
|
||||||
|
chalk.cyan('Example:') +
|
||||||
|
'\n' +
|
||||||
|
' task-master parse-prd requirements.txt --num-tasks 15\n' +
|
||||||
|
' task-master parse-prd --input=requirements.txt\n' +
|
||||||
|
' task-master parse-prd --force\n' +
|
||||||
|
' task-master parse-prd requirements_v2.txt --append\n\n' +
|
||||||
|
chalk.yellow('Note: This command will:') +
|
||||||
|
'\n' +
|
||||||
|
' 1. Look for a PRD file at scripts/prd.txt by default\n' +
|
||||||
|
' 2. Use the file specified by --input or positional argument if provided\n' +
|
||||||
|
' 3. Generate tasks from the PRD and either:\n' +
|
||||||
|
' - Overwrite any existing tasks.json file (default)\n' +
|
||||||
|
' - Append to existing tasks.json if --append is used',
|
||||||
|
{ padding: 1, borderColor: 'blue', borderStyle: 'round' }
|
||||||
|
)
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
if (!fs.existsSync(inputFile)) {
|
||||||
chalk.yellow(
|
console.error(
|
||||||
'No PRD file specified and default PRD file not found at scripts/prd.txt.'
|
chalk.red(`Error: Input PRD file not found: ${inputFile}`)
|
||||||
)
|
);
|
||||||
);
|
process.exit(1);
|
||||||
console.log(
|
}
|
||||||
boxen(
|
|
||||||
chalk.white.bold('Parse PRD Help') +
|
if (!(await confirmOverwriteIfNeeded())) return;
|
||||||
'\n\n' +
|
|
||||||
chalk.cyan('Usage:') +
|
console.log(chalk.blue(`Parsing PRD file: ${inputFile}`));
|
||||||
'\n' +
|
console.log(chalk.blue(`Generating ${numTasks} tasks...`));
|
||||||
` task-master parse-prd <prd-file.txt> [options]\n\n` +
|
if (append) {
|
||||||
chalk.cyan('Options:') +
|
console.log(chalk.blue('Appending to existing tasks...'));
|
||||||
'\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' +
|
spinner = ora('Parsing PRD and generating tasks...').start();
|
||||||
' -n, --num-tasks <number> Number of tasks to generate (default: 10)\n' +
|
await parsePRD(inputFile, outputPath, numTasks, {
|
||||||
' -f, --force Skip confirmation when overwriting existing tasks\n' +
|
append: useAppend,
|
||||||
' --append Append new tasks to existing tasks.json instead of overwriting\n\n' +
|
useForce
|
||||||
chalk.cyan('Example:') +
|
});
|
||||||
'\n' +
|
spinner.succeed('Tasks generated successfully!');
|
||||||
' task-master parse-prd requirements.txt --num-tasks 15\n' +
|
} catch (error) {
|
||||||
' task-master parse-prd --input=requirements.txt\n' +
|
if (spinner) {
|
||||||
' task-master parse-prd --force\n' +
|
spinner.fail(`Error parsing PRD: ${error.message}`);
|
||||||
' task-master parse-prd requirements_v2.txt --append\n\n' +
|
} else {
|
||||||
chalk.yellow('Note: This command will:') +
|
console.error(chalk.red(`Error parsing PRD: ${error.message}`));
|
||||||
'\n' +
|
}
|
||||||
' 1. Look for a PRD file at scripts/prd.txt by default\n' +
|
process.exit(1);
|
||||||
' 2. Use the file specified by --input or positional argument if provided\n' +
|
|
||||||
' 3. Generate tasks from the PRD and either:\n' +
|
|
||||||
' - Overwrite any existing tasks.json file (default)\n' +
|
|
||||||
' - Append to existing tasks.json if --append is used',
|
|
||||||
{ padding: 1, borderColor: 'blue', borderStyle: 'round' }
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for existing tasks.json before proceeding with specified input file
|
|
||||||
if (!(await confirmOverwriteIfNeeded())) return;
|
|
||||||
|
|
||||||
console.log(chalk.blue(`Parsing PRD file: ${inputFile}`));
|
|
||||||
console.log(chalk.blue(`Generating ${numTasks} tasks...`));
|
|
||||||
if (append) {
|
|
||||||
console.log(chalk.blue('Appending to existing tasks...'));
|
|
||||||
}
|
|
||||||
|
|
||||||
await parsePRD(inputFile, outputPath, numTasks, { append });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// update command
|
// update command
|
||||||
@@ -1006,7 +1037,7 @@ function registerCommands(programInstance) {
|
|||||||
)
|
)
|
||||||
.option(
|
.option(
|
||||||
'-s, --status <status>',
|
'-s, --status <status>',
|
||||||
'New status (todo, in-progress, review, done)'
|
`New status (one of: ${TASK_STATUS_OPTIONS.join(', ')})`
|
||||||
)
|
)
|
||||||
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
||||||
.action(async (options) => {
|
.action(async (options) => {
|
||||||
@@ -1019,6 +1050,16 @@ function registerCommands(programInstance) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isValidTaskStatus(status)) {
|
||||||
|
console.error(
|
||||||
|
chalk.red(
|
||||||
|
`Error: Invalid status value: ${status}. Use one of: ${TASK_STATUS_OPTIONS.join(', ')}`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
chalk.blue(`Setting status of task(s) ${taskId} to: ${status}`)
|
chalk.blue(`Setting status of task(s) ${taskId} to: ${status}`)
|
||||||
);
|
);
|
||||||
@@ -1246,10 +1287,6 @@ function registerCommands(programInstance) {
|
|||||||
'--details <details>',
|
'--details <details>',
|
||||||
'Implementation details (for manual task creation)'
|
'Implementation details (for manual task creation)'
|
||||||
)
|
)
|
||||||
.option(
|
|
||||||
'--test-strategy <testStrategy>',
|
|
||||||
'Test strategy (for manual task creation)'
|
|
||||||
)
|
|
||||||
.option(
|
.option(
|
||||||
'--dependencies <dependencies>',
|
'--dependencies <dependencies>',
|
||||||
'Comma-separated list of task IDs this task depends on'
|
'Comma-separated list of task IDs this task depends on'
|
||||||
@@ -1631,6 +1668,7 @@ function registerCommands(programInstance) {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(chalk.red(`Error: ${error.message}`));
|
console.error(chalk.red(`Error: ${error.message}`));
|
||||||
|
showAddSubtaskHelp();
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -2334,14 +2372,7 @@ function setupCLI() {
|
|||||||
return 'unknown'; // Default fallback if package.json fails
|
return 'unknown'; // Default fallback if package.json fails
|
||||||
})
|
})
|
||||||
.helpOption('-h, --help', 'Display help')
|
.helpOption('-h, --help', 'Display help')
|
||||||
.addHelpCommand(false) // Disable default help command
|
.addHelpCommand(false); // Disable default help command
|
||||||
.on('--help', () => {
|
|
||||||
displayHelp(); // Use your custom help display instead
|
|
||||||
})
|
|
||||||
.on('-h', () => {
|
|
||||||
displayHelp();
|
|
||||||
process.exit(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Modify the help option to use your custom display
|
// Modify the help option to use your custom display
|
||||||
programInstance.helpInformation = () => {
|
programInstance.helpInformation = () => {
|
||||||
@@ -2361,28 +2392,7 @@ function setupCLI() {
|
|||||||
*/
|
*/
|
||||||
async function checkForUpdate() {
|
async function checkForUpdate() {
|
||||||
// Get current version from package.json ONLY
|
// Get current version from package.json ONLY
|
||||||
let currentVersion = 'unknown'; // Initialize with a default
|
const currentVersion = getTaskMasterVersion();
|
||||||
try {
|
|
||||||
// Try to get the version from the installed package (if applicable) or current dir
|
|
||||||
let packageJsonPath = path.join(
|
|
||||||
process.cwd(),
|
|
||||||
'node_modules',
|
|
||||||
'task-master-ai',
|
|
||||||
'package.json'
|
|
||||||
);
|
|
||||||
// Fallback to current directory package.json if not found in node_modules
|
|
||||||
if (!fs.existsSync(packageJsonPath)) {
|
|
||||||
packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fs.existsSync(packageJsonPath)) {
|
|
||||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
||||||
currentVersion = packageJson.version;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
// Silently fail and use default
|
|
||||||
log('debug', `Error reading current package version: ${error.message}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
// Get the latest version from npm registry
|
// Get the latest version from npm registry
|
||||||
|
|||||||
@@ -677,6 +677,13 @@ function getAllProviders() {
|
|||||||
return Object.keys(MODEL_MAP || {});
|
return Object.keys(MODEL_MAP || {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBaseUrlForRole(role, explicitRoot = null) {
|
||||||
|
const roleConfig = getModelConfigForRole(role, explicitRoot);
|
||||||
|
return roleConfig && typeof roleConfig.baseUrl === 'string'
|
||||||
|
? roleConfig.baseUrl
|
||||||
|
: undefined;
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
// Core config access
|
// Core config access
|
||||||
getConfig,
|
getConfig,
|
||||||
@@ -704,6 +711,7 @@ export {
|
|||||||
getFallbackModelId,
|
getFallbackModelId,
|
||||||
getFallbackMaxTokens,
|
getFallbackMaxTokens,
|
||||||
getFallbackTemperature,
|
getFallbackTemperature,
|
||||||
|
getBaseUrlForRole,
|
||||||
|
|
||||||
// Global setting getters (No env var overrides)
|
// Global setting getters (No env var overrides)
|
||||||
getLogLevel,
|
getLogLevel,
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ async function addDependency(tasksPath, taskId, dependencyId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate updated task files
|
// Generate updated task files
|
||||||
await generateTaskFiles(tasksPath, 'tasks');
|
await generateTaskFiles(tasksPath, path.dirname(tasksPath));
|
||||||
|
|
||||||
log('info', 'Task files regenerated with updated dependencies.');
|
log('info', 'Task files regenerated with updated dependencies.');
|
||||||
} else {
|
} else {
|
||||||
@@ -334,7 +334,7 @@ async function removeDependency(tasksPath, taskId, dependencyId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Regenerate task files
|
// Regenerate task files
|
||||||
await generateTaskFiles(tasksPath, 'tasks');
|
await generateTaskFiles(tasksPath, path.dirname(tasksPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,20 +13,6 @@
|
|||||||
"cost_per_1m_tokens": { "input": 3.0, "output": 15.0 },
|
"cost_per_1m_tokens": { "input": 3.0, "output": 15.0 },
|
||||||
"allowed_roles": ["main", "fallback"],
|
"allowed_roles": ["main", "fallback"],
|
||||||
"max_tokens": 64000
|
"max_tokens": 64000
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "claude-3-5-haiku-20241022",
|
|
||||||
"swe_score": 0.406,
|
|
||||||
"cost_per_1m_tokens": { "input": 0.8, "output": 4.0 },
|
|
||||||
"allowed_roles": ["main", "fallback"],
|
|
||||||
"max_tokens": 64000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "claude-3-opus-20240229",
|
|
||||||
"swe_score": 0,
|
|
||||||
"cost_per_1m_tokens": { "input": 15, "output": 75 },
|
|
||||||
"allowed_roles": ["main", "fallback"],
|
|
||||||
"max_tokens": 64000
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"openai": [
|
"openai": [
|
||||||
@@ -41,7 +27,7 @@
|
|||||||
"id": "o1",
|
"id": "o1",
|
||||||
"swe_score": 0.489,
|
"swe_score": 0.489,
|
||||||
"cost_per_1m_tokens": { "input": 15.0, "output": 60.0 },
|
"cost_per_1m_tokens": { "input": 15.0, "output": 60.0 },
|
||||||
"allowed_roles": ["main", "fallback"]
|
"allowed_roles": ["main"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "o3",
|
"id": "o3",
|
||||||
@@ -53,7 +39,7 @@
|
|||||||
"id": "o3-mini",
|
"id": "o3-mini",
|
||||||
"swe_score": 0.493,
|
"swe_score": 0.493,
|
||||||
"cost_per_1m_tokens": { "input": 1.1, "output": 4.4 },
|
"cost_per_1m_tokens": { "input": 1.1, "output": 4.4 },
|
||||||
"allowed_roles": ["main", "fallback"],
|
"allowed_roles": ["main"],
|
||||||
"max_tokens": 100000
|
"max_tokens": 100000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -66,49 +52,49 @@
|
|||||||
"id": "o1-mini",
|
"id": "o1-mini",
|
||||||
"swe_score": 0.4,
|
"swe_score": 0.4,
|
||||||
"cost_per_1m_tokens": { "input": 1.1, "output": 4.4 },
|
"cost_per_1m_tokens": { "input": 1.1, "output": 4.4 },
|
||||||
"allowed_roles": ["main", "fallback"]
|
"allowed_roles": ["main"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "o1-pro",
|
"id": "o1-pro",
|
||||||
"swe_score": 0,
|
"swe_score": 0,
|
||||||
"cost_per_1m_tokens": { "input": 150.0, "output": 600.0 },
|
"cost_per_1m_tokens": { "input": 150.0, "output": 600.0 },
|
||||||
"allowed_roles": ["main", "fallback"]
|
"allowed_roles": ["main"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "gpt-4-5-preview",
|
"id": "gpt-4-5-preview",
|
||||||
"swe_score": 0.38,
|
"swe_score": 0.38,
|
||||||
"cost_per_1m_tokens": { "input": 75.0, "output": 150.0 },
|
"cost_per_1m_tokens": { "input": 75.0, "output": 150.0 },
|
||||||
"allowed_roles": ["main", "fallback"]
|
"allowed_roles": ["main"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "gpt-4-1-mini",
|
"id": "gpt-4-1-mini",
|
||||||
"swe_score": 0,
|
"swe_score": 0,
|
||||||
"cost_per_1m_tokens": { "input": 0.4, "output": 1.6 },
|
"cost_per_1m_tokens": { "input": 0.4, "output": 1.6 },
|
||||||
"allowed_roles": ["main", "fallback"]
|
"allowed_roles": ["main"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "gpt-4-1-nano",
|
"id": "gpt-4-1-nano",
|
||||||
"swe_score": 0,
|
"swe_score": 0,
|
||||||
"cost_per_1m_tokens": { "input": 0.1, "output": 0.4 },
|
"cost_per_1m_tokens": { "input": 0.1, "output": 0.4 },
|
||||||
"allowed_roles": ["main", "fallback"]
|
"allowed_roles": ["main"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "gpt-4o-mini",
|
"id": "gpt-4o-mini",
|
||||||
"swe_score": 0.3,
|
"swe_score": 0.3,
|
||||||
"cost_per_1m_tokens": { "input": 0.15, "output": 0.6 },
|
"cost_per_1m_tokens": { "input": 0.15, "output": 0.6 },
|
||||||
"allowed_roles": ["main", "fallback"]
|
"allowed_roles": ["main"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "gpt-4o-search-preview",
|
"id": "gpt-4o-search-preview",
|
||||||
"swe_score": 0.33,
|
"swe_score": 0.33,
|
||||||
"cost_per_1m_tokens": { "input": 2.5, "output": 10.0 },
|
"cost_per_1m_tokens": { "input": 2.5, "output": 10.0 },
|
||||||
"allowed_roles": ["main", "fallback", "research"]
|
"allowed_roles": ["research"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "gpt-4o-mini-search-preview",
|
"id": "gpt-4o-mini-search-preview",
|
||||||
"swe_score": 0.3,
|
"swe_score": 0.3,
|
||||||
"cost_per_1m_tokens": { "input": 0.15, "output": 0.6 },
|
"cost_per_1m_tokens": { "input": 0.15, "output": 0.6 },
|
||||||
"allowed_roles": ["main", "fallback", "research"]
|
"allowed_roles": ["research"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"google": [
|
"google": [
|
||||||
@@ -189,14 +175,6 @@
|
|||||||
"allowed_roles": ["main", "fallback", "research"],
|
"allowed_roles": ["main", "fallback", "research"],
|
||||||
"max_tokens": 131072
|
"max_tokens": 131072
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "grok-3-mini",
|
|
||||||
"name": "Grok 3 Mini",
|
|
||||||
"swe_score": 0,
|
|
||||||
"cost_per_1m_tokens": { "input": 0.3, "output": 0.5 },
|
|
||||||
"allowed_roles": ["main", "fallback", "research"],
|
|
||||||
"max_tokens": 131072
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "grok-3-fast",
|
"id": "grok-3-fast",
|
||||||
"name": "Grok 3 Fast",
|
"name": "Grok 3 Fast",
|
||||||
@@ -204,13 +182,6 @@
|
|||||||
"cost_per_1m_tokens": { "input": 5, "output": 25 },
|
"cost_per_1m_tokens": { "input": 5, "output": 25 },
|
||||||
"allowed_roles": ["main", "fallback", "research"],
|
"allowed_roles": ["main", "fallback", "research"],
|
||||||
"max_tokens": 131072
|
"max_tokens": 131072
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "grok-3-mini-fast",
|
|
||||||
"swe_score": 0,
|
|
||||||
"cost_per_1m_tokens": { "input": 0.6, "output": 4 },
|
|
||||||
"allowed_roles": ["main", "fallback", "research"],
|
|
||||||
"max_tokens": 131072
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"ollama": [
|
"ollama": [
|
||||||
@@ -283,7 +254,7 @@
|
|||||||
"id": "deepseek/deepseek-chat-v3-0324",
|
"id": "deepseek/deepseek-chat-v3-0324",
|
||||||
"swe_score": 0,
|
"swe_score": 0,
|
||||||
"cost_per_1m_tokens": { "input": 0.27, "output": 1.1 },
|
"cost_per_1m_tokens": { "input": 0.27, "output": 1.1 },
|
||||||
"allowed_roles": ["main", "fallback"],
|
"allowed_roles": ["main"],
|
||||||
"max_tokens": 64000
|
"max_tokens": 64000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -312,14 +283,14 @@
|
|||||||
"id": "google/gemini-2.5-flash-preview",
|
"id": "google/gemini-2.5-flash-preview",
|
||||||
"swe_score": 0,
|
"swe_score": 0,
|
||||||
"cost_per_1m_tokens": { "input": 0.15, "output": 0.6 },
|
"cost_per_1m_tokens": { "input": 0.15, "output": 0.6 },
|
||||||
"allowed_roles": ["main", "fallback"],
|
"allowed_roles": ["main"],
|
||||||
"max_tokens": 65535
|
"max_tokens": 65535
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "google/gemini-2.5-flash-preview:thinking",
|
"id": "google/gemini-2.5-flash-preview:thinking",
|
||||||
"swe_score": 0,
|
"swe_score": 0,
|
||||||
"cost_per_1m_tokens": { "input": 0.15, "output": 3.5 },
|
"cost_per_1m_tokens": { "input": 0.15, "output": 3.5 },
|
||||||
"allowed_roles": ["main", "fallback"],
|
"allowed_roles": ["main"],
|
||||||
"max_tokens": 65535
|
"max_tokens": 65535
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import chalk from 'chalk';
|
|||||||
import boxen from 'boxen';
|
import boxen from 'boxen';
|
||||||
import Table from 'cli-table3';
|
import Table from 'cli-table3';
|
||||||
|
|
||||||
import { log, readJSON, writeJSON, truncate } from '../utils.js';
|
import { log, readJSON, writeJSON, truncate, isSilentMode } from '../utils.js';
|
||||||
import { displayBanner } from '../ui.js';
|
import { displayBanner } from '../ui.js';
|
||||||
import generateTaskFiles from './generate-task-files.js';
|
import generateTaskFiles from './generate-task-files.js';
|
||||||
|
|
||||||
@@ -22,14 +22,16 @@ function clearSubtasks(tasksPath, taskIds) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
if (!isSilentMode()) {
|
||||||
boxen(chalk.white.bold('Clearing Subtasks'), {
|
console.log(
|
||||||
padding: 1,
|
boxen(chalk.white.bold('Clearing Subtasks'), {
|
||||||
borderColor: 'blue',
|
padding: 1,
|
||||||
borderStyle: 'round',
|
borderColor: 'blue',
|
||||||
margin: { top: 1, bottom: 1 }
|
borderStyle: 'round',
|
||||||
})
|
margin: { top: 1, bottom: 1 }
|
||||||
);
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle multiple task IDs (comma-separated)
|
// Handle multiple task IDs (comma-separated)
|
||||||
const taskIdArray = taskIds.split(',').map((id) => id.trim());
|
const taskIdArray = taskIds.split(',').map((id) => id.trim());
|
||||||
@@ -85,59 +87,65 @@ function clearSubtasks(tasksPath, taskIds) {
|
|||||||
writeJSON(tasksPath, data);
|
writeJSON(tasksPath, data);
|
||||||
|
|
||||||
// Show summary table
|
// Show summary table
|
||||||
console.log(
|
if (!isSilentMode()) {
|
||||||
boxen(chalk.white.bold('Subtask Clearing Summary:'), {
|
console.log(
|
||||||
padding: { left: 2, right: 2, top: 0, bottom: 0 },
|
boxen(chalk.white.bold('Subtask Clearing Summary:'), {
|
||||||
margin: { top: 1, bottom: 0 },
|
padding: { left: 2, right: 2, top: 0, bottom: 0 },
|
||||||
borderColor: 'blue',
|
margin: { top: 1, bottom: 0 },
|
||||||
borderStyle: 'round'
|
borderColor: 'blue',
|
||||||
})
|
borderStyle: 'round'
|
||||||
);
|
})
|
||||||
console.log(summaryTable.toString());
|
);
|
||||||
|
console.log(summaryTable.toString());
|
||||||
|
}
|
||||||
|
|
||||||
// Regenerate task files to reflect changes
|
// Regenerate task files to reflect changes
|
||||||
log('info', 'Regenerating task files...');
|
log('info', 'Regenerating task files...');
|
||||||
generateTaskFiles(tasksPath, path.dirname(tasksPath));
|
generateTaskFiles(tasksPath, path.dirname(tasksPath));
|
||||||
|
|
||||||
// Success message
|
// Success message
|
||||||
console.log(
|
if (!isSilentMode()) {
|
||||||
boxen(
|
console.log(
|
||||||
chalk.green(
|
boxen(
|
||||||
`Successfully cleared subtasks from ${chalk.bold(clearedCount)} task(s)`
|
chalk.green(
|
||||||
),
|
`Successfully cleared subtasks from ${chalk.bold(clearedCount)} task(s)`
|
||||||
{
|
),
|
||||||
padding: 1,
|
{
|
||||||
borderColor: 'green',
|
padding: 1,
|
||||||
borderStyle: 'round',
|
borderColor: 'green',
|
||||||
margin: { top: 1 }
|
borderStyle: 'round',
|
||||||
}
|
margin: { top: 1 }
|
||||||
)
|
}
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Next steps suggestion
|
// Next steps suggestion
|
||||||
console.log(
|
console.log(
|
||||||
boxen(
|
boxen(
|
||||||
chalk.white.bold('Next Steps:') +
|
chalk.white.bold('Next Steps:') +
|
||||||
'\n\n' +
|
'\n\n' +
|
||||||
`${chalk.cyan('1.')} Run ${chalk.yellow('task-master expand --id=<id>')} to generate new subtasks\n` +
|
`${chalk.cyan('1.')} Run ${chalk.yellow('task-master expand --id=<id>')} to generate new subtasks\n` +
|
||||||
`${chalk.cyan('2.')} Run ${chalk.yellow('task-master list --with-subtasks')} to verify changes`,
|
`${chalk.cyan('2.')} Run ${chalk.yellow('task-master list --with-subtasks')} to verify changes`,
|
||||||
{
|
{
|
||||||
|
padding: 1,
|
||||||
|
borderColor: 'cyan',
|
||||||
|
borderStyle: 'round',
|
||||||
|
margin: { top: 1 }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!isSilentMode()) {
|
||||||
|
console.log(
|
||||||
|
boxen(chalk.yellow('No subtasks were cleared'), {
|
||||||
padding: 1,
|
padding: 1,
|
||||||
borderColor: 'cyan',
|
borderColor: 'yellow',
|
||||||
borderStyle: 'round',
|
borderStyle: 'round',
|
||||||
margin: { top: 1 }
|
margin: { top: 1 }
|
||||||
}
|
})
|
||||||
)
|
);
|
||||||
);
|
}
|
||||||
} else {
|
|
||||||
console.log(
|
|
||||||
boxen(chalk.yellow('No subtasks were cleared'), {
|
|
||||||
padding: 1,
|
|
||||||
borderColor: 'yellow',
|
|
||||||
borderStyle: 'round',
|
|
||||||
margin: { top: 1 }
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ import { validateTaskDependencies } from '../dependency-manager.js';
|
|||||||
import { getDebugFlag } from '../config-manager.js';
|
import { getDebugFlag } from '../config-manager.js';
|
||||||
import updateSingleTaskStatus from './update-single-task-status.js';
|
import updateSingleTaskStatus from './update-single-task-status.js';
|
||||||
import generateTaskFiles from './generate-task-files.js';
|
import generateTaskFiles from './generate-task-files.js';
|
||||||
|
import {
|
||||||
|
isValidTaskStatus,
|
||||||
|
TASK_STATUS_OPTIONS
|
||||||
|
} from '../../../src/constants/task-status.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the status of a task
|
* Set the status of a task
|
||||||
@@ -19,6 +23,11 @@ import generateTaskFiles from './generate-task-files.js';
|
|||||||
*/
|
*/
|
||||||
async function setTaskStatus(tasksPath, taskIdInput, newStatus, options = {}) {
|
async function setTaskStatus(tasksPath, taskIdInput, newStatus, options = {}) {
|
||||||
try {
|
try {
|
||||||
|
if (!isValidTaskStatus(newStatus)) {
|
||||||
|
throw new Error(
|
||||||
|
`Error: Invalid status value: ${newStatus}. Use one of: ${TASK_STATUS_OPTIONS.join(', ')}`
|
||||||
|
);
|
||||||
|
}
|
||||||
// Determine if we're in MCP mode by checking for mcpLog
|
// Determine if we're in MCP mode by checking for mcpLog
|
||||||
const isMcpMode = !!options?.mcpLog;
|
const isMcpMode = !!options?.mcpLog;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
|
|
||||||
import { log } from '../utils.js';
|
import { log } from '../utils.js';
|
||||||
|
import { isValidTaskStatus } from '../../../src/constants/task-status.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the status of a single task
|
* Update the status of a single task
|
||||||
@@ -17,6 +18,12 @@ async function updateSingleTaskStatus(
|
|||||||
data,
|
data,
|
||||||
showUi = true
|
showUi = true
|
||||||
) {
|
) {
|
||||||
|
if (!isValidTaskStatus(newStatus)) {
|
||||||
|
throw new Error(
|
||||||
|
`Error: Invalid status value: ${newStatus}. Use one of: ${TASK_STATUS_OPTIONS.join(', ')}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if it's a subtask (e.g., "1.2")
|
// Check if it's a subtask (e.g., "1.2")
|
||||||
if (taskIdInput.includes('.')) {
|
if (taskIdInput.includes('.')) {
|
||||||
const [parentId, subtaskId] = taskIdInput
|
const [parentId, subtaskId] = taskIdInput
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import path from 'path';
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import boxen from 'boxen';
|
import boxen from 'boxen';
|
||||||
import Table from 'cli-table3';
|
import Table from 'cli-table3';
|
||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getStatusWithColor,
|
getStatusWithColor,
|
||||||
@@ -16,7 +17,10 @@ import {
|
|||||||
truncate,
|
truncate,
|
||||||
isSilentMode
|
isSilentMode
|
||||||
} from '../utils.js';
|
} from '../utils.js';
|
||||||
import { generateTextService } from '../ai-services-unified.js';
|
import {
|
||||||
|
generateObjectService,
|
||||||
|
generateTextService
|
||||||
|
} from '../ai-services-unified.js';
|
||||||
import { getDebugFlag } from '../config-manager.js';
|
import { getDebugFlag } from '../config-manager.js';
|
||||||
import generateTaskFiles from './generate-task-files.js';
|
import generateTaskFiles from './generate-task-files.js';
|
||||||
|
|
||||||
@@ -131,6 +135,17 @@ async function updateSubtaskById(
|
|||||||
|
|
||||||
const subtask = parentTask.subtasks[subtaskIndex];
|
const subtask = parentTask.subtasks[subtaskIndex];
|
||||||
|
|
||||||
|
const subtaskSchema = z.object({
|
||||||
|
id: z.number().int().positive(),
|
||||||
|
title: z.string(),
|
||||||
|
description: z.string().optional(),
|
||||||
|
status: z.string(),
|
||||||
|
dependencies: z.array(z.union([z.string(), z.number()])).optional(),
|
||||||
|
priority: z.string().optional(),
|
||||||
|
details: z.string().optional(),
|
||||||
|
testStrategy: z.string().optional()
|
||||||
|
});
|
||||||
|
|
||||||
// Only show UI elements for text output (CLI)
|
// Only show UI elements for text output (CLI)
|
||||||
if (outputFormat === 'text') {
|
if (outputFormat === 'text') {
|
||||||
// Show the subtask that will be updated
|
// Show the subtask that will be updated
|
||||||
@@ -168,101 +183,155 @@ async function updateSubtaskById(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let additionalInformation = '';
|
let parsedAIResponse;
|
||||||
try {
|
try {
|
||||||
// Build Prompts
|
// --- GET PARENT & SIBLING CONTEXT ---
|
||||||
const systemPrompt = `You are an AI assistant helping to update a software development subtask. Your goal is to APPEND new information to the existing details, not replace them. Add a timestamp.
|
const parentContext = {
|
||||||
|
id: parentTask.id,
|
||||||
|
title: parentTask.title
|
||||||
|
// Avoid sending full parent description/details unless necessary
|
||||||
|
};
|
||||||
|
|
||||||
|
const prevSubtask =
|
||||||
|
subtaskIndex > 0
|
||||||
|
? {
|
||||||
|
id: `${parentTask.id}.${parentTask.subtasks[subtaskIndex - 1].id}`,
|
||||||
|
title: parentTask.subtasks[subtaskIndex - 1].title,
|
||||||
|
status: parentTask.subtasks[subtaskIndex - 1].status
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const nextSubtask =
|
||||||
|
subtaskIndex < parentTask.subtasks.length - 1
|
||||||
|
? {
|
||||||
|
id: `${parentTask.id}.${parentTask.subtasks[subtaskIndex + 1].id}`,
|
||||||
|
title: parentTask.subtasks[subtaskIndex + 1].title,
|
||||||
|
status: parentTask.subtasks[subtaskIndex + 1].status
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const contextString = `
|
||||||
|
Parent Task: ${JSON.stringify(parentContext)}
|
||||||
|
${prevSubtask ? `Previous Subtask: ${JSON.stringify(prevSubtask)}` : ''}
|
||||||
|
${nextSubtask ? `Next Subtask: ${JSON.stringify(nextSubtask)}` : ''}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const systemPrompt = `You are an AI assistant updating a parent task's subtask. This subtask will be part of a larger parent task and will be used to direct AI agents to complete the subtask. Your goal is to GENERATE new, relevant information based on the user's request (which may be high-level, mid-level or low-level) and APPEND it to the existing subtask 'details' field, wrapped in specific XML-like tags with an ISO 8601 timestamp. Intelligently determine the level of detail to include based on the user's request. Some requests are meant simply to update the subtask with some mid-implementation details, while others are meant to update the subtask with a detailed plan or strategy.
|
||||||
|
|
||||||
|
Context Provided:
|
||||||
|
- The current subtask object.
|
||||||
|
- Basic info about the parent task (ID, title).
|
||||||
|
- Basic info about the immediately preceding subtask (ID, title, status), if it exists.
|
||||||
|
- Basic info about the immediately succeeding subtask (ID, title, status), if it exists.
|
||||||
|
- A user request string.
|
||||||
|
|
||||||
Guidelines:
|
Guidelines:
|
||||||
1. Identify the existing 'details' field in the subtask JSON.
|
1. Analyze the user request considering the provided subtask details AND the context of the parent and sibling tasks.
|
||||||
2. Create a new timestamp string in the format: '[YYYY-MM-DD HH:MM:SS]'.
|
2. GENERATE new, relevant text content that should be added to the 'details' field. Focus *only* on the substance of the update based on the user request and context. Do NOT add timestamps or any special formatting yourself. Avoid over-engineering the details, provide .
|
||||||
3. Append the new timestamp and the information from the user prompt to the *end* of the existing 'details' field.
|
3. Update the 'details' field in the subtask object with the GENERATED text content. It's okay if this overwrites previous details in the object you return, as the calling code will handle the final appending.
|
||||||
4. Ensure the final 'details' field is a single, coherent string with the new information added.
|
4. Return the *entire* updated subtask object (with your generated content in the 'details' field) as a valid JSON object conforming to the provided schema. Do NOT return explanations or markdown formatting.`;
|
||||||
5. Return the *entire* subtask object as a valid JSON, including the updated 'details' field and all other original fields (id, title, status, dependencies, etc.).`;
|
|
||||||
const subtaskDataString = JSON.stringify(subtask, null, 2);
|
const subtaskDataString = JSON.stringify(subtask, null, 2);
|
||||||
const userPrompt = `Here is the subtask to update:\n${subtaskDataString}\n\nPlease APPEND the following information to the 'details' field, preceded by a timestamp:\n${prompt}\n\nReturn only the updated subtask as a single, valid JSON object.`;
|
// Updated user prompt including context
|
||||||
|
const userPrompt = `Task Context:\n${contextString}\nCurrent Subtask:\n${subtaskDataString}\n\nUser Request: "${prompt}"\n\nPlease GENERATE new, relevant text content for the 'details' field based on the user request and the provided context. Return the entire updated subtask object as a valid JSON object matching the schema, with the newly generated text placed in the 'details' field.`;
|
||||||
|
// --- END UPDATED PROMPTS ---
|
||||||
|
|
||||||
// Call Unified AI Service
|
// Call Unified AI Service using generateObjectService
|
||||||
const role = useResearch ? 'research' : 'main';
|
const role = useResearch ? 'research' : 'main';
|
||||||
report('info', `Using AI service with role: ${role}`);
|
report('info', `Using AI object service with role: ${role}`);
|
||||||
|
|
||||||
const responseText = await generateTextService({
|
parsedAIResponse = await generateObjectService({
|
||||||
prompt: userPrompt,
|
prompt: userPrompt,
|
||||||
systemPrompt: systemPrompt,
|
systemPrompt: systemPrompt,
|
||||||
|
schema: subtaskSchema,
|
||||||
|
objectName: 'updatedSubtask',
|
||||||
role,
|
role,
|
||||||
session,
|
session,
|
||||||
projectRoot
|
projectRoot,
|
||||||
|
maxRetries: 2
|
||||||
});
|
});
|
||||||
report('success', 'Successfully received text response from AI service');
|
report(
|
||||||
|
'success',
|
||||||
|
'Successfully received object response from AI service'
|
||||||
|
);
|
||||||
|
|
||||||
if (outputFormat === 'text' && loadingIndicator) {
|
if (outputFormat === 'text' && loadingIndicator) {
|
||||||
// Stop indicator immediately since generateText is blocking
|
|
||||||
stopLoadingIndicator(loadingIndicator);
|
stopLoadingIndicator(loadingIndicator);
|
||||||
loadingIndicator = null;
|
loadingIndicator = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign the result directly (generateTextService returns the text string)
|
if (!parsedAIResponse || typeof parsedAIResponse !== 'object') {
|
||||||
additionalInformation = responseText ? responseText.trim() : '';
|
throw new Error('AI did not return a valid object.');
|
||||||
|
|
||||||
if (!additionalInformation) {
|
|
||||||
throw new Error('AI returned empty response.'); // Changed error message slightly
|
|
||||||
}
|
}
|
||||||
|
|
||||||
report(
|
report(
|
||||||
// Corrected log message to reflect generateText
|
|
||||||
'success',
|
'success',
|
||||||
`Successfully generated text using AI role: ${role}.`
|
`Successfully generated object using AI role: ${role}.`
|
||||||
);
|
);
|
||||||
} catch (aiError) {
|
} catch (aiError) {
|
||||||
report('error', `AI service call failed: ${aiError.message}`);
|
report('error', `AI service call failed: ${aiError.message}`);
|
||||||
|
if (outputFormat === 'text' && loadingIndicator) {
|
||||||
|
stopLoadingIndicator(loadingIndicator); // Ensure stop on error
|
||||||
|
loadingIndicator = null;
|
||||||
|
}
|
||||||
throw aiError;
|
throw aiError;
|
||||||
} // Removed the inner finally block as streamingInterval is gone
|
}
|
||||||
|
|
||||||
const currentDate = new Date();
|
// --- TIMESTAMP & FORMATTING LOGIC (Handled Locally) ---
|
||||||
|
// Extract only the generated content from the AI's response details field.
|
||||||
|
const generatedContent = parsedAIResponse.details || ''; // Default to empty string
|
||||||
|
|
||||||
// Format the additional information with timestamp
|
if (generatedContent.trim()) {
|
||||||
const formattedInformation = `\n\n<info added on ${currentDate.toISOString()}>\n${additionalInformation}\n</info added on ${currentDate.toISOString()}>`;
|
// Generate timestamp locally
|
||||||
|
const timestamp = new Date().toISOString(); // <<< Local Timestamp
|
||||||
|
|
||||||
|
// Format the content with XML-like tags and timestamp LOCALLY
|
||||||
|
const formattedBlock = `<info added on ${timestamp}>\n${generatedContent.trim()}\n</info added on ${timestamp}>`; // <<< Local Formatting
|
||||||
|
|
||||||
|
// Append the formatted block to the *original* subtask details
|
||||||
|
subtask.details =
|
||||||
|
(subtask.details ? subtask.details + '\n' : '') + formattedBlock; // <<< Local Appending
|
||||||
|
report(
|
||||||
|
'info',
|
||||||
|
'Appended timestamped, formatted block with AI-generated content to subtask.details.'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
report(
|
||||||
|
'warn',
|
||||||
|
'AI response object did not contain generated content in the "details" field. Original details remain unchanged.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// --- END TIMESTAMP & FORMATTING LOGIC ---
|
||||||
|
|
||||||
|
// Get a reference to the subtask *after* its details have been updated
|
||||||
|
const updatedSubtask = parentTask.subtasks[subtaskIndex]; // subtask === updatedSubtask now
|
||||||
|
|
||||||
|
report('info', 'Updated subtask details locally after AI generation.');
|
||||||
|
// --- END UPDATE SUBTASK ---
|
||||||
|
|
||||||
// Only show debug info for text output (CLI)
|
// Only show debug info for text output (CLI)
|
||||||
if (outputFormat === 'text' && getDebugFlag(session)) {
|
if (outputFormat === 'text' && getDebugFlag(session)) {
|
||||||
console.log(
|
console.log(
|
||||||
'>>> DEBUG: formattedInformation:',
|
'>>> DEBUG: Subtask details AFTER AI update:',
|
||||||
formattedInformation.substring(0, 70) + '...'
|
updatedSubtask.details // Use updatedSubtask
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append to subtask details and description
|
// Description update logic (keeping as is for now)
|
||||||
// Only show debug info for text output (CLI)
|
if (updatedSubtask.description) {
|
||||||
if (outputFormat === 'text' && getDebugFlag(session)) {
|
// Use updatedSubtask
|
||||||
console.log('>>> DEBUG: Subtask details BEFORE append:', subtask.details);
|
if (prompt.length < 100) {
|
||||||
}
|
|
||||||
|
|
||||||
if (subtask.details) {
|
|
||||||
subtask.details += formattedInformation;
|
|
||||||
} else {
|
|
||||||
subtask.details = `${formattedInformation}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only show debug info for text output (CLI)
|
|
||||||
if (outputFormat === 'text' && getDebugFlag(session)) {
|
|
||||||
console.log('>>> DEBUG: Subtask details AFTER append:', subtask.details);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subtask.description) {
|
|
||||||
// Only append to description if it makes sense (for shorter updates)
|
|
||||||
if (additionalInformation.length < 200) {
|
|
||||||
// Only show debug info for text output (CLI)
|
|
||||||
if (outputFormat === 'text' && getDebugFlag(session)) {
|
if (outputFormat === 'text' && getDebugFlag(session)) {
|
||||||
console.log(
|
console.log(
|
||||||
'>>> DEBUG: Subtask description BEFORE append:',
|
'>>> DEBUG: Subtask description BEFORE append:',
|
||||||
subtask.description
|
updatedSubtask.description // Use updatedSubtask
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
subtask.description += ` [Updated: ${currentDate.toLocaleDateString()}]`;
|
updatedSubtask.description += ` [Updated: ${new Date().toLocaleDateString()}]`; // Use updatedSubtask
|
||||||
// Only show debug info for text output (CLI)
|
|
||||||
if (outputFormat === 'text' && getDebugFlag(session)) {
|
if (outputFormat === 'text' && getDebugFlag(session)) {
|
||||||
console.log(
|
console.log(
|
||||||
'>>> DEBUG: Subtask description AFTER append:',
|
'>>> DEBUG: Subtask description AFTER append:',
|
||||||
subtask.description
|
updatedSubtask.description // Use updatedSubtask
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,10 +342,7 @@ Guidelines:
|
|||||||
console.log('>>> DEBUG: About to call writeJSON with updated data...');
|
console.log('>>> DEBUG: About to call writeJSON with updated data...');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the subtask in the parent task's array
|
// Write the updated tasks to the file (parentTask already contains the updated subtask)
|
||||||
parentTask.subtasks[subtaskIndex] = subtask;
|
|
||||||
|
|
||||||
// Write the updated tasks to the file
|
|
||||||
writeJSON(tasksPath, data);
|
writeJSON(tasksPath, data);
|
||||||
|
|
||||||
// Only show debug info for text output (CLI)
|
// Only show debug info for text output (CLI)
|
||||||
@@ -302,17 +368,18 @@ Guidelines:
|
|||||||
'\n\n' +
|
'\n\n' +
|
||||||
chalk.white.bold('Title:') +
|
chalk.white.bold('Title:') +
|
||||||
' ' +
|
' ' +
|
||||||
subtask.title +
|
updatedSubtask.title +
|
||||||
'\n\n' +
|
'\n\n' +
|
||||||
chalk.white.bold('Information Added:') +
|
// Update the display to show the new details field
|
||||||
|
chalk.white.bold('Updated Details:') +
|
||||||
'\n' +
|
'\n' +
|
||||||
chalk.white(truncate(additionalInformation, 300, true)),
|
chalk.white(truncate(updatedSubtask.details || '', 500, true)), // Use updatedSubtask
|
||||||
{ padding: 1, borderColor: 'green', borderStyle: 'round' }
|
{ padding: 1, borderColor: 'green', borderStyle: 'round' }
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return subtask;
|
return updatedSubtask; // Return the modified subtask object
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Outer catch block handles final errors after loop/attempts
|
// Outer catch block handles final errors after loop/attempts
|
||||||
// Stop indicator on error - only for text output (CLI)
|
// Stop indicator on error - only for text output (CLI)
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ async function updateTasks(
|
|||||||
chalk.cyan.bold('Title'),
|
chalk.cyan.bold('Title'),
|
||||||
chalk.cyan.bold('Status')
|
chalk.cyan.bold('Status')
|
||||||
],
|
],
|
||||||
colWidths: [5, 60, 10]
|
colWidths: [5, 70, 20]
|
||||||
});
|
});
|
||||||
|
|
||||||
tasksToUpdate.forEach((task) => {
|
tasksToUpdate.forEach((task) => {
|
||||||
|
|||||||
@@ -9,11 +9,18 @@ import boxen from 'boxen';
|
|||||||
import ora from 'ora';
|
import ora from 'ora';
|
||||||
import Table from 'cli-table3';
|
import Table from 'cli-table3';
|
||||||
import gradient from 'gradient-string';
|
import gradient from 'gradient-string';
|
||||||
import { log, findTaskById, readJSON, truncate } from './utils.js';
|
import {
|
||||||
import path from 'path';
|
log,
|
||||||
|
findTaskById,
|
||||||
|
readJSON,
|
||||||
|
truncate,
|
||||||
|
isSilentMode
|
||||||
|
} from './utils.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { findNextTask, analyzeTaskComplexity } from './task-manager.js';
|
import { findNextTask, analyzeTaskComplexity } from './task-manager.js';
|
||||||
import { getProjectName, getDefaultSubtasks } from './config-manager.js';
|
import { getProjectName, getDefaultSubtasks } from './config-manager.js';
|
||||||
|
import { TASK_STATUS_OPTIONS } from '../../src/constants/task-status.js';
|
||||||
|
import { getTaskMasterVersion } from '../../src/utils/getVersion.js';
|
||||||
|
|
||||||
// Create a color gradient for the banner
|
// Create a color gradient for the banner
|
||||||
const coolGradient = gradient(['#00b4d8', '#0077b6', '#03045e']);
|
const coolGradient = gradient(['#00b4d8', '#0077b6', '#03045e']);
|
||||||
@@ -23,6 +30,8 @@ const warmGradient = gradient(['#fb8b24', '#e36414', '#9a031e']);
|
|||||||
* Display a fancy banner for the CLI
|
* Display a fancy banner for the CLI
|
||||||
*/
|
*/
|
||||||
function displayBanner() {
|
function displayBanner() {
|
||||||
|
if (isSilentMode()) return;
|
||||||
|
|
||||||
console.clear();
|
console.clear();
|
||||||
const bannerText = figlet.textSync('Task Master', {
|
const bannerText = figlet.textSync('Task Master', {
|
||||||
font: 'Standard',
|
font: 'Standard',
|
||||||
@@ -38,17 +47,7 @@ function displayBanner() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Read version directly from package.json
|
// Read version directly from package.json
|
||||||
let version = 'unknown'; // Initialize with a default
|
const version = getTaskMasterVersion();
|
||||||
try {
|
|
||||||
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
||||||
if (fs.existsSync(packageJsonPath)) {
|
|
||||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
||||||
version = packageJson.version;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
// Silently fall back to default version
|
|
||||||
log('warn', 'Could not read package.json for version info.');
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
boxen(
|
boxen(
|
||||||
@@ -450,7 +449,7 @@ function displayHelp() {
|
|||||||
{
|
{
|
||||||
name: 'set-status',
|
name: 'set-status',
|
||||||
args: '--id=<id> --status=<status>',
|
args: '--id=<id> --status=<status>',
|
||||||
desc: 'Update task status (done, pending, etc.)'
|
desc: `Update task status (${TASK_STATUS_OPTIONS.join(', ')})`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'update',
|
name: 'update',
|
||||||
@@ -801,12 +800,7 @@ async function displayNextTask(tasksPath) {
|
|||||||
'padding-bottom': 0,
|
'padding-bottom': 0,
|
||||||
compact: true
|
compact: true
|
||||||
},
|
},
|
||||||
chars: {
|
chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' },
|
||||||
mid: '',
|
|
||||||
'left-mid': '',
|
|
||||||
'mid-mid': '',
|
|
||||||
'right-mid': ''
|
|
||||||
},
|
|
||||||
colWidths: [15, Math.min(75, process.stdout.columns - 20 || 60)],
|
colWidths: [15, Math.min(75, process.stdout.columns - 20 || 60)],
|
||||||
wordWrap: true
|
wordWrap: true
|
||||||
});
|
});
|
||||||
@@ -894,12 +888,7 @@ async function displayNextTask(tasksPath) {
|
|||||||
'padding-bottom': 0,
|
'padding-bottom': 0,
|
||||||
compact: true
|
compact: true
|
||||||
},
|
},
|
||||||
chars: {
|
chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' },
|
||||||
mid: '',
|
|
||||||
'left-mid': '',
|
|
||||||
'mid-mid': '',
|
|
||||||
'right-mid': ''
|
|
||||||
},
|
|
||||||
wordWrap: true
|
wordWrap: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
Task Master PRD
|
|
||||||
|
|
||||||
Create a CLI tool for task management
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"meta": {
|
"meta": {
|
||||||
"generatedAt": "2025-05-01T18:17:08.817Z",
|
"generatedAt": "2025-05-03T04:45:36.864Z",
|
||||||
"tasksAnalyzed": 35,
|
"tasksAnalyzed": 36,
|
||||||
"thresholdScore": 5,
|
"thresholdScore": 5,
|
||||||
"projectName": "Taskmaster",
|
"projectName": "Taskmaster",
|
||||||
"usedResearch": false
|
"usedResearch": false
|
||||||
@@ -10,282 +10,290 @@
|
|||||||
{
|
{
|
||||||
"taskId": 24,
|
"taskId": 24,
|
||||||
"taskTitle": "Implement AI-Powered Test Generation Command",
|
"taskTitle": "Implement AI-Powered Test Generation Command",
|
||||||
"complexityScore": 7,
|
"complexityScore": 8,
|
||||||
"recommendedSubtasks": 5,
|
"recommendedSubtasks": 5,
|
||||||
"expansionPrompt": "Break down the implementation of the 'generate-test' command into detailed subtasks covering command structure, AI prompt engineering, test file generation, and integration with existing systems.",
|
"expansionPrompt": "Expand the 'Implement AI-Powered Test Generation Command' task by detailing the specific steps required for AI prompt engineering, including data extraction, prompt formatting, and error handling.",
|
||||||
"reasoning": "This task involves creating a new CLI command that leverages AI to generate test files. It requires integration with Claude API, understanding of Jest testing, file system operations, and complex prompt engineering. The task already has 3 subtasks but would benefit from further breakdown to address error handling, documentation, and test validation components."
|
"reasoning": "Requires AI integration, complex logic, and thorough testing. Prompt engineering and API interaction add significant complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 26,
|
"taskId": 26,
|
||||||
"taskTitle": "Implement Context Foundation for AI Operations",
|
"taskTitle": "Implement Context Foundation for AI Operations",
|
||||||
"complexityScore": 6,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the implementation of the context foundation for AI operations into detailed subtasks covering file context handling, cursor rules integration, context extraction utilities, and command handler updates.",
|
"expansionPrompt": "Expand the 'Implement Context Foundation for AI Operations' task by detailing the specific steps for integrating file reading, cursor rules, and basic context extraction into the Claude API prompts.",
|
||||||
"reasoning": "This task involves creating a foundation for context integration in Task Master. It requires implementing file reading functionality, cursor rules integration, and context extraction utilities. The task already has 4 subtasks but would benefit from additional subtasks for testing, documentation, and integration with existing AI operations."
|
"reasoning": "Involves modifying multiple commands and integrating different context sources. Error handling and backwards compatibility are crucial."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 27,
|
"taskId": 27,
|
||||||
"taskTitle": "Implement Context Enhancements for AI Operations",
|
"taskTitle": "Implement Context Enhancements for AI Operations",
|
||||||
"complexityScore": 7,
|
"complexityScore": 8,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the implementation of context enhancements for AI operations into detailed subtasks covering code context extraction, task history context, PRD context integration, and context formatting improvements.",
|
"expansionPrompt": "Expand the 'Implement Context Enhancements for AI Operations' task by detailing the specific steps for code context extraction, task history integration, and PRD context integration, including parsing, summarization, and formatting.",
|
||||||
"reasoning": "This task builds upon the foundation from task #26 and adds more sophisticated context features. It involves implementing code context extraction, task history awareness, and PRD integration. The task already has 4 subtasks but would benefit from additional subtasks for testing, documentation, and integration with the foundation context system."
|
"reasoning": "Builds upon the previous task with more sophisticated context extraction and integration. Requires intelligent parsing and summarization."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 28,
|
"taskId": 28,
|
||||||
"taskTitle": "Implement Advanced ContextManager System",
|
"taskTitle": "Implement Advanced ContextManager System",
|
||||||
"complexityScore": 8,
|
"complexityScore": 9,
|
||||||
"recommendedSubtasks": 7,
|
"recommendedSubtasks": 7,
|
||||||
"expansionPrompt": "Break down the implementation of the advanced ContextManager system into detailed subtasks covering class structure, optimization pipeline, command interface, AI service integration, and performance monitoring.",
|
"expansionPrompt": "Expand the 'Implement Advanced ContextManager System' task by detailing the specific steps for creating the ContextManager class, implementing the optimization pipeline, and adding command interface enhancements, including caching and performance monitoring.",
|
||||||
"reasoning": "This task involves creating a comprehensive ContextManager class with advanced features like context optimization, prioritization, and intelligent selection. It builds on the previous context tasks and requires sophisticated algorithms for token management and context relevance scoring. The task already has 5 subtasks but would benefit from additional subtasks for testing, documentation, and integration with existing systems."
|
"reasoning": "A comprehensive system requiring careful design, optimization, and testing. Involves complex algorithms and performance considerations."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 32,
|
"taskId": 32,
|
||||||
"taskTitle": "Implement \"learn\" Command for Automatic Cursor Rule Generation",
|
"taskTitle": "Implement \"learn\" Command for Automatic Cursor Rule Generation",
|
||||||
"complexityScore": 9,
|
"complexityScore": 9,
|
||||||
"recommendedSubtasks": 8,
|
"recommendedSubtasks": 10,
|
||||||
"expansionPrompt": "Break down the implementation of the 'learn' command for automatic Cursor rule generation into detailed subtasks covering chat history analysis, rule management, AI integration, and command structure.",
|
"expansionPrompt": "Expand the 'Implement \"learn\" Command for Automatic Cursor Rule Generation' task by detailing the specific steps for Cursor data analysis, rule management, and AI integration, including error handling and performance optimization.",
|
||||||
"reasoning": "This task involves creating a complex system that analyzes Cursor's chat history and code changes to automatically generate rule files. It requires sophisticated data analysis, pattern recognition, and AI integration. The task already has 15 subtasks, which is appropriate given its complexity, but could benefit from reorganization into logical groupings."
|
"reasoning": "Requires deep integration with Cursor's data, complex pattern analysis, and AI interaction. Significant error handling and performance optimization are needed."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 40,
|
"taskId": 40,
|
||||||
"taskTitle": "Implement 'plan' Command for Task Implementation Planning",
|
"taskTitle": "Implement 'plan' Command for Task Implementation Planning",
|
||||||
"complexityScore": 5,
|
"complexityScore": 6,
|
||||||
"recommendedSubtasks": 5,
|
"recommendedSubtasks": 4,
|
||||||
"expansionPrompt": "Break down the implementation of the 'plan' command for task implementation planning into detailed subtasks covering command structure, AI integration, plan formatting, and error handling.",
|
"expansionPrompt": "Expand the 'Implement 'plan' Command for Task Implementation Planning' task by detailing the steps for retrieving task content, generating implementation plans with AI, and formatting the plan within XML tags.",
|
||||||
"reasoning": "This task involves creating a new command that generates implementation plans for tasks. It requires integration with AI services, understanding of task structure, and proper formatting of generated plans. The task has no subtasks yet, so creating 5 subtasks would provide a clear implementation path."
|
"reasoning": "Involves AI integration and requires careful formatting and error handling. Switching between Claude and Perplexity adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 41,
|
"taskId": 41,
|
||||||
"taskTitle": "Implement Visual Task Dependency Graph in Terminal",
|
"taskTitle": "Implement Visual Task Dependency Graph in Terminal",
|
||||||
"complexityScore": 8,
|
"complexityScore": 8,
|
||||||
"recommendedSubtasks": 8,
|
"recommendedSubtasks": 8,
|
||||||
"expansionPrompt": "Break down the implementation of the visual task dependency graph in terminal into detailed subtasks covering graph layout algorithms, ASCII/Unicode rendering, color coding, circular dependency detection, and filtering options.",
|
"expansionPrompt": "Expand the 'Implement Visual Task Dependency Graph in Terminal' task by detailing the steps for designing the graph rendering system, implementing layout algorithms, and handling circular dependencies and filtering options.",
|
||||||
"reasoning": "This task involves creating a complex visualization system for task dependencies using ASCII/Unicode characters. It requires sophisticated layout algorithms, rendering logic, and user interface considerations. The task already has 10 subtasks, which is appropriate given its complexity."
|
"reasoning": "Requires complex graph algorithms and terminal rendering. Accessibility and performance are important considerations."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 42,
|
"taskId": 42,
|
||||||
"taskTitle": "Implement MCP-to-MCP Communication Protocol",
|
"taskTitle": "Implement MCP-to-MCP Communication Protocol",
|
||||||
"complexityScore": 9,
|
"complexityScore": 8,
|
||||||
"recommendedSubtasks": 10,
|
"recommendedSubtasks": 7,
|
||||||
"expansionPrompt": "Break down the implementation of the MCP-to-MCP communication protocol into detailed subtasks covering protocol definition, adapter pattern, client module, reference implementation, and mode switching.",
|
"expansionPrompt": "Expand the 'Implement MCP-to-MCP Communication Protocol' task by detailing the steps for defining the protocol, implementing the adapter pattern, and building the client module, including error handling and security considerations.",
|
||||||
"reasoning": "This task involves designing and implementing a standardized communication protocol for Taskmaster to interact with external MCP tools. It requires sophisticated protocol design, authentication mechanisms, error handling, and support for different operational modes. The task already has 8 subtasks but would benefit from additional subtasks for security, testing, and documentation."
|
"reasoning": "Requires designing a new protocol and implementing communication with external systems. Security and error handling are critical."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 43,
|
"taskId": 43,
|
||||||
"taskTitle": "Add Research Flag to Add-Task Command",
|
"taskTitle": "Add Research Flag to Add-Task Command",
|
||||||
"complexityScore": 3,
|
"complexityScore": 5,
|
||||||
"recommendedSubtasks": 4,
|
"recommendedSubtasks": 3,
|
||||||
"expansionPrompt": "Break down the implementation of the research flag for the add-task command into detailed subtasks covering command argument parsing, research subtask generation, integration with existing command, and documentation.",
|
"expansionPrompt": "Expand the 'Add Research Flag to Add-Task Command' task by detailing the steps for updating the command parser, generating research subtasks, and linking them to the parent task.",
|
||||||
"reasoning": "This task involves modifying the add-task command to support a new flag that generates research-oriented subtasks. It's relatively straightforward as it builds on existing functionality. The task has no subtasks yet, so creating 4 subtasks would provide a clear implementation path."
|
"reasoning": "Relatively straightforward, but requires careful handling of subtask generation and linking."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 44,
|
"taskId": 44,
|
||||||
"taskTitle": "Implement Task Automation with Webhooks and Event Triggers",
|
"taskTitle": "Implement Task Automation with Webhooks and Event Triggers",
|
||||||
"complexityScore": 8,
|
"complexityScore": 8,
|
||||||
"recommendedSubtasks": 7,
|
"recommendedSubtasks": 7,
|
||||||
"expansionPrompt": "Break down the implementation of task automation with webhooks and event triggers into detailed subtasks covering webhook registration, event system, trigger definition, authentication, and payload templating.",
|
"expansionPrompt": "Expand the 'Implement Task Automation with Webhooks and Event Triggers' task by detailing the steps for implementing the webhook registration system, event system, and trigger definition interface, including security and error handling.",
|
||||||
"reasoning": "This task involves creating a sophisticated automation system with webhooks and event triggers. It requires implementing webhook registration, event capturing, trigger definitions, authentication, and integration with existing systems. The task has no subtasks yet, so creating 7 subtasks would provide a clear implementation path for this complex feature."
|
"reasoning": "Requires designing a robust event system and integrating with external services. Security and error handling are critical."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 45,
|
"taskId": 45,
|
||||||
"taskTitle": "Implement GitHub Issue Import Feature",
|
"taskTitle": "Implement GitHub Issue Import Feature",
|
||||||
"complexityScore": 5,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 5,
|
"recommendedSubtasks": 5,
|
||||||
"expansionPrompt": "Break down the implementation of the GitHub issue import feature into detailed subtasks covering URL parsing, GitHub API integration, task generation, authentication, and error handling.",
|
"expansionPrompt": "Expand the 'Implement GitHub Issue Import Feature' task by detailing the steps for parsing the URL, fetching issue details from the GitHub API, and generating a well-formatted task.",
|
||||||
"reasoning": "This task involves adding a feature to import GitHub issues as tasks. It requires integration with the GitHub API, URL parsing, authentication handling, and proper error management. The task has no subtasks yet, so creating 5 subtasks would provide a clear implementation path."
|
"reasoning": "Requires interacting with the GitHub API and handling various error conditions. Authentication adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 46,
|
"taskId": 46,
|
||||||
"taskTitle": "Implement ICE Analysis Command for Task Prioritization",
|
"taskTitle": "Implement ICE Analysis Command for Task Prioritization",
|
||||||
"complexityScore": 6,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 5,
|
||||||
"expansionPrompt": "Break down the implementation of the ICE analysis command for task prioritization into detailed subtasks covering scoring algorithm, report generation, CLI rendering, and integration with existing analysis tools.",
|
"expansionPrompt": "Expand the 'Implement ICE Analysis Command for Task Prioritization' task by detailing the steps for calculating ICE scores, generating the report file, and implementing the CLI rendering.",
|
||||||
"reasoning": "This task involves creating a new command that analyzes and ranks tasks based on Impact, Confidence, and Ease scoring. It requires implementing scoring algorithms, report generation, CLI rendering, and integration with existing analysis tools. The task has no subtasks yet, so creating 6 subtasks would provide a clear implementation path."
|
"reasoning": "Requires AI integration for scoring and careful formatting of the report. Integration with existing complexity reports adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 47,
|
"taskId": 47,
|
||||||
"taskTitle": "Enhance Task Suggestion Actions Card Workflow",
|
"taskTitle": "Enhance Task Suggestion Actions Card Workflow",
|
||||||
"complexityScore": 7,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the enhancement of the task suggestion actions card workflow into detailed subtasks covering task expansion phase, context addition phase, task management phase, and UI/UX improvements.",
|
"expansionPrompt": "Expand the 'Enhance Task Suggestion Actions Card Workflow' task by detailing the steps for implementing the task expansion, context addition, and task management phases, including UI/UX considerations.",
|
||||||
"reasoning": "This task involves redesigning the suggestion actions card to implement a structured workflow. It requires implementing multiple phases (expansion, context addition, management) with appropriate UI/UX considerations. The task has no subtasks yet, so creating 6 subtasks would provide a clear implementation path for this moderately complex feature."
|
"reasoning": "Requires significant UI/UX work and careful state management. Integration with existing functionality is crucial."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 48,
|
"taskId": 48,
|
||||||
"taskTitle": "Refactor Prompts into Centralized Structure",
|
"taskTitle": "Refactor Prompts into Centralized Structure",
|
||||||
"complexityScore": 4,
|
"complexityScore": 5,
|
||||||
"recommendedSubtasks": 4,
|
"recommendedSubtasks": 3,
|
||||||
"expansionPrompt": "Break down the refactoring of prompts into a centralized structure into detailed subtasks covering directory creation, prompt extraction, function modification, and documentation.",
|
"expansionPrompt": "Expand the 'Refactor Prompts into Centralized Structure' task by detailing the steps for creating the 'prompts' directory, extracting prompts into individual files, and updating functions to import them.",
|
||||||
"reasoning": "This task involves restructuring how prompts are managed in the codebase. It's a relatively straightforward refactoring task that requires creating a new directory structure, extracting prompts from functions, and updating references. The task has no subtasks yet, so creating 4 subtasks would provide a clear implementation path."
|
"reasoning": "Primarily a refactoring task, but requires careful attention to detail to avoid breaking existing functionality."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 49,
|
"taskId": 49,
|
||||||
"taskTitle": "Implement Code Quality Analysis Command",
|
"taskTitle": "Implement Code Quality Analysis Command",
|
||||||
"complexityScore": 8,
|
"complexityScore": 8,
|
||||||
"recommendedSubtasks": 7,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the implementation of the code quality analysis command into detailed subtasks covering pattern recognition, best practice verification, improvement recommendations, task integration, and reporting.",
|
"expansionPrompt": "Expand the 'Implement Code Quality Analysis Command' task by detailing the steps for pattern recognition, best practice verification, and improvement recommendations, including AI integration and task creation.",
|
||||||
"reasoning": "This task involves creating a sophisticated command that analyzes code quality, identifies patterns, verifies against best practices, and generates improvement recommendations. It requires complex algorithms for code analysis and integration with AI services. The task has no subtasks yet, so creating 7 subtasks would provide a clear implementation path for this complex feature."
|
"reasoning": "Requires complex code analysis and AI integration. Generating actionable recommendations adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 50,
|
"taskId": 50,
|
||||||
"taskTitle": "Implement Test Coverage Tracking System by Task",
|
"taskTitle": "Implement Test Coverage Tracking System by Task",
|
||||||
"complexityScore": 9,
|
"complexityScore": 9,
|
||||||
"recommendedSubtasks": 8,
|
"recommendedSubtasks": 7,
|
||||||
"expansionPrompt": "Break down the implementation of the test coverage tracking system by task into detailed subtasks covering data structure design, coverage report parsing, tracking and update generation, CLI commands, and AI-powered test generation.",
|
"expansionPrompt": "Expand the 'Implement Test Coverage Tracking System by Task' task by detailing the steps for creating the tests.json file structure, developing the coverage report parser, and implementing the CLI commands and AI-powered test generation system.",
|
||||||
"reasoning": "This task involves creating a comprehensive system for tracking test coverage at the task level. It requires implementing data structures, coverage report parsing, tracking mechanisms, CLI commands, and AI integration. The task already has 5 subtasks but would benefit from additional subtasks for integration testing, documentation, and user experience."
|
"reasoning": "A comprehensive system requiring deep integration with testing tools and AI. Maintaining bidirectional relationships adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 51,
|
"taskId": 51,
|
||||||
"taskTitle": "Implement Perplexity Research Command",
|
"taskTitle": "Implement Perplexity Research Command",
|
||||||
"complexityScore": 6,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 5,
|
||||||
"expansionPrompt": "Break down the implementation of the Perplexity research command into detailed subtasks covering API client service, task context extraction, CLI interface, results processing, and caching system.",
|
"expansionPrompt": "Expand the 'Implement Perplexity Research Command' task by detailing the steps for creating the Perplexity API client, implementing task context extraction, and building the CLI interface.",
|
||||||
"reasoning": "This task involves creating a command that integrates with Perplexity AI for research purposes. It requires implementing an API client, context extraction, CLI interface, results processing, and caching. The task already has 5 subtasks, which is appropriate for its complexity."
|
"reasoning": "Requires API integration and careful formatting of the research results. Caching adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 52,
|
"taskId": 52,
|
||||||
"taskTitle": "Implement Task Suggestion Command for CLI",
|
"taskTitle": "Implement Task Suggestion Command for CLI",
|
||||||
"complexityScore": 5,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 5,
|
"recommendedSubtasks": 5,
|
||||||
"expansionPrompt": "Break down the implementation of the task suggestion command for CLI into detailed subtasks covering task data collection, AI integration, suggestion presentation, interactive interface, and configuration options.",
|
"expansionPrompt": "Expand the 'Implement Task Suggestion Command for CLI' task by detailing the steps for collecting existing task data, generating task suggestions with AI, and implementing the interactive CLI interface.",
|
||||||
"reasoning": "This task involves creating a new CLI command that generates contextually relevant task suggestions. It requires collecting existing task data, integrating with AI services, presenting suggestions, and implementing an interactive interface. The task has no subtasks yet, so creating 5 subtasks would provide a clear implementation path."
|
"reasoning": "Requires AI integration and careful design of the interactive interface. Handling various flag combinations adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 53,
|
"taskId": 53,
|
||||||
"taskTitle": "Implement Subtask Suggestion Feature for Parent Tasks",
|
"taskTitle": "Implement Subtask Suggestion Feature for Parent Tasks",
|
||||||
"complexityScore": 6,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the implementation of the subtask suggestion feature for parent tasks into detailed subtasks covering parent task validation, context gathering, AI integration, interactive interface, and subtask linking.",
|
"expansionPrompt": "Expand the 'Implement Subtask Suggestion Feature for Parent Tasks' task by detailing the steps for validating parent tasks, gathering context, generating subtask suggestions with AI, and implementing the interactive CLI interface.",
|
||||||
"reasoning": "This task involves creating a feature that suggests contextually relevant subtasks for existing parent tasks. It requires implementing parent task validation, context gathering, AI integration, an interactive interface, and subtask linking. The task already has 6 subtasks, which is appropriate for its complexity."
|
"reasoning": "Requires AI integration and careful design of the interactive interface. Linking subtasks to parent tasks adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 55,
|
"taskId": 55,
|
||||||
"taskTitle": "Implement Positional Arguments Support for CLI Commands",
|
"taskTitle": "Implement Positional Arguments Support for CLI Commands",
|
||||||
"complexityScore": 5,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 5,
|
"recommendedSubtasks": 5,
|
||||||
"expansionPrompt": "Break down the implementation of positional arguments support for CLI commands into detailed subtasks covering argument parsing logic, command mapping, help text updates, error handling, and testing.",
|
"expansionPrompt": "Expand the 'Implement Positional Arguments Support for CLI Commands' task by detailing the steps for updating the argument parsing logic, defining the positional argument order, and handling edge cases.",
|
||||||
"reasoning": "This task involves modifying the command parsing logic to support positional arguments alongside the existing flag-based syntax. It requires updating argument parsing, mapping positional arguments to parameters, updating help text, and handling edge cases. The task has no subtasks yet, so creating 5 subtasks would provide a clear implementation path."
|
"reasoning": "Requires careful modification of the command parsing logic and ensuring backward compatibility. Handling edge cases adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 57,
|
"taskId": 57,
|
||||||
"taskTitle": "Enhance Task-Master CLI User Experience and Interface",
|
"taskTitle": "Enhance Task-Master CLI User Experience and Interface",
|
||||||
"complexityScore": 7,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the enhancement of the Task-Master CLI user experience and interface into detailed subtasks covering log management, visual enhancements, interactive elements, output formatting, and help documentation.",
|
"expansionPrompt": "Expand the 'Enhance Task-Master CLI User Experience and Interface' task by detailing the steps for log management, visual enhancements, interactive elements, and output formatting.",
|
||||||
"reasoning": "This task involves improving the CLI's user experience through various enhancements to logging, visuals, interactivity, and documentation. It requires implementing log levels, visual improvements, interactive elements, and better formatting. The task has no subtasks yet, so creating 6 subtasks would provide a clear implementation path for this moderately complex feature."
|
"reasoning": "Requires significant UI/UX work and careful consideration of different terminal environments. Reducing verbose logging adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 60,
|
"taskId": 60,
|
||||||
"taskTitle": "Implement Mentor System with Round-Table Discussion Feature",
|
"taskTitle": "Implement Mentor System with Round-Table Discussion Feature",
|
||||||
"complexityScore": 8,
|
"complexityScore": 8,
|
||||||
"recommendedSubtasks": 7,
|
"recommendedSubtasks": 7,
|
||||||
"expansionPrompt": "Break down the implementation of the mentor system with round-table discussion feature into detailed subtasks covering mentor management, round-table discussion, task system integration, LLM integration, and documentation.",
|
"expansionPrompt": "Expand the 'Implement Mentor System with Round-Table Discussion Feature' task by detailing the steps for mentor management, round-table discussion implementation, and integration with the task system, including LLM integration.",
|
||||||
"reasoning": "This task involves creating a sophisticated mentor system with round-table discussions. It requires implementing mentor management, discussion simulation, task integration, and LLM integration. The task has no subtasks yet, so creating 7 subtasks would provide a clear implementation path for this complex feature."
|
"reasoning": "Requires complex AI simulation and careful formatting of the discussion output. Integrating with the task system adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 61,
|
"taskId": 61,
|
||||||
"taskTitle": "Implement Flexible AI Model Management",
|
"taskTitle": "Implement Flexible AI Model Management",
|
||||||
"complexityScore": 10,
|
"complexityScore": 9,
|
||||||
"recommendedSubtasks": 10,
|
"recommendedSubtasks": 8,
|
||||||
"expansionPrompt": "Break down the implementation of flexible AI model management into detailed subtasks covering configuration management, CLI command parsing, AI SDK integration, service module development, environment variable handling, and documentation.",
|
"expansionPrompt": "Expand the 'Implement Flexible AI Model Management' task by detailing the steps for creating the configuration management module, implementing the CLI command parser, and integrating the Vercel AI SDK.",
|
||||||
"reasoning": "This task involves implementing comprehensive support for multiple AI models with a unified interface. It's extremely complex, requiring configuration management, CLI commands, SDK integration, service modules, and environment handling. The task already has 45 subtasks, which is appropriate given its complexity and scope."
|
"reasoning": "Requires deep integration with multiple AI models and careful management of API keys and configuration options. Vercel AI SDK integration adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 62,
|
"taskId": 62,
|
||||||
"taskTitle": "Add --simple Flag to Update Commands for Direct Text Input",
|
"taskTitle": "Add --simple Flag to Update Commands for Direct Text Input",
|
||||||
"complexityScore": 4,
|
"complexityScore": 5,
|
||||||
"recommendedSubtasks": 5,
|
"recommendedSubtasks": 4,
|
||||||
"expansionPrompt": "Break down the implementation of the --simple flag for update commands into detailed subtasks covering command parser updates, AI processing bypass, timestamp formatting, visual indicators, and documentation.",
|
"expansionPrompt": "Expand the 'Add --simple Flag to Update Commands for Direct Text Input' task by detailing the steps for updating the command parsers, implementing the conditional logic, and formatting the user input with a timestamp.",
|
||||||
"reasoning": "This task involves modifying update commands to accept a flag that bypasses AI processing. It requires updating command parsers, implementing conditional logic, formatting user input, and updating documentation. The task already has 8 subtasks, which is more than sufficient for its complexity."
|
"reasoning": "Relatively straightforward, but requires careful attention to formatting and ensuring consistency with AI-processed updates."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 63,
|
"taskId": 63,
|
||||||
"taskTitle": "Add pnpm Support for the Taskmaster Package",
|
"taskTitle": "Add pnpm Support for the Taskmaster Package",
|
||||||
"complexityScore": 5,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the implementation of pnpm support for the Taskmaster package into detailed subtasks covering documentation updates, package script compatibility, lockfile generation, installation testing, CI/CD integration, and website consistency verification.",
|
"expansionPrompt": "Expand the 'Add pnpm Support for the Taskmaster Package' task by detailing the steps for updating the documentation, ensuring package scripts compatibility, and testing the installation and operation with pnpm.",
|
||||||
"reasoning": "This task involves ensuring the Taskmaster package works seamlessly with pnpm. It requires updating documentation, ensuring script compatibility, testing installation, and integrating with CI/CD. The task already has 8 subtasks, which is appropriate for its complexity."
|
"reasoning": "Requires careful attention to detail to ensure compatibility with pnpm's execution model. Testing and documentation are crucial."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 64,
|
"taskId": 64,
|
||||||
"taskTitle": "Add Yarn Support for Taskmaster Installation",
|
"taskTitle": "Add Yarn Support for Taskmaster Installation",
|
||||||
"complexityScore": 5,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the implementation of Yarn support for Taskmaster installation into detailed subtasks covering package.json updates, Yarn-specific configuration, compatibility testing, documentation updates, package manager detection, and website consistency verification.",
|
"expansionPrompt": "Expand the 'Add Yarn Support for Taskmaster Installation' task by detailing the steps for updating package.json, adding Yarn-specific configuration files, and testing the installation and operation with Yarn.",
|
||||||
"reasoning": "This task involves ensuring the Taskmaster package works seamlessly with Yarn. It requires updating package.json, adding Yarn-specific configuration, testing compatibility, and updating documentation. The task already has 9 subtasks, which is appropriate for its complexity."
|
"reasoning": "Requires careful attention to detail to ensure compatibility with Yarn's execution model. Testing and documentation are crucial."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 65,
|
"taskId": 65,
|
||||||
"taskTitle": "Add Bun Support for Taskmaster Installation",
|
"taskTitle": "Add Bun Support for Taskmaster Installation",
|
||||||
"complexityScore": 5,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the implementation of Bun support for Taskmaster installation into detailed subtasks covering package.json updates, Bun-specific configuration, compatibility testing, documentation updates, package manager detection, and troubleshooting guidance.",
|
"expansionPrompt": "Expand the 'Add Bun Support for Taskmaster Installation' task by detailing the steps for updating the installation scripts, testing the installation and operation with Bun, and updating the documentation.",
|
||||||
"reasoning": "This task involves ensuring the Taskmaster package works seamlessly with Bun. It requires updating package.json, adding Bun-specific configuration, testing compatibility, and updating documentation. The task has no subtasks yet, so creating 6 subtasks would provide a clear implementation path."
|
"reasoning": "Requires careful attention to detail to ensure compatibility with Bun's execution model. Testing and documentation are crucial."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 66,
|
"taskId": 66,
|
||||||
"taskTitle": "Support Status Filtering in Show Command for Subtasks",
|
"taskTitle": "Support Status Filtering in Show Command for Subtasks",
|
||||||
"complexityScore": 3,
|
"complexityScore": 5,
|
||||||
"recommendedSubtasks": 4,
|
"recommendedSubtasks": 4,
|
||||||
"expansionPrompt": "Break down the implementation of status filtering in the show command for subtasks into detailed subtasks covering command parser updates, filtering logic, help documentation, and testing.",
|
"expansionPrompt": "Expand the 'Support Status Filtering in Show Command for Subtasks' task by detailing the steps for updating the command parser, modifying the show command handler, and updating the help documentation.",
|
||||||
"reasoning": "This task involves enhancing the show command to support status-based filtering of subtasks. It's relatively straightforward, requiring updates to the command parser, filtering logic, and documentation. The task has no subtasks yet, so creating 4 subtasks would provide a clear implementation path."
|
"reasoning": "Relatively straightforward, but requires careful handling of status validation and filtering."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 67,
|
"taskId": 67,
|
||||||
"taskTitle": "Add CLI JSON output and Cursor keybindings integration",
|
"taskTitle": "Add CLI JSON output and Cursor keybindings integration",
|
||||||
"complexityScore": 6,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the implementation of CLI JSON output and Cursor keybindings integration into detailed subtasks covering JSON flag implementation, output formatting, keybindings command structure, OS detection, file handling, and keybinding definition.",
|
"expansionPrompt": "Expand the 'Add CLI JSON output and Cursor keybindings integration' task by detailing the steps for implementing the JSON output logic, creating the install-keybindings command structure, and handling keybinding file manipulation.",
|
||||||
"reasoning": "This task involves two main components: adding JSON output to CLI commands and creating a new command for Cursor keybindings. It requires implementing a JSON flag, formatting output, creating a new command, detecting OS, handling files, and defining keybindings. The task already has 5 subtasks, which is appropriate for its complexity."
|
"reasoning": "Requires careful formatting of the JSON output and handling of file system operations. OS detection adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 68,
|
"taskId": 68,
|
||||||
"taskTitle": "Ability to create tasks without parsing PRD",
|
"taskTitle": "Ability to create tasks without parsing PRD",
|
||||||
"complexityScore": 4,
|
"complexityScore": 3,
|
||||||
"recommendedSubtasks": 4,
|
"recommendedSubtasks": 2,
|
||||||
"expansionPrompt": "Break down the implementation of creating tasks without parsing PRD into detailed subtasks covering tasks.json creation, function reuse from parse-prd, command modification, and documentation.",
|
"expansionPrompt": "Expand the 'Ability to create tasks without parsing PRD' task by detailing the steps for creating tasks without a PRD.",
|
||||||
"reasoning": "This task involves modifying the task creation process to work without a PRD. It's relatively straightforward, requiring tasks.json creation, function reuse, command modification, and documentation. The task has no subtasks yet, so creating 4 subtasks would provide a clear implementation path."
|
"reasoning": "Simple task to allow task creation without a PRD."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 69,
|
"taskId": 69,
|
||||||
"taskTitle": "Enhance Analyze Complexity for Specific Task IDs",
|
"taskTitle": "Enhance Analyze Complexity for Specific Task IDs",
|
||||||
"complexityScore": 5,
|
"complexityScore": 6,
|
||||||
"recommendedSubtasks": 5,
|
"recommendedSubtasks": 4,
|
||||||
"expansionPrompt": "Break down the enhancement of analyze-complexity for specific task IDs into detailed subtasks covering core logic modification, CLI command updates, MCP tool updates, report handling, and testing.",
|
"expansionPrompt": "Expand the 'Enhance Analyze Complexity for Specific Task IDs' task by detailing the steps for modifying the core logic, updating the CLI, and updating the MCP tool.",
|
||||||
"reasoning": "This task involves modifying the analyze-complexity feature to support analyzing specific task IDs. It requires updating core logic, CLI commands, MCP tools, and report handling. The task has no subtasks yet, so creating 5 subtasks would provide a clear implementation path."
|
"reasoning": "Requires modifying existing functionality and ensuring compatibility with both CLI and MCP."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 70,
|
"taskId": 70,
|
||||||
"taskTitle": "Implement 'diagram' command for Mermaid diagram generation",
|
"taskTitle": "Implement 'diagram' command for Mermaid diagram generation",
|
||||||
"complexityScore": 6,
|
"complexityScore": 6,
|
||||||
"recommendedSubtasks": 6,
|
"recommendedSubtasks": 4,
|
||||||
"expansionPrompt": "Break down the implementation of the 'diagram' command for Mermaid diagram generation into detailed subtasks covering command structure, task data collection, diagram generation, rendering options, file export, and documentation.",
|
"expansionPrompt": "Expand the 'Implement 'diagram' command for Mermaid diagram generation' task by detailing the steps for creating the command, generating the Mermaid diagram, and handling different output options.",
|
||||||
"reasoning": "This task involves creating a new command that generates Mermaid diagrams for task dependencies. It requires implementing command structure, collecting task data, generating diagrams, providing rendering options, and supporting file export. The task has no subtasks yet, so creating 6 subtasks would provide a clear implementation path."
|
"reasoning": "Requires generating Mermaid diagrams and handling different output options."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 72,
|
"taskId": 72,
|
||||||
"taskTitle": "Implement PDF Generation for Project Progress and Dependency Overview",
|
"taskTitle": "Implement PDF Generation for Project Progress and Dependency Overview",
|
||||||
"complexityScore": 7,
|
"complexityScore": 8,
|
||||||
"recommendedSubtasks": 7,
|
"recommendedSubtasks": 6,
|
||||||
"expansionPrompt": "Break down the implementation of PDF generation for project progress and dependency overview into detailed subtasks covering command structure, data collection, progress summary generation, dependency visualization, PDF creation, styling, and documentation.",
|
"expansionPrompt": "Expand the 'Implement PDF Generation for Project Progress and Dependency Overview' task by detailing the steps for summarizing project progress, visualizing the dependency chain, and generating the PDF document.",
|
||||||
"reasoning": "This task involves creating a feature to generate PDF reports of project progress and dependencies. It requires implementing command structure, collecting data, generating summaries, visualizing dependencies, creating PDFs, and styling the output. The task has no subtasks yet, so creating 7 subtasks would provide a clear implementation path for this moderately complex feature."
|
"reasoning": "Requires integrating with the diagram command and using a PDF generation library. Handling large dependency chains adds complexity."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 73,
|
"taskId": 73,
|
||||||
"taskTitle": "Implement Custom Model ID Support for Ollama/OpenRouter",
|
"taskTitle": "Implement Custom Model ID Support for Ollama/OpenRouter",
|
||||||
"complexityScore": 5,
|
"complexityScore": 7,
|
||||||
"recommendedSubtasks": 5,
|
"recommendedSubtasks": 5,
|
||||||
"expansionPrompt": "Break down the implementation of custom model ID support for Ollama/OpenRouter into detailed subtasks covering CLI flag implementation, model validation, interactive setup, configuration updates, and documentation.",
|
"expansionPrompt": "Expand the 'Implement Custom Model ID Support for Ollama/OpenRouter' task by detailing the steps for modifying the CLI, implementing the interactive setup, and handling validation and warnings.",
|
||||||
"reasoning": "This task involves allowing users to specify custom model IDs for Ollama and OpenRouter. It requires implementing CLI flags, validating models, updating the interactive setup, modifying configuration, and updating documentation. The task has no subtasks yet, so creating 5 subtasks would provide a clear implementation path."
|
"reasoning": "Requires integrating with external APIs and handling different model types. Validation and warnings are crucial."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"taskId": 75,
|
"taskId": 75,
|
||||||
"taskTitle": "Integrate Google Search Grounding for Research Role",
|
"taskTitle": "Integrate Google Search Grounding for Research Role",
|
||||||
"complexityScore": 4,
|
"complexityScore": 6,
|
||||||
"recommendedSubtasks": 4,
|
"recommendedSubtasks": 4,
|
||||||
"expansionPrompt": "Break down the integration of Google Search Grounding for research role into detailed subtasks covering AI service layer modification, conditional logic implementation, model configuration updates, and testing.",
|
"expansionPrompt": "Expand the 'Integrate Google Search Grounding for Research Role' task by detailing the steps for modifying the AI service layer, implementing the conditional logic, and updating the supported models.",
|
||||||
"reasoning": "This task involves updating the AI service layer to enable Google Search Grounding for the research role. It's relatively straightforward, requiring modifications to the AI service, implementing conditional logic, updating model configurations, and testing. The task has no subtasks yet, so creating 4 subtasks would provide a clear implementation path."
|
"reasoning": "Requires conditional logic and integration with the Google Search Grounding API."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"taskId": 76,
|
||||||
|
"taskTitle": "Develop E2E Test Framework for Taskmaster MCP Server (FastMCP over stdio)",
|
||||||
|
"complexityScore": 9,
|
||||||
|
"recommendedSubtasks": 7,
|
||||||
|
"expansionPrompt": "Expand the 'Develop E2E Test Framework for Taskmaster MCP Server (FastMCP over stdio)' task by detailing the steps for launching the FastMCP server, implementing the message protocol handler, and developing the request/response correlation mechanism.",
|
||||||
|
"reasoning": "Requires complex system integration and robust error handling. Designing a comprehensive test framework adds complexity."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* using the Vercel AI SDK.
|
* using the Vercel AI SDK.
|
||||||
*/
|
*/
|
||||||
import { createAnthropic } from '@ai-sdk/anthropic';
|
import { createAnthropic } from '@ai-sdk/anthropic';
|
||||||
import { generateText, streamText, generateObject, streamObject } from 'ai';
|
import { generateText, streamText, generateObject } from 'ai';
|
||||||
import { log } from '../../scripts/modules/utils.js'; // Assuming utils is accessible
|
import { log } from '../../scripts/modules/utils.js'; // Assuming utils is accessible
|
||||||
|
|
||||||
// TODO: Implement standardized functions for generateText, streamText, generateObject
|
// TODO: Implement standardized functions for generateText, streamText, generateObject
|
||||||
@@ -17,7 +17,7 @@ import { log } from '../../scripts/modules/utils.js'; // Assuming utils is acces
|
|||||||
// Remove the global variable and caching logic
|
// Remove the global variable and caching logic
|
||||||
// let anthropicClient;
|
// let anthropicClient;
|
||||||
|
|
||||||
function getClient(apiKey) {
|
function getClient(apiKey, baseUrl) {
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
// In a real scenario, this would use the config resolver.
|
// In a real scenario, this would use the config resolver.
|
||||||
// Throwing error here if key isn't passed for simplicity.
|
// Throwing error here if key isn't passed for simplicity.
|
||||||
@@ -30,14 +30,12 @@ function getClient(apiKey) {
|
|||||||
// Create and return a new instance directly with standard version header
|
// Create and return a new instance directly with standard version header
|
||||||
return createAnthropic({
|
return createAnthropic({
|
||||||
apiKey: apiKey,
|
apiKey: apiKey,
|
||||||
baseURL: 'https://api.anthropic.com/v1',
|
...(baseUrl && { baseURL: baseUrl }),
|
||||||
// Use standard version header instead of beta
|
// Use standard version header instead of beta
|
||||||
headers: {
|
headers: {
|
||||||
'anthropic-beta': 'output-128k-2025-02-19'
|
'anthropic-beta': 'output-128k-2025-02-19'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// }
|
|
||||||
// return anthropicClient;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Standardized Service Function Implementations ---
|
// --- Standardized Service Function Implementations ---
|
||||||
@@ -51,6 +49,7 @@ function getClient(apiKey) {
|
|||||||
* @param {Array<object>} params.messages - The messages array (e.g., [{ role: 'user', content: '...' }]).
|
* @param {Array<object>} params.messages - The messages array (e.g., [{ role: 'user', content: '...' }]).
|
||||||
* @param {number} [params.maxTokens] - Maximum tokens for the response.
|
* @param {number} [params.maxTokens] - Maximum tokens for the response.
|
||||||
* @param {number} [params.temperature] - Temperature for generation.
|
* @param {number} [params.temperature] - Temperature for generation.
|
||||||
|
* @param {string} [params.baseUrl] - The base URL for the Anthropic API.
|
||||||
* @returns {Promise<string>} The generated text content.
|
* @returns {Promise<string>} The generated text content.
|
||||||
* @throws {Error} If the API call fails.
|
* @throws {Error} If the API call fails.
|
||||||
*/
|
*/
|
||||||
@@ -59,11 +58,12 @@ export async function generateAnthropicText({
|
|||||||
modelId,
|
modelId,
|
||||||
messages,
|
messages,
|
||||||
maxTokens,
|
maxTokens,
|
||||||
temperature
|
temperature,
|
||||||
|
baseUrl
|
||||||
}) {
|
}) {
|
||||||
log('debug', `Generating Anthropic text with model: ${modelId}`);
|
log('debug', `Generating Anthropic text with model: ${modelId}`);
|
||||||
try {
|
try {
|
||||||
const client = getClient(apiKey);
|
const client = getClient(apiKey, baseUrl);
|
||||||
const result = await generateText({
|
const result = await generateText({
|
||||||
model: client(modelId),
|
model: client(modelId),
|
||||||
messages: messages,
|
messages: messages,
|
||||||
@@ -93,6 +93,7 @@ export async function generateAnthropicText({
|
|||||||
* @param {Array<object>} params.messages - The messages array.
|
* @param {Array<object>} params.messages - The messages array.
|
||||||
* @param {number} [params.maxTokens] - Maximum tokens for the response.
|
* @param {number} [params.maxTokens] - Maximum tokens for the response.
|
||||||
* @param {number} [params.temperature] - Temperature for generation.
|
* @param {number} [params.temperature] - Temperature for generation.
|
||||||
|
* @param {string} [params.baseUrl] - The base URL for the Anthropic API.
|
||||||
* @returns {Promise<object>} The full stream result object from the Vercel AI SDK.
|
* @returns {Promise<object>} The full stream result object from the Vercel AI SDK.
|
||||||
* @throws {Error} If the API call fails to initiate the stream.
|
* @throws {Error} If the API call fails to initiate the stream.
|
||||||
*/
|
*/
|
||||||
@@ -101,20 +102,20 @@ export async function streamAnthropicText({
|
|||||||
modelId,
|
modelId,
|
||||||
messages,
|
messages,
|
||||||
maxTokens,
|
maxTokens,
|
||||||
temperature
|
temperature,
|
||||||
|
baseUrl
|
||||||
}) {
|
}) {
|
||||||
log('debug', `Streaming Anthropic text with model: ${modelId}`);
|
log('debug', `Streaming Anthropic text with model: ${modelId}`);
|
||||||
try {
|
try {
|
||||||
const client = getClient(apiKey);
|
const client = getClient(apiKey, baseUrl);
|
||||||
|
|
||||||
// --- DEBUG LOGGING --- >>
|
|
||||||
log(
|
log(
|
||||||
'debug',
|
'debug',
|
||||||
'[streamAnthropicText] Parameters received by streamText:',
|
'[streamAnthropicText] Parameters received by streamText:',
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
{
|
{
|
||||||
modelId: modelId, // Log modelId being used
|
modelId: modelId,
|
||||||
messages: messages, // Log the messages array
|
messages: messages,
|
||||||
maxTokens: maxTokens,
|
maxTokens: maxTokens,
|
||||||
temperature: temperature
|
temperature: temperature
|
||||||
},
|
},
|
||||||
@@ -122,25 +123,19 @@ export async function streamAnthropicText({
|
|||||||
2
|
2
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
// --- << DEBUG LOGGING ---
|
|
||||||
|
|
||||||
const stream = await streamText({
|
const stream = await streamText({
|
||||||
model: client(modelId),
|
model: client(modelId),
|
||||||
messages: messages,
|
messages: messages,
|
||||||
maxTokens: maxTokens,
|
maxTokens: maxTokens,
|
||||||
temperature: temperature
|
temperature: temperature
|
||||||
// Beta header moved to client initialization
|
|
||||||
// TODO: Add other relevant parameters
|
// TODO: Add other relevant parameters
|
||||||
});
|
});
|
||||||
|
|
||||||
// *** RETURN THE FULL STREAM OBJECT, NOT JUST stream.textStream ***
|
// *** RETURN THE FULL STREAM OBJECT, NOT JUST stream.textStream ***
|
||||||
return stream;
|
return stream;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log(
|
log('error', `Anthropic streamText failed: ${error.message}`, error.stack);
|
||||||
'error',
|
|
||||||
`Anthropic streamText failed: ${error.message}`,
|
|
||||||
error.stack // Log stack trace for more details
|
|
||||||
);
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,6 +155,7 @@ export async function streamAnthropicText({
|
|||||||
* @param {number} [params.maxTokens] - Maximum tokens for the response.
|
* @param {number} [params.maxTokens] - Maximum tokens for the response.
|
||||||
* @param {number} [params.temperature] - Temperature for generation.
|
* @param {number} [params.temperature] - Temperature for generation.
|
||||||
* @param {number} [params.maxRetries] - Max retries for validation/generation.
|
* @param {number} [params.maxRetries] - Max retries for validation/generation.
|
||||||
|
* @param {string} [params.baseUrl] - The base URL for the Anthropic API.
|
||||||
* @returns {Promise<object>} The generated object matching the schema.
|
* @returns {Promise<object>} The generated object matching the schema.
|
||||||
* @throws {Error} If generation or validation fails.
|
* @throws {Error} If generation or validation fails.
|
||||||
*/
|
*/
|
||||||
@@ -171,24 +167,22 @@ export async function generateAnthropicObject({
|
|||||||
objectName = 'generated_object',
|
objectName = 'generated_object',
|
||||||
maxTokens,
|
maxTokens,
|
||||||
temperature,
|
temperature,
|
||||||
maxRetries = 3
|
maxRetries = 3,
|
||||||
|
baseUrl
|
||||||
}) {
|
}) {
|
||||||
log(
|
log(
|
||||||
'debug',
|
'debug',
|
||||||
`Generating Anthropic object ('${objectName}') with model: ${modelId}`
|
`Generating Anthropic object ('${objectName}') with model: ${modelId}`
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
const client = getClient(apiKey);
|
const client = getClient(apiKey, baseUrl);
|
||||||
|
|
||||||
// Log basic debug info
|
|
||||||
log(
|
log(
|
||||||
'debug',
|
'debug',
|
||||||
`Using maxTokens: ${maxTokens}, temperature: ${temperature}, model: ${modelId}`
|
`Using maxTokens: ${maxTokens}, temperature: ${temperature}, model: ${modelId}`
|
||||||
);
|
);
|
||||||
|
|
||||||
const result = await generateObject({
|
const result = await generateObject({
|
||||||
model: client(modelId),
|
model: client(modelId),
|
||||||
mode: 'tool', // Anthropic generally uses 'tool' mode for structured output
|
mode: 'tool',
|
||||||
schema: schema,
|
schema: schema,
|
||||||
messages: messages,
|
messages: messages,
|
||||||
tool: {
|
tool: {
|
||||||
@@ -199,14 +193,12 @@ export async function generateAnthropicObject({
|
|||||||
temperature: temperature,
|
temperature: temperature,
|
||||||
maxRetries: maxRetries
|
maxRetries: maxRetries
|
||||||
});
|
});
|
||||||
|
|
||||||
log(
|
log(
|
||||||
'debug',
|
'debug',
|
||||||
`Anthropic generateObject result received. Tokens: ${result.usage.completionTokens}/${result.usage.promptTokens}`
|
`Anthropic generateObject result received. Tokens: ${result.usage.completionTokens}/${result.usage.promptTokens}`
|
||||||
);
|
);
|
||||||
return result.object;
|
return result.object;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Simple error logging
|
|
||||||
log(
|
log(
|
||||||
'error',
|
'error',
|
||||||
`Anthropic generateObject ('${objectName}') failed: ${error.message}`
|
`Anthropic generateObject ('${objectName}') failed: ${error.message}`
|
||||||
|
|||||||
@@ -12,6 +12,16 @@ import { log } from '../../scripts/modules/utils.js'; // Import logging utility
|
|||||||
const DEFAULT_MODEL = 'gemini-2.0-pro'; // Or a suitable default
|
const DEFAULT_MODEL = 'gemini-2.0-pro'; // Or a suitable default
|
||||||
const DEFAULT_TEMPERATURE = 0.2; // Or a suitable default
|
const DEFAULT_TEMPERATURE = 0.2; // Or a suitable default
|
||||||
|
|
||||||
|
function getClient(apiKey, baseUrl) {
|
||||||
|
if (!apiKey) {
|
||||||
|
throw new Error('Google API key is required.');
|
||||||
|
}
|
||||||
|
return createGoogleGenerativeAI({
|
||||||
|
apiKey: apiKey,
|
||||||
|
...(baseUrl && { baseURL: baseUrl })
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates text using a Google AI model.
|
* Generates text using a Google AI model.
|
||||||
*
|
*
|
||||||
@@ -29,7 +39,8 @@ async function generateGoogleText({
|
|||||||
modelId = DEFAULT_MODEL,
|
modelId = DEFAULT_MODEL,
|
||||||
temperature = DEFAULT_TEMPERATURE,
|
temperature = DEFAULT_TEMPERATURE,
|
||||||
messages,
|
messages,
|
||||||
maxTokens // Note: Vercel SDK might handle this differently, needs verification
|
maxTokens,
|
||||||
|
baseUrl
|
||||||
}) {
|
}) {
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
throw new Error('Google API key is required.');
|
throw new Error('Google API key is required.');
|
||||||
@@ -37,28 +48,21 @@ async function generateGoogleText({
|
|||||||
log('info', `Generating text with Google model: ${modelId}`);
|
log('info', `Generating text with Google model: ${modelId}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// const google = new GoogleGenerativeAI({ apiKey }); // Incorrect instantiation
|
const googleProvider = getClient(apiKey, baseUrl);
|
||||||
const googleProvider = createGoogleGenerativeAI({ apiKey }); // Correct instantiation
|
const model = googleProvider(modelId);
|
||||||
// const model = google.getGenerativeModel({ model: modelId }); // Incorrect model retrieval
|
|
||||||
const model = googleProvider(modelId); // Correct model retrieval
|
|
||||||
|
|
||||||
// Construct payload suitable for Vercel SDK's generateText
|
|
||||||
// Note: The exact structure might depend on how messages are passed
|
|
||||||
const result = await generateText({
|
const result = await generateText({
|
||||||
model, // Pass the model instance
|
model,
|
||||||
messages, // Pass the messages array directly
|
messages,
|
||||||
temperature,
|
temperature,
|
||||||
maxOutputTokens: maxTokens // Map to correct Vercel SDK param if available
|
maxOutputTokens: maxTokens
|
||||||
});
|
});
|
||||||
|
return result.text;
|
||||||
// Assuming result structure provides text directly or within a property
|
|
||||||
return result.text; // Adjust based on actual SDK response
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log(
|
log(
|
||||||
'error',
|
'error',
|
||||||
`Error generating text with Google (${modelId}): ${error.message}`
|
`Error generating text with Google (${modelId}): ${error.message}`
|
||||||
);
|
);
|
||||||
throw error; // Re-throw for unified service handler
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +83,8 @@ async function streamGoogleText({
|
|||||||
modelId = DEFAULT_MODEL,
|
modelId = DEFAULT_MODEL,
|
||||||
temperature = DEFAULT_TEMPERATURE,
|
temperature = DEFAULT_TEMPERATURE,
|
||||||
messages,
|
messages,
|
||||||
maxTokens
|
maxTokens,
|
||||||
|
baseUrl
|
||||||
}) {
|
}) {
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
throw new Error('Google API key is required.');
|
throw new Error('Google API key is required.');
|
||||||
@@ -87,19 +92,15 @@ async function streamGoogleText({
|
|||||||
log('info', `Streaming text with Google model: ${modelId}`);
|
log('info', `Streaming text with Google model: ${modelId}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// const google = new GoogleGenerativeAI({ apiKey }); // Incorrect instantiation
|
const googleProvider = getClient(apiKey, baseUrl);
|
||||||
const googleProvider = createGoogleGenerativeAI({ apiKey }); // Correct instantiation
|
const model = googleProvider(modelId);
|
||||||
// const model = google.getGenerativeModel({ model: modelId }); // Incorrect model retrieval
|
|
||||||
const model = googleProvider(modelId); // Correct model retrieval
|
|
||||||
|
|
||||||
const stream = await streamText({
|
const stream = await streamText({
|
||||||
model, // Pass the model instance
|
model,
|
||||||
messages,
|
messages,
|
||||||
temperature,
|
temperature,
|
||||||
maxOutputTokens: maxTokens
|
maxOutputTokens: maxTokens
|
||||||
});
|
});
|
||||||
|
return stream;
|
||||||
return stream; // Return the stream directly
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log(
|
log(
|
||||||
'error',
|
'error',
|
||||||
@@ -130,7 +131,8 @@ async function generateGoogleObject({
|
|||||||
messages,
|
messages,
|
||||||
schema,
|
schema,
|
||||||
objectName, // Note: Vercel SDK might use this differently or not at all
|
objectName, // Note: Vercel SDK might use this differently or not at all
|
||||||
maxTokens
|
maxTokens,
|
||||||
|
baseUrl
|
||||||
}) {
|
}) {
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
throw new Error('Google API key is required.');
|
throw new Error('Google API key is required.');
|
||||||
@@ -138,23 +140,16 @@ async function generateGoogleObject({
|
|||||||
log('info', `Generating object with Google model: ${modelId}`);
|
log('info', `Generating object with Google model: ${modelId}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// const google = new GoogleGenerativeAI({ apiKey }); // Incorrect instantiation
|
const googleProvider = getClient(apiKey, baseUrl);
|
||||||
const googleProvider = createGoogleGenerativeAI({ apiKey }); // Correct instantiation
|
const model = googleProvider(modelId);
|
||||||
// const model = google.getGenerativeModel({ model: modelId }); // Incorrect model retrieval
|
|
||||||
const model = googleProvider(modelId); // Correct model retrieval
|
|
||||||
|
|
||||||
const { object } = await generateObject({
|
const { object } = await generateObject({
|
||||||
model, // Pass the model instance
|
model,
|
||||||
schema,
|
schema,
|
||||||
messages,
|
messages,
|
||||||
temperature,
|
temperature,
|
||||||
maxOutputTokens: maxTokens
|
maxOutputTokens: maxTokens
|
||||||
// Note: 'objectName' or 'mode' might not be directly applicable here
|
|
||||||
// depending on how `@ai-sdk/google` handles `generateObject`.
|
|
||||||
// Check SDK docs if specific tool calling/JSON mode needs explicit setup.
|
|
||||||
});
|
});
|
||||||
|
return object;
|
||||||
return object; // Return the parsed object
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log(
|
log(
|
||||||
'error',
|
'error',
|
||||||
|
|||||||
@@ -1,16 +1,26 @@
|
|||||||
import { createOpenAI, openai } from '@ai-sdk/openai'; // Using openai provider from Vercel AI SDK
|
import { createOpenAI } from '@ai-sdk/openai'; // Using openai provider from Vercel AI SDK
|
||||||
import { generateText, streamText, generateObject } from 'ai'; // Import necessary functions from 'ai'
|
import { generateObject } from 'ai'; // Import necessary functions from 'ai'
|
||||||
import { log } from '../../scripts/modules/utils.js';
|
import { log } from '../../scripts/modules/utils.js';
|
||||||
|
|
||||||
|
function getClient(apiKey, baseUrl) {
|
||||||
|
if (!apiKey) {
|
||||||
|
throw new Error('OpenAI API key is required.');
|
||||||
|
}
|
||||||
|
return createOpenAI({
|
||||||
|
apiKey: apiKey,
|
||||||
|
...(baseUrl && { baseURL: baseUrl })
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates text using OpenAI models via Vercel AI SDK.
|
* Generates text using OpenAI models via Vercel AI SDK.
|
||||||
*
|
*
|
||||||
* @param {object} params - Parameters including apiKey, modelId, messages, maxTokens, temperature.
|
* @param {object} params - Parameters including apiKey, modelId, messages, maxTokens, temperature, baseUrl.
|
||||||
* @returns {Promise<string>} The generated text content.
|
* @returns {Promise<string>} The generated text content.
|
||||||
* @throws {Error} If API call fails.
|
* @throws {Error} If API call fails.
|
||||||
*/
|
*/
|
||||||
export async function generateOpenAIText(params) {
|
export async function generateOpenAIText(params) {
|
||||||
const { apiKey, modelId, messages, maxTokens, temperature } = params;
|
const { apiKey, modelId, messages, maxTokens, temperature, baseUrl } = params;
|
||||||
log('debug', `generateOpenAIText called with model: ${modelId}`);
|
log('debug', `generateOpenAIText called with model: ${modelId}`);
|
||||||
|
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
@@ -23,18 +33,15 @@ export async function generateOpenAIText(params) {
|
|||||||
throw new Error('Invalid or empty messages array provided for OpenAI.');
|
throw new Error('Invalid or empty messages array provided for OpenAI.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const openaiClient = createOpenAI({ apiKey });
|
const openaiClient = getClient(apiKey, baseUrl);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await openaiClient.chat(messages, {
|
const result = await openaiClient.chat(messages, {
|
||||||
// Updated: Use openaiClient.chat directly
|
|
||||||
model: modelId,
|
model: modelId,
|
||||||
max_tokens: maxTokens,
|
max_tokens: maxTokens,
|
||||||
temperature
|
temperature
|
||||||
});
|
});
|
||||||
|
|
||||||
// Adjust based on actual Vercel SDK response structure for openaiClient.chat
|
|
||||||
// This might need refinement based on testing the SDK's output.
|
|
||||||
const textContent = result?.choices?.[0]?.message?.content?.trim();
|
const textContent = result?.choices?.[0]?.message?.content?.trim();
|
||||||
|
|
||||||
if (!textContent) {
|
if (!textContent) {
|
||||||
@@ -65,12 +72,12 @@ export async function generateOpenAIText(params) {
|
|||||||
/**
|
/**
|
||||||
* Streams text using OpenAI models via Vercel AI SDK.
|
* Streams text using OpenAI models via Vercel AI SDK.
|
||||||
*
|
*
|
||||||
* @param {object} params - Parameters including apiKey, modelId, messages, maxTokens, temperature.
|
* @param {object} params - Parameters including apiKey, modelId, messages, maxTokens, temperature, baseUrl.
|
||||||
* @returns {Promise<ReadableStream>} A readable stream of text deltas.
|
* @returns {Promise<ReadableStream>} A readable stream of text deltas.
|
||||||
* @throws {Error} If API call fails.
|
* @throws {Error} If API call fails.
|
||||||
*/
|
*/
|
||||||
export async function streamOpenAIText(params) {
|
export async function streamOpenAIText(params) {
|
||||||
const { apiKey, modelId, messages, maxTokens, temperature } = params;
|
const { apiKey, modelId, messages, maxTokens, temperature, baseUrl } = params;
|
||||||
log('debug', `streamOpenAIText called with model: ${modelId}`);
|
log('debug', `streamOpenAIText called with model: ${modelId}`);
|
||||||
|
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
@@ -85,12 +92,10 @@ export async function streamOpenAIText(params) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const openaiClient = createOpenAI({ apiKey });
|
const openaiClient = getClient(apiKey, baseUrl);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Use the streamText function from Vercel AI SDK core
|
|
||||||
const stream = await openaiClient.chat.stream(messages, {
|
const stream = await openaiClient.chat.stream(messages, {
|
||||||
// Updated: Use openaiClient.chat.stream
|
|
||||||
model: modelId,
|
model: modelId,
|
||||||
max_tokens: maxTokens,
|
max_tokens: maxTokens,
|
||||||
temperature
|
temperature
|
||||||
@@ -100,7 +105,6 @@ export async function streamOpenAIText(params) {
|
|||||||
'debug',
|
'debug',
|
||||||
`OpenAI streamText initiated successfully for model: ${modelId}`
|
`OpenAI streamText initiated successfully for model: ${modelId}`
|
||||||
);
|
);
|
||||||
// The Vercel SDK's streamText should directly return the stream object
|
|
||||||
return stream;
|
return stream;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log(
|
log(
|
||||||
@@ -117,7 +121,7 @@ export async function streamOpenAIText(params) {
|
|||||||
/**
|
/**
|
||||||
* Generates structured objects using OpenAI models via Vercel AI SDK.
|
* Generates structured objects using OpenAI models via Vercel AI SDK.
|
||||||
*
|
*
|
||||||
* @param {object} params - Parameters including apiKey, modelId, messages, schema, objectName, maxTokens, temperature.
|
* @param {object} params - Parameters including apiKey, modelId, messages, schema, objectName, maxTokens, temperature, baseUrl.
|
||||||
* @returns {Promise<object>} The generated object matching the schema.
|
* @returns {Promise<object>} The generated object matching the schema.
|
||||||
* @throws {Error} If API call fails or object generation fails.
|
* @throws {Error} If API call fails or object generation fails.
|
||||||
*/
|
*/
|
||||||
@@ -129,7 +133,8 @@ export async function generateOpenAIObject(params) {
|
|||||||
schema,
|
schema,
|
||||||
objectName,
|
objectName,
|
||||||
maxTokens,
|
maxTokens,
|
||||||
temperature
|
temperature,
|
||||||
|
baseUrl
|
||||||
} = params;
|
} = params;
|
||||||
log(
|
log(
|
||||||
'debug',
|
'debug',
|
||||||
@@ -145,10 +150,9 @@ export async function generateOpenAIObject(params) {
|
|||||||
if (!objectName)
|
if (!objectName)
|
||||||
throw new Error('Object name is required for OpenAI object generation.');
|
throw new Error('Object name is required for OpenAI object generation.');
|
||||||
|
|
||||||
const openaiClient = createOpenAI({ apiKey });
|
const openaiClient = getClient(apiKey, baseUrl);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Use the imported generateObject function from 'ai' package
|
|
||||||
const result = await generateObject({
|
const result = await generateObject({
|
||||||
model: openaiClient(modelId),
|
model: openaiClient(modelId),
|
||||||
schema: schema,
|
schema: schema,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user