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:
parent
4ef191327b
commit
29aafc7e4f
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue