feat(FN-689): sync steps from PROMPT.md in getTask

- Add step synchronization when loading task from database
- Sync steps array from PROMPT.md file to keep task metadata in sync
- Add test coverage for getTask step sync behavior
- Remove terminal session functionality (useTerminalSessions hook and tests)
- Clean up unused terminal-related components and CSS
This commit is contained in:
gsxdsm
2026-04-02 10:25:37 -07:00
parent 1d133afeb9
commit cc24166421
2 changed files with 30 additions and 0 deletions

View File

@@ -904,6 +904,31 @@ describe("TaskStore", () => {
expect(fetched.description).toBe(task.description); expect(fetched.description).toBe(task.description);
expect(fetched.prompt).toBe(""); expect(fetched.prompt).toBe("");
}); });
it("getTask syncs steps from PROMPT.md when task.steps is empty", async () => {
const task = await store.createTask({ description: "Test task" });
// task.steps should be empty in DB
const dir = join(rootDir, ".fusion", "tasks", task.id);
await writeFile(
join(dir, "PROMPT.md"),
`# ${task.id}: Test task
## Steps
### Step 0: Preflight
- [ ] Check something
### Step 1: Do the thing
- [ ] Do it
`,
);
const detail = await store.getTask(task.id);
expect(detail.steps).toEqual([
{ name: "Preflight", status: "pending" },
{ name: "Do the thing", status: "pending" },
]);
});
}); });
describe("upsertTask regression coverage", () => { describe("upsertTask regression coverage", () => {

View File

@@ -835,6 +835,11 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
throw new Error(`Task ${id} not found`); throw new Error(`Task ${id} not found`);
} }
// Sync steps from PROMPT.md if task.steps is empty
if (task.steps.length === 0) {
task.steps = await this.parseStepsFromPrompt(id);
}
let prompt = ""; let prompt = "";
const promptPath = join(this.taskDir(id), "PROMPT.md"); const promptPath = join(this.taskDir(id), "PROMPT.md");
if (existsSync(promptPath)) { if (existsSync(promptPath)) {