diff --git a/graphify/detect.py b/graphify/detect.py index e9dc701f0..d30b4918b 100644 --- a/graphify/detect.py +++ b/graphify/detect.py @@ -18,7 +18,7 @@ class FileType(str, Enum): _MANIFEST_PATH = "graphify-out/manifest.json" -CODE_EXTENSIONS = {'.py', '.ts', '.js', '.jsx', '.tsx', '.go', '.rs', '.java', '.cpp', '.cc', '.cxx', '.c', '.h', '.hpp', '.rb', '.swift', '.kt', '.kts', '.cs', '.scala', '.php', '.lua', '.toc', '.zig', '.ps1', '.ex', '.exs', '.m', '.mm', '.jl'} +CODE_EXTENSIONS = {'.py', '.ts', '.js', '.jsx', '.tsx', '.go', '.rs', '.java', '.cpp', '.cc', '.cxx', '.c', '.h', '.hpp', '.rb', '.swift', '.kt', '.kts', '.cs', '.scala', '.php', '.lua', '.toc', '.zig', '.ps1', '.ex', '.exs', '.m', '.mm', '.jl', '.gd'} DOC_EXTENSIONS = {'.md', '.txt', '.rst'} PAPER_EXTENSIONS = {'.pdf'} IMAGE_EXTENSIONS = {'.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg'} diff --git a/graphify/extract.py b/graphify/extract.py index 65e62c646..1ddc36245 100644 --- a/graphify/extract.py +++ b/graphify/extract.py @@ -2677,6 +2677,7 @@ def collect_files(target: Path, *, follow_symlinks: bool = False) -> list[Path]: ".rb", ".cs", ".kt", ".kts", ".scala", ".php", ".swift", ".lua", ".toc", ".zig", ".ps1", ".m", ".mm", + ".gd", } if not follow_symlinks: results: list[Path] = [] diff --git a/tests/test_detect.py b/tests/test_detect.py index ed43fea2b..fb6c85904 100644 --- a/tests/test_detect.py +++ b/tests/test_detect.py @@ -9,6 +9,11 @@ def test_classify_python(): def test_classify_typescript(): assert classify_file(Path("bar.ts")) == FileType.CODE +def test_classify_godot_gd(): + # GDScript files (.gd) are Godot engine scripts and should be treated as code + assert classify_file(Path("Player.gd")) == FileType.CODE + assert classify_file(Path("scenes/Enemy.gd")) == FileType.CODE + def test_classify_markdown(): assert classify_file(Path("README.md")) == FileType.DOCUMENT diff --git a/tests/test_extract.py b/tests/test_extract.py index 3d5b9f530..9e22285b3 100644 --- a/tests/test_extract.py +++ b/tests/test_extract.py @@ -62,7 +62,7 @@ def test_collect_files_from_dir(): ".java", ".c", ".cpp", ".cc", ".cxx", ".rb", ".cs", ".kt", ".kts", ".scala", ".php", ".h", ".hpp", ".swift", ".lua", ".toc", ".zig", ".ps1", ".ex", ".exs", - ".m", ".mm"} + ".m", ".mm", ".gd"} assert all(f.suffix in supported for f in files) assert len(files) > 0 @@ -73,6 +73,15 @@ def test_collect_files_skips_hidden(): assert not any(part.startswith(".") for part in f.parts) +def test_collect_files_picks_up_godot_gd(tmp_path): + # Regression test for #535 - Godot .gd script files were not being + # picked up by collect_files() after v0.50.0 upgrade. + gd_file = tmp_path / "Player.gd" + gd_file.write_text("extends Node\n\nfunc _ready():\n pass\n") + files = collect_files(tmp_path) + assert gd_file in files + + def test_collect_files_follows_symlinked_directory(tmp_path): real_dir = tmp_path / "real_src" real_dir.mkdir()