dominus-cli 0.2.1 → 0.5.0
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/dist/index.js +423 -70
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +18 -3
- package/dist/mcp.js.map +1 -1
- package/package.json +17 -16
- package/plugin/Dominus.rbxm +0 -0
- package/plugin/src/Executor.lua +1 -0
- package/plugin/src/Explorer.lua +123 -1
- package/plugin/src/Properties.lua +213 -28
- package/plugin/src/UIBuilder.lua +494 -32
- package/plugin/src/init.server.lua +111 -22
|
@@ -7,11 +7,7 @@
|
|
|
7
7
|
]]
|
|
8
8
|
|
|
9
9
|
local toolbar = plugin:CreateToolbar("Dominus")
|
|
10
|
-
local connectButton = toolbar:CreateButton(
|
|
11
|
-
"Connect",
|
|
12
|
-
"Connect to Dominus CLI agent",
|
|
13
|
-
"rbxassetid://12974519994"
|
|
14
|
-
)
|
|
10
|
+
local connectButton = toolbar:CreateButton("Connect", "Connect to Dominus CLI agent", "rbxassetid://12974519994")
|
|
15
11
|
|
|
16
12
|
local WsClient = require(script.WsClient)
|
|
17
13
|
local Protocol = require(script.Protocol)
|
|
@@ -53,7 +49,6 @@ local function handleMessage(rawMessage)
|
|
|
53
49
|
payload = { tree = tree },
|
|
54
50
|
ts = os.clock(),
|
|
55
51
|
}))
|
|
56
|
-
|
|
57
52
|
elseif msgType == "cli:get:script" then
|
|
58
53
|
local result = Explorer.getScriptSource(payload.path)
|
|
59
54
|
WsClient.send(Protocol.encode({
|
|
@@ -62,7 +57,6 @@ local function handleMessage(rawMessage)
|
|
|
62
57
|
payload = result,
|
|
63
58
|
ts = os.clock(),
|
|
64
59
|
}))
|
|
65
|
-
|
|
66
60
|
elseif msgType == "cli:set:script" then
|
|
67
61
|
local result = Explorer.setScriptSource(payload.path, payload.source)
|
|
68
62
|
WsClient.send(Protocol.encode({
|
|
@@ -71,7 +65,6 @@ local function handleMessage(rawMessage)
|
|
|
71
65
|
payload = result,
|
|
72
66
|
ts = os.clock(),
|
|
73
67
|
}))
|
|
74
|
-
|
|
75
68
|
elseif msgType == "cli:run" then
|
|
76
69
|
local result = Executor.run(payload.code)
|
|
77
70
|
WsClient.send(Protocol.encode({
|
|
@@ -80,7 +73,6 @@ local function handleMessage(rawMessage)
|
|
|
80
73
|
payload = result,
|
|
81
74
|
ts = os.clock(),
|
|
82
75
|
}))
|
|
83
|
-
|
|
84
76
|
elseif msgType == "cli:get:properties" then
|
|
85
77
|
local result = Properties.get(payload.path)
|
|
86
78
|
WsClient.send(Protocol.encode({
|
|
@@ -89,7 +81,14 @@ local function handleMessage(rawMessage)
|
|
|
89
81
|
payload = result,
|
|
90
82
|
ts = os.clock(),
|
|
91
83
|
}))
|
|
92
|
-
|
|
84
|
+
elseif msgType == "cli:get:descendants:properties" then
|
|
85
|
+
local result = Properties.getDescendants(payload.path)
|
|
86
|
+
WsClient.send(Protocol.encode({
|
|
87
|
+
id = msgId,
|
|
88
|
+
type = "studio:response",
|
|
89
|
+
payload = result,
|
|
90
|
+
ts = os.clock(),
|
|
91
|
+
}))
|
|
93
92
|
elseif msgType == "cli:set:properties" then
|
|
94
93
|
local result = Properties.set(payload.path, payload.properties)
|
|
95
94
|
WsClient.send(Protocol.encode({
|
|
@@ -98,7 +97,6 @@ local function handleMessage(rawMessage)
|
|
|
98
97
|
payload = result,
|
|
99
98
|
ts = os.clock(),
|
|
100
99
|
}))
|
|
101
|
-
|
|
102
100
|
elseif msgType == "cli:insert" then
|
|
103
101
|
local result = Explorer.insertInstance(payload.className, payload.parentPath, payload.name, payload.properties)
|
|
104
102
|
WsClient.send(Protocol.encode({
|
|
@@ -107,7 +105,6 @@ local function handleMessage(rawMessage)
|
|
|
107
105
|
payload = result,
|
|
108
106
|
ts = os.clock(),
|
|
109
107
|
}))
|
|
110
|
-
|
|
111
108
|
elseif msgType == "cli:delete" then
|
|
112
109
|
local result = Explorer.deleteInstance(payload.path)
|
|
113
110
|
WsClient.send(Protocol.encode({
|
|
@@ -116,7 +113,6 @@ local function handleMessage(rawMessage)
|
|
|
116
113
|
payload = result,
|
|
117
114
|
ts = os.clock(),
|
|
118
115
|
}))
|
|
119
|
-
|
|
120
116
|
elseif msgType == "cli:get:selection" then
|
|
121
117
|
local Selection = game:GetService("Selection")
|
|
122
118
|
local selected = Selection:Get()
|
|
@@ -132,7 +128,6 @@ local function handleMessage(rawMessage)
|
|
|
132
128
|
payload = { paths = paths, classNames = classNames },
|
|
133
129
|
ts = os.clock(),
|
|
134
130
|
}))
|
|
135
|
-
|
|
136
131
|
elseif msgType == "cli:search:scripts" then
|
|
137
132
|
local result = Explorer.searchScripts(payload.query, payload.maxResults or 20)
|
|
138
133
|
WsClient.send(Protocol.encode({
|
|
@@ -141,7 +136,6 @@ local function handleMessage(rawMessage)
|
|
|
141
136
|
payload = result,
|
|
142
137
|
ts = os.clock(),
|
|
143
138
|
}))
|
|
144
|
-
|
|
145
139
|
elseif msgType == "cli:get:output" then
|
|
146
140
|
local result = Watcher.getRecentOutput(payload.limit or 50, payload.level)
|
|
147
141
|
WsClient.send(Protocol.encode({
|
|
@@ -150,7 +144,6 @@ local function handleMessage(rawMessage)
|
|
|
150
144
|
payload = result,
|
|
151
145
|
ts = os.clock(),
|
|
152
146
|
}))
|
|
153
|
-
|
|
154
147
|
elseif msgType == "cli:run:tests" then
|
|
155
148
|
local result = TestRunner.run(payload.testName)
|
|
156
149
|
WsClient.send(Protocol.encode({
|
|
@@ -159,7 +152,6 @@ local function handleMessage(rawMessage)
|
|
|
159
152
|
payload = result,
|
|
160
153
|
ts = os.clock(),
|
|
161
154
|
}))
|
|
162
|
-
|
|
163
155
|
elseif msgType == "cli:test:run" then
|
|
164
156
|
-- ExecuteRunModeAsync yields until EndTest is called, so run in a thread
|
|
165
157
|
task.spawn(function()
|
|
@@ -171,7 +163,6 @@ local function handleMessage(rawMessage)
|
|
|
171
163
|
ts = os.clock(),
|
|
172
164
|
}))
|
|
173
165
|
end)
|
|
174
|
-
|
|
175
166
|
elseif msgType == "cli:test:play" then
|
|
176
167
|
-- ExecutePlayModeAsync yields until EndTest is called, so run in a thread
|
|
177
168
|
task.spawn(function()
|
|
@@ -183,7 +174,6 @@ local function handleMessage(rawMessage)
|
|
|
183
174
|
ts = os.clock(),
|
|
184
175
|
}))
|
|
185
176
|
end)
|
|
186
|
-
|
|
187
177
|
elseif msgType == "cli:test:end" then
|
|
188
178
|
local result = TestRunner.endTest(payload.value)
|
|
189
179
|
WsClient.send(Protocol.encode({
|
|
@@ -192,7 +182,6 @@ local function handleMessage(rawMessage)
|
|
|
192
182
|
payload = result,
|
|
193
183
|
ts = os.clock(),
|
|
194
184
|
}))
|
|
195
|
-
|
|
196
185
|
elseif msgType == "cli:build:ui" then
|
|
197
186
|
local result = UIBuilder.build(payload)
|
|
198
187
|
WsClient.send(Protocol.encode({
|
|
@@ -201,7 +190,6 @@ local function handleMessage(rawMessage)
|
|
|
201
190
|
payload = result,
|
|
202
191
|
ts = os.clock(),
|
|
203
192
|
}))
|
|
204
|
-
|
|
205
193
|
elseif msgType == "cli:get:reflection" then
|
|
206
194
|
local result = Reflection.getClassInfo(payload.className)
|
|
207
195
|
WsClient.send(Protocol.encode({
|
|
@@ -210,7 +198,108 @@ local function handleMessage(rawMessage)
|
|
|
210
198
|
payload = result,
|
|
211
199
|
ts = os.clock(),
|
|
212
200
|
}))
|
|
213
|
-
|
|
201
|
+
elseif msgType == "cli:serialize:ui" then
|
|
202
|
+
local result = UIBuilder.serialize(payload)
|
|
203
|
+
WsClient.send(Protocol.encode({
|
|
204
|
+
id = msgId,
|
|
205
|
+
type = "studio:response",
|
|
206
|
+
payload = result,
|
|
207
|
+
ts = os.clock(),
|
|
208
|
+
}))
|
|
209
|
+
elseif msgType == "cli:move:instance" then
|
|
210
|
+
local instance = Explorer.resolveInstance(payload.path)
|
|
211
|
+
if not instance then
|
|
212
|
+
WsClient.send(Protocol.encode({
|
|
213
|
+
id = msgId,
|
|
214
|
+
type = "studio:response",
|
|
215
|
+
payload = { success = false, error = "Instance not found: " .. payload.path },
|
|
216
|
+
ts = os.clock(),
|
|
217
|
+
}))
|
|
218
|
+
else
|
|
219
|
+
local newParent = Explorer.resolveInstance(payload.newParent)
|
|
220
|
+
if not newParent then
|
|
221
|
+
local svcOk, svc = pcall(function()
|
|
222
|
+
return game:GetService(payload.newParent)
|
|
223
|
+
end)
|
|
224
|
+
if svcOk then
|
|
225
|
+
newParent = svc
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
if not newParent then
|
|
229
|
+
WsClient.send(Protocol.encode({
|
|
230
|
+
id = msgId,
|
|
231
|
+
type = "studio:response",
|
|
232
|
+
payload = { success = false, error = "New parent not found: " .. payload.newParent },
|
|
233
|
+
ts = os.clock(),
|
|
234
|
+
}))
|
|
235
|
+
else
|
|
236
|
+
local ChangeHistoryService = game:GetService("ChangeHistoryService")
|
|
237
|
+
local recording = ChangeHistoryService:TryBeginRecording("Dominus: Move " .. instance.Name)
|
|
238
|
+
local ok, err = pcall(function()
|
|
239
|
+
instance.Parent = newParent
|
|
240
|
+
end)
|
|
241
|
+
if recording then
|
|
242
|
+
if ok then
|
|
243
|
+
ChangeHistoryService:FinishRecording(recording, Enum.FinishRecordingOperation.Commit)
|
|
244
|
+
else
|
|
245
|
+
ChangeHistoryService:FinishRecording(recording, Enum.FinishRecordingOperation.Cancel)
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
if ok then
|
|
249
|
+
WsClient.send(Protocol.encode({
|
|
250
|
+
id = msgId,
|
|
251
|
+
type = "studio:response",
|
|
252
|
+
payload = { success = true, newPath = Explorer.getPath(instance) },
|
|
253
|
+
ts = os.clock(),
|
|
254
|
+
}))
|
|
255
|
+
else
|
|
256
|
+
WsClient.send(Protocol.encode({
|
|
257
|
+
id = msgId,
|
|
258
|
+
type = "studio:response",
|
|
259
|
+
payload = { success = false, error = "Move failed: " .. tostring(err) },
|
|
260
|
+
ts = os.clock(),
|
|
261
|
+
}))
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
elseif msgType == "cli:undo" then
|
|
266
|
+
local ChangeHistoryService = game:GetService("ChangeHistoryService")
|
|
267
|
+
local ok, err = pcall(function()
|
|
268
|
+
ChangeHistoryService:Undo()
|
|
269
|
+
end)
|
|
270
|
+
WsClient.send(Protocol.encode({
|
|
271
|
+
id = msgId,
|
|
272
|
+
type = "studio:response",
|
|
273
|
+
payload = ok and { success = true } or { success = false, error = tostring(err) },
|
|
274
|
+
ts = os.clock(),
|
|
275
|
+
}))
|
|
276
|
+
elseif msgType == "cli:redo" then
|
|
277
|
+
local ChangeHistoryService = game:GetService("ChangeHistoryService")
|
|
278
|
+
local ok, err = pcall(function()
|
|
279
|
+
ChangeHistoryService:Redo()
|
|
280
|
+
end)
|
|
281
|
+
WsClient.send(Protocol.encode({
|
|
282
|
+
id = msgId,
|
|
283
|
+
type = "studio:response",
|
|
284
|
+
payload = ok and { success = true } or { success = false, error = tostring(err) },
|
|
285
|
+
ts = os.clock(),
|
|
286
|
+
}))
|
|
287
|
+
elseif msgType == "cli:bulk:set:properties" then
|
|
288
|
+
local result = Properties.bulkSet(payload)
|
|
289
|
+
WsClient.send(Protocol.encode({
|
|
290
|
+
id = msgId,
|
|
291
|
+
type = "studio:response",
|
|
292
|
+
payload = result,
|
|
293
|
+
ts = os.clock(),
|
|
294
|
+
}))
|
|
295
|
+
elseif msgType == "cli:find:replace:scripts" then
|
|
296
|
+
local result = Explorer.findReplaceScripts(payload)
|
|
297
|
+
WsClient.send(Protocol.encode({
|
|
298
|
+
id = msgId,
|
|
299
|
+
type = "studio:response",
|
|
300
|
+
payload = result,
|
|
301
|
+
ts = os.clock(),
|
|
302
|
+
}))
|
|
214
303
|
else
|
|
215
304
|
warn("[Dominus] Unknown message type:", msgType)
|
|
216
305
|
end
|