feat: extend file watcher to support all indexable file types beyond markdown

This commit is contained in:
Bruno Charest 2026-03-24 16:38:35 -04:00
parent c5e395005f
commit d020264ba3

View File

@ -7,11 +7,11 @@ from typing import Callable, Dict, List, Optional
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
from watchdog.events import FileSystemEventHandler
from backend.indexer import SUPPORTED_EXTENSIONS
logger = logging.getLogger("obsigate.watcher")
# Extensions de fichiers surveillées
WATCHED_EXTENSIONS = {'.md', '.markdown'}
IGNORED_DIRS = {'.obsidian', '.trash', '.git', '__pycache__', 'node_modules'}
@ -37,7 +37,9 @@ class VaultEventHandler(FileSystemEventHandler):
p = Path(path)
if any(part in IGNORED_DIRS for part in p.parts):
return False
return p.suffix.lower() in WATCHED_EXTENSIONS
suffix = p.suffix.lower()
basename_lower = p.name.lower()
return suffix in SUPPORTED_EXTENSIONS or basename_lower in ("dockerfile", "makefile", "cmakelists.txt")
def _enqueue(self, event_type: str, src: str, dest: str = None):
"""Thread-safe : envoyer l'événement vers l'event loop asyncio."""