#
tokens: 33719/50000 1/821 files (page 46/52)
lines: on (toggle) GitHub
raw markdown copy reset
This is page 46 of 52. Use http://codebase.md/eyaltoledano/claude-task-master?lines=true&page={x} to view the full context.

# Directory Structure

```
├── .changeset
│   ├── config.json
│   └── README.md
├── .claude
│   ├── agents
│   │   ├── task-checker.md
│   │   ├── task-executor.md
│   │   └── task-orchestrator.md
│   ├── commands
│   │   ├── dedupe.md
│   │   └── tm
│   │       ├── add-dependency
│   │       │   └── add-dependency.md
│   │       ├── add-subtask
│   │       │   ├── add-subtask.md
│   │       │   └── convert-task-to-subtask.md
│   │       ├── add-task
│   │       │   └── add-task.md
│   │       ├── analyze-complexity
│   │       │   └── analyze-complexity.md
│   │       ├── complexity-report
│   │       │   └── complexity-report.md
│   │       ├── expand
│   │       │   ├── expand-all-tasks.md
│   │       │   └── expand-task.md
│   │       ├── fix-dependencies
│   │       │   └── fix-dependencies.md
│   │       ├── generate
│   │       │   └── generate-tasks.md
│   │       ├── help.md
│   │       ├── init
│   │       │   ├── init-project-quick.md
│   │       │   └── init-project.md
│   │       ├── learn.md
│   │       ├── list
│   │       │   ├── list-tasks-by-status.md
│   │       │   ├── list-tasks-with-subtasks.md
│   │       │   └── list-tasks.md
│   │       ├── models
│   │       │   ├── setup-models.md
│   │       │   └── view-models.md
│   │       ├── next
│   │       │   └── next-task.md
│   │       ├── parse-prd
│   │       │   ├── parse-prd-with-research.md
│   │       │   └── parse-prd.md
│   │       ├── remove-dependency
│   │       │   └── remove-dependency.md
│   │       ├── remove-subtask
│   │       │   └── remove-subtask.md
│   │       ├── remove-subtasks
│   │       │   ├── remove-all-subtasks.md
│   │       │   └── remove-subtasks.md
│   │       ├── remove-task
│   │       │   └── remove-task.md
│   │       ├── set-status
│   │       │   ├── to-cancelled.md
│   │       │   ├── to-deferred.md
│   │       │   ├── to-done.md
│   │       │   ├── to-in-progress.md
│   │       │   ├── to-pending.md
│   │       │   └── to-review.md
│   │       ├── setup
│   │       │   ├── install-taskmaster.md
│   │       │   └── quick-install-taskmaster.md
│   │       ├── show
│   │       │   └── show-task.md
│   │       ├── status
│   │       │   └── project-status.md
│   │       ├── sync-readme
│   │       │   └── sync-readme.md
│   │       ├── tm-main.md
│   │       ├── update
│   │       │   ├── update-single-task.md
│   │       │   ├── update-task.md
│   │       │   └── update-tasks-from-id.md
│   │       ├── utils
│   │       │   └── analyze-project.md
│   │       ├── validate-dependencies
│   │       │   └── validate-dependencies.md
│   │       └── workflows
│   │           ├── auto-implement-tasks.md
│   │           ├── command-pipeline.md
│   │           └── smart-workflow.md
│   └── TM_COMMANDS_GUIDE.md
├── .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
│   └── 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
│   │   ├── 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
│   │   ├── test-prd.txt
│   │   └── tm-core-phase-1.txt
│   ├── reports
│   │   ├── task-complexity-report_cc-kiro-hooks.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.txt
├── .vscode
│   ├── extensions.json
│   └── settings.json
├── apps
│   ├── cli
│   │   ├── CHANGELOG.md
│   │   ├── package.json
│   │   ├── src
│   │   │   ├── commands
│   │   │   │   ├── auth.command.ts
│   │   │   │   ├── context.command.ts
│   │   │   │   ├── list.command.ts
│   │   │   │   ├── set-status.command.ts
│   │   │   │   ├── show.command.ts
│   │   │   │   └── start.command.ts
│   │   │   ├── index.ts
│   │   │   ├── ui
│   │   │   │   ├── components
│   │   │   │   │   ├── dashboard.component.ts
│   │   │   │   │   ├── header.component.ts
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── next-task.component.ts
│   │   │   │   │   ├── suggested-steps.component.ts
│   │   │   │   │   └── task-detail.component.ts
│   │   │   │   └── index.ts
│   │   │   └── utils
│   │   │       ├── auto-update.ts
│   │   │       └── ui.ts
│   │   └── tsconfig.json
│   ├── 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
│   │   │   └── task-structure.mdx
│   │   ├── CHANGELOG.md
│   │   ├── docs.json
│   │   ├── favicon.svg
│   │   ├── getting-started
│   │   │   ├── 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
│   │   ├── 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
├── assets
│   ├── .windsurfrules
│   ├── AGENTS.md
│   ├── claude
│   │   ├── agents
│   │   │   ├── task-checker.md
│   │   │   ├── task-executor.md
│   │   │   └── task-orchestrator.md
│   │   ├── commands
│   │   │   └── tm
│   │   │       ├── add-dependency
│   │   │       │   └── add-dependency.md
│   │   │       ├── add-subtask
│   │   │       │   ├── add-subtask.md
│   │   │       │   └── convert-task-to-subtask.md
│   │   │       ├── add-task
│   │   │       │   └── add-task.md
│   │   │       ├── analyze-complexity
│   │   │       │   └── analyze-complexity.md
│   │   │       ├── clear-subtasks
│   │   │       │   ├── clear-all-subtasks.md
│   │   │       │   └── clear-subtasks.md
│   │   │       ├── complexity-report
│   │   │       │   └── complexity-report.md
│   │   │       ├── expand
│   │   │       │   ├── expand-all-tasks.md
│   │   │       │   └── expand-task.md
│   │   │       ├── fix-dependencies
│   │   │       │   └── fix-dependencies.md
│   │   │       ├── generate
│   │   │       │   └── generate-tasks.md
│   │   │       ├── help.md
│   │   │       ├── init
│   │   │       │   ├── init-project-quick.md
│   │   │       │   └── init-project.md
│   │   │       ├── learn.md
│   │   │       ├── list
│   │   │       │   ├── list-tasks-by-status.md
│   │   │       │   ├── list-tasks-with-subtasks.md
│   │   │       │   └── list-tasks.md
│   │   │       ├── models
│   │   │       │   ├── setup-models.md
│   │   │       │   └── view-models.md
│   │   │       ├── next
│   │   │       │   └── next-task.md
│   │   │       ├── parse-prd
│   │   │       │   ├── parse-prd-with-research.md
│   │   │       │   └── parse-prd.md
│   │   │       ├── remove-dependency
│   │   │       │   └── remove-dependency.md
│   │   │       ├── remove-subtask
│   │   │       │   └── remove-subtask.md
│   │   │       ├── remove-subtasks
│   │   │       │   ├── remove-all-subtasks.md
│   │   │       │   └── remove-subtasks.md
│   │   │       ├── remove-task
│   │   │       │   └── remove-task.md
│   │   │       ├── set-status
│   │   │       │   ├── to-cancelled.md
│   │   │       │   ├── to-deferred.md
│   │   │       │   ├── to-done.md
│   │   │       │   ├── to-in-progress.md
│   │   │       │   ├── to-pending.md
│   │   │       │   └── to-review.md
│   │   │       ├── setup
│   │   │       │   ├── install-taskmaster.md
│   │   │       │   └── quick-install-taskmaster.md
│   │   │       ├── show
│   │   │       │   └── show-task.md
│   │   │       ├── status
│   │   │       │   └── project-status.md
│   │   │       ├── sync-readme
│   │   │       │   └── sync-readme.md
│   │   │       ├── tm-main.md
│   │   │       ├── update
│   │   │       │   ├── update-single-task.md
│   │   │       │   ├── update-task.md
│   │   │       │   └── update-tasks-from-id.md
│   │   │       ├── utils
│   │   │       │   └── analyze-project.md
│   │   │       ├── validate-dependencies
│   │   │       │   └── validate-dependencies.md
│   │   │       └── workflows
│   │   │           ├── auto-implement-tasks.md
│   │   │           ├── command-pipeline.md
│   │   │           └── smart-workflow.md
│   │   └── TM_COMMANDS_GUIDE.md
│   ├── config.json
│   ├── env.example
│   ├── example_prd.txt
│   ├── 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.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
│   ├── CLI-COMMANDER-PATTERN.md
│   ├── command-reference.md
│   ├── configuration.md
│   ├── contributor-docs
│   │   └── testing-roo-integration.md
│   ├── cross-tag-task-movement.md
│   ├── examples
│   │   └── claude-code-usage.md
│   ├── examples.md
│   ├── licensing.md
│   ├── mcp-provider-guide.md
│   ├── mcp-provider.md
│   ├── migration-guide.md
│   ├── models.md
│   ├── providers
│   │   └── gemini-cli.md
│   ├── README.md
│   ├── scripts
│   │   └── models-json-to-markdown.js
│   ├── task-structure.md
│   └── tutorial.md
├── images
│   └── 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
│       │   │   ├── list-tasks.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
│       │   │   ├── show-task.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
│           ├── get-task.js
│           ├── get-tasks.js
│           ├── index.js
│           ├── initialize-project.js
│           ├── list-tags.js
│           ├── models.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.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
│   ├── build-config
│   │   ├── CHANGELOG.md
│   │   ├── package.json
│   │   ├── src
│   │   │   └── tsdown.base.ts
│   │   └── tsconfig.json
│   └── tm-core
│       ├── .gitignore
│       ├── CHANGELOG.md
│       ├── docs
│       │   └── listTasks-architecture.md
│       ├── package.json
│       ├── POC-STATUS.md
│       ├── README.md
│       ├── src
│       │   ├── auth
│       │   │   ├── auth-manager.test.ts
│       │   │   ├── auth-manager.ts
│       │   │   ├── config.ts
│       │   │   ├── credential-store.test.ts
│       │   │   ├── credential-store.ts
│       │   │   ├── index.ts
│       │   │   ├── oauth-service.ts
│       │   │   ├── supabase-session-storage.ts
│       │   │   └── types.ts
│       │   ├── clients
│       │   │   ├── index.ts
│       │   │   └── supabase-client.ts
│       │   ├── config
│       │   │   ├── config-manager.spec.ts
│       │   │   ├── config-manager.ts
│       │   │   ├── index.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
│       │   ├── constants
│       │   │   └── index.ts
│       │   ├── entities
│       │   │   └── task.entity.ts
│       │   ├── errors
│       │   │   ├── index.ts
│       │   │   └── task-master-error.ts
│       │   ├── executors
│       │   │   ├── base-executor.ts
│       │   │   ├── claude-executor.ts
│       │   │   ├── executor-factory.ts
│       │   │   ├── executor-service.ts
│       │   │   ├── index.ts
│       │   │   └── types.ts
│       │   ├── index.ts
│       │   ├── interfaces
│       │   │   ├── ai-provider.interface.ts
│       │   │   ├── configuration.interface.ts
│       │   │   ├── index.ts
│       │   │   └── storage.interface.ts
│       │   ├── logger
│       │   │   ├── factory.ts
│       │   │   ├── index.ts
│       │   │   └── logger.ts
│       │   ├── mappers
│       │   │   └── TaskMapper.ts
│       │   ├── parser
│       │   │   └── index.ts
│       │   ├── providers
│       │   │   ├── ai
│       │   │   │   ├── base-provider.ts
│       │   │   │   └── index.ts
│       │   │   └── index.ts
│       │   ├── repositories
│       │   │   ├── supabase-task-repository.ts
│       │   │   └── task-repository.interface.ts
│       │   ├── services
│       │   │   ├── index.ts
│       │   │   ├── organization.service.ts
│       │   │   ├── task-execution-service.ts
│       │   │   └── task-service.ts
│       │   ├── storage
│       │   │   ├── api-storage.ts
│       │   │   ├── file-storage
│       │   │   │   ├── file-operations.ts
│       │   │   │   ├── file-storage.ts
│       │   │   │   ├── format-handler.ts
│       │   │   │   ├── index.ts
│       │   │   │   └── path-resolver.ts
│       │   │   ├── index.ts
│       │   │   └── storage-factory.ts
│       │   ├── subpath-exports.test.ts
│       │   ├── task-master-core.ts
│       │   ├── types
│       │   │   ├── database.types.ts
│       │   │   ├── index.ts
│       │   │   └── legacy.ts
│       │   └── utils
│       │       ├── id-generator.ts
│       │       └── index.ts
│       ├── tests
│       │   ├── integration
│       │   │   └── list-tasks.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
│   ├── dev.js
│   ├── init.js
│   ├── modules
│   │   ├── ai-services-unified.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
├── src
│   ├── ai-providers
│   │   ├── anthropic.js
│   │   ├── azure.js
│   │   ├── base-provider.js
│   │   ├── bedrock.js
│   │   ├── claude-code.js
│   │   ├── custom-sdk
│   │   │   ├── claude-code
│   │   │   │   ├── errors.js
│   │   │   │   ├── index.js
│   │   │   │   ├── json-extractor.js
│   │   │   │   ├── language-model.js
│   │   │   │   ├── message-converter.js
│   │   │   │   └── types.js
│   │   │   └── grok-cli
│   │   │       ├── errors.js
│   │   │       ├── index.js
│   │   │       ├── json-extractor.js
│   │   │       ├── language-model.js
│   │   │       ├── message-converter.js
│   │   │       └── types.js
│   │   ├── gemini-cli.js
│   │   ├── google-vertex.js
│   │   ├── google.js
│   │   ├── grok-cli.js
│   │   ├── groq.js
│   │   ├── index.js
│   │   ├── ollama.js
│   │   ├── openai.js
│   │   ├── openrouter.js
│   │   ├── perplexity.js
│   │   └── xai.js
│   ├── constants
│   │   ├── commands.js
│   │   ├── paths.js
│   │   ├── profiles.js
│   │   ├── providers.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
│   ├── 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
│   ├── fixture
│   │   └── test-tasks.json
│   ├── fixtures
│   │   ├── .taskmasterconfig
│   │   ├── sample-claude-response.js
│   │   ├── sample-prd.txt
│   │   └── sample-tasks.js
│   ├── integration
│   │   ├── 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
│   ├── 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
│       │   ├── claude-code.test.js
│       │   ├── custom-sdk
│       │   │   └── claude-code
│       │   │       └── language-model.test.js
│       │   ├── gemini-cli.test.js
│       │   ├── mcp-components.test.js
│       │   └── openai.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
│       ├── 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
│       ├── providers
│       │   └── provider-registry.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
│       │       │   ├── move-task-cross-tag.test.js
│       │       │   ├── move-task.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
```

