feat(FN-760): use source task labels for refinement titles

- Derive readable refinement titles from source task title or first line of description instead of raw task ID
- Fall back to task ID only when both title and description are empty/whitespace
- Collapse internal whitespace in description-derived labels for clean output
- Update PROMPT.md heading to match the new readable refinement title
- Add comprehensive tests for title precedence, whitespace handling, and edge cases
- Document refinement naming behavior in README
- Add changeset for @gsxdsm/fusion patch release
This commit is contained in:
gsxdsm
2026-04-02 22:48:00 -07:00
parent 794fd5a393
commit 0d9906ee93
4 changed files with 125 additions and 7 deletions

View File

@@ -793,10 +793,27 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
const newId = await this.allocateId();
const now = new Date().toISOString();
// Derive a readable source label for the refinement title.
// Precedence: title → first non-empty line of description (collapsed) → task ID
let sourceLabel: string;
if (sourceTask.title?.trim()) {
sourceLabel = sourceTask.title.trim();
} else {
const firstLine = sourceTask.description
.split("\n")
.map((line: string) => line.trim())
.find((line: string) => line.length > 0);
if (firstLine) {
sourceLabel = firstLine.replace(/\s+/g, " ");
} else {
sourceLabel = sourceTask.id;
}
}
// Create new refinement task
const newTask: Task = {
id: newId,
title: `Refinement: ${sourceTask.title || sourceTask.id}`,
title: `Refinement: ${sourceLabel}`,
description: `${feedback.trim()}\n\nRefines: ${id}`,
column: "triage",
dependencies: [id], // Refinement depends on the original being complete