@me0wo/opencode 2.2.6 → 2.2.7-fork.s3d3310fe6e229caca5cf3b58dfe023f6ca671eee
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 +24 -4
- package/package.json +24 -11
- package/README.md +0 -12
package/bin/cli.mjs
CHANGED
|
@@ -1,19 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module"
|
|
3
3
|
import { spawn } from "node:child_process"
|
|
4
|
+
import { existsSync } from "node:fs"
|
|
4
5
|
import path from "node:path"
|
|
5
6
|
|
|
6
7
|
const require = createRequire(import.meta.url)
|
|
7
|
-
const
|
|
8
|
+
const target = `${process.platform === "win32" ? "windows" : process.platform}-${process.arch}`
|
|
8
9
|
let entry
|
|
9
10
|
try {
|
|
10
|
-
entry = path.join(path.dirname(require.resolve(`@me0wo/opencode-${
|
|
11
|
+
entry = path.join(path.dirname(require.resolve(`@me0wo/opencode-${target}/package.json`)), "opencode.mjs")
|
|
11
12
|
} catch {
|
|
12
|
-
console.error(`@me0wo/opencode: no bundle available for ${
|
|
13
|
+
console.error(`@me0wo/opencode: no bundle available for ${target}`)
|
|
13
14
|
process.exit(1)
|
|
14
15
|
}
|
|
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
|
+
})
|
|
16
27
|
child.on("exit", (code, signal) => {
|
|
17
28
|
if (signal) process.kill(process.pid, signal)
|
|
18
29
|
else process.exitCode = code ?? 1
|
|
19
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,17 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@me0wo/opencode",
|
|
3
|
-
"version": "2.2.
|
|
4
|
-
"description": "OpenCode
|
|
3
|
+
"version": "2.2.7-fork.s3d3310fe6e229caca5cf3b58dfe023f6ca671eee",
|
|
4
|
+
"description": "OpenCode fork JS bundle",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"bin": {
|
|
7
|
-
|
|
6
|
+
"bin": {
|
|
7
|
+
"opencode-patcher": "bin/cli.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/"
|
|
11
|
+
],
|
|
8
12
|
"optionalDependencies": {
|
|
9
|
-
"@me0wo/opencode-linux-x64": "2.2.
|
|
10
|
-
"@me0wo/opencode-
|
|
11
|
-
"@me0wo/opencode-
|
|
13
|
+
"@me0wo/opencode-linux-x64": "2.2.7-fork.s3d3310fe6e229caca5cf3b58dfe023f6ca671eee",
|
|
14
|
+
"@me0wo/opencode-linux-arm64": "2.2.7-fork.s3d3310fe6e229caca5cf3b58dfe023f6ca671eee",
|
|
15
|
+
"@me0wo/opencode-darwin-arm64": "2.2.7-fork.s3d3310fe6e229caca5cf3b58dfe023f6ca671eee",
|
|
16
|
+
"@me0wo/opencode-darwin-x64": "2.2.7-fork.s3d3310fe6e229caca5cf3b58dfe023f6ca671eee",
|
|
17
|
+
"@me0wo/opencode-windows-x64": "2.2.7-fork.s3d3310fe6e229caca5cf3b58dfe023f6ca671eee",
|
|
18
|
+
"@me0wo/opencode-windows-arm64": "2.2.7-fork.s3d3310fe6e229caca5cf3b58dfe023f6ca671eee"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=26"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/Sn0wo2/opencode.git"
|
|
12
26
|
},
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"publishConfig": { "access": "public" }
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
17
30
|
}
|
package/README.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# @me0wo/opencode
|
|
2
|
-
|
|
3
|
-
Unofficial npm distribution of the [OpenCode V2](https://github.com/anomalyco/opencode) JS bundle, built from upstream stable release tags by [Sn0wo2/opencode-dist](https://github.com/Sn0wo2/opencode-dist).
|
|
4
|
-
|
|
5
|
-
No runtime is embedded; the launcher runs the platform bundle with your own Node (>= 26) or bun (>= 1.4.4).
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
npm i -g @me0wo/opencode
|
|
9
|
-
opencode-node --version
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
The platform bundle (`@me0wo/opencode-linux-x64`, `@me0wo/opencode-darwin-arm64`, or `@me0wo/opencode-windows-x64`) is selected automatically via optionalDependencies and ships `opencode.mjs` plus its native assets (pty, file watching, web UI). Run `bunx opencode-node` to execute the bundle with bun instead of Node.
|