Files
claude-mem/src/cli/types.ts
T
Alex Newman d0676aa049 feat: file-read gate allows Edit, add legacy-peer-deps for grammar install
- Change file-read gate from deny to allow with limit:1, injecting the
  observation timeline as additionalContext. Edit now works on gated files
  since the file registers as "read" with near-zero token cost.
- Add updatedInput to HookResult type for PreToolUse hooks.
- Add .npmrc with legacy-peer-deps=true for tree-sitter peer dep conflicts.
- Add --legacy-peer-deps to npm fallback paths in smart-install.js so end
  users without bun can install the 24 grammar packages.
- Rebuild plugin artifacts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 14:06:07 -07:00

39 lines
1.0 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?: 'allow' | 'deny';
permissionDecisionReason?: string;
updatedInput?: Record<string, unknown>;
};
systemMessage?: string;
exitCode?: number;
}
export interface PlatformAdapter {
normalizeInput(raw: unknown): NormalizedHookInput;
formatOutput(result: HookResult): unknown;
}
export interface EventHandler {
execute(input: NormalizedHookInput): Promise<HookResult>;
}