feat: 添加 Provider Registry、StatusLine、Cache Stats 和其他增强

- providerRegistry: OpenAI 兼容 provider 切换(Cerebras/Groq/DeepSeek/Qwen)
- StatusLine: 增强状态栏(缓存命中率、TTL 倒计时、自定义 shell 命令)
- cacheStats: 缓存命中率和 token 签名追踪
- ultrareviewPreflight: 代码审查预检服务
- SkillsMenu/filterSkills: 技能菜单过滤增强
- MagicDocs/langfuse prompts: 提示词更新
- claude.ts: API 客户端更新

Co-Authored-By: glm-5-turbo <zai-org@claude-code-best.win>
This commit is contained in:
claude-code-best
2026-05-09 23:04:35 +08:00
parent fdddb6dbe8
commit efaf4afd9c
28 changed files with 3613 additions and 219 deletions

View File

@@ -1,4 +1,13 @@
import { describe, test, expect, mock, beforeEach, afterEach } from 'bun:test'
import {
afterAll,
afterEach,
beforeAll,
beforeEach,
describe,
expect,
mock,
test,
} from 'bun:test'
// Mock dgram before importing LanBeacon
const mockSocket = {
@@ -13,9 +22,32 @@ const mockSocket = {
close: mock(() => {}),
}
mock.module('dgram', () => ({
createSocket: () => mockSocket,
}))
// Spread+flag pattern: previously this was a bare `mock.module('dgram', ...)`
// which leaked the stub createSocket into every later test file in the
// process via Bun's last-write-wins module mock cache. Spread real dgram
// + gate the stub behind useLanBeaconDgramStubs so other tests see real UDP.
let useLanBeaconDgramStubs = false
mock.module('dgram', () => {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const real = require('dgram') as Record<string, unknown>
return {
...real,
default: real,
createSocket: ((...args: unknown[]) =>
useLanBeaconDgramStubs
? mockSocket
: (real.createSocket as (...a: unknown[]) => unknown)(
...args,
)) as typeof real.createSocket,
}
})
beforeAll(() => {
useLanBeaconDgramStubs = true
})
afterAll(() => {
useLanBeaconDgramStubs = false
})
const { LanBeacon } = await import('../lanBeacon.js')