diff --git a/adapters/common/__tests__/format.test.ts b/adapters/common/__tests__/format.test.ts index 9ba63416..128f7e4e 100644 --- a/adapters/common/__tests__/format.test.ts +++ b/adapters/common/__tests__/format.test.ts @@ -118,8 +118,14 @@ describe('formatToolUse', () => { expect(result).toBe('🔧 Read …/project/src/index.ts') }) + + it('shortens Windows paths in file tool summaries', () => { + const result = formatToolUse('Read', { file_path: 'C:\\Users\\test\\project\\src\\index.ts' }) + expect(result).toBe('🔧 Read …/project/src/index.ts') + }) }) + describe('formatPermissionRequest', () => { it('includes tool name, input preview, and request ID', () => { const result = formatPermissionRequest('Bash', { command: 'rm -rf /' }, 'abcde') diff --git a/adapters/common/format.ts b/adapters/common/format.ts index d011d67a..e3e1efd7 100644 --- a/adapters/common/format.ts +++ b/adapters/common/format.ts @@ -223,7 +223,7 @@ function formatToolSummary(tool: string, inp: Record): string | } function shortPath(fp: string): string { - const parts = fp.split('/') + const parts = fp.replaceAll('\\', '/').split('/') return parts.length > 3 ? '…/' + parts.slice(-3).join('/') : fp }