fix: enhance task expansion with multiple improvements

This commit resolves several issues with the task expansion system to
ensure higher quality subtasks and better synchronization:

1. Task File Generation
- Add automatic regeneration of task files after expanding tasks
- Ensure individual task text files stay in sync with tasks.json
- Avoids manual regeneration steps after task expansion

2. Perplexity API Integration
- Fix 'researchPrompt is not defined' error in Perplexity integration
- Add specialized research-oriented prompt template
- Improve system message for better context and instruction
- Better fallback to Claude when Perplexity unavailable

3. Subtask Parsing Improvements
- Enhance regex pattern to handle more formatting variations
- Implement multiple parsing strategies for different response formats:
  * Improved section detection with flexible headings
  * Added support for numbered and bulleted lists
  * Implemented heuristic-based title and description extraction
- Create more meaningful dummy subtasks with relevant titles and descriptions
  instead of generic placeholders
- Ensure minimal descriptions are always provided

4. Quality Verification and Retry System
- Add post-expansion verification to identify low-quality subtask sets
- Detect tasks with too many generic/placeholder subtasks
- Implement interactive retry mechanism with enhanced prompts
- Use adjusted settings for retries (research mode, subtask count)
- Clear existing subtasks before retry to prevent duplicates
- Provide detailed reporting of verification and retry process

These changes significantly improve the quality of generated subtasks
and reduce the need for manual intervention when subtask generation
produces suboptimal results.
This commit is contained in:
Eyal Toledano
2025-03-21 16:25:12 -04:00
parent 3f35783b60
commit eadd13e798
18 changed files with 3291 additions and 975 deletions

View File

@@ -81,7 +81,7 @@ function copyTemplateFile(templateName, targetPath, replacements = {}) {
sourcePath = path.join(__dirname, 'dev.js');
break;
case 'scripts_README.md':
sourcePath = path.join(__dirname, 'README.md');
sourcePath = path.join(__dirname, '..', 'assets', 'scripts_README.md');
break;
case 'dev_workflow.mdc':
sourcePath = path.join(__dirname, '..', '.cursor', 'rules', 'dev_workflow.mdc');
@@ -269,13 +269,24 @@ function createProjectStructure(projectName, projectDescription, projectVersion,
log('warn', 'Git not available, skipping repository initialization');
}
// Run npm install automatically
log('info', 'Installing dependencies...');
try {
execSync('npm install', { stdio: 'inherit', cwd: targetDir });
log('info', `${COLORS.green}Dependencies installed successfully!${COLORS.reset}`);
} catch (error) {
log('error', 'Failed to install dependencies:', error.message);
log('error', 'Please run npm install manually');
}
log('info', `${COLORS.green}${COLORS.bright}Project initialized successfully!${COLORS.reset}`);
log('info', '');
log('info', 'Next steps:');
log('info', '1. Run `npm install` to install dependencies');
log('info', '2. Create a .env file with your ANTHROPIC_API_KEY (see .env.example)');
log('info', '3. Add your PRD to the project');
log('info', '4. Run `npm run parse-prd -- --input=<your-prd-file.txt>` to generate tasks');
log('info', '1. Create a .env file with your ANTHROPIC_API_KEY (see .env.example)');
log('info', '2. Add your PRD.txt to the /scripts directory');
log('info', '3. Ask Cursor Agent to parse your PRD.txt and generate tasks');
log('info', '└── You can also manually run `npm run parse-prd -- --input=<your-prd-file.txt>` to generate tasks');
log('info', '4. Review the README.md file to learn how to use other commands via Cursor Agent.');
log('info', '');
}