@sunerpy/oh-my-openagent-windows-x64-baseline 4.20.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/bin/oh-my-opencode.js +127 -0
- package/package.json +22 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
const wrapperPackageRoot = process.env.OMO_WRAPPER_PACKAGE_ROOT;
|
|
7
|
+
const lazyCodexInvocationNames = new Set(["lazycodex", "lazycodex-ai"]);
|
|
8
|
+
const lazyCodexInstallerCommands = new Set(["install", "setup", "update", "uninstall", "cleanup"]);
|
|
9
|
+
|
|
10
|
+
if (!wrapperPackageRoot) {
|
|
11
|
+
console.error("oh-my-opencode: OMO_WRAPPER_PACKAGE_ROOT is required to launch the packaged CLI.");
|
|
12
|
+
process.exit(2);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function exitFromResult(result, failureLabel) {
|
|
16
|
+
if (result.error) {
|
|
17
|
+
console.error(`oh-my-opencode: ${failureLabel}: ${result.error.message}`);
|
|
18
|
+
process.exit(2);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (result.signal) {
|
|
22
|
+
const signalCodes = { SIGINT: 2, SIGILL: 4, SIGKILL: 9, SIGTERM: 15 };
|
|
23
|
+
process.exit(128 + (signalCodes[result.signal] ?? 1));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
process.exit(result.status ?? 1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function shouldRunLazyCodexInstaller() {
|
|
30
|
+
const args = process.argv.slice(2);
|
|
31
|
+
const command = readInstallerCommand(args);
|
|
32
|
+
const platformArg = readPlatformArg(args);
|
|
33
|
+
if (lazyCodexInvocationNames.has(process.env.OMO_INVOCATION_NAME ?? "")) {
|
|
34
|
+
if ((command === "install" || command === "setup") && platformArg !== undefined && platformArg !== "codex") {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return command === undefined ||
|
|
38
|
+
command === "--help" ||
|
|
39
|
+
command === "-h" ||
|
|
40
|
+
command === "--version" ||
|
|
41
|
+
command === "-v" ||
|
|
42
|
+
lazyCodexInstallerCommands.has(command);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return (command === "install" || command === "setup") && platformArg === "codex";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function readInstallerCommand(args) {
|
|
49
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
50
|
+
const arg = args[index];
|
|
51
|
+
if (arg === "--platform" || arg === "--repo-root") {
|
|
52
|
+
index += 1;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (arg.startsWith("-")) continue;
|
|
56
|
+
return arg;
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function readPlatformArg(args) {
|
|
62
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
63
|
+
const arg = args[index];
|
|
64
|
+
if (arg === "--platform") {
|
|
65
|
+
return args[index + 1];
|
|
66
|
+
}
|
|
67
|
+
if (arg.startsWith("--platform=")) {
|
|
68
|
+
return arg.slice("--platform=".length);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (shouldRunLazyCodexInstaller()) {
|
|
75
|
+
const lazyCodexInstallerPath = join(wrapperPackageRoot, "packages", "omo-codex", "scripts", "install-local.mjs");
|
|
76
|
+
|
|
77
|
+
if (!existsSync(lazyCodexInstallerPath)) {
|
|
78
|
+
console.error(`oh-my-opencode: lazycodex installer not found at ${lazyCodexInstallerPath}`);
|
|
79
|
+
process.exit(2);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const result = spawnSync(process.execPath, [lazyCodexInstallerPath, ...process.argv.slice(2)], {
|
|
83
|
+
stdio: "inherit",
|
|
84
|
+
env: process.env,
|
|
85
|
+
});
|
|
86
|
+
exitFromResult(result, "failed to execute lazycodex Node installer");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const cliPath = join(wrapperPackageRoot, "dist", "cli", "index.js");
|
|
90
|
+
const nodeCliPath = join(wrapperPackageRoot, "dist", "cli-node", "index.js");
|
|
91
|
+
|
|
92
|
+
if (!existsSync(cliPath)) {
|
|
93
|
+
console.error(`oh-my-opencode: packaged CLI not found at ${cliPath}`);
|
|
94
|
+
process.exit(2);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function runNodeCli(reason) {
|
|
98
|
+
if (!existsSync(nodeCliPath)) return;
|
|
99
|
+
if (reason) {
|
|
100
|
+
console.error(`oh-my-opencode: ${reason}; falling back to the node CLI at ${nodeCliPath}`);
|
|
101
|
+
}
|
|
102
|
+
const result = spawnSync(process.execPath, [nodeCliPath, ...process.argv.slice(2)], {
|
|
103
|
+
stdio: "inherit",
|
|
104
|
+
env: process.env,
|
|
105
|
+
});
|
|
106
|
+
exitFromResult(result, "failed to execute the node CLI");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (process.env.OMO_RUNTIME === "node") {
|
|
110
|
+
runNodeCli();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const bunBinary = process.env.BUN_BINARY || "bun";
|
|
114
|
+
const result = spawnSync(bunBinary, [cliPath, ...process.argv.slice(2)], {
|
|
115
|
+
stdio: "inherit",
|
|
116
|
+
env: process.env,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if (result.error) {
|
|
120
|
+
runNodeCli(`bun is not available (${result.error.message})`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (result.signal === "SIGILL") {
|
|
124
|
+
runNodeCli("bun crashed with SIGILL - this CPU lacks the instruction set bun requires (x86-64-v2/SSE4.2 or newer)");
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
exitFromResult(result, "failed to execute Bun");
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sunerpy/oh-my-openagent-windows-x64-baseline",
|
|
3
|
+
"version": "4.20.0",
|
|
4
|
+
"description": "Platform launcher for @sunerpy/oh-my-openagent (windows-x64-baseline)",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/sunerpy/oh-my-openagent"
|
|
9
|
+
},
|
|
10
|
+
"os": [
|
|
11
|
+
"win32"
|
|
12
|
+
],
|
|
13
|
+
"cpu": [
|
|
14
|
+
"x64"
|
|
15
|
+
],
|
|
16
|
+
"files": [
|
|
17
|
+
"bin"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
}
|
|
22
|
+
}
|