UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

120 lines 3.27 kB
/** * Laziness Detection Hook * * Pre-write hook that detects and blocks destructive avoidance patterns * including test deletion, feature removal, and coverage regression. * * @implements @.aiwg/requirements/use-cases/UC-AP-001-detect-test-deletion.md * @implements @.aiwg/requirements/use-cases/UC-AP-002-detect-feature-removal.md * @implements @.aiwg/requirements/use-cases/UC-AP-003-detect-coverage-regression.md * @schema @.aiwg/patterns/laziness-patterns.yaml * @agent @agentic/code/frameworks/sdlc-complete/agents/laziness-detector.md */ export interface DetectedPattern { id: string; name: string; category: string; severity: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW'; file: string; line?: number; match: string; confidence: number; } export interface BlockDecision { block: boolean; warn?: boolean; log?: boolean; reason?: string; recovery?: string; patterns: DetectedPattern[]; } export interface FileChange { path: string; type: 'added' | 'modified' | 'deleted'; diff: string; linesAdded: number; linesDeleted: number; } /** * Laziness Detection Hook * * Analyzes pending file changes for avoidance patterns. */ export declare class LazinessDetectionHook { constructor(patternsPath?: string); /** * Main entry point - analyze file changes before write */ analyze(changes: FileChange[]): Promise<BlockDecision>; /** * Detect patterns in a single file change */ private detectPatternsInChange; /** * Pattern: LP-001 - Complete Test File Deletion */ private detectTestDeletion; /** * Pattern: LP-002, LP-003 - Test Suite/Individual Test Disabling */ private detectTestDisabling; /** * Pattern: LP-012 - Trivial Assertion Replacement */ private detectAssertionWeakening; /** * Pattern: LP-005 - Feature Code Commenting */ private detectFeatureRemoval; /** * Pattern: TODO/FIXME Accumulation (MEDIUM severity) */ private detectTodoAccumulation; /** * Pattern: LP-006 - Validation Removal */ private detectValidationRemoval; /** * Pattern: LP-007 - Error Handler Deletion */ private detectErrorHandlerDeletion; /** * Pattern: LP-015 - Hardcoded Test Bypass */ private detectHardcodedBypass; /** * Pattern: LP-016 - Error Suppression */ private detectErrorSuppression; /** * Pattern: LP-008 - Feature Flag Disabling */ private detectFeatureFlagDisabling; /** * Make blocking decision based on detected patterns */ private makeBlockDecision; /** * Helper: Check if file is a test file */ private isTestFile; /** * Helper: Check if file is source code (not test) */ private isSourceFile; /** * Helper: Check if file is config */ private isConfigFile; /** * Capture baseline metrics for comparison */ private captureBaseline; } /** * Hook execution function * * Called by AIWG framework before file write operations. */ export declare function executeLazinessDetectionHook(changes: FileChange[]): Promise<BlockDecision>; //# sourceMappingURL=laziness-detection.d.ts.map