evil-omo 3.11.4 → 3.11.5

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/evil-omo.js CHANGED
@@ -3,14 +3,17 @@
3
3
  // Wrapper script that detects platform and spawns the correct binary
4
4
 
5
5
  import { spawnSync } from "node:child_process";
6
- import { readFileSync } from "node:fs";
6
+ import { resolve } from "node:path";
7
+ import { existsSync, readFileSync } from "node:fs";
7
8
  import { createRequire } from "node:module";
9
+ import { fileURLToPath } from "node:url";
8
10
  import { getPlatformPackageCandidates, getBinaryPath } from "./platform.js";
9
11
 
10
12
  const require = createRequire(import.meta.url);
11
13
  const PLUGIN_NAME = "evil-omo";
12
14
  const FORCE_BASELINE_ENV = "EVIL_OMO_FORCE_BASELINE";
13
15
  const LEGACY_FORCE_BASELINE_ENV = "OH_MY_OPENCODE_FORCE_BASELINE";
16
+ const BUNDLED_CLI_ENTRYPOINT = fileURLToPath(new URL("../dist/cli/index.js", import.meta.url));
14
17
 
15
18
  /**
16
19
  * Detect libc family on Linux
@@ -74,7 +77,59 @@ function getSignalExitCode(signal) {
74
77
  return 128 + (signalCodeByName[signal] ?? 1);
75
78
  }
76
79
 
80
+ export function shouldUseBundledCli(versions = process.versions) {
81
+ return Boolean(versions?.bun);
82
+ }
83
+
84
+ export function getBundledCliEntrypoint() {
85
+ return BUNDLED_CLI_ENTRYPOINT;
86
+ }
87
+
88
+ export function resolveBundledCliRuntime(
89
+ versions = process.versions,
90
+ execPath = process.execPath,
91
+ spawnImpl = spawnSync,
92
+ ) {
93
+ if (shouldUseBundledCli(versions)) {
94
+ return execPath;
95
+ }
96
+
97
+ const probe = spawnImpl("bun", ["--version"], {
98
+ encoding: "utf8",
99
+ stdio: "pipe",
100
+ });
101
+
102
+ if (probe.error || probe.status !== 0) {
103
+ return null;
104
+ }
105
+
106
+ return "bun";
107
+ }
108
+
109
+ export function runBundledCli(args, spawnImpl = spawnSync, runtime = process.execPath) {
110
+ return spawnImpl(runtime, [getBundledCliEntrypoint(), ...args], {
111
+ stdio: "inherit",
112
+ });
113
+ }
114
+
115
+ function isDirectExecution() {
116
+ return Boolean(process.argv[1]) && resolve(process.argv[1]) === fileURLToPath(import.meta.url);
117
+ }
118
+
77
119
  function main() {
120
+ const bundledCliRuntime = resolveBundledCliRuntime();
121
+ if (bundledCliRuntime && existsSync(getBundledCliEntrypoint())) {
122
+ const result = runBundledCli(process.argv.slice(2), spawnSync, bundledCliRuntime);
123
+
124
+ if (!result.error) {
125
+ if (result.signal) {
126
+ process.exit(getSignalExitCode(result.signal));
127
+ }
128
+
129
+ process.exit(result.status ?? 1);
130
+ }
131
+ }
132
+
78
133
  const { platform, arch } = process;
79
134
  const libcFamily = getLibcFamily();
80
135
  const avx2Supported = supportsAvx2();
@@ -142,4 +197,6 @@ function main() {
142
197
  process.exit(1);
143
198
  }
144
199
 
145
- main();
200
+ if (isDirectExecution()) {
201
+ main();
202
+ }
@@ -0,0 +1,82 @@
1
+ import { describe, expect, test } from "bun:test"
2
+ import {
3
+ getBundledCliEntrypoint,
4
+ resolveBundledCliRuntime,
5
+ runBundledCli,
6
+ shouldUseBundledCli,
7
+ } from "./evil-omo.js"
8
+
9
+ describe("shouldUseBundledCli", () => {
10
+ test("returns true when running under Bun", () => {
11
+ expect(shouldUseBundledCli({ bun: "1.3.10" })).toBe(true)
12
+ })
13
+
14
+ test("returns false when Bun runtime is unavailable", () => {
15
+ expect(shouldUseBundledCli({})).toBe(false)
16
+ })
17
+ })
18
+
19
+ describe("getBundledCliEntrypoint", () => {
20
+ test("returns the packaged CLI entrypoint path", () => {
21
+ expect(getBundledCliEntrypoint().replaceAll("\\", "/")).toEndWith("/dist/cli/index.js")
22
+ })
23
+ })
24
+
25
+ describe("resolveBundledCliRuntime", () => {
26
+ test("uses the current execPath when already running under Bun", () => {
27
+ const runtime = resolveBundledCliRuntime({ bun: "1.3.10" }, "C:/bun.exe", () => {
28
+ throw new Error("should not probe bun when already running under Bun")
29
+ })
30
+
31
+ expect(runtime).toBe("C:/bun.exe")
32
+ })
33
+
34
+ test("uses bun on PATH when running under Node and bun is available", () => {
35
+ const runtime = resolveBundledCliRuntime({}, "C:/node.exe", (command, args, options) => {
36
+ expect(command).toBe("bun")
37
+ expect(args).toEqual(["--version"])
38
+ expect(options).toEqual({ encoding: "utf8", stdio: "pipe" })
39
+
40
+ return {
41
+ status: 0,
42
+ signal: null,
43
+ error: undefined,
44
+ }
45
+ })
46
+
47
+ expect(runtime).toBe("bun")
48
+ })
49
+
50
+ test("returns null when bun is unavailable outside Bun runtime", () => {
51
+ const runtime = resolveBundledCliRuntime({}, "C:/node.exe", () => ({
52
+ status: 1,
53
+ signal: null,
54
+ error: new Error("bun not found"),
55
+ }))
56
+
57
+ expect(runtime).toBeNull()
58
+ })
59
+ })
60
+
61
+ describe("runBundledCli", () => {
62
+ test("spawns the current runtime with the packaged CLI entrypoint", () => {
63
+ const calls: Array<{ command: string; args: string[]; options: { stdio: string } }> = []
64
+ const fakeSpawn = (command: string, args: string[], options: { stdio: string }) => {
65
+ calls.push({ command, args, options })
66
+ return {
67
+ status: 0,
68
+ signal: null,
69
+ error: undefined,
70
+ }
71
+ }
72
+
73
+ runBundledCli(["install"], fakeSpawn, "bun.exe")
74
+
75
+ expect(calls).toHaveLength(1)
76
+ expect(calls[0]).toEqual({
77
+ command: "bun.exe",
78
+ args: [getBundledCliEntrypoint(), "install"],
79
+ options: { stdio: "inherit" },
80
+ })
81
+ })
82
+ })
package/dist/cli/index.js CHANGED
@@ -8865,7 +8865,7 @@ var {
8865
8865
  // package.json
8866
8866
  var package_default = {
8867
8867
  name: "evil-omo",
8868
- version: "3.11.4",
8868
+ version: "3.11.5",
8869
8869
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
8870
8870
  main: "dist/index.js",
8871
8871
  types: "dist/index.d.ts",
@@ -8941,17 +8941,17 @@ var package_default = {
8941
8941
  typescript: "^5.7.3"
8942
8942
  },
8943
8943
  optionalDependencies: {
8944
- "evil-omo-darwin-arm64": "3.11.4",
8945
- "evil-omo-darwin-x64": "3.11.4",
8946
- "evil-omo-darwin-x64-baseline": "3.11.4",
8947
- "evil-omo-linux-x64": "3.11.4",
8948
- "evil-omo-linux-x64-baseline": "3.11.4",
8949
- "evil-omo-linux-arm64": "3.11.4",
8950
- "evil-omo-linux-x64-musl": "3.11.4",
8951
- "evil-omo-linux-x64-musl-baseline": "3.11.4",
8952
- "evil-omo-linux-arm64-musl": "3.11.4",
8953
- "evil-omo-windows-x64": "3.11.4",
8954
- "evil-omo-windows-x64-baseline": "3.11.4"
8944
+ "evil-omo-darwin-arm64": "3.11.5",
8945
+ "evil-omo-darwin-x64": "3.11.5",
8946
+ "evil-omo-darwin-x64-baseline": "3.11.5",
8947
+ "evil-omo-linux-x64": "3.11.5",
8948
+ "evil-omo-linux-x64-baseline": "3.11.5",
8949
+ "evil-omo-linux-arm64": "3.11.5",
8950
+ "evil-omo-linux-x64-musl": "3.11.5",
8951
+ "evil-omo-linux-x64-musl-baseline": "3.11.5",
8952
+ "evil-omo-linux-arm64-musl": "3.11.5",
8953
+ "evil-omo-windows-x64": "3.11.5",
8954
+ "evil-omo-windows-x64-baseline": "3.11.5"
8955
8955
  },
8956
8956
  overrides: {
8957
8957
  "@opencode-ai/sdk": "^1.2.24"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evil-omo",
3
- "version": "3.11.4",
3
+ "version": "3.11.5",
4
4
  "description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -76,17 +76,17 @@
76
76
  "typescript": "^5.7.3"
77
77
  },
78
78
  "optionalDependencies": {
79
- "evil-omo-darwin-arm64": "3.11.4",
80
- "evil-omo-darwin-x64": "3.11.4",
81
- "evil-omo-darwin-x64-baseline": "3.11.4",
82
- "evil-omo-linux-x64": "3.11.4",
83
- "evil-omo-linux-x64-baseline": "3.11.4",
84
- "evil-omo-linux-arm64": "3.11.4",
85
- "evil-omo-linux-x64-musl": "3.11.4",
86
- "evil-omo-linux-x64-musl-baseline": "3.11.4",
87
- "evil-omo-linux-arm64-musl": "3.11.4",
88
- "evil-omo-windows-x64": "3.11.4",
89
- "evil-omo-windows-x64-baseline": "3.11.4"
79
+ "evil-omo-darwin-arm64": "3.11.5",
80
+ "evil-omo-darwin-x64": "3.11.5",
81
+ "evil-omo-darwin-x64-baseline": "3.11.5",
82
+ "evil-omo-linux-x64": "3.11.5",
83
+ "evil-omo-linux-x64-baseline": "3.11.5",
84
+ "evil-omo-linux-arm64": "3.11.5",
85
+ "evil-omo-linux-x64-musl": "3.11.5",
86
+ "evil-omo-linux-x64-musl-baseline": "3.11.5",
87
+ "evil-omo-linux-arm64-musl": "3.11.5",
88
+ "evil-omo-windows-x64": "3.11.5",
89
+ "evil-omo-windows-x64-baseline": "3.11.5"
90
90
  },
91
91
  "overrides": {
92
92
  "@opencode-ai/sdk": "^1.2.24"