gdharness 1.1.37 → 1.1.38

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
@@ -17758,7 +17758,7 @@ var init_tool_definitions = __esm(() => {
17758
17758
  },
17759
17759
  {
17760
17760
  name: "script_edit",
17761
- description: "Creates a GDScript file, or adds functions, variables and signals to one. Every declaration written carries a type. Both load what they wrote under the project's own warning settings and answer with parses; the engine's reasons for a refusal come back under engine_messages. create answers with the extends and class_name the engine read, and a script declaring a class_name is put in the project's class list, with registered saying whether it is there. modify makes every addition or none, and answers with the line each one is on in the file written. rename renames a class or a member wherever the engine uses it and writes every file or none. A new name already taken is refused with nothing written, a member's included when a class inheriting it already uses the name in code, as a local or a parameter. changed lists each file with its changed lines as they now read, and leftAlone lists every other whole-word occurrence of the old name with what the tokenizer makes of it (code, string, comment, doc, nodePath, scene, text, or ignored for a file under a .gdignore directory, which is never changed) and, where it is not plain, why: a string that is the old name whole, such as find_children's type or a call's method name, which nothing renames or compiles and which is listed first; a node named like the class; a call on a value whose type the analyser could not tell. A member rename answers under languageServer how many requests it made and how long they took. A comment or a line of a text file with nothing more to say is given under leftAloneInProse by file and line instead, and code that is certainly another symbol of the same name, a bare name in a file where nothing inherits the member or one the language server resolved to another declaration, under leftAloneOtherSymbols by file, why and line. Read both before calling the rename done; nothing in them was changed. Afterwards an open editor scans the changed files and reloads every changed script, which is also the compile check, and its answer comes back under editor; with no editor the class cache is rebuilt and the changed scripts are compiled in a fresh engine, under classCache and compiled. written is true once the files are written, and ok is false when what came after the write failed: the files are left changed, and note says so.",
17761
+ description: "Creates a GDScript file, or adds functions, variables and signals to one. Every declaration written carries a type. Both load what they wrote under the project's own warning settings and answer with parses; the engine's reasons for a refusal come back under engine_messages. create answers with the extends and class_name the engine read, and a script declaring a class_name is put in the project's class list, with registered saying whether it is there. modify makes every addition or none, and answers with the line each one is on in the file written. rename renames a class or a member wherever the engine uses it and writes every file or none. A new name already taken is refused with nothing written, a member's included when a class inheriting it already uses the name in code, as a local or a parameter. changed lists each file with its changed lines as they now read, and leftAlone lists every other whole-word occurrence of the old name with what the tokenizer makes of it (code, string, comment, doc, nodePath, scene, text, or ignored for a file under a .gdignore directory, which is never changed) and, where it is not plain, why: a string that is the old name whole, such as find_children's type or a call's method name, which nothing renames or compiles and which is listed first; a node named like the class; a call on a value whose type the analyser could not tell. A member rename answers under languageServer how many requests it made and how long they took. A comment, documentation line, string or text file line with nothing more to say is given under leftAloneInProse by file, kind and line instead, and code that is certainly another symbol of the same name, a bare name in a file where nothing inherits the member or one the language server resolved to another declaration, under leftAloneOtherSymbols as each why with the files and lines it covers. summary.leftAlone counts each of the three lists beside the total. Read both before calling the rename done; nothing in them was changed. Afterwards an open editor scans the changed files and reloads every changed script, which is also the compile check, and its answer comes back under editor; with no editor the class cache is rebuilt and the changed scripts are compiled in a fresh engine, under classCache and compiled. written is true once the files are written, and ok is false when what came after the write failed: the files are left changed, and note says so.",
17762
17762
  parameters: {
17763
17763
  projectPath: PROJECT_PATH,
17764
17764
  scriptPath: SCRIPT_PATH,
@@ -40807,6 +40807,7 @@ async function renameSymbol(request, services) {
40807
40807
  }, plan);
40808
40808
  }
40809
40809
  plan = mentionIgnored(plan, ignoredTexts(projectPath), symbol, moveTo === null ? null : declaringPath);
40810
+ const left = leftAloneReport(plan.mentions);
40810
40811
  const rewrites = rewritesOf(plan, texts, moveTo === null || request.newScriptPath === null ? null : { from: declaringPath, to: moveTo, absoluteTo: request.newScriptPath });
40811
40812
  const graph = new ClassGraph(scripts, declared);
40812
40813
  const rank = (path) => (declaringFiles.includes(path) ? 0 : 1000) + graph.ancestors(`${path}#`).length;
@@ -40823,8 +40824,8 @@ async function renameSymbol(request, services) {
40823
40824
  ...overrides.length > 0 ? { overridesRenamed: overrides } : {},
40824
40825
  ...moveTo === null ? {} : { moved: { from: declaringPath, to: moveTo } },
40825
40826
  changed: changedReport(plan.edits, rewrites),
40826
- ...leftAloneReport(plan.mentions),
40827
- summary: summaryOf(plan.edits, plan.mentions, rewrites)
40827
+ ...left.lists,
40828
+ summary: summaryOf(plan.edits, plan.mentions, rewrites, left.counts)
40828
40829
  }
40829
40830
  };
