From af53525cbc660a595b67d4bb90d906911c71f45d Mon Sep 17 00:00:00 2001 From: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com> Date: Fri, 26 Sep 2025 20:58:15 +0200 Subject: [PATCH 1/2] fix: handle subtasks in getTask method (#1254) Co-authored-by: Ralph Khreish Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> --- .changeset/fix-subtask-getTask.md | 7 +++ packages/tm-core/src/services/task-service.ts | 25 +++++++-- .../src/storage/file-storage/file-storage.ts | 56 +++++++++++++++++++ 3 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 .changeset/fix-subtask-getTask.md diff --git a/.changeset/fix-subtask-getTask.md b/.changeset/fix-subtask-getTask.md new file mode 100644 index 00000000..ed79e1a6 --- /dev/null +++ b/.changeset/fix-subtask-getTask.md @@ -0,0 +1,7 @@ +--- +"task-master-ai": patch +--- + +Fixed issue where `tm show` command could not find subtasks using dotted notation IDs (e.g., '8.1'). + +- The command now properly searches within parent task subtasks and returns the correct subtask information. \ No newline at end of file diff --git a/packages/tm-core/src/services/task-service.ts b/packages/tm-core/src/services/task-service.ts index 0670dfa1..2b050e29 100644 --- a/packages/tm-core/src/services/task-service.ts +++ b/packages/tm-core/src/services/task-service.ts @@ -135,15 +135,28 @@ export class TaskService { } /** - * Get a single task by ID + * Get a single task by ID - delegates to storage layer */ async getTask(taskId: string, tag?: string): Promise { - const result = await this.getTaskList({ - tag, - includeSubtasks: true - }); + // Use provided tag or get active tag + const activeTag = tag || this.getActiveTag(); - return result.tasks.find((t) => t.id === taskId) || null; + try { + // Delegate to storage layer which handles the specific logic for tasks vs subtasks + return await this.storage.loadTask(String(taskId), activeTag); + } catch (error) { + throw new TaskMasterError( + `Failed to get task ${taskId}`, + ERROR_CODES.STORAGE_ERROR, + { + operation: 'getTask', + resource: 'task', + taskId: String(taskId), + tag: activeTag + }, + error as Error + ); + } } /** diff --git a/packages/tm-core/src/storage/file-storage/file-storage.ts b/packages/tm-core/src/storage/file-storage/file-storage.ts index a0486e41..b4349e4c 100644 --- a/packages/tm-core/src/storage/file-storage/file-storage.ts +++ b/packages/tm-core/src/storage/file-storage/file-storage.ts @@ -105,9 +105,65 @@ export class FileStorage implements IStorage { /** * Load a single task by ID from the tasks.json file + * Handles both regular tasks and subtasks (with dotted notation like "1.2") */ async loadTask(taskId: string, tag?: string): Promise { const tasks = await this.loadTasks(tag); + + // Check if this is a subtask (contains a dot) + if (taskId.includes('.')) { + const [parentId, subtaskId] = taskId.split('.'); + const parentTask = tasks.find((t) => String(t.id) === parentId); + + if (!parentTask || !parentTask.subtasks) { + return null; + } + + const subtask = parentTask.subtasks.find( + (st) => String(st.id) === subtaskId + ); + if (!subtask) { + return null; + } + + const toFullSubId = (maybeDotId: string | number): string => { + const depId = String(maybeDotId); + return depId.includes('.') ? depId : `${parentTask.id}.${depId}`; + }; + const resolvedDependencies = + subtask.dependencies?.map((dep) => toFullSubId(dep)) ?? []; + + // Return a Task-like object for the subtask with the full dotted ID + // Following the same pattern as findTaskById in utils.js + const subtaskResult = { + ...subtask, + id: taskId, // Use the full dotted ID + title: subtask.title || `Subtask ${subtaskId}`, + description: subtask.description || '', + status: subtask.status || 'pending', + priority: subtask.priority || parentTask.priority || 'medium', + dependencies: resolvedDependencies, + details: subtask.details || '', + testStrategy: subtask.testStrategy || '', + subtasks: [], + tags: parentTask.tags || [], + assignee: subtask.assignee || parentTask.assignee, + complexity: subtask.complexity || parentTask.complexity, + createdAt: subtask.createdAt || parentTask.createdAt, + updatedAt: subtask.updatedAt || parentTask.updatedAt, + // Add reference to parent task for context (like utils.js does) + parentTask: { + id: parentTask.id, + title: parentTask.title, + status: parentTask.status + }, + isSubtask: true + }; + + return subtaskResult; + } + + // Handle regular task lookup return tasks.find((task) => String(task.id) === String(taskId)) || null; } From 3b3dbabed18a5c37ef770604ec2357d054e79e21 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 27 Sep 2025 08:56:38 +0200 Subject: [PATCH 2/2] Version Packages (#1255) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com> --- .changeset/fix-subtask-getTask.md | 7 ------- CHANGELOG.md | 7 +++++++ apps/extension/CHANGELOG.md | 7 +++++++ apps/extension/package.json | 4 ++-- package-lock.json | 8 ++++---- package.json | 2 +- 6 files changed, 21 insertions(+), 14 deletions(-) delete mode 100644 .changeset/fix-subtask-getTask.md diff --git a/.changeset/fix-subtask-getTask.md b/.changeset/fix-subtask-getTask.md deleted file mode 100644 index ed79e1a6..00000000 --- a/.changeset/fix-subtask-getTask.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"task-master-ai": patch ---- - -Fixed issue where `tm show` command could not find subtasks using dotted notation IDs (e.g., '8.1'). - -- The command now properly searches within parent task subtasks and returns the correct subtask information. \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 71c32093..e3dbe8d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # task-master-ai +## 0.27.3 + +### Patch Changes + +- [#1254](https://github.com/eyaltoledano/claude-task-master/pull/1254) [`af53525`](https://github.com/eyaltoledano/claude-task-master/commit/af53525cbc660a595b67d4bb90d906911c71f45d) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fixed issue where `tm show` command could not find subtasks using dotted notation IDs (e.g., '8.1'). + - The command now properly searches within parent task subtasks and returns the correct subtask information. + ## 0.27.2 ### Patch Changes diff --git a/apps/extension/CHANGELOG.md b/apps/extension/CHANGELOG.md index 6c98d5dc..5b7cdea4 100644 --- a/apps/extension/CHANGELOG.md +++ b/apps/extension/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 0.25.4 + +### Patch Changes + +- Updated dependencies [[`af53525`](https://github.com/eyaltoledano/claude-task-master/commit/af53525cbc660a595b67d4bb90d906911c71f45d)]: + - task-master-ai@0.27.3 + ## 0.25.3 ### Patch Changes diff --git a/apps/extension/package.json b/apps/extension/package.json index 88f33ae0..705cb9bd 100644 --- a/apps/extension/package.json +++ b/apps/extension/package.json @@ -3,7 +3,7 @@ "private": true, "displayName": "TaskMaster", "description": "A visual Kanban board interface for TaskMaster projects in VS Code", - "version": "0.25.3", + "version": "0.25.4", "publisher": "Hamster", "icon": "assets/icon.png", "engines": { @@ -240,7 +240,7 @@ "check-types": "tsc --noEmit" }, "dependencies": { - "task-master-ai": "0.27.2" + "task-master-ai": "0.27.3" }, "devDependencies": { "@dnd-kit/core": "^6.3.1", diff --git a/package-lock.json b/package-lock.json index b2a6b523..aca4e236 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "task-master-ai", - "version": "0.27.2", + "version": "0.27.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "task-master-ai", - "version": "0.27.2", + "version": "0.27.3", "license": "MIT WITH Commons-Clause", "workspaces": [ "apps/*", @@ -357,9 +357,9 @@ } }, "apps/extension": { - "version": "0.25.3", + "version": "0.25.4", "dependencies": { - "task-master-ai": "0.27.2" + "task-master-ai": "0.27.3" }, "devDependencies": { "@dnd-kit/core": "^6.3.1", diff --git a/package.json b/package.json index 3fb6eb0a..95045826 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "task-master-ai", - "version": "0.27.2", + "version": "0.27.3", "description": "A task management system for ambitious AI-driven development that doesn't overwhelm and confuse Cursor.", "main": "index.js", "type": "module",