assets/scripts_README.md
This folder contains a meta-development script (dev.js) and related utilities that manage tasks for an AI-driven or traditional software development workflow. The script revolves around a tasks.json file, which holds an up-to-date list of development tasks.
In an AI-driven development process—particularly with tools like Cursor—it's beneficial to have a single source of truth for tasks. This script allows you to:
.txt) to initialize a set of tasks (tasks.json).task_001.txt) for easy reference or to feed into an AI coding workflow.done, pending, or deferred based on progress.Task Master configuration is now managed through two primary methods:
.taskmaster/config.json File (Project Root - Primary)
main, research, fallback), model parameters (maxTokens, temperature), logLevel, defaultSubtasks, defaultPriority, projectName, etc.task-master models --setup command or the models MCP tool.Environment Variables (.env File - API Keys Only)
ANTHROPIC_API_KEY, PERPLEXITY_API_KEY)..env file in your project root for CLI usage.assets/env.example for required key names.Important: Settings like MODEL, MAX_TOKENS, TEMPERATURE, TASKMASTER_LOG_LEVEL, etc., are no longer set via .env. Use task-master models --setup instead.
tasks.json:
id, title, description, status, etc.).meta field can store additional info like the project's name, version, or reference to the PRD.subtasks for more detailed implementation steps.CLI Commands You can run the commands via:
# If installed globally
task-master [command] [options]
# If using locally within the project
node scripts/dev.js [command] [options]
Available commands:
init: Initialize a new projectparse-prd: Generate tasks from a PRD documentlist: Display all tasks with their statusupdate: Update tasks based on new informationgenerate: Create individual task filesset-status: Change a task's statusexpand: Add subtasks to a task or all tasksclear-subtasks: Remove subtasks from specified tasksnext: Determine the next task to work on based on dependenciesshow: Display detailed information about a specific taskanalyze-complexity: Analyze task complexity and generate recommendationscomplexity-report: Display the complexity analysis in a readable formatadd-dependency: Add a dependency between tasksremove-dependency: Remove a dependency from a taskvalidate-dependencies: Check for invalid dependenciesfix-dependencies: Fix invalid dependencies automaticallyadd-task: Add a new task using AIRun task-master --help or node scripts/dev.js --help to see detailed usage information.
The list command allows you to view all tasks and their status:
# List all tasks
task-master list
# List tasks with a specific status
task-master list --status=pending
# List tasks and include their subtasks
task-master list --with-subtasks
# List tasks with a specific status and include their subtasks
task-master list --status=pending --with-subtasks
The update command allows you to update tasks based on new information or implementation changes:
# Update tasks starting from ID 4 with a new prompt
task-master update --from=4 --prompt="Refactor tasks from ID 4 onward to use Express instead of Fastify"
# Update all tasks (default from=1)
task-master update --prompt="Add authentication to all relevant tasks"
# Specify a different tasks file
task-master update --file=custom-tasks.json --from=5 --prompt="Change database from MongoDB to PostgreSQL"
Notes:
--prompt parameter is required and should explain the changes or new contextThe set-status command allows you to change a task's status:
# Mark a task as done
task-master set-status --id=3 --status=done
# Mark a task as pending
task-master set-status --id=4 --status=pending
# Mark a specific subtask as done
task-master set-status --id=3.1 --status=done
# Mark multiple tasks at once
task-master set-status --id=1,2,3 --status=done
Notes:
parentId.subtaskId (e.g., 3.1)The expand command allows you to break down tasks into subtasks for more detailed implementation:
# Expand a specific task with 3 subtasks (default)
task-master expand --id=3
# Expand a specific task with 5 subtasks
task-master expand --id=3 --num=5
# Expand a task with additional context
task-master expand --id=3 --prompt="Focus on security aspects"
# Expand all pending tasks that don't have subtasks
task-master expand --all
# Force regeneration of subtasks for all pending tasks
task-master expand --all --force
# Use Perplexity AI for research-backed subtask generation
task-master expand --id=3 --research
# Use Perplexity AI for research-backed generation on all pending tasks
task-master expand --all --research
The clear-subtasks command allows you to remove subtasks from specified tasks:
# Clear subtasks from a specific task
task-master clear-subtasks --id=3
# Clear subtasks from multiple tasks
task-master clear-subtasks --id=1,2,3
# Clear subtasks from all tasks
task-master clear-subtasks --all
Notes:
expand command to immediately generate new subtasksai-services-unified.js).--research) is determined by the configuration in .taskmaster/config.json based on the requested role (main or research)..env file (for CLI) or MCP session environment.expand --research), ensure you have:
research role using task-master models --setup (Perplexity models are recommended).PERPLEXITY_API_KEY) to your .env file.The script supports different logging levels controlled by the TASKMASTER_LOG_LEVEL environment variable:
debug: Detailed information, typically useful for troubleshootinginfo: Confirmation that things are working as expected (default)warn: Warning messages that don't prevent executionerror: Error messages that might prevent executionWhen DEBUG=true is set, debug logs are also written to a dev-debug.log file in the project root.
The add-dependency and remove-dependency commands allow you to manage task dependencies:
# Add a dependency to a task
task-master add-dependency --id=<id> --depends-on=<id>
# Remove a dependency from a task
task-master remove-dependency --id=<id> --depends-on=<id>
These commands:
Allow precise dependency management:
Include validation checks:
Provide clear feedback:
Automatically update task files:
The script provides two specialized commands to ensure task dependencies remain valid and properly maintained:
The validate-dependencies command allows you to check for invalid dependencies without making changes:
# Check for invalid dependencies in tasks.json
task-master validate-dependencies
# Specify a different tasks file
task-master validate-dependencies --file=custom-tasks.json
This command:
Use this command to audit your task structure before applying fixes.
The fix-dependencies command proactively finds and fixes all invalid dependencies:
# Find and fix all invalid dependencies
task-master fix-dependencies
# Specify a different tasks file
task-master fix-dependencies --file=custom-tasks.json
This command:
This is especially useful when tasks have been deleted or IDs have changed, potentially breaking dependency chains.
The analyze-complexity command allows you to automatically assess task complexity and generate expansion recommendations:
# Analyze all tasks and generate expansion recommendations
task-master analyze-complexity
# Specify a custom output file
task-master analyze-complexity --output=custom-report.json
# Override the model used for analysis
task-master analyze-complexity --model=claude-3-opus-20240229
# Set a custom complexity threshold (1-10)
task-master analyze-complexity --threshold=6
# Use Perplexity AI for research-backed complexity analysis
task-master analyze-complexity --research
Notes:
scripts/task-complexity-report.jsonexpansionCommand that can be copied directly to the terminal or executed programmaticallyThe expand command automatically checks for and uses complexity analysis if available:
# Expand a task, using complexity report recommendations if available
task-master expand --id=8
# Expand all tasks, prioritizing by complexity score if a report exists
task-master expand --all
# Override recommendations with explicit values
task-master expand --id=8 --num=5 --prompt="Custom prompt"
When a complexity report exists:
expand command will use the recommended subtask count from the report (unless overridden)--all, tasks are sorted by complexity score (highest first)--research flag is preserved from the complexity analysis to expansionThe output report structure is:
{
"meta": {
"generatedAt": "2023-06-15T12:34:56.789Z",
"tasksAnalyzed": 20,
"thresholdScore": 5,
"projectName": "Your Project Name",
"usedResearch": true
},
"complexityAnalysis": [
{
"taskId": 8,
"taskTitle": "Develop Implementation Drift Handling",
"complexityScore": 9.5,
"recommendedSubtasks": 6,
"expansionPrompt": "Create subtasks that handle detecting...",
"reasoning": "This task requires sophisticated logic...",
"expansionCommand": "task-master expand --id=8 --num=6 --prompt=\"Create subtasks...\" --research"
}
// More tasks sorted by complexity score (highest first)
]
}
The next command helps you determine which task to work on next based on dependencies and status:
# Show the next task to work on
task-master next
# Specify a different tasks file
task-master next --file=custom-tasks.json
This command:
This feature ensures you're always working on the most appropriate task based on your project's current state and dependency structure.
The show command allows you to view detailed information about a specific task:
# Show details for a specific task
task-master show 1
# Alternative syntax with --id option
task-master show --id=1
# Show details for a subtask
task-master show --id=1.2
# Specify a different tasks file
task-master show 3 --file=custom-tasks.json
This command:
This command is particularly useful when you need to examine a specific task in detail before implementing it or when you want to check the status and details of a particular task.