diff --git a/.changeset/floppy-news-buy.md b/.changeset/floppy-news-buy.md new file mode 100644 index 00000000..547ef981 --- /dev/null +++ b/.changeset/floppy-news-buy.md @@ -0,0 +1,38 @@ +--- +"task-master-ai": patch +--- + +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. \ No newline at end of file diff --git a/.cursor/rules/test_workflow.mdc b/.cursor/rules/test_workflow.mdc new file mode 100644 index 00000000..2ec6fe97 --- /dev/null +++ b/.cursor/rules/test_workflow.mdc @@ -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: ['/src', '/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: ['/tests/setup.ts'], + + // Global teardown to prevent worker process leaks + globalTeardown: '/tests/teardown.ts', + + // Module path mapping (if needed) + moduleNameMapper: { + '^@/(.*)$': '/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: ['/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: [ + '/src/**/*.integration.test.ts', + '/tests/integration/**/*.test.ts', + ], + preset: 'ts-jest', + testEnvironment: 'node', + setupFilesAfterEnv: ['/tests/setup/integration.ts'], + testTimeout: 10000, + }, + // E2E tests - full workflows + { + displayName: 'e2e', + testMatch: ['/tests/e2e/**/*.test.ts'], + preset: 'ts-jest', + testEnvironment: 'node', + setupFilesAfterEnv: ['/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 + + + org.junit.jupiter + junit-jupiter + 5.9.2 + test + +``` + +#### **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; +const mockCompare = bcrypt.compare as jest.MockedFunction; + +// ✅ 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) \ No newline at end of file diff --git a/.taskmaster/docs/research/2025-08-01_do-we-need-to-add-new-commands-or-can-we-just-weap.md b/.taskmaster/docs/research/2025-08-01_do-we-need-to-add-new-commands-or-can-we-just-weap.md new file mode 100644 index 00000000..15b8e04b --- /dev/null +++ b/.taskmaster/docs/research/2025-08-01_do-we-need-to-add-new-commands-or-can-we-just-weap.md @@ -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 []`, Git creates a new linked working tree at ``, 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 `, and `task-master worktree remove ` 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* diff --git a/.taskmaster/reports/task-complexity-report.json b/.taskmaster/reports/task-complexity-report.json index 67d523af..b204cb42 100644 --- a/.taskmaster/reports/task-complexity-report.json +++ b/.taskmaster/reports/task-complexity-report.json @@ -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." } ] -} +} \ No newline at end of file diff --git a/.taskmaster/state.json b/.taskmaster/state.json index 7674db09..54eba571 100644 --- a/.taskmaster/state.json +++ b/.taskmaster/state.json @@ -1,9 +1,9 @@ { - "currentTag": "master", - "lastSwitched": "2025-07-22T13:32:03.558Z", - "branchTagMapping": { - "v017-adds": "v017-adds", - "next": "next" - }, - "migrationNoticeShown": true -} + "currentTag": "master", + "lastSwitched": "2025-08-01T14:09:25.838Z", + "branchTagMapping": { + "v017-adds": "v017-adds", + "next": "next" + }, + "migrationNoticeShown": true +} \ No newline at end of file diff --git a/.taskmaster/tasks/tasks.json b/.taskmaster/tasks/tasks.json index cde5d76f..baf73c66 100644 --- a/.taskmaster/tasks/tasks.json +++ b/.taskmaster/tasks/tasks.json @@ -2571,42 +2571,42 @@ "testStrategy": "Testing should verify both the protocol design and implementation:\n\n1. Unit tests for the adapter pattern, ensuring it correctly translates between Taskmaster's internal models and the MCP protocol.\n2. Integration tests with a mock MCP tool or server to validate the full request/response cycle.\n3. Specific tests for the reference implementation (e.g., GitHub-MCP or Postgres-MCP), including authentication flows.\n4. Error handling tests that simulate network failures, timeouts, and malformed responses.\n5. Performance tests to ensure the communication does not introduce significant latency.\n6. Security tests to verify that authentication and encryption mechanisms are functioning correctly.\n7. End-to-end tests demonstrating Taskmaster's ability to programmatically interact with external MCP tools and execute tasks.\n8. Compatibility tests with different versions of the protocol to ensure backward compatibility.\n9. Tests for mode switching:\n - Validate that Taskmaster correctly operates in solo/local mode using the `tasks.json` file.\n - Validate that Taskmaster correctly operates in multiplayer/remote mode with external MCP integrations (e.g., GitHub-MCP or Postgres-MCP).\n - Ensure seamless switching between modes without data loss or corruption.\n10. A test harness should be created to simulate an MCP tool or server for testing purposes without relying on external dependencies. Test cases should be documented thoroughly to serve as examples for other implementations.", "subtasks": [ { - "id": "42-1", + "id": 42, "title": "Define MCP-to-MCP communication protocol", "status": "pending" }, { - "id": "42-2", + "id": 42, "title": "Implement adapter pattern for MCP integration", "status": "pending" }, { - "id": "42-3", + "id": 42, "title": "Develop client module for MCP tool discovery and interaction", "status": "pending" }, { - "id": "42-4", + "id": 42, "title": "Provide reference implementation for GitHub-MCP integration", "status": "pending" }, { - "id": "42-5", + "id": 42, "title": "Add support for solo/local and multiplayer/remote modes", "status": "pending" }, { - "id": "42-6", + "id": 42, "title": "Update core modules to support dynamic mode-based operations", "status": "pending" }, { - "id": "42-7", + "id": 42, "title": "Document protocol and mode-switching functionality", "status": "pending" }, { - "id": "42-8", + "id": 42, "title": "Update terminology to reflect MCP server-based communication", "status": "pending" } @@ -5403,7 +5403,7 @@ "id": 92, "title": "Implement Project Root Environment Variable Support in MCP Configuration", "description": "Add support for a 'TASK_MASTER_PROJECT_ROOT' environment variable in MCP configuration, allowing it to be set in both mcp.json and .env, with precedence over other methods. This will define the root directory for the MCP server and take precedence over all other project root resolution methods. The implementation should be backward compatible with existing workflows that don't use this variable.", - "status": "review", + "status": "done", "dependencies": [ 1, 3, @@ -5417,49 +5417,49 @@ "id": 1, "title": "Update configuration loader to check for TASK_MASTER_PROJECT_ROOT environment variable", "description": "Modify the configuration loading system to check for the TASK_MASTER_PROJECT_ROOT environment variable as the primary source for project root directory. Ensure proper error handling if the variable is set but points to a non-existent or inaccessible directory.", - "status": "pending" + "status": "done" }, { "id": 2, "title": "Add support for 'projectRoot' in configuration files", "description": "Implement support for a 'projectRoot' key in mcp_config.toml and mcp.json configuration files as a fallback when the environment variable is not set. Update the configuration parser to recognize and validate this field.", - "status": "pending" + "status": "done" }, { "id": 3, "title": "Refactor project root resolution logic with clear precedence rules", "description": "Create a unified project root resolution function that follows the precedence order: 1) TASK_MASTER_PROJECT_ROOT environment variable, 2) 'projectRoot' in config files, 3) existing resolution methods. Ensure this function is used consistently throughout the codebase.", - "status": "pending" + "status": "done" }, { "id": 4, "title": "Update all MCP tools to use the new project root resolution", "description": "Identify all MCP tools and components that need to access the project root and update them to use the new resolution logic. Ensure consistent behavior across all parts of the system.", - "status": "pending" + "status": "done" }, { "id": 5, "title": "Add comprehensive tests for the new project root resolution", "description": "Create unit and integration tests to verify the correct behavior of the project root resolution logic under various configurations and edge cases.", - "status": "pending" + "status": "done" }, { "id": 6, "title": "Update documentation with new configuration options", "description": "Update the project documentation to clearly explain the new TASK_MASTER_PROJECT_ROOT environment variable, the 'projectRoot' configuration option, and the precedence rules. Include examples of different configuration scenarios.", - "status": "pending" + "status": "done" }, { "id": 7, "title": "Implement validation for project root directory", "description": "Add validation to ensure the specified project root directory exists and has the necessary permissions. Provide clear error messages when validation fails.", - "status": "pending" + "status": "done" }, { "id": 8, "title": "Implement support for loading environment variables from .env files", "description": "Add functionality to load the TASK_MASTER_PROJECT_ROOT variable from .env files in the workspace, following best practices for environment variable management in MCP servers.", - "status": "pending" + "status": "done" } ] }, @@ -5806,93 +5806,43 @@ }, { "id": 97, - "title": "Implement Git Workflow Integration", - "description": "Add `task-master git` command suite to automate git workflows based on established patterns from Task 4, eliminating manual overhead and ensuring 100% consistency", + "title": "Implement Basic Git Branch Management for Tasks", + "description": "Develop a simple Git integration module that provides essential branch management capabilities for tasks, including creation and tracking", "status": "pending", "dependencies": [], - "priority": "high", - "details": "Create a comprehensive git workflow automation system that integrates deeply with TaskMaster's task management. The feature will:\n\n1. **Automated Branch Management**:\n - Create branches following `task-{id}` naming convention\n - Validate branch names and prevent conflicts\n - Handle branch switching with uncommitted changes\n - Clean up local and remote branches post-merge\n\n2. **Intelligent Commit Generation**:\n - Auto-detect commit type (feat/fix/test/refactor/docs) from file changes\n - Generate standardized commit messages with task context\n - Support subtask-specific commits with proper references\n - Include coverage delta in test commits\n\n3. **PR Automation**:\n - Generate comprehensive PR descriptions from task/subtask data\n - Include implementation details, test coverage, breaking changes\n - Format using GitHub markdown with task hierarchy\n - Auto-populate PR template with relevant metadata\n\n4. **Workflow State Management**:\n - Track current task branch and status\n - Validate task readiness before PR creation\n - Ensure all subtasks completed before finishing\n - Handle merge conflicts gracefully\n\n5. **Integration Points**:\n - Seamless integration with existing task commands\n - MCP server support for IDE integrations\n - GitHub CLI (`gh`) authentication support\n - Coverage report parsing and display\n\n**Technical Architecture**:\n- Modular command structure in `scripts/modules/task-manager/git-*`\n- Git operations wrapper using simple-git or native child_process\n- Template engine for commit/PR generation in `scripts/modules/`\n- State persistence in `.taskmaster/git-state.json`\n- Error recovery and rollback mechanisms\n\n**Key Files to Create**:\n- `scripts/modules/task-manager/git-start.js` - Branch creation and task status update\n- `scripts/modules/task-manager/git-commit.js` - Intelligent commit message generation\n- `scripts/modules/task-manager/git-pr.js` - PR creation with auto-generated description\n- `scripts/modules/task-manager/git-finish.js` - Post-merge cleanup and status update\n- `scripts/modules/task-manager/git-status.js` - Current git workflow state display\n- `scripts/modules/git-operations.js` - Core git functionality wrapper\n- `scripts/modules/commit-analyzer.js` - File change analysis for commit types\n- `scripts/modules/pr-description-generator.js` - PR description template generator\n\n**MCP Integration Files**:\n- `mcp-server/src/core/direct-functions/git-start.js`\n- `mcp-server/src/core/direct-functions/git-commit.js`\n- `mcp-server/src/core/direct-functions/git-pr.js`\n- `mcp-server/src/core/direct-functions/git-finish.js`\n- `mcp-server/src/core/direct-functions/git-status.js`\n- `mcp-server/src/tools/git-start.js`\n- `mcp-server/src/tools/git-commit.js`\n- `mcp-server/src/tools/git-pr.js`\n- `mcp-server/src/tools/git-finish.js`\n- `mcp-server/src/tools/git-status.js`\n\n**Configuration**:\n- Add git workflow settings to `.taskmasterconfig`\n- Support for custom commit prefixes and PR templates\n- Branch naming pattern customization\n- Remote repository detection and validation", - "testStrategy": "Implement comprehensive test suite following Task 4's TDD approach:\n\n1. **Unit Tests** (target: 95%+ coverage):\n - Git operations wrapper with mocked git commands\n - Commit type detection with various file change scenarios\n - PR description generation with different task structures\n - Branch name validation and generation\n - State management and persistence\n\n2. **Integration Tests**:\n - Full workflow simulation in test repository\n - Error handling for git conflicts and failures\n - Multi-task workflow scenarios\n - Coverage integration with real test runs\n - GitHub API interaction (mocked)\n\n3. **E2E Tests**:\n - Complete task lifecycle from start to finish\n - Multiple developer workflow simulation\n - Merge conflict resolution scenarios\n - Branch protection and validation\n\n4. **Test Implementation Details**:\n - Use Jest with git repository fixtures\n - Mock simple-git for isolated unit tests\n - Create test tasks.json scenarios\n - Validate all error messages and edge cases\n - Test rollback and recovery mechanisms\n\n5. **Coverage Requirements**:\n - Minimum 90% overall coverage\n - 100% coverage for critical paths (branch creation, PR generation)\n - All error scenarios must be tested\n - Performance tests for large task hierarchies", + "priority": "medium", + "details": "Implement a basic Git branch management system with the following features:\n\n1. **Core Command Interface**:\n - `task-master git start [task-id]` - Creates a branch with standard naming pattern\n - `task-master git status` - Shows task-related branches and their statuses\n - `task-master git finish [task-id]` - Completes work on a task branch\n\n2. **Simple Configuration**:\n - Use a basic configuration file: `config/git-integration.json`\n - Support for default branch naming template (e.g., `feature/{id}`)\n - Basic team workflow settings\n\n3. **Streamlined Implementation**:\n - Create simple file structure:\n - `scripts/modules/git/index.js` - Main entry point\n - `scripts/modules/git/commands/` - Basic command implementations\n - Use synchronous Git operations for simplicity\n - Focus on supporting the main Git client only\n\n4. **Basic Error Handling**:\n - Standard error messages for common issues\n - Simple input validation\n - Handle basic edge cases:\n - Existing branches\n - Uncommitted changes detection\n\n5. **Core Integration**:\n - Basic task status updates based on branch activity\n - Support for primary remote repository only\n\n6. **User Experience**:\n - Simple terminal output\n - Basic help documentation for commands", + "testStrategy": "Implement a focused testing strategy:\n\n1. **Unit Tests**:\n - Test core command functions\n - Test basic configuration parsing\n - Coverage target: >70% for core functionality\n\n2. **Integration Tests**:\n - Set up simple test repositories\n - Test basic workflows (start, status, finish)\n - Verify correct branch creation and naming\n\n3. **Basic Edge Case Testing**:\n - Test behavior with uncommitted changes\n - Test with simple repository states\n\n4. **Manual Testing**:\n - Create a simple test plan with basic workflows\n - Document expected outcomes\n - Perform manual verification\n\n5. **Documentation Check**:\n - Verify help text for accuracy", "subtasks": [ { "id": 1, - "title": "Design and implement core git operations wrapper", - "description": "Create a robust git operations layer that handles all git commands with proper error handling and state management", + "title": "Implement Core Git Branch Commands", + "description": "Create the essential Git branch command implementations for starting, checking status, and finishing task branches with minimal functionality.", + "dependencies": [], + "details": "Implement the three core commands in their simplest form:\n1. `task-master git start [task-id]` - Create a branch using a basic naming pattern like `feature/{id}`\n2. `task-master git status` - Show only the current task branches without detailed status information\n3. `task-master git finish [task-id]` - Basic completion of a task branch\n\nUse synchronous Git operations and focus only on the happy path. Skip advanced error handling and edge cases. Place all command implementations in `scripts/modules/git/commands/` with minimal code.", "status": "pending", - "details": "Create `scripts/modules/git-operations.js` with methods for:\n- Branch creation/deletion (local and remote)\n- Commit operations with message formatting\n- Status checking and conflict detection\n- Remote operations (fetch, push, pull)\n- Repository validation and setup\n\nUse simple-git library or child_process for git commands. Implement comprehensive error handling with specific error types for different git failures. Include retry logic for network operations.", - "testStrategy": "Unit test all git operations with mocked git commands. Test error scenarios including conflicts, network failures, and invalid states. Achieve 100% coverage." + "testStrategy": "Manual testing only - verify each command works in a simple test repository with the basic workflow: start a branch, check status, finish the branch." }, { "id": 2, - "title": "Implement git start command", - "description": "Create the entry point for task-based git workflows with automated branch creation and task status updates", + "title": "Create Minimal Configuration Setup", + "description": "Set up the simplest possible configuration file structure to support basic branch naming and minimal settings.", + "dependencies": [], + "details": "Create a basic `config/git-integration.json` file with only two settings:\n1. Default branch naming template (e.g., `feature/{id}`)\n2. Default base branch name (e.g., `main`)\n\nImplement a simple function to read this configuration file. Do not implement validation, fallback options, or advanced configuration capabilities. Focus only on the minimal setup needed for the core commands to function.", "status": "pending", - "details": "Implement `scripts/modules/task-manager/git-start.js` with functionality to:\n- Validate task exists and is ready to start\n- Check for clean working directory\n- Create branch with `task-{id}` naming\n- Update task status to 'in-progress'\n- Store workflow state in `.taskmaster/git-state.json`\n- Handle existing branch scenarios\n- Support --force flag for branch recreation\n\nIntegrate with existing task-master commands and ensure MCP compatibility.", - "testStrategy": "Test all scenarios including clean start, existing branches, dirty working directory, and force recreation. Mock git operations and task updates." + "testStrategy": "Verify the configuration file can be read and the values are correctly used by the branch commands." }, { "id": 3, - "title": "Build intelligent commit analyzer and generator", - "description": "Create a system that analyzes file changes to auto-detect commit types and generate standardized commit messages", + "title": "Integrate Git Module with Task System", + "description": "Connect the Git branch commands to the task tracking system with minimal integration to update task statuses.", + "dependencies": [ + "1", + "2" + ], + "details": "Create the main entry point at `scripts/modules/git/index.js` that exposes the three core commands. Implement the simplest possible integration with the task system:\n1. When a branch is started, update the task status to 'in-progress'\n2. When a branch is finished, update the task status to 'completed'\n\nSkip all advanced integrations, error handling, and edge cases. Do not implement remote repository support beyond the absolute basics. Focus only on making the commands accessible through the main CLI interface.", "status": "pending", - "details": "Develop `scripts/modules/commit-analyzer.js` with:\n- File change detection and categorization\n- Commit type inference rules:\n - feat: new files in scripts/, new functions\n - fix: changes to existing logic\n - test: changes in tests/ directory\n - docs: markdown and comment changes\n - refactor: file moves, renames, cleanup\n- Smart message generation with task context\n- Support for custom commit templates\n- Subtask reference inclusion\n\nCreate `scripts/modules/task-manager/git-commit.js` that uses the analyzer to generate commits with proper formatting.", - "testStrategy": "Test commit type detection with various file change combinations. Validate message generation for all scenarios. Test edge cases and custom templates." - }, - { - "id": 4, - "title": "Create PR description generator and command", - "description": "Build a comprehensive PR description generator that creates detailed, formatted descriptions from task data", - "status": "pending", - "details": "Implement `scripts/modules/pr-description-generator.js` to generate:\n- Task overview with full context\n- Subtask completion checklist\n- Implementation details summary\n- Test coverage metrics integration\n- Breaking changes section\n- Related tasks and dependencies\n\nCreate `scripts/modules/task-manager/git-pr.js` to:\n- Validate all subtasks are complete\n- Generate PR title and description\n- Use GitHub CLI for PR creation\n- Handle draft PR scenarios\n- Support custom PR templates\n- Include labels based on task metadata", - "testStrategy": "Test PR generation with various task structures. Validate markdown formatting and GitHub compatibility. Test with incomplete subtasks and edge cases." - }, - { - "id": 5, - "title": "Implement git finish command with cleanup", - "description": "Create the workflow completion command that handles post-merge cleanup and task status updates", - "status": "pending", - "details": "Build `scripts/modules/task-manager/git-finish.js` with:\n- PR merge verification via GitHub API\n- Local branch cleanup\n- Remote branch deletion (with confirmation)\n- Task status update to 'done'\n- Workflow state cleanup\n- Switch back to main branch\n- Pull latest changes\n\nHandle scenarios where PR isn't merged yet or merge failed. Include --skip-cleanup flag for manual branch management.", - "testStrategy": "Test successful completion flow, unmerged PR handling, and cleanup failures. Mock GitHub API and git operations. Validate state cleanup." - }, - { - "id": 6, - "title": "Add git status command for workflow visibility", - "description": "Create a status command that shows current git workflow state with task context", - "status": "pending", - "details": "Implement `scripts/modules/task-manager/git-status.js` to display:\n- Current task and branch information\n- Subtask completion status\n- Uncommitted changes summary\n- PR status if exists\n- Coverage metrics comparison\n- Suggested next actions\n\nIntegrate with existing task status displays and provide actionable guidance based on workflow state.", - "testStrategy": "Test status display in various workflow states. Validate suggestion logic and formatting. Test with missing or corrupted state." - }, - { - "id": 7, - "title": "Integrate with Commander.js and add command routing", - "description": "Add the git command suite to TaskMaster's CLI with proper help text and option handling", - "status": "pending", - "details": "Update `scripts/modules/commands.js` to:\n- Add 'git' command with subcommands\n- Implement option parsing for all git commands\n- Add comprehensive help text\n- Ensure proper error handling and display\n- Validate command prerequisites\n\nCreate proper command structure:\n- `task-master git start [taskId] [options]`\n- `task-master git commit [options]`\n- `task-master git pr [options]`\n- `task-master git finish [options]`\n- `task-master git status [options]`", - "testStrategy": "Test command registration and routing. Validate help text and option parsing. Test error handling for invalid commands." - }, - { - "id": 8, - "title": "Add MCP server integration for git commands", - "description": "Implement MCP tools and direct functions for git workflow commands to enable IDE integration", - "status": "pending", - "details": "Create MCP integration in:\n- `mcp-server/src/core/direct-functions/git-start.js`\n- `mcp-server/src/core/direct-functions/git-commit.js`\n- `mcp-server/src/core/direct-functions/git-pr.js`\n- `mcp-server/src/core/direct-functions/git-finish.js`\n- `mcp-server/src/core/direct-functions/git-status.js`\n- `mcp-server/src/tools/git-start.js`\n- `mcp-server/src/tools/git-commit.js`\n- `mcp-server/src/tools/git-pr.js`\n- `mcp-server/src/tools/git-finish.js`\n- `mcp-server/src/tools/git-status.js`\n\nImplement tools for:\n- git_start_task\n- git_commit_task\n- git_create_pr\n- git_finish_task\n- git_workflow_status\n\nEnsure proper error handling, logging, and response formatting. Include telemetry data for git operations.", - "testStrategy": "Test MCP tool registration and execution. Validate response formats and error handling. Test with various parameter combinations." - }, - { - "id": 9, - "title": "Create comprehensive test suite", - "description": "Implement full test coverage following Task 4's high standards with unit, integration, and E2E tests", - "status": "pending", - "details": "Create test files:\n- `tests/unit/git/` - Unit tests for all git components\n- `tests/integration/git-workflow.test.js` - Full workflow tests\n- `tests/e2e/git-automation.test.js` - End-to-end scenarios\n\nImplement:\n- Git repository fixtures and mocks\n- Coverage tracking and reporting\n- Performance benchmarks\n- Error scenario coverage\n- Multi-developer workflow simulations\n\nTarget 95%+ coverage with focus on critical paths.", - "testStrategy": "Follow TDD approach. Write tests before implementation. Use Jest with proper mocking. Validate all edge cases and error scenarios." - }, - { - "id": 10, - "title": "Add configuration and documentation", - "description": "Create configuration options and comprehensive documentation for the git workflow feature", - "status": "pending", - "details": "Configuration tasks:\n- Add git workflow settings to `.taskmasterconfig`\n- Support environment variables for GitHub tokens\n- Create default PR and commit templates\n- Add branch naming customization\n\nDocumentation tasks:\n- Update README with git workflow section\n- Create `docs/git-workflow.md` guide\n- Add examples for common scenarios\n- Document configuration options\n- Create troubleshooting guide\n\nUpdate rule files:\n- Create `.cursor/rules/git_workflow.mdc`\n- Update existing workflow rules", - "testStrategy": "Test configuration loading and validation. Verify documentation accuracy with real usage scenarios. Test template rendering." + "testStrategy": "Test the complete workflow manually: create a task, start a branch for it, verify the task status changes, finish the branch, and verify the task status updates accordingly." } ] }, @@ -6330,7 +6280,7 @@ "id": 103, "title": "Implement Tagged Task Lists System for Multi-Context Task Management", "description": "Develop a comprehensive tagged task lists system enabling users to organize, filter, and manage tasks across multiple contexts (e.g., personal, branch, version) with full backward compatibility.", - "status": "in-progress", + "status": "done", "dependencies": [ 3, 11, @@ -6402,7 +6352,7 @@ 4 ], "details": "Enable seamless context switching between code branches and task tags. Use add-tag internally when creating tags from branch names.\n\n**Code Context Analysis Complete**\n\n**Current State:**\n- `state.json` has `branchTagMapping: {}` ready for storing git branch to tag mappings\n- `config.json` has `tags.enabledGitworkflow: false` and `tags.autoSwitchTagWithBranch: false` controls\n- Existing tag management functions in `scripts/modules/task-manager/tag-management.js` provide `createTag`, `useTag`, `switchCurrentTag` utilities\n- No existing git integration - need to add git CLI dependencies\n\n**Implementation Plan:**\n\n1. **Add Git Dependencies**: Add `simple-git` package for git operations (better than calling CLI directly)\n2. **Create Git Utilities Module**: `scripts/modules/utils/git-utils.js` with functions:\n - `getCurrentBranch()` - Get current git branch name\n - `isGitRepository()` - Check if we're in a git repo\n - `getBranchList()` - Get list of all branches\n - `onBranchChange()` - Hook for branch change detection\n\n3. **Enhance Tag Management**: Add git integration functions:\n - `createTagFromBranch(branchName)` - Create tag from git branch name\n - `autoSwitchTagForBranch()` - Auto-switch tag when branch changes\n - `updateBranchTagMapping()` - Update state.json mapping\n\n4. **Add CLI Commands**:\n - `--from-branch` flag for `add-tag` command\n - `task-master sync-git` command for manual git-tag synchronization\n\n5. **Configuration Integration**: \n - Check `config.tags.enabledGitworkflow` before git operations\n - Use `config.tags.autoSwitchTagWithBranch` for automatic switching\n\n**Next Steps**: Start with adding simple-git dependency and creating git utilities module.\n\n\n**Updated Implementation Strategy - Automatic Git Integration**\n\n**Revised Approach:**\n- Eliminate manual `sync-git` command for seamless user experience\n- Implement automatic git-tag synchronization following the established migration pattern\n- Integration occurs transparently during normal task operations without user intervention\n- Behavior controlled entirely through existing configuration flags\n\n**Updated Implementation Plan:**\n\n1. **Simplified Git Dependencies**: Keep `simple-git` package for git operations\n\n2. **Enhanced Git Utilities Module**: `scripts/modules/utils/git-utils.js` with streamlined functions:\n - `getCurrentBranch()` - Get current git branch name\n - `isGitRepository()` - Check if we're in a git repo\n - `shouldAutoSync()` - Check if git workflow is enabled and conditions are met\n\n3. **Automatic Integration Hook**: \n - Add `checkAndSyncGitTags()` function to utils.js\n - Integrate into `readJSON()` similar to migration system\n - Automatically create tags from branch names when conditions are met\n - Update branch-tag mappings in state.json transparently\n\n4. **Streamlined Tag Management**: Remove complex CLI additions:\n - No `--from-branch` flag needed for `add-tag`\n - No manual `sync-git` command\n - Automatic tag creation and switching based on git context\n\n5. **Configuration-Driven Behavior**:\n - `config.tags.enabledGitworkflow` enables/disables entire system\n - `config.tags.autoSwitchTagWithBranch` controls automatic tag switching\n - Silent operation when disabled, seamless when enabled\n\n**Benefits**: Zero-friction git integration that \"just works\" when enabled, following established project patterns for automatic system enhancements.\n\n\n**✅ IMPLEMENTATION COMPLETED**\n\n**Final Implementation Summary:**\n\n1. **Proper Module Organization**: \n - Moved `checkAndAutoSwitchGitTag` function to correct location in `scripts/modules/utils/git-utils.js`\n - Updated imports in `utils.js` to use the git-utils version\n - Maintains clean separation of concerns with git operations in dedicated module\n\n2. **Seamless Integration Architecture**:\n - Function automatically executes during `readJSON()` operations\n - Integrates with both migration system and normal tagged format processing\n - Zero user intervention required - works transparently in background\n\n3. **Smart Git-Tag Synchronization**:\n - Automatically switches to existing tags matching current branch names\n - Creates new tags for branches without corresponding tags\n - Updates `state.json` branch-tag mappings for persistent tracking\n - Validates branch names (excludes main/master/develop/dev/HEAD)\n\n4. **Configuration-Driven Operation**:\n - Controlled by `config.tags.enabledGitworkflow` and `config.tags.autoSwitchTagWithBranch` flags\n - Silent operation when disabled, seamless when enabled\n - Uses `console.debug` for error handling to avoid disrupting normal operations\n\n5. **MCP-Compatible Design**:\n - All functions require `projectRoot` parameter for MCP compatibility\n - Leverages existing git utility functions (`isGitRepository`, `getCurrentBranch`, `isValidBranchForTag`, `sanitizeBranchNameForTag`)\n - Follows established project patterns for automatic system enhancements\n\n**Status**: Implementation complete and ready for production use. Users can enable automatic git integration by configuring the appropriate flags in `.taskmaster/config.json`.\n\n\n**SCOPE SIMPLIFIED: Basic CLI Git Integration Only**\n\n**Implementation Status Changed:**\n- **CANCELLED**: All automatic git-tag synchronization features\n- **CANCELLED**: Configuration-driven git workflow automation \n- **CANCELLED**: Silent background git integration\n- **CANCELLED**: Branch-tag mapping persistence and auto-switching\n\n**COMPLETED: Core Git Utilities**\n- Git utilities module with MCP-compatible functions ready\n- Branch name sanitization and validation implemented\n- Git repository detection working\n\n**REMAINING WORK: CLI Integration**\n- Add `--from-branch` flag to `add-tag` command in `scripts/modules/commands.js`\n- Integrate existing git utilities with tag creation workflow\n- Enable `task-master add-tag --from-branch` command functionality\n\n**Final Simplified Scope:**\nSingle explicit command: `task-master add-tag --from-branch`\n- Detects current git branch name\n- Sanitizes branch name to valid tag format\n- Creates new tag with sanitized name\n- No automation, no background processes, no persistent mappings\n\n**Benefits**: Explicit user control, predictable behavior, simple implementation, easy debugging, clear separation of concerns between git and task management.\n\n**Next Step**: Implement CLI flag integration to complete the simplified git integration feature.\n", - "status": "deferred", + "status": "done", "testStrategy": "Test tag creation and switching in repositories with multiple branches." }, { @@ -6530,7 +6480,7 @@ "title": "Implement Task Template Importing from External .json Files", "description": "Implement a mechanism to import tasks from external .json files, treating them as task templates. This allows users to add new .json files to the .taskmaster/tasks folder. The system should read these files, extract tasks under a specific tag, and merge them into the main tasks.json. The 'master' tag from template files must be ignored to prevent conflicts, and the primary tasks.json file will always take precedence over imported tags.", "details": "Key implementation steps: 1. Develop a file watcher or a manual import command to detect and process new .json files in the tasks directory. 2. Implement logic to read an external json file, identify the tag key, and extract the array of tasks. 3. Handle potential conflicts: if an imported tag already exists in the main tasks.json, the existing tasks should be preserved and new ones appended, or the import should be skipped based on a defined precedence rule. 4. Ignore any 'master' key in template files to protect the integrity of the main task list. 5. Update task ID sequencing to ensure imported tasks are assigned unique IDs that don't conflict with existing tasks.\n\n**UPDATED IMPLEMENTATION PLAN - Silent Task Template Discovery**\n\n**Core Architecture Changes**:\n- Replace manual import workflow with automatic file discovery during tag operations\n- Implement file pattern matching for `tasks_*.json` files in tasks directory\n- Create seamless tag resolution system that checks external files when tags not found in main tasks.json\n\n**Silent Discovery Mechanism**:\n- Scan for `tasks_*.json` files during any tag-related operation (list-tags, use-tag, etc.)\n- Extract tag names from filenames and validate against internal tag keys\n- Build dynamic tag registry combining main tasks.json tags with discovered external tags\n- Apply precedence rule: main tasks.json tags override external files with same tag name\n\n**File Naming and Structure Convention**:\n- External files follow pattern: `tasks_[tagname].json` where tagname must match internal tag key\n- Files contain same structure as main tasks.json but only the specific tag section is used\n- Master key in external files is ignored to prevent conflicts with main task list\n\n**Key Implementation Updates**:\n- Enhance `getAvailableTags()` to include filesystem scan and merge results\n- Modify tag resolution logic to check external files as fallback when tag missing from main file\n- Update `listTags()` to display external tags with visual indicator (e.g., \"[ext]\" suffix)\n- Implement read-only access for external tags - all task modifications route to main tasks.json\n- Add error handling for malformed external files without breaking core functionality\n\n**User Experience Flow**:\n- Users drop `tasks_projectname.json` files into tasks directory\n- Tags become immediately available via `task-master use-tag projectname`\n- No manual import commands or configuration required\n- External tags appear in tag listings alongside main tags\n\n**Benefits Over Manual Import**:\n- Zero-friction workflow for adding new task contexts\n- Supports team collaboration through shared task template files\n- Enables multi-project task management without cluttering main tasks.json\n- Maintains clean separation between permanent tasks and temporary project contexts\n\n\n**Tag Preservation Bug Fix Testing**\n\nConducted testing to verify the fix for the tag preservation bug where tag structures were being lost during operations. The fix ensures that:\n\n- Tag hierarchies and relationships are maintained during file discovery operations\n- External tag files preserve their internal structure when accessed through the silent discovery mechanism\n- Main tasks.json tag integrity is protected during external file scanning\n- Tag metadata and associations remain intact across read operations\n- No data corruption occurs when switching between main and external tag contexts\n\nTesting confirmed that tag structures now persist correctly without loss of organizational data or task relationships within tagged contexts.\n\n\n**MCP Server Update-Subtask Tool Testing**\n\nPerformed testing of the MCP server's update-subtask tool to verify it maintains tag structure integrity during subtask modifications. The test confirms that:\n\n- Tag hierarchies remain intact when subtasks are updated through the MCP interface\n- External tag file references are preserved during update operations\n- Silent discovery mechanism continues to function correctly after subtask modifications\n- No tag disappearance occurs when using the MCP server tools for task management\n- Tag preservation fixes remain effective across different update pathways including MCP server operations\n\nThis validates that the tag structure preservation improvements work consistently across both direct CLI operations and MCP server-mediated task updates.\n\n\n**IMPLEMENTATION STARTED - External File Discovery System**\n\n**Current Progress:**\n- ✅ Analyzed existing tag management architecture\n- ✅ Identified integration points in `readJSON`, `tags()`, and tag resolution logic\n- ✅ Confirmed file naming convention: `tasks_[tagname].json` pattern\n- 🔄 **STARTING**: Implementation of core external file discovery functions\n\n**Implementation Plan:**\n1. **Create External File Discovery Functions** in `utils.js`:\n - `scanForExternalTaskFiles(projectRoot)` - Scan tasks directory for `tasks_*.json` files\n - `getExternalTagsFromFiles(projectRoot)` - Extract tag names from external files\n - `readExternalTagData(projectRoot, tagName)` - Read specific external tag data\n - `getAvailableTags(projectRoot)` - Enhanced to include both main + external tags\n\n2. **Enhance Tag Resolution Logic** in `readJSON`:\n - Add fallback to external files when tag not found in main tasks.json\n - Maintain precedence: main tasks.json tags override external files\n - Preserve read-only access for external tags\n\n3. **Update `tags()` Function** in `tag-management.js`:\n - Display external tags with `[ext]` indicator\n - Show external tag metadata and task counts\n - Maintain current tag highlighting and sorting\n\n4. **Integration Points**:\n - `readJSON()` - Add external file fallback in tag resolution\n - `tags()` - Include external tags in listing\n - `useTag()` - Support switching to external tags\n - All tag operations maintain read-only access for external tags\n\n**Next Step:** Implementing external file discovery functions in utils.js\n\n\n**IMPLEMENTATION PROGRESS UPDATE - External File Discovery System**\n\n**Current Status:**\n- ✅ Analyzed existing tag management architecture\n- ✅ Identified integration points in `readJSON`, `tags()`, and tag resolution logic\n- ✅ Confirmed file naming convention: `tasks_[tagname].json` pattern\n- 🔄 **IN PROGRESS**: Implementation of core external file discovery functions\n\n**Updated Implementation Plan:**\n1. **Create External File Discovery Functions** in `utils.js`:\n - `scanForExternalTaskFiles(projectRoot)` - Scan tasks directory for `tasks_*.json` files\n - `getExternalTagsFromFiles(projectRoot)` - Extract tag names from external files\n - `readExternalTagData(projectRoot, tagName)` - Read specific external tag data\n - `getAvailableTags(projectRoot)` - Enhanced to include both main + external tags\n\n2. **Enhance Tag Resolution Logic** in `readJSON`:\n - Add fallback to external files when tag not found in main tasks.json\n - Maintain precedence: main tasks.json tags override external files\n - Preserve read-only access for external tags\n\n3. **Update `tags()` Function** in `tag-management.js`:\n - Display external tags with `(imported)` indicator *(updated from [ext])*\n - Show external tag metadata and task counts\n - Maintain current tag highlighting and sorting\n\n4. **Integration Points**:\n - `readJSON()` - Add external file fallback in tag resolution\n - `tags()` - Include external tags in listing with `(imported)` suffix\n - `useTag()` - Support switching to external tags\n - All tag operations maintain read-only access for external tags\n\n**Visual Indicator Change:**\n- **Previous**: External tags shown with `[ext]` suffix\n- **Updated**: External tags shown with `(imported)` suffix for better UX\n\n**Next Step:** Continuing implementation of external file discovery functions in utils.js\n\n\n**IMPLEMENTATION SIZE ASSESSMENT - External File Discovery System**\n\n**Scope: Moderate Implementation (~150-200 lines total)**\n\n**Core Functions to Add (4-5 functions in utils.js):**\n1. `scanForExternalTaskFiles(projectRoot)` - ~20-30 lines\n - Use fs.readdirSync to scan tasks directory\n - Filter for `tasks_*.json` pattern using regex\n - Return array of discovered external files\n\n2. `getExternalTagsFromFiles(projectRoot)` - ~15-20 lines \n - Call scanForExternalTaskFiles()\n - Extract tag names from filenames using regex\n - Return array of external tag names\n\n3. `readExternalTagData(projectRoot, tagName)` - ~25-35 lines\n - Construct external file path: `tasks/tasks_${tagName}.json`\n - Read and parse JSON with error handling\n - Return tag data or null if not found/invalid\n\n4. `getAvailableTags(projectRoot)` - ~20-30 lines\n - Get main tags from existing readJSON logic\n - Get external tags from getExternalTagsFromFiles()\n - Merge and deduplicate, prioritizing main tags\n - Return combined tag list with metadata\n\n**Integration Points (3 main areas):**\n1. **Enhance `readJSON()` function** - Add ~15-20 lines\n - Add external file fallback when tag not found in main tasks.json\n - Maintain precedence: main tasks.json > external files\n - Preserve existing error handling patterns\n\n2. **Update `tags()` function** in tag-management.js - Modify ~10-15 lines\n - Use enhanced getAvailableTags() instead of current logic\n - Display external tags with `(imported)` indicator\n - Show external tag metadata and task counts\n - Maintain current tag highlighting and sorting\n\n3. **Update `useTag()` function** in tag-management.js - Modify ~5-10 lines\n - Allow switching to external tags (read-only mode)\n - Update state.json with external tag context\n - Display appropriate warnings for read-only external tags\n\n**Testing Requirements:**\n- Create test external files: `tasks_feature-branch.json`, `tasks_v2.json`\n- Test tag listing with mixed main/external tags\n- Test tag switching to external tags\n- Test read-only behavior for external tags\n- Test precedence when same tag exists in both main and external\n\n**Total Estimated Lines: ~150-200 lines**\n**Estimated Time: 45-60 minutes**\n**Complexity: Moderate - mostly file I/O and data merging logic**\n", - "status": "deferred", + "status": "done", "dependencies": [], "parentTaskId": 103 }, @@ -6557,10 +6507,8 @@ { "id": 104, "title": "Implement 'scope-up' and 'scope-down' CLI Commands for Dynamic Task Complexity Adjustment", - "description": "Add new CLI commands 'scope-up' and 'scope-down' to enable users to dynamically increase or decrease the complexity of tasks or subtasks, with support for multiple IDs, strength levels, and milestone-aware adjustments.", - "details": "1. Extend the CLI (commands.js) to introduce 'scope-up' and 'scope-down' commands, following established subcommand patterns for consistency and discoverability. \n2. Accept comma-separated task/subtask IDs and an optional '--strength' flag (light|regular|heavy, defaulting to regular). Validate all inputs, ensuring referenced tasks/subtasks exist and strength is valid.\n3. Fetch current task details and associated milestone context to inform the adjustment logic.\n4. Implement core logic functions that:\n - Construct context-aware AI prompts for scaling complexity up or down, leveraging the current state, project phase, and strength parameter.\n - Call the unified AI service (ai-services-unified.js) to generate new task/subtask content at the desired complexity level.\n - Replace existing task details and subtasks with the AI-generated output, preserving historical versions for rollback/comparison.\n - Ensure task dependency integrity and update tasks.json and related files accordingly.\n5. Integrate robust error handling for invalid IDs, parameters, or AI failures, and provide clear CLI output showing before/after differences.\n6. Add corresponding MCP tool equivalents for integrated environments and update documentation/help text to reflect new commands and usage patterns.\n7. Ensure compatibility with batch operations, milestone-based guidelines, and existing task management workflows.", - "testStrategy": "- Write unit and integration tests for both 'scope-up' and 'scope-down' commands, covering single and multiple ID scenarios, all strength levels, and edge cases (e.g., non-existent IDs, invalid strength values).\n- Simulate CLI usage to verify correct parsing, validation, and error handling.\n- Test AI prompt construction and output integration, ensuring that task complexity is adjusted as expected for each strength level and milestone context.\n- Verify that historical data is preserved and that before/after summaries are accurate and clear.\n- Confirm that task dependencies remain intact and that batch operations work as intended.\n- Validate MCP tool integration and documentation updates.", - "status": "pending", + "description": "Add new CLI commands 'scope-up' and 'scope-down' to enable users to dynamically increase or decrease the complexity of tasks or subtasks, with support for multiple IDs, strength levels, milestone-aware adjustments, and custom prompts for targeted modifications.", + "status": "done", "dependencies": [ 3, 11, @@ -6568,22 +6516,68 @@ 94 ], "priority": "high", + "details": "1. Extend the CLI (commands.js) to introduce 'scope-up' and 'scope-down' commands, following established subcommand patterns for consistency and discoverability. \n2. Accept comma-separated task/subtask IDs and an optional '--strength' flag (light|regular|heavy, defaulting to regular). Validate all inputs, ensuring referenced tasks/subtasks exist and strength is valid.\n3. Implement a '--prompt' flag that allows users to specify custom instructions for how to scope up/down tasks, including targeting specific parts of tasks/subtasks (e.g., removing unnecessary test sections, focusing on particular implementation aspects).\n4. Fetch current task details and associated milestone context to inform the adjustment logic.\n5. Implement core logic functions that:\n - Construct context-aware AI prompts for scaling complexity up or down, leveraging the current state, project phase, strength parameter, and any user-provided custom prompt.\n - Call the unified AI service (ai-services-unified.js) to generate new task/subtask content at the desired complexity level.\n - Replace existing task details and subtasks with the AI-generated output, preserving historical versions for rollback/comparison.\n - Ensure task dependency integrity and update tasks.json and related files accordingly.\n6. Integrate robust error handling for invalid IDs, parameters, or AI failures, and provide clear CLI output showing before/after differences.\n7. Add corresponding MCP tool equivalents for integrated environments and update documentation/help text to reflect new commands and usage patterns.\n8. Ensure compatibility with batch operations, milestone-based guidelines, and existing task management workflows.", + "testStrategy": "- Write unit and integration tests for both 'scope-up' and 'scope-down' commands, covering single and multiple ID scenarios, all strength levels, custom prompts, and edge cases (e.g., non-existent IDs, invalid strength values).\n- Test various custom prompt scenarios, including prompts that target specific sections of tasks/subtasks for modification.\n- Simulate CLI usage to verify correct parsing, validation, and error handling.\n- Test AI prompt construction and output integration, ensuring that task complexity is adjusted as expected for each strength level, milestone context, and custom prompt.\n- Verify that historical data is preserved and that before/after summaries are accurate and clear.\n- Confirm that task dependencies remain intact and that batch operations work as intended.\n- Validate MCP tool integration and documentation updates.", "subtasks": [ { - "id": 2, - "title": "Set up Authentication System and User Management Backend", - "description": "Implement the complete authentication infrastructure including user registration, login, password reset, and session management with database schema and API endpoints.", + "id": 1, + "title": "Extend CLI with scope-up and scope-down commands", + "description": "Implement the basic command structure for scope-up and scope-down in commands.js, following established patterns and adding appropriate help text. [Updated: 2025-08-01]", "dependencies": [], - "details": "Create user database schema with fields for id, email, password_hash, name, bio, avatar_url, created_at, updated_at. Implement JWT-based authentication with refresh tokens. Set up API endpoints for /auth/register, /auth/login, /auth/logout, /auth/refresh, /auth/forgot-password, /auth/reset-password, /auth/verify-email. Include password hashing with bcrypt, email verification system, and role-based access control with user roles (admin, user). Implement middleware for route protection and session validation.", - "status": "pending", - "testStrategy": "Unit tests for authentication functions, integration tests for auth API endpoints, test password reset flow, verify JWT token generation and validation" + "details": "1. Add new command definitions in commands.js for 'scope-up' and 'scope-down'\n2. Implement command argument parsing for comma-separated task/subtask IDs\n3. Add the '--strength' flag with validation for 'light', 'regular', and 'heavy' options (default to 'regular')\n4. Add the '--prompt' flag for custom scoping instructions\n5. Create help text and usage examples for both commands\n6. Ensure commands follow the established pattern of other Task Master commands\n7. Implement basic input validation (checking if IDs exist, strength values are valid)\n\nTDD Progress Update:\n\n1. Completed test setup:\n - Fixed test file to use ES module imports instead of CommonJS require\n - Jest watch mode is running and showing failing tests as expected\n\n2. Implemented comprehensive test coverage for scope adjustment functionality:\n - Tests for scopeUpTask and scopeDownTask core functions\n - Strength level validation (light/regular/heavy)\n - Custom prompt handling\n - Multiple task ID processing\n - AI service integration testing\n\n3. Current test status:\n - All 5 tests are failing as expected (function modules don't exist yet)\n - Ready to implement core logic to make tests pass\n - Following TDD red-green-refactor cycle\n\n4. Next implementation step:\n - Creating scripts/modules/task-manager/scope-adjustment.js with core functions to make tests pass\n\n\nTesting the subtask note feature from the kanban board. This is a simple test to verify that notes can be added directly from the kanban view. The feature appears to be working as expected.\n", + "status": "done", + "testStrategy": "Write unit tests for command registration, argument parsing, and input validation. Test with various combinations of valid and invalid inputs including non-existent task IDs, invalid strength values, and empty inputs." + }, + { + "id": 2, + "title": "Implement task/subtask retrieval and context gathering", + "description": "Create functions to retrieve task/subtask details and gather relevant context information needed for complexity adjustment.", + "dependencies": [ + "104.1" + ], + "details": "1. Implement a function to fetch task and subtask details by ID from tasks.json\n2. Create a function to gather milestone context for the specified tasks\n3. Implement validation to ensure all specified IDs exist and are valid\n4. Add error handling for missing or invalid tasks/subtasks\n5. Create a data structure to hold the original task state for later comparison\n6. Implement functions to determine if an ID refers to a task or subtask\n7. Add support for handling multiple IDs in a single command execution", + "status": "done", + "testStrategy": "Test task and subtask retrieval with various ID formats. Verify correct handling of both task and subtask IDs. Test error cases like non-existent IDs and malformed ID strings." + }, + { + "id": 3, + "title": "Develop core complexity adjustment logic", + "description": "Implement the core functions that construct AI prompts and process responses to adjust task complexity up or down.", + "dependencies": [ + "104.2" + ], + "details": "1. Create separate handler functions for scope-up and scope-down operations\n2. Implement prompt construction logic that incorporates:\n - Current task/subtask details\n - Milestone context\n - Strength parameter (light/regular/heavy)\n - User-provided custom prompt\n3. Add integration with ai-services-unified.js to generate new content\n4. Implement response parsing to extract updated task details\n5. Create utility functions to determine how much to increase/decrease complexity based on strength\n6. Add special handling for different task components (description, implementation details, test strategy)", + "status": "done", + "testStrategy": "Test prompt construction with various inputs and strength levels. Mock AI service responses to test parsing logic. Verify that different strength levels produce appropriately scaled adjustments." + }, + { + "id": 4, + "title": "Implement task update and persistence logic", + "description": "Create functions to update tasks/subtasks with new content while preserving integrity and handling dependencies.", + "dependencies": [ + "104.3" + ], + "details": "1. Implement functions to update task and subtask objects with new content\n2. Create logic to preserve task dependency integrity during updates\n3. Add version history tracking to store previous versions of tasks\n4. Implement file writing functions to persist changes to tasks.json\n5. Add validation to ensure updated tasks maintain required fields and format\n6. Implement rollback capability in case of errors\n7. Create utility functions to display before/after differences in the CLI\n8. Add support for batch updates when multiple IDs are provided", + "status": "done", + "testStrategy": "Test task updates with various scenarios including single tasks, subtasks, and multiple items. Verify that dependencies remain intact after updates. Test rollback functionality by simulating errors during the update process." + }, + { + "id": 5, + "title": "Integrate with MCP tool and add comprehensive error handling", + "description": "Add MCP tool equivalents for the new commands and implement robust error handling throughout the implementation.", + "dependencies": [ + "104.4" + ], + "details": "1. Create MCP tool equivalents for scope-up and scope-down commands\n2. Implement comprehensive error handling for all potential failure points:\n - Network errors during AI service calls\n - Invalid task/subtask IDs\n - Malformed AI responses\n - File system errors\n3. Add clear user feedback with colorized output showing differences\n4. Implement progress indicators for longer operations\n5. Update documentation to include the new commands\n6. Add examples of common usage patterns to help text\n7. Ensure compatibility with existing task management workflows\n8. Add logging integration using the existing logging system\n\nMCP Integration Complete:\n\n✅ **Direct Functions Created:**\n- Created `mcp-server/src/core/direct-functions/scope-up.js` - Direct function wrapper for scope-up functionality\n- Created `mcp-server/src/core/direct-functions/scope-down.js` - Direct function wrapper for scope-down functionality\n- Both follow the exact same pattern as add-task direct function with proper error handling and silent mode\n\n✅ **MCP Tools Created:**\n- Created `mcp-server/src/tools/scope-up.js` - MCP tool for scope_up_task \n- Created `mcp-server/src/tools/scope-down.js` - MCP tool for scope_down_task\n- Both follow the exact same pattern as add-task tool with proper Zod schema validation\n\n✅ **Integration Updates:**\n- Added imports and exports to `mcp-server/src/core/task-master-core.js` for both direct functions\n- Added imports and registrations to `mcp-server/src/tools/index.js` in Group 5: Task Creation & Modification\n- Tools will be available as `mcp_task-master-ai_scope_up_task` and `mcp_task-master-ai_scope_down_task` after MCP server restart\n\n✅ **Tool Parameters:**\n- `id`: Comma-separated list of task IDs (required)\n- `strength`: light/regular/heavy (optional, defaults to regular) \n- `prompt`: Custom scoping instructions (optional)\n- `file`: Path to tasks.json (optional, auto-detected)\n- `projectRoot`: Absolute project path (required)\n- `tag`: Tag context (optional, uses current tag)\n- `research`: Enable research mode (optional, defaults to false)\n\n✅ **Error Handling:**\n- Comprehensive error handling for missing parameters, invalid task IDs, AI failures\n- Structured error responses with appropriate error codes\n- Silent mode handling to prevent CLI output interference\n\n**Status**: MCP integration complete. Requires MCP server restart for new tools to become available.\n", + "status": "done", + "testStrategy": "Test error handling by simulating various failure conditions. Verify that appropriate error messages are displayed. Test MCP tool integration and ensure consistent behavior between CLI and MCP interfaces. Perform end-to-end testing with real tasks to verify the complete workflow." } ] } ], "metadata": { "created": "2025-06-13T23:52:56.848Z", - "updated": "2025-06-14T15:19:05.130Z", + "updated": "2025-08-02T14:13:14.826Z", "description": "Main tag for the taskmaster project" } }, diff --git a/apps/extension/src/components/TaskDetails/AIActionsSection.tsx b/apps/extension/src/components/TaskDetails/AIActionsSection.tsx index 098158f8..9ec2d54b 100644 --- a/apps/extension/src/components/TaskDetails/AIActionsSection.tsx +++ b/apps/extension/src/components/TaskDetails/AIActionsSection.tsx @@ -4,10 +4,12 @@ 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 +33,15 @@ export const AIActionsSection: React.FC = ({ onAppendingChange }) => { const [prompt, setPrompt] = useState(''); - const [lastAction, setLastAction] = useState<'regenerate' | 'append' | 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 +109,64 @@ export const AIActionsSection: React.FC = ({ } }; + 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 ( = ({ defaultExpanded={true} buttonClassName="text-vscode-foreground/80 hover:text-vscode-foreground" > -
-
- -