dominus-cli 2.0.0 → 2.1.1
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/CHANGELOG.md +195 -0
- package/README.md +162 -248
- package/dist/install-plugin.js +75 -0
- package/dist/install-plugin.js.map +1 -0
- package/dist/mcp.js +1394 -4764
- package/dist/mcp.js.map +1 -1
- package/docs/DOMINUS_2_PLAN.md +75 -0
- package/package.json +27 -26
- package/plugin/Dominus.rbxmx +3674 -0
- package/plugin/src/BridgeConfig.lua +2 -0
- package/plugin/src/CommandRouter.lua +94 -0
- package/plugin/src/Explorer.lua +530 -373
- package/plugin/src/InstanceRegistry.lua +122 -0
- package/plugin/src/Mutation.lua +135 -0
- package/plugin/src/Properties.lua +859 -785
- package/plugin/src/Protocol.lua +30 -30
- package/plugin/src/Reflection.lua +91 -59
- package/plugin/src/TestRunner.lua +69 -141
- package/plugin/src/UIBuilder.lua +857 -727
- package/plugin/src/ValueCodec.lua +231 -0
- package/plugin/src/Watcher.lua +85 -85
- package/plugin/src/WsClient.lua +166 -81
- package/plugin/src/init.server.lua +191 -365
- package/dist/index.js +0 -7998
- package/dist/index.js.map +0 -1
- package/plugin/Dominus.rbxm +0 -0
- package/plugin/src/Executor.lua +0 -117
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
local Explorer = require(script.Parent.Explorer)
|
|
2
|
+
local InstanceRegistry = require(script.Parent.InstanceRegistry)
|
|
3
|
+
local Mutation = require(script.Parent.Mutation)
|
|
4
|
+
local Properties = require(script.Parent.Properties)
|
|
5
|
+
local Reflection = require(script.Parent.Reflection)
|
|
6
|
+
local TestRunner = require(script.Parent.TestRunner)
|
|
7
|
+
local UIBuilder = require(script.Parent.UIBuilder)
|
|
8
|
+
local Watcher = require(script.Parent.Watcher)
|
|
9
|
+
|
|
10
|
+
local CommandRouter = {}
|
|
11
|
+
|
|
12
|
+
local handlers = {
|
|
13
|
+
["studio:v2:get_tree"] = function(payload)
|
|
14
|
+
return Explorer.getTreeV2(payload)
|
|
15
|
+
end,
|
|
16
|
+
["studio:v2:inspect"] = function(payload)
|
|
17
|
+
return Properties.inspectV2(payload)
|
|
18
|
+
end,
|
|
19
|
+
["studio:v2:get_selection"] = function()
|
|
20
|
+
local Selection = game:GetService("Selection")
|
|
21
|
+
local selected = {}
|
|
22
|
+
for _, instance in Selection:Get() do
|
|
23
|
+
table.insert(selected, {
|
|
24
|
+
name = instance.Name,
|
|
25
|
+
className = instance.ClassName,
|
|
26
|
+
ref = InstanceRegistry.toRef(instance),
|
|
27
|
+
})
|
|
28
|
+
end
|
|
29
|
+
return { success = true, selection = selected }
|
|
30
|
+
end,
|
|
31
|
+
["studio:v2:read_script"] = function(payload)
|
|
32
|
+
return Explorer.readScriptV2(payload)
|
|
33
|
+
end,
|
|
34
|
+
["studio:v2:update_script"] = function(payload)
|
|
35
|
+
return Explorer.updateScriptV2(payload)
|
|
36
|
+
end,
|
|
37
|
+
["studio:v2:apply"] = function(payload)
|
|
38
|
+
return Mutation.apply(payload)
|
|
39
|
+
end,
|
|
40
|
+
["studio:v2:delete"] = function(payload)
|
|
41
|
+
return Mutation.delete(payload)
|
|
42
|
+
end,
|
|
43
|
+
["studio:v2:build_ui"] = function(payload)
|
|
44
|
+
return UIBuilder.buildV2(payload)
|
|
45
|
+
end,
|
|
46
|
+
["studio:v2:snapshot_ui"] = function(payload)
|
|
47
|
+
return UIBuilder.snapshotV2(payload)
|
|
48
|
+
end,
|
|
49
|
+
["studio:v2:run_test"] = function(payload)
|
|
50
|
+
return TestRunner.executeV2(payload)
|
|
51
|
+
end,
|
|
52
|
+
["studio:v2:get_output"] = function(payload)
|
|
53
|
+
local result = Watcher.getRecentOutput(math.clamp(payload.limit or 100, 1, 500), payload.level)
|
|
54
|
+
result.success = true
|
|
55
|
+
return result
|
|
56
|
+
end,
|
|
57
|
+
["studio:v2:get_reflection"] = function(payload)
|
|
58
|
+
if type(payload.className) ~= "string" then
|
|
59
|
+
return { success = false, error = "className must be a string" }
|
|
60
|
+
end
|
|
61
|
+
return Reflection.getClassInfo(payload.className)
|
|
62
|
+
end,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function CommandRouter.handle(message, sendResponse)
|
|
66
|
+
if type(message) ~= "table" or type(message.id) ~= "string" or #message.id > 128 then
|
|
67
|
+
return false, "Invalid Dominus request envelope"
|
|
68
|
+
end
|
|
69
|
+
if type(message.type) ~= "string" or type(message.payload) ~= "table" then
|
|
70
|
+
return false, "Invalid Dominus request type or payload"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
local handler = handlers[message.type]
|
|
74
|
+
if not handler then
|
|
75
|
+
sendResponse(message.id, {
|
|
76
|
+
success = false,
|
|
77
|
+
error = "Command is not allowed by the Dominus 2 plugin: " .. message.type,
|
|
78
|
+
})
|
|
79
|
+
return true
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
task.spawn(function()
|
|
83
|
+
local ok, result = pcall(handler, message.payload)
|
|
84
|
+
if not ok then
|
|
85
|
+
result = { success = false, error = "Command failed: " .. tostring(result) }
|
|
86
|
+
elseif type(result) ~= "table" then
|
|
87
|
+
result = { success = false, error = "Command returned an invalid result" }
|
|
88
|
+
end
|
|
89
|
+
sendResponse(message.id, result)
|
|
90
|
+
end)
|
|
91
|
+
return true
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
return CommandRouter
|