@chinaresoft/resoftcode 0.1.0 → 0.1.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/package.json +13 -2
- package/bin/bin/kilo +0 -251
- package/bin/bin/resoft +0 -257
- package/chinaresoft-resoftcode-0.1.0.tgz +0 -0
package/package.json
CHANGED
|
@@ -9,10 +9,21 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.1.
|
|
12
|
+
"version": "0.1.1",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"optionalDependencies": {
|
|
15
|
-
"@chinaresoft/resoftcode-darwin-
|
|
15
|
+
"@chinaresoft/resoftcode-darwin-x64-baseline": "0.1.1",
|
|
16
|
+
"@chinaresoft/resoftcode-linux-x64-musl": "0.1.1",
|
|
17
|
+
"@chinaresoft/resoftcode-linux-x64": "0.1.1",
|
|
18
|
+
"@chinaresoft/resoftcode-windows-x64-baseline": "0.1.1",
|
|
19
|
+
"@chinaresoft/resoftcode-linux-x64-baseline": "0.1.1",
|
|
20
|
+
"@chinaresoft/resoftcode-linux-arm64-musl": "0.1.1",
|
|
21
|
+
"@chinaresoft/resoftcode-linux-x64-baseline-musl": "0.1.1",
|
|
22
|
+
"@chinaresoft/resoftcode-linux-arm64": "0.1.1",
|
|
23
|
+
"@chinaresoft/resoftcode-darwin-arm64": "0.1.1",
|
|
24
|
+
"@chinaresoft/resoftcode-windows-x64": "0.1.1",
|
|
25
|
+
"@chinaresoft/resoftcode-windows-arm64": "0.1.1",
|
|
26
|
+
"@chinaresoft/resoftcode-darwin-x64": "0.1.1"
|
|
16
27
|
},
|
|
17
28
|
"repository": {
|
|
18
29
|
"type": "git",
|
package/bin/bin/kilo
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const childProcess = require("child_process")
|
|
4
|
-
const fs = require("fs")
|
|
5
|
-
const path = require("path")
|
|
6
|
-
const os = require("os")
|
|
7
|
-
|
|
8
|
-
const forwardedSignals = ["SIGINT", "SIGTERM", "SIGHUP"]
|
|
9
|
-
|
|
10
|
-
// kilocode_change start - point packaged binaries at co-located tree-sitter WASM resources
|
|
11
|
-
function configureTreeSitterResources(target) {
|
|
12
|
-
const wasmDir = path.join(path.dirname(target), "tree-sitter")
|
|
13
|
-
if (!process.env.KILO_TREE_SITTER_WASM_DIR && fs.existsSync(path.join(wasmDir, "tree-sitter.wasm"))) {
|
|
14
|
-
process.env.KILO_TREE_SITTER_WASM_DIR = wasmDir
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
// kilocode_change end
|
|
18
|
-
|
|
19
|
-
function run(target, fallback) {
|
|
20
|
-
// kilocode_change - preserve cached binary fallback
|
|
21
|
-
configureTreeSitterResources(target) // kilocode_change
|
|
22
|
-
// kilocode_change start - fall through if the cached binary cannot be spawned
|
|
23
|
-
const child = (() => {
|
|
24
|
-
try {
|
|
25
|
-
return childProcess.spawn(target, process.argv.slice(2), {
|
|
26
|
-
stdio: "inherit",
|
|
27
|
-
})
|
|
28
|
-
} catch (error) {
|
|
29
|
-
if (fallback) {
|
|
30
|
-
run(fallback)
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
console.error(error.message)
|
|
34
|
-
process.exit(1)
|
|
35
|
-
}
|
|
36
|
-
})()
|
|
37
|
-
if (!child) return
|
|
38
|
-
// kilocode_change end
|
|
39
|
-
|
|
40
|
-
const forwarders = {}
|
|
41
|
-
const clear = () => {
|
|
42
|
-
// kilocode_change - remove listeners before cached binary fallback
|
|
43
|
-
for (const signal of forwardedSignals) {
|
|
44
|
-
process.removeListener(signal, forwarders[signal])
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
child.on("error", (error) => {
|
|
49
|
-
clear() // kilocode_change
|
|
50
|
-
// kilocode_change start - fall through to findBinary() if cached binary fails
|
|
51
|
-
if (fallback) {
|
|
52
|
-
run(fallback)
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
// kilocode_change end
|
|
56
|
-
console.error(error.message)
|
|
57
|
-
process.exit(1)
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
for (const signal of forwardedSignals) {
|
|
61
|
-
forwarders[signal] = () => {
|
|
62
|
-
try {
|
|
63
|
-
child.kill(signal)
|
|
64
|
-
} catch {
|
|
65
|
-
// The child may have already exited.
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
process.on(signal, forwarders[signal])
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
child.on("exit", (code, signal) => {
|
|
72
|
-
clear() // kilocode_change
|
|
73
|
-
|
|
74
|
-
if (signal) {
|
|
75
|
-
process.kill(process.pid, signal)
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
process.exit(typeof code === "number" ? code : 0)
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const envPath = process.env.KILO_BIN_PATH
|
|
84
|
-
|
|
85
|
-
const scriptPath = fs.realpathSync(__filename)
|
|
86
|
-
const scriptDir = path.dirname(scriptPath)
|
|
87
|
-
|
|
88
|
-
const cached = path.join(scriptDir, ".kilo")
|
|
89
|
-
|
|
90
|
-
const platformMap = {
|
|
91
|
-
darwin: "darwin",
|
|
92
|
-
linux: "linux",
|
|
93
|
-
win32: "windows",
|
|
94
|
-
}
|
|
95
|
-
const archMap = {
|
|
96
|
-
x64: "x64",
|
|
97
|
-
arm64: "arm64",
|
|
98
|
-
arm: "arm",
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
let platform = platformMap[os.platform()]
|
|
102
|
-
if (!platform) {
|
|
103
|
-
platform = os.platform()
|
|
104
|
-
}
|
|
105
|
-
let arch = archMap[os.arch()]
|
|
106
|
-
if (!arch) {
|
|
107
|
-
arch = os.arch()
|
|
108
|
-
}
|
|
109
|
-
// resoft_change start - canonical China Resoft scope with legacy fallbacks
|
|
110
|
-
const base = "@chinaresoft/resoftcode-" + platform + "-" + arch
|
|
111
|
-
const scopeBase = "@chinaresoft/cli-" + platform + "-" + arch
|
|
112
|
-
const priorBase = "@resoft/cli-" + platform + "-" + arch
|
|
113
|
-
const legacyBase = "@kilocode/cli-" + platform + "-" + arch
|
|
114
|
-
// resoft_change end
|
|
115
|
-
// resoft_change start - prefer resoft binary, fall back to legacy kilo
|
|
116
|
-
const primaryBinary = platform === "windows" ? "resoftcode.exe" : "resoftcode"
|
|
117
|
-
const scopeBinary = platform === "windows" ? "resoft.exe" : "resoft"
|
|
118
|
-
const legacyBinary = platform === "windows" ? "kilo.exe" : "kilo"
|
|
119
|
-
// resoft_change end
|
|
120
|
-
|
|
121
|
-
function supportsAvx2() {
|
|
122
|
-
if (arch !== "x64") return false
|
|
123
|
-
|
|
124
|
-
if (platform === "linux") {
|
|
125
|
-
try {
|
|
126
|
-
return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
|
|
127
|
-
} catch {
|
|
128
|
-
return false
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (platform === "darwin") {
|
|
133
|
-
try {
|
|
134
|
-
const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
|
|
135
|
-
encoding: "utf8",
|
|
136
|
-
timeout: 1500,
|
|
137
|
-
})
|
|
138
|
-
if (result.status !== 0) return false
|
|
139
|
-
return (result.stdout || "").trim() === "1"
|
|
140
|
-
} catch {
|
|
141
|
-
return false
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (platform === "windows") {
|
|
146
|
-
const cmd =
|
|
147
|
-
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
148
|
-
|
|
149
|
-
for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
150
|
-
try {
|
|
151
|
-
const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
|
|
152
|
-
encoding: "utf8",
|
|
153
|
-
timeout: 3000,
|
|
154
|
-
windowsHide: true,
|
|
155
|
-
})
|
|
156
|
-
if (result.status !== 0) continue
|
|
157
|
-
const out = (result.stdout || "").trim().toLowerCase()
|
|
158
|
-
if (out === "true" || out === "1") return true
|
|
159
|
-
if (out === "false" || out === "0") return false
|
|
160
|
-
} catch {
|
|
161
|
-
continue
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return false
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return false
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const names = (() => {
|
|
172
|
-
// resoft_change start - prefer @chinaresoft/resoftcode-* and keep prior scopes as fallbacks
|
|
173
|
-
const expand = (prefix) => {
|
|
174
|
-
const avx2 = supportsAvx2()
|
|
175
|
-
const baseline = arch === "x64" && !avx2
|
|
176
|
-
|
|
177
|
-
if (platform === "linux") {
|
|
178
|
-
const musl = (() => {
|
|
179
|
-
try {
|
|
180
|
-
if (fs.existsSync("/etc/alpine-release")) return true
|
|
181
|
-
} catch {
|
|
182
|
-
// ignore
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
try {
|
|
186
|
-
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
187
|
-
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
188
|
-
if (text.includes("musl")) return true
|
|
189
|
-
} catch {
|
|
190
|
-
// ignore
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
return false
|
|
194
|
-
})()
|
|
195
|
-
|
|
196
|
-
if (musl) {
|
|
197
|
-
if (arch === "x64") {
|
|
198
|
-
if (baseline) return [`${prefix}-baseline-musl`, `${prefix}-musl`, `${prefix}-baseline`, prefix]
|
|
199
|
-
return [`${prefix}-musl`, `${prefix}-baseline-musl`, prefix, `${prefix}-baseline`]
|
|
200
|
-
}
|
|
201
|
-
return [`${prefix}-musl`, prefix]
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (arch === "x64") {
|
|
205
|
-
if (baseline) return [`${prefix}-baseline`, prefix, `${prefix}-baseline-musl`, `${prefix}-musl`]
|
|
206
|
-
return [prefix, `${prefix}-baseline`, `${prefix}-musl`, `${prefix}-baseline-musl`]
|
|
207
|
-
}
|
|
208
|
-
return [prefix, `${prefix}-musl`]
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (arch === "x64") {
|
|
212
|
-
if (baseline) return [`${prefix}-baseline`, prefix]
|
|
213
|
-
return [prefix, `${prefix}-baseline`]
|
|
214
|
-
}
|
|
215
|
-
return [prefix]
|
|
216
|
-
}
|
|
217
|
-
return [...expand(base), ...expand(scopeBase), ...expand(priorBase), ...expand(legacyBase)]
|
|
218
|
-
// resoft_change end
|
|
219
|
-
})()
|
|
220
|
-
|
|
221
|
-
function findBinary(startDir) {
|
|
222
|
-
let current = startDir
|
|
223
|
-
for (;;) {
|
|
224
|
-
const modules = path.join(current, "node_modules")
|
|
225
|
-
if (fs.existsSync(modules)) {
|
|
226
|
-
for (const name of names) {
|
|
227
|
-
for (const binaryName of [primaryBinary, scopeBinary, legacyBinary]) {
|
|
228
|
-
const candidate = path.join(modules, name, "bin", binaryName)
|
|
229
|
-
if (fs.existsSync(candidate)) return candidate
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
const parent = path.dirname(current)
|
|
234
|
-
if (parent === current) {
|
|
235
|
-
return
|
|
236
|
-
}
|
|
237
|
-
current = parent
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const resolved = envPath || (fs.existsSync(cached) ? cached : findBinary(scriptDir))
|
|
242
|
-
if (!resolved) {
|
|
243
|
-
console.error(
|
|
244
|
-
"It seems that your package manager failed to install the right version of the Resoft CLI for your platform. You can try manually installing " +
|
|
245
|
-
names.map((n) => `\"${n}\"`).join(" or ") +
|
|
246
|
-
" package",
|
|
247
|
-
)
|
|
248
|
-
process.exit(1)
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
run(resolved, resolved === cached ? findBinary(scriptDir) : undefined) // kilocode_change - preserve cached binary fallback
|
package/bin/bin/resoft
DELETED
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const childProcess = require("child_process")
|
|
4
|
-
const fs = require("fs")
|
|
5
|
-
const path = require("path")
|
|
6
|
-
const os = require("os")
|
|
7
|
-
|
|
8
|
-
const forwardedSignals = ["SIGINT", "SIGTERM", "SIGHUP"]
|
|
9
|
-
|
|
10
|
-
process.env.RESOFT_CLI = "1"
|
|
11
|
-
|
|
12
|
-
// kilocode_change start - point packaged binaries at co-located tree-sitter WASM resources
|
|
13
|
-
function configureTreeSitterResources(target) {
|
|
14
|
-
const wasmDir = path.join(path.dirname(target), "tree-sitter")
|
|
15
|
-
if (!process.env.KILO_TREE_SITTER_WASM_DIR && fs.existsSync(path.join(wasmDir, "tree-sitter.wasm"))) {
|
|
16
|
-
process.env.KILO_TREE_SITTER_WASM_DIR = wasmDir
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
// kilocode_change end
|
|
20
|
-
|
|
21
|
-
function run(target, fallback) {
|
|
22
|
-
// kilocode_change - preserve cached binary fallback
|
|
23
|
-
configureTreeSitterResources(target) // kilocode_change
|
|
24
|
-
// kilocode_change start - fall through if the cached binary cannot be spawned
|
|
25
|
-
const child = (() => {
|
|
26
|
-
try {
|
|
27
|
-
return childProcess.spawn(target, process.argv.slice(2), {
|
|
28
|
-
stdio: "inherit",
|
|
29
|
-
})
|
|
30
|
-
} catch (error) {
|
|
31
|
-
if (fallback) {
|
|
32
|
-
run(fallback)
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
console.error(error.message)
|
|
36
|
-
process.exit(1)
|
|
37
|
-
}
|
|
38
|
-
})()
|
|
39
|
-
if (!child) return
|
|
40
|
-
// kilocode_change end
|
|
41
|
-
|
|
42
|
-
const forwarders = {}
|
|
43
|
-
const clear = () => {
|
|
44
|
-
// kilocode_change - remove listeners before cached binary fallback
|
|
45
|
-
for (const signal of forwardedSignals) {
|
|
46
|
-
process.removeListener(signal, forwarders[signal])
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
child.on("error", (error) => {
|
|
51
|
-
clear() // kilocode_change
|
|
52
|
-
// kilocode_change start - fall through to findBinary() if cached binary fails
|
|
53
|
-
if (fallback) {
|
|
54
|
-
run(fallback)
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
// kilocode_change end
|
|
58
|
-
console.error(error.message)
|
|
59
|
-
process.exit(1)
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
for (const signal of forwardedSignals) {
|
|
63
|
-
forwarders[signal] = () => {
|
|
64
|
-
try {
|
|
65
|
-
child.kill(signal)
|
|
66
|
-
} catch {
|
|
67
|
-
// The child may have already exited.
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
process.on(signal, forwarders[signal])
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
child.on("exit", (code, signal) => {
|
|
74
|
-
clear() // kilocode_change
|
|
75
|
-
|
|
76
|
-
if (signal) {
|
|
77
|
-
process.kill(process.pid, signal)
|
|
78
|
-
return
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
process.exit(typeof code === "number" ? code : 0)
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const envPath = process.env.KILO_BIN_PATH
|
|
86
|
-
|
|
87
|
-
const scriptPath = fs.realpathSync(__filename)
|
|
88
|
-
const scriptDir = path.dirname(scriptPath)
|
|
89
|
-
|
|
90
|
-
// resoft_change start - prefer the Resoft cache link and retain the Kilo link as fallback
|
|
91
|
-
const cached = path.join(scriptDir, ".resoft")
|
|
92
|
-
const legacyCached = path.join(scriptDir, ".kilo")
|
|
93
|
-
// resoft_change end
|
|
94
|
-
|
|
95
|
-
const platformMap = {
|
|
96
|
-
darwin: "darwin",
|
|
97
|
-
linux: "linux",
|
|
98
|
-
win32: "windows",
|
|
99
|
-
}
|
|
100
|
-
const archMap = {
|
|
101
|
-
x64: "x64",
|
|
102
|
-
arm64: "arm64",
|
|
103
|
-
arm: "arm",
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
let platform = platformMap[os.platform()]
|
|
107
|
-
if (!platform) {
|
|
108
|
-
platform = os.platform()
|
|
109
|
-
}
|
|
110
|
-
let arch = archMap[os.arch()]
|
|
111
|
-
if (!arch) {
|
|
112
|
-
arch = os.arch()
|
|
113
|
-
}
|
|
114
|
-
// resoft_change start - canonical China Resoft scope with legacy fallbacks
|
|
115
|
-
const base = "@chinaresoft/resoftcode-" + platform + "-" + arch
|
|
116
|
-
const scopeBase = "@chinaresoft/cli-" + platform + "-" + arch
|
|
117
|
-
const priorBase = "@resoft/cli-" + platform + "-" + arch
|
|
118
|
-
const legacyBase = "@kilocode/cli-" + platform + "-" + arch
|
|
119
|
-
// resoft_change end
|
|
120
|
-
// resoft_change start - prefer resoft binary, fall back to legacy kilo
|
|
121
|
-
const primaryBinary = platform === "windows" ? "resoftcode.exe" : "resoftcode"
|
|
122
|
-
const scopeBinary = platform === "windows" ? "resoft.exe" : "resoft"
|
|
123
|
-
const legacyBinary = platform === "windows" ? "kilo.exe" : "kilo"
|
|
124
|
-
// resoft_change end
|
|
125
|
-
|
|
126
|
-
function supportsAvx2() {
|
|
127
|
-
if (arch !== "x64") return false
|
|
128
|
-
|
|
129
|
-
if (platform === "linux") {
|
|
130
|
-
try {
|
|
131
|
-
return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
|
|
132
|
-
} catch {
|
|
133
|
-
return false
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (platform === "darwin") {
|
|
138
|
-
try {
|
|
139
|
-
const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
|
|
140
|
-
encoding: "utf8",
|
|
141
|
-
timeout: 1500,
|
|
142
|
-
})
|
|
143
|
-
if (result.status !== 0) return false
|
|
144
|
-
return (result.stdout || "").trim() === "1"
|
|
145
|
-
} catch {
|
|
146
|
-
return false
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (platform === "windows") {
|
|
151
|
-
const cmd =
|
|
152
|
-
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
153
|
-
|
|
154
|
-
for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
155
|
-
try {
|
|
156
|
-
const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
|
|
157
|
-
encoding: "utf8",
|
|
158
|
-
timeout: 3000,
|
|
159
|
-
windowsHide: true,
|
|
160
|
-
})
|
|
161
|
-
if (result.status !== 0) continue
|
|
162
|
-
const out = (result.stdout || "").trim().toLowerCase()
|
|
163
|
-
if (out === "true" || out === "1") return true
|
|
164
|
-
if (out === "false" || out === "0") return false
|
|
165
|
-
} catch {
|
|
166
|
-
continue
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return false
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return false
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const names = (() => {
|
|
177
|
-
// resoft_change start - prefer @chinaresoft/resoftcode-* and keep prior scopes as fallbacks
|
|
178
|
-
const expand = (prefix) => {
|
|
179
|
-
const avx2 = supportsAvx2()
|
|
180
|
-
const baseline = arch === "x64" && !avx2
|
|
181
|
-
|
|
182
|
-
if (platform === "linux") {
|
|
183
|
-
const musl = (() => {
|
|
184
|
-
try {
|
|
185
|
-
if (fs.existsSync("/etc/alpine-release")) return true
|
|
186
|
-
} catch {
|
|
187
|
-
// ignore
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
try {
|
|
191
|
-
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
192
|
-
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
193
|
-
if (text.includes("musl")) return true
|
|
194
|
-
} catch {
|
|
195
|
-
// ignore
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return false
|
|
199
|
-
})()
|
|
200
|
-
|
|
201
|
-
if (musl) {
|
|
202
|
-
if (arch === "x64") {
|
|
203
|
-
if (baseline) return [`${prefix}-baseline-musl`, `${prefix}-musl`, `${prefix}-baseline`, prefix]
|
|
204
|
-
return [`${prefix}-musl`, `${prefix}-baseline-musl`, prefix, `${prefix}-baseline`]
|
|
205
|
-
}
|
|
206
|
-
return [`${prefix}-musl`, prefix]
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (arch === "x64") {
|
|
210
|
-
if (baseline) return [`${prefix}-baseline`, prefix, `${prefix}-baseline-musl`, `${prefix}-musl`]
|
|
211
|
-
return [prefix, `${prefix}-baseline`, `${prefix}-musl`, `${prefix}-baseline-musl`]
|
|
212
|
-
}
|
|
213
|
-
return [prefix, `${prefix}-musl`]
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (arch === "x64") {
|
|
217
|
-
if (baseline) return [`${prefix}-baseline`, prefix]
|
|
218
|
-
return [prefix, `${prefix}-baseline`]
|
|
219
|
-
}
|
|
220
|
-
return [prefix]
|
|
221
|
-
}
|
|
222
|
-
return [...expand(base), ...expand(scopeBase), ...expand(priorBase), ...expand(legacyBase)]
|
|
223
|
-
// resoft_change end
|
|
224
|
-
})()
|
|
225
|
-
|
|
226
|
-
function findBinary(startDir) {
|
|
227
|
-
let current = startDir
|
|
228
|
-
for (;;) {
|
|
229
|
-
const modules = path.join(current, "node_modules")
|
|
230
|
-
if (fs.existsSync(modules)) {
|
|
231
|
-
for (const name of names) {
|
|
232
|
-
for (const binaryName of [primaryBinary, scopeBinary, legacyBinary]) {
|
|
233
|
-
const candidate = path.join(modules, name, "bin", binaryName)
|
|
234
|
-
if (fs.existsSync(candidate)) return candidate
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
const parent = path.dirname(current)
|
|
239
|
-
if (parent === current) {
|
|
240
|
-
return
|
|
241
|
-
}
|
|
242
|
-
current = parent
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const resolved =
|
|
247
|
-
envPath || (fs.existsSync(cached) ? cached : fs.existsSync(legacyCached) ? legacyCached : findBinary(scriptDir))
|
|
248
|
-
if (!resolved) {
|
|
249
|
-
console.error(
|
|
250
|
-
"It seems that your package manager failed to install the right version of the Resoft CLI for your platform. You can try manually installing " +
|
|
251
|
-
names.map((n) => `\"${n}\"`).join(" or ") +
|
|
252
|
-
" package",
|
|
253
|
-
)
|
|
254
|
-
process.exit(1)
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
run(resolved, resolved === cached || resolved === legacyCached ? findBinary(scriptDir) : undefined) // kilocode_change - preserve cached binary fallback
|
|
File without changes
|