fix: use task.filePath in aggregator update/archive/delete handlers

Task files are named 'task-001 - title.md' not 'task-001.md'.
The handlers were constructing incorrect filenames instead of using
the filePath property stored when tasks are loaded.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2025-12-04 05:12:27 -08:00
parent 4ef191327b
commit 29aafc7e4f
1 changed files with 18 additions and 13 deletions

View File

@ -538,10 +538,11 @@ export class BacklogAggregator {
return Response.json({ error: "Task not found" }, { status: 404 });
}
// Find the task file path
const tasksDir = join(projectPath, "backlog", "tasks");
const taskFileName = `${taskId}.md`;
const taskFilePath = join(tasksDir, taskFileName);
// Use the stored file path from when the task was loaded
const taskFilePath = task.filePath;
if (!taskFilePath) {
return Response.json({ error: "Task file path not found" }, { status: 404 });
}
// Read the current task file
let content: string;
@ -695,12 +696,15 @@ created_date: '${dateStr}'
return Response.json({ error: "Task not found" }, { status: 404 });
}
// Find the task file path
const tasksDir = join(projectPath, "backlog", "tasks");
// Use the stored file path from when the task was loaded
const taskFilePath = task.filePath;
if (!taskFilePath) {
return Response.json({ error: "Task file path not found" }, { status: 404 });
}
// Build archive path preserving the original filename
const archiveDir = join(projectPath, "backlog", "archive", "tasks");
const taskFileName = `${taskId}.md`;
const taskFilePath = join(tasksDir, taskFileName);
const archiveFilePath = join(archiveDir, taskFileName);
const archiveFilePath = join(archiveDir, basename(taskFilePath));
// Ensure archive directory exists
try {
@ -754,10 +758,11 @@ created_date: '${dateStr}'
return Response.json({ error: "Task not found" }, { status: 404 });
}
// Find the task file path
const tasksDir = join(projectPath, "backlog", "tasks");
const taskFileName = `${taskId}.md`;
const taskFilePath = join(tasksDir, taskFileName);
// Use the stored file path from when the task was loaded
const taskFilePath = task.filePath;
if (!taskFilePath) {
return Response.json({ error: "Task file path not found" }, { status: 404 });
}
// Delete the file
try {