@baixfeng/godot-mcp-cli 1.0.11

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.
Files changed (115) hide show
  1. package/README.md +187 -0
  2. package/addons/godot_mcp/command_handler.gd +161 -0
  3. package/addons/godot_mcp/command_handler.gd.uid +1 -0
  4. package/addons/godot_mcp/commands/base_command_processor.gd +221 -0
  5. package/addons/godot_mcp/commands/base_command_processor.gd.uid +1 -0
  6. package/addons/godot_mcp/commands/debugger_commands.gd +221 -0
  7. package/addons/godot_mcp/commands/debugger_commands.gd.uid +1 -0
  8. package/addons/godot_mcp/commands/editor_commands.gd +237 -0
  9. package/addons/godot_mcp/commands/editor_commands.gd.uid +1 -0
  10. package/addons/godot_mcp/commands/editor_script_commands.gd +365 -0
  11. package/addons/godot_mcp/commands/editor_script_commands.gd.uid +1 -0
  12. package/addons/godot_mcp/commands/input_commands.gd +337 -0
  13. package/addons/godot_mcp/commands/input_commands.gd.uid +1 -0
  14. package/addons/godot_mcp/commands/node_commands.gd +222 -0
  15. package/addons/godot_mcp/commands/node_commands.gd.uid +1 -0
  16. package/addons/godot_mcp/commands/project_commands.gd +298 -0
  17. package/addons/godot_mcp/commands/project_commands.gd.uid +1 -0
  18. package/addons/godot_mcp/commands/scene_commands.gd +337 -0
  19. package/addons/godot_mcp/commands/scene_commands.gd.uid +1 -0
  20. package/addons/godot_mcp/commands/script_commands.gd +349 -0
  21. package/addons/godot_mcp/commands/script_commands.gd.uid +1 -0
  22. package/addons/godot_mcp/mcp_asset_commands.gd +153 -0
  23. package/addons/godot_mcp/mcp_asset_commands.gd.uid +1 -0
  24. package/addons/godot_mcp/mcp_debug_output_publisher.gd +1669 -0
  25. package/addons/godot_mcp/mcp_debug_output_publisher.gd.uid +1 -0
  26. package/addons/godot_mcp/mcp_debugger_bridge.gd +1455 -0
  27. package/addons/godot_mcp/mcp_debugger_bridge.gd.uid +1 -0
  28. package/addons/godot_mcp/mcp_enhanced_commands.gd +1083 -0
  29. package/addons/godot_mcp/mcp_enhanced_commands.gd.uid +1 -0
  30. package/addons/godot_mcp/mcp_input_handler.gd +545 -0
  31. package/addons/godot_mcp/mcp_input_handler.gd.uid +1 -0
  32. package/addons/godot_mcp/mcp_runtime_debugger_bridge.gd +464 -0
  33. package/addons/godot_mcp/mcp_runtime_debugger_bridge.gd.uid +1 -0
  34. package/addons/godot_mcp/mcp_script_resource_commands.gd +165 -0
  35. package/addons/godot_mcp/mcp_script_resource_commands.gd.uid +1 -0
  36. package/addons/godot_mcp/mcp_server.gd +260 -0
  37. package/addons/godot_mcp/mcp_server.gd.uid +1 -0
  38. package/addons/godot_mcp/plugin.cfg +7 -0
  39. package/addons/godot_mcp/runtime_debugger.gd +81 -0
  40. package/addons/godot_mcp/runtime_debugger.gd.uid +1 -0
  41. package/addons/godot_mcp/ui/mcp_panel.gd +94 -0
  42. package/addons/godot_mcp/ui/mcp_panel.gd.uid +1 -0
  43. package/addons/godot_mcp/ui/mcp_panel.tscn +96 -0
  44. package/addons/godot_mcp/utils/node_utils.gd +82 -0
  45. package/addons/godot_mcp/utils/node_utils.gd.uid +1 -0
  46. package/addons/godot_mcp/utils/resource_utils.gd +81 -0
  47. package/addons/godot_mcp/utils/resource_utils.gd.uid +1 -0
  48. package/addons/godot_mcp/utils/script_utils.gd +114 -0
  49. package/addons/godot_mcp/utils/script_utils.gd.uid +1 -0
  50. package/addons/godot_mcp/websocket_server.gd +197 -0
  51. package/addons/godot_mcp/websocket_server.gd.uid +1 -0
  52. package/dist/cli.d.ts +2 -0
  53. package/dist/cli.js +561 -0
  54. package/dist/cli.js.map +1 -0
  55. package/dist/index.d.ts +1 -0
  56. package/dist/index.js +156 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/resources/asset_resources.d.ts +29 -0
  59. package/dist/resources/asset_resources.js +145 -0
  60. package/dist/resources/asset_resources.js.map +1 -0
  61. package/dist/resources/debug_resources.d.ts +11 -0
  62. package/dist/resources/debug_resources.js +106 -0
  63. package/dist/resources/debug_resources.js.map +1 -0
  64. package/dist/resources/debugger_resources.d.ts +62 -0
  65. package/dist/resources/debugger_resources.js +201 -0
  66. package/dist/resources/debugger_resources.js.map +1 -0
  67. package/dist/resources/editor_resources.d.ts +47 -0
  68. package/dist/resources/editor_resources.js +155 -0
  69. package/dist/resources/editor_resources.js.map +1 -0
  70. package/dist/resources/project_resources.d.ts +33 -0
  71. package/dist/resources/project_resources.js +137 -0
  72. package/dist/resources/project_resources.js.map +1 -0
  73. package/dist/resources/scene_resources.d.ts +33 -0
  74. package/dist/resources/scene_resources.js +160 -0
  75. package/dist/resources/scene_resources.js.map +1 -0
  76. package/dist/resources/script_resources.d.ts +51 -0
  77. package/dist/resources/script_resources.js +203 -0
  78. package/dist/resources/script_resources.js.map +1 -0
  79. package/dist/tools/asset_tools.d.ts +5 -0
  80. package/dist/tools/asset_tools.js +125 -0
  81. package/dist/tools/asset_tools.js.map +1 -0
  82. package/dist/tools/debugger_tools.d.ts +2 -0
  83. package/dist/tools/debugger_tools.js +342 -0
  84. package/dist/tools/debugger_tools.js.map +1 -0
  85. package/dist/tools/editor_tools.d.ts +2 -0
  86. package/dist/tools/editor_tools.js +165 -0
  87. package/dist/tools/editor_tools.js.map +1 -0
  88. package/dist/tools/enhanced_tools.d.ts +5 -0
  89. package/dist/tools/enhanced_tools.js +706 -0
  90. package/dist/tools/enhanced_tools.js.map +1 -0
  91. package/dist/tools/input_tools.d.ts +2 -0
  92. package/dist/tools/input_tools.js +408 -0
  93. package/dist/tools/input_tools.js.map +1 -0
  94. package/dist/tools/node_tools.d.ts +5 -0
  95. package/dist/tools/node_tools.js +217 -0
  96. package/dist/tools/node_tools.js.map +1 -0
  97. package/dist/tools/project_tools.d.ts +5 -0
  98. package/dist/tools/project_tools.js +162 -0
  99. package/dist/tools/project_tools.js.map +1 -0
  100. package/dist/tools/scene_tools.d.ts +5 -0
  101. package/dist/tools/scene_tools.js +260 -0
  102. package/dist/tools/scene_tools.js.map +1 -0
  103. package/dist/tools/script_resource_tools.d.ts +5 -0
  104. package/dist/tools/script_resource_tools.js +5 -0
  105. package/dist/tools/script_resource_tools.js.map +1 -0
  106. package/dist/tools/script_tools.d.ts +5 -0
  107. package/dist/tools/script_tools.js +154 -0
  108. package/dist/tools/script_tools.js.map +1 -0
  109. package/dist/utils/godot_connection.d.ts +30 -0
  110. package/dist/utils/godot_connection.js +285 -0
  111. package/dist/utils/godot_connection.js.map +1 -0
  112. package/dist/utils/types.d.ts +16 -0
  113. package/dist/utils/types.js +2 -0
  114. package/dist/utils/types.js.map +1 -0
  115. package/package.json +58 -0
