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: 2
|
||||
# Title: Develop Command Line Interface Foundation
|
||||
# Status: done
|
||||
# Dependencies: 1 ✅
|
||||
# Dependencies: ✅ 1 (done)
|
||||
# Priority: high
|
||||
# Description: Create the basic CLI structure using Commander.js with command parsing and help documentation.
|
||||
# Details:
|
||||
@@ -16,69 +16,33 @@ Implement the CLI foundation including:
|
||||
Test each command with various parameters to ensure proper parsing. Verify help documentation is comprehensive and accurate. Test logging at different verbosity levels.
|
||||
|
||||
# Subtasks:
|
||||
## Subtask ID: 1
|
||||
## Title: Set up Commander.js Framework
|
||||
## Status: done
|
||||
## Dependencies: None
|
||||
## Description: Initialize and configure Commander.js as the command-line parsing framework. Create the main CLI entry point file that will serve as the application's command-line interface. Set up the basic command structure with program name, version, and description from package.json. Implement the core program flow including command registration pattern and error handling.
|
||||
## Acceptance Criteria:
|
||||
- Commander.js is properly installed and configured in the project
|
||||
- CLI entry point file is created with proper Node.js shebang and permissions
|
||||
- Program metadata (name, version, description) is correctly loaded from package.json
|
||||
- Basic command registration pattern is established
|
||||
- Global error handling is implemented to catch and display unhandled exceptions
|
||||
## 1. Set up Commander.js Framework [done]
|
||||
### Dependencies: None
|
||||
### Description: Initialize and configure Commander.js as the command-line parsing framework. Create the main CLI entry point file that will serve as the application's command-line interface. Set up the basic command structure with program name, version, and description from package.json. Implement the core program flow including command registration pattern and error handling.
|
||||
### Details:
|
||||
|
||||
## Subtask ID: 2
|
||||
## Title: Implement Global Options Handling
|
||||
## Status: done
|
||||
## Dependencies: 2.1 ✅
|
||||
## Description: Add support for all required global options including --help, --version, --file, --quiet, --debug, and --json. Implement the logic to process these options and modify program behavior accordingly. Create a configuration object that stores these settings and can be accessed by all commands. Ensure options can be combined and have appropriate precedence rules.
|
||||
## Acceptance Criteria:
|
||||
- All specified global options (--help, --version, --file, --quiet, --debug, --json) are implemented
|
||||
- Options correctly modify program behavior when specified
|
||||
- Alternative tasks.json file can be specified with --file option
|
||||
- Output verbosity is controlled by --quiet and --debug flags
|
||||
- JSON output format is supported with the --json flag
|
||||
- Help text is displayed when --help is specified
|
||||
- Version information is displayed when --version is specified
|
||||
|
||||
## Subtask ID: 3
|
||||
## Title: Create Command Help Documentation System
|
||||
## Status: done
|
||||
## Dependencies: 2.1 ✅, 2.2 ✅
|
||||
## Description: Develop a comprehensive help documentation system that provides clear usage instructions for all commands and options. Implement both command-specific help and general program help. Ensure help text is well-formatted, consistent, and includes examples. Create a centralized system for managing help text to ensure consistency across the application.
|
||||
## Acceptance Criteria:
|
||||
- General program help shows all available commands and global options
|
||||
- Command-specific help shows detailed usage information for each command
|
||||
- Help text includes clear examples of command usage
|
||||
- Help formatting is consistent and readable across all commands
|
||||
- Help system handles both explicit help requests (--help) and invalid command syntax
|
||||
## 2. Implement Global Options Handling [done]
|
||||
### Dependencies: 1 (done)
|
||||
### Description: Add support for all required global options including --help, --version, --file, --quiet, --debug, and --json. Implement the logic to process these options and modify program behavior accordingly. Create a configuration object that stores these settings and can be accessed by all commands. Ensure options can be combined and have appropriate precedence rules.
|
||||
### Details:
|
||||
|
||||
## Subtask ID: 4
|
||||
## Title: Implement Colorized Console Output
|
||||
## Status: done
|
||||
## Dependencies: 2.1 ✅
|
||||
## Description: Create a utility module for colorized console output to improve readability and user experience. Implement different color schemes for various message types (info, warning, error, success). Add support for text styling (bold, underline, etc.) and ensure colors are used consistently throughout the application. Make sure colors can be disabled in environments that don't support them.
|
||||
## Acceptance Criteria:
|
||||
- Utility module provides consistent API for colorized output
|
||||
- Different message types (info, warning, error, success) use appropriate colors
|
||||
- Text styling options (bold, underline, etc.) are available
|
||||
- Colors are disabled automatically in environments that don't support them
|
||||
- Color usage is consistent across the application
|
||||
- Output remains readable when colors are disabled
|
||||
|
||||
## Subtask ID: 5
|
||||
## Title: Develop Configurable Logging System
|
||||
## Status: done
|
||||
## Dependencies: 2.1 ✅, 2.2 ✅, 2.4 ✅
|
||||
## Description: Create a logging system with configurable verbosity levels that integrates with the CLI. Implement different logging levels (error, warn, info, debug, trace) and ensure log output respects the verbosity settings specified by global options. Add support for log output redirection to files. Ensure logs include appropriate timestamps and context information.
|
||||
## Acceptance Criteria:
|
||||
- Logging system supports multiple verbosity levels (error, warn, info, debug, trace)
|
||||
- Log output respects verbosity settings from global options (--quiet, --debug)
|
||||
- Logs include timestamps and appropriate context information
|
||||
- Log messages use consistent formatting and appropriate colors
|
||||
- Logging can be redirected to files when needed
|
||||
- Debug logs provide detailed information useful for troubleshooting
|
||||
- Logging system has minimal performance impact when not in use
|
||||
## 3. Create Command Help Documentation System [done]
|
||||
### Dependencies: 1 (done), 2 (done)
|
||||
### Description: Develop a comprehensive help documentation system that provides clear usage instructions for all commands and options. Implement both command-specific help and general program help. Ensure help text is well-formatted, consistent, and includes examples. Create a centralized system for managing help text to ensure consistency across the application.
|
||||
### Details:
|
||||
|
||||
|
||||
## 4. Implement Colorized Console Output [done]
|
||||
### Dependencies: 1 (done)
|
||||
### Description: Create a utility module for colorized console output to improve readability and user experience. Implement different color schemes for various message types (info, warning, error, success). Add support for text styling (bold, underline, etc.) and ensure colors are used consistently throughout the application. Make sure colors can be disabled in environments that don't support them.
|
||||
### Details:
|
||||
|
||||
|
||||
## 5. Develop Configurable Logging System [done]
|
||||
### Dependencies: 1 (done), 2 (done), 4 (done)
|
||||
### Description: Create a logging system with configurable verbosity levels that integrates with the CLI. Implement different logging levels (error, warn, info, debug, trace) and ensure log output respects the verbosity settings specified by global options. Add support for log output redirection to files. Ensure logs include appropriate timestamps and context information.
|
||||
### Details:
|
||||
|
||||
|
||||
Each of these subtasks directly addresses a component of the CLI foundation as specified in the task description, and together they provide a complete implementation of the required functionality. The subtasks are ordered in a logical sequence that respects their dependencies.
|
||||
|
||||
Reference in New Issue
Block a user