feat(hooks): add hook management and session timeline features

- Add hook quick templates component with configurable templates
- Refactor NativeSessionPanel to use new SessionTimeline component
- Add OpenCode session parser for parsing OpenCode CLI sessions
- Enhance API with session-related endpoints
- Add locale translations for hooks and native session features
- Update hook commands and routes for better hook management
This commit is contained in:
catlog22
2026-02-25 23:21:35 +08:00
parent 25f442b329
commit 519efe9783
15 changed files with 1543 additions and 435 deletions

View File

@@ -182,6 +182,15 @@ export const HOOK_TEMPLATES: readonly HookTemplate[] = [
'-e',
'const p=JSON.parse(process.env.HOOK_INPUT||"{}");const cp=require("child_process");const payload=JSON.stringify({type:"SESSION_SUMMARY",transcript:p.transcript_path||"",project:process.env.CLAUDE_PROJECT_DIR||process.cwd(),timestamp:Date.now()});cp.spawnSync("curl",["-s","-X","POST","-H","Content-Type: application/json","-d",payload,"http://localhost:3456/api/hook"],{stdio:"inherit",shell:true})'
]
},
{
id: 'project-state-inject',
name: 'Project State Inject',
description: 'Inject project guidelines and recent dev history at session start',
category: 'indexing',
trigger: 'SessionStart',
command: 'ccw',
args: ['hook', 'project-state', '--stdin']
}
] as const;
@@ -205,6 +214,7 @@ const TEMPLATE_ICONS: Record<string, typeof Bell> = {
'git-auto-stage': GitBranch,
'post-edit-index': Database,
'session-end-summary': FileBarChart,
'project-state-inject': FileBarChart,
};
// ========== Category Names ==========