Compare commits
41 Commits
task-104
...
extension@
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a003041cd8 | ||
|
|
6b57ead106 | ||
|
|
7b6e117b1d | ||
|
|
03b045e9cd | ||
|
|
699afdae59 | ||
|
|
80c09802e8 | ||
|
|
cf8f0f4b1c | ||
|
|
75c514cf5b | ||
|
|
41d1e671b1 | ||
|
|
a464e550b8 | ||
|
|
3a852afdae | ||
|
|
4bb63706b8 | ||
|
|
fcf14e09be | ||
|
|
4357af3f13 | ||
|
|
59f7676051 | ||
|
|
36468f3c93 | ||
|
|
ca4d93ee6a | ||
|
|
37fb569a62 | ||
|
|
ed0d4e6641 | ||
|
|
5184f8e7b2 | ||
|
|
587523a23b | ||
|
|
7a50f0c6ec | ||
|
|
adeb76ee15 | ||
|
|
d342070375 | ||
|
|
5e4dbac525 | ||
|
|
fb15c2eaf7 | ||
|
|
e8ceb08341 | ||
|
|
e495b2b559 | ||
|
|
e0d1d03f33 | ||
|
|
4a4bca905d | ||
|
|
9d5f50ac8e | ||
|
|
bbeaa9163a | ||
|
|
a4a172be94 | ||
|
|
028ed9c444 | ||
|
|
53903f1e8e | ||
|
|
36c56231cc | ||
|
|
b82d858f81 | ||
|
|
9808967d6b | ||
|
|
3fee7515f3 | ||
|
|
82b17bdb57 | ||
|
|
72ca68edeb |
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
Fix for tasks not found when using string IDs
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
Fix tag-specific complexity report detection in expand command
|
||||
|
||||
The expand command now correctly finds and uses tag-specific complexity reports (e.g., `task-complexity-report_feature-xyz.json`) when operating in a tag context. Previously, it would always look for the generic `task-complexity-report.json` file due to a default value in the CLI option definition.
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"mode": "pre",
|
||||
"tag": "rc",
|
||||
"initialVersions": {
|
||||
"task-master-ai": "0.22.0",
|
||||
"extension": "0.20.0"
|
||||
},
|
||||
"changesets": [
|
||||
"eleven-horses-shop",
|
||||
"fix-tag-complexity-detection"
|
||||
]
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
---
|
||||
"extension": minor
|
||||
---
|
||||
|
||||
🎉 **Introducing TaskMaster Extension!**
|
||||
|
||||
We're thrilled to launch the first version of our Code extension, bringing the power of TaskMaster directly into your favorite code editor. While this is our initial release and we've kept things focused, it already packs powerful features to supercharge your development workflow.
|
||||
|
||||
## ✨ Key Features
|
||||
|
||||
### 📋 Visual Task Management
|
||||
- **Kanban Board View**: Visualize all your tasks in an intuitive board layout directly in VS Code
|
||||
- **Drag & Drop**: Easily change task status by dragging cards between columns
|
||||
- **Real-time Updates**: See changes instantly as you work through your project
|
||||
|
||||
### 🏷️ Multi-Context Support
|
||||
- **Tag Switching**: Seamlessly switch between different project contexts/tags
|
||||
- **Isolated Workflows**: Keep different features or experiments organized separately
|
||||
|
||||
### 🤖 AI-Powered Task Updates
|
||||
- **Smart Updates**: Use TaskMaster's AI capabilities to update tasks and subtasks
|
||||
- **Context-Aware**: Leverages your existing TaskMaster configuration and models
|
||||
|
||||
### 📊 Rich Task Information
|
||||
- **Complexity Scores**: See task complexity ratings at a glance
|
||||
- **Subtask Visualization**: Expand tasks to view and manage subtasks
|
||||
- **Dependency Graphs**: Understand task relationships and dependencies visually
|
||||
|
||||
### ⚙️ Configuration Management
|
||||
- **Visual Config Editor**: View and understand your `.taskmaster/config.json` settings
|
||||
- **Easy Access**: No more manual JSON editing for common configuration tasks
|
||||
|
||||
### 🚀 Quick Actions
|
||||
- **Status Updates**: Change task status with a single click
|
||||
- **Task Details**: Access full task information without leaving VS Code
|
||||
- **Integrated Commands**: All TaskMaster commands available through the command palette
|
||||
|
||||
## 🎯 What's Next?
|
||||
|
||||
This is just the beginning! We wanted to get a solid foundation into your hands quickly. The extension will evolve rapidly with your feedback, adding more advanced features, better visualizations, and deeper integration with your development workflow.
|
||||
|
||||
Thank you for being part of the TaskMaster journey. Your workflow has never looked better! 🚀
|
||||
162
.claude/agents/task-checker.md
Normal file
162
.claude/agents/task-checker.md
Normal file
@@ -0,0 +1,162 @@
|
||||
---
|
||||
name: task-checker
|
||||
description: Use this agent to verify that tasks marked as 'review' have been properly implemented according to their specifications. This agent performs quality assurance by checking implementations against requirements, running tests, and ensuring best practices are followed. <example>Context: A task has been marked as 'review' after implementation. user: 'Check if task 118 was properly implemented' assistant: 'I'll use the task-checker agent to verify the implementation meets all requirements.' <commentary>Tasks in 'review' status need verification before being marked as 'done'.</commentary></example> <example>Context: Multiple tasks are in review status. user: 'Verify all tasks that are ready for review' assistant: 'I'll deploy the task-checker to verify all tasks in review status.' <commentary>The checker ensures quality before tasks are marked complete.</commentary></example>
|
||||
model: sonnet
|
||||
color: yellow
|
||||
---
|
||||
|
||||
You are a Quality Assurance specialist that rigorously verifies task implementations against their specifications. Your role is to ensure that tasks marked as 'review' meet all requirements before they can be marked as 'done'.
|
||||
|
||||
## Core Responsibilities
|
||||
|
||||
1. **Task Specification Review**
|
||||
- Retrieve task details using MCP tool `mcp__task-master-ai__get_task`
|
||||
- Understand the requirements, test strategy, and success criteria
|
||||
- Review any subtasks and their individual requirements
|
||||
|
||||
2. **Implementation Verification**
|
||||
- Use `Read` tool to examine all created/modified files
|
||||
- Use `Bash` tool to run compilation and build commands
|
||||
- Use `Grep` tool to search for required patterns and implementations
|
||||
- Verify file structure matches specifications
|
||||
- Check that all required methods/functions are implemented
|
||||
|
||||
3. **Test Execution**
|
||||
- Run tests specified in the task's testStrategy
|
||||
- Execute build commands (npm run build, tsc --noEmit, etc.)
|
||||
- Verify no compilation errors or warnings
|
||||
- Check for runtime errors where applicable
|
||||
- Test edge cases mentioned in requirements
|
||||
|
||||
4. **Code Quality Assessment**
|
||||
- Verify code follows project conventions
|
||||
- Check for proper error handling
|
||||
- Ensure TypeScript typing is strict (no 'any' unless justified)
|
||||
- Verify documentation/comments where required
|
||||
- Check for security best practices
|
||||
|
||||
5. **Dependency Validation**
|
||||
- Verify all task dependencies were actually completed
|
||||
- Check integration points with dependent tasks
|
||||
- Ensure no breaking changes to existing functionality
|
||||
|
||||
## Verification Workflow
|
||||
|
||||
1. **Retrieve Task Information**
|
||||
```
|
||||
Use mcp__task-master-ai__get_task to get full task details
|
||||
Note the implementation requirements and test strategy
|
||||
```
|
||||
|
||||
2. **Check File Existence**
|
||||
```bash
|
||||
# Verify all required files exist
|
||||
ls -la [expected directories]
|
||||
# Read key files to verify content
|
||||
```
|
||||
|
||||
3. **Verify Implementation**
|
||||
- Read each created/modified file
|
||||
- Check against requirements checklist
|
||||
- Verify all subtasks are complete
|
||||
|
||||
4. **Run Tests**
|
||||
```bash
|
||||
# TypeScript compilation
|
||||
cd [project directory] && npx tsc --noEmit
|
||||
|
||||
# Run specified tests
|
||||
npm test [specific test files]
|
||||
|
||||
# Build verification
|
||||
npm run build
|
||||
```
|
||||
|
||||
5. **Generate Verification Report**
|
||||
|
||||
## Output Format
|
||||
|
||||
```yaml
|
||||
verification_report:
|
||||
task_id: [ID]
|
||||
status: PASS | FAIL | PARTIAL
|
||||
score: [1-10]
|
||||
|
||||
requirements_met:
|
||||
- ✅ [Requirement that was satisfied]
|
||||
- ✅ [Another satisfied requirement]
|
||||
|
||||
issues_found:
|
||||
- ❌ [Issue description]
|
||||
- ⚠️ [Warning or minor issue]
|
||||
|
||||
files_verified:
|
||||
- path: [file path]
|
||||
status: [created/modified/verified]
|
||||
issues: [any problems found]
|
||||
|
||||
tests_run:
|
||||
- command: [test command]
|
||||
result: [pass/fail]
|
||||
output: [relevant output]
|
||||
|
||||
recommendations:
|
||||
- [Specific fix needed]
|
||||
- [Improvement suggestion]
|
||||
|
||||
verdict: |
|
||||
[Clear statement on whether task should be marked 'done' or sent back to 'pending']
|
||||
[If FAIL: Specific list of what must be fixed]
|
||||
[If PASS: Confirmation that all requirements are met]
|
||||
```
|
||||
|
||||
## Decision Criteria
|
||||
|
||||
**Mark as PASS (ready for 'done'):**
|
||||
- All required files exist and contain expected content
|
||||
- All tests pass successfully
|
||||
- No compilation or build errors
|
||||
- All subtasks are complete
|
||||
- Core requirements are met
|
||||
- Code quality is acceptable
|
||||
|
||||
**Mark as PARTIAL (may proceed with warnings):**
|
||||
- Core functionality is implemented
|
||||
- Minor issues that don't block functionality
|
||||
- Missing nice-to-have features
|
||||
- Documentation could be improved
|
||||
- Tests pass but coverage could be better
|
||||
|
||||
**Mark as FAIL (must return to 'pending'):**
|
||||
- Required files are missing
|
||||
- Compilation or build errors
|
||||
- Tests fail
|
||||
- Core requirements not met
|
||||
- Security vulnerabilities detected
|
||||
- Breaking changes to existing code
|
||||
|
||||
## Important Guidelines
|
||||
|
||||
- **BE THOROUGH**: Check every requirement systematically
|
||||
- **BE SPECIFIC**: Provide exact file paths and line numbers for issues
|
||||
- **BE FAIR**: Distinguish between critical issues and minor improvements
|
||||
- **BE CONSTRUCTIVE**: Provide clear guidance on how to fix issues
|
||||
- **BE EFFICIENT**: Focus on requirements, not perfection
|
||||
|
||||
## Tools You MUST Use
|
||||
|
||||
- `Read`: Examine implementation files (READ-ONLY)
|
||||
- `Bash`: Run tests and verification commands
|
||||
- `Grep`: Search for patterns in code
|
||||
- `mcp__task-master-ai__get_task`: Get task details
|
||||
- **NEVER use Write/Edit** - you only verify, not fix
|
||||
|
||||
## Integration with Workflow
|
||||
|
||||
You are the quality gate between 'review' and 'done' status:
|
||||
1. Task-executor implements and marks as 'review'
|
||||
2. You verify and report PASS/FAIL
|
||||
3. Claude either marks as 'done' (PASS) or 'pending' (FAIL)
|
||||
4. If FAIL, task-executor re-implements based on your report
|
||||
|
||||
Your verification ensures high quality and prevents accumulation of technical debt.
|
||||
92
.claude/agents/task-executor.md
Normal file
92
.claude/agents/task-executor.md
Normal file
@@ -0,0 +1,92 @@
|
||||
---
|
||||
name: task-executor
|
||||
description: Use this agent when you need to implement, complete, or work on a specific task that has been identified by the task-orchestrator or when explicitly asked to execute a particular task. This agent focuses on the actual implementation and completion of individual tasks rather than planning or orchestration. Examples: <example>Context: The task-orchestrator has identified that task 2.3 'Implement user authentication' needs to be worked on next. user: 'Let's work on the authentication task' assistant: 'I'll use the task-executor agent to implement the user authentication task that was identified.' <commentary>Since we need to actually implement a specific task rather than plan or identify tasks, use the task-executor agent.</commentary></example> <example>Context: User wants to complete a specific subtask. user: 'Please implement the JWT token validation for task 2.3.1' assistant: 'I'll launch the task-executor agent to implement the JWT token validation subtask.' <commentary>The user is asking for specific implementation work on a known task, so the task-executor is appropriate.</commentary></example> <example>Context: After reviewing the task list, implementation is needed. user: 'Now let's actually build the API endpoint for user registration' assistant: 'I'll use the task-executor agent to implement the user registration API endpoint.' <commentary>Moving from planning to execution phase requires the task-executor agent.</commentary></example>
|
||||
model: sonnet
|
||||
color: blue
|
||||
---
|
||||
|
||||
You are an elite implementation specialist focused on executing and completing specific tasks with precision and thoroughness. Your role is to take identified tasks and transform them into working implementations, following best practices and project standards.
|
||||
|
||||
**IMPORTANT: You are designed to be SHORT-LIVED and FOCUSED**
|
||||
- Execute ONE specific subtask or a small group of related subtasks
|
||||
- Complete your work, verify it, mark for review, and exit
|
||||
- Do NOT decide what to do next - the orchestrator handles task sequencing
|
||||
- Focus on implementation excellence within your assigned scope
|
||||
|
||||
**Core Responsibilities:**
|
||||
|
||||
1. **Subtask Analysis**: When given a subtask, understand its SPECIFIC requirements. If given a full task ID, focus on the specific subtask(s) assigned to you. Use MCP tools to get details if needed.
|
||||
|
||||
2. **Rapid Implementation Planning**: Quickly identify:
|
||||
- The EXACT files you need to create/modify for THIS subtask
|
||||
- What already exists that you can build upon
|
||||
- The minimum viable implementation that satisfies requirements
|
||||
|
||||
3. **Focused Execution WITH ACTUAL IMPLEMENTATION**:
|
||||
- **YOU MUST USE TOOLS TO CREATE/EDIT FILES - DO NOT JUST DESCRIBE**
|
||||
- Use `Write` tool to create new files specified in the task
|
||||
- Use `Edit` tool to modify existing files
|
||||
- Use `Bash` tool to run commands (mkdir, npm install, etc.)
|
||||
- Use `Read` tool to verify your implementations
|
||||
- Implement one subtask at a time for clarity and traceability
|
||||
- Follow the project's coding standards from CLAUDE.md if available
|
||||
- After each subtask, VERIFY the files exist using Read or ls commands
|
||||
|
||||
4. **Progress Documentation**:
|
||||
- Use MCP tool `mcp__task-master-ai__update_subtask` to log your approach and any important decisions
|
||||
- Update task status to 'in-progress' when starting: Use MCP tool `mcp__task-master-ai__set_task_status` with status='in-progress'
|
||||
- **IMPORTANT: Mark as 'review' (NOT 'done') after implementation**: Use MCP tool `mcp__task-master-ai__set_task_status` with status='review'
|
||||
- Tasks will be verified by task-checker before moving to 'done'
|
||||
|
||||
5. **Quality Assurance**:
|
||||
- Implement the testing strategy specified in the task
|
||||
- Verify that all acceptance criteria are met
|
||||
- Check for any dependency conflicts or integration issues
|
||||
- Run relevant tests before marking task as complete
|
||||
|
||||
6. **Dependency Management**:
|
||||
- Check task dependencies before starting implementation
|
||||
- If blocked by incomplete dependencies, clearly communicate this
|
||||
- Use `task-master validate-dependencies` when needed
|
||||
|
||||
**Implementation Workflow:**
|
||||
|
||||
1. Retrieve task details using MCP tool `mcp__task-master-ai__get_task` with the task ID
|
||||
2. Check dependencies and prerequisites
|
||||
3. Plan implementation approach - list specific files to create
|
||||
4. Update task status to 'in-progress' using MCP tool
|
||||
5. **ACTUALLY IMPLEMENT** the solution using tools:
|
||||
- Use `Bash` to create directories
|
||||
- Use `Write` to create new files with actual content
|
||||
- Use `Edit` to modify existing files
|
||||
- DO NOT just describe what should be done - DO IT
|
||||
6. **VERIFY** your implementation:
|
||||
- Use `ls` or `Read` to confirm files were created
|
||||
- Use `Bash` to run any build/test commands
|
||||
- Ensure the implementation is real, not theoretical
|
||||
7. Log progress and decisions in subtask updates using MCP tools
|
||||
8. Test and verify the implementation works
|
||||
9. **Mark task as 'review' (NOT 'done')** after verifying files exist
|
||||
10. Report completion with:
|
||||
- List of created/modified files
|
||||
- Any issues encountered
|
||||
- What needs verification by task-checker
|
||||
|
||||
**Key Principles:**
|
||||
|
||||
- Focus on completing one task thoroughly before moving to the next
|
||||
- Maintain clear communication about what you're implementing and why
|
||||
- Follow existing code patterns and project conventions
|
||||
- Prioritize working code over extensive documentation unless docs are the task
|
||||
- Ask for clarification if task requirements are ambiguous
|
||||
- Consider edge cases and error handling in your implementations
|
||||
|
||||
**Integration with Task Master:**
|
||||
|
||||
You work in tandem with the task-orchestrator agent. While the orchestrator identifies and plans tasks, you execute them. Always use Task Master commands to:
|
||||
- Track your progress
|
||||
- Update task information
|
||||
- Maintain project state
|
||||
- Coordinate with the broader development workflow
|
||||
|
||||
When you complete a task, briefly summarize what was implemented and suggest whether to continue with the next task or if review/testing is needed first.
|
||||
208
.claude/agents/task-orchestrator.md
Normal file
208
.claude/agents/task-orchestrator.md
Normal file
@@ -0,0 +1,208 @@
|
||||
---
|
||||
name: task-orchestrator
|
||||
description: Use this agent FREQUENTLY throughout task execution to analyze and coordinate parallel work at the SUBTASK level. Invoke the orchestrator: (1) at session start to plan execution, (2) after EACH subtask completes to identify next parallel batch, (3) whenever executors finish to find newly unblocked work. ALWAYS provide FULL CONTEXT including project root, package location, what files ACTUALLY exist vs task status, and specific implementation details. The orchestrator breaks work into SUBTASK-LEVEL units for short-lived, focused executors. Maximum 3 parallel executors at once.\n\n<example>\nContext: Starting work with existing code\nuser: "Work on tm-core tasks. Files exist: types/index.ts, storage/file-storage.ts. Task 118 says in-progress but BaseProvider not created."\nassistant: "I'll invoke orchestrator with full context about actual vs reported state to plan subtask execution"\n<commentary>\nProvide complete context about file existence and task reality.\n</commentary>\n</example>\n\n<example>\nContext: Subtask completion\nuser: "Subtask 118.2 done. What subtasks can run in parallel now?"\nassistant: "Invoking orchestrator to analyze dependencies and identify next 3 parallel subtasks"\n<commentary>\nFrequent orchestration after each subtask ensures maximum parallelization.\n</commentary>\n</example>\n\n<example>\nContext: Breaking down tasks\nuser: "Task 118 has 5 subtasks, how to parallelize?"\nassistant: "Orchestrator will analyze which specific subtasks (118.1, 118.2, etc.) can run simultaneously"\n<commentary>\nFocus on subtask-level parallelization, not full tasks.\n</commentary>\n</example>
|
||||
model: opus
|
||||
color: green
|
||||
---
|
||||
|
||||
You are the Task Orchestrator, an elite coordination agent specialized in managing Task Master workflows for maximum efficiency and parallelization. You excel at analyzing task dependency graphs, identifying opportunities for concurrent execution, and deploying specialized task-executor agents to complete work efficiently.
|
||||
|
||||
## Core Responsibilities
|
||||
|
||||
1. **Subtask-Level Analysis**: Break down tasks into INDIVIDUAL SUBTASKS and analyze which specific subtasks can run in parallel. Focus on subtask dependencies, not just task-level dependencies.
|
||||
|
||||
2. **Reality Verification**: ALWAYS verify what files actually exist vs what task status claims. Use the context provided about actual implementation state to make informed decisions.
|
||||
|
||||
3. **Short-Lived Executor Deployment**: Deploy executors for SINGLE SUBTASKS or small groups of related subtasks. Keep executors focused and short-lived. Maximum 3 parallel executors at once.
|
||||
|
||||
4. **Continuous Reassessment**: After EACH subtask completes, immediately reassess what new subtasks are unblocked and can run in parallel.
|
||||
|
||||
## Operational Workflow
|
||||
|
||||
### Initial Assessment Phase
|
||||
1. Use `get_tasks` or `task-master list` to retrieve all available tasks
|
||||
2. Analyze task statuses, priorities, and dependencies
|
||||
3. Identify tasks with status 'pending' that have no blocking dependencies
|
||||
4. Group related tasks that could benefit from specialized executors
|
||||
5. Create an execution plan that maximizes parallelization
|
||||
|
||||
### Executor Deployment Phase
|
||||
1. For each independent task or task group:
|
||||
- Deploy a task-executor agent with specific instructions
|
||||
- Provide the executor with task ID, requirements, and context
|
||||
- Set clear completion criteria and reporting expectations
|
||||
2. Maintain a registry of active executors and their assigned tasks
|
||||
3. Establish communication protocols for progress updates
|
||||
|
||||
### Coordination Phase
|
||||
1. Monitor executor progress through task status updates
|
||||
2. When a task completes:
|
||||
- Verify completion with `get_task` or `task-master show <id>`
|
||||
- Update task status if needed using `set_task_status`
|
||||
- Reassess dependency graph for newly unblocked tasks
|
||||
- Deploy new executors for available work
|
||||
3. Handle executor failures or blocks:
|
||||
- Reassign tasks to new executors if needed
|
||||
- Escalate complex issues to the user
|
||||
- Update task status to 'blocked' when appropriate
|
||||
|
||||
### Optimization Strategies
|
||||
|
||||
**Parallel Execution Rules**:
|
||||
- Never assign dependent tasks to different executors simultaneously
|
||||
- Prioritize high-priority tasks when resources are limited
|
||||
- Group small, related subtasks for single executor efficiency
|
||||
- Balance executor load to prevent bottlenecks
|
||||
|
||||
**Context Management**:
|
||||
- Provide executors with minimal but sufficient context
|
||||
- Share relevant completed task information when it aids execution
|
||||
- Maintain a shared knowledge base of project-specific patterns
|
||||
|
||||
**Quality Assurance**:
|
||||
- Verify task completion before marking as done
|
||||
- Ensure test strategies are followed when specified
|
||||
- Coordinate cross-task integration testing when needed
|
||||
|
||||
## Communication Protocols
|
||||
|
||||
When deploying executors, provide them with:
|
||||
```
|
||||
TASK ASSIGNMENT:
|
||||
- Task ID: [specific ID]
|
||||
- Objective: [clear goal]
|
||||
- Dependencies: [list any completed prerequisites]
|
||||
- Success Criteria: [specific completion requirements]
|
||||
- Context: [relevant project information]
|
||||
- Reporting: [when and how to report back]
|
||||
```
|
||||
|
||||
When receiving executor updates:
|
||||
1. Acknowledge completion or issues
|
||||
2. Update task status in Task Master
|
||||
3. Reassess execution strategy
|
||||
4. Deploy new executors as appropriate
|
||||
|
||||
## Decision Framework
|
||||
|
||||
**When to parallelize**:
|
||||
- Multiple pending tasks with no interdependencies
|
||||
- Sufficient context available for independent execution
|
||||
- Tasks are well-defined with clear success criteria
|
||||
|
||||
**When to serialize**:
|
||||
- Strong dependencies between tasks
|
||||
- Limited context or unclear requirements
|
||||
- Integration points requiring careful coordination
|
||||
|
||||
**When to escalate**:
|
||||
- Circular dependencies detected
|
||||
- Critical blockers affecting multiple tasks
|
||||
- Ambiguous requirements needing clarification
|
||||
- Resource conflicts between executors
|
||||
|
||||
## Error Handling
|
||||
|
||||
1. **Executor Failure**: Reassign task to new executor with additional context about the failure
|
||||
2. **Dependency Conflicts**: Halt affected executors, resolve conflict, then resume
|
||||
3. **Task Ambiguity**: Request clarification from user before proceeding
|
||||
4. **System Errors**: Implement graceful degradation, falling back to serial execution if needed
|
||||
|
||||
## Performance Metrics
|
||||
|
||||
Track and optimize for:
|
||||
- Task completion rate
|
||||
- Parallel execution efficiency
|
||||
- Executor success rate
|
||||
- Time to completion for task groups
|
||||
- Dependency resolution speed
|
||||
|
||||
## Integration with Task Master
|
||||
|
||||
Leverage these Task Master MCP tools effectively:
|
||||
- `get_tasks` - Continuous queue monitoring
|
||||
- `get_task` - Detailed task analysis
|
||||
- `set_task_status` - Progress tracking
|
||||
- `next_task` - Fallback for serial execution
|
||||
- `analyze_project_complexity` - Strategic planning
|
||||
- `complexity_report` - Resource allocation
|
||||
|
||||
## Output Format for Execution
|
||||
|
||||
**Your job is to analyze and create actionable execution plans that Claude can use to deploy executors.**
|
||||
|
||||
After completing your dependency analysis, you MUST output a structured execution plan:
|
||||
|
||||
```yaml
|
||||
execution_plan:
|
||||
EXECUTE_IN_PARALLEL:
|
||||
# Maximum 3 subtasks running simultaneously
|
||||
- subtask_id: [e.g., 118.2]
|
||||
parent_task: [e.g., 118]
|
||||
title: [Specific subtask title]
|
||||
priority: [high/medium/low]
|
||||
estimated_time: [e.g., 10 minutes]
|
||||
executor_prompt: |
|
||||
Execute Subtask [ID]: [Specific subtask title]
|
||||
|
||||
SPECIFIC REQUIREMENTS:
|
||||
[Exact implementation needed for THIS subtask only]
|
||||
|
||||
FILES TO CREATE/MODIFY:
|
||||
[Specific file paths]
|
||||
|
||||
CONTEXT:
|
||||
[What already exists that this subtask depends on]
|
||||
|
||||
SUCCESS CRITERIA:
|
||||
[Specific completion criteria for this subtask]
|
||||
|
||||
IMPORTANT:
|
||||
- Focus ONLY on this subtask
|
||||
- Mark subtask as 'review' when complete
|
||||
- Use MCP tool: mcp__task-master-ai__set_task_status
|
||||
|
||||
- subtask_id: [Another subtask that can run in parallel]
|
||||
parent_task: [Parent task ID]
|
||||
title: [Specific subtask title]
|
||||
priority: [priority]
|
||||
estimated_time: [time estimate]
|
||||
executor_prompt: |
|
||||
[Focused prompt for this specific subtask]
|
||||
|
||||
blocked:
|
||||
- task_id: [ID]
|
||||
title: [Task title]
|
||||
waiting_for: [list of blocking task IDs]
|
||||
becomes_ready_when: [condition for unblocking]
|
||||
|
||||
next_wave:
|
||||
trigger: "After tasks [IDs] complete"
|
||||
newly_available: [List of task IDs that will unblock]
|
||||
tasks_to_execute_in_parallel: [IDs that can run together in next wave]
|
||||
|
||||
critical_path: [Ordered list of task IDs forming the critical path]
|
||||
|
||||
parallelization_instruction: |
|
||||
IMPORTANT FOR CLAUDE: Deploy ALL tasks in 'EXECUTE_IN_PARALLEL' section
|
||||
simultaneously using multiple Task tool invocations in a single response.
|
||||
Example: If 3 tasks are listed, invoke the Task tool 3 times in one message.
|
||||
|
||||
verification_needed:
|
||||
- task_id: [ID of any task in 'review' status]
|
||||
verification_focus: [what to check]
|
||||
```
|
||||
|
||||
**CRITICAL INSTRUCTIONS FOR CLAUDE (MAIN):**
|
||||
1. When you see `EXECUTE_IN_PARALLEL`, deploy ALL listed executors at once
|
||||
2. Use multiple Task tool invocations in a SINGLE response
|
||||
3. Do not execute them sequentially - they must run in parallel
|
||||
4. Wait for all parallel executors to complete before proceeding to next wave
|
||||
|
||||
**IMPORTANT NOTES**:
|
||||
- Label parallel tasks clearly in `EXECUTE_IN_PARALLEL` section
|
||||
- Provide complete, self-contained prompts for each executor
|
||||
- Executors should mark tasks as 'review' for verification, not 'done'
|
||||
- Be explicit about which tasks can run simultaneously
|
||||
|
||||
You are the strategic mind analyzing the entire task landscape. Make parallelization opportunities UNMISTAKABLY CLEAR to Claude.
|
||||
803
.cursor/rules/test_workflow.mdc
Normal file
803
.cursor/rules/test_workflow.mdc
Normal file
@@ -0,0 +1,803 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
# Test Workflow & Development Process
|
||||
|
||||
## **Initial Testing Framework Setup**
|
||||
|
||||
Before implementing the TDD workflow, ensure your project has a proper testing framework configured. This section covers setup for different technology stacks.
|
||||
|
||||
### **Detecting Project Type & Framework Needs**
|
||||
|
||||
**AI Agent Assessment Checklist:**
|
||||
1. **Language Detection**: Check for `package.json` (Node.js/JavaScript), `requirements.txt` (Python), `Cargo.toml` (Rust), etc.
|
||||
2. **Existing Tests**: Look for test files (`.test.`, `.spec.`, `_test.`) or test directories
|
||||
3. **Framework Detection**: Check for existing test runners in dependencies
|
||||
4. **Project Structure**: Analyze directory structure for testing patterns
|
||||
|
||||
### **JavaScript/Node.js Projects (Jest Setup)**
|
||||
|
||||
#### **Prerequisites Check**
|
||||
```bash
|
||||
# Verify Node.js project
|
||||
ls package.json # Should exist
|
||||
|
||||
# Check for existing testing setup
|
||||
ls jest.config.js jest.config.ts # Check for Jest config
|
||||
grep -E "(jest|vitest|mocha)" package.json # Check for test runners
|
||||
```
|
||||
|
||||
#### **Jest Installation & Configuration**
|
||||
|
||||
**Step 1: Install Dependencies**
|
||||
```bash
|
||||
# Core Jest dependencies
|
||||
npm install --save-dev jest
|
||||
|
||||
# TypeScript support (if using TypeScript)
|
||||
npm install --save-dev ts-jest @types/jest
|
||||
|
||||
# Additional useful packages
|
||||
npm install --save-dev supertest @types/supertest # For API testing
|
||||
npm install --save-dev jest-watch-typeahead # Enhanced watch mode
|
||||
```
|
||||
|
||||
**Step 2: Create Jest Configuration**
|
||||
|
||||
Create `jest.config.js` with the following production-ready configuration:
|
||||
|
||||
```javascript
|
||||
/** @type {import('jest').Config} */
|
||||
module.exports = {
|
||||
// Use ts-jest preset for TypeScript support
|
||||
preset: 'ts-jest',
|
||||
|
||||
// Test environment
|
||||
testEnvironment: 'node',
|
||||
|
||||
// Roots for test discovery
|
||||
roots: ['<rootDir>/src', '<rootDir>/tests'],
|
||||
|
||||
// Test file patterns
|
||||
testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
|
||||
|
||||
// Transform files
|
||||
transform: {
|
||||
'^.+\\.ts$': [
|
||||
'ts-jest',
|
||||
{
|
||||
tsconfig: {
|
||||
target: 'es2020',
|
||||
module: 'commonjs',
|
||||
esModuleInterop: true,
|
||||
allowSyntheticDefaultImports: true,
|
||||
skipLibCheck: true,
|
||||
strict: false,
|
||||
noImplicitAny: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
'^.+\\.js$': [
|
||||
'ts-jest',
|
||||
{
|
||||
useESM: false,
|
||||
tsconfig: {
|
||||
target: 'es2020',
|
||||
module: 'commonjs',
|
||||
esModuleInterop: true,
|
||||
allowSyntheticDefaultImports: true,
|
||||
allowJs: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// Module file extensions
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
||||
|
||||
// Transform ignore patterns - adjust for ES modules
|
||||
transformIgnorePatterns: ['node_modules/(?!(your-es-module-deps|.*\\.mjs$))'],
|
||||
|
||||
// Coverage configuration
|
||||
collectCoverage: true,
|
||||
coverageDirectory: 'coverage',
|
||||
coverageReporters: [
|
||||
'text', // Console output
|
||||
'text-summary', // Brief summary
|
||||
'lcov', // For IDE integration
|
||||
'html', // Detailed HTML report
|
||||
],
|
||||
|
||||
// Files to collect coverage from
|
||||
collectCoverageFrom: [
|
||||
'src/**/*.ts',
|
||||
'!src/**/*.d.ts',
|
||||
'!src/**/*.test.ts',
|
||||
'!src/**/index.ts', // Often just exports
|
||||
'!src/generated/**', // Generated code
|
||||
'!src/config/database.ts', // Database config (tested via integration)
|
||||
],
|
||||
|
||||
// Coverage thresholds - TaskMaster standards
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
branches: 70,
|
||||
functions: 80,
|
||||
lines: 80,
|
||||
statements: 80,
|
||||
},
|
||||
// Higher standards for critical business logic
|
||||
'./src/utils/': {
|
||||
branches: 85,
|
||||
functions: 90,
|
||||
lines: 90,
|
||||
statements: 90,
|
||||
},
|
||||
'./src/middleware/': {
|
||||
branches: 80,
|
||||
functions: 85,
|
||||
lines: 85,
|
||||
statements: 85,
|
||||
},
|
||||
},
|
||||
|
||||
// Setup files
|
||||
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
|
||||
|
||||
// Global teardown to prevent worker process leaks
|
||||
globalTeardown: '<rootDir>/tests/teardown.ts',
|
||||
|
||||
// Module path mapping (if needed)
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
},
|
||||
|
||||
// Clear mocks between tests
|
||||
clearMocks: true,
|
||||
|
||||
// Restore mocks after each test
|
||||
restoreMocks: true,
|
||||
|
||||
// Global test timeout
|
||||
testTimeout: 10000,
|
||||
|
||||
// Projects for different test types
|
||||
projects: [
|
||||
// Unit tests - for pure functions only
|
||||
{
|
||||
displayName: 'unit',
|
||||
testMatch: ['<rootDir>/src/**/*.test.ts'],
|
||||
testPathIgnorePatterns: ['.*\\.integration\\.test\\.ts$', '/tests/'],
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
collectCoverageFrom: [
|
||||
'src/**/*.ts',
|
||||
'!src/**/*.d.ts',
|
||||
'!src/**/*.test.ts',
|
||||
'!src/**/*.integration.test.ts',
|
||||
],
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
branches: 70,
|
||||
functions: 80,
|
||||
lines: 80,
|
||||
statements: 80,
|
||||
},
|
||||
},
|
||||
},
|
||||
// Integration tests - real database/services
|
||||
{
|
||||
displayName: 'integration',
|
||||
testMatch: [
|
||||
'<rootDir>/src/**/*.integration.test.ts',
|
||||
'<rootDir>/tests/integration/**/*.test.ts',
|
||||
],
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
setupFilesAfterEnv: ['<rootDir>/tests/setup/integration.ts'],
|
||||
testTimeout: 10000,
|
||||
},
|
||||
// E2E tests - full workflows
|
||||
{
|
||||
displayName: 'e2e',
|
||||
testMatch: ['<rootDir>/tests/e2e/**/*.test.ts'],
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
setupFilesAfterEnv: ['<rootDir>/tests/setup/e2e.ts'],
|
||||
testTimeout: 30000,
|
||||
},
|
||||
],
|
||||
|
||||
// Verbose output for better debugging
|
||||
verbose: true,
|
||||
|
||||
// Run projects sequentially to avoid conflicts
|
||||
maxWorkers: 1,
|
||||
|
||||
// Enable watch mode plugins
|
||||
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
|
||||
};
|
||||
```
|
||||
|
||||
**Step 3: Update package.json Scripts**
|
||||
|
||||
Add these scripts to your `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:coverage": "jest --coverage",
|
||||
"test:unit": "jest --selectProjects unit",
|
||||
"test:integration": "jest --selectProjects integration",
|
||||
"test:e2e": "jest --selectProjects e2e",
|
||||
"test:ci": "jest --ci --coverage --watchAll=false"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Step 4: Create Test Setup Files**
|
||||
|
||||
Create essential test setup files:
|
||||
|
||||
```typescript
|
||||
// tests/setup.ts - Global setup
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
// Global test configuration
|
||||
beforeAll(() => {
|
||||
// Set test timeout
|
||||
jest.setTimeout(10000);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Clean up mocks after each test
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
```
|
||||
|
||||
```typescript
|
||||
// tests/setup/integration.ts - Integration test setup
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
beforeAll(async () => {
|
||||
// Connect to test database
|
||||
await prisma.$connect();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
// Cleanup and disconnect
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
// Clean test data before each test
|
||||
// Add your cleanup logic here
|
||||
});
|
||||
```
|
||||
|
||||
```typescript
|
||||
// tests/teardown.ts - Global teardown
|
||||
export default async () => {
|
||||
// Global cleanup after all tests
|
||||
console.log('Global test teardown complete');
|
||||
};
|
||||
```
|
||||
|
||||
**Step 5: Create Initial Test Structure**
|
||||
|
||||
```bash
|
||||
# Create test directories
|
||||
mkdir -p tests/{setup,fixtures,unit,integration,e2e}
|
||||
mkdir -p tests/unit/src/{utils,services,middleware}
|
||||
|
||||
# Create sample test fixtures
|
||||
mkdir tests/fixtures
|
||||
```
|
||||
|
||||
### **Generic Testing Framework Setup (Any Language)**
|
||||
|
||||
#### **Framework Selection Guide**
|
||||
|
||||
**Python Projects:**
|
||||
- **pytest**: Recommended for most Python projects
|
||||
- **unittest**: Built-in, suitable for simple projects
|
||||
- **Coverage**: Use `coverage.py` for code coverage
|
||||
|
||||
```bash
|
||||
# Python setup example
|
||||
pip install pytest pytest-cov
|
||||
echo "[tool:pytest]" > pytest.ini
|
||||
echo "testpaths = tests" >> pytest.ini
|
||||
echo "addopts = --cov=src --cov-report=html --cov-report=term" >> pytest.ini
|
||||
```
|
||||
|
||||
**Go Projects:**
|
||||
- **Built-in testing**: Use Go's built-in `testing` package
|
||||
- **Coverage**: Built-in with `go test -cover`
|
||||
|
||||
```bash
|
||||
# Go setup example
|
||||
go mod init your-project
|
||||
mkdir -p tests
|
||||
# Tests are typically *_test.go files alongside source
|
||||
```
|
||||
|
||||
**Rust Projects:**
|
||||
- **Built-in testing**: Use Rust's built-in test framework
|
||||
- **cargo-tarpaulin**: For coverage analysis
|
||||
|
||||
```bash
|
||||
# Rust setup example
|
||||
cargo new your-project
|
||||
cd your-project
|
||||
cargo install cargo-tarpaulin # For coverage
|
||||
```
|
||||
|
||||
**Java Projects:**
|
||||
- **JUnit 5**: Modern testing framework
|
||||
- **Maven/Gradle**: Build tools with testing integration
|
||||
|
||||
```xml
|
||||
<!-- Maven pom.xml example -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>5.9.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
#### **Universal Testing Principles**
|
||||
|
||||
**Coverage Standards (Adapt to Your Language):**
|
||||
- **Global Minimum**: 70-80% line coverage
|
||||
- **Critical Code**: 85-90% coverage
|
||||
- **New Features**: Must meet or exceed standards
|
||||
- **Legacy Code**: Gradual improvement strategy
|
||||
|
||||
**Test Organization:**
|
||||
- **Unit Tests**: Fast, isolated, no external dependencies
|
||||
- **Integration Tests**: Test component interactions
|
||||
- **E2E Tests**: Test complete user workflows
|
||||
- **Performance Tests**: Load and stress testing (if applicable)
|
||||
|
||||
**Naming Conventions:**
|
||||
- **Test Files**: `*.test.*`, `*_test.*`, or language-specific patterns
|
||||
- **Test Functions**: Descriptive names (e.g., `should_return_error_for_invalid_input`)
|
||||
- **Test Directories**: Organized by test type and mirroring source structure
|
||||
|
||||
#### **TaskMaster Integration for Any Framework**
|
||||
|
||||
**Document Testing Setup in Subtasks:**
|
||||
```bash
|
||||
# Update subtask with testing framework setup
|
||||
task-master update-subtask --id=X.Y --prompt="Testing framework setup:
|
||||
- Installed [Framework Name] with coverage support
|
||||
- Configured [Coverage Tool] with thresholds: 80% lines, 70% branches
|
||||
- Created test directory structure: unit/, integration/, e2e/
|
||||
- Added test scripts to build configuration
|
||||
- All setup tests passing"
|
||||
```
|
||||
|
||||
**Testing Framework Verification:**
|
||||
```bash
|
||||
# Verify setup works
|
||||
[test-command] # e.g., npm test, pytest, go test, cargo test
|
||||
|
||||
# Check coverage reporting
|
||||
[coverage-command] # e.g., npm run test:coverage
|
||||
|
||||
# Update task with verification
|
||||
task-master update-subtask --id=X.Y --prompt="Testing framework verified:
|
||||
- Sample tests running successfully
|
||||
- Coverage reporting functional
|
||||
- CI/CD integration ready
|
||||
- Ready to begin TDD workflow"
|
||||
```
|
||||
|
||||
## **Test-Driven Development (TDD) Integration**
|
||||
|
||||
### **Core TDD Cycle with Jest**
|
||||
```bash
|
||||
# 1. Start development with watch mode
|
||||
npm run test:watch
|
||||
|
||||
# 2. Write failing test first
|
||||
# Create test file: src/utils/newFeature.test.ts
|
||||
# Write test that describes expected behavior
|
||||
|
||||
# 3. Implement minimum code to make test pass
|
||||
# 4. Refactor while keeping tests green
|
||||
# 5. Add edge cases and error scenarios
|
||||
```
|
||||
|
||||
### **TDD Workflow Per Subtask**
|
||||
```bash
|
||||
# When starting a new subtask:
|
||||
task-master set-status --id=4.1 --status=in-progress
|
||||
|
||||
# Begin TDD cycle:
|
||||
npm run test:watch # Keep running during development
|
||||
|
||||
# Document TDD progress in subtask:
|
||||
task-master update-subtask --id=4.1 --prompt="TDD Progress:
|
||||
- Written 3 failing tests for core functionality
|
||||
- Implemented basic feature, tests now passing
|
||||
- Adding edge case tests for error handling"
|
||||
|
||||
# Complete subtask with test summary:
|
||||
task-master update-subtask --id=4.1 --prompt="Implementation complete:
|
||||
- Feature implemented with 8 unit tests
|
||||
- Coverage: 95% statements, 88% branches
|
||||
- All tests passing, TDD cycle complete"
|
||||
```
|
||||
|
||||
## **Testing Commands & Usage**
|
||||
|
||||
### **Development Commands**
|
||||
```bash
|
||||
# Primary development command - use during coding
|
||||
npm run test:watch # Watch mode with Jest
|
||||
npm run test:watch -- --testNamePattern="auth" # Watch specific tests
|
||||
|
||||
# Targeted testing during development
|
||||
npm run test:unit # Run only unit tests
|
||||
npm run test:unit -- --coverage # Unit tests with coverage
|
||||
|
||||
# Integration testing when APIs are ready
|
||||
npm run test:integration # Run integration tests
|
||||
npm run test:integration -- --detectOpenHandles # Debug hanging tests
|
||||
|
||||
# End-to-end testing for workflows
|
||||
npm run test:e2e # Run E2E tests
|
||||
npm run test:e2e -- --timeout=30000 # Extended timeout for E2E
|
||||
```
|
||||
|
||||
### **Quality Assurance Commands**
|
||||
```bash
|
||||
# Full test suite with coverage (before commits)
|
||||
npm run test:coverage # Complete coverage analysis
|
||||
|
||||
# All tests (CI/CD pipeline)
|
||||
npm test # Run all test projects
|
||||
|
||||
# Specific test file execution
|
||||
npm test -- auth.test.ts # Run specific test file
|
||||
npm test -- --testNamePattern="should handle errors" # Run specific tests
|
||||
```
|
||||
|
||||
## **Test Implementation Patterns**
|
||||
|
||||
### **Unit Test Development**
|
||||
```typescript
|
||||
// ✅ DO: Follow established patterns from auth.test.ts
|
||||
describe('FeatureName', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
// Setup mocks with proper typing
|
||||
});
|
||||
|
||||
describe('functionName', () => {
|
||||
it('should handle normal case', () => {
|
||||
// Test implementation with specific assertions
|
||||
});
|
||||
|
||||
it('should throw error for invalid input', async () => {
|
||||
// Error scenario testing
|
||||
await expect(functionName(invalidInput))
|
||||
.rejects.toThrow('Specific error message');
|
||||
});
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### **Integration Test Development**
|
||||
```typescript
|
||||
// ✅ DO: Use supertest for API endpoint testing
|
||||
import request from 'supertest';
|
||||
import { app } from '../../src/app';
|
||||
|
||||
describe('POST /api/auth/register', () => {
|
||||
beforeEach(async () => {
|
||||
await integrationTestUtils.cleanupTestData();
|
||||
});
|
||||
|
||||
it('should register user successfully', async () => {
|
||||
const userData = createTestUser();
|
||||
|
||||
const response = await request(app)
|
||||
.post('/api/auth/register')
|
||||
.send(userData)
|
||||
.expect(201);
|
||||
|
||||
expect(response.body).toMatchObject({
|
||||
id: expect.any(String),
|
||||
email: userData.email
|
||||
});
|
||||
|
||||
// Verify database state
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { email: userData.email }
|
||||
});
|
||||
expect(user).toBeTruthy();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### **E2E Test Development**
|
||||
```typescript
|
||||
// ✅ DO: Test complete user workflows
|
||||
describe('User Authentication Flow', () => {
|
||||
it('should complete registration → login → protected access', async () => {
|
||||
// Step 1: Register
|
||||
const userData = createTestUser();
|
||||
await request(app)
|
||||
.post('/api/auth/register')
|
||||
.send(userData)
|
||||
.expect(201);
|
||||
|
||||
// Step 2: Login
|
||||
const loginResponse = await request(app)
|
||||
.post('/api/auth/login')
|
||||
.send({ email: userData.email, password: userData.password })
|
||||
.expect(200);
|
||||
|
||||
const { token } = loginResponse.body;
|
||||
|
||||
// Step 3: Access protected resource
|
||||
await request(app)
|
||||
.get('/api/profile')
|
||||
.set('Authorization', `Bearer ${token}`)
|
||||
.expect(200);
|
||||
}, 30000); // Extended timeout for E2E
|
||||
});
|
||||
```
|
||||
|
||||
## **Mocking & Test Utilities**
|
||||
|
||||
### **Established Mocking Patterns**
|
||||
```typescript
|
||||
// ✅ DO: Use established bcrypt mocking pattern
|
||||
jest.mock('bcrypt');
|
||||
import bcrypt from 'bcrypt';
|
||||
const mockHash = bcrypt.hash as jest.MockedFunction<typeof bcrypt.hash>;
|
||||
const mockCompare = bcrypt.compare as jest.MockedFunction<typeof bcrypt.compare>;
|
||||
|
||||
// ✅ DO: Use Prisma mocking for unit tests
|
||||
jest.mock('@prisma/client', () => ({
|
||||
PrismaClient: jest.fn().mockImplementation(() => ({
|
||||
user: {
|
||||
create: jest.fn(),
|
||||
findUnique: jest.fn(),
|
||||
},
|
||||
$connect: jest.fn(),
|
||||
$disconnect: jest.fn(),
|
||||
})),
|
||||
}));
|
||||
```
|
||||
|
||||
### **Test Fixtures Usage**
|
||||
```typescript
|
||||
// ✅ DO: Use centralized test fixtures
|
||||
import { createTestUser, adminUser, invalidUser } from '../fixtures/users';
|
||||
|
||||
describe('User Service', () => {
|
||||
it('should handle admin user creation', async () => {
|
||||
const userData = createTestUser(adminUser);
|
||||
// Test implementation
|
||||
});
|
||||
|
||||
it('should reject invalid user data', async () => {
|
||||
const userData = createTestUser(invalidUser);
|
||||
// Error testing
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## **Coverage Standards & Monitoring**
|
||||
|
||||
### **Coverage Thresholds**
|
||||
- **Global Standards**: 80% lines/functions, 70% branches
|
||||
- **Critical Code**: 90% utils, 85% middleware
|
||||
- **New Features**: Must meet or exceed global thresholds
|
||||
- **Legacy Code**: Gradual improvement with each change
|
||||
|
||||
### **Coverage Reporting & Analysis**
|
||||
```bash
|
||||
# Generate coverage reports
|
||||
npm run test:coverage
|
||||
|
||||
# View detailed HTML report
|
||||
open coverage/lcov-report/index.html
|
||||
|
||||
# Coverage files generated:
|
||||
# - coverage/lcov-report/index.html # Detailed HTML report
|
||||
# - coverage/lcov.info # LCOV format for IDE integration
|
||||
# - coverage/coverage-final.json # JSON format for tooling
|
||||
```
|
||||
|
||||
### **Coverage Quality Checks**
|
||||
```typescript
|
||||
// ✅ DO: Test all code paths
|
||||
describe('validateInput', () => {
|
||||
it('should return true for valid input', () => {
|
||||
expect(validateInput('valid')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for various invalid inputs', () => {
|
||||
expect(validateInput('')).toBe(false); // Empty string
|
||||
expect(validateInput(null)).toBe(false); // Null value
|
||||
expect(validateInput(undefined)).toBe(false); // Undefined
|
||||
});
|
||||
|
||||
it('should throw for unexpected input types', () => {
|
||||
expect(() => validateInput(123)).toThrow('Invalid input type');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## **Testing During Development Phases**
|
||||
|
||||
### **Feature Development Phase**
|
||||
```bash
|
||||
# 1. Start feature development
|
||||
task-master set-status --id=X.Y --status=in-progress
|
||||
|
||||
# 2. Begin TDD cycle
|
||||
npm run test:watch
|
||||
|
||||
# 3. Document test progress in subtask
|
||||
task-master update-subtask --id=X.Y --prompt="Test development:
|
||||
- Created test file with 5 failing tests
|
||||
- Implemented core functionality
|
||||
- Tests passing, adding error scenarios"
|
||||
|
||||
# 4. Verify coverage before completion
|
||||
npm run test:coverage
|
||||
|
||||
# 5. Update subtask with final test status
|
||||
task-master update-subtask --id=X.Y --prompt="Testing complete:
|
||||
- 12 unit tests with full coverage
|
||||
- All edge cases and error scenarios covered
|
||||
- Ready for integration testing"
|
||||
```
|
||||
|
||||
### **Integration Testing Phase**
|
||||
```bash
|
||||
# After API endpoints are implemented
|
||||
npm run test:integration
|
||||
|
||||
# Update integration test templates
|
||||
# Replace placeholder tests with real endpoint calls
|
||||
|
||||
# Document integration test results
|
||||
task-master update-subtask --id=X.Y --prompt="Integration tests:
|
||||
- Updated auth endpoint tests
|
||||
- Database integration verified
|
||||
- All HTTP status codes and responses tested"
|
||||
```
|
||||
|
||||
### **Pre-Commit Testing Phase**
|
||||
```bash
|
||||
# Before committing code
|
||||
npm run test:coverage # Verify all tests pass with coverage
|
||||
npm run test:unit # Quick unit test verification
|
||||
npm run test:integration # Integration test verification (if applicable)
|
||||
|
||||
# Commit pattern for test updates
|
||||
git add tests/ src/**/*.test.ts
|
||||
git commit -m "test(task-X): Add comprehensive tests for Feature Y
|
||||
|
||||
- Unit tests with 95% coverage (exceeds 90% threshold)
|
||||
- Integration tests for API endpoints
|
||||
- Test fixtures for data generation
|
||||
- Proper mocking patterns established
|
||||
|
||||
Task X: Feature Y - Testing complete"
|
||||
```
|
||||
|
||||
## **Error Handling & Debugging**
|
||||
|
||||
### **Test Debugging Techniques**
|
||||
```typescript
|
||||
// ✅ DO: Use test utilities for debugging
|
||||
import { testUtils } from '../setup';
|
||||
|
||||
it('should debug complex operation', () => {
|
||||
testUtils.withConsole(() => {
|
||||
// Console output visible only for this test
|
||||
console.log('Debug info:', complexData);
|
||||
service.complexOperation();
|
||||
});
|
||||
});
|
||||
|
||||
// ✅ DO: Use proper async debugging
|
||||
it('should handle async operations', async () => {
|
||||
const promise = service.asyncOperation();
|
||||
|
||||
// Test intermediate state
|
||||
expect(service.isProcessing()).toBe(true);
|
||||
|
||||
const result = await promise;
|
||||
expect(result).toBe('expected');
|
||||
expect(service.isProcessing()).toBe(false);
|
||||
});
|
||||
```
|
||||
|
||||
### **Common Test Issues & Solutions**
|
||||
```bash
|
||||
# Hanging tests (common with database connections)
|
||||
npm run test:integration -- --detectOpenHandles
|
||||
|
||||
# Memory leaks in tests
|
||||
npm run test:unit -- --logHeapUsage
|
||||
|
||||
# Slow tests identification
|
||||
npm run test:coverage -- --verbose
|
||||
|
||||
# Mock not working properly
|
||||
# Check: mock is declared before imports
|
||||
# Check: jest.clearAllMocks() in beforeEach
|
||||
# Check: TypeScript typing is correct
|
||||
```
|
||||
|
||||
## **Continuous Integration Integration**
|
||||
|
||||
### **CI/CD Pipeline Testing**
|
||||
```yaml
|
||||
# Example GitHub Actions integration
|
||||
- name: Run tests
|
||||
run: |
|
||||
npm ci
|
||||
npm run test:coverage
|
||||
|
||||
- name: Upload coverage reports
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: ./coverage/lcov.info
|
||||
```
|
||||
|
||||
### **Pre-commit Hooks**
|
||||
```bash
|
||||
# Setup pre-commit testing (recommended)
|
||||
# In package.json scripts:
|
||||
"pre-commit": "npm run test:unit && npm run test:integration"
|
||||
|
||||
# Husky integration example:
|
||||
npx husky add .husky/pre-commit "npm run test:unit"
|
||||
```
|
||||
|
||||
## **Test Maintenance & Evolution**
|
||||
|
||||
### **Adding Tests for New Features**
|
||||
1. **Create test file** alongside source code or in `tests/unit/`
|
||||
2. **Follow established patterns** from `src/utils/auth.test.ts`
|
||||
3. **Use existing fixtures** from `tests/fixtures/`
|
||||
4. **Apply proper mocking** patterns for dependencies
|
||||
5. **Meet coverage thresholds** for the module
|
||||
|
||||
### **Updating Integration/E2E Tests**
|
||||
1. **Update templates** in `tests/integration/` when APIs change
|
||||
2. **Modify E2E workflows** in `tests/e2e/` for new user journeys
|
||||
3. **Update test fixtures** for new data requirements
|
||||
4. **Maintain database cleanup** utilities
|
||||
|
||||
### **Test Performance Optimization**
|
||||
- **Parallel execution**: Jest runs tests in parallel by default
|
||||
- **Test isolation**: Use proper setup/teardown for independence
|
||||
- **Mock optimization**: Mock heavy dependencies appropriately
|
||||
- **Database efficiency**: Use transaction rollbacks where possible
|
||||
|
||||
---
|
||||
|
||||
**Key References:**
|
||||
- [Testing Standards](mdc:.cursor/rules/tests.mdc)
|
||||
- [Git Workflow](mdc:.cursor/rules/git_workflow.mdc)
|
||||
- [Development Workflow](mdc:.cursor/rules/dev_workflow.mdc)
|
||||
- [Jest Configuration](mdc:jest.config.js)
|
||||
102
.github/scripts/check-pre-release-mode.mjs
vendored
Executable file
102
.github/scripts/check-pre-release-mode.mjs
vendored
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env node
|
||||
import { readFileSync, existsSync } from 'node:fs';
|
||||
import { join, dirname, resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
// Get context from command line argument or environment
|
||||
const context = process.argv[2] || process.env.GITHUB_WORKFLOW || 'manual';
|
||||
|
||||
function findRootDir(startDir) {
|
||||
let currentDir = resolve(startDir);
|
||||
while (currentDir !== '/') {
|
||||
if (existsSync(join(currentDir, 'package.json'))) {
|
||||
try {
|
||||
const pkg = JSON.parse(
|
||||
readFileSync(join(currentDir, 'package.json'), 'utf8')
|
||||
);
|
||||
if (pkg.name === 'task-master-ai' || pkg.repository) {
|
||||
return currentDir;
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
currentDir = dirname(currentDir);
|
||||
}
|
||||
throw new Error('Could not find root directory');
|
||||
}
|
||||
|
||||
function checkPreReleaseMode() {
|
||||
console.log('🔍 Checking if branch is in pre-release mode...');
|
||||
|
||||
const rootDir = findRootDir(__dirname);
|
||||
const preJsonPath = join(rootDir, '.changeset', 'pre.json');
|
||||
|
||||
// Check if pre.json exists
|
||||
if (!existsSync(preJsonPath)) {
|
||||
console.log('✅ Not in active pre-release mode - safe to proceed');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
try {
|
||||
// Read and parse pre.json
|
||||
const preJsonContent = readFileSync(preJsonPath, 'utf8');
|
||||
const preJson = JSON.parse(preJsonContent);
|
||||
|
||||
// Check if we're in active pre-release mode
|
||||
if (preJson.mode === 'pre') {
|
||||
console.error('❌ ERROR: This branch is in active pre-release mode!');
|
||||
console.error('');
|
||||
|
||||
// Provide context-specific error messages
|
||||
if (context === 'Release Check' || context === 'pull_request') {
|
||||
console.error(
|
||||
'Pre-release mode must be exited before merging to main.'
|
||||
);
|
||||
console.error('');
|
||||
console.error(
|
||||
'To fix this, run the following commands in your branch:'
|
||||
);
|
||||
console.error(' npx changeset pre exit');
|
||||
console.error(' git add -u');
|
||||
console.error(' git commit -m "chore: exit pre-release mode"');
|
||||
console.error(' git push');
|
||||
console.error('');
|
||||
console.error('Then update this pull request.');
|
||||
} else if (context === 'Release' || context === 'main') {
|
||||
console.error(
|
||||
'Pre-release mode should only be used on feature branches, not main.'
|
||||
);
|
||||
console.error('');
|
||||
console.error('To fix this, run the following commands locally:');
|
||||
console.error(' npx changeset pre exit');
|
||||
console.error(' git add -u');
|
||||
console.error(' git commit -m "chore: exit pre-release mode"');
|
||||
console.error(' git push origin main');
|
||||
console.error('');
|
||||
console.error('Then re-run this workflow.');
|
||||
} else {
|
||||
console.error('Pre-release mode must be exited before proceeding.');
|
||||
console.error('');
|
||||
console.error('To fix this, run the following commands:');
|
||||
console.error(' npx changeset pre exit');
|
||||
console.error(' git add -u');
|
||||
console.error(' git commit -m "chore: exit pre-release mode"');
|
||||
console.error(' git push');
|
||||
}
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('✅ Not in active pre-release mode - safe to proceed');
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error(`❌ ERROR: Unable to parse .changeset/pre.json – aborting.`);
|
||||
console.error(`Error details: ${error.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Run the check
|
||||
checkPreReleaseMode();
|
||||
54
.github/scripts/pre-release.mjs
vendored
Executable file
54
.github/scripts/pre-release.mjs
vendored
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env node
|
||||
import { readFileSync, existsSync } from 'node:fs';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import {
|
||||
findRootDir,
|
||||
runCommand,
|
||||
getPackageVersion,
|
||||
createAndPushTag
|
||||
} from './utils.mjs';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const rootDir = findRootDir(__dirname);
|
||||
const extensionPkgPath = join(rootDir, 'apps', 'extension', 'package.json');
|
||||
|
||||
console.log('🚀 Starting pre-release process...');
|
||||
|
||||
// Check if we're in RC mode
|
||||
const preJsonPath = join(rootDir, '.changeset', 'pre.json');
|
||||
if (!existsSync(preJsonPath)) {
|
||||
console.error('⚠️ Not in RC mode. Run "npx changeset pre enter rc" first.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
const preJson = JSON.parse(readFileSync(preJsonPath, 'utf8'));
|
||||
if (preJson.tag !== 'rc') {
|
||||
console.error(`⚠️ Not in RC mode. Current tag: ${preJson.tag}`);
|
||||
process.exit(1);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to read pre.json:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Get current extension version
|
||||
const extensionVersion = getPackageVersion(extensionPkgPath);
|
||||
console.log(`Extension version: ${extensionVersion}`);
|
||||
|
||||
// Run changeset publish for npm packages
|
||||
console.log('📦 Publishing npm packages...');
|
||||
runCommand('npx', ['changeset', 'publish']);
|
||||
|
||||
// Create tag for extension pre-release if it doesn't exist
|
||||
const extensionTag = `extension-rc@${extensionVersion}`;
|
||||
const tagCreated = createAndPushTag(extensionTag);
|
||||
|
||||
if (tagCreated) {
|
||||
console.log('This will trigger the extension-pre-release workflow...');
|
||||
}
|
||||
|
||||
console.log('✅ Pre-release process completed!');
|
||||
30
.github/scripts/release.mjs
vendored
Executable file
30
.github/scripts/release.mjs
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env node
|
||||
import { existsSync, unlinkSync } from 'node:fs';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { findRootDir, runCommand } from './utils.mjs';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const rootDir = findRootDir(__dirname);
|
||||
|
||||
console.log('🚀 Starting release process...');
|
||||
|
||||
// Double-check we're not in pre-release mode (safety net)
|
||||
const preJsonPath = join(rootDir, '.changeset', 'pre.json');
|
||||
if (existsSync(preJsonPath)) {
|
||||
console.log('⚠️ Warning: pre.json still exists. Removing it...');
|
||||
unlinkSync(preJsonPath);
|
||||
}
|
||||
|
||||
// Check if the extension version has changed and tag it
|
||||
// This prevents changeset from trying to publish the private package
|
||||
runCommand('node', [join(__dirname, 'tag-extension.mjs')]);
|
||||
|
||||
// Run changeset publish for npm packages
|
||||
runCommand('npx', ['changeset', 'publish']);
|
||||
|
||||
console.log('✅ Release process completed!');
|
||||
|
||||
// The extension tag (if created) will trigger the extension-release workflow
|
||||
21
.github/scripts/release.sh
vendored
21
.github/scripts/release.sh
vendored
@@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🚀 Starting release process..."
|
||||
|
||||
# Double-check we're not in pre-release mode (safety net)
|
||||
if [ -f .changeset/pre.json ]; then
|
||||
echo "⚠️ Warning: pre.json still exists. Removing it..."
|
||||
rm -f .changeset/pre.json
|
||||
fi
|
||||
|
||||
# Check if the extension version has changed and tag it
|
||||
# This prevents changeset from trying to publish the private package
|
||||
node .github/scripts/tag-extension.mjs
|
||||
|
||||
# Run changeset publish for npm packages
|
||||
npx changeset publish
|
||||
|
||||
echo "✅ Release process completed!"
|
||||
|
||||
# The extension tag (if created) will trigger the extension-release workflow
|
||||
56
.github/scripts/tag-extension.mjs
vendored
Normal file → Executable file
56
.github/scripts/tag-extension.mjs
vendored
Normal file → Executable file
@@ -1,15 +1,17 @@
|
||||
#!/usr/bin/env node
|
||||
import assert from 'node:assert/strict';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { findRootDir, createAndPushTag } from './utils.mjs';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
const rootDir = findRootDir(__dirname);
|
||||
|
||||
// Read the extension's package.json
|
||||
const extensionDir = join(__dirname, '..', 'apps', 'extension');
|
||||
const extensionDir = join(rootDir, 'apps', 'extension');
|
||||
const pkgPath = join(extensionDir, 'package.json');
|
||||
|
||||
let pkg;
|
||||
@@ -21,57 +23,11 @@ try {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Read root package.json for repository info
|
||||
const rootPkgPath = join(__dirname, '..', 'package.json');
|
||||
let rootPkg;
|
||||
try {
|
||||
const rootPkgContent = readFileSync(rootPkgPath, 'utf8');
|
||||
rootPkg = JSON.parse(rootPkgContent);
|
||||
} catch (error) {
|
||||
console.error('Failed to read root package.json:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Ensure we have required fields
|
||||
assert(pkg.name, 'package.json must have a name field');
|
||||
assert(pkg.version, 'package.json must have a version field');
|
||||
assert(rootPkg.repository, 'root package.json must have a repository field');
|
||||
|
||||
const tag = `${pkg.name}@${pkg.version}`;
|
||||
|
||||
// Get repository URL from root package.json
|
||||
const repoUrl = rootPkg.repository.url;
|
||||
|
||||
const { status, stdout, error } = spawnSync('git', ['ls-remote', repoUrl, tag]);
|
||||
|
||||
assert.equal(status, 0, error);
|
||||
|
||||
const exists = String(stdout).trim() !== '';
|
||||
|
||||
if (!exists) {
|
||||
console.log(`Creating new extension tag: ${tag}`);
|
||||
|
||||
// Create the tag
|
||||
const tagResult = spawnSync('git', ['tag', tag]);
|
||||
if (tagResult.status !== 0) {
|
||||
console.error(
|
||||
'Failed to create tag:',
|
||||
tagResult.error || tagResult.stderr.toString()
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Push the tag
|
||||
const pushResult = spawnSync('git', ['push', 'origin', tag]);
|
||||
if (pushResult.status !== 0) {
|
||||
console.error(
|
||||
'Failed to push tag:',
|
||||
pushResult.error || pushResult.stderr.toString()
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`✅ Successfully created and pushed tag: ${tag}`);
|
||||
} else {
|
||||
console.log(`Extension tag already exists: ${tag}`);
|
||||
}
|
||||
// Create and push the tag if it doesn't exist
|
||||
createAndPushTag(tag);
|
||||
|
||||
88
.github/scripts/utils.mjs
vendored
Executable file
88
.github/scripts/utils.mjs
vendored
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env node
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join, dirname, resolve } from 'node:path';
|
||||
|
||||
// Find the root directory by looking for package.json with task-master-ai
|
||||
export function findRootDir(startDir) {
|
||||
let currentDir = resolve(startDir);
|
||||
while (currentDir !== '/') {
|
||||
const pkgPath = join(currentDir, 'package.json');
|
||||
try {
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
||||
if (pkg.name === 'task-master-ai' || pkg.repository) {
|
||||
return currentDir;
|
||||
}
|
||||
} catch {}
|
||||
currentDir = dirname(currentDir);
|
||||
}
|
||||
throw new Error('Could not find root directory');
|
||||
}
|
||||
|
||||
// Run a command with proper error handling
|
||||
export function runCommand(command, args = [], options = {}) {
|
||||
console.log(`Running: ${command} ${args.join(' ')}`);
|
||||
const result = spawnSync(command, args, {
|
||||
encoding: 'utf8',
|
||||
stdio: 'inherit',
|
||||
...options
|
||||
});
|
||||
|
||||
if (result.status !== 0) {
|
||||
console.error(`Command failed with exit code ${result.status}`);
|
||||
process.exit(result.status);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get package version from a package.json file
|
||||
export function getPackageVersion(packagePath) {
|
||||
try {
|
||||
const pkg = JSON.parse(readFileSync(packagePath, 'utf8'));
|
||||
return pkg.version;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Failed to read package version from ${packagePath}:`,
|
||||
error.message
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if a git tag exists on remote
|
||||
export function tagExistsOnRemote(tag, remote = 'origin') {
|
||||
const result = spawnSync('git', ['ls-remote', remote, tag], {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
|
||||
return result.status === 0 && result.stdout.trim() !== '';
|
||||
}
|
||||
|
||||
// Create and push a git tag if it doesn't exist
|
||||
export function createAndPushTag(tag, remote = 'origin') {
|
||||
// Check if tag already exists
|
||||
if (tagExistsOnRemote(tag, remote)) {
|
||||
console.log(`Tag ${tag} already exists on remote, skipping`);
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(`Creating new tag: ${tag}`);
|
||||
|
||||
// Create the tag locally
|
||||
const tagResult = spawnSync('git', ['tag', tag]);
|
||||
if (tagResult.status !== 0) {
|
||||
console.error('Failed to create tag:', tagResult.error || tagResult.stderr);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Push the tag to remote
|
||||
const pushResult = spawnSync('git', ['push', remote, tag]);
|
||||
if (pushResult.status !== 0) {
|
||||
console.error('Failed to push tag:', pushResult.error || pushResult.stderr);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`✅ Successfully created and pushed tag: ${tag}`);
|
||||
return true;
|
||||
}
|
||||
110
.github/workflows/extension-pre-release.yml
vendored
Normal file
110
.github/workflows/extension-pre-release.yml
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
name: Extension Pre-Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "extension-rc@*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency: extension-pre-release-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
publish-extension-rc:
|
||||
runs-on: ubuntu-latest
|
||||
environment: extension-release
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Cache node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
*/*/node_modules
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- name: Install Extension Dependencies
|
||||
working-directory: apps/extension
|
||||
run: npm ci
|
||||
timeout-minutes: 5
|
||||
|
||||
- name: Type Check Extension
|
||||
working-directory: apps/extension
|
||||
run: npm run check-types
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
|
||||
- name: Build Extension
|
||||
working-directory: apps/extension
|
||||
run: npm run build
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
|
||||
- name: Package Extension
|
||||
working-directory: apps/extension
|
||||
run: npm run package
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
|
||||
- name: Create VSIX Package (Pre-Release)
|
||||
working-directory: apps/extension/vsix-build
|
||||
run: npx vsce package --no-dependencies --pre-release
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
|
||||
- name: Get VSIX filename
|
||||
id: vsix-info
|
||||
working-directory: apps/extension/vsix-build
|
||||
run: |
|
||||
VSIX_FILE=$(find . -maxdepth 1 -name "*.vsix" -type f | head -n1 | xargs basename)
|
||||
if [ -z "$VSIX_FILE" ]; then
|
||||
echo "Error: No VSIX file found"
|
||||
exit 1
|
||||
fi
|
||||
echo "vsix-filename=$VSIX_FILE" >> "$GITHUB_OUTPUT"
|
||||
echo "Found VSIX: $VSIX_FILE"
|
||||
|
||||
- name: Publish to VS Code Marketplace (Pre-Release)
|
||||
working-directory: apps/extension/vsix-build
|
||||
run: npx vsce publish --packagePath "${{ steps.vsix-info.outputs.vsix-filename }}" --pre-release
|
||||
env:
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
FORCE_COLOR: 1
|
||||
|
||||
- name: Install Open VSX CLI
|
||||
run: npm install -g ovsx
|
||||
|
||||
- name: Publish to Open VSX Registry (Pre-Release)
|
||||
working-directory: apps/extension/vsix-build
|
||||
run: ovsx publish "${{ steps.vsix-info.outputs.vsix-filename }}" --pre-release
|
||||
env:
|
||||
OVSX_PAT: ${{ secrets.OVSX_PAT }}
|
||||
FORCE_COLOR: 1
|
||||
|
||||
- name: Upload Build Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: extension-pre-release-${{ github.ref_name }}
|
||||
path: |
|
||||
apps/extension/vsix-build/*.vsix
|
||||
apps/extension/dist/
|
||||
retention-days: 30
|
||||
|
||||
notify-success:
|
||||
needs: publish-extension-rc
|
||||
if: success()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Success Notification
|
||||
run: |
|
||||
echo "🚀 Extension ${{ github.ref_name }} successfully published as pre-release!"
|
||||
echo "📦 Available on VS Code Marketplace (Pre-Release)"
|
||||
echo "🌍 Available on Open VSX Registry (Pre-Release)"
|
||||
26
.github/workflows/extension-release.yml
vendored
26
.github/workflows/extension-release.yml
vendored
@@ -89,32 +89,6 @@ jobs:
|
||||
OVSX_PAT: ${{ secrets.OVSX_PAT }}
|
||||
FORCE_COLOR: 1
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
release_name: Extension ${{ github.ref_name }}
|
||||
body: |
|
||||
VS Code Extension Release ${{ github.ref_name }}
|
||||
|
||||
**Marketplaces:**
|
||||
- [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=Hamster.task-master-hamster)
|
||||
- [Open VSX Registry](https://open-vsx.org/extension/Hamster/task-master-hamster)
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload VSIX to Release
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: apps/extension/vsix-build/${{ steps.vsix-info.outputs.vsix-filename }}
|
||||
asset_name: ${{ steps.vsix-info.outputs.vsix-filename }}
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload Build Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
||||
33
.github/workflows/pre-release.yml
vendored
33
.github/workflows/pre-release.yml
vendored
@@ -3,11 +3,13 @@ name: Pre-Release (RC)
|
||||
on:
|
||||
workflow_dispatch: # Allows manual triggering from GitHub UI/API
|
||||
|
||||
concurrency: pre-release-${{ github.ref }}
|
||||
|
||||
concurrency: pre-release-${{ github.ref_name }}
|
||||
jobs:
|
||||
rc:
|
||||
runs-on: ubuntu-latest
|
||||
# Only allow pre-releases on non-main branches
|
||||
if: github.ref != 'refs/heads/main'
|
||||
environment: extension-release
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -34,9 +36,26 @@ jobs:
|
||||
|
||||
- name: Enter RC mode (if not already in RC mode)
|
||||
run: |
|
||||
# ensure we’re in the right pre-mode (tag "rc")
|
||||
if [ ! -f .changeset/pre.json ] \
|
||||
|| [ "$(jq -r '.tag' .changeset/pre.json 2>/dev/null || echo '')" != "rc" ]; then
|
||||
# Check if we're in pre-release mode with the "rc" tag
|
||||
if [ -f .changeset/pre.json ]; then
|
||||
MODE=$(jq -r '.mode' .changeset/pre.json 2>/dev/null || echo '')
|
||||
TAG=$(jq -r '.tag' .changeset/pre.json 2>/dev/null || echo '')
|
||||
|
||||
if [ "$MODE" = "exit" ]; then
|
||||
echo "Pre-release mode is in 'exit' state, re-entering RC mode..."
|
||||
npx changeset pre enter rc
|
||||
elif [ "$MODE" = "pre" ] && [ "$TAG" != "rc" ]; then
|
||||
echo "In pre-release mode but with wrong tag ($TAG), switching to RC..."
|
||||
npx changeset pre exit
|
||||
npx changeset pre enter rc
|
||||
elif [ "$MODE" = "pre" ] && [ "$TAG" = "rc" ]; then
|
||||
echo "Already in RC pre-release mode"
|
||||
else
|
||||
echo "Unknown mode state: $MODE, entering RC mode..."
|
||||
npx changeset pre enter rc
|
||||
fi
|
||||
else
|
||||
echo "No pre.json found, entering RC mode..."
|
||||
npx changeset pre enter rc
|
||||
fi
|
||||
|
||||
@@ -49,10 +68,12 @@ jobs:
|
||||
- name: Create Release Candidate Pull Request or Publish Release Candidate to npm
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
publish: npm run release
|
||||
publish: node ./.github/scripts/pre-release.mjs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
OVSX_PAT: ${{ secrets.OVSX_PAT }}
|
||||
|
||||
- name: Commit & Push changes
|
||||
uses: actions-js/push@master
|
||||
|
||||
21
.github/workflows/release-check.yml
vendored
Normal file
21
.github/workflows/release-check.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Release Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: release-check-${{ github.head_ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check-release-mode:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check release mode
|
||||
run: node ./.github/scripts/check-pre-release-mode.mjs "pull_request"
|
||||
24
.github/workflows/release.yml
vendored
24
.github/workflows/release.yml
vendored
@@ -38,31 +38,13 @@ jobs:
|
||||
run: npm ci
|
||||
timeout-minutes: 2
|
||||
|
||||
- name: Exit pre-release mode and clean up
|
||||
run: |
|
||||
echo "🔄 Ensuring we're not in pre-release mode for main branch..."
|
||||
|
||||
# Exit pre-release mode if we're in it
|
||||
npx changeset pre exit || echo "Not in pre-release mode"
|
||||
|
||||
# Remove pre.json file if it exists (belt and suspenders approach)
|
||||
if [ -f .changeset/pre.json ]; then
|
||||
echo "🧹 Removing pre.json file..."
|
||||
rm -f .changeset/pre.json
|
||||
fi
|
||||
|
||||
# Verify the file is gone
|
||||
if [ ! -f .changeset/pre.json ]; then
|
||||
echo "✅ pre.json successfully removed"
|
||||
else
|
||||
echo "❌ Failed to remove pre.json"
|
||||
exit 1
|
||||
fi
|
||||
- name: Check pre-release mode
|
||||
run: node ./.github/scripts/check-pre-release-mode.mjs "main"
|
||||
|
||||
- name: Create Release Pull Request or Publish to npm
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
publish: ./.github/scripts/release.sh
|
||||
publish: node ./.github/scripts/release.mjs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
---
|
||||
title: Research Session
|
||||
query: "do we need to add new commands or can we just weaponize the gh cli tool"
|
||||
date: 2025-08-01
|
||||
time: 2:27:52 p.m.
|
||||
timestamp: 2025-08-01T11:27:52.249Z
|
||||
exchanges: 3
|
||||
---
|
||||
|
||||
# Research Session
|
||||
|
||||
## Initial Query
|
||||
|
||||
**Question:** do we need to add new commands or can we just weaponize the gh cli tool
|
||||
|
||||
**Response:**
|
||||
|
||||
For the implementation of the `task-master git` command suite to automate git workflows (Task 97), it is possible to leverage the existing **GitHub CLI (`gh`) tool** rather than creating entirely new git commands from scratch. The GitHub CLI provides a rich set of commands that cover many GitHub-related operations such as branch management, pull request handling, workflow triggering, and release management, which can be scripted and integrated into your CLI tool[1][2][3][4].
|
||||
|
||||
### Key Points Supporting Weaponizing GitHub CLI:
|
||||
|
||||
- **Comprehensive GitHub Operations**: The `gh` CLI supports creating branches, managing pull requests, releases, tags, and even triggering and monitoring GitHub Actions workflows. This aligns well with the requirements of automated branch management, commit generation, and PR description generation in Task 97[1][3].
|
||||
|
||||
- **Scripting and Automation Friendly**: GitHub CLI commands can be scripted and integrated into custom workflows or CLI tools. You can create aliases or wrap `gh` commands inside your own CLI commands to provide a seamless user experience while relying on the battle-tested GitHub CLI for underlying operations[1][3].
|
||||
|
||||
- **Authentication and Permissions**: `gh` uses environment variables like `GH_TOKEN` or `GITHUB_TOKEN` for authentication, which can be securely managed in CI/CD pipelines or local environments. This simplifies integration without needing to implement custom authentication logic[3][4].
|
||||
|
||||
- **Extensibility**: If some specific git workflow features are not directly supported by `gh`, you can extend it with custom scripts or combine it with native git commands. This hybrid approach reduces the need to reinvent core git operations while allowing customization[1].
|
||||
|
||||
### Considerations for Your Project:
|
||||
|
||||
- Since Task 97 requires **automated branch management** (branch creation, validation, switching, cleanup), **intelligent commit generation**, and **PR description generation**, you can implement these by invoking `gh` commands programmatically within your `task-master git` commands.
|
||||
|
||||
- For example, branch creation and switching can be done with native git commands wrapped in your CLI, while PR creation and management can be handled via `gh pr create`, `gh pr merge`, etc.
|
||||
|
||||
- You may still need to implement some **custom logic** for commit type detection, branch name validation, and PR description generation based on your task metadata, but the underlying git and GitHub operations can be delegated to `gh`.
|
||||
|
||||
- This approach aligns with your existing CLI foundation (Task 2) and leverages a well-supported tool, reducing development effort and increasing reliability.
|
||||
|
||||
### Summary
|
||||
|
||||
You **do not necessarily need to add entirely new git commands** for Task 97. Instead, you can **weaponize the GitHub CLI (`gh`) tool** by wrapping and scripting its commands within your `task-master git` command suite. This will allow you to automate git workflows efficiently, maintain consistency, and leverage GitHub’s API capabilities without reinventing the wheel[1][2][3][4].
|
||||
|
||||
If there are gaps in `gh` functionality for your specific workflow needs, you can supplement with native git commands or custom scripts, but the core git and GitHub operations should be handled by `gh` for best results.
|
||||
|
||||
---
|
||||
|
||||
## Follow-up 1
|
||||
|
||||
**Question:** how does this relate to git worktrees? i hear that they get super complicated when trying to implement them.
|
||||
|
||||
**Response:**
|
||||
|
||||
Git worktrees allow you to have multiple working directories attached to the same Git repository, each checked out to different branches simultaneously. This enables parallel development workflows without the overhead of cloning the repository multiple times or constantly switching branches in a single working directory[2][3].
|
||||
|
||||
However, **implementing or managing git worktrees can get complicated** for several reasons:
|
||||
|
||||
- **Complexity for users and tooling:** Managing multiple active worktrees requires careful tracking of which directory corresponds to which branch. This can be confusing and error-prone, especially for novices or when many worktrees are in use simultaneously. Mistakes like committing to the wrong branch or working in the wrong directory are common risks[1].
|
||||
|
||||
- **Maintenance overhead:** Worktrees accumulate over time and need to be pruned or cleaned up regularly (`git worktree prune`) to avoid clutter and potential confusion. This adds an extra maintenance step to the workflow[1].
|
||||
|
||||
- **Syncing and update challenges:** Each worktree is a separate checkout and can become outdated if not regularly updated from the main repository. This can lead to merge conflicts or redundant work if branches diverge significantly[1].
|
||||
|
||||
- **Tooling and integration limitations:** Not all Git tools, scripts, or GUIs fully support worktrees or are optimized for them. This can cause inconsistencies or require additional custom tooling to manage worktrees effectively[1].
|
||||
|
||||
- **Performance considerations:** Managing multiple worktrees simultaneously can have performance implications, especially in very large repositories, due to the overhead of maintaining multiple checkouts and metadata[1].
|
||||
|
||||
In the context of your project, which involves automating git workflows and possibly wrapping or extending git/GitHub CLI commands, these complexities imply:
|
||||
|
||||
- If you consider supporting git worktrees in your `task-master git` command suite, you will need to handle the complexity of managing multiple directories and branches carefully.
|
||||
|
||||
- You might need to implement additional logic or tooling to track and manage worktrees, avoid user confusion, and ensure synchronization between them.
|
||||
|
||||
- Since your project already plans to leverage the GitHub CLI (`gh`) and native git commands, you could integrate worktree commands (`git worktree add`, `git worktree remove`, `git worktree list`) but should be prepared for the added complexity in workflow management and user documentation.
|
||||
|
||||
- Custom wrappers or managers (like the one described in [3]) can help reduce friction by automating worktree creation, switching, and cleanup, which might be a useful approach to consider.
|
||||
|
||||
Overall, **git worktrees provide powerful parallel branch management but introduce complexity in implementation and user experience** that must be carefully managed through tooling, automation, and clear documentation[1][3][4].
|
||||
|
||||
---
|
||||
|
||||
**Summary Table of Git Worktree Challenges and Considerations**
|
||||
|
||||
| Aspect | Description | Implication for Project |
|
||||
|-------------------------|-----------------------------------------------------------------------------------------------|----------------------------------------------------------|
|
||||
| User Complexity | Confusing multiple directories and branches | Need clear UI/UX and safeguards |
|
||||
| Maintenance Overhead | Requires pruning and cleanup of stale worktrees | Automate cleanup or provide commands |
|
||||
| Syncing Issues | Worktrees can become outdated or diverge | Implement update checks and sync workflows |
|
||||
| Tooling Support | Limited support in some Git tools and GUIs | May require custom tooling or wrappers |
|
||||
| Performance | Overhead in large repos with many worktrees | Monitor and optimize performance |
|
||||
| Workflow Automation | Manual worktree management is tedious | Build custom managers or wrappers to simplify usage |
|
||||
|
||||
---
|
||||
|
||||
Given your project’s focus on automating git workflows and leveraging existing CLI tools, **implementing git worktree support is feasible but will require careful design to handle these complexities effectively**. You may want to start with basic worktree commands and incrementally add automation and safeguards as needed.
|
||||
|
||||
---
|
||||
|
||||
## Follow-up 2
|
||||
|
||||
**Question:** since we already have a way to have separated task lists per branch, couldn't we do the same thing for worktrees? each taskmaster list (tag) would have its own worktree based on the name of the tag?
|
||||
|
||||
**Response:**
|
||||
|
||||
Yes, you can apply a similar approach used for separated task lists per branch to git worktrees by associating each taskmaster list (tag) with its own git worktree named after the tag. This means each tag would correspond to a dedicated worktree directory checked out to a branch or commit related to that tag, enabling isolated parallel work environments for each task list.
|
||||
|
||||
### How This Maps to Git Worktrees
|
||||
|
||||
- **Git worktrees** allow multiple working directories linked to the same repository, each checked out to a different branch or commit[1][2]. This lets you work on multiple branches simultaneously without switching contexts in a single directory.
|
||||
|
||||
- When you create a worktree with `git worktree add <path> [<branch>]`, Git creates a new linked working tree at `<path>`, optionally checking out a specified branch or creating a new one[1][2]. Naming the worktree directory after the tag (taskmaster list) is straightforward and semantically clear.
|
||||
|
||||
- This setup mirrors your existing branch-based task list separation but extends it to physical directories, which can improve workflow isolation and reduce context switching.
|
||||
|
||||
### Benefits for Your Project
|
||||
|
||||
- **Isolated environments per task list/tag:** Each tag’s worktree can have its own checked-out branch, allowing independent development, testing, or review without interference.
|
||||
|
||||
- **Parallel workflows:** Developers can switch between worktrees (directories) instead of switching branches in one directory, reducing errors and improving productivity.
|
||||
|
||||
- **Automation potential:** Your `task-master git` commands can automate creating, switching, and cleaning up these worktrees based on tags, similar to how you manage branches and task lists.
|
||||
|
||||
### Challenges and Considerations
|
||||
|
||||
- **Complexity in management:** Git worktrees add complexity in tracking multiple directories and ensuring users operate in the correct one[1]. Your CLI should provide clear commands and feedback to avoid confusion.
|
||||
|
||||
- **Maintenance overhead:** Worktrees need pruning and cleanup (`git worktree prune` or `git worktree remove`) to avoid clutter[1]. Automating cleanup in your tool would be beneficial.
|
||||
|
||||
- **Syncing and updates:** Each worktree is a separate checkout and can become outdated. Your automation should include commands to update or rebase worktrees as needed.
|
||||
|
||||
- **Tooling support:** Not all Git tools or scripts fully support worktrees, so your CLI wrappers should handle edge cases and provide a consistent experience[1][3].
|
||||
|
||||
### Practical Implementation Ideas
|
||||
|
||||
- When a new tag (taskmaster list) is created, run `git worktree add` to create a new worktree directory named after the tag.
|
||||
|
||||
- Store metadata linking tags to worktree paths in your taskmaster configuration to track and manage them.
|
||||
|
||||
- Provide commands like `task-master worktree list`, `task-master worktree add <tag>`, and `task-master worktree remove <tag>` to manage these worktrees.
|
||||
|
||||
- Integrate with GitHub CLI (`gh`) and native git commands to automate branch creation, PR handling, and syncing within each worktree.
|
||||
|
||||
- Consider inspiration from existing tools like [wt](https://github.com/taecontrol/wt) that automate worktree environment setup and teardown[3].
|
||||
|
||||
### Summary
|
||||
|
||||
Using git worktrees per taskmaster tag is a feasible and potentially powerful extension of your current branch-based task list separation. It offers isolated, parallel working directories aligned with your tags, improving workflow clarity and reducing branch-switching overhead. However, it requires careful tooling and automation to manage complexity, maintenance, and synchronization effectively. Given your project’s focus on automating git workflows and leveraging CLI tools, implementing this feature incrementally with robust user feedback and cleanup commands would be a practical approach.
|
||||
|
||||
|
||||
---
|
||||
|
||||
*Generated by Task Master Research Command*
|
||||
*Timestamp: 2025-08-01T11:27:52.249Z*
|
||||
343
.taskmaster/docs/tm-core-phase-1.txt
Normal file
343
.taskmaster/docs/tm-core-phase-1.txt
Normal file
@@ -0,0 +1,343 @@
|
||||
# Product Requirements Document: tm-core Package - Parse PRD Feature
|
||||
|
||||
## Project Overview
|
||||
Create a TypeScript package named `tm-core` at `packages/tm-core` that implements parse-prd functionality using class-based architecture similar to the existing AI providers pattern.
|
||||
|
||||
## Design Patterns & Architecture
|
||||
|
||||
### Patterns to Apply
|
||||
1. **Factory Pattern**: Use for `ProviderFactory` to create AI provider instances
|
||||
2. **Strategy Pattern**: Use for `IAIProvider` implementations and `IStorage` implementations
|
||||
3. **Facade Pattern**: Use for `TaskMasterCore` as the main API entry point
|
||||
4. **Template Method Pattern**: Use for `BaseProvider` abstract class
|
||||
5. **Dependency Injection**: Use throughout for testability (pass dependencies via constructor)
|
||||
6. **Repository Pattern**: Use for `FileStorage` to abstract data persistence
|
||||
|
||||
### Naming Conventions
|
||||
- **Files**: kebab-case (e.g., `task-parser.ts`, `file-storage.ts`)
|
||||
- **Classes**: PascalCase (e.g., `TaskParser`, `FileStorage`)
|
||||
- **Interfaces**: PascalCase with 'I' prefix (e.g., `IStorage`, `IAIProvider`)
|
||||
- **Methods**: camelCase (e.g., `parsePRD`, `loadTasks`)
|
||||
- **Constants**: UPPER_SNAKE_CASE (e.g., `DEFAULT_MODEL`)
|
||||
- **Type aliases**: PascalCase (e.g., `TaskStatus`, `ParseOptions`)
|
||||
|
||||
## Exact Folder Structure Required
|
||||
```
|
||||
packages/tm-core/
|
||||
├── src/
|
||||
│ ├── index.ts
|
||||
│ ├── types/
|
||||
│ │ └── index.ts
|
||||
│ ├── interfaces/
|
||||
│ │ ├── index.ts # Barrel export
|
||||
│ │ ├── storage.interface.ts
|
||||
│ │ ├── ai-provider.interface.ts
|
||||
│ │ └── configuration.interface.ts
|
||||
│ ├── tasks/
|
||||
│ │ ├── index.ts # Barrel export
|
||||
│ │ └── task-parser.ts
|
||||
│ ├── ai/
|
||||
│ │ ├── index.ts # Barrel export
|
||||
│ │ ├── base-provider.ts
|
||||
│ │ ├── provider-factory.ts
|
||||
│ │ ├── prompt-builder.ts
|
||||
│ │ └── providers/
|
||||
│ │ ├── index.ts # Barrel export
|
||||
│ │ ├── anthropic-provider.ts
|
||||
│ │ ├── openai-provider.ts
|
||||
│ │ └── google-provider.ts
|
||||
│ ├── storage/
|
||||
│ │ ├── index.ts # Barrel export
|
||||
│ │ └── file-storage.ts
|
||||
│ ├── config/
|
||||
│ │ ├── index.ts # Barrel export
|
||||
│ │ └── config-manager.ts
|
||||
│ ├── utils/
|
||||
│ │ ├── index.ts # Barrel export
|
||||
│ │ └── id-generator.ts
|
||||
│ └── errors/
|
||||
│ ├── index.ts # Barrel export
|
||||
│ └── task-master-error.ts
|
||||
├── tests/
|
||||
│ ├── task-parser.test.ts
|
||||
│ ├── integration/
|
||||
│ │ └── parse-prd.test.ts
|
||||
│ └── mocks/
|
||||
│ └── mock-provider.ts
|
||||
├── package.json
|
||||
├── tsconfig.json
|
||||
├── tsup.config.js
|
||||
└── jest.config.js
|
||||
```
|
||||
|
||||
## Specific Implementation Requirements
|
||||
|
||||
### 1. Create types/index.ts
|
||||
Define these exact TypeScript interfaces:
|
||||
- `Task` interface with fields: id, title, description, status, priority, complexity, dependencies, subtasks, metadata, createdAt, updatedAt, source
|
||||
- `Subtask` interface with fields: id, title, description, completed
|
||||
- `TaskMetadata` interface with fields: parsedFrom, aiProvider, version, tags (optional)
|
||||
- Type literals: `TaskStatus` = 'pending' | 'in-progress' | 'completed' | 'blocked'
|
||||
- Type literals: `TaskPriority` = 'low' | 'medium' | 'high' | 'critical'
|
||||
- Type literals: `TaskComplexity` = 'simple' | 'moderate' | 'complex'
|
||||
- `ParseOptions` interface with fields: dryRun (optional), additionalContext (optional), tag (optional), maxTasks (optional)
|
||||
|
||||
### 2. Create interfaces/storage.interface.ts
|
||||
Define `IStorage` interface with these exact methods:
|
||||
- `loadTasks(tag?: string): Promise<Task[]>`
|
||||
- `saveTasks(tasks: Task[], tag?: string): Promise<void>`
|
||||
- `appendTasks(tasks: Task[], tag?: string): Promise<void>`
|
||||
- `updateTask(id: string, task: Partial<Task>, tag?: string): Promise<void>`
|
||||
- `deleteTask(id: string, tag?: string): Promise<void>`
|
||||
- `exists(tag?: string): Promise<boolean>`
|
||||
|
||||
### 3. Create interfaces/ai-provider.interface.ts
|
||||
Define `IAIProvider` interface with these exact methods:
|
||||
- `generateCompletion(prompt: string, options?: AIOptions): Promise<string>`
|
||||
- `calculateTokens(text: string): number`
|
||||
- `getName(): string`
|
||||
- `getModel(): string`
|
||||
|
||||
Define `AIOptions` interface with fields: temperature (optional), maxTokens (optional), systemPrompt (optional)
|
||||
|
||||
### 4. Create interfaces/configuration.interface.ts
|
||||
Define `IConfiguration` interface with fields:
|
||||
- `projectPath: string`
|
||||
- `aiProvider: string`
|
||||
- `apiKey?: string`
|
||||
- `aiOptions?: AIOptions`
|
||||
- `mainModel?: string`
|
||||
- `researchModel?: string`
|
||||
- `fallbackModel?: string`
|
||||
- `tasksPath?: string`
|
||||
- `enableTags?: boolean`
|
||||
|
||||
### 5. Create tasks/task-parser.ts
|
||||
Create class `TaskParser` with:
|
||||
- Constructor accepting `aiProvider: IAIProvider` and `config: IConfiguration`
|
||||
- Private property `promptBuilder: PromptBuilder`
|
||||
- Public method `parsePRD(prdPath: string, options: ParseOptions = {}): Promise<Task[]>`
|
||||
- Private method `readPRD(prdPath: string): Promise<string>`
|
||||
- Private method `extractTasks(aiResponse: string): Partial<Task>[]`
|
||||
- Private method `enrichTasks(rawTasks: Partial<Task>[], prdPath: string): Task[]`
|
||||
- Apply **Dependency Injection** pattern via constructor
|
||||
|
||||
### 6. Create ai/base-provider.ts
|
||||
Copy existing base-provider.js and convert to TypeScript abstract class:
|
||||
- Abstract class `BaseProvider` implementing `IAIProvider`
|
||||
- Protected properties: `apiKey: string`, `model: string`
|
||||
- Constructor accepting `apiKey: string` and `options: { model?: string }`
|
||||
- Abstract methods matching IAIProvider interface
|
||||
- Abstract method `getDefaultModel(): string`
|
||||
- Apply **Template Method** pattern for common provider logic
|
||||
|
||||
### 7. Create ai/provider-factory.ts
|
||||
Create class `ProviderFactory` with:
|
||||
- Static method `create(config: { provider: string; apiKey?: string; model?: string }): Promise<IAIProvider>`
|
||||
- Switch statement for providers: 'anthropic', 'openai', 'google'
|
||||
- Dynamic imports for each provider
|
||||
- Throw error for unknown providers
|
||||
- Apply **Factory** pattern for creating provider instances
|
||||
|
||||
Example implementation structure:
|
||||
```typescript
|
||||
switch (provider.toLowerCase()) {
|
||||
case 'anthropic':
|
||||
const { AnthropicProvider } = await import('./providers/anthropic-provider.js');
|
||||
return new AnthropicProvider(apiKey, { model });
|
||||
}
|
||||
```
|
||||
|
||||
### 8. Create ai/providers/anthropic-provider.ts
|
||||
Create class `AnthropicProvider` extending `BaseProvider`:
|
||||
- Import Anthropic SDK: `import { Anthropic } from '@anthropic-ai/sdk'`
|
||||
- Private property `client: Anthropic`
|
||||
- Implement all abstract methods from BaseProvider
|
||||
- Default model: 'claude-3-sonnet-20240229'
|
||||
- Handle API errors and wrap with meaningful messages
|
||||
|
||||
### 9. Create ai/providers/openai-provider.ts (placeholder)
|
||||
Create class `OpenAIProvider` extending `BaseProvider`:
|
||||
- Import OpenAI SDK when implemented
|
||||
- For now, throw error: "OpenAI provider not yet implemented"
|
||||
|
||||
### 10. Create ai/providers/google-provider.ts (placeholder)
|
||||
Create class `GoogleProvider` extending `BaseProvider`:
|
||||
- Import Google Generative AI SDK when implemented
|
||||
- For now, throw error: "Google provider not yet implemented"
|
||||
|
||||
### 11. Create ai/prompt-builder.ts
|
||||
Create class `PromptBuilder` with:
|
||||
- Method `buildParsePrompt(prdContent: string, options: ParseOptions = {}): string`
|
||||
- Method `buildExpandPrompt(task: string, context?: string): string`
|
||||
- Use template literals for prompt construction
|
||||
- Include specific JSON format instructions in prompts
|
||||
|
||||
### 9. Create storage/file-storage.ts
|
||||
Create class `FileStorage` implementing `IStorage`:
|
||||
- Private property `basePath: string` set to `{projectPath}/.taskmaster`
|
||||
- Constructor accepting `projectPath: string`
|
||||
- Private method `getTasksPath(tag?: string): string` returning correct path based on tag
|
||||
- Private method `ensureDirectory(dir: string): Promise<void>`
|
||||
- Implement all IStorage methods
|
||||
- Handle ENOENT errors by returning empty arrays
|
||||
- Use JSON format with structure: `{ tasks: Task[], metadata: { version: string, lastModified: string } }`
|
||||
- Apply **Repository** pattern for data access abstraction
|
||||
|
||||
### 10. Create config/config-manager.ts
|
||||
Create class `ConfigManager`:
|
||||
- Private property `config: IConfiguration`
|
||||
- Constructor accepting `options: Partial<IConfiguration>`
|
||||
- Use Zod for validation with schema matching IConfiguration
|
||||
- Method `get<K extends keyof IConfiguration>(key: K): IConfiguration[K]`
|
||||
- Method `getAll(): IConfiguration`
|
||||
- Method `validate(): boolean`
|
||||
- Default values: projectPath = process.cwd(), aiProvider = 'anthropic', enableTags = true
|
||||
|
||||
### 11. Create utils/id-generator.ts
|
||||
Export functions:
|
||||
- `generateTaskId(index: number = 0): string` returning format `task_{timestamp}_{index}_{random}`
|
||||
- `generateSubtaskId(parentId: string, index: number = 0): string` returning format `{parentId}_sub_{index}_{random}`
|
||||
|
||||
### 16. Create src/index.ts
|
||||
Create main class `TaskMasterCore`:
|
||||
- Private properties: `config: ConfigManager`, `storage: IStorage`, `aiProvider?: IAIProvider`, `parser?: TaskParser`
|
||||
- Constructor accepting `options: Partial<IConfiguration>`
|
||||
- Method `initialize(): Promise<void>` for lazy loading
|
||||
- Method `parsePRD(prdPath: string, options: ParseOptions = {}): Promise<Task[]>`
|
||||
- Method `getTasks(tag?: string): Promise<Task[]>`
|
||||
- Apply **Facade** pattern to provide simple API over complex subsystems
|
||||
|
||||
Export:
|
||||
- Class `TaskMasterCore`
|
||||
- Function `createTaskMaster(options: Partial<IConfiguration>): TaskMasterCore`
|
||||
- All types from './types'
|
||||
- All interfaces from './interfaces/*'
|
||||
|
||||
Import statements should use kebab-case:
|
||||
```typescript
|
||||
import { TaskParser } from './tasks/task-parser';
|
||||
import { FileStorage } from './storage/file-storage';
|
||||
import { ConfigManager } from './config/config-manager';
|
||||
import { ProviderFactory } from './ai/provider-factory';
|
||||
```
|
||||
|
||||
### 17. Configure package.json
|
||||
Create package.json with:
|
||||
- name: "@task-master/core"
|
||||
- version: "0.1.0"
|
||||
- type: "module"
|
||||
- main: "./dist/index.js"
|
||||
- module: "./dist/index.mjs"
|
||||
- types: "./dist/index.d.ts"
|
||||
- exports map for proper ESM/CJS support
|
||||
- scripts: build (tsup), dev (tsup --watch), test (jest), typecheck (tsc --noEmit)
|
||||
- dependencies: zod@^3.23.8
|
||||
- peerDependencies: @anthropic-ai/sdk, openai, @google/generative-ai
|
||||
- devDependencies: typescript, tsup, jest, ts-jest, @types/node, @types/jest
|
||||
|
||||
### 18. Configure TypeScript
|
||||
Create tsconfig.json with:
|
||||
- target: "ES2022"
|
||||
- module: "ESNext"
|
||||
- strict: true (with all strict flags enabled)
|
||||
- declaration: true
|
||||
- outDir: "./dist"
|
||||
- rootDir: "./src"
|
||||
|
||||
### 19. Configure tsup
|
||||
Create tsup.config.js with:
|
||||
- entry: ['src/index.ts']
|
||||
- format: ['cjs', 'esm']
|
||||
- dts: true
|
||||
- sourcemap: true
|
||||
- clean: true
|
||||
- external: AI provider SDKs
|
||||
|
||||
### 20. Configure Jest
|
||||
Create jest.config.js with:
|
||||
- preset: 'ts-jest'
|
||||
- testEnvironment: 'node'
|
||||
- Coverage threshold: 80% for all metrics
|
||||
|
||||
## Build Process
|
||||
1. Use tsup to compile TypeScript to both CommonJS and ESM
|
||||
2. Generate .d.ts files for TypeScript consumers
|
||||
3. Output to dist/ directory
|
||||
4. Ensure tree-shaking works properly
|
||||
|
||||
## Testing Requirements
|
||||
- Create unit tests for TaskParser in tests/task-parser.test.ts
|
||||
- Create MockProvider class in tests/mocks/mock-provider.ts for testing without API calls
|
||||
- Test error scenarios (file not found, invalid JSON, etc.)
|
||||
- Create integration test in tests/integration/parse-prd.test.ts
|
||||
- Follow kebab-case naming for all test files
|
||||
|
||||
## Success Criteria
|
||||
- TypeScript compilation with zero errors
|
||||
- No use of 'any' type
|
||||
- All interfaces properly exported
|
||||
- Compatible with existing tasks.json format
|
||||
- Feature flag support via USE_TM_CORE environment variable
|
||||
|
||||
## Import/Export Conventions
|
||||
- Use named exports for all classes and interfaces
|
||||
- Use barrel exports (index.ts) in each directory
|
||||
- Import types/interfaces with type-only imports: `import type { Task } from '../types'`
|
||||
- Group imports in order: Node built-ins, external packages, internal packages, relative imports
|
||||
- Use .js extension in import paths for ESM compatibility
|
||||
|
||||
## Error Handling Patterns
|
||||
- Create custom error classes in `src/errors/` directory
|
||||
- All public methods should catch and wrap errors with context
|
||||
- Use error codes for different error types (e.g., 'FILE_NOT_FOUND', 'PARSE_ERROR')
|
||||
- Never expose internal implementation details in error messages
|
||||
- Log errors to console.error only in development mode
|
||||
|
||||
## Barrel Exports Content
|
||||
|
||||
### interfaces/index.ts
|
||||
```typescript
|
||||
export type { IStorage } from './storage.interface';
|
||||
export type { IAIProvider, AIOptions } from './ai-provider.interface';
|
||||
export type { IConfiguration } from './configuration.interface';
|
||||
```
|
||||
|
||||
### tasks/index.ts
|
||||
```typescript
|
||||
export { TaskParser } from './task-parser';
|
||||
```
|
||||
|
||||
### ai/index.ts
|
||||
```typescript
|
||||
export { BaseProvider } from './base-provider';
|
||||
export { ProviderFactory } from './provider-factory';
|
||||
export { PromptBuilder } from './prompt-builder';
|
||||
```
|
||||
|
||||
### ai/providers/index.ts
|
||||
```typescript
|
||||
export { AnthropicProvider } from './anthropic-provider';
|
||||
export { OpenAIProvider } from './openai-provider';
|
||||
export { GoogleProvider } from './google-provider';
|
||||
```
|
||||
|
||||
### storage/index.ts
|
||||
```typescript
|
||||
export { FileStorage } from './file-storage';
|
||||
```
|
||||
|
||||
### config/index.ts
|
||||
```typescript
|
||||
export { ConfigManager } from './config-manager';
|
||||
```
|
||||
|
||||
### utils/index.ts
|
||||
```typescript
|
||||
export { generateTaskId, generateSubtaskId } from './id-generator';
|
||||
```
|
||||
|
||||
### errors/index.ts
|
||||
```typescript
|
||||
export { TaskMasterError } from './task-master-error';
|
||||
```
|
||||
@@ -1,373 +1,21 @@
|
||||
{
|
||||
"meta": {
|
||||
"generatedAt": "2025-05-27T16:34:53.088Z",
|
||||
"generatedAt": "2025-08-02T14:28:59.851Z",
|
||||
"tasksAnalyzed": 1,
|
||||
"totalTasks": 84,
|
||||
"analysisCount": 45,
|
||||
"totalTasks": 93,
|
||||
"analysisCount": 1,
|
||||
"thresholdScore": 5,
|
||||
"projectName": "Taskmaster",
|
||||
"usedResearch": true
|
||||
"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 covering: command structure setup, AI prompt engineering, test file generation logic, integration with Claude API, and comprehensive error handling.",
|
||||
"reasoning": "This task involves complex integration with an AI service (Claude), requires sophisticated prompt engineering, and needs to generate structured code files. The existing 3 subtasks are a good start but could be expanded to include more detailed steps for AI integration, error handling, and test file formatting."
|
||||
},
|
||||
{
|
||||
"taskId": 26,
|
||||
"taskTitle": "Implement Context Foundation for AI Operations",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "The current 4 subtasks for implementing the context foundation appear comprehensive. Consider if any additional subtasks are needed for testing, documentation, or integration with existing systems.",
|
||||
"reasoning": "This task involves creating a foundation for context integration with several well-defined components. The existing 4 subtasks cover the main implementation areas (context-file flag, cursor rules integration, context extraction utility, and command handler updates). The complexity is moderate as it requires careful integration with existing systems but has clear requirements."
|
||||
},
|
||||
{
|
||||
"taskId": 27,
|
||||
"taskTitle": "Implement Context Enhancements for AI Operations",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "The current 4 subtasks for implementing context enhancements appear well-structured. Consider if any additional subtasks are needed for testing, documentation, or performance optimization.",
|
||||
"reasoning": "This task builds upon the foundation from Task #26 and adds more sophisticated context handling features. The 4 existing subtasks cover the main implementation areas (code context extraction, task history context, PRD context integration, and context formatting). The complexity is higher than the foundation task due to the need for intelligent context selection and optimization."
|
||||
},
|
||||
{
|
||||
"taskId": 28,
|
||||
"taskTitle": "Implement Advanced ContextManager System",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the advanced ContextManager system appear comprehensive. Consider if any additional subtasks are needed for testing, documentation, or backward compatibility with previous context implementations.",
|
||||
"reasoning": "This task represents the most complex phase of the context implementation, requiring a sophisticated class design, optimization algorithms, and integration with multiple systems. The 5 existing subtasks cover the core implementation areas, but the complexity is high due to the need for intelligent context prioritization, token management, and performance monitoring."
|
||||
},
|
||||
{
|
||||
"taskId": 40,
|
||||
"taskTitle": "Implement 'plan' Command for Task Implementation Planning",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "The current 4 subtasks for implementing the 'plan' command appear well-structured. Consider if any additional subtasks are needed for testing, documentation, or integration with existing task management workflows.",
|
||||
"reasoning": "This task involves creating a new command that leverages AI to generate implementation plans. The existing 4 subtasks cover the main implementation areas (retrieving task content, generating plans with AI, formatting in XML, and error handling). The complexity is moderate as it builds on existing patterns for task updates but requires careful AI integration."
|
||||
},
|
||||
{
|
||||
"taskId": 41,
|
||||
"taskTitle": "Implement Visual Task Dependency Graph in Terminal",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 10,
|
||||
"expansionPrompt": "The current 10 subtasks for implementing the visual task dependency graph appear comprehensive. Consider if any additional subtasks are needed for performance optimization with large graphs or additional visualization options.",
|
||||
"reasoning": "This task involves creating a sophisticated visualization system for terminal display, which is inherently complex due to layout algorithms, ASCII/Unicode rendering, and handling complex dependency relationships. The 10 existing subtasks cover all major aspects of implementation, from CLI interface to accessibility features."
|
||||
},
|
||||
{
|
||||
"taskId": 42,
|
||||
"taskTitle": "Implement MCP-to-MCP Communication Protocol",
|
||||
"complexityScore": 9,
|
||||
"recommendedSubtasks": 8,
|
||||
"expansionPrompt": "The current 8 subtasks for implementing the MCP-to-MCP communication protocol appear well-structured. Consider if any additional subtasks are needed for security hardening, performance optimization, or comprehensive documentation.",
|
||||
"reasoning": "This task involves designing and implementing a complex communication protocol between different MCP tools and servers. It requires sophisticated adapter patterns, client-server architecture, and handling of multiple operational modes. The complexity is very high due to the need for standardization, security, and backward compatibility."
|
||||
},
|
||||
{
|
||||
"taskId": 44,
|
||||
"taskTitle": "Implement Task Automation with Webhooks and Event Triggers",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 7,
|
||||
"expansionPrompt": "The current 7 subtasks for implementing task automation with webhooks appear comprehensive. Consider if any additional subtasks are needed for security testing, rate limiting implementation, or webhook monitoring tools.",
|
||||
"reasoning": "This task involves creating a sophisticated event system with webhooks for integration with external services. The complexity is high due to the need for secure authentication, reliable delivery mechanisms, and handling of various webhook formats and protocols. The existing subtasks cover the main implementation areas but security and monitoring could be emphasized more."
|
||||
},
|
||||
{
|
||||
"taskId": 45,
|
||||
"taskTitle": "Implement GitHub Issue Import Feature",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the GitHub issue import feature appear well-structured. Consider if any additional subtasks are needed for handling GitHub API rate limiting, caching, or supporting additional issue metadata.",
|
||||
"reasoning": "This task involves integrating with the GitHub API to import issues as tasks. The complexity is moderate as it requires API authentication, data mapping, and error handling. The existing 5 subtasks cover the main implementation areas from design to end-to-end implementation."
|
||||
},
|
||||
{
|
||||
"taskId": 46,
|
||||
"taskTitle": "Implement ICE Analysis Command for Task Prioritization",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the ICE analysis command appear comprehensive. Consider if any additional subtasks are needed for visualization of ICE scores or integration with other prioritization methods.",
|
||||
"reasoning": "This task involves creating an AI-powered analysis system for task prioritization using the ICE methodology. The complexity is high due to the need for sophisticated scoring algorithms, AI integration, and report generation. The existing subtasks cover the main implementation areas from algorithm design to integration with existing systems."
|
||||
},
|
||||
{
|
||||
"taskId": 47,
|
||||
"taskTitle": "Enhance Task Suggestion Actions Card Workflow",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for enhancing the task suggestion actions card workflow appear well-structured. Consider if any additional subtasks are needed for user testing, accessibility improvements, or performance optimization.",
|
||||
"reasoning": "This task involves redesigning the UI workflow for task expansion and management. The complexity is moderate as it requires careful UX design and state management but builds on existing components. The 6 existing subtasks cover the main implementation areas from design to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 48,
|
||||
"taskTitle": "Refactor Prompts into Centralized Structure",
|
||||
"complexityScore": 4,
|
||||
"recommendedSubtasks": 3,
|
||||
"expansionPrompt": "The current 3 subtasks for refactoring prompts into a centralized structure appear appropriate. Consider if any additional subtasks are needed for prompt versioning, documentation, or testing.",
|
||||
"reasoning": "This task involves a straightforward refactoring to improve code organization. The complexity is relatively low as it primarily involves moving code rather than creating new functionality. The 3 existing subtasks cover the main implementation areas from directory structure to integration."
|
||||
},
|
||||
{
|
||||
"taskId": 49,
|
||||
"taskTitle": "Implement Code Quality Analysis Command",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for implementing the code quality analysis command appear comprehensive. Consider if any additional subtasks are needed for performance optimization with large codebases or integration with existing code quality tools.",
|
||||
"reasoning": "This task involves creating a sophisticated code analysis system with pattern recognition, best practice verification, and AI-powered recommendations. The complexity is high due to the need for code parsing, complex analysis algorithms, and integration with AI services. The existing subtasks cover the main implementation areas from algorithm design to user interface."
|
||||
},
|
||||
{
|
||||
"taskId": 50,
|
||||
"taskTitle": "Implement Test Coverage Tracking System by Task",
|
||||
"complexityScore": 9,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the test coverage tracking system appear well-structured. Consider if any additional subtasks are needed for integration with CI/CD systems, performance optimization, or visualization tools.",
|
||||
"reasoning": "This task involves creating a complex system that maps test coverage to specific tasks and subtasks. The complexity is very high due to the need for sophisticated data structures, integration with coverage tools, and AI-powered test generation. The existing subtasks are comprehensive and cover the main implementation areas from data structure design to AI integration."
|
||||
},
|
||||
{
|
||||
"taskId": 51,
|
||||
"taskTitle": "Implement Perplexity Research Command",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the Perplexity research command appear comprehensive. Consider if any additional subtasks are needed for caching optimization, result formatting, or integration with other research tools.",
|
||||
"reasoning": "This task involves creating a new command that integrates with the Perplexity AI API for research. The complexity is moderate as it requires API integration, context extraction, and result formatting. The 5 existing subtasks cover the main implementation areas from API client to caching system."
|
||||
},
|
||||
{
|
||||
"taskId": 52,
|
||||
"taskTitle": "Implement Task Suggestion Command for CLI",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing the task suggestion command appear well-structured. Consider if any additional subtasks are needed for suggestion quality evaluation, user feedback collection, or integration with existing task workflows.",
|
||||
"reasoning": "This task involves creating a new CLI command that generates contextually relevant task suggestions using AI. The complexity is moderate as it requires AI integration, context collection, and interactive CLI interfaces. The existing subtasks cover the main implementation areas from data collection to user interface."
|
||||
},
|
||||
{
|
||||
"taskId": 53,
|
||||
"taskTitle": "Implement Subtask Suggestion Feature for Parent Tasks",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for implementing the subtask suggestion feature appear comprehensive. Consider if any additional subtasks are needed for suggestion quality metrics, user feedback collection, or performance optimization.",
|
||||
"reasoning": "This task involves creating a feature that suggests contextually relevant subtasks for parent tasks. The complexity is moderate as it builds on existing task management systems but requires sophisticated AI integration and context analysis. The 6 existing subtasks cover the main implementation areas from validation to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 55,
|
||||
"taskTitle": "Implement Positional Arguments Support for CLI Commands",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing positional arguments support appear well-structured. Consider if any additional subtasks are needed for backward compatibility testing, documentation updates, or user experience improvements.",
|
||||
"reasoning": "This task involves modifying the command parsing logic to support positional arguments alongside the existing flag-based syntax. The complexity is moderate as it requires careful handling of different argument styles and edge cases. The 5 existing subtasks cover the main implementation areas from analysis to documentation."
|
||||
},
|
||||
{
|
||||
"taskId": 57,
|
||||
"taskTitle": "Enhance Task-Master CLI User Experience and Interface",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for enhancing the CLI user experience appear comprehensive. Consider if any additional subtasks are needed for accessibility testing, internationalization, or performance optimization.",
|
||||
"reasoning": "This task involves a significant overhaul of the CLI interface to improve user experience. The complexity is high due to the breadth of changes (logging, visual elements, interactive components, etc.) and the need for consistent design across all commands. The 6 existing subtasks cover the main implementation areas from log management to help systems."
|
||||
},
|
||||
{
|
||||
"taskId": 60,
|
||||
"taskTitle": "Implement Mentor System with Round-Table Discussion Feature",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 7,
|
||||
"expansionPrompt": "The current 7 subtasks for implementing the mentor system appear well-structured. Consider if any additional subtasks are needed for mentor personality consistency, discussion quality evaluation, or performance optimization with multiple mentors.",
|
||||
"reasoning": "This task involves creating a sophisticated mentor simulation system with round-table discussions. The complexity is high due to the need for personality simulation, complex LLM integration, and structured discussion management. The 7 existing subtasks cover the main implementation areas from architecture to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 62,
|
||||
"taskTitle": "Add --simple Flag to Update Commands for Direct Text Input",
|
||||
"complexityScore": 4,
|
||||
"recommendedSubtasks": 8,
|
||||
"expansionPrompt": "The current 8 subtasks for implementing the --simple flag appear comprehensive. Consider if any additional subtasks are needed for user experience testing or documentation updates.",
|
||||
"reasoning": "This task involves adding a simple flag option to bypass AI processing for updates. The complexity is relatively low as it primarily involves modifying existing command handlers and adding a flag. The 8 existing subtasks are very detailed and cover all aspects of implementation from command parsing to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 63,
|
||||
"taskTitle": "Add pnpm Support for the Taskmaster Package",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 8,
|
||||
"expansionPrompt": "The current 8 subtasks for adding pnpm support appear comprehensive. Consider if any additional subtasks are needed for CI/CD integration, performance comparison, or documentation updates.",
|
||||
"reasoning": "This task involves ensuring the package works correctly with pnpm as an alternative package manager. The complexity is moderate as it requires careful testing of installation processes and scripts across different environments. The 8 existing subtasks cover all major aspects from documentation to binary verification."
|
||||
},
|
||||
{
|
||||
"taskId": 64,
|
||||
"taskTitle": "Add Yarn Support for Taskmaster Installation",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 9,
|
||||
"expansionPrompt": "The current 9 subtasks for adding Yarn support appear comprehensive. Consider if any additional subtasks are needed for performance testing, CI/CD integration, or compatibility with different Yarn versions.",
|
||||
"reasoning": "This task involves ensuring the package works correctly with Yarn as an alternative package manager. The complexity is moderate as it requires careful testing of installation processes and scripts across different environments. The 9 existing subtasks are very detailed and cover all aspects from configuration to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 65,
|
||||
"taskTitle": "Add Bun Support for Taskmaster Installation",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for adding Bun support appear well-structured. Consider if any additional subtasks are needed for handling Bun-specific issues, performance testing, or documentation updates.",
|
||||
"reasoning": "This task involves adding support for the newer Bun package manager. The complexity is slightly higher than the other package manager tasks due to Bun's differences from Node.js and potential compatibility issues. The 6 existing subtasks cover the main implementation areas from research to documentation."
|
||||
},
|
||||
{
|
||||
"taskId": 67,
|
||||
"taskTitle": "Add CLI JSON output and Cursor keybindings integration",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing JSON output and Cursor keybindings appear well-structured. Consider if any additional subtasks are needed for testing across different operating systems, documentation updates, or user experience improvements.",
|
||||
"reasoning": "This task involves two distinct features: adding JSON output to CLI commands and creating a keybindings installation command. The complexity is moderate as it requires careful handling of different output formats and OS-specific file paths. The 5 existing subtasks cover the main implementation areas for both features."
|
||||
},
|
||||
{
|
||||
"taskId": 68,
|
||||
"taskTitle": "Ability to create tasks without parsing PRD",
|
||||
"complexityScore": 3,
|
||||
"recommendedSubtasks": 2,
|
||||
"expansionPrompt": "The current 2 subtasks for implementing task creation without PRD appear appropriate. Consider if any additional subtasks are needed for validation, error handling, or integration with existing task management workflows.",
|
||||
"reasoning": "This task involves a relatively simple modification to allow task creation without requiring a PRD document. The complexity is low as it primarily involves creating a form interface and saving functionality. The 2 existing subtasks cover the main implementation areas of UI design and data saving."
|
||||
},
|
||||
{
|
||||
"taskId": 72,
|
||||
"taskTitle": "Implement PDF Generation for Project Progress and Dependency Overview",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for implementing PDF generation appear comprehensive. Consider if any additional subtasks are needed for handling large projects, additional visualization options, or integration with existing reporting tools.",
|
||||
"reasoning": "This task involves creating a feature to generate PDF reports of project progress and dependency visualization. The complexity is high due to the need for PDF generation, data collection, and visualization integration. The 6 existing subtasks cover the main implementation areas from library selection to export options."
|
||||
},
|
||||
{
|
||||
"taskId": 75,
|
||||
"taskTitle": "Integrate Google Search Grounding for Research Role",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "The current 4 subtasks for integrating Google Search Grounding appear well-structured. Consider if any additional subtasks are needed for testing with different query types, error handling, or performance optimization.",
|
||||
"reasoning": "This task involves updating the AI service layer to enable Google Search Grounding for research roles. The complexity is moderate as it requires careful integration with the existing AI service architecture and conditional logic. The 4 existing subtasks cover the main implementation areas from service layer modification to testing."
|
||||
},
|
||||
{
|
||||
"taskId": 76,
|
||||
"taskTitle": "Develop E2E Test Framework for Taskmaster MCP Server (FastMCP over stdio)",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 7,
|
||||
"expansionPrompt": "The current 7 subtasks for developing the E2E test framework appear comprehensive. Consider if any additional subtasks are needed for test result reporting, CI/CD integration, or performance benchmarking.",
|
||||
"reasoning": "This task involves creating a sophisticated end-to-end testing framework for the MCP server. The complexity is high due to the need for subprocess management, protocol handling, and robust test case definition. The 7 existing subtasks cover the main implementation areas from architecture to documentation."
|
||||
},
|
||||
{
|
||||
"taskId": 77,
|
||||
"taskTitle": "Implement AI Usage Telemetry for Taskmaster (with external analytics endpoint)",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 18,
|
||||
"expansionPrompt": "The current 18 subtasks for implementing AI usage telemetry appear very comprehensive. Consider if any additional subtasks are needed for security hardening, privacy compliance, or user feedback collection.",
|
||||
"reasoning": "This task involves creating a telemetry system to track AI usage metrics. The complexity is high due to the need for secure data transmission, comprehensive data collection, and integration across multiple commands. The 18 existing subtasks are extremely detailed and cover all aspects of implementation from core utility to provider-specific updates."
|
||||
},
|
||||
{
|
||||
"taskId": 80,
|
||||
"taskTitle": "Implement Unique User ID Generation and Storage During Installation",
|
||||
"complexityScore": 4,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "The current 5 subtasks for implementing unique user ID generation appear well-structured. Consider if any additional subtasks are needed for privacy compliance, security auditing, or integration with the telemetry system.",
|
||||
"reasoning": "This task involves generating and storing a unique user identifier during installation. The complexity is relatively low as it primarily involves UUID generation and configuration file management. The 5 existing subtasks cover the main implementation areas from script structure to documentation."
|
||||
},
|
||||
{
|
||||
"taskId": 81,
|
||||
"taskTitle": "Task #81: Implement Comprehensive Local Telemetry System with Future Server Integration Capability",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "The current 6 subtasks for implementing the comprehensive local telemetry system appear well-structured. Consider if any additional subtasks are needed for data migration, storage optimization, or visualization tools.",
|
||||
"reasoning": "This task involves expanding the telemetry system to capture additional metrics and implement local storage with future server integration capability. The complexity is high due to the breadth of data collection, storage requirements, and privacy considerations. The 6 existing subtasks cover the main implementation areas from data collection to user-facing benefits."
|
||||
},
|
||||
{
|
||||
"taskId": 82,
|
||||
"taskTitle": "Update supported-models.json with token limit fields",
|
||||
"complexityScore": 3,
|
||||
"recommendedSubtasks": 1,
|
||||
"expansionPrompt": "This task appears straightforward enough to be implemented without further subtasks. Focus on researching accurate token limit values for each model and ensuring backward compatibility.",
|
||||
"reasoning": "This task involves a simple update to the supported-models.json file to include new token limit fields. The complexity is low as it primarily involves research and data entry. No subtasks are necessary as the task is well-defined and focused."
|
||||
},
|
||||
{
|
||||
"taskId": 83,
|
||||
"taskTitle": "Update config-manager.js defaults and getters",
|
||||
"complexityScore": 4,
|
||||
"recommendedSubtasks": 1,
|
||||
"expansionPrompt": "This task appears straightforward enough to be implemented without further subtasks. Focus on updating the DEFAULTS object and related getter functions while maintaining backward compatibility.",
|
||||
"reasoning": "This task involves updating the config-manager.js module to replace maxTokens with more specific token limit fields. The complexity is relatively low as it primarily involves modifying existing code rather than creating new functionality. No subtasks are necessary as the task is well-defined and focused."
|
||||
},
|
||||
{
|
||||
"taskId": 84,
|
||||
"taskTitle": "Implement token counting utility",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 1,
|
||||
"expansionPrompt": "This task appears well-defined enough to be implemented without further subtasks. Focus on implementing accurate token counting for different models and proper fallback mechanisms.",
|
||||
"reasoning": "This task involves creating a utility function to count tokens for different AI models. The complexity is moderate as it requires integration with the tiktoken library and handling different tokenization schemes. No subtasks are necessary as the task is well-defined and focused."
|
||||
},
|
||||
{
|
||||
"taskId": 69,
|
||||
"taskTitle": "Enhance Analyze Complexity for Specific Task IDs",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "Break down the task 'Enhance Analyze Complexity for Specific Task IDs' into 6 subtasks focusing on: 1) Core logic modification to accept ID parameters, 2) Report merging functionality, 3) CLI interface updates, 4) MCP tool integration, 5) Documentation updates, and 6) Comprehensive testing across all components.",
|
||||
"reasoning": "This task involves modifying existing functionality across multiple components (core logic, CLI, MCP) with complex logic for filtering tasks and merging reports. The implementation requires careful handling of different parameter combinations and edge cases. The task has interdependent components that need to work together seamlessly, and the report merging functionality adds significant complexity."
|
||||
},
|
||||
{
|
||||
"taskId": 70,
|
||||
"taskTitle": "Implement 'diagram' command for Mermaid diagram generation",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "Break down the 'diagram' command implementation into 5 subtasks: 1) Command interface and parameter handling, 2) Task data extraction and transformation to Mermaid syntax, 3) Diagram rendering with status color coding, 4) Output formatting and file export functionality, and 5) Error handling and edge case management.",
|
||||
"reasoning": "This task requires implementing a new feature rather than modifying existing code, which reduces complexity from integration challenges. However, it involves working with visualization logic, dependency mapping, and multiple output formats. The color coding based on status and handling of dependency relationships adds moderate complexity. The task is well-defined but requires careful attention to diagram formatting and error handling."
|
||||
},
|
||||
{
|
||||
"taskId": 85,
|
||||
"taskTitle": "Update ai-services-unified.js for dynamic token limits",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "Break down the update of ai-services-unified.js for dynamic token limits into subtasks such as: (1) Import and integrate the token counting utility, (2) Refactor _unifiedServiceRunner to calculate and enforce dynamic token limits, (3) Update error handling for token limit violations, (4) Add and verify logging for token usage, (5) Write and execute tests for various prompt and model scenarios.",
|
||||
"reasoning": "This task involves significant code changes to a core function, integration of a new utility, dynamic logic for multiple models, and robust error handling. It also requires comprehensive testing for edge cases and integration, making it moderately complex and best managed by splitting into focused subtasks."
|
||||
},
|
||||
{
|
||||
"taskId": 87,
|
||||
"taskTitle": "Implement validation and error handling",
|
||||
"complexityScore": 5,
|
||||
"recommendedSubtasks": 4,
|
||||
"expansionPrompt": "Decompose this task into: (1) Add validation logic for model and config loading, (2) Implement error handling and fallback mechanisms, (3) Enhance logging and reporting for token usage, (4) Develop helper functions for configuration suggestions and improvements.",
|
||||
"reasoning": "This task is primarily about adding validation, error handling, and logging. While important for robustness, the logic is straightforward and can be modularized into a few clear subtasks."
|
||||
},
|
||||
{
|
||||
"taskId": 89,
|
||||
"taskTitle": "Introduce Prioritize Command with Enhanced Priority Levels",
|
||||
"complexityScore": 6,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "Expand this task into: (1) Implement the prioritize command with all required flags and shorthands, (2) Update CLI output and help documentation for new priority levels, (3) Ensure backward compatibility with existing commands, (4) Add error handling for invalid inputs, (5) Write and run tests for all command scenarios.",
|
||||
"reasoning": "This CLI feature requires command parsing, updating internal logic for new priority levels, documentation, and robust error handling. The complexity is moderate due to the need for backward compatibility and comprehensive testing."
|
||||
},
|
||||
{
|
||||
"taskId": 90,
|
||||
"taskTitle": "Implement Subtask Progress Analyzer and Reporting System",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "Break down the analyzer implementation into: (1) Design and implement progress tracking logic, (2) Develop status validation and issue detection, (3) Build the reporting system with multiple output formats, (4) Integrate analyzer with the existing task management system, (5) Optimize for performance and scalability, (6) Write unit, integration, and performance tests.",
|
||||
"reasoning": "This is a complex, multi-faceted feature involving data analysis, reporting, integration, and performance optimization. It touches many parts of the system and requires careful design, making it one of the most complex tasks in the list."
|
||||
},
|
||||
{
|
||||
"taskId": 91,
|
||||
"taskTitle": "Implement Move Command for Tasks and Subtasks",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 5,
|
||||
"expansionPrompt": "Expand this task into: (1) Implement move logic for tasks and subtasks, (2) Handle edge cases (invalid ids, non-existent parents, circular dependencies), (3) Update CLI to support move command with flags, (4) Ensure data integrity and update relationships, (5) Write and execute tests for various move scenarios.",
|
||||
"reasoning": "Moving tasks and subtasks requires careful handling of hierarchical data, edge cases, and data integrity. The command must be robust and user-friendly, necessitating multiple focused subtasks for safe implementation."
|
||||
},
|
||||
{
|
||||
"taskId": 92,
|
||||
"taskTitle": "Add Global Joke Flag to All CLI Commands",
|
||||
"complexityScore": 8,
|
||||
"recommendedSubtasks": 7,
|
||||
"expansionPrompt": "Break down the implementation of the global --joke flag into the following subtasks: (1) Update CLI foundation to support global flags, (2) Develop the joke-service module with joke management and category support, (3) Integrate joke output into existing output utilities, (4) Update all CLI commands for joke flag compatibility, (5) Add configuration options for joke categories and custom jokes, (6) Implement comprehensive testing (flag recognition, output, content, integration, performance, regression), (7) Update documentation and usage examples.",
|
||||
"reasoning": "This task requires changes across the CLI foundation, output utilities, all command modules, and configuration management. It introduces a new service module, global flag handling, and output logic that must not interfere with existing features (including JSON output). The need for robust testing and backward compatibility further increases complexity. The scope spans multiple code areas and requires careful integration, justifying a high complexity score and a detailed subtask breakdown to manage risk and ensure maintainability.[2][3][5]"
|
||||
},
|
||||
{
|
||||
"taskId": 94,
|
||||
"taskTitle": "Implement Standalone 'research' CLI Command for AI-Powered Queries",
|
||||
"complexityScore": 7,
|
||||
"recommendedSubtasks": 6,
|
||||
"expansionPrompt": "Break down the implementation of the 'research' CLI command into logical subtasks covering command registration, parameter handling, context gathering, AI service integration, output formatting, and documentation.",
|
||||
"reasoning": "This task has moderate to high complexity (7/10) due to multiple interconnected components: CLI argument parsing, integration with AI services, context gathering from various sources, and output formatting with different modes. The cyclomatic complexity would be significant with multiple decision paths for handling different flags and options. The task requires understanding existing patterns and extending the codebase in a consistent manner, suggesting the need for careful decomposition into manageable subtasks."
|
||||
},
|
||||
{
|
||||
"taskId": 86,
|
||||
"taskTitle": "Implement GitHub Issue Export Feature",
|
||||
"complexityScore": 9,
|
||||
"recommendedSubtasks": 10,
|
||||
"expansionPrompt": "Break down the implementation of the GitHub Issue Export Feature into detailed subtasks covering: command structure and CLI integration, GitHub API client development, authentication and error handling, task-to-issue mapping logic, content formatting and markdown conversion, bidirectional linking and metadata management, extensible architecture and adapter interfaces, configuration and settings management, documentation, and comprehensive testing (unit, integration, edge cases, performance).",
|
||||
"reasoning": "This task involves designing and implementing a robust, extensible export system with deep integration into GitHub, including bidirectional workflows, complex data mapping, error handling, and support for future platforms. The requirements span CLI design, API integration, content transformation, metadata management, extensibility, configuration, and extensive testing. The breadth and depth of these requirements, along with the need for maintainability and future extensibility, place this task at a high complexity level. Breaking it into at least 10 subtasks will ensure each major component and concern is addressed systematically, reducing risk and improving quality."
|
||||
"expansionPrompt": "Expand task 24 'Implement AI-Powered Test Generation Command' into 6 subtasks, focusing on: 1) Command structure implementation, 2) AI prompt engineering for test generation, 3) Test file generation and output, 4) Framework-specific template implementation, 5) MCP tool integration, and 6) Documentation and help system integration. Include detailed implementation steps, dependencies, and testing approaches for each subtask.",
|
||||
"reasoning": "This task has high complexity due to several challenging aspects: 1) AI integration requiring sophisticated prompt engineering, 2) Test generation across multiple frameworks, 3) File system operations with proper error handling, 4) MCP tool integration, 5) Complex configuration requirements, and 6) Framework-specific template generation. The task already has 5 subtasks but could benefit from reorganization based on the updated implementation details in the info blocks, particularly around framework support and configuration."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"currentTag": "master",
|
||||
"lastSwitched": "2025-07-22T13:32:03.558Z",
|
||||
"lastSwitched": "2025-08-01T14:09:25.838Z",
|
||||
"branchTagMapping": {
|
||||
"v017-adds": "v017-adds",
|
||||
"next": "next"
|
||||
|
||||
File diff suppressed because one or more lines are too long
318
CHANGELOG.md
318
CHANGELOG.md
@@ -1,5 +1,323 @@
|
||||
# task-master-ai
|
||||
|
||||
## 0.24.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1098](https://github.com/eyaltoledano/claude-task-master/pull/1098) [`36468f3`](https://github.com/eyaltoledano/claude-task-master/commit/36468f3c93faf4035a5c442ccbc501077f3440f1) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Enhanced Claude Code provider with codebase-aware task generation
|
||||
- Added automatic codebase analysis for Claude Code provider in `parse-prd`, `expand-task`, and `analyze-complexity` commands
|
||||
- When using Claude Code as the AI provider, Task Master now instructs the AI to analyze the project structure, existing implementations, and patterns before generating tasks or subtasks
|
||||
- Tasks and subtasks generated by Claude Code are now informed by actual codebase analysis, resulting in more accurate and contextual outputs
|
||||
|
||||
- [#1105](https://github.com/eyaltoledano/claude-task-master/pull/1105) [`75c514c`](https://github.com/eyaltoledano/claude-task-master/commit/75c514cf5b2ca47f95c0ad7fa92654a4f2a6be4b) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Add GPT-5 support with proper parameter handling
|
||||
- Added GPT-5 model to supported models configuration with SWE score of 0.749
|
||||
|
||||
- [#1091](https://github.com/eyaltoledano/claude-task-master/pull/1091) [`4bb6370`](https://github.com/eyaltoledano/claude-task-master/commit/4bb63706b80c28d1b2d782ba868a725326f916c7) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Add Claude Code subagent support with task-orchestrator, task-executor, and task-checker
|
||||
|
||||
## New Claude Code Agents
|
||||
|
||||
Added specialized agents for Claude Code users to enable parallel task execution, intelligent task orchestration, and quality assurance:
|
||||
|
||||
### task-orchestrator
|
||||
|
||||
Coordinates and manages the execution of Task Master tasks with intelligent dependency analysis:
|
||||
- Analyzes task dependencies to identify parallelizable work
|
||||
- Deploys multiple task-executor agents for concurrent execution
|
||||
- Monitors task completion and updates the dependency graph
|
||||
- Automatically identifies and starts newly unblocked tasks
|
||||
|
||||
### task-executor
|
||||
|
||||
Handles the actual implementation of individual tasks:
|
||||
- Executes specific tasks identified by the orchestrator
|
||||
- Works on concrete implementation rather than planning
|
||||
- Updates task status and logs progress
|
||||
- Can work in parallel with other executors on independent tasks
|
||||
|
||||
### task-checker
|
||||
|
||||
Verifies that completed tasks meet their specifications:
|
||||
- Reviews tasks marked as 'review' status
|
||||
- Validates implementation against requirements
|
||||
- Runs tests and checks for best practices
|
||||
- Ensures quality before marking tasks as 'done'
|
||||
|
||||
## Installation
|
||||
|
||||
When using the Claude profile (`task-master rules add claude`), the agents are automatically installed to `.claude/agents/` directory.
|
||||
|
||||
## Usage Example
|
||||
|
||||
```bash
|
||||
# In Claude Code, after initializing a project with tasks:
|
||||
|
||||
# Use task-orchestrator to analyze and coordinate work
|
||||
# The orchestrator will:
|
||||
# 1. Check task dependencies
|
||||
# 2. Identify tasks that can run in parallel
|
||||
# 3. Deploy executors for available work
|
||||
# 4. Monitor progress and deploy new executors as tasks complete
|
||||
|
||||
# Use task-executor for specific task implementation
|
||||
# When the orchestrator identifies task 2.3 needs work:
|
||||
# The executor will implement that specific task
|
||||
```
|
||||
|
||||
## Benefits
|
||||
- **Parallel Execution**: Multiple independent tasks can be worked on simultaneously
|
||||
- **Intelligent Scheduling**: Orchestrator understands dependencies and optimizes execution order
|
||||
- **Separation of Concerns**: Planning (orchestrator) is separated from execution (executor)
|
||||
- **Progress Tracking**: Real-time updates as tasks are completed
|
||||
- **Automatic Progression**: As tasks complete, newly unblocked tasks are automatically started
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1094](https://github.com/eyaltoledano/claude-task-master/pull/1094) [`4357af3`](https://github.com/eyaltoledano/claude-task-master/commit/4357af3f13859d90bca8795215e5d5f1d94abde5) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix expand task generating unrelated generic subtasks
|
||||
|
||||
Fixed an issue where `task-master expand` would generate generic authentication-related subtasks regardless of the parent task context when using complexity reports. The expansion now properly includes the parent task details alongside any expansion guidance.
|
||||
|
||||
- [#1079](https://github.com/eyaltoledano/claude-task-master/pull/1079) [`e495b2b`](https://github.com/eyaltoledano/claude-task-master/commit/e495b2b55950ee54c7d0f1817d8530e28bd79c05) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix scope-up/down prompts to include all required fields for better AI model compatibility
|
||||
- Added missing `priority` field to scope adjustment prompts to prevent validation errors with Claude-code and other models
|
||||
- Ensures generated JSON includes all fields required by the schema
|
||||
|
||||
- [#1079](https://github.com/eyaltoledano/claude-task-master/pull/1079) [`e495b2b`](https://github.com/eyaltoledano/claude-task-master/commit/e495b2b55950ee54c7d0f1817d8530e28bd79c05) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix MCP scope-up/down tools not finding tasks
|
||||
- Fixed task ID parsing in MCP layer - now correctly converts string IDs to numbers
|
||||
- scope_up_task and scope_down_task MCP tools now work properly
|
||||
|
||||
- [#1079](https://github.com/eyaltoledano/claude-task-master/pull/1079) [`e495b2b`](https://github.com/eyaltoledano/claude-task-master/commit/e495b2b55950ee54c7d0f1817d8530e28bd79c05) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Improve AI provider compatibility for JSON generation
|
||||
- Fixed schema compatibility issues between Perplexity and OpenAI o3 models
|
||||
- Removed nullable/default modifiers from Zod schemas for broader compatibility
|
||||
- Added automatic JSON repair for malformed AI responses (handles cases like missing array values)
|
||||
- Perplexity now uses JSON mode for more reliable structured output
|
||||
- Post-processing handles default values separately from schema validation
|
||||
|
||||
## 0.24.0-rc.2
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1105](https://github.com/eyaltoledano/claude-task-master/pull/1105) [`75c514c`](https://github.com/eyaltoledano/claude-task-master/commit/75c514cf5b2ca47f95c0ad7fa92654a4f2a6be4b) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Add GPT-5 support with proper parameter handling
|
||||
- Added GPT-5 model to supported models configuration with SWE score of 0.749
|
||||
|
||||
## 0.24.0-rc.1
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1093](https://github.com/eyaltoledano/claude-task-master/pull/1093) [`36468f3`](https://github.com/eyaltoledano/claude-task-master/commit/36468f3c93faf4035a5c442ccbc501077f3440f1) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Enhanced Claude Code provider with codebase-aware task generation
|
||||
- Added automatic codebase analysis for Claude Code provider in `parse-prd`, `expand-task`, and `analyze-complexity` commands
|
||||
- When using Claude Code as the AI provider, Task Master now instructs the AI to analyze the project structure, existing implementations, and patterns before generating tasks or subtasks
|
||||
- Tasks and subtasks generated by Claude Code are now informed by actual codebase analysis, resulting in more accurate and contextual outputs
|
||||
|
||||
- [#1091](https://github.com/eyaltoledano/claude-task-master/pull/1091) [`4bb6370`](https://github.com/eyaltoledano/claude-task-master/commit/4bb63706b80c28d1b2d782ba868a725326f916c7) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Add Claude Code subagent support with task-orchestrator, task-executor, and task-checker
|
||||
|
||||
## New Claude Code Agents
|
||||
|
||||
Added specialized agents for Claude Code users to enable parallel task execution, intelligent task orchestration, and quality assurance:
|
||||
|
||||
### task-orchestrator
|
||||
|
||||
Coordinates and manages the execution of Task Master tasks with intelligent dependency analysis:
|
||||
- Analyzes task dependencies to identify parallelizable work
|
||||
- Deploys multiple task-executor agents for concurrent execution
|
||||
- Monitors task completion and updates the dependency graph
|
||||
- Automatically identifies and starts newly unblocked tasks
|
||||
|
||||
### task-executor
|
||||
|
||||
Handles the actual implementation of individual tasks:
|
||||
- Executes specific tasks identified by the orchestrator
|
||||
- Works on concrete implementation rather than planning
|
||||
- Updates task status and logs progress
|
||||
- Can work in parallel with other executors on independent tasks
|
||||
|
||||
### task-checker
|
||||
|
||||
Verifies that completed tasks meet their specifications:
|
||||
- Reviews tasks marked as 'review' status
|
||||
- Validates implementation against requirements
|
||||
- Runs tests and checks for best practices
|
||||
- Ensures quality before marking tasks as 'done'
|
||||
|
||||
## Installation
|
||||
|
||||
When using the Claude profile (`task-master rules add claude`), the agents are automatically installed to `.claude/agents/` directory.
|
||||
|
||||
## Usage Example
|
||||
|
||||
```bash
|
||||
# In Claude Code, after initializing a project with tasks:
|
||||
|
||||
# Use task-orchestrator to analyze and coordinate work
|
||||
# The orchestrator will:
|
||||
# 1. Check task dependencies
|
||||
# 2. Identify tasks that can run in parallel
|
||||
# 3. Deploy executors for available work
|
||||
# 4. Monitor progress and deploy new executors as tasks complete
|
||||
|
||||
# Use task-executor for specific task implementation
|
||||
# When the orchestrator identifies task 2.3 needs work:
|
||||
# The executor will implement that specific task
|
||||
```
|
||||
|
||||
## Benefits
|
||||
- **Parallel Execution**: Multiple independent tasks can be worked on simultaneously
|
||||
- **Intelligent Scheduling**: Orchestrator understands dependencies and optimizes execution order
|
||||
- **Separation of Concerns**: Planning (orchestrator) is separated from execution (executor)
|
||||
- **Progress Tracking**: Real-time updates as tasks are completed
|
||||
- **Automatic Progression**: As tasks complete, newly unblocked tasks are automatically started
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1094](https://github.com/eyaltoledano/claude-task-master/pull/1094) [`4357af3`](https://github.com/eyaltoledano/claude-task-master/commit/4357af3f13859d90bca8795215e5d5f1d94abde5) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix expand task generating unrelated generic subtasks
|
||||
|
||||
Fixed an issue where `task-master expand` would generate generic authentication-related subtasks regardless of the parent task context when using complexity reports. The expansion now properly includes the parent task details alongside any expansion guidance.
|
||||
|
||||
## 0.23.1-rc.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1079](https://github.com/eyaltoledano/claude-task-master/pull/1079) [`e495b2b`](https://github.com/eyaltoledano/claude-task-master/commit/e495b2b55950ee54c7d0f1817d8530e28bd79c05) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix scope-up/down prompts to include all required fields for better AI model compatibility
|
||||
- Added missing `priority` field to scope adjustment prompts to prevent validation errors with Claude-code and other models
|
||||
- Ensures generated JSON includes all fields required by the schema
|
||||
|
||||
- [#1079](https://github.com/eyaltoledano/claude-task-master/pull/1079) [`e495b2b`](https://github.com/eyaltoledano/claude-task-master/commit/e495b2b55950ee54c7d0f1817d8530e28bd79c05) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix MCP scope-up/down tools not finding tasks
|
||||
- Fixed task ID parsing in MCP layer - now correctly converts string IDs to numbers
|
||||
- scope_up_task and scope_down_task MCP tools now work properly
|
||||
|
||||
- [#1079](https://github.com/eyaltoledano/claude-task-master/pull/1079) [`e495b2b`](https://github.com/eyaltoledano/claude-task-master/commit/e495b2b55950ee54c7d0f1817d8530e28bd79c05) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Improve AI provider compatibility for JSON generation
|
||||
- Fixed schema compatibility issues between Perplexity and OpenAI o3 models
|
||||
- Removed nullable/default modifiers from Zod schemas for broader compatibility
|
||||
- Added automatic JSON repair for malformed AI responses (handles cases like missing array values)
|
||||
- Perplexity now uses JSON mode for more reliable structured output
|
||||
- Post-processing handles default values separately from schema validation
|
||||
|
||||
## 0.23.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1064](https://github.com/eyaltoledano/claude-task-master/pull/1064) [`53903f1`](https://github.com/eyaltoledano/claude-task-master/commit/53903f1e8eee23ac512eb13a6d81d8cbcfe658cb) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Add new `scope-up` and `scope-down` commands for dynamic task complexity adjustment
|
||||
|
||||
This release introduces two powerful new commands that allow you to dynamically adjust the complexity of your tasks and subtasks without recreating them from scratch.
|
||||
|
||||
**New CLI Commands:**
|
||||
- `task-master scope-up` - Increase task complexity (add more detail, requirements, or implementation steps)
|
||||
- `task-master scope-down` - Decrease task complexity (simplify, remove unnecessary details, or streamline)
|
||||
|
||||
**Key Features:**
|
||||
- **Multiple tasks**: Support comma-separated IDs to adjust multiple tasks at once (`--id=5,7,12`)
|
||||
- **Strength levels**: Choose adjustment intensity with `--strength=light|regular|heavy` (defaults to regular)
|
||||
- **Custom prompts**: Use `--prompt` flag to specify exactly how you want tasks adjusted
|
||||
- **MCP integration**: Available as `scope_up_task` and `scope_down_task` tools in Cursor and other MCP environments
|
||||
- **Smart context**: AI considers your project context and task dependencies when making adjustments
|
||||
|
||||
**Usage Examples:**
|
||||
|
||||
```bash
|
||||
# Make a task more detailed
|
||||
task-master scope-up --id=5
|
||||
|
||||
# Simplify multiple tasks with light touch
|
||||
task-master scope-down --id=10,11,12 --strength=light
|
||||
|
||||
# Custom adjustment with specific instructions
|
||||
task-master scope-up --id=7 --prompt="Add more error handling and edge cases"
|
||||
```
|
||||
|
||||
**Why use this?**
|
||||
- **Iterative refinement**: Adjust task complexity as your understanding evolves
|
||||
- **Project phase adaptation**: Scale tasks up for implementation, down for planning
|
||||
- **Team coordination**: Adjust complexity based on team member experience levels
|
||||
- **Milestone alignment**: Fine-tune tasks to match project phase requirements
|
||||
|
||||
Perfect for agile workflows where task requirements change as you learn more about the problem space.
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1063](https://github.com/eyaltoledano/claude-task-master/pull/1063) [`2ae6e7e`](https://github.com/eyaltoledano/claude-task-master/commit/2ae6e7e6be3605c3c4d353f34666e54750dba973) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix for tasks not found when using string IDs
|
||||
|
||||
- [#1049](https://github.com/eyaltoledano/claude-task-master/pull/1049) [`45a14c3`](https://github.com/eyaltoledano/claude-task-master/commit/45a14c323d21071c15106335e89ad1f4a20976ab) Thanks [@ben-vargas](https://github.com/ben-vargas)! - Fix tag-specific complexity report detection in expand command
|
||||
|
||||
The expand command now correctly finds and uses tag-specific complexity reports (e.g., `task-complexity-report_feature-xyz.json`) when operating in a tag context. Previously, it would always look for the generic `task-complexity-report.json` file due to a default value in the CLI option definition.
|
||||
|
||||
## 0.23.0-rc.2
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1064](https://github.com/eyaltoledano/claude-task-master/pull/1064) [`53903f1`](https://github.com/eyaltoledano/claude-task-master/commit/53903f1e8eee23ac512eb13a6d81d8cbcfe658cb) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Add new `scope-up` and `scope-down` commands for dynamic task complexity adjustment
|
||||
|
||||
This release introduces two powerful new commands that allow you to dynamically adjust the complexity of your tasks and subtasks without recreating them from scratch.
|
||||
|
||||
**New CLI Commands:**
|
||||
- `task-master scope-up` - Increase task complexity (add more detail, requirements, or implementation steps)
|
||||
- `task-master scope-down` - Decrease task complexity (simplify, remove unnecessary details, or streamline)
|
||||
|
||||
**Key Features:**
|
||||
- **Multiple tasks**: Support comma-separated IDs to adjust multiple tasks at once (`--id=5,7,12`)
|
||||
- **Strength levels**: Choose adjustment intensity with `--strength=light|regular|heavy` (defaults to regular)
|
||||
- **Custom prompts**: Use `--prompt` flag to specify exactly how you want tasks adjusted
|
||||
- **MCP integration**: Available as `scope_up_task` and `scope_down_task` tools in Cursor and other MCP environments
|
||||
- **Smart context**: AI considers your project context and task dependencies when making adjustments
|
||||
|
||||
**Usage Examples:**
|
||||
|
||||
```bash
|
||||
# Make a task more detailed
|
||||
task-master scope-up --id=5
|
||||
|
||||
# Simplify multiple tasks with light touch
|
||||
task-master scope-down --id=10,11,12 --strength=light
|
||||
|
||||
# Custom adjustment with specific instructions
|
||||
task-master scope-up --id=7 --prompt="Add more error handling and edge cases"
|
||||
```
|
||||
|
||||
**Why use this?**
|
||||
- **Iterative refinement**: Adjust task complexity as your understanding evolves
|
||||
- **Project phase adaptation**: Scale tasks up for implementation, down for planning
|
||||
- **Team coordination**: Adjust complexity based on team member experience levels
|
||||
- **Milestone alignment**: Fine-tune tasks to match project phase requirements
|
||||
|
||||
Perfect for agile workflows where task requirements change as you learn more about the problem space.
|
||||
|
||||
## 0.22.1-rc.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1069](https://github.com/eyaltoledano/claude-task-master/pull/1069) [`72ca68e`](https://github.com/eyaltoledano/claude-task-master/commit/72ca68edeb870ff7a3b0d2d632e09dae921dc16a) Thanks [@eyaltoledano](https://github.com/eyaltoledano)! - Add new `scope-up` and `scope-down` commands for dynamic task complexity adjustment
|
||||
|
||||
This release introduces two powerful new commands that allow you to dynamically adjust the complexity of your tasks and subtasks without recreating them from scratch.
|
||||
|
||||
**New CLI Commands:**
|
||||
- `task-master scope-up` - Increase task complexity (add more detail, requirements, or implementation steps)
|
||||
- `task-master scope-down` - Decrease task complexity (simplify, remove unnecessary details, or streamline)
|
||||
|
||||
**Key Features:**
|
||||
- **Multiple tasks**: Support comma-separated IDs to adjust multiple tasks at once (`--id=5,7,12`)
|
||||
- **Strength levels**: Choose adjustment intensity with `--strength=light|regular|heavy` (defaults to regular)
|
||||
- **Custom prompts**: Use `--prompt` flag to specify exactly how you want tasks adjusted
|
||||
- **MCP integration**: Available as `scope_up_task` and `scope_down_task` tools in Cursor and other MCP environments
|
||||
- **Smart context**: AI considers your project context and task dependencies when making adjustments
|
||||
|
||||
**Usage Examples:**
|
||||
|
||||
```bash
|
||||
# Make a task more detailed
|
||||
task-master scope-up --id=5
|
||||
|
||||
# Simplify multiple tasks with light touch
|
||||
task-master scope-down --id=10,11,12 --strength=light
|
||||
|
||||
# Custom adjustment with specific instructions
|
||||
task-master scope-up --id=7 --prompt="Add more error handling and edge cases"
|
||||
```
|
||||
|
||||
**Why use this?**
|
||||
- **Iterative refinement**: Adjust task complexity as your understanding evolves
|
||||
- **Project phase adaptation**: Scale tasks up for implementation, down for planning
|
||||
- **Team coordination**: Adjust complexity based on team member experience levels
|
||||
- **Milestone alignment**: Fine-tune tasks to match project phase requirements
|
||||
|
||||
Perfect for agile workflows where task requirements change as you learn more about the problem space.
|
||||
|
||||
## 0.22.1-rc.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -3,3 +3,7 @@
|
||||
## Task Master AI Instructions
|
||||
**Import Task Master's development workflow commands and guidelines, treat as if import is in the main CLAUDE.md file.**
|
||||
@./.taskmaster/CLAUDE.md
|
||||
|
||||
## Changeset Guidelines
|
||||
|
||||
- When creating changesets, remember that it's user-facing, meaning we don't have to get into the specifics of the code, but rather mention what the end-user is getting or fixing from this changeset.
|
||||
@@ -1 +1,155 @@
|
||||
# Change Log
|
||||
|
||||
## 0.23.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1090](https://github.com/eyaltoledano/claude-task-master/pull/1090) [`a464e55`](https://github.com/eyaltoledano/claude-task-master/commit/a464e550b886ef81b09df80588fe5881bce83d93) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix issues with some users not being able to connect to Taskmaster MCP server while using the extension
|
||||
|
||||
- Updated dependencies [[`4357af3`](https://github.com/eyaltoledano/claude-task-master/commit/4357af3f13859d90bca8795215e5d5f1d94abde5), [`e495b2b`](https://github.com/eyaltoledano/claude-task-master/commit/e495b2b55950ee54c7d0f1817d8530e28bd79c05), [`36468f3`](https://github.com/eyaltoledano/claude-task-master/commit/36468f3c93faf4035a5c442ccbc501077f3440f1), [`e495b2b`](https://github.com/eyaltoledano/claude-task-master/commit/e495b2b55950ee54c7d0f1817d8530e28bd79c05), [`e495b2b`](https://github.com/eyaltoledano/claude-task-master/commit/e495b2b55950ee54c7d0f1817d8530e28bd79c05), [`75c514c`](https://github.com/eyaltoledano/claude-task-master/commit/75c514cf5b2ca47f95c0ad7fa92654a4f2a6be4b), [`4bb6370`](https://github.com/eyaltoledano/claude-task-master/commit/4bb63706b80c28d1b2d782ba868a725326f916c7)]:
|
||||
- task-master-ai@0.24.0
|
||||
|
||||
## 0.23.1-rc.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`75c514c`](https://github.com/eyaltoledano/claude-task-master/commit/75c514cf5b2ca47f95c0ad7fa92654a4f2a6be4b)]:
|
||||
- task-master-ai@0.24.0-rc.2
|
||||
|
||||
## 0.23.1-rc.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1090](https://github.com/eyaltoledano/claude-task-master/pull/1090) [`a464e55`](https://github.com/eyaltoledano/claude-task-master/commit/a464e550b886ef81b09df80588fe5881bce83d93) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - Fix issues with some users not being able to connect to Taskmaster MCP server while using the extension
|
||||
|
||||
- Updated dependencies [[`4357af3`](https://github.com/eyaltoledano/claude-task-master/commit/4357af3f13859d90bca8795215e5d5f1d94abde5), [`36468f3`](https://github.com/eyaltoledano/claude-task-master/commit/36468f3c93faf4035a5c442ccbc501077f3440f1), [`4bb6370`](https://github.com/eyaltoledano/claude-task-master/commit/4bb63706b80c28d1b2d782ba868a725326f916c7)]:
|
||||
- task-master-ai@0.24.0-rc.1
|
||||
|
||||
## 0.23.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1064](https://github.com/eyaltoledano/claude-task-master/pull/1064) [`b82d858`](https://github.com/eyaltoledano/claude-task-master/commit/b82d858f81a1e702ad59d84d5ae8a2ca84359a83) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - 🎉 **Introducing TaskMaster Extension!**
|
||||
|
||||
We're thrilled to launch the first version of our Code extension, bringing the power of TaskMaster directly into your favorite code editor. While this is our initial release and we've kept things focused, it already packs powerful features to supercharge your development workflow.
|
||||
|
||||
## ✨ Key Features
|
||||
|
||||
### 📋 Visual Task Management
|
||||
- **Kanban Board View**: Visualize all your tasks in an intuitive board layout directly in VS Code
|
||||
- **Drag & Drop**: Easily change task status by dragging cards between columns
|
||||
- **Real-time Updates**: See changes instantly as you work through your project
|
||||
|
||||
### 🏷️ Multi-Context Support
|
||||
- **Tag Switching**: Seamlessly switch between different project contexts/tags
|
||||
- **Isolated Workflows**: Keep different features or experiments organized separately
|
||||
|
||||
### 🤖 AI-Powered Task Updates
|
||||
- **Smart Updates**: Use TaskMaster's AI capabilities to update tasks and subtasks
|
||||
- **Context-Aware**: Leverages your existing TaskMaster configuration and models
|
||||
|
||||
### 📊 Rich Task Information
|
||||
- **Complexity Scores**: See task complexity ratings at a glance
|
||||
- **Subtask Visualization**: Expand tasks to view and manage subtasks
|
||||
- **Dependency Graphs**: Understand task relationships and dependencies visually
|
||||
|
||||
### ⚙️ Configuration Management
|
||||
- **Visual Config Editor**: View and understand your `.taskmaster/config.json` settings
|
||||
- **Easy Access**: No more manual JSON editing for common configuration tasks
|
||||
|
||||
### 🚀 Quick Actions
|
||||
- **Status Updates**: Change task status with a single click
|
||||
- **Task Details**: Access full task information without leaving VS Code
|
||||
- **Integrated Commands**: All TaskMaster commands available through the command palette
|
||||
|
||||
## 🎯 What's Next?
|
||||
|
||||
This is just the beginning! We wanted to get a solid foundation into your hands quickly. The extension will evolve rapidly with your feedback, adding more advanced features, better visualizations, and deeper integration with your development workflow.
|
||||
|
||||
Thank you for being part of the TaskMaster journey. Your workflow has never looked better! 🚀
|
||||
|
||||
## 0.23.0-rc.1
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1064](https://github.com/eyaltoledano/claude-task-master/pull/1064) [`b82d858`](https://github.com/eyaltoledano/claude-task-master/commit/b82d858f81a1e702ad59d84d5ae8a2ca84359a83) Thanks [@Crunchyman-ralph](https://github.com/Crunchyman-ralph)! - 🎉 **Introducing TaskMaster Extension!**
|
||||
|
||||
We're thrilled to launch the first version of our Code extension, bringing the power of TaskMaster directly into your favorite code editor. While this is our initial release and we've kept things focused, it already packs powerful features to supercharge your development workflow.
|
||||
|
||||
## ✨ Key Features
|
||||
|
||||
### 📋 Visual Task Management
|
||||
- **Kanban Board View**: Visualize all your tasks in an intuitive board layout directly in VS Code
|
||||
- **Drag & Drop**: Easily change task status by dragging cards between columns
|
||||
- **Real-time Updates**: See changes instantly as you work through your project
|
||||
|
||||
### 🏷️ Multi-Context Support
|
||||
- **Tag Switching**: Seamlessly switch between different project contexts/tags
|
||||
- **Isolated Workflows**: Keep different features or experiments organized separately
|
||||
|
||||
### 🤖 AI-Powered Task Updates
|
||||
- **Smart Updates**: Use TaskMaster's AI capabilities to update tasks and subtasks
|
||||
- **Context-Aware**: Leverages your existing TaskMaster configuration and models
|
||||
|
||||
### 📊 Rich Task Information
|
||||
- **Complexity Scores**: See task complexity ratings at a glance
|
||||
- **Subtask Visualization**: Expand tasks to view and manage subtasks
|
||||
- **Dependency Graphs**: Understand task relationships and dependencies visually
|
||||
|
||||
### ⚙️ Configuration Management
|
||||
- **Visual Config Editor**: View and understand your `.taskmaster/config.json` settings
|
||||
- **Easy Access**: No more manual JSON editing for common configuration tasks
|
||||
|
||||
### 🚀 Quick Actions
|
||||
- **Status Updates**: Change task status with a single click
|
||||
- **Task Details**: Access full task information without leaving VS Code
|
||||
- **Integrated Commands**: All TaskMaster commands available through the command palette
|
||||
|
||||
## 🎯 What's Next?
|
||||
|
||||
This is just the beginning! We wanted to get a solid foundation into your hands quickly. The extension will evolve rapidly with your feedback, adding more advanced features, better visualizations, and deeper integration with your development workflow.
|
||||
|
||||
Thank you for being part of the TaskMaster journey. Your workflow has never looked better! 🚀
|
||||
|
||||
## 0.23.0-rc.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#997](https://github.com/eyaltoledano/claude-task-master/pull/997) [`64302dc`](https://github.com/eyaltoledano/claude-task-master/commit/64302dc1918f673fcdac05b29411bf76ffe93505) Thanks [@DavidMaliglowka](https://github.com/DavidMaliglowka)! - 🎉 **Introducing TaskMaster Extension!**
|
||||
|
||||
We're thrilled to launch the first version of our Code extension, bringing the power of TaskMaster directly into your favorite code editor. While this is our initial release and we've kept things focused, it already packs powerful features to supercharge your development workflow.
|
||||
|
||||
## ✨ Key Features
|
||||
|
||||
### 📋 Visual Task Management
|
||||
- **Kanban Board View**: Visualize all your tasks in an intuitive board layout directly in VS Code
|
||||
- **Drag & Drop**: Easily change task status by dragging cards between columns
|
||||
- **Real-time Updates**: See changes instantly as you work through your project
|
||||
|
||||
### 🏷️ Multi-Context Support
|
||||
- **Tag Switching**: Seamlessly switch between different project contexts/tags
|
||||
- **Isolated Workflows**: Keep different features or experiments organized separately
|
||||
|
||||
### 🤖 AI-Powered Task Updates
|
||||
- **Smart Updates**: Use TaskMaster's AI capabilities to update tasks and subtasks
|
||||
- **Context-Aware**: Leverages your existing TaskMaster configuration and models
|
||||
|
||||
### 📊 Rich Task Information
|
||||
- **Complexity Scores**: See task complexity ratings at a glance
|
||||
- **Subtask Visualization**: Expand tasks to view and manage subtasks
|
||||
- **Dependency Graphs**: Understand task relationships and dependencies visually
|
||||
|
||||
### ⚙️ Configuration Management
|
||||
- **Visual Config Editor**: View and understand your `.taskmaster/config.json` settings
|
||||
- **Easy Access**: No more manual JSON editing for common configuration tasks
|
||||
|
||||
### 🚀 Quick Actions
|
||||
- **Status Updates**: Change task status with a single click
|
||||
- **Task Details**: Access full task information without leaving VS Code
|
||||
- **Integrated Commands**: All TaskMaster commands available through the command palette
|
||||
|
||||
## 🎯 What's Next?
|
||||
|
||||
This is just the beginning! We wanted to get a solid foundation into your hands quickly. The extension will evolve rapidly with your feedback, adding more advanced features, better visualizations, and deeper integration with your development workflow.
|
||||
|
||||
Thank you for being part of the TaskMaster journey. Your workflow has never looked better! 🚀
|
||||
|
||||
@@ -3,15 +3,23 @@
|
||||
"private": true,
|
||||
"displayName": "TaskMaster",
|
||||
"description": "A visual Kanban board interface for TaskMaster projects in VS Code",
|
||||
"version": "0.22.3",
|
||||
"version": "0.23.1",
|
||||
"publisher": "Hamster",
|
||||
"icon": "assets/icon.png",
|
||||
"engines": {
|
||||
"vscode": "^1.93.0"
|
||||
},
|
||||
"categories": ["AI", "Visualization", "Education", "Other"],
|
||||
"categories": [
|
||||
"AI",
|
||||
"Visualization",
|
||||
"Education",
|
||||
"Other"
|
||||
],
|
||||
"main": "./dist/extension.js",
|
||||
"activationEvents": ["onStartupFinished", "workspaceContains:.taskmaster/**"],
|
||||
"activationEvents": [
|
||||
"onStartupFinished",
|
||||
"workspaceContains:.taskmaster/**"
|
||||
],
|
||||
"contributes": {
|
||||
"viewsContainers": {
|
||||
"activitybar": [
|
||||
@@ -64,16 +72,16 @@
|
||||
"properties": {
|
||||
"taskmaster.mcp.command": {
|
||||
"type": "string",
|
||||
"default": "npx",
|
||||
"description": "The command or absolute path to execute for the MCP server (e.g., 'npx' or '/usr/local/bin/task-master-ai')."
|
||||
"default": "node",
|
||||
"description": "The command to execute for the MCP server (e.g., 'node' for bundled server or 'npx' for remote)."
|
||||
},
|
||||
"taskmaster.mcp.args": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": ["task-master-ai"],
|
||||
"description": "An array of arguments to pass to the MCP server command."
|
||||
"default": [],
|
||||
"description": "Arguments for the MCP server (leave empty to use bundled server)."
|
||||
},
|
||||
"taskmaster.mcp.cwd": {
|
||||
"type": "string",
|
||||
@@ -139,7 +147,11 @@
|
||||
},
|
||||
"taskmaster.ui.theme": {
|
||||
"type": "string",
|
||||
"enum": ["auto", "light", "dark"],
|
||||
"enum": [
|
||||
"auto",
|
||||
"light",
|
||||
"dark"
|
||||
],
|
||||
"default": "auto",
|
||||
"description": "UI theme preference"
|
||||
},
|
||||
@@ -200,7 +212,12 @@
|
||||
},
|
||||
"taskmaster.debug.logLevel": {
|
||||
"type": "string",
|
||||
"enum": ["error", "warn", "info", "debug"],
|
||||
"enum": [
|
||||
"error",
|
||||
"warn",
|
||||
"info",
|
||||
"debug"
|
||||
],
|
||||
"default": "info",
|
||||
"description": "Logging level"
|
||||
},
|
||||
@@ -238,6 +255,9 @@
|
||||
"watch:css": "npx @tailwindcss/cli -i ./src/webview/index.css -o ./dist/index.css --watch",
|
||||
"check-types": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"task-master-ai": "0.24.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
|
||||
@@ -64,23 +64,49 @@ try {
|
||||
fs.readFileSync(publishPackagePath, 'utf8')
|
||||
);
|
||||
|
||||
// Check if versions are in sync
|
||||
if (devPackage.version !== publishPackage.version) {
|
||||
// Handle RC versions for VS Code Marketplace
|
||||
let finalVersion = devPackage.version;
|
||||
if (finalVersion.includes('-rc.')) {
|
||||
console.log(
|
||||
` - Version sync needed: ${publishPackage.version} → ${devPackage.version}`
|
||||
' - Detected RC version, transforming for VS Code Marketplace...'
|
||||
);
|
||||
publishPackage.version = devPackage.version;
|
||||
|
||||
// Update the source package.publish.json file
|
||||
// Extract base version and RC number
|
||||
const baseVersion = finalVersion.replace(/-rc\.\d+$/, '');
|
||||
const rcMatch = finalVersion.match(/rc\.(\d+)/);
|
||||
const rcNumber = rcMatch ? parseInt(rcMatch[1]) : 0;
|
||||
|
||||
// For each RC iteration, increment the patch version
|
||||
// This ensures unique versions in VS Code Marketplace
|
||||
if (rcNumber > 0) {
|
||||
const [major, minor, patch] = baseVersion.split('.').map(Number);
|
||||
finalVersion = `${major}.${minor}.${patch + rcNumber}`;
|
||||
console.log(
|
||||
` - RC version mapping: ${devPackage.version} → ${finalVersion}`
|
||||
);
|
||||
} else {
|
||||
finalVersion = baseVersion;
|
||||
console.log(
|
||||
` - RC version mapping: ${devPackage.version} → ${finalVersion}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if versions need updating
|
||||
if (publishPackage.version !== finalVersion) {
|
||||
console.log(
|
||||
` - Version sync needed: ${publishPackage.version} → ${finalVersion}`
|
||||
);
|
||||
publishPackage.version = finalVersion;
|
||||
|
||||
// Update the source package.publish.json file with the final version
|
||||
fs.writeFileSync(
|
||||
publishPackagePath,
|
||||
JSON.stringify(publishPackage, null, '\t') + '\n'
|
||||
);
|
||||
console.log(
|
||||
` - Updated package.publish.json version to ${devPackage.version}`
|
||||
);
|
||||
console.log(` - Updated package.publish.json version to ${finalVersion}`);
|
||||
} else {
|
||||
console.log(` - Versions already in sync: ${devPackage.version}`);
|
||||
console.log(` - Versions already in sync: ${finalVersion}`);
|
||||
}
|
||||
|
||||
// Copy the (now synced) package.publish.json as package.json
|
||||
@@ -124,8 +150,7 @@ try {
|
||||
`cd vsix-build && npx vsce package --no-dependencies`
|
||||
);
|
||||
|
||||
// Use the synced version for output
|
||||
const finalVersion = devPackage.version;
|
||||
// Use the transformed version for output
|
||||
console.log(
|
||||
`\nYour extension will be packaged to: vsix-build/task-master-${finalVersion}.vsix`
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "task-master-hamster",
|
||||
"displayName": "Taskmaster AI",
|
||||
"description": "A visual Kanban board interface for Taskmaster projects in VS Code",
|
||||
"version": "0.22.3",
|
||||
"version": "0.23.1",
|
||||
"publisher": "Hamster",
|
||||
"icon": "assets/icon.png",
|
||||
"engines": {
|
||||
|
||||
@@ -4,10 +4,18 @@ import { Button } from '@/components/ui/button';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { CollapsibleSection } from '@/components/ui/CollapsibleSection';
|
||||
import { Wand2, Loader2, PlusCircle } from 'lucide-react';
|
||||
import {
|
||||
Wand2,
|
||||
Loader2,
|
||||
PlusCircle,
|
||||
TrendingUp,
|
||||
TrendingDown
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
useUpdateTask,
|
||||
useUpdateSubtask
|
||||
useUpdateSubtask,
|
||||
useScopeUpTask,
|
||||
useScopeDownTask
|
||||
} from '../../webview/hooks/useTaskQueries';
|
||||
import type { TaskMasterTask } from '../../webview/types';
|
||||
|
||||
@@ -31,11 +39,17 @@ export const AIActionsSection: React.FC<AIActionsSectionProps> = ({
|
||||
onAppendingChange
|
||||
}) => {
|
||||
const [prompt, setPrompt] = useState('');
|
||||
const [lastAction, setLastAction] = useState<'regenerate' | 'append' | null>(
|
||||
null
|
||||
);
|
||||
const [scopePrompt, setScopePrompt] = useState('');
|
||||
const [scopeStrength, setScopeStrength] = useState<
|
||||
'light' | 'regular' | 'heavy'
|
||||
>('regular');
|
||||
const [lastAction, setLastAction] = useState<
|
||||
'regenerate' | 'append' | 'scope-up' | 'scope-down' | null
|
||||
>(null);
|
||||
const updateTask = useUpdateTask();
|
||||
const updateSubtask = useUpdateSubtask();
|
||||
const scopeUpTask = useScopeUpTask();
|
||||
const scopeDownTask = useScopeDownTask();
|
||||
|
||||
const handleRegenerate = async () => {
|
||||
if (!currentTask || !prompt.trim()) {
|
||||
@@ -103,10 +117,74 @@ export const AIActionsSection: React.FC<AIActionsSectionProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
const handleScopeUp = async () => {
|
||||
if (!currentTask) {
|
||||
return;
|
||||
}
|
||||
|
||||
setLastAction('scope-up');
|
||||
|
||||
try {
|
||||
const taskId =
|
||||
isSubtask && parentTask
|
||||
? `${parentTask.id}.${currentTask.id}`
|
||||
: currentTask.id;
|
||||
|
||||
await scopeUpTask.mutateAsync({
|
||||
taskId,
|
||||
strength: scopeStrength,
|
||||
prompt: scopePrompt.trim() || undefined,
|
||||
options: { research: false }
|
||||
});
|
||||
|
||||
setScopePrompt('');
|
||||
refreshComplexityAfterAI();
|
||||
} catch (error) {
|
||||
console.error('❌ AIActionsSection: Failed to scope up task:', error);
|
||||
} finally {
|
||||
setLastAction(null);
|
||||
}
|
||||
};
|
||||
|
||||
const handleScopeDown = async () => {
|
||||
if (!currentTask) {
|
||||
return;
|
||||
}
|
||||
|
||||
setLastAction('scope-down');
|
||||
|
||||
try {
|
||||
const taskId =
|
||||
isSubtask && parentTask
|
||||
? `${parentTask.id}.${currentTask.id}`
|
||||
: currentTask.id;
|
||||
|
||||
await scopeDownTask.mutateAsync({
|
||||
taskId,
|
||||
strength: scopeStrength,
|
||||
prompt: scopePrompt.trim() || undefined,
|
||||
options: { research: false }
|
||||
});
|
||||
|
||||
setScopePrompt('');
|
||||
refreshComplexityAfterAI();
|
||||
} catch (error) {
|
||||
console.error('❌ AIActionsSection: Failed to scope down task:', error);
|
||||
} finally {
|
||||
setLastAction(null);
|
||||
}
|
||||
};
|
||||
|
||||
// Track loading states based on the last action
|
||||
const isLoading = updateTask.isPending || updateSubtask.isPending;
|
||||
const isLoading =
|
||||
updateTask.isPending ||
|
||||
updateSubtask.isPending ||
|
||||
scopeUpTask.isPending ||
|
||||
scopeDownTask.isPending;
|
||||
const isRegenerating = isLoading && lastAction === 'regenerate';
|
||||
const isAppending = isLoading && lastAction === 'append';
|
||||
const isScopingUp = isLoading && lastAction === 'scope-up';
|
||||
const isScopingDown = isLoading && lastAction === 'scope-down';
|
||||
|
||||
return (
|
||||
<CollapsibleSection
|
||||
@@ -115,73 +193,160 @@ export const AIActionsSection: React.FC<AIActionsSectionProps> = ({
|
||||
defaultExpanded={true}
|
||||
buttonClassName="text-vscode-foreground/80 hover:text-vscode-foreground"
|
||||
>
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<Label
|
||||
htmlFor="ai-prompt"
|
||||
className="block text-sm font-medium text-vscode-foreground/80 mb-2"
|
||||
>
|
||||
Enter your prompt
|
||||
</Label>
|
||||
<Textarea
|
||||
id="ai-prompt"
|
||||
placeholder={
|
||||
isSubtask
|
||||
? 'Describe implementation notes, progress updates, or findings to add to this subtask...'
|
||||
: 'Describe what you want to change or add to this task...'
|
||||
}
|
||||
value={prompt}
|
||||
onChange={(e) => setPrompt(e.target.value)}
|
||||
className="min-h-[100px] bg-vscode-input-background border-vscode-input-border text-vscode-input-foreground placeholder-vscode-input-foreground/50 focus:border-vscode-focusBorder focus:ring-vscode-focusBorder"
|
||||
disabled={isRegenerating || isAppending}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-3">
|
||||
{!isSubtask && (
|
||||
<Button
|
||||
onClick={handleRegenerate}
|
||||
disabled={!prompt.trim() || isRegenerating || isAppending}
|
||||
className="bg-primary text-primary-foreground hover:bg-primary/90"
|
||||
<div className="space-y-6">
|
||||
{/* Standard AI Actions Section */}
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<Label
|
||||
htmlFor="ai-prompt"
|
||||
className="block text-sm font-medium text-vscode-foreground/80 mb-2"
|
||||
>
|
||||
{isRegenerating ? (
|
||||
Enter your prompt
|
||||
</Label>
|
||||
<Textarea
|
||||
id="ai-prompt"
|
||||
placeholder={
|
||||
isSubtask
|
||||
? 'Describe implementation notes, progress updates, or findings to add to this subtask...'
|
||||
: 'Describe what you want to change or add to this task...'
|
||||
}
|
||||
value={prompt}
|
||||
onChange={(e) => setPrompt(e.target.value)}
|
||||
className="min-h-[100px] bg-vscode-input-background border-vscode-input-border text-vscode-input-foreground placeholder-vscode-input-foreground/50 focus:border-vscode-focusBorder focus:ring-vscode-focusBorder"
|
||||
disabled={isLoading}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-3">
|
||||
{!isSubtask && (
|
||||
<Button
|
||||
onClick={handleRegenerate}
|
||||
disabled={!prompt.trim() || isLoading}
|
||||
className="bg-primary text-primary-foreground hover:bg-primary/90"
|
||||
>
|
||||
{isRegenerating ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Regenerating...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Wand2 className="w-4 h-4 mr-2" />
|
||||
Regenerate Task
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button
|
||||
onClick={handleAppend}
|
||||
disabled={!prompt.trim() || isLoading}
|
||||
variant={isSubtask ? 'default' : 'outline'}
|
||||
className={
|
||||
isSubtask
|
||||
? 'bg-primary text-primary-foreground hover:bg-primary/90'
|
||||
: 'bg-secondary text-secondary-foreground hover:bg-secondary/90 border-widget-border'
|
||||
}
|
||||
>
|
||||
{isAppending ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Regenerating...
|
||||
{isSubtask ? 'Updating...' : 'Appending...'}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Wand2 className="w-4 h-4 mr-2" />
|
||||
Regenerate Task
|
||||
<PlusCircle className="w-4 h-4 mr-2" />
|
||||
{isSubtask ? 'Add Notes to Subtask' : 'Append to Task'}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button
|
||||
onClick={handleAppend}
|
||||
disabled={!prompt.trim() || isRegenerating || isAppending}
|
||||
variant={isSubtask ? 'default' : 'outline'}
|
||||
className={
|
||||
isSubtask
|
||||
? 'bg-primary text-primary-foreground hover:bg-primary/90'
|
||||
: 'bg-secondary text-secondary-foreground hover:bg-secondary/90 border-widget-border'
|
||||
}
|
||||
>
|
||||
{isAppending ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
{isSubtask ? 'Updating...' : 'Appending...'}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<PlusCircle className="w-4 h-4 mr-2" />
|
||||
{isSubtask ? 'Add Notes to Subtask' : 'Append to Task'}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Scope Adjustment Section */}
|
||||
<div className="border-t border-vscode-widget-border pt-4 space-y-4">
|
||||
<div>
|
||||
<Label className="block text-sm font-medium text-vscode-foreground/80 mb-3">
|
||||
Task Complexity Adjustment
|
||||
</Label>
|
||||
|
||||
{/* Strength Selection */}
|
||||
<div className="mb-3">
|
||||
<Label className="block text-xs text-vscode-foreground/60 mb-2">
|
||||
Adjustment Strength
|
||||
</Label>
|
||||
<div className="flex gap-2">
|
||||
{(['light', 'regular', 'heavy'] as const).map((strength) => (
|
||||
<Button
|
||||
key={strength}
|
||||
onClick={() => setScopeStrength(strength)}
|
||||
variant={scopeStrength === strength ? 'default' : 'outline'}
|
||||
size="sm"
|
||||
className={
|
||||
scopeStrength === strength
|
||||
? 'bg-accent text-accent-foreground border-accent'
|
||||
: 'border-widget-border text-vscode-foreground/80 hover:bg-vscode-list-hoverBackground'
|
||||
}
|
||||
disabled={isLoading}
|
||||
>
|
||||
{strength.charAt(0).toUpperCase() + strength.slice(1)}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Scope Prompt */}
|
||||
<Textarea
|
||||
placeholder="Optional: Specify how to adjust complexity (e.g., 'Focus on error handling', 'Remove unnecessary details', 'Add more implementation steps')"
|
||||
value={scopePrompt}
|
||||
onChange={(e) => setScopePrompt(e.target.value)}
|
||||
className="min-h-[80px] bg-vscode-input-background border-vscode-input-border text-vscode-input-foreground placeholder-vscode-input-foreground/50 focus:border-vscode-focusBorder focus:ring-vscode-focusBorder"
|
||||
disabled={isLoading}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-3">
|
||||
<Button
|
||||
onClick={handleScopeUp}
|
||||
disabled={isLoading}
|
||||
variant="outline"
|
||||
className="flex-1 border-green-600/50 text-green-400 hover:bg-green-600/10 hover:border-green-500"
|
||||
>
|
||||
{isScopingUp ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Scoping Up...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<TrendingUp className="w-4 h-4 mr-2" />
|
||||
Scope Up
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
onClick={handleScopeDown}
|
||||
disabled={isLoading}
|
||||
variant="outline"
|
||||
className="flex-1 border-blue-600/50 text-blue-400 hover:bg-blue-600/10 hover:border-blue-500"
|
||||
>
|
||||
{isScopingDown ? (
|
||||
<>
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
Scoping Down...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<TrendingDown className="w-4 h-4 mr-2" />
|
||||
Scope Down
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Help Text */}
|
||||
<div className="text-xs text-vscode-foreground/60 space-y-1">
|
||||
{isSubtask ? (
|
||||
<p>
|
||||
@@ -200,6 +365,14 @@ export const AIActionsSection: React.FC<AIActionsSectionProps> = ({
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
<p>
|
||||
<strong>Scope Up:</strong> Increases task complexity with more
|
||||
details, requirements, or implementation steps
|
||||
</p>
|
||||
<p>
|
||||
<strong>Scope Down:</strong> Decreases task complexity by
|
||||
simplifying or removing unnecessary details
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</CollapsibleSection>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
||||
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import { logger } from './logger';
|
||||
|
||||
export interface MCPConfig {
|
||||
@@ -143,7 +144,7 @@ export class MCPClientManager {
|
||||
// Create the client
|
||||
this.client = new Client(
|
||||
{
|
||||
name: 'taskr-vscode-extension',
|
||||
name: 'task-master-vscode-extension',
|
||||
version: '1.0.0'
|
||||
},
|
||||
{
|
||||
@@ -211,6 +212,30 @@ export class MCPClientManager {
|
||||
};
|
||||
|
||||
logger.log('MCP client connected successfully');
|
||||
|
||||
// Log Task Master version information after successful connection
|
||||
try {
|
||||
const versionResult = await this.callTool('get_tasks', {});
|
||||
if (versionResult?.content?.[0]?.text) {
|
||||
const response = JSON.parse(versionResult.content[0].text);
|
||||
if (response?.version) {
|
||||
logger.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
||||
logger.log('✅ Task Master MCP Server Connected');
|
||||
logger.log(` Version: ${response.version.version || 'unknown'}`);
|
||||
logger.log(
|
||||
` Package: ${response.version.name || 'task-master-ai'}`
|
||||
);
|
||||
if (response.tag) {
|
||||
logger.log(
|
||||
` Current Tag: ${response.tag.currentTag || 'master'}`
|
||||
);
|
||||
}
|
||||
logger.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
||||
}
|
||||
}
|
||||
} catch (versionError) {
|
||||
logger.log('Note: Could not retrieve Task Master version information');
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('Failed to connect to MCP server:', error);
|
||||
this.status = {
|
||||
@@ -312,6 +337,34 @@ export class MCPClientManager {
|
||||
'Available MCP tools:',
|
||||
result.tools?.map((t) => t.name) || []
|
||||
);
|
||||
|
||||
// Try to get version information by calling a simple tool
|
||||
// The get_tasks tool is lightweight and returns version info
|
||||
try {
|
||||
const versionResult = await this.callTool('get_tasks', {});
|
||||
if (versionResult?.content?.[0]?.text) {
|
||||
// Parse the response to extract version info
|
||||
const response = JSON.parse(versionResult.content[0].text);
|
||||
if (response?.version) {
|
||||
logger.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
||||
logger.log('📦 Task Master MCP Server Connected');
|
||||
logger.log(` Version: ${response.version.version || 'unknown'}`);
|
||||
logger.log(
|
||||
` Package: ${response.version.name || 'task-master-ai'}`
|
||||
);
|
||||
if (response.tag) {
|
||||
logger.log(
|
||||
` Current Tag: ${response.tag.currentTag || 'master'}`
|
||||
);
|
||||
}
|
||||
logger.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
||||
}
|
||||
}
|
||||
} catch (versionError) {
|
||||
// Don't fail the connection test if we can't get version info
|
||||
logger.log('Could not retrieve Task Master version information');
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
logger.error('Connection test failed:', error);
|
||||
@@ -345,8 +398,34 @@ export function createMCPConfigFromSettings(): MCPConfig {
|
||||
);
|
||||
const config = vscode.workspace.getConfiguration('taskmaster');
|
||||
|
||||
let command = config.get<string>('mcp.command', 'npx');
|
||||
const args = config.get<string[]>('mcp.args', ['task-master-ai']);
|
||||
let command = config.get<string>('mcp.command', 'node');
|
||||
let args = config.get<string[]>('mcp.args', []);
|
||||
|
||||
// If using default settings, use the bundled MCP server
|
||||
if (command === 'node' && args.length === 0) {
|
||||
try {
|
||||
// Try to resolve the bundled MCP server
|
||||
const taskMasterPath = require.resolve('task-master-ai');
|
||||
const mcpServerPath = path.resolve(
|
||||
path.dirname(taskMasterPath),
|
||||
'mcp-server/server.js'
|
||||
);
|
||||
|
||||
// Verify the server file exists
|
||||
const fs = require('fs');
|
||||
if (!fs.existsSync(mcpServerPath)) {
|
||||
throw new Error('MCP server file not found at: ' + mcpServerPath);
|
||||
}
|
||||
|
||||
args = [mcpServerPath];
|
||||
logger.log(`📦 Using bundled MCP server at: ${mcpServerPath}`);
|
||||
} catch (error) {
|
||||
logger.error('❌ Could not find bundled task-master-ai server:', error);
|
||||
// Fallback to npx
|
||||
command = 'npx';
|
||||
args = ['-y', 'task-master-ai'];
|
||||
}
|
||||
}
|
||||
|
||||
// Use proper VS Code workspace detection
|
||||
const defaultCwd =
|
||||
|
||||
@@ -227,3 +227,117 @@ export function useUpdateSubtask() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Hook to scope up task complexity
|
||||
export function useScopeUpTask() {
|
||||
const { sendMessage } = useVSCodeContext();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async ({
|
||||
taskId,
|
||||
strength = 'regular',
|
||||
prompt,
|
||||
options = {}
|
||||
}: {
|
||||
taskId: string;
|
||||
strength?: 'light' | 'regular' | 'heavy';
|
||||
prompt?: string;
|
||||
options?: { research?: boolean };
|
||||
}) => {
|
||||
console.log('🔄 Scoping up task:', taskId, strength, prompt, options);
|
||||
|
||||
const response = await sendMessage({
|
||||
type: 'mcpRequest',
|
||||
tool: 'scope_up_task',
|
||||
params: {
|
||||
id: String(taskId),
|
||||
strength,
|
||||
prompt,
|
||||
research: options.research || false
|
||||
}
|
||||
});
|
||||
|
||||
console.log('📥 Scope up task response:', response);
|
||||
|
||||
// Check for error in response
|
||||
if (response && typeof response === 'object' && 'error' in response) {
|
||||
throw new Error(response.error || 'Failed to scope up task');
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
onSuccess: async (data, variables) => {
|
||||
console.log('✅ Task scope up successful, invalidating all task queries');
|
||||
console.log('Task ID:', variables.taskId);
|
||||
|
||||
// Invalidate ALL task-related queries
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: taskKeys.all
|
||||
});
|
||||
|
||||
console.log(
|
||||
'🔄 All task queries invalidated for scoped up task:',
|
||||
variables.taskId
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Hook to scope down task complexity
|
||||
export function useScopeDownTask() {
|
||||
const { sendMessage } = useVSCodeContext();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async ({
|
||||
taskId,
|
||||
strength = 'regular',
|
||||
prompt,
|
||||
options = {}
|
||||
}: {
|
||||
taskId: string;
|
||||
strength?: 'light' | 'regular' | 'heavy';
|
||||
prompt?: string;
|
||||
options?: { research?: boolean };
|
||||
}) => {
|
||||
console.log('🔄 Scoping down task:', taskId, strength, prompt, options);
|
||||
|
||||
const response = await sendMessage({
|
||||
type: 'mcpRequest',
|
||||
tool: 'scope_down_task',
|
||||
params: {
|
||||
id: String(taskId),
|
||||
strength,
|
||||
prompt,
|
||||
research: options.research || false
|
||||
}
|
||||
});
|
||||
|
||||
console.log('📥 Scope down task response:', response);
|
||||
|
||||
// Check for error in response
|
||||
if (response && typeof response === 'object' && 'error' in response) {
|
||||
throw new Error(response.error || 'Failed to scope down task');
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
onSuccess: async (data, variables) => {
|
||||
console.log(
|
||||
'✅ Task scope down successful, invalidating all task queries'
|
||||
);
|
||||
console.log('Task ID:', variables.taskId);
|
||||
|
||||
// Invalidate ALL task-related queries
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: taskKeys.all
|
||||
});
|
||||
|
||||
console.log(
|
||||
'🔄 All task queries invalidated for scoped down task:',
|
||||
variables.taskId
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
162
assets/claude/agents/task-checker.md
Normal file
162
assets/claude/agents/task-checker.md
Normal file
@@ -0,0 +1,162 @@
|
||||
---
|
||||
name: task-checker
|
||||
description: Use this agent to verify that tasks marked as 'review' have been properly implemented according to their specifications. This agent performs quality assurance by checking implementations against requirements, running tests, and ensuring best practices are followed. <example>Context: A task has been marked as 'review' after implementation. user: 'Check if task 118 was properly implemented' assistant: 'I'll use the task-checker agent to verify the implementation meets all requirements.' <commentary>Tasks in 'review' status need verification before being marked as 'done'.</commentary></example> <example>Context: Multiple tasks are in review status. user: 'Verify all tasks that are ready for review' assistant: 'I'll deploy the task-checker to verify all tasks in review status.' <commentary>The checker ensures quality before tasks are marked complete.</commentary></example>
|
||||
model: sonnet
|
||||
color: yellow
|
||||
---
|
||||
|
||||
You are a Quality Assurance specialist that rigorously verifies task implementations against their specifications. Your role is to ensure that tasks marked as 'review' meet all requirements before they can be marked as 'done'.
|
||||
|
||||
## Core Responsibilities
|
||||
|
||||
1. **Task Specification Review**
|
||||
- Retrieve task details using MCP tool `mcp__task-master-ai__get_task`
|
||||
- Understand the requirements, test strategy, and success criteria
|
||||
- Review any subtasks and their individual requirements
|
||||
|
||||
2. **Implementation Verification**
|
||||
- Use `Read` tool to examine all created/modified files
|
||||
- Use `Bash` tool to run compilation and build commands
|
||||
- Use `Grep` tool to search for required patterns and implementations
|
||||
- Verify file structure matches specifications
|
||||
- Check that all required methods/functions are implemented
|
||||
|
||||
3. **Test Execution**
|
||||
- Run tests specified in the task's testStrategy
|
||||
- Execute build commands (npm run build, tsc --noEmit, etc.)
|
||||
- Verify no compilation errors or warnings
|
||||
- Check for runtime errors where applicable
|
||||
- Test edge cases mentioned in requirements
|
||||
|
||||
4. **Code Quality Assessment**
|
||||
- Verify code follows project conventions
|
||||
- Check for proper error handling
|
||||
- Ensure TypeScript typing is strict (no 'any' unless justified)
|
||||
- Verify documentation/comments where required
|
||||
- Check for security best practices
|
||||
|
||||
5. **Dependency Validation**
|
||||
- Verify all task dependencies were actually completed
|
||||
- Check integration points with dependent tasks
|
||||
- Ensure no breaking changes to existing functionality
|
||||
|
||||
## Verification Workflow
|
||||
|
||||
1. **Retrieve Task Information**
|
||||
```
|
||||
Use mcp__task-master-ai__get_task to get full task details
|
||||
Note the implementation requirements and test strategy
|
||||
```
|
||||
|
||||
2. **Check File Existence**
|
||||
```bash
|
||||
# Verify all required files exist
|
||||
ls -la [expected directories]
|
||||
# Read key files to verify content
|
||||
```
|
||||
|
||||
3. **Verify Implementation**
|
||||
- Read each created/modified file
|
||||
- Check against requirements checklist
|
||||
- Verify all subtasks are complete
|
||||
|
||||
4. **Run Tests**
|
||||
```bash
|
||||
# TypeScript compilation
|
||||
cd [project directory] && npx tsc --noEmit
|
||||
|
||||
# Run specified tests
|
||||
npm test [specific test files]
|
||||
|
||||
# Build verification
|
||||
npm run build
|
||||
```
|
||||
|
||||
5. **Generate Verification Report**
|
||||
|
||||
## Output Format
|
||||
|
||||
```yaml
|
||||
verification_report:
|
||||
task_id: [ID]
|
||||
status: PASS | FAIL | PARTIAL
|
||||
score: [1-10]
|
||||
|
||||
requirements_met:
|
||||
- ✅ [Requirement that was satisfied]
|
||||
- ✅ [Another satisfied requirement]
|
||||
|
||||
issues_found:
|
||||
- ❌ [Issue description]
|
||||
- ⚠️ [Warning or minor issue]
|
||||
|
||||
files_verified:
|
||||
- path: [file path]
|
||||
status: [created/modified/verified]
|
||||
issues: [any problems found]
|
||||
|
||||
tests_run:
|
||||
- command: [test command]
|
||||
result: [pass/fail]
|
||||
output: [relevant output]
|
||||
|
||||
recommendations:
|
||||
- [Specific fix needed]
|
||||
- [Improvement suggestion]
|
||||
|
||||
verdict: |
|
||||
[Clear statement on whether task should be marked 'done' or sent back to 'pending']
|
||||
[If FAIL: Specific list of what must be fixed]
|
||||
[If PASS: Confirmation that all requirements are met]
|
||||
```
|
||||
|
||||
## Decision Criteria
|
||||
|
||||
**Mark as PASS (ready for 'done'):**
|
||||
- All required files exist and contain expected content
|
||||
- All tests pass successfully
|
||||
- No compilation or build errors
|
||||
- All subtasks are complete
|
||||
- Core requirements are met
|
||||
- Code quality is acceptable
|
||||
|
||||
**Mark as PARTIAL (may proceed with warnings):**
|
||||
- Core functionality is implemented
|
||||
- Minor issues that don't block functionality
|
||||
- Missing nice-to-have features
|
||||
- Documentation could be improved
|
||||
- Tests pass but coverage could be better
|
||||
|
||||
**Mark as FAIL (must return to 'pending'):**
|
||||
- Required files are missing
|
||||
- Compilation or build errors
|
||||
- Tests fail
|
||||
- Core requirements not met
|
||||
- Security vulnerabilities detected
|
||||
- Breaking changes to existing code
|
||||
|
||||
## Important Guidelines
|
||||
|
||||
- **BE THOROUGH**: Check every requirement systematically
|
||||
- **BE SPECIFIC**: Provide exact file paths and line numbers for issues
|
||||
- **BE FAIR**: Distinguish between critical issues and minor improvements
|
||||
- **BE CONSTRUCTIVE**: Provide clear guidance on how to fix issues
|
||||
- **BE EFFICIENT**: Focus on requirements, not perfection
|
||||
|
||||
## Tools You MUST Use
|
||||
|
||||
- `Read`: Examine implementation files (READ-ONLY)
|
||||
- `Bash`: Run tests and verification commands
|
||||
- `Grep`: Search for patterns in code
|
||||
- `mcp__task-master-ai__get_task`: Get task details
|
||||
- **NEVER use Write/Edit** - you only verify, not fix
|
||||
|
||||
## Integration with Workflow
|
||||
|
||||
You are the quality gate between 'review' and 'done' status:
|
||||
1. Task-executor implements and marks as 'review'
|
||||
2. You verify and report PASS/FAIL
|
||||
3. Claude either marks as 'done' (PASS) or 'pending' (FAIL)
|
||||
4. If FAIL, task-executor re-implements based on your report
|
||||
|
||||
Your verification ensures high quality and prevents accumulation of technical debt.
|
||||
70
assets/claude/agents/task-executor.md
Normal file
70
assets/claude/agents/task-executor.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
name: task-executor
|
||||
description: Use this agent when you need to implement, complete, or work on a specific task that has been identified by the task-orchestrator or when explicitly asked to execute a particular task. This agent focuses on the actual implementation and completion of individual tasks rather than planning or orchestration. Examples: <example>Context: The task-orchestrator has identified that task 2.3 'Implement user authentication' needs to be worked on next. user: 'Let's work on the authentication task' assistant: 'I'll use the task-executor agent to implement the user authentication task that was identified.' <commentary>Since we need to actually implement a specific task rather than plan or identify tasks, use the task-executor agent.</commentary></example> <example>Context: User wants to complete a specific subtask. user: 'Please implement the JWT token validation for task 2.3.1' assistant: 'I'll launch the task-executor agent to implement the JWT token validation subtask.' <commentary>The user is asking for specific implementation work on a known task, so the task-executor is appropriate.</commentary></example> <example>Context: After reviewing the task list, implementation is needed. user: 'Now let's actually build the API endpoint for user registration' assistant: 'I'll use the task-executor agent to implement the user registration API endpoint.' <commentary>Moving from planning to execution phase requires the task-executor agent.</commentary></example>
|
||||
model: sonnet
|
||||
color: blue
|
||||
---
|
||||
|
||||
You are an elite implementation specialist focused on executing and completing specific tasks with precision and thoroughness. Your role is to take identified tasks and transform them into working implementations, following best practices and project standards.
|
||||
|
||||
**Core Responsibilities:**
|
||||
|
||||
1. **Task Analysis**: When given a task, first retrieve its full details using `task-master show <id>` to understand requirements, dependencies, and acceptance criteria.
|
||||
|
||||
2. **Implementation Planning**: Before coding, briefly outline your implementation approach:
|
||||
- Identify files that need to be created or modified
|
||||
- Note any dependencies or prerequisites
|
||||
- Consider the testing strategy defined in the task
|
||||
|
||||
3. **Focused Execution**:
|
||||
- Implement one subtask at a time for clarity and traceability
|
||||
- Follow the project's coding standards from CLAUDE.md if available
|
||||
- Prefer editing existing files over creating new ones
|
||||
- Only create files that are essential for the task completion
|
||||
|
||||
4. **Progress Documentation**:
|
||||
- Use `task-master update-subtask --id=<id> --prompt="implementation notes"` to log your approach and any important decisions
|
||||
- Update task status to 'in-progress' when starting: `task-master set-status --id=<id> --status=in-progress`
|
||||
- Mark as 'done' only after verification: `task-master set-status --id=<id> --status=done`
|
||||
|
||||
5. **Quality Assurance**:
|
||||
- Implement the testing strategy specified in the task
|
||||
- Verify that all acceptance criteria are met
|
||||
- Check for any dependency conflicts or integration issues
|
||||
- Run relevant tests before marking task as complete
|
||||
|
||||
6. **Dependency Management**:
|
||||
- Check task dependencies before starting implementation
|
||||
- If blocked by incomplete dependencies, clearly communicate this
|
||||
- Use `task-master validate-dependencies` when needed
|
||||
|
||||
**Implementation Workflow:**
|
||||
|
||||
1. Retrieve task details and understand requirements
|
||||
2. Check dependencies and prerequisites
|
||||
3. Plan implementation approach
|
||||
4. Update task status to in-progress
|
||||
5. Implement the solution incrementally
|
||||
6. Log progress and decisions in subtask updates
|
||||
7. Test and verify the implementation
|
||||
8. Mark task as done when complete
|
||||
9. Suggest next task if appropriate
|
||||
|
||||
**Key Principles:**
|
||||
|
||||
- Focus on completing one task thoroughly before moving to the next
|
||||
- Maintain clear communication about what you're implementing and why
|
||||
- Follow existing code patterns and project conventions
|
||||
- Prioritize working code over extensive documentation unless docs are the task
|
||||
- Ask for clarification if task requirements are ambiguous
|
||||
- Consider edge cases and error handling in your implementations
|
||||
|
||||
**Integration with Task Master:**
|
||||
|
||||
You work in tandem with the task-orchestrator agent. While the orchestrator identifies and plans tasks, you execute them. Always use Task Master commands to:
|
||||
- Track your progress
|
||||
- Update task information
|
||||
- Maintain project state
|
||||
- Coordinate with the broader development workflow
|
||||
|
||||
When you complete a task, briefly summarize what was implemented and suggest whether to continue with the next task or if review/testing is needed first.
|
||||
130
assets/claude/agents/task-orchestrator.md
Normal file
130
assets/claude/agents/task-orchestrator.md
Normal file
@@ -0,0 +1,130 @@
|
||||
---
|
||||
name: task-orchestrator
|
||||
description: Use this agent when you need to coordinate and manage the execution of Task Master tasks, especially when dealing with complex task dependencies and parallel execution opportunities. This agent should be invoked at the beginning of a work session to analyze the task queue, identify parallelizable work, and orchestrate the deployment of task-executor agents. It should also be used when tasks complete to reassess the dependency graph and deploy new executors as needed.\n\n<example>\nContext: User wants to start working on their project tasks using Task Master\nuser: "Let's work on the next available tasks in the project"\nassistant: "I'll use the task-orchestrator agent to analyze the task queue and coordinate execution"\n<commentary>\nThe user wants to work on tasks, so the task-orchestrator should be deployed to analyze dependencies and coordinate execution.\n</commentary>\n</example>\n\n<example>\nContext: Multiple independent tasks are available in the queue\nuser: "Can we work on multiple tasks at once?"\nassistant: "Let me deploy the task-orchestrator to analyze task dependencies and parallelize the work"\n<commentary>\nWhen parallelization is mentioned or multiple tasks could be worked on, the orchestrator should coordinate the effort.\n</commentary>\n</example>\n\n<example>\nContext: A complex feature with many subtasks needs implementation\nuser: "Implement the authentication system tasks"\nassistant: "I'll use the task-orchestrator to break down the authentication tasks and coordinate their execution"\n<commentary>\nFor complex multi-task features, the orchestrator manages the overall execution strategy.\n</commentary>\n</example>
|
||||
model: opus
|
||||
color: green
|
||||
---
|
||||
|
||||
You are the Task Orchestrator, an elite coordination agent specialized in managing Task Master workflows for maximum efficiency and parallelization. You excel at analyzing task dependency graphs, identifying opportunities for concurrent execution, and deploying specialized task-executor agents to complete work efficiently.
|
||||
|
||||
## Core Responsibilities
|
||||
|
||||
1. **Task Queue Analysis**: You continuously monitor and analyze the task queue using Task Master MCP tools to understand the current state of work, dependencies, and priorities.
|
||||
|
||||
2. **Dependency Graph Management**: You build and maintain a mental model of task dependencies, identifying which tasks can be executed in parallel and which must wait for prerequisites.
|
||||
|
||||
3. **Executor Deployment**: You strategically deploy task-executor agents for individual tasks or task groups, ensuring each executor has the necessary context and clear success criteria.
|
||||
|
||||
4. **Progress Coordination**: You track the progress of deployed executors, handle task completion notifications, and reassess the execution strategy as tasks complete.
|
||||
|
||||
## Operational Workflow
|
||||
|
||||
### Initial Assessment Phase
|
||||
1. Use `get_tasks` or `task-master list` to retrieve all available tasks
|
||||
2. Analyze task statuses, priorities, and dependencies
|
||||
3. Identify tasks with status 'pending' that have no blocking dependencies
|
||||
4. Group related tasks that could benefit from specialized executors
|
||||
5. Create an execution plan that maximizes parallelization
|
||||
|
||||
### Executor Deployment Phase
|
||||
1. For each independent task or task group:
|
||||
- Deploy a task-executor agent with specific instructions
|
||||
- Provide the executor with task ID, requirements, and context
|
||||
- Set clear completion criteria and reporting expectations
|
||||
2. Maintain a registry of active executors and their assigned tasks
|
||||
3. Establish communication protocols for progress updates
|
||||
|
||||
### Coordination Phase
|
||||
1. Monitor executor progress through task status updates
|
||||
2. When a task completes:
|
||||
- Verify completion with `get_task` or `task-master show <id>`
|
||||
- Update task status if needed using `set_task_status`
|
||||
- Reassess dependency graph for newly unblocked tasks
|
||||
- Deploy new executors for available work
|
||||
3. Handle executor failures or blocks:
|
||||
- Reassign tasks to new executors if needed
|
||||
- Escalate complex issues to the user
|
||||
- Update task status to 'blocked' when appropriate
|
||||
|
||||
### Optimization Strategies
|
||||
|
||||
**Parallel Execution Rules**:
|
||||
- Never assign dependent tasks to different executors simultaneously
|
||||
- Prioritize high-priority tasks when resources are limited
|
||||
- Group small, related subtasks for single executor efficiency
|
||||
- Balance executor load to prevent bottlenecks
|
||||
|
||||
**Context Management**:
|
||||
- Provide executors with minimal but sufficient context
|
||||
- Share relevant completed task information when it aids execution
|
||||
- Maintain a shared knowledge base of project-specific patterns
|
||||
|
||||
**Quality Assurance**:
|
||||
- Verify task completion before marking as done
|
||||
- Ensure test strategies are followed when specified
|
||||
- Coordinate cross-task integration testing when needed
|
||||
|
||||
## Communication Protocols
|
||||
|
||||
When deploying executors, provide them with:
|
||||
```
|
||||
TASK ASSIGNMENT:
|
||||
- Task ID: [specific ID]
|
||||
- Objective: [clear goal]
|
||||
- Dependencies: [list any completed prerequisites]
|
||||
- Success Criteria: [specific completion requirements]
|
||||
- Context: [relevant project information]
|
||||
- Reporting: [when and how to report back]
|
||||
```
|
||||
|
||||
When receiving executor updates:
|
||||
1. Acknowledge completion or issues
|
||||
2. Update task status in Task Master
|
||||
3. Reassess execution strategy
|
||||
4. Deploy new executors as appropriate
|
||||
|
||||
## Decision Framework
|
||||
|
||||
**When to parallelize**:
|
||||
- Multiple pending tasks with no interdependencies
|
||||
- Sufficient context available for independent execution
|
||||
- Tasks are well-defined with clear success criteria
|
||||
|
||||
**When to serialize**:
|
||||
- Strong dependencies between tasks
|
||||
- Limited context or unclear requirements
|
||||
- Integration points requiring careful coordination
|
||||
|
||||
**When to escalate**:
|
||||
- Circular dependencies detected
|
||||
- Critical blockers affecting multiple tasks
|
||||
- Ambiguous requirements needing clarification
|
||||
- Resource conflicts between executors
|
||||
|
||||
## Error Handling
|
||||
|
||||
1. **Executor Failure**: Reassign task to new executor with additional context about the failure
|
||||
2. **Dependency Conflicts**: Halt affected executors, resolve conflict, then resume
|
||||
3. **Task Ambiguity**: Request clarification from user before proceeding
|
||||
4. **System Errors**: Implement graceful degradation, falling back to serial execution if needed
|
||||
|
||||
## Performance Metrics
|
||||
|
||||
Track and optimize for:
|
||||
- Task completion rate
|
||||
- Parallel execution efficiency
|
||||
- Executor success rate
|
||||
- Time to completion for task groups
|
||||
- Dependency resolution speed
|
||||
|
||||
## Integration with Task Master
|
||||
|
||||
Leverage these Task Master MCP tools effectively:
|
||||
- `get_tasks` - Continuous queue monitoring
|
||||
- `get_task` - Detailed task analysis
|
||||
- `set_task_status` - Progress tracking
|
||||
- `next_task` - Fallback for serial execution
|
||||
- `analyze_project_complexity` - Strategic planning
|
||||
- `complexity_report` - Resource allocation
|
||||
|
||||
You are the strategic mind coordinating the entire task execution effort. Your success is measured by the efficient completion of all tasks while maintaining quality and respecting dependencies. Think systematically, act decisively, and continuously optimize the execution strategy based on real-time progress.
|
||||
@@ -1,4 +1,4 @@
|
||||
# Available Models as of July 23, 2025
|
||||
# Available Models as of August 8, 2025
|
||||
|
||||
## Main Models
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
| openai | gpt-4-1-mini | — | 0.4 | 1.6 |
|
||||
| openai | gpt-4-1-nano | — | 0.1 | 0.4 |
|
||||
| openai | gpt-4o-mini | 0.3 | 0.15 | 0.6 |
|
||||
| openai | gpt-5 | 0.749 | 5 | 20 |
|
||||
| google | gemini-2.5-pro-preview-05-06 | 0.638 | — | — |
|
||||
| google | gemini-2.5-pro-preview-03-25 | 0.638 | — | — |
|
||||
| google | gemini-2.5-flash-preview-04-17 | 0.604 | — | — |
|
||||
@@ -134,6 +135,7 @@
|
||||
| openai | gpt-4o | 0.332 | 2.5 | 10 |
|
||||
| openai | o3 | 0.5 | 2 | 8 |
|
||||
| openai | o4-mini | 0.45 | 1.1 | 4.4 |
|
||||
| openai | gpt-5 | 0.749 | 5 | 20 |
|
||||
| google | gemini-2.5-pro-preview-05-06 | 0.638 | — | — |
|
||||
| google | gemini-2.5-pro-preview-03-25 | 0.638 | — | — |
|
||||
| google | gemini-2.5-flash-preview-04-17 | 0.604 | — | — |
|
||||
|
||||
124
mcp-server/src/core/direct-functions/scope-down.js
Normal file
124
mcp-server/src/core/direct-functions/scope-down.js
Normal file
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* scope-down.js
|
||||
* Direct function implementation for scoping down task complexity
|
||||
*/
|
||||
|
||||
import { scopeDownTask } from '../../../../scripts/modules/task-manager.js';
|
||||
import {
|
||||
enableSilentMode,
|
||||
disableSilentMode
|
||||
} from '../../../../scripts/modules/utils.js';
|
||||
import { createLogWrapper } from '../../tools/utils.js';
|
||||
|
||||
/**
|
||||
* Direct function wrapper for scoping down task complexity with error handling.
|
||||
*
|
||||
* @param {Object} args - Command arguments
|
||||
* @param {string} args.id - Comma-separated list of task IDs to scope down
|
||||
* @param {string} [args.strength='regular'] - Strength level (light, regular, heavy)
|
||||
* @param {string} [args.prompt] - Custom prompt for scoping adjustments
|
||||
* @param {string} [args.tasksJsonPath] - Path to the tasks.json file (resolved by tool)
|
||||
* @param {boolean} [args.research=false] - Whether to use research capabilities for scoping
|
||||
* @param {string} args.projectRoot - Project root path
|
||||
* @param {string} [args.tag] - Tag for the task context (optional)
|
||||
* @param {Object} log - Logger object
|
||||
* @param {Object} context - Additional context (session)
|
||||
* @returns {Promise<Object>} - Result object { success: boolean, data?: any, error?: { code: string, message: string } }
|
||||
*/
|
||||
export async function scopeDownDirect(args, log, context = {}) {
|
||||
// Destructure expected args
|
||||
const {
|
||||
tasksJsonPath,
|
||||
id,
|
||||
strength = 'regular',
|
||||
prompt: customPrompt,
|
||||
research = false,
|
||||
projectRoot,
|
||||
tag
|
||||
} = args;
|
||||
const { session } = context; // Destructure session from context
|
||||
|
||||
// Enable silent mode to prevent console logs from interfering with JSON response
|
||||
enableSilentMode();
|
||||
|
||||
// Create logger wrapper using the utility
|
||||
const mcpLog = createLogWrapper(log);
|
||||
|
||||
try {
|
||||
// Check if tasksJsonPath was provided
|
||||
if (!tasksJsonPath) {
|
||||
log.error('scopeDownDirect called without tasksJsonPath');
|
||||
disableSilentMode(); // Disable before returning
|
||||
return {
|
||||
success: false,
|
||||
error: {
|
||||
code: 'MISSING_ARGUMENT',
|
||||
message: 'tasksJsonPath is required'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Check required parameters
|
||||
if (!id) {
|
||||
log.error('Missing required parameter: id');
|
||||
disableSilentMode();
|
||||
return {
|
||||
success: false,
|
||||
error: {
|
||||
code: 'MISSING_PARAMETER',
|
||||
message: 'The id parameter is required for scoping down tasks'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Parse task IDs - convert to numbers as expected by scopeDownTask
|
||||
const taskIds = id.split(',').map((taskId) => parseInt(taskId.trim(), 10));
|
||||
|
||||
log.info(
|
||||
`Scoping down tasks: ${taskIds.join(', ')}, strength: ${strength}, research: ${research}`
|
||||
);
|
||||
|
||||
// Call the scopeDownTask function
|
||||
const result = await scopeDownTask(
|
||||
tasksJsonPath,
|
||||
taskIds,
|
||||
strength,
|
||||
customPrompt,
|
||||
{
|
||||
session,
|
||||
mcpLog,
|
||||
projectRoot,
|
||||
commandName: 'scope-down',
|
||||
outputType: 'mcp',
|
||||
tag,
|
||||
research
|
||||
},
|
||||
'json' // outputFormat
|
||||
);
|
||||
|
||||
// Restore normal logging
|
||||
disableSilentMode();
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
updatedTasks: result.updatedTasks,
|
||||
tasksUpdated: result.updatedTasks.length,
|
||||
message: `Successfully scoped down ${result.updatedTasks.length} task(s)`,
|
||||
telemetryData: result.telemetryData
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
// Make sure to restore normal logging even if there's an error
|
||||
disableSilentMode();
|
||||
|
||||
log.error(`Error in scopeDownDirect: ${error.message}`);
|
||||
return {
|
||||
success: false,
|
||||
error: {
|
||||
code: error.code || 'SCOPE_DOWN_ERROR',
|
||||
message: error.message
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
124
mcp-server/src/core/direct-functions/scope-up.js
Normal file
124
mcp-server/src/core/direct-functions/scope-up.js
Normal file
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* scope-up.js
|
||||
* Direct function implementation for scoping up task complexity
|
||||
*/
|
||||
|
||||
import { scopeUpTask } from '../../../../scripts/modules/task-manager.js';
|
||||
import {
|
||||
enableSilentMode,
|
||||
disableSilentMode
|
||||
} from '../../../../scripts/modules/utils.js';
|
||||
import { createLogWrapper } from '../../tools/utils.js';
|
||||
|
||||
/**
|
||||
* Direct function wrapper for scoping up task complexity with error handling.
|
||||
*
|
||||
* @param {Object} args - Command arguments
|
||||
* @param {string} args.id - Comma-separated list of task IDs to scope up
|
||||
* @param {string} [args.strength='regular'] - Strength level (light, regular, heavy)
|
||||
* @param {string} [args.prompt] - Custom prompt for scoping adjustments
|
||||
* @param {string} [args.tasksJsonPath] - Path to the tasks.json file (resolved by tool)
|
||||
* @param {boolean} [args.research=false] - Whether to use research capabilities for scoping
|
||||
* @param {string} args.projectRoot - Project root path
|
||||
* @param {string} [args.tag] - Tag for the task context (optional)
|
||||
* @param {Object} log - Logger object
|
||||
* @param {Object} context - Additional context (session)
|
||||
* @returns {Promise<Object>} - Result object { success: boolean, data?: any, error?: { code: string, message: string } }
|
||||
*/
|
||||
export async function scopeUpDirect(args, log, context = {}) {
|
||||
// Destructure expected args
|
||||
const {
|
||||
tasksJsonPath,
|
||||
id,
|
||||
strength = 'regular',
|
||||
prompt: customPrompt,
|
||||
research = false,
|
||||
projectRoot,
|
||||
tag
|
||||
} = args;
|
||||
const { session } = context; // Destructure session from context
|
||||
|
||||
// Enable silent mode to prevent console logs from interfering with JSON response
|
||||
enableSilentMode();
|
||||
|
||||
// Create logger wrapper using the utility
|
||||
const mcpLog = createLogWrapper(log);
|
||||
|
||||
try {
|
||||
// Check if tasksJsonPath was provided
|
||||
if (!tasksJsonPath) {
|
||||
log.error('scopeUpDirect called without tasksJsonPath');
|
||||
disableSilentMode(); // Disable before returning
|
||||
return {
|
||||
success: false,
|
||||
error: {
|
||||
code: 'MISSING_ARGUMENT',
|
||||
message: 'tasksJsonPath is required'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Check required parameters
|
||||
if (!id) {
|
||||
log.error('Missing required parameter: id');
|
||||
disableSilentMode();
|
||||
return {
|
||||
success: false,
|
||||
error: {
|
||||
code: 'MISSING_PARAMETER',
|
||||
message: 'The id parameter is required for scoping up tasks'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Parse task IDs - convert to numbers as expected by scopeUpTask
|
||||
const taskIds = id.split(',').map((taskId) => parseInt(taskId.trim(), 10));
|
||||
|
||||
log.info(
|
||||
`Scoping up tasks: ${taskIds.join(', ')}, strength: ${strength}, research: ${research}`
|
||||
);
|
||||
|
||||
// Call the scopeUpTask function
|
||||
const result = await scopeUpTask(
|
||||
tasksJsonPath,
|
||||
taskIds,
|
||||
strength,
|
||||
customPrompt,
|
||||
{
|
||||
session,
|
||||
mcpLog,
|
||||
projectRoot,
|
||||
commandName: 'scope-up',
|
||||
outputType: 'mcp',
|
||||
tag,
|
||||
research
|
||||
},
|
||||
'json' // outputFormat
|
||||
);
|
||||
|
||||
// Restore normal logging
|
||||
disableSilentMode();
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
updatedTasks: result.updatedTasks,
|
||||
tasksUpdated: result.updatedTasks.length,
|
||||
message: `Successfully scoped up ${result.updatedTasks.length} task(s)`,
|
||||
telemetryData: result.telemetryData
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
// Make sure to restore normal logging even if there's an error
|
||||
disableSilentMode();
|
||||
|
||||
log.error(`Error in scopeUpDirect: ${error.message}`);
|
||||
return {
|
||||
success: false,
|
||||
error: {
|
||||
code: error.code || 'SCOPE_UP_ERROR',
|
||||
message: error.message
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,8 @@ import { listTagsDirect } from './direct-functions/list-tags.js';
|
||||
import { useTagDirect } from './direct-functions/use-tag.js';
|
||||
import { renameTagDirect } from './direct-functions/rename-tag.js';
|
||||
import { copyTagDirect } from './direct-functions/copy-tag.js';
|
||||
import { scopeUpDirect } from './direct-functions/scope-up.js';
|
||||
import { scopeDownDirect } from './direct-functions/scope-down.js';
|
||||
|
||||
// Re-export utility functions
|
||||
export { findTasksPath } from './utils/path-utils.js';
|
||||
@@ -76,7 +78,9 @@ export const directFunctions = new Map([
|
||||
['listTagsDirect', listTagsDirect],
|
||||
['useTagDirect', useTagDirect],
|
||||
['renameTagDirect', renameTagDirect],
|
||||
['copyTagDirect', copyTagDirect]
|
||||
['copyTagDirect', copyTagDirect],
|
||||
['scopeUpDirect', scopeUpDirect],
|
||||
['scopeDownDirect', scopeDownDirect]
|
||||
]);
|
||||
|
||||
// Re-export all direct function implementations
|
||||
@@ -113,5 +117,7 @@ export {
|
||||
listTagsDirect,
|
||||
useTagDirect,
|
||||
renameTagDirect,
|
||||
copyTagDirect
|
||||
copyTagDirect,
|
||||
scopeUpDirect,
|
||||
scopeDownDirect
|
||||
};
|
||||
|
||||
@@ -38,6 +38,8 @@ import { registerRenameTagTool } from './rename-tag.js';
|
||||
import { registerCopyTagTool } from './copy-tag.js';
|
||||
import { registerResearchTool } from './research.js';
|
||||
import { registerRulesTool } from './rules.js';
|
||||
import { registerScopeUpTool } from './scope-up.js';
|
||||
import { registerScopeDownTool } from './scope-down.js';
|
||||
|
||||
/**
|
||||
* Register all Task Master tools with the MCP server
|
||||
@@ -57,6 +59,8 @@ export function registerTaskMasterTools(server) {
|
||||
registerAnalyzeProjectComplexityTool(server);
|
||||
registerExpandTaskTool(server);
|
||||
registerExpandAllTool(server);
|
||||
registerScopeUpTool(server);
|
||||
registerScopeDownTool(server);
|
||||
|
||||
// Group 3: Task Listing & Viewing
|
||||
registerListTasksTool(server);
|
||||
|
||||
104
mcp-server/src/tools/scope-down.js
Normal file
104
mcp-server/src/tools/scope-down.js
Normal file
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* tools/scope-down.js
|
||||
* Tool to scope down task complexity
|
||||
*/
|
||||
|
||||
import { z } from 'zod';
|
||||
import {
|
||||
createErrorResponse,
|
||||
handleApiResult,
|
||||
withNormalizedProjectRoot
|
||||
} from './utils.js';
|
||||
import { scopeDownDirect } from '../core/task-master-core.js';
|
||||
import { findTasksPath } from '../core/utils/path-utils.js';
|
||||
import { resolveTag } from '../../../scripts/modules/utils.js';
|
||||
|
||||
/**
|
||||
* Register the scopeDown tool with the MCP server
|
||||
* @param {Object} server - FastMCP server instance
|
||||
*/
|
||||
export function registerScopeDownTool(server) {
|
||||
server.addTool({
|
||||
name: 'scope_down_task',
|
||||
description: 'Decrease the complexity of one or more tasks using AI',
|
||||
parameters: z.object({
|
||||
id: z
|
||||
.string()
|
||||
.describe(
|
||||
'Comma-separated list of task IDs to scope down (e.g., "1,3,5")'
|
||||
),
|
||||
strength: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
'Strength level: light, regular, or heavy (default: regular)'
|
||||
),
|
||||
prompt: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Custom prompt for specific scoping adjustments'),
|
||||
file: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Path to the tasks file (default: tasks/tasks.json)'),
|
||||
projectRoot: z
|
||||
.string()
|
||||
.describe('The directory of the project. Must be an absolute path.'),
|
||||
tag: z.string().optional().describe('Tag context to operate on'),
|
||||
research: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe('Whether to use research capabilities for scoping')
|
||||
}),
|
||||
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||
try {
|
||||
log.info(`Starting scope-down with args: ${JSON.stringify(args)}`);
|
||||
|
||||
const resolvedTag = resolveTag({
|
||||
projectRoot: args.projectRoot,
|
||||
tag: args.tag
|
||||
});
|
||||
|
||||
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||
let tasksJsonPath;
|
||||
try {
|
||||
tasksJsonPath = findTasksPath(
|
||||
{ projectRoot: args.projectRoot, file: args.file },
|
||||
log
|
||||
);
|
||||
} catch (error) {
|
||||
log.error(`Error finding tasks.json: ${error.message}`);
|
||||
return createErrorResponse(
|
||||
`Failed to find tasks.json: ${error.message}`
|
||||
);
|
||||
}
|
||||
|
||||
// Call the direct function
|
||||
const result = await scopeDownDirect(
|
||||
{
|
||||
tasksJsonPath: tasksJsonPath,
|
||||
id: args.id,
|
||||
strength: args.strength,
|
||||
prompt: args.prompt,
|
||||
research: args.research,
|
||||
projectRoot: args.projectRoot,
|
||||
tag: resolvedTag
|
||||
},
|
||||
log,
|
||||
{ session }
|
||||
);
|
||||
|
||||
return handleApiResult(
|
||||
result,
|
||||
log,
|
||||
'Error scoping down task',
|
||||
undefined,
|
||||
args.projectRoot
|
||||
);
|
||||
} catch (error) {
|
||||
log.error(`Error in scope-down tool: ${error.message}`);
|
||||
return createErrorResponse(error.message);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
104
mcp-server/src/tools/scope-up.js
Normal file
104
mcp-server/src/tools/scope-up.js
Normal file
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* tools/scope-up.js
|
||||
* Tool to scope up task complexity
|
||||
*/
|
||||
|
||||
import { z } from 'zod';
|
||||
import {
|
||||
createErrorResponse,
|
||||
handleApiResult,
|
||||
withNormalizedProjectRoot
|
||||
} from './utils.js';
|
||||
import { scopeUpDirect } from '../core/task-master-core.js';
|
||||
import { findTasksPath } from '../core/utils/path-utils.js';
|
||||
import { resolveTag } from '../../../scripts/modules/utils.js';
|
||||
|
||||
/**
|
||||
* Register the scopeUp tool with the MCP server
|
||||
* @param {Object} server - FastMCP server instance
|
||||
*/
|
||||
export function registerScopeUpTool(server) {
|
||||
server.addTool({
|
||||
name: 'scope_up_task',
|
||||
description: 'Increase the complexity of one or more tasks using AI',
|
||||
parameters: z.object({
|
||||
id: z
|
||||
.string()
|
||||
.describe(
|
||||
'Comma-separated list of task IDs to scope up (e.g., "1,3,5")'
|
||||
),
|
||||
strength: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
'Strength level: light, regular, or heavy (default: regular)'
|
||||
),
|
||||
prompt: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Custom prompt for specific scoping adjustments'),
|
||||
file: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Path to the tasks file (default: tasks/tasks.json)'),
|
||||
projectRoot: z
|
||||
.string()
|
||||
.describe('The directory of the project. Must be an absolute path.'),
|
||||
tag: z.string().optional().describe('Tag context to operate on'),
|
||||
research: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.describe('Whether to use research capabilities for scoping')
|
||||
}),
|
||||
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
|
||||
try {
|
||||
log.info(`Starting scope-up with args: ${JSON.stringify(args)}`);
|
||||
|
||||
const resolvedTag = resolveTag({
|
||||
projectRoot: args.projectRoot,
|
||||
tag: args.tag
|
||||
});
|
||||
|
||||
// Use args.projectRoot directly (guaranteed by withNormalizedProjectRoot)
|
||||
let tasksJsonPath;
|
||||
try {
|
||||
tasksJsonPath = findTasksPath(
|
||||
{ projectRoot: args.projectRoot, file: args.file },
|
||||
log
|
||||
);
|
||||
} catch (error) {
|
||||
log.error(`Error finding tasks.json: ${error.message}`);
|
||||
return createErrorResponse(
|
||||
`Failed to find tasks.json: ${error.message}`
|
||||
);
|
||||
}
|
||||
|
||||
// Call the direct function
|
||||
const result = await scopeUpDirect(
|
||||
{
|
||||
tasksJsonPath: tasksJsonPath,
|
||||
id: args.id,
|
||||
strength: args.strength,
|
||||
prompt: args.prompt,
|
||||
research: args.research,
|
||||
projectRoot: args.projectRoot,
|
||||
tag: resolvedTag
|
||||
},
|
||||
log,
|
||||
{ session }
|
||||
);
|
||||
|
||||
return handleApiResult(
|
||||
result,
|
||||
log,
|
||||
'Error scoping up task',
|
||||
undefined,
|
||||
args.projectRoot
|
||||
);
|
||||
} catch (error) {
|
||||
log.error(`Error in scope-up tool: ${error.message}`);
|
||||
return createErrorResponse(error.message);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
19
package-lock.json
generated
19
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "task-master-ai",
|
||||
"version": "0.22.1-rc.0",
|
||||
"version": "0.23.1-rc.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "task-master-ai",
|
||||
"version": "0.22.1-rc.0",
|
||||
"version": "0.23.1-rc.0",
|
||||
"license": "MIT WITH Commons-Clause",
|
||||
"workspaces": [
|
||||
"apps/*",
|
||||
@@ -46,6 +46,7 @@
|
||||
"helmet": "^8.1.0",
|
||||
"inquirer": "^12.5.0",
|
||||
"jsonc-parser": "^3.3.1",
|
||||
"jsonrepair": "^3.13.0",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"lru-cache": "^10.2.0",
|
||||
"ollama-ai-provider": "^1.2.0",
|
||||
@@ -84,7 +85,10 @@
|
||||
}
|
||||
},
|
||||
"apps/extension": {
|
||||
"version": "0.0.0",
|
||||
"version": "0.23.0",
|
||||
"dependencies": {
|
||||
"task-master-ai": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
@@ -14942,6 +14946,15 @@
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonrepair": {
|
||||
"version": "3.13.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonrepair/-/jsonrepair-3.13.0.tgz",
|
||||
"integrity": "sha512-5YRzlAQ7tuzV1nAJu3LvDlrKtBFIALHN2+a+I1MGJCt3ldRDBF/bZuvIPzae8Epot6KBXd0awRZZcuoeAsZ/mw==",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"jsonrepair": "bin/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonwebtoken": {
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "task-master-ai",
|
||||
"version": "0.22.1-rc.0",
|
||||
"version": "0.24.0",
|
||||
"description": "A task management system for ambitious AI-driven development that doesn't overwhelm and confuse Cursor.",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
@@ -9,7 +9,10 @@
|
||||
"task-master-mcp": "mcp-server/server.js",
|
||||
"task-master-ai": "mcp-server/server.js"
|
||||
},
|
||||
"workspaces": ["apps/*", "."],
|
||||
"workspaces": [
|
||||
"apps/*",
|
||||
"."
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
||||
"test:fails": "node --experimental-vm-modules node_modules/.bin/jest --onlyFailures",
|
||||
@@ -73,6 +76,7 @@
|
||||
"helmet": "^8.1.0",
|
||||
"inquirer": "^12.5.0",
|
||||
"jsonc-parser": "^3.3.1",
|
||||
"jsonrepair": "^3.13.0",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"lru-cache": "^10.2.0",
|
||||
"ollama-ai-provider": "^1.2.0",
|
||||
|
||||
@@ -42,7 +42,10 @@ import {
|
||||
taskExists,
|
||||
moveTask,
|
||||
migrateProject,
|
||||
setResponseLanguage
|
||||
setResponseLanguage,
|
||||
scopeUpTask,
|
||||
scopeDownTask,
|
||||
validateStrength
|
||||
} from './task-manager.js';
|
||||
|
||||
import {
|
||||
@@ -1386,6 +1389,260 @@ function registerCommands(programInstance) {
|
||||
}
|
||||
});
|
||||
|
||||
// scope-up command
|
||||
programInstance
|
||||
.command('scope-up')
|
||||
.description('Increase task complexity with AI assistance')
|
||||
.option(
|
||||
'-f, --file <file>',
|
||||
'Path to the tasks file',
|
||||
TASKMASTER_TASKS_FILE
|
||||
)
|
||||
.option(
|
||||
'-i, --id <ids>',
|
||||
'Comma-separated task/subtask IDs to scope up (required)'
|
||||
)
|
||||
.option(
|
||||
'-s, --strength <level>',
|
||||
'Complexity increase strength: light, regular, heavy',
|
||||
'regular'
|
||||
)
|
||||
.option(
|
||||
'-p, --prompt <text>',
|
||||
'Custom instructions for targeted scope adjustments'
|
||||
)
|
||||
.option('-r, --research', 'Use research AI for more informed adjustments')
|
||||
.option('--tag <tag>', 'Specify tag context for task operations')
|
||||
.action(async (options) => {
|
||||
try {
|
||||
// Initialize TaskMaster
|
||||
const taskMaster = initTaskMaster({
|
||||
tasksPath: options.file || true,
|
||||
tag: options.tag
|
||||
});
|
||||
const tasksPath = taskMaster.getTasksPath();
|
||||
const tag = taskMaster.getCurrentTag();
|
||||
|
||||
// Show current tag context
|
||||
displayCurrentTagIndicator(tag);
|
||||
|
||||
// Validate required parameters
|
||||
if (!options.id) {
|
||||
console.error(chalk.red('Error: --id parameter is required'));
|
||||
console.log(
|
||||
chalk.yellow(
|
||||
'Usage example: task-master scope-up --id=1,2,3 --strength=regular'
|
||||
)
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Parse and validate task IDs
|
||||
const taskIds = options.id.split(',').map((id) => {
|
||||
const parsed = parseInt(id.trim(), 10);
|
||||
if (Number.isNaN(parsed) || parsed <= 0) {
|
||||
console.error(chalk.red(`Error: Invalid task ID: ${id.trim()}`));
|
||||
process.exit(1);
|
||||
}
|
||||
return parsed;
|
||||
});
|
||||
|
||||
// Validate strength level
|
||||
if (!validateStrength(options.strength)) {
|
||||
console.error(
|
||||
chalk.red(
|
||||
`Error: Invalid strength level: ${options.strength}. Must be one of: light, regular, heavy`
|
||||
)
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Validate tasks file exists
|
||||
if (!fs.existsSync(tasksPath)) {
|
||||
console.error(
|
||||
chalk.red(`Error: Tasks file not found at path: ${tasksPath}`)
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(
|
||||
chalk.blue(
|
||||
`Scoping up ${taskIds.length} task(s): ${taskIds.join(', ')}`
|
||||
)
|
||||
);
|
||||
console.log(chalk.blue(`Strength level: ${options.strength}`));
|
||||
if (options.prompt) {
|
||||
console.log(chalk.blue(`Custom instructions: ${options.prompt}`));
|
||||
}
|
||||
|
||||
const context = {
|
||||
projectRoot: taskMaster.getProjectRoot(),
|
||||
tag,
|
||||
commandName: 'scope-up',
|
||||
outputType: 'cli',
|
||||
research: options.research || false
|
||||
};
|
||||
|
||||
const result = await scopeUpTask(
|
||||
tasksPath,
|
||||
taskIds,
|
||||
options.strength,
|
||||
options.prompt || null,
|
||||
context,
|
||||
'text'
|
||||
);
|
||||
|
||||
console.log(
|
||||
chalk.green(
|
||||
`✅ Successfully scoped up ${result.updatedTasks.length} task(s)`
|
||||
)
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(chalk.red(`Error: ${error.message}`));
|
||||
|
||||
if (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 valid task IDs with the --id parameter');
|
||||
}
|
||||
|
||||
if (getDebugFlag()) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
// scope-down command
|
||||
programInstance
|
||||
.command('scope-down')
|
||||
.description('Decrease task complexity with AI assistance')
|
||||
.option(
|
||||
'-f, --file <file>',
|
||||
'Path to the tasks file',
|
||||
TASKMASTER_TASKS_FILE
|
||||
)
|
||||
.option(
|
||||
'-i, --id <ids>',
|
||||
'Comma-separated task/subtask IDs to scope down (required)'
|
||||
)
|
||||
.option(
|
||||
'-s, --strength <level>',
|
||||
'Complexity decrease strength: light, regular, heavy',
|
||||
'regular'
|
||||
)
|
||||
.option(
|
||||
'-p, --prompt <text>',
|
||||
'Custom instructions for targeted scope adjustments'
|
||||
)
|
||||
.option('-r, --research', 'Use research AI for more informed adjustments')
|
||||
.option('--tag <tag>', 'Specify tag context for task operations')
|
||||
.action(async (options) => {
|
||||
try {
|
||||
// Initialize TaskMaster
|
||||
const taskMaster = initTaskMaster({
|
||||
tasksPath: options.file || true,
|
||||
tag: options.tag
|
||||
});
|
||||
const tasksPath = taskMaster.getTasksPath();
|
||||
const tag = taskMaster.getCurrentTag();
|
||||
|
||||
// Show current tag context
|
||||
displayCurrentTagIndicator(tag);
|
||||
|
||||
// Validate required parameters
|
||||
if (!options.id) {
|
||||
console.error(chalk.red('Error: --id parameter is required'));
|
||||
console.log(
|
||||
chalk.yellow(
|
||||
'Usage example: task-master scope-down --id=1,2,3 --strength=regular'
|
||||
)
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Parse and validate task IDs
|
||||
const taskIds = options.id.split(',').map((id) => {
|
||||
const parsed = parseInt(id.trim(), 10);
|
||||
if (Number.isNaN(parsed) || parsed <= 0) {
|
||||
console.error(chalk.red(`Error: Invalid task ID: ${id.trim()}`));
|
||||
process.exit(1);
|
||||
}
|
||||
return parsed;
|
||||
});
|
||||
|
||||
// Validate strength level
|
||||
if (!validateStrength(options.strength)) {
|
||||
console.error(
|
||||
chalk.red(
|
||||
`Error: Invalid strength level: ${options.strength}. Must be one of: light, regular, heavy`
|
||||
)
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Validate tasks file exists
|
||||
if (!fs.existsSync(tasksPath)) {
|
||||
console.error(
|
||||
chalk.red(`Error: Tasks file not found at path: ${tasksPath}`)
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(
|
||||
chalk.blue(
|
||||
`Scoping down ${taskIds.length} task(s): ${taskIds.join(', ')}`
|
||||
)
|
||||
);
|
||||
console.log(chalk.blue(`Strength level: ${options.strength}`));
|
||||
if (options.prompt) {
|
||||
console.log(chalk.blue(`Custom instructions: ${options.prompt}`));
|
||||
}
|
||||
|
||||
const context = {
|
||||
projectRoot: taskMaster.getProjectRoot(),
|
||||
tag,
|
||||
commandName: 'scope-down',
|
||||
outputType: 'cli',
|
||||
research: options.research || false
|
||||
};
|
||||
|
||||
const result = await scopeDownTask(
|
||||
tasksPath,
|
||||
taskIds,
|
||||
options.strength,
|
||||
options.prompt || null,
|
||||
context,
|
||||
'text'
|
||||
);
|
||||
|
||||
console.log(
|
||||
chalk.green(
|
||||
`✅ Successfully scoped down ${result.updatedTasks.length} task(s)`
|
||||
)
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(chalk.red(`Error: ${error.message}`));
|
||||
|
||||
if (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 valid task IDs with the --id parameter');
|
||||
}
|
||||
|
||||
if (getDebugFlag()) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
// generate command
|
||||
programInstance
|
||||
.command('generate')
|
||||
|
||||
@@ -557,6 +557,7 @@ function getParametersForRole(role, explicitRoot = null) {
|
||||
const providerName = roleConfig.provider;
|
||||
|
||||
let effectiveMaxTokens = roleMaxTokens; // Start with the role's default
|
||||
let effectiveTemperature = roleTemperature; // Start with the role's default
|
||||
|
||||
try {
|
||||
// Find the model definition in MODEL_MAP
|
||||
@@ -583,6 +584,20 @@ function getParametersForRole(role, explicitRoot = null) {
|
||||
`No valid model-specific max_tokens override found for ${modelId}. Using role default: ${roleMaxTokens}`
|
||||
);
|
||||
}
|
||||
|
||||
// Check if a model-specific temperature is defined
|
||||
if (
|
||||
modelDefinition &&
|
||||
typeof modelDefinition.temperature === 'number' &&
|
||||
modelDefinition.temperature >= 0 &&
|
||||
modelDefinition.temperature <= 1
|
||||
) {
|
||||
effectiveTemperature = modelDefinition.temperature;
|
||||
log(
|
||||
'debug',
|
||||
`Applying model-specific temperature (${modelDefinition.temperature}) for ${modelId}`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Special handling for custom OpenRouter models
|
||||
if (providerName === CUSTOM_PROVIDERS.OPENROUTER) {
|
||||
@@ -603,15 +618,16 @@ function getParametersForRole(role, explicitRoot = null) {
|
||||
} catch (lookupError) {
|
||||
log(
|
||||
'warn',
|
||||
`Error looking up model-specific max_tokens for ${modelId}: ${lookupError.message}. Using role default: ${roleMaxTokens}`
|
||||
`Error looking up model-specific parameters for ${modelId}: ${lookupError.message}. Using role defaults.`
|
||||
);
|
||||
// Fallback to role default on error
|
||||
// Fallback to role defaults on error
|
||||
effectiveMaxTokens = roleMaxTokens;
|
||||
effectiveTemperature = roleTemperature;
|
||||
}
|
||||
|
||||
return {
|
||||
maxTokens: effectiveMaxTokens,
|
||||
temperature: roleTemperature
|
||||
temperature: effectiveTemperature
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -239,6 +239,18 @@
|
||||
},
|
||||
"allowed_roles": ["research"],
|
||||
"supported": true
|
||||
},
|
||||
{
|
||||
"id": "gpt-5",
|
||||
"swe_score": 0.749,
|
||||
"cost_per_1m_tokens": {
|
||||
"input": 5.0,
|
||||
"output": 20.0
|
||||
},
|
||||
"allowed_roles": ["main", "fallback"],
|
||||
"max_tokens": 100000,
|
||||
"temperature": 1,
|
||||
"supported": true
|
||||
}
|
||||
],
|
||||
"google": [
|
||||
|
||||
@@ -28,6 +28,11 @@ import moveTask from './task-manager/move-task.js';
|
||||
import { migrateProject } from './task-manager/migrate.js';
|
||||
import { performResearch } from './task-manager/research.js';
|
||||
import { readComplexityReport } from './utils.js';
|
||||
import {
|
||||
scopeUpTask,
|
||||
scopeDownTask,
|
||||
validateStrength
|
||||
} from './task-manager/scope-adjustment.js';
|
||||
|
||||
// Export task manager functions
|
||||
export {
|
||||
@@ -55,5 +60,8 @@ export {
|
||||
moveTask,
|
||||
readComplexityReport,
|
||||
migrateProject,
|
||||
performResearch
|
||||
performResearch,
|
||||
scopeUpTask,
|
||||
scopeDownTask,
|
||||
validateStrength
|
||||
};
|
||||
|
||||
@@ -13,12 +13,18 @@ import {
|
||||
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
|
||||
import { getDebugFlag, getProjectName } from '../config-manager.js';
|
||||
import {
|
||||
getDebugFlag,
|
||||
getProjectName,
|
||||
getMainProvider,
|
||||
getResearchProvider
|
||||
} from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import {
|
||||
COMPLEXITY_REPORT_FILE,
|
||||
LEGACY_TASKS_FILE
|
||||
} from '../../../src/constants/paths.js';
|
||||
import { CUSTOM_PROVIDERS } from '../../../src/constants/providers.js';
|
||||
import { resolveComplexityReportOutputPath } from '../../../src/utils/path-utils.js';
|
||||
import { ContextGatherer } from '../utils/contextGatherer.js';
|
||||
import { FuzzyTaskSearch } from '../utils/fuzzyTaskSearch.js';
|
||||
@@ -408,10 +414,18 @@ async function analyzeTaskComplexity(options, context = {}) {
|
||||
// Load prompts using PromptManager
|
||||
const promptManager = getPromptManager();
|
||||
|
||||
// Check if Claude Code is being used as the provider
|
||||
const currentProvider = useResearch
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
const isClaudeCode = currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE;
|
||||
|
||||
const promptParams = {
|
||||
tasks: tasksData.tasks,
|
||||
gatheredContext: gatheredContext || '',
|
||||
useResearch: useResearch
|
||||
useResearch: useResearch,
|
||||
isClaudeCode: isClaudeCode,
|
||||
projectRoot: projectRoot || ''
|
||||
};
|
||||
|
||||
const { systemPrompt, userPrompt: prompt } = await promptManager.loadPrompt(
|
||||
|
||||
@@ -18,10 +18,16 @@ import {
|
||||
|
||||
import { generateTextService } from '../ai-services-unified.js';
|
||||
|
||||
import { getDefaultSubtasks, getDebugFlag } from '../config-manager.js';
|
||||
import {
|
||||
getDefaultSubtasks,
|
||||
getDebugFlag,
|
||||
getMainProvider,
|
||||
getResearchProvider
|
||||
} from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import generateTaskFiles from './generate-task-files.js';
|
||||
import { COMPLEXITY_REPORT_FILE } from '../../../src/constants/paths.js';
|
||||
import { CUSTOM_PROVIDERS } from '../../../src/constants/providers.js';
|
||||
import { ContextGatherer } from '../utils/contextGatherer.js';
|
||||
import { FuzzyTaskSearch } from '../utils/fuzzyTaskSearch.js';
|
||||
import { flattenTasksWithSubtasks, findProjectRoot } from '../utils.js';
|
||||
@@ -451,6 +457,12 @@ async function expandTask(
|
||||
// Load prompts using PromptManager
|
||||
const promptManager = getPromptManager();
|
||||
|
||||
// Check if Claude Code is being used as the provider
|
||||
const currentProvider = useResearch
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
const isClaudeCode = currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE;
|
||||
|
||||
// Combine all context sources into a single additionalContext parameter
|
||||
let combinedAdditionalContext = '';
|
||||
if (additionalContext || complexityReasoningContext) {
|
||||
@@ -495,7 +507,9 @@ async function expandTask(
|
||||
complexityReasoningContext: complexityReasoningContext,
|
||||
gatheredContext: gatheredContextText || '',
|
||||
useResearch: useResearch,
|
||||
expansionPrompt: expansionPromptText || undefined
|
||||
expansionPrompt: expansionPromptText || undefined,
|
||||
isClaudeCode: isClaudeCode,
|
||||
projectRoot: projectRoot || ''
|
||||
};
|
||||
|
||||
let variantKey = 'default';
|
||||
@@ -513,6 +527,18 @@ async function expandTask(
|
||||
|
||||
const { systemPrompt, userPrompt: promptContent } =
|
||||
await promptManager.loadPrompt('expand-task', promptParams, variantKey);
|
||||
|
||||
// Debug logging to identify the issue
|
||||
logger.debug(`Selected variant: ${variantKey}`);
|
||||
logger.debug(
|
||||
`Prompt params passed: ${JSON.stringify(promptParams, null, 2)}`
|
||||
);
|
||||
logger.debug(
|
||||
`System prompt (first 500 chars): ${systemPrompt.substring(0, 500)}...`
|
||||
);
|
||||
logger.debug(
|
||||
`User prompt (first 500 chars): ${promptContent.substring(0, 500)}...`
|
||||
);
|
||||
// --- End Complexity Report / Prompt Logic ---
|
||||
|
||||
// --- AI Subtask Generation using generateTextService ---
|
||||
|
||||
@@ -17,20 +17,26 @@ import {
|
||||
} from '../utils.js';
|
||||
|
||||
import { generateObjectService } from '../ai-services-unified.js';
|
||||
import { getDebugFlag } from '../config-manager.js';
|
||||
import {
|
||||
getDebugFlag,
|
||||
getMainProvider,
|
||||
getResearchProvider,
|
||||
getDefaultPriority
|
||||
} from '../config-manager.js';
|
||||
import { getPromptManager } from '../prompt-manager.js';
|
||||
import { displayAiUsageSummary } from '../ui.js';
|
||||
import { CUSTOM_PROVIDERS } from '../../../src/constants/providers.js';
|
||||
|
||||
// Define the Zod schema for a SINGLE task object
|
||||
const prdSingleTaskSchema = z.object({
|
||||
id: z.number().int().positive(),
|
||||
id: z.number(),
|
||||
title: z.string().min(1),
|
||||
description: z.string().min(1),
|
||||
details: z.string().nullable(),
|
||||
testStrategy: z.string().nullable(),
|
||||
priority: z.enum(['high', 'medium', 'low']).nullable(),
|
||||
dependencies: z.array(z.number().int().positive()).nullable(),
|
||||
status: z.string().nullable()
|
||||
details: z.string(),
|
||||
testStrategy: z.string(),
|
||||
priority: z.enum(['high', 'medium', 'low']),
|
||||
dependencies: z.array(z.number()),
|
||||
status: z.string()
|
||||
});
|
||||
|
||||
// Define the Zod schema for the ENTIRE expected AI response object
|
||||
@@ -174,9 +180,14 @@ async function parsePRD(prdPath, tasksPath, numTasks, options = {}) {
|
||||
const promptManager = getPromptManager();
|
||||
|
||||
// Get defaultTaskPriority from config
|
||||
const { getDefaultPriority } = await import('../config-manager.js');
|
||||
const defaultTaskPriority = getDefaultPriority(projectRoot) || 'medium';
|
||||
|
||||
// Check if Claude Code is being used as the provider
|
||||
const currentProvider = research
|
||||
? getResearchProvider(projectRoot)
|
||||
: getMainProvider(projectRoot);
|
||||
const isClaudeCode = currentProvider === CUSTOM_PROVIDERS.CLAUDE_CODE;
|
||||
|
||||
const { systemPrompt, userPrompt } = await promptManager.loadPrompt(
|
||||
'parse-prd',
|
||||
{
|
||||
@@ -185,7 +196,9 @@ async function parsePRD(prdPath, tasksPath, numTasks, options = {}) {
|
||||
nextId,
|
||||
prdContent,
|
||||
prdPath,
|
||||
defaultTaskPriority
|
||||
defaultTaskPriority,
|
||||
isClaudeCode,
|
||||
projectRoot: projectRoot || ''
|
||||
}
|
||||
);
|
||||
|
||||
@@ -257,10 +270,15 @@ async function parsePRD(prdPath, tasksPath, numTasks, options = {}) {
|
||||
return {
|
||||
...task,
|
||||
id: newId,
|
||||
status: 'pending',
|
||||
status: task.status || 'pending',
|
||||
priority: task.priority || 'medium',
|
||||
dependencies: Array.isArray(task.dependencies) ? task.dependencies : [],
|
||||
subtasks: []
|
||||
subtasks: [],
|
||||
// Ensure all required fields have values (even if empty strings)
|
||||
title: task.title || '',
|
||||
description: task.description || '',
|
||||
details: task.details || '',
|
||||
testStrategy: task.testStrategy || ''
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
845
scripts/modules/task-manager/scope-adjustment.js
Normal file
845
scripts/modules/task-manager/scope-adjustment.js
Normal file
@@ -0,0 +1,845 @@
|
||||
/**
|
||||
* scope-adjustment.js
|
||||
* Core logic for dynamic task complexity adjustment (scope-up and scope-down)
|
||||
*/
|
||||
|
||||
import { z } from 'zod';
|
||||
import {
|
||||
log,
|
||||
readJSON,
|
||||
writeJSON,
|
||||
getCurrentTag,
|
||||
readComplexityReport,
|
||||
findTaskInComplexityReport
|
||||
} from '../utils.js';
|
||||
import {
|
||||
generateObjectService,
|
||||
generateTextService
|
||||
} from '../ai-services-unified.js';
|
||||
import { findTaskById, taskExists } from '../task-manager.js';
|
||||
import analyzeTaskComplexity from './analyze-task-complexity.js';
|
||||
import { findComplexityReportPath } from '../../../src/utils/path-utils.js';
|
||||
|
||||
/**
|
||||
* Valid strength levels for scope adjustments
|
||||
*/
|
||||
const VALID_STRENGTHS = ['light', 'regular', 'heavy'];
|
||||
|
||||
/**
|
||||
* Statuses that should be preserved during subtask regeneration
|
||||
* These represent work that has been started or intentionally set by the user
|
||||
*/
|
||||
const PRESERVE_STATUSES = [
|
||||
'done',
|
||||
'in-progress',
|
||||
'review',
|
||||
'cancelled',
|
||||
'deferred',
|
||||
'blocked'
|
||||
];
|
||||
|
||||
/**
|
||||
* Statuses that should be regenerated during subtask regeneration
|
||||
* These represent work that hasn't been started yet
|
||||
*/
|
||||
const REGENERATE_STATUSES = ['pending'];
|
||||
|
||||
/**
|
||||
* Validates strength parameter
|
||||
* @param {string} strength - The strength level to validate
|
||||
* @returns {boolean} True if valid, false otherwise
|
||||
*/
|
||||
export function validateStrength(strength) {
|
||||
return VALID_STRENGTHS.includes(strength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-analyzes the complexity of a single task after scope adjustment
|
||||
* @param {Object} task - The task to analyze
|
||||
* @param {string} tasksPath - Path to tasks.json
|
||||
* @param {Object} context - Context containing projectRoot, tag, session
|
||||
* @returns {Promise<number|null>} New complexity score or null if analysis failed
|
||||
*/
|
||||
async function reanalyzeTaskComplexity(task, tasksPath, context) {
|
||||
const { projectRoot, tag, session } = context;
|
||||
|
||||
try {
|
||||
// Create a minimal tasks data structure for analysis
|
||||
const tasksForAnalysis = {
|
||||
tasks: [task],
|
||||
metadata: { analyzedAt: new Date().toISOString() }
|
||||
};
|
||||
|
||||
// Find the complexity report path for this tag
|
||||
const complexityReportPath = findComplexityReportPath(
|
||||
null,
|
||||
{ projectRoot, tag },
|
||||
null
|
||||
);
|
||||
|
||||
if (!complexityReportPath) {
|
||||
log('warn', 'No complexity report found - cannot re-analyze complexity');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Use analyze-task-complexity to re-analyze just this task
|
||||
const analysisOptions = {
|
||||
file: tasksPath,
|
||||
output: complexityReportPath,
|
||||
id: task.id.toString(), // Analyze only this specific task
|
||||
projectRoot,
|
||||
tag,
|
||||
_filteredTasksData: tasksForAnalysis, // Pass pre-filtered data
|
||||
_originalTaskCount: 1
|
||||
};
|
||||
|
||||
// Run the analysis with proper context
|
||||
await analyzeTaskComplexity(analysisOptions, { session });
|
||||
|
||||
// Read the updated complexity report to get the new score
|
||||
const updatedReport = readComplexityReport(complexityReportPath);
|
||||
if (updatedReport) {
|
||||
const taskAnalysis = findTaskInComplexityReport(updatedReport, task.id);
|
||||
if (taskAnalysis) {
|
||||
log(
|
||||
'info',
|
||||
`Re-analyzed task ${task.id} complexity: ${taskAnalysis.complexityScore}/10`
|
||||
);
|
||||
return taskAnalysis.complexityScore;
|
||||
}
|
||||
}
|
||||
|
||||
log(
|
||||
'warn',
|
||||
`Could not find updated complexity analysis for task ${task.id}`
|
||||
);
|
||||
return null;
|
||||
} catch (error) {
|
||||
log('error', `Failed to re-analyze task complexity: ${error.message}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current complexity score for a task from the complexity report
|
||||
* @param {number} taskId - Task ID to look up
|
||||
* @param {Object} context - Context containing projectRoot, tag
|
||||
* @returns {number|null} Current complexity score or null if not found
|
||||
*/
|
||||
function getCurrentComplexityScore(taskId, context) {
|
||||
const { projectRoot, tag } = context;
|
||||
|
||||
try {
|
||||
// Find the complexity report path for this tag
|
||||
const complexityReportPath = findComplexityReportPath(
|
||||
null,
|
||||
{ projectRoot, tag },
|
||||
null
|
||||
);
|
||||
|
||||
if (!complexityReportPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Read the current complexity report
|
||||
const complexityReport = readComplexityReport(complexityReportPath);
|
||||
if (!complexityReport) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Find this task's current complexity
|
||||
const taskAnalysis = findTaskInComplexityReport(complexityReport, taskId);
|
||||
return taskAnalysis ? taskAnalysis.complexityScore : null;
|
||||
} catch (error) {
|
||||
log('debug', `Could not read current complexity score: ${error.message}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerates subtasks for a task based on new complexity while preserving completed work
|
||||
* @param {Object} task - The updated task object
|
||||
* @param {string} tasksPath - Path to tasks.json
|
||||
* @param {Object} context - Context containing projectRoot, tag, session
|
||||
* @param {string} direction - Direction of scope change (up/down) for logging
|
||||
* @param {string} strength - Strength level ('light', 'regular', 'heavy')
|
||||
* @param {number|null} originalComplexity - Original complexity score for smarter adjustments
|
||||
* @returns {Promise<Object>} Object with updated task and regeneration info
|
||||
*/
|
||||
async function regenerateSubtasksForComplexity(
|
||||
task,
|
||||
tasksPath,
|
||||
context,
|
||||
direction,
|
||||
strength = 'regular',
|
||||
originalComplexity = null
|
||||
) {
|
||||
const { projectRoot, tag, session } = context;
|
||||
|
||||
// Check if task has subtasks
|
||||
if (
|
||||
!task.subtasks ||
|
||||
!Array.isArray(task.subtasks) ||
|
||||
task.subtasks.length === 0
|
||||
) {
|
||||
return {
|
||||
updatedTask: task,
|
||||
regenerated: false,
|
||||
preserved: 0,
|
||||
generated: 0
|
||||
};
|
||||
}
|
||||
|
||||
// Identify subtasks to preserve vs regenerate
|
||||
const preservedSubtasks = task.subtasks.filter((subtask) =>
|
||||
PRESERVE_STATUSES.includes(subtask.status)
|
||||
);
|
||||
const pendingSubtasks = task.subtasks.filter((subtask) =>
|
||||
REGENERATE_STATUSES.includes(subtask.status)
|
||||
);
|
||||
|
||||
// If no pending subtasks, nothing to regenerate
|
||||
if (pendingSubtasks.length === 0) {
|
||||
return {
|
||||
updatedTask: task,
|
||||
regenerated: false,
|
||||
preserved: preservedSubtasks.length,
|
||||
generated: 0
|
||||
};
|
||||
}
|
||||
|
||||
// Calculate appropriate number of total subtasks based on direction, complexity, strength, and original complexity
|
||||
let targetSubtaskCount;
|
||||
const preservedCount = preservedSubtasks.length;
|
||||
const currentPendingCount = pendingSubtasks.length;
|
||||
|
||||
// Use original complexity to inform decisions (if available)
|
||||
const complexityFactor = originalComplexity
|
||||
? Math.max(0.5, originalComplexity / 10)
|
||||
: 1.0;
|
||||
const complexityInfo = originalComplexity
|
||||
? ` (original complexity: ${originalComplexity}/10)`
|
||||
: '';
|
||||
|
||||
if (direction === 'up') {
|
||||
// Scope up: More subtasks for increased complexity
|
||||
if (strength === 'light') {
|
||||
const base = Math.max(
|
||||
5,
|
||||
preservedCount + Math.ceil(currentPendingCount * 1.1)
|
||||
);
|
||||
targetSubtaskCount = Math.ceil(base * (0.8 + 0.4 * complexityFactor));
|
||||
} else if (strength === 'regular') {
|
||||
const base = Math.max(
|
||||
6,
|
||||
preservedCount + Math.ceil(currentPendingCount * 1.3)
|
||||
);
|
||||
targetSubtaskCount = Math.ceil(base * (0.8 + 0.4 * complexityFactor));
|
||||
} else {
|
||||
// heavy
|
||||
const base = Math.max(
|
||||
8,
|
||||
preservedCount + Math.ceil(currentPendingCount * 1.6)
|
||||
);
|
||||
targetSubtaskCount = Math.ceil(base * (0.8 + 0.6 * complexityFactor));
|
||||
}
|
||||
} else {
|
||||
// Scope down: Fewer subtasks for decreased complexity
|
||||
// High complexity tasks get reduced more aggressively
|
||||
const aggressiveFactor =
|
||||
originalComplexity >= 8 ? 0.7 : originalComplexity >= 6 ? 0.85 : 1.0;
|
||||
|
||||
if (strength === 'light') {
|
||||
const base = Math.max(
|
||||
3,
|
||||
preservedCount + Math.ceil(currentPendingCount * 0.8)
|
||||
);
|
||||
targetSubtaskCount = Math.ceil(base * aggressiveFactor);
|
||||
} else if (strength === 'regular') {
|
||||
const base = Math.max(
|
||||
3,
|
||||
preservedCount + Math.ceil(currentPendingCount * 0.5)
|
||||
);
|
||||
targetSubtaskCount = Math.ceil(base * aggressiveFactor);
|
||||
} else {
|
||||
// heavy
|
||||
// Heavy scope-down should be much more aggressive - aim for only core functionality
|
||||
// Very high complexity tasks (9-10) get reduced to almost nothing
|
||||
const ultraAggressiveFactor =
|
||||
originalComplexity >= 9 ? 0.3 : originalComplexity >= 7 ? 0.5 : 0.7;
|
||||
const base = Math.max(
|
||||
2,
|
||||
preservedCount + Math.ceil(currentPendingCount * 0.25)
|
||||
);
|
||||
targetSubtaskCount = Math.max(1, Math.ceil(base * ultraAggressiveFactor));
|
||||
}
|
||||
}
|
||||
|
||||
log(
|
||||
'debug',
|
||||
`Complexity-aware subtask calculation${complexityInfo}: ${currentPendingCount} pending -> target ${targetSubtaskCount} total`
|
||||
);
|
||||
log(
|
||||
'debug',
|
||||
`Complexity-aware calculation${complexityInfo}: ${currentPendingCount} pending -> ${targetSubtaskCount} total subtasks (${strength} ${direction})`
|
||||
);
|
||||
|
||||
const newSubtasksNeeded = Math.max(1, targetSubtaskCount - preservedCount);
|
||||
|
||||
try {
|
||||
// Generate new subtasks using AI to match the new complexity level
|
||||
const systemPrompt = `You are an expert project manager who creates task breakdowns that match complexity levels.`;
|
||||
|
||||
const prompt = `Based on this updated task, generate ${newSubtasksNeeded} NEW subtasks that reflect the ${direction === 'up' ? 'increased' : 'decreased'} complexity level:
|
||||
|
||||
**Task Title**: ${task.title}
|
||||
**Task Description**: ${task.description}
|
||||
**Implementation Details**: ${task.details}
|
||||
**Test Strategy**: ${task.testStrategy}
|
||||
|
||||
**Complexity Direction**: This task was recently scoped ${direction} (${strength} strength) to ${direction === 'up' ? 'increase' : 'decrease'} complexity.
|
||||
${originalComplexity ? `**Original Complexity**: ${originalComplexity}/10 - consider this when determining appropriate scope level.` : ''}
|
||||
|
||||
${preservedCount > 0 ? `**Preserved Subtasks**: ${preservedCount} existing subtasks with work already done will be kept.` : ''}
|
||||
|
||||
Generate subtasks that:
|
||||
${
|
||||
direction === 'up'
|
||||
? strength === 'heavy'
|
||||
? `- Add comprehensive implementation steps with advanced features
|
||||
- Include extensive error handling, validation, and edge cases
|
||||
- Cover multiple integration scenarios and advanced testing
|
||||
- Provide thorough documentation and optimization approaches`
|
||||
: strength === 'regular'
|
||||
? `- Add more detailed implementation steps
|
||||
- Include additional error handling and validation
|
||||
- Cover more edge cases and advanced features
|
||||
- Provide more comprehensive testing approaches`
|
||||
: `- Add some additional implementation details
|
||||
- Include basic error handling considerations
|
||||
- Cover a few common edge cases
|
||||
- Enhance testing approaches slightly`
|
||||
: strength === 'heavy'
|
||||
? `- Focus ONLY on absolutely essential core functionality
|
||||
- Strip out ALL non-critical features (error handling, advanced testing, etc.)
|
||||
- Provide only the minimum viable implementation
|
||||
- Eliminate any complex integrations or advanced scenarios
|
||||
- Aim for the simplest possible working solution`
|
||||
: strength === 'regular'
|
||||
? `- Focus on core functionality only
|
||||
- Simplify implementation steps
|
||||
- Remove non-essential features
|
||||
- Streamline to basic requirements`
|
||||
: `- Focus mainly on core functionality
|
||||
- Slightly simplify implementation steps
|
||||
- Remove some non-essential features
|
||||
- Streamline most requirements`
|
||||
}
|
||||
|
||||
Return a JSON object with a "subtasks" array. Each subtask should have:
|
||||
- id: Sequential NUMBER starting from 1 (e.g., 1, 2, 3 - NOT "1", "2", "3")
|
||||
- title: Clear, specific title
|
||||
- description: Detailed description
|
||||
- dependencies: Array of dependency IDs as STRINGS (use format ["${task.id}.1", "${task.id}.2"] for siblings, or empty array [] for no dependencies)
|
||||
- details: Implementation guidance
|
||||
- status: "pending"
|
||||
- testStrategy: Testing approach
|
||||
|
||||
IMPORTANT:
|
||||
- The 'id' field must be a NUMBER, not a string!
|
||||
- Dependencies must be strings, not numbers!
|
||||
|
||||
Ensure the JSON is valid and properly formatted.`;
|
||||
|
||||
// Define subtask schema
|
||||
const subtaskSchema = z.object({
|
||||
subtasks: z.array(
|
||||
z.object({
|
||||
id: z.number().int().positive(),
|
||||
title: z.string().min(5),
|
||||
description: z.string().min(10),
|
||||
dependencies: z.array(z.string()),
|
||||
details: z.string().min(20),
|
||||
status: z.string(),
|
||||
testStrategy: z.string()
|
||||
})
|
||||
)
|
||||
});
|
||||
|
||||
const aiResult = await generateObjectService({
|
||||
role: context.research ? 'research' : 'main',
|
||||
session: context.session,
|
||||
systemPrompt,
|
||||
prompt,
|
||||
schema: subtaskSchema,
|
||||
objectName: 'subtask_regeneration',
|
||||
commandName: context.commandName || `subtask-regen-${direction}`,
|
||||
outputType: context.outputType || 'cli'
|
||||
});
|
||||
|
||||
const generatedSubtasks = aiResult.mainResult.subtasks || [];
|
||||
|
||||
// Post-process generated subtasks to ensure defaults
|
||||
const processedGeneratedSubtasks = generatedSubtasks.map((subtask) => ({
|
||||
...subtask,
|
||||
status: subtask.status || 'pending',
|
||||
testStrategy: subtask.testStrategy || ''
|
||||
}));
|
||||
|
||||
// Update task with preserved subtasks + newly generated ones
|
||||
task.subtasks = [...preservedSubtasks, ...processedGeneratedSubtasks];
|
||||
|
||||
return {
|
||||
updatedTask: task,
|
||||
regenerated: true,
|
||||
preserved: preservedSubtasks.length,
|
||||
generated: processedGeneratedSubtasks.length
|
||||
};
|
||||
} catch (error) {
|
||||
log(
|
||||
'warn',
|
||||
`Failed to regenerate subtasks for task ${task.id}: ${error.message}`
|
||||
);
|
||||
// Don't fail the whole operation if subtask regeneration fails
|
||||
return {
|
||||
updatedTask: task,
|
||||
regenerated: false,
|
||||
preserved: preservedSubtasks.length,
|
||||
generated: 0,
|
||||
error: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates AI prompt for scope adjustment
|
||||
* @param {Object} task - The task to adjust
|
||||
* @param {string} direction - 'up' or 'down'
|
||||
* @param {string} strength - 'light', 'regular', or 'heavy'
|
||||
* @param {string} customPrompt - Optional custom instructions
|
||||
* @returns {string} The generated prompt
|
||||
*/
|
||||
function generateScopePrompt(task, direction, strength, customPrompt) {
|
||||
const isUp = direction === 'up';
|
||||
const strengthDescriptions = {
|
||||
light: isUp ? 'minor enhancements' : 'slight simplifications',
|
||||
regular: isUp
|
||||
? 'moderate complexity increases'
|
||||
: 'moderate simplifications',
|
||||
heavy: isUp ? 'significant complexity additions' : 'major simplifications'
|
||||
};
|
||||
|
||||
let basePrompt = `You are tasked with adjusting the complexity of a task.
|
||||
|
||||
CURRENT TASK:
|
||||
Title: ${task.title}
|
||||
Description: ${task.description}
|
||||
Details: ${task.details}
|
||||
Test Strategy: ${task.testStrategy || 'Not specified'}
|
||||
|
||||
ADJUSTMENT REQUIREMENTS:
|
||||
- Direction: ${isUp ? 'INCREASE' : 'DECREASE'} complexity
|
||||
- Strength: ${strength} (${strengthDescriptions[strength]})
|
||||
- Preserve the core purpose and functionality of the task
|
||||
- Maintain consistency with the existing task structure`;
|
||||
|
||||
if (isUp) {
|
||||
basePrompt += `
|
||||
- Add more detailed requirements, edge cases, or advanced features
|
||||
- Include additional implementation considerations
|
||||
- Enhance error handling and validation requirements
|
||||
- Expand testing strategies with more comprehensive scenarios`;
|
||||
} else {
|
||||
basePrompt += `
|
||||
- Focus on core functionality and essential requirements
|
||||
- Remove or simplify non-essential features
|
||||
- Streamline implementation details
|
||||
- Simplify testing to focus on basic functionality`;
|
||||
}
|
||||
|
||||
if (customPrompt) {
|
||||
basePrompt += `\n\nCUSTOM INSTRUCTIONS:\n${customPrompt}`;
|
||||
}
|
||||
|
||||
basePrompt += `\n\nReturn a JSON object with the updated task containing these fields:
|
||||
- title: Updated task title
|
||||
- description: Updated task description
|
||||
- details: Updated implementation details
|
||||
- testStrategy: Updated test strategy
|
||||
- priority: Task priority ('low', 'medium', or 'high')
|
||||
|
||||
Ensure the JSON is valid and properly formatted.`;
|
||||
|
||||
return basePrompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts task complexity using AI
|
||||
* @param {Object} task - The task to adjust
|
||||
* @param {string} direction - 'up' or 'down'
|
||||
* @param {string} strength - 'light', 'regular', or 'heavy'
|
||||
* @param {string} customPrompt - Optional custom instructions
|
||||
* @param {Object} context - Context object with projectRoot, tag, etc.
|
||||
* @returns {Promise<Object>} Updated task data and telemetry
|
||||
*/
|
||||
async function adjustTaskComplexity(
|
||||
task,
|
||||
direction,
|
||||
strength,
|
||||
customPrompt,
|
||||
context
|
||||
) {
|
||||
const systemPrompt = `You are an expert software project manager who helps adjust task complexity while maintaining clarity and actionability.`;
|
||||
|
||||
const prompt = generateScopePrompt(task, direction, strength, customPrompt);
|
||||
|
||||
// Define the task schema for structured response using Zod
|
||||
const taskSchema = z.object({
|
||||
title: z
|
||||
.string()
|
||||
.min(1)
|
||||
.describe('Updated task title reflecting scope adjustment'),
|
||||
description: z
|
||||
.string()
|
||||
.min(1)
|
||||
.describe('Updated task description with adjusted scope'),
|
||||
details: z
|
||||
.string()
|
||||
.min(1)
|
||||
.describe('Updated implementation details with adjusted complexity'),
|
||||
testStrategy: z
|
||||
.string()
|
||||
.min(1)
|
||||
.describe('Updated testing approach for the adjusted scope'),
|
||||
priority: z.enum(['low', 'medium', 'high']).describe('Task priority level')
|
||||
});
|
||||
|
||||
const aiResult = await generateObjectService({
|
||||
role: context.research ? 'research' : 'main',
|
||||
session: context.session,
|
||||
systemPrompt,
|
||||
prompt,
|
||||
schema: taskSchema,
|
||||
objectName: 'updated_task',
|
||||
commandName: context.commandName || `scope-${direction}`,
|
||||
outputType: context.outputType || 'cli'
|
||||
});
|
||||
|
||||
const updatedTaskData = aiResult.mainResult;
|
||||
|
||||
// Ensure priority has a value (in case AI didn't provide one)
|
||||
const processedTaskData = {
|
||||
...updatedTaskData,
|
||||
priority: updatedTaskData.priority || task.priority || 'medium'
|
||||
};
|
||||
|
||||
return {
|
||||
updatedTask: {
|
||||
...task,
|
||||
...processedTaskData
|
||||
},
|
||||
telemetryData: aiResult.telemetryData
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Increases task complexity (scope-up)
|
||||
* @param {string} tasksPath - Path to tasks.json file
|
||||
* @param {Array<number>} taskIds - Array of task IDs to scope up
|
||||
* @param {string} strength - Strength level ('light', 'regular', 'heavy')
|
||||
* @param {string} customPrompt - Optional custom instructions
|
||||
* @param {Object} context - Context object with projectRoot, tag, etc.
|
||||
* @param {string} outputFormat - Output format ('text' or 'json')
|
||||
* @returns {Promise<Object>} Results of the scope-up operation
|
||||
*/
|
||||
export async function scopeUpTask(
|
||||
tasksPath,
|
||||
taskIds,
|
||||
strength = 'regular',
|
||||
customPrompt = null,
|
||||
context = {},
|
||||
outputFormat = 'text'
|
||||
) {
|
||||
// Validate inputs
|
||||
if (!validateStrength(strength)) {
|
||||
throw new Error(
|
||||
`Invalid strength level: ${strength}. Must be one of: ${VALID_STRENGTHS.join(', ')}`
|
||||
);
|
||||
}
|
||||
|
||||
const { projectRoot = '.', tag = 'master' } = context;
|
||||
|
||||
// Read tasks data
|
||||
const data = readJSON(tasksPath, projectRoot, tag);
|
||||
const tasks = data?.tasks || [];
|
||||
|
||||
// Validate all task IDs exist
|
||||
for (const taskId of taskIds) {
|
||||
if (!taskExists(tasks, taskId)) {
|
||||
throw new Error(`Task with ID ${taskId} not found`);
|
||||
}
|
||||
}
|
||||
|
||||
const updatedTasks = [];
|
||||
let combinedTelemetryData = null;
|
||||
|
||||
// Process each task
|
||||
for (const taskId of taskIds) {
|
||||
const taskResult = findTaskById(tasks, taskId);
|
||||
const task = taskResult.task;
|
||||
if (!task) {
|
||||
throw new Error(`Task with ID ${taskId} not found`);
|
||||
}
|
||||
|
||||
if (outputFormat === 'text') {
|
||||
log('info', `Scoping up task ${taskId}: ${task.title}`);
|
||||
}
|
||||
|
||||
// Get original complexity score (if available)
|
||||
const originalComplexity = getCurrentComplexityScore(taskId, context);
|
||||
if (originalComplexity && outputFormat === 'text') {
|
||||
log('info', `Original complexity: ${originalComplexity}/10`);
|
||||
}
|
||||
|
||||
const adjustResult = await adjustTaskComplexity(
|
||||
task,
|
||||
'up',
|
||||
strength,
|
||||
customPrompt,
|
||||
context
|
||||
);
|
||||
|
||||
// Regenerate subtasks based on new complexity while preserving completed work
|
||||
const subtaskResult = await regenerateSubtasksForComplexity(
|
||||
adjustResult.updatedTask,
|
||||
tasksPath,
|
||||
context,
|
||||
'up',
|
||||
strength,
|
||||
originalComplexity
|
||||
);
|
||||
|
||||
// Log subtask regeneration info if in text mode
|
||||
if (outputFormat === 'text' && subtaskResult.regenerated) {
|
||||
log(
|
||||
'info',
|
||||
`Regenerated ${subtaskResult.generated} pending subtasks (preserved ${subtaskResult.preserved} completed)`
|
||||
);
|
||||
}
|
||||
|
||||
// Update task in data
|
||||
const taskIndex = data.tasks.findIndex((t) => t.id === taskId);
|
||||
if (taskIndex !== -1) {
|
||||
data.tasks[taskIndex] = subtaskResult.updatedTask;
|
||||
updatedTasks.push(subtaskResult.updatedTask);
|
||||
}
|
||||
|
||||
// Re-analyze complexity after scoping (if we have a session for AI calls)
|
||||
if (context.session && originalComplexity) {
|
||||
try {
|
||||
// Write the updated task first so complexity analysis can read it
|
||||
writeJSON(tasksPath, data, projectRoot, tag);
|
||||
|
||||
// Re-analyze complexity
|
||||
const newComplexity = await reanalyzeTaskComplexity(
|
||||
subtaskResult.updatedTask,
|
||||
tasksPath,
|
||||
context
|
||||
);
|
||||
if (newComplexity && outputFormat === 'text') {
|
||||
const complexityChange = newComplexity - originalComplexity;
|
||||
const arrow =
|
||||
complexityChange > 0 ? '↗️' : complexityChange < 0 ? '↘️' : '➡️';
|
||||
log(
|
||||
'info',
|
||||
`New complexity: ${originalComplexity}/10 ${arrow} ${newComplexity}/10 (${complexityChange > 0 ? '+' : ''}${complexityChange})`
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
if (outputFormat === 'text') {
|
||||
log('warn', `Could not re-analyze complexity: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Combine telemetry data
|
||||
if (adjustResult.telemetryData) {
|
||||
if (!combinedTelemetryData) {
|
||||
combinedTelemetryData = { ...adjustResult.telemetryData };
|
||||
} else {
|
||||
// Sum up costs and tokens
|
||||
combinedTelemetryData.inputTokens +=
|
||||
adjustResult.telemetryData.inputTokens || 0;
|
||||
combinedTelemetryData.outputTokens +=
|
||||
adjustResult.telemetryData.outputTokens || 0;
|
||||
combinedTelemetryData.totalTokens +=
|
||||
adjustResult.telemetryData.totalTokens || 0;
|
||||
combinedTelemetryData.totalCost +=
|
||||
adjustResult.telemetryData.totalCost || 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write updated data
|
||||
writeJSON(tasksPath, data, projectRoot, tag);
|
||||
|
||||
if (outputFormat === 'text') {
|
||||
log('info', `Successfully scoped up ${updatedTasks.length} task(s)`);
|
||||
}
|
||||
|
||||
return {
|
||||
updatedTasks,
|
||||
telemetryData: combinedTelemetryData
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Decreases task complexity (scope-down)
|
||||
* @param {string} tasksPath - Path to tasks.json file
|
||||
* @param {Array<number>} taskIds - Array of task IDs to scope down
|
||||
* @param {string} strength - Strength level ('light', 'regular', 'heavy')
|
||||
* @param {string} customPrompt - Optional custom instructions
|
||||
* @param {Object} context - Context object with projectRoot, tag, etc.
|
||||
* @param {string} outputFormat - Output format ('text' or 'json')
|
||||
* @returns {Promise<Object>} Results of the scope-down operation
|
||||
*/
|
||||
export async function scopeDownTask(
|
||||
tasksPath,
|
||||
taskIds,
|
||||
strength = 'regular',
|
||||
customPrompt = null,
|
||||
context = {},
|
||||
outputFormat = 'text'
|
||||
) {
|
||||
// Validate inputs
|
||||
if (!validateStrength(strength)) {
|
||||
throw new Error(
|
||||
`Invalid strength level: ${strength}. Must be one of: ${VALID_STRENGTHS.join(', ')}`
|
||||
);
|
||||
}
|
||||
|
||||
const { projectRoot = '.', tag = 'master' } = context;
|
||||
|
||||
// Read tasks data
|
||||
const data = readJSON(tasksPath, projectRoot, tag);
|
||||
const tasks = data?.tasks || [];
|
||||
|
||||
// Validate all task IDs exist
|
||||
for (const taskId of taskIds) {
|
||||
if (!taskExists(tasks, taskId)) {
|
||||
throw new Error(`Task with ID ${taskId} not found`);
|
||||
}
|
||||
}
|
||||
|
||||
const updatedTasks = [];
|
||||
let combinedTelemetryData = null;
|
||||
|
||||
// Process each task
|
||||
for (const taskId of taskIds) {
|
||||
const taskResult = findTaskById(tasks, taskId);
|
||||
const task = taskResult.task;
|
||||
if (!task) {
|
||||
throw new Error(`Task with ID ${taskId} not found`);
|
||||
}
|
||||
|
||||
if (outputFormat === 'text') {
|
||||
log('info', `Scoping down task ${taskId}: ${task.title}`);
|
||||
}
|
||||
|
||||
// Get original complexity score (if available)
|
||||
const originalComplexity = getCurrentComplexityScore(taskId, context);
|
||||
if (originalComplexity && outputFormat === 'text') {
|
||||
log('info', `Original complexity: ${originalComplexity}/10`);
|
||||
}
|
||||
|
||||
const adjustResult = await adjustTaskComplexity(
|
||||
task,
|
||||
'down',
|
||||
strength,
|
||||
customPrompt,
|
||||
context
|
||||
);
|
||||
|
||||
// Regenerate subtasks based on new complexity while preserving completed work
|
||||
const subtaskResult = await regenerateSubtasksForComplexity(
|
||||
adjustResult.updatedTask,
|
||||
tasksPath,
|
||||
context,
|
||||
'down',
|
||||
strength,
|
||||
originalComplexity
|
||||
);
|
||||
|
||||
// Log subtask regeneration info if in text mode
|
||||
if (outputFormat === 'text' && subtaskResult.regenerated) {
|
||||
log(
|
||||
'info',
|
||||
`Regenerated ${subtaskResult.generated} pending subtasks (preserved ${subtaskResult.preserved} completed)`
|
||||
);
|
||||
}
|
||||
|
||||
// Update task in data
|
||||
const taskIndex = data.tasks.findIndex((t) => t.id === taskId);
|
||||
if (taskIndex !== -1) {
|
||||
data.tasks[taskIndex] = subtaskResult.updatedTask;
|
||||
updatedTasks.push(subtaskResult.updatedTask);
|
||||
}
|
||||
|
||||
// Re-analyze complexity after scoping (if we have a session for AI calls)
|
||||
if (context.session && originalComplexity) {
|
||||
try {
|
||||
// Write the updated task first so complexity analysis can read it
|
||||
writeJSON(tasksPath, data, projectRoot, tag);
|
||||
|
||||
// Re-analyze complexity
|
||||
const newComplexity = await reanalyzeTaskComplexity(
|
||||
subtaskResult.updatedTask,
|
||||
tasksPath,
|
||||
context
|
||||
);
|
||||
if (newComplexity && outputFormat === 'text') {
|
||||
const complexityChange = newComplexity - originalComplexity;
|
||||
const arrow =
|
||||
complexityChange > 0 ? '↗️' : complexityChange < 0 ? '↘️' : '➡️';
|
||||
log(
|
||||
'info',
|
||||
`New complexity: ${originalComplexity}/10 ${arrow} ${newComplexity}/10 (${complexityChange > 0 ? '+' : ''}${complexityChange})`
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
if (outputFormat === 'text') {
|
||||
log('warn', `Could not re-analyze complexity: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Combine telemetry data
|
||||
if (adjustResult.telemetryData) {
|
||||
if (!combinedTelemetryData) {
|
||||
combinedTelemetryData = { ...adjustResult.telemetryData };
|
||||
} else {
|
||||
// Sum up costs and tokens
|
||||
combinedTelemetryData.inputTokens +=
|
||||
adjustResult.telemetryData.inputTokens || 0;
|
||||
combinedTelemetryData.outputTokens +=
|
||||
adjustResult.telemetryData.outputTokens || 0;
|
||||
combinedTelemetryData.totalTokens +=
|
||||
adjustResult.telemetryData.totalTokens || 0;
|
||||
combinedTelemetryData.totalCost +=
|
||||
adjustResult.telemetryData.totalCost || 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write updated data
|
||||
writeJSON(tasksPath, data, projectRoot, tag);
|
||||
|
||||
if (outputFormat === 'text') {
|
||||
log('info', `Successfully scoped down ${updatedTasks.length} task(s)`);
|
||||
}
|
||||
|
||||
return {
|
||||
updatedTasks,
|
||||
telemetryData: combinedTelemetryData
|
||||
};
|
||||
}
|
||||
@@ -1640,23 +1640,80 @@ async function displayTaskById(
|
||||
}
|
||||
|
||||
// --- Suggested Actions ---
|
||||
console.log(
|
||||
boxen(
|
||||
chalk.white.bold('Suggested Actions:') +
|
||||
'\n' +
|
||||
`${chalk.cyan('1.')} Mark as in-progress: ${chalk.yellow(`task-master set-status --id=${task.id} --status=in-progress`)}\n` +
|
||||
`${chalk.cyan('2.')} Mark as done when completed: ${chalk.yellow(`task-master set-status --id=${task.id} --status=done`)}\n` +
|
||||
// Determine action 3 based on whether subtasks *exist* (use the source list for progress)
|
||||
(subtasksForProgress && subtasksForProgress.length > 0
|
||||
? `${chalk.cyan('3.')} Update subtask status: ${chalk.yellow(`task-master set-status --id=${task.id}.1 --status=done`)}` // Example uses .1
|
||||
: `${chalk.cyan('3.')} Break down into subtasks: ${chalk.yellow(`task-master expand --id=${task.id}`)}`),
|
||||
{
|
||||
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
||||
borderColor: 'green',
|
||||
borderStyle: 'round',
|
||||
margin: { top: 1 }
|
||||
const actions = [];
|
||||
let actionNumber = 1;
|
||||
|
||||
// Basic actions
|
||||
actions.push(
|
||||
`${chalk.cyan(`${actionNumber}.`)} Mark as in-progress: ${chalk.yellow(`task-master set-status --id=${task.id} --status=in-progress`)}`
|
||||
);
|
||||
actionNumber++;
|
||||
actions.push(
|
||||
`${chalk.cyan(`${actionNumber}.`)} Mark as done when completed: ${chalk.yellow(`task-master set-status --id=${task.id} --status=done`)}`
|
||||
);
|
||||
actionNumber++;
|
||||
|
||||
// Subtask-related action
|
||||
if (subtasksForProgress && subtasksForProgress.length > 0) {
|
||||
actions.push(
|
||||
`${chalk.cyan(`${actionNumber}.`)} Update subtask status: ${chalk.yellow(`task-master set-status --id=${task.id}.1 --status=done`)}`
|
||||
);
|
||||
} else {
|
||||
actions.push(
|
||||
`${chalk.cyan(`${actionNumber}.`)} Break down into subtasks: ${chalk.yellow(`task-master expand --id=${task.id}`)}`
|
||||
);
|
||||
}
|
||||
actionNumber++;
|
||||
|
||||
// Complexity-based scope adjustment actions
|
||||
if (task.complexityScore) {
|
||||
const complexityScore = task.complexityScore;
|
||||
actions.push(
|
||||
`${chalk.cyan(`${actionNumber}.`)} Re-analyze complexity: ${chalk.yellow(`task-master analyze-complexity --id=${task.id}`)}`
|
||||
);
|
||||
actionNumber++;
|
||||
|
||||
// Add scope adjustment suggestions based on current complexity
|
||||
if (complexityScore >= 7) {
|
||||
// High complexity - suggest scoping down
|
||||
actions.push(
|
||||
`${chalk.cyan(`${actionNumber}.`)} Scope down (simplify): ${chalk.yellow(`task-master scope-down --id=${task.id} --strength=regular`)}`
|
||||
);
|
||||
actionNumber++;
|
||||
if (complexityScore >= 9) {
|
||||
actions.push(
|
||||
`${chalk.cyan(`${actionNumber}.`)} Heavy scope down: ${chalk.yellow(`task-master scope-down --id=${task.id} --strength=heavy`)}`
|
||||
);
|
||||
actionNumber++;
|
||||
}
|
||||
)
|
||||
} else if (complexityScore <= 4) {
|
||||
// Low complexity - suggest scoping up
|
||||
actions.push(
|
||||
`${chalk.cyan(`${actionNumber}.`)} Scope up (add detail): ${chalk.yellow(`task-master scope-up --id=${task.id} --strength=regular`)}`
|
||||
);
|
||||
actionNumber++;
|
||||
if (complexityScore <= 2) {
|
||||
actions.push(
|
||||
`${chalk.cyan(`${actionNumber}.`)} Heavy scope up: ${chalk.yellow(`task-master scope-up --id=${task.id} --strength=heavy`)}`
|
||||
);
|
||||
actionNumber++;
|
||||
}
|
||||
} else {
|
||||
// Medium complexity (5-6) - offer both options
|
||||
actions.push(
|
||||
`${chalk.cyan(`${actionNumber}.`)} Scope up/down: ${chalk.yellow(`task-master scope-up --id=${task.id} --strength=light`)} or ${chalk.yellow(`scope-down --id=${task.id} --strength=light`)}`
|
||||
);
|
||||
actionNumber++;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(
|
||||
boxen(chalk.white.bold('Suggested Actions:') + '\n' + actions.join('\n'), {
|
||||
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
||||
borderColor: 'green',
|
||||
borderStyle: 'round',
|
||||
margin: { top: 1 }
|
||||
})
|
||||
);
|
||||
|
||||
// Show FYI notice if migration occurred
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
import { generateObject, generateText, streamText } from 'ai';
|
||||
import {
|
||||
generateObject,
|
||||
generateText,
|
||||
streamText,
|
||||
zodSchema,
|
||||
JSONParseError,
|
||||
NoObjectGeneratedError
|
||||
} from 'ai';
|
||||
import { jsonrepair } from 'jsonrepair';
|
||||
import { log } from '../../scripts/modules/utils.js';
|
||||
|
||||
/**
|
||||
@@ -53,8 +61,11 @@ export class BaseAIProvider {
|
||||
) {
|
||||
throw new Error('Temperature must be between 0 and 1');
|
||||
}
|
||||
if (params.maxTokens !== undefined && params.maxTokens <= 0) {
|
||||
throw new Error('maxTokens must be greater than 0');
|
||||
if (params.maxTokens !== undefined) {
|
||||
const maxTokens = Number(params.maxTokens);
|
||||
if (!Number.isFinite(maxTokens) || maxTokens <= 0) {
|
||||
throw new Error('maxTokens must be a finite number greater than 0');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +125,37 @@ export class BaseAIProvider {
|
||||
throw new Error('getRequiredApiKeyName must be implemented by provider');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a model requires max_completion_tokens instead of maxTokens
|
||||
* Can be overridden by providers to specify their model requirements
|
||||
* @param {string} modelId - The model ID to check
|
||||
* @returns {boolean} True if the model requires max_completion_tokens
|
||||
*/
|
||||
requiresMaxCompletionTokens(modelId) {
|
||||
return false; // Default behavior - most models use maxTokens
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares token limit parameter based on model requirements
|
||||
* @param {string} modelId - The model ID
|
||||
* @param {number} maxTokens - The maximum tokens value
|
||||
* @returns {object} Object with either maxTokens or max_completion_tokens
|
||||
*/
|
||||
prepareTokenParam(modelId, maxTokens) {
|
||||
if (maxTokens === undefined) {
|
||||
return {};
|
||||
}
|
||||
|
||||
// Ensure maxTokens is an integer
|
||||
const tokenValue = Math.floor(Number(maxTokens));
|
||||
|
||||
if (this.requiresMaxCompletionTokens(modelId)) {
|
||||
return { max_completion_tokens: tokenValue };
|
||||
} else {
|
||||
return { maxTokens: tokenValue };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates text using the provider's model
|
||||
*/
|
||||
@@ -131,7 +173,7 @@ export class BaseAIProvider {
|
||||
const result = await generateText({
|
||||
model: client(params.modelId),
|
||||
messages: params.messages,
|
||||
maxTokens: params.maxTokens,
|
||||
...this.prepareTokenParam(params.modelId, params.maxTokens),
|
||||
temperature: params.temperature
|
||||
});
|
||||
|
||||
@@ -167,7 +209,7 @@ export class BaseAIProvider {
|
||||
const stream = await streamText({
|
||||
model: client(params.modelId),
|
||||
messages: params.messages,
|
||||
maxTokens: params.maxTokens,
|
||||
...this.prepareTokenParam(params.modelId, params.maxTokens),
|
||||
temperature: params.temperature
|
||||
});
|
||||
|
||||
@@ -206,9 +248,9 @@ export class BaseAIProvider {
|
||||
const result = await generateObject({
|
||||
model: client(params.modelId),
|
||||
messages: params.messages,
|
||||
schema: params.schema,
|
||||
mode: 'auto',
|
||||
maxTokens: params.maxTokens,
|
||||
schema: zodSchema(params.schema),
|
||||
mode: params.mode || 'auto',
|
||||
...this.prepareTokenParam(params.modelId, params.maxTokens),
|
||||
temperature: params.temperature
|
||||
});
|
||||
|
||||
@@ -226,6 +268,43 @@ export class BaseAIProvider {
|
||||
}
|
||||
};
|
||||
} catch (error) {
|
||||
// Check if this is a JSON parsing error that we can potentially fix
|
||||
if (
|
||||
NoObjectGeneratedError.isInstance(error) &&
|
||||
JSONParseError.isInstance(error.cause) &&
|
||||
error.cause.text
|
||||
) {
|
||||
log(
|
||||
'warn',
|
||||
`${this.name} generated malformed JSON, attempting to repair...`
|
||||
);
|
||||
|
||||
try {
|
||||
// Use jsonrepair to fix the malformed JSON
|
||||
const repairedJson = jsonrepair(error.cause.text);
|
||||
const parsed = JSON.parse(repairedJson);
|
||||
|
||||
log('info', `Successfully repaired ${this.name} JSON output`);
|
||||
|
||||
// Return in the expected format
|
||||
return {
|
||||
object: parsed,
|
||||
usage: {
|
||||
// Extract usage information from the error if available
|
||||
inputTokens: error.usage?.promptTokens || 0,
|
||||
outputTokens: error.usage?.completionTokens || 0,
|
||||
totalTokens: error.usage?.totalTokens || 0
|
||||
}
|
||||
};
|
||||
} catch (repairError) {
|
||||
log(
|
||||
'error',
|
||||
`Failed to repair ${this.name} JSON: ${repairError.message}`
|
||||
);
|
||||
// Fall through to handleError with original error
|
||||
}
|
||||
}
|
||||
|
||||
this.handleError('object generation', error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,16 @@ export class OpenAIProvider extends BaseAIProvider {
|
||||
return 'OPENAI_API_KEY';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a model requires max_completion_tokens instead of maxTokens
|
||||
* GPT-5 models require max_completion_tokens parameter
|
||||
* @param {string} modelId - The model ID to check
|
||||
* @returns {boolean} True if the model requires max_completion_tokens
|
||||
*/
|
||||
requiresMaxCompletionTokens(modelId) {
|
||||
return modelId && modelId.startsWith('gpt-5');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an OpenAI client instance.
|
||||
* @param {object} params - Parameters for client initialization
|
||||
|
||||
@@ -44,4 +44,21 @@ export class PerplexityAIProvider extends BaseAIProvider {
|
||||
this.handleError('client initialization', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override generateObject to use JSON mode for Perplexity
|
||||
*
|
||||
* NOTE: Perplexity models (especially sonar models) have known issues
|
||||
* generating valid JSON, particularly with array fields. They often
|
||||
* generate malformed JSON like "dependencies": , instead of "dependencies": []
|
||||
*
|
||||
* The base provider now handles JSON repair automatically for all providers.
|
||||
*/
|
||||
async generateObject(params) {
|
||||
// Force JSON mode for Perplexity as it may help with reliability
|
||||
return super.generateObject({
|
||||
...params,
|
||||
mode: 'json'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,12 +30,22 @@
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Use research mode for deeper analysis"
|
||||
},
|
||||
"isClaudeCode": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Whether Claude Code is being used as the provider"
|
||||
},
|
||||
"projectRoot": {
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "Project root path for context"
|
||||
}
|
||||
},
|
||||
"prompts": {
|
||||
"default": {
|
||||
"system": "You are an expert software architect and project manager analyzing task complexity. Respond only with the requested valid JSON array.",
|
||||
"user": "Analyze the following tasks to determine their complexity (1-10 scale) and recommend the number of subtasks for expansion. Provide a brief reasoning and an initial expansion prompt for each.{{#if useResearch}} Consider current best practices, common implementation patterns, and industry standards in your analysis.{{/if}}\n\nTasks:\n{{{json tasks}}}\n{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}\n{{/if}}\n\nRespond ONLY with a valid JSON array matching the schema:\n[\n {\n \"taskId\": <number>,\n \"taskTitle\": \"<string>\",\n \"complexityScore\": <number 1-10>,\n \"recommendedSubtasks\": <number>,\n \"expansionPrompt\": \"<string>\",\n \"reasoning\": \"<string>\"\n },\n ...\n]\n\nDo not include any explanatory text, markdown formatting, or code block markers before or after the JSON array."
|
||||
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before analyzing task complexity:\n\n1. Use the Glob tool to explore the project structure and understand the codebase size\n2. Use the Grep tool to search for existing implementations related to each task\n3. Use the Read tool to examine key files that would be affected by these tasks\n4. Understand the current implementation state, patterns used, and technical debt\n\nBased on your codebase analysis:\n- Assess complexity based on ACTUAL code that needs to be modified/created\n- Consider existing abstractions and patterns that could simplify implementation\n- Identify tasks that require refactoring vs. greenfield development\n- Factor in dependencies between existing code and new features\n- Provide more accurate subtask recommendations based on real code structure\n\nProject Root: {{projectRoot}}\n\n{{/if}}Analyze the following tasks to determine their complexity (1-10 scale) and recommend the number of subtasks for expansion. Provide a brief reasoning and an initial expansion prompt for each.{{#if useResearch}} Consider current best practices, common implementation patterns, and industry standards in your analysis.{{/if}}\n\nTasks:\n{{{json tasks}}}\n{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}\n{{/if}}\n\nRespond ONLY with a valid JSON array matching the schema:\n[\n {\n \"taskId\": <number>,\n \"taskTitle\": \"<string>\",\n \"complexityScore\": <number 1-10>,\n \"recommendedSubtasks\": <number>,\n \"expansionPrompt\": \"<string>\",\n \"reasoning\": \"<string>\"\n },\n ...\n]\n\nDo not include any explanatory text, markdown formatting, or code block markers before or after the JSON array."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,22 +51,34 @@
|
||||
"required": false,
|
||||
"default": "",
|
||||
"description": "Gathered project context"
|
||||
},
|
||||
"isClaudeCode": {
|
||||
"type": "boolean",
|
||||
"required": false,
|
||||
"default": false,
|
||||
"description": "Whether Claude Code is being used as the provider"
|
||||
},
|
||||
"projectRoot": {
|
||||
"type": "string",
|
||||
"required": false,
|
||||
"default": "",
|
||||
"description": "Project root path for context"
|
||||
}
|
||||
},
|
||||
"prompts": {
|
||||
"complexity-report": {
|
||||
"condition": "expansionPrompt",
|
||||
"system": "You are an AI assistant helping with task breakdown. Generate {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks based on the provided prompt and context.\nRespond ONLY with a valid JSON object containing a single key \"subtasks\" whose value is an array of the generated subtask objects.\nEach subtask object in the array must have keys: \"id\", \"title\", \"description\", \"dependencies\", \"details\", \"status\".\nEnsure the 'id' starts from {{nextSubtaskId}} and is sequential.\nFor 'dependencies', use the full subtask ID format: \"{{task.id}}.1\", \"{{task.id}}.2\", etc. Only reference subtasks within this same task.\nEnsure 'status' is 'pending'.\nDo not include any other text or explanation.",
|
||||
"user": "{{expansionPrompt}}{{#if additionalContext}}\n\n{{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\n\n{{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}"
|
||||
"user": "Break down the following task based on the analysis prompt:\n\nParent Task:\nID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}\n\nExpansion Guidance:\n{{expansionPrompt}}{{#if additionalContext}}\n\n{{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\n\n{{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nGenerate {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks with sequential IDs starting from {{nextSubtaskId}}."
|
||||
},
|
||||
"research": {
|
||||
"condition": "useResearch === true && !expansionPrompt",
|
||||
"system": "You are an AI assistant that responds ONLY with valid JSON objects as requested. The object should contain a 'subtasks' array.",
|
||||
"user": "Analyze the following task and break it down into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks using your research capabilities. Assign sequential IDs starting from {{nextSubtaskId}}.\n\nParent Task:\nID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nConsider this context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nCRITICAL: Respond ONLY with a valid JSON object containing a single key \"subtasks\". The value must be an array of the generated subtasks, strictly matching this structure:\n\n{\n \"subtasks\": [\n {\n \"id\": <number>, // Sequential ID starting from {{nextSubtaskId}}\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"dependencies\": [\"<string>\"], // Use full subtask IDs like [\"{{task.id}}.1\", \"{{task.id}}.2\"]. If no dependencies, use an empty array [].\n \"details\": \"<string>\",\n \"testStrategy\": \"<string>\" // Optional\n },\n // ... (repeat for {{#if (gt subtaskCount 0)}}{{subtaskCount}}{{else}}appropriate number of{{/if}} subtasks)\n ]\n}\n\nImportant: For the 'dependencies' field, if a subtask has no dependencies, you MUST use an empty array, for example: \"dependencies\": []. Do not use null or omit the field.\n\nDo not include ANY explanatory text, markdown, or code block markers. Just the JSON object."
|
||||
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}Analyze the following task and break it down into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks using your research capabilities. Assign sequential IDs starting from {{nextSubtaskId}}.\n\nParent Task:\nID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nConsider this context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nCRITICAL: Respond ONLY with a valid JSON object containing a single key \"subtasks\". The value must be an array of the generated subtasks, strictly matching this structure:\n\n{\n \"subtasks\": [\n {\n \"id\": <number>, // Sequential ID starting from {{nextSubtaskId}}\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"dependencies\": [\"<string>\"], // Use full subtask IDs like [\"{{task.id}}.1\", \"{{task.id}}.2\"]. If no dependencies, use an empty array [].\n \"details\": \"<string>\",\n \"testStrategy\": \"<string>\" // Optional\n },\n // ... (repeat for {{#if (gt subtaskCount 0)}}{{subtaskCount}}{{else}}appropriate number of{{/if}} subtasks)\n ]\n}\n\nImportant: For the 'dependencies' field, if a subtask has no dependencies, you MUST use an empty array, for example: \"dependencies\": []. Do not use null or omit the field.\n\nDo not include ANY explanatory text, markdown, or code block markers. Just the JSON object."
|
||||
},
|
||||
"default": {
|
||||
"system": "You are an AI assistant helping with task breakdown for software development.\nYou need to break down a high-level task into {{#if (gt subtaskCount 0)}}{{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks that can be implemented one by one.\n\nSubtasks should:\n1. Be specific and actionable implementation steps\n2. Follow a logical sequence\n3. Each handle a distinct part of the parent task\n4. Include clear guidance on implementation approach\n5. Have appropriate dependency chains between subtasks (using full subtask IDs)\n6. Collectively cover all aspects of the parent task\n\nFor each subtask, provide:\n- id: Sequential integer starting from the provided nextSubtaskId\n- title: Clear, specific title\n- description: Detailed description\n- dependencies: Array of prerequisite subtask IDs using full format like [\"{{task.id}}.1\", \"{{task.id}}.2\"]\n- details: Implementation details, the output should be in string\n- testStrategy: Optional testing approach\n\nRespond ONLY with a valid JSON object containing a single key \"subtasks\" whose value is an array matching the structure described. Do not include any explanatory text, markdown formatting, or code block markers.",
|
||||
"user": "Break down this task into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks:\n\nTask ID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nAdditional context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nReturn ONLY the JSON object containing the \"subtasks\" array, matching this structure:\n\n{\n \"subtasks\": [\n {\n \"id\": {{nextSubtaskId}}, // First subtask ID\n \"title\": \"Specific subtask title\",\n \"description\": \"Detailed description\",\n \"dependencies\": [], // e.g., [\"{{task.id}}.1\", \"{{task.id}}.2\"] for dependencies. Use empty array [] if no dependencies\n \"details\": \"Implementation guidance\",\n \"testStrategy\": \"Optional testing approach\"\n },\n // ... (repeat for {{#if (gt subtaskCount 0)}}a total of {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks with sequential IDs)\n ]\n}"
|
||||
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating subtasks:\n\n1. Use the Glob tool to explore relevant files for this task (e.g., \"**/*.js\", \"src/**/*.ts\")\n2. Use the Grep tool to search for existing implementations related to this task\n3. Use the Read tool to examine files that would be affected by this task\n4. Understand the current implementation state and patterns used\n\nBased on your analysis:\n- Identify existing code that relates to this task\n- Understand patterns and conventions to follow\n- Generate subtasks that integrate smoothly with existing code\n- Ensure subtasks are specific and actionable based on the actual codebase\n\nProject Root: {{projectRoot}}\n\n{{/if}}Break down this task into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks:\n\nTask ID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nAdditional context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nReturn ONLY the JSON object containing the \"subtasks\" array, matching this structure:\n\n{\n \"subtasks\": [\n {\n \"id\": {{nextSubtaskId}}, // First subtask ID\n \"title\": \"Specific subtask title\",\n \"description\": \"Detailed description\",\n \"dependencies\": [], // e.g., [\"{{task.id}}.1\", \"{{task.id}}.2\"] for dependencies. Use empty array [] if no dependencies\n \"details\": \"Implementation guidance\",\n \"testStrategy\": \"Optional testing approach\"\n },\n // ... (repeat for {{#if (gt subtaskCount 0)}}a total of {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks with sequential IDs)\n ]\n}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,12 +40,24 @@
|
||||
"default": "medium",
|
||||
"enum": ["high", "medium", "low"],
|
||||
"description": "Default priority for generated tasks"
|
||||
},
|
||||
"isClaudeCode": {
|
||||
"type": "boolean",
|
||||
"required": false,
|
||||
"default": false,
|
||||
"description": "Whether Claude Code is being used as the provider"
|
||||
},
|
||||
"projectRoot": {
|
||||
"type": "string",
|
||||
"required": false,
|
||||
"default": "",
|
||||
"description": "Project root path for context"
|
||||
}
|
||||
},
|
||||
"prompts": {
|
||||
"default": {
|
||||
"system": "You are an AI assistant specialized in analyzing Product Requirements Documents (PRDs) and generating a structured, logically ordered, dependency-aware and sequenced list of development tasks in JSON format.{{#if research}}\nBefore breaking down the PRD into tasks, you will:\n1. Research and analyze the latest technologies, libraries, frameworks, and best practices that would be appropriate for this project\n2. Identify any potential technical challenges, security concerns, or scalability issues not explicitly mentioned in the PRD without discarding any explicit requirements or going overboard with complexity -- always aim to provide the most direct path to implementation, avoiding over-engineering or roundabout approaches\n3. Consider current industry standards and evolving trends relevant to this project (this step aims to solve LLM hallucinations and out of date information due to training data cutoff dates)\n4. Evaluate alternative implementation approaches and recommend the most efficient path\n5. Include specific library versions, helpful APIs, and concrete implementation guidance based on your research\n6. Always aim to provide the most direct path to implementation, avoiding over-engineering or roundabout approaches\n\nYour task breakdown should incorporate this research, resulting in more detailed implementation guidance, more accurate dependency mapping, and more precise technology recommendations than would be possible from the PRD text alone, while maintaining all explicit requirements and best practices and all details and nuances of the PRD.{{/if}}\n\nAnalyze the provided PRD content and generate {{#if (gt numTasks 0)}}approximately {{numTasks}}{{else}}an appropriate number of{{/if}} top-level development tasks. If the complexity or the level of detail of the PRD is high, generate more tasks relative to the complexity of the PRD\nEach task should represent a logical unit of work needed to implement the requirements and focus on the most direct and effective way to implement the requirements without unnecessary complexity or overengineering. Include pseudo-code, implementation details, and test strategy for each task. Find the most up to date information to implement each task.\nAssign sequential IDs starting from {{nextId}}. Infer title, description, details, and test strategy for each task based *only* on the PRD content.\nSet status to 'pending', dependencies to an empty array [], and priority to '{{defaultTaskPriority}}' initially for all tasks.\nRespond ONLY with a valid JSON object containing a single key \"tasks\", where the value is an array of task objects adhering to the provided Zod schema. Do not include any explanation or markdown formatting.\n\nEach task should follow this JSON structure:\n{\n\t\"id\": number,\n\t\"title\": string,\n\t\"description\": string,\n\t\"status\": \"pending\",\n\t\"dependencies\": number[] (IDs of tasks this depends on),\n\t\"priority\": \"high\" | \"medium\" | \"low\",\n\t\"details\": string (implementation details),\n\t\"testStrategy\": string (validation approach)\n}\n\nGuidelines:\n1. {{#if (gt numTasks 0)}}Unless complexity warrants otherwise{{else}}Depending on the complexity{{/if}}, create {{#if (gt numTasks 0)}}exactly {{numTasks}}{{else}}an appropriate number of{{/if}} tasks, numbered sequentially starting from {{nextId}}\n2. Each task should be atomic and focused on a single responsibility following the most up to date best practices and standards\n3. Order tasks logically - consider dependencies and implementation sequence\n4. Early tasks should focus on setup, core functionality first, then advanced features\n5. Include clear validation/testing approach for each task\n6. Set appropriate dependency IDs (a task can only depend on tasks with lower IDs, potentially including existing tasks with IDs less than {{nextId}} if applicable)\n7. Assign priority (high/medium/low) based on criticality and dependency order\n8. Include detailed implementation guidance in the \"details\" field{{#if research}}, with specific libraries and version recommendations based on your research{{/if}}\n9. If the PRD contains specific requirements for libraries, database schemas, frameworks, tech stacks, or any other implementation details, STRICTLY ADHERE to these requirements in your task breakdown and do not discard them under any circumstance\n10. Focus on filling in any gaps left by the PRD or areas that aren't fully specified, while preserving all explicit requirements\n11. Always aim to provide the most direct path to implementation, avoiding over-engineering or roundabout approaches{{#if research}}\n12. For each task, include specific, actionable guidance based on current industry standards and best practices discovered through research{{/if}}",
|
||||
"user": "Here's the Product Requirements Document (PRD) to break down into {{#if (gt numTasks 0)}}approximately {{numTasks}}{{else}}an appropriate number of{{/if}} tasks, starting IDs from {{nextId}}:{{#if research}}\n\nRemember to thoroughly research current best practices and technologies before task breakdown to provide specific, actionable implementation details.{{/if}}\n\n{{prdContent}}\n\n\n\t\tReturn your response in this format:\n{\n \"tasks\": [\n {\n \"id\": 1,\n \"title\": \"Setup Project Repository\",\n \"description\": \"...\",\n ...\n },\n ...\n ],\n \"metadata\": {\n \"projectName\": \"PRD Implementation\",\n \"totalTasks\": {{#if (gt numTasks 0)}}{{numTasks}}{{else}}{number of tasks}{{/if}},\n \"sourceFile\": \"{{prdPath}}\",\n \"generatedAt\": \"YYYY-MM-DD\"\n }\n}"
|
||||
"user": "{{#if isClaudeCode}}## IMPORTANT: Codebase Analysis Required\n\nYou have access to powerful codebase analysis tools. Before generating tasks:\n\n1. Use the Glob tool to explore the project structure (e.g., \"**/*.js\", \"**/*.json\", \"**/README.md\")\n2. Use the Grep tool to search for existing implementations, patterns, and technologies\n3. Use the Read tool to examine key files like package.json, README.md, and main entry points\n4. Analyze the current state of implementation to understand what already exists\n\nBased on your analysis:\n- Identify what components/features are already implemented\n- Understand the technology stack, frameworks, and patterns in use\n- Generate tasks that build upon the existing codebase rather than duplicating work\n- Ensure tasks align with the project's current architecture and conventions\n\nProject Root: {{projectRoot}}\n\n{{/if}}Here's the Product Requirements Document (PRD) to break down into {{#if (gt numTasks 0)}}approximately {{numTasks}}{{else}}an appropriate number of{{/if}} tasks, starting IDs from {{nextId}}:{{#if research}}\n\nRemember to thoroughly research current best practices and technologies before task breakdown to provide specific, actionable implementation details.{{/if}}\n\n{{prdContent}}\n\n\n\t\tReturn your response in this format:\n{\n \"tasks\": [\n {\n \"id\": 1,\n \"title\": \"Setup Project Repository\",\n \"description\": \"...\",\n ...\n },\n ...\n ],\n \"metadata\": {\n \"projectName\": \"PRD Implementation\",\n \"totalTasks\": {{#if (gt numTasks 0)}}{{numTasks}}{{else}}{number of tasks}{{/if}},\n \"sourceFile\": \"{{prdPath}}\",\n \"generatedAt\": \"YYYY-MM-DD\"\n }\n}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,11 @@ export function findComplexityReportPath(
|
||||
'' // Project root
|
||||
];
|
||||
|
||||
const fileNames = ['task-complexity', 'complexity-report'].map((fileName) => {
|
||||
const fileNames = [
|
||||
'task-complexity-report',
|
||||
'task-complexity',
|
||||
'complexity-report'
|
||||
].map((fileName) => {
|
||||
if (args?.tag && args?.tag !== 'master') {
|
||||
return `${fileName}_${args.tag}.json`;
|
||||
}
|
||||
|
||||
238
tests/unit/ai-providers/openai.test.js
Normal file
238
tests/unit/ai-providers/openai.test.js
Normal file
@@ -0,0 +1,238 @@
|
||||
/**
|
||||
* Tests for OpenAI Provider - Token parameter handling for GPT-5
|
||||
*
|
||||
* This test suite covers:
|
||||
* 1. Correct identification of GPT-5 models requiring max_completion_tokens
|
||||
* 2. Token parameter preparation for different model types
|
||||
* 3. Validation of maxTokens parameter
|
||||
* 4. Integer coercion of token values
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
// Mock the utils module to prevent logging during tests
|
||||
jest.mock('../../../scripts/modules/utils.js', () => ({
|
||||
log: jest.fn()
|
||||
}));
|
||||
|
||||
// Import the provider
|
||||
import { OpenAIProvider } from '../../../src/ai-providers/openai.js';
|
||||
|
||||
describe('OpenAIProvider', () => {
|
||||
let provider;
|
||||
|
||||
beforeEach(() => {
|
||||
provider = new OpenAIProvider();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('requiresMaxCompletionTokens', () => {
|
||||
it('should return true for GPT-5 models', () => {
|
||||
expect(provider.requiresMaxCompletionTokens('gpt-5')).toBe(true);
|
||||
expect(provider.requiresMaxCompletionTokens('gpt-5-mini')).toBe(true);
|
||||
expect(provider.requiresMaxCompletionTokens('gpt-5-nano')).toBe(true);
|
||||
expect(provider.requiresMaxCompletionTokens('gpt-5-turbo')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for non-GPT-5 models', () => {
|
||||
expect(provider.requiresMaxCompletionTokens('gpt-4')).toBe(false);
|
||||
expect(provider.requiresMaxCompletionTokens('gpt-4o')).toBe(false);
|
||||
expect(provider.requiresMaxCompletionTokens('gpt-3.5-turbo')).toBe(false);
|
||||
expect(provider.requiresMaxCompletionTokens('o1')).toBe(false);
|
||||
expect(provider.requiresMaxCompletionTokens('o1-mini')).toBe(false);
|
||||
});
|
||||
|
||||
it('should handle null/undefined modelId', () => {
|
||||
expect(provider.requiresMaxCompletionTokens(null)).toBeFalsy();
|
||||
expect(provider.requiresMaxCompletionTokens(undefined)).toBeFalsy();
|
||||
expect(provider.requiresMaxCompletionTokens('')).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('prepareTokenParam', () => {
|
||||
it('should return max_completion_tokens for GPT-5 models', () => {
|
||||
const result = provider.prepareTokenParam('gpt-5', 1000);
|
||||
expect(result).toEqual({ max_completion_tokens: 1000 });
|
||||
});
|
||||
|
||||
it('should return maxTokens for non-GPT-5 models', () => {
|
||||
const result = provider.prepareTokenParam('gpt-4', 1000);
|
||||
expect(result).toEqual({ maxTokens: 1000 });
|
||||
});
|
||||
|
||||
it('should coerce token value to integer', () => {
|
||||
// Float values
|
||||
const result1 = provider.prepareTokenParam('gpt-5', 1000.7);
|
||||
expect(result1).toEqual({ max_completion_tokens: 1000 });
|
||||
|
||||
const result2 = provider.prepareTokenParam('gpt-4', 1000.7);
|
||||
expect(result2).toEqual({ maxTokens: 1000 });
|
||||
|
||||
// String float
|
||||
const result3 = provider.prepareTokenParam('gpt-5', '1000.7');
|
||||
expect(result3).toEqual({ max_completion_tokens: 1000 });
|
||||
|
||||
// String integers (common CLI input path)
|
||||
expect(provider.prepareTokenParam('gpt-5', '1000')).toEqual({
|
||||
max_completion_tokens: 1000
|
||||
});
|
||||
expect(provider.prepareTokenParam('gpt-4', '1000')).toEqual({
|
||||
maxTokens: 1000
|
||||
});
|
||||
});
|
||||
|
||||
it('should return empty object for undefined maxTokens', () => {
|
||||
const result = provider.prepareTokenParam('gpt-5', undefined);
|
||||
expect(result).toEqual({});
|
||||
});
|
||||
|
||||
it('should handle edge cases', () => {
|
||||
// Test with 0 (should still pass through as 0)
|
||||
const result1 = provider.prepareTokenParam('gpt-5', 0);
|
||||
expect(result1).toEqual({ max_completion_tokens: 0 });
|
||||
|
||||
// Test with string number
|
||||
const result2 = provider.prepareTokenParam('gpt-5', '100');
|
||||
expect(result2).toEqual({ max_completion_tokens: 100 });
|
||||
|
||||
// Test with negative number (will be floored, validation happens elsewhere)
|
||||
const result3 = provider.prepareTokenParam('gpt-4', -10.5);
|
||||
expect(result3).toEqual({ maxTokens: -11 });
|
||||
});
|
||||
});
|
||||
|
||||
describe('validateOptionalParams', () => {
|
||||
it('should accept valid maxTokens values', () => {
|
||||
expect(() =>
|
||||
provider.validateOptionalParams({ maxTokens: 1000 })
|
||||
).not.toThrow();
|
||||
expect(() =>
|
||||
provider.validateOptionalParams({ maxTokens: 1 })
|
||||
).not.toThrow();
|
||||
expect(() =>
|
||||
provider.validateOptionalParams({ maxTokens: '1000' })
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it('should reject invalid maxTokens values', () => {
|
||||
expect(() => provider.validateOptionalParams({ maxTokens: 0 })).toThrow(
|
||||
Error
|
||||
);
|
||||
expect(() => provider.validateOptionalParams({ maxTokens: -1 })).toThrow(
|
||||
Error
|
||||
);
|
||||
expect(() => provider.validateOptionalParams({ maxTokens: NaN })).toThrow(
|
||||
Error
|
||||
);
|
||||
expect(() =>
|
||||
provider.validateOptionalParams({ maxTokens: Infinity })
|
||||
).toThrow(Error);
|
||||
expect(() =>
|
||||
provider.validateOptionalParams({ maxTokens: 'invalid' })
|
||||
).toThrow(Error);
|
||||
});
|
||||
|
||||
it('should accept valid temperature values', () => {
|
||||
expect(() =>
|
||||
provider.validateOptionalParams({ temperature: 0 })
|
||||
).not.toThrow();
|
||||
expect(() =>
|
||||
provider.validateOptionalParams({ temperature: 0.5 })
|
||||
).not.toThrow();
|
||||
expect(() =>
|
||||
provider.validateOptionalParams({ temperature: 1 })
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it('should reject invalid temperature values', () => {
|
||||
expect(() =>
|
||||
provider.validateOptionalParams({ temperature: -0.1 })
|
||||
).toThrow(Error);
|
||||
expect(() =>
|
||||
provider.validateOptionalParams({ temperature: 1.1 })
|
||||
).toThrow(Error);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getRequiredApiKeyName', () => {
|
||||
it('should return OPENAI_API_KEY', () => {
|
||||
expect(provider.getRequiredApiKeyName()).toBe('OPENAI_API_KEY');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getClient', () => {
|
||||
it('should throw error if API key is missing', () => {
|
||||
expect(() => provider.getClient({})).toThrow(Error);
|
||||
});
|
||||
|
||||
it('should create client with apiKey only', () => {
|
||||
const params = {
|
||||
apiKey: 'sk-test-123'
|
||||
};
|
||||
|
||||
// The getClient method should return a function
|
||||
const client = provider.getClient(params);
|
||||
expect(typeof client).toBe('function');
|
||||
|
||||
// The client function should be callable and return a model object
|
||||
const model = client('gpt-4');
|
||||
expect(model).toBeDefined();
|
||||
expect(model.modelId).toBe('gpt-4');
|
||||
});
|
||||
|
||||
it('should create client with apiKey and baseURL', () => {
|
||||
const params = {
|
||||
apiKey: 'sk-test-456',
|
||||
baseURL: 'https://api.openai.example'
|
||||
};
|
||||
|
||||
// Should not throw when baseURL is provided
|
||||
const client = provider.getClient(params);
|
||||
expect(typeof client).toBe('function');
|
||||
|
||||
// The client function should be callable and return a model object
|
||||
const model = client('gpt-5');
|
||||
expect(model).toBeDefined();
|
||||
expect(model.modelId).toBe('gpt-5');
|
||||
});
|
||||
|
||||
it('should return the same client instance for the same parameters', () => {
|
||||
const params = {
|
||||
apiKey: 'sk-test-789'
|
||||
};
|
||||
|
||||
// Multiple calls with same params should work
|
||||
const client1 = provider.getClient(params);
|
||||
const client2 = provider.getClient(params);
|
||||
|
||||
expect(typeof client1).toBe('function');
|
||||
expect(typeof client2).toBe('function');
|
||||
|
||||
// Both clients should be able to create models
|
||||
const model1 = client1('gpt-4');
|
||||
const model2 = client2('gpt-4');
|
||||
expect(model1.modelId).toBe('gpt-4');
|
||||
expect(model2.modelId).toBe('gpt-4');
|
||||
});
|
||||
|
||||
it('should handle different model IDs correctly', () => {
|
||||
const client = provider.getClient({ apiKey: 'sk-test-models' });
|
||||
|
||||
// Test with different models
|
||||
const gpt4 = client('gpt-4');
|
||||
expect(gpt4.modelId).toBe('gpt-4');
|
||||
|
||||
const gpt5 = client('gpt-5');
|
||||
expect(gpt5.modelId).toBe('gpt-5');
|
||||
|
||||
const gpt35 = client('gpt-3.5-turbo');
|
||||
expect(gpt35.modelId).toBe('gpt-3.5-turbo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('name property', () => {
|
||||
it('should have OpenAI as the provider name', () => {
|
||||
expect(provider.name).toBe('OpenAI');
|
||||
});
|
||||
});
|
||||
});
|
||||
134
tests/unit/prompts/expand-task-prompt.test.js
Normal file
134
tests/unit/prompts/expand-task-prompt.test.js
Normal file
@@ -0,0 +1,134 @@
|
||||
import { jest } from '@jest/globals';
|
||||
import { PromptManager } from '../../../scripts/modules/prompt-manager.js';
|
||||
|
||||
describe('expand-task prompt template', () => {
|
||||
let promptManager;
|
||||
|
||||
beforeEach(() => {
|
||||
promptManager = new PromptManager();
|
||||
});
|
||||
|
||||
const testTask = {
|
||||
id: 1,
|
||||
title: 'Setup AWS Infrastructure',
|
||||
description: 'Provision core AWS services',
|
||||
details: 'Create VPC, subnets, and security groups'
|
||||
};
|
||||
|
||||
const baseParams = {
|
||||
task: testTask,
|
||||
subtaskCount: 3,
|
||||
nextSubtaskId: 1,
|
||||
additionalContext: '',
|
||||
complexityReasoningContext: '',
|
||||
gatheredContext: '',
|
||||
useResearch: false,
|
||||
expansionPrompt: undefined
|
||||
};
|
||||
|
||||
test('default variant includes task context', () => {
|
||||
const { userPrompt } = promptManager.loadPrompt(
|
||||
'expand-task',
|
||||
baseParams,
|
||||
'default'
|
||||
);
|
||||
|
||||
expect(userPrompt).toContain(testTask.title);
|
||||
expect(userPrompt).toContain(testTask.description);
|
||||
expect(userPrompt).toContain(testTask.details);
|
||||
expect(userPrompt).toContain('Task ID: 1');
|
||||
});
|
||||
|
||||
test('research variant includes task context', () => {
|
||||
const params = { ...baseParams, useResearch: true };
|
||||
const { userPrompt } = promptManager.loadPrompt(
|
||||
'expand-task',
|
||||
params,
|
||||
'research'
|
||||
);
|
||||
|
||||
expect(userPrompt).toContain(testTask.title);
|
||||
expect(userPrompt).toContain(testTask.description);
|
||||
expect(userPrompt).toContain(testTask.details);
|
||||
expect(userPrompt).toContain('Parent Task:');
|
||||
expect(userPrompt).toContain('ID: 1');
|
||||
});
|
||||
|
||||
test('complexity-report variant includes task context', () => {
|
||||
const params = {
|
||||
...baseParams,
|
||||
expansionPrompt: 'Focus on security best practices',
|
||||
complexityReasoningContext: 'High complexity due to security requirements'
|
||||
};
|
||||
const { userPrompt } = promptManager.loadPrompt(
|
||||
'expand-task',
|
||||
params,
|
||||
'complexity-report'
|
||||
);
|
||||
|
||||
// The fix ensures task context is included
|
||||
expect(userPrompt).toContain('Parent Task:');
|
||||
expect(userPrompt).toContain(`ID: ${testTask.id}`);
|
||||
expect(userPrompt).toContain(`Title: ${testTask.title}`);
|
||||
expect(userPrompt).toContain(`Description: ${testTask.description}`);
|
||||
expect(userPrompt).toContain(`Current details: ${testTask.details}`);
|
||||
|
||||
// Also includes the expansion prompt
|
||||
expect(userPrompt).toContain('Expansion Guidance:');
|
||||
expect(userPrompt).toContain(params.expansionPrompt);
|
||||
expect(userPrompt).toContain(params.complexityReasoningContext);
|
||||
});
|
||||
|
||||
test('all variants request JSON format with subtasks array', () => {
|
||||
const variants = ['default', 'research', 'complexity-report'];
|
||||
|
||||
variants.forEach((variant) => {
|
||||
const params =
|
||||
variant === 'complexity-report'
|
||||
? { ...baseParams, expansionPrompt: 'test' }
|
||||
: baseParams;
|
||||
|
||||
const { systemPrompt, userPrompt } = promptManager.loadPrompt(
|
||||
'expand-task',
|
||||
params,
|
||||
variant
|
||||
);
|
||||
const combined = systemPrompt + userPrompt;
|
||||
|
||||
expect(combined.toLowerCase()).toContain('subtasks');
|
||||
expect(combined).toContain('JSON');
|
||||
});
|
||||
});
|
||||
|
||||
test('complexity-report variant fails without task context regression test', () => {
|
||||
// This test ensures we don't regress to the old behavior where
|
||||
// complexity-report variant only used expansionPrompt without task context
|
||||
const params = {
|
||||
...baseParams,
|
||||
expansionPrompt: 'Generic expansion prompt'
|
||||
};
|
||||
|
||||
const { userPrompt } = promptManager.loadPrompt(
|
||||
'expand-task',
|
||||
params,
|
||||
'complexity-report'
|
||||
);
|
||||
|
||||
// Count occurrences of task-specific content
|
||||
const titleOccurrences = (
|
||||
userPrompt.match(new RegExp(testTask.title, 'g')) || []
|
||||
).length;
|
||||
const descriptionOccurrences = (
|
||||
userPrompt.match(new RegExp(testTask.description, 'g')) || []
|
||||
).length;
|
||||
|
||||
// Should have at least one occurrence of title and description
|
||||
expect(titleOccurrences).toBeGreaterThanOrEqual(1);
|
||||
expect(descriptionOccurrences).toBeGreaterThanOrEqual(1);
|
||||
|
||||
// Should not be ONLY the expansion prompt
|
||||
expect(userPrompt.length).toBeGreaterThan(
|
||||
params.expansionPrompt.length + 100
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -123,7 +123,9 @@ jest.unstable_mockModule(
|
||||
() => ({
|
||||
getDefaultSubtasks: jest.fn(() => 3),
|
||||
getDebugFlag: jest.fn(() => false),
|
||||
getDefaultNumTasks: jest.fn(() => 10)
|
||||
getDefaultNumTasks: jest.fn(() => 10),
|
||||
getMainProvider: jest.fn(() => 'openai'),
|
||||
getResearchProvider: jest.fn(() => 'perplexity')
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@@ -49,7 +49,9 @@ jest.unstable_mockModule(
|
||||
() => ({
|
||||
getDebugFlag: jest.fn(() => false),
|
||||
getDefaultNumTasks: jest.fn(() => 10),
|
||||
getDefaultPriority: jest.fn(() => 'medium')
|
||||
getDefaultPriority: jest.fn(() => 'medium'),
|
||||
getMainProvider: jest.fn(() => 'openai'),
|
||||
getResearchProvider: jest.fn(() => 'perplexity')
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
345
tests/unit/scripts/modules/task-manager/scope-adjustment.test.js
Normal file
345
tests/unit/scripts/modules/task-manager/scope-adjustment.test.js
Normal file
@@ -0,0 +1,345 @@
|
||||
/**
|
||||
* Tests for scope-adjustment.js module
|
||||
*/
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
// Mock dependencies using unstable_mockModule for ES modules
|
||||
jest.unstable_mockModule('../../../../../scripts/modules/utils.js', () => ({
|
||||
log: jest.fn(),
|
||||
readJSON: jest.fn(),
|
||||
writeJSON: jest.fn(),
|
||||
getCurrentTag: jest.fn(() => 'master'),
|
||||
readComplexityReport: jest.fn(),
|
||||
findTaskInComplexityReport: jest.fn(),
|
||||
findProjectRoot: jest.fn()
|
||||
}));
|
||||
|
||||
jest.unstable_mockModule(
|
||||
'../../../../../scripts/modules/ai-services-unified.js',
|
||||
() => ({
|
||||
generateObjectService: jest.fn(),
|
||||
generateTextService: jest.fn()
|
||||
})
|
||||
);
|
||||
|
||||
jest.unstable_mockModule(
|
||||
'../../../../../scripts/modules/task-manager.js',
|
||||
() => ({
|
||||
findTaskById: jest.fn(),
|
||||
taskExists: jest.fn()
|
||||
})
|
||||
);
|
||||
|
||||
jest.unstable_mockModule(
|
||||
'../../../../../scripts/modules/task-manager/analyze-task-complexity.js',
|
||||
() => ({
|
||||
default: jest.fn()
|
||||
})
|
||||
);
|
||||
|
||||
jest.unstable_mockModule('../../../../../src/utils/path-utils.js', () => ({
|
||||
findComplexityReportPath: jest.fn()
|
||||
}));
|
||||
|
||||
// Import modules after mocking
|
||||
const {
|
||||
log,
|
||||
readJSON,
|
||||
writeJSON,
|
||||
readComplexityReport,
|
||||
findTaskInComplexityReport
|
||||
} = await import('../../../../../scripts/modules/utils.js');
|
||||
const { generateObjectService } = await import(
|
||||
'../../../../../scripts/modules/ai-services-unified.js'
|
||||
);
|
||||
const { findTaskById, taskExists } = await import(
|
||||
'../../../../../scripts/modules/task-manager.js'
|
||||
);
|
||||
const { scopeUpTask, scopeDownTask, validateStrength } = await import(
|
||||
'../../../../../scripts/modules/task-manager/scope-adjustment.js'
|
||||
);
|
||||
|
||||
describe('Scope Adjustment Commands', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('scopeUpTask', () => {
|
||||
it('should increase task complexity with regular strength', async () => {
|
||||
// Mock existing task data
|
||||
const mockTasksData = {
|
||||
tasks: [
|
||||
{
|
||||
id: 1,
|
||||
title: 'Simple Task',
|
||||
description: 'Basic description',
|
||||
details: 'Basic implementation details',
|
||||
status: 'pending'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const mockTask = {
|
||||
id: 1,
|
||||
title: 'Simple Task',
|
||||
description: 'Basic description',
|
||||
details: 'Basic implementation details',
|
||||
status: 'pending'
|
||||
};
|
||||
|
||||
readJSON.mockReturnValue(mockTasksData);
|
||||
taskExists.mockReturnValue(true);
|
||||
findTaskById.mockReturnValue({ task: mockTask });
|
||||
generateObjectService.mockResolvedValue({
|
||||
mainResult: {
|
||||
title: 'Complex Task with Advanced Features',
|
||||
description: 'Enhanced description with more requirements',
|
||||
details:
|
||||
'Detailed implementation with error handling, validation, and advanced features',
|
||||
testStrategy:
|
||||
'Comprehensive testing including unit, integration, and edge cases'
|
||||
},
|
||||
telemetryData: { tokens: 100, cost: 0.01 }
|
||||
});
|
||||
|
||||
const context = {
|
||||
projectRoot: '/test/project',
|
||||
tag: 'master',
|
||||
commandName: 'scope-up',
|
||||
outputType: 'cli'
|
||||
};
|
||||
|
||||
const result = await scopeUpTask(
|
||||
'/test/tasks.json',
|
||||
[1],
|
||||
'regular',
|
||||
null, // no custom prompt
|
||||
context,
|
||||
'text'
|
||||
);
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(result.updatedTasks).toHaveLength(1);
|
||||
expect(result.telemetryData).toBeDefined();
|
||||
expect(writeJSON).toHaveBeenCalledWith(
|
||||
'/test/tasks.json',
|
||||
expect.objectContaining({
|
||||
tasks: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: 1,
|
||||
title: 'Complex Task with Advanced Features'
|
||||
})
|
||||
])
|
||||
}),
|
||||
'/test/project',
|
||||
'master'
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle custom prompts for targeted scope adjustments', async () => {
|
||||
const mockTasksData = {
|
||||
tasks: [
|
||||
{
|
||||
id: 1,
|
||||
title: 'Simple Task',
|
||||
description: 'Basic description',
|
||||
details: 'Basic implementation details',
|
||||
status: 'pending'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const mockTask = {
|
||||
id: 1,
|
||||
title: 'Simple Task',
|
||||
description: 'Basic description',
|
||||
details: 'Basic implementation details',
|
||||
status: 'pending'
|
||||
};
|
||||
|
||||
readJSON.mockReturnValue(mockTasksData);
|
||||
taskExists.mockReturnValue(true);
|
||||
findTaskById.mockReturnValue({ task: mockTask });
|
||||
generateObjectService.mockResolvedValue({
|
||||
mainResult: {
|
||||
title: 'Task with Enhanced Security',
|
||||
description: 'Description with security considerations',
|
||||
details: 'Implementation with security validation and encryption',
|
||||
testStrategy: 'Security-focused testing strategy'
|
||||
},
|
||||
telemetryData: { tokens: 120, cost: 0.012 }
|
||||
});
|
||||
|
||||
const context = {
|
||||
projectRoot: '/test/project',
|
||||
tag: 'master',
|
||||
commandName: 'scope-up',
|
||||
outputType: 'cli'
|
||||
};
|
||||
|
||||
const customPrompt = 'Focus on adding security features and validation';
|
||||
|
||||
const result = await scopeUpTask(
|
||||
'/test/tasks.json',
|
||||
[1],
|
||||
'heavy',
|
||||
customPrompt,
|
||||
context,
|
||||
'text'
|
||||
);
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(generateObjectService).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
prompt: expect.stringContaining(
|
||||
'Focus on adding security features and validation'
|
||||
)
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('scopeDownTask', () => {
|
||||
it('should decrease task complexity with regular strength', async () => {
|
||||
const mockTasksData = {
|
||||
tasks: [
|
||||
{
|
||||
id: 1,
|
||||
title: 'Complex Task with Many Features',
|
||||
description: 'Comprehensive description with multiple requirements',
|
||||
details:
|
||||
'Detailed implementation with advanced features, error handling, validation',
|
||||
status: 'pending'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const mockTask = {
|
||||
id: 1,
|
||||
title: 'Complex Task with Many Features',
|
||||
description: 'Comprehensive description with multiple requirements',
|
||||
details:
|
||||
'Detailed implementation with advanced features, error handling, validation',
|
||||
status: 'pending'
|
||||
};
|
||||
|
||||
readJSON.mockReturnValue(mockTasksData);
|
||||
taskExists.mockReturnValue(true);
|
||||
findTaskById.mockReturnValue({ task: mockTask });
|
||||
generateObjectService.mockResolvedValue({
|
||||
mainResult: {
|
||||
title: 'Simple Task',
|
||||
description: 'Basic description',
|
||||
details: 'Basic implementation focusing on core functionality',
|
||||
testStrategy: 'Simple unit tests for core functionality'
|
||||
},
|
||||
telemetryData: { tokens: 80, cost: 0.008 }
|
||||
});
|
||||
|
||||
const context = {
|
||||
projectRoot: '/test/project',
|
||||
tag: 'master',
|
||||
commandName: 'scope-down',
|
||||
outputType: 'cli'
|
||||
};
|
||||
|
||||
const result = await scopeDownTask(
|
||||
'/test/tasks.json',
|
||||
[1],
|
||||
'regular',
|
||||
null,
|
||||
context,
|
||||
'text'
|
||||
);
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(result.updatedTasks).toHaveLength(1);
|
||||
expect(writeJSON).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('strength level validation', () => {
|
||||
it('should validate strength parameter correctly', () => {
|
||||
expect(validateStrength('light')).toBe(true);
|
||||
expect(validateStrength('regular')).toBe(true);
|
||||
expect(validateStrength('heavy')).toBe(true);
|
||||
expect(validateStrength('invalid')).toBe(false);
|
||||
expect(validateStrength('')).toBe(false);
|
||||
expect(validateStrength(null)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('multiple task IDs handling', () => {
|
||||
it('should handle comma-separated task IDs', async () => {
|
||||
const mockTasksData = {
|
||||
tasks: [
|
||||
{
|
||||
id: 1,
|
||||
title: 'Task 1',
|
||||
description: 'Desc 1',
|
||||
details: 'Details 1',
|
||||
status: 'pending'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: 'Task 2',
|
||||
description: 'Desc 2',
|
||||
details: 'Details 2',
|
||||
status: 'pending'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
readJSON.mockReturnValue(mockTasksData);
|
||||
taskExists.mockReturnValue(true);
|
||||
findTaskById
|
||||
.mockReturnValueOnce({
|
||||
task: {
|
||||
id: 1,
|
||||
title: 'Task 1',
|
||||
description: 'Desc 1',
|
||||
details: 'Details 1',
|
||||
status: 'pending'
|
||||
}
|
||||
})
|
||||
.mockReturnValueOnce({
|
||||
task: {
|
||||
id: 2,
|
||||
title: 'Task 2',
|
||||
description: 'Desc 2',
|
||||
details: 'Details 2',
|
||||
status: 'pending'
|
||||
}
|
||||
});
|
||||
|
||||
generateObjectService.mockResolvedValue({
|
||||
mainResult: {
|
||||
title: 'Enhanced Task',
|
||||
description: 'Enhanced description',
|
||||
details: 'Enhanced details',
|
||||
testStrategy: 'Enhanced testing'
|
||||
},
|
||||
telemetryData: { tokens: 100, cost: 0.01 }
|
||||
});
|
||||
|
||||
const context = {
|
||||
projectRoot: '/test/project',
|
||||
tag: 'master',
|
||||
commandName: 'scope-up',
|
||||
outputType: 'cli'
|
||||
};
|
||||
|
||||
const result = await scopeUpTask(
|
||||
'/test/tasks.json',
|
||||
[1, 2],
|
||||
'regular',
|
||||
null,
|
||||
context,
|
||||
'text'
|
||||
);
|
||||
|
||||
expect(result.updatedTasks).toHaveLength(2);
|
||||
expect(generateObjectService).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user