Adjusts the readmes and cursor rule.

This commit is contained in:
Eyal Toledano
2025-03-21 18:37:24 -04:00
parent eef6a2ad02
commit e11aba2fec
7 changed files with 211 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ alwaysApply: true
- Select tasks based on dependencies (all marked 'done'), priority level, and ID order
- Clarify tasks by checking task files in tasks/ directory or asking for user input
- Break down complex tasks using `node scripts/dev.js expand --id=<id>` with appropriate flags
- Clear existing subtasks if needed using `node scripts/dev.js clear-subtasks --id=<id>` before regenerating
- Implement code following task details, dependencies, and project standards
- Verify tasks according to test strategies before marking as complete
- Mark completed tasks with `node scripts/dev.js set-status --id=<id> --status=done`
@@ -33,6 +34,7 @@ alwaysApply: true
- Use `--prompt="<context>"` to provide additional context when needed
- Review and adjust generated subtasks as necessary
- Use `--all` flag to expand multiple pending tasks at once
- If subtasks need regeneration, clear them first with `clear-subtasks` command
- **Implementation Drift Handling**
- When implementation differs significantly from planned approach
@@ -126,6 +128,21 @@ alwaysApply: true
- Example: `node scripts/dev.js analyze-complexity --research`
- Notes: Report includes complexity scores, recommended subtasks, and tailored prompts.
- **Command Reference: clear-subtasks**
- Syntax: `node scripts/dev.js clear-subtasks --id=<id>`
- Description: Removes subtasks from specified tasks to allow regeneration
- Parameters:
- `--id=<id>`: ID or comma-separated IDs of tasks to clear subtasks from
- `--all`: Clear subtasks from all tasks
- Examples:
- `node scripts/dev.js clear-subtasks --id=3`
- `node scripts/dev.js clear-subtasks --id=1,2,3`
- `node scripts/dev.js clear-subtasks --all`
- Notes:
- Task files are automatically regenerated after clearing subtasks
- Can be combined with expand command to immediately generate new subtasks
- Works with both parent tasks and individual subtasks
- **Task Structure Fields**
- **id**: Unique identifier for the task (Example: `1`)
- **title**: Brief, descriptive title (Example: `"Initialize Repo"`)

View File

@@ -300,6 +300,18 @@ or
npm run dev -- expand --all --research
```
### Clear Subtasks
```bash
# Clear subtasks from a specific task
npm run dev -- clear-subtasks --id=<id>
# Clear subtasks from multiple tasks
npm run dev -- clear-subtasks --id=1,2,3
# Clear subtasks from all tasks
npm run dev -- clear-subtasks --all
```
## Task Structure
Tasks in tasks.json have the following structure:
@@ -348,6 +360,11 @@ What's the next task I should work on? Please consider dependencies and prioriti
I'd like to implement task 4. Can you help me understand what needs to be done and how to approach it?
```
### Managing subtasks
```
I need to regenerate the subtasks for task 3 with a different approach. Can you help me clear and regenerate them?
```
### Handling changes
```
We've decided to use MongoDB instead of PostgreSQL. Can you update all future tasks to reflect this change?

View File

@@ -13,6 +13,7 @@ In an AI-driven development process—particularly with tools like [Cursor](http
5. **Set task status**—mark tasks as `done`, `pending`, or `deferred` based on progress.
6. **Expand** tasks with subtasks—break down complex tasks into smaller, more manageable subtasks.
7. **Research-backed subtask generation**—use Perplexity AI to generate more informed and contextually relevant subtasks.
8. **Clear subtasks**—remove subtasks from specified tasks to allow regeneration or restructuring.
## Configuration
@@ -56,6 +57,7 @@ The script can be configured through environment variables in a `.env` file at t
- `generate`: Create individual task files
- `set-status`: Change a task's status
- `expand`: Add subtasks to a task or all tasks
- `clear-subtasks`: Remove subtasks from specified tasks
Run `node scripts/dev.js` without arguments to see detailed usage information.
@@ -148,12 +150,26 @@ node scripts/dev.js expand --id=3 --research
node scripts/dev.js expand --all --research
```
## Clearing Subtasks
The `clear-subtasks` command allows you to remove subtasks from specified tasks:
```bash
# Clear subtasks from a specific task
node scripts/dev.js clear-subtasks --id=3
# Clear subtasks from multiple tasks
node scripts/dev.js clear-subtasks --id=1,2,3
# Clear subtasks from all tasks
node scripts/dev.js clear-subtasks --all
```
Notes:
- Tasks marked as 'done' or 'completed' are always skipped
- By default, tasks that already have subtasks are skipped unless `--force` is used
- Subtasks include title, description, dependencies, and acceptance criteria
- The `--research` flag uses Perplexity AI to generate more informed and contextually relevant subtasks
- If Perplexity API is unavailable, the script will fall back to using Anthropic's Claude
- After clearing subtasks, task files are automatically regenerated
- This is useful when you want to regenerate subtasks with a different approach
- Can be combined with the `expand` command to immediately generate new subtasks
- Works with both parent tasks and individual subtasks
## AI Integration

