From 04b6a3cb21c3eb87336ed216fda0af3e60eea56c Mon Sep 17 00:00:00 2001 From: Eyal Toledano Date: Thu, 8 May 2025 19:34:00 -0400 Subject: [PATCH] feat(telemetry): Integrate AI usage telemetry into analyze-complexity This commit applies the standard telemetry pattern to the analyze-task-complexity command and its corresponding MCP tool. Key Changes: 1. Core Logic (scripts/modules/task-manager/analyze-task-complexity.js): - The call to generateTextService now includes commandName: 'analyze-complexity' and outputType. - The full response { mainResult, telemetryData } is captured. - mainResult (the AI-generated text) is used for parsing the complexity report JSON. - If running in CLI mode (outputFormat === 'text'), displayAiUsageSummary is called with the telemetryData. - The function now returns { report: ..., telemetryData: ... }. 2. Direct Function (mcp-server/src/core/direct-functions/analyze-task-complexity.js): - The call to the core analyzeTaskComplexity function now passes the necessary context for telemetry (commandName, outputType). - The successful response object now correctly extracts coreResult.telemetryData and includes it in the data.telemetryData field returned to the MCP client. --- .../analyze-task-complexity.js | 32 +- .../task-manager/analyze-task-complexity.js | 106 ++-- scripts/task-complexity-report.json | 580 +++++++++--------- tasks/task_077.txt | 4 +- tasks/tasks.json | 12 +- tests/unit/ai-services-unified.test.js | 4 +- 6 files changed, 354 insertions(+), 384 deletions(-) diff --git a/mcp-server/src/core/direct-functions/analyze-task-complexity.js b/mcp-server/src/core/direct-functions/analyze-task-complexity.js index 503a5ea3..8a6cd4ca 100644 --- a/mcp-server/src/core/direct-functions/analyze-task-complexity.js +++ b/mcp-server/src/core/direct-functions/analyze-task-complexity.js @@ -79,17 +79,19 @@ export async function analyzeTaskComplexityDirect(args, log, context = {}) { } let report; + let coreResult; try { // --- Call Core Function (Pass context separately) --- // Pass coreOptions as the first argument // Pass context object { session, mcpLog } as the second argument - report = await analyzeTaskComplexity( - coreOptions, // Pass options object - { session, mcpLog: logWrapper } // Pass context object - // Removed the explicit 'json' format argument, assuming context handling is sufficient - // If issues persist, we might need to add an explicit format param to analyzeTaskComplexity - ); + coreResult = await analyzeTaskComplexity(coreOptions, { + session, + mcpLog: logWrapper, + commandName: 'analyze-complexity', + outputType: 'mcp' + }); + report = coreResult.report; } catch (error) { log.error( `Error in analyzeTaskComplexity core function: ${error.message}` @@ -125,8 +127,11 @@ export async function analyzeTaskComplexityDirect(args, log, context = {}) { }; } - // Added a check to ensure report is defined before accessing its properties - if (!report || typeof report !== 'object') { + if ( + !coreResult || + !coreResult.report || + typeof coreResult.report !== 'object' + ) { log.error( 'Core analysis function returned an invalid or undefined response.' ); @@ -141,8 +146,8 @@ export async function analyzeTaskComplexityDirect(args, log, context = {}) { try { // Ensure complexityAnalysis exists and is an array - const analysisArray = Array.isArray(report.complexityAnalysis) - ? report.complexityAnalysis + const analysisArray = Array.isArray(coreResult.report.complexityAnalysis) + ? coreResult.report.complexityAnalysis : []; // Count tasks by complexity (remains the same) @@ -159,15 +164,16 @@ export async function analyzeTaskComplexityDirect(args, log, context = {}) { return { success: true, data: { - message: `Task complexity analysis complete. Report saved to ${outputPath}`, // Use outputPath from args - reportPath: outputPath, // Use outputPath from args + message: `Task complexity analysis complete. Report saved to ${outputPath}`, + reportPath: outputPath, reportSummary: { taskCount: analysisArray.length, highComplexityTasks, mediumComplexityTasks, lowComplexityTasks }, - fullReport: report // Now includes the full report + fullReport: coreResult.report, + telemetryData: coreResult.telemetryData } }; } catch (parseError) { diff --git a/scripts/modules/task-manager/analyze-task-complexity.js b/scripts/modules/task-manager/analyze-task-complexity.js index 472e86a2..ac828436 100644 --- a/scripts/modules/task-manager/analyze-task-complexity.js +++ b/scripts/modules/task-manager/analyze-task-complexity.js @@ -4,7 +4,11 @@ import readline from 'readline'; import { log, readJSON, writeJSON, isSilentMode } from '../utils.js'; -import { startLoadingIndicator, stopLoadingIndicator } from '../ui.js'; +import { + startLoadingIndicator, + stopLoadingIndicator, + displayAiUsageSummary +} from '../ui.js'; import { generateTextService } from '../ai-services-unified.js'; @@ -196,29 +200,32 @@ async function analyzeTaskComplexity(options, context = {}) { } const prompt = generateInternalComplexityAnalysisPrompt(tasksData); - // System prompt remains simple for text generation const systemPrompt = 'You are an expert software architect and project manager analyzing task complexity. Respond only with the requested valid JSON array.'; let loadingIndicator = null; if (outputFormat === 'text') { - loadingIndicator = startLoadingIndicator('Calling AI service...'); + loadingIndicator = startLoadingIndicator( + `${useResearch ? 'Researching' : 'Analyzing'} the complexity of your tasks with AI...\n` + ); } - let fullResponse = ''; // To store the raw text response + let aiServiceResponse = null; + let complexityAnalysis = null; try { const role = useResearch ? 'research' : 'main'; - fullResponse = await generateTextService({ + aiServiceResponse = await generateTextService({ prompt, systemPrompt, role, session, - projectRoot + projectRoot, + commandName: 'analyze-complexity', + outputType: mcpLog ? 'mcp' : 'cli' }); - // --- Stop Loading Indicator (Unchanged) --- if (loadingIndicator) { stopLoadingIndicator(loadingIndicator); loadingIndicator = null; @@ -230,26 +237,18 @@ async function analyzeTaskComplexity(options, context = {}) { chalk.green('AI service call complete. Parsing response...') ); } - // --- End Stop Loading Indicator --- - // --- Re-introduce Manual JSON Parsing & Cleanup --- reportLog(`Parsing complexity analysis from text response...`, 'info'); - let complexityAnalysis; try { - let cleanedResponse = fullResponse; - // Basic trim first + let cleanedResponse = aiServiceResponse.mainResult; cleanedResponse = cleanedResponse.trim(); - // Remove potential markdown code block fences const codeBlockMatch = cleanedResponse.match( /```(?:json)?\s*([\s\S]*?)\s*```/ ); if (codeBlockMatch) { - cleanedResponse = codeBlockMatch[1].trim(); // Trim content inside block - reportLog('Extracted JSON from code block', 'info'); + cleanedResponse = codeBlockMatch[1].trim(); } else { - // If no code block, ensure it starts with '[' and ends with ']' - // This is less robust but a common fallback const firstBracket = cleanedResponse.indexOf('['); const lastBracket = cleanedResponse.lastIndexOf(']'); if (firstBracket !== -1 && lastBracket > firstBracket) { @@ -257,13 +256,11 @@ async function analyzeTaskComplexity(options, context = {}) { firstBracket, lastBracket + 1 ); - reportLog('Extracted content between first [ and last ]', 'info'); } else { reportLog( 'Warning: Response does not appear to be a JSON array.', 'warn' ); - // Keep going, maybe JSON.parse can handle it or will fail informatively } } @@ -277,48 +274,23 @@ async function analyzeTaskComplexity(options, context = {}) { ); } - try { - complexityAnalysis = JSON.parse(cleanedResponse); - } catch (jsonError) { - reportLog( - 'Initial JSON parsing failed. Raw response might be malformed.', - 'error' - ); - reportLog(`Original JSON Error: ${jsonError.message}`, 'error'); - if (outputFormat === 'text' && getDebugFlag(session)) { - console.log(chalk.red('--- Start Raw Malformed Response ---')); - console.log(chalk.gray(fullResponse)); - console.log(chalk.red('--- End Raw Malformed Response ---')); - } - // Re-throw the specific JSON parsing error - throw new Error( - `Failed to parse JSON response: ${jsonError.message}` - ); - } - - // Ensure it's an array after parsing - if (!Array.isArray(complexityAnalysis)) { - throw new Error('Parsed response is not a valid JSON array.'); - } - } catch (error) { - // Catch errors specifically from the parsing/cleanup block - if (loadingIndicator) stopLoadingIndicator(loadingIndicator); // Ensure indicator stops + complexityAnalysis = JSON.parse(cleanedResponse); + } catch (parseError) { + if (loadingIndicator) stopLoadingIndicator(loadingIndicator); reportLog( - `Error parsing complexity analysis JSON: ${error.message}`, + `Error parsing complexity analysis JSON: ${parseError.message}`, 'error' ); if (outputFormat === 'text') { console.error( chalk.red( - `Error parsing complexity analysis JSON: ${error.message}` + `Error parsing complexity analysis JSON: ${parseError.message}` ) ); } - throw error; // Re-throw parsing error + throw parseError; } - // --- End Manual JSON Parsing & Cleanup --- - // --- Post-processing (Missing Task Check) - (Unchanged) --- const taskIds = tasksData.tasks.map((t) => t.id); const analysisTaskIds = complexityAnalysis.map((a) => a.taskId); const missingTaskIds = taskIds.filter( @@ -353,10 +325,8 @@ async function analyzeTaskComplexity(options, context = {}) { } } } - // --- End Post-processing --- - // --- Report Creation & Writing (Unchanged) --- - const finalReport = { + const report = { meta: { generatedAt: new Date().toISOString(), tasksAnalyzed: tasksData.tasks.length, @@ -367,15 +337,13 @@ async function analyzeTaskComplexity(options, context = {}) { complexityAnalysis: complexityAnalysis }; reportLog(`Writing complexity report to ${outputPath}...`, 'info'); - writeJSON(outputPath, finalReport); + writeJSON(outputPath, report); reportLog( `Task complexity analysis complete. Report written to ${outputPath}`, 'success' ); - // --- End Report Creation & Writing --- - // --- Display CLI Summary (Unchanged) --- if (outputFormat === 'text') { console.log( chalk.green( @@ -429,23 +397,28 @@ async function analyzeTaskComplexity(options, context = {}) { if (getDebugFlag(session)) { console.debug( chalk.gray( - `Final analysis object: ${JSON.stringify(finalReport, null, 2)}` + `Final analysis object: ${JSON.stringify(report, null, 2)}` ) ); } - } - // --- End Display CLI Summary --- - return finalReport; - } catch (error) { - // Catches errors from generateTextService call + if (aiServiceResponse.telemetryData) { + displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli'); + } + } + + return { + report: report, + telemetryData: aiServiceResponse?.telemetryData + }; + } catch (aiError) { if (loadingIndicator) stopLoadingIndicator(loadingIndicator); - reportLog(`Error during AI service call: ${error.message}`, 'error'); + reportLog(`Error during AI service call: ${aiError.message}`, 'error'); if (outputFormat === 'text') { console.error( - chalk.red(`Error during AI service call: ${error.message}`) + chalk.red(`Error during AI service call: ${aiError.message}`) ); - if (error.message.includes('API key')) { + if (aiError.message.includes('API key')) { console.log( chalk.yellow( '\nPlease ensure your API keys are correctly configured in .env or ~/.taskmaster/.env' @@ -456,10 +429,9 @@ async function analyzeTaskComplexity(options, context = {}) { ); } } - throw error; // Re-throw AI service error + throw aiError; } } catch (error) { - // Catches general errors (file read, etc.) reportLog(`Error analyzing task complexity: ${error.message}`, 'error'); if (outputFormat === 'text') { console.error( diff --git a/scripts/task-complexity-report.json b/scripts/task-complexity-report.json index afe9a655..cbe9fdf9 100644 --- a/scripts/task-complexity-report.json +++ b/scripts/task-complexity-report.json @@ -1,299 +1,283 @@ { - "meta": { - "generatedAt": "2025-05-03T04:45:36.864Z", - "tasksAnalyzed": 36, - "thresholdScore": 5, - "projectName": "Taskmaster", - "usedResearch": false - }, - "complexityAnalysis": [ - { - "taskId": 24, - "taskTitle": "Implement AI-Powered Test Generation Command", - "complexityScore": 8, - "recommendedSubtasks": 5, - "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": "Requires AI integration, complex logic, and thorough testing. Prompt engineering and API interaction add significant complexity." - }, - { - "taskId": 26, - "taskTitle": "Implement Context Foundation for AI Operations", - "complexityScore": 7, - "recommendedSubtasks": 6, - "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": "Involves modifying multiple commands and integrating different context sources. Error handling and backwards compatibility are crucial." - }, - { - "taskId": 27, - "taskTitle": "Implement Context Enhancements for AI Operations", - "complexityScore": 8, - "recommendedSubtasks": 6, - "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": "Builds upon the previous task with more sophisticated context extraction and integration. Requires intelligent parsing and summarization." - }, - { - "taskId": 28, - "taskTitle": "Implement Advanced ContextManager System", - "complexityScore": 9, - "recommendedSubtasks": 7, - "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": "A comprehensive system requiring careful design, optimization, and testing. Involves complex algorithms and performance considerations." - }, - { - "taskId": 32, - "taskTitle": "Implement \"learn\" Command for Automatic Cursor Rule Generation", - "complexityScore": 9, - "recommendedSubtasks": 10, - "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": "Requires deep integration with Cursor's data, complex pattern analysis, and AI interaction. Significant error handling and performance optimization are needed." - }, - { - "taskId": 40, - "taskTitle": "Implement 'plan' Command for Task Implementation Planning", - "complexityScore": 6, - "recommendedSubtasks": 4, - "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": "Involves AI integration and requires careful formatting and error handling. Switching between Claude and Perplexity adds complexity." - }, - { - "taskId": 41, - "taskTitle": "Implement Visual Task Dependency Graph in Terminal", - "complexityScore": 8, - "recommendedSubtasks": 8, - "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": "Requires complex graph algorithms and terminal rendering. Accessibility and performance are important considerations." - }, - { - "taskId": 42, - "taskTitle": "Implement MCP-to-MCP Communication Protocol", - "complexityScore": 8, - "recommendedSubtasks": 7, - "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": "Requires designing a new protocol and implementing communication with external systems. Security and error handling are critical." - }, - { - "taskId": 43, - "taskTitle": "Add Research Flag to Add-Task Command", - "complexityScore": 5, - "recommendedSubtasks": 3, - "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": "Relatively straightforward, but requires careful handling of subtask generation and linking." - }, - { - "taskId": 44, - "taskTitle": "Implement Task Automation with Webhooks and Event Triggers", - "complexityScore": 8, - "recommendedSubtasks": 7, - "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": "Requires designing a robust event system and integrating with external services. Security and error handling are critical." - }, - { - "taskId": 45, - "taskTitle": "Implement GitHub Issue Import Feature", - "complexityScore": 7, - "recommendedSubtasks": 5, - "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": "Requires interacting with the GitHub API and handling various error conditions. Authentication adds complexity." - }, - { - "taskId": 46, - "taskTitle": "Implement ICE Analysis Command for Task Prioritization", - "complexityScore": 7, - "recommendedSubtasks": 5, - "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": "Requires AI integration for scoring and careful formatting of the report. Integration with existing complexity reports adds complexity." - }, - { - "taskId": 47, - "taskTitle": "Enhance Task Suggestion Actions Card Workflow", - "complexityScore": 7, - "recommendedSubtasks": 6, - "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": "Requires significant UI/UX work and careful state management. Integration with existing functionality is crucial." - }, - { - "taskId": 48, - "taskTitle": "Refactor Prompts into Centralized Structure", - "complexityScore": 5, - "recommendedSubtasks": 3, - "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": "Primarily a refactoring task, but requires careful attention to detail to avoid breaking existing functionality." - }, - { - "taskId": 49, - "taskTitle": "Implement Code Quality Analysis Command", - "complexityScore": 8, - "recommendedSubtasks": 6, - "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": "Requires complex code analysis and AI integration. Generating actionable recommendations adds complexity." - }, - { - "taskId": 50, - "taskTitle": "Implement Test Coverage Tracking System by Task", - "complexityScore": 9, - "recommendedSubtasks": 7, - "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": "A comprehensive system requiring deep integration with testing tools and AI. Maintaining bidirectional relationships adds complexity." - }, - { - "taskId": 51, - "taskTitle": "Implement Perplexity Research Command", - "complexityScore": 7, - "recommendedSubtasks": 5, - "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": "Requires API integration and careful formatting of the research results. Caching adds complexity." - }, - { - "taskId": 52, - "taskTitle": "Implement Task Suggestion Command for CLI", - "complexityScore": 7, - "recommendedSubtasks": 5, - "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": "Requires AI integration and careful design of the interactive interface. Handling various flag combinations adds complexity." - }, - { - "taskId": 53, - "taskTitle": "Implement Subtask Suggestion Feature for Parent Tasks", - "complexityScore": 7, - "recommendedSubtasks": 6, - "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": "Requires AI integration and careful design of the interactive interface. Linking subtasks to parent tasks adds complexity." - }, - { - "taskId": 55, - "taskTitle": "Implement Positional Arguments Support for CLI Commands", - "complexityScore": 7, - "recommendedSubtasks": 5, - "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": "Requires careful modification of the command parsing logic and ensuring backward compatibility. Handling edge cases adds complexity." - }, - { - "taskId": 57, - "taskTitle": "Enhance Task-Master CLI User Experience and Interface", - "complexityScore": 7, - "recommendedSubtasks": 6, - "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": "Requires significant UI/UX work and careful consideration of different terminal environments. Reducing verbose logging adds complexity." - }, - { - "taskId": 60, - "taskTitle": "Implement Mentor System with Round-Table Discussion Feature", - "complexityScore": 8, - "recommendedSubtasks": 7, - "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": "Requires complex AI simulation and careful formatting of the discussion output. Integrating with the task system adds complexity." - }, - { - "taskId": 61, - "taskTitle": "Implement Flexible AI Model Management", - "complexityScore": 9, - "recommendedSubtasks": 8, - "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": "Requires deep integration with multiple AI models and careful management of API keys and configuration options. Vercel AI SDK integration adds complexity." - }, - { - "taskId": 62, - "taskTitle": "Add --simple Flag to Update Commands for Direct Text Input", - "complexityScore": 5, - "recommendedSubtasks": 4, - "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": "Relatively straightforward, but requires careful attention to formatting and ensuring consistency with AI-processed updates." - }, - { - "taskId": 63, - "taskTitle": "Add pnpm Support for the Taskmaster Package", - "complexityScore": 7, - "recommendedSubtasks": 6, - "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": "Requires careful attention to detail to ensure compatibility with pnpm's execution model. Testing and documentation are crucial." - }, - { - "taskId": 64, - "taskTitle": "Add Yarn Support for Taskmaster Installation", - "complexityScore": 7, - "recommendedSubtasks": 6, - "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": "Requires careful attention to detail to ensure compatibility with Yarn's execution model. Testing and documentation are crucial." - }, - { - "taskId": 65, - "taskTitle": "Add Bun Support for Taskmaster Installation", - "complexityScore": 7, - "recommendedSubtasks": 6, - "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": "Requires careful attention to detail to ensure compatibility with Bun's execution model. Testing and documentation are crucial." - }, - { - "taskId": 66, - "taskTitle": "Support Status Filtering in Show Command for Subtasks", - "complexityScore": 5, - "recommendedSubtasks": 4, - "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": "Relatively straightforward, but requires careful handling of status validation and filtering." - }, - { - "taskId": 67, - "taskTitle": "Add CLI JSON output and Cursor keybindings integration", - "complexityScore": 7, - "recommendedSubtasks": 6, - "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": "Requires careful formatting of the JSON output and handling of file system operations. OS detection adds complexity." - }, - { - "taskId": 68, - "taskTitle": "Ability to create tasks without parsing PRD", - "complexityScore": 3, - "recommendedSubtasks": 2, - "expansionPrompt": "Expand the 'Ability to create tasks without parsing PRD' task by detailing the steps for creating tasks without a PRD.", - "reasoning": "Simple task to allow task creation without a PRD." - }, - { - "taskId": 69, - "taskTitle": "Enhance Analyze Complexity for Specific Task IDs", - "complexityScore": 6, - "recommendedSubtasks": 4, - "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": "Requires modifying existing functionality and ensuring compatibility with both CLI and MCP." - }, - { - "taskId": 70, - "taskTitle": "Implement 'diagram' command for Mermaid diagram generation", - "complexityScore": 6, - "recommendedSubtasks": 4, - "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": "Requires generating Mermaid diagrams and handling different output options." - }, - { - "taskId": 72, - "taskTitle": "Implement PDF Generation for Project Progress and Dependency Overview", - "complexityScore": 8, - "recommendedSubtasks": 6, - "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": "Requires integrating with the diagram command and using a PDF generation library. Handling large dependency chains adds complexity." - }, - { - "taskId": 73, - "taskTitle": "Implement Custom Model ID Support for Ollama/OpenRouter", - "complexityScore": 7, - "recommendedSubtasks": 5, - "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": "Requires integrating with external APIs and handling different model types. Validation and warnings are crucial." - }, - { - "taskId": 75, - "taskTitle": "Integrate Google Search Grounding for Research Role", - "complexityScore": 6, - "recommendedSubtasks": 4, - "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": "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." - } - ] -} + "meta": { + "generatedAt": "2025-05-08T23:29:42.699Z", + "tasksAnalyzed": 34, + "thresholdScore": 5, + "projectName": "Taskmaster", + "usedResearch": false + }, + "complexityAnalysis": [ + { + "taskId": 24, + "taskTitle": "Implement AI-Powered Test Generation Command", + "complexityScore": 7, + "recommendedSubtasks": 5, + "expansionPrompt": "Break down the implementation of the AI-powered test generation command into detailed subtasks, including API integration with Claude, test file generation logic, command structure, and error handling. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves complex AI integration with Claude API, test generation logic, and file system operations. It requires understanding both the testing framework (Jest) and AI prompt engineering. The existing 3 subtasks are a good start but could benefit from additional subtasks for error handling, documentation, and integration with existing commands." + }, + { + "taskId": 26, + "taskTitle": "Implement Context Foundation for AI Operations", + "complexityScore": 6, + "recommendedSubtasks": 4, + "expansionPrompt": "Break down the implementation of the context foundation for AI operations into detailed subtasks, focusing on the file-based context integration, cursor rules integration, context extraction utilities, and command handler updates. For each subtask, provide specific implementation steps and testing approaches.", + "reasoning": "This task involves adding context capabilities to AI operations, which requires modifications to multiple command handlers and creating utility functions. The existing 4 subtasks cover the main components well, but each could benefit from more detailed implementation steps. The complexity is moderate as it builds on existing AI integration but requires careful handling of different context sources." + }, + { + "taskId": 27, + "taskTitle": "Implement Context Enhancements for AI Operations", + "complexityScore": 7, + "recommendedSubtasks": 5, + "expansionPrompt": "Break down the implementation of context enhancements for AI operations into detailed subtasks, focusing on code context extraction, task history context, PRD context integration, and context formatting. For each subtask, provide specific implementation steps, technical challenges, and testing approaches.", + "reasoning": "This task builds upon Task #26 but adds more sophisticated context handling including code parsing, task history analysis, and PRD integration. The existing 4 subtasks cover the main areas but lack detail on implementation specifics. The complexity is high due to the need for intelligent parsing of different file types, context prioritization, and token optimization." + }, + { + "taskId": 28, + "taskTitle": "Implement Advanced ContextManager System", + "complexityScore": 8, + "recommendedSubtasks": 6, + "expansionPrompt": "Break down the implementation of the Advanced ContextManager System into detailed subtasks, focusing on the core class structure, context optimization algorithms, command interface integration, AI service integration, and performance monitoring. For each subtask, provide specific implementation details, technical challenges, and testing approaches.", + "reasoning": "This task represents the most complex phase of the context implementation, requiring a sophisticated class architecture, intelligent optimization algorithms, and integration with multiple systems. The existing 5 subtasks cover the main components but would benefit from more detailed implementation steps. The complexity is high due to the need for context prioritization, token budgeting, and caching mechanisms." + }, + { + "taskId": 40, + "taskTitle": "Implement 'plan' Command for Task Implementation Planning", + "complexityScore": 5, + "recommendedSubtasks": 4, + "expansionPrompt": "Break down the implementation of the 'plan' command into detailed subtasks, focusing on task content retrieval, AI integration for plan generation, XML formatting, and command interface development. For each subtask, provide specific implementation steps and testing approaches.", + "reasoning": "This task involves creating a new command that leverages AI to generate implementation plans for tasks. The existing 4 subtasks cover the main components well. The complexity is moderate as it builds on existing AI integration patterns but requires specific formatting and task manipulation logic." + }, + { + "taskId": 41, + "taskTitle": "Implement Visual Task Dependency Graph in Terminal", + "complexityScore": 8, + "recommendedSubtasks": 8, + "expansionPrompt": "Break down the implementation of the visual task dependency graph feature into detailed subtasks, focusing on graph layout algorithms, ASCII/Unicode rendering, color coding, circular dependency detection, filtering capabilities, and accessibility features. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves complex graph visualization algorithms, terminal rendering, and layout optimization. The existing 10 subtasks are comprehensive but could be consolidated into 8 more focused areas. The complexity is high due to the need for sophisticated graph layout algorithms, handling of complex dependency chains, and terminal rendering constraints." + }, + { + "taskId": 42, + "taskTitle": "Implement MCP-to-MCP Communication Protocol", + "complexityScore": 9, + "recommendedSubtasks": 10, + "expansionPrompt": "Break down the implementation of the MCP-to-MCP communication protocol into detailed subtasks, focusing on protocol design, adapter pattern implementation, client module development, reference implementations, mode switching, security considerations, and documentation. For each subtask, provide specific implementation details, technical challenges, and testing approaches.", + "reasoning": "This task involves designing and implementing a complex communication protocol between different MCP tools and servers. The existing 8 subtasks provide a good foundation but lack detail on security, error handling, and specific implementation challenges. The complexity is very high due to the need for a standardized protocol, authentication mechanisms, and support for different operational modes." + }, + { + "taskId": 44, + "taskTitle": "Implement Task Automation with Webhooks and Event Triggers", + "complexityScore": 8, + "recommendedSubtasks": 8, + "expansionPrompt": "Break down the implementation of task automation with webhooks and event triggers into detailed subtasks, focusing on webhook registration, event system design, trigger definition interface, authentication mechanisms, rate limiting, payload templating, and integration with existing task management. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves creating a comprehensive webhook and event trigger system, which requires careful design of event handling, security mechanisms, and integration with external services. The existing 7 subtasks cover most aspects but could benefit from additional focus on security and testing. The complexity is high due to the need for robust authentication, rate limiting, and handling of external service interactions." + }, + { + "taskId": 45, + "taskTitle": "Implement GitHub Issue Import Feature", + "complexityScore": 5, + "recommendedSubtasks": 5, + "expansionPrompt": "Break down the implementation of the GitHub issue import feature into detailed subtasks, focusing on URL parsing, GitHub API integration, data mapping, error handling, and command interface development. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves integrating with the GitHub API to import issues as tasks. The existing 5 subtasks cover the main components well. The complexity is moderate as it requires API integration, authentication handling, and data mapping between GitHub issues and internal task structure." + }, + { + "taskId": 46, + "taskTitle": "Implement ICE Analysis Command for Task Prioritization", + "complexityScore": 6, + "recommendedSubtasks": 5, + "expansionPrompt": "Break down the implementation of the ICE analysis command into detailed subtasks, focusing on the scoring algorithm, AI integration for evaluation, report generation, CLI rendering, and integration with existing complexity reports. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves creating a new analysis command for task prioritization using the ICE methodology. The existing 5 subtasks cover the main components well. The complexity is moderate as it builds on existing analysis patterns but requires specific scoring algorithms and AI integration for evaluation." + }, + { + "taskId": 47, + "taskTitle": "Enhance Task Suggestion Actions Card Workflow", + "complexityScore": 6, + "recommendedSubtasks": 6, + "expansionPrompt": "Break down the enhancement of the task suggestion actions card workflow into detailed subtasks, focusing on the task expansion phase, context addition phase, task management phase, and UI/UX improvements. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves redesigning the suggestion actions card to implement a structured workflow. The existing 6 subtasks cover the main components well. The complexity is moderate as it requires UI/UX design considerations, state management, and integration with existing task management functionality." + }, + { + "taskId": 48, + "taskTitle": "Refactor Prompts into Centralized Structure", + "complexityScore": 4, + "recommendedSubtasks": 3, + "expansionPrompt": "Break down the refactoring of prompts into a centralized structure into detailed subtasks, focusing on directory structure creation, prompt extraction, and function updates. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves refactoring existing prompt definitions into a centralized structure. The existing 3 subtasks cover the main components well. The complexity is relatively low as it's primarily a code organization task, though it requires careful handling to maintain functionality across the application." + }, + { + "taskId": 49, + "taskTitle": "Implement Code Quality Analysis Command", + "complexityScore": 7, + "recommendedSubtasks": 6, + "expansionPrompt": "Break down the implementation of the code quality analysis command into detailed subtasks, focusing on pattern recognition algorithms, best practice verification, AI integration for recommendations, task generation, and reporting interfaces. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves creating a sophisticated code analysis system with AI integration for recommendations. The existing 6 subtasks cover the main components well. The complexity is high due to the need for pattern recognition algorithms, code parsing, and integration with AI services for quality assessment." + }, + { + "taskId": 50, + "taskTitle": "Implement Test Coverage Tracking System by Task", + "complexityScore": 8, + "recommendedSubtasks": 5, + "expansionPrompt": "Break down the implementation of the test coverage tracking system into detailed subtasks, focusing on data structure design, coverage report parsing, tracking and update mechanisms, CLI commands, and AI test generation. For each subtask, provide specific implementation details, technical challenges, and testing approaches.", + "reasoning": "This task involves creating a comprehensive test coverage tracking system that maps tests to specific tasks. The existing 5 subtasks are well-defined but could benefit from more detailed implementation steps. The complexity is high due to the need for coverage report parsing, bidirectional mapping between tests and tasks, and AI-powered test generation." + }, + { + "taskId": 51, + "taskTitle": "Implement Perplexity Research Command", + "complexityScore": 5, + "recommendedSubtasks": 5, + "expansionPrompt": "Break down the implementation of the Perplexity research command into detailed subtasks, focusing on API client service, context extraction, CLI interface, results processing, and caching mechanisms. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves creating a new command for research using Perplexity AI. The existing 5 subtasks cover the main components well. The complexity is moderate as it requires API integration, context handling, and results formatting, but follows established patterns for command implementation." + }, + { + "taskId": 52, + "taskTitle": "Implement Task Suggestion Command for CLI", + "complexityScore": 6, + "recommendedSubtasks": 5, + "expansionPrompt": "Break down the implementation of the task suggestion command for CLI into detailed subtasks, focusing on data collection, AI integration, interactive interface, suggestion selection, and configuration options. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves creating a new CLI command for generating task suggestions. The existing 5 subtasks cover the main components well. The complexity is moderate as it requires AI integration for generating contextually relevant suggestions and an interactive CLI interface for user interaction." + }, + { + "taskId": 53, + "taskTitle": "Implement Subtask Suggestion Feature for Parent Tasks", + "complexityScore": 6, + "recommendedSubtasks": 6, + "expansionPrompt": "Break down the implementation of the subtask suggestion feature into detailed subtasks, focusing on parent task validation, context gathering, AI integration, interactive CLI interface, subtask linking, and comprehensive testing. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves creating a feature to suggest contextually relevant subtasks for existing parent tasks. The existing 6 subtasks cover the main components well. The complexity is moderate as it requires AI integration for generating relevant subtask suggestions and careful integration with the existing task management system." + }, + { + "taskId": 55, + "taskTitle": "Implement Positional Arguments Support for CLI Commands", + "complexityScore": 5, + "recommendedSubtasks": 5, + "expansionPrompt": "Break down the implementation of positional arguments support for CLI commands into detailed subtasks, focusing on argument parsing structure analysis, specification format design, core parsing logic, edge case handling, and documentation updates. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves modifying the command parsing logic to support positional arguments alongside the existing flag-based syntax. The existing 5 subtasks cover the main components well. The complexity is moderate as it requires careful handling of argument parsing and maintaining backward compatibility." + }, + { + "taskId": 57, + "taskTitle": "Enhance Task-Master CLI User Experience and Interface", + "complexityScore": 7, + "recommendedSubtasks": 6, + "expansionPrompt": "Break down the enhancement of the Task-Master CLI user experience into detailed subtasks, focusing on log management, visual enhancements, interactive elements, output formatting, help documentation, and accessibility features. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves improving the CLI's user experience through various enhancements. The existing 6 subtasks cover the main components well. The complexity is moderate to high as it requires implementing various UI improvements, log management, and interactive elements while maintaining functionality in different environments." + }, + { + "taskId": 60, + "taskTitle": "Implement Mentor System with Round-Table Discussion Feature", + "complexityScore": 8, + "recommendedSubtasks": 7, + "expansionPrompt": "Break down the implementation of the mentor system with round-table discussion feature into detailed subtasks, focusing on mentor management, round-table discussion mechanics, task integration, LLM integration for mentor simulation, output formatting, and comprehensive testing. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves creating a sophisticated mentor system with simulated round-table discussions. The existing 7 subtasks cover the main components well. The complexity is high due to the need for realistic mentor simulation using LLMs, managing multiple simulated personalities, and integrating with the task system." + }, + { + "taskId": 62, + "taskTitle": "Add --simple Flag to Update Commands for Direct Text Input", + "complexityScore": 4, + "recommendedSubtasks": 8, + "expansionPrompt": "Break down the implementation of the --simple flag for update commands into detailed subtasks, focusing on command parser updates, conditional logic for AI processing, timestamp formatting, visual indicators, storage integration, help documentation, testing, and final validation. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves adding a simple flag option to update commands for direct text input without AI processing. The existing 8 subtasks are very detailed and cover all aspects of the implementation. The complexity is relatively low as it's primarily a feature addition to existing commands, though it requires careful integration with the existing update logic." + }, + { + "taskId": 63, + "taskTitle": "Add pnpm Support for the Taskmaster Package", + "complexityScore": 5, + "recommendedSubtasks": 8, + "expansionPrompt": "Break down the implementation of pnpm support for the Taskmaster package into detailed subtasks, focusing on documentation updates, package script compatibility, lockfile generation, installation testing, CI/CD integration, dependency resolution, and init script verification. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves ensuring the Taskmaster package works correctly with pnpm as a package manager. The existing 8 subtasks cover the main components well. The complexity is moderate as it requires testing across different environments and ensuring compatibility with the existing npm installation process." + }, + { + "taskId": 64, + "taskTitle": "Add Yarn Support for Taskmaster Installation", + "complexityScore": 5, + "recommendedSubtasks": 9, + "expansionPrompt": "Break down the implementation of Yarn support for Taskmaster installation into detailed subtasks, focusing on package.json updates, Yarn-specific configuration, script and CLI testing, documentation updates, package manager detection, installation UI consistency, init script verification, binary linking, and website account setup testing. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves adding support for Yarn as a package manager for Taskmaster. The existing 9 subtasks cover the main components well. The complexity is moderate as it requires testing across different environments and ensuring compatibility with the existing npm and pnpm installation processes." + }, + { + "taskId": 65, + "taskTitle": "Add Bun Support for Taskmaster Installation", + "complexityScore": 6, + "recommendedSubtasks": 6, + "expansionPrompt": "Break down the implementation of Bun support for Taskmaster installation into detailed subtasks, focusing on compatibility research, installation script updates, Bun-specific installation path, cross-platform testing, functionality verification, and documentation updates. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves adding support for Bun as a package manager for Taskmaster. The existing 6 subtasks cover the main components well. The complexity is moderate to high as Bun is a newer package manager with potential compatibility issues and requires testing across different environments." + }, + { + "taskId": 67, + "taskTitle": "Add CLI JSON output and Cursor keybindings integration", + "complexityScore": 5, + "recommendedSubtasks": 5, + "expansionPrompt": "Break down the implementation of CLI JSON output and Cursor keybindings integration into detailed subtasks, focusing on core JSON output logic, schema consistency, keybinding command structure, file handling, and keybinding configuration. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves adding JSON output capability to CLI commands and creating a new command for Cursor keybindings integration. The existing 5 subtasks cover the main components well. The complexity is moderate as it requires modifying multiple command handlers and implementing OS-specific file operations." + }, + { + "taskId": 68, + "taskTitle": "Ability to create tasks without parsing PRD", + "complexityScore": 3, + "recommendedSubtasks": 4, + "expansionPrompt": "Break down the implementation of task creation without PRD parsing into detailed subtasks, focusing on task creation form design, data validation, storage functionality, and integration with existing task management. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves enabling task creation without requiring a PRD document. The existing 2 subtasks are minimal and could benefit from additional subtasks for data validation and integration. The complexity is relatively low as it's primarily extending existing task creation functionality to work without a PRD." + }, + { + "taskId": 69, + "taskTitle": "Enhance Analyze Complexity for Specific Task IDs", + "complexityScore": 5, + "recommendedSubtasks": 4, + "expansionPrompt": "Break down the enhancement of analyze-complexity for specific task IDs into detailed subtasks, focusing on core logic modification, CLI interface updates, MCP tool integration, and comprehensive testing. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves modifying the existing analyze-complexity feature to support analyzing specific task IDs. The existing 4 subtasks cover the main components well. The complexity is moderate as it requires modifying existing functionality while maintaining backward compatibility and ensuring proper report merging." + }, + { + "taskId": 70, + "taskTitle": "Implement 'diagram' command for Mermaid diagram generation", + "complexityScore": 6, + "recommendedSubtasks": 4, + "expansionPrompt": "Break down the implementation of the 'diagram' command for Mermaid diagram generation into detailed subtasks, focusing on command interface design, diagram generation core functionality, output handling, and documentation. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves creating a new command for generating Mermaid diagrams to visualize task dependencies. The existing 4 subtasks cover the main components well. The complexity is moderate as it requires implementing graph visualization algorithms and integrating with the existing task management system." + }, + { + "taskId": 72, + "taskTitle": "Implement PDF Generation for Project Progress and Dependency Overview", + "complexityScore": 7, + "recommendedSubtasks": 6, + "expansionPrompt": "Break down the implementation of PDF generation for project progress and dependency overview into detailed subtasks, focusing on PDF library selection, template design, data collection, dependency visualization integration, core functionality, and export options. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves creating a feature to generate PDF reports summarizing project progress and visualizing task dependencies. The existing 6 subtasks cover the main components well. The complexity is high due to the need for PDF generation, data visualization, and integration with the existing diagram command." + }, + { + "taskId": 75, + "taskTitle": "Integrate Google Search Grounding for Research Role", + "complexityScore": 4, + "recommendedSubtasks": 4, + "expansionPrompt": "Break down the integration of Google Search Grounding for the research role into detailed subtasks, focusing on AI service layer modification, research role detection, model configuration updates, and comprehensive testing. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves updating the AI service layer to enable Google Search Grounding specifically for the research role. The existing 4 subtasks cover the main components well. The complexity is relatively low as it's primarily a conditional feature enablement based on the AI role and provider." + }, + { + "taskId": 76, + "taskTitle": "Develop E2E Test Framework for Taskmaster MCP Server (FastMCP over stdio)", + "complexityScore": 8, + "recommendedSubtasks": 7, + "expansionPrompt": "Break down the development of the E2E test framework for Taskmaster MCP server into detailed subtasks, focusing on architecture design, server launcher implementation, message protocol handling, request/response correlation, assertion framework, test case implementation, and CI integration. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves designing and implementing a comprehensive end-to-end test framework for the Taskmaster MCP server. The existing 7 subtasks cover the main components well. The complexity is high due to the need for subprocess management, protocol handling, and robust test assertion capabilities." + }, + { + "taskId": 77, + "taskTitle": "Implement AI Usage Telemetry for Taskmaster (with external analytics endpoint)", + "complexityScore": 7, + "recommendedSubtasks": 17, + "expansionPrompt": "Break down the implementation of AI usage telemetry for Taskmaster into detailed subtasks, focusing on telemetry utility development, secure transmission, user consent mechanisms, command integration, usage summary display, and provider-specific implementations. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves implementing a comprehensive telemetry system for tracking AI usage in Taskmaster. The existing 17 subtasks are very detailed and cover all aspects of the implementation across different commands and providers. The complexity is high due to the need for accurate token counting, cost calculation, and integration across multiple commands and AI providers." + }, + { + "taskId": 80, + "taskTitle": "Implement Unique User ID Generation and Storage During Installation", + "complexityScore": 4, + "recommendedSubtasks": 5, + "expansionPrompt": "Break down the implementation of unique user ID generation and storage during installation into detailed subtasks, focusing on post-install script structure, UUID generation, config file handling, integration, and documentation. For each subtask, provide specific implementation details and testing approaches.", + "reasoning": "This task involves implementing a mechanism to generate and store a unique user identifier during the npm installation process. The existing 5 subtasks cover the main components well. The complexity is relatively low as it primarily involves UUID generation and configuration file management." + }, + { + "taskId": 81, + "taskTitle": "Task #81: Implement Comprehensive Local Telemetry System with Future Server Integration Capability", + "complexityScore": 8, + "recommendedSubtasks": 6, + "expansionPrompt": "Break down the implementation of the comprehensive local telemetry system into detailed subtasks, focusing on additional data collection points, local storage system, server transmission architecture, privacy controls, debugging tools, and user-facing benefits. For each subtask, provide specific implementation details, technical challenges, and testing approaches.", + "reasoning": "This task involves expanding the existing telemetry infrastructure to provide more comprehensive insights while storing data locally until a server endpoint becomes available. The existing 6 subtasks cover the main components well. The complexity is high due to the need for robust local storage, data aggregation, privacy controls, and designing for future server integration." + } + ] +} \ No newline at end of file diff --git a/tasks/task_077.txt b/tasks/task_077.txt index ef98667f..48e35e19 100644 --- a/tasks/task_077.txt +++ b/tasks/task_077.txt @@ -230,7 +230,7 @@ Apply telemetry pattern from telemetry.mdc: * Verify `handleApiResult` correctly passes `data.telemetryData` through. -## 11. Telemetry Integration for update-subtask-by-id [in-progress] +## 11. Telemetry Integration for update-subtask-by-id [done] ### Dependencies: None ### Description: Integrate AI usage telemetry capture and propagation for the update-subtask-by-id functionality. ### Details: @@ -254,7 +254,7 @@ Apply telemetry pattern from telemetry.mdc: * Verify `handleApiResult` correctly passes `data.telemetryData` through (if present). -## 12. Telemetry Integration for analyze-task-complexity [pending] +## 12. Telemetry Integration for analyze-task-complexity [done] ### Dependencies: None ### Description: Integrate AI usage telemetry capture and propagation for the analyze-task-complexity functionality. ### Details: diff --git a/tasks/tasks.json b/tasks/tasks.json index 6c34c86a..e056d7e2 100644 --- a/tasks/tasks.json +++ b/tasks/tasks.json @@ -5015,16 +5015,22 @@ "title": "Telemetry Integration for update-subtask-by-id", "description": "Integrate AI usage telemetry capture and propagation for the update-subtask-by-id functionality.", "details": "\\\nApply telemetry pattern from telemetry.mdc:\n\n1. **Core (`scripts/modules/task-manager/update-subtask-by-id.js`):**\n * Verify if this function *actually* calls an AI service. If it only appends text, telemetry integration might not apply directly here, but ensure its callers handle telemetry if they use AI.\n * *If it calls AI:* Modify AI service call to include `commandName: \\'update-subtask\\'` and `outputType`.\n * *If it calls AI:* Receive `{ mainResult, telemetryData }`.\n * *If it calls AI:* Return object including `telemetryData`.\n * *If it calls AI:* Handle CLI display via `displayAiUsageSummary` if applicable.\n\n2. **Direct (`mcp-server/src/core/direct-functions/update-subtask-by-id.js`):**\n * *If core calls AI:* Pass `commandName`, `outputType: \\'mcp\\'` to core.\n * *If core calls AI:* Pass `outputFormat: \\'json\\'` if applicable.\n * *If core calls AI:* Receive `{ ..., telemetryData }` from core.\n * *If core calls AI:* Return `{ success: true, data: { ..., telemetryData } }`.\n\n3. **Tool (`mcp-server/src/tools/update-subtask.js`):**\n * Verify `handleApiResult` correctly passes `data.telemetryData` through (if present).\n", - "status": "in-progress", + "status": "done", "dependencies": [], - "parentTaskId": 77 + "parentTaskId": 77, + "parentTask": { + "id": 77, + "title": "Implement AI Usage Telemetry for Taskmaster (with external analytics endpoint)", + "status": "in-progress" + }, + "isSubtask": true }, { "id": 12, "title": "Telemetry Integration for analyze-task-complexity", "description": "Integrate AI usage telemetry capture and propagation for the analyze-task-complexity functionality.", "details": "\\\nApply telemetry pattern from telemetry.mdc:\n\n1. **Core (`scripts/modules/task-manager/analyze-task-complexity.js`):**\n * Modify AI service call to include `commandName: \\'analyze-complexity\\'` and `outputType`.\n * Receive `{ mainResult, telemetryData }`.\n * Return object including `telemetryData` (perhaps alongside the complexity report data).\n * Handle CLI display via `displayAiUsageSummary` if applicable.\n\n2. **Direct (`mcp-server/src/core/direct-functions/analyze-task-complexity.js`):**\n * Pass `commandName`, `outputType: \\'mcp\\'` to core.\n * Pass `outputFormat: \\'json\\'` if applicable.\n * Receive `{ ..., telemetryData }` from core.\n * Return `{ success: true, data: { ..., telemetryData } }`.\n\n3. **Tool (`mcp-server/src/tools/analyze.js`):**\n * Verify `handleApiResult` correctly passes `data.telemetryData` through.\n", - "status": "pending", + "status": "done", "dependencies": [], "parentTaskId": 77 }, diff --git a/tests/unit/ai-services-unified.test.js b/tests/unit/ai-services-unified.test.js index 9481a45a..d34806a7 100644 --- a/tests/unit/ai-services-unified.test.js +++ b/tests/unit/ai-services-unified.test.js @@ -305,7 +305,9 @@ describe('Unified AI Services', () => { expect(mockGenerateAnthropicText).toHaveBeenCalledTimes(2); // Initial + 1 retry expect(mockLog).toHaveBeenCalledWith( 'info', - expect.stringContaining('Retryable error detected. Retrying') + expect.stringContaining( + 'Something went wrong on the provider side. Retrying' + ) ); });