Implement selective file watching to reduce watchers when --skip-projects or nested .claude exist#37
Open
Implement selective file watching to reduce watchers when --skip-projects or nested .claude exist#37
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #32
…ects or nested .claude directories exist - Add setupSelectiveWatchers() function to create individual watchers for .claude subdirectories - Skip watching projects folder when --skip-projects option is enabled - Skip watching nested .claude directories to avoid recursive watching issues - Add shouldIgnoreFileChange() function for runtime filtering of file change events - Maintain same filtering logic as used in archiving process for consistency - Add comprehensive test suite for validation: * test-watch-filtering.js - Tests file change filtering logic * test-watcher-setup.js - Tests selective watcher setup * test-watch-selective-monitoring.sh - Manual testing helper This significantly reduces the number of filesystem watchers when: 1. --skip-projects is used (excludes entire projects directory) 2. Nested .claude directories exist (prevents recursive monitoring) Fixes issue where watch mode would monitor all files including those excluded from backups. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements selective file watching in watch mode to reduce the number of filesystem watchers when
--skip-projectsis enabled or nested.claudedirectories exist, addressing issue #32.Problem
Previously, watch mode would monitor ALL files and subdirectories recursively in the
~/.claudedirectory, including:--skip-projectswas used).claudedirectories (which cause recursive monitoring issues)This resulted in unnecessary filesystem watchers being created for files that were excluded from backups.
Solution
--skip-projectsis enabled or selective filtering is needed, create individual watchers for each subdirectory instead of using recursive watching on the parentprojectsfolder when--skip-projectsis enabled.claudedirectories to avoid recursive monitoring issuesshouldIgnoreFileChange()function to filter file change events using the same logic as the archiving processKey Changes
setupSelectiveWatchers()function: Creates individual watchers for each subdirectory in~/.claudewith selective filteringshouldIgnoreFileChange()function: Filters file change events at runtime using path analysisTesting
examples/test-watch-filtering.js- validates file filtering logicexamples/test-watcher-setup.js- tests selective watcher setupexamples/test-watch-selective-monitoring.sh- helper for manual testingBenefits
--skip-projectsis used.claudedirectory edge casesImpact
Fixes #32
🤖 Generated with Claude Code