# Files

--------------------------------------------------------------------------------
/tests/manual/prompts/prompt-test.js:
--------------------------------------------------------------------------------

```javascript
   1 | #!/usr/bin/env node
   2 | 
   3 | /**
   4 |  * Task Master Prompt Template Testing Tool
   5 |  *
   6 |  * Interactive menu system for testing prompt templates with realistic data.
   7 |  * Tests all 8 prompt templates with multiple variants and error conditions.
   8 |  *
   9 |  * Usage:
  10 |  *   node prompt-test.js              # Interactive menu
  11 |  *   node prompt-test.js --batch      # Run all tests
  12 |  *   node prompt-test.js --full       # Run all tests with full prompts
  13 |  *   node prompt-test.js --help       # Show help
  14 |  */
  15 | 
  16 | import fs from 'fs';
  17 | import path from 'path';
  18 | import { fileURLToPath } from 'url';
  19 | import readline from 'readline';
  20 | 
  21 | // Get project root and import prompt manager
  22 | const __filename = fileURLToPath(import.meta.url);
  23 | const __dirname = path.dirname(__filename);
  24 | const projectRoot = path.resolve(__dirname, '../../..');
  25 | 
  26 | // Import prompt manager
  27 | import { getPromptManager } from '../../../scripts/modules/prompt-manager.js';
  28 | const promptManager = getPromptManager();
  29 | 
  30 | // ANSI color codes for better output formatting
  31 | const colors = {
  32 | 	reset: '\x1b[0m',
  33 | 	bright: '\x1b[1m',
  34 | 	red: '\x1b[31m',
  35 | 	green: '\x1b[32m',
  36 | 	yellow: '\x1b[33m',
  37 | 	blue: '\x1b[34m',
  38 | 	magenta: '\x1b[35m',
  39 | 	cyan: '\x1b[36m'
  40 | };
  41 | 
  42 | // Test data for all prompt templates
  43 | const sampleData = {
  44 | 	'add-task': {
  45 | 		scenarios: [
  46 | 			{
  47 | 				name: 'Basic Task Creation',
  48 | 				params: {
  49 | 					prompt: 'Implement user authentication with JWT tokens',
  50 | 					newTaskId: 15,
  51 | 					existingTasks: [
  52 | 						{ id: 1, title: 'Setup Express Server', status: 'done' },
  53 | 						{ id: 2, title: 'Setup Database Connection', status: 'done' },
  54 | 						{ id: 14, title: 'Create User Model', status: 'pending' }
  55 | 					],
  56 | 					gatheredContext:
  57 | 						'Project uses Express.js, MongoDB, and has existing user registration functionality.',
  58 | 					contextFromArgs:
  59 | 						'Use bcrypt for password hashing and jsonwebtoken library.',
  60 | 					priority: 'high',
  61 | 					dependencies: [1, 2],
  62 | 					useResearch: false
  63 | 				},
  64 | 				variants: ['default']
  65 | 			},
  66 | 			{
  67 | 				name: 'Research-Enhanced Task Creation',
  68 | 				params: {
  69 | 					prompt: 'Implement real-time chat feature with WebSockets',
  70 | 					newTaskId: 20,
  71 | 					existingTasks: [
  72 | 						{ id: 1, title: 'Setup Express Server', status: 'done' },
  73 | 						{ id: 18, title: 'User Authentication', status: 'done' }
  74 | 					],
  75 | 					gatheredContext: 'Node.js project with Socket.io already installed.',
  76 | 					priority: 'medium',
  77 | 					dependencies: [18],
  78 | 					useResearch: true
  79 | 				},
  80 | 				variants: ['research']
  81 | 			}
  82 | 		]
  83 | 	},
  84 | 	'expand-task': {
  85 | 		scenarios: [
  86 | 			{
  87 | 				name: 'Basic Task Expansion',
  88 | 				params: {
  89 | 					task: {
  90 | 						id: 8,
  91 | 						title: 'Implement User Dashboard',
  92 | 						description: 'Create a comprehensive user dashboard with analytics',
  93 | 						details:
  94 | 							'Dashboard should include user profile, activity history, and statistics.'
  95 | 					},
  96 | 					subtaskCount: 4,
  97 | 					nextSubtaskId: 1,
  98 | 					additionalContext:
  99 | 						'Use React components and Chart.js for visualizations.',
 100 | 					complexityReasoningContext: '',
 101 | 					gatheredContext:
 102 | 						'React application with existing user authentication and data models for user activities and preferences.',
 103 | 					useResearch: false
 104 | 				},
 105 | 				variants: ['default']
 106 | 			},
 107 | 			{
 108 | 				name: 'Research-Enhanced Expansion',
 109 | 				params: {
 110 | 					task: {
 111 | 						id: 12,
 112 | 						title: 'Implement Microservices Architecture',
 113 | 						description: 'Refactor monolith to microservices',
 114 | 						details:
 115 | 							'Break down existing application into independently deployable services.'
 116 | 					},
 117 | 					subtaskCount: 6,
 118 | 					nextSubtaskId: 1,
 119 | 					additionalContext:
 120 | 						'Current tech stack: Node.js, PostgreSQL, Redis. Consider Docker and Kubernetes.',
 121 | 					complexityReasoningContext:
 122 | 						'\nComplexity Analysis Reasoning: This task involves significant architectural changes requiring careful planning, service decomposition, data migration, and deployment orchestration.',
 123 | 					gatheredContext:
 124 | 						'Monolithic Express.js application with tightly coupled modules, shared database, and existing API contracts that need to be maintained during migration.',
 125 | 					useResearch: true
 126 | 				},
 127 | 				variants: ['research']
 128 | 			},
 129 | 			{
 130 | 				name: 'Complexity Report Driven',
 131 | 				params: {
 132 | 					task: {
 133 | 						id: 15,
 134 | 						title: 'Advanced Search Implementation',
 135 | 						description: 'Implement full-text search with filters and sorting',
 136 | 						details:
 137 | 							'Search should include autocomplete, faceted search, and relevance scoring.'
 138 | 					},
 139 | 					subtaskCount: 5,
 140 | 					nextSubtaskId: 1,
 141 | 					additionalContext:
 142 | 						'Existing data is in PostgreSQL. Consider Elasticsearch integration.',
 143 | 					complexityReasoningContext:
 144 | 						'\nComplexity Analysis Reasoning: High complexity due to search infrastructure requirements, indexing strategy design, query optimization needs, and performance considerations.',
 145 | 					gatheredContext:
 146 | 						'E-commerce application with product catalog, user reviews, and inventory data stored in PostgreSQL. Current simple search using LIKE queries is insufficient for growing data volume.',
 147 | 					useResearch: false,
 148 | 					expansionPrompt:
 149 | 						'Break down this complex search implementation focusing on: 1) Search infrastructure setup, 2) Indexing strategy, 3) Query optimization, 4) User interface components, 5) Performance testing and monitoring.'
 150 | 				},
 151 | 				variants: ['complexity-report']
 152 | 			}
 153 | 		]
 154 | 	},
 155 | 	'analyze-complexity': {
 156 | 		scenarios: [
 157 | 			{
 158 | 				name: 'Standard Complexity Analysis',
 159 | 				params: {
 160 | 					tasks: [
 161 | 						{
 162 | 							id: 5,
 163 | 							title: 'Implement Payment Processing',
 164 | 							description:
 165 | 								'Integrate Stripe payments with error handling and webhooks',
 166 | 							details:
 167 | 								'Need to handle multiple payment methods, subscription billing, and compliance.'
 168 | 						},
 169 | 						{
 170 | 							id: 6,
 171 | 							title: 'Add CSS Styling',
 172 | 							description: 'Style the login form',
 173 | 							details: 'Basic styling with CSS.'
 174 | 						},
 175 | 						{
 176 | 							id: 7,
 177 | 							title: 'Setup CI/CD Pipeline',
 178 | 							description: 'Configure automated testing and deployment',
 179 | 							details: 'Multi-environment deployment with Docker and AWS.'
 180 | 						}
 181 | 					],
 182 | 					gatheredContext:
 183 | 						'E-commerce project using Node.js, React, and AWS infrastructure.',
 184 | 					threshold: 6,
 185 | 					useResearch: false
 186 | 				},
 187 | 				variants: ['default']
 188 | 			},
 189 | 			{
 190 | 				name: 'Research-Enhanced Complexity Analysis',
 191 | 				params: {
 192 | 					tasks: [
 193 | 						{
 194 | 							id: 10,
 195 | 							title: 'Implement Microservices Architecture',
 196 | 							description:
 197 | 								'Refactor monolith to microservices using latest patterns',
 198 | 							details:
 199 | 								'Break down existing application into independently deployable services following current industry standards.'
 200 | 						},
 201 | 						{
 202 | 							id: 11,
 203 | 							title: 'AI-Powered Search Integration',
 204 | 							description: 'Implement semantic search with AI/ML capabilities',
 205 | 							details:
 206 | 								'Modern search implementation using vector databases and LLM integration.'
 207 | 						}
 208 | 					],
 209 | 					gatheredContext:
 210 | 						'Modern web application requiring scalable architecture and AI integration.',
 211 | 					threshold: 7,
 212 | 					useResearch: true,
 213 | 					testName: 'research'
 214 | 				},
 215 | 				variants: ['research']
 216 | 			}
 217 | 		]
 218 | 	},
 219 | 	research: {
 220 | 		scenarios: [
 221 | 			{
 222 | 				name: 'Default Research Query',
 223 | 				params: {
 224 | 					query:
 225 | 						'What are the latest trends in full-stack JavaScript development?',
 226 | 					gatheredContext:
 227 | 						'MERN stack application with microservices architecture. Looking to modernize tech stack.',
 228 | 					detailLevel: 'medium',
 229 | 					projectInfo: {
 230 | 						root: '/project',
 231 | 						taskCount: 25,
 232 | 						fileCount: 80
 233 | 					}
 234 | 				},
 235 | 				variants: ['default']
 236 | 			},
 237 | 			{
 238 | 				name: 'Low Detail Research',
 239 | 				params: {
 240 | 					query:
 241 | 						'What are the best practices for implementing JWT authentication in Node.js?',
 242 | 					gatheredContext:
 243 | 						'Express.js application with existing user registration. Using bcrypt for passwords.',
 244 | 					detailLevel: 'low',
 245 | 					projectInfo: {
 246 | 						root: '/project',
 247 | 						taskCount: 15,
 248 | 						fileCount: 45
 249 | 					}
 250 | 				},
 251 | 				variants: ['low']
 252 | 			},
 253 | 			{
 254 | 				name: 'Medium Detail Research',
 255 | 				params: {
 256 | 					query:
 257 | 						'How to implement real-time notifications in a React application?',
 258 | 					gatheredContext:
 259 | 						'React frontend with Redux state management. Backend uses Socket.io and Redis.',
 260 | 					detailLevel: 'medium',
 261 | 					projectInfo: {
 262 | 						root: '/project',
 263 | 						taskCount: 20,
 264 | 						fileCount: 67
 265 | 					}
 266 | 				},
 267 | 				variants: ['medium']
 268 | 			},
 269 | 			{
 270 | 				name: 'High Detail Research',
 271 | 				params: {
 272 | 					query: 'Best architecture patterns for microservices with Node.js?',
 273 | 					gatheredContext:
 274 | 						'Monolithic Express application being refactored. Uses PostgreSQL, Redis, and AWS infrastructure.',
 275 | 					detailLevel: 'high',
 276 | 					projectInfo: {
 277 | 						root: '/project',
 278 | 						taskCount: 35,
 279 | 						fileCount: 120
 280 | 					}
 281 | 				},
 282 | 				variants: ['high']
 283 | 			}
 284 | 		]
 285 | 	},
 286 | 	'parse-prd': {
 287 | 		scenarios: [
 288 | 			{
 289 | 				name: 'Standard PRD Parsing',
 290 | 				params: {
 291 | 					prdContent: `# Social Media Dashboard
 292 | 
 293 | ## Overview
 294 | Create a comprehensive social media management dashboard that allows users to manage multiple social platforms from a single interface.
 295 | 
 296 | ## Features
 297 | 1. Multi-platform integration (Twitter, Facebook, Instagram)
 298 | 2. Post scheduling and automation
 299 | 3. Analytics and reporting
 300 | 4. Team collaboration features
 301 | 5. Content calendar view
 302 | 
 303 | ## Technical Requirements
 304 | - React frontend with TypeScript
 305 | - Node.js backend with Express
 306 | - PostgreSQL database
 307 | - Redis for caching
 308 | - AWS deployment
 309 | 
 310 | ## Success Metrics
 311 | - Support for 3 social platforms
 312 | - Handle 10,000+ scheduled posts
 313 | - 99.9% uptime requirement`,
 314 | 					numTasks: 8,
 315 | 					nextId: 1,
 316 | 					prdPath: 'social-media-dashboard-prd.txt',
 317 | 					defaultTaskPriority: 'medium',
 318 | 					research: false
 319 | 				},
 320 | 				variants: ['default']
 321 | 			},
 322 | 			{
 323 | 				name: 'Research-Enhanced PRD Parsing',
 324 | 				params: {
 325 | 					prdContent: `# AI-Powered E-commerce Platform
 326 | 
 327 | ## Overview
 328 | Build a next-generation e-commerce platform with AI-driven recommendations, voice search, and predictive analytics.
 329 | 
 330 | ## Core Features
 331 | 1. AI product recommendations using machine learning
 332 | 2. Voice search integration with natural language processing
 333 | 3. Predictive inventory management
 334 | 4. Real-time fraud detection
 335 | 5. Automated customer service chatbot
 336 | 
 337 | ## Technical Requirements
 338 | - Modern JavaScript framework (latest best practices)
 339 | - Cloud-native architecture with microservices
 340 | - AI/ML integration for recommendations and analytics
 341 | - Real-time data processing pipeline
 342 | - Enterprise-grade security and compliance
 343 | 
 344 | ## Performance Goals
 345 | - Sub-200ms API response times
 346 | - Support for 1M+ concurrent users
 347 | - 99.99% uptime SLA
 348 | - Global CDN distribution`,
 349 | 					numTasks: 10,
 350 | 					nextId: 1,
 351 | 					prdPath: 'ai-ecommerce-prd.txt',
 352 | 					defaultTaskPriority: 'high',
 353 | 					research: true
 354 | 				},
 355 | 				variants: ['research']
 356 | 			}
 357 | 		]
 358 | 	},
 359 | 	'update-subtask': {
 360 | 		scenarios: [
 361 | 			{
 362 | 				name: 'Implementation Progress Update',
 363 | 				params: {
 364 | 					parentTask: {
 365 | 						id: 8,
 366 | 						title: 'Implement User Authentication',
 367 | 						description: 'Build complete authentication system with JWT',
 368 | 						status: 'in-progress'
 369 | 					},
 370 | 					currentDetails:
 371 | 						'Implement JWT authentication middleware with token validation and refresh capabilities.',
 372 | 					updatePrompt:
 373 | 						'Made significant progress on the authentication middleware. Successfully implemented JWT token validation and user session management. Encountered issue with token refresh mechanism - tokens were expiring too quickly. Modified the refresh logic to use sliding expiration. All tests are now passing.',
 374 | 					useResearch: false,
 375 | 					gatheredContext:
 376 | 						'Project uses Express.js and MongoDB for user data storage.'
 377 | 				},
 378 | 				variants: ['default']
 379 | 			},
 380 | 			{
 381 | 				name: 'Research-Enhanced Update',
 382 | 				params: {
 383 | 					parentTask: {
 384 | 						id: 12,
 385 | 						title: 'Implement OAuth Integration',
 386 | 						description: 'Add OAuth 2.0 support for third-party login',
 387 | 						status: 'in-progress'
 388 | 					},
 389 | 					currentDetails:
 390 | 						'Implement OAuth 2.0 authentication flow with proper security measures.',
 391 | 					updatePrompt:
 392 | 						'Researched latest OAuth 2.0 security best practices. Found vulnerability in current implementation regarding PKCE. Need to implement state parameter validation and secure code exchange. Updated implementation to follow RFC 7636 recommendations.',
 393 | 					useResearch: true,
 394 | 					gatheredContext:
 395 | 						'Security is critical for this project. Need to follow industry standards.'
 396 | 				},
 397 | 				variants: ['research']
 398 | 			}
 399 | 		]
 400 | 	},
 401 | 	'update-task': {
 402 | 		scenarios: [
 403 | 			{
 404 | 				name: 'Task Details Update',
 405 | 				params: {
 406 | 					task: {
 407 | 						id: 10,
 408 | 						title: 'Implement Payment Processing',
 409 | 						description: 'Integrate Stripe payment processing',
 410 | 						details: 'Basic Stripe integration with credit card processing.',
 411 | 						status: 'pending'
 412 | 					},
 413 | 					taskJson:
 414 | 						'{"id": 10, "title": "Implement Payment Processing", "description": "Integrate Stripe payment processing", "details": "Basic Stripe integration with credit card processing.", "status": "pending", "dependencies": [], "priority": "high"}',
 415 | 					updatePrompt:
 416 | 						'After reviewing the current codebase, the payment integration needs to support additional payment methods beyond Stripe. Add support for PayPal and Apple Pay. Also need to implement webhook security validation and transaction logging for compliance.',
 417 | 					useResearch: false,
 418 | 					gatheredContext:
 419 | 						'E-commerce platform with existing user accounts and shopping cart functionality.'
 420 | 				},
 421 | 				variants: ['default']
 422 | 			},
 423 | 			{
 424 | 				name: 'Append Mode Update',
 425 | 				params: {
 426 | 					task: {
 427 | 						id: 15,
 428 | 						title: 'Database Migration System',
 429 | 						description: 'Implement automated database schema migrations',
 430 | 						details:
 431 | 							'Create migration scripts for PostgreSQL schema updates with rollback capabilities.',
 432 | 						status: 'in-progress'
 433 | 					},
 434 | 					taskJson:
 435 | 						'{"id": 15, "title": "Database Migration System", "description": "Implement automated database schema migrations", "details": "Create migration scripts for PostgreSQL schema updates with rollback capabilities.", "status": "in-progress", "dependencies": [], "priority": "high"}',
 436 | 					currentDetails:
 437 | 						'Create migration scripts for PostgreSQL schema updates with rollback capabilities.',
 438 | 					updatePrompt:
 439 | 						'Discovered additional requirement for zero-downtime migrations. Research shows we need to implement blue-green deployment strategy with gradual schema changes. Added connection pooling considerations and automated testing for migration validation.',
 440 | 					appendMode: true,
 441 | 					useResearch: false,
 442 | 					gatheredContext:
 443 | 						'Production database with strict uptime requirements and high transaction volume.'
 444 | 				},
 445 | 				variants: ['append']
 446 | 			},
 447 | 			{
 448 | 				name: 'Research-Enhanced Task Update',
 449 | 				params: {
 450 | 					task: {
 451 | 						id: 12,
 452 | 						title: 'Payment Security Compliance',
 453 | 						description: 'Ensure payment processing meets security standards',
 454 | 						details:
 455 | 							'Implement basic security measures for payment processing.',
 456 | 						status: 'in-progress'
 457 | 					},
 458 | 					taskJson:
 459 | 						'{"id": 12, "title": "Payment Security Compliance", "description": "Ensure payment processing meets security standards", "details": "Implement basic security measures for payment processing.", "status": "in-progress", "dependencies": [10], "priority": "high"}',
 460 | 					updatePrompt:
 461 | 						'Need to incorporate latest PCI DSS 4.0 compliance requirements and implement Strong Customer Authentication (SCA) for European markets. Research shows new requirements for biometric authentication and dynamic linking.',
 462 | 					useResearch: true,
 463 | 					gatheredContext:
 464 | 						'Security compliance is critical for international payment processing.'
 465 | 				},
 466 | 				variants: ['research']
 467 | 			}
 468 | 		]
 469 | 	},
 470 | 	'update-tasks': {
 471 | 		scenarios: [
 472 | 			{
 473 | 				name: 'Bulk Task Updates',
 474 | 				params: {
 475 | 					tasks: [
 476 | 						{
 477 | 							id: 5,
 478 | 							title: 'User API Endpoints',
 479 | 							description: 'Create REST endpoints for user operations',
 480 | 							status: 'pending',
 481 | 							dependencies: [],
 482 | 							priority: 'high'
 483 | 						},
 484 | 						{
 485 | 							id: 6,
 486 | 							title: 'Product API Integration',
 487 | 							description: 'Integrate with product REST API',
 488 | 							status: 'in-progress',
 489 | 							dependencies: [5],
 490 | 							priority: 'medium'
 491 | 						},
 492 | 						{
 493 | 							id: 7,
 494 | 							title: 'Authentication API',
 495 | 							description: 'Implement REST-based auth API',
 496 | 							status: 'pending',
 497 | 							dependencies: [],
 498 | 							priority: 'high'
 499 | 						}
 500 | 					],
 501 | 					updatePrompt:
 502 | 						'Migration from REST API to GraphQL. All API-related tasks need to be updated to use GraphQL schemas, resolvers, and Apollo Client instead of traditional REST endpoints.',
 503 | 					useResearch: false,
 504 | 					projectContext:
 505 | 						'Full-stack application migrating from REST to GraphQL for better data fetching.'
 506 | 				},
 507 | 				variants: ['default']
 508 | 			}
 509 | 		]
 510 | 	}
 511 | };
 512 | 
 513 | // Interactive menu system
 514 | class PromptTestMenu {
 515 | 	constructor() {
 516 | 		this.rl = readline.createInterface({
 517 | 			input: process.stdin,
 518 | 			output: process.stdout
 519 | 		});
 520 | 		this.promptManager = getPromptManager();
 521 | 		this.showFullPrompts = true;
 522 | 	}
 523 | 
 524 | 	async start() {
 525 | 		console.log(
 526 | 			`${colors.cyan}${colors.bright}=== Task Master Prompt Template Testing Menu ===${colors.reset}\n`
 527 | 		);
 528 | 		await this.showMainMenu();
 529 | 	}
 530 | 
 531 | 	async showMainMenu() {
 532 | 		console.clear();
 533 | 		console.log(
 534 | 			`${colors.cyan}=== Task Master Prompt Template Testing Menu ===${colors.reset}\n`
 535 | 		);
 536 | 
 537 | 		console.log('Main Menu:');
 538 | 		console.log('  1. Test specific prompt template');
 539 | 		console.log('  2. Run all tests');
 540 | 		console.log(
 541 | 			`  3. Toggle full prompt display (currently: ${this.showFullPrompts ? 'ON' : 'OFF'})`
 542 | 		);
 543 | 		console.log('  4. Generate HTML report');
 544 | 		console.log('  5. Exit');
 545 | 
 546 | 		const choice = await this.getInput('\nSelect an option (1-5): ');
 547 | 
 548 | 		switch (choice) {
 549 | 			case '1':
 550 | 				await this.showTemplateMenu();
 551 | 				break;
 552 | 			case '2':
 553 | 				await this.runAllTests();
 554 | 				break;
 555 | 			case '3':
 556 | 				this.showFullPrompts = !this.showFullPrompts;
 557 | 				console.log(
 558 | 					`${colors.green}Full prompt display ${this.showFullPrompts ? 'enabled' : 'disabled'}${colors.reset}`
 559 | 				);
 560 | 				await this.waitForEnter();
 561 | 				await this.showMainMenu();
 562 | 				break;
 563 | 			case '4':
 564 | 				await this.generateHTMLReport();
 565 | 				break;
 566 | 			case '5':
 567 | 				console.log('Goodbye!');
 568 | 				this.rl.close();
 569 | 				return;
 570 | 			default:
 571 | 				console.log(
 572 | 					`${colors.red}Invalid option. Please try again.${colors.reset}`
 573 | 				);
 574 | 				await this.waitForEnter();
 575 | 				await this.showMainMenu();
 576 | 		}
 577 | 	}
 578 | 
 579 | 	async showTemplateMenu() {
 580 | 		const templates = [
 581 | 			{ key: 'add-task', name: 'Add Task', variants: ['default', 'research'] },
 582 | 			{
 583 | 				key: 'expand-task',
 584 | 				name: 'Expand Task',
 585 | 				variants: ['default', 'research', 'complexity-report']
 586 | 			},
 587 | 			{
 588 | 				key: 'analyze-complexity',
 589 | 				name: 'Analyze Complexity',
 590 | 				variants: ['default', 'research']
 591 | 			},
 592 | 			{
 593 | 				key: 'research',
 594 | 				name: 'Research',
 595 | 				variants: ['default', 'low', 'medium', 'high']
 596 | 			},
 597 | 			{
 598 | 				key: 'parse-prd',
 599 | 				name: 'Parse PRD',
 600 | 				variants: ['default', 'research']
 601 | 			},
 602 | 			{
 603 | 				key: 'update-subtask',
 604 | 				name: 'Update Subtask',
 605 | 				variants: ['default', 'research']
 606 | 			},
 607 | 			{
 608 | 				key: 'update-task',
 609 | 				name: 'Update Task',
 610 | 				variants: ['default', 'append', 'research']
 611 | 			},
 612 | 			{
 613 | 				key: 'update-tasks',
 614 | 				name: 'Update Tasks',
 615 | 				variants: ['default']
 616 | 			}
 617 | 		];
 618 | 
 619 | 		console.log(
 620 | 			`${colors.bright}Select a prompt template to test:${colors.reset}`
 621 | 		);
 622 | 		templates.forEach((template, index) => {
 623 | 			console.log(
 624 | 				`  ${index + 1}. ${template.name} (${template.variants.join(', ')})`
 625 | 			);
 626 | 		});
 627 | 		console.log(`  ${templates.length + 1}. Back to main menu`);
 628 | 		console.log();
 629 | 
 630 | 		const choice = await this.prompt(
 631 | 			`Select template (1-${templates.length + 1}): `
 632 | 		);
 633 | 		const choiceNum = parseInt(choice.trim());
 634 | 
 635 | 		if (choiceNum >= 1 && choiceNum <= templates.length) {
 636 | 			const selectedTemplate = templates[choiceNum - 1];
 637 | 			await this.showVariantMenu(selectedTemplate);
 638 | 		} else if (choiceNum === templates.length + 1) {
 639 | 			await this.showMainMenu();
 640 | 		} else {
 641 | 			console.log(
 642 | 				`${colors.red}Invalid option. Please try again.${colors.reset}\n`
 643 | 			);
 644 | 			await this.showTemplateMenu();
 645 | 		}
 646 | 	}
 647 | 
 648 | 	async showVariantMenu(template) {
 649 | 		console.log(
 650 | 			`${colors.bright}${template.name} - Select variant:${colors.reset}`
 651 | 		);
 652 | 		template.variants.forEach((variant, index) => {
 653 | 			console.log(`  ${index + 1}. ${variant}`);
 654 | 		});
 655 | 		console.log(`  ${template.variants.length + 1}. Test all variants`);
 656 | 		console.log(`  ${template.variants.length + 2}. Back to template menu`);
 657 | 		console.log();
 658 | 
 659 | 		const choice = await this.prompt(
 660 | 			`Select variant (1-${template.variants.length + 2}): `
 661 | 		);
 662 | 		const choiceNum = parseInt(choice.trim());
 663 | 
 664 | 		if (choiceNum >= 1 && choiceNum <= template.variants.length) {
 665 | 			const selectedVariant = template.variants[choiceNum - 1];
 666 | 			await this.runSingleTest(template.key, selectedVariant);
 667 | 		} else if (choiceNum === template.variants.length + 1) {
 668 | 			console.log(
 669 | 				`${colors.cyan}Testing all variants for ${template.name}...${colors.reset}\n`
 670 | 			);
 671 | 			for (const variant of template.variants) {
 672 | 				await this.runSingleTest(template.key, variant);
 673 | 				console.log(); // Extra spacing between variants
 674 | 			}
 675 | 		} else if (choiceNum === template.variants.length + 2) {
 676 | 			await this.showTemplateMenu();
 677 | 		} else {
 678 | 			console.log(
 679 | 				`${colors.red}Invalid option. Please try again.${colors.reset}\n`
 680 | 			);
 681 | 			await this.showVariantMenu(template);
 682 | 		}
 683 | 
 684 | 		// After running test(s), show options to continue
 685 | 		await this.showPostTestMenu(template);
 686 | 	}
 687 | 
 688 | 	async showPostTestMenu(template) {
 689 | 		console.log(
 690 | 			`${colors.bright}What would you like to do next?${colors.reset}`
 691 | 		);
 692 | 		console.log('  1. Test another variant of this template');
 693 | 		console.log('  2. Choose a different template');
 694 | 		console.log('  3. Back to main menu');
 695 | 		console.log();
 696 | 
 697 | 		const choice = await this.prompt('Select option (1-3): ');
 698 | 
 699 | 		switch (choice.trim()) {
 700 | 			case '1':
 701 | 				await this.showVariantMenu(template);
 702 | 				break;
 703 | 			case '2':
 704 | 				await this.showTemplateMenu();
 705 | 				break;
 706 | 			case '3':
 707 | 				await this.showMainMenu();
 708 | 				break;
 709 | 			default:
 710 | 				console.log(
 711 | 					`${colors.red}Invalid option. Please try again.${colors.reset}\n`
 712 | 				);
 713 | 				await this.showPostTestMenu(template);
 714 | 		}
 715 | 	}
 716 | 
 717 | 	async runSingleTest(templateKey, variant) {
 718 | 		console.log(
 719 | 			`${colors.magenta}${colors.bright}Testing ${templateKey} - ${variant} variant${colors.reset}`
 720 | 		);
 721 | 		console.log('='.repeat(60));
 722 | 
 723 | 		try {
 724 | 			// Handle special research mode variants
 725 | 			let actualVariant = variant;
 726 | 			let useResearch = false;
 727 | 			let research = false;
 728 | 			let detailLevel = null;
 729 | 			if (
 730 | 				(templateKey === 'add-task' ||
 731 | 					templateKey === 'analyze-complexity' ||
 732 | 					templateKey === 'update-subtask' ||
 733 | 					templateKey === 'update-task' ||
 734 | 					templateKey === 'update-tasks') &&
 735 | 				variant === 'research'
 736 | 			) {
 737 | 				actualVariant = 'default';
 738 | 				useResearch = true;
 739 | 			}
 740 | 			if (templateKey === 'parse-prd' && variant === 'research') {
 741 | 				actualVariant = 'default';
 742 | 				research = true;
 743 | 			}
 744 | 			if (
 745 | 				templateKey === 'research' &&
 746 | 				['low', 'medium', 'high'].includes(variant)
 747 | 			) {
 748 | 				actualVariant = 'default';
 749 | 				detailLevel = variant;
 750 | 			}
 751 | 
 752 | 			const testData = getTestDataForTemplate(templateKey, actualVariant);
 753 | 
 754 | 			// Override useResearch, research, or detailLevel if needed
 755 | 			if (useResearch) {
 756 | 				testData.params.useResearch = true;
 757 | 			}
 758 | 			if (research) {
 759 | 				testData.params.research = true;
 760 | 			}
 761 | 			if (detailLevel) {
 762 | 				testData.params.detailLevel = detailLevel;
 763 | 			}
 764 | 
 765 | 			const result = await this.promptManager.loadPrompt(
 766 | 				templateKey,
 767 | 				testData.params,
 768 | 				templateVariant
 769 | 			);
 770 | 
 771 | 			console.log(
 772 | 				`${colors.green}✓ SUCCESS${colors.reset} - Template loaded and processed successfully`
 773 | 			);
 774 | 			console.log(`${colors.bright}Parameters used:${colors.reset}`);
 775 | 			console.log(JSON.stringify(testData.params, null, 2));
 776 | 
 777 | 			if (this.showFullPrompts) {
 778 | 				console.log(`\n${colors.bright}System Prompt:${colors.reset}`);
 779 | 				console.log('-'.repeat(40));
 780 | 				console.log(result.systemPrompt);
 781 | 
 782 | 				console.log(`\n${colors.bright}User Prompt:${colors.reset}`);
 783 | 				console.log('-'.repeat(40));
 784 | 				console.log(result.userPrompt);
 785 | 			} else {
 786 | 				console.log(`\n${colors.bright}System Prompt Preview:${colors.reset}`);
 787 | 				console.log(result.systemPrompt.substring(0, 200) + '...');
 788 | 
 789 | 				console.log(`\n${colors.bright}User Prompt Preview:${colors.reset}`);
 790 | 				console.log(result.userPrompt.substring(0, 200) + '...');
 791 | 
 792 | 				console.log(
 793 | 					`\n${colors.yellow}Tip: Use option 3 in main menu to toggle full prompt display${colors.reset}`
 794 | 				);
 795 | 			}
 796 | 		} catch (error) {
 797 | 			console.log(`${colors.red}✗ FAILED${colors.reset} - ${error.message}`);
 798 | 			if (error.stack) {
 799 | 				console.log(`${colors.red}Stack trace:${colors.reset}`);
 800 | 				console.log(error.stack);
 801 | 			}
 802 | 		}
 803 | 
 804 | 		console.log('='.repeat(60));
 805 | 	}
 806 | 
 807 | 	async runAllTests() {
 808 | 		console.log(
 809 | 			`${colors.cyan}Running all comprehensive tests...${colors.reset}\n`
 810 | 		);
 811 | 
 812 | 		const results = await runComprehensiveTests(true);
 813 | 
 814 | 		console.log(`\n${colors.bright}Test Results Summary:${colors.reset}`);
 815 | 		console.log(`Total tests: ${results.total}`);
 816 | 		console.log(`Passed: ${colors.green}${results.passed}${colors.reset}`);
 817 | 		console.log(`Failed: ${colors.red}${results.failed}${colors.reset}`);
 818 | 
 819 | 		if (results.failedTests.length > 0) {
 820 | 			console.log(`\n${colors.red}Failed tests:${colors.reset}`);
 821 | 			results.failedTests.forEach((test) => {
 822 | 				console.log(`  - ${test.template} (${test.variant}): ${test.error}`);
 823 | 			});
 824 | 		}
 825 | 
 826 | 		console.log();
 827 | 		await this.prompt('Press Enter to continue...');
 828 | 		await this.showMainMenu();
 829 | 	}
 830 | 
 831 | 	prompt(question) {
 832 | 		return new Promise((resolve) => {
 833 | 			this.rl.question(question, resolve);
 834 | 		});
 835 | 	}
 836 | 
 837 | 	async getInput(question) {
 838 | 		const answer = await this.prompt(question);
 839 | 		return answer.trim();
 840 | 	}
 841 | 
 842 | 	async waitForEnter() {
 843 | 		await this.prompt('Press Enter to continue...');
 844 | 	}
 845 | 
 846 | 	async generateHTMLReport() {
 847 | 		const { filepath, results } = await generateAndSaveHTMLReport();
 848 | 		await this.waitForEnter();
 849 | 		await this.showMainMenu();
 850 | 	}
 851 | }
 852 | 
 853 | // Helper function to get test data for a specific template and variant
 854 | function getTestDataForTemplate(templateKey, variant) {
 855 | 	if (!sampleData[templateKey] || !sampleData[templateKey].scenarios) {
 856 | 		return { name: 'Unknown Template', params: {} };
 857 | 	}
 858 | 
 859 | 	// Find appropriate scenario for this variant
 860 | 	const scenario = sampleData[templateKey].scenarios.find((s) =>
 861 | 		s.variants.includes(variant)
 862 | 	);
 863 | 
 864 | 	// If no scenario found for this variant, use the first scenario but mark it as a test case
 865 | 	if (!scenario) {
 866 | 		const firstScenario = sampleData[templateKey].scenarios[0];
 867 | 		if (!firstScenario) {
 868 | 			return { name: 'No Scenarios', params: {} };
 869 | 		}
 870 | 		return {
 871 | 			name: `${firstScenario.name} (variant test)`,
 872 | 			params: firstScenario.params
 873 | 		};
 874 | 	}
 875 | 
 876 | 	return {
 877 | 		name: scenario.name,
 878 | 		params: scenario.params
 879 | 	};
 880 | }
 881 | 
 882 | // Run all comprehensive tests
 883 | async function runComprehensiveTests(generateDetailed = false) {
 884 | 	console.log('Task Master Prompt Template Comprehensive Test');
 885 | 	console.log('=============================================\n');
 886 | 
 887 | 	let passed = 0;
 888 | 	let failed = 0;
 889 | 	const failedTests = [];
 890 | 	const detailedResults = [];
 891 | 
 892 | 	// Test all combinations
 893 | 	const testCases = [
 894 | 		{ template: 'add-task', variant: 'default' },
 895 | 		{
 896 | 			template: 'add-task',
 897 | 			variant: 'default',
 898 | 			useResearch: true,
 899 | 			testName: 'research'
 900 | 		},
 901 | 		{ template: 'expand-task', variant: 'default' },
 902 | 		{ template: 'expand-task', variant: 'research' },
 903 | 		{ template: 'expand-task', variant: 'complexity-report' },
 904 | 		{ template: 'analyze-complexity', variant: 'default' },
 905 | 		{
 906 | 			template: 'analyze-complexity',
 907 | 			variant: 'default',
 908 | 			useResearch: true,
 909 | 			testName: 'research'
 910 | 		},
 911 | 		{
 912 | 			template: 'research',
 913 | 			variant: 'default',
 914 | 			detailLevel: 'low',
 915 | 			testName: 'low'
 916 | 		},
 917 | 		{
 918 | 			template: 'research',
 919 | 			variant: 'default',
 920 | 			detailLevel: 'medium',
 921 | 			testName: 'medium'
 922 | 		},
 923 | 		{
 924 | 			template: 'research',
 925 | 			variant: 'default',
 926 | 			detailLevel: 'high',
 927 | 			testName: 'high'
 928 | 		},
 929 | 		{ template: 'parse-prd', variant: 'default' },
 930 | 		{
 931 | 			template: 'parse-prd',
 932 | 			variant: 'default',
 933 | 			research: true,
 934 | 			testName: 'research'
 935 | 		},
 936 | 		{ template: 'update-subtask', variant: 'default' },
 937 | 		{
 938 | 			template: 'update-subtask',
 939 | 			variant: 'default',
 940 | 			useResearch: true,
 941 | 			testName: 'research'
 942 | 		},
 943 | 		{ template: 'update-task', variant: 'default' },
 944 | 		{ template: 'update-task', variant: 'append' },
 945 | 		{
 946 | 			template: 'update-task',
 947 | 			variant: 'default',
 948 | 			useResearch: true,
 949 | 			testName: 'research'
 950 | 		},
 951 | 		{ template: 'update-tasks', variant: 'default' },
 952 | 
 953 | 		// Conditional logic tests for new helper functions
 954 | 		{
 955 | 			template: 'parse-prd',
 956 | 			variant: 'default',
 957 | 			customData: {
 958 | 				name: 'Test Zero Tasks Conditional Logic',
 959 | 				params: {
 960 | 					prdContent: 'Test PRD content for zero tasks validation',
 961 | 					numTasks: 0,
 962 | 					nextId: 1,
 963 | 					prdPath: 'test-zero-tasks.txt',
 964 | 					defaultTaskPriority: 'medium',
 965 | 					research: false
 966 | 				}
 967 | 			},
 968 | 			testName: 'conditional-zero-tasks',
 969 | 			validateOutput: (result) => {
 970 | 				return (
 971 | 					result.systemPrompt.includes('an appropriate number of') &&
 972 | 					!result.systemPrompt.includes('approximately 0')
 973 | 				);
 974 | 			}
 975 | 		},
 976 | 		{
 977 | 			template: 'expand-task',
 978 | 			variant: 'default',
 979 | 			customData: {
 980 | 				name: 'Test Zero Subtasks Conditional Logic',
 981 | 				params: {
 982 | 					task: {
 983 | 						id: 99,
 984 | 						title: 'Test Zero Subtasks Conditional',
 985 | 						description: 'Test conditional logic with zero subtasks',
 986 | 						details: 'Testing gt helper with zero value'
 987 | 					},
 988 | 					subtaskCount: 0,
 989 | 					nextSubtaskId: 1,
 990 | 					additionalContext: 'Testing conditional logic',
 991 | 					complexityReasoningContext: '',
 992 | 					gatheredContext: 'Test context'
 993 | 				}
 994 | 			},
 995 | 			testName: 'conditional-zero-subtasks',
 996 | 			validateOutput: (result) => {
 997 | 				return (
 998 | 					result.systemPrompt.includes('an appropriate number of') &&
 999 | 					!result.systemPrompt.includes('0 specific subtasks')
1000 | 				);
1001 | 			}
1002 | 		},
1003 | 		{
1004 | 			template: 'parse-prd',
1005 | 			variant: 'default',
1006 | 			customData: {
1007 | 				name: 'Test Positive Tasks Conditional Logic',
1008 | 				params: {
1009 | 					prdContent: 'Test PRD content for positive tasks validation',
1010 | 					numTasks: 5,
1011 | 					nextId: 1,
1012 | 					prdPath: 'test-positive-tasks.txt',
1013 | 					defaultTaskPriority: 'medium',
1014 | 					research: false
1015 | 				}
1016 | 			},
1017 | 			testName: 'conditional-positive-tasks',
1018 | 			validateOutput: (result) => {
1019 | 				return (
1020 | 					result.systemPrompt.includes('approximately 5') &&
1021 | 					!result.systemPrompt.includes('an appropriate number of')
1022 | 				);
1023 | 			}
1024 | 		},
1025 | 		{
1026 | 			template: 'expand-task',
1027 | 			variant: 'default',
1028 | 			customData: {
1029 | 				name: 'Test Positive Subtasks Conditional Logic',
1030 | 				params: {
1031 | 					task: {
1032 | 						id: 98,
1033 | 						title: 'Test Positive Subtasks Conditional',
1034 | 						description: 'Test conditional logic with positive subtasks',
1035 | 						details: 'Testing gt helper with positive value'
1036 | 					},
1037 | 					subtaskCount: 3,
1038 | 					nextSubtaskId: 1,
1039 | 					additionalContext: 'Testing conditional logic',
1040 | 					complexityReasoningContext: '',
1041 | 					gatheredContext: 'Test context'
1042 | 				}
1043 | 			},
1044 | 			testName: 'conditional-positive-subtasks',
1045 | 			validateOutput: (result) => {
1046 | 				return (
1047 | 					result.systemPrompt.includes('3 specific subtasks') &&
1048 | 					!result.systemPrompt.includes('an appropriate number of')
1049 | 				);
1050 | 			}
1051 | 		},
1052 | 
1053 | 		// Error condition tests
1054 | 		{ template: 'expand-task', variant: 'nonexistent', expectError: true },
1055 | 		{ template: 'nonexistent-template', variant: 'default', expectError: true },
1056 | 		{
1057 | 			template: 'parse-prd',
1058 | 			variant: 'default',
1059 | 			params: {},
1060 | 			expectError: true
1061 | 		},
1062 | 		{
1063 | 			template: 'add-task',
1064 | 			variant: 'default',
1065 | 			params: { prompt: '' },
1066 | 			expectError: true
1067 | 		},
1068 | 		{
1069 | 			template: 'research',
1070 | 			variant: 'default',
1071 | 			detailLevel: 'invalid-detail',
1072 | 			expectError: true,
1073 | 			testName: 'invalid-detail'
1074 | 		}
1075 | 	];
1076 | 
1077 | 	for (const testCase of testCases) {
1078 | 		try {
1079 | 			// Handle variant conversion for comprehensive tests
1080 | 			let scenarioVariant = testCase.variant;
1081 | 			let templateVariant = testCase.variant;
1082 | 
1083 | 			// For templates using detail levels, convert to default with detailLevel param
1084 | 			if (
1085 | 				testCase.template === 'research' &&
1086 | 				['low', 'medium', 'high'].includes(testCase.variant)
1087 | 			) {
1088 | 				templateVariant = 'default';
1089 | 			}
1090 | 
1091 | 			// For consolidated templates, convert research variant to default for template loading only
1092 | 			if (
1093 | 				(testCase.template === 'add-task' ||
1094 | 					testCase.template === 'analyze-complexity' ||
1095 | 					testCase.template === 'update-subtask' ||
1096 | 					testCase.template === 'update-task' ||
1097 | 					testCase.template === 'parse-prd') &&
1098 | 				testCase.variant === 'research'
1099 | 			) {
1100 | 				templateVariant = 'default';
1101 | 			}
1102 | 
1103 | 			// Get test data using scenario variant (research scenarios will be found correctly)
1104 | 			const testData =
1105 | 				testCase.customData ||
1106 | 				(testCase.params
1107 | 					? { name: 'Custom Test Data', params: testCase.params }
1108 | 					: null) ||
1109 | 				getTestDataForTemplate(testCase.template, scenarioVariant);
1110 | 
1111 | 			// Override test data with custom parameters if specified
1112 | 			if (testCase.useResearch !== undefined) {
1113 | 				testData.params.useResearch = testCase.useResearch;
1114 | 			}
1115 | 			if (testCase.research !== undefined) {
1116 | 				testData.params.research = testCase.research;
1117 | 			}
1118 | 			if (testCase.detailLevel !== undefined) {
1119 | 				testData.params.detailLevel = testCase.detailLevel;
1120 | 			}
1121 | 
1122 | 			const result = await promptManager.loadPrompt(
1123 | 				testCase.template,
1124 | 				testData.params,
1125 | 				templateVariant
1126 | 			);
1127 | 
1128 | 			const displayName = testCase.testName || testCase.variant;
1129 | 
1130 | 			if (testCase.expectError) {
1131 | 				console.log(
1132 | 					`✗ FAILED - ${testCase.template} (${displayName}): Expected error but test passed`
1133 | 				);
1134 | 				failedTests.push({
1135 | 					template: testCase.template,
1136 | 					variant: displayName,
1137 | 					error: 'Expected error but test passed'
1138 | 				});
1139 | 				failed++;
1140 | 
1141 | 				if (generateDetailed) {
1142 | 					detailedResults.push({
1143 | 						template: testCase.template,
1144 | 						variant: displayName,
1145 | 						success: false,
1146 | 						expectedError: true,
1147 | 						error: 'Expected error but test passed'
1148 | 					});
1149 | 				}
1150 | 			} else {
1151 | 				// Check output validation if provided
1152 | 				let validationPassed = true;
1153 | 				let validationError = null;
1154 | 
1155 | 				if (testCase.validateOutput) {
1156 | 					try {
1157 | 						validationPassed = testCase.validateOutput(result);
1158 | 						if (!validationPassed) {
1159 | 							validationError =
1160 | 								'Output validation failed - conditional logic did not produce expected content';
1161 | 						}
1162 | 					} catch (error) {
1163 | 						validationPassed = false;
1164 | 						validationError = `Output validation error: ${error.message}`;
1165 | 					}
1166 | 				}
1167 | 
1168 | 				if (validationPassed) {
1169 | 					console.log(`✓ PASSED - ${testCase.template} (${displayName})`);
1170 | 					passed++;
1171 | 
1172 | 					if (generateDetailed) {
1173 | 						detailedResults.push({
1174 | 							template: testCase.template,
1175 | 							variant: displayName,
1176 | 							success: true,
1177 | 							prompts: {
1178 | 								systemPrompt: result.systemPrompt,
1179 | 								userPrompt: result.userPrompt
1180 | 							}
1181 | 						});
1182 | 					}
1183 | 				} else {
1184 | 					console.log(
1185 | 						`✗ FAILED - ${testCase.template} (${displayName}): ${validationError}`
1186 | 					);
1187 | 					failedTests.push({
1188 | 						template: testCase.template,
1189 | 						variant: displayName,
1190 | 						error: validationError
1191 | 					});
1192 | 					failed++;
1193 | 
1194 | 					if (generateDetailed) {
1195 | 						detailedResults.push({
1196 | 							template: testCase.template,
1197 | 							variant: displayName,
1198 | 							success: false,
1199 | 							error: validationError,
1200 | 							prompts: {
1201 | 								systemPrompt: result.systemPrompt,
1202 | 								userPrompt: result.userPrompt
1203 | 							}
1204 | 						});
1205 | 					}
1206 | 				}
1207 | 			}
1208 | 		} catch (error) {
1209 | 			const displayName = testCase.testName || testCase.variant;
1210 | 
1211 | 			if (testCase.expectError) {
1212 | 				console.log(
1213 | 					`✓ PASSED - ${testCase.template} (${displayName}): Expected error occurred`
1214 | 				);
1215 | 				passed++;
1216 | 
1217 | 				if (generateDetailed) {
1218 | 					detailedResults.push({
1219 | 						template: testCase.template,
1220 | 						variant: displayName,
1221 | 						success: true,
1222 | 						expectedError: true,
1223 | 						error: error.message
1224 | 					});
1225 | 				}
1226 | 			} else {
1227 | 				console.log(
1228 | 					`✗ FAILED - ${testCase.template} (${displayName}): ${error.message}`
1229 | 				);
1230 | 				failedTests.push({
1231 | 					template: testCase.template,
1232 | 					variant: displayName,
1233 | 					error: error.message
1234 | 				});
1235 | 				failed++;
1236 | 
1237 | 				if (generateDetailed) {
1238 | 					detailedResults.push({
1239 | 						template: testCase.template,
1240 | 						variant: displayName,
1241 | 						success: false,
1242 | 						error: error.message
1243 | 					});
1244 | 				}
1245 | 			}
1246 | 		}
1247 | 	}
1248 | 
1249 | 	const total = passed + failed;
1250 | 	const results = { passed, failed, total, failedTests };
1251 | 
1252 | 	if (generateDetailed) {
1253 | 		results.detailedResults = detailedResults;
1254 | 	}
1255 | 
1256 | 	return results;
1257 | }
1258 | 
1259 | // Test a specific template and variant
1260 | async function testSpecificTemplate(
1261 | 	templateKey,
1262 | 	variant,
1263 | 	showFullOutput = false
1264 | ) {
1265 | 	console.log(
1266 | 		`${colors.cyan}Testing: ${templateKey} (${variant})${colors.reset}\n`
1267 | 	);
1268 | 
1269 | 	try {
1270 | 		// Handle special research mode variants for template loading
1271 | 		let actualVariant = variant;
1272 | 		let detailLevel = null;
1273 | 
1274 | 		// For templates with separate research scenarios, keep the research variant
1275 | 		// For templates using detail levels, convert to default with detailLevel param
1276 | 		if (
1277 | 			templateKey === 'research' &&
1278 | 			['low', 'medium', 'high'].includes(variant)
1279 | 		) {
1280 | 			actualVariant = 'default';
1281 | 			detailLevel = variant;
1282 | 		}
1283 | 
1284 | 		// Get test data using the actual variant (research scenarios will be found)
1285 | 		const testData = getTestDataForTemplate(templateKey, actualVariant);
1286 | 
1287 | 		// For consolidated templates, convert research variant to default for template loading
1288 | 		let templateVariant = actualVariant;
1289 | 		if (
1290 | 			(templateKey === 'add-task' ||
1291 | 				templateKey === 'analyze-complexity' ||
1292 | 				templateKey === 'update-subtask' ||
1293 | 				templateKey === 'update-task' ||
1294 | 				templateKey === 'parse-prd') &&
1295 | 			variant === 'research'
1296 | 		) {
1297 | 			templateVariant = 'default';
1298 | 		}
1299 | 
1300 | 		// Override detailLevel if needed for research template
1301 | 		if (detailLevel) {
1302 | 			testData.params.detailLevel = detailLevel;
1303 | 		}
1304 | 
1305 | 		const result = await promptManager.loadPrompt(
1306 | 			templateKey,
1307 | 			testData.params,
1308 | 			templateVariant
1309 | 		);
1310 | 
1311 | 		console.log(`${colors.green}✓ SUCCESS${colors.reset}\n`);
1312 | 		console.log(`${colors.bright}Template:${colors.reset} ${templateKey}`);
1313 | 		console.log(`${colors.bright}Variant:${colors.reset} ${variant}`);
1314 | 		console.log(`${colors.bright}Test Data:${colors.reset} ${testData.name}\n`);
1315 | 
1316 | 		if (showFullOutput) {
1317 | 			console.log(`${colors.bright}=== SYSTEM PROMPT ===${colors.reset}`);
1318 | 			console.log(result.systemPrompt);
1319 | 			console.log(`\n${colors.bright}=== USER PROMPT ===${colors.reset}`);
1320 | 			console.log(result.userPrompt);
1321 | 		} else {
1322 | 			console.log(`${colors.bright}System Prompt Preview:${colors.reset}`);
1323 | 			console.log(result.systemPrompt.substring(0, 200) + '...');
1324 | 			console.log(`\n${colors.bright}User Prompt Preview:${colors.reset}`);
1325 | 			console.log(result.userPrompt.substring(0, 200) + '...');
1326 | 		}
1327 | 	} catch (error) {
1328 | 		console.log(`${colors.red}✗ FAILED: ${error.message}${colors.reset}`);
1329 | 		return false;
1330 | 	}
1331 | 
1332 | 	return true;
1333 | }
1334 | 
1335 | // Main execution
1336 | async function main() {
1337 | 	const args = process.argv.slice(2);
1338 | 
1339 | 	if (args.includes('--help') || args.includes('-h')) {
1340 | 		console.log(`Task Master Prompt Template Testing Tool
1341 | 
1342 | Usage:
1343 |   node prompt-test.js [options]
1344 | 
1345 | Options:
1346 |   --help, -h     Show this help message
1347 |   --full         Run all tests and show full prompts
1348 |   --batch        Run all tests in batch mode (non-interactive)
1349 |   --html         Generate HTML report and open in browser
1350 |   --test <template>:<variant>  Test specific template variant (e.g., --test add-task:default)
1351 | 
1352 | Interactive Mode:
1353 |   Run without arguments to start the interactive menu system.
1354 |   
1355 | Examples:
1356 |   node prompt-test.js              # Interactive menu
1357 |   node prompt-test.js --batch      # Run all tests
1358 |   node prompt-test.js --full       # Run all tests with full prompts
1359 |   node prompt-test.js --html       # Generate HTML report
1360 |   node prompt-test.js --test add-task:default  # Test specific template`);
1361 | 		process.exit(0);
1362 | 	}
1363 | 
1364 | 	const showFullPrompts = args.includes('--full');
1365 | 	const batchMode = args.includes('--batch');
1366 | 	const htmlMode = args.includes('--html');
1367 | 	const testArg = args.find((arg) => arg.startsWith('--test'));
1368 | 
1369 | 	if (testArg) {
1370 | 		let templateVariant;
1371 | 		if (testArg.includes('=')) {
1372 | 			// Handle --test=template:variant format
1373 | 			templateVariant = testArg.split('=')[1];
1374 | 		} else {
1375 | 			// Handle --test template:variant format
1376 | 			const testIndex = args.indexOf('--test');
1377 | 			templateVariant = args[testIndex + 1];
1378 | 		}
1379 | 
1380 | 		if (!templateVariant) {
1381 | 			console.error(
1382 | 				'Usage: --test template:variant (e.g., --test add-task:default)'
1383 | 			);
1384 | 			process.exit(1);
1385 | 		}
1386 | 		const [templateKey, variant] = templateVariant.split(':');
1387 | 		await testSpecificTemplate(templateKey, variant || 'default', true);
1388 | 		process.exit(0);
1389 | 	}
1390 | 
1391 | 	if (htmlMode) {
1392 | 		await generateAndSaveHTMLReport();
1393 | 		process.exit(0);
1394 | 	}
1395 | 
1396 | 	if (batchMode) {
1397 | 		const results = await runComprehensiveTests(true);
1398 | 		console.log(`\nTest Results: ${results.passed}/${results.total} passed`);
1399 | 		process.exit(results.failed > 0 ? 1 : 0);
1400 | 	} else if (showFullPrompts) {
1401 | 		// Legacy full test mode
1402 | 		const results = await runComprehensiveTests(true);
1403 | 		console.log(`\nTest Results: ${results.passed}/${results.total} passed`);
1404 | 
1405 | 		// Show sample full prompts
1406 | 		console.log('\n=== Sample Full Prompts ===\n');
1407 | 		try {
1408 | 			const promptManager = getPromptManager();
1409 | 			const testData = getTestDataForTemplate('add-task', 'default');
1410 | 			const result = await promptManager.loadPrompt(
1411 | 				'add-task',
1412 | 				testData.params,
1413 | 				'default'
1414 | 			);
1415 | 
1416 | 			console.log('System Prompt (add-task, default):');
1417 | 			console.log('-'.repeat(40));
1418 | 			console.log(result.systemPrompt);
1419 | 
1420 | 			console.log('\nUser Prompt (add-task, default):');
1421 | 			console.log('-'.repeat(40));
1422 | 			console.log(result.userPrompt);
1423 | 		} catch (error) {
1424 | 			console.log('Error showing sample prompts:', error.message);
1425 | 		}
1426 | 	} else {
1427 | 		// Interactive mode
1428 | 		const menu = new PromptTestMenu();
1429 | 		await menu.start();
1430 | 	}
1431 | }
1432 | 
1433 | // Run if called directly
1434 | if (import.meta.url === `file://${process.argv[1]}`) {
1435 | 	main().catch(console.error);
1436 | }
1437 | 
1438 | export { runComprehensiveTests, getTestDataForTemplate };
1439 | 
1440 | // HTML report generation
1441 | function generateHTMLReport(testResults, templateResults = []) {
1442 | 	const timestamp = new Date().toISOString();
1443 | 	const passed = testResults.passed;
1444 | 	const total = testResults.total;
1445 | 	const failed = testResults.failed;
1446 | 
1447 | 	// Helper function to generate consistent anchor IDs
1448 | 	function generateAnchorId(template, variant) {
1449 | 		return `test-${template.replace(/[^a-zA-Z0-9]/g, '_')}-${variant.replace(/[^a-zA-Z0-9]/g, '_')}`;
1450 | 	}
1451 | 
1452 | 	// Sort template results alphabetically by template name, then by variant
1453 | 	const sortedResults = [...templateResults].sort((a, b) => {
1454 | 		if (a.template !== b.template) {
1455 | 			return a.template.localeCompare(b.template);
1456 | 		}
1457 | 		return a.variant.localeCompare(b.variant);
1458 | 	});
1459 | 
1460 | 	let html = `<!DOCTYPE html>
1461 | <html lang="en">
1462 | <head>
1463 |     <meta charset="UTF-8">
1464 |     <meta name="viewport" content="width=device-width, initial-scale=1.0">
1465 |     <title>Task Master Prompt Template Test Report</title>
1466 |     <style>
1467 |         body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; margin: 0; padding: 20px; background: #f5f5f5; }
1468 |         .container { max-width: 1200px; margin: 0 auto; background: white; padding: 30px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
1469 |         .header { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 2px solid #eee; }
1470 |         .title { color: #2c3e50; margin: 0; font-size: 2.5em; font-weight: 300; }
1471 |         .subtitle { color: #7f8c8d; margin: 10px 0; font-size: 1.1em; }
1472 |         .summary { display: flex; justify-content: center; gap: 30px; margin: 30px 0; flex-wrap: wrap; }
1473 |         .stat { text-align: center; padding: 20px; border-radius: 8px; min-width: 120px; }
1474 |         .stat.passed { background: #d4edda; color: #155724; }
1475 |         .stat.failed { background: #f8d7da; color: #721c24; }
1476 |         .stat.total { background: #e2e3e5; color: #383d41; }
1477 |         .stat-number { font-size: 2em; font-weight: bold; margin: 0; }
1478 |         .stat-label { margin: 5px 0 0 0; font-size: 0.9em; text-transform: uppercase; letter-spacing: 1px; }
1479 |         .test-section { margin: 40px 0; }
1480 |         .test-grid { display: block; }
1481 |         .test-grid .test-case { margin-bottom: 16px; }
1482 |         .section-title { color: #2c3e50; border-bottom: 1px solid #bdc3c7; padding-bottom: 10px; margin-bottom: 20px; font-size: 1.5em; }
1483 |         .summary-section { margin: 20px 0; }
1484 |         .template-group { margin: 4px 0; padding: 6px 10px; border-radius: 4px; background: #f8f9fa; border-left: 3px solid #dee2e6; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
1485 |         .template-name { font-size: 0.9em; font-weight: 600; color: #2c3e50; margin-right: 4px; }
1486 |         .template-status { padding: 2px 6px; border-radius: 8px; font-size: 0.7em; font-weight: 600; text-transform: uppercase; margin-left: auto; flex-shrink: 0; }
1487 |         .template-status.passed { background: #d4edda; color: #155724; }
1488 |         .template-status.failed { background: #f8d7da; color: #721c24; }
1489 |         .variant-item { padding: 2px 6px; border-radius: 3px; background: white; border: 1px solid #e9ecef; font-size: 0.75em; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
1490 |         .variant-item.passed { border-left: 2px solid #28a745; color: #155724; }
1491 |         .variant-item.failed { border-left: 2px solid #dc3545; color: #721c24; background: #fff5f5; }
1492 |         .variant-name { font-weight: 500; }
1493 |         .variant-name a { text-decoration: none; color: inherit; }
1494 |         .variant-name a:hover { text-decoration: underline; }
1495 |         .variant-badge { font-size: 0.8em; font-weight: bold; }
1496 |         .summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-bottom: 30px; }
1497 |         .summary-item { padding: 15px; border-radius: 8px; border-left: 4px solid #3498db; background: #f8f9fa; display: flex; justify-content: space-between; align-items: center; }
1498 |         .summary-item.passed { border-left-color: #28a745; }
1499 |         .summary-item.failed { border-left-color: #dc3545; background: #fff5f5; }
1500 |         .summary-name { font-weight: 600; color: #2c3e50; }
1501 |         .summary-status { padding: 4px 8px; border-radius: 15px; font-size: 0.75em; font-weight: 600; text-transform: uppercase; }
1502 |         .summary-status.passed { background: #d4edda; color: #155724; }
1503 |         .summary-status.failed { background: #f8d7da; color: #721c24; }
1504 |         .test-case { margin: 8px 0; padding: 12px 16px; border-radius: 6px; border-left: 4px solid #3498db; background: #f8f9fa; }
1505 |         .test-case.passed { border-left-color: #28a745; }
1506 |         .test-case.failed { border-left-color: #dc3545; background: #fff5f5; }
1507 |         .test-header { margin-bottom: 8px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
1508 |         .test-name { font-weight: 600; color: #2c3e50; font-size: 1em; margin: 0; flex-shrink: 0; }
1509 |         .test-status { padding: 4px 8px; border-radius: 12px; font-size: 0.7em; font-weight: 600; text-transform: uppercase; display: inline-block; flex-shrink: 0; }
1510 |         .test-status.passed { background: #d4edda; color: #155724; }
1511 |         .test-status.failed { background: #f8d7da; color: #721c24; }
1512 |         .prompt-section { margin-top: 20px; }
1513 |         .prompt-title { font-weight: 600; color: #495057; margin: 20px 0 10px 0; font-size: 1em; text-transform: uppercase; letter-spacing: 0.5px; }
1514 |         .prompt-content { background: #f1f3f4; padding: 20px; border-radius: 6px; font-family: 'Monaco', 'Menlo', 'Consolas', monospace; font-size: 0.9em; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; border: 1px solid #e9ecef; overflow-x: auto; }
1515 |         .error-message { color: #dc3545; font-style: italic; margin-top: 15px; padding: 10px; background: #fff5f5; border-radius: 4px; }
1516 |         .toggle-button { background: #007bff; color: white; border: none; padding: 8px 12px; border-radius: 4px; cursor: pointer; font-size: 0.75em; margin: 0; transition: all 0.2s ease; margin-left: auto; min-height: 44px; min-width: 44px; touch-action: manipulation; user-select: none; }
1517 |         .toggle-button:hover { background: #0056b3; transform: translateY(-1px); }
1518 |         .toggle-button:active { background: #004085; transform: translateY(0); }
1519 |         .toggle-button:focus { outline: 2px solid #80bdff; outline-offset: 2px; }
1520 |         .toggle-content { display: none; margin-top: 8px; }
1521 |         .toggle-content.expanded { display: block; }
1522 |         .footer { text-align: center; margin-top: 50px; padding-top: 20px; border-top: 1px solid #eee; color: #6c757d; font-size: 0.9em; }
1523 |         .divider { height: 2px; background: linear-gradient(to right, #e9ecef, #dee2e6, #e9ecef); margin: 40px 0; border-radius: 1px; }
1524 |         .error-tests-section { margin: 20px 0; }
1525 |         .error-section-title { color: #856404; font-size: 1.1em; font-weight: 600; margin-bottom: 10px; border-bottom: 1px solid #ffc107; padding-bottom: 5px; }
1526 |         .error-group { margin: 4px 0; padding: 6px 10px; border-radius: 4px; background: #fff3cd; border-left: 3px solid #ffc107; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
1527 | 
1528 |         /* Mobile Responsive Styles */
1529 |         @media (max-width: 768px) {
1530 |             body { padding: 15px; }
1531 |             .container { padding: 20px; }
1532 |             .header { margin-bottom: 25px; padding-bottom: 15px; }
1533 |             .title { font-size: 2em; line-height: 1.2; }
1534 |             .subtitle { font-size: 0.95em; }
1535 |             .summary { gap: 20px; margin: 25px 0; }
1536 |             .stat { min-width: 90px; padding: 12px 8px; }
1537 |             .stat-number { font-size: 1.6em; }
1538 |             .stat-label { font-size: 0.75em; }
1539 |             .section-title { font-size: 1.25em; }
1540 |             .test-section { margin: 25px 0; }
1541 |             .test-grid .test-case { margin-bottom: 10px; }
1542 |             .template-group { gap: 4px; padding: 8px 12px; align-items: center; }
1543 |             .template-name { font-size: 0.85em; flex-shrink: 0; }
1544 |             .template-status { font-size: 0.65em; padding: 3px 6px; flex-shrink: 0; }
1545 |             .variant-item { margin: 1px; padding: 3px 5px; font-size: 0.7em; min-height: 24px; flex-shrink: 0; }
1546 |             .summary-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
1547 |             .test-case { margin: 6px 0; padding: 8px 12px; }
1548 |             .test-header { gap: 6px; justify-content: space-between; }
1549 |             .test-name { font-size: 0.9em; }
1550 |             .test-status { font-size: 0.65em; padding: 3px 6px; }
1551 |             .toggle-button { padding: 6px 10px; font-size: 0.7em; min-height: 38px; min-width: 38px; touch-action: manipulation; }
1552 |             .prompt-content { padding: 12px; font-size: 0.75em; }
1553 |             .prompt-title { font-size: 0.85em; margin: 12px 0 6px 0; }
1554 |             .divider { margin: 25px 0; }
1555 |             .footer { margin-top: 25px; font-size: 0.8em; }
1556 |         }
1557 | 
1558 |         @media (max-width: 480px) {
1559 |             body { padding: 10px; }
1560 |             .container { padding: 15px; }
1561 |             .title { font-size: 1.7em; }
1562 |             .summary { gap: 12px; }
1563 |             .stat { min-width: 75px; padding: 10px 6px; }
1564 |             .stat-number { font-size: 1.4em; }
1565 |             .stat-label { font-size: 0.7em; }
1566 |             .template-group { gap: 3px; align-items: center; }
1567 |             .template-name { font-size: 0.8em; flex-shrink: 0; }
1568 |             .template-status { font-size: 0.6em; padding: 2px 4px; flex-shrink: 0; }
1569 |             .variant-item { font-size: 0.65em; padding: 2px 4px; min-height: 20px; }
1570 |             .test-header { gap: 4px; justify-content: space-between; align-items: center; }
1571 |             .test-name { font-size: 0.85em; }
1572 |             .test-status { font-size: 0.6em; padding: 2px 4px; }
1573 |             .toggle-button { padding: 6px 10px; font-size: 0.7em; min-height: 40px; min-width: 40px; touch-action: manipulation; }
1574 |             .prompt-content { padding: 10px; font-size: 0.7em; line-height: 1.3; }
1575 |             .test-case { padding: 6px 8px; }
1576 |             .test-grid .test-case { margin-bottom: 8px; }
1577 |         }
1578 | 
1579 |         /* Touch-friendly enhancements */
1580 |         @media (hover: none) and (pointer: coarse) {
1581 |             .variant-name a { padding: 6px; margin: -6px; min-height: 44px; display: inline-flex; align-items: center; }
1582 |             .toggle-button { min-height: 44px; min-width: 44px; }
1583 |             .toggle-button:hover { transform: none; } /* Disable hover effects on touch devices */
1584 |         }
1585 |     </style>
1586 |     <script>
1587 |         function togglePrompts(buttonId) {
1588 |             const button = document.getElementById(buttonId);
1589 |             const content = document.getElementById(buttonId + '-content');
1590 |             
1591 |             if (content.classList.contains('expanded')) {
1592 |                 content.classList.remove('expanded');
1593 |                 button.textContent = 'Show Prompts';
1594 |                 button.style.background = '#007bff';
1595 |             } else {
1596 |                 content.classList.add('expanded');
1597 |                 button.textContent = 'Hide Prompts';
1598 |                 button.style.background = '#6c757d';
1599 |             }
1600 |         }
1601 |     </script>
1602 | </head>
1603 | <body>
1604 |     <div class="container">
1605 |         <div class="header">
1606 |             <h1 class="title">Task Master Prompt Template Test Report</h1>
1607 |             <p class="subtitle">Generated on ${timestamp}</p>
1608 |         </div>
1609 |         
1610 |         <div class="summary">
1611 |             <div class="stat total">
1612 |                 <p class="stat-number">${total}</p>
1613 |                 <p class="stat-label">Total Tests</p>
1614 |             </div>
1615 |             <div class="stat passed">
1616 |                 <p class="stat-number">${passed}</p>
1617 |                 <p class="stat-label">Passed</p>
1618 |             </div>
1619 |             <div class="stat failed">
1620 |                 <p class="stat-number">${failed}</p>
1621 |                 <p class="stat-label">Failed</p>
1622 |             </div>
1623 |         </div>`;
1624 | 
1625 | 	if (sortedResults.length > 0) {
1626 | 		// Separate real templates from error condition tests
1627 | 		const realTemplateResults = sortedResults.filter(
1628 | 			(result) =>
1629 | 				!result.expectedError &&
1630 | 				result.template !== 'nonexistent-template' &&
1631 | 				!(
1632 | 					result.template === 'research' && result.testName === 'invalid-detail'
1633 | 				) &&
1634 | 				!(result.template === 'expand-task' && result.variant === 'nonexistent')
1635 | 		);
1636 | 
1637 | 		const errorConditionResults = sortedResults.filter(
1638 | 			(result) =>
1639 | 				result.expectedError ||
1640 | 				result.template === 'nonexistent-template' ||
1641 | 				(result.template === 'research' &&
1642 | 					result.testName === 'invalid-detail') ||
1643 | 				(result.template === 'expand-task' && result.variant === 'nonexistent')
1644 | 		);
1645 | 
1646 | 		// Group real template results by template
1647 | 		const groupedResults = {};
1648 | 		realTemplateResults.forEach((result) => {
1649 | 			if (!groupedResults[result.template]) {
1650 | 				groupedResults[result.template] = [];
1651 | 			}
1652 | 			groupedResults[result.template].push(result);
1653 | 		});
1654 | 
1655 | 		// Test Results Summary Section for Real Templates
1656 | 		html += `
1657 |         <div class="summary-section">
1658 |             <h2 class="section-title">Test Results Summary</h2>`;
1659 | 
1660 | 		Object.keys(groupedResults)
1661 | 			.sort()
1662 | 			.forEach((templateName) => {
1663 | 				const templateResults = groupedResults[templateName];
1664 | 				const passedCount = templateResults.filter((r) => r.success).length;
1665 | 				const totalCount = templateResults.length;
1666 | 				const allPassed = passedCount === totalCount;
1667 | 
1668 | 				html += `
1669 |             <div class="template-group">
1670 |                 <span class="template-name">${templateName}:</span>`;
1671 | 
1672 | 				templateResults.forEach((result) => {
1673 | 					const status = result.success ? 'passed' : 'failed';
1674 | 					const badge = result.success ? '✓' : '✗';
1675 | 					const anchorId = generateAnchorId(result.template, result.variant);
1676 | 					html += `
1677 |                     <span class="variant-item ${status}">
1678 |                         <span class="variant-name"><a href="#${anchorId}">${result.variant}</a></span>
1679 |                         <span class="variant-badge">${badge}</span>
1680 |                     </span>`;
1681 | 				});
1682 | 
1683 | 				html += `
1684 |                 <span class="template-status ${allPassed ? 'passed' : 'failed'}">${passedCount}/${totalCount} passed</span>
1685 |             </div>`;
1686 | 			});
1687 | 
1688 | 		// Error Condition Tests Section
1689 | 		if (errorConditionResults.length > 0) {
1690 | 			html += `
1691 |         </div>
1692 |         
1693 |         <div class="error-tests-section">
1694 |             <h3 class="error-section-title">Error Condition Tests</h3>
1695 |             <div class="error-group">`;
1696 | 
1697 | 			errorConditionResults.forEach((result) => {
1698 | 				const status = result.success ? 'passed' : 'failed';
1699 | 				const badge = result.success ? '✓' : '✗';
1700 | 				let testName = '';
1701 | 
1702 | 				if (result.template === 'nonexistent-template') {
1703 | 					testName = 'nonexistent-template';
1704 | 				} else if (
1705 | 					result.template === 'expand-task' &&
1706 | 					result.variant === 'nonexistent'
1707 | 				) {
1708 | 					testName = 'nonexistent-variant';
1709 | 				} else if (result.template === 'parse-prd' && result.error) {
1710 | 					testName = 'missing-parameters';
1711 | 				} else if (
1712 | 					result.template === 'add-task' &&
1713 | 					result.error &&
1714 | 					result.error.includes('prompt')
1715 | 				) {
1716 | 					testName = 'empty-prompt';
1717 | 				} else if (
1718 | 					result.template === 'research' &&
1719 | 					result.variant === 'invalid-detail'
1720 | 				) {
1721 | 					testName = 'invalid-variant';
1722 | 				} else {
1723 | 					testName = `${result.template}-${result.variant}`;
1724 | 				}
1725 | 
1726 | 				html += `
1727 |                 <span class="variant-item ${status}">
1728 |                     <span class="variant-name">${testName}</span>
1729 |                     <span class="variant-badge">${badge}</span>
1730 |                 </span>`;
1731 | 			});
1732 | 
1733 | 			const errorPassedCount = errorConditionResults.filter(
1734 | 				(r) => r.success
1735 | 			).length;
1736 | 			const errorTotalCount = errorConditionResults.length;
1737 | 			const allErrorsPassed = errorPassedCount === errorTotalCount;
1738 | 
1739 | 			html += `
1740 |                 <span class="template-status ${allErrorsPassed ? 'passed' : 'failed'}">${errorPassedCount}/${errorTotalCount} passed</span>
1741 |             </div>
1742 |         </div>`;
1743 | 		}
1744 | 
1745 | 		html += `
1746 |         
1747 |         <div class="divider"></div>`;
1748 | 
1749 | 		// Detailed Prompts Section
1750 | 		html += `
1751 |         <div class="test-section">
1752 |             <h2 class="section-title">Detailed Prompt Content</h2>
1753 |             <div class="test-grid">`;
1754 | 
1755 | 		realTemplateResults.forEach((result, index) => {
1756 | 			const status = result.success ? 'passed' : 'failed';
1757 | 			const anchorId = generateAnchorId(result.template, result.variant);
1758 | 			html += `
1759 |             <div class="test-case ${status}" id="${anchorId}">
1760 |                 <div class="test-header">
1761 |                     <div class="test-name">${result.template} (${result.variant})</div>
1762 |                     <span class="test-status ${status}">${status}</span>`;
1763 | 
1764 | 			if (result.success && result.prompts) {
1765 | 				const safeTemplate = (result.template || 'unknown').replace(
1766 | 					/[^a-zA-Z0-9]/g,
1767 | 					'_'
1768 | 				);
1769 | 				const safeVariant = (result.variant || 'default').replace(
1770 | 					/[^a-zA-Z0-9]/g,
1771 | 					'_'
1772 | 				);
1773 | 				const toggleId = `toggle-${safeTemplate}-${safeVariant}-${index}`;
1774 | 				html += `
1775 |                     <button class="toggle-button" id="${toggleId}" onclick="togglePrompts('${toggleId}')">Show Prompts</button>
1776 |                 </div>
1777 |                 <div class="toggle-content" id="${toggleId}-content">
1778 |                     <div class="prompt-section">
1779 |                         <div class="prompt-title">System Prompt</div>
1780 |                         <div class="prompt-content">${escapeHtml(result.prompts.systemPrompt)}</div>
1781 |                     </div>
1782 |                     <div class="prompt-section">
1783 |                         <div class="prompt-title">User Prompt</div>
1784 |                         <div class="prompt-content">${escapeHtml(result.prompts.userPrompt)}</div>
1785 |                     </div>
1786 |                 </div>`;
1787 | 			} else {
1788 | 				html += `
1789 |                 </div>`;
1790 | 			}
1791 | 
1792 | 			if (!result.success) {
1793 | 				html += `<div class="error-message">Error: ${escapeHtml(result.error)}</div>`;
1794 | 			}
1795 | 
1796 | 			html += `</div>`;
1797 | 		});
1798 | 
1799 | 		html += `</div></div>`;
1800 | 	}
1801 | 
1802 | 	html += `
1803 |         <div class="footer">
1804 |             <p>Task Master Prompt Template Testing Tool</p>
1805 |         </div>
1806 |     </div>
1807 | </body>
1808 | </html>`;
1809 | 
1810 | 	return html;
1811 | }
1812 | 
1813 | // Helper function to escape HTML
1814 | function escapeHtml(text) {
1815 | 	if (!text) return '';
1816 | 	return text
1817 | 		.toString()
1818 | 		.replace(/&/g, '&amp;')
1819 | 		.replace(/</g, '&lt;')
1820 | 		.replace(/>/g, '&gt;')
1821 | 		.replace(/"/g, '&quot;')
1822 | 		.replace(/'/g, '&#39;');
1823 | }
1824 | 
1825 | // Generate and save HTML report
1826 | async function generateAndSaveHTMLReport() {
1827 | 	console.log(`${colors.cyan}Generating HTML Report...${colors.reset}\n`);
1828 | 
1829 | 	const results = await runComprehensiveTests(true);
1830 | 	const html = generateHTMLReport(results, results.detailedResults);
1831 | 
1832 | 	// Create output directory if it doesn't exist
1833 | 	const outputDir = path.join(projectRoot, 'tests/manual/prompts/output');
1834 | 	if (!fs.existsSync(outputDir)) {
1835 | 		fs.mkdirSync(outputDir, { recursive: true });
1836 | 	}
1837 | 
1838 | 	// Generate filename with timestamp
1839 | 	const timestamp = new Date()
1840 | 		.toISOString()
1841 | 		.replace(/[:.]/g, '-')
1842 | 		.substring(0, 19);
1843 | 	const filename = `prompt-test-report-${timestamp}.html`;
1844 | 	const filepath = path.join(outputDir, filename);
1845 | 
1846 | 	// Save HTML file
1847 | 	fs.writeFileSync(filepath, html, 'utf8');
1848 | 
1849 | 	console.log(
1850 | 		`${colors.green}✓ HTML report generated: ${filepath}${colors.reset}`
1851 | 	);
1852 | 	console.log(
1853 | 		`${colors.cyan}Results: ${results.passed}/${results.total} tests passed${colors.reset}`
1854 | 	);
1855 | 
1856 | 	// Try to open in browser (cross-platform)
1857 | 	try {
1858 | 		const { exec } = await import('child_process');
1859 | 		const command =
1860 | 			process.platform === 'darwin'
1861 | 				? 'open'
1862 | 				: process.platform === 'win32'
1863 | 					? 'start'
1864 | 					: 'xdg-open';
1865 | 		exec(`${command} "${filepath}"`);
1866 | 		console.log(`${colors.blue}Opening report in browser...${colors.reset}`);
1867 | 	} catch (error) {
1868 | 		console.log(
1869 | 			`${colors.yellow}Couldn't auto-open browser. Please open: ${filepath}${colors.reset}`
1870 | 		);
1871 | 	}
1872 | 
1873 | 	return { filepath, results };
1874 | }
1875 | 
```
Page 46/52FirstPrevNextLast