slopcode 0.2.109 → 0.2.110
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/slopcode +4 -5
- package/package.json +12 -12
- package/postinstall.mjs +69 -10
package/bin/slopcode
CHANGED
|
@@ -206,13 +206,12 @@ function supportedMessage() {
|
|
|
206
206
|
|
|
207
207
|
function termuxMessage() {
|
|
208
208
|
return [
|
|
209
|
-
"SlopCode native Termux support
|
|
210
|
-
"
|
|
209
|
+
"SlopCode native Termux support could not find the Android runtime.",
|
|
210
|
+
"Reinstall from Termux with:",
|
|
211
211
|
" pkg update",
|
|
212
|
-
" pkg install nodejs git ripgrep neovim",
|
|
213
|
-
" npm install -g slopcode@latest",
|
|
214
|
-
"If npm skipped optional dependencies, rerun with:",
|
|
212
|
+
" pkg install nodejs git ripgrep neovim tar",
|
|
215
213
|
" npm install -g slopcode@latest --include=optional",
|
|
214
|
+
"If postinstall could not download the runtime, install the matching GitHub release asset manually.",
|
|
216
215
|
].join("\n")
|
|
217
216
|
}
|
|
218
217
|
|
package/package.json
CHANGED
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
36
36
|
},
|
|
37
|
-
"version": "0.2.
|
|
37
|
+
"version": "0.2.110",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"slopcode-bin-darwin-arm64": "0.2.
|
|
41
|
-
"slopcode-bin-linux-x64-baseline": "0.2.
|
|
42
|
-
"slopcode-bin-windows-x64": "0.2.
|
|
43
|
-
"slopcode-bin-linux-x64": "0.2.
|
|
44
|
-
"slopcode-bin-linux-x64-baseline-musl": "0.2.
|
|
45
|
-
"slopcode-bin-linux-x64-musl": "0.2.
|
|
46
|
-
"slopcode-bin-linux-arm64": "0.2.
|
|
47
|
-
"slopcode-bin-windows-x64-baseline": "0.2.
|
|
48
|
-
"slopcode-bin-linux-arm64-musl": "0.2.
|
|
49
|
-
"slopcode-bin-darwin-x64-baseline": "0.2.
|
|
50
|
-
"slopcode-bin-darwin-x64": "0.2.
|
|
40
|
+
"slopcode-bin-darwin-arm64": "0.2.110",
|
|
41
|
+
"slopcode-bin-linux-x64-baseline": "0.2.110",
|
|
42
|
+
"slopcode-bin-windows-x64": "0.2.110",
|
|
43
|
+
"slopcode-bin-linux-x64": "0.2.110",
|
|
44
|
+
"slopcode-bin-linux-x64-baseline-musl": "0.2.110",
|
|
45
|
+
"slopcode-bin-linux-x64-musl": "0.2.110",
|
|
46
|
+
"slopcode-bin-linux-arm64": "0.2.110",
|
|
47
|
+
"slopcode-bin-windows-x64-baseline": "0.2.110",
|
|
48
|
+
"slopcode-bin-linux-arm64-musl": "0.2.110",
|
|
49
|
+
"slopcode-bin-darwin-x64-baseline": "0.2.110",
|
|
50
|
+
"slopcode-bin-darwin-x64": "0.2.110"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -142,16 +142,69 @@ function supportedMessage() {
|
|
|
142
142
|
|
|
143
143
|
function termuxMessage() {
|
|
144
144
|
return [
|
|
145
|
-
"SlopCode native Termux support
|
|
146
|
-
"Install from Termux with
|
|
145
|
+
"SlopCode native Termux support could not install the Android runtime.",
|
|
146
|
+
"Install from Termux with:",
|
|
147
147
|
" pkg update",
|
|
148
|
-
" pkg install nodejs git ripgrep neovim",
|
|
149
|
-
" npm install -g slopcode@latest",
|
|
150
|
-
"If npm skipped optional dependencies, rerun with:",
|
|
148
|
+
" pkg install nodejs git ripgrep neovim tar",
|
|
151
149
|
" npm install -g slopcode@latest --include=optional",
|
|
150
|
+
"If that still fails, install the matching GitHub release asset manually.",
|
|
152
151
|
].join("\n")
|
|
153
152
|
}
|
|
154
153
|
|
|
154
|
+
function androidPackage(arch) {
|
|
155
|
+
return `@slopcode-ai/slopcode-android-${arch}`
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function androidTarget(arch) {
|
|
159
|
+
return path.join(__dirname, "node_modules", "@slopcode-ai", `slopcode-android-${arch}`)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function androidUrl(arch) {
|
|
163
|
+
return `https://github.com/teamslop/slopcode/releases/download/v${pkg.version}/slopcode-android-${arch}.tar.gz`
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function androidAsset(arch, tmp) {
|
|
167
|
+
if (process.env.SLOPCODE_ANDROID_ASSET_PATH) return process.env.SLOPCODE_ANDROID_ASSET_PATH
|
|
168
|
+
const out = path.join(tmp, `slopcode-android-${arch}.tar.gz`)
|
|
169
|
+
const res = await fetch(process.env.SLOPCODE_ANDROID_ASSET_URL || androidUrl(arch))
|
|
170
|
+
if (!res.ok) throw new Error(`Failed to download Android runtime: ${res.status} ${res.statusText}`)
|
|
171
|
+
await fs.promises.writeFile(out, Buffer.from(await res.arrayBuffer()))
|
|
172
|
+
return out
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
async function installAndroid(arch) {
|
|
176
|
+
const tmp = await fs.promises.mkdtemp(path.join(os.tmpdir(), "slopcode-android-"))
|
|
177
|
+
const target = androidTarget(arch)
|
|
178
|
+
try {
|
|
179
|
+
const archive = await androidAsset(arch, tmp)
|
|
180
|
+
const extract = path.join(tmp, "package")
|
|
181
|
+
await fs.promises.mkdir(extract, { recursive: true })
|
|
182
|
+
const result = require("child_process").spawnSync("tar", ["-xzf", archive, "-C", extract], {
|
|
183
|
+
encoding: "utf8",
|
|
184
|
+
timeout: 120000,
|
|
185
|
+
})
|
|
186
|
+
if (result.status !== 0) {
|
|
187
|
+
throw new Error((result.stderr || result.stdout || "tar failed").trim())
|
|
188
|
+
}
|
|
189
|
+
const binary = path.join(extract, "bin", "slopcode")
|
|
190
|
+
if (!fs.existsSync(binary)) throw new Error("Downloaded Android runtime is missing bin/slopcode")
|
|
191
|
+
await fs.promises.rm(target, { recursive: true, force: true })
|
|
192
|
+
await fs.promises.mkdir(path.dirname(target), { recursive: true })
|
|
193
|
+
await fs.promises.rename(extract, target)
|
|
194
|
+
fs.chmodSync(path.join(target, "bin", "slopcode"), 0o755)
|
|
195
|
+
return {
|
|
196
|
+
binaryPath: path.join(target, "bin", "slopcode"),
|
|
197
|
+
binaryName: "slopcode",
|
|
198
|
+
packageName: androidPackage(arch),
|
|
199
|
+
platform: "android",
|
|
200
|
+
arch,
|
|
201
|
+
libc: "bionic",
|
|
202
|
+
}
|
|
203
|
+
} finally {
|
|
204
|
+
await fs.promises.rm(tmp, { recursive: true, force: true })
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
155
208
|
function findBinary() {
|
|
156
209
|
const { platform, arch } = detectPlatformAndArch()
|
|
157
210
|
const binaryName = platform === "windows" ? "slopcode.exe" : "slopcode"
|
|
@@ -232,11 +285,17 @@ async function main() {
|
|
|
232
285
|
const found = findBinary()
|
|
233
286
|
if (!found) {
|
|
234
287
|
clearCache()
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
288
|
+
if (detectLibc(platform, arch) === "bionic") {
|
|
289
|
+
try {
|
|
290
|
+
await installAndroid(arch)
|
|
291
|
+
console.log("Android/Termux runtime installed from GitHub release asset")
|
|
292
|
+
} catch (error) {
|
|
293
|
+
console.log(termuxMessage())
|
|
294
|
+
console.error(error.message)
|
|
295
|
+
}
|
|
296
|
+
return
|
|
297
|
+
}
|
|
298
|
+
console.log("No platform binary package detected during postinstall; runtime resolver will handle it")
|
|
240
299
|
return
|
|
241
300
|
}
|
|
242
301
|
|