Commit ec62e2f
committed
# Fix: Exclude cache files from rules compilation
## Summary
Prevents system files like `.DS_Store`, `.Thumbs.db`, and other cache files from being processed as rule files in the `.roo/rules-{mode-slug}` directories.
## Changes
- Added `shouldIncludeRuleFile()` function to filter out unwanted files during rule compilation
- Modified `readTextFilesFromDirectory()` to apply file filtering before processing
- Added support for 21 common cache file patterns including `.DS_Store`, `.db`, `.bak`, `.log`, etc.
- Updated comment to reflect the new filtering behavior
## Impact
- Fixes issue where macOS `.DS_Store` files were being included in system prompts
- Prevents other cache and temporary files from polluting rule compilation
- Improves system prompt quality and reduces noise
## Additional Notes
**Why we didn't import from existing exclusion patterns:**
The existing `getCacheFilePatterns()` function in `src/services/checkpoints/excludes.ts` contains identical patterns, but we cannot import from it due to architectural constraints:
- The `custom-instructions.ts` file is imported by webview components that run in the browser
- `excludes.ts` has Node.js dependencies (`fs/promises`, `path`) that cannot be bundled for browser environments
- Importing from `excludes.ts` would cause Vite build failures in the webview
This is a necessary architectural trade-off to maintain browser compatibility while solving the cache file inclusion issue.
Resolves: #27281 parent 24eb6e4 commit ec62e2f
1 file changed
+50
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
126 | 130 | | |
127 | 131 | | |
128 | 132 | | |
| |||
133 | 137 | | |
134 | 138 | | |
135 | 139 | | |
136 | | - | |
| 140 | + | |
137 | 141 | | |
138 | 142 | | |
139 | 143 | | |
| |||
297 | 301 | | |
298 | 302 | | |
299 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
0 commit comments