This is page 15 of 50. Use http://codebase.md/eyaltoledano/claude-task-master?lines=false&page={x} to view the full context.
# Directory Structure
```
├── .changeset
│ ├── config.json
│ └── README.md
├── .claude
│ ├── commands
│ │ └── dedupe.md
│ └── TM_COMMANDS_GUIDE.md
├── .claude-plugin
│ └── marketplace.json
├── .coderabbit.yaml
├── .cursor
│ ├── mcp.json
│ └── rules
│ ├── ai_providers.mdc
│ ├── ai_services.mdc
│ ├── architecture.mdc
│ ├── changeset.mdc
│ ├── commands.mdc
│ ├── context_gathering.mdc
│ ├── cursor_rules.mdc
│ ├── dependencies.mdc
│ ├── dev_workflow.mdc
│ ├── git_workflow.mdc
│ ├── glossary.mdc
│ ├── mcp.mdc
│ ├── new_features.mdc
│ ├── self_improve.mdc
│ ├── tags.mdc
│ ├── taskmaster.mdc
│ ├── tasks.mdc
│ ├── telemetry.mdc
│ ├── test_workflow.mdc
│ ├── tests.mdc
│ ├── ui.mdc
│ └── utilities.mdc
├── .cursorignore
├── .env.example
├── .github
│ ├── ISSUE_TEMPLATE
│ │ ├── bug_report.md
│ │ ├── enhancements---feature-requests.md
│ │ └── feedback.md
│ ├── PULL_REQUEST_TEMPLATE
│ │ ├── bugfix.md
│ │ ├── config.yml
│ │ ├── feature.md
│ │ └── integration.md
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── scripts
│ │ ├── auto-close-duplicates.mjs
│ │ ├── backfill-duplicate-comments.mjs
│ │ ├── check-pre-release-mode.mjs
│ │ ├── parse-metrics.mjs
│ │ ├── release.mjs
│ │ ├── tag-extension.mjs
│ │ ├── utils.mjs
│ │ └── validate-changesets.mjs
│ └── workflows
│ ├── auto-close-duplicates.yml
│ ├── backfill-duplicate-comments.yml
│ ├── ci.yml
│ ├── claude-dedupe-issues.yml
│ ├── claude-docs-trigger.yml
│ ├── claude-docs-updater.yml
│ ├── claude-issue-triage.yml
│ ├── claude.yml
│ ├── extension-ci.yml
│ ├── extension-release.yml
│ ├── log-issue-events.yml
│ ├── pre-release.yml
│ ├── release-check.yml
│ ├── release.yml
│ ├── update-models-md.yml
│ └── weekly-metrics-discord.yml
├── .gitignore
├── .kiro
│ ├── hooks
│ │ ├── tm-code-change-task-tracker.kiro.hook
│ │ ├── tm-complexity-analyzer.kiro.hook
│ │ ├── tm-daily-standup-assistant.kiro.hook
│ │ ├── tm-git-commit-task-linker.kiro.hook
│ │ ├── tm-pr-readiness-checker.kiro.hook
│ │ ├── tm-task-dependency-auto-progression.kiro.hook
│ │ └── tm-test-success-task-completer.kiro.hook
│ ├── settings
│ │ └── mcp.json
│ └── steering
│ ├── dev_workflow.md
│ ├── kiro_rules.md
│ ├── self_improve.md
│ ├── taskmaster_hooks_workflow.md
│ └── taskmaster.md
├── .manypkg.json
├── .mcp.json
├── .npmignore
├── .nvmrc
├── .taskmaster
│ ├── CLAUDE.md
│ ├── config.json
│ ├── docs
│ │ ├── autonomous-tdd-git-workflow.md
│ │ ├── MIGRATION-ROADMAP.md
│ │ ├── prd-tm-start.txt
│ │ ├── prd.txt
│ │ ├── README.md
│ │ ├── research
│ │ │ ├── 2025-06-14_how-can-i-improve-the-scope-up-and-scope-down-comm.md
│ │ │ ├── 2025-06-14_should-i-be-using-any-specific-libraries-for-this.md
│ │ │ ├── 2025-06-14_test-save-functionality.md
│ │ │ ├── 2025-06-14_test-the-fix-for-duplicate-saves-final-test.md
│ │ │ └── 2025-08-01_do-we-need-to-add-new-commands-or-can-we-just-weap.md
│ │ ├── task-template-importing-prd.txt
│ │ ├── tdd-workflow-phase-0-spike.md
│ │ ├── tdd-workflow-phase-1-core-rails.md
│ │ ├── tdd-workflow-phase-1-orchestrator.md
│ │ ├── tdd-workflow-phase-2-pr-resumability.md
│ │ ├── tdd-workflow-phase-3-extensibility-guardrails.md
│ │ ├── test-prd.txt
│ │ └── tm-core-phase-1.txt
│ ├── reports
│ │ ├── task-complexity-report_autonomous-tdd-git-workflow.json
│ │ ├── task-complexity-report_cc-kiro-hooks.json
│ │ ├── task-complexity-report_tdd-phase-1-core-rails.json
│ │ ├── task-complexity-report_tdd-workflow-phase-0.json
│ │ ├── task-complexity-report_test-prd-tag.json
│ │ ├── task-complexity-report_tm-core-phase-1.json
│ │ ├── task-complexity-report.json
│ │ └── tm-core-complexity.json
│ ├── state.json
│ ├── tasks
│ │ ├── task_001_tm-start.txt
│ │ ├── task_002_tm-start.txt
│ │ ├── task_003_tm-start.txt
│ │ ├── task_004_tm-start.txt
│ │ ├── task_007_tm-start.txt
│ │ └── tasks.json
│ └── templates
│ ├── example_prd_rpg.md
│ └── example_prd.md
├── .vscode
│ ├── extensions.json
│ └── settings.json
├── apps
│ ├── cli
│ │ ├── CHANGELOG.md
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── command-registry.ts
│ │ │ ├── commands
│ │ │ │ ├── auth.command.ts
│ │ │ │ ├── autopilot
│ │ │ │ │ ├── abort.command.ts
│ │ │ │ │ ├── commit.command.ts
│ │ │ │ │ ├── complete.command.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── next.command.ts
│ │ │ │ │ ├── resume.command.ts
│ │ │ │ │ ├── shared.ts
│ │ │ │ │ ├── start.command.ts
│ │ │ │ │ └── status.command.ts
│ │ │ │ ├── briefs.command.ts
│ │ │ │ ├── context.command.ts
│ │ │ │ ├── export.command.ts
│ │ │ │ ├── list.command.ts
│ │ │ │ ├── models
│ │ │ │ │ ├── custom-providers.ts
│ │ │ │ │ ├── fetchers.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── prompts.ts
│ │ │ │ │ ├── setup.ts
│ │ │ │ │ └── types.ts
│ │ │ │ ├── next.command.ts
│ │ │ │ ├── set-status.command.ts
│ │ │ │ ├── show.command.ts
│ │ │ │ ├── start.command.ts
│ │ │ │ └── tags.command.ts
│ │ │ ├── index.ts
│ │ │ ├── lib
│ │ │ │ └── model-management.ts
│ │ │ ├── types
│ │ │ │ └── tag-management.d.ts
│ │ │ ├── ui
│ │ │ │ ├── components
│ │ │ │ │ ├── cardBox.component.ts
│ │ │ │ │ ├── dashboard.component.ts
│ │ │ │ │ ├── header.component.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── next-task.component.ts
│ │ │ │ │ ├── suggested-steps.component.ts
│ │ │ │ │ └── task-detail.component.ts
│ │ │ │ ├── display
│ │ │ │ │ ├── messages.ts
│ │ │ │ │ └── tables.ts
│ │ │ │ ├── formatters
│ │ │ │ │ ├── complexity-formatters.ts
│ │ │ │ │ ├── dependency-formatters.ts
│ │ │ │ │ ├── priority-formatters.ts
│ │ │ │ │ ├── status-formatters.spec.ts
│ │ │ │ │ └── status-formatters.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── layout
│ │ │ │ ├── helpers.spec.ts
│ │ │ │ └── helpers.ts
│ │ │ └── utils
│ │ │ ├── auth-helpers.ts
│ │ │ ├── auto-update.ts
│ │ │ ├── brief-selection.ts
│ │ │ ├── display-helpers.ts
│ │ │ ├── error-handler.ts
│ │ │ ├── index.ts
│ │ │ ├── project-root.ts
│ │ │ ├── task-status.ts
│ │ │ ├── ui.spec.ts
│ │ │ └── ui.ts
│ │ ├── tests
│ │ │ ├── integration
│ │ │ │ └── commands
│ │ │ │ └── autopilot
│ │ │ │ └── workflow.test.ts
│ │ │ └── unit
│ │ │ ├── commands
│ │ │ │ ├── autopilot
│ │ │ │ │ └── shared.test.ts
│ │ │ │ ├── list.command.spec.ts
│ │ │ │ └── show.command.spec.ts
│ │ │ └── ui
│ │ │ └── dashboard.component.spec.ts
│ │ ├── tsconfig.json
│ │ └── vitest.config.ts
│ ├── docs
│ │ ├── archive
│ │ │ ├── ai-client-utils-example.mdx
│ │ │ ├── ai-development-workflow.mdx
│ │ │ ├── command-reference.mdx
│ │ │ ├── configuration.mdx
│ │ │ ├── cursor-setup.mdx
│ │ │ ├── examples.mdx
│ │ │ └── Installation.mdx
│ │ ├── best-practices
│ │ │ ├── advanced-tasks.mdx
│ │ │ ├── configuration-advanced.mdx
│ │ │ └── index.mdx
│ │ ├── capabilities
│ │ │ ├── cli-root-commands.mdx
│ │ │ ├── index.mdx
│ │ │ ├── mcp.mdx
│ │ │ ├── rpg-method.mdx
│ │ │ └── task-structure.mdx
│ │ ├── CHANGELOG.md
│ │ ├── command-reference.mdx
│ │ ├── configuration.mdx
│ │ ├── docs.json
│ │ ├── favicon.svg
│ │ ├── getting-started
│ │ │ ├── api-keys.mdx
│ │ │ ├── contribute.mdx
│ │ │ ├── faq.mdx
│ │ │ └── quick-start
│ │ │ ├── configuration-quick.mdx
│ │ │ ├── execute-quick.mdx
│ │ │ ├── installation.mdx
│ │ │ ├── moving-forward.mdx
│ │ │ ├── prd-quick.mdx
│ │ │ ├── quick-start.mdx
│ │ │ ├── requirements.mdx
│ │ │ ├── rules-quick.mdx
│ │ │ └── tasks-quick.mdx
│ │ ├── introduction.mdx
│ │ ├── licensing.md
│ │ ├── logo
│ │ │ ├── dark.svg
│ │ │ ├── light.svg
│ │ │ └── task-master-logo.png
│ │ ├── package.json
│ │ ├── README.md
│ │ ├── style.css
│ │ ├── tdd-workflow
│ │ │ ├── ai-agent-integration.mdx
│ │ │ └── quickstart.mdx
│ │ ├── vercel.json
│ │ └── whats-new.mdx
│ ├── extension
│ │ ├── .vscodeignore
│ │ ├── assets
│ │ │ ├── banner.png
│ │ │ ├── icon-dark.svg
│ │ │ ├── icon-light.svg
│ │ │ ├── icon.png
│ │ │ ├── screenshots
│ │ │ │ ├── kanban-board.png
│ │ │ │ └── task-details.png
│ │ │ └── sidebar-icon.svg
│ │ ├── CHANGELOG.md
│ │ ├── components.json
│ │ ├── docs
│ │ │ ├── extension-CI-setup.md
│ │ │ └── extension-development-guide.md
│ │ ├── esbuild.js
│ │ ├── LICENSE
│ │ ├── package.json
│ │ ├── package.mjs
│ │ ├── package.publish.json
│ │ ├── README.md
│ │ ├── src
│ │ │ ├── components
│ │ │ │ ├── ConfigView.tsx
│ │ │ │ ├── constants.ts
│ │ │ │ ├── TaskDetails
│ │ │ │ │ ├── AIActionsSection.tsx
│ │ │ │ │ ├── DetailsSection.tsx
│ │ │ │ │ ├── PriorityBadge.tsx
│ │ │ │ │ ├── SubtasksSection.tsx
│ │ │ │ │ ├── TaskMetadataSidebar.tsx
│ │ │ │ │ └── useTaskDetails.ts
│ │ │ │ ├── TaskDetailsView.tsx
│ │ │ │ ├── TaskMasterLogo.tsx
│ │ │ │ └── ui
│ │ │ │ ├── badge.tsx
│ │ │ │ ├── breadcrumb.tsx
│ │ │ │ ├── button.tsx
│ │ │ │ ├── card.tsx
│ │ │ │ ├── collapsible.tsx
│ │ │ │ ├── CollapsibleSection.tsx
│ │ │ │ ├── dropdown-menu.tsx
│ │ │ │ ├── label.tsx
│ │ │ │ ├── scroll-area.tsx
│ │ │ │ ├── separator.tsx
│ │ │ │ ├── shadcn-io
│ │ │ │ │ └── kanban
│ │ │ │ │ └── index.tsx
│ │ │ │ └── textarea.tsx
│ │ │ ├── extension.ts
│ │ │ ├── index.ts
│ │ │ ├── lib
│ │ │ │ └── utils.ts
│ │ │ ├── services
│ │ │ │ ├── config-service.ts
│ │ │ │ ├── error-handler.ts
│ │ │ │ ├── notification-preferences.ts
│ │ │ │ ├── polling-service.ts
│ │ │ │ ├── polling-strategies.ts
│ │ │ │ ├── sidebar-webview-manager.ts
│ │ │ │ ├── task-repository.ts
│ │ │ │ ├── terminal-manager.ts
│ │ │ │ └── webview-manager.ts
│ │ │ ├── test
│ │ │ │ └── extension.test.ts
│ │ │ ├── utils
│ │ │ │ ├── configManager.ts
│ │ │ │ ├── connectionManager.ts
│ │ │ │ ├── errorHandler.ts
│ │ │ │ ├── event-emitter.ts
│ │ │ │ ├── logger.ts
│ │ │ │ ├── mcpClient.ts
│ │ │ │ ├── notificationPreferences.ts
│ │ │ │ └── task-master-api
│ │ │ │ ├── cache
│ │ │ │ │ └── cache-manager.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── mcp-client.ts
│ │ │ │ ├── transformers
│ │ │ │ │ └── task-transformer.ts
│ │ │ │ └── types
│ │ │ │ └── index.ts
│ │ │ └── webview
│ │ │ ├── App.tsx
│ │ │ ├── components
│ │ │ │ ├── AppContent.tsx
│ │ │ │ ├── EmptyState.tsx
│ │ │ │ ├── ErrorBoundary.tsx
│ │ │ │ ├── PollingStatus.tsx
│ │ │ │ ├── PriorityBadge.tsx
│ │ │ │ ├── SidebarView.tsx
│ │ │ │ ├── TagDropdown.tsx
│ │ │ │ ├── TaskCard.tsx
│ │ │ │ ├── TaskEditModal.tsx
│ │ │ │ ├── TaskMasterKanban.tsx
│ │ │ │ ├── ToastContainer.tsx
│ │ │ │ └── ToastNotification.tsx
│ │ │ ├── constants
│ │ │ │ └── index.ts
│ │ │ ├── contexts
│ │ │ │ └── VSCodeContext.tsx
│ │ │ ├── hooks
│ │ │ │ ├── useTaskQueries.ts
│ │ │ │ ├── useVSCodeMessages.ts
│ │ │ │ └── useWebviewHeight.ts
│ │ │ ├── index.css
│ │ │ ├── index.tsx
│ │ │ ├── providers
│ │ │ │ └── QueryProvider.tsx
│ │ │ ├── reducers
│ │ │ │ └── appReducer.ts
│ │ │ ├── sidebar.tsx
│ │ │ ├── types
│ │ │ │ └── index.ts
│ │ │ └── utils
│ │ │ ├── logger.ts
│ │ │ └── toast.ts
│ │ └── tsconfig.json
│ └── mcp
│ ├── CHANGELOG.md
│ ├── package.json
│ ├── src
│ │ ├── index.ts
│ │ ├── shared
│ │ │ ├── types.ts
│ │ │ └── utils.ts
│ │ └── tools
│ │ ├── autopilot
│ │ │ ├── abort.tool.ts
│ │ │ ├── commit.tool.ts
│ │ │ ├── complete.tool.ts
│ │ │ ├── finalize.tool.ts
│ │ │ ├── index.ts
│ │ │ ├── next.tool.ts
│ │ │ ├── resume.tool.ts
│ │ │ ├── start.tool.ts
│ │ │ └── status.tool.ts
│ │ ├── README-ZOD-V3.md
│ │ └── tasks
│ │ ├── get-task.tool.ts
│ │ ├── get-tasks.tool.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ └── vitest.config.ts
├── assets
│ ├── .windsurfrules
│ ├── AGENTS.md
│ ├── claude
│ │ └── TM_COMMANDS_GUIDE.md
│ ├── config.json
│ ├── env.example
│ ├── example_prd_rpg.txt
│ ├── example_prd.txt
│ ├── GEMINI.md
│ ├── gitignore
│ ├── kiro-hooks
│ │ ├── tm-code-change-task-tracker.kiro.hook
│ │ ├── tm-complexity-analyzer.kiro.hook
│ │ ├── tm-daily-standup-assistant.kiro.hook
│ │ ├── tm-git-commit-task-linker.kiro.hook
│ │ ├── tm-pr-readiness-checker.kiro.hook
│ │ ├── tm-task-dependency-auto-progression.kiro.hook
│ │ └── tm-test-success-task-completer.kiro.hook
│ ├── roocode
│ │ ├── .roo
│ │ │ ├── rules-architect
│ │ │ │ └── architect-rules
│ │ │ ├── rules-ask
│ │ │ │ └── ask-rules
│ │ │ ├── rules-code
│ │ │ │ └── code-rules
│ │ │ ├── rules-debug
│ │ │ │ └── debug-rules
│ │ │ ├── rules-orchestrator
│ │ │ │ └── orchestrator-rules
│ │ │ └── rules-test
│ │ │ └── test-rules
│ │ └── .roomodes
│ ├── rules
│ │ ├── cursor_rules.mdc
│ │ ├── dev_workflow.mdc
│ │ ├── self_improve.mdc
│ │ ├── taskmaster_hooks_workflow.mdc
│ │ └── taskmaster.mdc
│ └── scripts_README.md
├── bin
│ └── task-master.js
├── biome.json
├── CHANGELOG.md
├── CLAUDE_CODE_PLUGIN.md
├── CLAUDE.md
├── context
│ ├── chats
│ │ ├── add-task-dependencies-1.md
│ │ └── max-min-tokens.txt.md
│ ├── fastmcp-core.txt
│ ├── fastmcp-docs.txt
│ ├── MCP_INTEGRATION.md
│ ├── mcp-js-sdk-docs.txt
│ ├── mcp-protocol-repo.txt
│ ├── mcp-protocol-schema-03262025.json
│ └── mcp-protocol-spec.txt
├── CONTRIBUTING.md
├── docs
│ ├── claude-code-integration.md
│ ├── CLI-COMMANDER-PATTERN.md
│ ├── command-reference.md
│ ├── configuration.md
│ ├── contributor-docs
│ │ ├── testing-roo-integration.md
│ │ └── worktree-setup.md
│ ├── cross-tag-task-movement.md
│ ├── examples
│ │ ├── claude-code-usage.md
│ │ └── codex-cli-usage.md
│ ├── examples.md
│ ├── licensing.md
│ ├── mcp-provider-guide.md
│ ├── mcp-provider.md
│ ├── migration-guide.md
│ ├── models.md
│ ├── providers
│ │ ├── codex-cli.md
│ │ └── gemini-cli.md
│ ├── README.md
│ ├── scripts
│ │ └── models-json-to-markdown.js
│ ├── task-structure.md
│ └── tutorial.md
├── images
│ ├── hamster-hiring.png
│ └── logo.png
├── index.js
├── jest.config.js
├── jest.resolver.cjs
├── LICENSE
├── llms-install.md
├── mcp-server
│ ├── server.js
│ └── src
│ ├── core
│ │ ├── __tests__
│ │ │ └── context-manager.test.js
│ │ ├── context-manager.js
│ │ ├── direct-functions
│ │ │ ├── add-dependency.js
│ │ │ ├── add-subtask.js
│ │ │ ├── add-tag.js
│ │ │ ├── add-task.js
│ │ │ ├── analyze-task-complexity.js
│ │ │ ├── cache-stats.js
│ │ │ ├── clear-subtasks.js
│ │ │ ├── complexity-report.js
│ │ │ ├── copy-tag.js
│ │ │ ├── create-tag-from-branch.js
│ │ │ ├── delete-tag.js
│ │ │ ├── expand-all-tasks.js
│ │ │ ├── expand-task.js
│ │ │ ├── fix-dependencies.js
│ │ │ ├── generate-task-files.js
│ │ │ ├── initialize-project.js
│ │ │ ├── list-tags.js
│ │ │ ├── models.js
│ │ │ ├── move-task-cross-tag.js
│ │ │ ├── move-task.js
│ │ │ ├── next-task.js
│ │ │ ├── parse-prd.js
│ │ │ ├── remove-dependency.js
│ │ │ ├── remove-subtask.js
│ │ │ ├── remove-task.js
│ │ │ ├── rename-tag.js
│ │ │ ├── research.js
│ │ │ ├── response-language.js
│ │ │ ├── rules.js
│ │ │ ├── scope-down.js
│ │ │ ├── scope-up.js
│ │ │ ├── set-task-status.js
│ │ │ ├── update-subtask-by-id.js
│ │ │ ├── update-task-by-id.js
│ │ │ ├── update-tasks.js
│ │ │ ├── use-tag.js
│ │ │ └── validate-dependencies.js
│ │ ├── task-master-core.js
│ │ └── utils
│ │ ├── env-utils.js
│ │ └── path-utils.js
│ ├── custom-sdk
│ │ ├── errors.js
│ │ ├── index.js
│ │ ├── json-extractor.js
│ │ ├── language-model.js
│ │ ├── message-converter.js
│ │ └── schema-converter.js
│ ├── index.js
│ ├── logger.js
│ ├── providers
│ │ └── mcp-provider.js
│ └── tools
│ ├── add-dependency.js
│ ├── add-subtask.js
│ ├── add-tag.js
│ ├── add-task.js
│ ├── analyze.js
│ ├── clear-subtasks.js
│ ├── complexity-report.js
│ ├── copy-tag.js
│ ├── delete-tag.js
│ ├── expand-all.js
│ ├── expand-task.js
│ ├── fix-dependencies.js
│ ├── generate.js
│ ├── get-operation-status.js
│ ├── index.js
│ ├── initialize-project.js
│ ├── list-tags.js
│ ├── models.js
│ ├── move-task.js
│ ├── next-task.js
│ ├── parse-prd.js
│ ├── README-ZOD-V3.md
│ ├── remove-dependency.js
│ ├── remove-subtask.js
│ ├── remove-task.js
│ ├── rename-tag.js
│ ├── research.js
│ ├── response-language.js
│ ├── rules.js
│ ├── scope-down.js
│ ├── scope-up.js
│ ├── set-task-status.js
│ ├── tool-registry.js
│ ├── update-subtask.js
│ ├── update-task.js
│ ├── update.js
│ ├── use-tag.js
│ ├── utils.js
│ └── validate-dependencies.js
├── mcp-test.js
├── output.json
├── package-lock.json
├── package.json
├── packages
│ ├── ai-sdk-provider-grok-cli
│ │ ├── CHANGELOG.md
│ │ ├── package.json
│ │ ├── README.md
│ │ ├── src
│ │ │ ├── errors.test.ts
│ │ │ ├── errors.ts
│ │ │ ├── grok-cli-language-model.ts
│ │ │ ├── grok-cli-provider.test.ts
│ │ │ ├── grok-cli-provider.ts
│ │ │ ├── index.ts
│ │ │ ├── json-extractor.test.ts
│ │ │ ├── json-extractor.ts
│ │ │ ├── message-converter.test.ts
│ │ │ ├── message-converter.ts
│ │ │ └── types.ts
│ │ └── tsconfig.json
│ ├── build-config
│ │ ├── CHANGELOG.md
│ │ ├── package.json
│ │ ├── src
│ │ │ └── tsdown.base.ts
│ │ └── tsconfig.json
│ ├── claude-code-plugin
│ │ ├── .claude-plugin
│ │ │ └── plugin.json
│ │ ├── .gitignore
│ │ ├── agents
│ │ │ ├── task-checker.md
│ │ │ ├── task-executor.md
│ │ │ └── task-orchestrator.md
│ │ ├── CHANGELOG.md
│ │ ├── commands
│ │ │ ├── add-dependency.md
│ │ │ ├── add-subtask.md
│ │ │ ├── add-task.md
│ │ │ ├── analyze-complexity.md
│ │ │ ├── analyze-project.md
│ │ │ ├── auto-implement-tasks.md
│ │ │ ├── command-pipeline.md
│ │ │ ├── complexity-report.md
│ │ │ ├── convert-task-to-subtask.md
│ │ │ ├── expand-all-tasks.md
│ │ │ ├── expand-task.md
│ │ │ ├── fix-dependencies.md
│ │ │ ├── generate-tasks.md
│ │ │ ├── help.md
│ │ │ ├── init-project-quick.md
│ │ │ ├── init-project.md
│ │ │ ├── install-taskmaster.md
│ │ │ ├── learn.md
│ │ │ ├── list-tasks-by-status.md
│ │ │ ├── list-tasks-with-subtasks.md
│ │ │ ├── list-tasks.md
│ │ │ ├── next-task.md
│ │ │ ├── parse-prd-with-research.md
│ │ │ ├── parse-prd.md
│ │ │ ├── project-status.md
│ │ │ ├── quick-install-taskmaster.md
│ │ │ ├── remove-all-subtasks.md
│ │ │ ├── remove-dependency.md
│ │ │ ├── remove-subtask.md
│ │ │ ├── remove-subtasks.md
│ │ │ ├── remove-task.md
│ │ │ ├── setup-models.md
│ │ │ ├── show-task.md
│ │ │ ├── smart-workflow.md
│ │ │ ├── sync-readme.md
│ │ │ ├── tm-main.md
│ │ │ ├── to-cancelled.md
│ │ │ ├── to-deferred.md
│ │ │ ├── to-done.md
│ │ │ ├── to-in-progress.md
│ │ │ ├── to-pending.md
│ │ │ ├── to-review.md
│ │ │ ├── update-single-task.md
│ │ │ ├── update-task.md
│ │ │ ├── update-tasks-from-id.md
│ │ │ ├── validate-dependencies.md
│ │ │ └── view-models.md
│ │ ├── mcp.json
│ │ └── package.json
│ ├── tm-bridge
│ │ ├── CHANGELOG.md
│ │ ├── package.json
│ │ ├── README.md
│ │ ├── src
│ │ │ ├── add-tag-bridge.ts
│ │ │ ├── bridge-types.ts
│ │ │ ├── bridge-utils.ts
│ │ │ ├── expand-bridge.ts
│ │ │ ├── index.ts
│ │ │ ├── tags-bridge.ts
│ │ │ ├── update-bridge.ts
│ │ │ └── use-tag-bridge.ts
│ │ └── tsconfig.json
│ └── tm-core
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── docs
│ │ └── listTasks-architecture.md
│ ├── package.json
│ ├── POC-STATUS.md
│ ├── README.md
│ ├── src
│ │ ├── common
│ │ │ ├── constants
│ │ │ │ ├── index.ts
│ │ │ │ ├── paths.ts
│ │ │ │ └── providers.ts
│ │ │ ├── errors
│ │ │ │ ├── index.ts
│ │ │ │ └── task-master-error.ts
│ │ │ ├── interfaces
│ │ │ │ ├── configuration.interface.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── storage.interface.ts
│ │ │ ├── logger
│ │ │ │ ├── factory.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── logger.spec.ts
│ │ │ │ └── logger.ts
│ │ │ ├── mappers
│ │ │ │ ├── TaskMapper.test.ts
│ │ │ │ └── TaskMapper.ts
│ │ │ ├── types
│ │ │ │ ├── database.types.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── legacy.ts
│ │ │ │ └── repository-types.ts
│ │ │ └── utils
│ │ │ ├── git-utils.ts
│ │ │ ├── id-generator.ts
│ │ │ ├── index.ts
│ │ │ ├── path-helpers.ts
│ │ │ ├── path-normalizer.spec.ts
│ │ │ ├── path-normalizer.ts
│ │ │ ├── project-root-finder.spec.ts
│ │ │ ├── project-root-finder.ts
│ │ │ ├── run-id-generator.spec.ts
│ │ │ └── run-id-generator.ts
│ │ ├── index.ts
│ │ ├── modules
│ │ │ ├── ai
│ │ │ │ ├── index.ts
│ │ │ │ ├── interfaces
│ │ │ │ │ └── ai-provider.interface.ts
│ │ │ │ └── providers
│ │ │ │ ├── base-provider.ts
│ │ │ │ └── index.ts
│ │ │ ├── auth
│ │ │ │ ├── auth-domain.spec.ts
│ │ │ │ ├── auth-domain.ts
│ │ │ │ ├── config.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── managers
│ │ │ │ │ ├── auth-manager.spec.ts
│ │ │ │ │ └── auth-manager.ts
│ │ │ │ ├── services
│ │ │ │ │ ├── context-store.ts
│ │ │ │ │ ├── oauth-service.ts
│ │ │ │ │ ├── organization.service.ts
│ │ │ │ │ ├── supabase-session-storage.spec.ts
│ │ │ │ │ └── supabase-session-storage.ts
│ │ │ │ └── types.ts
│ │ │ ├── briefs
│ │ │ │ ├── briefs-domain.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── services
│ │ │ │ │ └── brief-service.ts
│ │ │ │ ├── types.ts
│ │ │ │ └── utils
│ │ │ │ └── url-parser.ts
│ │ │ ├── commands
│ │ │ │ └── index.ts
│ │ │ ├── config
│ │ │ │ ├── config-domain.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── managers
│ │ │ │ │ ├── config-manager.spec.ts
│ │ │ │ │ └── config-manager.ts
│ │ │ │ └── services
│ │ │ │ ├── config-loader.service.spec.ts
│ │ │ │ ├── config-loader.service.ts
│ │ │ │ ├── config-merger.service.spec.ts
│ │ │ │ ├── config-merger.service.ts
│ │ │ │ ├── config-persistence.service.spec.ts
│ │ │ │ ├── config-persistence.service.ts
│ │ │ │ ├── environment-config-provider.service.spec.ts
│ │ │ │ ├── environment-config-provider.service.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── runtime-state-manager.service.spec.ts
│ │ │ │ └── runtime-state-manager.service.ts
│ │ │ ├── dependencies
│ │ │ │ └── index.ts
│ │ │ ├── execution
│ │ │ │ ├── executors
│ │ │ │ │ ├── base-executor.ts
│ │ │ │ │ ├── claude-executor.ts
│ │ │ │ │ └── executor-factory.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── services
│ │ │ │ │ └── executor-service.ts
│ │ │ │ └── types.ts
│ │ │ ├── git
│ │ │ │ ├── adapters
│ │ │ │ │ ├── git-adapter.test.ts
│ │ │ │ │ └── git-adapter.ts
│ │ │ │ ├── git-domain.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── services
│ │ │ │ ├── branch-name-generator.spec.ts
│ │ │ │ ├── branch-name-generator.ts
│ │ │ │ ├── commit-message-generator.test.ts
│ │ │ │ ├── commit-message-generator.ts
│ │ │ │ ├── scope-detector.test.ts
│ │ │ │ ├── scope-detector.ts
│ │ │ │ ├── template-engine.test.ts
│ │ │ │ └── template-engine.ts
│ │ │ ├── integration
│ │ │ │ ├── clients
│ │ │ │ │ ├── index.ts
│ │ │ │ │ └── supabase-client.ts
│ │ │ │ ├── integration-domain.ts
│ │ │ │ └── services
│ │ │ │ ├── export.service.ts
│ │ │ │ ├── task-expansion.service.ts
│ │ │ │ └── task-retrieval.service.ts
│ │ │ ├── reports
│ │ │ │ ├── index.ts
│ │ │ │ ├── managers
│ │ │ │ │ └── complexity-report-manager.ts
│ │ │ │ └── types.ts
│ │ │ ├── storage
│ │ │ │ ├── adapters
│ │ │ │ │ ├── activity-logger.ts
│ │ │ │ │ ├── api-storage.ts
│ │ │ │ │ └── file-storage
│ │ │ │ │ ├── file-operations.ts
│ │ │ │ │ ├── file-storage.ts
│ │ │ │ │ ├── format-handler.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ └── path-resolver.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── services
│ │ │ │ │ └── storage-factory.ts
│ │ │ │ └── utils
│ │ │ │ └── api-client.ts
│ │ │ ├── tasks
│ │ │ │ ├── entities
│ │ │ │ │ └── task.entity.ts
│ │ │ │ ├── parser
│ │ │ │ │ └── index.ts
│ │ │ │ ├── repositories
│ │ │ │ │ ├── supabase
│ │ │ │ │ │ ├── dependency-fetcher.ts
│ │ │ │ │ │ ├── index.ts
│ │ │ │ │ │ └── supabase-repository.ts
│ │ │ │ │ └── task-repository.interface.ts
│ │ │ │ ├── services
│ │ │ │ │ ├── preflight-checker.service.ts
│ │ │ │ │ ├── tag.service.ts
│ │ │ │ │ ├── task-execution-service.ts
│ │ │ │ │ ├── task-loader.service.ts
│ │ │ │ │ └── task-service.ts
│ │ │ │ └── tasks-domain.ts
│ │ │ ├── ui
│ │ │ │ └── index.ts
│ │ │ └── workflow
│ │ │ ├── managers
│ │ │ │ ├── workflow-state-manager.spec.ts
│ │ │ │ └── workflow-state-manager.ts
│ │ │ ├── orchestrators
│ │ │ │ ├── workflow-orchestrator.test.ts
│ │ │ │ └── workflow-orchestrator.ts
│ │ │ ├── services
│ │ │ │ ├── test-result-validator.test.ts
│ │ │ │ ├── test-result-validator.ts
│ │ │ │ ├── test-result-validator.types.ts
│ │ │ │ ├── workflow-activity-logger.ts
│ │ │ │ └── workflow.service.ts
│ │ │ ├── types.ts
│ │ │ └── workflow-domain.ts
│ │ ├── subpath-exports.test.ts
│ │ ├── tm-core.ts
│ │ └── utils
│ │ └── time.utils.ts
│ ├── tests
│ │ ├── auth
│ │ │ └── auth-refresh.test.ts
│ │ ├── integration
│ │ │ ├── auth-token-refresh.test.ts
│ │ │ ├── list-tasks.test.ts
│ │ │ └── storage
│ │ │ └── activity-logger.test.ts
│ │ ├── mocks
│ │ │ └── mock-provider.ts
│ │ ├── setup.ts
│ │ └── unit
│ │ ├── base-provider.test.ts
│ │ ├── executor.test.ts
│ │ └── smoke.test.ts
│ ├── tsconfig.json
│ └── vitest.config.ts
├── README-task-master.md
├── README.md
├── scripts
│ ├── create-worktree.sh
│ ├── dev.js
│ ├── init.js
│ ├── list-worktrees.sh
│ ├── modules
│ │ ├── ai-services-unified.js
│ │ ├── bridge-utils.js
│ │ ├── commands.js
│ │ ├── config-manager.js
│ │ ├── dependency-manager.js
│ │ ├── index.js
│ │ ├── prompt-manager.js
│ │ ├── supported-models.json
│ │ ├── sync-readme.js
│ │ ├── task-manager
│ │ │ ├── add-subtask.js
│ │ │ ├── add-task.js
│ │ │ ├── analyze-task-complexity.js
│ │ │ ├── clear-subtasks.js
│ │ │ ├── expand-all-tasks.js
│ │ │ ├── expand-task.js
│ │ │ ├── find-next-task.js
│ │ │ ├── generate-task-files.js
│ │ │ ├── is-task-dependent.js
│ │ │ ├── list-tasks.js
│ │ │ ├── migrate.js
│ │ │ ├── models.js
│ │ │ ├── move-task.js
│ │ │ ├── parse-prd
│ │ │ │ ├── index.js
│ │ │ │ ├── parse-prd-config.js
│ │ │ │ ├── parse-prd-helpers.js
│ │ │ │ ├── parse-prd-non-streaming.js
│ │ │ │ ├── parse-prd-streaming.js
│ │ │ │ └── parse-prd.js
│ │ │ ├── remove-subtask.js
│ │ │ ├── remove-task.js
│ │ │ ├── research.js
│ │ │ ├── response-language.js
│ │ │ ├── scope-adjustment.js
│ │ │ ├── set-task-status.js
│ │ │ ├── tag-management.js
│ │ │ ├── task-exists.js
│ │ │ ├── update-single-task-status.js
│ │ │ ├── update-subtask-by-id.js
│ │ │ ├── update-task-by-id.js
│ │ │ └── update-tasks.js
│ │ ├── task-manager.js
│ │ ├── ui.js
│ │ ├── update-config-tokens.js
│ │ ├── utils
│ │ │ ├── contextGatherer.js
│ │ │ ├── fuzzyTaskSearch.js
│ │ │ └── git-utils.js
│ │ └── utils.js
│ ├── task-complexity-report.json
│ ├── test-claude-errors.js
│ └── test-claude.js
├── sonar-project.properties
├── src
│ ├── ai-providers
│ │ ├── anthropic.js
│ │ ├── azure.js
│ │ ├── base-provider.js
│ │ ├── bedrock.js
│ │ ├── claude-code.js
│ │ ├── codex-cli.js
│ │ ├── gemini-cli.js
│ │ ├── google-vertex.js
│ │ ├── google.js
│ │ ├── grok-cli.js
│ │ ├── groq.js
│ │ ├── index.js
│ │ ├── lmstudio.js
│ │ ├── ollama.js
│ │ ├── openai-compatible.js
│ │ ├── openai.js
│ │ ├── openrouter.js
│ │ ├── perplexity.js
│ │ ├── xai.js
│ │ ├── zai-coding.js
│ │ └── zai.js
│ ├── constants
│ │ ├── commands.js
│ │ ├── paths.js
│ │ ├── profiles.js
│ │ ├── rules-actions.js
│ │ ├── task-priority.js
│ │ └── task-status.js
│ ├── profiles
│ │ ├── amp.js
│ │ ├── base-profile.js
│ │ ├── claude.js
│ │ ├── cline.js
│ │ ├── codex.js
│ │ ├── cursor.js
│ │ ├── gemini.js
│ │ ├── index.js
│ │ ├── kilo.js
│ │ ├── kiro.js
│ │ ├── opencode.js
│ │ ├── roo.js
│ │ ├── trae.js
│ │ ├── vscode.js
│ │ ├── windsurf.js
│ │ └── zed.js
│ ├── progress
│ │ ├── base-progress-tracker.js
│ │ ├── cli-progress-factory.js
│ │ ├── parse-prd-tracker.js
│ │ ├── progress-tracker-builder.js
│ │ └── tracker-ui.js
│ ├── prompts
│ │ ├── add-task.json
│ │ ├── analyze-complexity.json
│ │ ├── expand-task.json
│ │ ├── parse-prd.json
│ │ ├── README.md
│ │ ├── research.json
│ │ ├── schemas
│ │ │ ├── parameter.schema.json
│ │ │ ├── prompt-template.schema.json
│ │ │ ├── README.md
│ │ │ └── variant.schema.json
│ │ ├── update-subtask.json
│ │ ├── update-task.json
│ │ └── update-tasks.json
│ ├── provider-registry
│ │ └── index.js
│ ├── schemas
│ │ ├── add-task.js
│ │ ├── analyze-complexity.js
│ │ ├── base-schemas.js
│ │ ├── expand-task.js
│ │ ├── parse-prd.js
│ │ ├── registry.js
│ │ ├── update-subtask.js
│ │ ├── update-task.js
│ │ └── update-tasks.js
│ ├── task-master.js
│ ├── ui
│ │ ├── confirm.js
│ │ ├── indicators.js
│ │ └── parse-prd.js
│ └── utils
│ ├── asset-resolver.js
│ ├── create-mcp-config.js
│ ├── format.js
│ ├── getVersion.js
│ ├── logger-utils.js
│ ├── manage-gitignore.js
│ ├── path-utils.js
│ ├── profiles.js
│ ├── rule-transformer.js
│ ├── stream-parser.js
│ └── timeout-manager.js
├── test-clean-tags.js
├── test-config-manager.js
├── test-prd.txt
├── test-tag-functions.js
├── test-version-check-full.js
├── test-version-check.js
├── tests
│ ├── e2e
│ │ ├── e2e_helpers.sh
│ │ ├── parse_llm_output.cjs
│ │ ├── run_e2e.sh
│ │ ├── run_fallback_verification.sh
│ │ └── test_llm_analysis.sh
│ ├── fixtures
│ │ ├── .taskmasterconfig
│ │ ├── sample-claude-response.js
│ │ ├── sample-prd.txt
│ │ └── sample-tasks.js
│ ├── helpers
│ │ └── tool-counts.js
│ ├── integration
│ │ ├── claude-code-error-handling.test.js
│ │ ├── claude-code-optional.test.js
│ │ ├── cli
│ │ │ ├── commands.test.js
│ │ │ ├── complex-cross-tag-scenarios.test.js
│ │ │ └── move-cross-tag.test.js
│ │ ├── manage-gitignore.test.js
│ │ ├── mcp-server
│ │ │ └── direct-functions.test.js
│ │ ├── move-task-cross-tag.integration.test.js
│ │ ├── move-task-simple.integration.test.js
│ │ ├── profiles
│ │ │ ├── amp-init-functionality.test.js
│ │ │ ├── claude-init-functionality.test.js
│ │ │ ├── cline-init-functionality.test.js
│ │ │ ├── codex-init-functionality.test.js
│ │ │ ├── cursor-init-functionality.test.js
│ │ │ ├── gemini-init-functionality.test.js
│ │ │ ├── opencode-init-functionality.test.js
│ │ │ ├── roo-files-inclusion.test.js
│ │ │ ├── roo-init-functionality.test.js
│ │ │ ├── rules-files-inclusion.test.js
│ │ │ ├── trae-init-functionality.test.js
│ │ │ ├── vscode-init-functionality.test.js
│ │ │ └── windsurf-init-functionality.test.js
│ │ └── providers
│ │ └── temperature-support.test.js
│ ├── manual
│ │ ├── progress
│ │ │ ├── parse-prd-analysis.js
│ │ │ ├── test-parse-prd.js
│ │ │ └── TESTING_GUIDE.md
│ │ └── prompts
│ │ ├── prompt-test.js
│ │ └── README.md
│ ├── README.md
│ ├── setup.js
│ └── unit
│ ├── ai-providers
│ │ ├── base-provider.test.js
│ │ ├── claude-code.test.js
│ │ ├── codex-cli.test.js
│ │ ├── gemini-cli.test.js
│ │ ├── lmstudio.test.js
│ │ ├── mcp-components.test.js
│ │ ├── openai-compatible.test.js
│ │ ├── openai.test.js
│ │ ├── provider-registry.test.js
│ │ ├── zai-coding.test.js
│ │ ├── zai-provider.test.js
│ │ ├── zai-schema-introspection.test.js
│ │ └── zai.test.js
│ ├── ai-services-unified.test.js
│ ├── commands.test.js
│ ├── config-manager.test.js
│ ├── config-manager.test.mjs
│ ├── dependency-manager.test.js
│ ├── init.test.js
│ ├── initialize-project.test.js
│ ├── kebab-case-validation.test.js
│ ├── manage-gitignore.test.js
│ ├── mcp
│ │ └── tools
│ │ ├── __mocks__
│ │ │ └── move-task.js
│ │ ├── add-task.test.js
│ │ ├── analyze-complexity.test.js
│ │ ├── expand-all.test.js
│ │ ├── get-tasks.test.js
│ │ ├── initialize-project.test.js
│ │ ├── move-task-cross-tag-options.test.js
│ │ ├── move-task-cross-tag.test.js
│ │ ├── remove-task.test.js
│ │ └── tool-registration.test.js
│ ├── mcp-providers
│ │ ├── mcp-components.test.js
│ │ └── mcp-provider.test.js
│ ├── parse-prd.test.js
│ ├── profiles
│ │ ├── amp-integration.test.js
│ │ ├── claude-integration.test.js
│ │ ├── cline-integration.test.js
│ │ ├── codex-integration.test.js
│ │ ├── cursor-integration.test.js
│ │ ├── gemini-integration.test.js
│ │ ├── kilo-integration.test.js
│ │ ├── kiro-integration.test.js
│ │ ├── mcp-config-validation.test.js
│ │ ├── opencode-integration.test.js
│ │ ├── profile-safety-check.test.js
│ │ ├── roo-integration.test.js
│ │ ├── rule-transformer-cline.test.js
│ │ ├── rule-transformer-cursor.test.js
│ │ ├── rule-transformer-gemini.test.js
│ │ ├── rule-transformer-kilo.test.js
│ │ ├── rule-transformer-kiro.test.js
│ │ ├── rule-transformer-opencode.test.js
│ │ ├── rule-transformer-roo.test.js
│ │ ├── rule-transformer-trae.test.js
│ │ ├── rule-transformer-vscode.test.js
│ │ ├── rule-transformer-windsurf.test.js
│ │ ├── rule-transformer-zed.test.js
│ │ ├── rule-transformer.test.js
│ │ ├── selective-profile-removal.test.js
│ │ ├── subdirectory-support.test.js
│ │ ├── trae-integration.test.js
│ │ ├── vscode-integration.test.js
│ │ ├── windsurf-integration.test.js
│ │ └── zed-integration.test.js
│ ├── progress
│ │ └── base-progress-tracker.test.js
│ ├── prompt-manager.test.js
│ ├── prompts
│ │ ├── expand-task-prompt.test.js
│ │ └── prompt-migration.test.js
│ ├── scripts
│ │ └── modules
│ │ ├── commands
│ │ │ ├── move-cross-tag.test.js
│ │ │ └── README.md
│ │ ├── dependency-manager
│ │ │ ├── circular-dependencies.test.js
│ │ │ ├── cross-tag-dependencies.test.js
│ │ │ └── fix-dependencies-command.test.js
│ │ ├── task-manager
│ │ │ ├── add-subtask.test.js
│ │ │ ├── add-task.test.js
│ │ │ ├── analyze-task-complexity.test.js
│ │ │ ├── clear-subtasks.test.js
│ │ │ ├── complexity-report-tag-isolation.test.js
│ │ │ ├── expand-all-tasks.test.js
│ │ │ ├── expand-task.test.js
│ │ │ ├── find-next-task.test.js
│ │ │ ├── generate-task-files.test.js
│ │ │ ├── list-tasks.test.js
│ │ │ ├── models-baseurl.test.js
│ │ │ ├── move-task-cross-tag.test.js
│ │ │ ├── move-task.test.js
│ │ │ ├── parse-prd-schema.test.js
│ │ │ ├── parse-prd.test.js
│ │ │ ├── remove-subtask.test.js
│ │ │ ├── remove-task.test.js
│ │ │ ├── research.test.js
│ │ │ ├── scope-adjustment.test.js
│ │ │ ├── set-task-status.test.js
│ │ │ ├── setup.js
│ │ │ ├── update-single-task-status.test.js
│ │ │ ├── update-subtask-by-id.test.js
│ │ │ ├── update-task-by-id.test.js
│ │ │ └── update-tasks.test.js
│ │ ├── ui
│ │ │ └── cross-tag-error-display.test.js
│ │ └── utils-tag-aware-paths.test.js
│ ├── task-finder.test.js
│ ├── task-manager
│ │ ├── clear-subtasks.test.js
│ │ ├── move-task.test.js
│ │ ├── tag-boundary.test.js
│ │ └── tag-management.test.js
│ ├── task-master.test.js
│ ├── ui
│ │ └── indicators.test.js
│ ├── ui.test.js
│ ├── utils-strip-ansi.test.js
│ └── utils.test.js
├── tsconfig.json
├── tsdown.config.ts
├── turbo.json
└── update-task-migration-plan.md
```
# Files
--------------------------------------------------------------------------------
/tests/unit/profiles/cursor-integration.test.js:
--------------------------------------------------------------------------------
```javascript
import { jest } from '@jest/globals';
import fs from 'fs';
import path from 'path';
import os from 'os';
// Mock external modules
jest.mock('child_process', () => ({
execSync: jest.fn()
}));
// Mock console methods to avoid chalk issues
const mockLog = jest.fn();
const originalConsole = global.console;
const mockConsole = {
log: jest.fn(),
info: jest.fn(),
warn: jest.fn(),
error: jest.fn(),
clear: jest.fn()
};
global.console = mockConsole;
// Mock utils logger to avoid chalk dependency issues
await jest.unstable_mockModule('../../../scripts/modules/utils.js', () => ({
default: undefined,
log: mockLog,
isSilentMode: () => false
}));
// Import the cursor profile after mocking
const { cursorProfile, onAddRulesProfile, onRemoveRulesProfile } = await import(
'../../../src/profiles/cursor.js'
);
describe('Cursor Integration', () => {
let tempDir;
afterAll(() => {
global.console = originalConsole;
});
beforeEach(() => {
jest.clearAllMocks();
// Create a temporary directory for testing
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'task-master-test-'));
// Spy on fs methods
jest.spyOn(fs, 'writeFileSync').mockImplementation(() => {});
jest.spyOn(fs, 'readFileSync').mockImplementation((filePath) => {
if (filePath.toString().includes('mcp.json')) {
return JSON.stringify({ mcpServers: {} }, null, 2);
}
return '{}';
});
jest.spyOn(fs, 'existsSync').mockImplementation(() => false);
jest.spyOn(fs, 'mkdirSync').mockImplementation(() => {});
});
afterEach(() => {
// Clean up the temporary directory
try {
fs.rmSync(tempDir, { recursive: true, force: true });
} catch (err) {
console.error(`Error cleaning up: ${err.message}`);
}
});
// Test function that simulates the createProjectStructure behavior for Cursor files
function mockCreateCursorStructure() {
// Create main .cursor directory
fs.mkdirSync(path.join(tempDir, '.cursor'), { recursive: true });
// Create rules directory
fs.mkdirSync(path.join(tempDir, '.cursor', 'rules'), { recursive: true });
// Create MCP config file
fs.writeFileSync(
path.join(tempDir, '.cursor', 'mcp.json'),
JSON.stringify({ mcpServers: {} }, null, 2)
);
}
test('creates all required .cursor directories', () => {
// Act
mockCreateCursorStructure();
// Assert
expect(fs.mkdirSync).toHaveBeenCalledWith(path.join(tempDir, '.cursor'), {
recursive: true
});
expect(fs.mkdirSync).toHaveBeenCalledWith(
path.join(tempDir, '.cursor', 'rules'),
{ recursive: true }
);
});
test('cursor profile has lifecycle functions for command copying', () => {
// Assert that the profile exports the lifecycle functions
expect(typeof onAddRulesProfile).toBe('function');
expect(typeof onRemoveRulesProfile).toBe('function');
expect(cursorProfile.onAddRulesProfile).toBe(onAddRulesProfile);
expect(cursorProfile.onRemoveRulesProfile).toBe(onRemoveRulesProfile);
});
describe('command copying lifecycle', () => {
let mockAssetsDir;
let mockTargetDir;
beforeEach(() => {
mockAssetsDir = path.join(tempDir, 'assets');
mockTargetDir = path.join(tempDir, 'target');
// Reset all mocks
jest.clearAllMocks();
// Mock fs methods for the lifecycle functions
jest.spyOn(fs, 'existsSync').mockImplementation((filePath) => {
const pathStr = filePath.toString();
if (pathStr.includes('claude/commands')) {
return true; // Mock that source commands exist
}
return false;
});
jest.spyOn(fs, 'mkdirSync').mockImplementation(() => {});
jest.spyOn(fs, 'readdirSync').mockImplementation(() => ['tm']);
jest
.spyOn(fs, 'statSync')
.mockImplementation(() => ({ isDirectory: () => true }));
jest.spyOn(fs, 'copyFileSync').mockImplementation(() => {});
jest.spyOn(fs, 'rmSync').mockImplementation(() => {});
});
afterEach(() => {
jest.restoreAllMocks();
});
test('onAddRulesProfile copies commands from assets to .cursor/commands', () => {
// Detect if cpSync exists and set up appropriate spy
if (fs.cpSync) {
const cpSpy = jest.spyOn(fs, 'cpSync').mockImplementation(() => {});
// Act
onAddRulesProfile(mockTargetDir, mockAssetsDir);
// Assert
expect(fs.existsSync).toHaveBeenCalledWith(
path.join(mockAssetsDir, 'claude', 'commands')
);
expect(cpSpy).toHaveBeenCalledWith(
path.join(mockAssetsDir, 'claude', 'commands'),
path.join(mockTargetDir, '.cursor', 'commands'),
expect.objectContaining({ recursive: true, force: true })
);
} else {
// Act
onAddRulesProfile(mockTargetDir, mockAssetsDir);
// Assert
expect(fs.existsSync).toHaveBeenCalledWith(
path.join(mockAssetsDir, 'claude', 'commands')
);
expect(fs.mkdirSync).toHaveBeenCalledWith(
path.join(mockTargetDir, '.cursor', 'commands'),
{ recursive: true }
);
expect(fs.copyFileSync).toHaveBeenCalled();
}
});
test('onAddRulesProfile handles missing source directory gracefully', () => {
// Arrange - mock source directory not existing
jest.spyOn(fs, 'existsSync').mockImplementation(() => false);
// Act
onAddRulesProfile(mockTargetDir, mockAssetsDir);
// Assert - should not attempt to copy anything
expect(fs.mkdirSync).not.toHaveBeenCalled();
expect(fs.copyFileSync).not.toHaveBeenCalled();
});
test('onRemoveRulesProfile removes .cursor/commands directory', () => {
// Arrange - mock directory exists
jest.spyOn(fs, 'existsSync').mockImplementation(() => true);
// Act
onRemoveRulesProfile(mockTargetDir);
// Assert
expect(fs.rmSync).toHaveBeenCalledWith(
path.join(mockTargetDir, '.cursor', 'commands'),
{ recursive: true, force: true }
);
});
test('onRemoveRulesProfile handles missing directory gracefully', () => {
// Arrange - mock directory doesn't exist
jest.spyOn(fs, 'existsSync').mockImplementation(() => false);
// Act
onRemoveRulesProfile(mockTargetDir);
// Assert - should still return true but not attempt removal
expect(fs.rmSync).not.toHaveBeenCalled();
});
test('onRemoveRulesProfile handles removal errors gracefully', () => {
// Arrange - mock directory exists but removal fails
jest.spyOn(fs, 'existsSync').mockImplementation(() => true);
jest.spyOn(fs, 'rmSync').mockImplementation(() => {
throw new Error('Permission denied');
});
// Act & Assert - should not throw
expect(() => onRemoveRulesProfile(mockTargetDir)).not.toThrow();
});
});
});
```
--------------------------------------------------------------------------------
/packages/tm-core/src/modules/integration/services/task-expansion.service.ts:
--------------------------------------------------------------------------------
```typescript
/**
* @fileoverview Task Expansion Service
* Core service for expanding tasks into subtasks using AI
*/
import { z } from 'zod';
import {
ERROR_CODES,
TaskMasterError
} from '../../../common/errors/task-master-error.js';
import { getLogger } from '../../../common/logger/factory.js';
import { AuthManager } from '../../auth/managers/auth-manager.js';
import { ApiClient } from '../../storage/utils/api-client.js';
import type { TaskRepository } from '../../tasks/repositories/task-repository.interface.js';
/**
* Response from the expand task API endpoint (202 Accepted)
*/
interface ExpandTaskResponse {
message: string;
taskId: string;
queued: boolean;
jobId: string;
}
/**
* Result returned to the caller with expansion details
*/
export interface ExpandTaskResult {
/** Success message */
message: string;
/** Task ID (display_id like HAM-4) */
taskId: string;
/** Whether the job was queued successfully */
queued: boolean;
/** Background job ID for tracking */
jobId: string;
/** Direct link to view the task in the UI */
taskLink: string;
}
/**
* Options for task expansion
*/
export interface ExpandTaskOptions {
/** Number of subtasks to generate */
numSubtasks?: number;
/** Use research model for expansion */
useResearch?: boolean;
/** Additional context for AI generation */
additionalContext?: string;
/** Force expansion even if subtasks exist */
force?: boolean;
}
/**
* TaskExpansionService handles AI-powered task expansion
*/
export class TaskExpansionService {
private readonly repository: TaskRepository;
private readonly projectId: string;
private readonly apiClient: ApiClient;
private readonly authManager: AuthManager;
private readonly logger = getLogger('TaskExpansionService');
constructor(
repository: TaskRepository,
projectId: string,
apiClient: ApiClient,
authManager: AuthManager
) {
this.repository = repository;
this.projectId = projectId;
this.apiClient = apiClient;
this.authManager = authManager;
}
/**
* Expand task into subtasks with AI-powered generation
* Sends task to backend for server-side AI processing
* @returns Expansion result with job details and task link
*/
async expandTask(
taskId: string,
options?: ExpandTaskOptions
): Promise<ExpandTaskResult> {
try {
// Get brief context from AuthManager
const context = this.authManager.ensureBriefSelected('expandTask');
// Get the task being expanded to extract existing subtasks
const task = await this.repository.getTask(this.projectId, taskId);
if (!task) {
throw new TaskMasterError(
`Task ${taskId} not found`,
ERROR_CODES.TASK_NOT_FOUND,
{
operation: 'expandTask',
taskId,
userMessage: `Task ${taskId} isn't available in the current project.`
}
);
}
// Get brief information for enriched context
const brief = await this.repository.getBrief(context.briefId);
// Build brief context payload with brief data if available
const briefContext = {
title: brief?.name || context.briefName || context.briefId,
description: brief?.description || undefined,
status: brief?.status || 'active'
};
// Get all tasks for context (optional but helpful for AI)
const allTasks = await this.repository.getTasks(this.projectId);
// Build the payload according to ExpandTaskContextSchema
const payload = {
briefContext,
allTasks,
existingSubtasks: task.subtasks || [],
enrichedContext: options?.additionalContext
};
// Build query params for options that aren't part of the context
const queryParams = new URLSearchParams();
if (options?.numSubtasks !== undefined) {
queryParams.set('numSubtasks', options.numSubtasks.toString());
}
if (options?.useResearch !== undefined) {
queryParams.set('useResearch', options.useResearch.toString());
}
if (options?.force !== undefined) {
queryParams.set('force', options.force.toString());
}
// Validate that task has a database UUID (required for API calls)
if (!task.databaseId) {
throw new TaskMasterError(
`Task ${taskId} is missing a database ID. Task expansion requires tasks to be synced with the remote database.`,
ERROR_CODES.VALIDATION_ERROR,
{
operation: 'expandTask',
taskId,
userMessage:
'This task has not been synced with the remote database. Please ensure the task is saved remotely before attempting expansion.'
}
);
}
// Validate UUID format using Zod
const uuidSchema = z.uuid();
const validation = uuidSchema.safeParse(task.databaseId);
if (!validation.success) {
throw new TaskMasterError(
`Task ${taskId} has an invalid database ID format: ${task.databaseId}`,
ERROR_CODES.VALIDATION_ERROR,
{
operation: 'expandTask',
taskId,
databaseId: task.databaseId,
userMessage:
'The task database ID is not in valid UUID format. This may indicate data corruption.'
}
);
}
// Use validated databaseId (UUID) for API calls
const taskUuid = task.databaseId;
const url = `/ai/api/v1/tasks/${taskUuid}/subtasks/generate${
queryParams.toString() ? `?${queryParams.toString()}` : ''
}`;
const result = await this.apiClient.post<ExpandTaskResponse>(
url,
payload
);
// Get base URL for task link
const baseUrl =
process.env.TM_BASE_DOMAIN ||
process.env.TM_PUBLIC_BASE_DOMAIN ||
'http://localhost:8080';
const taskLink = `${baseUrl}/home/hamster/briefs/${context.briefId}/task/${taskUuid}`;
// Log success with job details and task link
this.logger.info(`✓ Task expansion queued for ${taskId}`);
this.logger.info(` Job ID: ${result.jobId}`);
this.logger.info(` ${result.message}`);
this.logger.info(` View task: ${taskLink}`);
return {
...result,
taskLink
};
} catch (error) {
// If it's already a TaskMasterError, just add context and re-throw
if (error instanceof TaskMasterError) {
throw error.withContext({
operation: 'expandTask',
taskId,
numSubtasks: options?.numSubtasks,
useResearch: options?.useResearch
});
}
// For other errors, wrap them
const errorMessage =
error instanceof Error ? error.message : String(error);
throw new TaskMasterError(
errorMessage,
ERROR_CODES.STORAGE_ERROR,
{
operation: 'expandTask',
taskId,
numSubtasks: options?.numSubtasks,
useResearch: options?.useResearch
},
error as Error
);
}
}
}
```
--------------------------------------------------------------------------------
/apps/docs/getting-started/quick-start/installation.mdx:
--------------------------------------------------------------------------------
```markdown
---
title: Installation
sidebarTitle: "Installation"
---
Now that you have Node.js and your first API Key, you are ready to begin installing Task Master in one of three ways.
<Note>Cursor Users Can Use the One Click Install Below</Note>
<Accordion title="Quick Install for Cursor 1.0+ (One-Click)">
<a href="cursor://anysphere.cursor-deeplink/mcp/install?name=task-master-ai&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIi0tcGFja2FnZT10YXNrLW1hc3Rlci1haSIsInRhc2stbWFzdGVyLWFpIl0sImVudiI6eyJBTlRIUk9QSUNfQVBJX0tFWSI6IllPVVJfQU5USFJPUElDX0FQSV9LRVlfSEVSRSIsIlBFUlBMRVhJVFlfQVBJX0tFWSI6IllPVVJfUEVSUExFWElUWV9BUElfS0VZX0hFUkUiLCJPUEVOQUlfQVBJX0tFWSI6IllPVVJfT1BFTkFJX0tFWV9IRVJFIiwiR09PR0xFX0FQSV9LRVkiOiJZT1VSX0dPT0dMRV9LRVlfSEVSRSIsIk1JU1RSQUxfQVBJX0tFWSI6IllPVVJfTUlTVFJBTF9LRVlfSEVSRSIsIk9QRU5ST1VURVJfQVBJX0tFWSI6IllPVVJfT1BFTlJPVVRFUl9LRVlfSEVSRSIsIlhBSV9BUElfS0VZIjoiWU9VUl9YQUlfS0VZX0hFUkUiLCJBWlVSRV9PUEVOQUJFX0FQSV9LRVkiOiJZT1VSX0FaVVJFX0tFWV9IRVJFIiwiT0xMQU1BX0FQSV9LRVkiOiJZT1VSX09MTEFNQV9BUElfS0VZX0hFUkUifX0%3D">
<img
className="block dark:hidden"
src="https://cursor.com/deeplink/mcp-install-light.png"
alt="Add Task Master MCP server to Cursor"
noZoom
/>
<img
className="hidden dark:block"
src="https://cursor.com/deeplink/mcp-install-dark.png"
alt="Add Task Master MCP server to Cursor"
noZoom
/>
</a>
Or click the copy button (top-right of code block) then paste into your browser:
```text
cursor://anysphere.cursor-deeplink/mcp/install?name=taskmaster-ai&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIi0tcGFja2FnZT10YXNrLW1hc3Rlci1haSIsInRhc2stbWFzdGVyLWFpIl0sImVudiI6eyJBTlRIUk9QSUNfQVBJX0tFWSI6IllPVVJfQU5USFJPUElDX0FQSV9LRVlfSEVSRSIsIlBFUlBMRVhJVFlfQVBJX0tFWSI6IllPVVJfUEVSUExFWElUWV9BUElfS0VZX0hFUkUiLCJPUEVOQUlfQVBJX0tFWSI6IllPVVJfT1BFTkFJX0tFWV9IRVJFIiwiR09PR0xFX0FQSV9LRVkiOiJZT1VSX0dPT0dMRV9LRVlfSEVSRSIsIk1JU1RSQUxfQVBJX0tFWSI6IllPVVJfTUlTVFJBTF9LRVlfSEVSRSIsIk9QRU5ST1VURVJfQVBJX0tFWSI6IllPVVJfT1BFTlJPVVRFUl9LRVlfSEVSRSIsIlhBSV9BUElfS0VZIjoiWU9VUl9YQUlfS0VZX0hFUkUiLCJBWlVSRV9PUEVOQUlfQVBJX0tFWSI6IllPVVJfQVpVUkVfS0VZX0hFUkUiLCJPTExBTUFfQVBJX0tFWSI6IllPVVJfT0xMQU1BX0FQSV9LRVlfSEVSRSJ9fQo=
```
> **Note:** After clicking the link, you'll still need to add your API keys to the configuration. The link installs the MCP server with placeholder keys that you'll need to replace with your actual API keys.
### Claude Code Quick Install
For Claude Code users:
```bash
claude mcp add taskmaster-ai -- npx -y task-master-ai
```
Don't forget to add your API keys to the configuration:
- in the root .env of your Project
- in the "env" section of your mcp config for taskmaster-ai
</Accordion>
## Installation Options
<Accordion title="Option 1: MCP (Recommended)">
MCP (Model Control Protocol) lets you run Task Master directly from your editor.
## 1. Add your MCP config at the following path depending on your editor
| Editor | Scope | Linux/macOS Path | Windows Path | Key |
| ------------ | ------- | ------------------------------------- | ------------------------------------------------- | ------------ |
| **Cursor** | Global | `~/.cursor/mcp.json` | `%USERPROFILE%\.cursor\mcp.json` | `mcpServers` |
| | Project | `<project_folder>/.cursor/mcp.json` | `<project_folder>\.cursor\mcp.json` | `mcpServers` |
| **Windsurf** | Global | `~/.codeium/windsurf/mcp_config.json` | `%USERPROFILE%\.codeium\windsurf\mcp_config.json` | `mcpServers` |
| **VS Code** | Project | `<project_folder>/.vscode/mcp.json` | `<project_folder>\.vscode\mcp.json` | `servers` |
## Manual Configuration
### Cursor & Windsurf (`mcpServers`)
```json
{
"mcpServers": {
"taskmaster-ai": {
"command": "npx",
"args": ["-y", "task-master-ai"],
"env": {
"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE",
"PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE",
"OPENAI_API_KEY": "YOUR_OPENAI_KEY_HERE",
"GOOGLE_API_KEY": "YOUR_GOOGLE_KEY_HERE",
"MISTRAL_API_KEY": "YOUR_MISTRAL_KEY_HERE",
"OPENROUTER_API_KEY": "YOUR_OPENROUTER_KEY_HERE",
"XAI_API_KEY": "YOUR_XAI_KEY_HERE",
"AZURE_OPENAI_API_KEY": "YOUR_AZURE_KEY_HERE",
"OLLAMA_API_KEY": "YOUR_OLLAMA_API_KEY_HERE"
}
}
}
}
```
> 🔑 Replace `YOUR_…_KEY_HERE` with your real API keys. You can remove keys you don't use.
> **Note**: If you see `0 tools enabled` in the MCP settings, restart your editor and check that your API keys are correctly configured.
### VS Code (`servers` + `type`)
```json
{
"servers": {
"taskmaster-ai": {
"command": "npx",
"args": ["-y", "task-master-ai"],
"env": {
"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY_HERE",
"PERPLEXITY_API_KEY": "YOUR_PERPLEXITY_API_KEY_HERE",
"OPENAI_API_KEY": "YOUR_OPENAI_KEY_HERE",
"GOOGLE_API_KEY": "YOUR_GOOGLE_KEY_HERE",
"MISTRAL_API_KEY": "YOUR_MISTRAL_KEY_HERE",
"OPENROUTER_API_KEY": "YOUR_OPENROUTER_KEY_HERE",
"XAI_API_KEY": "YOUR_XAI_KEY_HERE",
"AZURE_OPENAI_API_KEY": "YOUR_AZURE_KEY_HERE"
},
"type": "stdio"
}
}
}
```
> 🔑 Replace `YOUR_…_KEY_HERE` with your real API keys. You can remove keys you don't use.
#### 2. (Cursor-only) Enable Taskmaster MCP
Open Cursor Settings (Ctrl+Shift+J) ➡ Click on MCP tab on the left ➡ Enable task-master-ai with the toggle
#### 3. (Optional) Configure the models you want to use
In your editor's AI chat pane, say:
```txt
Change the main, research and fallback models to <model_name>, <model_name> and <model_name> respectively.
```
For example, to use Claude Code (no API key required):
```txt
Change the main model to claude-code/sonnet
```
#### 4. Initialize Task Master
In your editor's AI chat pane, say:
```txt
Initialize taskmaster-ai in my project
```
</Accordion>
<Accordion title="Option 2: Using Command Line">
## CLI Installation
```bash
# Install globally
npm install -g task-master-ai
# OR install locally within your project
npm install task-master-ai
```
## Initialize a new project
```bash
# If installed globally
task-master init
# If installed locally
npx task-master init
# Initialize project with specific rules
task-master init --rules cursor,windsurf,vscode
```
This will prompt you for project details and set up a new project with the necessary files and structure.
</Accordion>
```
--------------------------------------------------------------------------------
/mcp-server/src/core/direct-functions/rules.js:
--------------------------------------------------------------------------------
```javascript
/**
* rules.js
* Direct function implementation for adding or removing rules
*/
import {
enableSilentMode,
disableSilentMode
} from '../../../../scripts/modules/utils.js';
import {
convertAllRulesToProfileRules,
removeProfileRules,
getRulesProfile,
isValidProfile
} from '../../../../src/utils/rule-transformer.js';
import { RULE_PROFILES } from '../../../../src/constants/profiles.js';
import { RULES_ACTIONS } from '../../../../src/constants/rules-actions.js';
import {
wouldRemovalLeaveNoProfiles,
getInstalledProfiles
} from '../../../../src/utils/profiles.js';
import path from 'path';
import fs from 'fs';
/**
* Direct function wrapper for adding or removing rules.
* @param {Object} args - Command arguments
* @param {"add"|"remove"} args.action - Action to perform: add or remove rules
* @param {string[]} args.profiles - List of profiles to add or remove
* @param {string} args.projectRoot - Absolute path to the project root
* @param {boolean} [args.yes=true] - Run non-interactively
* @param {Object} log - Logger object
* @param {Object} context - Additional context (session)
* @returns {Promise<Object>} - Result object { success: boolean, data?: any, error?: { code: string, message: string } }
*/
export async function rulesDirect(args, log, context = {}) {
enableSilentMode();
try {
const { action, profiles, projectRoot, yes, force } = args;
if (
!action ||
!Array.isArray(profiles) ||
profiles.length === 0 ||
!projectRoot
) {
return {
success: false,
error: {
code: 'MISSING_ARGUMENT',
message: 'action, profiles, and projectRoot are required.'
}
};
}
const removalResults = [];
const addResults = [];
if (action === RULES_ACTIONS.REMOVE) {
// Safety check: Ensure this won't remove all rule profiles (unless forced)
if (!force && wouldRemovalLeaveNoProfiles(projectRoot, profiles)) {
const installedProfiles = getInstalledProfiles(projectRoot);
const remainingProfiles = installedProfiles.filter(
(profile) => !profiles.includes(profile)
);
return {
success: false,
error: {
code: 'CRITICAL_REMOVAL_BLOCKED',
message: `CRITICAL: This operation would remove ALL remaining rule profiles (${profiles.join(', ')}), leaving your project with no rules configurations. This could significantly impact functionality. Currently installed profiles: ${installedProfiles.join(', ')}. If you're certain you want to proceed, set force: true or use the CLI with --force flag.`
}
};
}
for (const profile of profiles) {
if (!isValidProfile(profile)) {
removalResults.push({
profileName: profile,
success: false,
error: `The requested rule profile for '${profile}' is unavailable. Supported profiles are: ${RULE_PROFILES.join(', ')}.`
});
continue;
}
const profileConfig = getRulesProfile(profile);
const result = removeProfileRules(projectRoot, profileConfig);
removalResults.push(result);
}
const successes = removalResults
.filter((r) => r.success)
.map((r) => r.profileName);
const skipped = removalResults
.filter((r) => r.skipped)
.map((r) => r.profileName);
const errors = removalResults.filter(
(r) => r.error && !r.success && !r.skipped
);
const withNotices = removalResults.filter((r) => r.notice);
let summary = '';
if (successes.length > 0) {
summary += `Successfully removed Task Master rules: ${successes.join(', ')}.`;
}
if (skipped.length > 0) {
summary += `Skipped (default or protected): ${skipped.join(', ')}.`;
}
if (errors.length > 0) {
summary += errors
.map((r) => `Error removing ${r.profileName}: ${r.error}`)
.join(' ');
}
if (withNotices.length > 0) {
summary += ` Notices: ${withNotices.map((r) => `${r.profileName} - ${r.notice}`).join('; ')}.`;
}
disableSilentMode();
return {
success: errors.length === 0,
data: { summary, results: removalResults }
};
} else if (action === RULES_ACTIONS.ADD) {
for (const profile of profiles) {
if (!isValidProfile(profile)) {
addResults.push({
profileName: profile,
success: false,
error: `Profile not found: static import missing for '${profile}'. Valid profiles: ${RULE_PROFILES.join(', ')}`
});
continue;
}
const profileConfig = getRulesProfile(profile);
const { success, failed } = convertAllRulesToProfileRules(
projectRoot,
profileConfig
);
// Determine paths
const rulesDir = profileConfig.rulesDir;
const profileRulesDir = path.join(projectRoot, rulesDir);
const profileDir = profileConfig.profileDir;
const mcpConfig = profileConfig.mcpConfig !== false;
const mcpPath =
mcpConfig && profileConfig.mcpConfigPath
? path.join(projectRoot, profileConfig.mcpConfigPath)
: null;
// Check what was created
const mcpConfigCreated =
mcpConfig && mcpPath ? fs.existsSync(mcpPath) : undefined;
const rulesDirCreated = fs.existsSync(profileRulesDir);
const profileFolderCreated = fs.existsSync(
path.join(projectRoot, profileDir)
);
const error =
failed > 0 ? `${failed} rule files failed to convert.` : null;
const resultObj = {
profileName: profile,
mcpConfigCreated,
rulesDirCreated,
profileFolderCreated,
skipped: false,
error,
success:
(mcpConfig ? mcpConfigCreated : true) &&
rulesDirCreated &&
success > 0 &&
!error
};
addResults.push(resultObj);
}
const successes = addResults
.filter((r) => r.success)
.map((r) => r.profileName);
const errors = addResults.filter((r) => r.error && !r.success);
let summary = '';
if (successes.length > 0) {
summary += `Successfully added rules: ${successes.join(', ')}.`;
}
if (errors.length > 0) {
summary += errors
.map((r) => ` Error adding ${r.profileName}: ${r.error}`)
.join(' ');
}
disableSilentMode();
return {
success: errors.length === 0,
data: { summary, results: addResults }
};
} else {
disableSilentMode();
return {
success: false,
error: {
code: 'INVALID_ACTION',
message: `Unknown action. Use "${RULES_ACTIONS.ADD}" or "${RULES_ACTIONS.REMOVE}".`
}
};
}
} catch (error) {
disableSilentMode();
log.error(`[rulesDirect] Error: ${error.message}`);
return {
success: false,
error: {
code: error.code || 'RULES_ERROR',
message: error.message
}
};
}
}
```
--------------------------------------------------------------------------------
/mcp-server/src/core/direct-functions/move-task-cross-tag.js:
--------------------------------------------------------------------------------
```javascript
/**
* Direct function wrapper for cross-tag task moves
*/
import { moveTasksBetweenTags } from '../../../../scripts/modules/task-manager/move-task.js';
import { findTasksPath } from '../utils/path-utils.js';
import {
enableSilentMode,
disableSilentMode
} from '../../../../scripts/modules/utils.js';
/**
* Move tasks between tags
* @param {Object} args - Function arguments
* @param {string} args.tasksJsonPath - Explicit path to the tasks.json file
* @param {string} args.sourceIds - Comma-separated IDs of tasks to move
* @param {string} args.sourceTag - Source tag name
* @param {string} args.targetTag - Target tag name
* @param {boolean} args.withDependencies - Move dependent tasks along with main task
* @param {boolean} args.ignoreDependencies - Break cross-tag dependencies during move
* @param {string} args.file - Alternative path to the tasks.json file
* @param {string} args.projectRoot - Project root directory
* @param {Object} log - Logger object
* @returns {Promise<{success: boolean, data?: Object, error?: Object}>}
*/
export async function moveTaskCrossTagDirect(args, log, context = {}) {
const { session } = context;
const { projectRoot } = args;
log.info(`moveTaskCrossTagDirect called with args: ${JSON.stringify(args)}`);
// Validate required parameters
if (!args.sourceIds) {
return {
success: false,
error: {
message: 'Source IDs are required',
code: 'MISSING_SOURCE_IDS'
}
};
}
if (!args.sourceTag) {
return {
success: false,
error: {
message: 'Source tag is required for cross-tag moves',
code: 'MISSING_SOURCE_TAG'
}
};
}
if (!args.targetTag) {
return {
success: false,
error: {
message: 'Target tag is required for cross-tag moves',
code: 'MISSING_TARGET_TAG'
}
};
}
// Validate that source and target tags are different
if (args.sourceTag === args.targetTag) {
return {
success: false,
error: {
message: `Source and target tags are the same ("${args.sourceTag}")`,
code: 'SAME_SOURCE_TARGET_TAG',
suggestions: [
'Use different tags for cross-tag moves',
'Use within-tag move: task-master move --from=<id> --to=<id> --tag=<tag>',
'Check available tags: task-master tags'
]
}
};
}
try {
// Find tasks.json path if not provided
let tasksPath = args.tasksJsonPath || args.file;
if (!tasksPath) {
if (!args.projectRoot) {
return {
success: false,
error: {
message:
'Project root is required if tasksJsonPath is not provided',
code: 'MISSING_PROJECT_ROOT'
}
};
}
tasksPath = findTasksPath(args, log);
}
// Enable silent mode to prevent console output during MCP operation
enableSilentMode();
try {
// Parse source IDs
const sourceIds = args.sourceIds.split(',').map((id) => id.trim());
// Prepare move options
const moveOptions = {
withDependencies: args.withDependencies || false,
ignoreDependencies: args.ignoreDependencies || false
};
// Call the core moveTasksBetweenTags function
const result = await moveTasksBetweenTags(
tasksPath,
sourceIds,
args.sourceTag,
args.targetTag,
moveOptions,
{ projectRoot }
);
return {
success: true,
data: {
...result,
message: `Successfully moved ${sourceIds.length} task(s) from "${args.sourceTag}" to "${args.targetTag}"`,
moveOptions,
sourceTag: args.sourceTag,
targetTag: args.targetTag
}
};
} finally {
// Restore console output - always executed regardless of success or error
disableSilentMode();
}
} catch (error) {
log.error(`Failed to move tasks between tags: ${error.message}`);
log.error(`Error code: ${error.code}, Error name: ${error.name}`);
// Enhanced error handling with structured error objects
let errorCode = 'MOVE_TASK_CROSS_TAG_ERROR';
let suggestions = [];
// Handle structured errors first
if (error.code === 'CROSS_TAG_DEPENDENCY_CONFLICTS') {
errorCode = 'CROSS_TAG_DEPENDENCY_CONFLICT';
suggestions = [
'Use --with-dependencies to move dependent tasks together',
'Use --ignore-dependencies to break cross-tag dependencies',
'Run task-master validate-dependencies to check for issues',
'Move dependencies first, then move the main task'
];
} else if (error.code === 'CANNOT_MOVE_SUBTASK') {
errorCode = 'SUBTASK_MOVE_RESTRICTION';
suggestions = [
'Promote subtask to full task first: task-master remove-subtask --id=<subtaskId> --convert',
'Move the parent task with all subtasks using --with-dependencies'
];
} else if (
error.code === 'TASK_NOT_FOUND' ||
error.code === 'INVALID_SOURCE_TAG' ||
error.code === 'INVALID_TARGET_TAG'
) {
errorCode = 'TAG_OR_TASK_NOT_FOUND';
suggestions = [
'Check available tags: task-master tags',
'Verify task IDs exist: task-master list',
'Check task details: task-master show <id>'
];
} else if (error.message.includes('cross-tag dependency conflicts')) {
// Fallback for legacy error messages
errorCode = 'CROSS_TAG_DEPENDENCY_CONFLICT';
suggestions = [
'Use --with-dependencies to move dependent tasks together',
'Use --ignore-dependencies to break cross-tag dependencies',
'Run task-master validate-dependencies to check for issues',
'Move dependencies first, then move the main task'
];
} else if (error.message.includes('Cannot move subtask')) {
// Fallback for legacy error messages
errorCode = 'SUBTASK_MOVE_RESTRICTION';
suggestions = [
'Promote subtask to full task first: task-master remove-subtask --id=<subtaskId> --convert',
'Move the parent task with all subtasks using --with-dependencies'
];
} else if (error.message.includes('not found')) {
// Fallback for legacy error messages
errorCode = 'TAG_OR_TASK_NOT_FOUND';
suggestions = [
'Check available tags: task-master tags',
'Verify task IDs exist: task-master list',
'Check task details: task-master show <id>'
];
} else if (
error.code === 'TASK_ALREADY_EXISTS' ||
error.message?.includes('already exists in target tag')
) {
// Target tag has an ID collision
errorCode = 'TASK_ALREADY_EXISTS';
suggestions = [
'Choose a different target tag without conflicting IDs',
'Move a different set of IDs (avoid existing ones)',
'If needed, move within-tag to a new ID first, then cross-tag move'
];
}
return {
success: false,
error: {
message: error.message,
code: errorCode,
suggestions
}
};
}
}
```
--------------------------------------------------------------------------------
/scripts/modules/task-manager/generate-task-files.js:
--------------------------------------------------------------------------------
```javascript
import path from 'path';
import fs from 'fs';
import chalk from 'chalk';
import { log, readJSON } from '../utils.js';
import { formatDependenciesWithStatus } from '../ui.js';
import { validateAndFixDependencies } from '../dependency-manager.js';
import { getDebugFlag } from '../config-manager.js';
/**
* Generate individual task files from tasks.json
* @param {string} tasksPath - Path to the tasks.json file
* @param {string} outputDir - Output directory for task files
* @param {Object} options - Additional options (mcpLog for MCP mode, projectRoot, tag)
* @param {string} [options.projectRoot] - Project root path
* @param {string} [options.tag] - Tag for the task
* @param {Object} [options.mcpLog] - MCP logger object
* @returns {Object|undefined} Result object in MCP mode, undefined in CLI mode
*/
function generateTaskFiles(tasksPath, outputDir, options = {}) {
try {
const isMcpMode = !!options?.mcpLog;
const { projectRoot, tag } = options;
// 1. Read the raw data structure, ensuring we have all tags.
// We call readJSON without a specific tag to get the resolved default view,
// which correctly contains the full structure in `_rawTaggedData`.
const resolvedData = readJSON(tasksPath, projectRoot, tag);
if (!resolvedData) {
throw new Error(`Could not read or parse tasks file: ${tasksPath}`);
}
// Prioritize the _rawTaggedData if it exists, otherwise use the data as is.
const rawData = resolvedData._rawTaggedData || resolvedData;
// 2. Determine the target tag we need to generate files for.
const tagData = rawData[tag];
if (!tagData || !tagData.tasks) {
throw new Error(`Tag '${tag}' not found or has no tasks in the data.`);
}
const tasksForGeneration = tagData.tasks;
// Create the output directory if it doesn't exist
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
}
log(
'info',
`Preparing to regenerate ${tasksForGeneration.length} task files for tag '${tag}'`
);
// 3. Validate dependencies using the FULL, raw data structure to prevent data loss.
validateAndFixDependencies(
rawData, // Pass the entire object with all tags
tasksPath,
projectRoot,
tag // Provide the current tag context for the operation
);
const allTasksInTag = tagData.tasks;
const validTaskIds = allTasksInTag.map((task) => task.id);
// Cleanup orphaned task files
log('info', 'Checking for orphaned task files to clean up...');
try {
const files = fs.readdirSync(outputDir);
// Tag-aware file patterns: master -> task_001.txt, other tags -> task_001_tagname.txt
const masterFilePattern = /^task_(\d+)\.txt$/;
const taggedFilePattern = new RegExp(`^task_(\\d+)_${tag}\\.txt$`);
const orphanedFiles = files.filter((file) => {
let match = null;
let fileTaskId = null;
// Check if file belongs to current tag
if (tag === 'master') {
match = file.match(masterFilePattern);
if (match) {
fileTaskId = parseInt(match[1], 10);
// Only clean up master files when processing master tag
return !validTaskIds.includes(fileTaskId);
}
} else {
match = file.match(taggedFilePattern);
if (match) {
fileTaskId = parseInt(match[1], 10);
// Only clean up files for the current tag
return !validTaskIds.includes(fileTaskId);
}
}
return false;
});
if (orphanedFiles.length > 0) {
log(
'info',
`Found ${orphanedFiles.length} orphaned task files to remove for tag '${tag}'`
);
orphanedFiles.forEach((file) => {
const filePath = path.join(outputDir, file);
fs.unlinkSync(filePath);
});
} else {
log('info', 'No orphaned task files found.');
}
} catch (err) {
log('warn', `Error cleaning up orphaned task files: ${err.message}`);
}
// Generate task files for the target tag
log('info', `Generating individual task files for tag '${tag}'...`);
tasksForGeneration.forEach((task) => {
// Tag-aware file naming: master -> task_001.txt, other tags -> task_001_tagname.txt
const taskFileName =
tag === 'master'
? `task_${task.id.toString().padStart(3, '0')}.txt`
: `task_${task.id.toString().padStart(3, '0')}_${tag}.txt`;
const taskPath = path.join(outputDir, taskFileName);
let content = `# Task ID: ${task.id}\n`;
content += `# Title: ${task.title}\n`;
content += `# Status: ${task.status || 'pending'}\n`;
if (task.dependencies && task.dependencies.length > 0) {
content += `# Dependencies: ${formatDependenciesWithStatus(task.dependencies, allTasksInTag, false)}\n`;
} else {
content += '# Dependencies: None\n';
}
content += `# Priority: ${task.priority || 'medium'}\n`;
content += `# Description: ${task.description || ''}\n`;
content += '# Details:\n';
content += (task.details || '')
.split('\n')
.map((line) => line)
.join('\n');
content += '\n\n';
content += '# Test Strategy:\n';
content += (task.testStrategy || '')
.split('\n')
.map((line) => line)
.join('\n');
content += '\n';
if (task.subtasks && task.subtasks.length > 0) {
content += '\n# Subtasks:\n';
task.subtasks.forEach((subtask) => {
content += `## ${subtask.id}. ${subtask.title} [${subtask.status || 'pending'}]\n`;
if (subtask.dependencies && subtask.dependencies.length > 0) {
const subtaskDeps = subtask.dependencies
.map((depId) =>
typeof depId === 'number'
? `${task.id}.${depId}`
: depId.toString()
)
.join(', ');
content += `### Dependencies: ${subtaskDeps}\n`;
} else {
content += '### Dependencies: None\n';
}
content += `### Description: ${subtask.description || ''}\n`;
content += '### Details:\n';
content += (subtask.details || '')
.split('\n')
.map((line) => line)
.join('\n');
content += '\n\n';
});
}
fs.writeFileSync(taskPath, content);
});
log(
'success',
`All ${tasksForGeneration.length} tasks for tag '${tag}' have been generated into '${outputDir}'.`
);
if (isMcpMode) {
return {
success: true,
count: tasksForGeneration.length,
directory: outputDir
};
}
} catch (error) {
log('error', `Error generating task files: ${error.message}`);
if (!options?.mcpLog) {
console.error(chalk.red(`Error generating task files: ${error.message}`));
if (getDebugFlag()) {
console.error(error);
}
process.exit(1);
} else {
throw error;
}
}
}
export default generateTaskFiles;
```
--------------------------------------------------------------------------------
/apps/docs/tdd-workflow/quickstart.mdx:
--------------------------------------------------------------------------------
```markdown
---
title: "TDD Workflow Quick Start"
description: "Get started with TaskMaster's autonomous TDD workflow in 5 minutes"
---
Get started with TaskMaster's autonomous TDD workflow in 5 minutes.
## Prerequisites
- TaskMaster initialized project (`tm init`)
- Tasks with subtasks created (`tm parse-prd` or `tm expand`)
- Git repository with clean working tree
- Test framework installed (vitest, jest, mocha, etc.)
## 1. Start a Workflow
```bash
tm autopilot start <taskId>
```
Example:
```bash
$ tm autopilot start 7
✓ Workflow started for task 7
✓ Created branch: task-7
✓ Current phase: RED
✓ Subtask 1/5: Implement start command
→ Next action: Write a failing test
```
## 2. The TDD Cycle
### RED Phase: Write Failing Test
```bash
# Check what to do next
$ tm autopilot next --json
{
"action": "generate_test",
"currentSubtask": {
"id": "1",
"title": "Implement start command"
}
}
```
Write a test that fails:
```typescript
// tests/start.test.ts
import { describe, it, expect } from 'vitest';
import { StartCommand } from '../src/commands/start';
describe('StartCommand', () => {
it('should initialize workflow', async () => {
const command = new StartCommand();
const result = await command.execute({ taskId: '7' });
expect(result.success).toBe(true);
});
});
```
Run tests:
```bash
$ npm test
# ✗ 1 test failed
```
Complete RED phase:
```bash
$ tm autopilot complete --results '{"total":1,"passed":0,"failed":1,"skipped":0}'
✓ RED phase complete
✓ Current phase: GREEN
→ Next action: Implement code to pass tests
```
### GREEN Phase: Implement Feature
Write minimal code to pass:
```typescript
// src/commands/start.ts
export class StartCommand {
async execute(options: { taskId: string }) {
return { success: true };
}
}
```
Run tests:
```bash
$ npm test
# ✓ 1 test passed
```
Complete GREEN phase:
```bash
$ tm autopilot complete --results '{"total":1,"passed":1,"failed":0,"skipped":0}'
✓ GREEN phase complete
✓ Current phase: COMMIT
→ Next action: Commit changes
```
### COMMIT Phase: Save Progress
```bash
$ tm autopilot commit
✓ Created commit: abc123
✓ Message: feat(autopilot): implement start command (Task 7.1)
✓ Advanced to subtask 2/5
✓ Current phase: RED
→ Next action: Write a failing test
```
## 3. Continue for All Subtasks
Repeat the RED-GREEN-COMMIT cycle for each subtask until complete.
```bash
# Check progress anytime
$ tm autopilot status --json
{
"taskId": "7",
"progress": {
"completed": 1,
"total": 5,
"percentage": 20
},
"currentSubtask": {
"id": "2",
"title": "Implement resume command"
}
}
```
## 4. Complete the Workflow
When all subtasks are done:
```bash
$ tm autopilot status --json
{
"phase": "COMPLETE",
"progress": {
"completed": 5,
"total": 5,
"percentage": 100
}
}
```
Your branch `task-7` is ready for review/merge!
## Common Patterns
### Parse Test Output
Your test runner outputs human-readable format - convert to JSON:
**Vitest:**
```
Tests 2 failed | 8 passed | 10 total
```
→ `{"total":10,"passed":8,"failed":2,"skipped":0}`
**Jest:**
```
Tests: 2 failed, 8 passed, 10 total
```
→ `{"total":10,"passed":8,"failed":2,"skipped":0}`
### Handle Errors
**Problem:** RED phase won't complete - "no test failures"
**Solution:** Your test isn't testing new behavior. Make sure it fails:
```typescript
// Bad - test passes immediately
it('should exist', () => {
expect(StartCommand).toBeDefined(); // Always passes
});
// Good - test fails until feature exists
it('should initialize workflow', async () => {
const result = await new StartCommand().execute({ taskId: '7' });
expect(result.success).toBe(true); // Fails until execute() is implemented
});
```
**Problem:** GREEN phase won't complete - "tests still failing"
**Solution:** Fix your implementation until all tests pass:
```bash
# Run tests to see what's failing
$ npm test
# Fix the issue
$ vim src/commands/start.ts
# Verify tests pass
$ npm test
# Try again
$ tm autopilot complete --results '{"total":1,"passed":1,"failed":0,"skipped":0}'
```
### Resume Interrupted Work
```bash
# If you interrupted the workflow
$ tm autopilot resume
✓ Workflow resumed
✓ Task 7 - subtask 3/5
✓ Current phase: GREEN
→ Continue from where you left off
```
## JSON Output Mode
All commands support `--json` for programmatic use:
```bash
$ tm autopilot start 7 --json | jq .
{
"success": true,
"taskId": "7",
"branchName": "task-7",
"phase": "SUBTASK_LOOP",
"tddPhase": "RED",
"progress": { ... },
"currentSubtask": { ... },
"nextAction": "generate_test"
}
```
Perfect for:
- CI/CD integration
- Custom tooling
- Automated workflows
- Progress monitoring
## MCP Integration
For AI agents (Claude Code, etc.), use MCP tools:
```typescript
// Start workflow
await mcp.call('autopilot_start', {
taskId: '7',
projectRoot: '/path/to/project'
});
// Get next action
const next = await mcp.call('autopilot_next', {
projectRoot: '/path/to/project'
});
// Complete phase
await mcp.call('autopilot_complete_phase', {
projectRoot: '/path/to/project',
testResults: { total: 1, passed: 0, failed: 1, skipped: 0 }
});
// Commit
await mcp.call('autopilot_commit', {
projectRoot: '/path/to/project'
});
```
See [AI Agent Integration Guide](./ai-agent-integration.mdx) for details.
## Cheat Sheet
```bash
# Start
tm autopilot start <taskId> # Initialize workflow
# Workflow Control
tm autopilot next # What's next?
tm autopilot status # Current state
tm autopilot resume # Continue interrupted work
tm autopilot abort # Cancel and cleanup
# TDD Cycle
tm autopilot complete --results '{...}' # Advance phase
tm autopilot commit # Save progress
# Options
--json # Machine-readable output
--project-root <path> # Specify project location
--force # Override safety checks
```
## Next Steps
- Read [AI Agent Integration Guide](./ai-agent-integration.mdx) for complete documentation
- Check [Command Reference](/command-reference) for all options
## Tips
1. **Always let tests fail first** - That's the RED phase
2. **Write minimal code** - Just enough to pass
3. **Commit frequently** - After each subtask
4. **Use --json** - Better for programmatic use
5. **Check status often** - Know where you are
6. **Trust the workflow** - It enforces TDD rules
---
**Ready to start?** Run `tm autopilot start <taskId>` and begin your TDD journey!
```
--------------------------------------------------------------------------------
/src/profiles/vscode.js:
--------------------------------------------------------------------------------
```javascript
// VS Code conversion profile for rule-transformer
import path from 'path';
import fs from 'fs';
import { log } from '../../scripts/modules/utils.js';
import { createProfile, COMMON_TOOL_MAPPINGS } from './base-profile.js';
/**
* Transform standard MCP config format to VS Code format
* @param {Object} mcpConfig - Standard MCP configuration object
* @returns {Object} - Transformed VS Code configuration object
*/
function transformToVSCodeFormat(mcpConfig) {
const vscodeConfig = {};
// Transform mcpServers to servers
if (mcpConfig.mcpServers) {
vscodeConfig.servers = {};
for (const [serverName, serverConfig] of Object.entries(
mcpConfig.mcpServers
)) {
// Transform server configuration
const transformedServer = {
...serverConfig
};
// Add type: "stdio" after the env block
if (transformedServer.env) {
// Reorder properties: keep command, args, env, then add type
const reorderedServer = {};
if (transformedServer.command)
reorderedServer.command = transformedServer.command;
if (transformedServer.args)
reorderedServer.args = transformedServer.args;
if (transformedServer.env) reorderedServer.env = transformedServer.env;
reorderedServer.type = 'stdio';
// Add any other properties that might exist
Object.keys(transformedServer).forEach((key) => {
if (!['command', 'args', 'env', 'type'].includes(key)) {
reorderedServer[key] = transformedServer[key];
}
});
vscodeConfig.servers[serverName] = reorderedServer;
} else {
// If no env block, just add type at the end
transformedServer.type = 'stdio';
vscodeConfig.servers[serverName] = transformedServer;
}
}
}
return vscodeConfig;
}
/**
* Lifecycle function called after MCP config generation to transform to VS Code format
* @param {string} targetDir - Target project directory
* @param {string} assetsDir - Assets directory (unused for VS Code)
*/
function onPostConvertRulesProfile(targetDir, assetsDir) {
const vscodeConfigPath = path.join(targetDir, '.vscode', 'mcp.json');
if (!fs.existsSync(vscodeConfigPath)) {
log('debug', '[VS Code] No .vscode/mcp.json found to transform');
return;
}
try {
// Read the generated standard MCP config
const mcpConfigContent = fs.readFileSync(vscodeConfigPath, 'utf8');
const mcpConfig = JSON.parse(mcpConfigContent);
// Check if it's already in VS Code format (has servers instead of mcpServers)
if (mcpConfig.servers) {
log(
'info',
'[VS Code] mcp.json already in VS Code format, skipping transformation'
);
return;
}
// Transform to VS Code format
const vscodeConfig = transformToVSCodeFormat(mcpConfig);
// Write back the transformed config with proper formatting
fs.writeFileSync(
vscodeConfigPath,
JSON.stringify(vscodeConfig, null, 2) + '\n'
);
log('info', '[VS Code] Transformed mcp.json to VS Code format');
log('debug', `[VS Code] Renamed mcpServers->servers, added type: "stdio"`);
} catch (error) {
log('error', `[VS Code] Failed to transform mcp.json: ${error.message}`);
}
}
/**
* Lifecycle function called when removing VS Code profile
* @param {string} targetDir - Target project directory
*/
function onRemoveRulesProfile(targetDir) {
const vscodeConfigPath = path.join(targetDir, '.vscode', 'mcp.json');
if (!fs.existsSync(vscodeConfigPath)) {
log('debug', '[VS Code] No .vscode/mcp.json found to clean up');
return;
}
try {
// Read the current config
const configContent = fs.readFileSync(vscodeConfigPath, 'utf8');
const config = JSON.parse(configContent);
// Check if it has the servers section and task-master-ai server
if (config.servers && config.servers['task-master-ai']) {
// Remove task-master-ai server
delete config.servers['task-master-ai'];
// Check if there are other MCP servers
const remainingServers = Object.keys(config.servers);
if (remainingServers.length === 0) {
// No other servers, remove entire file
fs.rmSync(vscodeConfigPath, { force: true });
log('info', '[VS Code] Removed empty mcp.json file');
// Also remove .vscode directory if it's empty
const vscodeDir = path.dirname(vscodeConfigPath);
try {
const dirContents = fs.readdirSync(vscodeDir);
if (dirContents.length === 0) {
fs.rmSync(vscodeDir, { recursive: true, force: true });
log('debug', '[VS Code] Removed empty .vscode directory');
}
} catch (err) {
// Directory might not be empty or might not exist, that's fine
}
} else {
// Write back the modified config
fs.writeFileSync(
vscodeConfigPath,
JSON.stringify(config, null, 2) + '\n'
);
log(
'info',
'[VS Code] Removed TaskMaster from mcp.json, preserved other configurations'
);
}
} else {
log('debug', '[VS Code] TaskMaster not found in mcp.json');
}
} catch (error) {
log('error', `[VS Code] Failed to clean up mcp.json: ${error.message}`);
}
}
// Create and export vscode profile using the base factory
export const vscodeProfile = createProfile({
name: 'vscode',
displayName: 'VS Code',
url: 'code.visualstudio.com',
docsUrl: 'code.visualstudio.com/docs',
rulesDir: '.github/instructions', // VS Code instructions location
profileDir: '.vscode', // VS Code configuration directory
mcpConfigName: 'mcp.json', // VS Code uses mcp.json in .vscode directory
targetExtension: '.instructions.md',
customReplacements: [
// Core VS Code directory structure changes
{ from: /\.cursor\/rules/g, to: '.github/instructions' },
{ from: /\.cursor\/mcp\.json/g, to: '.vscode/mcp.json' },
// Fix any remaining vscode/rules references that might be created during transformation
{ from: /\.vscode\/rules/g, to: '.github/instructions' },
// VS Code custom instructions format - use applyTo with quoted patterns instead of globs
{ from: /^globs:\s*(.+)$/gm, to: 'applyTo: "$1"' },
// Remove unsupported property - alwaysApply
{ from: /^alwaysApply:\s*(true|false)\s*\n?/gm, to: '' },
// Essential markdown link transformations for VS Code structure
{
from: /\[(.+?)\]\(mdc:\.cursor\/rules\/(.+?)\.mdc\)/g,
to: '[$1](.github/instructions/$2.instructions.md)'
},
// VS Code specific terminology
{ from: /rules directory/g, to: 'instructions directory' },
{ from: /cursor rules/gi, to: 'VS Code instructions' }
],
onPostConvert: onPostConvertRulesProfile,
onRemove: onRemoveRulesProfile
});
// Export lifecycle functions separately to avoid naming conflicts
export { onPostConvertRulesProfile, onRemoveRulesProfile };
```
--------------------------------------------------------------------------------
/packages/tm-core/src/modules/workflow/services/test-result-validator.ts:
--------------------------------------------------------------------------------
```typescript
import { z } from 'zod';
import type {
CoverageThresholds,
PhaseValidationOptions,
TestResult,
ValidationResult
} from './test-result-validator.types.js';
/**
* Schema for coverage metrics validation
*/
const coverageSchema = z.object({
line: z.number().min(0).max(100),
branch: z.number().min(0).max(100),
function: z.number().min(0).max(100),
statement: z.number().min(0).max(100)
});
/**
* Schema for test result validation
*/
const testResultSchema = z.object({
total: z.number().int().nonnegative(),
passed: z.number().int().nonnegative(),
failed: z.number().int().nonnegative(),
skipped: z.number().int().nonnegative(),
phase: z.enum(['RED', 'GREEN', 'REFACTOR']),
coverage: coverageSchema.optional()
});
/**
* Validates test results according to TDD phase semantics
*/
export class TestResultValidator {
/**
* Validates a test result object
*/
validate(testResult: TestResult): ValidationResult {
const errors: string[] = [];
const warnings: string[] = [];
const suggestions: string[] = [];
// Schema validation
const parseResult = testResultSchema.safeParse(testResult);
if (!parseResult.success) {
const zodIssues = parseResult.error.issues || [];
errors.push(
...zodIssues.map((e) => {
const path = e.path.length > 0 ? `${e.path.join('.')}: ` : '';
return `${path}${e.message}`;
})
);
return { valid: false, errors, warnings, suggestions };
}
// Total validation
const sum = testResult.passed + testResult.failed + testResult.skipped;
if (sum !== testResult.total) {
errors.push('Total tests must equal passed + failed + skipped');
}
// If there are validation errors, return early
if (errors.length > 0) {
return { valid: false, errors, warnings, suggestions };
}
return { valid: true, errors, warnings, suggestions };
}
/**
* Validates RED phase test results
* RED phase must have at least one failing test
*/
validateRedPhase(testResult: TestResult): ValidationResult {
const baseValidation = this.validate(testResult);
if (!baseValidation.valid) {
return baseValidation;
}
const errors: string[] = [];
const suggestions: string[] = [];
// RED phase must have failures
if (testResult.failed === 0) {
errors.push('RED phase must have at least one failing test');
suggestions.push('Write failing tests first to follow TDD workflow');
}
// Must have at least one test
if (testResult.total === 0) {
errors.push('Cannot validate empty test suite');
suggestions.push('Add at least one test to begin TDD cycle');
}
return {
valid: errors.length === 0,
errors,
suggestions
};
}
/**
* Validates GREEN phase test results
* GREEN phase must have zero failures
*/
validateGreenPhase(
testResult: TestResult,
previousTestCount?: number
): ValidationResult {
const baseValidation = this.validate(testResult);
if (!baseValidation.valid) {
return baseValidation;
}
const errors: string[] = [];
const warnings: string[] = [];
const suggestions: string[] = [];
// GREEN phase must have zero failures
if (testResult.failed > 0) {
errors.push('GREEN phase must have zero failures');
suggestions.push('Fix implementation to make all tests pass');
}
// Must have at least one passing test
if (testResult.passed === 0) {
errors.push('GREEN phase must have at least one passing test');
suggestions.push('Ensure tests exist and implementation makes them pass');
}
// Check for test count regression
if (
previousTestCount !== undefined &&
testResult.total < previousTestCount
) {
warnings.push(
`Test count decreased from ${previousTestCount} to ${testResult.total}`
);
suggestions.push('Verify that no tests were accidentally removed');
}
return {
valid: errors.length === 0,
errors,
warnings,
suggestions
};
}
/**
* Validates coverage thresholds if provided
*/
validateCoverage(
testResult: TestResult,
thresholds: CoverageThresholds
): ValidationResult {
const baseValidation = this.validate(testResult);
if (!baseValidation.valid) {
return baseValidation;
}
const errors: string[] = [];
const suggestions: string[] = [];
// Skip validation if no coverage data
if (!testResult.coverage) {
return { valid: true, errors: [], suggestions: [] };
}
const coverage = testResult.coverage;
const gaps: string[] = [];
// Check each coverage type against threshold
if (thresholds.line !== undefined && coverage.line < thresholds.line) {
gaps.push(`line coverage (${coverage.line}% < ${thresholds.line}%)`);
}
if (
thresholds.branch !== undefined &&
coverage.branch < thresholds.branch
) {
gaps.push(
`branch coverage (${coverage.branch}% < ${thresholds.branch}%)`
);
}
if (
thresholds.function !== undefined &&
coverage.function < thresholds.function
) {
gaps.push(
`function coverage (${coverage.function}% < ${thresholds.function}%)`
);
}
if (
thresholds.statement !== undefined &&
coverage.statement < thresholds.statement
) {
gaps.push(
`statement coverage (${coverage.statement}% < ${thresholds.statement}%)`
);
}
if (gaps.length > 0) {
errors.push(`Coverage thresholds not met: ${gaps.join(', ')}`);
suggestions.push('Add more tests to improve code coverage');
}
return {
valid: errors.length === 0,
errors,
suggestions
};
}
/**
* Validates test results based on TDD phase
*/
validatePhase(
testResult: TestResult,
options?: PhaseValidationOptions
): ValidationResult {
const phase = options?.phase ?? testResult.phase;
// Phase-specific validation
let phaseResult: ValidationResult;
if (phase === 'RED') {
phaseResult = this.validateRedPhase(testResult);
} else if (phase === 'GREEN') {
phaseResult = this.validateGreenPhase(
testResult,
options?.previousTestCount
);
} else {
// REFACTOR phase uses same rules as GREEN
phaseResult = this.validateGreenPhase(
testResult,
options?.previousTestCount
);
}
if (!phaseResult.valid) {
return phaseResult;
}
// Coverage validation if thresholds provided
if (options?.coverageThresholds) {
const coverageResult = this.validateCoverage(
testResult,
options.coverageThresholds
);
// Merge results
return {
valid: coverageResult.valid,
errors: [...(phaseResult.errors || []), ...coverageResult.errors],
warnings: phaseResult.warnings,
suggestions: [
...(phaseResult.suggestions || []),
...(coverageResult.suggestions || [])
]
};
}
return phaseResult;
}
}
```
--------------------------------------------------------------------------------
/apps/docs/capabilities/task-structure.mdx:
--------------------------------------------------------------------------------
```markdown
---
title: "Task Structure"
sidebarTitle: "Task Structure"
description: "Tasks in Task Master follow a specific format designed to provide comprehensive information for both humans and AI assistants."
---
## Task Fields in tasks.json
Tasks in tasks.json have the following structure:
| Field | Description | Example |
| -------------- | ---------------------------------------------- | ------------------------------------------------------ |
| `id` | Unique identifier for the task. | `1` |
| `title` | Brief, descriptive title. | `"Initialize Repo"` |
| `description` | What the task involves. | `"Create a new repository, set up initial structure."` |
| `status` | Current state. | `"pending"`, `"done"`, `"deferred"` |
| `dependencies` | Prerequisite task IDs. ✅ Completed, ⏱️ Pending | `[1, 2]` |
| `priority` | Task importance. | `"high"`, `"medium"`, `"low"` |
| `details` | Implementation instructions. | `"Use GitHub client ID/secret, handle callback..."` |
| `testStrategy` | How to verify success. | `"Deploy and confirm 'Hello World' response."` |
| `subtasks` | Nested subtasks related to the main task. | `[{"id": 1, "title": "Configure OAuth", ...}]` |
## Task File Format
Individual task files follow this format:
```
# Task ID: <id>
# Title: <title>
# Status: <status>
# Dependencies: <comma-separated list of dependency IDs>
# Priority: <priority>
# Description: <brief description>
# Details:
<detailed implementation notes>
# Test Strategy:
<verification approach>
```
## Features in Detail
<AccordionGroup>
<Accordion title="Analyzing Task Complexity">
The `analyze-complexity` command:
- Analyzes each task using AI to assess its complexity on a scale of 1-10
- Recommends optimal number of subtasks based on configured DEFAULT_SUBTASKS
- Generates tailored prompts for expanding each task
- Creates a comprehensive JSON report with ready-to-use commands
- Saves the report to scripts/task-complexity-report.json by default
The generated report contains:
- Complexity analysis for each task (scored 1-10)
- Recommended number of subtasks based on complexity
- AI-generated expansion prompts customized for each task
- Ready-to-run expansion commands directly within each task analysis
</Accordion>
<Accordion title="Viewing Complexity Report">
The `complexity-report` command:
- Displays a formatted, easy-to-read version of the complexity analysis report
- Shows tasks organized by complexity score (highest to lowest)
- Provides complexity distribution statistics (low, medium, high)
- Highlights tasks recommended for expansion based on threshold score
- Includes ready-to-use expansion commands for each complex task
- If no report exists, offers to generate one on the spot
</Accordion>
<Accordion title="Smart Task Expansion">
The `expand` command automatically checks for and uses the complexity report:
When a complexity report exists:
- Tasks are automatically expanded using the recommended subtask count and prompts
- When expanding all tasks, they're processed in order of complexity (highest first)
- Research-backed generation is preserved from the complexity analysis
- You can still override recommendations with explicit command-line options
Example workflow:
```bash
# Generate the complexity analysis report with research capabilities
task-master analyze-complexity --research
# Review the report in a readable format
task-master complexity-report
# Expand tasks using the optimized recommendations
task-master expand --id=8
# or expand all tasks
task-master expand --all
```
</Accordion>
<Accordion title="Finding the Next Task">
The `next` command:
- Identifies tasks that are pending/in-progress and have all dependencies satisfied
- Prioritizes tasks by priority level, dependency count, and task ID
- Displays comprehensive information about the selected task:
- Basic task details (ID, title, priority, dependencies)
- Implementation details
- Subtasks (if they exist)
- Provides contextual suggested actions:
- Command to mark the task as in-progress
- Command to mark the task as done
- Commands for working with subtasks
</Accordion>
<Accordion title="Viewing Specific Task Details">
The `show` command:
- Displays comprehensive details about a specific task or subtask
- Shows task status, priority, dependencies, and detailed implementation notes
- For parent tasks, displays all subtasks and their status
- For subtasks, shows parent task relationship
- Provides contextual action suggestions based on the task's state
- Works with both regular tasks and subtasks (using the format taskId.subtaskId)
</Accordion>
</AccordionGroup>
## Best Practices for AI-Driven Development
<CardGroup cols={2}>
<Card title="📝 Detailed PRD" icon="lightbulb">
The more detailed your PRD, the better the generated tasks will be.
</Card>
<Card title="👀 Review Tasks" icon="magnifying-glass">
After parsing the PRD, review the tasks to ensure they make sense and have appropriate dependencies.
</Card>
<Card title="📊 Analyze Complexity" icon="chart-line">
Use the complexity analysis feature to identify which tasks should be broken down further.
</Card>
<Card title="⛓️ Follow Dependencies" icon="link">
Always respect task dependencies - the Cursor agent will help with this.
</Card>
<Card title="🔄 Update As You Go" icon="arrows-rotate">
If your implementation diverges from the plan, use the update command to keep future tasks aligned.
</Card>
<Card title="📦 Break Down Tasks" icon="boxes-stacked">
Use the expand command to break down complex tasks into manageable subtasks.
</Card>
<Card title="🔄 Regenerate Files" icon="file-arrow-up">
After any updates to tasks.json, regenerate the task files to keep them in sync.
</Card>
<Card title="💬 Provide Context" icon="comment">
When asking the Cursor agent to help with a task, provide context about what you're trying to achieve.
</Card>
<Card title="✅ Validate Dependencies" icon="circle-check">
Periodically run the validate-dependencies command to check for invalid or circular dependencies.
</Card>
</CardGroup>
```
--------------------------------------------------------------------------------
/tests/unit/task-finder.test.js:
--------------------------------------------------------------------------------
```javascript
/**
* Task finder tests
*/
// Import after mocks are set up - No mocks needed for readComplexityReport anymore
import { findTaskById } from '../../scripts/modules/utils.js';
import { emptySampleTasks, sampleTasks } from '../fixtures/sample-tasks.js';
describe('Task Finder', () => {
describe('findTaskById function', () => {
test('should find a task by numeric ID', () => {
const result = findTaskById(sampleTasks.tasks, 2);
expect(result.task).toBeDefined();
expect(result.task.id).toBe(2);
expect(result.task.title).toBe('Create Core Functionality');
expect(result.originalSubtaskCount).toBeNull();
});
test('should find a task by string ID', () => {
const result = findTaskById(sampleTasks.tasks, '2');
expect(result.task).toBeDefined();
expect(result.task.id).toBe(2);
expect(result.originalSubtaskCount).toBeNull();
});
test('should find tasks when JSON contains string IDs (normalized to numbers)', () => {
// Simulate tasks loaded from JSON with string IDs and mixed subtask notations
const tasksWithStringIds = [
{ id: '1', title: 'First Task' },
{
id: '2',
title: 'Second Task',
subtasks: [
{ id: '1', title: 'Subtask One' },
{ id: '2.2', title: 'Subtask Two (with dotted notation)' } // Testing dotted notation
]
},
{
id: '5',
title: 'Fifth Task',
subtasks: [
{ id: '5.1', title: 'Subtask with dotted ID' }, // Should normalize to 1
{ id: '3', title: 'Subtask with simple ID' } // Should stay as 3
]
}
];
// The readJSON function should normalize these IDs to numbers
// For this test, we'll manually normalize them to simulate what happens
tasksWithStringIds.forEach((task) => {
task.id = parseInt(task.id, 10);
if (task.subtasks) {
task.subtasks.forEach((subtask) => {
// Handle dotted notation like "5.1" -> extract the subtask part
if (typeof subtask.id === 'string' && subtask.id.includes('.')) {
const parts = subtask.id.split('.');
subtask.id = parseInt(parts[parts.length - 1], 10);
} else {
subtask.id = parseInt(subtask.id, 10);
}
});
}
});
// Test finding tasks by numeric ID
const result1 = findTaskById(tasksWithStringIds, 5);
expect(result1.task).toBeDefined();
expect(result1.task.id).toBe(5);
expect(result1.task.title).toBe('Fifth Task');
// Test finding tasks by string ID
const result2 = findTaskById(tasksWithStringIds, '5');
expect(result2.task).toBeDefined();
expect(result2.task.id).toBe(5);
// Test finding subtasks with normalized IDs
const result3 = findTaskById(tasksWithStringIds, '2.1');
expect(result3.task).toBeDefined();
expect(result3.task.id).toBe(1);
expect(result3.task.title).toBe('Subtask One');
expect(result3.task.isSubtask).toBe(true);
// Test subtask that was originally "2.2" (should be normalized to 2)
const result4 = findTaskById(tasksWithStringIds, '2.2');
expect(result4.task).toBeDefined();
expect(result4.task.id).toBe(2);
expect(result4.task.title).toBe('Subtask Two (with dotted notation)');
// Test subtask that was originally "5.1" (should be normalized to 1)
const result5 = findTaskById(tasksWithStringIds, '5.1');
expect(result5.task).toBeDefined();
expect(result5.task.id).toBe(1);
expect(result5.task.title).toBe('Subtask with dotted ID');
// Test subtask that was originally "3" (should stay as 3)
const result6 = findTaskById(tasksWithStringIds, '5.3');
expect(result6.task).toBeDefined();
expect(result6.task.id).toBe(3);
expect(result6.task.title).toBe('Subtask with simple ID');
});
test('should find a subtask using dot notation', () => {
const result = findTaskById(sampleTasks.tasks, '3.1');
expect(result.task).toBeDefined();
expect(result.task.id).toBe(1);
expect(result.task.title).toBe('Create Header Component');
expect(result.task.isSubtask).toBe(true);
expect(result.task.parentTask.id).toBe(3);
expect(result.originalSubtaskCount).toBeNull();
});
test('should return null for non-existent task ID', () => {
const result = findTaskById(sampleTasks.tasks, 99);
expect(result.task).toBeNull();
expect(result.originalSubtaskCount).toBeNull();
});
test('should return null for non-existent subtask ID', () => {
const result = findTaskById(sampleTasks.tasks, '3.99');
expect(result.task).toBeNull();
expect(result.originalSubtaskCount).toBeNull();
});
test('should return null for non-existent parent task ID in subtask notation', () => {
const result = findTaskById(sampleTasks.tasks, '99.1');
expect(result.task).toBeNull();
expect(result.originalSubtaskCount).toBeNull();
});
test('should return null when tasks array is empty', () => {
const result = findTaskById(emptySampleTasks.tasks, 1);
expect(result.task).toBeNull();
expect(result.originalSubtaskCount).toBeNull();
});
test('should work correctly when no complexity report is provided', () => {
// Pass null as the complexity report
const result = findTaskById(sampleTasks.tasks, 2, null);
expect(result.task).toBeDefined();
expect(result.task.id).toBe(2);
expect(result.task.complexityScore).toBeUndefined();
});
test('should work correctly when task has no complexity data in the provided report', () => {
// Define a complexity report that doesn't include task 2
const complexityReport = {
complexityAnalysis: [{ taskId: 999, complexityScore: 5 }]
};
const result = findTaskById(sampleTasks.tasks, 2, complexityReport);
expect(result.task).toBeDefined();
expect(result.task.id).toBe(2);
expect(result.task.complexityScore).toBeUndefined();
});
test('should include complexity score when report is provided', () => {
// Define the complexity report for this test
const complexityReport = {
meta: {
generatedAt: '2023-01-01T00:00:00.000Z',
tasksAnalyzed: 3,
thresholdScore: 5
},
complexityAnalysis: [
{
taskId: 1,
taskTitle: 'Initialize Project',
complexityScore: 3,
recommendedSubtasks: 2
},
{
taskId: 2,
taskTitle: 'Create Core Functionality',
complexityScore: 8,
recommendedSubtasks: 5
},
{
taskId: 3,
taskTitle: 'Implement UI Components',
complexityScore: 6,
recommendedSubtasks: 4
}
]
};
const result = findTaskById(sampleTasks.tasks, 2, complexityReport);
expect(result.task).toBeDefined();
expect(result.task.id).toBe(2);
expect(result.task.complexityScore).toBe(8);
});
});
});
```
--------------------------------------------------------------------------------
/.taskmaster/reports/task-complexity-report_cc-kiro-hooks.json:
--------------------------------------------------------------------------------
```json
{
"meta": {
"generatedAt": "2025-07-22T09:41:10.517Z",
"tasksAnalyzed": 10,
"totalTasks": 10,
"analysisCount": 10,
"thresholdScore": 5,
"projectName": "Taskmaster",
"usedResearch": false
},
"complexityAnalysis": [
{
"taskId": 1,
"taskTitle": "Implement Task Integration Layer (TIL) Core",
"complexityScore": 8,
"recommendedSubtasks": 5,
"expansionPrompt": "Break down the TIL Core implementation into distinct components: hook registration system, task lifecycle management, event coordination, state persistence layer, and configuration validation. Each subtask should focus on a specific architectural component with clear interfaces and testable boundaries.",
"reasoning": "This is a foundational component with multiple complex subsystems including event-driven architecture, API integration, state management, and configuration validation. The existing 5 subtasks are well-structured and appropriately sized."
},
{
"taskId": 2,
"taskTitle": "Develop Dependency Monitor with Taskmaster MCP Integration",
"complexityScore": 7,
"recommendedSubtasks": 4,
"expansionPrompt": "Divide the dependency monitor into: dependency graph data structure implementation, circular dependency detection algorithm, Taskmaster MCP integration layer, and real-time notification system. Focus on performance optimization for large graphs and efficient caching strategies.",
"reasoning": "Complex graph algorithms and real-time monitoring require careful implementation. The task involves sophisticated data structures, algorithm design, and API integration with performance constraints."
},
{
"taskId": 3,
"taskTitle": "Build Execution Manager with Priority Queue and Parallel Execution",
"complexityScore": 8,
"recommendedSubtasks": 5,
"expansionPrompt": "Structure the execution manager into: priority queue implementation, resource conflict detection system, parallel execution coordinator, timeout and cancellation handler, and execution history persistence layer. Each component should handle specific aspects of concurrent task management.",
"reasoning": "Managing concurrent execution with resource conflicts, priority scheduling, and persistence is highly complex. Requires careful synchronization, error handling, and performance optimization."
},
{
"taskId": 4,
"taskTitle": "Implement Safety Manager with Configurable Constraints and Emergency Controls",
"complexityScore": 7,
"recommendedSubtasks": 4,
"expansionPrompt": "Break down into: constraint validation engine, emergency control system (stop/pause), user approval workflow implementation, and safety monitoring/audit logging. Each subtask should address specific safety aspects with fail-safe mechanisms.",
"reasoning": "Safety systems require careful design with multiple fail-safes. The task involves validation logic, real-time controls, workflow management, and comprehensive logging."
},
{
"taskId": 5,
"taskTitle": "Develop Event-Based Hook Processor",
"complexityScore": 6,
"recommendedSubtasks": 4,
"expansionPrompt": "Organize into: file system event integration, Git/VCS event listeners, build system event connectors, and event filtering/debouncing mechanism. Focus on modular event source integration with configurable processing pipelines.",
"reasoning": "While conceptually straightforward, integrating multiple event sources with proper filtering and performance optimization requires careful implementation. Each event source has unique characteristics."
},
{
"taskId": 6,
"taskTitle": "Implement Prompt-Based Hook Processor with AI Integration",
"complexityScore": 7,
"recommendedSubtasks": 4,
"expansionPrompt": "Divide into: prompt interception mechanism, NLP-based task suggestion engine, context injection system, and conversation-based status updater. Each component should handle specific aspects of AI conversation integration.",
"reasoning": "AI integration with prompt analysis and dynamic context injection is complex. Requires understanding of conversation flow, relevance scoring, and seamless integration with existing systems."
},
{
"taskId": 7,
"taskTitle": "Create Update-Based Hook Processor for Automatic Progress Tracking",
"complexityScore": 6,
"recommendedSubtasks": 4,
"expansionPrompt": "Structure as: code change monitor, acceptance criteria validator, dependency update propagator, and conflict detection/resolution system. Focus on accurate progress tracking and automated validation logic.",
"reasoning": "Automatic progress tracking requires integration with version control and intelligent analysis of code changes. Conflict detection and dependency propagation add complexity."
},
{
"taskId": 8,
"taskTitle": "Develop Real-Time Automation Dashboard and User Controls",
"complexityScore": 7,
"recommendedSubtasks": 5,
"expansionPrompt": "Break down into: WebSocket real-time communication layer, interactive dependency graph visualization, task queue and status displays, user control interfaces, and analytics/charting components. Each UI component should be modular and reusable.",
"reasoning": "Building a responsive real-time dashboard with complex visualizations and interactive controls is challenging. Requires careful state management, performance optimization, and user experience design."
},
{
"taskId": 9,
"taskTitle": "Integrate Kiro IDE and Taskmaster MCP with Core Services",
"complexityScore": 8,
"recommendedSubtasks": 4,
"expansionPrompt": "Organize into: KiroHookAdapter implementation, TaskmasterMCPAdapter development, error handling and retry logic layer, and IDE UI component integration. Focus on robust adapter patterns and comprehensive error recovery.",
"reasoning": "End-to-end integration of multiple systems with different architectures is highly complex. Requires careful adapter design, extensive error handling, and thorough testing across all integration points."
},
{
"taskId": 10,
"taskTitle": "Implement Configuration Management and Safety Profiles",
"complexityScore": 6,
"recommendedSubtasks": 4,
"expansionPrompt": "Divide into: visual configuration editor UI, JSON Schema validation engine, import/export functionality, and version control integration. Each component should provide intuitive configuration management with robust validation.",
"reasoning": "While technically less complex than core systems, building an intuitive configuration editor with validation, versioning, and import/export requires careful UI/UX design and robust data handling."
}
]
}
```
--------------------------------------------------------------------------------
/apps/extension/src/components/TaskDetails/SubtasksSection.tsx:
--------------------------------------------------------------------------------
```typescript
import type React from 'react';
import { useState } from 'react';
import { Button } from '@/components/ui/button';
import { Label } from '@/components/ui/label';
import { Textarea } from '@/components/ui/textarea';
import { Badge } from '@/components/ui/badge';
import { CollapsibleSection } from '@/components/ui/CollapsibleSection';
import { Plus, Loader2 } from 'lucide-react';
import type { TaskMasterTask } from '../../webview/types';
import { getStatusDotColor } from '../constants';
interface SubtasksSectionProps {
currentTask: TaskMasterTask;
isSubtask: boolean;
sendMessage: (message: any) => Promise<any>;
onNavigateToTask: (taskId: string) => void;
}
export const SubtasksSection: React.FC<SubtasksSectionProps> = ({
currentTask,
isSubtask,
sendMessage,
onNavigateToTask
}) => {
const [isAddingSubtask, setIsAddingSubtask] = useState(false);
const [newSubtaskTitle, setNewSubtaskTitle] = useState('');
const [newSubtaskDescription, setNewSubtaskDescription] = useState('');
const [isSubmittingSubtask, setIsSubmittingSubtask] = useState(false);
const handleAddSubtask = async () => {
if (!currentTask || !newSubtaskTitle.trim() || isSubtask) {
return;
}
setIsSubmittingSubtask(true);
try {
await sendMessage({
type: 'addSubtask',
data: {
parentTaskId: currentTask.id,
subtaskData: {
title: newSubtaskTitle.trim(),
description: newSubtaskDescription.trim() || undefined,
status: 'pending'
}
}
});
// Reset form and close
setNewSubtaskTitle('');
setNewSubtaskDescription('');
setIsAddingSubtask(false);
} catch (error) {
console.error('❌ TaskDetailsView: Failed to add subtask:', error);
} finally {
setIsSubmittingSubtask(false);
}
};
const handleCancelAddSubtask = () => {
setIsAddingSubtask(false);
setNewSubtaskTitle('');
setNewSubtaskDescription('');
};
if (
!((currentTask.subtasks && currentTask.subtasks.length > 0) || !isSubtask)
) {
return null;
}
const rightElement = (
<>
{currentTask.subtasks && currentTask.subtasks.length > 0 && (
<span className="text-sm text-vscode-foreground/50">
{currentTask.subtasks?.filter((st) => st.status === 'done').length}/
{currentTask.subtasks?.length}
</span>
)}
{!isSubtask && (
<Button
variant="ghost"
size="sm"
className="ml-auto p-1 h-6 w-6 hover:bg-vscode-button-hoverBackground"
onClick={() => setIsAddingSubtask(true)}
title="Add subtask"
>
<Plus className="w-4 h-4" />
</Button>
)}
</>
);
return (
<CollapsibleSection
title="Sub-issues"
defaultExpanded={true}
rightElement={rightElement}
>
<div className="space-y-3">
{/* Add Subtask Form */}
{isAddingSubtask && (
<div className="bg-widget-background rounded-lg p-4 border border-widget-border">
<h4 className="text-sm font-medium text-vscode-foreground mb-3">
Add New Subtask
</h4>
<div className="space-y-3">
<div>
<Label
htmlFor="subtask-title"
className="block text-sm text-vscode-foreground/80 mb-1"
>
Title*
</Label>
<input
id="subtask-title"
type="text"
placeholder="Enter subtask title..."
value={newSubtaskTitle}
onChange={(e) => setNewSubtaskTitle(e.target.value)}
className="w-full px-3 py-2 text-sm bg-vscode-input-background border border-vscode-input-border text-vscode-input-foreground placeholder-vscode-input-foreground/50 rounded focus:border-vscode-focusBorder focus:ring-1 focus:ring-vscode-focusBorder"
disabled={isSubmittingSubtask}
/>
</div>
<div>
<Label
htmlFor="subtask-description"
className="block text-sm text-vscode-foreground/80 mb-1"
>
Description (Optional)
</Label>
<Textarea
id="subtask-description"
placeholder="Enter subtask description..."
value={newSubtaskDescription}
onChange={(e) => setNewSubtaskDescription(e.target.value)}
className="min-h-[80px] bg-vscode-input-background border-vscode-input-border text-vscode-input-foreground placeholder-vscode-input-foreground/50 focus:border-vscode-focusBorder focus:ring-vscode-focusBorder"
disabled={isSubmittingSubtask}
/>
</div>
<div className="flex gap-3 pt-2">
<Button
onClick={handleAddSubtask}
disabled={!newSubtaskTitle.trim() || isSubmittingSubtask}
className="bg-primary text-primary-foreground hover:bg-primary/90"
>
{isSubmittingSubtask ? (
<>
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
Adding...
</>
) : (
<>
<Plus className="w-4 h-4 mr-2" />
Add Subtask
</>
)}
</Button>
<Button
onClick={handleCancelAddSubtask}
variant="outline"
disabled={isSubmittingSubtask}
className="border-widget-border"
>
Cancel
</Button>
</div>
</div>
</div>
)}
{/* Subtasks List */}
{currentTask.subtasks && currentTask.subtasks.length > 0 && (
<div className="space-y-2">
{currentTask.subtasks.map((subtask, index) => {
const subtaskId = `${currentTask.id}.${index + 1}`;
return (
<div
key={subtask.id}
className="flex items-center gap-3 p-3 rounded-md border border-textSeparator-foreground hover:border-vscode-border/70 transition-colors cursor-pointer"
onClick={() => onNavigateToTask(subtaskId)}
>
<div
className="w-4 h-4 rounded-full flex items-center justify-center"
style={{
backgroundColor: getStatusDotColor(subtask.status)
}}
/>
<div className="flex-1 min-w-0">
<p className="text-sm text-vscode-foreground truncate">
{subtask.title}
</p>
{subtask.description && (
<p className="text-xs text-vscode-foreground/60 truncate mt-0.5">
{subtask.description}
</p>
)}
</div>
<div className="flex items-center gap-2 flex-shrink-0">
<Badge
variant="secondary"
className="text-xs bg-secondary/20 border-secondary/30 text-secondary-foreground px-2 py-0.5"
>
{subtask.status === 'pending' ? 'todo' : subtask.status}
</Badge>
</div>
</div>
);
})}
</div>
)}
</div>
</CollapsibleSection>
);
};
```
--------------------------------------------------------------------------------
/mcp-server/src/custom-sdk/language-model.js:
--------------------------------------------------------------------------------
```javascript
/**
* src/ai-providers/custom-sdk/mcp/language-model.js
*
* MCP Language Model implementation following AI SDK LanguageModelV1 interface.
* Uses MCP session.requestSampling() for AI operations.
*/
import {
convertToMCPFormat,
convertFromMCPFormat
} from './message-converter.js';
import { MCPError, mapMCPError } from './errors.js';
import { extractJson } from './json-extractor.js';
import {
convertSchemaToInstructions,
enhancePromptForJSON
} from './schema-converter.js';
/**
* MCP Language Model implementing AI SDK LanguageModelV1 interface
*/
export class MCPLanguageModel {
specificationVersion = 'v1';
defaultObjectGenerationMode = 'json';
supportsImageUrls = false;
supportsStructuredOutputs = true;
constructor(options) {
this.session = options.session; // MCP session object
this.modelId = options.modelId;
this.settings = options.settings || {};
this.provider = 'mcp-ai-sdk';
this.maxTokens = this.settings.maxTokens;
this.temperature = this.settings.temperature;
this.validateSession();
}
/**
* Validate that the MCP session has required capabilities
*/
validateSession() {
if (!this.session?.clientCapabilities?.sampling) {
throw new MCPError('MCP session must have client sampling capabilities');
}
}
/**
* Generate text using MCP session sampling
* @param {object} options - Generation options
* @param {Array} options.prompt - AI SDK prompt format
* @param {AbortSignal} options.abortSignal - Abort signal
* @returns {Promise<object>} Generation result in AI SDK format
*/
async doGenerate(options) {
try {
// Convert AI SDK prompt to MCP format
const { messages, systemPrompt } = convertToMCPFormat(options.prompt);
// Use MCP session.requestSampling (same as MCPRemoteProvider)
const response = await this.session.requestSampling(
{
messages,
systemPrompt,
temperature: this.settings.temperature,
maxTokens: this.settings.maxTokens,
includeContext: 'thisServer'
},
{
// signal: options.abortSignal,
timeout: 240000 // 4 minutes timeout
}
);
// Convert MCP response back to AI SDK format
const result = convertFromMCPFormat(response);
return {
text: result.text,
finishReason: result.finishReason || 'stop',
usage: {
promptTokens: result.usage?.inputTokens || 0,
completionTokens: result.usage?.outputTokens || 0,
totalTokens:
(result.usage?.inputTokens || 0) + (result.usage?.outputTokens || 0)
},
rawResponse: response,
warnings: result.warnings
};
} catch (error) {
throw mapMCPError(error);
}
}
/**
* Generate structured object using MCP session sampling
* @param {object} options - Generation options
* @param {Array} options.prompt - AI SDK prompt format
* @param {import('zod').ZodSchema} options.schema - Zod schema for validation
* @param {string} [options.mode='json'] - Generation mode ('json' or 'tool')
* @param {AbortSignal} options.abortSignal - Abort signal
* @returns {Promise<object>} Generation result with structured object
*/
async doGenerateObject(options) {
try {
const { schema, mode = 'json', ...restOptions } = options;
if (!schema) {
throw new MCPError('Schema is required for object generation');
}
// Convert schema to JSON instructions
const objectName = restOptions.objectName || 'generated_object';
const jsonInstructions = convertSchemaToInstructions(schema, objectName);
// Enhance prompt with JSON generation instructions
const enhancedPrompt = enhancePromptForJSON(
options.prompt,
jsonInstructions
);
// Convert enhanced prompt to MCP format
const { messages, systemPrompt } = convertToMCPFormat(enhancedPrompt);
// Use MCP session.requestSampling with enhanced prompt
const response = await this.session.requestSampling(
{
messages,
systemPrompt,
temperature: this.settings.temperature,
maxTokens: this.settings.maxTokens,
includeContext: 'thisServer'
},
{
timeout: 240000 // 4 minutes timeout
}
);
// Convert MCP response back to AI SDK format
const result = convertFromMCPFormat(response);
// Extract JSON from the response text
const jsonText = extractJson(result.text);
// Parse and validate JSON
let parsedObject;
try {
parsedObject = JSON.parse(jsonText);
} catch (parseError) {
throw new MCPError(
`Failed to parse JSON response: ${parseError.message}. Response: ${result.text.substring(0, 200)}...`
);
}
// Validate against schema
try {
const validatedObject = schema.parse(parsedObject);
return {
object: validatedObject,
finishReason: result.finishReason || 'stop',
usage: {
promptTokens: result.usage?.inputTokens || 0,
completionTokens: result.usage?.outputTokens || 0,
totalTokens:
(result.usage?.inputTokens || 0) +
(result.usage?.outputTokens || 0)
},
rawResponse: response,
warnings: result.warnings
};
} catch (validationError) {
throw new MCPError(
`Generated object does not match schema: ${validationError.message}. Generated: ${JSON.stringify(parsedObject, null, 2)}`
);
}
} catch (error) {
throw mapMCPError(error);
}
}
/**
* Stream text generation using MCP session sampling
* Note: MCP may not support native streaming, so this may simulate streaming
* @param {object} options - Generation options
* @returns {AsyncIterable} Stream of generation chunks
*/
async doStream(options) {
try {
// For now, simulate streaming by chunking the complete response
// TODO: Implement native streaming if MCP supports it
const result = await this.doGenerate(options);
// Create async generator that yields chunks
return this.simulateStreaming(result);
} catch (error) {
throw mapMCPError(error);
}
}
/**
* Simulate streaming by chunking a complete response
* @param {object} result - Complete generation result
* @returns {AsyncIterable} Simulated stream chunks
*/
async *simulateStreaming(result) {
const text = result.text;
const chunkSize = Math.max(1, Math.floor(text.length / 10)); // 10 chunks
for (let i = 0; i < text.length; i += chunkSize) {
const chunk = text.slice(i, i + chunkSize);
const isLast = i + chunkSize >= text.length;
yield {
type: 'text-delta',
textDelta: chunk
};
// Small delay to simulate streaming
await new Promise((resolve) => setTimeout(resolve, 50));
}
// Final chunk with finish reason and usage
yield {
type: 'finish',
finishReason: result.finishReason,
usage: result.usage
};
}
}
```
--------------------------------------------------------------------------------
/scripts/test-claude-errors.js:
--------------------------------------------------------------------------------
```javascript
#!/usr/bin/env node
/**
* test-claude-errors.js
*
* A test script to verify the error handling and retry logic in the callClaude function.
* This script creates a modified version of dev.js that simulates different error scenarios.
*/
import fs from 'fs';
import path from 'path';
import dotenv from 'dotenv';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import { execSync, spawn } from 'child_process';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Load environment variables from .env file
dotenv.config();
// Create a simple PRD for testing
const createTestPRD = () => {
return `# Test PRD for Error Handling
## Overview
This is a simple test PRD to verify the error handling in the callClaude function.
## Requirements
1. Create a simple web application
2. Implement user authentication
3. Add a dashboard for users
`;
};
// Create a modified version of dev.js that simulates errors
function createErrorSimulationScript(errorType, failureCount = 2) {
// Read the original dev.js file
const devJsPath = path.join(__dirname, 'dev.js');
const devJsContent = fs.readFileSync(devJsPath, 'utf8');
// Create a modified version that simulates errors
let modifiedContent = devJsContent;
// Find the anthropic.messages.create call and replace it with our mock
const anthropicCallRegex =
/const response = await anthropic\.messages\.create\(/;
let mockCode = '';
switch (errorType) {
case 'network':
mockCode = `
// Mock for network error simulation
let currentAttempt = 0;
const failureCount = ${failureCount};
// Simulate network error for the first few attempts
currentAttempt++;
console.log(\`[Mock] API call attempt \${currentAttempt}\`);
if (currentAttempt <= failureCount) {
console.log(\`[Mock] Simulating network error (attempt \${currentAttempt}/\${failureCount})\`);
throw new Error('Network error: Connection refused');
}
const response = await anthropic.messages.create(`;
break;
case 'timeout':
mockCode = `
// Mock for timeout error simulation
let currentAttempt = 0;
const failureCount = ${failureCount};
// Simulate timeout error for the first few attempts
currentAttempt++;
console.log(\`[Mock] API call attempt \${currentAttempt}\`);
if (currentAttempt <= failureCount) {
console.log(\`[Mock] Simulating timeout error (attempt \${currentAttempt}/\${failureCount})\`);
throw new Error('Request timed out after 60000ms');
}
const response = await anthropic.messages.create(`;
break;
case 'invalid-json':
mockCode = `
// Mock for invalid JSON response
let currentAttempt = 0;
const failureCount = ${failureCount};
// Simulate invalid JSON for the first few attempts
currentAttempt++;
console.log(\`[Mock] API call attempt \${currentAttempt}\`);
if (currentAttempt <= failureCount) {
console.log(\`[Mock] Simulating invalid JSON response (attempt \${currentAttempt}/\${failureCount})\`);
return {
content: [
{
text: \`\`\`json\\n{"meta": {"projectName": "Test Project"}, "tasks": [{"id": 1, "title": "Task 1"\`
}
]
};
}
const response = await anthropic.messages.create(`;
break;
case 'empty-tasks':
mockCode = `
// Mock for empty tasks array
let currentAttempt = 0;
const failureCount = ${failureCount};
// Simulate empty tasks array for the first few attempts
currentAttempt++;
console.log(\`[Mock] API call attempt \${currentAttempt}\`);
if (currentAttempt <= failureCount) {
console.log(\`[Mock] Simulating empty tasks array (attempt \${currentAttempt}/\${failureCount})\`);
return {
content: [
{
text: \`\`\`json\\n{"meta": {"projectName": "Test Project"}, "tasks": []}\\n\`\`\`
}
]
};
}
const response = await anthropic.messages.create(`;
break;
default:
// No modification
mockCode = `const response = await anthropic.messages.create(`;
}
// Replace the anthropic call with our mock
modifiedContent = modifiedContent.replace(anthropicCallRegex, mockCode);
// Write the modified script to a temporary file
const tempScriptPath = path.join(__dirname, `temp-dev-${errorType}.js`);
fs.writeFileSync(tempScriptPath, modifiedContent, 'utf8');
return tempScriptPath;
}
// Function to run a test with a specific error type
async function runErrorTest(errorType, numTasks = 5, failureCount = 2) {
console.log(`\n=== Test: ${errorType.toUpperCase()} Error Simulation ===`);
// Create a test PRD
const testPRD = createTestPRD();
const testPRDPath = path.join(__dirname, `test-prd-${errorType}.txt`);
fs.writeFileSync(testPRDPath, testPRD, 'utf8');
// Create a modified dev.js that simulates the specified error
const tempScriptPath = createErrorSimulationScript(errorType, failureCount);
console.log(`Created test PRD at ${testPRDPath}`);
console.log(`Created error simulation script at ${tempScriptPath}`);
console.log(
`Running with error type: ${errorType}, failure count: ${failureCount}, tasks: ${numTasks}`
);
try {
// Run the modified script
execSync(
`node ${tempScriptPath} parse-prd --input=${testPRDPath} --tasks=${numTasks}`,
{
stdio: 'inherit'
}
);
console.log(`${errorType} error test completed successfully`);
} catch (error) {
console.error(`${errorType} error test failed:`, error.message);
} finally {
// Clean up temporary files
if (fs.existsSync(tempScriptPath)) {
fs.unlinkSync(tempScriptPath);
}
if (fs.existsSync(testPRDPath)) {
fs.unlinkSync(testPRDPath);
}
}
}
// Function to run all error tests
async function runAllErrorTests() {
console.log('Starting error handling tests for callClaude function...');
// Test 1: Network error with automatic retry
await runErrorTest('network', 5, 2);
// Test 2: Timeout error with automatic retry
await runErrorTest('timeout', 5, 2);
// Test 3: Invalid JSON response with task reduction
await runErrorTest('invalid-json', 10, 2);
// Test 4: Empty tasks array with task reduction
await runErrorTest('empty-tasks', 15, 2);
// Test 5: Exhausted retries (more failures than MAX_RETRIES)
await runErrorTest('network', 5, 4);
console.log('\nAll error tests completed!');
}
// Run the tests
runAllErrorTests().catch((error) => {
console.error('Error running tests:', error);
process.exit(1);
});
```
--------------------------------------------------------------------------------
/apps/docs/command-reference.mdx:
--------------------------------------------------------------------------------
```markdown
---
title: "Task Master Commands"
description: "A comprehensive reference of all available Task Master commands"
---
<AccordionGroup>
<Accordion title="Parse PRD">
```bash
# Parse a PRD file and generate tasks
task-master parse-prd <prd-file.txt>
# Limit the number of tasks generated
task-master parse-prd <prd-file.txt> --num-tasks=10
```
</Accordion>
<Accordion title="List Tasks">
```bash
# List all tasks
task-master list
# List tasks with a specific status
task-master list --status=<status>
# List tasks with subtasks
task-master list --with-subtasks
# List tasks with a specific status and include subtasks
task-master list --status=<status> --with-subtasks
```
</Accordion>
<Accordion title="Show Next Task">
```bash
# Show the next task to work on based on dependencies and status
task-master next
```
</Accordion>
<Accordion title="Show Specific Task">
```bash
# Show details of a specific task
task-master show <id>
# or
task-master show --id=<id>
# View a specific subtask (e.g., subtask 2 of task 1)
task-master show 1.2
```
</Accordion>
<Accordion title="Update Tasks">
```bash
# Update tasks from a specific ID and provide context
task-master update --from=<id> --prompt="<prompt>"
```
</Accordion>
<Accordion title="Update a Specific Task">
```bash
# Update a single task by ID with new information
task-master update-task --id=<id> --prompt="<prompt>"
# Use research-backed updates with Perplexity AI
task-master update-task --id=<id> --prompt="<prompt>" --research
```
</Accordion>
<Accordion title="Update a Subtask">
```bash
# Append additional information to a specific subtask
task-master update-subtask --id=<parentId.subtaskId> --prompt="<prompt>"
# Example: Add details about API rate limiting to subtask 2 of task 5
task-master update-subtask --id=5.2 --prompt="Add rate limiting of 100 requests per minute"
# Use research-backed updates with Perplexity AI
task-master update-subtask --id=<parentId.subtaskId> --prompt="<prompt>" --research
```
Unlike the `update-task` command which replaces task information, the `update-subtask` command _appends_ new information to the existing subtask details, marking it with a timestamp. This is useful for iteratively enhancing subtasks while preserving the original content.
</Accordion>
<Accordion title="Generate Task Files">
```bash
# Generate individual task files from tasks.json
task-master generate
```
</Accordion>
<Accordion title="Set Task Status">
```bash
# Set status of a single task
task-master set-status --id=<id> --status=<status>
# Set status for multiple tasks
task-master set-status --id=1,2,3 --status=<status>
# Set status for subtasks
task-master set-status --id=1.1,1.2 --status=<status>
```
When marking a task as "done", all of its subtasks will automatically be marked as "done" as well.
</Accordion>
<Accordion title="Expand Tasks">
```bash
# Expand a specific task with subtasks
task-master expand --id=<id> --num=<number>
# Expand with additional context
task-master expand --id=<id> --prompt="<context>"
# Expand all pending tasks
task-master expand --all
# Force regeneration of subtasks for tasks that already have them
task-master expand --all --force
# Research-backed subtask generation for a specific task
task-master expand --id=<id> --research
# Research-backed generation for all tasks
task-master expand --all --research
```
</Accordion>
<Accordion title="Clear Subtasks">
```bash
# Clear subtasks from a specific task
task-master clear-subtasks --id=<id>
# Clear subtasks from multiple tasks
task-master clear-subtasks --id=1,2,3
# Clear subtasks from all tasks
task-master clear-subtasks --all
```
</Accordion>
<Accordion title="Analyze Task Complexity">
```bash
# Analyze complexity of all tasks
task-master analyze-complexity
# Save report to a custom location
task-master analyze-complexity --output=my-report.json
# Use a specific LLM model
task-master analyze-complexity --model=claude-3-opus-20240229
# Set a custom complexity threshold (1-10)
task-master analyze-complexity --threshold=6
# Use an alternative tasks file
task-master analyze-complexity --file=custom-tasks.json
# Use Perplexity AI for research-backed complexity analysis
task-master analyze-complexity --research
```
</Accordion>
<Accordion title="View Complexity Report">
```bash
# Display the task complexity analysis report
task-master complexity-report
# View a report at a custom location
task-master complexity-report --file=my-report.json
```
</Accordion>
<Accordion title="Managing Task Dependencies">
```bash
# Add a dependency to a task
task-master add-dependency --id=<id> --depends-on=<id>
# Remove a dependency from a task
task-master remove-dependency --id=<id> --depends-on=<id>
# Validate dependencies without fixing them
task-master validate-dependencies
# Find and fix invalid dependencies automatically
task-master fix-dependencies
```
</Accordion>
<Accordion title="Add a New Task">
```bash
# Add a new task using AI
task-master add-task --prompt="Description of the new task"
# Add a task with dependencies
task-master add-task --prompt="Description" --dependencies=1,2,3
# Add a task with priority
task-master add-task --prompt="Description" --priority=high
```
</Accordion>
<Accordion title="Initialize a Project">
```bash
# Initialize a new project with Task Master structure
task-master init
```
</Accordion>
<Accordion title="TDD Workflow (Autopilot)">
```bash
# Start autonomous TDD workflow for a task
task-master autopilot start <taskId>
# Get next action with context
task-master autopilot next
# Complete phase with test results
task-master autopilot complete --results '{"total":N,"passed":N,"failed":N}'
# Commit changes
task-master autopilot commit
# Check workflow status
task-master autopilot status
# Resume interrupted workflow
task-master autopilot resume
# Abort workflow
task-master autopilot abort
```
The TDD workflow enforces RED → GREEN → COMMIT cycles for each subtask. See [AI Agent Integration](/tdd-workflow/ai-agent-integration) for details.
</Accordion>
</AccordionGroup>
```
--------------------------------------------------------------------------------
/.github/workflows/log-issue-events.yml:
--------------------------------------------------------------------------------
```yaml
name: Log GitHub Issue Events
on:
issues:
types: [opened, closed]
jobs:
log-issue-created:
if: github.event.action == 'opened'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
issues: read
steps:
- name: Log issue creation to Statsig
env:
STATSIG_API_KEY: ${{ secrets.STATSIG_API_KEY }}
run: |
ISSUE_NUMBER=${{ github.event.issue.number }}
REPO=${{ github.repository }}
ISSUE_TITLE=$(echo '${{ github.event.issue.title }}' | sed "s/'/'\\\\''/g")
AUTHOR="${{ github.event.issue.user.login }}"
CREATED_AT="${{ github.event.issue.created_at }}"
if [ -z "$STATSIG_API_KEY" ]; then
echo "STATSIG_API_KEY not found, skipping Statsig logging"
exit 0
fi
# Prepare the event payload
EVENT_PAYLOAD=$(jq -n \
--arg issue_number "$ISSUE_NUMBER" \
--arg repo "$REPO" \
--arg title "$ISSUE_TITLE" \
--arg author "$AUTHOR" \
--arg created_at "$CREATED_AT" \
'{
events: [{
eventName: "github_issue_created",
value: 1,
metadata: {
repository: $repo,
issue_number: ($issue_number | tonumber),
issue_title: $title,
issue_author: $author,
created_at: $created_at
},
time: (now | floor | tostring)
}]
}')
# Send to Statsig API
echo "Logging issue creation to Statsig for issue #${ISSUE_NUMBER}"
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST https://events.statsigapi.net/v1/log_event \
-H "Content-Type: application/json" \
-H "STATSIG-API-KEY: ${STATSIG_API_KEY}" \
-d "$EVENT_PAYLOAD")
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | head -n-1)
if [ "$HTTP_CODE" -eq 200 ] || [ "$HTTP_CODE" -eq 202 ]; then
echo "Successfully logged issue creation for issue #${ISSUE_NUMBER}"
else
echo "Failed to log issue creation for issue #${ISSUE_NUMBER}. HTTP ${HTTP_CODE}: ${BODY}"
fi
log-issue-closed:
if: github.event.action == 'closed'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
issues: read
steps:
- name: Log issue closure to Statsig
env:
STATSIG_API_KEY: ${{ secrets.STATSIG_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ISSUE_NUMBER=${{ github.event.issue.number }}
REPO=${{ github.repository }}
ISSUE_TITLE=$(echo '${{ github.event.issue.title }}' | sed "s/'/'\\\\''/g")
CLOSED_BY="${{ github.event.issue.closed_by.login }}"
CLOSED_AT="${{ github.event.issue.closed_at }}"
STATE_REASON="${{ github.event.issue.state_reason }}"
if [ -z "$STATSIG_API_KEY" ]; then
echo "STATSIG_API_KEY not found, skipping Statsig logging"
exit 0
fi
# Get additional issue data via GitHub API
echo "Fetching additional issue data for #${ISSUE_NUMBER}"
ISSUE_DATA=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${REPO}/issues/${ISSUE_NUMBER}")
COMMENTS_COUNT=$(echo "$ISSUE_DATA" | jq -r '.comments')
# Get reactions data
REACTIONS_DATA=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${REPO}/issues/${ISSUE_NUMBER}/reactions")
REACTIONS_COUNT=$(echo "$REACTIONS_DATA" | jq '. | length')
# Check if issue was closed automatically (by checking if closed_by is a bot)
CLOSED_AUTOMATICALLY="false"
if [[ "$CLOSED_BY" == *"[bot]"* ]]; then
CLOSED_AUTOMATICALLY="true"
fi
# Check if closed as duplicate by state_reason
CLOSED_AS_DUPLICATE="false"
if [ "$STATE_REASON" = "duplicate" ]; then
CLOSED_AS_DUPLICATE="true"
fi
# Prepare the event payload
EVENT_PAYLOAD=$(jq -n \
--arg issue_number "$ISSUE_NUMBER" \
--arg repo "$REPO" \
--arg title "$ISSUE_TITLE" \
--arg closed_by "$CLOSED_BY" \
--arg closed_at "$CLOSED_AT" \
--arg state_reason "$STATE_REASON" \
--arg comments_count "$COMMENTS_COUNT" \
--arg reactions_count "$REACTIONS_COUNT" \
--arg closed_automatically "$CLOSED_AUTOMATICALLY" \
--arg closed_as_duplicate "$CLOSED_AS_DUPLICATE" \
'{
events: [{
eventName: "github_issue_closed",
value: 1,
metadata: {
repository: $repo,
issue_number: ($issue_number | tonumber),
issue_title: $title,
closed_by: $closed_by,
closed_at: $closed_at,
state_reason: $state_reason,
comments_count: ($comments_count | tonumber),
reactions_count: ($reactions_count | tonumber),
closed_automatically: ($closed_automatically | test("true")),
closed_as_duplicate: ($closed_as_duplicate | test("true"))
},
time: (now | floor | tostring)
}]
}')
# Send to Statsig API
echo "Logging issue closure to Statsig for issue #${ISSUE_NUMBER}"
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST https://events.statsigapi.net/v1/log_event \
-H "Content-Type: application/json" \
-H "STATSIG-API-KEY: ${STATSIG_API_KEY}" \
-d "$EVENT_PAYLOAD")
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | head -n-1)
if [ "$HTTP_CODE" -eq 200 ] || [ "$HTTP_CODE" -eq 202 ]; then
echo "Successfully logged issue closure for issue #${ISSUE_NUMBER}"
echo "Closed by: $CLOSED_BY"
echo "Comments: $COMMENTS_COUNT"
echo "Reactions: $REACTIONS_COUNT"
echo "Closed automatically: $CLOSED_AUTOMATICALLY"
echo "Closed as duplicate: $CLOSED_AS_DUPLICATE"
else
echo "Failed to log issue closure for issue #${ISSUE_NUMBER}. HTTP ${HTTP_CODE}: ${BODY}"
fi
```
--------------------------------------------------------------------------------
/docs/examples.md:
--------------------------------------------------------------------------------
```markdown
# Example Cursor AI Interactions
Here are some common interactions with Cursor AI when using Task Master:
## Starting a new project
```
I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/prd.txt.
Can you help me parse it and set up the initial tasks?
```
## Working on tasks
```
What's the next task I should work on? Please consider dependencies and priorities.
```
## Implementing a specific task
```
I'd like to implement task 4. Can you help me understand what needs to be done and how to approach it?
```
## Viewing multiple tasks
```
Can you show me tasks 1, 3, and 5 so I can understand their relationship?
```
```
I need to see the status of tasks 44, 55, and their subtasks. Can you show me those?
```
```
Show me tasks 10, 12, and 15 and give me some batch actions I can perform on them.
```
## Managing subtasks
```
I need to regenerate the subtasks for task 3 with a different approach. Can you help me clear and regenerate them?
```
## Handling changes
```
I've decided to use MongoDB instead of PostgreSQL. Can you update all future tasks to reflect this change?
```
## Completing work
```
I've finished implementing the authentication system described in task 2. All tests are passing.
Please mark it as complete and tell me what I should work on next.
```
## Reorganizing tasks
```
I think subtask 5.2 would fit better as part of task 7. Can you move it there?
```
(Agent runs: `task-master move --from=5.2 --to=7.3`)
```
Task 8 should actually be a subtask of task 4. Can you reorganize this?
```
(Agent runs: `task-master move --from=8 --to=4.1`)
```
I just merged the main branch and there's a conflict in tasks.json. My teammates created tasks 10-15 on their branch while I created tasks 10-12 on my branch. Can you help me resolve this by moving my tasks?
```
(Agent runs:
```bash
task-master move --from=10 --to=16
task-master move --from=11 --to=17
task-master move --from=12 --to=18
```
)
## Analyzing complexity
```
Can you analyze the complexity of our tasks to help me understand which ones need to be broken down further?
```
## Viewing complexity report
```
Can you show me the complexity report in a more readable format?
```
### Breaking Down Complex Tasks
```
Task 5 seems complex. Can you break it down into subtasks?
```
(Agent runs: `task-master expand --id=5`)
```
Please break down task 5 using research-backed generation.
```
(Agent runs: `task-master expand --id=5 --research`)
### Updating Tasks with Research
```
We need to update task 15 based on the latest React Query v5 changes. Can you research this and update the task?
```
(Agent runs: `task-master update-task --id=15 --prompt="Update based on React Query v5 changes" --research`)
### Adding Tasks with Research
```
Please add a new task to implement user profile image uploads using Cloudinary, research the best approach.
```
(Agent runs: `task-master add-task --prompt="Implement user profile image uploads using Cloudinary" --research`)
## Research-Driven Development
### Getting Fresh Information
```
Research the latest best practices for implementing JWT authentication in Node.js applications.
```
(Agent runs: `task-master research "Latest best practices for JWT authentication in Node.js"`)
### Research with Project Context
```
I'm working on task 15 which involves API optimization. Can you research current best practices for our specific implementation?
```
(Agent runs: `task-master research "API optimization best practices" --id=15 --files=src/api.js`)
### Research Before Implementation
```
Before I implement task 8 (React Query integration), can you research the latest React Query v5 patterns and any breaking changes?
```
(Agent runs: `task-master research "React Query v5 patterns and breaking changes" --id=8`)
### Research and Update Pattern
```
Research the latest security recommendations for Express.js applications and update our authentication task with the findings.
```
(Agent runs:
1. `task-master research "Latest Express.js security recommendations" --id=12`
2. `task-master update-subtask --id=12.3 --prompt="Updated with latest security findings: [research results]"`)
### Research for Debugging
```
I'm having issues with our WebSocket implementation in task 20. Can you research common WebSocket problems and solutions?
```
(Agent runs: `task-master research "Common WebSocket implementation problems and solutions" --id=20 --files=src/websocket.js`)
### Research Technology Comparisons
```
We need to choose between Redis and Memcached for caching. Can you research the current recommendations for our use case?
```
(Agent runs: `task-master research "Redis vs Memcached 2024 comparison for session caching" --tree`)
## Git Integration and Tag Management
### Creating Tags for Feature Branches
```
I'm starting work on a new feature branch for user authentication. Can you create a matching task tag?
```
(Agent runs: `task-master add-tag --from-branch`)
### Creating Named Tags
```
Create a new tag called 'api-v2' for our API redesign work.
```
(Agent runs: `task-master add-tag api-v2 --description="API v2 redesign tasks"`)
### Switching Tag Contexts
```
Switch to the 'testing' tag so I can work on QA tasks.
```
(Agent runs: `task-master use-tag testing`)
### Copying Tasks Between Tags
```
I need to copy the current tasks to a new 'hotfix' tag for urgent fixes.
```
(Agent runs: `task-master add-tag hotfix --copy-from-current --description="Urgent hotfix tasks"`)
### Managing Multiple Contexts
```
Show me all available tags and their current status.
```
(Agent runs: `task-master tags --show-metadata`)
### Tag Cleanup
```
I've finished the 'user-auth' feature and merged the branch. Can you clean up the tag?
```
(Agent runs: `task-master delete-tag user-auth`)
### Working with Tag-Specific Tasks
```
List all tasks in the 'api-v2' tag context.
```
(Agent runs: `task-master use-tag api-v2` then `task-master list`)
### Branch-Based Development Workflow
```
I'm switching to work on the 'feature/payments' branch. Can you set up the task context for this?
```
(Agent runs:
1. `git checkout feature/payments`
2. `task-master add-tag --from-branch --description="Payment system implementation"`
3. `task-master list` to show tasks in the new context)
### Parallel Feature Development
```
I need to work on both authentication and payment features simultaneously. How should I organize the tasks?
```
(Agent suggests and runs:
1. `task-master add-tag auth --description="Authentication feature tasks"`
2. `task-master add-tag payments --description="Payment system tasks"`
3. `task-master use-tag auth` to start with authentication work)
```
--------------------------------------------------------------------------------
/apps/mcp/src/tools/autopilot/commit.tool.ts:
--------------------------------------------------------------------------------
```typescript
/**
* @fileoverview autopilot-commit MCP tool
* Create a git commit with automatic staging and message generation
*/
import { z } from 'zod';
import {
handleApiResult,
withNormalizedProjectRoot
} from '../../shared/utils.js';
import type { MCPContext } from '../../shared/types.js';
import { WorkflowService, GitAdapter, CommitMessageGenerator } from '@tm/core';
import type { FastMCP } from 'fastmcp';
const CommitSchema = z.object({
projectRoot: z
.string()
.describe('Absolute path to the project root directory'),
files: z
.array(z.string())
.optional()
.describe(
'Specific files to stage (relative to project root). If not provided, stages all changes.'
),
customMessage: z
.string()
.optional()
.describe('Custom commit message to use instead of auto-generated message')
});
type CommitArgs = z.infer<typeof CommitSchema>;
/**
* Register the autopilot_commit tool with the MCP server
*/
export function registerAutopilotCommitTool(server: FastMCP) {
server.addTool({
name: 'autopilot_commit',
description:
'Create a git commit with automatic staging, message generation, and metadata embedding. Generates appropriate commit messages based on subtask context and TDD phase.',
parameters: CommitSchema,
execute: withNormalizedProjectRoot(
async (args: CommitArgs, context: MCPContext) => {
const { projectRoot, files, customMessage } = args;
try {
context.log.info(`Creating commit for workflow in ${projectRoot}`);
const workflowService = new WorkflowService(projectRoot);
// Check if workflow exists
if (!(await workflowService.hasWorkflow())) {
return handleApiResult({
result: {
success: false,
error: {
message:
'No active workflow found. Start a workflow with autopilot_start'
}
},
log: context.log,
projectRoot
});
}
// Resume workflow
await workflowService.resumeWorkflow();
const status = workflowService.getStatus();
const workflowContext = workflowService.getContext();
// Verify we're in COMMIT phase
if (status.tddPhase !== 'COMMIT') {
context.log.warn(
`Not in COMMIT phase (currently in ${status.tddPhase})`
);
return handleApiResult({
result: {
success: false,
error: {
message: `Cannot commit: currently in ${status.tddPhase} phase. Complete the ${status.tddPhase} phase first using autopilot_complete_phase`
}
},
log: context.log,
projectRoot
});
}
// Verify there's an active subtask
if (!status.currentSubtask) {
return handleApiResult({
result: {
success: false,
error: { message: 'No active subtask to commit' }
},
log: context.log,
projectRoot
});
}
// Initialize git adapter
const gitAdapter = new GitAdapter(projectRoot);
// Stage files
try {
if (files && files.length > 0) {
await gitAdapter.stageFiles(files);
context.log.info(`Staged ${files.length} files`);
} else {
await gitAdapter.stageFiles(['.']);
context.log.info('Staged all changes');
}
} catch (error: any) {
context.log.error(`Failed to stage files: ${error.message}`);
return handleApiResult({
result: {
success: false,
error: { message: `Failed to stage files: ${error.message}` }
},
log: context.log,
projectRoot
});
}
// Check if there are staged changes
const hasStagedChanges = await gitAdapter.hasStagedChanges();
if (!hasStagedChanges) {
context.log.warn('No staged changes to commit');
return handleApiResult({
result: {
success: false,
error: {
message:
'No staged changes to commit. Make code changes before committing'
}
},
log: context.log,
projectRoot
});
}
// Get git status for message generation
const gitStatus = await gitAdapter.getStatus();
// Generate commit message
let commitMessage: string;
if (customMessage) {
commitMessage = customMessage;
context.log.info('Using custom commit message');
} else {
const messageGenerator = new CommitMessageGenerator();
// Determine commit type based on phase and subtask
// RED phase = test files, GREEN phase = implementation
const type = status.tddPhase === 'COMMIT' ? 'feat' : 'test';
// Use subtask title as description
const description = status.currentSubtask.title;
// Construct proper CommitMessageOptions
const options = {
type,
description,
changedFiles: gitStatus.staged,
taskId: status.taskId,
phase: status.tddPhase,
testsPassing: workflowContext.lastTestResults?.passed,
testsFailing: workflowContext.lastTestResults?.failed
};
commitMessage = messageGenerator.generateMessage(options);
context.log.info('Generated commit message automatically');
}
// Create commit
try {
await gitAdapter.createCommit(commitMessage);
context.log.info('Commit created successfully');
} catch (error: any) {
context.log.error(`Failed to create commit: ${error.message}`);
return handleApiResult({
result: {
success: false,
error: { message: `Failed to create commit: ${error.message}` }
},
log: context.log,
projectRoot
});
}
// Get last commit info
const lastCommit = await gitAdapter.getLastCommit();
// Complete COMMIT phase and advance workflow
const newStatus = await workflowService.commit();
context.log.info(
`Commit completed. Current phase: ${newStatus.tddPhase || newStatus.phase}`
);
const isComplete = newStatus.phase === 'COMPLETE';
// Get next action with guidance
const nextAction = workflowService.getNextAction();
return handleApiResult({
result: {
success: true,
data: {
message: isComplete
? 'Workflow completed successfully'
: 'Commit created and workflow advanced',
commitSha: lastCommit.sha,
commitMessage,
...newStatus,
isComplete,
nextAction: nextAction.action,
nextSteps: nextAction.nextSteps
}
},
log: context.log,
projectRoot
});
} catch (error: any) {
context.log.error(`Error in autopilot-commit: ${error.message}`);
if (error.stack) {
context.log.debug(error.stack);
}
return handleApiResult({
result: {
success: false,
error: { message: `Failed to commit: ${error.message}` }
},
log: context.log,
projectRoot
});
}
}
)
});
}
```
--------------------------------------------------------------------------------
/.github/scripts/auto-close-duplicates.mjs:
--------------------------------------------------------------------------------
```
#!/usr/bin/env node
async function githubRequest(endpoint, token, method = 'GET', body) {
const response = await fetch(`https://api.github.com${endpoint}`, {
method,
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/vnd.github.v3+json',
'User-Agent': 'auto-close-duplicates-script',
...(body && { 'Content-Type': 'application/json' })
},
...(body && { body: JSON.stringify(body) })
});
if (!response.ok) {
throw new Error(
`GitHub API request failed: ${response.status} ${response.statusText}`
);
}
return response.json();
}
function extractDuplicateIssueNumber(commentBody) {
const match = commentBody.match(/#(\d+)/);
return match ? parseInt(match[1], 10) : null;
}
async function closeIssueAsDuplicate(
owner,
repo,
issueNumber,
duplicateOfNumber,
token
) {
await githubRequest(
`/repos/${owner}/${repo}/issues/${issueNumber}`,
token,
'PATCH',
{
state: 'closed',
state_reason: 'not_planned',
labels: ['duplicate']
}
);
await githubRequest(
`/repos/${owner}/${repo}/issues/${issueNumber}/comments`,
token,
'POST',
{
body: `This issue has been automatically closed as a duplicate of #${duplicateOfNumber}.
If this is incorrect, please re-open this issue or create a new one.
🤖 Generated with [Task Master Bot]`
}
);
}
async function autoCloseDuplicates() {
console.log('[DEBUG] Starting auto-close duplicates script');
const token = process.env.GITHUB_TOKEN;
if (!token) {
throw new Error('GITHUB_TOKEN environment variable is required');
}
console.log('[DEBUG] GitHub token found');
const owner = process.env.GITHUB_REPOSITORY_OWNER || 'eyaltoledano';
const repo = process.env.GITHUB_REPOSITORY_NAME || 'claude-task-master';
console.log(`[DEBUG] Repository: ${owner}/${repo}`);
const threeDaysAgo = new Date();
threeDaysAgo.setDate(threeDaysAgo.getDate() - 3);
console.log(
`[DEBUG] Checking for duplicate comments older than: ${threeDaysAgo.toISOString()}`
);
console.log('[DEBUG] Fetching open issues created more than 3 days ago...');
const allIssues = [];
let page = 1;
const perPage = 100;
const MAX_PAGES = 50; // Increase limit for larger repos
let foundRecentIssue = false;
while (true) {
const pageIssues = await githubRequest(
`/repos/${owner}/${repo}/issues?state=open&per_page=${perPage}&page=${page}&sort=created&direction=desc`,
token
);
if (pageIssues.length === 0) break;
// Filter for issues created more than 3 days ago
const oldEnoughIssues = pageIssues.filter(
(issue) => new Date(issue.created_at) <= threeDaysAgo
);
allIssues.push(...oldEnoughIssues);
// If all issues on this page are newer than 3 days, we can stop
if (oldEnoughIssues.length === 0 && page === 1) {
foundRecentIssue = true;
break;
}
// If we found some old issues but not all, continue to next page
// as there might be more old issues
page++;
// Safety limit to avoid infinite loops
if (page > MAX_PAGES) {
console.log(`[WARNING] Reached maximum page limit of ${MAX_PAGES}`);
break;
}
}
const issues = allIssues;
console.log(`[DEBUG] Found ${issues.length} open issues`);
let processedCount = 0;
let candidateCount = 0;
for (const issue of issues) {
processedCount++;
console.log(
`[DEBUG] Processing issue #${issue.number} (${processedCount}/${issues.length}): ${issue.title}`
);
console.log(`[DEBUG] Fetching comments for issue #${issue.number}...`);
const comments = await githubRequest(
`/repos/${owner}/${repo}/issues/${issue.number}/comments`,
token
);
console.log(
`[DEBUG] Issue #${issue.number} has ${comments.length} comments`
);
const dupeComments = comments.filter(
(comment) =>
comment.body.includes('Found') &&
comment.body.includes('possible duplicate') &&
comment.user.type === 'Bot'
);
console.log(
`[DEBUG] Issue #${issue.number} has ${dupeComments.length} duplicate detection comments`
);
if (dupeComments.length === 0) {
console.log(
`[DEBUG] Issue #${issue.number} - no duplicate comments found, skipping`
);
continue;
}
const lastDupeComment = dupeComments[dupeComments.length - 1];
const dupeCommentDate = new Date(lastDupeComment.created_at);
console.log(
`[DEBUG] Issue #${
issue.number
} - most recent duplicate comment from: ${dupeCommentDate.toISOString()}`
);
if (dupeCommentDate > threeDaysAgo) {
console.log(
`[DEBUG] Issue #${issue.number} - duplicate comment is too recent, skipping`
);
continue;
}
console.log(
`[DEBUG] Issue #${
issue.number
} - duplicate comment is old enough (${Math.floor(
(Date.now() - dupeCommentDate.getTime()) / (1000 * 60 * 60 * 24)
)} days)`
);
const commentsAfterDupe = comments.filter(
(comment) => new Date(comment.created_at) > dupeCommentDate
);
console.log(
`[DEBUG] Issue #${issue.number} - ${commentsAfterDupe.length} comments after duplicate detection`
);
if (commentsAfterDupe.length > 0) {
console.log(
`[DEBUG] Issue #${issue.number} - has activity after duplicate comment, skipping`
);
continue;
}
console.log(
`[DEBUG] Issue #${issue.number} - checking reactions on duplicate comment...`
);
const reactions = await githubRequest(
`/repos/${owner}/${repo}/issues/comments/${lastDupeComment.id}/reactions`,
token
);
console.log(
`[DEBUG] Issue #${issue.number} - duplicate comment has ${reactions.length} reactions`
);
const authorThumbsDown = reactions.some(
(reaction) =>
reaction.user.id === issue.user.id && reaction.content === '-1'
);
console.log(
`[DEBUG] Issue #${issue.number} - author thumbs down reaction: ${authorThumbsDown}`
);
if (authorThumbsDown) {
console.log(
`[DEBUG] Issue #${issue.number} - author disagreed with duplicate detection, skipping`
);
continue;
}
const duplicateIssueNumber = extractDuplicateIssueNumber(
lastDupeComment.body
);
if (!duplicateIssueNumber) {
console.log(
`[DEBUG] Issue #${issue.number} - could not extract duplicate issue number from comment, skipping`
);
continue;
}
candidateCount++;
const issueUrl = `https://github.com/${owner}/${repo}/issues/${issue.number}`;
try {
console.log(
`[INFO] Auto-closing issue #${issue.number} as duplicate of #${duplicateIssueNumber}: ${issueUrl}`
);
await closeIssueAsDuplicate(
owner,
repo,
issue.number,
duplicateIssueNumber,
token
);
console.log(
`[SUCCESS] Successfully closed issue #${issue.number} as duplicate of #${duplicateIssueNumber}`
);
} catch (error) {
console.error(
`[ERROR] Failed to close issue #${issue.number} as duplicate: ${error}`
);
}
}
console.log(
`[DEBUG] Script completed. Processed ${processedCount} issues, found ${candidateCount} candidates for auto-close`
);
}
autoCloseDuplicates().catch(console.error);
```
--------------------------------------------------------------------------------
/apps/extension/src/webview/components/TaskEditModal.tsx:
--------------------------------------------------------------------------------
```typescript
/**
* Task Edit Modal Component
*/
import React, { useState, useEffect, useRef } from 'react';
import { Button } from '@/components/ui/button';
import { Label } from '@/components/ui/label';
import { Textarea } from '@/components/ui/textarea';
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger
} from '@/components/ui/dropdown-menu';
import type { TaskMasterTask, TaskUpdates } from '../types';
interface TaskEditModalProps {
task: TaskMasterTask;
onSave: (taskId: string, updates: TaskUpdates) => Promise<void>;
onCancel: () => void;
}
export const TaskEditModal: React.FC<TaskEditModalProps> = ({
task,
onSave,
onCancel
}) => {
const [updates, setUpdates] = useState<TaskUpdates>({
title: task.title,
description: task.description || '',
details: task.details || '',
testStrategy: task.testStrategy || '',
priority: task.priority,
dependencies: task.dependencies || []
});
const [isSaving, setIsSaving] = useState(false);
const formRef = useRef<HTMLFormElement>(null);
const titleInputRef = useRef<HTMLInputElement>(null);
// Focus title input on mount
useEffect(() => {
titleInputRef.current?.focus();
titleInputRef.current?.select();
}, []);
const handleSubmit = async (e?: React.FormEvent) => {
e?.preventDefault();
setIsSaving(true);
try {
await onSave(task.id, updates);
} catch (error) {
console.error('Failed to save task:', error);
} finally {
setIsSaving(false);
}
};
const hasChanges = () => {
return (
updates.title !== task.title ||
updates.description !== (task.description || '') ||
updates.details !== (task.details || '') ||
updates.testStrategy !== (task.testStrategy || '') ||
updates.priority !== task.priority ||
JSON.stringify(updates.dependencies) !==
JSON.stringify(task.dependencies || [])
);
};
return (
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4">
<div className="bg-vscode-editor-background border border-vscode-border rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden flex flex-col">
{/* Header */}
<div className="flex items-center justify-between p-4 border-b border-vscode-border">
<h2 className="text-lg font-semibold">Edit Task #{task.id}</h2>
<button
onClick={onCancel}
className="text-vscode-foreground/50 hover:text-vscode-foreground transition-colors"
>
<svg
className="w-5 h-5"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M6 18L18 6M6 6l12 12"
/>
</svg>
</button>
</div>
{/* Form */}
<form
ref={formRef}
onSubmit={handleSubmit}
className="flex-1 overflow-y-auto p-4 space-y-4"
>
{/* Title */}
<div className="space-y-2">
<Label htmlFor="title">Title</Label>
<input
ref={titleInputRef}
id="title"
type="text"
value={updates.title || ''}
onChange={(e) =>
setUpdates({ ...updates, title: e.target.value })
}
className="w-full px-3 py-2 bg-vscode-input border border-vscode-border rounded-md text-vscode-foreground focus:outline-none focus:ring-2 focus:ring-vscode-focusBorder"
placeholder="Task title"
/>
</div>
{/* Priority */}
<div className="space-y-2">
<Label htmlFor="priority">Priority</Label>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" className="w-full justify-between">
<span className="capitalize">{updates.priority}</span>
<svg
className="w-4 h-4"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M19 9l-7 7-7-7"
/>
</svg>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-full">
<DropdownMenuItem
onClick={() => setUpdates({ ...updates, priority: 'high' })}
>
High
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setUpdates({ ...updates, priority: 'medium' })}
>
Medium
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => setUpdates({ ...updates, priority: 'low' })}
>
Low
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
{/* Description */}
<div className="space-y-2">
<Label htmlFor="description">Description</Label>
<Textarea
id="description"
value={updates.description || ''}
onChange={(e) =>
setUpdates({ ...updates, description: e.target.value })
}
className="min-h-[80px]"
placeholder="Brief description of the task"
/>
</div>
{/* Details */}
<div className="space-y-2">
<Label htmlFor="details">Implementation Details</Label>
<Textarea
id="details"
value={updates.details || ''}
onChange={(e) =>
setUpdates({ ...updates, details: e.target.value })
}
className="min-h-[120px]"
placeholder="Technical details and implementation notes"
/>
</div>
{/* Test Strategy */}
<div className="space-y-2">
<Label htmlFor="testStrategy">Test Strategy</Label>
<Textarea
id="testStrategy"
value={updates.testStrategy || ''}
onChange={(e) =>
setUpdates({ ...updates, testStrategy: e.target.value })
}
className="min-h-[80px]"
placeholder="How to test this task"
/>
</div>
{/* Dependencies */}
<div className="space-y-2">
<Label htmlFor="dependencies">
Dependencies (comma-separated task IDs)
</Label>
<input
id="dependencies"
type="text"
value={updates.dependencies?.join(', ') || ''}
onChange={(e) =>
setUpdates({
...updates,
dependencies: e.target.value
.split(',')
.map((d) => d.trim())
.filter(Boolean)
})
}
className="w-full px-3 py-2 bg-vscode-input border border-vscode-border rounded-md text-vscode-foreground focus:outline-none focus:ring-2 focus:ring-vscode-focusBorder"
placeholder="e.g., 1, 2.1, 3"
/>
</div>
</form>
{/* Footer */}
<div className="flex items-center justify-end gap-2 p-4 border-t border-vscode-border">
<Button variant="outline" onClick={onCancel} disabled={isSaving}>
Cancel
</Button>
<Button
onClick={() => handleSubmit()}
disabled={isSaving || !hasChanges()}
>
{isSaving ? 'Saving...' : 'Save Changes'}
</Button>
</div>
</div>
</div>
);
};
```