Append file lists to summary text for LLM context and TUI display

Files are included both:
- In summary text as <read-files>/<modified-files> tags (visible to LLM and TUI)
- In details for structured access by code
This commit is contained in:
Mario Zechner 2025-12-29 22:09:31 +01:00
parent 9427211f99
commit d1a49c45ff

View file

@ -361,16 +361,28 @@ export async function generateBranchSummary(
return { error: response.errorMessage || "Summarization failed" };
}
const summary = response.content
let summary = response.content
.filter((c): c is { type: "text"; text: string } => c.type === "text")
.map((c) => c.text)
.join("\n");
// Compute file lists for details
// Compute file lists
const modified = new Set([...fileOps.edited, ...fileOps.written]);
const readOnly = [...fileOps.read].filter((f) => !modified.has(f)).sort();
const modifiedFiles = [...modified].sort();
// Append file lists to summary text (for LLM context and TUI display)
const fileSections: string[] = [];
if (readOnly.length > 0) {
fileSections.push(`<read-files>\n${readOnly.join("\n")}\n</read-files>`);
}
if (modifiedFiles.length > 0) {
fileSections.push(`<modified-files>\n${modifiedFiles.join("\n")}\n</modified-files>`);
}
if (fileSections.length > 0) {
summary += `\n\n${fileSections.join("\n\n")}`;
}
return {
summary: summary || "No summary generated",
readFiles: readOnly,