Skip to content

feat(watch): standalone cora watch command with auto-reindex - #496

Merged
ajianaz merged 1 commit into
developfrom
feat/watch-command-436
Aug 5, 2026
Merged

feat(watch): standalone cora watch command with auto-reindex#496
ajianaz merged 1 commit into
developfrom
feat/watch-command-436

Conversation

@ajianaz

@ajianaz ajianaz commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What

Add standalone cora watch command that monitors file changes and auto-reindexes the project.

Why

Currently file watching is embedded inside cora index --watch with a simple 2-second poll loop. Issue #436 requests a proper standalone watcher with configurable debounce, git-only filtering, and glob pattern support — making it usable as a background daemon during active development.

How

  • New module src/commands/watch.rs with run_watch() entry point
  • Poll-based change detection (no new dependency like notify crate needed)
  • Debounce window configurable via --debounce <ms> (default: 500ms)
  • --git-only flag: only process files tracked by git ls-files
  • --filter <glob>: limit to matching paths (e.g. src/**/*.rs)
  • Skips hidden directories (.git, .cora), node_modules, target/
  • Initial full index, then incremental reindex on detected changes
  • Reuses existing index::index_project_with_skip() for consistency

CLI

cora watch [--debounce 500] [--git-only] [--filter 'src/**/*.rs']

Testing

  • cargo test --features tree-sitter — 898 tests, 0 failures
  • cargo clippy --all-targets --features tree-sitter -- -D warnings — 0 warnings
  • cargo fmt -- --check — clean
  • 5 new unit tests: walk_files, detect_changes (empty, source, non-source filter), git-tracked fallback

Related Issues

Closes #436

Checklist

  • Code follows project conventions (CONTRIBUTING.md)
  • Tests added for new functionality
  • No clippy warnings
  • Commit message follows Conventional Commits

Add standalone file-system watcher that auto-reindexes on change:

- `cora watch` command with debounce, --git-only, --filter glob
- Poll-based change detection (no new dependency needed)
- Skips hidden dirs, node_modules, target
- Initial full index then incremental reindex on detected changes
- 5 unit tests covering walk, detect, git-only, glob filter

Closes #436
@ajianaz
ajianaz merged commit bb53578 into develop Aug 5, 2026
13 checks passed
@ajianaz ajianaz mentioned this pull request Aug 5, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement cora watch — background file watcher (Phase 2)

1 participant