Refactor: Modularize Task Master CLI into Modules Directory
Simplified the Task Master CLI by organizing code into modules within the directory. **Why:** - **Better Organization:** Code is now grouped by function (AI, commands, dependencies, tasks, UI, utilities). - **Easier to Maintain:** Smaller modules are simpler to update and fix. - **Scalable:** New features can be added more easily in a structured way. **What Changed:** - Moved code from single _____ _ __ __ _ |_ _|_ _ ___| | __ | \/ | __ _ ___| |_ ___ _ __ | |/ _` / __| |/ / | |\/| |/ _` / __| __/ _ \ '__| | | (_| \__ \ < | | | | (_| \__ \ || __/ | |_|\__,_|___/_|\_\ |_| |_|\__,_|___/\__\___|_| by https://x.com/eyaltoledano ╭────────────────────────────────────────────╮ │ │ │ Version: 0.9.16 Project: Task Master │ │ │ ╰────────────────────────────────────────────╯ ╭─────────────────────╮ │ │ │ Task Master CLI │ │ │ ╰─────────────────────╯ ╭───────────────────╮ │ Task Generation │ ╰───────────────────╯ parse-prd --input=<file.txt> [--tasks=10] Generate tasks from a PRD document generate Create individual task files from tasks… ╭───────────────────╮ │ Task Management │ ╰───────────────────╯ list [--status=<status>] [--with-subtas… List all tasks with their status set-status --id=<id> --status=<status> Update task status (done, pending, etc.) update --from=<id> --prompt="<context>" Update tasks based on new requirements add-task --prompt="<text>" [--dependencies=… Add a new task using AI add-dependency --id=<id> --depends-on=<id> Add a dependency to a task remove-dependency --id=<id> --depends-on=<id> Remove a dependency from a task ╭──────────────────────────╮ │ Task Analysis & Detail │ ╰──────────────────────────╯ analyze-complexity [--research] [--threshold=5] Analyze tasks and generate expansion re… complexity-report [--file=<path>] Display the complexity analysis report expand --id=<id> [--num=5] [--research] [… Break down tasks into detailed subtasks expand --all [--force] [--research] Expand all pending tasks with subtasks clear-subtasks --id=<id> Remove subtasks from specified tasks ╭─────────────────────────────╮ │ Task Navigation & Viewing │ ╰─────────────────────────────╯ next Show the next task to work on based on … show <id> Display detailed information about a sp… ╭─────────────────────────╮ │ Dependency Management │ ╰─────────────────────────╯ validate-dependenci… Identify invalid dependencies without f… fix-dependencies Fix invalid dependencies automatically ╭─────────────────────────╮ │ Environment Variables │ ╰─────────────────────────╯ ANTHROPIC_API_KEY Your Anthropic API key Required MODEL Claude model to use Default: claude-3-7-sonn… MAX_TOKENS Maximum tokens for responses Default: 4000 TEMPERATURE Temperature for model responses Default: 0.7 PERPLEXITY_API_KEY Perplexity API key for research Optional PERPLEXITY_MODEL Perplexity model to use Default: sonar-small-onl… DEBUG Enable debug logging Default: false LOG_LEVEL Console output level (debug,info,warn,error) Default: info DEFAULT_SUBTASKS Default number of subtasks to generate Default: 3 DEFAULT_PRIORITY Default task priority Default: medium PROJECT_NAME Project name displayed in UI Default: Task Master file into these new modules: - : AI interactions (Claude, Perplexity) - : CLI command definitions (Commander.js) - : Task dependency handling - : Core task operations (create, list, update, etc.) - : User interface elements (display, formatting) - : Utility functions and configuration - : Exports all modules - Replaced direct use of _____ _ __ __ _ |_ _|_ _ ___| | __ | \/ | __ _ ___| |_ ___ _ __ | |/ _` / __| |/ / | |\/| |/ _` / __| __/ _ \ '__| | | (_| \__ \ < | | | | (_| \__ \ || __/ | |_|\__,_|___/_|\_\ |_| |_|\__,_|___/\__\___|_| by https://x.com/eyaltoledano ╭────────────────────────────────────────────╮ │ │ │ Version: 0.9.16 Project: Task Master │ │ │ ╰────────────────────────────────────────────╯ ╭─────────────────────╮ │ │ │ Task Master CLI │ │ │ ╰─────────────────────╯ ╭───────────────────╮ │ Task Generation │ ╰───────────────────╯ parse-prd --input=<file.txt> [--tasks=10] Generate tasks from a PRD document generate Create individual task files from tasks… ╭───────────────────╮ │ Task Management │ ╰───────────────────╯ list [--status=<status>] [--with-subtas… List all tasks with their status set-status --id=<id> --status=<status> Update task status (done, pending, etc.) update --from=<id> --prompt="<context>" Update tasks based on new requirements add-task --prompt="<text>" [--dependencies=… Add a new task using AI add-dependency --id=<id> --depends-on=<id> Add a dependency to a task remove-dependency --id=<id> --depends-on=<id> Remove a dependency from a task ╭──────────────────────────╮ │ Task Analysis & Detail │ ╰──────────────────────────╯ analyze-complexity [--research] [--threshold=5] Analyze tasks and generate expansion re… complexity-report [--file=<path>] Display the complexity analysis report expand --id=<id> [--num=5] [--research] [… Break down tasks into detailed subtasks expand --all [--force] [--research] Expand all pending tasks with subtasks clear-subtasks --id=<id> Remove subtasks from specified tasks ╭─────────────────────────────╮ │ Task Navigation & Viewing │ ╰─────────────────────────────╯ next Show the next task to work on based on … show <id> Display detailed information about a sp… ╭─────────────────────────╮ │ Dependency Management │ ╰─────────────────────────╯ validate-dependenci… Identify invalid dependencies without f… fix-dependencies Fix invalid dependencies automatically ╭─────────────────────────╮ │ Environment Variables │ ╰─────────────────────────╯ ANTHROPIC_API_KEY Your Anthropic API key Required MODEL Claude model to use Default: claude-3-7-sonn… MAX_TOKENS Maximum tokens for responses Default: 4000 TEMPERATURE Temperature for model responses Default: 0.7 PERPLEXITY_API_KEY Perplexity API key for research Optional PERPLEXITY_MODEL Perplexity model to use Default: sonar-small-onl… DEBUG Enable debug logging Default: false LOG_LEVEL Console output level (debug,info,warn,error) Default: info DEFAULT_SUBTASKS Default number of subtasks to generate Default: 3 DEFAULT_PRIORITY Default task priority Default: medium PROJECT_NAME Project name displayed in UI Default: Task Master with the global command (see ). - Updated documentation () to reflect the new command. **Benefits:** Code is now cleaner, easier to work with, and ready for future growth. Use the command (or ) to run the CLI. See for command details.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Task ID: 4
|
||||
# Title: Create Task File Generation System
|
||||
# Status: done
|
||||
# Dependencies: 1 ✅, 3 ✅
|
||||
# Dependencies: ✅ 1 (done), ✅ 3 (done)
|
||||
# Priority: medium
|
||||
# Description: Implement the system for generating individual task files from the tasks.json data structure.
|
||||
# Details:
|
||||
@@ -16,72 +16,33 @@ Build the task file generation system including:
|
||||
Generate task files from sample tasks.json data and verify the content matches the expected format. Test synchronization by modifying task files and ensuring changes are reflected in tasks.json.
|
||||
|
||||
# Subtasks:
|
||||
## Subtask ID: 1
|
||||
## Title: Design Task File Template Structure
|
||||
## Status: done
|
||||
## Dependencies: None
|
||||
## Description: Create the template structure for individual task files that will be generated from tasks.json. This includes defining the format with sections for task ID, title, status, dependencies, priority, description, details, test strategy, and subtasks. Implement a template engine or string formatting system that can populate these templates with task data. The template should follow the format specified in the PRD's Task File Format section.
|
||||
## Acceptance Criteria:
|
||||
- Template structure matches the specification in the PRD
|
||||
- Template includes all required sections (ID, title, status, dependencies, etc.)
|
||||
- Template supports proper formatting of multi-line content like details and test strategy
|
||||
- Template handles subtasks correctly, including proper indentation and formatting
|
||||
- Template system is modular and can be easily modified if requirements change
|
||||
## 1. Design Task File Template Structure [done]
|
||||
### Dependencies: None
|
||||
### Description: Create the template structure for individual task files that will be generated from tasks.json. This includes defining the format with sections for task ID, title, status, dependencies, priority, description, details, test strategy, and subtasks. Implement a template engine or string formatting system that can populate these templates with task data. The template should follow the format specified in the PRD's Task File Format section.
|
||||
### Details:
|
||||
|
||||
## Subtask ID: 2
|
||||
## Title: Implement Task File Generation Logic
|
||||
## Status: done
|
||||
## Dependencies: 4.1 ✅
|
||||
## Description: Develop the core functionality to generate individual task files from the tasks.json data structure. This includes reading the tasks.json file, iterating through each task, applying the template to each task's data, and writing the resulting content to appropriately named files in the tasks directory. Ensure proper error handling for file operations and data validation.
|
||||
## Acceptance Criteria:
|
||||
- Successfully reads tasks from tasks.json
|
||||
- Correctly applies template to each task's data
|
||||
- Generates files with proper naming convention (e.g., task_001.txt)
|
||||
- Creates the tasks directory if it doesn't exist
|
||||
- Handles errors gracefully (file not found, permission issues, etc.)
|
||||
- Validates task data before generation to prevent errors
|
||||
- Logs generation process with appropriate verbosity levels
|
||||
|
||||
## Subtask ID: 3
|
||||
## Title: Implement File Naming and Organization System
|
||||
## Status: done
|
||||
## Dependencies: 4.1 ✅
|
||||
## Description: Create a consistent system for naming and organizing task files. Implement a function that generates standardized filenames based on task IDs (e.g., task_001.txt for task ID 1). Design the directory structure for storing task files according to the PRD specification. Ensure the system handles task ID formatting consistently and prevents filename collisions.
|
||||
## Acceptance Criteria:
|
||||
- Generates consistent filenames based on task IDs with proper zero-padding
|
||||
- Creates and maintains the correct directory structure as specified in the PRD
|
||||
- Handles special characters or edge cases in task IDs appropriately
|
||||
- Prevents filename collisions between different tasks
|
||||
- Provides utility functions for converting between task IDs and filenames
|
||||
- Maintains backward compatibility if the naming scheme needs to evolve
|
||||
## 2. Implement Task File Generation Logic [done]
|
||||
### Dependencies: 1 (done)
|
||||
### Description: Develop the core functionality to generate individual task files from the tasks.json data structure. This includes reading the tasks.json file, iterating through each task, applying the template to each task's data, and writing the resulting content to appropriately named files in the tasks directory. Ensure proper error handling for file operations and data validation.
|
||||
### Details:
|
||||
|
||||
## Subtask ID: 4
|
||||
## Title: Implement Task File to JSON Synchronization
|
||||
## Status: done
|
||||
## Dependencies: 4.1 ✅, 4.3 ✅, 4.2 ✅
|
||||
## Description: Develop functionality to read modified task files and update the corresponding entries in tasks.json. This includes parsing the task file format, extracting structured data, validating the changes, and updating the tasks.json file accordingly. Ensure the system can handle concurrent modifications and resolve conflicts appropriately.
|
||||
## Acceptance Criteria:
|
||||
- Successfully parses task files to extract structured data
|
||||
- Validates parsed data against the task model schema
|
||||
- Updates tasks.json with changes from task files
|
||||
- Handles conflicts when the same task is modified in both places
|
||||
- Preserves task relationships and dependencies during synchronization
|
||||
- Provides clear error messages for parsing or validation failures
|
||||
- Updates the "updatedAt" timestamp in tasks.json metadata
|
||||
|
||||
## Subtask ID: 5
|
||||
## Title: Implement Change Detection and Update Handling
|
||||
## Status: done
|
||||
## Dependencies: 4.1 ✅, 4.3 ✅, 4.4 ✅, 4.2 ✅
|
||||
## Description: Create a system to detect changes in task files and tasks.json, and handle updates bidirectionally. This includes implementing file watching or comparison mechanisms, determining which version is newer, and applying changes in the appropriate direction. Ensure the system handles edge cases like deleted files, new tasks, and conflicting changes.
|
||||
## Acceptance Criteria:
|
||||
- Detects changes in both task files and tasks.json
|
||||
- Determines which version is newer based on modification timestamps or content
|
||||
- Applies changes in the appropriate direction (file to JSON or JSON to file)
|
||||
- Handles edge cases like deleted files, new tasks, and renamed tasks
|
||||
- Provides options for manual conflict resolution when necessary
|
||||
- Maintains data integrity during the synchronization process
|
||||
- Includes a command to force synchronization in either direction
|
||||
- Logs all synchronization activities for troubleshooting
|
||||
## 3. Implement File Naming and Organization System [done]
|
||||
### Dependencies: 1 (done)
|
||||
### Description: Create a consistent system for naming and organizing task files. Implement a function that generates standardized filenames based on task IDs (e.g., task_001.txt for task ID 1). Design the directory structure for storing task files according to the PRD specification. Ensure the system handles task ID formatting consistently and prevents filename collisions.
|
||||
### Details:
|
||||
|
||||
|
||||
## 4. Implement Task File to JSON Synchronization [done]
|
||||
### Dependencies: 1 (done), 3 (done), 2 (done)
|
||||
### Description: Develop functionality to read modified task files and update the corresponding entries in tasks.json. This includes parsing the task file format, extracting structured data, validating the changes, and updating the tasks.json file accordingly. Ensure the system can handle concurrent modifications and resolve conflicts appropriately.
|
||||
### Details:
|
||||
|
||||
|
||||
## 5. Implement Change Detection and Update Handling [done]
|
||||
### Dependencies: 1 (done), 3 (done), 4 (done), 2 (done)
|
||||
### Description: Create a system to detect changes in task files and tasks.json, and handle updates bidirectionally. This includes implementing file watching or comparison mechanisms, determining which version is newer, and applying changes in the appropriate direction. Ensure the system handles edge cases like deleted files, new tasks, and conflicting changes.
|
||||
### Details:
|
||||
|
||||
|
||||
Each of these subtasks addresses a specific component of the task file generation system, following a logical progression from template design to bidirectional synchronization. The dependencies ensure that prerequisites are completed before dependent work begins, and the acceptance criteria provide clear guidelines for verifying each subtask's completion.
|
||||
|
||||
Reference in New Issue
Block a user