Fixes readme files and makes sure that when you mark a parent task done that its sub tasks are also marked done

This commit is contained in:
Eyal Toledano
2025-03-21 14:17:43 -04:00
parent da61e9dccf
commit 3f35783b60
11 changed files with 264 additions and 8 deletions

View File

@@ -97,6 +97,30 @@ Notes:
- Only tasks that aren't marked as 'done' will be updated
- Tasks with ID >= the specified --from value will be updated
## Setting Task Status
The `set-status` command allows you to change a task's status:
```bash
# Mark a task as done
node scripts/dev.js set-status --id=3 --status=done
# Mark a task as pending
node scripts/dev.js set-status --id=4 --status=pending
# Mark a specific subtask as done
node scripts/dev.js set-status --id=3.1 --status=done
# Mark multiple tasks at once
node scripts/dev.js set-status --id=1,2,3 --status=done
```
Notes:
- When marking a parent task as "done", all of its subtasks will automatically be marked as "done" as well
- Common status values are 'done', 'pending', and 'deferred', but any string is accepted
- You can specify multiple task IDs by separating them with commas
- Subtask IDs are specified using the format `parentId.subtaskId` (e.g., `3.1`)
## Expanding Tasks
The `expand` command allows you to break down tasks into subtasks for more detailed implementation:
@@ -154,4 +178,4 @@ The script supports different logging levels controlled by the `LOG_LEVEL` envir
- `warn`: Warning messages that don't prevent execution
- `error`: Error messages that might prevent execution
When `DEBUG=true` is set, debug logs are also written to a `dev-debug.log` file in the project root.
When `DEBUG=true` is set, debug logs are also written to a `dev-debug.log` file in the project root.

View File

@@ -662,6 +662,17 @@ function setTaskStatus(tasksPath, taskIdInput, newStatus) {
const oldStatus = task.status || 'pending';
task.status = newStatus;
// Automatically update subtasks if the parent task is being marked as done
if (newStatus === 'done' && task.subtasks && Array.isArray(task.subtasks) && task.subtasks.length > 0) {
log('info', `Task ${taskId} has ${task.subtasks.length} subtasks that will be marked as done too.`);
task.subtasks.forEach(subtask => {
const oldSubtaskStatus = subtask.status || 'pending';
subtask.status = newStatus;
log('info', ` └─ Updated subtask ${taskId}.${subtask.id} status from '${oldSubtaskStatus}' to '${newStatus}'`);
});
}
// Save the changes
writeJSON(tasksPath, data);
log('info', `Updated task ${taskId} status from '${oldStatus}' to '${newStatus}'`);

View File

@@ -92,8 +92,8 @@ function copyTemplateFile(templateName, targetPath, replacements = {}) {
case 'self_improve.mdc':
sourcePath = path.join(__dirname, '..', '.cursor', 'rules', 'self_improve.mdc');
break;
case 'README.md':
sourcePath = path.join(__dirname, '..', 'README.md');
case 'README-task-master.md':
sourcePath = path.join(__dirname, '..', 'README-task-master.md');
break;
default:
// For other files like env.example, gitignore, etc. that don't have direct equivalents
@@ -212,7 +212,8 @@ function createProjectStructure(projectName, projectDescription, projectVersion,
"@anthropic-ai/sdk": "^0.39.0",
"chalk": "^4.1.2",
"commander": "^11.1.0",
"dotenv": "^16.3.1"
"dotenv": "^16.3.1",
"openai": "^4.86.1"
}
};
@@ -256,7 +257,7 @@ function createProjectStructure(projectName, projectDescription, projectVersion,
copyTemplateFile('example_prd.txt', path.join(targetDir, 'scripts', 'example_prd.txt'));
// Create main README.md
copyTemplateFile('README.md', path.join(targetDir, 'README.md'), replacements);
copyTemplateFile('README-task-master.md', path.join(targetDir, 'README.md'), replacements);
// Initialize git repository if git is available
try {

View File

@@ -120,7 +120,7 @@ function preparePackage() {
// Check for required files
const requiredFiles = [
'package.json',
'README.md',
'README-task-master.md',
'index.js',
'scripts/init.js',
'scripts/dev.js',