Watch Mode
Real-time documentation updates as you code
PRO FEATUREWatch Mode is the ultimate productivity booster for developers who value up-to-date documentation. CodeContext monitors your code changes in real-time and automatically updates your documentation as you work. No more context switching, no more forgetting to update docs.
Watch Mode Benefits
Real-Time Updates
Docs update as you save files
Zero Friction
No manual commands needed
Smart Detection
Only updates what changed
How Watch Mode Works
Start Watch Mode
Run CodeContext in watch mode to begin monitoring:
$ codecontext update --watch
File Monitoring
CodeContext watches your project files for changes, using efficient file system watchers that don't impact performance.
Smart Debouncing
Changes are intelligently batched to avoid excessive updates. Waits for you to finish typing before processing.
Automatic Updates
Documentation is regenerated and saved automatically. You'll see a notification when updates complete.
Watch Mode in Action
Watch Mode Configuration
Customize watch mode behavior to match your workflow:
{ "watch": { "enabled": true, "debounce": 2000, // Wait 2 seconds after last change "paths": [ // Directories to watch "src/**", "lib/**", "api/**" ], "ignore": [ // Patterns to ignore "node_modules/**", "dist/**", "*.test.{js,ts}", "*.spec.{js,ts}", "**/__tests__/**", ".git/**" ], "fileTypes": [ // File extensions to watch ".js", ".jsx", ".ts", ".tsx", ".py", ".java", ".go", ".rs" ], "updateTypes": { // What to update "readme": true, "changelog": true, "api": true }, "notifications": { "success": true, "errors": true, "sound": false } } }
Performance Optimization
Efficient Watching
- Uses native file system events
- Minimal CPU and memory usage
- Intelligent file filtering
- Batches multiple changes
Smart Updates
- Only updates affected docs
- Caches unchanged content
- Incremental processing
- Parallel documentation generation
Advanced Watch Mode Features
Custom Triggers
Define custom events that trigger documentation updates:
watch.triggers: ["save", "test-pass", "commit"]
Selective Updates
Update only specific documentation based on file changes:
watch.rules: [{"pattern": "api/**", "update": ["api-docs"]}]
Team Sync
Broadcast updates to team members in real-time:
watch.broadcast: true
IDE Integration
Get notifications directly in your editor:
watch.ide: "vscode" | "intellij" | "sublime"
Perfect For
API Development
Keep API documentation in sync as you develop endpoints:
- • Auto-update endpoint docs
- • Reflect parameter changes
- • Update response examples
- • Track breaking changes
Library Development
Maintain accurate docs while building libraries:
- • Update method signatures
- • Reflect new features
- • Keep examples current
- • Track deprecations
Team Projects
Ensure documentation stays current across teams:
- • Real-time doc updates
- • No forgotten updates
- • Consistent documentation
- • Reduced review burden
Open Source
Keep community docs up-to-date:
- • Auto-update contributor docs
- • Maintain accurate setup guides
- • Update feature lists
- • Track project evolution
Watch Mode Tips
- Use .magicignore: Create a
.magicignore
file for project-specific ignore patterns - Adjust debounce time: Increase for large projects, decrease for quick feedback
- Use focused watching: Only watch directories you're actively working on
- Combine with git hooks: Use watch mode locally, hooks for CI/CD
- Monitor the logs: Check terminal output for any issues or warnings
Troubleshooting
High CPU usage
Increase debounce time or reduce watched paths. Check for recursive symlinks.
Updates not triggering
Check ignore patterns and ensure files are in watched paths. Verify file permissions.
Too many updates
Increase debounce time or use more specific file patterns. Consider selective updates.