2b8fbcf50e
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
export interface NormalizedHookInput {
|
|
sessionId: string;
|
|
cwd: string;
|
|
platform?: string; // 'claude-code', 'cursor', 'gemini-cli', etc.
|
|
prompt?: string;
|
|
toolName?: string;
|
|
toolInput?: unknown;
|
|
toolResponse?: unknown;
|
|
transcriptPath?: string;
|
|
// Cursor-specific fields
|
|
filePath?: string; // afterFileEdit
|
|
edits?: unknown[]; // afterFileEdit
|
|
// Platform-specific metadata (source, reason, trigger, mcp_context, etc.)
|
|
metadata?: Record<string, unknown>;
|
|
}
|
|
|
|
export interface HookResult {
|
|
continue?: boolean;
|
|
suppressOutput?: boolean;
|
|
hookSpecificOutput?: {
|
|
hookEventName: string;
|
|
additionalContext: string;
|
|
permissionDecision?: string;
|
|
permissionDecisionReason?: string;
|
|
};
|
|
systemMessage?: string;
|
|
exitCode?: number;
|
|
stderrMessage?: string; // Written to stderr before exit (for exit code 2 blocking feedback)
|
|
}
|
|
|
|
export interface PlatformAdapter {
|
|
normalizeInput(raw: unknown): NormalizedHookInput;
|
|
formatOutput(result: HookResult): unknown;
|
|
}
|
|
|
|
export interface EventHandler {
|
|
execute(input: NormalizedHookInput): Promise<HookResult>;
|
|
}
|