evil-omo 3.16.0 → 3.16.1
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/LICENSE.md +82 -82
- package/README.ja.md +353 -353
- package/README.ko.md +347 -347
- package/README.md +51 -51
- package/README.ru.md +374 -374
- package/README.zh-cn.md +352 -352
- package/bin/evil-omo.js +201 -201
- package/bin/platform.d.ts +14 -14
- package/bin/platform.js +82 -82
- package/bin/platform.test.ts +218 -218
- package/dist/cli/index.js +103 -914
- package/dist/index.js +122 -325
- package/package.json +1 -1
- package/postinstall.mjs +133 -133
package/bin/platform.test.ts
CHANGED
|
@@ -1,218 +1,218 @@
|
|
|
1
|
-
// bin/platform.test.ts
|
|
2
|
-
import { describe, expect, test } from "bun:test";
|
|
3
|
-
import { getBinaryPath, getPlatformPackage, getPlatformPackageCandidates } from "./platform.js";
|
|
4
|
-
|
|
5
|
-
describe("getPlatformPackage", () => {
|
|
6
|
-
// #region Darwin platforms
|
|
7
|
-
test("returns darwin-arm64 for macOS ARM64", () => {
|
|
8
|
-
// #given macOS ARM64 platform
|
|
9
|
-
const input = { platform: "darwin", arch: "arm64" };
|
|
10
|
-
|
|
11
|
-
// #when getting platform package
|
|
12
|
-
const result = getPlatformPackage(input);
|
|
13
|
-
|
|
14
|
-
// #then returns correct package name
|
|
15
|
-
expect(result).toBe("evil-omo-darwin-arm64");
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test("returns darwin-x64 for macOS Intel", () => {
|
|
19
|
-
// #given macOS x64 platform
|
|
20
|
-
const input = { platform: "darwin", arch: "x64" };
|
|
21
|
-
|
|
22
|
-
// #when getting platform package
|
|
23
|
-
const result = getPlatformPackage(input);
|
|
24
|
-
|
|
25
|
-
// #then returns correct package name
|
|
26
|
-
expect(result).toBe("evil-omo-darwin-x64");
|
|
27
|
-
});
|
|
28
|
-
// #endregion
|
|
29
|
-
|
|
30
|
-
// #region Linux glibc platforms
|
|
31
|
-
test("returns linux-x64 for Linux x64 with glibc", () => {
|
|
32
|
-
// #given Linux x64 with glibc
|
|
33
|
-
const input = { platform: "linux", arch: "x64", libcFamily: "glibc" };
|
|
34
|
-
|
|
35
|
-
// #when getting platform package
|
|
36
|
-
const result = getPlatformPackage(input);
|
|
37
|
-
|
|
38
|
-
// #then returns correct package name
|
|
39
|
-
expect(result).toBe("evil-omo-linux-x64");
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test("returns linux-arm64 for Linux ARM64 with glibc", () => {
|
|
43
|
-
// #given Linux ARM64 with glibc
|
|
44
|
-
const input = { platform: "linux", arch: "arm64", libcFamily: "glibc" };
|
|
45
|
-
|
|
46
|
-
// #when getting platform package
|
|
47
|
-
const result = getPlatformPackage(input);
|
|
48
|
-
|
|
49
|
-
// #then returns correct package name
|
|
50
|
-
expect(result).toBe("evil-omo-linux-arm64");
|
|
51
|
-
});
|
|
52
|
-
// #endregion
|
|
53
|
-
|
|
54
|
-
// #region Linux musl platforms
|
|
55
|
-
test("returns linux-x64-musl for Alpine x64", () => {
|
|
56
|
-
// #given Linux x64 with musl (Alpine)
|
|
57
|
-
const input = { platform: "linux", arch: "x64", libcFamily: "musl" };
|
|
58
|
-
|
|
59
|
-
// #when getting platform package
|
|
60
|
-
const result = getPlatformPackage(input);
|
|
61
|
-
|
|
62
|
-
// #then returns correct package name with musl suffix
|
|
63
|
-
expect(result).toBe("evil-omo-linux-x64-musl");
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test("returns linux-arm64-musl for Alpine ARM64", () => {
|
|
67
|
-
// #given Linux ARM64 with musl (Alpine)
|
|
68
|
-
const input = { platform: "linux", arch: "arm64", libcFamily: "musl" };
|
|
69
|
-
|
|
70
|
-
// #when getting platform package
|
|
71
|
-
const result = getPlatformPackage(input);
|
|
72
|
-
|
|
73
|
-
// #then returns correct package name with musl suffix
|
|
74
|
-
expect(result).toBe("evil-omo-linux-arm64-musl");
|
|
75
|
-
});
|
|
76
|
-
// #endregion
|
|
77
|
-
|
|
78
|
-
// #region Windows platform
|
|
79
|
-
test("returns windows-x64 for Windows", () => {
|
|
80
|
-
// #given Windows x64 platform (win32 is Node's platform name)
|
|
81
|
-
const input = { platform: "win32", arch: "x64" };
|
|
82
|
-
|
|
83
|
-
// #when getting platform package
|
|
84
|
-
const result = getPlatformPackage(input);
|
|
85
|
-
|
|
86
|
-
// #then returns correct package name with 'windows' not 'win32'
|
|
87
|
-
expect(result).toBe("evil-omo-windows-x64");
|
|
88
|
-
});
|
|
89
|
-
// #endregion
|
|
90
|
-
|
|
91
|
-
// #region Error cases
|
|
92
|
-
test("throws error for Linux with null libcFamily", () => {
|
|
93
|
-
// #given Linux platform with null libc detection
|
|
94
|
-
const input = { platform: "linux", arch: "x64", libcFamily: null };
|
|
95
|
-
|
|
96
|
-
// #when getting platform package
|
|
97
|
-
// #then throws descriptive error
|
|
98
|
-
expect(() => getPlatformPackage(input)).toThrow("Could not detect libc");
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
test("throws error for Linux with undefined libcFamily", () => {
|
|
102
|
-
// #given Linux platform with undefined libc
|
|
103
|
-
const input = { platform: "linux", arch: "x64", libcFamily: undefined };
|
|
104
|
-
|
|
105
|
-
// #when getting platform package
|
|
106
|
-
// #then throws descriptive error
|
|
107
|
-
expect(() => getPlatformPackage(input)).toThrow("Could not detect libc");
|
|
108
|
-
});
|
|
109
|
-
// #endregion
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe("getBinaryPath", () => {
|
|
113
|
-
test("returns path without .exe for Unix platforms", () => {
|
|
114
|
-
// #given Unix platform package
|
|
115
|
-
const pkg = "evil-omo-darwin-arm64";
|
|
116
|
-
const platform = "darwin";
|
|
117
|
-
|
|
118
|
-
// #when getting binary path
|
|
119
|
-
const result = getBinaryPath(pkg, platform);
|
|
120
|
-
|
|
121
|
-
// #then returns path without extension
|
|
122
|
-
expect(result).toBe("evil-omo-darwin-arm64/bin/evil-omo");
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
test("returns path with .exe for Windows", () => {
|
|
126
|
-
// #given Windows platform package
|
|
127
|
-
const pkg = "evil-omo-windows-x64";
|
|
128
|
-
const platform = "win32";
|
|
129
|
-
|
|
130
|
-
// #when getting binary path
|
|
131
|
-
const result = getBinaryPath(pkg, platform);
|
|
132
|
-
|
|
133
|
-
// #then returns path with .exe extension
|
|
134
|
-
expect(result).toBe("evil-omo-windows-x64/bin/evil-omo.exe");
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
test("returns path without .exe for Linux", () => {
|
|
138
|
-
// #given Linux platform package
|
|
139
|
-
const pkg = "evil-omo-linux-x64";
|
|
140
|
-
const platform = "linux";
|
|
141
|
-
|
|
142
|
-
// #when getting binary path
|
|
143
|
-
const result = getBinaryPath(pkg, platform);
|
|
144
|
-
|
|
145
|
-
// #then returns path without extension
|
|
146
|
-
expect(result).toBe("evil-omo-linux-x64/bin/evil-omo");
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
describe("getPlatformPackageCandidates", () => {
|
|
151
|
-
test("returns x64 and baseline candidates for Linux glibc", () => {
|
|
152
|
-
// #given Linux x64 with glibc
|
|
153
|
-
const input = { platform: "linux", arch: "x64", libcFamily: "glibc" };
|
|
154
|
-
|
|
155
|
-
// #when getting package candidates
|
|
156
|
-
const result = getPlatformPackageCandidates(input);
|
|
157
|
-
|
|
158
|
-
// #then returns modern first then baseline fallback
|
|
159
|
-
expect(result).toEqual([
|
|
160
|
-
"evil-omo-linux-x64",
|
|
161
|
-
"evil-omo-linux-x64-baseline",
|
|
162
|
-
]);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
test("returns x64 musl and baseline candidates for Linux musl", () => {
|
|
166
|
-
// #given Linux x64 with musl
|
|
167
|
-
const input = { platform: "linux", arch: "x64", libcFamily: "musl" };
|
|
168
|
-
|
|
169
|
-
// #when getting package candidates
|
|
170
|
-
const result = getPlatformPackageCandidates(input);
|
|
171
|
-
|
|
172
|
-
// #then returns musl modern first then musl baseline fallback
|
|
173
|
-
expect(result).toEqual([
|
|
174
|
-
"evil-omo-linux-x64-musl",
|
|
175
|
-
"evil-omo-linux-x64-musl-baseline",
|
|
176
|
-
]);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
test("returns baseline first when preferBaseline is true", () => {
|
|
180
|
-
// #given Windows x64 and baseline preference
|
|
181
|
-
const input = { platform: "win32", arch: "x64", preferBaseline: true };
|
|
182
|
-
|
|
183
|
-
// #when getting package candidates
|
|
184
|
-
const result = getPlatformPackageCandidates(input);
|
|
185
|
-
|
|
186
|
-
// #then baseline package is preferred first
|
|
187
|
-
expect(result).toEqual([
|
|
188
|
-
"evil-omo-windows-x64-baseline",
|
|
189
|
-
"evil-omo-windows-x64",
|
|
190
|
-
]);
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
test("supports renamed package family via packageBaseName override", () => {
|
|
196
|
-
// #given Linux x64 with glibc and renamed package base
|
|
197
|
-
const input = { platform: "linux", arch: "x64", libcFamily: "glibc", packageBaseName: "oh-my-openagent" };
|
|
198
|
-
|
|
199
|
-
// #when getting package candidates
|
|
200
|
-
const result = getPlatformPackageCandidates(input);
|
|
201
|
-
|
|
202
|
-
// #then returns renamed package family candidates
|
|
203
|
-
expect(result).toEqual([
|
|
204
|
-
"oh-my-openagent-linux-x64",
|
|
205
|
-
"oh-my-openagent-linux-x64-baseline",
|
|
206
|
-
]);
|
|
207
|
-
});
|
|
208
|
-
test("returns only one candidate for ARM64", () => {
|
|
209
|
-
// #given non-x64 platform
|
|
210
|
-
const input = { platform: "linux", arch: "arm64", libcFamily: "glibc" };
|
|
211
|
-
|
|
212
|
-
// #when getting package candidates
|
|
213
|
-
const result = getPlatformPackageCandidates(input);
|
|
214
|
-
|
|
215
|
-
// #then baseline fallback is not included
|
|
216
|
-
expect(result).toEqual(["evil-omo-linux-arm64"]);
|
|
217
|
-
});
|
|
218
|
-
});
|
|
1
|
+
// bin/platform.test.ts
|
|
2
|
+
import { describe, expect, test } from "bun:test";
|
|
3
|
+
import { getBinaryPath, getPlatformPackage, getPlatformPackageCandidates } from "./platform.js";
|
|
4
|
+
|
|
5
|
+
describe("getPlatformPackage", () => {
|
|
6
|
+
// #region Darwin platforms
|
|
7
|
+
test("returns darwin-arm64 for macOS ARM64", () => {
|
|
8
|
+
// #given macOS ARM64 platform
|
|
9
|
+
const input = { platform: "darwin", arch: "arm64" };
|
|
10
|
+
|
|
11
|
+
// #when getting platform package
|
|
12
|
+
const result = getPlatformPackage(input);
|
|
13
|
+
|
|
14
|
+
// #then returns correct package name
|
|
15
|
+
expect(result).toBe("evil-omo-darwin-arm64");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("returns darwin-x64 for macOS Intel", () => {
|
|
19
|
+
// #given macOS x64 platform
|
|
20
|
+
const input = { platform: "darwin", arch: "x64" };
|
|
21
|
+
|
|
22
|
+
// #when getting platform package
|
|
23
|
+
const result = getPlatformPackage(input);
|
|
24
|
+
|
|
25
|
+
// #then returns correct package name
|
|
26
|
+
expect(result).toBe("evil-omo-darwin-x64");
|
|
27
|
+
});
|
|
28
|
+
// #endregion
|
|
29
|
+
|
|
30
|
+
// #region Linux glibc platforms
|
|
31
|
+
test("returns linux-x64 for Linux x64 with glibc", () => {
|
|
32
|
+
// #given Linux x64 with glibc
|
|
33
|
+
const input = { platform: "linux", arch: "x64", libcFamily: "glibc" };
|
|
34
|
+
|
|
35
|
+
// #when getting platform package
|
|
36
|
+
const result = getPlatformPackage(input);
|
|
37
|
+
|
|
38
|
+
// #then returns correct package name
|
|
39
|
+
expect(result).toBe("evil-omo-linux-x64");
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("returns linux-arm64 for Linux ARM64 with glibc", () => {
|
|
43
|
+
// #given Linux ARM64 with glibc
|
|
44
|
+
const input = { platform: "linux", arch: "arm64", libcFamily: "glibc" };
|
|
45
|
+
|
|
46
|
+
// #when getting platform package
|
|
47
|
+
const result = getPlatformPackage(input);
|
|
48
|
+
|
|
49
|
+
// #then returns correct package name
|
|
50
|
+
expect(result).toBe("evil-omo-linux-arm64");
|
|
51
|
+
});
|
|
52
|
+
// #endregion
|
|
53
|
+
|
|
54
|
+
// #region Linux musl platforms
|
|
55
|
+
test("returns linux-x64-musl for Alpine x64", () => {
|
|
56
|
+
// #given Linux x64 with musl (Alpine)
|
|
57
|
+
const input = { platform: "linux", arch: "x64", libcFamily: "musl" };
|
|
58
|
+
|
|
59
|
+
// #when getting platform package
|
|
60
|
+
const result = getPlatformPackage(input);
|
|
61
|
+
|
|
62
|
+
// #then returns correct package name with musl suffix
|
|
63
|
+
expect(result).toBe("evil-omo-linux-x64-musl");
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("returns linux-arm64-musl for Alpine ARM64", () => {
|
|
67
|
+
// #given Linux ARM64 with musl (Alpine)
|
|
68
|
+
const input = { platform: "linux", arch: "arm64", libcFamily: "musl" };
|
|
69
|
+
|
|
70
|
+
// #when getting platform package
|
|
71
|
+
const result = getPlatformPackage(input);
|
|
72
|
+
|
|
73
|
+
// #then returns correct package name with musl suffix
|
|
74
|
+
expect(result).toBe("evil-omo-linux-arm64-musl");
|
|
75
|
+
});
|
|
76
|
+
// #endregion
|
|
77
|
+
|
|
78
|
+
// #region Windows platform
|
|
79
|
+
test("returns windows-x64 for Windows", () => {
|
|
80
|
+
// #given Windows x64 platform (win32 is Node's platform name)
|
|
81
|
+
const input = { platform: "win32", arch: "x64" };
|
|
82
|
+
|
|
83
|
+
// #when getting platform package
|
|
84
|
+
const result = getPlatformPackage(input);
|
|
85
|
+
|
|
86
|
+
// #then returns correct package name with 'windows' not 'win32'
|
|
87
|
+
expect(result).toBe("evil-omo-windows-x64");
|
|
88
|
+
});
|
|
89
|
+
// #endregion
|
|
90
|
+
|
|
91
|
+
// #region Error cases
|
|
92
|
+
test("throws error for Linux with null libcFamily", () => {
|
|
93
|
+
// #given Linux platform with null libc detection
|
|
94
|
+
const input = { platform: "linux", arch: "x64", libcFamily: null };
|
|
95
|
+
|
|
96
|
+
// #when getting platform package
|
|
97
|
+
// #then throws descriptive error
|
|
98
|
+
expect(() => getPlatformPackage(input)).toThrow("Could not detect libc");
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test("throws error for Linux with undefined libcFamily", () => {
|
|
102
|
+
// #given Linux platform with undefined libc
|
|
103
|
+
const input = { platform: "linux", arch: "x64", libcFamily: undefined };
|
|
104
|
+
|
|
105
|
+
// #when getting platform package
|
|
106
|
+
// #then throws descriptive error
|
|
107
|
+
expect(() => getPlatformPackage(input)).toThrow("Could not detect libc");
|
|
108
|
+
});
|
|
109
|
+
// #endregion
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe("getBinaryPath", () => {
|
|
113
|
+
test("returns path without .exe for Unix platforms", () => {
|
|
114
|
+
// #given Unix platform package
|
|
115
|
+
const pkg = "evil-omo-darwin-arm64";
|
|
116
|
+
const platform = "darwin";
|
|
117
|
+
|
|
118
|
+
// #when getting binary path
|
|
119
|
+
const result = getBinaryPath(pkg, platform);
|
|
120
|
+
|
|
121
|
+
// #then returns path without extension
|
|
122
|
+
expect(result).toBe("evil-omo-darwin-arm64/bin/evil-omo");
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
test("returns path with .exe for Windows", () => {
|
|
126
|
+
// #given Windows platform package
|
|
127
|
+
const pkg = "evil-omo-windows-x64";
|
|
128
|
+
const platform = "win32";
|
|
129
|
+
|
|
130
|
+
// #when getting binary path
|
|
131
|
+
const result = getBinaryPath(pkg, platform);
|
|
132
|
+
|
|
133
|
+
// #then returns path with .exe extension
|
|
134
|
+
expect(result).toBe("evil-omo-windows-x64/bin/evil-omo.exe");
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test("returns path without .exe for Linux", () => {
|
|
138
|
+
// #given Linux platform package
|
|
139
|
+
const pkg = "evil-omo-linux-x64";
|
|
140
|
+
const platform = "linux";
|
|
141
|
+
|
|
142
|
+
// #when getting binary path
|
|
143
|
+
const result = getBinaryPath(pkg, platform);
|
|
144
|
+
|
|
145
|
+
// #then returns path without extension
|
|
146
|
+
expect(result).toBe("evil-omo-linux-x64/bin/evil-omo");
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
describe("getPlatformPackageCandidates", () => {
|
|
151
|
+
test("returns x64 and baseline candidates for Linux glibc", () => {
|
|
152
|
+
// #given Linux x64 with glibc
|
|
153
|
+
const input = { platform: "linux", arch: "x64", libcFamily: "glibc" };
|
|
154
|
+
|
|
155
|
+
// #when getting package candidates
|
|
156
|
+
const result = getPlatformPackageCandidates(input);
|
|
157
|
+
|
|
158
|
+
// #then returns modern first then baseline fallback
|
|
159
|
+
expect(result).toEqual([
|
|
160
|
+
"evil-omo-linux-x64",
|
|
161
|
+
"evil-omo-linux-x64-baseline",
|
|
162
|
+
]);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("returns x64 musl and baseline candidates for Linux musl", () => {
|
|
166
|
+
// #given Linux x64 with musl
|
|
167
|
+
const input = { platform: "linux", arch: "x64", libcFamily: "musl" };
|
|
168
|
+
|
|
169
|
+
// #when getting package candidates
|
|
170
|
+
const result = getPlatformPackageCandidates(input);
|
|
171
|
+
|
|
172
|
+
// #then returns musl modern first then musl baseline fallback
|
|
173
|
+
expect(result).toEqual([
|
|
174
|
+
"evil-omo-linux-x64-musl",
|
|
175
|
+
"evil-omo-linux-x64-musl-baseline",
|
|
176
|
+
]);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
test("returns baseline first when preferBaseline is true", () => {
|
|
180
|
+
// #given Windows x64 and baseline preference
|
|
181
|
+
const input = { platform: "win32", arch: "x64", preferBaseline: true };
|
|
182
|
+
|
|
183
|
+
// #when getting package candidates
|
|
184
|
+
const result = getPlatformPackageCandidates(input);
|
|
185
|
+
|
|
186
|
+
// #then baseline package is preferred first
|
|
187
|
+
expect(result).toEqual([
|
|
188
|
+
"evil-omo-windows-x64-baseline",
|
|
189
|
+
"evil-omo-windows-x64",
|
|
190
|
+
]);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
test("supports renamed package family via packageBaseName override", () => {
|
|
196
|
+
// #given Linux x64 with glibc and renamed package base
|
|
197
|
+
const input = { platform: "linux", arch: "x64", libcFamily: "glibc", packageBaseName: "oh-my-openagent" };
|
|
198
|
+
|
|
199
|
+
// #when getting package candidates
|
|
200
|
+
const result = getPlatformPackageCandidates(input);
|
|
201
|
+
|
|
202
|
+
// #then returns renamed package family candidates
|
|
203
|
+
expect(result).toEqual([
|
|
204
|
+
"oh-my-openagent-linux-x64",
|
|
205
|
+
"oh-my-openagent-linux-x64-baseline",
|
|
206
|
+
]);
|
|
207
|
+
});
|
|
208
|
+
test("returns only one candidate for ARM64", () => {
|
|
209
|
+
// #given non-x64 platform
|
|
210
|
+
const input = { platform: "linux", arch: "arm64", libcFamily: "glibc" };
|
|
211
|
+
|
|
212
|
+
// #when getting package candidates
|
|
213
|
+
const result = getPlatformPackageCandidates(input);
|
|
214
|
+
|
|
215
|
+
// #then baseline fallback is not included
|
|
216
|
+
expect(result).toEqual(["evil-omo-linux-arm64"]);
|
|
217
|
+
});
|
|
218
|
+
});
|