#!/usr/bin/env node /** * Forgen — PreToolUse Hook * * 도구 실행 전 위험 명령어 차단 및 컨텍스트 리마인더 주입. * - rm -rf, git push --force 등 위험 패턴 감지 * - 활성 모드 상태 리마인더 주입 */ interface DangerousPatternEntry { pattern: RegExp; description: string; severity: 'block' | 'warn'; /** * match_target (v0.4.1): 'masked' (default) — quote/heredoc 본문 제거 후 매칭. * 실 shell 실행 토큰 검사에 적합. 'raw' — 원본 command 그대로 매칭. * `python -c "..."`, `eval "..."` 처럼 **quote 안 본문이 실제 payload 로 실행** * 되는 패턴에 사용. */ matchTarget?: 'raw' | 'masked'; } /** 위험 Bash 명령어 패턴 (패키지 내장 + 사용자 커스텀 병합) */ export declare const DANGEROUS_PATTERNS: DangerousPatternEntry[]; /** 위험 명령어 검사 (순수 함수) */ export declare function checkDangerousCommand(toolName: string, toolInput: Record | string): { action: 'block' | 'warn' | 'pass'; description?: string; command?: string; }; /** 카운터 기반 리마인더 표시 여부 판정 (순수 함수 — I/O 없음) */ export declare function shouldShowReminder(count: number, interval?: number): boolean; /** * Update evidence counter in a solution file. * PR2b: solution-writer.incrementEvidence로 위임. lock + fresh re-read + atomic write. * * Exported for use by solution-injector. */ export declare function updateSolutionEvidence(solutionName: string, field: 'reflected' | 'negative' | 'injected' | 'sessions' | 'reExtracted'): void; export {};