opencode2 2.0.16
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/README.md +44 -0
- package/bin/opencode2.cjs +83 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# opencode2
|
|
2
|
+
|
|
3
|
+
OpenCode v2 CLI with prompt modes, code-review-graph auto-indexing, and the browser skill.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -g opencode2
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Node.js 18 or newer. The platform binary ships in `opencode2-linux-x64` and is pulled in
|
|
12
|
+
automatically as an optional dependency.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
opencode2 # interactive TUI
|
|
18
|
+
opencode2 --auto "prompt" # headless run with auto approvals
|
|
19
|
+
opencode2 --version # opencode v2.0.16
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What is added over stock OpenCode
|
|
23
|
+
|
|
24
|
+
- **Prompt modes** — `answer`, `implement`, `test`, `deploy`. Each mode attaches its own skill,
|
|
25
|
+
system reminder, sub-agents, and commands based on a deterministic classifier for the prompt.
|
|
26
|
+
- **code-review-graph** — the graph is built when a project opens and kept current while you work,
|
|
27
|
+
with the code-review-graph MCP server exposing its 30 tools.
|
|
28
|
+
- **browser skill** — materialized into the skill cache with the `bsk` helper binary.
|
|
29
|
+
|
|
30
|
+
## Platform support
|
|
31
|
+
|
|
32
|
+
| Package | Platform |
|
|
33
|
+
| ------------------------ | ---------------- |
|
|
34
|
+
| `opencode2-linux-x64` | Linux x64 (glibc) |
|
|
35
|
+
|
|
36
|
+
Other platforms are not published yet; build from source in the repository.
|
|
37
|
+
|
|
38
|
+
## Repository
|
|
39
|
+
|
|
40
|
+
https://github.com/game-libgdx-unity/opencode2
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT
|
|
@@ -0,0 +1,83 @@
|
|
|
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 =
|
|
9
|
+
process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGHUP"] : ["SIGINT", "SIGTERM", "SIGHUP", "SIGUSR1"]
|
|
10
|
+
|
|
11
|
+
function run(target) {
|
|
12
|
+
const child = childProcess.spawn(target, process.argv.slice(2), { stdio: "inherit" })
|
|
13
|
+
child.on("error", (error) => {
|
|
14
|
+
console.error(error.message)
|
|
15
|
+
process.exit(1)
|
|
16
|
+
})
|
|
17
|
+
const forwarders = {}
|
|
18
|
+
for (const signal of forwardedSignals) {
|
|
19
|
+
const forwarder = () => {
|
|
20
|
+
try {
|
|
21
|
+
child.kill(signal)
|
|
22
|
+
} catch {}
|
|
23
|
+
}
|
|
24
|
+
forwarders[signal] = forwarder
|
|
25
|
+
process.on(signal, forwarder)
|
|
26
|
+
}
|
|
27
|
+
child.on("exit", (code, signal) => {
|
|
28
|
+
for (const forwardedSignal of forwardedSignals) process.removeListener(forwardedSignal, forwarders[forwardedSignal])
|
|
29
|
+
if (signal) return process.kill(process.pid, signal)
|
|
30
|
+
process.exit(typeof code === "number" ? code : 0)
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const platform = { darwin: "darwin", linux: "linux", win32: "windows" }[os.platform()] || os.platform()
|
|
35
|
+
const arch = { x64: "x64", arm64: "arm64", arm: "arm" }[os.arch()] || os.arch()
|
|
36
|
+
const base = `opencode2-${platform}-${arch}`
|
|
37
|
+
const binary = platform === "windows" ? "opencode2.exe" : "opencode2"
|
|
38
|
+
|
|
39
|
+
function musl() {
|
|
40
|
+
if (platform !== "linux") return false
|
|
41
|
+
try {
|
|
42
|
+
if (fs.existsSync("/etc/alpine-release")) return true
|
|
43
|
+
const result = childProcess.spawnSync("ldd", "--version", { encoding: "utf8" })
|
|
44
|
+
return ((result.stdout || "") + (result.stderr || "")).toLowerCase().includes("musl")
|
|
45
|
+
} catch {
|
|
46
|
+
return false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const names = (() => {
|
|
51
|
+
if (platform === "linux") return musl() ? [`${base}-musl`, base] : [base, `${base}-musl`]
|
|
52
|
+
return [base]
|
|
53
|
+
})()
|
|
54
|
+
|
|
55
|
+
function findBinary(roots) {
|
|
56
|
+
for (const startDir of roots) {
|
|
57
|
+
let current = startDir
|
|
58
|
+
for (;;) {
|
|
59
|
+
const modules = path.join(current, "node_modules")
|
|
60
|
+
if (fs.existsSync(modules)) {
|
|
61
|
+
for (const name of names) {
|
|
62
|
+
const candidate = path.join(modules, name, "bin", binary)
|
|
63
|
+
if (fs.existsSync(candidate)) return candidate
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const parent = path.dirname(current)
|
|
67
|
+
if (parent === current) break
|
|
68
|
+
current = parent
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const scriptDir = path.dirname(fs.realpathSync(__filename))
|
|
74
|
+
const resolved = process.env.OPENCODE_BIN_PATH || findBinary([scriptDir, process.cwd()])
|
|
75
|
+
if (!resolved) {
|
|
76
|
+
console.error(
|
|
77
|
+
`opencode2 could not find its ${platform}-${arch} binary. Install it manually with:\n` +
|
|
78
|
+
names.map((name) => ` npm install -g ${name}`).join("\n") +
|
|
79
|
+
"\nor set OPENCODE_BIN_PATH to the binary location.",
|
|
80
|
+
)
|
|
81
|
+
process.exit(1)
|
|
82
|
+
}
|
|
83
|
+
run(resolved)
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode2",
|
|
3
|
+
"version": "2.0.16",
|
|
4
|
+
"description": "OpenCode v2 CLI with prompt modes, code-review-graph auto-indexing, and the browser skill",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/game-libgdx-unity/opencode2.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/game-libgdx-unity/opencode2#readme",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"opencode",
|
|
13
|
+
"ai",
|
|
14
|
+
"cli",
|
|
15
|
+
"coding-agent",
|
|
16
|
+
"agent"
|
|
17
|
+
],
|
|
18
|
+
"bin": {
|
|
19
|
+
"opencode2": "bin/opencode2.cjs"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"bin",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18"
|
|
27
|
+
},
|
|
28
|
+
"optionalDependencies": {
|
|
29
|
+
"opencode2-linux-x64": "2.0.16"
|
|
30
|
+
}
|
|
31
|
+
}
|