Merge pull request #145 from milla-jovovich/fix/room-keyword-path-matching

fix: room detection checks keywords against folder paths
This commit is contained in:
Ben Sigman
2026-04-07 14:08:14 -07:00
committed by GitHub
+3 -2
View File
@@ -311,11 +311,12 @@ def detect_room(filepath: Path, content: str, rooms: list, project_path: Path) -
filename = filepath.stem.lower()
content_lower = content[:2000].lower()
# Priority 1: folder path contains room name
# Priority 1: folder path matches room name or keywords
path_parts = relative.replace("\\", "/").split("/")
for part in path_parts[:-1]: # skip filename itself
for room in rooms:
if room["name"].lower() in part or part in room["name"].lower():
candidates = [room["name"].lower()] + [k.lower() for k in room.get("keywords", [])]
if any(part == c or c in part or part in c for c in candidates):
return room["name"]
# Priority 2: filename matches room name