@@ -0,0 +1,201 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { getGodotConnection } from '../utils/godot_connection.js';
38
+ /**
39
+ * Resource for accessing current debugger state including breakpoints and execution status
40
+ */
41
+ export var debuggerStateResource = {
42
+ uri: 'godot://debugger/state',
43
+ name: 'Debugger State',
44
+ description: 'Current state of the Godot debugger including breakpoints, sessions, and execution status',
45
+ mimeType: 'application/json',
46
+ load: function () {
47
+ return __awaiter(this, void 0, void 0, function () {
48
+ var godot, result, error_1;
49
+ return __generator(this, function (_a) {
50
+ switch (_a.label) {
51
+ case 0:
52
+ godot = getGodotConnection();
53
+ _a.label = 1;
54
+ case 1:
55
+ _a.trys.push([1, 3, , 4]);
56
+ return [4 /*yield*/, godot.sendCommand('debugger_get_current_state', {})];
57
+ case 2:
58
+ result = _a.sent();
59
+ return [2 /*return*/, {
60
+ text: JSON.stringify(result)
61
+ }];
62
+ case 3:
63
+ error_1 = _a.sent();
64
+ throw new Error("Failed to get debugger state: ".concat(error_1.message));
65
+ case 4: return [2 /*return*/];
66
+ }
67
+ });
68
+ });
69
+ }
70
+ };
71
+ /**
72
+ * Resource for accessing active debugger breakpoints
73
+ */
74
+ export var debuggerBreakpointsResource = {
75
+ uri: 'godot://debugger/breakpoints',
76
+ name: 'Debugger Breakpoints',
77
+ description: 'List of all currently set breakpoints in the debugger',
78
+ mimeType: 'application/json',
79
+ load: function () {
80
+ return __awaiter(this, void 0, void 0, function () {
81
+ var godot, result, error_2;
82
+ return __generator(this, function (_a) {
83
+ switch (_a.label) {
84
+ case 0:
85
+ godot = getGodotConnection();
86
+ _a.label = 1;
87
+ case 1:
88
+ _a.trys.push([1, 3, , 4]);
89
+ return [4 /*yield*/, godot.sendCommand('debugger_get_breakpoints', {})];
90
+ case 2:
91
+ result = _a.sent();
92
+ return [2 /*return*/, {
93
+ text: JSON.stringify(result)
94
+ }];
95
+ case 3:
96
+ error_2 = _a.sent();
97
+ throw new Error("Failed to get debugger breakpoints: ".concat(error_2.message));
98
+ case 4: return [2 /*return*/];
99
+ }
100
+ });
101
+ });
102
+ }
103
+ };
104
+ /**
105
+ * Resource template for accessing debugger call stack information
106
+ */
107
+ export var debuggerCallStackResourceTemplate = {
108
+ uriTemplate: 'godot://debugger/call-stack/{sessionId?}',
109
+ name: 'Debugger Call Stack',
110
+ description: 'Call stack information for a specific debug session (or active session if not specified)',
111
+ mimeType: 'application/json',
112
+ arguments: [
113
+ {
114
+ name: 'sessionId',
115
+ description: 'Optional debug session ID (will use active session if not provided)',
116
+ required: false
117
+ }
118
+ ],
119
+ load: function (_a) {
120
+ return __awaiter(this, arguments, void 0, function (_b) {
121
+ var godot, params, result, error_3;
122
+ var sessionId = _b.sessionId;
123
+ return __generator(this, function (_c) {
124
+ switch (_c.label) {
125
+ case 0:
126
+ godot = getGodotConnection();
127
+ _c.label = 1;
128
+ case 1:
129
+ _c.trys.push([1, 3, , 4]);
130
+ params = sessionId !== undefined ? { session_id: sessionId } : {};
131
+ return [4 /*yield*/, godot.sendCommand('debugger_get_call_stack', params)];
132
+ case 2:
133
+ result = _c.sent();
134
+ return [2 /*return*/, {
135
+ text: JSON.stringify(result)
136
+ }];
137
+ case 3:
138
+ error_3 = _c.sent();
139
+ throw new Error("Failed to get debugger call stack: ".concat(error_3.message));
140
+ case 4: return [2 /*return*/];
141
+ }
142
+ });
143
+ });
144
+ }
145
+ };
146
+ /**
147
+ * Resource template for accessing debugger session information
148
+ */
149
+ export var debuggerSessionResourceTemplate = {
150
+ uriTemplate: 'godot://debugger/session/{sessionId}',
151
+ name: 'Debugger Session',
152
+ description: 'Detailed information about a specific debugger session',
153
+ mimeType: 'application/json',
154
+ arguments: [
155
+ {
156
+ name: 'sessionId',
157
+ description: 'Debug session ID',
158
+ required: true
159
+ }
160
+ ],
161
+ load: function (_a) {
162
+ return __awaiter(this, arguments, void 0, function (_b) {
163
+ var godot, result, sessionData, error_4;
164
+ var sessionId = _b.sessionId;
165
+ return __generator(this, function (_c) {
166
+ switch (_c.label) {
167
+ case 0:
168
+ godot = getGodotConnection();
169
+ _c.label = 1;
170
+ case 1:
171
+ _c.trys.push([1, 3, , 4]);
172
+ return [4 /*yield*/, godot.sendCommand('debugger_get_current_state', {})];
173
+ case 2:
174
+ result = _c.sent();
175
+ // Filter the state to return only the requested session
176
+ if (result.active_sessions && result.active_sessions.includes(sessionId)) {
177
+ sessionData = {
178
+ sessionId: sessionId,
179
+ isActive: result.current_session_id === sessionId,
180
+ paused: result.paused,
181
+ currentScript: result.current_script,
182
+ currentLine: result.current_line,
183
+ };
184
+ return [2 /*return*/, {
185
+ text: JSON.stringify(sessionData)
186
+ }];
187
+ }
188
+ else {
189
+ throw new Error("Session ".concat(sessionId, " not found or not active"));
190
+ }
191
+ return [3 /*break*/, 4];
192
+ case 3:
193
+ error_4 = _c.sent();
194
+ throw new Error("Failed to get debugger session info: ".concat(error_4.message));
195
+ case 4: return [2 /*return*/];
196
+ }
197
+ });
198
+ });
199
+ }
200
+ };
201
+ //# sourceMappingURL=debugger_resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debugger_resources.js","source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CAAC,SAAS,CAAC,EAAE,CAAC;4BACnE,WAAW,GAAG;gCAClB,SAAS,EAAE,SAAS;gCACpB,QAAQ,EAAE,MAAM,CAAC,kBAAkB,KAAK,SAAS;gCACjD,MAAM,EAAE,MAAM,CAAC,MAAM;gCACrB,aAAa,EAAE,MAAM,CAAC,cAAc;gCACpC,WAAW,EAAE,MAAM,CAAC,YAAY;6BACjC,CAAC;4BAEF,sBAAO;oCACL,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;iCAClC,EAAC;wBACJ,CAAC;6BAAM,CAAC;4BACN,MAAM,IAAI,KAAK,CAAC,kBAAW,SAAS,6BAA0B,CAAC,CAAC;wBAClE,CAAC;;;;wBAED,MAAM,IAAI,KAAK,CAAC,+CAAyC,OAAe,CAAC,OAAO,CAAE,CAAC,CAAC;;;;;KAEvF;CACF,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Resource that provides information about the current state of the Godot editor
3
+ */
4
+ export declare const editorStateResource: {
5
+ uri: string;
6
+ name: string;
7
+ mimeType: string;
8
+ load(): Promise<{
9
+ text: string;
10
+ }>;
11
+ };
12
+ /**
13
+ * Resource that provides information about the currently selected node
14
+ */
15
+ export declare const selectedNodeResource: {
16
+ uri: string;
17
+ name: string;
18
+ mimeType: string;
19
+ load(): Promise<{
20
+ text: string;
21
+ }>;
22
+ };
23
+ /**
24
+ * Resource that provides information about the currently edited script
25
+ */
26
+ export declare const currentScriptResource: {
27
+ uri: string;
28
+ name: string;
29
+ mimeType: string;
30
+ load(): Promise<{
31
+ text: any;
32
+ metadata: {
33
+ path: any;
34
+ language: string;
35
+ error?: undefined;
36
+ script_found?: undefined;
37
+ };
38
+ } | {
39
+ text: string;
40
+ metadata: {
41
+ error: string;
42
+ script_found: boolean;
43
+ path?: undefined;
44
+ language?: undefined;
45
+ };
46
+ }>;
47
+ };
@@ -0,0 +1,155 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { getGodotConnection } from '../utils/godot_connection.js';
38
+ /**
39
+ * Resource that provides information about the current state of the Godot editor
40
+ */
41
+ export var editorStateResource = {
42
+ uri: 'godot/editor/state',
43
+ name: 'Godot Editor State',
44
+ mimeType: 'application/json',
45
+ load: function () {
46
+ return __awaiter(this, void 0, void 0, function () {
47
+ var godot, result, error_1;
48
+ return __generator(this, function (_a) {
49
+ switch (_a.label) {
50
+ case 0:
51
+ godot = getGodotConnection();
52
+ _a.label = 1;
53
+ case 1:
54
+ _a.trys.push([1, 3, , 4]);
55
+ return [4 /*yield*/, godot.sendCommand('get_editor_state')];
56
+ case 2:
57
+ result = _a.sent();
58
+ return [2 /*return*/, {
59
+ text: JSON.stringify(result)
60
+ }];
61
+ case 3:
62
+ error_1 = _a.sent();
63
+ console.error('Error fetching editor state:', error_1);
64
+ throw error_1;
65
+ case 4: return [2 /*return*/];
66
+ }
67
+ });
68
+ });
69
+ }
70
+ };
71
+ /**
72
+ * Resource that provides information about the currently selected node
73
+ */
74
+ export var selectedNodeResource = {
75
+ uri: 'godot/editor/selected_node',
76
+ name: 'Godot Selected Node',
77
+ mimeType: 'application/json',
78
+ load: function () {
79
+ return __awaiter(this, void 0, void 0, function () {
80
+ var godot, result, error_2;
81
+ return __generator(this, function (_a) {
82
+ switch (_a.label) {
83
+ case 0:
84
+ godot = getGodotConnection();
85
+ _a.label = 1;
86
+ case 1:
87
+ _a.trys.push([1, 3, , 4]);
88
+ return [4 /*yield*/, godot.sendCommand('get_selected_node')];
89
+ case 2:
90
+ result = _a.sent();
91
+ return [2 /*return*/, {
92
+ text: JSON.stringify(result)
93
+ }];
94
+ case 3:
95
+ error_2 = _a.sent();
96
+ console.error('Error fetching selected node:', error_2);
97
+ throw error_2;
98
+ case 4: return [2 /*return*/];
99
+ }
100
+ });
101
+ });
102
+ }
103
+ };
104
+ /**
105
+ * Resource that provides information about the currently edited script
106
+ */
107
+ export var currentScriptResource = {
108
+ uri: 'godot/editor/current_script',
109
+ name: 'Current Script in Editor',
110
+ mimeType: 'text/plain',
111
+ load: function () {
112
+ return __awaiter(this, void 0, void 0, function () {
113
+ var godot, result, error_3;
114
+ return __generator(this, function (_a) {
115
+ switch (_a.label) {
116
+ case 0:
117
+ godot = getGodotConnection();
118
+ _a.label = 1;
119
+ case 1:
120
+ _a.trys.push([1, 3, , 4]);
121
+ return [4 /*yield*/, godot.sendCommand('get_current_script')];
122
+ case 2:
123
+ result = _a.sent();
124
+ // If we got a script path, return script content and metadata
125
+ if (result && result.script_found && result.content) {
126
+ return [2 /*return*/, {
127
+ text: result.content,
128
+ metadata: {
129
+ path: result.script_path,
130
+ language: result.script_path.endsWith('.gd') ? 'gdscript' :
131
+ result.script_path.endsWith('.cs') ? 'csharp' : 'unknown'
132
+ }
133
+ }];
134
+ }
135
+ else {
136
+ return [2 /*return*/, {
137
+ text: '',
138
+ metadata: {
139
+ error: 'No script currently being edited',
140
+ script_found: false
141
+ }
142
+ }];
143
+ }
144
+ return [3 /*break*/, 4];
145
+ case 3:
146
+ error_3 = _a.sent();
147
+ console.error('Error fetching current script:', error_3);
148
+ throw error_3;
149
+ case 4: return [2 /*return*/];
150
+ }
151
+ });
152
+ });
153
+ }
154
+ };
155
+ //# sourceMappingURL=editor_resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor_resources.js","sourceRoot":"","sources":["../../src/resources/editor_resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAG;IACjC,GAAG,EAAE,oBAAoB;IACzB,IAAI,EAAE,oBAAoB;IAC1B,QAAQ,EAA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AI,EAAE,MAAM,CAAC,OAAO;oCACpB,QAAQ,EAAE;wCACR,IAAI,EAAE,MAAM,CAAC,WAAW;wCACxB,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;4CAClD,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;qCACnE;iCACF,EAAC;wBACJ,CAAC;6BAAM,CAAC;4BACN,sBAAO;oCACL,IAAI,EAAE,EAAE;oCACR,QAAQ,EAAE;wCACR,KAAK,EAAE,kCAAkC;wCACzC,YAAY,EAAE,KAAK;qCACpB;iCACF,EAAC;wBACJ,CAAC;;;;wBAED,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,OAAK,CAAC,CAAC;wBACvD,MAAM,OAAK,CAAC;;;;;KAEf;CACF,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Resource that provides information about the Godot project structure
3
+ */
4
+ export declare const projectStructureResource: {
5
+ uri: string;
6
+ name: string;
7
+ mimeType: string;
8
+ load(): Promise<{
9
+ text: string;
10
+ }>;
11
+ };
12
+ /**
13
+ * Resource that provides project settings
14
+ */
15
+ export declare const projectSettingsResource: {
16
+ uri: string;
17
+ name: string;
18
+ mimeType: string;
19
+ load(): Promise<{
20
+ text: string;
21
+ }>;
22
+ };
23
+ /**
24
+ * Resource that provides a list of all project resources
25
+ */
26
+ export declare const projectResourcesResource: {
27
+ uri: string;
28
+ name: string;
29
+ mimeType: string;
30
+ load(): Promise<{
31
+ text: string;
32
+ }>;
33
+ };
@@ -0,0 +1,137 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { getGodotConnection } from '../utils/godot_connection.js';
38
+ /**
39
+ * Resource that provides information about the Godot project structure
40
+ */
41
+ export var projectStructureResource = {
42
+ uri: 'godot/project/structure',
43
+ name: 'Godot Project Structure',
44
+ mimeType: 'application/json',
45
+ load: function () {
46
+ return __awaiter(this, void 0, void 0, function () {
47
+ var godot, result, error_1;
48
+ return __generator(this, function (_a) {
49
+ switch (_a.label) {
50
+ case 0:
51
+ godot = getGodotConnection();
52
+ _a.label = 1;
53
+ case 1:
54
+ _a.trys.push([1, 3, , 4]);
55
+ return [4 /*yield*/, godot.sendCommand('get_project_structure')];
56
+ case 2:
57
+ result = _a.sent();
58
+ return [2 /*return*/, {
59
+ text: JSON.stringify(result)
60
+ }];
61
+ case 3:
62
+ error_1 = _a.sent();
63
+ console.error('Error fetching project structure:', error_1);
64
+ throw error_1;
65
+ case 4: return [2 /*return*/];
66
+ }
67
+ });
68
+ });
69
+ }
70
+ };
71
+ /**
72
+ * Resource that provides project settings
73
+ */
74
+ export var projectSettingsResource = {
75
+ uri: 'godot/project/settings',
76
+ name: 'Godot Project Settings',
77
+ mimeType: 'application/json',
78
+ load: function () {
79
+ return __awaiter(this, void 0, void 0, function () {
80
+ var godot, result, error_2;
81
+ return __generator(this, function (_a) {
82
+ switch (_a.label) {
83
+ case 0:
84
+ godot = getGodotConnection();
85
+ _a.label = 1;
86
+ case 1:
87
+ _a.trys.push([1, 3, , 4]);
88
+ return [4 /*yield*/, godot.sendCommand('get_project_settings')];
89
+ case 2:
90
+ result = _a.sent();
91
+ return [2 /*return*/, {
92
+ text: JSON.stringify(result)
93
+ }];
94
+ case 3:
95
+ error_2 = _a.sent();
96
+ console.error('Error fetching project settings:', error_2);
97
+ throw error_2;
98
+ case 4: return [2 /*return*/];
99
+ }
100
+ });
101
+ });
102
+ }
103
+ };
104
+ /**
105
+ * Resource that provides a list of all project resources
106
+ */
107
+ export var projectResourcesResource = {
108
+ uri: 'godot/project/resources',
109
+ name: 'Godot Project Resources',
110
+ mimeType: 'application/json',
111
+ load: function () {
112
+ return __awaiter(this, void 0, void 0, function () {
113
+ var godot, result, error_3;
114
+ return __generator(this, function (_a) {
115
+ switch (_a.label) {
116
+ case 0:
117
+ godot = getGodotConnection();
118
+ _a.label = 1;
119
+ case 1:
120
+ _a.trys.push([1, 3, , 4]);
121
+ return [4 /*yield*/, godot.sendCommand('list_project_resources')];
122
+ case 2:
123
+ result = _a.sent();
124
+ return [2 /*return*/, {
125
+ text: JSON.stringify(result)
126
+ }];
127
+ case 3:
128
+ error_3 = _a.sent();
129
+ console.error('Error fetching project resources:', error_3);
130
+ throw error_3;
131
+ case 4: return [2 /*return*/];
132
+ }
133
+ });
134
+ });
135
+ }
136
+ };
137
+ //# sourceMappingURL=project_resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project_resources.js","sourceRoot":"","sources":["../../src/resources/project_resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,IAAM,wBAAwB,GAAG;IACtC,GAAG,EAAE,yBAAyB;IAC9B,IAAI,EAAE,yBAAyB;IAC/B,QAAQ,EAAE,kBAAkB;IACtB,IAAI;;;;;;wBACF,KAAK,GAAG,kBAAkB,EAAE,CAAC;;;;wBAIlB,qBAAM,KAAK,CAAC,WAAW,CAAC,uBAAuB,CAAC,EAAA;;wBAAzD,MAAM,GAAG,SAAgD;wBAE/D,sBAAO;gCACL,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;6BAC7B,EAAC;;;wBAEF,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,OAAK,CAAC,CAAC;wBAC1D,MAAM,OAAK,CAAC;;;;;KAEf;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,IAAM,uBAAuB,GAAG;IACrC,GAAG,EAAE,wBAAwB;IAC7B,IAAI,EAAE,wBAAwB;IAC9B,QAAQ,EAAE,kBAAkB;IACtB,IAAI;;;;;;wBACF,KAAK,GAAG,kBAAkB,EAAE,CAAC;;;;wBAIlB,qBAAM,KAAK,CAAC,WAAW,CAAC,sBAAsB,CAAC,EAAA;;wBAAxD,MAAM,GAAG,SAA+C;wBAE9D,sBAAO;gCACL,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;6BAC7B,EAAC;;;wBAEF,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,OAAK,CAAC,CAAC;wBACzD,MAAM,OAAK,CAAC;;;;;KAEf;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,IAAM,wBAAwB,GAAG;IACtC,GAAG,EAAE,yBAAyB;IAC9B,IAAI,EAAE,yBAAyB;IAC/B,QAAQ,EAAE,kBAAkB;IACtB,IAAI;;;;;;wBACF,KAAK,GAAG,kBAAkB,EAAE,CAAC;;;;wBAIlB,qBAAM,KAAK,CAAC,WAAW,CAAC,wBAAwB,CAAC,EAAA;;wBAA1D,MAAM,GAAG,SAAiD;wBAEhE,sBAAO;gCACL,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;6BAC7B,EAAC;;;wBAEF,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,OAAK,CAAC,CAAC;wBAC1D,MAAM,OAAK,CAAC;;;;;KAEf;CACF,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Resource that provides a list of all scenes in the project
3
+ */
4
+ export declare const sceneListResource: {
5
+ uri: string;
6
+ name: string;
7
+ mimeType: string;
8
+ load(): Promise<{
9
+ text: string;
10
+ }>;
11
+ };
12
+ /**
13
+ * Resource that provides detailed information about a specific scene
14
+ */
15
+ export declare const sceneStructureResource: {
16
+ uri: string;
17
+ name: string;
18
+ mimeType: string;
19
+ load(): Promise<{
20
+ text: string;
21
+ }>;
22
+ };
23
+ /**
24
+ * Resource that provides the complete scene tree hierarchy
25
+ */
26
+ export declare const fullSceneTreeResource: {
27
+ uri: string;
28
+ name: string;
29
+ mimeType: string;
30
+ load(): Promise<{
31
+ text: string;
32
+ }>;
33
+ };