feat(parser): detect class-name expressions, parse .tres, resolve autoload singletons#21
Merged
Merged
Conversation
Read the `[autoload]` section of `project.godot` at analysis start and
register each identifier in the symbol table. The class-ref pipeline
landed in the previous commit then resolves `TurnManager.advance()`,
`EventBus.emit_signal(...)`, and any other autoload-prefixed member
access to its backing script — so an existing rule like
`forbidden: { from: scripts/skills/, to: scripts/autoload/ }` fires
without any auxiliary tooling.
Both `*` (enabled singleton) and bare entries are parsed; only the
`[autoload]` section is read so look-alike lines under other sections
don't leak through. References inside string literals or comments are
already filtered by the class-ref sanitizer; added explicit regression
tests covering both.
LeTuR
force-pushed
the
claude/detect-all-class-names-H26yQ
branch
from
April 29, 2026 14:41
8859f59 to
429ee35
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the rule-coverage gap where
.gdcruiser.jsonrules only sawextends,preload(), andload(). Three S-tier detections so architectural rules natively cover everything that previously needed a separate pre-commit hook.Class-name expressions in GDScript
var x: Foo,func f(c: Foo) -> FooArray[Foo],Dictionary[String, Foo]obj is Foo,obj as FooFoo.method(),Foo.CONSTRefs are resolved against the project symbol table; built-ins and unresolved identifiers are dropped to keep the graph clean. New
CLASS_REFdependency type plus an expanded built-ins list (~250 entries)..tresresource parsingscript_class="..."from the[gd_resource]header registers the resource in the symbol table.[ext_resource path="res://..."]is captured — scripts becomeSCENE_SCRIPTedges, other resource refs become a newRESOURCE_REFedge — so rules now cover the data layer.*.tres; analyzer parses them after.tscn.Autoload singletons (
project.godot)[autoload]section and registers each identifier in the symbol table before class-ref resolution runs.TurnManager.advance(),EventBus.emit_signal(...), etc. then resolve via the sameMEMBER_ACCESSpattern as any other class reference.*Identifier="*res://..."(enabled singleton) and bare entries are parsed; section-scoped so look-alike lines under other sections are ignored.Ancillary
uses/resourceedge labels..tressection, and autoload section.Test plan
uv run pytest— 140 tests pass (39 new)uv run ruff check .cleanuv run ruff format --check .cleanuv run gdcruiser tests/fixtures --no-cyclesshows newclass_refedges (e.g.enemy.gd → player.gdfromvar target: Player) andheal_skill.tresin the graphuv run gdcruiser tests/fixtures/autoload_project --no-cyclesresolvesTurnManager.advance()andEventBus.something_happenedto their backing scripts; in-string and in-comment references absentGenerated by Claude Code