dominus-cli 0.5.8 → 0.5.9
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 +10 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +10 -5
- package/dist/mcp.js.map +1 -1
- package/package.json +1 -1
package/dist/mcp.js
CHANGED
|
@@ -744,6 +744,11 @@ async function startMcpServer() {
|
|
|
744
744
|
for (const p of parts) r += `[${luaStr(p)}]`;
|
|
745
745
|
return r;
|
|
746
746
|
}
|
|
747
|
+
function cleanNum(n) {
|
|
748
|
+
if (Number.isInteger(n)) return String(n);
|
|
749
|
+
const rounded = Math.round(n * 1e3) / 1e3;
|
|
750
|
+
return String(rounded);
|
|
751
|
+
}
|
|
747
752
|
function generateComponentCode(tree, componentName, framework) {
|
|
748
753
|
const isReact = framework === "react";
|
|
749
754
|
const lib = isReact ? "React" : "Roact";
|
|
@@ -801,7 +806,7 @@ async function startMcpServer() {
|
|
|
801
806
|
function luaValue(val, _depth) {
|
|
802
807
|
if (val === null || val === void 0) return "nil";
|
|
803
808
|
if (typeof val === "boolean") return String(val);
|
|
804
|
-
if (typeof val === "number") return
|
|
809
|
+
if (typeof val === "number") return cleanNum(val);
|
|
805
810
|
if (typeof val === "string") {
|
|
806
811
|
if (val.startsWith("#") && val.length === 7) {
|
|
807
812
|
return `Color3.fromHex("${val}")`;
|
|
@@ -813,15 +818,15 @@ async function startMcpServer() {
|
|
|
813
818
|
}
|
|
814
819
|
if (Array.isArray(val)) {
|
|
815
820
|
if (val.length === 4 && val.every((v) => typeof v === "number")) {
|
|
816
|
-
return `UDim2.new(${val.join(", ")})`;
|
|
821
|
+
return `UDim2.new(${val.map(cleanNum).join(", ")})`;
|
|
817
822
|
}
|
|
818
823
|
if (val.length === 2 && val.every((v) => typeof v === "number")) {
|
|
819
|
-
return `Vector2.new(${val.join(", ")})`;
|
|
824
|
+
return `Vector2.new(${val.map(cleanNum).join(", ")})`;
|
|
820
825
|
}
|
|
821
826
|
if (val.length === 3 && val.every((v) => typeof v === "number")) {
|
|
822
827
|
const allSmall = val.every((v) => v <= 1);
|
|
823
|
-
if (allSmall) return `Color3.new(${val.join(", ")})`;
|
|
824
|
-
return `Color3.fromRGB(${val.join(", ")})`;
|
|
828
|
+
if (allSmall) return `Color3.new(${val.map(cleanNum).join(", ")})`;
|
|
829
|
+
return `Color3.fromRGB(${val.map((v) => String(Math.round(v))).join(", ")})`;
|
|
825
830
|
}
|
|
826
831
|
return `{${val.map((v) => luaValue(v, _depth)).join(", ")}}`;
|
|
827
832
|
}
|