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.
2025-03-23 23:19:37 -04:00
|
|
|
/**
|
|
|
|
* commands.js
|
|
|
|
* Command-line interface for the Task Master CLI
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { program } from 'commander';
|
|
|
|
import path from 'path';
|
|
|
|
import chalk from 'chalk';
|
|
|
|
import boxen from 'boxen';
|
|
|
|
import fs from 'fs';
|
|
|
|
|
|
|
|
import { CONFIG, log, readJSON } from './utils.js';
|
|
|
|
import {
|
|
|
|
parsePRD,
|
|
|
|
updateTasks,
|
|
|
|
generateTaskFiles,
|
|
|
|
setTaskStatus,
|
|
|
|
listTasks,
|
|
|
|
expandTask,
|
|
|
|
expandAllTasks,
|
|
|
|
clearSubtasks,
|
|
|
|
addTask,
|
2025-03-24 21:18:49 -04:00
|
|
|
addSubtask,
|
|
|
|
removeSubtask,
|
2025-03-27 01:33:20 -04:00
|
|
|
analyzeTaskComplexity,
|
|
|
|
updateTaskById
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
} from './task-manager.js';
|
|
|
|
|
|
|
|
import {
|
|
|
|
addDependency,
|
|
|
|
removeDependency,
|
|
|
|
validateDependenciesCommand,
|
|
|
|
fixDependenciesCommand
|
|
|
|
} from './dependency-manager.js';
|
|
|
|
|
|
|
|
import {
|
|
|
|
displayBanner,
|
|
|
|
displayHelp,
|
|
|
|
displayNextTask,
|
|
|
|
displayTaskById,
|
|
|
|
displayComplexityReport,
|
2025-03-24 21:18:49 -04:00
|
|
|
getStatusWithColor
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
} from './ui.js';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Configure and register CLI commands
|
|
|
|
* @param {Object} program - Commander program instance
|
|
|
|
*/
|
|
|
|
function registerCommands(programInstance) {
|
|
|
|
// Default help
|
|
|
|
programInstance.on('--help', function() {
|
|
|
|
displayHelp();
|
|
|
|
});
|
|
|
|
|
|
|
|
// parse-prd command
|
|
|
|
programInstance
|
|
|
|
.command('parse-prd')
|
|
|
|
.description('Parse a PRD file and generate tasks')
|
2025-03-24 16:30:27 -04:00
|
|
|
.argument('[file]', 'Path to the PRD file')
|
2025-03-25 00:42:59 -04:00
|
|
|
.option('-i, --input <file>', 'Path to the PRD file (alternative to positional argument)')
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
.option('-o, --output <file>', 'Output file path', 'tasks/tasks.json')
|
|
|
|
.option('-n, --num-tasks <number>', 'Number of tasks to generate', '10')
|
|
|
|
.action(async (file, options) => {
|
2025-03-25 00:42:59 -04:00
|
|
|
// Use input option if file argument not provided
|
|
|
|
const inputFile = file || options.input;
|
2025-03-26 15:07:31 -04:00
|
|
|
const defaultPrdPath = 'scripts/prd.txt';
|
2025-03-25 00:42:59 -04:00
|
|
|
|
2025-03-26 15:07:31 -04:00
|
|
|
// If no input file specified, check for default PRD location
|
2025-03-25 00:42:59 -04:00
|
|
|
if (!inputFile) {
|
2025-03-26 15:07:31 -04:00
|
|
|
if (fs.existsSync(defaultPrdPath)) {
|
|
|
|
console.log(chalk.blue(`Using default PRD file: ${defaultPrdPath}`));
|
|
|
|
const numTasks = parseInt(options.numTasks, 10);
|
|
|
|
const outputPath = options.output;
|
|
|
|
|
|
|
|
console.log(chalk.blue(`Generating ${numTasks} tasks...`));
|
|
|
|
await parsePRD(defaultPrdPath, outputPath, numTasks);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(chalk.yellow('No PRD file specified and default PRD file not found at scripts/prd.txt.'));
|
2025-03-24 16:30:27 -04:00
|
|
|
console.log(boxen(
|
|
|
|
chalk.white.bold('Parse PRD Help') + '\n\n' +
|
|
|
|
chalk.cyan('Usage:') + '\n' +
|
|
|
|
` task-master parse-prd <prd-file.txt> [options]\n\n` +
|
|
|
|
chalk.cyan('Options:') + '\n' +
|
2025-03-25 00:42:59 -04:00
|
|
|
' -i, --input <file> Path to the PRD file (alternative to positional argument)\n' +
|
|
|
|
' -o, --output <file> Output file path (default: "tasks/tasks.json")\n' +
|
|
|
|
' -n, --num-tasks <number> Number of tasks to generate (default: 10)\n\n' +
|
2025-03-24 16:30:27 -04:00
|
|
|
chalk.cyan('Example:') + '\n' +
|
2025-03-25 00:42:59 -04:00
|
|
|
' task-master parse-prd requirements.txt --num-tasks 15\n' +
|
|
|
|
' task-master parse-prd --input=requirements.txt\n\n' +
|
2025-03-26 15:07:31 -04:00
|
|
|
chalk.yellow('Note: This command will:') + '\n' +
|
|
|
|
' 1. Look for a PRD file at scripts/prd.txt by default\n' +
|
|
|
|
' 2. Use the file specified by --input or positional argument if provided\n' +
|
|
|
|
' 3. Generate tasks from the PRD and overwrite any existing tasks.json file',
|
2025-03-24 16:30:27 -04:00
|
|
|
{ padding: 1, borderColor: 'blue', borderStyle: 'round' }
|
|
|
|
));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
const numTasks = parseInt(options.numTasks, 10);
|
|
|
|
const outputPath = options.output;
|
|
|
|
|
2025-03-25 00:42:59 -04:00
|
|
|
console.log(chalk.blue(`Parsing PRD file: ${inputFile}`));
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
console.log(chalk.blue(`Generating ${numTasks} tasks...`));
|
|
|
|
|
2025-03-25 00:42:59 -04:00
|
|
|
await parsePRD(inputFile, outputPath, numTasks);
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// update command
|
|
|
|
programInstance
|
|
|
|
.command('update')
|
|
|
|
.description('Update tasks based on new information or implementation changes')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.option('--from <id>', 'Task ID to start updating from (tasks with ID >= this value will be updated)', '1')
|
|
|
|
.option('-p, --prompt <text>', 'Prompt explaining the changes or new context (required)')
|
feat: Enhance Task Master CLI with Testing Framework, Perplexity AI Integration, and Refactored Core Logic
This commit introduces significant enhancements and refactoring to the Task Master CLI, focusing on improved testing, integration with Perplexity AI for research-backed task updates, and core logic refactoring for better maintainability and functionality.
**Testing Infrastructure Setup:**
- Implemented Jest as the primary testing framework, setting up a comprehensive testing environment.
- Added new test scripts to including , , and for streamlined testing workflows.
- Integrated necessary devDependencies for testing, such as , , , , and , to support unit, integration, and end-to-end testing.
**Dependency Updates:**
- Updated and to reflect the latest dependency versions, ensuring project stability and access to the newest features and security patches.
- Upgraded to version 0.9.16 and usage: openai [-h] [-v] [-b API_BASE] [-k API_KEY] [-p PROXY [PROXY ...]]
[-o ORGANIZATION] [-t {openai,azure}]
[--api-version API_VERSION] [--azure-endpoint AZURE_ENDPOINT]
[--azure-ad-token AZURE_AD_TOKEN] [-V]
{api,tools,migrate,grit} ...
positional arguments:
{api,tools,migrate,grit}
api Direct API calls
tools Client side tools for convenience
options:
-h, --help show this help message and exit
-v, --verbose Set verbosity.
-b, --api-base API_BASE
What API base url to use.
-k, --api-key API_KEY
What API key to use.
-p, --proxy PROXY [PROXY ...]
What proxy to use.
-o, --organization ORGANIZATION
Which organization to run as (will use your default
organization if not specified)
-t, --api-type {openai,azure}
The backend API to call, must be `openai` or `azure`
--api-version API_VERSION
The Azure API version, e.g.
'https://learn.microsoft.com/en-us/azure/ai-
services/openai/reference#rest-api-versioning'
--azure-endpoint AZURE_ENDPOINT
The Azure endpoint, e.g.
'https://endpoint.openai.azure.com'
--azure-ad-token AZURE_AD_TOKEN
A token from Azure Active Directory,
https://www.microsoft.com/en-
us/security/business/identity-access/microsoft-entra-
id
-V, --version show program's version number and exit to 4.89.0.
- Added dependency (version 2.3.0) and updated related dependencies to their latest versions.
**Perplexity AI Integration for Research-Backed Updates:**
- Introduced an option to leverage Perplexity AI for task updates, enabling research-backed enhancements to task details.
- Implemented logic to initialize a Perplexity AI client if the environment variable is available.
- Modified the function to accept a parameter, allowing dynamic selection between Perplexity AI and Claude AI for task updates based on API key availability and user preference.
- Enhanced to handle responses from Perplexity AI and update tasks accordingly, including improved error handling and logging for robust operation.
**Core Logic Refactoring and Improvements:**
- Refactored the function to utilize task IDs instead of dependency IDs, ensuring consistency and clarity in dependency management.
- Implemented a new function to rigorously check for both circular dependencies and self-dependencies within tasks, improving task relationship integrity.
- Enhanced UI elements in :
- Refactored to incorporate icons for different task statuses and utilize a object for color mapping, improving visual representation of task status.
- Updated to display colored complexity scores with emojis, providing a more intuitive and visually appealing representation of task complexity.
- Refactored the task data structure creation and validation process:
- Updated the JSON Schema for to reflect a more streamlined and efficient task structure.
- Implemented Task Model Classes for better data modeling and type safety.
- Improved File System Operations for task data management.
- Developed robust Validation Functions and an Error Handling System to ensure data integrity and application stability.
**Testing Guidelines Implementation:**
- Implemented guidelines for writing testable code when developing new features, promoting a test-driven development approach.
- Added testing requirements and best practices for unit, integration, and edge case testing to ensure comprehensive test coverage.
- Updated the development workflow to mandate writing tests before proceeding with configuration and documentation updates, reinforcing the importance of testing throughout the development lifecycle.
This commit collectively enhances the Task Master CLI's reliability, functionality, and developer experience through improved testing practices, AI-powered research capabilities, and a more robust and maintainable codebase.
2025-03-24 13:28:08 -04:00
|
|
|
.option('-r, --research', 'Use Perplexity AI for research-backed task updates')
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const fromId = parseInt(options.from, 10);
|
|
|
|
const prompt = options.prompt;
|
feat: Enhance Task Master CLI with Testing Framework, Perplexity AI Integration, and Refactored Core Logic
This commit introduces significant enhancements and refactoring to the Task Master CLI, focusing on improved testing, integration with Perplexity AI for research-backed task updates, and core logic refactoring for better maintainability and functionality.
**Testing Infrastructure Setup:**
- Implemented Jest as the primary testing framework, setting up a comprehensive testing environment.
- Added new test scripts to including , , and for streamlined testing workflows.
- Integrated necessary devDependencies for testing, such as , , , , and , to support unit, integration, and end-to-end testing.
**Dependency Updates:**
- Updated and to reflect the latest dependency versions, ensuring project stability and access to the newest features and security patches.
- Upgraded to version 0.9.16 and usage: openai [-h] [-v] [-b API_BASE] [-k API_KEY] [-p PROXY [PROXY ...]]
[-o ORGANIZATION] [-t {openai,azure}]
[--api-version API_VERSION] [--azure-endpoint AZURE_ENDPOINT]
[--azure-ad-token AZURE_AD_TOKEN] [-V]
{api,tools,migrate,grit} ...
positional arguments:
{api,tools,migrate,grit}
api Direct API calls
tools Client side tools for convenience
options:
-h, --help show this help message and exit
-v, --verbose Set verbosity.
-b, --api-base API_BASE
What API base url to use.
-k, --api-key API_KEY
What API key to use.
-p, --proxy PROXY [PROXY ...]
What proxy to use.
-o, --organization ORGANIZATION
Which organization to run as (will use your default
organization if not specified)
-t, --api-type {openai,azure}
The backend API to call, must be `openai` or `azure`
--api-version API_VERSION
The Azure API version, e.g.
'https://learn.microsoft.com/en-us/azure/ai-
services/openai/reference#rest-api-versioning'
--azure-endpoint AZURE_ENDPOINT
The Azure endpoint, e.g.
'https://endpoint.openai.azure.com'
--azure-ad-token AZURE_AD_TOKEN
A token from Azure Active Directory,
https://www.microsoft.com/en-
us/security/business/identity-access/microsoft-entra-
id
-V, --version show program's version number and exit to 4.89.0.
- Added dependency (version 2.3.0) and updated related dependencies to their latest versions.
**Perplexity AI Integration for Research-Backed Updates:**
- Introduced an option to leverage Perplexity AI for task updates, enabling research-backed enhancements to task details.
- Implemented logic to initialize a Perplexity AI client if the environment variable is available.
- Modified the function to accept a parameter, allowing dynamic selection between Perplexity AI and Claude AI for task updates based on API key availability and user preference.
- Enhanced to handle responses from Perplexity AI and update tasks accordingly, including improved error handling and logging for robust operation.
**Core Logic Refactoring and Improvements:**
- Refactored the function to utilize task IDs instead of dependency IDs, ensuring consistency and clarity in dependency management.
- Implemented a new function to rigorously check for both circular dependencies and self-dependencies within tasks, improving task relationship integrity.
- Enhanced UI elements in :
- Refactored to incorporate icons for different task statuses and utilize a object for color mapping, improving visual representation of task status.
- Updated to display colored complexity scores with emojis, providing a more intuitive and visually appealing representation of task complexity.
- Refactored the task data structure creation and validation process:
- Updated the JSON Schema for to reflect a more streamlined and efficient task structure.
- Implemented Task Model Classes for better data modeling and type safety.
- Improved File System Operations for task data management.
- Developed robust Validation Functions and an Error Handling System to ensure data integrity and application stability.
**Testing Guidelines Implementation:**
- Implemented guidelines for writing testable code when developing new features, promoting a test-driven development approach.
- Added testing requirements and best practices for unit, integration, and edge case testing to ensure comprehensive test coverage.
- Updated the development workflow to mandate writing tests before proceeding with configuration and documentation updates, reinforcing the importance of testing throughout the development lifecycle.
This commit collectively enhances the Task Master CLI's reliability, functionality, and developer experience through improved testing practices, AI-powered research capabilities, and a more robust and maintainable codebase.
2025-03-24 13:28:08 -04:00
|
|
|
const useResearch = options.research || false;
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
|
|
|
|
if (!prompt) {
|
|
|
|
console.error(chalk.red('Error: --prompt parameter is required. Please provide information about the changes.'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(chalk.blue(`Updating tasks from ID >= ${fromId} with prompt: "${prompt}"`));
|
|
|
|
console.log(chalk.blue(`Tasks file: ${tasksPath}`));
|
|
|
|
|
feat: Enhance Task Master CLI with Testing Framework, Perplexity AI Integration, and Refactored Core Logic
This commit introduces significant enhancements and refactoring to the Task Master CLI, focusing on improved testing, integration with Perplexity AI for research-backed task updates, and core logic refactoring for better maintainability and functionality.
**Testing Infrastructure Setup:**
- Implemented Jest as the primary testing framework, setting up a comprehensive testing environment.
- Added new test scripts to including , , and for streamlined testing workflows.
- Integrated necessary devDependencies for testing, such as , , , , and , to support unit, integration, and end-to-end testing.
**Dependency Updates:**
- Updated and to reflect the latest dependency versions, ensuring project stability and access to the newest features and security patches.
- Upgraded to version 0.9.16 and usage: openai [-h] [-v] [-b API_BASE] [-k API_KEY] [-p PROXY [PROXY ...]]
[-o ORGANIZATION] [-t {openai,azure}]
[--api-version API_VERSION] [--azure-endpoint AZURE_ENDPOINT]
[--azure-ad-token AZURE_AD_TOKEN] [-V]
{api,tools,migrate,grit} ...
positional arguments:
{api,tools,migrate,grit}
api Direct API calls
tools Client side tools for convenience
options:
-h, --help show this help message and exit
-v, --verbose Set verbosity.
-b, --api-base API_BASE
What API base url to use.
-k, --api-key API_KEY
What API key to use.
-p, --proxy PROXY [PROXY ...]
What proxy to use.
-o, --organization ORGANIZATION
Which organization to run as (will use your default
organization if not specified)
-t, --api-type {openai,azure}
The backend API to call, must be `openai` or `azure`
--api-version API_VERSION
The Azure API version, e.g.
'https://learn.microsoft.com/en-us/azure/ai-
services/openai/reference#rest-api-versioning'
--azure-endpoint AZURE_ENDPOINT
The Azure endpoint, e.g.
'https://endpoint.openai.azure.com'
--azure-ad-token AZURE_AD_TOKEN
A token from Azure Active Directory,
https://www.microsoft.com/en-
us/security/business/identity-access/microsoft-entra-
id
-V, --version show program's version number and exit to 4.89.0.
- Added dependency (version 2.3.0) and updated related dependencies to their latest versions.
**Perplexity AI Integration for Research-Backed Updates:**
- Introduced an option to leverage Perplexity AI for task updates, enabling research-backed enhancements to task details.
- Implemented logic to initialize a Perplexity AI client if the environment variable is available.
- Modified the function to accept a parameter, allowing dynamic selection between Perplexity AI and Claude AI for task updates based on API key availability and user preference.
- Enhanced to handle responses from Perplexity AI and update tasks accordingly, including improved error handling and logging for robust operation.
**Core Logic Refactoring and Improvements:**
- Refactored the function to utilize task IDs instead of dependency IDs, ensuring consistency and clarity in dependency management.
- Implemented a new function to rigorously check for both circular dependencies and self-dependencies within tasks, improving task relationship integrity.
- Enhanced UI elements in :
- Refactored to incorporate icons for different task statuses and utilize a object for color mapping, improving visual representation of task status.
- Updated to display colored complexity scores with emojis, providing a more intuitive and visually appealing representation of task complexity.
- Refactored the task data structure creation and validation process:
- Updated the JSON Schema for to reflect a more streamlined and efficient task structure.
- Implemented Task Model Classes for better data modeling and type safety.
- Improved File System Operations for task data management.
- Developed robust Validation Functions and an Error Handling System to ensure data integrity and application stability.
**Testing Guidelines Implementation:**
- Implemented guidelines for writing testable code when developing new features, promoting a test-driven development approach.
- Added testing requirements and best practices for unit, integration, and edge case testing to ensure comprehensive test coverage.
- Updated the development workflow to mandate writing tests before proceeding with configuration and documentation updates, reinforcing the importance of testing throughout the development lifecycle.
This commit collectively enhances the Task Master CLI's reliability, functionality, and developer experience through improved testing practices, AI-powered research capabilities, and a more robust and maintainable codebase.
2025-03-24 13:28:08 -04:00
|
|
|
if (useResearch) {
|
|
|
|
console.log(chalk.blue('Using Perplexity AI for research-backed task updates'));
|
|
|
|
}
|
|
|
|
|
|
|
|
await updateTasks(tasksPath, fromId, prompt, useResearch);
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
});
|
|
|
|
|
2025-03-27 01:33:20 -04:00
|
|
|
// updateTask command
|
|
|
|
programInstance
|
|
|
|
.command('update-task')
|
|
|
|
.description('Update a single task by ID with new information')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.option('-i, --id <id>', 'Task ID to update (required)')
|
|
|
|
.option('-p, --prompt <text>', 'Prompt explaining the changes or new context (required)')
|
|
|
|
.option('-r, --research', 'Use Perplexity AI for research-backed task updates')
|
|
|
|
.action(async (options) => {
|
|
|
|
try {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
|
|
|
|
// Validate required parameters
|
|
|
|
if (!options.id) {
|
|
|
|
console.error(chalk.red('Error: --id parameter is required'));
|
|
|
|
console.log(chalk.yellow('Usage example: task-master update-task --id=23 --prompt="Update with new information"'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse the task ID and validate it's a number
|
|
|
|
const taskId = parseInt(options.id, 10);
|
|
|
|
if (isNaN(taskId) || taskId <= 0) {
|
|
|
|
console.error(chalk.red(`Error: Invalid task ID: ${options.id}. Task ID must be a positive integer.`));
|
|
|
|
console.log(chalk.yellow('Usage example: task-master update-task --id=23 --prompt="Update with new information"'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!options.prompt) {
|
|
|
|
console.error(chalk.red('Error: --prompt parameter is required. Please provide information about the changes.'));
|
|
|
|
console.log(chalk.yellow('Usage example: task-master update-task --id=23 --prompt="Update with new information"'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
const prompt = options.prompt;
|
|
|
|
const useResearch = options.research || false;
|
|
|
|
|
|
|
|
// Validate tasks file exists
|
|
|
|
if (!fs.existsSync(tasksPath)) {
|
|
|
|
console.error(chalk.red(`Error: Tasks file not found at path: ${tasksPath}`));
|
|
|
|
if (tasksPath === 'tasks/tasks.json') {
|
|
|
|
console.log(chalk.yellow('Hint: Run task-master init or task-master parse-prd to create tasks.json first'));
|
|
|
|
} else {
|
|
|
|
console.log(chalk.yellow(`Hint: Check if the file path is correct: ${tasksPath}`));
|
|
|
|
}
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(chalk.blue(`Updating task ${taskId} with prompt: "${prompt}"`));
|
|
|
|
console.log(chalk.blue(`Tasks file: ${tasksPath}`));
|
|
|
|
|
|
|
|
if (useResearch) {
|
|
|
|
// Verify Perplexity API key exists if using research
|
|
|
|
if (!process.env.PERPLEXITY_API_KEY) {
|
|
|
|
console.log(chalk.yellow('Warning: PERPLEXITY_API_KEY environment variable is missing. Research-backed updates will not be available.'));
|
|
|
|
console.log(chalk.yellow('Falling back to Claude AI for task update.'));
|
|
|
|
} else {
|
|
|
|
console.log(chalk.blue('Using Perplexity AI for research-backed task update'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const result = await updateTaskById(tasksPath, taskId, prompt, useResearch);
|
|
|
|
|
|
|
|
// If the task wasn't updated (e.g., if it was already marked as done)
|
|
|
|
if (!result) {
|
|
|
|
console.log(chalk.yellow('\nTask update was not completed. Review the messages above for details.'));
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.error(chalk.red(`Error: ${error.message}`));
|
|
|
|
|
|
|
|
// Provide more helpful error messages for common issues
|
|
|
|
if (error.message.includes('task') && error.message.includes('not found')) {
|
|
|
|
console.log(chalk.yellow('\nTo fix this issue:'));
|
|
|
|
console.log(' 1. Run task-master list to see all available task IDs');
|
|
|
|
console.log(' 2. Use a valid task ID with the --id parameter');
|
|
|
|
} else if (error.message.includes('API key')) {
|
|
|
|
console.log(chalk.yellow('\nThis error is related to API keys. Check your environment variables.'));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CONFIG.debug) {
|
|
|
|
console.error(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
// generate command
|
|
|
|
programInstance
|
|
|
|
.command('generate')
|
|
|
|
.description('Generate task files from tasks.json')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.option('-o, --output <dir>', 'Output directory', 'tasks')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const outputDir = options.output;
|
|
|
|
|
|
|
|
console.log(chalk.blue(`Generating task files from: ${tasksPath}`));
|
|
|
|
console.log(chalk.blue(`Output directory: ${outputDir}`));
|
|
|
|
|
|
|
|
await generateTaskFiles(tasksPath, outputDir);
|
|
|
|
});
|
|
|
|
|
|
|
|
// set-status command
|
|
|
|
programInstance
|
|
|
|
.command('set-status')
|
|
|
|
.description('Set the status of a task')
|
|
|
|
.option('-i, --id <id>', 'Task ID (can be comma-separated for multiple tasks)')
|
|
|
|
.option('-s, --status <status>', 'New status (todo, in-progress, review, done)')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const taskId = options.id;
|
|
|
|
const status = options.status;
|
|
|
|
|
|
|
|
if (!taskId || !status) {
|
|
|
|
console.error(chalk.red('Error: Both --id and --status are required'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(chalk.blue(`Setting status of task(s) ${taskId} to: ${status}`));
|
|
|
|
|
|
|
|
await setTaskStatus(tasksPath, taskId, status);
|
|
|
|
});
|
|
|
|
|
|
|
|
// list command
|
|
|
|
programInstance
|
|
|
|
.command('list')
|
|
|
|
.description('List all tasks')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.option('-s, --status <status>', 'Filter by status')
|
|
|
|
.option('--with-subtasks', 'Show subtasks for each task')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const statusFilter = options.status;
|
|
|
|
const withSubtasks = options.withSubtasks || false;
|
|
|
|
|
|
|
|
console.log(chalk.blue(`Listing tasks from: ${tasksPath}`));
|
|
|
|
if (statusFilter) {
|
|
|
|
console.log(chalk.blue(`Filtering by status: ${statusFilter}`));
|
|
|
|
}
|
|
|
|
if (withSubtasks) {
|
|
|
|
console.log(chalk.blue('Including subtasks in listing'));
|
|
|
|
}
|
|
|
|
|
|
|
|
await listTasks(tasksPath, statusFilter, withSubtasks);
|
|
|
|
});
|
|
|
|
|
|
|
|
// expand command
|
|
|
|
programInstance
|
|
|
|
.command('expand')
|
|
|
|
.description('Break down tasks into detailed subtasks')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.option('-i, --id <id>', 'Task ID to expand')
|
|
|
|
.option('-a, --all', 'Expand all tasks')
|
|
|
|
.option('-n, --num <number>', 'Number of subtasks to generate', CONFIG.defaultSubtasks.toString())
|
|
|
|
.option('--research', 'Enable Perplexity AI for research-backed subtask generation')
|
|
|
|
.option('-p, --prompt <text>', 'Additional context to guide subtask generation')
|
|
|
|
.option('--force', 'Force regeneration of subtasks for tasks that already have them')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const idArg = options.id ? parseInt(options.id, 10) : null;
|
|
|
|
const allFlag = options.all;
|
|
|
|
const numSubtasks = parseInt(options.num, 10);
|
|
|
|
const forceFlag = options.force;
|
|
|
|
const useResearch = options.research === true;
|
|
|
|
const additionalContext = options.prompt || '';
|
|
|
|
|
|
|
|
// Debug log to verify the value
|
|
|
|
log('debug', `Research enabled: ${useResearch}`);
|
|
|
|
|
|
|
|
if (allFlag) {
|
|
|
|
console.log(chalk.blue(`Expanding all tasks with ${numSubtasks} subtasks each...`));
|
|
|
|
if (useResearch) {
|
|
|
|
console.log(chalk.blue('Using Perplexity AI for research-backed subtask generation'));
|
|
|
|
} else {
|
|
|
|
console.log(chalk.yellow('Research-backed subtask generation disabled'));
|
|
|
|
}
|
|
|
|
if (additionalContext) {
|
|
|
|
console.log(chalk.blue(`Additional context: "${additionalContext}"`));
|
|
|
|
}
|
|
|
|
await expandAllTasks(numSubtasks, useResearch, additionalContext, forceFlag);
|
|
|
|
} else if (idArg) {
|
|
|
|
console.log(chalk.blue(`Expanding task ${idArg} with ${numSubtasks} subtasks...`));
|
|
|
|
if (useResearch) {
|
|
|
|
console.log(chalk.blue('Using Perplexity AI for research-backed subtask generation'));
|
|
|
|
} else {
|
|
|
|
console.log(chalk.yellow('Research-backed subtask generation disabled'));
|
|
|
|
}
|
|
|
|
if (additionalContext) {
|
|
|
|
console.log(chalk.blue(`Additional context: "${additionalContext}"`));
|
|
|
|
}
|
|
|
|
await expandTask(idArg, numSubtasks, useResearch, additionalContext);
|
|
|
|
} else {
|
|
|
|
console.error(chalk.red('Error: Please specify a task ID with --id=<id> or use --all to expand all tasks.'));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// analyze-complexity command
|
|
|
|
programInstance
|
|
|
|
.command('analyze-complexity')
|
|
|
|
.description(`Analyze tasks and generate expansion recommendations${chalk.reset('')}`)
|
|
|
|
.option('-o, --output <file>', 'Output file path for the report', 'scripts/task-complexity-report.json')
|
|
|
|
.option('-m, --model <model>', 'LLM model to use for analysis (defaults to configured model)')
|
|
|
|
.option('-t, --threshold <number>', 'Minimum complexity score to recommend expansion (1-10)', '5')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.option('-r, --research', 'Use Perplexity AI for research-backed complexity analysis')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file || 'tasks/tasks.json';
|
|
|
|
const outputPath = options.output;
|
|
|
|
const modelOverride = options.model;
|
|
|
|
const thresholdScore = parseFloat(options.threshold);
|
|
|
|
const useResearch = options.research || false;
|
|
|
|
|
|
|
|
console.log(chalk.blue(`Analyzing task complexity from: ${tasksPath}`));
|
|
|
|
console.log(chalk.blue(`Output report will be saved to: ${outputPath}`));
|
|
|
|
|
|
|
|
if (useResearch) {
|
|
|
|
console.log(chalk.blue('Using Perplexity AI for research-backed complexity analysis'));
|
|
|
|
}
|
|
|
|
|
|
|
|
await analyzeTaskComplexity(options);
|
|
|
|
});
|
|
|
|
|
|
|
|
// clear-subtasks command
|
|
|
|
programInstance
|
|
|
|
.command('clear-subtasks')
|
|
|
|
.description('Clear subtasks from specified tasks')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.option('-i, --id <ids>', 'Task IDs (comma-separated) to clear subtasks from')
|
|
|
|
.option('--all', 'Clear subtasks from all tasks')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const taskIds = options.id;
|
|
|
|
const all = options.all;
|
|
|
|
|
|
|
|
if (!taskIds && !all) {
|
|
|
|
console.error(chalk.red('Error: Please specify task IDs with --id=<ids> or use --all to clear all tasks'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (all) {
|
|
|
|
// If --all is specified, get all task IDs
|
|
|
|
const data = readJSON(tasksPath);
|
|
|
|
if (!data || !data.tasks) {
|
|
|
|
console.error(chalk.red('Error: No valid tasks found'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
const allIds = data.tasks.map(t => t.id).join(',');
|
|
|
|
clearSubtasks(tasksPath, allIds);
|
|
|
|
} else {
|
|
|
|
clearSubtasks(tasksPath, taskIds);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// add-task command
|
|
|
|
programInstance
|
|
|
|
.command('add-task')
|
|
|
|
.description('Add a new task using AI')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.option('-p, --prompt <text>', 'Description of the task to add (required)')
|
|
|
|
.option('-d, --dependencies <ids>', 'Comma-separated list of task IDs this task depends on')
|
|
|
|
.option('--priority <priority>', 'Task priority (high, medium, low)', 'medium')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const prompt = options.prompt;
|
|
|
|
const dependencies = options.dependencies ? options.dependencies.split(',').map(id => parseInt(id.trim(), 10)) : [];
|
|
|
|
const priority = options.priority;
|
|
|
|
|
|
|
|
if (!prompt) {
|
|
|
|
console.error(chalk.red('Error: --prompt parameter is required. Please provide a task description.'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(chalk.blue(`Adding new task with description: "${prompt}"`));
|
|
|
|
console.log(chalk.blue(`Dependencies: ${dependencies.length > 0 ? dependencies.join(', ') : 'None'}`));
|
|
|
|
console.log(chalk.blue(`Priority: ${priority}`));
|
|
|
|
|
|
|
|
await addTask(tasksPath, prompt, dependencies, priority);
|
|
|
|
});
|
|
|
|
|
|
|
|
// next command
|
|
|
|
programInstance
|
|
|
|
.command('next')
|
|
|
|
.description(`Show the next task to work on based on dependencies and status${chalk.reset('')}`)
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
await displayNextTask(tasksPath);
|
|
|
|
});
|
|
|
|
|
|
|
|
// show command
|
|
|
|
programInstance
|
|
|
|
.command('show')
|
|
|
|
.description(`Display detailed information about a specific task${chalk.reset('')}`)
|
|
|
|
.argument('[id]', 'Task ID to show')
|
|
|
|
.option('-i, --id <id>', 'Task ID to show')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.action(async (taskId, options) => {
|
|
|
|
const idArg = taskId || options.id;
|
|
|
|
|
|
|
|
if (!idArg) {
|
|
|
|
console.error(chalk.red('Error: Please provide a task ID'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
const tasksPath = options.file;
|
|
|
|
await displayTaskById(tasksPath, idArg);
|
|
|
|
});
|
|
|
|
|
|
|
|
// add-dependency command
|
|
|
|
programInstance
|
|
|
|
.command('add-dependency')
|
|
|
|
.description('Add a dependency to a task')
|
|
|
|
.option('-i, --id <id>', 'Task ID to add dependency to')
|
|
|
|
.option('-d, --depends-on <id>', 'Task ID that will become a dependency')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const taskId = options.id;
|
|
|
|
const dependencyId = options.dependsOn;
|
|
|
|
|
|
|
|
if (!taskId || !dependencyId) {
|
|
|
|
console.error(chalk.red('Error: Both --id and --depends-on are required'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
await addDependency(tasksPath, parseInt(taskId, 10), parseInt(dependencyId, 10));
|
|
|
|
});
|
|
|
|
|
|
|
|
// remove-dependency command
|
|
|
|
programInstance
|
|
|
|
.command('remove-dependency')
|
|
|
|
.description('Remove a dependency from a task')
|
|
|
|
.option('-i, --id <id>', 'Task ID to remove dependency from')
|
|
|
|
.option('-d, --depends-on <id>', 'Task ID to remove as a dependency')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const taskId = options.id;
|
|
|
|
const dependencyId = options.dependsOn;
|
|
|
|
|
|
|
|
if (!taskId || !dependencyId) {
|
|
|
|
console.error(chalk.red('Error: Both --id and --depends-on are required'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
await removeDependency(tasksPath, parseInt(taskId, 10), parseInt(dependencyId, 10));
|
|
|
|
});
|
|
|
|
|
|
|
|
// validate-dependencies command
|
|
|
|
programInstance
|
|
|
|
.command('validate-dependencies')
|
|
|
|
.description(`Identify invalid dependencies without fixing them${chalk.reset('')}`)
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.action(async (options) => {
|
|
|
|
await validateDependenciesCommand(options.file);
|
|
|
|
});
|
|
|
|
|
|
|
|
// fix-dependencies command
|
|
|
|
programInstance
|
|
|
|
.command('fix-dependencies')
|
|
|
|
.description(`Fix invalid dependencies automatically${chalk.reset('')}`)
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.action(async (options) => {
|
|
|
|
await fixDependenciesCommand(options.file);
|
|
|
|
});
|
|
|
|
|
|
|
|
// complexity-report command
|
|
|
|
programInstance
|
|
|
|
.command('complexity-report')
|
|
|
|
.description(`Display the complexity analysis report${chalk.reset('')}`)
|
|
|
|
.option('-f, --file <file>', 'Path to the report file', 'scripts/task-complexity-report.json')
|
|
|
|
.action(async (options) => {
|
|
|
|
await displayComplexityReport(options.file);
|
|
|
|
});
|
2025-03-24 21:18:49 -04:00
|
|
|
|
|
|
|
// add-subtask command
|
|
|
|
programInstance
|
|
|
|
.command('add-subtask')
|
|
|
|
.description('Add a subtask to an existing task')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.option('-p, --parent <id>', 'Parent task ID (required)')
|
|
|
|
.option('-i, --task-id <id>', 'Existing task ID to convert to subtask')
|
|
|
|
.option('-t, --title <title>', 'Title for the new subtask (when creating a new subtask)')
|
|
|
|
.option('-d, --description <text>', 'Description for the new subtask')
|
|
|
|
.option('--details <text>', 'Implementation details for the new subtask')
|
|
|
|
.option('--dependencies <ids>', 'Comma-separated list of dependency IDs for the new subtask')
|
|
|
|
.option('-s, --status <status>', 'Status for the new subtask', 'pending')
|
|
|
|
.option('--no-generate', 'Skip regenerating task files')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const parentId = options.parent;
|
|
|
|
const existingTaskId = options.taskId;
|
|
|
|
const generateFiles = options.generate;
|
|
|
|
|
|
|
|
if (!parentId) {
|
|
|
|
console.error(chalk.red('Error: --parent parameter is required. Please provide a parent task ID.'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse dependencies if provided
|
|
|
|
let dependencies = [];
|
|
|
|
if (options.dependencies) {
|
|
|
|
dependencies = options.dependencies.split(',').map(id => {
|
|
|
|
// Handle both regular IDs and dot notation
|
|
|
|
return id.includes('.') ? id.trim() : parseInt(id.trim(), 10);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
if (existingTaskId) {
|
|
|
|
// Convert existing task to subtask
|
|
|
|
console.log(chalk.blue(`Converting task ${existingTaskId} to a subtask of ${parentId}...`));
|
|
|
|
await addSubtask(tasksPath, parentId, existingTaskId, null, generateFiles);
|
|
|
|
console.log(chalk.green(`✓ Task ${existingTaskId} successfully converted to a subtask of task ${parentId}`));
|
|
|
|
} else if (options.title) {
|
|
|
|
// Create new subtask with provided data
|
|
|
|
console.log(chalk.blue(`Creating new subtask for parent task ${parentId}...`));
|
|
|
|
|
|
|
|
const newSubtaskData = {
|
|
|
|
title: options.title,
|
|
|
|
description: options.description || '',
|
|
|
|
details: options.details || '',
|
|
|
|
status: options.status || 'pending',
|
|
|
|
dependencies: dependencies
|
|
|
|
};
|
|
|
|
|
|
|
|
const subtask = await addSubtask(tasksPath, parentId, null, newSubtaskData, generateFiles);
|
|
|
|
console.log(chalk.green(`✓ New subtask ${parentId}.${subtask.id} successfully created`));
|
|
|
|
|
|
|
|
// Display success message and suggested next steps
|
|
|
|
console.log(boxen(
|
|
|
|
chalk.white.bold(`Subtask ${parentId}.${subtask.id} Added Successfully`) + '\n\n' +
|
|
|
|
chalk.white(`Title: ${subtask.title}`) + '\n' +
|
|
|
|
chalk.white(`Status: ${getStatusWithColor(subtask.status)}`) + '\n' +
|
|
|
|
(dependencies.length > 0 ? chalk.white(`Dependencies: ${dependencies.join(', ')}`) + '\n' : '') +
|
|
|
|
'\n' +
|
|
|
|
chalk.white.bold('Next Steps:') + '\n' +
|
|
|
|
chalk.cyan(`1. Run ${chalk.yellow(`task-master show ${parentId}`)} to see the parent task with all subtasks`) + '\n' +
|
|
|
|
chalk.cyan(`2. Run ${chalk.yellow(`task-master set-status --id=${parentId}.${subtask.id} --status=in-progress`)} to start working on it`),
|
|
|
|
{ padding: 1, borderColor: 'green', borderStyle: 'round', margin: { top: 1 } }
|
|
|
|
));
|
|
|
|
} else {
|
|
|
|
console.error(chalk.red('Error: Either --task-id or --title must be provided.'));
|
|
|
|
console.log(boxen(
|
|
|
|
chalk.white.bold('Usage Examples:') + '\n\n' +
|
|
|
|
chalk.white('Convert existing task to subtask:') + '\n' +
|
|
|
|
chalk.yellow(` task-master add-subtask --parent=5 --task-id=8`) + '\n\n' +
|
|
|
|
chalk.white('Create new subtask:') + '\n' +
|
|
|
|
chalk.yellow(` task-master add-subtask --parent=5 --title="Implement login UI" --description="Create the login form"`) + '\n\n',
|
|
|
|
{ padding: 1, borderColor: 'blue', borderStyle: 'round' }
|
|
|
|
));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.error(chalk.red(`Error: ${error.message}`));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// remove-subtask command
|
|
|
|
programInstance
|
|
|
|
.command('remove-subtask')
|
|
|
|
.description('Remove a subtask from its parent task')
|
|
|
|
.option('-f, --file <file>', 'Path to the tasks file', 'tasks/tasks.json')
|
|
|
|
.option('-i, --id <id>', 'Subtask ID to remove in format "parentId.subtaskId" (required)')
|
|
|
|
.option('-c, --convert', 'Convert the subtask to a standalone task instead of deleting it')
|
|
|
|
.option('--no-generate', 'Skip regenerating task files')
|
|
|
|
.action(async (options) => {
|
|
|
|
const tasksPath = options.file;
|
|
|
|
const subtaskId = options.id;
|
|
|
|
const convertToTask = options.convert || false;
|
|
|
|
const generateFiles = options.generate;
|
|
|
|
|
|
|
|
if (!subtaskId) {
|
|
|
|
console.error(chalk.red('Error: --id parameter is required. Please provide a subtask ID in format "parentId.subtaskId".'));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
console.log(chalk.blue(`Removing subtask ${subtaskId}...`));
|
|
|
|
if (convertToTask) {
|
|
|
|
console.log(chalk.blue('The subtask will be converted to a standalone task'));
|
|
|
|
}
|
|
|
|
|
|
|
|
const result = await removeSubtask(tasksPath, subtaskId, convertToTask, generateFiles);
|
|
|
|
|
|
|
|
if (convertToTask && result) {
|
|
|
|
// Display success message and next steps for converted task
|
|
|
|
console.log(boxen(
|
|
|
|
chalk.white.bold(`Subtask ${subtaskId} Converted to Task #${result.id}`) + '\n\n' +
|
|
|
|
chalk.white(`Title: ${result.title}`) + '\n' +
|
|
|
|
chalk.white(`Status: ${getStatusWithColor(result.status)}`) + '\n' +
|
|
|
|
chalk.white(`Dependencies: ${result.dependencies.join(', ')}`) + '\n\n' +
|
|
|
|
chalk.white.bold('Next Steps:') + '\n' +
|
|
|
|
chalk.cyan(`1. Run ${chalk.yellow(`task-master show ${result.id}`)} to see details of the new task`) + '\n' +
|
|
|
|
chalk.cyan(`2. Run ${chalk.yellow(`task-master set-status --id=${result.id} --status=in-progress`)} to start working on it`),
|
|
|
|
{ padding: 1, borderColor: 'green', borderStyle: 'round', margin: { top: 1 } }
|
|
|
|
));
|
|
|
|
} else {
|
|
|
|
// Display success message for deleted subtask
|
|
|
|
console.log(boxen(
|
|
|
|
chalk.white.bold(`Subtask ${subtaskId} Removed`) + '\n\n' +
|
|
|
|
chalk.white('The subtask has been successfully deleted.'),
|
|
|
|
{ padding: 1, borderColor: 'green', borderStyle: 'round', margin: { top: 1 } }
|
|
|
|
));
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.error(chalk.red(`Error: ${error.message}`));
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
});
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
|
2025-03-26 15:54:51 -04:00
|
|
|
// init command (documentation only, implementation is in init.js)
|
|
|
|
programInstance
|
|
|
|
.command('init')
|
|
|
|
.description('Initialize a new project with Task Master structure')
|
|
|
|
.option('-n, --name <name>', 'Project name')
|
|
|
|
.option('-my_name <name>', 'Project name (alias for --name)')
|
|
|
|
.option('--my_name <name>', 'Project name (alias for --name)')
|
|
|
|
.option('-d, --description <description>', 'Project description')
|
|
|
|
.option('-my_description <description>', 'Project description (alias for --description)')
|
|
|
|
.option('-v, --version <version>', 'Project version')
|
|
|
|
.option('-my_version <version>', 'Project version (alias for --version)')
|
|
|
|
.option('-a, --author <author>', 'Author name')
|
|
|
|
.option('-y, --yes', 'Skip prompts and use default values')
|
|
|
|
.option('--skip-install', 'Skip installing dependencies')
|
|
|
|
.action(() => {
|
|
|
|
console.log(chalk.yellow('The init command must be run as a standalone command: task-master init'));
|
|
|
|
console.log(chalk.cyan('Example usage:'));
|
|
|
|
console.log(chalk.white(' task-master init -n "My Project" -d "Project description"'));
|
|
|
|
console.log(chalk.white(' task-master init -my_name "My Project" -my_description "Project description"'));
|
|
|
|
console.log(chalk.white(' task-master init -y'));
|
|
|
|
process.exit(0);
|
|
|
|
});
|
|
|
|
|
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.
2025-03-23 23:19:37 -04:00
|
|
|
// Add more commands as needed...
|
|
|
|
|
|
|
|
return programInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setup the CLI application
|
|
|
|
* @returns {Object} Configured Commander program
|
|
|
|
*/
|
|
|
|
function setupCLI() {
|
|
|
|
// Create a new program instance
|
|
|
|
const programInstance = program
|
|
|
|
.name('dev')
|
|
|
|
.description('AI-driven development task management')
|
|
|
|
.version(() => {
|
|
|
|
// Read version directly from package.json
|
|
|
|
try {
|
|
|
|
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
|
|
if (fs.existsSync(packageJsonPath)) {
|
|
|
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
|
|
return packageJson.version;
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
// Silently fall back to default version
|
|
|
|
}
|
|
|
|
return CONFIG.projectVersion; // Default fallback
|
|
|
|
})
|
|
|
|
.helpOption('-h, --help', 'Display help')
|
|
|
|
.addHelpCommand(false) // Disable default help command
|
|
|
|
.on('--help', () => {
|
|
|
|
displayHelp(); // Use your custom help display instead
|
|
|
|
})
|
|
|
|
.on('-h', () => {
|
|
|
|
displayHelp();
|
|
|
|
process.exit(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Modify the help option to use your custom display
|
|
|
|
programInstance.helpInformation = () => {
|
|
|
|
displayHelp();
|
|
|
|
return '';
|
|
|
|
};
|
|
|
|
|
|
|
|
// Register commands
|
|
|
|
registerCommands(programInstance);
|
|
|
|
|
|
|
|
return programInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse arguments and run the CLI
|
|
|
|
* @param {Array} argv - Command-line arguments
|
|
|
|
*/
|
|
|
|
async function runCLI(argv = process.argv) {
|
|
|
|
try {
|
|
|
|
// Display banner if not in a pipe
|
|
|
|
if (process.stdout.isTTY) {
|
|
|
|
displayBanner();
|
|
|
|
}
|
|
|
|
|
|
|
|
// If no arguments provided, show help
|
|
|
|
if (argv.length <= 2) {
|
|
|
|
displayHelp();
|
|
|
|
process.exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Setup and parse
|
|
|
|
const programInstance = setupCLI();
|
|
|
|
await programInstance.parseAsync(argv);
|
|
|
|
} catch (error) {
|
|
|
|
console.error(chalk.red(`Error: ${error.message}`));
|
|
|
|
|
|
|
|
if (CONFIG.debug) {
|
|
|
|
console.error(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
registerCommands,
|
|
|
|
setupCLI,
|
|
|
|
runCLI
|
|
|
|
};
|