feat(hooks): 添加 Hooks 配置管理功能

- 新增 Server Hooks API 路由 (CRUD + 测试执行)
- 新增 HooksPanel 组件用于管理所有钩子类型
- 新增 HookEditor 组件用于编辑单个钩子规则
- 支持 file_edited/file_created/file_deleted/session_completed 四种钩子
- 集成到 web 和 desktop 应用
This commit is contained in:
2025-12-12 21:02:06 +08:00
parent 622bd869f9
commit 9365e07df1
12 changed files with 1990 additions and 5 deletions
+6
View File
@@ -11,6 +11,7 @@ import {
ConfigPanel,
CommandPanel,
MCPPanel,
HooksPanel,
Toaster,
listSessions,
createSession,
@@ -25,6 +26,7 @@ export function App() {
const [showConfig, setShowConfig] = useState(false);
const [showCommands, setShowCommands] = useState(false);
const [showMCP, setShowMCP] = useState(false);
const [showHooks, setShowHooks] = useState(false);
const [sessionTitleUpdate, setSessionTitleUpdate] = useState<{ sessionId: string; name: string } | null>(null);
// 初始化:加载或创建会话
@@ -111,6 +113,7 @@ export function App() {
onOpenConfig={() => setShowConfig(true)}
onOpenCommands={() => setShowCommands(true)}
onOpenMCP={() => setShowMCP(true)}
onOpenHooks={() => setShowHooks(true)}
/>
) : (
<div className="flex-1 flex items-center justify-center h-full">
@@ -165,6 +168,9 @@ export function App() {
{/* MCP 面板 */}
{showMCP && <MCPPanel onClose={() => setShowMCP(false)} responsive />}
{/* Hooks 面板 */}
{showHooks && <HooksPanel onClose={() => setShowHooks(false)} responsive />}
{/* 移动端底部文件按钮 */}
<button
onClick={() => setShowFileBrowser(true)}