chore: task management, adjust readmes, adjust cursor rules, add mcp_integration.md to docs
This commit is contained in:
@@ -102,6 +102,38 @@ alwaysApply: false
|
||||
}
|
||||
```
|
||||
|
||||
- **Enhanced Input Validation**:
|
||||
- ✅ DO: Validate file existence for critical file operations
|
||||
- ✅ DO: Provide context-specific validation for identifiers
|
||||
- ✅ DO: Check required API keys for features that depend on them
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Validate file existence
|
||||
if (!fs.existsSync(tasksPath)) {
|
||||
console.error(chalk.red(`Error: Tasks file not found at path: ${tasksPath}`));
|
||||
if (tasksPath === 'tasks/tasks.json') {
|
||||
console.log(chalk.yellow('Hint: Run task-master init or task-master parse-prd to create tasks.json first'));
|
||||
} else {
|
||||
console.log(chalk.yellow(`Hint: Check if the file path is correct: ${tasksPath}`));
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// ✅ DO: Validate task ID
|
||||
const taskId = parseInt(options.id, 10);
|
||||
if (isNaN(taskId) || taskId <= 0) {
|
||||
console.error(chalk.red(`Error: Invalid task ID: ${options.id}. Task ID must be a positive integer.`));
|
||||
console.log(chalk.yellow('Usage example: task-master update-task --id=23 --prompt="Update with new information"'));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// ✅ DO: Check for required API keys
|
||||
if (useResearch && !process.env.PERPLEXITY_API_KEY) {
|
||||
console.log(chalk.yellow('Warning: PERPLEXITY_API_KEY environment variable is missing. Research-backed updates will not be available.'));
|
||||
console.log(chalk.yellow('Falling back to Claude AI for task update.'));
|
||||
}
|
||||
```
|
||||
|
||||
## User Feedback
|
||||
|
||||
- **Operation Status**:
|
||||
@@ -123,6 +155,26 @@ alwaysApply: false
|
||||
}
|
||||
```
|
||||
|
||||
- **Success Messages with Next Steps**:
|
||||
- ✅ DO: Use boxen for important success messages with clear formatting
|
||||
- ✅ DO: Provide suggested next steps after command completion
|
||||
- ✅ DO: Include ready-to-use commands for follow-up actions
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Display success with next steps
|
||||
console.log(boxen(
|
||||
chalk.white.bold(`Subtask ${parentId}.${subtask.id} Added Successfully`) + '\n\n' +
|
||||
chalk.white(`Title: ${subtask.title}`) + '\n' +
|
||||
chalk.white(`Status: ${getStatusWithColor(subtask.status)}`) + '\n' +
|
||||
(dependencies.length > 0 ? chalk.white(`Dependencies: ${dependencies.join(', ')}`) + '\n' : '') +
|
||||
'\n' +
|
||||
chalk.white.bold('Next Steps:') + '\n' +
|
||||
chalk.cyan(`1. Run ${chalk.yellow(`task-master show ${parentId}`)} to see the parent task with all subtasks`) + '\n' +
|
||||
chalk.cyan(`2. Run ${chalk.yellow(`task-master set-status --id=${parentId}.${subtask.id} --status=in-progress`)} to start working on it`),
|
||||
{ padding: 1, borderColor: 'green', borderStyle: 'round', margin: { top: 1 } }
|
||||
));
|
||||
```
|
||||
|
||||
## Command Registration
|
||||
|
||||
- **Command Grouping**:
|
||||
@@ -139,7 +191,10 @@ alwaysApply: false
|
||||
export {
|
||||
registerCommands,
|
||||
setupCLI,
|
||||
runCLI
|
||||
runCLI,
|
||||
checkForUpdate, // Include version checking functions
|
||||
compareVersions,
|
||||
displayUpgradeNotification
|
||||
};
|
||||
```
|
||||
|
||||
@@ -218,6 +273,35 @@ alwaysApply: false
|
||||
});
|
||||
```
|
||||
|
||||
- **Contextual Error Handling**:
|
||||
- ✅ DO: Provide specific error handling for common issues
|
||||
- ✅ DO: Include troubleshooting hints for each error type
|
||||
- ✅ DO: Use consistent error formatting across all commands
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Provide specific error handling with guidance
|
||||
try {
|
||||
// Implementation
|
||||
} catch (error) {
|
||||
console.error(chalk.red(`Error: ${error.message}`));
|
||||
|
||||
// Provide more helpful error messages for common issues
|
||||
if (error.message.includes('task') && error.message.includes('not found')) {
|
||||
console.log(chalk.yellow('\nTo fix this issue:'));
|
||||
console.log(' 1. Run task-master list to see all available task IDs');
|
||||
console.log(' 2. Use a valid task ID with the --id parameter');
|
||||
} else if (error.message.includes('API key')) {
|
||||
console.log(chalk.yellow('\nThis error is related to API keys. Check your environment variables.'));
|
||||
}
|
||||
|
||||
if (CONFIG.debug) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
```
|
||||
|
||||
## Integration with Other Modules
|
||||
|
||||
- **Import Organization**:
|
||||
@@ -230,6 +314,7 @@ alwaysApply: false
|
||||
import { program } from 'commander';
|
||||
import path from 'path';
|
||||
import chalk from 'chalk';
|
||||
import https from 'https';
|
||||
|
||||
import { CONFIG, log, readJSON } from './utils.js';
|
||||
import { displayBanner, displayHelp } from './ui.js';
|
||||
@@ -247,30 +332,22 @@ alwaysApply: false
|
||||
.description('Add a new subtask to a parent task or convert an existing task to a subtask')
|
||||
.option('-f, --file <path>', 'Path to the tasks file', 'tasks/tasks.json')
|
||||
.option('-p, --parent <id>', 'ID of the parent task (required)')
|
||||
.option('-e, --existing <id>', 'ID of an existing task to convert to a subtask')
|
||||
.option('-i, --task-id <id>', 'Existing task ID to convert to subtask')
|
||||
.option('-t, --title <title>', 'Title for the new subtask (when not converting)')
|
||||
.option('-d, --description <description>', 'Description for the new subtask (when not converting)')
|
||||
.option('--details <details>', 'Implementation details for the new subtask (when not converting)')
|
||||
.option('--dependencies <ids>', 'Comma-separated list of subtask IDs this subtask depends on')
|
||||
.option('--status <status>', 'Initial status for the subtask', 'pending')
|
||||
.option('--skip-generate', 'Skip regenerating task files')
|
||||
.action(async (options) => {
|
||||
// Validate required parameters
|
||||
if (!options.parent) {
|
||||
console.error(chalk.red('Error: --parent parameter is required'));
|
||||
showAddSubtaskHelp(); // Show contextual help
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Validate that either existing task ID or title is provided
|
||||
if (!options.existing && !options.title) {
|
||||
console.error(chalk.red('Error: Either --existing or --title must be provided'));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
// Implementation
|
||||
} catch (error) {
|
||||
// Error handling
|
||||
}
|
||||
// Implementation with detailed error handling
|
||||
});
|
||||
```
|
||||
|
||||
@@ -283,25 +360,75 @@ alwaysApply: false
|
||||
.option('-f, --file <path>', 'Path to the tasks file', 'tasks/tasks.json')
|
||||
.option('-i, --id <id>', 'ID of the subtask to remove in format "parentId.subtaskId" (required)')
|
||||
.option('-c, --convert', 'Convert the subtask to a standalone task')
|
||||
.option('--skip-generate', 'Skip regenerating task files')
|
||||
.action(async (options) => {
|
||||
// Validate required parameters
|
||||
if (!options.id) {
|
||||
console.error(chalk.red('Error: --id parameter is required'));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Validate subtask ID format
|
||||
if (!options.id.includes('.')) {
|
||||
console.error(chalk.red('Error: Subtask ID must be in format "parentId.subtaskId"'));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
// Implementation
|
||||
} catch (error) {
|
||||
// Error handling
|
||||
}
|
||||
// Implementation with detailed error handling
|
||||
})
|
||||
.on('error', function(err) {
|
||||
console.error(chalk.red(`Error: ${err.message}`));
|
||||
showRemoveSubtaskHelp(); // Show contextual help
|
||||
process.exit(1);
|
||||
});
|
||||
```
|
||||
|
||||
## Version Checking and Updates
|
||||
|
||||
- **Automatic Version Checking**:
|
||||
- ✅ DO: Implement version checking to notify users of available updates
|
||||
- ✅ DO: Use non-blocking version checks that don't delay command execution
|
||||
- ✅ DO: Display update notifications after command completion
|
||||
|
||||
```javascript
|
||||
// ✅ DO: Implement version checking function
|
||||
async function checkForUpdate() {
|
||||
// Implementation details...
|
||||
return { currentVersion, latestVersion, needsUpdate };
|
||||
}
|
||||
|
||||
// ✅ DO: Implement semantic version comparison
|
||||
function compareVersions(v1, v2) {
|
||||
const v1Parts = v1.split('.').map(p => parseInt(p, 10));
|
||||
const v2Parts = v2.split('.').map(p => parseInt(p, 10));
|
||||
|
||||
// Implementation details...
|
||||
return result; // -1, 0, or 1
|
||||
}
|
||||
|
||||
// ✅ DO: Display attractive update notifications
|
||||
function displayUpgradeNotification(currentVersion, latestVersion) {
|
||||
const message = boxen(
|
||||
`${chalk.blue.bold('Update Available!')} ${chalk.dim(currentVersion)} → ${chalk.green(latestVersion)}\n\n` +
|
||||
`Run ${chalk.cyan('npm i task-master-ai@latest -g')} to update to the latest version with new features and bug fixes.`,
|
||||
{
|
||||
padding: 1,
|
||||
margin: { top: 1, bottom: 1 },
|
||||
borderColor: 'yellow',
|
||||
borderStyle: 'round'
|
||||
}
|
||||
);
|
||||
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
// ✅ DO: Integrate version checking in CLI run function
|
||||
async function runCLI(argv = process.argv) {
|
||||
try {
|
||||
// Start the update check in the background - don't await yet
|
||||
const updateCheckPromise = checkForUpdate();
|
||||
|
||||
// Setup and parse
|
||||
const programInstance = setupCLI();
|
||||
await programInstance.parseAsync(argv);
|
||||
|
||||
// After command execution, check if an update is available
|
||||
const updateInfo = await updateCheckPromise;
|
||||
if (updateInfo.needsUpdate) {
|
||||
displayUpgradeNotification(updateInfo.currentVersion, updateInfo.latestVersion);
|
||||
}
|
||||
} catch (error) {
|
||||
// Error handling...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Refer to [`commands.js`](mdc:scripts/modules/commands.js) for implementation examples and [`new_features.mdc`](mdc:.cursor/rules/new_features.mdc) for integration guidelines.
|
||||
19
README.md
19
README.md
@@ -362,6 +362,25 @@ task-master show 1.2
|
||||
task-master update --from=<id> --prompt="<prompt>"
|
||||
```
|
||||
|
||||
# Use Perplexity AI for research-backed updates
|
||||
task-master update --from=<id> --prompt="<prompt>" --research
|
||||
```
|
||||
|
||||
### Update a Single Task
|
||||
|
||||
```bash
|
||||
# Update a specific task with new information
|
||||
task-master update-task --id=<id> --prompt="<prompt>"
|
||||
|
||||
# Use research-backed task updates
|
||||
task-master update-task --id=<id> --prompt="<prompt>" --research
|
||||
```
|
||||
|
||||
The update-task command:
|
||||
- Updates a single specified task rather than multiple tasks
|
||||
- Provides detailed validation and helpful error messages
|
||||
- Falls back gracefully if research API is unavailable
|
||||
- Preserves tasks marked as "done"
|
||||
### Generate Task Files
|
||||
|
||||
```bash
|
||||
|
||||
269
docs/MCP_INTEGRATION.md
Normal file
269
docs/MCP_INTEGRATION.md
Normal file
@@ -0,0 +1,269 @@
|
||||
# Task Master MCP Integration
|
||||
|
||||
This document outlines how Task Master CLI functionality is integrated with MCP (Master Control Program) architecture to provide both CLI and programmatic API access to features.
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
The MCP integration uses a layered approach:
|
||||
|
||||
1. **Core Functions** - In `scripts/modules/` contain the main business logic
|
||||
2. **Source Parameter** - Core functions check the `source` parameter to determine behavior
|
||||
3. **Task Master Core** - In `mcp-server/src/core/task-master-core.js` provides direct function imports
|
||||
4. **MCP Tools** - In `mcp-server/src/tools/` register the functions with the MCP server
|
||||
|
||||
```
|
||||
┌─────────────────┐ ┌─────────────────┐
|
||||
│ CLI User │ │ MCP User │
|
||||
└────────┬────────┘ └────────┬────────┘
|
||||
│ │
|
||||
▼ ▼
|
||||
┌────────────────┐ ┌────────────────────┐
|
||||
│ commands.js │ │ MCP Tool API │
|
||||
└────────┬───────┘ └──────────┬─────────┘
|
||||
│ │
|
||||
│ │
|
||||
▼ ▼
|
||||
┌───────────────────────────────────────────────┐
|
||||
│ │
|
||||
│ Core Modules (task-manager.js, etc.) │
|
||||
│ │
|
||||
└───────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Core Function Pattern
|
||||
|
||||
Core functions should follow this pattern to support both CLI and MCP use:
|
||||
|
||||
```javascript
|
||||
/**
|
||||
* Example function with source parameter support
|
||||
* @param {Object} options - Additional options including source
|
||||
* @returns {Object|undefined} - Returns data when source is 'mcp'
|
||||
*/
|
||||
function exampleFunction(param1, param2, options = {}) {
|
||||
try {
|
||||
// Skip UI for MCP
|
||||
if (options.source !== 'mcp') {
|
||||
displayBanner();
|
||||
console.log(chalk.blue('Processing operation...'));
|
||||
}
|
||||
|
||||
// Do the core business logic
|
||||
const result = doSomething(param1, param2);
|
||||
|
||||
// For MCP, return structured data
|
||||
if (options.source === 'mcp') {
|
||||
return {
|
||||
success: true,
|
||||
data: result
|
||||
};
|
||||
}
|
||||
|
||||
// For CLI, display output
|
||||
console.log(chalk.green('Operation completed successfully!'));
|
||||
} catch (error) {
|
||||
// Handle errors based on source
|
||||
if (options.source === 'mcp') {
|
||||
return {
|
||||
success: false,
|
||||
error: error.message
|
||||
};
|
||||
}
|
||||
|
||||
// CLI error handling
|
||||
console.error(chalk.red(`Error: ${error.message}`));
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Source-Adapter Utilities
|
||||
|
||||
For convenience, you can use the source adapter helpers in `scripts/modules/source-adapter.js`:
|
||||
|
||||
```javascript
|
||||
import { adaptForMcp, sourceSplitFunction } from './source-adapter.js';
|
||||
|
||||
// Simple adaptation - just adds source parameter support
|
||||
export const simpleFunction = adaptForMcp(originalFunction);
|
||||
|
||||
// Split implementation - completely different code paths for CLI vs MCP
|
||||
export const complexFunction = sourceSplitFunction(
|
||||
// CLI version with UI
|
||||
function(param1, param2) {
|
||||
displayBanner();
|
||||
console.log(`Processing ${param1}...`);
|
||||
// ... CLI implementation
|
||||
},
|
||||
// MCP version with structured return
|
||||
function(param1, param2, options = {}) {
|
||||
// ... MCP implementation
|
||||
return { success: true, data };
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
## Adding New Features
|
||||
|
||||
When adding new features, follow these steps to ensure CLI and MCP compatibility:
|
||||
|
||||
1. **Implement Core Logic** in the appropriate module file
|
||||
2. **Add Source Parameter Support** using the pattern above
|
||||
3. **Add to task-master-core.js** to make it available for direct import
|
||||
4. **Update Command Map** in `mcp-server/src/tools/utils.js`
|
||||
5. **Create Tool Implementation** in `mcp-server/src/tools/`
|
||||
6. **Register the Tool** in `mcp-server/src/tools/index.js`
|
||||
|
||||
### Core Function Implementation
|
||||
|
||||
```javascript
|
||||
// In scripts/modules/task-manager.js
|
||||
export async function newFeature(param1, param2, options = {}) {
|
||||
try {
|
||||
// Source-specific UI
|
||||
if (options.source !== 'mcp') {
|
||||
displayBanner();
|
||||
console.log(chalk.blue('Running new feature...'));
|
||||
}
|
||||
|
||||
// Shared core logic
|
||||
const result = processFeature(param1, param2);
|
||||
|
||||
// Source-specific return handling
|
||||
if (options.source === 'mcp') {
|
||||
return {
|
||||
success: true,
|
||||
data: result
|
||||
};
|
||||
}
|
||||
|
||||
// CLI output
|
||||
console.log(chalk.green('Feature completed successfully!'));
|
||||
displayOutput(result);
|
||||
} catch (error) {
|
||||
// Error handling based on source
|
||||
if (options.source === 'mcp') {
|
||||
return {
|
||||
success: false,
|
||||
error: error.message
|
||||
};
|
||||
}
|
||||
|
||||
console.error(chalk.red(`Error: ${error.message}`));
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Task Master Core Update
|
||||
|
||||
```javascript
|
||||
// In mcp-server/src/core/task-master-core.js
|
||||
import { newFeature } from '../../../scripts/modules/task-manager.js';
|
||||
|
||||
// Add to exports
|
||||
export default {
|
||||
// ... existing functions
|
||||
|
||||
async newFeature(args = {}, options = {}) {
|
||||
const { param1, param2 } = args;
|
||||
return executeFunction(newFeature, [param1, param2], options);
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### Command Map Update
|
||||
|
||||
```javascript
|
||||
// In mcp-server/src/tools/utils.js
|
||||
const commandMap = {
|
||||
// ... existing mappings
|
||||
'new-feature': 'newFeature'
|
||||
};
|
||||
```
|
||||
|
||||
### Tool Implementation
|
||||
|
||||
```javascript
|
||||
// In mcp-server/src/tools/newFeature.js
|
||||
import { z } from "zod";
|
||||
import {
|
||||
executeTaskMasterCommand,
|
||||
createContentResponse,
|
||||
createErrorResponse,
|
||||
} from "./utils.js";
|
||||
|
||||
export function registerNewFeatureTool(server) {
|
||||
server.addTool({
|
||||
name: "newFeature",
|
||||
description: "Run the new feature",
|
||||
parameters: z.object({
|
||||
param1: z.string().describe("First parameter"),
|
||||
param2: z.number().optional().describe("Second parameter"),
|
||||
file: z.string().optional().describe("Path to the tasks file"),
|
||||
projectRoot: z.string().describe("Root directory of the project")
|
||||
}),
|
||||
execute: async (args, { log }) => {
|
||||
try {
|
||||
log.info(`Running new feature with args: ${JSON.stringify(args)}`);
|
||||
|
||||
const cmdArgs = [];
|
||||
if (args.param1) cmdArgs.push(`--param1=${args.param1}`);
|
||||
if (args.param2) cmdArgs.push(`--param2=${args.param2}`);
|
||||
if (args.file) cmdArgs.push(`--file=${args.file}`);
|
||||
|
||||
const projectRoot = args.projectRoot;
|
||||
|
||||
// Execute the command
|
||||
const result = await executeTaskMasterCommand(
|
||||
"new-feature",
|
||||
log,
|
||||
cmdArgs,
|
||||
projectRoot
|
||||
);
|
||||
|
||||
if (!result.success) {
|
||||
throw new Error(result.error);
|
||||
}
|
||||
|
||||
return createContentResponse(result.stdout);
|
||||
} catch (error) {
|
||||
log.error(`Error in new feature: ${error.message}`);
|
||||
return createErrorResponse(`Error in new feature: ${error.message}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Tool Registration
|
||||
|
||||
```javascript
|
||||
// In mcp-server/src/tools/index.js
|
||||
import { registerNewFeatureTool } from "./newFeature.js";
|
||||
|
||||
export function registerTaskMasterTools(server) {
|
||||
// ... existing registrations
|
||||
registerNewFeatureTool(server);
|
||||
}
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Always test your MCP-compatible features with both CLI and MCP interfaces:
|
||||
|
||||
```javascript
|
||||
// Test CLI usage
|
||||
node scripts/dev.js new-feature --param1=test --param2=123
|
||||
|
||||
// Test MCP usage
|
||||
node mcp-server/tests/test-command.js newFeature
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Keep Core Logic DRY** - Share as much logic as possible between CLI and MCP
|
||||
2. **Structured Data for MCP** - Return clean JSON objects from MCP source functions
|
||||
3. **Consistent Error Handling** - Standardize error formats for both interfaces
|
||||
4. **Documentation** - Update MCP tool documentation when adding new features
|
||||
5. **Testing** - Test both CLI and MCP interfaces for any new or modified feature
|
||||
@@ -17,7 +17,8 @@ export default {
|
||||
// The glob patterns Jest uses to detect test files
|
||||
testMatch: [
|
||||
'**/__tests__/**/*.js',
|
||||
'**/?(*.)+(spec|test).js'
|
||||
'**/?(*.)+(spec|test).js',
|
||||
'**/tests/*.test.js'
|
||||
],
|
||||
|
||||
// Transform files
|
||||
|
||||
@@ -94,6 +94,9 @@ node scripts/dev.js update --from=4 --prompt="Refactor tasks from ID 4 onward to
|
||||
# Update all tasks (default from=1)
|
||||
node scripts/dev.js update --prompt="Add authentication to all relevant tasks"
|
||||
|
||||
# With research-backed updates using Perplexity AI
|
||||
node scripts/dev.js update --from=4 --prompt="Integrate OAuth 2.0" --research
|
||||
|
||||
# Specify a different tasks file
|
||||
node scripts/dev.js update --file=custom-tasks.json --from=5 --prompt="Change database from MongoDB to PostgreSQL"
|
||||
```
|
||||
@@ -102,6 +105,27 @@ Notes:
|
||||
- The `--prompt` parameter is required and should explain the changes or new context
|
||||
- Only tasks that aren't marked as 'done' will be updated
|
||||
- Tasks with ID >= the specified --from value will be updated
|
||||
- The `--research` flag uses Perplexity AI for more informed updates when available
|
||||
|
||||
## Updating a Single Task
|
||||
|
||||
The `update-task` command allows you to update a specific task instead of multiple tasks:
|
||||
|
||||
```bash
|
||||
# Update a specific task with new information
|
||||
node scripts/dev.js update-task --id=4 --prompt="Use JWT for authentication"
|
||||
|
||||
# With research-backed updates using Perplexity AI
|
||||
node scripts/dev.js update-task --id=4 --prompt="Use JWT for authentication" --research
|
||||
```
|
||||
|
||||
This command:
|
||||
- Updates only the specified task rather than a range of tasks
|
||||
- Provides detailed validation with helpful error messages
|
||||
- Checks for required API keys when using research mode
|
||||
- Falls back gracefully if Perplexity API is unavailable
|
||||
- Preserves tasks that are already marked as "done"
|
||||
- Includes contextual error handling for common issues
|
||||
|
||||
## Setting Task Status
|
||||
|
||||
@@ -426,4 +450,95 @@ This command:
|
||||
- Commands for working with subtasks
|
||||
- For subtasks, provides a link to view the parent task
|
||||
|
||||
This command is particularly useful when you need to examine a specific task in detail before implementing it or when you want to check the status and details of a particular task.
|
||||
This command is particularly useful when you need to examine a specific task in detail before implementing it or when you want to check the status and details of a particular task.
|
||||
|
||||
## Enhanced Error Handling
|
||||
|
||||
The script now includes improved error handling throughout all commands:
|
||||
|
||||
1. **Detailed Validation**:
|
||||
- Required parameters (like task IDs and prompts) are validated early
|
||||
- File existence is checked with customized errors for common scenarios
|
||||
- Parameter type conversion is handled with clear error messages
|
||||
|
||||
2. **Contextual Error Messages**:
|
||||
- Task not found errors include suggestions to run the list command
|
||||
- API key errors include reminders to check environment variables
|
||||
- Invalid ID format errors show the expected format
|
||||
|
||||
3. **Command-Specific Help Displays**:
|
||||
- When validation fails, detailed help for the specific command is shown
|
||||
- Help displays include usage examples and parameter descriptions
|
||||
- Formatted in clear, color-coded boxes with examples
|
||||
|
||||
4. **Helpful Error Recovery**:
|
||||
- Detailed troubleshooting steps for common errors
|
||||
- Graceful fallbacks for missing optional dependencies
|
||||
- Clear instructions for how to fix configuration issues
|
||||
|
||||
## Version Checking
|
||||
|
||||
The script now automatically checks for updates without slowing down execution:
|
||||
|
||||
1. **Background Version Checking**:
|
||||
- Non-blocking version checks run in the background while commands execute
|
||||
- Actual command execution isn't delayed by version checking
|
||||
- Update notifications appear after command completion
|
||||
|
||||
2. **Update Notifications**:
|
||||
- When a newer version is available, a notification is displayed
|
||||
- Notifications include current version, latest version, and update command
|
||||
- Formatted in an attention-grabbing box with clear instructions
|
||||
|
||||
3. **Implementation Details**:
|
||||
- Uses semantic versioning to compare current and latest versions
|
||||
- Fetches version information from npm registry with a timeout
|
||||
- Gracefully handles connection issues without affecting command execution
|
||||
|
||||
## Subtask Management
|
||||
|
||||
The script now includes enhanced commands for managing subtasks:
|
||||
|
||||
### Adding Subtasks
|
||||
|
||||
```bash
|
||||
# Add a subtask to an existing task
|
||||
node scripts/dev.js add-subtask --parent=5 --title="Implement login UI" --description="Create login form"
|
||||
|
||||
# Convert an existing task to a subtask
|
||||
node scripts/dev.js add-subtask --parent=5 --task-id=8
|
||||
|
||||
# Add a subtask with dependencies
|
||||
node scripts/dev.js add-subtask --parent=5 --title="Authentication middleware" --dependencies=5.1,5.2
|
||||
|
||||
# Skip regenerating task files
|
||||
node scripts/dev.js add-subtask --parent=5 --title="Login API route" --skip-generate
|
||||
```
|
||||
|
||||
Key features:
|
||||
- Create new subtasks with detailed properties or convert existing tasks
|
||||
- Define dependencies between subtasks
|
||||
- Set custom status for new subtasks
|
||||
- Provides next-step suggestions after creation
|
||||
|
||||
### Removing Subtasks
|
||||
|
||||
```bash
|
||||
# Remove a subtask
|
||||
node scripts/dev.js remove-subtask --id=5.2
|
||||
|
||||
# Remove multiple subtasks
|
||||
node scripts/dev.js remove-subtask --id=5.2,5.3,5.4
|
||||
|
||||
# Convert a subtask to a standalone task
|
||||
node scripts/dev.js remove-subtask --id=5.2 --convert
|
||||
|
||||
# Skip regenerating task files
|
||||
node scripts/dev.js remove-subtask --id=5.2 --skip-generate
|
||||
```
|
||||
|
||||
Key features:
|
||||
- Remove subtasks individually or in batches
|
||||
- Optionally convert subtasks to standalone tasks
|
||||
- Control whether task files are regenerated
|
||||
- Provides detailed success messages and next steps
|
||||
@@ -1,6 +1,6 @@
|
||||
# Task ID: 1
|
||||
# Title: Implement Task Data Structure
|
||||
# Status: done
|
||||
# Status: in-progress
|
||||
# Dependencies: None
|
||||
# Priority: high
|
||||
# Description: Design and implement the core tasks.json structure that will serve as the single source of truth for the system.
|
||||
|
||||
@@ -246,7 +246,7 @@ Testing approach:
|
||||
7. Add cache statistics for monitoring performance
|
||||
8. Create unit tests for context management and caching functionality
|
||||
|
||||
## 10. Enhance Tool Registration and Resource Management [pending]
|
||||
## 10. Enhance Tool Registration and Resource Management [in-progress]
|
||||
### Dependencies: 23.1
|
||||
### Description: Refactor tool registration to follow FastMCP best practices, using decorators and improving the overall structure. Implement proper resource management for task templates and other shared resources.
|
||||
### Details:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Task ID: 34
|
||||
# Title: Implement updateTask Command for Single Task Updates
|
||||
# Status: in-progress
|
||||
# Status: done
|
||||
# Dependencies: None
|
||||
# Priority: high
|
||||
# Description: Create a new command that allows updating a specific task by ID using AI-driven refinement while preserving completed subtasks and supporting all existing update command options.
|
||||
@@ -103,7 +103,7 @@ Testing approach:
|
||||
- Test concurrency scenarios with multiple simultaneous updates
|
||||
- Verify logging captures appropriate information for troubleshooting
|
||||
|
||||
## 4. Write comprehensive tests for updateTask command [in-progress]
|
||||
## 4. Write comprehensive tests for updateTask command [done]
|
||||
### Dependencies: 34.1, 34.2, 34.3
|
||||
### Description: Create a comprehensive test suite for the updateTask command to ensure it works correctly in all scenarios and maintains backward compatibility.
|
||||
### Details:
|
||||
@@ -130,7 +130,7 @@ Testing approach:
|
||||
- Create test fixtures for consistent test data
|
||||
- Use snapshot testing for command output verification
|
||||
|
||||
## 5. Update CLI documentation and help text [pending]
|
||||
## 5. Update CLI documentation and help text [done]
|
||||
### Dependencies: 34.2
|
||||
### Description: Update the CLI help documentation to include the new updateTask command and ensure users understand its purpose and options.
|
||||
### Details:
|
||||
|
||||
@@ -12,12 +12,13 @@
|
||||
"id": 1,
|
||||
"title": "Implement Task Data Structure",
|
||||
"description": "Design and implement the core tasks.json structure that will serve as the single source of truth for the system.",
|
||||
"status": "done",
|
||||
"status": "in-progress",
|
||||
"dependencies": [],
|
||||
"priority": "high",
|
||||
"details": "Create the foundational data structure including:\n- JSON schema for tasks.json\n- Task model with all required fields (id, title, description, status, dependencies, priority, details, testStrategy, subtasks)\n- Validation functions for the task model\n- Basic file system operations for reading/writing tasks.json\n- Error handling for file operations",
|
||||
"testStrategy": "Verify that the tasks.json structure can be created, read, and validated. Test with sample data to ensure all fields are properly handled and that validation correctly identifies invalid structures.",
|
||||
"subtasks": []
|
||||
"subtasks": [],
|
||||
"previousStatus": "in-progress"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -1419,7 +1420,7 @@
|
||||
1
|
||||
],
|
||||
"details": "1. Update registerTaskMasterTools function to use FastMCP's decorator pattern\n2. Implement @mcp.tool() decorators for all existing tools\n3. Add proper type annotations and documentation for all tools\n4. Create resource handlers for task templates using @mcp.resource()\n5. Implement resource templates for common task patterns\n6. Update the server initialization to properly register all tools and resources\n7. Add validation for tool inputs using FastMCP's built-in validation\n8. Create comprehensive tests for tool registration and resource access",
|
||||
"status": "pending",
|
||||
"status": "in-progress",
|
||||
"parentTaskId": 23
|
||||
},
|
||||
{
|
||||
@@ -1816,7 +1817,7 @@
|
||||
"id": 34,
|
||||
"title": "Implement updateTask Command for Single Task Updates",
|
||||
"description": "Create a new command that allows updating a specific task by ID using AI-driven refinement while preserving completed subtasks and supporting all existing update command options.",
|
||||
"status": "in-progress",
|
||||
"status": "done",
|
||||
"dependencies": [],
|
||||
"priority": "high",
|
||||
"details": "Implement a new command called 'updateTask' that focuses on updating a single task rather than all tasks from an ID onwards. The implementation should:\n\n1. Accept a single task ID as a required parameter\n2. Use the same AI-driven approach as the existing update command to refine the task\n3. Preserve the completion status of any subtasks that were previously marked as complete\n4. Support all options from the existing update command including:\n - The research flag for Perplexity integration\n - Any formatting or refinement options\n - Task context options\n5. Update the CLI help documentation to include this new command\n6. Ensure the command follows the same pattern as other commands in the codebase\n7. Add appropriate error handling for cases where the specified task ID doesn't exist\n8. Implement the ability to update task title, description, and details separately if needed\n9. Ensure the command returns appropriate success/failure messages\n10. Optimize the implementation to only process the single task rather than scanning through all tasks\n\nThe command should reuse existing AI prompt templates where possible but modify them to focus on refining a single task rather than multiple tasks.",
|
||||
@@ -1864,7 +1865,7 @@
|
||||
3
|
||||
],
|
||||
"details": "Implementation steps:\n1. Create unit tests for the updateTaskById function in task-manager.js\n - Test finding and updating tasks with various IDs\n - Test preservation of completed subtasks\n - Test different update options combinations\n - Test error handling for non-existent tasks\n2. Create unit tests for the updateTask command in commands.js\n - Test command parameter parsing\n - Test option handling\n - Test error scenarios and messages\n3. Create integration tests that verify the end-to-end flow\n - Test the command with actual AI service integration\n - Test with mock AI responses for predictable testing\n4. Implement test fixtures and mocks for consistent testing\n5. Add performance tests to ensure the command is efficient\n6. Test edge cases such as empty tasks, tasks with many subtasks, etc.\n\nTesting approach:\n- Use Jest or similar testing framework\n- Implement mocks for external dependencies like AI services\n- Create test fixtures for consistent test data\n- Use snapshot testing for command output verification",
|
||||
"status": "in-progress",
|
||||
"status": "done",
|
||||
"parentTaskId": 34
|
||||
},
|
||||
{
|
||||
@@ -1875,7 +1876,7 @@
|
||||
2
|
||||
],
|
||||
"details": "Implementation steps:\n1. Add comprehensive help text for the updateTask command including:\n - Command description\n - Required and optional parameters\n - Examples of usage\n - Description of all supported options\n2. Update the main CLI help documentation to include the new command\n3. Add the command to any relevant command groups or categories\n4. Create usage examples that demonstrate common scenarios\n5. Update README.md and other documentation files to include information about the new command\n6. Add inline code comments explaining the implementation details\n7. Update any API documentation if applicable\n8. Create or update user guides with the new functionality\n\nTesting approach:\n- Verify help text is displayed correctly when running `--help`\n- Review documentation for clarity and completeness\n- Have team members review the documentation for usability\n- Test examples to ensure they work as documented",
|
||||
"status": "pending",
|
||||
"status": "done",
|
||||
"parentTaskId": 34
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user