[Feat] Add per-task context folder file watching via fs.watch#156
Merged
[Feat] Add per-task context folder file watching via fs.watch#156
Conversation
Contributor
|
Hi @samzong, DetailsInstructions for interacting with me using comments are available here. |
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
Add live file watching for per-task context folders. When users add context folders to a task, file changes (create/modify/delete) are detected via
fs.watchand the file list auto-refreshes — no manual re-add needed.Type of change
[Feat]new featureWhy is this needed?
Context folder file lists were static — only refreshed on manual actions like re-adding the folder. Users had no way to see newly created files without closing and re-opening the folder. This makes the context folder feature feel live: create or delete a file and the count updates within ~1 second.
What changed?
file-watcher.tsmodule in main process:fs.watch({ recursive: true })manager with 500ms debounce, max 10 watchers per task, silent error handling (EPERM/ENOENT), initial synthetic event suppression, and full cleanup on app quit viaunwatchAll()context-handlers.ts:context:watch-folderandcontext:unwatch-folderwatchContextFolder,unwatchContextFolder,onContextFilesChangedrefreshIdRef) prevents stale async IPC results from overwriting fresh onesArchitecture impact
context:files-changedflows main → renderer viasendToWindow(reuses existingwindow-utils.tsutility)docs/architecture-invariants.md: none — context folders are client-only state, not persisted to DB, no message persistence paths affectedLinked issues
N/A
Validation
pnpm lintpnpm testpnpm buildCommands, screenshots, or notes:
Screenshots or recordings
N/A — file count label is a plain text span next to existing folder pills, no layout or design-system changes.
Release note
NONE.Checklist
[Feat],[Fix],[UI],[Docs],[Refactor],[Build], or[Chore]