feat: Add comprehensive Godot file type support

Complete support for all Godot file types:
- GDScript (.gd) - Regex-based parser for Godot-specific syntax
- Godot Scenes (.tscn) - Node hierarchy and script attachments
- Godot Resources (.tres) - Properties and dependencies
- Godot Shaders (.gdshader) - Uniforms and shader functions

Implementation details:
- Added 4 new analyzer methods to CodeAnalyzer class
  - _analyze_gdscript(): Functions, signals, @export vars, class_name
  - _analyze_godot_scene(): Node hierarchy, scripts, resources
  - _analyze_godot_resource(): Resource type, properties, script refs
  - _analyze_godot_shader(): Shader type, uniforms, varyings, functions

- Updated dependency_analyzer.py
  - Added _extract_godot_resources() for ext_resource and preload()
  - Fixed DependencyInfo calls (removed invalid 'alias' parameter)

- Updated codebase_scraper.py
  - Added Godot file extensions to LANGUAGE_EXTENSIONS
  - Extended content filter to accept Godot-specific keys
    (nodes, properties, uniforms, signals, exports)

Tested on Cosmic Ideler Godot project:
- 443/452 files successfully analyzed (98%)
- 265 GDScript, 118 .tscn, 38 .tres, 9 .gdshader, 13 .cs

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-02-02 21:36:56 +03:00
parent 583a774b00
commit b252f43d0e
3 changed files with 340 additions and 3 deletions

View File

@@ -69,6 +69,9 @@ LANGUAGE_EXTENSIONS = {
".c": "C",
".cs": "C#",
".gd": "GDScript", # Godot scripting language
".tscn": "GodotScene", # Godot scene files
".tres": "GodotResource", # Godot resource files
".gdshader": "GodotShader", # Godot shader files
".go": "Go",
".rs": "Rust",
".java": "Java",
@@ -842,7 +845,18 @@ def analyze_codebase(
analysis = analyzer.analyze_file(str(file_path), content, language)
# Only include files with actual analysis results
if analysis and (analysis.get("classes") or analysis.get("functions")):
# Check for any meaningful content (classes, functions, nodes, properties, etc.)
has_content = (
analysis.get("classes")
or analysis.get("functions")
or analysis.get("nodes") # Godot scenes
or analysis.get("properties") # Godot resources
or analysis.get("uniforms") # Godot shaders
or analysis.get("signals") # GDScript signals
or analysis.get("exports") # GDScript exports
)
if analysis and has_content:
results["files"].append(
{
"file": str(file_path.relative_to(directory)),