kurihada
|
1b7d55848d
|
refactor(server): 消除与 Core 的重复类型定义
- 删除 Server 中 60+ 个与 Core 重复的类型定义
- 将动态导入 (await import) 改为静态类型导入 (import type)
- 保留必要的运行时静态导入
- 修复测试文件中的 mock 初始化问题
- 净删除约 960 行重复代码
重构文件:
- routes/checkpoints.ts: 删除 155 行重复类型
- routes/agents.ts: 删除 93 行重复类型
- routes/commands.ts: 删除 83 行重复类型
- routes/mcp.ts: 修复类型窄化
- routes/hooks.ts: 已使用静态导入
- routes/providers.ts: 删除 63 行重复类型
- session/manager.ts: 删除 41 行重复类型
- routes/sessions.ts: 添加类型导入
- permission/handler.ts: 添加类型导入
|
2025-12-16 20:19:24 +08:00 |
|
kurihada
|
67e129fce2
|
fix(commands): 修复路由顺序导致 /content 端点被遮蔽的问题
- 将 /:name{.+}/execute 和 /:name{.+}/content 路由移到 /:name{.+} 之前
- Hono 的 {.+} 模式会贪婪匹配,导致 /test/content 被解析为 name='test/content'
- 更新测试用例以正确测试 /content 端点功能
|
2025-12-15 00:17:22 +08:00 |
|
kurihada
|
c44527a890
|
test(server): 添加 routes 模块单元测试
- agents.test.ts: Agent presets CRUD API (18 tests)
- tools.test.ts: Tool registration & execution (10 tests)
- files.test.ts: File browser API with path security (24 tests)
- commands.test.ts: Slash commands CRUD & execution (20 tests)
- hooks.test.ts: Hooks configuration management (20 tests)
覆盖率从 29.59% 提升到 60.35%,共 287 个测试
|
2025-12-15 00:14:27 +08:00 |
|