Fix: Ensure consistent handling of kebab-case flags in CLI
- Enhanced the function in ℹ️ Initialized Perplexity client with OpenAI compatibility layer _____ _ __ __ _ |_ _|_ _ ___| | __ | \/ | __ _ ___| |_ ___ _ __ | |/ _` / __| |/ / | |\/| |/ _` / __| __/ _ \ '__| | | (_| \__ \ < | | | | (_| \__ \ || __/ | |_|\__,_|___/_|\_\ |_| |_|\__,_|___/\__\___|_| by https://x.com/eyaltoledano ╭────────────────────────────────────────────╮ │ │ │ Version: 0.9.24 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-pro 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 _____ _ __ __ _ |_ _|_ _ ___| | __ | \/ | __ _ ___| |_ ___ _ __ | |/ _` / __| |/ / | |\/| |/ _` / __| __/ _ \ '__| | | (_| \__ \ < | | | | (_| \__ \ || __/ | |_|\__,_|___/_|\_\ |_| |_|\__,_|___/\__\___|_| by https://x.com/eyaltoledano ╭────────────────────────────────────────────╮ │ │ │ Version: 0.9.24 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-pro 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 to correctly handle kebab-case flags by: - Converting camelCase options back to kebab-case for command line arguments. - Checking the original CLI arguments to determine the format used by the user. - Preserving the original flag format when passing it to the underlying script. - Special handling for and flags to ensure they are correctly interpreted. - Updated boolean flag handling to correctly manage negated options and preserve user-specified formats. - Marked task 022 as done and updated the status of its sub-tasks in . - Added tasks 26, 27 and 28 for context improvements related to task generation This commit ensures that all kebab-case flags are handled consistently across the CLI, improving user experience and command reliability.
This commit is contained in:
@@ -52,24 +52,82 @@ function createDevScriptAction(commandName) {
|
||||
args.push(...cmd.args);
|
||||
}
|
||||
|
||||
// Get the original CLI arguments to detect which options were explicitly specified
|
||||
const originalArgs = process.argv;
|
||||
|
||||
// Special handling for parent parameter which seems to have issues
|
||||
const parentArg = originalArgs.find(arg => arg.startsWith('--parent='));
|
||||
if (parentArg) {
|
||||
args.push('-p', parentArg.split('=')[1]);
|
||||
} else if (options.parent) {
|
||||
args.push('-p', options.parent);
|
||||
}
|
||||
|
||||
// Add all options
|
||||
Object.entries(options).forEach(([key, value]) => {
|
||||
// Skip the Command's built-in properties
|
||||
// Skip the Command's built-in properties and parent (special handling)
|
||||
if (['parent', 'commands', 'options', 'rawArgs'].includes(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Special case: handle the 'generate' option which is automatically set to true
|
||||
// We should only include it if --no-generate was explicitly specified
|
||||
if (key === 'generate') {
|
||||
// Check if --no-generate was explicitly specified
|
||||
if (originalArgs.includes('--no-generate')) {
|
||||
args.push('--no-generate');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Look for how this parameter was passed in the original arguments
|
||||
// Find if it was passed as --key=value
|
||||
const equalsFormat = originalArgs.find(arg => arg.startsWith(`--${key}=`));
|
||||
|
||||
// Check for kebab-case flags
|
||||
// Convert camelCase back to kebab-case for command line arguments
|
||||
const kebabKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();
|
||||
|
||||
// Check if it was passed with kebab-case
|
||||
const foundInOriginal = originalArgs.find(arg =>
|
||||
arg === `--${key}` ||
|
||||
arg === `--${kebabKey}` ||
|
||||
arg.startsWith(`--${key}=`) ||
|
||||
arg.startsWith(`--${kebabKey}=`)
|
||||
);
|
||||
|
||||
// Determine the actual flag name to use (original or kebab-case)
|
||||
const flagName = foundInOriginal ?
|
||||
(foundInOriginal.startsWith('--') ? foundInOriginal.split('=')[0].slice(2) : key) :
|
||||
key;
|
||||
|
||||
if (equalsFormat) {
|
||||
// Preserve the original format with equals sign
|
||||
args.push(equalsFormat);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle boolean flags
|
||||
if (typeof value === 'boolean') {
|
||||
if (value === true) {
|
||||
args.push(`--${key}`);
|
||||
} else if (key.startsWith('no-')) {
|
||||
// Handle --no-X options
|
||||
const baseOption = key.substring(3);
|
||||
args.push(`--${baseOption}`);
|
||||
// For non-negated options, add the flag
|
||||
if (!flagName.startsWith('no-')) {
|
||||
args.push(`--${flagName}`);
|
||||
}
|
||||
} else {
|
||||
// For false values, use --no-X format
|
||||
if (flagName.startsWith('no-')) {
|
||||
// If option is already in --no-X format, it means the user used --no-X explicitly
|
||||
// We need to pass it as is
|
||||
args.push(`--${flagName}`);
|
||||
} else {
|
||||
// If it's a regular option set to false, convert to --no-X
|
||||
args.push(`--no-${flagName}`);
|
||||
}
|
||||
}
|
||||
} else if (value !== undefined) {
|
||||
args.push(`--${key}`, value.toString());
|
||||
// For non-boolean values, pass as --key value (space-separated)
|
||||
args.push(`--${flagName}`, value.toString());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Task ID: 22
|
||||
# Title: Create Comprehensive Test Suite for Task Master CLI
|
||||
# Status: in-progress
|
||||
# Status: done
|
||||
# Dependencies: 21
|
||||
# Priority: high
|
||||
# Description: Develop a complete testing infrastructure for the Task Master CLI that includes unit, integration, and end-to-end tests to verify all core functionality and error handling.
|
||||
@@ -63,13 +63,13 @@ The task will be considered complete when all tests pass consistently, coverage
|
||||
### Details:
|
||||
|
||||
|
||||
## 2. Implement Unit Tests for Core Components [pending]
|
||||
## 2. Implement Unit Tests for Core Components [done]
|
||||
### Dependencies: 22.1
|
||||
### Description: Create a comprehensive set of unit tests for all utility functions, core logic components, and individual modules of the Task Master CLI. This includes tests for task creation, parsing, manipulation, data storage, retrieval, and formatting functions. Ensure all edge cases and error scenarios are covered.
|
||||
### Details:
|
||||
|
||||
|
||||
## 3. Develop Integration and End-to-End Tests [pending]
|
||||
## 3. Develop Integration and End-to-End Tests [deferred]
|
||||
### Dependencies: 22.1, 22.2
|
||||
### Description: Create integration tests that verify the correct interaction between different components of the CLI, including command execution, option parsing, and data flow. Implement end-to-end tests that simulate complete user workflows, such as creating a task, expanding it, and updating its status. Include tests for error scenarios, recovery processes, and handling large numbers of tasks.
|
||||
### Details:
|
||||
|
||||
96
tasks/task_026.txt
Normal file
96
tasks/task_026.txt
Normal file
@@ -0,0 +1,96 @@
|
||||
# Task ID: 26
|
||||
# Title: Implement Context Foundation for AI Operations
|
||||
# Status: pending
|
||||
# Dependencies: 5, 6, 7
|
||||
# Priority: high
|
||||
# Description: Implement the foundation for context integration in Task Master, enabling AI operations to leverage file-based context, cursor rules, and basic code context to improve generated outputs.
|
||||
# Details:
|
||||
Create a Phase 1 foundation for context integration in Task Master that provides immediate practical value:
|
||||
|
||||
1. Add `--context-file` Flag to AI Commands:
|
||||
- Add a consistent `--context-file <file>` option to all AI-related commands (expand, update, add-task, etc.)
|
||||
- Implement file reading functionality that loads content from the specified file
|
||||
- Add content integration into Claude API prompts with appropriate formatting
|
||||
- Handle error conditions such as file not found gracefully
|
||||
- Update help documentation to explain the new option
|
||||
|
||||
2. Implement Cursor Rules Integration for Context:
|
||||
- Create a `--context-rules <rules>` option for all AI commands
|
||||
- Implement functionality to extract content from specified .cursor/rules/*.mdc files
|
||||
- Support comma-separated lists of rule names and "all" option
|
||||
- Add validation and error handling for non-existent rules
|
||||
- Include helpful examples in command help output
|
||||
|
||||
3. Implement Basic Context File Extraction Utility:
|
||||
- Create utility functions in utils.js for reading context from files
|
||||
- Add proper error handling and logging
|
||||
- Implement content validation to ensure reasonable size limits
|
||||
- Add content truncation if files exceed token limits
|
||||
- Create helper functions for formatting context additions properly
|
||||
|
||||
4. Update Command Handler Logic:
|
||||
- Modify command handlers to support the new context options
|
||||
- Update prompt construction to incorporate context content
|
||||
- Ensure backwards compatibility with existing commands
|
||||
- Add logging for context inclusion to aid troubleshooting
|
||||
|
||||
The focus of this phase is to provide immediate value with straightforward implementations that enable users to include relevant context in their AI operations.
|
||||
|
||||
# Test Strategy:
|
||||
Testing should verify that the context foundation works as expected and adds value:
|
||||
|
||||
1. Functional Tests:
|
||||
- Verify `--context-file` flag correctly reads and includes content from specified files
|
||||
- Test that `--context-rules` correctly extracts and formats content from cursor rules
|
||||
- Test with both existing and non-existent files/rules to verify error handling
|
||||
- Verify content truncation works appropriately for large files
|
||||
|
||||
2. Integration Tests:
|
||||
- Test each AI-related command with context options
|
||||
- Verify context is properly included in API calls to Claude
|
||||
- Test combinations of multiple context options
|
||||
- Verify help documentation includes the new options
|
||||
|
||||
3. Usability Testing:
|
||||
- Create test scenarios that show clear improvement in AI output quality with context
|
||||
- Compare outputs with and without context to measure impact
|
||||
- Document examples of effective context usage for the user documentation
|
||||
|
||||
4. Error Handling:
|
||||
- Test invalid file paths and rule names
|
||||
- Test oversized context files
|
||||
- Verify appropriate error messages guide users to correct usage
|
||||
|
||||
The testing focus should be on proving immediate value to users while ensuring robust error handling.
|
||||
|
||||
# Subtasks:
|
||||
## 1. Implement --context-file Flag for AI Commands [pending]
|
||||
### Dependencies: None
|
||||
### Description: Add the --context-file <file> option to all AI-related commands and implement file reading functionality
|
||||
### Details:
|
||||
1. Update the contextOptions array in commands.js to include the --context-file option\n2. Modify AI command action handlers to check for the context-file option\n3. Implement file reading functionality that loads content from the specified file\n4. Add content integration into Claude API prompts with appropriate formatting\n5. Add error handling for file not found or permission issues\n6. Update help documentation to explain the new option with examples
|
||||
|
||||
## 2. Implement --context Flag for AI Commands [pending]
|
||||
### Dependencies: None
|
||||
### Description: Add support for directly passing context in the command line
|
||||
### Details:
|
||||
1. Update AI command options to include a --context option\n2. Modify action handlers to process context from command line\n3. Sanitize and truncate long context inputs\n4. Add content integration into Claude API prompts\n5. Update help documentation to explain the new option with examples
|
||||
|
||||
## 3. Implement Cursor Rules Integration for Context [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a --context-rules option for all AI commands that extracts content from specified .cursor/rules/*.mdc files
|
||||
### Details:
|
||||
1. Add --context-rules <rules> option to all AI-related commands\n2. Implement functionality to extract content from specified .cursor/rules/*.mdc files\n3. Support comma-separated lists of rule names and 'all' option\n4. Add validation and error handling for non-existent rules\n5. Include helpful examples in command help output
|
||||
|
||||
## 4. Implement Basic Context File Extraction Utility [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create utility functions for reading context from files with error handling and content validation
|
||||
### Details:
|
||||
1. Create utility functions in utils.js for reading context from files\n2. Add proper error handling and logging for file access issues\n3. Implement content validation to ensure reasonable size limits\n4. Add content truncation if files exceed token limits\n5. Create helper functions for formatting context additions properly\n6. Document the utility functions with clear examples
|
||||
|
||||
## 5. Test Subtask [pending]
|
||||
### Dependencies: None
|
||||
### Description: This is a test subtask
|
||||
### Details:
|
||||
|
||||
|
||||
95
tasks/task_027.txt
Normal file
95
tasks/task_027.txt
Normal file
@@ -0,0 +1,95 @@
|
||||
# Task ID: 27
|
||||
# Title: Implement Context Enhancements for AI Operations
|
||||
# Status: pending
|
||||
# Dependencies: 26
|
||||
# Priority: high
|
||||
# Description: Enhance the basic context integration with more sophisticated code context extraction, task history awareness, and PRD integration to provide richer context for AI operations.
|
||||
# Details:
|
||||
Building upon the foundational context implementation in Task #26, implement Phase 2 context enhancements:
|
||||
|
||||
1. Add Code Context Extraction Feature:
|
||||
- Create a `--context-code <pattern>` option for all AI commands
|
||||
- Implement glob-based file matching to extract code from specified patterns
|
||||
- Create intelligent code parsing to extract most relevant sections (function signatures, classes, exports)
|
||||
- Implement token usage optimization by selecting key structural elements
|
||||
- Add formatting for code context with proper file paths and syntax indicators
|
||||
|
||||
2. Implement Task History Context:
|
||||
- Add a `--context-tasks <ids>` option for AI commands
|
||||
- Support comma-separated task IDs and a "similar" option to find related tasks
|
||||
- Create functions to extract context from specified tasks or find similar tasks
|
||||
- Implement formatting for task context with clear section markers
|
||||
- Add validation and error handling for non-existent task IDs
|
||||
|
||||
3. Add PRD Context Integration:
|
||||
- Create a `--context-prd <file>` option for AI commands
|
||||
- Implement PRD text extraction and intelligent summarization
|
||||
- Add formatting for PRD context with appropriate section markers
|
||||
- Integrate with the existing PRD parsing functionality from Task #6
|
||||
|
||||
4. Improve Context Formatting and Integration:
|
||||
- Create a standardized context formatting system
|
||||
- Implement type-based sectioning for different context sources
|
||||
- Add token estimation for different context types to manage total prompt size
|
||||
- Enhance prompt templates to better integrate various context types
|
||||
|
||||
These enhancements will provide significantly richer context for AI operations, resulting in more accurate and relevant outputs while remaining practical to implement.
|
||||
|
||||
# Test Strategy:
|
||||
Testing should verify the enhanced context functionality:
|
||||
|
||||
1. Code Context Testing:
|
||||
- Verify pattern matching works for different glob patterns
|
||||
- Test code extraction with various file types and sizes
|
||||
- Verify intelligent parsing correctly identifies important code elements
|
||||
- Test token optimization by comparing full file extraction vs. optimized extraction
|
||||
- Check code formatting in prompts sent to Claude API
|
||||
|
||||
2. Task History Testing:
|
||||
- Test with different combinations of task IDs
|
||||
- Verify "similar" option correctly identifies relevant tasks
|
||||
- Test with non-existent task IDs to ensure proper error handling
|
||||
- Verify formatting and integration in prompts
|
||||
|
||||
3. PRD Context Testing:
|
||||
- Test with various PRD files of different sizes
|
||||
- Verify summarization functions correctly when PRDs are too large
|
||||
- Test integration with prompts and formatting
|
||||
|
||||
4. Performance Testing:
|
||||
- Measure the impact of context enrichment on command execution time
|
||||
- Test with large code bases to ensure reasonable performance
|
||||
- Verify token counting and optimization functions work as expected
|
||||
|
||||
5. Quality Assessment:
|
||||
- Compare AI outputs with Phase 1 vs. Phase 2 context to measure improvements
|
||||
- Create test cases that specifically benefit from code context
|
||||
- Create test cases that benefit from task history context
|
||||
|
||||
Focus testing on practical use cases that demonstrate clear improvements in AI-generated outputs.
|
||||
|
||||
# Subtasks:
|
||||
## 1. Implement Code Context Extraction Feature [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a --context-code <pattern> option for AI commands and implement glob-based file matching to extract relevant code sections
|
||||
### Details:
|
||||
|
||||
|
||||
## 2. Implement Task History Context Integration [pending]
|
||||
### Dependencies: None
|
||||
### Description: Add a --context-tasks option for AI commands that supports finding and extracting context from specified or similar tasks
|
||||
### Details:
|
||||
|
||||
|
||||
## 3. Add PRD Context Integration [pending]
|
||||
### Dependencies: None
|
||||
### Description: Implement a --context-prd option for AI commands that extracts and formats content from PRD files
|
||||
### Details:
|
||||
|
||||
|
||||
## 4. Create Standardized Context Formatting System [pending]
|
||||
### Dependencies: None
|
||||
### Description: Implement a consistent formatting system for different context types with section markers and token optimization
|
||||
### Details:
|
||||
|
||||
|
||||
112
tasks/task_028.txt
Normal file
112
tasks/task_028.txt
Normal file
@@ -0,0 +1,112 @@
|
||||
# Task ID: 28
|
||||
# Title: Implement Advanced ContextManager System
|
||||
# Status: pending
|
||||
# Dependencies: 26, 27
|
||||
# Priority: high
|
||||
# Description: Create a comprehensive ContextManager class to unify context handling with advanced features like context optimization, prioritization, and intelligent context selection.
|
||||
# Details:
|
||||
Building on Phase 1 and Phase 2 context implementations, develop Phase 3 advanced context management:
|
||||
|
||||
1. Implement the ContextManager Class:
|
||||
- Create a unified `ContextManager` class that encapsulates all context functionality
|
||||
- Implement methods for gathering context from all supported sources
|
||||
- Create a configurable context priority system to favor more relevant context types
|
||||
- Add token management to ensure context fits within API limits
|
||||
- Implement caching for frequently used context to improve performance
|
||||
|
||||
2. Create Context Optimization Pipeline:
|
||||
- Develop intelligent context optimization algorithms
|
||||
- Implement type-based truncation strategies (code vs. text)
|
||||
- Create relevance scoring to prioritize most useful context portions
|
||||
- Add token budget allocation that divides available tokens among context types
|
||||
- Implement dynamic optimization based on operation type
|
||||
|
||||
3. Add Command Interface Enhancements:
|
||||
- Create the `--context-all` flag to include all available context
|
||||
- Add the `--context-max-tokens <tokens>` option to control token allocation
|
||||
- Implement unified context options across all AI commands
|
||||
- Add intelligent default values for different command types
|
||||
|
||||
4. Integrate with AI Services:
|
||||
- Update the AI service integration to use the ContextManager
|
||||
- Create specialized context assembly for different AI operations
|
||||
- Add post-processing to capture new context from AI responses
|
||||
- Implement adaptive context selection based on operation success
|
||||
|
||||
5. Add Performance Monitoring:
|
||||
- Create context usage statistics tracking
|
||||
- Implement logging for context selection decisions
|
||||
- Add warnings for context token limits
|
||||
- Create troubleshooting utilities for context-related issues
|
||||
|
||||
The ContextManager system should provide a powerful but easy-to-use interface for both users and developers, maintaining backward compatibility with earlier phases while adding substantial new capabilities.
|
||||
|
||||
# Test Strategy:
|
||||
Testing should verify both the functionality and performance of the advanced context management:
|
||||
|
||||
1. Unit Testing:
|
||||
- Test all ContextManager class methods with various inputs
|
||||
- Verify optimization algorithms maintain critical information
|
||||
- Test caching mechanisms for correctness and efficiency
|
||||
- Verify token allocation and budgeting functions
|
||||
- Test each context source integration separately
|
||||
|
||||
2. Integration Testing:
|
||||
- Verify ContextManager integration with AI services
|
||||
- Test with all AI-related commands
|
||||
- Verify backward compatibility with existing context options
|
||||
- Test context prioritization across multiple context types
|
||||
- Verify logging and error handling
|
||||
|
||||
3. Performance Testing:
|
||||
- Benchmark context gathering and optimization times
|
||||
- Test with large and complex context sources
|
||||
- Measure impact of caching on repeated operations
|
||||
- Verify memory usage remains acceptable
|
||||
- Test with token limits of different sizes
|
||||
|
||||
4. Quality Assessment:
|
||||
- Compare AI outputs using Phase 3 vs. earlier context handling
|
||||
- Measure improvements in context relevance and quality
|
||||
- Test complex scenarios requiring multiple context types
|
||||
- Quantify the impact on token efficiency
|
||||
|
||||
5. User Experience Testing:
|
||||
- Verify CLI options are intuitive and well-documented
|
||||
- Test error messages are helpful for troubleshooting
|
||||
- Ensure log output provides useful insights
|
||||
- Test all convenience options like `--context-all`
|
||||
|
||||
Create automated test suites for regression testing of the complete context system.
|
||||
|
||||
# Subtasks:
|
||||
## 1. Implement Core ContextManager Class Structure [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a unified ContextManager class that encapsulates all context functionality with methods for gathering context from supported sources
|
||||
### Details:
|
||||
|
||||
|
||||
## 2. Develop Context Optimization Pipeline [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create intelligent algorithms for context optimization including type-based truncation, relevance scoring, and token budget allocation
|
||||
### Details:
|
||||
|
||||
|
||||
## 3. Create Command Interface Enhancements [pending]
|
||||
### Dependencies: None
|
||||
### Description: Add unified context options to all AI commands including --context-all flag and --context-max-tokens for controlling allocation
|
||||
### Details:
|
||||
|
||||
|
||||
## 4. Integrate ContextManager with AI Services [pending]
|
||||
### Dependencies: None
|
||||
### Description: Update AI service integration to use the ContextManager with specialized context assembly for different operations
|
||||
### Details:
|
||||
|
||||
|
||||
## 5. Implement Performance Monitoring and Metrics [pending]
|
||||
### Dependencies: None
|
||||
### Description: Create a system for tracking context usage statistics, logging selection decisions, and providing troubleshooting utilities
|
||||
### Details:
|
||||
|
||||
|
||||
177
tasks/tasks.json
177
tasks/tasks.json
@@ -1282,7 +1282,7 @@
|
||||
"id": 22,
|
||||
"title": "Create Comprehensive Test Suite for Task Master CLI",
|
||||
"description": "Develop a complete testing infrastructure for the Task Master CLI that includes unit, integration, and end-to-end tests to verify all core functionality and error handling.",
|
||||
"status": "in-progress",
|
||||
"status": "done",
|
||||
"dependencies": [
|
||||
21
|
||||
],
|
||||
@@ -1302,7 +1302,7 @@
|
||||
"id": 2,
|
||||
"title": "Implement Unit Tests for Core Components",
|
||||
"description": "Create a comprehensive set of unit tests for all utility functions, core logic components, and individual modules of the Task Master CLI. This includes tests for task creation, parsing, manipulation, data storage, retrieval, and formatting functions. Ensure all edge cases and error scenarios are covered.",
|
||||
"status": "pending",
|
||||
"status": "done",
|
||||
"dependencies": [
|
||||
1
|
||||
],
|
||||
@@ -1312,7 +1312,7 @@
|
||||
"id": 3,
|
||||
"title": "Develop Integration and End-to-End Tests",
|
||||
"description": "Create integration tests that verify the correct interaction between different components of the CLI, including command execution, option parsing, and data flow. Implement end-to-end tests that simulate complete user workflows, such as creating a task, expanding it, and updating its status. Include tests for error scenarios, recovery processes, and handling large numbers of tasks.",
|
||||
"status": "pending",
|
||||
"status": "deferred",
|
||||
"dependencies": [
|
||||
1,
|
||||
2
|
||||
@@ -1446,6 +1446,177 @@
|
||||
"parentTaskId": 25
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 26,
|
||||
"title": "Implement Context Foundation for AI Operations",
|
||||
"description": "Implement the foundation for context integration in Task Master, enabling AI operations to leverage file-based context, cursor rules, and basic code context to improve generated outputs.",
|
||||
"status": "pending",
|
||||
"dependencies": [
|
||||
5,
|
||||
6,
|
||||
7
|
||||
],
|
||||
"priority": "high",
|
||||
"details": "Create a Phase 1 foundation for context integration in Task Master that provides immediate practical value:\n\n1. Add `--context-file` Flag to AI Commands:\n - Add a consistent `--context-file <file>` option to all AI-related commands (expand, update, add-task, etc.)\n - Implement file reading functionality that loads content from the specified file\n - Add content integration into Claude API prompts with appropriate formatting\n - Handle error conditions such as file not found gracefully\n - Update help documentation to explain the new option\n\n2. Implement Cursor Rules Integration for Context:\n - Create a `--context-rules <rules>` option for all AI commands\n - Implement functionality to extract content from specified .cursor/rules/*.mdc files\n - Support comma-separated lists of rule names and \"all\" option\n - Add validation and error handling for non-existent rules\n - Include helpful examples in command help output\n\n3. Implement Basic Context File Extraction Utility:\n - Create utility functions in utils.js for reading context from files\n - Add proper error handling and logging\n - Implement content validation to ensure reasonable size limits\n - Add content truncation if files exceed token limits\n - Create helper functions for formatting context additions properly\n\n4. Update Command Handler Logic:\n - Modify command handlers to support the new context options\n - Update prompt construction to incorporate context content\n - Ensure backwards compatibility with existing commands\n - Add logging for context inclusion to aid troubleshooting\n\nThe focus of this phase is to provide immediate value with straightforward implementations that enable users to include relevant context in their AI operations.",
|
||||
"testStrategy": "Testing should verify that the context foundation works as expected and adds value:\n\n1. Functional Tests:\n - Verify `--context-file` flag correctly reads and includes content from specified files\n - Test that `--context-rules` correctly extracts and formats content from cursor rules\n - Test with both existing and non-existent files/rules to verify error handling\n - Verify content truncation works appropriately for large files\n\n2. Integration Tests:\n - Test each AI-related command with context options\n - Verify context is properly included in API calls to Claude\n - Test combinations of multiple context options\n - Verify help documentation includes the new options\n\n3. Usability Testing:\n - Create test scenarios that show clear improvement in AI output quality with context\n - Compare outputs with and without context to measure impact\n - Document examples of effective context usage for the user documentation\n\n4. Error Handling:\n - Test invalid file paths and rule names\n - Test oversized context files\n - Verify appropriate error messages guide users to correct usage\n\nThe testing focus should be on proving immediate value to users while ensuring robust error handling.",
|
||||
"subtasks": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Implement --context-file Flag for AI Commands",
|
||||
"description": "Add the --context-file <file> option to all AI-related commands and implement file reading functionality",
|
||||
"details": "1. Update the contextOptions array in commands.js to include the --context-file option\\n2. Modify AI command action handlers to check for the context-file option\\n3. Implement file reading functionality that loads content from the specified file\\n4. Add content integration into Claude API prompts with appropriate formatting\\n5. Add error handling for file not found or permission issues\\n6. Update help documentation to explain the new option with examples",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 26
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Implement --context Flag for AI Commands",
|
||||
"description": "Add support for directly passing context in the command line",
|
||||
"details": "1. Update AI command options to include a --context option\\n2. Modify action handlers to process context from command line\\n3. Sanitize and truncate long context inputs\\n4. Add content integration into Claude API prompts\\n5. Update help documentation to explain the new option with examples",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 26
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Implement Cursor Rules Integration for Context",
|
||||
"description": "Create a --context-rules option for all AI commands that extracts content from specified .cursor/rules/*.mdc files",
|
||||
"details": "1. Add --context-rules <rules> option to all AI-related commands\\n2. Implement functionality to extract content from specified .cursor/rules/*.mdc files\\n3. Support comma-separated lists of rule names and 'all' option\\n4. Add validation and error handling for non-existent rules\\n5. Include helpful examples in command help output",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 26
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Implement Basic Context File Extraction Utility",
|
||||
"description": "Create utility functions for reading context from files with error handling and content validation",
|
||||
"details": "1. Create utility functions in utils.js for reading context from files\\n2. Add proper error handling and logging for file access issues\\n3. Implement content validation to ensure reasonable size limits\\n4. Add content truncation if files exceed token limits\\n5. Create helper functions for formatting context additions properly\\n6. Document the utility functions with clear examples",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 26
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Test Subtask",
|
||||
"description": "This is a test subtask",
|
||||
"details": "",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 26
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 27,
|
||||
"title": "Implement Context Enhancements for AI Operations",
|
||||
"description": "Enhance the basic context integration with more sophisticated code context extraction, task history awareness, and PRD integration to provide richer context for AI operations.",
|
||||
"status": "pending",
|
||||
"dependencies": [
|
||||
26
|
||||
],
|
||||
"priority": "high",
|
||||
"details": "Building upon the foundational context implementation in Task #26, implement Phase 2 context enhancements:\n\n1. Add Code Context Extraction Feature:\n - Create a `--context-code <pattern>` option for all AI commands\n - Implement glob-based file matching to extract code from specified patterns\n - Create intelligent code parsing to extract most relevant sections (function signatures, classes, exports)\n - Implement token usage optimization by selecting key structural elements\n - Add formatting for code context with proper file paths and syntax indicators\n\n2. Implement Task History Context:\n - Add a `--context-tasks <ids>` option for AI commands\n - Support comma-separated task IDs and a \"similar\" option to find related tasks\n - Create functions to extract context from specified tasks or find similar tasks\n - Implement formatting for task context with clear section markers\n - Add validation and error handling for non-existent task IDs\n\n3. Add PRD Context Integration:\n - Create a `--context-prd <file>` option for AI commands\n - Implement PRD text extraction and intelligent summarization\n - Add formatting for PRD context with appropriate section markers\n - Integrate with the existing PRD parsing functionality from Task #6\n\n4. Improve Context Formatting and Integration:\n - Create a standardized context formatting system\n - Implement type-based sectioning for different context sources\n - Add token estimation for different context types to manage total prompt size\n - Enhance prompt templates to better integrate various context types\n\nThese enhancements will provide significantly richer context for AI operations, resulting in more accurate and relevant outputs while remaining practical to implement.",
|
||||
"testStrategy": "Testing should verify the enhanced context functionality:\n\n1. Code Context Testing:\n - Verify pattern matching works for different glob patterns\n - Test code extraction with various file types and sizes\n - Verify intelligent parsing correctly identifies important code elements\n - Test token optimization by comparing full file extraction vs. optimized extraction\n - Check code formatting in prompts sent to Claude API\n\n2. Task History Testing:\n - Test with different combinations of task IDs\n - Verify \"similar\" option correctly identifies relevant tasks\n - Test with non-existent task IDs to ensure proper error handling\n - Verify formatting and integration in prompts\n\n3. PRD Context Testing:\n - Test with various PRD files of different sizes\n - Verify summarization functions correctly when PRDs are too large\n - Test integration with prompts and formatting\n\n4. Performance Testing:\n - Measure the impact of context enrichment on command execution time\n - Test with large code bases to ensure reasonable performance\n - Verify token counting and optimization functions work as expected\n\n5. Quality Assessment:\n - Compare AI outputs with Phase 1 vs. Phase 2 context to measure improvements\n - Create test cases that specifically benefit from code context\n - Create test cases that benefit from task history context\n\nFocus testing on practical use cases that demonstrate clear improvements in AI-generated outputs.",
|
||||
"subtasks": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Implement Code Context Extraction Feature",
|
||||
"description": "Create a --context-code <pattern> option for AI commands and implement glob-based file matching to extract relevant code sections",
|
||||
"details": "",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 27
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Implement Task History Context Integration",
|
||||
"description": "Add a --context-tasks option for AI commands that supports finding and extracting context from specified or similar tasks",
|
||||
"details": "",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 27
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Add PRD Context Integration",
|
||||
"description": "Implement a --context-prd option for AI commands that extracts and formats content from PRD files",
|
||||
"details": "",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 27
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Create Standardized Context Formatting System",
|
||||
"description": "Implement a consistent formatting system for different context types with section markers and token optimization",
|
||||
"details": "",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 27
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 28,
|
||||
"title": "Implement Advanced ContextManager System",
|
||||
"description": "Create a comprehensive ContextManager class to unify context handling with advanced features like context optimization, prioritization, and intelligent context selection.",
|
||||
"status": "pending",
|
||||
"dependencies": [
|
||||
26,
|
||||
27
|
||||
],
|
||||
"priority": "high",
|
||||
"details": "Building on Phase 1 and Phase 2 context implementations, develop Phase 3 advanced context management:\n\n1. Implement the ContextManager Class:\n - Create a unified `ContextManager` class that encapsulates all context functionality\n - Implement methods for gathering context from all supported sources\n - Create a configurable context priority system to favor more relevant context types\n - Add token management to ensure context fits within API limits\n - Implement caching for frequently used context to improve performance\n\n2. Create Context Optimization Pipeline:\n - Develop intelligent context optimization algorithms\n - Implement type-based truncation strategies (code vs. text)\n - Create relevance scoring to prioritize most useful context portions\n - Add token budget allocation that divides available tokens among context types\n - Implement dynamic optimization based on operation type\n\n3. Add Command Interface Enhancements:\n - Create the `--context-all` flag to include all available context\n - Add the `--context-max-tokens <tokens>` option to control token allocation\n - Implement unified context options across all AI commands\n - Add intelligent default values for different command types\n\n4. Integrate with AI Services:\n - Update the AI service integration to use the ContextManager\n - Create specialized context assembly for different AI operations\n - Add post-processing to capture new context from AI responses\n - Implement adaptive context selection based on operation success\n\n5. Add Performance Monitoring:\n - Create context usage statistics tracking\n - Implement logging for context selection decisions\n - Add warnings for context token limits\n - Create troubleshooting utilities for context-related issues\n\nThe ContextManager system should provide a powerful but easy-to-use interface for both users and developers, maintaining backward compatibility with earlier phases while adding substantial new capabilities.",
|
||||
"testStrategy": "Testing should verify both the functionality and performance of the advanced context management:\n\n1. Unit Testing:\n - Test all ContextManager class methods with various inputs\n - Verify optimization algorithms maintain critical information\n - Test caching mechanisms for correctness and efficiency\n - Verify token allocation and budgeting functions\n - Test each context source integration separately\n\n2. Integration Testing:\n - Verify ContextManager integration with AI services\n - Test with all AI-related commands\n - Verify backward compatibility with existing context options\n - Test context prioritization across multiple context types\n - Verify logging and error handling\n\n3. Performance Testing:\n - Benchmark context gathering and optimization times\n - Test with large and complex context sources\n - Measure impact of caching on repeated operations\n - Verify memory usage remains acceptable\n - Test with token limits of different sizes\n\n4. Quality Assessment:\n - Compare AI outputs using Phase 3 vs. earlier context handling\n - Measure improvements in context relevance and quality\n - Test complex scenarios requiring multiple context types\n - Quantify the impact on token efficiency\n\n5. User Experience Testing:\n - Verify CLI options are intuitive and well-documented\n - Test error messages are helpful for troubleshooting\n - Ensure log output provides useful insights\n - Test all convenience options like `--context-all`\n\nCreate automated test suites for regression testing of the complete context system.",
|
||||
"subtasks": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Implement Core ContextManager Class Structure",
|
||||
"description": "Create a unified ContextManager class that encapsulates all context functionality with methods for gathering context from supported sources",
|
||||
"details": "",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 28
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Develop Context Optimization Pipeline",
|
||||
"description": "Create intelligent algorithms for context optimization including type-based truncation, relevance scoring, and token budget allocation",
|
||||
"details": "",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 28
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Create Command Interface Enhancements",
|
||||
"description": "Add unified context options to all AI commands including --context-all flag and --context-max-tokens for controlling allocation",
|
||||
"details": "",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 28
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Integrate ContextManager with AI Services",
|
||||
"description": "Update AI service integration to use the ContextManager with specialized context assembly for different operations",
|
||||
"details": "",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 28
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Implement Performance Monitoring and Metrics",
|
||||
"description": "Create a system for tracking context usage statistics, logging selection decisions, and providing troubleshooting utilities",
|
||||
"details": "",
|
||||
"status": "pending",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 28
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user