UNPKG

tdd-guard

Version:

TDD Guard enforces Test-Driven Development principles using Claude Code hooks

2 lines 1.77 kB
export declare const OPERATION_ANALYSIS = "## Analyzing Code Changes\n\n### For Edit/MultiEdit Operations\nWhen reviewing edits, you must:\n\n1. **Identify truly NEW content**\n - Compare old string vs new string character by character\n - A test is NEW only if it doesn't exist in the old string\n - Modifying an existing test is not adding a new test\n - Moving or reformatting tests doesn't count as new\n\n2. **Count new tests accurately**\n - Look for test blocks: `test(`, `it(`, `describe(`\n - Count only tests that appear in new but not in old\n - One new test = allowed, Multiple new tests = violation\n\n3. **Check implementation changes**\n - Determine what the test failure indicates\n - Verify implementation matches the failure type\n - Ensure minimal implementation principle\n\n### For Write Operations\nWhen reviewing new file creation:\n\n1. **Test files**: Usually allowed (starting TDD cycle)\n - Should contain only one test initially\n - Multiple tests in new file = violation\n\n2. **Implementation files**: Check context carefully\n - Need evidence of failing test\n - Implementation must match test failure type\n\n### Context Clues to Consider\n\n1. **Test Output**: Most important indicator\n - Shows current TDD phase\n - Reveals what implementation is needed\n - Missing output = likely violation\n\n2. **Todo List**: Provides intent\n - \"Refactor\" todos require passing tests\n - \"Add test\" todos support test creation\n - Multiple \"add test\" todos don't justify multiple tests\n\n3. **File Paths**: Indicate test vs implementation\n - Changes must be appropriate for file type\n - Test changes have different rules than implementation"; //# sourceMappingURL=operation-analysis.d.ts.map