feat: prepare GoodBuddy 0.8.0

This commit is contained in:
lofyer
2026-08-05 19:40:40 +08:00
parent 38ac2206f2
commit 39a457ded8
96 changed files with 14221 additions and 1027 deletions
+42 -1
View File
@@ -1,5 +1,8 @@
import { describe, expect, it } from 'vitest'
import { safeToolArgumentSummary } from './approval-summary'
import {
safeToolArgumentSummary,
safeToolErrorDetail
} from './approval-summary'
describe('safeToolArgumentSummary', () => {
it('redacts nested sensitive fields', () => {
@@ -26,3 +29,41 @@ describe('safeToolArgumentSummary', () => {
).not.toContain('secret-token')
})
})
describe('safeToolErrorDetail', () => {
it('extracts nested runtime errors while redacting secrets', () => {
expect(
safeToolErrorDetail([
{
content:
'exit code 1\nAuthorization: Bearer secret-token'
}
])
).toBe('exit code 1\nAuthorization: [REDACTED]')
expect(
safeToolErrorDetail({
message:
'{"token":"json-secret","authorization":"Basic abc123"}'
})
).toBe(
'{"token":"[REDACTED]","authorization":"[REDACTED]"}'
)
})
it('bounds output and ignores unrelated provider payload fields', () => {
expect(
safeToolErrorDetail(
{
content: 'parser failure '.repeat(20),
privateDocument: 'must not be returned'
},
40
)
).toHaveLength(40)
expect(
safeToolErrorDetail({
privateDocument: 'must not be returned'
})
).toBeUndefined()
})
})