@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.
- package/README.md +187 -0
- package/addons/godot_mcp/command_handler.gd +161 -0
- package/addons/godot_mcp/command_handler.gd.uid +1 -0
- package/addons/godot_mcp/commands/base_command_processor.gd +221 -0
- package/addons/godot_mcp/commands/base_command_processor.gd.uid +1 -0
- package/addons/godot_mcp/commands/debugger_commands.gd +221 -0
- package/addons/godot_mcp/commands/debugger_commands.gd.uid +1 -0
- package/addons/godot_mcp/commands/editor_commands.gd +237 -0
- package/addons/godot_mcp/commands/editor_commands.gd.uid +1 -0
- package/addons/godot_mcp/commands/editor_script_commands.gd +365 -0
- package/addons/godot_mcp/commands/editor_script_commands.gd.uid +1 -0
- package/addons/godot_mcp/commands/input_commands.gd +337 -0
- package/addons/godot_mcp/commands/input_commands.gd.uid +1 -0
- package/addons/godot_mcp/commands/node_commands.gd +222 -0
- package/addons/godot_mcp/commands/node_commands.gd.uid +1 -0
- package/addons/godot_mcp/commands/project_commands.gd +298 -0
- package/addons/godot_mcp/commands/project_commands.gd.uid +1 -0
- package/addons/godot_mcp/commands/scene_commands.gd +337 -0
- package/addons/godot_mcp/commands/scene_commands.gd.uid +1 -0
- package/addons/godot_mcp/commands/script_commands.gd +349 -0
- package/addons/godot_mcp/commands/script_commands.gd.uid +1 -0
- package/addons/godot_mcp/mcp_asset_commands.gd +153 -0
- package/addons/godot_mcp/mcp_asset_commands.gd.uid +1 -0
- package/addons/godot_mcp/mcp_debug_output_publisher.gd +1669 -0
- package/addons/godot_mcp/mcp_debug_output_publisher.gd.uid +1 -0
- package/addons/godot_mcp/mcp_debugger_bridge.gd +1455 -0
- package/addons/godot_mcp/mcp_debugger_bridge.gd.uid +1 -0
- package/addons/godot_mcp/mcp_enhanced_commands.gd +1083 -0
- package/addons/godot_mcp/mcp_enhanced_commands.gd.uid +1 -0
- package/addons/godot_mcp/mcp_input_handler.gd +545 -0
- package/addons/godot_mcp/mcp_input_handler.gd.uid +1 -0
- package/addons/godot_mcp/mcp_runtime_debugger_bridge.gd +464 -0
- package/addons/godot_mcp/mcp_runtime_debugger_bridge.gd.uid +1 -0
- package/addons/godot_mcp/mcp_script_resource_commands.gd +165 -0
- package/addons/godot_mcp/mcp_script_resource_commands.gd.uid +1 -0
- package/addons/godot_mcp/mcp_server.gd +260 -0
- package/addons/godot_mcp/mcp_server.gd.uid +1 -0
- package/addons/godot_mcp/plugin.cfg +7 -0
- package/addons/godot_mcp/runtime_debugger.gd +81 -0
- package/addons/godot_mcp/runtime_debugger.gd.uid +1 -0
- package/addons/godot_mcp/ui/mcp_panel.gd +94 -0
- package/addons/godot_mcp/ui/mcp_panel.gd.uid +1 -0
- package/addons/godot_mcp/ui/mcp_panel.tscn +96 -0
- package/addons/godot_mcp/utils/node_utils.gd +82 -0
- package/addons/godot_mcp/utils/node_utils.gd.uid +1 -0
- package/addons/godot_mcp/utils/resource_utils.gd +81 -0
- package/addons/godot_mcp/utils/resource_utils.gd.uid +1 -0
- package/addons/godot_mcp/utils/script_utils.gd +114 -0
- package/addons/godot_mcp/utils/script_utils.gd.uid +1 -0
- package/addons/godot_mcp/websocket_server.gd +197 -0
- package/addons/godot_mcp/websocket_server.gd.uid +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +561 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +156 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/asset_resources.d.ts +29 -0
- package/dist/resources/asset_resources.js +145 -0
- package/dist/resources/asset_resources.js.map +1 -0
- package/dist/resources/debug_resources.d.ts +11 -0
- package/dist/resources/debug_resources.js +106 -0
- package/dist/resources/debug_resources.js.map +1 -0
- package/dist/resources/debugger_resources.d.ts +62 -0
- package/dist/resources/debugger_resources.js +201 -0
- package/dist/resources/debugger_resources.js.map +1 -0
- package/dist/resources/editor_resources.d.ts +47 -0
- package/dist/resources/editor_resources.js +155 -0
- package/dist/resources/editor_resources.js.map +1 -0
- package/dist/resources/project_resources.d.ts +33 -0
- package/dist/resources/project_resources.js +137 -0
- package/dist/resources/project_resources.js.map +1 -0
- package/dist/resources/scene_resources.d.ts +33 -0
- package/dist/resources/scene_resources.js +160 -0
- package/dist/resources/scene_resources.js.map +1 -0
- package/dist/resources/script_resources.d.ts +51 -0
- package/dist/resources/script_resources.js +203 -0
- package/dist/resources/script_resources.js.map +1 -0
- package/dist/tools/asset_tools.d.ts +5 -0
- package/dist/tools/asset_tools.js +125 -0
- package/dist/tools/asset_tools.js.map +1 -0
- package/dist/tools/debugger_tools.d.ts +2 -0
- package/dist/tools/debugger_tools.js +342 -0
- package/dist/tools/debugger_tools.js.map +1 -0
- package/dist/tools/editor_tools.d.ts +2 -0
- package/dist/tools/editor_tools.js +165 -0
- package/dist/tools/editor_tools.js.map +1 -0
- package/dist/tools/enhanced_tools.d.ts +5 -0
- package/dist/tools/enhanced_tools.js +706 -0
- package/dist/tools/enhanced_tools.js.map +1 -0
- package/dist/tools/input_tools.d.ts +2 -0
- package/dist/tools/input_tools.js +408 -0
- package/dist/tools/input_tools.js.map +1 -0
- package/dist/tools/node_tools.d.ts +5 -0
- package/dist/tools/node_tools.js +217 -0
- package/dist/tools/node_tools.js.map +1 -0
- package/dist/tools/project_tools.d.ts +5 -0
- package/dist/tools/project_tools.js +162 -0
- package/dist/tools/project_tools.js.map +1 -0
- package/dist/tools/scene_tools.d.ts +5 -0
- package/dist/tools/scene_tools.js +260 -0
- package/dist/tools/scene_tools.js.map +1 -0
- package/dist/tools/script_resource_tools.d.ts +5 -0
- package/dist/tools/script_resource_tools.js +5 -0
- package/dist/tools/script_resource_tools.js.map +1 -0
- package/dist/tools/script_tools.d.ts +5 -0
- package/dist/tools/script_tools.js +154 -0
- package/dist/tools/script_tools.js.map +1 -0
- package/dist/utils/godot_connection.d.ts +30 -0
- package/dist/utils/godot_connection.js +285 -0
- package/dist/utils/godot_connection.js.map +1 -0
- package/dist/utils/types.d.ts +16 -0
- package/dist/utils/types.js +2 -0
- package/dist/utils/types.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,160 @@
|
|
|
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 a list of all scenes in the project
|
|
40
|
+
*/
|
|
41
|
+
export var sceneListResource = {
|
|
42
|
+
uri: 'godot/scenes',
|
|
43
|
+
name: 'Godot Scene List',
|
|
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('list_project_files', {
|
|
56
|
+
extensions: ['.tscn', '.scn']
|
|
57
|
+
})];
|
|
58
|
+
case 2:
|
|
59
|
+
result = _a.sent();
|
|
60
|
+
if (result && result.files) {
|
|
61
|
+
return [2 /*return*/, {
|
|
62
|
+
text: JSON.stringify({
|
|
63
|
+
scenes: result.files,
|
|
64
|
+
count: result.files.length
|
|
65
|
+
})
|
|
66
|
+
}];
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return [2 /*return*/, {
|
|
70
|
+
text: JSON.stringify({
|
|
71
|
+
scenes: [],
|
|
72
|
+
count: 0
|
|
73
|
+
})
|
|
74
|
+
}];
|
|
75
|
+
}
|
|
76
|
+
return [3 /*break*/, 4];
|
|
77
|
+
case 3:
|
|
78
|
+
error_1 = _a.sent();
|
|
79
|
+
console.error('Error fetching scene list:', error_1);
|
|
80
|
+
throw error_1;
|
|
81
|
+
case 4: return [2 /*return*/];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Resource that provides detailed information about a specific scene
|
|
89
|
+
*/
|
|
90
|
+
export var sceneStructureResource = {
|
|
91
|
+
uri: 'godot/scene/current',
|
|
92
|
+
name: 'Godot Scene Structure',
|
|
93
|
+
mimeType: 'application/json',
|
|
94
|
+
load: function () {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
+
var godot, result, error_2;
|
|
97
|
+
return __generator(this, function (_a) {
|
|
98
|
+
switch (_a.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
godot = getGodotConnection();
|
|
101
|
+
_a.label = 1;
|
|
102
|
+
case 1:
|
|
103
|
+
_a.trys.push([1, 3, , 4]);
|
|
104
|
+
return [4 /*yield*/, godot.sendCommand('get_editor_scene_structure', {
|
|
105
|
+
include_properties: true,
|
|
106
|
+
include_scripts: true,
|
|
107
|
+
})];
|
|
108
|
+
case 2:
|
|
109
|
+
result = _a.sent();
|
|
110
|
+
return [2 /*return*/, {
|
|
111
|
+
text: JSON.stringify(result)
|
|
112
|
+
}];
|
|
113
|
+
case 3:
|
|
114
|
+
error_2 = _a.sent();
|
|
115
|
+
console.error('Error fetching scene structure:', error_2);
|
|
116
|
+
throw error_2;
|
|
117
|
+
case 4: return [2 /*return*/];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Resource that provides the complete scene tree hierarchy
|
|
125
|
+
*/
|
|
126
|
+
export var fullSceneTreeResource = {
|
|
127
|
+
uri: 'godot/scene/tree',
|
|
128
|
+
name: 'Full Scene Tree',
|
|
129
|
+
mimeType: 'application/json',
|
|
130
|
+
load: function () {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
132
|
+
var godot, result, error_3;
|
|
133
|
+
var _a;
|
|
134
|
+
return __generator(this, function (_b) {
|
|
135
|
+
switch (_b.label) {
|
|
136
|
+
case 0:
|
|
137
|
+
godot = getGodotConnection();
|
|
138
|
+
_b.label = 1;
|
|
139
|
+
case 1:
|
|
140
|
+
_b.trys.push([1, 3, , 4]);
|
|
141
|
+
return [4 /*yield*/, godot.sendCommand('get_editor_scene_structure', {
|
|
142
|
+
include_properties: true,
|
|
143
|
+
include_scripts: true,
|
|
144
|
+
})];
|
|
145
|
+
case 2:
|
|
146
|
+
result = _b.sent();
|
|
147
|
+
return [2 /*return*/, {
|
|
148
|
+
text: JSON.stringify((_a = result.structure) !== null && _a !== void 0 ? _a : result)
|
|
149
|
+
}];
|
|
150
|
+
case 3:
|
|
151
|
+
error_3 = _b.sent();
|
|
152
|
+
console.error('Error fetching full scene tree:', error_3);
|
|
153
|
+
throw error_3;
|
|
154
|
+
case 4: return [2 /*return*/];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=scene_resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene_resources.js","sourceRoot":"","sources":["../../src/resources/scene_resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EA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b;wBAEF,sBAAO;gCACH,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;6BAC/B,EAAC;;;wBAEF,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,OAAK,CAAC,CAAC;wBACxD,MAAM,OAAK,CAAC;;;;;KAEnB;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,IAAM,qBAAqB,GAAG;IACnC,GAAG,EAAE,kBAAkB;IACvB,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,kBAAkB;IACtB,IAAI;;;;;;;wBACF,KAAK,GAAG,kBAAkB,EAAE,CAAC;;;;wBAIlB,qBAAM,KAAK,CAAC,WAAW,CAAC,4BAA4B,EAAE;gCACnE,kBAAkB,EAAE,IAAI;gCACxB,eAAe,EAAE,IAAI;6BACtB,CAAC,EAAA;;wBAHI,MAAM,GAAG,SAGb;wBAEF,sBAAO;gCACL,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAA,MAAM,CAAC,SAAS,mCAAI,MAAM,CAAC;6BACjD,EAAC;;;wBAEF,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,OAAK,CAAC,CAAC;wBACxD,MAAM,OAAK,CAAC;;;;;KAEf;CACF,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource for script list
|
|
3
|
+
*/
|
|
4
|
+
export declare const scriptListResource: {
|
|
5
|
+
uri: string;
|
|
6
|
+
name: string;
|
|
7
|
+
mimeType: string;
|
|
8
|
+
load(): Promise<{
|
|
9
|
+
text: string;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Template resource for retrieving script content by path.
|
|
14
|
+
*/
|
|
15
|
+
export declare const scriptByPathResourceTemplate: {
|
|
16
|
+
uriTemplate: string;
|
|
17
|
+
name: string;
|
|
18
|
+
mimeType: string;
|
|
19
|
+
arguments: {
|
|
20
|
+
name: "path";
|
|
21
|
+
description: string;
|
|
22
|
+
required: boolean;
|
|
23
|
+
}[];
|
|
24
|
+
load({ path }: {
|
|
25
|
+
path: string;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
text: any;
|
|
28
|
+
metadata: {
|
|
29
|
+
path: any;
|
|
30
|
+
language: string;
|
|
31
|
+
};
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Template resource for retrieving script metadata by path.
|
|
36
|
+
*/
|
|
37
|
+
export declare const scriptMetadataResourceTemplate: {
|
|
38
|
+
uriTemplate: string;
|
|
39
|
+
name: string;
|
|
40
|
+
mimeType: string;
|
|
41
|
+
arguments: {
|
|
42
|
+
name: "path";
|
|
43
|
+
description: string;
|
|
44
|
+
required: boolean;
|
|
45
|
+
}[];
|
|
46
|
+
load({ path }: {
|
|
47
|
+
path: string;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
text: string;
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
@@ -0,0 +1,203 @@
|
|
|
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 script list
|
|
40
|
+
*/
|
|
41
|
+
export var scriptListResource = {
|
|
42
|
+
uri: 'godot/scripts',
|
|
43
|
+
name: 'Script List',
|
|
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('list_project_files', {
|
|
56
|
+
extensions: ['.gd', '.cs']
|
|
57
|
+
})];
|
|
58
|
+
case 2:
|
|
59
|
+
result = _a.sent();
|
|
60
|
+
if (result && result.files) {
|
|
61
|
+
return [2 /*return*/, {
|
|
62
|
+
text: JSON.stringify({
|
|
63
|
+
scripts: result.files,
|
|
64
|
+
count: result.files.length,
|
|
65
|
+
gdscripts: result.files.filter(function (f) { return f.endsWith('.gd'); }),
|
|
66
|
+
csharp_scripts: result.files.filter(function (f) { return f.endsWith('.cs'); })
|
|
67
|
+
})
|
|
68
|
+
}];
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return [2 /*return*/, {
|
|
72
|
+
text: JSON.stringify({
|
|
73
|
+
scripts: [],
|
|
74
|
+
count: 0,
|
|
75
|
+
gdscripts: [],
|
|
76
|
+
csharp_scripts: []
|
|
77
|
+
})
|
|
78
|
+
}];
|
|
79
|
+
}
|
|
80
|
+
return [3 /*break*/, 4];
|
|
81
|
+
case 3:
|
|
82
|
+
error_1 = _a.sent();
|
|
83
|
+
console.error('Error fetching script list:', error_1);
|
|
84
|
+
throw error_1;
|
|
85
|
+
case 4: return [2 /*return*/];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Template resource for retrieving script content by path.
|
|
93
|
+
*/
|
|
94
|
+
export var scriptByPathResourceTemplate = {
|
|
95
|
+
uriTemplate: 'godot/script/{path}',
|
|
96
|
+
name: 'Script Content By Path',
|
|
97
|
+
mimeType: 'text/plain',
|
|
98
|
+
arguments: [
|
|
99
|
+
{
|
|
100
|
+
name: 'path',
|
|
101
|
+
description: 'Path to the script (e.g. res://scripts/player.gd)',
|
|
102
|
+
required: true
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
load: function (_a) {
|
|
106
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
107
|
+
var godot, normalizedPath, result, message, error_2;
|
|
108
|
+
var _c, _d, _e;
|
|
109
|
+
var path = _b.path;
|
|
110
|
+
return __generator(this, function (_f) {
|
|
111
|
+
switch (_f.label) {
|
|
112
|
+
case 0:
|
|
113
|
+
godot = getGodotConnection();
|
|
114
|
+
_f.label = 1;
|
|
115
|
+
case 1:
|
|
116
|
+
_f.trys.push([1, 3, , 4]);
|
|
117
|
+
if (!path || path.trim() === '') {
|
|
118
|
+
throw new Error('Script path must be provided.');
|
|
119
|
+
}
|
|
120
|
+
normalizedPath = path.trim();
|
|
121
|
+
if (!normalizedPath.startsWith('res://')) {
|
|
122
|
+
normalizedPath = "res://".concat(normalizedPath);
|
|
123
|
+
}
|
|
124
|
+
return [4 /*yield*/, godot.sendCommand('get_script', { path: normalizedPath })];
|
|
125
|
+
case 2:
|
|
126
|
+
result = _f.sent();
|
|
127
|
+
if (!result || result.script_found === false) {
|
|
128
|
+
message = (_c = result === null || result === void 0 ? void 0 : result.error) !== null && _c !== void 0 ? _c : "Script not found at ".concat(normalizedPath);
|
|
129
|
+
throw new Error(message);
|
|
130
|
+
}
|
|
131
|
+
return [2 /*return*/, {
|
|
132
|
+
text: (_d = result.content) !== null && _d !== void 0 ? _d : '',
|
|
133
|
+
metadata: {
|
|
134
|
+
path: (_e = result.script_path) !== null && _e !== void 0 ? _e : normalizedPath,
|
|
135
|
+
language: normalizedPath.endsWith('.gd') ? 'gdscript' :
|
|
136
|
+
normalizedPath.endsWith('.cs') ? 'csharp' : 'unknown'
|
|
137
|
+
}
|
|
138
|
+
}];
|
|
139
|
+
case 3:
|
|
140
|
+
error_2 = _f.sent();
|
|
141
|
+
console.error('Error fetching script content by path:', error_2);
|
|
142
|
+
throw error_2;
|
|
143
|
+
case 4: return [2 /*return*/];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Template resource for retrieving script metadata by path.
|
|
151
|
+
*/
|
|
152
|
+
export var scriptMetadataResourceTemplate = {
|
|
153
|
+
uriTemplate: 'godot/script/{path}/metadata',
|
|
154
|
+
name: 'Script Metadata By Path',
|
|
155
|
+
mimeType: 'application/json',
|
|
156
|
+
arguments: [
|
|
157
|
+
{
|
|
158
|
+
name: 'path',
|
|
159
|
+
description: 'Path to the script (e.g. res://scripts/player.gd)',
|
|
160
|
+
required: true
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
load: function (_a) {
|
|
164
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
165
|
+
var godot, normalizedPath, result, error_3;
|
|
166
|
+
var path = _b.path;
|
|
167
|
+
return __generator(this, function (_c) {
|
|
168
|
+
switch (_c.label) {
|
|
169
|
+
case 0:
|
|
170
|
+
godot = getGodotConnection();
|
|
171
|
+
_c.label = 1;
|
|
172
|
+
case 1:
|
|
173
|
+
_c.trys.push([1, 3, , 4]);
|
|
174
|
+
if (!path || path.trim() === '') {
|
|
175
|
+
throw new Error('Script path must be provided for metadata lookup.');
|
|
176
|
+
}
|
|
177
|
+
normalizedPath = path.trim();
|
|
178
|
+
if (!normalizedPath.startsWith('res://')) {
|
|
179
|
+
normalizedPath = "res://".concat(normalizedPath);
|
|
180
|
+
}
|
|
181
|
+
return [4 /*yield*/, godot.sendCommand('get_script_metadata', { path: normalizedPath })];
|
|
182
|
+
case 2:
|
|
183
|
+
result = _c.sent();
|
|
184
|
+
if (!result) {
|
|
185
|
+
throw new Error("Metadata not available for ".concat(normalizedPath));
|
|
186
|
+
}
|
|
187
|
+
if (result.error) {
|
|
188
|
+
throw new Error(result.error);
|
|
189
|
+
}
|
|
190
|
+
return [2 /*return*/, {
|
|
191
|
+
text: JSON.stringify(result)
|
|
192
|
+
}];
|
|
193
|
+
case 3:
|
|
194
|
+
error_3 = _c.sent();
|
|
195
|
+
console.error('Error fetching script metadata by path:', error_3);
|
|
196
|
+
throw error_3;
|
|
197
|
+
case 4: return [2 /*return*/];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
//# sourceMappingURL=script_resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script_resources.js","sourceRoot":"","sources":["../../src/resources/script_resources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG;IAChC,GAAG,EAAE,eAAe;IACpB,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,kBAAkB;IACtB,IAAI;;;;;;wBACF,KAAK,GAAG,kBAAkB,EAAE,CAAC;;;;wBAElB,qBAAM,KAAK,CAAC,WAAW,CAAC,oBAAoB,EAAE;gCAC3D,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;6BAC3B,CAAC,EAAA;;wBAFI,MAAM,GAAG,SAEb;wBAEF,IAAI,MAAM,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;4BAC3B,sBAAO;oCACL,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wCACnB,OAAO,EAAE,MAAM,CAAC,KAAK;wCACrB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;wCAC1B,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAC,CAAS,IAAK,OAAA,CAAC,CAAC,QAA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AAC,mDAAmD,CAAC,CAAC;wBACvE,CAAC;wBAEG,cAAc,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;wBACjC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;4BACzC,cAAc,GAAG,gBAAS,cAAc,CAAE,CAAC;wBAC7C,CAAC;wBAEc,qBAAM,KAAK,CAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,EAAA;;wBAAjF,MAAM,GAAG,SAAwE;wBAEvF,IAAI,CAAC,MAAM,EAAE,CAAC;4BACZ,MAAM,IAAI,KAAK,CAAC,qCAA8B,cAAc,CAAE,CAAC,CAAC;wBAClE,CAAC;wBAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;4BACjB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;wBAChC,CAAC;wBAED,sBAAO;gCACL,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;6BAC7B,EAAC;;;wBAEF,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,OAAK,CAAC,CAAC;wBAChE,MAAM,OAAK,CAAC;;;;;KAEf;CACF,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
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
|
+
// File: /server/src/tools/asset_tools.ts
|
|
38
|
+
import { z } from 'zod';
|
|
39
|
+
import { getGodotConnection } from '../utils/godot_connection.js';
|
|
40
|
+
/**
|
|
41
|
+
* Tools for asset management in Godot
|
|
42
|
+
*/
|
|
43
|
+
export var assetTools = [
|
|
44
|
+
{
|
|
45
|
+
name: 'list_assets_by_type',
|
|
46
|
+
description: 'List all assets of a specific type in the project',
|
|
47
|
+
parameters: z.object({
|
|
48
|
+
type: z.string()
|
|
49
|
+
.describe('Type of assets to list. Valid types: "scripts" (.gd), "scenes" (.tscn), "images" (.png, .jpg, etc.), "audio" (.ogg, .mp3, .wav), "fonts" (.ttf, .otf), "models" (.glb, .gltf, .obj, .fbx), "shaders" (.gdshader), "resources" (.tres, .res), "all" (everything)'),
|
|
50
|
+
}),
|
|
51
|
+
execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
52
|
+
var godot, result, assetCount, assetType, fileList, error_1;
|
|
53
|
+
var type = _b.type;
|
|
54
|
+
return __generator(this, function (_c) {
|
|
55
|
+
switch (_c.label) {
|
|
56
|
+
case 0:
|
|
57
|
+
godot = getGodotConnection();
|
|
58
|
+
_c.label = 1;
|
|
59
|
+
case 1:
|
|
60
|
+
_c.trys.push([1, 3, , 4]);
|
|
61
|
+
return [4 /*yield*/, godot.sendCommand('list_assets_by_type', { type: type })];
|
|
62
|
+
case 2:
|
|
63
|
+
result = _c.sent();
|
|
64
|
+
assetCount = result.count || 0;
|
|
65
|
+
assetType = result.assetType || type;
|
|
66
|
+
if (assetCount === 0) {
|
|
67
|
+
return [2 /*return*/, "No ".concat(assetType, " assets found in the project.")];
|
|
68
|
+
}
|
|
69
|
+
fileList = result.files.join('\n- ');
|
|
70
|
+
return [2 /*return*/, [
|
|
71
|
+
"Found ".concat(assetCount, " ").concat(assetType, " assets in the project."),
|
|
72
|
+
'',
|
|
73
|
+
'Assets:',
|
|
74
|
+
"- ".concat(fileList)
|
|
75
|
+
].join('\n')];
|
|
76
|
+
case 3:
|
|
77
|
+
error_1 = _c.sent();
|
|
78
|
+
throw new Error("Failed to list assets: ".concat(error_1.message));
|
|
79
|
+
case 4: return [2 /*return*/];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}); },
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'list_project_files',
|
|
86
|
+
description: 'List files in the project matching specified extensions',
|
|
87
|
+
parameters: z.object({
|
|
88
|
+
extensions: z.array(z.string()).optional()
|
|
89
|
+
.describe('File extensions to filter by (e.g. [".tscn", ".gd"])'),
|
|
90
|
+
}),
|
|
91
|
+
execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
92
|
+
var godot, result, fileCount, extensionStr, fileList, error_2;
|
|
93
|
+
var _c = _b.extensions, extensions = _c === void 0 ? [] : _c;
|
|
94
|
+
return __generator(this, function (_d) {
|
|
95
|
+
switch (_d.label) {
|
|
96
|
+
case 0:
|
|
97
|
+
godot = getGodotConnection();
|
|
98
|
+
_d.label = 1;
|
|
99
|
+
case 1:
|
|
100
|
+
_d.trys.push([1, 3, , 4]);
|
|
101
|
+
return [4 /*yield*/, godot.sendCommand('list_project_files', { extensions: extensions })];
|
|
102
|
+
case 2:
|
|
103
|
+
result = _d.sent();
|
|
104
|
+
fileCount = result.files ? result.files.length : 0;
|
|
105
|
+
extensionStr = extensions.length > 0 ? extensions.join(', ') : 'all';
|
|
106
|
+
if (fileCount === 0) {
|
|
107
|
+
return [2 /*return*/, "No files with extensions ".concat(extensionStr, " found in the project.")];
|
|
108
|
+
}
|
|
109
|
+
fileList = result.files.join('\n- ');
|
|
110
|
+
return [2 /*return*/, [
|
|
111
|
+
"Found ".concat(fileCount, " files with extensions ").concat(extensionStr, " in the project."),
|
|
112
|
+
'',
|
|
113
|
+
'Files:',
|
|
114
|
+
"- ".concat(fileList)
|
|
115
|
+
].join('\n')];
|
|
116
|
+
case 3:
|
|
117
|
+
error_2 = _d.sent();
|
|
118
|
+
throw new Error("Failed to list project files: ".concat(error_2.message));
|
|
119
|
+
case 4: return [2 /*return*/];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}); },
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
//# sourceMappingURL=asset_tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset_tools.js","sourceRoot":"","sources":["../../src/tools/asset_tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAyC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGlE;;GAEG;AACH,MAAM,CAAC,IAAM,UAAU,GAAc;IACnC;QACE,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE,mDAAmD;QAChE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;iBACb,QAAQ,CAAC,iQAAiQ,CAAC;SAC/Q,CAAC;QACF,OAAO,EAAE,iEAAO,EAAQ;;gBAAN,IAAI,UAAA;;;;wBACd,KAAK,GAAG,kBAAkB,EAAE,CAAC;;;;wBAGlB,qBAAM,KAAK,CAAC,WAAW,CAAC,qBAAqB,EAAE,EAAE,IAAI,MAAA,EAAE,CAAC,EAAA;;wBAAjE,MAAM,GAAG,SAAwD;wBAGjE,UAAU,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;wBAC/B,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC;wBAE3C,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;4BACrB,sBAAO,aAAM,SAAS,kCAA+B,EAAC;wBACxD,CAAC;wBAEK,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;wBAE3C,sBAAO;gCACL,gBAAS,U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