Refactors the `expandTask` and `expandAllTasks` features to complete subtask 61.38 and enhance functionality based on subtask 61.37's refactor.
Key Changes:
- **Additive Expansion (`expandTask`, `expandAllTasks`):**
- Modified `expandTask` default behavior to append newly generated subtasks to any existing ones.
- Added a `force` flag (passed down from CLI/MCP via `--force` option/parameter) to `expandTask` and `expandAllTasks`. When `force` is true, existing subtasks are cleared before generating new ones.
- Updated relevant CLI command (`expand`), MCP tool (`expand_task`, `expand_all`), and direct function wrappers (`expandTaskDirect`, `expandAllTasksDirect`) to handle and pass the `force` flag.
- **Complexity Report Integration (`expandTask`):**
- `expandTask` now reads `scripts/task-complexity-report.json`.
- If an analysis entry exists for the target task:
- `recommendedSubtasks` is used to determine the number of subtasks to generate (unless `--num` is explicitly provided).
- `expansionPrompt` is used as the primary prompt content for the AI.
- `reasoning` is appended to any additional context provided.
- If no report entry exists or the report is missing, it falls back to default subtask count (from config) and standard prompt generation.
- **`expandAllTasks` Orchestration:**
- Refactored `expandAllTasks` to primarily iterate through eligible tasks (pending/in-progress, considering `force` flag and existing subtasks) and call the updated `expandTask` function for each.
- Removed redundant logic (like complexity reading or explicit subtask clearing) now handled within `expandTask`.
- Ensures correct context (`session`, `mcpLog`) and flags (`useResearch`, `force`) are passed down.
- **Configuration & Cleanup:**
- Updated `.cursor/mcp.json` with new Perplexity/Anthropic API keys (old ones invalidated).
- Completed refactoring of `expandTask` started in 61.37, confirming usage of `generateTextService` and appropriate prompts.
- **Task Management:**
- Marked subtask 61.37 as complete.
- Updated `.changeset/cuddly-zebras-matter.md` to reflect user-facing changes.
These changes finalize the refactoring of the task expansion features, making them more robust, configurable via complexity analysis, and aligned with the unified AI service architecture.
69 lines
4.1 KiB
Plaintext
69 lines
4.1 KiB
Plaintext
# Task ID: 59
|
|
# Title: Remove Manual Package.json Modifications and Implement Automatic Dependency Management
|
|
# Status: pending
|
|
# Dependencies: None
|
|
# Priority: medium
|
|
# Description: Eliminate code that manually modifies users' package.json files and implement proper npm dependency management that automatically handles package requirements when users install task-master-ai.
|
|
# Details:
|
|
Currently, the application is attempting to manually modify users' package.json files, which is not the recommended approach for npm packages. Instead:
|
|
|
|
1. Review all code that directly manipulates package.json files in users' projects
|
|
2. Remove these manual modifications
|
|
3. Properly define all dependencies in the package.json of task-master-ai itself
|
|
4. Ensure all peer dependencies are correctly specified
|
|
5. For any scripts that need to be available to users, use proper npm bin linking or npx commands
|
|
6. Update the installation process to leverage npm's built-in dependency management
|
|
7. If configuration is needed in users' projects, implement a proper initialization command that creates config files rather than modifying package.json
|
|
8. Document the new approach in the README and any other relevant documentation
|
|
|
|
This change will make the package more reliable, follow npm best practices, and prevent potential conflicts or errors when modifying users' project files.
|
|
|
|
# Test Strategy:
|
|
1. Create a fresh test project directory
|
|
2. Install the updated task-master-ai package using npm install task-master-ai
|
|
3. Verify that no code attempts to modify the test project's package.json
|
|
4. Confirm all dependencies are properly installed in node_modules
|
|
5. Test all commands to ensure they work without the previous manual package.json modifications
|
|
6. Try installing in projects with various existing configurations to ensure no conflicts occur
|
|
7. Test the uninstall process to verify it cleanly removes the package without leaving unwanted modifications
|
|
8. Verify the package works in different npm environments (npm 6, 7, 8) and with different Node.js versions
|
|
9. Create an integration test that simulates a real user workflow from installation through usage
|
|
|
|
# Subtasks:
|
|
## 1. Conduct Code Audit for Dependency Management [pending]
|
|
### Dependencies: None
|
|
### Description: Review the current codebase to identify all areas where dependencies are manually managed, modified, or referenced outside of npm best practices.
|
|
### Details:
|
|
Focus on scripts, configuration files, and any custom logic related to dependency installation or versioning.
|
|
|
|
## 2. Remove Manual Dependency Modifications [pending]
|
|
### Dependencies: 59.1
|
|
### Description: Eliminate any custom scripts or manual steps that alter dependencies outside of npm's standard workflow.
|
|
### Details:
|
|
Refactor or delete code that manually installs, updates, or modifies dependencies, ensuring all dependency management is handled via npm.
|
|
|
|
## 3. Update npm Dependencies [pending]
|
|
### Dependencies: 59.2
|
|
### Description: Update all project dependencies using npm, ensuring versions are current and compatible, and resolve any conflicts.
|
|
### Details:
|
|
Run npm update, audit for vulnerabilities, and adjust package.json and package-lock.json as needed.
|
|
|
|
## 4. Update Initialization and Installation Commands [pending]
|
|
### Dependencies: 59.3
|
|
### Description: Revise project setup scripts and documentation to reflect the new npm-based dependency management approach.
|
|
### Details:
|
|
Ensure that all initialization commands (e.g., npm install) are up-to-date and remove references to deprecated manual steps.
|
|
|
|
## 5. Update Documentation [pending]
|
|
### Dependencies: 59.4
|
|
### Description: Revise project documentation to describe the new dependency management process and provide clear setup instructions.
|
|
### Details:
|
|
Update README, onboarding guides, and any developer documentation to align with npm best practices.
|
|
|
|
## 6. Perform Regression Testing [pending]
|
|
### Dependencies: 59.5
|
|
### Description: Run comprehensive tests to ensure that the refactor has not introduced any regressions or broken existing functionality.
|
|
### Details:
|
|
Execute automated and manual tests, focusing on areas affected by dependency management changes.
|
|
|