@me0wo/opencode 0.0.0-stage → 2.2.7-fork.s08f17465b6241cd6201379fcb5e83e09ee0a0850
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/cli.mjs +39 -0
- package/package.json +28 -4
- package/README.md +0 -3
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module"
|
|
3
|
+
import { spawn } from "node:child_process"
|
|
4
|
+
import { existsSync } from "node:fs"
|
|
5
|
+
import path from "node:path"
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url)
|
|
8
|
+
const target = `${process.platform === "win32" ? "windows" : process.platform}-${process.arch}`
|
|
9
|
+
let entry
|
|
10
|
+
try {
|
|
11
|
+
entry = path.join(path.dirname(require.resolve(`@me0wo/opencode-${target}/package.json`)), "opencode.mjs")
|
|
12
|
+
} catch {
|
|
13
|
+
console.error(`@me0wo/opencode: no bundle available for ${target}`)
|
|
14
|
+
process.exit(1)
|
|
15
|
+
}
|
|
16
|
+
// npm and bun install this file with the same node shebang, so bun's shim
|
|
17
|
+
// starts it under node too. Bun only links global packages under
|
|
18
|
+
// <prefix>/install/global, which tells a bun-installed copy to run its bundle
|
|
19
|
+
// with bun while npm-family installs keep the node that started the launcher.
|
|
20
|
+
const bun = /\/install\/global\/node_modules\//.test(import.meta.url)
|
|
21
|
+
const executable = bun ? bunExecutable() : process.execPath
|
|
22
|
+
const child = spawn(executable, [entry, ...process.argv.slice(2)], { stdio: "inherit" })
|
|
23
|
+
child.on("error", (error) => {
|
|
24
|
+
console.error(error.message)
|
|
25
|
+
process.exit(1)
|
|
26
|
+
})
|
|
27
|
+
child.on("exit", (code, signal) => {
|
|
28
|
+
if (signal) process.kill(process.pid, signal)
|
|
29
|
+
else process.exitCode = code ?? 1
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
function bunExecutable() {
|
|
33
|
+
const binary = process.platform === "win32" ? "bun.exe" : "bun"
|
|
34
|
+
if (process.env.BUN_INSTALL) {
|
|
35
|
+
const installed = path.join(process.env.BUN_INSTALL, "bin", binary)
|
|
36
|
+
if (existsSync(installed)) return installed
|
|
37
|
+
}
|
|
38
|
+
return "bun"
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@me0wo/opencode",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.2.7-fork.s08f17465b6241cd6201379fcb5e83e09ee0a0850",
|
|
4
|
+
"description": "OpenCode fork JS bundle",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"opencode-patcher": "bin/cli.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/"
|
|
11
|
+
],
|
|
12
|
+
"optionalDependencies": {
|
|
13
|
+
"@me0wo/opencode-linux-x64": "2.2.7-fork.s08f17465b6241cd6201379fcb5e83e09ee0a0850",
|
|
14
|
+
"@me0wo/opencode-linux-arm64": "2.2.7-fork.s08f17465b6241cd6201379fcb5e83e09ee0a0850",
|
|
15
|
+
"@me0wo/opencode-darwin-arm64": "2.2.7-fork.s08f17465b6241cd6201379fcb5e83e09ee0a0850",
|
|
16
|
+
"@me0wo/opencode-darwin-x64": "2.2.7-fork.s08f17465b6241cd6201379fcb5e83e09ee0a0850",
|
|
17
|
+
"@me0wo/opencode-windows-x64": "2.2.7-fork.s08f17465b6241cd6201379fcb5e83e09ee0a0850",
|
|
18
|
+
"@me0wo/opencode-windows-arm64": "2.2.7-fork.s08f17465b6241cd6201379fcb5e83e09ee0a0850"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=26"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/Sn0wo2/opencode.git"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/README.md
DELETED