Files
xiaofanluan 7cccacdc51 feat: add repository-wide code review with feature analysis
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>
2026-01-27 22:58:22 +08:00

50 lines
1.4 KiB
TypeScript

// tests/repo-scanner/filter.test.ts
import { describe, it, expect } from 'vitest'
import { shouldIgnore, detectLanguage } from '../../src/repo-scanner/filter.js'
describe('filter', () => {
describe('shouldIgnore', () => {
it('should ignore node_modules', () => {
expect(shouldIgnore('node_modules/lodash/index.js', [])).toBe(true)
})
it('should ignore .git', () => {
expect(shouldIgnore('.git/config', [])).toBe(true)
})
it('should ignore custom patterns', () => {
expect(shouldIgnore('vendor/lib.js', ['vendor'])).toBe(true)
})
it('should not ignore regular source files', () => {
expect(shouldIgnore('src/index.ts', [])).toBe(false)
})
it('should ignore binary files', () => {
expect(shouldIgnore('assets/logo.png', [])).toBe(true)
})
it('should ignore minified files', () => {
expect(shouldIgnore('dist/bundle.min.js', [])).toBe(true)
})
})
describe('detectLanguage', () => {
it('should detect TypeScript', () => {
expect(detectLanguage('src/index.ts')).toBe('typescript')
})
it('should detect JavaScript', () => {
expect(detectLanguage('src/index.js')).toBe('javascript')
})
it('should detect Python', () => {
expect(detectLanguage('main.py')).toBe('python')
})
it('should return unknown for unrecognized extensions', () => {
expect(detectLanguage('file.xyz')).toBe('unknown')
})
})
})