diff --git a/crates/pi-natives/src/shell/windows.rs b/crates/pi-natives/src/shell/windows.rs index 49e3cef49..8973dd16a 100644 --- a/crates/pi-natives/src/shell/windows.rs +++ b/crates/pi-natives/src/shell/windows.rs @@ -266,7 +266,11 @@ fn translate_msys_segment(segment: &str, install_roots: &[PathBuf]) -> Option bool { - value.len() == 1 && value.chars().next().is_some_and(|c| c.is_ascii_alphabetic()) + value.len() == 1 + && value + .chars() + .next() + .is_some_and(|c| c.is_ascii_alphabetic()) } fn is_windows_style_path(value: &str) -> bool { @@ -283,14 +287,8 @@ mod tests { #[test] fn drive_letter_segments_translate_to_windows_paths() { - assert_eq!( - translate_msys_segment("/c/Users/foo", &[]).as_deref(), - Some("C:\\Users\\foo"), - ); - assert_eq!( - translate_msys_segment("/d", &[]).as_deref(), - Some("D:\\"), - ); + assert_eq!(translate_msys_segment("/c/Users/foo", &[]).as_deref(), Some("C:\\Users\\foo"),); + assert_eq!(translate_msys_segment("/d", &[]).as_deref(), Some("D:\\"),); } #[test] @@ -308,4 +306,4 @@ mod tests { assert!(!is_drive_letter("cc")); assert!(!is_drive_letter("1")); } -} \ No newline at end of file +} diff --git a/packages/coding-agent/src/edit/modes/hashline.ts b/packages/coding-agent/src/edit/modes/hashline.ts index f483c1b4e..9f7aae121 100644 --- a/packages/coding-agent/src/edit/modes/hashline.ts +++ b/packages/coding-agent/src/edit/modes/hashline.ts @@ -96,7 +96,7 @@ function stripLeadingHashlinePrefixes(line: string): string { return result; } -function filterTruncationNotices(lines: string[]): string[] { +function _filterTruncationNotices(lines: string[]): string[] { return lines.filter(line => !READ_TRUNCATION_NOTICE_RE.test(line)); } @@ -126,9 +126,7 @@ export function stripHashlinePrefixes(lines: string[]): string[] { const { nonEmpty, hashPrefixCount } = collectLinePrefixStats(lines); if (nonEmpty === 0) return lines; if (hashPrefixCount !== nonEmpty) return lines; - return lines - .filter(line => !READ_TRUNCATION_NOTICE_RE.test(line)) - .map(line => stripLeadingHashlinePrefixes(line)); + return lines.filter(line => !READ_TRUNCATION_NOTICE_RE.test(line)).map(line => stripLeadingHashlinePrefixes(line)); } const linesSchema = Type.Union([ diff --git a/packages/coding-agent/test/core/hashline.test.ts b/packages/coding-agent/test/core/hashline.test.ts index a66144506..ee3e59b19 100644 --- a/packages/coding-agent/test/core/hashline.test.ts +++ b/packages/coding-agent/test/core/hashline.test.ts @@ -959,23 +959,14 @@ describe("stripNewLinePrefixes", () => { }); it("strips hashline prefixes when generic read truncation notice is present", () => { - const lines = [ - "1#BQ:line one", - "2#XS:line two", - "", - "[42 more lines in file. Use sel=L3 to continue]", - ]; + const lines = ["1#BQ:line one", "2#XS:line two", "", "[42 more lines in file. Use sel=L3 to continue]"]; const result = stripNewLinePrefixes(lines); expect(result[0]).toBe("line one"); expect(result[1]).toBe("line two"); }); it("strips nested hashline prefixes (already-corrupted content re-read)", () => { - const lines = [ - "1#NX:1#BQ:---", - "2#TY:2#XS:title: example", - "3#JZ:3#BQ:---", - ]; + const lines = ["1#NX:1#BQ:---", "2#TY:2#XS:title: example", "3#JZ:3#BQ:---"]; const result = stripNewLinePrefixes(lines); expect(result[0]).toBe("---"); expect(result[1]).toBe("title: example"); @@ -1013,15 +1004,11 @@ describe("stripHashlinePrefixes", () => { }); it("strips nested hashline prefixes from already-corrupted content", () => { - const lines = [ - "1#NX:1#BQ:---", - "2#TY:2#XS:title", - ]; + const lines = ["1#NX:1#BQ:---", "2#TY:2#XS:title"]; const result = stripHashlinePrefixes(lines); expect(result[0]).toBe("---"); expect(result[1]).toBe("title"); }); - }); // ═══════════════════════════════════════════════════════════════════════════