mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-15 12:53:31 +08:00
Avoid Bun filter-mode repository scans that exhaust macOS file descriptors and corrupt subprocess test evidence. Apply rooted filters across server, contract, coverage, persistence, policy, desktop native, and adapter test entrypoints. Confidence: high Scope-risk: narrow Tested: bun run check:policy; bun run check:server; bun run check:chat-contract
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
#!/usr/bin/env bun
|
|
|
|
type Check = {
|
|
title: string
|
|
command: string[]
|
|
cwd?: string
|
|
}
|
|
|
|
const rootDir = process.cwd()
|
|
const checks: Check[] = [
|
|
{
|
|
title: 'Server persistent JSON migrations',
|
|
command: ['bun', 'test', './src/server/__tests__/persistence-upgrade.test.ts'],
|
|
},
|
|
{
|
|
title: 'Desktop localStorage migrations',
|
|
command: ['bun', 'run', 'test', '--', '--run', 'src/lib/persistenceMigrations.test.ts'],
|
|
cwd: 'desktop',
|
|
},
|
|
]
|
|
|
|
async function runCheck(check: Check): Promise<number> {
|
|
const cwd = check.cwd ? `${rootDir}/${check.cwd}` : rootDir
|
|
console.log(`\n[persistence-upgrade] ${check.title}`)
|
|
console.log(`$ ${check.command.join(' ')}`)
|
|
const proc = Bun.spawn(check.command, {
|
|
cwd,
|
|
stdout: 'inherit',
|
|
stderr: 'inherit',
|
|
})
|
|
return proc.exited
|
|
}
|
|
|
|
let failures = 0
|
|
for (const check of checks) {
|
|
const code = await runCheck(check)
|
|
if (code !== 0) {
|
|
failures += 1
|
|
}
|
|
}
|
|
|
|
if (failures > 0) {
|
|
console.error(`\n[persistence-upgrade] failed checks: ${failures}`)
|
|
process.exit(1)
|
|
}
|
|
|
|
console.log('\n[persistence-upgrade] all checks passed')
|