7cccacdc51
Implement full repository review mode that detects logical features/modules and reviews them systematically with session persistence for pause/resume capability. Key additions: - RepoScanner: scans codebase and estimates tokens/cost - FeatureAnalyzer: AI-powered detection of logical modules - FeaturePlanner: creates review execution plan - StateManager: persists sessions for resume capability - RepoOrchestrator: executes feature-by-feature reviews - MarkdownReporter: generates review reports New CLI options: --repo, --quick, --deep, --list-sessions, --session, --export, --path, --ignore, --plan-only, --reanalyze Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
// tests/feature-analyzer/hash.test.ts
|
|
import { describe, it, expect } from 'vitest'
|
|
import { computeCodebaseHash } from '../../src/feature-analyzer/hash.js'
|
|
import type { FileInfo } from '../../src/repo-scanner/types.js'
|
|
|
|
describe('computeCodebaseHash', () => {
|
|
it('should return consistent hash for same files', () => {
|
|
const files: FileInfo[] = [
|
|
{ path: '/a.ts', relativePath: 'a.ts', language: 'typescript', lines: 100, size: 1000 },
|
|
{ path: '/b.ts', relativePath: 'b.ts', language: 'typescript', lines: 50, size: 500 }
|
|
]
|
|
|
|
const hash1 = computeCodebaseHash(files)
|
|
const hash2 = computeCodebaseHash(files)
|
|
|
|
expect(hash1).toBe(hash2)
|
|
expect(hash1).toHaveLength(16) // Short hash
|
|
})
|
|
|
|
it('should return different hash for different files', () => {
|
|
const files1: FileInfo[] = [
|
|
{ path: '/a.ts', relativePath: 'a.ts', language: 'typescript', lines: 100, size: 1000 }
|
|
]
|
|
const files2: FileInfo[] = [
|
|
{ path: '/b.ts', relativePath: 'b.ts', language: 'typescript', lines: 100, size: 1000 }
|
|
]
|
|
|
|
const hash1 = computeCodebaseHash(files1)
|
|
const hash2 = computeCodebaseHash(files2)
|
|
|
|
expect(hash1).not.toBe(hash2)
|
|
})
|
|
|
|
it('should detect size changes', () => {
|
|
const files1: FileInfo[] = [
|
|
{ path: '/a.ts', relativePath: 'a.ts', language: 'typescript', lines: 100, size: 1000 }
|
|
]
|
|
const files2: FileInfo[] = [
|
|
{ path: '/a.ts', relativePath: 'a.ts', language: 'typescript', lines: 100, size: 2000 }
|
|
]
|
|
|
|
const hash1 = computeCodebaseHash(files1)
|
|
const hash2 = computeCodebaseHash(files2)
|
|
|
|
expect(hash1).not.toBe(hash2)
|
|
})
|
|
})
|