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.
135 lines
6.3 KiB
Plaintext
135 lines
6.3 KiB
Plaintext
# Task ID: 41
|
|
# Title: Implement Visual Task Dependency Graph in Terminal
|
|
# Status: pending
|
|
# Dependencies: None
|
|
# Priority: medium
|
|
# Description: Create a feature that renders task dependencies as a visual graph using ASCII/Unicode characters in the terminal, with color-coded nodes representing tasks and connecting lines showing dependency relationships.
|
|
# Details:
|
|
This implementation should include:
|
|
|
|
1. Create a new command `graph` or `visualize` that displays the dependency graph.
|
|
|
|
2. Design an ASCII/Unicode-based graph rendering system that:
|
|
- Represents each task as a node with its ID and abbreviated title
|
|
- Shows dependencies as directional lines between nodes (→, ↑, ↓, etc.)
|
|
- Uses color coding for different task statuses (e.g., green for completed, yellow for in-progress, red for blocked)
|
|
- Handles complex dependency chains with proper spacing and alignment
|
|
|
|
3. Implement layout algorithms to:
|
|
- Minimize crossing lines for better readability
|
|
- Properly space nodes to avoid overlapping
|
|
- Support both vertical and horizontal graph orientations (as a configurable option)
|
|
|
|
4. Add detection and highlighting of circular dependencies with a distinct color/pattern
|
|
|
|
5. Include a legend explaining the color coding and symbols used
|
|
|
|
6. Ensure the graph is responsive to terminal width, with options to:
|
|
- Automatically scale to fit the current terminal size
|
|
- Allow zooming in/out of specific sections for large graphs
|
|
- Support pagination or scrolling for very large dependency networks
|
|
|
|
7. Add options to filter the graph by:
|
|
- Specific task IDs or ranges
|
|
- Task status
|
|
- Dependency depth (e.g., show only direct dependencies or N levels deep)
|
|
|
|
8. Ensure accessibility by using distinct patterns in addition to colors for users with color vision deficiencies
|
|
|
|
9. Optimize performance for projects with many tasks and complex dependency relationships
|
|
|
|
# Test Strategy:
|
|
1. Unit Tests:
|
|
- Test the graph generation algorithm with various dependency structures
|
|
- Verify correct node placement and connection rendering
|
|
- Test circular dependency detection
|
|
- Verify color coding matches task statuses
|
|
|
|
2. Integration Tests:
|
|
- Test the command with projects of varying sizes (small, medium, large)
|
|
- Verify correct handling of different terminal sizes
|
|
- Test all filtering options
|
|
|
|
3. Visual Verification:
|
|
- Create test cases with predefined dependency structures and verify the visual output matches expected patterns
|
|
- Test with terminals of different sizes, including very narrow terminals
|
|
- Verify readability of complex graphs
|
|
|
|
4. Edge Cases:
|
|
- Test with no dependencies (single nodes only)
|
|
- Test with circular dependencies
|
|
- Test with very deep dependency chains
|
|
- Test with wide dependency networks (many parallel tasks)
|
|
- Test with the maximum supported number of tasks
|
|
|
|
5. Usability Testing:
|
|
- Have team members use the feature and provide feedback on readability and usefulness
|
|
- Test in different terminal emulators to ensure compatibility
|
|
- Verify the feature works in terminals with limited color support
|
|
|
|
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.
|
|
|