gdharness 0.13.22 → 0.13.23

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
@@ -39000,7 +39000,8 @@ class GodotServer {
39000
39000
  try {
39001
39001
  const answer = asParams(await this.godotBridge.invokeTool("reload_script", { ...args, scriptPath: reloading }));
39002
39002
  const methods = readArray(answer, "methods");
39003
- reloaded = methods ? { methods: methods.map(String) } : { problem: `the editor would not say what ${reloading} has after reloading it` };
39003
+ const before = readArray(answer, "heldBefore");
39004
+ reloaded = methods ? { methods: methods.map(String), ...before ? { heldBefore: before.map(String) } : {} } : { problem: `the editor would not say what ${reloading} has after reloading it` };
39004
39005
  } catch (error) {
39005
39006
  reloaded = { problem: `${reloading} could not be reloaded: ${errorMessage(error)}` };
39006
39007
  }
@@ -39012,6 +39013,7 @@ class GodotServer {
39012
39013
  ok: !busy && unseen.length === 0 && stillGone.length === 0 && checked.unchecked === undefined,
39013
39014
  stillWorking: busy,
39014
39015
  waitedMs: Date.now() - started,
39016
+ heldBeforeReload: reloaded.heldBefore,
39015
39017
  reloadedMethods: reloaded.methods,
39016
39018
  reloadProblem: reloaded.problem,
39017
39019
  unseenByEditor: unseen.length > 0 ? unseen : undefined,
@@ -60,6 +60,11 @@ func reload_script(args: Dictionary) -> Dictionary:
60
60
  if script == null:
61
61
  return {"ok": false, "error": path + " is not a GDScript"}
62
62
 
63
+ # What the copy had before anything touched it, which is the reading that shows the fault rather
64
+ # than the one that mends it. Without it a caller cannot tell a copy that was already current
65
+ # from one this call repaired, and those are different facts about their editor.
66
+ var held: Array[String] = _method_names(script)
67
+
63
68
  # The source is read off disk and put back before reloading, which is the whole of the fix and
64
69
  # is not obvious. `reload` recompiles from the object's own `source_code`, not from the file, so
65
70
  # a script the editor loaded before the change recompiles the text it was holding and comes back
@@ -75,11 +80,15 @@ func reload_script(args: Dictionary) -> Dictionary:
75
80
  if failed != OK:
76
81
  return {"ok": false, "error": "Reloading " + path + " answered error " + str(failed)}
77
82
 
78
- var methods: Array[String] = []
83
+ return {"ok": true, "script": path, "heldBefore": held, "methods": _method_names(script)}
84
+
85
+
86
+ func _method_names(script: GDScript) -> Array[String]:
87
+ var names: Array[String] = []
79
88
  for entry: Dictionary in script.get_script_method_list():
80
- methods.append(str(entry.get("name", "")))
81
- methods.sort()
82
- return {"ok": true, "script": path, "methods": methods}
89
+ names.append(str(entry.get("name", "")))
90
+ names.sort()
91
+ return names
83
92
 
84
93
 
85
94
  func global_classes(_args: Dictionary) -> Dictionary:
package/build/index.js CHANGED
@@ -31752,7 +31752,8 @@ class GodotServer {
31752
31752
  try {
31753
31753
  const answer = asParams(await this.godotBridge.invokeTool("reload_script", { ...args, scriptPath: reloading }));
31754
31754
  const methods = readArray(answer, "methods");
31755
- reloaded = methods ? { methods: methods.map(String) } : { problem: `the editor would not say what ${reloading} has after reloading it` };
31755
+ const before = readArray(answer, "heldBefore");
31756
+ reloaded = methods ? { methods: methods.map(String), ...before ? { heldBefore: before.map(String) } : {} } : { problem: `the editor would not say what ${reloading} has after reloading it` };
31756
31757
  } catch (error) {
31757
31758
  reloaded = { problem: `${reloading} could not be reloaded: ${errorMessage(error)}` };
31758
31759
  }
@@ -31764,6 +31765,7 @@ class GodotServer {
31764
31765
  ok: !busy && unseen.length === 0 && stillGone.length === 0 && checked.unchecked === undefined,
31765
31766
  stillWorking: busy,
31766
31767
  waitedMs: Date.now() - started,
31768
+ heldBeforeReload: reloaded.heldBefore,
31767
31769
  reloadedMethods: reloaded.methods,
31768
31770
  reloadProblem: reloaded.problem,
31769
31771
  unseenByEditor: unseen.length > 0 ? unseen : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "0.13.22",
3
+ "version": "0.13.23",
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",