unrealcli 1.0.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/install.js +130 -0
- package/package.json +39 -0
- package/run.js +29 -0
package/install.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Postinstall script for the unrealmcp npm package.
|
|
5
|
+
*
|
|
6
|
+
* Downloads the correct ue-cli binary for the current platform from
|
|
7
|
+
* the GitHub Releases page and places it in the bin/ directory.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const https = require("https");
|
|
11
|
+
const http = require("http");
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const os = require("os");
|
|
15
|
+
const { execSync } = require("child_process");
|
|
16
|
+
|
|
17
|
+
const VERSION = require("./package.json").version;
|
|
18
|
+
const REPO = "aadeshrao123/Unreal-MCP";
|
|
19
|
+
|
|
20
|
+
const PLATFORM_MAP = {
|
|
21
|
+
"win32-x64": "ue-cli-windows-amd64.exe",
|
|
22
|
+
"linux-x64": "ue-cli-linux-amd64",
|
|
23
|
+
"linux-arm64": "ue-cli-linux-arm64",
|
|
24
|
+
"darwin-x64": "ue-cli-darwin-amd64",
|
|
25
|
+
"darwin-arm64": "ue-cli-darwin-arm64",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function getPlatformKey() {
|
|
29
|
+
const platform = os.platform();
|
|
30
|
+
const arch = os.arch();
|
|
31
|
+
return `${platform}-${arch}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getBinaryName() {
|
|
35
|
+
const key = getPlatformKey();
|
|
36
|
+
const name = PLATFORM_MAP[key];
|
|
37
|
+
if (!name) {
|
|
38
|
+
console.error(`Unsupported platform: ${key}`);
|
|
39
|
+
console.error(`Supported: ${Object.keys(PLATFORM_MAP).join(", ")}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
return name;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getDownloadUrl(binaryName) {
|
|
46
|
+
return `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function followRedirects(url, callback) {
|
|
50
|
+
const client = url.startsWith("https") ? https : http;
|
|
51
|
+
client.get(url, { headers: { "User-Agent": "unrealmcp-npm" } }, (res) => {
|
|
52
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
53
|
+
followRedirects(res.headers.location, callback);
|
|
54
|
+
} else {
|
|
55
|
+
callback(res);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function download(url, destPath) {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
console.log(`Downloading ue-cli v${VERSION}...`);
|
|
63
|
+
console.log(` ${url}`);
|
|
64
|
+
|
|
65
|
+
followRedirects(url, (res) => {
|
|
66
|
+
if (res.statusCode !== 200) {
|
|
67
|
+
reject(new Error(`Download failed: HTTP ${res.statusCode}`));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const totalBytes = parseInt(res.headers["content-length"], 10) || 0;
|
|
72
|
+
let downloadedBytes = 0;
|
|
73
|
+
|
|
74
|
+
const file = fs.createWriteStream(destPath);
|
|
75
|
+
res.on("data", (chunk) => {
|
|
76
|
+
downloadedBytes += chunk.length;
|
|
77
|
+
if (totalBytes > 0) {
|
|
78
|
+
const pct = Math.round((downloadedBytes / totalBytes) * 100);
|
|
79
|
+
process.stdout.write(`\r Progress: ${pct}%`);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
res.pipe(file);
|
|
83
|
+
|
|
84
|
+
file.on("finish", () => {
|
|
85
|
+
process.stdout.write("\n");
|
|
86
|
+
file.close();
|
|
87
|
+
resolve();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
file.on("error", (err) => {
|
|
91
|
+
fs.unlink(destPath, () => {});
|
|
92
|
+
reject(err);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function main() {
|
|
99
|
+
const binaryName = getBinaryName();
|
|
100
|
+
const url = getDownloadUrl(binaryName);
|
|
101
|
+
|
|
102
|
+
const binDir = path.join(__dirname, "bin");
|
|
103
|
+
if (!fs.existsSync(binDir)) {
|
|
104
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// On Windows keep .exe, on Unix use plain name
|
|
108
|
+
const isWindows = os.platform() === "win32";
|
|
109
|
+
const destName = isWindows ? "ue-cli.exe" : "ue-cli";
|
|
110
|
+
const destPath = path.join(binDir, destName);
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
await download(url, destPath);
|
|
114
|
+
|
|
115
|
+
// Make executable on Unix
|
|
116
|
+
if (!isWindows) {
|
|
117
|
+
fs.chmodSync(destPath, 0o755);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
console.log(` Installed: ${destPath}`);
|
|
121
|
+
console.log(` Run: ue-cli health_check`);
|
|
122
|
+
} catch (err) {
|
|
123
|
+
console.error(`\nFailed to install ue-cli: ${err.message}`);
|
|
124
|
+
console.error(`You can manually download from:`);
|
|
125
|
+
console.error(` https://github.com/${REPO}/releases/tag/v${VERSION}`);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "unrealcli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI for controlling Unreal Engine 5 Editor — create materials, blueprints, spawn actors, modify assets. No Python, no MCP, no dependencies.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"unreal",
|
|
7
|
+
"unreal-engine",
|
|
8
|
+
"ue5",
|
|
9
|
+
"cli",
|
|
10
|
+
"mcp",
|
|
11
|
+
"gamedev",
|
|
12
|
+
"editor",
|
|
13
|
+
"ai",
|
|
14
|
+
"claude",
|
|
15
|
+
"blueprint",
|
|
16
|
+
"material"
|
|
17
|
+
],
|
|
18
|
+
"author": "Aadesh Yadav",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/aadeshrao123/Unreal-MCP"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/aadeshrao123/Unreal-MCP#readme",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/aadeshrao123/Unreal-MCP/issues"
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"ue-cli": "run.js"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"postinstall": "node install.js"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"install.js",
|
|
36
|
+
"run.js",
|
|
37
|
+
"bin/"
|
|
38
|
+
]
|
|
39
|
+
}
|
package/run.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wrapper script that finds and executes the ue-cli binary.
|
|
5
|
+
* This is the bin entry point for the npm package.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const os = require("os");
|
|
10
|
+
const { execFileSync } = require("child_process");
|
|
11
|
+
|
|
12
|
+
const isWindows = os.platform() === "win32";
|
|
13
|
+
const binaryName = isWindows ? "ue-cli.exe" : "ue-cli";
|
|
14
|
+
const binaryPath = path.join(__dirname, "bin", binaryName);
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
execFileSync(binaryPath, process.argv.slice(2), {
|
|
18
|
+
stdio: "inherit",
|
|
19
|
+
env: process.env,
|
|
20
|
+
});
|
|
21
|
+
} catch (err) {
|
|
22
|
+
if (err.status !== undefined) {
|
|
23
|
+
process.exit(err.status);
|
|
24
|
+
}
|
|
25
|
+
console.error(`Failed to run ue-cli: ${err.message}`);
|
|
26
|
+
console.error(`Expected binary at: ${binaryPath}`);
|
|
27
|
+
console.error(`Try reinstalling: npm install -g unrealmcp`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|