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:
@@ -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 "";
|
||||||
|
|||||||
Reference in New Issue
Block a user