feat: Add task dependency management and enhance task information display

- Implemented  and  commands:
    - Added validation to prevent circular and duplicate dependencies.
    - Ensured proper error handling for invalid task IDs.
    - Updated task files (tasks.json and individual task files) after changes.
- Enhanced the  command to provide a detailed view of tasks:
    - Displayed dependencies with status (using color-coded output).
    - Included comprehensive task information (description, details, etc.).
- Updated documentation: README, scripts/README.md, and dev_workflow.mdc.
- Prepared package for publishing (version bump).
This commit is contained in:
Eyal Toledano
2025-03-22 00:02:22 -04:00
parent e11aba2fec
commit 306d79fb7c
11 changed files with 4197 additions and 1175 deletions

View File

@@ -14,6 +14,7 @@ In an AI-driven development process—particularly with tools like [Cursor](http
6. **Expand** tasks with subtasks—break down complex tasks into smaller, more manageable subtasks.
7. **Research-backed subtask generation**—use Perplexity AI to generate more informed and contextually relevant subtasks.
8. **Clear subtasks**—remove subtasks from specified tasks to allow regeneration or restructuring.
9. **Show task details**—display detailed information about a specific task and its subtasks.
## Configuration
@@ -41,6 +42,7 @@ The script can be configured through environment variables in a `.env` file at t
- A JSON file at the project root containing an array of tasks (each with `id`, `title`, `description`, `status`, etc.).
- The `meta` field can store additional info like the project's name, version, or reference to the PRD.
- Tasks can have `subtasks` for more detailed implementation steps.
- Dependencies are displayed with status indicators (✅ for completed, ⏱️ for pending) to easily track progress.
2. **Script Commands**
You can run the script via:
@@ -58,6 +60,8 @@ The script can be configured through environment variables in a `.env` file at t
- `set-status`: Change a task's status
- `expand`: Add subtasks to a task or all tasks
- `clear-subtasks`: Remove subtasks from specified tasks
- `next`: Determine the next task to work on based on dependencies
- `show`: Display detailed information about a specific task
Run `node scripts/dev.js` without arguments to see detailed usage information.
@@ -122,6 +126,7 @@ Notes:
- Common status values are 'done', 'pending', and 'deferred', but any string is accepted
- You can specify multiple task IDs by separating them with commas
- Subtask IDs are specified using the format `parentId.subtaskId` (e.g., `3.1`)
- Dependencies are updated to show completion status (✅ for completed, ⏱️ for pending) throughout the system
## Expanding Tasks
@@ -270,4 +275,102 @@ The output report structure is:
// More tasks sorted by complexity score (highest first)
]
}
```
```
## Finding the Next Task
The `next` command helps you determine which task to work on next based on dependencies and status:
```bash
# Show the next task to work on
node scripts/dev.js next
# Specify a different tasks file
node scripts/dev.js next --file=custom-tasks.json
```
This command:
1. Identifies all **eligible tasks** - pending or in-progress tasks whose dependencies are all satisfied (marked as done)
2. **Prioritizes** these eligible tasks by:
- Priority level (high > medium > low)
- Number of dependencies (fewer dependencies first)
- Task ID (lower ID first)
3. **Displays** comprehensive information about the selected task:
- Basic task details (ID, title, priority, dependencies)
- Detailed description and implementation details
- Subtasks if they exist
4. Provides **contextual suggested actions**:
- Command to mark the task as in-progress
- Command to mark the task as done when completed
- Commands for working with subtasks (update status or expand)
This feature ensures you're always working on the most appropriate task based on your project's current state and dependency structure.
## Showing Task Details
The `show` command allows you to view detailed information about a specific task:
```bash
# Show details for a specific task
node scripts/dev.js show 1
# Alternative syntax with --id option
node scripts/dev.js show --id=1
# Show details for a subtask
node scripts/dev.js show --id=1.2
# Specify a different tasks file
node scripts/dev.js show 3 --file=custom-tasks.json
```
This command:
1. **Displays comprehensive information** about the specified task:
- Basic task details (ID, title, priority, dependencies, status)
- Full description and implementation details
- Test strategy information
- Subtasks if they exist
2. **Handles both regular tasks and subtasks**:
- For regular tasks, shows all subtasks and their status
- For subtasks, shows the parent task relationship
3. **Provides contextual suggested actions**:
- Commands to update the task status
- Commands for working with subtasks
- For subtasks, provides a link to view the parent task
This command is particularly useful when you need to examine a specific task in detail before implementing it or when you want to check the status and details of a particular task.
## Managing Task Dependencies
The `add-dependency` and `remove-dependency` commands allow you to manage task dependencies:
```bash
# Add a dependency to a task
node scripts/dev.js add-dependency --id=<id> --depends-on=<id>
# Remove a dependency from a task
node scripts/dev.js remove-dependency --id=<id> --depends-on=<id>
```
These commands:
1. **Allow precise dependency management**:
- Add dependencies between tasks with automatic validation
- Remove dependencies when they're no longer needed
- Update task files automatically after changes
2. **Include validation checks**:
- Prevent circular dependencies (a task depending on itself)
- Prevent duplicate dependencies
- Verify that both tasks exist before adding/removing dependencies
- Check if dependencies exist before attempting to remove them
3. **Provide clear feedback**:
- Success messages confirm when dependencies are added/removed
- Error messages explain why operations failed (if applicable)
4. **Automatically update task files**:
- Regenerates task files to reflect dependency changes
- Ensures tasks and their files stay synchronized

File diff suppressed because it is too large Load Diff