@morphllm/morphcode 1.0.3 → 2.0.3
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/cli.js +27 -0
- package/package.json +12 -20
- package/bin/morphcode +0 -38
- package/postinstall.mjs +0 -3
package/cli.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require("child_process");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
|
|
7
|
+
const platform = os.platform() === "win32" ? "windows" : os.platform();
|
|
8
|
+
const arch = os.arch() === "arm64" ? "arm64" : "x64";
|
|
9
|
+
const pkg = `@morphllm/morphcode-${platform}-${arch}`;
|
|
10
|
+
const ext = os.platform() === "win32" ? ".exe" : "";
|
|
11
|
+
|
|
12
|
+
let binPath;
|
|
13
|
+
try {
|
|
14
|
+
const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
|
|
15
|
+
binPath = path.join(pkgDir, `sa${ext}`);
|
|
16
|
+
} catch {
|
|
17
|
+
console.error(`Platform package ${pkg} not found. Install: npm i -g @morphllm/morphcode`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!fs.existsSync(binPath)) {
|
|
22
|
+
console.error(`Binary not found at ${binPath}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const r = spawnSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
27
|
+
process.exit(r.status ?? 0);
|
package/package.json
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphcode",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
},
|
|
6
|
-
"
|
|
7
|
-
"postinstall": "node ./postinstall.mjs"
|
|
8
|
-
},
|
|
9
|
-
"version": "1.0.3",
|
|
3
|
+
"version": "2.0.3",
|
|
4
|
+
"description": "Morph Code — AI coding agent CLI",
|
|
5
|
+
"bin": { "morphcode": "./cli.js" },
|
|
6
|
+
"files": ["cli.js"],
|
|
10
7
|
"optionalDependencies": {
|
|
11
|
-
"@morphllm/morphcode-
|
|
12
|
-
"@morphllm/morphcode-
|
|
13
|
-
"@morphllm/morphcode-linux-
|
|
14
|
-
"@morphllm/morphcode-linux-
|
|
15
|
-
"@morphllm/morphcode-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"@morphllm/morphcode-darwin-x64-baseline": "1.0.3",
|
|
20
|
-
"@morphllm/morphcode-windows-x64": "1.0.3",
|
|
21
|
-
"@morphllm/morphcode-windows-x64-baseline": "1.0.3"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
8
|
+
"@morphllm/morphcode-darwin-arm64": "2.0.3",
|
|
9
|
+
"@morphllm/morphcode-darwin-x64": "2.0.3",
|
|
10
|
+
"@morphllm/morphcode-linux-arm64": "2.0.3",
|
|
11
|
+
"@morphllm/morphcode-linux-x64": "2.0.3",
|
|
12
|
+
"@morphllm/morphcode-windows-x64": "2.0.3"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT"
|
|
15
|
+
}
|
package/bin/morphcode
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const os = require("os")
|
|
4
|
-
const { execSync, spawn } = require("child_process")
|
|
5
|
-
const path = require("path")
|
|
6
|
-
|
|
7
|
-
const platform = process.platform === "win32" ? "windows" : process.platform
|
|
8
|
-
const arch = process.arch
|
|
9
|
-
|
|
10
|
-
const base = "@morphllm/morphcode-" + platform + "-" + arch
|
|
11
|
-
const binary = platform === "windows" ? "morphcode.exe" : "morphcode"
|
|
12
|
-
|
|
13
|
-
function getBinaryPath() {
|
|
14
|
-
try {
|
|
15
|
-
const pkgPath = require.resolve(base + "/package.json")
|
|
16
|
-
return path.join(path.dirname(pkgPath), "bin", binary)
|
|
17
|
-
} catch {}
|
|
18
|
-
|
|
19
|
-
// Try baseline for x64
|
|
20
|
-
if (arch === "x64") {
|
|
21
|
-
try {
|
|
22
|
-
const baselinePkg = base + "-baseline"
|
|
23
|
-
const pkgPath = require.resolve(baselinePkg + "/package.json")
|
|
24
|
-
return path.join(path.dirname(pkgPath), "bin", binary)
|
|
25
|
-
} catch {}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
console.error("Could not find morphcode binary for " + platform + "-" + arch)
|
|
29
|
-
process.exit(1)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const binaryPath = getBinaryPath()
|
|
33
|
-
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
34
|
-
stdio: "inherit",
|
|
35
|
-
env: process.env,
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
child.on("exit", (code) => process.exit(code ?? 0))
|
package/postinstall.mjs
DELETED