slopcode 0.2.106 → 0.2.109

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.
Files changed (3) hide show
  1. package/bin/slopcode +16 -16
  2. package/package.json +12 -12
  3. package/postinstall.mjs +20 -15
package/bin/slopcode CHANGED
@@ -40,6 +40,7 @@ const archMap = {
40
40
  arm: "arm",
41
41
  }
42
42
  const supported = {
43
+ android: ["arm64", "x64"],
43
44
  darwin: ["arm64", "x64"],
44
45
  linux: ["arm64", "x64"],
45
46
  windows: ["x64"],
@@ -136,9 +137,8 @@ function supportsAvx2() {
136
137
 
137
138
  function names(prefix) {
138
139
  const kind = libc()
139
- if (kind === "bionic") return []
140
-
141
- const base = `${prefix}-${platform}-${arch}`
140
+ const base = kind === "bionic" ? `${prefix}-android-${arch}` : `${prefix}-${platform}-${arch}`
141
+ if (kind === "bionic") return [`@slopcode-ai/slopcode-android-${arch}`, base]
142
142
  const avx2 = supportsAvx2()
143
143
  const baseline = arch === "x64" && !avx2
144
144
 
@@ -206,25 +206,21 @@ function supportedMessage() {
206
206
 
207
207
  function termuxMessage() {
208
208
  return [
209
- "SlopCode does not ship a native Android/Termux (bionic) binary yet.",
210
- "Run SlopCode inside a Termux proot Linux distro:",
211
- " pkg install proot-distro",
212
- " proot-distro install debian",
213
- " proot-distro login debian",
214
- " apt update && apt install -y curl ca-certificates git",
215
- " curl -fsSL https://slopcode.dev/install | bash",
209
+ "SlopCode native Termux support needs the Android runtime package.",
210
+ "Install from Termux with optional npm dependencies enabled:",
211
+ " pkg update",
212
+ " pkg install nodejs git ripgrep neovim",
213
+ " npm install -g slopcode@latest",
214
+ "If npm skipped optional dependencies, rerun with:",
215
+ " npm install -g slopcode@latest --include=optional",
216
216
  ].join("\n")
217
217
  }
218
218
 
219
- if (libc() === "bionic") {
220
- clearCache()
221
- console.error(termuxMessage())
222
- process.exit(1)
223
- }
219
+ const useCache = libc() !== "bionic"
224
220
 
225
221
  const packageNames = names("slopcode-bin")
226
222
  const resolvedNames = Array.from(new Set([...packageNames, ...names("slopcode")]))
227
- const hit = cacheReady(resolvedNames)
223
+ const hit = useCache ? cacheReady(resolvedNames) : undefined
228
224
  if (hit) {
229
225
  run(hit)
230
226
  }
@@ -268,6 +264,10 @@ function findBinary(startDir) {
268
264
 
269
265
  const resolved = resolveBinary() || findBinary(scriptDir)
270
266
  if (!resolved) {
267
+ if (libc() === "bionic") {
268
+ console.error(termuxMessage())
269
+ process.exit(1)
270
+ }
271
271
  console.error(
272
272
  "It seems that your package manager failed to install the right version of the slopcode CLI for your platform. You can try manually installing " +
273
273
  packageNames.map((n) => `\"${n}\"`).join(" or ") +
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.106",
37
+ "version": "0.2.109",
38
38
  "license": "MIT",
39
39
  "optionalDependencies": {
40
- "slopcode-bin-darwin-arm64": "0.2.106",
41
- "slopcode-bin-linux-x64-baseline": "0.2.106",
42
- "slopcode-bin-windows-x64": "0.2.106",
43
- "slopcode-bin-linux-x64": "0.2.106",
44
- "slopcode-bin-linux-x64-baseline-musl": "0.2.106",
45
- "slopcode-bin-linux-x64-musl": "0.2.106",
46
- "slopcode-bin-linux-arm64": "0.2.106",
47
- "slopcode-bin-windows-x64-baseline": "0.2.106",
48
- "slopcode-bin-linux-arm64-musl": "0.2.106",
49
- "slopcode-bin-darwin-x64-baseline": "0.2.106",
50
- "slopcode-bin-darwin-x64": "0.2.106"
40
+ "slopcode-bin-darwin-arm64": "0.2.109",
41
+ "slopcode-bin-linux-x64-baseline": "0.2.109",
42
+ "slopcode-bin-windows-x64": "0.2.109",
43
+ "slopcode-bin-linux-x64": "0.2.109",
44
+ "slopcode-bin-linux-x64-baseline-musl": "0.2.109",
45
+ "slopcode-bin-linux-x64-musl": "0.2.109",
46
+ "slopcode-bin-linux-arm64": "0.2.109",
47
+ "slopcode-bin-windows-x64-baseline": "0.2.109",
48
+ "slopcode-bin-linux-arm64-musl": "0.2.109",
49
+ "slopcode-bin-darwin-x64-baseline": "0.2.109",
50
+ "slopcode-bin-darwin-x64": "0.2.109"
51
51
  }
52
52
  }
package/postinstall.mjs CHANGED
@@ -10,6 +10,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
10
10
  const require = createRequire(import.meta.url)
11
11
  const pkg = require("./package.json")
12
12
  const supported = {
13
+ android: ["arm64", "x64"],
13
14
  darwin: ["arm64", "x64"],
14
15
  linux: ["arm64", "x64"],
15
16
  windows: ["x64"],
@@ -91,9 +92,9 @@ function supportsAvx2(platform, arch) {
91
92
  }
92
93
 
93
94
  function names(platform, arch) {
94
- const base = `slopcode-bin-${platform}-${arch}`
95
95
  const libc = detectLibc(platform, arch)
96
- if (libc === "bionic") return []
96
+ const base = `slopcode-bin-${libc === "bionic" ? "android" : platform}-${arch}`
97
+ if (libc === "bionic") return [`@slopcode-ai/slopcode-android-${arch}`, base, `slopcode-android-${arch}`]
97
98
  const avx2 = supportsAvx2(platform, arch)
98
99
  const baseline = arch === "x64" && !avx2
99
100
 
@@ -141,13 +142,13 @@ function supportedMessage() {
141
142
 
142
143
  function termuxMessage() {
143
144
  return [
144
- "SlopCode does not ship a native Android/Termux (bionic) binary yet.",
145
- "Run SlopCode inside a Termux proot Linux distro:",
146
- " pkg install proot-distro",
147
- " proot-distro install debian",
148
- " proot-distro login debian",
149
- " apt update && apt install -y curl ca-certificates git",
150
- " curl -fsSL https://slopcode.dev/install | bash",
145
+ "SlopCode native Termux support needs the Android runtime package.",
146
+ "Install from Termux with optional npm dependencies enabled:",
147
+ " pkg update",
148
+ " pkg install nodejs git ripgrep neovim",
149
+ " npm install -g slopcode@latest",
150
+ "If npm skipped optional dependencies, rerun with:",
151
+ " npm install -g slopcode@latest --include=optional",
151
152
  ].join("\n")
152
153
  }
153
154
 
@@ -214,11 +215,6 @@ function writeMeta(input) {
214
215
  async function main() {
215
216
  try {
216
217
  const { platform, arch } = detectPlatformAndArch()
217
- if (detectLibc(platform, arch) === "bionic") {
218
- clearCache()
219
- console.log(termuxMessage())
220
- return
221
- }
222
218
 
223
219
  if (!(supported[platform] ?? []).includes(arch)) {
224
220
  clearCache()
@@ -236,10 +232,19 @@ async function main() {
236
232
  const found = findBinary()
237
233
  if (!found) {
238
234
  clearCache()
239
- console.log("No platform binary package detected during postinstall; runtime resolver will handle it")
235
+ console.log(
236
+ detectLibc(platform, arch) === "bionic"
237
+ ? termuxMessage()
238
+ : "No platform binary package detected during postinstall; runtime resolver will handle it",
239
+ )
240
240
  return
241
241
  }
242
242
 
243
+ if (found.libc === "bionic") {
244
+ clearCache()
245
+ console.log("Android/Termux runtime package detected; runtime resolver will launch it")
246
+ return
247
+ }
243
248
  clearCache()
244
249
  const target = path.join(__dirname, "bin", ".slopcode")
245
250
  const { targetPath } = prepareBinDirectory(".slopcode")