refactor(expand/all): Implement additive expansion and complexity report integration
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.
This commit is contained in:
@@ -70,3 +70,65 @@ This implementation should include:
|
||||
6. Performance Testing:
|
||||
- Measure rendering time for large projects
|
||||
- Ensure reasonable performance with 100+ interconnected tasks
|
||||
|
||||
# Subtasks:
|
||||
## 1. CLI Command Setup [pending]
|
||||
### Dependencies: None
|
||||
### Description: Design and implement the command-line interface for the dependency graph tool, including argument parsing and help documentation.
|
||||
### Details:
|
||||
Define commands for input file specification, output options, filtering, and other user-configurable parameters.
|
||||
|
||||
## 2. Graph Layout Algorithms [pending]
|
||||
### Dependencies: 41.1
|
||||
### Description: Develop or integrate algorithms to compute optimal node and edge placement for clear and readable graph layouts in a terminal environment.
|
||||
### Details:
|
||||
Consider topological sorting, hierarchical, and force-directed layouts suitable for ASCII/Unicode rendering.
|
||||
|
||||
## 3. ASCII/Unicode Rendering Engine [pending]
|
||||
### Dependencies: 41.2
|
||||
### Description: Implement rendering logic to display the dependency graph using ASCII and Unicode characters in the terminal.
|
||||
### Details:
|
||||
Support for various node and edge styles, and ensure compatibility with different terminal types.
|
||||
|
||||
## 4. Color Coding Support [pending]
|
||||
### Dependencies: 41.3
|
||||
### Description: Add color coding to nodes and edges to visually distinguish types, statuses, or other attributes in the graph.
|
||||
### Details:
|
||||
Use ANSI escape codes for color; provide options for colorblind-friendly palettes.
|
||||
|
||||
## 5. Circular Dependency Detection [pending]
|
||||
### Dependencies: 41.2
|
||||
### Description: Implement algorithms to detect and highlight circular dependencies within the graph.
|
||||
### Details:
|
||||
Clearly mark cycles in the rendered output and provide warnings or errors as appropriate.
|
||||
|
||||
## 6. Filtering and Search Functionality [pending]
|
||||
### Dependencies: 41.1, 41.2
|
||||
### Description: Enable users to filter nodes and edges by criteria such as name, type, or dependency depth.
|
||||
### Details:
|
||||
Support command-line flags for filtering and interactive search if feasible.
|
||||
|
||||
## 7. Accessibility Features [pending]
|
||||
### Dependencies: 41.3, 41.4
|
||||
### Description: Ensure the tool is accessible, including support for screen readers, high-contrast modes, and keyboard navigation.
|
||||
### Details:
|
||||
Provide alternative text output and ensure color is not the sole means of conveying information.
|
||||
|
||||
## 8. Performance Optimization [pending]
|
||||
### Dependencies: 41.2, 41.3, 41.4, 41.5, 41.6
|
||||
### Description: Profile and optimize the tool for large graphs to ensure responsive rendering and low memory usage.
|
||||
### Details:
|
||||
Implement lazy loading, efficient data structures, and parallel processing where appropriate.
|
||||
|
||||
## 9. Documentation [pending]
|
||||
### Dependencies: 41.1, 41.2, 41.3, 41.4, 41.5, 41.6, 41.7, 41.8
|
||||
### Description: Write comprehensive user and developer documentation covering installation, usage, configuration, and extension.
|
||||
### Details:
|
||||
Include examples, troubleshooting, and contribution guidelines.
|
||||
|
||||
## 10. Testing and Validation [pending]
|
||||
### Dependencies: 41.1, 41.2, 41.3, 41.4, 41.5, 41.6, 41.7, 41.8, 41.9
|
||||
### Description: Develop automated tests for all major features, including CLI parsing, layout correctness, rendering, color coding, filtering, and cycle detection.
|
||||
### Details:
|
||||
Include unit, integration, and regression tests; validate accessibility and performance claims.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user