UNPKG

ccguard

Version:

Automated enforcement of net-negative LOC, complexity constraints, and quality standards for Claude code

650 lines 18.7 kB
import { z } from 'zod'; export declare const HookContextSchema: z.ZodObject<{ session_id: z.ZodString; transcript_path: z.ZodString; hook_event_name: z.ZodString; }, "strip", z.ZodTypeAny, { session_id: string; transcript_path: string; hook_event_name: string; }, { session_id: string; transcript_path: string; hook_event_name: string; }>; export declare const HookDataSchema: z.ZodObject<{ session_id: z.ZodString; transcript_path: z.ZodString; hook_event_name: z.ZodString; } & { tool_name: z.ZodString; tool_input: z.ZodUnknown; }, "strip", z.ZodTypeAny, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: string; tool_input?: unknown; }, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: string; tool_input?: unknown; }>; export declare const UserPromptSubmitSchema: z.ZodEffects<z.ZodObject<{ session_id: z.ZodString; transcript_path: z.ZodString; hook_event_name: z.ZodString; } & { prompt: z.ZodString; cwd: z.ZodString; }, "strip", z.ZodTypeAny, { session_id: string; transcript_path: string; hook_event_name: string; prompt: string; cwd: string; }, { session_id: string; transcript_path: string; hook_event_name: string; prompt: string; cwd: string; }>, { session_id: string; transcript_path: string; hook_event_name: string; prompt: string; cwd: string; }, { session_id: string; transcript_path: string; hook_event_name: string; prompt: string; cwd: string; }>; export declare const EditSchema: z.ZodObject<{ file_path: z.ZodString; old_string: z.ZodString; new_string: z.ZodString; replace_all: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { file_path: string; old_string: string; new_string: string; replace_all?: boolean | undefined; }, { file_path: string; old_string: string; new_string: string; replace_all?: boolean | undefined; }>; export declare const MultiEditSchema: z.ZodObject<{ file_path: z.ZodString; edits: z.ZodArray<z.ZodObject<{ old_string: z.ZodString; new_string: z.ZodString; replace_all: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { old_string: string; new_string: string; replace_all?: boolean | undefined; }, { old_string: string; new_string: string; replace_all?: boolean | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { file_path: string; edits: { old_string: string; new_string: string; replace_all?: boolean | undefined; }[]; }, { file_path: string; edits: { old_string: string; new_string: string; replace_all?: boolean | undefined; }[]; }>; export declare const WriteSchema: z.ZodObject<{ file_path: z.ZodString; content: z.ZodString; }, "strip", z.ZodTypeAny, { file_path: string; content: string; }, { file_path: string; content: string; }>; export declare const EditOperationSchema: z.ZodObject<{ session_id: z.ZodString; transcript_path: z.ZodString; hook_event_name: z.ZodString; } & { tool_name: z.ZodLiteral<"Edit">; tool_input: z.ZodObject<{ file_path: z.ZodString; old_string: z.ZodString; new_string: z.ZodString; replace_all: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { file_path: string; old_string: string; new_string: string; replace_all?: boolean | undefined; }, { file_path: string; old_string: string; new_string: string; replace_all?: boolean | undefined; }>; }, "strip", z.ZodTypeAny, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "Edit"; tool_input: { file_path: string; old_string: string; new_string: string; replace_all?: boolean | undefined; }; }, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "Edit"; tool_input: { file_path: string; old_string: string; new_string: string; replace_all?: boolean | undefined; }; }>; export declare const MultiEditOperationSchema: z.ZodObject<{ session_id: z.ZodString; transcript_path: z.ZodString; hook_event_name: z.ZodString; } & { tool_name: z.ZodLiteral<"MultiEdit">; tool_input: z.ZodObject<{ file_path: z.ZodString; edits: z.ZodArray<z.ZodObject<{ old_string: z.ZodString; new_string: z.ZodString; replace_all: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { old_string: string; new_string: string; replace_all?: boolean | undefined; }, { old_string: string; new_string: string; replace_all?: boolean | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { file_path: string; edits: { old_string: string; new_string: string; replace_all?: boolean | undefined; }[]; }, { file_path: string; edits: { old_string: string; new_string: string; replace_all?: boolean | undefined; }[]; }>; }, "strip", z.ZodTypeAny, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "MultiEdit"; tool_input: { file_path: string; edits: { old_string: string; new_string: string; replace_all?: boolean | undefined; }[]; }; }, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "MultiEdit"; tool_input: { file_path: string; edits: { old_string: string; new_string: string; replace_all?: boolean | undefined; }[]; }; }>; export declare const WriteOperationSchema: z.ZodObject<{ session_id: z.ZodString; transcript_path: z.ZodString; hook_event_name: z.ZodString; } & { tool_name: z.ZodLiteral<"Write">; tool_input: z.ZodObject<{ file_path: z.ZodString; content: z.ZodString; }, "strip", z.ZodTypeAny, { file_path: string; content: string; }, { file_path: string; content: string; }>; }, "strip", z.ZodTypeAny, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "Write"; tool_input: { file_path: string; content: string; }; }, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "Write"; tool_input: { file_path: string; content: string; }; }>; export declare const ToolOperationSchema: z.ZodDiscriminatedUnion<"tool_name", [z.ZodObject<{ session_id: z.ZodString; transcript_path: z.ZodString; hook_event_name: z.ZodString; } & { tool_name: z.ZodLiteral<"Edit">; tool_input: z.ZodObject<{ file_path: z.ZodString; old_string: z.ZodString; new_string: z.ZodString; replace_all: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { file_path: string; old_string: string; new_string: string; replace_all?: boolean | undefined; }, { file_path: string; old_string: string; new_string: string; replace_all?: boolean | undefined; }>; }, "strip", z.ZodTypeAny, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "Edit"; tool_input: { file_path: string; old_string: string; new_string: string; replace_all?: boolean | undefined; }; }, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "Edit"; tool_input: { file_path: string; old_string: string; new_string: string; replace_all?: boolean | undefined; }; }>, z.ZodObject<{ session_id: z.ZodString; transcript_path: z.ZodString; hook_event_name: z.ZodString; } & { tool_name: z.ZodLiteral<"MultiEdit">; tool_input: z.ZodObject<{ file_path: z.ZodString; edits: z.ZodArray<z.ZodObject<{ old_string: z.ZodString; new_string: z.ZodString; replace_all: z.ZodOptional<z.ZodBoolean>; }, "strip", z.ZodTypeAny, { old_string: string; new_string: string; replace_all?: boolean | undefined; }, { old_string: string; new_string: string; replace_all?: boolean | undefined; }>, "many">; }, "strip", z.ZodTypeAny, { file_path: string; edits: { old_string: string; new_string: string; replace_all?: boolean | undefined; }[]; }, { file_path: string; edits: { old_string: string; new_string: string; replace_all?: boolean | undefined; }[]; }>; }, "strip", z.ZodTypeAny, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "MultiEdit"; tool_input: { file_path: string; edits: { old_string: string; new_string: string; replace_all?: boolean | undefined; }[]; }; }, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "MultiEdit"; tool_input: { file_path: string; edits: { old_string: string; new_string: string; replace_all?: boolean | undefined; }[]; }; }>, z.ZodObject<{ session_id: z.ZodString; transcript_path: z.ZodString; hook_event_name: z.ZodString; } & { tool_name: z.ZodLiteral<"Write">; tool_input: z.ZodObject<{ file_path: z.ZodString; content: z.ZodString; }, "strip", z.ZodTypeAny, { file_path: string; content: string; }, { file_path: string; content: string; }>; }, "strip", z.ZodTypeAny, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "Write"; tool_input: { file_path: string; content: string; }; }, { session_id: string; transcript_path: string; hook_event_name: string; tool_name: "Write"; tool_input: { file_path: string; content: string; }; }>]>; export declare const SessionStatsSchema: z.ZodObject<{ totalLinesAdded: z.ZodNumber; totalLinesRemoved: z.ZodNumber; netChange: z.ZodNumber; operationCount: z.ZodNumber; lastUpdated: z.ZodString; }, "strip", z.ZodTypeAny, { totalLinesAdded: number; totalLinesRemoved: number; netChange: number; operationCount: number; lastUpdated: string; }, { totalLinesAdded: number; totalLinesRemoved: number; netChange: number; operationCount: number; lastUpdated: string; }>; export declare const GuardStateSchema: z.ZodObject<{ enabled: z.ZodBoolean; lastUpdated: z.ZodString; }, "strip", z.ZodTypeAny, { lastUpdated: string; enabled: boolean; }, { lastUpdated: string; enabled: boolean; }>; export declare const GuardConfigSchema: z.ZodObject<{ enforcement: z.ZodDefault<z.ZodObject<{ mode: z.ZodDefault<z.ZodEnum<["session-wide", "per-operation"]>>; strategy: z.ZodDefault<z.ZodEnum<["cumulative", "snapshot"]>>; ignoreEmptyLines: z.ZodDefault<z.ZodBoolean>; limitType: z.ZodDefault<z.ZodOptional<z.ZodEnum<["hard", "soft"]>>>; }, "strip", z.ZodTypeAny, { mode: "session-wide" | "per-operation"; strategy: "cumulative" | "snapshot"; ignoreEmptyLines: boolean; limitType: "hard" | "soft"; }, { mode?: "session-wide" | "per-operation" | undefined; strategy?: "cumulative" | "snapshot" | undefined; ignoreEmptyLines?: boolean | undefined; limitType?: "hard" | "soft" | undefined; }>>; whitelist: z.ZodDefault<z.ZodObject<{ patterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; extensions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { patterns: string[]; extensions: string[]; }, { patterns?: string[] | undefined; extensions?: string[] | undefined; }>>; thresholds: z.ZodOptional<z.ZodObject<{ allowedPositiveLines: z.ZodDefault<z.ZodNumber>; }, "strip", z.ZodTypeAny, { allowedPositiveLines: number; }, { allowedPositiveLines?: number | undefined; }>>; }, "strip", z.ZodTypeAny, { enforcement: { mode: "session-wide" | "per-operation"; strategy: "cumulative" | "snapshot"; ignoreEmptyLines: boolean; limitType: "hard" | "soft"; }; whitelist: { patterns: string[]; extensions: string[]; }; thresholds?: { allowedPositiveLines: number; } | undefined; }, { enforcement?: { mode?: "session-wide" | "per-operation" | undefined; strategy?: "cumulative" | "snapshot" | undefined; ignoreEmptyLines?: boolean | undefined; limitType?: "hard" | "soft" | undefined; } | undefined; whitelist?: { patterns?: string[] | undefined; extensions?: string[] | undefined; } | undefined; thresholds?: { allowedPositiveLines?: number | undefined; } | undefined; }>; export declare const HotConfigSchema: z.ZodObject<{ enforcement: z.ZodOptional<z.ZodObject<{ mode: z.ZodOptional<z.ZodEnum<["session-wide", "per-operation"]>>; strategy: z.ZodOptional<z.ZodEnum<["cumulative", "snapshot"]>>; limitType: z.ZodOptional<z.ZodEnum<["hard", "soft"]>>; }, "strip", z.ZodTypeAny, { mode?: "session-wide" | "per-operation" | undefined; strategy?: "cumulative" | "snapshot" | undefined; limitType?: "hard" | "soft" | undefined; }, { mode?: "session-wide" | "per-operation" | undefined; strategy?: "cumulative" | "snapshot" | undefined; limitType?: "hard" | "soft" | undefined; }>>; thresholds: z.ZodOptional<z.ZodObject<{ allowedPositiveLines: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { allowedPositiveLines?: number | undefined; }, { allowedPositiveLines?: number | undefined; }>>; lastUpdated: z.ZodString; sessionId: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { lastUpdated: string; enforcement?: { mode?: "session-wide" | "per-operation" | undefined; strategy?: "cumulative" | "snapshot" | undefined; limitType?: "hard" | "soft" | undefined; } | undefined; thresholds?: { allowedPositiveLines?: number | undefined; } | undefined; sessionId?: string | undefined; }, { lastUpdated: string; enforcement?: { mode?: "session-wide" | "per-operation" | undefined; strategy?: "cumulative" | "snapshot" | undefined; limitType?: "hard" | "soft" | undefined; } | undefined; thresholds?: { allowedPositiveLines?: number | undefined; } | undefined; sessionId?: string | undefined; }>; export declare const OperationRecordSchema: z.ZodObject<{ timestamp: z.ZodString; toolName: z.ZodEnum<["Edit", "MultiEdit", "Write"]>; filePath: z.ZodString; linesAdded: z.ZodNumber; linesRemoved: z.ZodNumber; netChange: z.ZodNumber; decision: z.ZodEnum<["approve", "block"]>; reason: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { netChange: number; timestamp: string; toolName: "Edit" | "MultiEdit" | "Write"; filePath: string; linesAdded: number; linesRemoved: number; decision: "block" | "approve"; reason?: string | undefined; }, { netChange: number; timestamp: string; toolName: "Edit" | "MultiEdit" | "Write"; filePath: string; linesAdded: number; linesRemoved: number; decision: "block" | "approve"; reason?: string | undefined; }>; export declare const OperationHistorySchema: z.ZodObject<{ records: z.ZodArray<z.ZodObject<{ timestamp: z.ZodString; toolName: z.ZodEnum<["Edit", "MultiEdit", "Write"]>; filePath: z.ZodString; linesAdded: z.ZodNumber; linesRemoved: z.ZodNumber; netChange: z.ZodNumber; decision: z.ZodEnum<["approve", "block"]>; reason: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { netChange: number; timestamp: string; toolName: "Edit" | "MultiEdit" | "Write"; filePath: string; linesAdded: number; linesRemoved: number; decision: "block" | "approve"; reason?: string | undefined; }, { netChange: number; timestamp: string; toolName: "Edit" | "MultiEdit" | "Write"; filePath: string; linesAdded: number; linesRemoved: number; decision: "block" | "approve"; reason?: string | undefined; }>, "many">; maxRecords: z.ZodNumber; lastUpdated: z.ZodString; }, "strip", z.ZodTypeAny, { lastUpdated: string; records: { netChange: number; timestamp: string; toolName: "Edit" | "MultiEdit" | "Write"; filePath: string; linesAdded: number; linesRemoved: number; decision: "block" | "approve"; reason?: string | undefined; }[]; maxRecords: number; }, { lastUpdated: string; records: { netChange: number; timestamp: string; toolName: "Edit" | "MultiEdit" | "Write"; filePath: string; linesAdded: number; linesRemoved: number; decision: "block" | "approve"; reason?: string | undefined; }[]; maxRecords: number; }>; export declare const LockedFilesSchema: z.ZodObject<{ files: z.ZodArray<z.ZodString, "many">; lastUpdated: z.ZodString; }, "strip", z.ZodTypeAny, { lastUpdated: string; files: string[]; }, { lastUpdated: string; files: string[]; }>; export declare const isEditOperation: (op: { tool_name: string; }) => boolean; export declare const isMultiEditOperation: (op: { tool_name: string; }) => boolean; export declare const isWriteOperation: (op: { tool_name: string; }) => boolean; //# sourceMappingURL=schemas.d.ts.map