mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 03:03:44 +00:00
Fix file ops: Read (not modified) and Modified (edited or written)
- Read: files only read, not modified - Modified: files that were edited OR written - Avoids duplicate listings when same file is read then edited
This commit is contained in:
parent
dc5fc4fc40
commit
e7bfb5afe7
1 changed files with 11 additions and 14 deletions
|
|
@ -242,24 +242,21 @@ Be brief and focused on what matters for future reference.`;
|
||||||
* Format file operations as a static section to append to summary.
|
* Format file operations as a static section to append to summary.
|
||||||
*/
|
*/
|
||||||
function formatFileOperations(fileOps: FileOperations): string {
|
function formatFileOperations(fileOps: FileOperations): string {
|
||||||
|
// Combine edited and written into "modified"
|
||||||
|
const modified = new Set([...fileOps.edited, ...fileOps.written]);
|
||||||
|
|
||||||
|
// Read-only = read but not modified
|
||||||
|
const readOnly = [...fileOps.read].filter((f) => !modified.has(f)).sort();
|
||||||
|
|
||||||
const sections: string[] = [];
|
const sections: string[] = [];
|
||||||
|
|
||||||
if (fileOps.read.size > 0) {
|
if (readOnly.length > 0) {
|
||||||
const files = [...fileOps.read].sort();
|
sections.push(`**Read:** ${readOnly.join(", ")}`);
|
||||||
sections.push(`**Read:** ${files.join(", ")}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileOps.edited.size > 0) {
|
if (modified.size > 0) {
|
||||||
const files = [...fileOps.edited].sort();
|
const files = [...modified].sort();
|
||||||
sections.push(`**Edited:** ${files.join(", ")}`);
|
sections.push(`**Modified:** ${files.join(", ")}`);
|
||||||
}
|
|
||||||
|
|
||||||
if (fileOps.written.size > 0) {
|
|
||||||
// Exclude files that were also edited (edit implies write)
|
|
||||||
const writtenOnly = [...fileOps.written].filter((f) => !fileOps.edited.has(f)).sort();
|
|
||||||
if (writtenOnly.length > 0) {
|
|
||||||
sections.push(`**Created:** ${writtenOnly.join(", ")}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sections.length === 0) return "";
|
if (sections.length === 0) return "";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue