Fix issue with kebab-case validator incorrectly flagging single-word flags like --prompt. Refactor detectCamelCaseFlags to properly handle all single-word flags. Update tests to verify correct behavior with single-word and camelCase flags. Add support for alternative flag formats in init command (e.g., -my_name). This fixes a bug where users couldn't use the --prompt flag directly and had to use -p instead.
- Fix tests using ES Module best practices instead of complex mocking
- Replace Commander.js mocking with direct action handler testing
- Resolve ES Module import/mock issues and function redeclaration errors
- Fix circular reference issues with console.log spies
- Properly setup mock functions with jest.fn() for method access
- Improve parse-prd command functionality
- Add default PRD path support (scripts/prd.txt) so you can just run `task-master parse-prd` and it will use the default PRD if it exists.
- Improve error handling and user feedback
- Enhance help text with more detailed information
- Fix detectCamelCaseFlags implementation in utils.js yet again with more tests this time
- Improve regex pattern to correctly detect camelCase flags
- Skip flags already in kebab-case format
- Enhance tests with proper test-specific implementations
- Document testing best practices
- Add comprehensive "Common Testing Pitfalls and Solutions" section to tests.mdc
- Provide clear examples of correct testing patterns for ES modules
- Document techniques for test isolation and mock organization
This commit introduces several significant improvements:
- **Enhanced Unit Testing:** Vastly improved unit tests for the module, covering core functions, edge cases, and error handling. Simplified test functions and comprehensive mocking were implemented for better isolation and reliability. Added new section to tests.mdc detailing reliable testing techniques.
- **CLI Kebab-Case Flag Enforcement:** The CLI now enforces kebab-case for flags, providing helpful error messages when camelCase is used. This improves consistency and user experience.
- **AI Enhancements:**
- Enabled 128k token output for Claude 3.7 Sonnet by adding the header.
- Added a new task to to document this change and its testing strategy.
- Added unit tests to verify the Anthropic client configuration.
- Added and utility functions.
- **Improved Test Coverage:** Added tests for the new CLI flag validation logic.