Merge d0d09dbe05b7cdcac60b8a908e0eb83a5647811e into 4c3b08c0a443df17d4abe85ac051cc45acda0666

This commit is contained in:
Raphaelowo 2026-07-14 02:21:20 +08:00 committed by GitHub
commit 02e7808310
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -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')

View File

@ -223,7 +223,7 @@ function formatToolSummary(tool: string, inp: Record<string, unknown>): string |
}
function shortPath(fp: string): string {
const parts = fp.split('/')
const parts = fp.replaceAll('\\', '/').split('/')
return parts.length > 3 ? '…/' + parts.slice(-3).join('/') : fp
}