View File

@@ -300,6 +300,18 @@ or
npm run dev -- expand --all --research
```
### Clear Subtasks
```bash
# Clear subtasks from a specific task
npm run dev -- clear-subtasks --id=<id>
# Clear subtasks from multiple tasks
npm run dev -- clear-subtasks --id=1,2,3
# Clear subtasks from all tasks
npm run dev -- clear-subtasks --all
```
## Task Structure
Tasks in tasks.json have the following structure:
@@ -348,6 +360,11 @@ What's the next task I should work on? Please consider dependencies and prioriti
I'd like to implement task 4. Can you help me understand what needs to be done and how to approach it?
```
### Managing subtasks
```
I need to regenerate the subtasks for task 3 with a different approach. Can you help me clear and regenerate them?
```
### Handling changes
```
We've decided to use MongoDB instead of PostgreSQL. Can you update all future tasks to reflect this change?

View File

@@ -19,7 +19,7 @@
* 4) set-status --id=4 --status=done
* -> Updates a single task's status to done (or pending, deferred, in-progress, etc.).
* -> Supports comma-separated IDs for updating multiple tasks: --id=1,2,3,1.1,1.2
*
* -> If you set the status of a parent task to done, all its subtasks will be set to done.
* 5) list
* -> Lists tasks in a brief console view (ID, title, status).
*
@@ -52,6 +52,11 @@
* --file, -f <path>: Use alternative tasks.json file instead of default
* --research, -r: Use Perplexity AI for research-backed complexity analysis
*
* 8) clear-subtasks
* -> Clears subtasks from specified tasks
* -> Supports comma-separated IDs for clearing multiple tasks: --id=1,2,3,1.1,1.2
* -> Use --all to clear subtasks from all tasks
*
* Usage examples:
* node dev.js parse-prd --input=sample-prd.txt
* node dev.js parse-prd --input=sample-prd.txt --tasks=10
@@ -67,6 +72,7 @@
* node dev.js analyze-complexity --output=custom-report.json
* node dev.js analyze-complexity --threshold=6 --model=claude-3.7-sonnet
* node dev.js analyze-complexity --research
* node dev.js clear-subtasks --id=1,2,3 --all
*/
import fs from 'fs';
@@ -527,6 +533,11 @@ async function updateTasks(tasksPath, fromId, prompt) {
writeJSON(tasksPath, data);
log('info', "Tasks updated successfully.");
// Add call to generate task files
log('info', "Regenerating task files...");
await generateTaskFiles(tasksPath, path.dirname(tasksPath));
} catch (parseError) {
log('error', "Failed to parse Claude's response as JSON:", parseError);
log('debug', "Response content:", fullResponse);
@@ -665,6 +676,10 @@ function setTaskStatus(tasksPath, taskIdInput, newStatus) {
writeJSON(tasksPath, data);
log('info', `Updated subtask ${parentId}.${subtaskId} status from '${oldStatus}' to '${newStatus}'`);
// Add call to generate task files
log('info', "Regenerating task files...");
generateTaskFiles(tasksPath, path.dirname(tasksPath));
return;
}
@@ -700,6 +715,10 @@ function setTaskStatus(tasksPath, taskIdInput, newStatus) {
// Save the changes
writeJSON(tasksPath, data);
log('info', `Updated task ${taskId} status from '${oldStatus}' to '${newStatus}'`);
// Add call to generate task files
log('info', "Regenerating task files...");
generateTaskFiles(tasksPath, path.dirname(tasksPath));
}
//
@@ -1711,6 +1730,36 @@ async function main() {
await analyzeTaskComplexity(options);
});
program
.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);
}
});
await program.parseAsync(process.argv);
}
@@ -2321,6 +2370,57 @@ function findTaskInComplexityReport(report, taskId) {
return report.complexityAnalysis.find(task => task.taskId === taskId);
}
//
// Clear subtasks from tasks
//
function clearSubtasks(tasksPath, taskIds) {
log('info', `Reading tasks from ${tasksPath}...`);
const data = readJSON(tasksPath);
if (!data || !data.tasks) {
log('error', "No valid tasks found.");
process.exit(1);
}
// Handle multiple task IDs (comma-separated)
const taskIdArray = taskIds.split(',').map(id => id.trim());
let clearedCount = 0;
taskIdArray.forEach(taskId => {
const id = parseInt(taskId, 10);
if (isNaN(id)) {
log('error', `Invalid task ID: ${taskId}`);
return;
}
const task = data.tasks.find(t => t.id === id);
if (!task) {
log('error', `Task ${id} not found`);
return;
}
if (!task.subtasks || task.subtasks.length === 0) {
log('info', `Task ${id} has no subtasks to clear`);
return;
}
const subtaskCount = task.subtasks.length;
task.subtasks = [];
clearedCount++;
log('info', `Cleared ${subtaskCount} subtasks from task ${id}`);
});
if (clearedCount > 0) {
writeJSON(tasksPath, data);
log('info', `Successfully cleared subtasks from ${clearedCount} task(s)`);
// Regenerate task files to reflect changes
log('info', "Regenerating task files...");
generateTaskFiles(tasksPath, path.dirname(tasksPath));
} else {
log('info', "No subtasks were cleared");
}
}
main().catch(err => {
log('error', err);
process.exit(1);

View File

@@ -11,6 +11,7 @@ alwaysApply: true
- Select tasks based on dependencies (all marked 'done'), priority level, and ID order
- Clarify tasks by checking task files in tasks/ directory or asking for user input
- Break down complex tasks using `node scripts/dev.js expand --id=<id>` with appropriate flags
- Clear existing subtasks if needed using `node scripts/dev.js clear-subtasks --id=<id>` before regenerating
- Implement code following task details, dependencies, and project standards
- Verify tasks according to test strategies before marking as complete
- Mark completed tasks with `node scripts/dev.js set-status --id=<id> --status=done`
@@ -33,6 +34,7 @@ alwaysApply: true
- Use `--prompt="<context>"` to provide additional context when needed
- Review and adjust generated subtasks as necessary
- Use `--all` flag to expand multiple pending tasks at once
- If subtasks need regeneration, clear them first with `clear-subtasks` command
- **Implementation Drift Handling**
- When implementation differs significantly from planned approach
@@ -126,6 +128,21 @@ alwaysApply: true
- Example: `node scripts/dev.js analyze-complexity --research`
- Notes: Report includes complexity scores, recommended subtasks, and tailored prompts.
- **Command Reference: clear-subtasks**
- Syntax: `node scripts/dev.js clear-subtasks --id=<id>`
- Description: Removes subtasks from specified tasks to allow regeneration
- Parameters:
- `--id=<id>`: ID or comma-separated IDs of tasks to clear subtasks from
- `--all`: Clear subtasks from all tasks
- Examples:
- `node scripts/dev.js clear-subtasks --id=3`
- `node scripts/dev.js clear-subtasks --id=1,2,3`
- `node scripts/dev.js clear-subtasks --all`
- Notes:
- Task files are automatically regenerated after clearing subtasks
- Can be combined with expand command to immediately generate new subtasks
- Works with both parent tasks and individual subtasks
- **Task Structure Fields**
- **id**: Unique identifier for the task (Example: `1`)
- **title**: Brief, descriptive title (Example: `"Initialize Repo"`)

View File

@@ -13,6 +13,7 @@ In an AI-driven development process—particularly with tools like [Cursor](http
5. **Set task status**—mark tasks as `done`, `pending`, or `deferred` based on progress.
6. **Expand** tasks with subtasks—break down complex tasks into smaller, more manageable subtasks.
7. **Research-backed subtask generation**—use Perplexity AI to generate more informed and contextually relevant subtasks.
8. **Clear subtasks**—remove subtasks from specified tasks to allow regeneration or restructuring.
## Configuration
@@ -56,6 +57,7 @@ The script can be configured through environment variables in a `.env` file at t
- `generate`: Create individual task files
- `set-status`: Change a task's status
- `expand`: Add subtasks to a task or all tasks
- `clear-subtasks`: Remove subtasks from specified tasks
Run `node scripts/dev.js` without arguments to see detailed usage information.
@@ -148,12 +150,26 @@ node scripts/dev.js expand --id=3 --research
node scripts/dev.js expand --all --research
```
## Clearing Subtasks
The `clear-subtasks` command allows you to remove subtasks from specified tasks:
```bash
# Clear subtasks from a specific task
node scripts/dev.js clear-subtasks --id=3
# Clear subtasks from multiple tasks
node scripts/dev.js clear-subtasks --id=1,2,3
# Clear subtasks from all tasks
node scripts/dev.js clear-subtasks --all
```
Notes:
- Tasks marked as 'done' or 'completed' are always skipped
- By default, tasks that already have subtasks are skipped unless `--force` is used
- Subtasks include title, description, dependencies, and acceptance criteria
- The `--research` flag uses Perplexity AI to generate more informed and contextually relevant subtasks
- If Perplexity API is unavailable, the script will fall back to using Anthropic's Claude
- After clearing subtasks, task files are automatically regenerated
- This is useful when you want to regenerate subtasks with a different approach
- Can be combined with the `expand` command to immediately generate new subtasks
- Works with both parent tasks and individual subtasks
## AI Integration