mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 19:05:11 +00:00
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:
parent
9427211f99
commit
d1a49c45ff
1 changed files with 14 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue