gdharness 1.3.23 → 1.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cli.js CHANGED
@@ -9786,6 +9786,17 @@ function scriptsNaming(projectPath, classes) {
9786
9786
  });
9787
9787
  return naming.sort((a, b) => a.script.localeCompare(b.script));
9788
9788
  }
9789
+ function scriptsDeclaring(projectPath, classes) {
9790
+ const named = new Set(classes);
9791
+ const declaring = [];
9792
+ eachScript(projectPath, (script, source) => {
9793
+ const declares = DECLARATION.exec(source)?.[1];
9794
+ if (declares !== undefined && named.has(declares)) {
9795
+ declaring.push({ script, tool: TOOL.test(codeOf(source)) });
9796
+ }
9797
+ });
9798
+ return declaring.sort((a, b) => a.script.localeCompare(b.script));
9799
+ }
9789
9800
  function cachedClasses(projectPath) {
9790
9801
  const cache = join6(projectPath, ".godot", "global_script_class_cache.cfg");
9791
9802
  if (!existsSync4(cache)) {
@@ -55869,6 +55880,11 @@ ${error.text}`;
55869
55880
  });
55870
55881
  }
55871
55882
  async reloadDependents(projectPath, classes) {
55883
+ for (const { script, tool } of scriptsDeclaring(projectPath, classes)) {
55884
+ if (!tool) {
55885
+ await this.reloadOnce(script);
55886
+ }
55887
+ }
55872
55888
  return await this.reloadInEditor(scriptsNaming(projectPath, classes), projectPath);
55873
55889
  }
55874
55890
  async reloadInEditor(scripts, projectPath = "") {
@@ -56,7 +56,15 @@ func reload_script(args: Dictionary) -> Dictionary:
56
56
  if not ResourceLoader.exists(path):
57
57
  return {"ok": false, "error": "No script at " + path}
58
58
 
59
- var loaded: Resource = load(path)
59
+ # The copy the editor holds, when it holds one, and otherwise a load that reads the file, rather
60
+ # than load(): a load recompiles a script whose base has been reloaded from the text it holds,
61
+ # which is the text before the file changed. A rename reloading a base and then its subclass
62
+ # logged "not found in base" for the subclass's old call to the renamed method, a moment before
63
+ # the reload below compiled it clean.
64
+ var cached: Resource = ResourceLoader.get_cached_ref(path)
65
+ var loaded: Resource = (
66
+ cached if cached != null else ResourceLoader.load(path, "", ResourceLoader.CACHE_MODE_IGNORE)
67
+ )
60
68
  var script: GDScript = loaded as GDScript
61
69
  if script == null:
62
70
  return {"ok": false, "error": path + " is not a GDScript"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.3.23",
3
+ "version": "1.3.24",
4
4
  "mcpName": "io.github.Aureliolo/gdharness",
5
5
  "description": "A harness for driving a Godot 4 project from an agent: editor addons, a runtime bridge into the running game, an MCP server in front of them, and a CLI that installs and diagnoses the Godot side.",
6
6
  "type": "module",