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 });
|
return Response.json({ error: "Task not found" }, { status: 404 });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the task file path
|
// Use the stored file path from when the task was loaded
|
||||||
const tasksDir = join(projectPath, "backlog", "tasks");
|
const taskFilePath = task.filePath;
|
||||||
const taskFileName = `${taskId}.md`;
|
if (!taskFilePath) {
|
||||||
const taskFilePath = join(tasksDir, taskFileName);
|
return Response.json({ error: "Task file path not found" }, { status: 404 });
|
||||||
|
}
|
||||||
|
|
||||||
// Read the current task file
|
// Read the current task file
|
||||||
let content: string;
|
let content: string;
|
||||||
|
|
@ -695,12 +696,15 @@ created_date: '${dateStr}'
|
||||||
return Response.json({ error: "Task not found" }, { status: 404 });
|
return Response.json({ error: "Task not found" }, { status: 404 });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the task file path
|
// Use the stored file path from when the task was loaded
|
||||||
const tasksDir = join(projectPath, "backlog", "tasks");
|
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 archiveDir = join(projectPath, "backlog", "archive", "tasks");
|
||||||
const taskFileName = `${taskId}.md`;
|
const archiveFilePath = join(archiveDir, basename(taskFilePath));
|
||||||
const taskFilePath = join(tasksDir, taskFileName);
|
|
||||||
const archiveFilePath = join(archiveDir, taskFileName);
|
|
||||||
|
|
||||||
// Ensure archive directory exists
|
// Ensure archive directory exists
|
||||||
try {
|
try {
|
||||||
|
|
@ -754,10 +758,11 @@ created_date: '${dateStr}'
|
||||||
return Response.json({ error: "Task not found" }, { status: 404 });
|
return Response.json({ error: "Task not found" }, { status: 404 });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the task file path
|
// Use the stored file path from when the task was loaded
|
||||||
const tasksDir = join(projectPath, "backlog", "tasks");
|
const taskFilePath = task.filePath;
|
||||||
const taskFileName = `${taskId}.md`;
|
if (!taskFilePath) {
|
||||||
const taskFilePath = join(tasksDir, taskFileName);
|
return Response.json({ error: "Task file path not found" }, { status: 404 });
|
||||||
|
}
|
||||||
|
|
||||||
// Delete the file
|
// Delete the file
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue