mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
feat(hooks): add 7 hook templates with full install pipeline and extended trigger types
Extend HookTriggerType from 5 to 12 official events (Notification, SubagentStart, SubagentStop, PreCompact, SessionEnd, PostToolUseFailure, PermissionRequest). Add templates: stop-notify, auto-format-on-write, auto-lint-on-write, block-sensitive-files, git-auto-stage, post-edit-index, session-end-summary across notification/automation/indexing categories. Fix install pipeline to use correct nested settings.json format with _templateId metadata for precise detection. Redesign templates UI as responsive card grid with per-template icons.
This commit is contained in:
@@ -20,7 +20,7 @@ import { cn } from '@/lib/utils';
|
||||
|
||||
// ========== Types ==========
|
||||
|
||||
export type HookTriggerType = 'SessionStart' | 'UserPromptSubmit' | 'PreToolUse' | 'PostToolUse' | 'Stop';
|
||||
export type HookTriggerType = 'SessionStart' | 'UserPromptSubmit' | 'PreToolUse' | 'PostToolUse' | 'Stop' | 'Notification' | 'SubagentStart' | 'SubagentStop' | 'PreCompact' | 'SessionEnd' | 'PostToolUseFailure' | 'PermissionRequest';
|
||||
|
||||
export interface HookCardData {
|
||||
name: string;
|
||||
@@ -55,6 +55,20 @@ function getTriggerIcon(trigger: HookTriggerType) {
|
||||
return '✅';
|
||||
case 'Stop':
|
||||
return '🛑';
|
||||
case 'Notification':
|
||||
return '🔔';
|
||||
case 'SubagentStart':
|
||||
return '🚀';
|
||||
case 'SubagentStop':
|
||||
return '🏁';
|
||||
case 'PreCompact':
|
||||
return '📦';
|
||||
case 'SessionEnd':
|
||||
return '👋';
|
||||
case 'PostToolUseFailure':
|
||||
return '❌';
|
||||
case 'PermissionRequest':
|
||||
return '🔐';
|
||||
default:
|
||||
return '📌';
|
||||
}
|
||||
@@ -63,15 +77,20 @@ function getTriggerIcon(trigger: HookTriggerType) {
|
||||
function getTriggerVariant(trigger: HookTriggerType): 'default' | 'secondary' | 'outline' {
|
||||
switch (trigger) {
|
||||
case 'SessionStart':
|
||||
return 'default';
|
||||
case 'UserPromptSubmit':
|
||||
case 'SubagentStart':
|
||||
return 'default';
|
||||
case 'PreToolUse':
|
||||
case 'Stop':
|
||||
case 'PreCompact':
|
||||
case 'PermissionRequest':
|
||||
return 'secondary';
|
||||
case 'PostToolUse':
|
||||
case 'Notification':
|
||||
case 'SubagentStop':
|
||||
case 'SessionEnd':
|
||||
case 'PostToolUseFailure':
|
||||
return 'outline';
|
||||
case 'Stop':
|
||||
return 'secondary';
|
||||
default:
|
||||
return 'outline';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user