40830
40831
  }
@@ -40923,36 +40924,48 @@ function leftAloneReport(mentions) {
40923
40924
  const full = [];
40924
40925
  const prose = new Map;
40925
40926
  const others = new Map;
40926
- const add = (group, line) => {
40927
- if (!group.lines.includes(line)) {
40928
- group.lines.push(line);
40927
+ const counts = { quoted: 0, inProse: 0, otherSymbols: 0 };
40928
+ const add = (lines, line) => {
40929
+ if (!lines.includes(line)) {
40930
+ lines.push(line);
40929
40931
  }
40930
40932
  };
40931
40933
  for (const mention of mentions) {
40932
- if ((mention.kind === "comment" || mention.kind === "text") && mention.why === undefined) {
40934
+ if (PROSE_KINDS.has(mention.kind) && mention.why === undefined) {
40933
40935
  const key = `${mention.file}
40934
40936
  ${mention.kind}`;
40935
40937
  const group = prose.get(key) ?? { file: mention.file, kind: mention.kind, lines: [] };
40936
- add(group, mention.line);
40938
+ add(group.lines, mention.line);
40937
40939
  prose.set(key, group);
40940
+ counts.inProse += 1;
40938
40941
  } else if (mention.kind === "code" && (mention.why === NOT_INHERITED || mention.why === RESOLVED_ELSEWHERE)) {
40939
- const key = `${mention.file}
40940
- ${mention.why}`;
40941
- const group = others.get(key) ?? { file: mention.file, why: mention.why, lines: [] };
40942
- add(group, mention.line);
40943
- others.set(key, group);
40942
+ const files = others.get(mention.why) ?? new Map;
40943
+ const lines = files.get(mention.file) ?? [];
40944
+ add(lines, mention.line);
40945
+ files.set(mention.file, lines);
40946
+ others.set(mention.why, files);
40947
+ counts.otherSymbols += 1;
40944
40948
  } else {
40945
40949
  full.push(mention);
40950
+ counts.quoted += 1;
40946
40951
  }
40947
40952
  }
40948
40953
  const loudFirst = (mention) => mention.kind === "string" && mention.why !== undefined ? 0 : 1;
40949
40954
  return {
40950
- leftAlone: full.sort((a, b) => loudFirst(a) - loudFirst(b)),
40951
- ...prose.size > 0 ? { leftAloneInProse: [...prose.values()] } : {},
40952
- ...others.size > 0 ? { leftAloneOtherSymbols: [...others.values()] } : {}
40955
+ lists: {
40956
+ leftAlone: full.sort((a, b) => loudFirst(a) - loudFirst(b)),
40957
+ ...prose.size > 0 ? { leftAloneInProse: [...prose.values()] } : {},
40958
+ ...others.size > 0 ? {
40959
+ leftAloneOtherSymbols: [...others.entries()].map(([why, files]) => ({
40960
+ why,
40961
+ files: [...files.entries()].map(([file, lines]) => ({ file, lines }))
40962
+ }))
40963
+ } : {}
40964
+ },
40965
+ counts
40953
40966
  };
40954
40967
  }
40955
- function summaryOf(edits, mentions, rewrites) {
40968
+ function summaryOf(edits, mentions, rewrites, left) {
40956
40969
  const count = (values) => {
40957
40970
  const counted = {};
40958
40971
  for (const value of values) {
@@ -40964,11 +40977,11 @@ function summaryOf(edits, mentions, rewrites) {
40964
40977
  filesChanged: rewrites.length,
40965
40978
  edits: edits.length,
40966
40979
  editsByKind: count(edits.map((edit) => edit.kind)),
40967
- leftAlone: mentions.length,
40980
+ leftAlone: { total: mentions.length, ...left },
40968
40981
  leftAloneByKind: count(mentions.map((mention) => mention.kind))
40969
40982
  };
40970
40983
  }
40971
- var WHAT;
40984
+ var WHAT, PROSE_KINDS;
40972
40985
  var init_rename_symbol = __esm(() => {
40973
40986
  init_gdscript_source();
40974
40987
  init_lsp_client();
@@ -40984,6 +40997,7 @@ var init_rename_symbol = __esm(() => {
40984
40997
  class: "inner class",
40985
40998
  enumValue: "enum value"
40986
40999
  };
41000
+ PROSE_KINDS = new Set(["comment", "doc", "string", "text"]);
40987
41001
  });
40988
41002
 
40989
41003
  // src/restart-note.ts
@@ -47815,9 +47829,9 @@ To rename a class or a member across the project, use \`script_edit rename\` rat
47815
47829
  replacement: it changes the uses the engine resolves, doc links and what scenes record, and lists
47816
47830
  every other occurrence of the word for you to read: a string that is the name whole, such as a
47817
47831
  \`find_children\` type, first under \`leftAlone\` since nothing compiles it, a file under a
47818
- \`.gdignore\` directory there too, a word in a comment or a text file by line under
47819
- \`leftAloneInProse\`, and a local or another class's member of the same name by line under
47820
- \`leftAloneOtherSymbols\`. Pass \`preview\` first on a large rename. If the answer has \`ok: false\`
47832
+ \`.gdignore\` directory there too, a word in a comment, a doc line, a string or a text file by
47833
+ line under \`leftAloneInProse\`, and a local or another class's member of the same name by line
47834
+ under \`leftAloneOtherSymbols\`. Pass \`preview\` first on a large rename. If the answer has \`ok: false\`
47821
47835
  beside \`written: true\`, the files were changed and a script did not compile afterwards.
47822
47836
 
47823
47837
  Editing a file while a game is running does not change the running game. \`auto_reload\` is an
package/build/index.js CHANGED
@@ -31780,6 +31780,7 @@ async function renameSymbol(request, services) {
31780
31780
  }, plan);
31781
31781
  }
31782
31782
  plan = mentionIgnored(plan, ignoredTexts(projectPath), symbol, moveTo === null ? null : declaringPath);
31783
+ const left = leftAloneReport(plan.mentions);
31783
31784
  const rewrites = rewritesOf(plan, texts, moveTo === null || request.newScriptPath === null ? null : { from: declaringPath, to: moveTo, absoluteTo: request.newScriptPath });
31784
31785
  const graph = new ClassGraph(scripts, declared);
31785
31786
  const rank = (path) => (declaringFiles.includes(path) ? 0 : 1000) + graph.ancestors(`${path}#`).length;
@@ -31796,8 +31797,8 @@ async function renameSymbol(request, services) {
31796
31797
  ...overrides.length > 0 ? { overridesRenamed: overrides } : {},
31797
31798
  ...moveTo === null ? {} : { moved: { from: declaringPath, to: moveTo } },
31798
31799
  changed: changedReport(plan.edits, rewrites),
31799
- ...leftAloneReport(plan.mentions),
31800
- summary: summaryOf(plan.edits, plan.mentions, rewrites)
31800
+ ...left.lists,
31801
+ summary: summaryOf(plan.edits, plan.mentions, rewrites, left.counts)
31801
31802
  }
31802
31803
  };
31803
31804
  }
@@ -31896,36 +31897,49 @@ function leftAloneReport(mentions) {
31896
31897
  const full = [];
31897
31898
  const prose = new Map;
31898
31899
  const others = new Map;
31899
- const add = (group, line) => {
31900
- if (!group.lines.includes(line)) {
31901
- group.lines.push(line);
31900
+ const counts = { quoted: 0, inProse: 0, otherSymbols: 0 };
31901
+ const add = (lines, line) => {
31902
+ if (!lines.includes(line)) {
31903
+ lines.push(line);
31902
31904
  }
31903
31905
  };
31904
31906
  for (const mention of mentions) {
31905
- if ((mention.kind === "comment" || mention.kind === "text") && mention.why === undefined) {
31907
+ if (PROSE_KINDS.has(mention.kind) && mention.why === undefined) {
31906
31908
  const key = `${mention.file}
31907
31909
  ${mention.kind}`;
31908
31910
  const group = prose.get(key) ?? { file: mention.file, kind: mention.kind, lines: [] };
31909
- add(group, mention.line);
31911
+ add(group.lines, mention.line);
31910
31912
  prose.set(key, group);
31913
+ counts.inProse += 1;
31911
31914
  } else if (mention.kind === "code" && (mention.why === NOT_INHERITED || mention.why === RESOLVED_ELSEWHERE)) {
31912
- const key = `${mention.file}
31913
- ${mention.why}`;
31914
- const group = others.get(key) ?? { file: mention.file, why: mention.why, lines: [] };
31915
- add(group, mention.line);
31916
- others.set(key, group);
31915
+ const files = others.get(mention.why) ?? new Map;
31916
+ const lines = files.get(mention.file) ?? [];
31917
+ add(lines, mention.line);
31918
+ files.set(mention.file, lines);
31919
+ others.set(mention.why, files);
31920
+ counts.otherSymbols += 1;
31917
31921
  } else {
31918
31922
  full.push(mention);
31923
+ counts.quoted += 1;
31919
31924
  }
31920
31925
  }
31921
31926
  const loudFirst = (mention) => mention.kind === "string" && mention.why !== undefined ? 0 : 1;
31922
31927
  return {
31923
- leftAlone: full.sort((a, b) => loudFirst(a) - loudFirst(b)),
31924
- ...prose.size > 0 ? { leftAloneInProse: [...prose.values()] } : {},
31925
- ...others.size > 0 ? { leftAloneOtherSymbols: [...others.values()] } : {}
31928
+ lists: {
31929
+ leftAlone: full.sort((a, b) => loudFirst(a) - loudFirst(b)),
31930
+ ...prose.size > 0 ? { leftAloneInProse: [...prose.values()] } : {},
31931
+ ...others.size > 0 ? {
31932
+ leftAloneOtherSymbols: [...others.entries()].map(([why, files]) => ({
31933
+ why,
31934
+ files: [...files.entries()].map(([file, lines]) => ({ file, lines }))
31935
+ }))
31936
+ } : {}
31937
+ },
31938
+ counts
31926
31939
  };
31927
31940
  }
31928
- function summaryOf(edits, mentions, rewrites) {
31941
+ var PROSE_KINDS = new Set(["comment", "doc", "string", "text"]);
31942
+ function summaryOf(edits, mentions, rewrites, left) {
31929
31943
  const count = (values) => {
31930
31944
  const counted = {};
31931
31945
  for (const value of values) {
@@ -31937,7 +31951,7 @@ function summaryOf(edits, mentions, rewrites) {
31937
31951
  filesChanged: rewrites.length,
31938
31952
  edits: edits.length,
31939
31953
  editsByKind: count(edits.map((edit) => edit.kind)),
31940
- leftAlone: mentions.length,
31954
+ leftAlone: { total: mentions.length, ...left },
31941
31955
  leftAloneByKind: count(mentions.map((mention) => mention.kind))
31942
31956
  };
31943
31957
  }
@@ -33111,7 +33125,7 @@ var TOOL_SPECS = [
33111
33125
  },
33112
33126
  {
33113
33127
  name: "script_edit",
33114
- description: "Creates a GDScript file, or adds functions, variables and signals to one. Every declaration written carries a type. Both load what they wrote under the project's own warning settings and answer with parses; the engine's reasons for a refusal come back under engine_messages. create answers with the extends and class_name the engine read, and a script declaring a class_name is put in the project's class list, with registered saying whether it is there. modify makes every addition or none, and answers with the line each one is on in the file written. rename renames a class or a member wherever the engine uses it and writes every file or none. A new name already taken is refused with nothing written, a member's included when a class inheriting it already uses the name in code, as a local or a parameter. changed lists each file with its changed lines as they now read, and leftAlone lists every other whole-word occurrence of the old name with what the tokenizer makes of it (code, string, comment, doc, nodePath, scene, text, or ignored for a file under a .gdignore directory, which is never changed) and, where it is not plain, why: a string that is the old name whole, such as find_children's type or a call's method name, which nothing renames or compiles and which is listed first; a node named like the class; a call on a value whose type the analyser could not tell. A member rename answers under languageServer how many requests it made and how long they took. A comment or a line of a text file with nothing more to say is given under leftAloneInProse by file and line instead, and code that is certainly another symbol of the same name, a bare name in a file where nothing inherits the member or one the language server resolved to another declaration, under leftAloneOtherSymbols by file, why and line. Read both before calling the rename done; nothing in them was changed. Afterwards an open editor scans the changed files and reloads every changed script, which is also the compile check, and its answer comes back under editor; with no editor the class cache is rebuilt and the changed scripts are compiled in a fresh engine, under classCache and compiled. written is true once the files are written, and ok is false when what came after the write failed: the files are left changed, and note says so.",
33128
+ description: "Creates a GDScript file, or adds functions, variables and signals to one. Every declaration written carries a type. Both load what they wrote under the project's own warning settings and answer with parses; the engine's reasons for a refusal come back under engine_messages. create answers with the extends and class_name the engine read, and a script declaring a class_name is put in the project's class list, with registered saying whether it is there. modify makes every addition or none, and answers with the line each one is on in the file written. rename renames a class or a member wherever the engine uses it and writes every file or none. A new name already taken is refused with nothing written, a member's included when a class inheriting it already uses the name in code, as a local or a parameter. changed lists each file with its changed lines as they now read, and leftAlone lists every other whole-word occurrence of the old name with what the tokenizer makes of it (code, string, comment, doc, nodePath, scene, text, or ignored for a file under a .gdignore directory, which is never changed) and, where it is not plain, why: a string that is the old name whole, such as find_children's type or a call's method name, which nothing renames or compiles and which is listed first; a node named like the class; a call on a value whose type the analyser could not tell. A member rename answers under languageServer how many requests it made and how long they took. A comment, documentation line, string or text file line with nothing more to say is given under leftAloneInProse by file, kind and line instead, and code that is certainly another symbol of the same name, a bare name in a file where nothing inherits the member or one the language server resolved to another declaration, under leftAloneOtherSymbols as each why with the files and lines it covers. summary.leftAlone counts each of the three lists beside the total. Read both before calling the rename done; nothing in them was changed. Afterwards an open editor scans the changed files and reloads every changed script, which is also the compile check, and its answer comes back under editor; with no editor the class cache is rebuilt and the changed scripts are compiled in a fresh engine, under classCache and compiled. written is true once the files are written, and ok is false when what came after the write failed: the files are left changed, and note says so.",
33115
33129
  parameters: {
33116
33130
  projectPath: PROJECT_PATH,
33117
33131
  scriptPath: SCRIPT_PATH,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.1.37",
3
+ "version": "1.1.38",
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",