Refactoroscope includes a real-time watching capability that monitors your codebase for changes and automatically re-analyzes affected files.
The watch feature uses the watchdog
library to monitor file system events in your project directory. When changes are detected, Refactoroscope performs an incremental analysis of the modified files and updates the results in real-time.
To start watching your project directory:
uv run refactoroscope watch .
You can also specify a specific directory to watch:
uv run refactoroscope watch /path/to/your/project
Complexity analysis is enabled by default when watching. To disable it:
uv run refactoroscope watch . --no-complexity
To enable AI-powered suggestions during watching:
uv run refactoroscope watch . --ai
Note that AI analysis is performed only on files that change, not on the entire codebase each time.
The watch command provides a terminal UI that updates in real-time with:
You can configure the watching behavior through the .refactoroscope.yml
configuration file:
watch:
# Debounce delay in seconds to prevent excessive analysis
debounce_delay: 1.0
# Whether to analyze on file creation events
analyze_on_create: true
# Whether to analyze on file modification events
analyze_on_modify: true
# Whether to analyze on file deletion events
analyze_on_delete: true
# Patterns to ignore (in addition to .gitignore)
ignore_patterns:
- "*.log"
- "*.tmp"
- ".DS_Store"