cerebras-cli 1.1.63 → 1.1.64

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/opencode ADDED
@@ -0,0 +1,84 @@
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
+ function run(target) {
9
+ const result = childProcess.spawnSync(target, process.argv.slice(2), {
10
+ stdio: "inherit",
11
+ })
12
+ if (result.error) {
13
+ console.error(result.error.message)
14
+ process.exit(1)
15
+ }
16
+ const code = typeof result.status === "number" ? result.status : 0
17
+ process.exit(code)
18
+ }
19
+
20
+ const envPath = process.env.OPENCODE_BIN_PATH
21
+ if (envPath) {
22
+ run(envPath)
23
+ }
24
+
25
+ const scriptPath = fs.realpathSync(__filename)
26
+ const scriptDir = path.dirname(scriptPath)
27
+
28
+ const platformMap = {
29
+ darwin: "darwin",
30
+ linux: "linux",
31
+ win32: "windows",
32
+ }
33
+ const archMap = {
34
+ x64: "x64",
35
+ arm64: "arm64",
36
+ arm: "arm",
37
+ }
38
+
39
+ let platform = platformMap[os.platform()]
40
+ if (!platform) {
41
+ platform = os.platform()
42
+ }
43
+ let arch = archMap[os.arch()]
44
+ if (!arch) {
45
+ arch = os.arch()
46
+ }
47
+ const base = "cerebras-cli-" + platform + "-" + arch
48
+ const binary = platform === "windows" ? "opencode.exe" : "opencode"
49
+
50
+ function findBinary(startDir) {
51
+ let current = startDir
52
+ for (;;) {
53
+ const modules = path.join(current, "node_modules")
54
+ if (fs.existsSync(modules)) {
55
+ const entries = fs.readdirSync(modules)
56
+ for (const entry of entries) {
57
+ if (!entry.startsWith(base)) {
58
+ continue
59
+ }
60
+ const candidate = path.join(modules, entry, "bin", binary)
61
+ if (fs.existsSync(candidate)) {
62
+ return candidate
63
+ }
64
+ }
65
+ }
66
+ const parent = path.dirname(current)
67
+ if (parent === current) {
68
+ return
69
+ }
70
+ current = parent
71
+ }
72
+ }
73
+
74
+ const resolved = findBinary(scriptDir)
75
+ if (!resolved) {
76
+ console.error(
77
+ 'It seems that your package manager failed to install the right version of the opencode CLI for your platform. You can try manually installing the "' +
78
+ base +
79
+ '" package',
80
+ )
81
+ process.exit(1)
82
+ }
83
+
84
+ run(resolved)
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ const childProcess = require("child_process")
3
+ const fs = require("fs")
4
+ const path = require("path")
5
+ const os = require("os")
6
+
7
+ function run(target) {
8
+ const result = childProcess.spawnSync(target, process.argv.slice(2), { stdio: "inherit" })
9
+ if (result.error) { console.error(result.error.message); process.exit(1) }
10
+ process.exit(typeof result.status === "number" ? result.status : 0)
11
+ }
12
+
13
+ const envPath = process.env.CEREBRAS_CLI_BIN_PATH || process.env.OPENCODE_BIN_PATH
14
+ if (envPath) run(envPath)
15
+
16
+ const scriptDir = path.dirname(fs.realpathSync(__filename))
17
+ const base = "cerebras-cli-" + ({"darwin":"darwin","linux":"linux","win32":"windows"}[os.platform()] || os.platform()) + "-" + ({"x64":"x64","arm64":"arm64","arm":"arm"}[os.arch()] || os.arch())
18
+ const binary = os.platform() === "win32" ? "cerebras-cli.exe" : "cerebras-cli"
19
+
20
+ function findBinary(startDir) {
21
+ let current = startDir
22
+ while (true) {
23
+ const modules = path.join(current, "node_modules")
24
+ if (fs.existsSync(modules)) {
25
+ for (const entry of fs.readdirSync(modules)) {
26
+ if (entry.startsWith(base)) {
27
+ const candidate = path.join(modules, entry, "bin", binary)
28
+ if (fs.existsSync(candidate)) return candidate
29
+ }
30
+ }
31
+ }
32
+ const parent = path.dirname(current)
33
+ if (parent === current) return
34
+ current = parent
35
+ }
36
+ }
37
+
38
+ const resolved = findBinary(scriptDir)
39
+ if (!resolved) { console.error("Binary not found for " + base); process.exit(1) }
40
+ run(resolved)
package/package.json CHANGED
@@ -1 +1,19 @@
1
- {"name":"cerebras-cli","bin":{"cerebras-cli":"./bin/cerebras"},"scripts":{"postinstall":"bun ./postinstall.mjs || node ./postinstall.mjs"},"version":"1.1.63","license":"MIT","optionalDependencies":{"cerebras-cli-darwin-arm64":"1.1.63"}}
1
+ {
2
+ "name": "cerebras-cli",
3
+ "version": "1.1.64",
4
+ "description": "Cerebras AI coding agent for the terminal",
5
+ "bin": {
6
+ "cerebras-cli": "./bin/opencode",
7
+ "opencode": "./bin/opencode"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
11
+ },
12
+ "optionalDependencies": {
13
+ "cerebras-cli-darwin-arm64": "1.1.64",
14
+ "cerebras-cli-darwin-x64": "1.1.64",
15
+ "cerebras-cli-linux-arm64": "1.1.64",
16
+ "cerebras-cli-linux-x64": "1.1.64"
17
+ },
18
+ "license": "MIT"
19
+ }
package/postinstall.mjs CHANGED
@@ -50,7 +50,7 @@ function detectPlatformAndArch() {
50
50
  function findBinary() {
51
51
  const { platform, arch } = detectPlatformAndArch()
52
52
  const packageName = `cerebras-cli-${platform}-${arch}`
53
- const binaryName = platform === "windows" ? "cerebras.exe" : "cerebras"
53
+ const binaryName = platform === "windows" ? "opencode.exe" : "opencode"
54
54
 
55
55
  try {
56
56
  // Use require.resolve to find the package
@@ -89,7 +89,7 @@ function symlinkBinary(sourcePath, binaryName) {
89
89
  const { targetPath } = prepareBinDirectory(binaryName)
90
90
 
91
91
  fs.symlinkSync(sourcePath, targetPath)
92
- console.log(`cerebras-cli binary symlinked: ${targetPath} -> ${sourcePath}`)
92
+ console.log(`opencode binary symlinked: ${targetPath} -> ${sourcePath}`)
93
93
 
94
94
  // Verify the file exists after operation
95
95
  if (!fs.existsSync(targetPath)) {
@@ -106,13 +106,10 @@ async function main() {
106
106
  return
107
107
  }
108
108
 
109
- // On non-Windows platforms, just verify the binary package exists
110
- // Don't replace the wrapper script - it handles binary execution
111
- const { binaryPath } = findBinary()
112
- console.log(`Platform binary verified at: ${binaryPath}`)
113
- console.log("Wrapper script will handle binary execution")
109
+ const { binaryPath, binaryName } = findBinary()
110
+ symlinkBinary(binaryPath, binaryName)
114
111
  } catch (error) {
115
- console.error("Failed to setup cerebras-cli binary:", error.message)
112
+ console.error("Failed to setup opencode binary:", error.message)
116
113
  process.exit(1)
117
114
  }
118
115
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 opencode
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/bin/bin/cerebras DELETED
@@ -1,173 +0,0 @@
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
- function run(target) {
9
- const result = childProcess.spawnSync(target, process.argv.slice(2), {
10
- stdio: "inherit",
11
- })
12
- if (result.error) {
13
- console.error(result.error.message)
14
- process.exit(1)
15
- }
16
- const code = typeof result.status === "number" ? result.status : 0
17
- process.exit(code)
18
- }
19
-
20
- const envPath = process.env.CEREBRAS_BIN_PATH
21
- if (envPath) {
22
- run(envPath)
23
- }
24
-
25
- const scriptPath = fs.realpathSync(__filename)
26
- const scriptDir = path.dirname(scriptPath)
27
-
28
- const platformMap = {
29
- darwin: "darwin",
30
- linux: "linux",
31
- win32: "windows",
32
- }
33
- const archMap = {
34
- x64: "x64",
35
- arm64: "arm64",
36
- arm: "arm",
37
- }
38
-
39
- let platform = platformMap[os.platform()]
40
- if (!platform) {
41
- platform = os.platform()
42
- }
43
- let arch = archMap[os.arch()]
44
- if (!arch) {
45
- arch = os.arch()
46
- }
47
- const base = "cerebras-cli-" + platform + "-" + arch
48
- const binary = platform === "windows" ? "cerebras.exe" : "cerebras"
49
-
50
- function supportsAvx2() {
51
- if (arch !== "x64") return false
52
-
53
- if (platform === "linux") {
54
- try {
55
- return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
56
- } catch {
57
- return false
58
- }
59
- }
60
-
61
- if (platform === "darwin") {
62
- try {
63
- const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
64
- encoding: "utf8",
65
- timeout: 1500,
66
- })
67
- if (result.status !== 0) return false
68
- return (result.stdout || "").trim() === "1"
69
- } catch {
70
- return false
71
- }
72
- }
73
-
74
- if (platform === "windows") {
75
- const cmd =
76
- '(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
77
-
78
- for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
79
- try {
80
- const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
81
- encoding: "utf8",
82
- timeout: 3000,
83
- windowsHide: true,
84
- })
85
- if (result.status !== 0) continue
86
- const out = (result.stdout || "").trim().toLowerCase()
87
- if (out === "true" || out === "1") return true
88
- if (out === "false" || out === "0") return false
89
- } catch {
90
- continue
91
- }
92
- }
93
-
94
- return false
95
- }
96
-
97
- return false
98
- }
99
-
100
- const names = (() => {
101
- const avx2 = supportsAvx2()
102
- const baseline = arch === "x64" && !avx2
103
-
104
- if (platform === "linux") {
105
- const musl = (() => {
106
- try {
107
- if (fs.existsSync("/etc/alpine-release")) return true
108
- } catch {
109
- // ignore
110
- }
111
-
112
- try {
113
- const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
114
- const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
115
- if (text.includes("musl")) return true
116
- } catch {
117
- // ignore
118
- }
119
-
120
- return false
121
- })()
122
-
123
- if (musl) {
124
- if (arch === "x64") {
125
- if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
126
- return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
127
- }
128
- return [`${base}-musl`, base]
129
- }
130
-
131
- if (arch === "x64") {
132
- if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
133
- return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
134
- }
135
- return [base, `${base}-musl`]
136
- }
137
-
138
- if (arch === "x64") {
139
- if (baseline) return [`${base}-baseline`, base]
140
- return [base, `${base}-baseline`]
141
- }
142
- return [base]
143
- })()
144
-
145
- function findBinary(startDir) {
146
- let current = startDir
147
- for (;;) {
148
- const modules = path.join(current, "node_modules")
149
- if (fs.existsSync(modules)) {
150
- for (const name of names) {
151
- const candidate = path.join(modules, name, "bin", binary)
152
- if (fs.existsSync(candidate)) return candidate
153
- }
154
- }
155
- const parent = path.dirname(current)
156
- if (parent === current) {
157
- return
158
- }
159
- current = parent
160
- }
161
- }
162
-
163
- const resolved = findBinary(scriptDir)
164
- if (!resolved) {
165
- console.error(
166
- 'It seems that your package manager failed to install the right version of the cerebras CLI for your platform. You can try manually installing the "' +
167
- base +
168
- '" package',
169
- )
170
- process.exit(1)
171
- }
172
-
173
- run(resolved)
package/bin/cerebras DELETED
@@ -1,173 +0,0 @@
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
- function run(target) {
9
- const result = childProcess.spawnSync(target, process.argv.slice(2), {
10
- stdio: "inherit",
11
- })
12
- if (result.error) {
13
- console.error(result.error.message)
14
- process.exit(1)
15
- }
16
- const code = typeof result.status === "number" ? result.status : 0
17
- process.exit(code)
18
- }
19
-
20
- const envPath = process.env.CEREBRAS_BIN_PATH
21
- if (envPath) {
22
- run(envPath)
23
- }
24
-
25
- const scriptPath = fs.realpathSync(__filename)
26
- const scriptDir = path.dirname(scriptPath)
27
-
28
- const platformMap = {
29
- darwin: "darwin",
30
- linux: "linux",
31
- win32: "windows",
32
- }
33
- const archMap = {
34
- x64: "x64",
35
- arm64: "arm64",
36
- arm: "arm",
37
- }
38
-
39
- let platform = platformMap[os.platform()]
40
- if (!platform) {
41
- platform = os.platform()
42
- }
43
- let arch = archMap[os.arch()]
44
- if (!arch) {
45
- arch = os.arch()
46
- }
47
- const base = "cerebras-cli-" + platform + "-" + arch
48
- const binary = platform === "windows" ? "cerebras.exe" : "cerebras"
49
-
50
- function supportsAvx2() {
51
- if (arch !== "x64") return false
52
-
53
- if (platform === "linux") {
54
- try {
55
- return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
56
- } catch {
57
- return false
58
- }
59
- }
60
-
61
- if (platform === "darwin") {
62
- try {
63
- const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], {
64
- encoding: "utf8",
65
- timeout: 1500,
66
- })
67
- if (result.status !== 0) return false
68
- return (result.stdout || "").trim() === "1"
69
- } catch {
70
- return false
71
- }
72
- }
73
-
74
- if (platform === "windows") {
75
- const cmd =
76
- '(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
77
-
78
- for (const exe of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
79
- try {
80
- const result = childProcess.spawnSync(exe, ["-NoProfile", "-NonInteractive", "-Command", cmd], {
81
- encoding: "utf8",
82
- timeout: 3000,
83
- windowsHide: true,
84
- })
85
- if (result.status !== 0) continue
86
- const out = (result.stdout || "").trim().toLowerCase()
87
- if (out === "true" || out === "1") return true
88
- if (out === "false" || out === "0") return false
89
- } catch {
90
- continue
91
- }
92
- }
93
-
94
- return false
95
- }
96
-
97
- return false
98
- }
99
-
100
- const names = (() => {
101
- const avx2 = supportsAvx2()
102
- const baseline = arch === "x64" && !avx2
103
-
104
- if (platform === "linux") {
105
- const musl = (() => {
106
- try {
107
- if (fs.existsSync("/etc/alpine-release")) return true
108
- } catch {
109
- // ignore
110
- }
111
-
112
- try {
113
- const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
114
- const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
115
- if (text.includes("musl")) return true
116
- } catch {
117
- // ignore
118
- }
119
-
120
- return false
121
- })()
122
-
123
- if (musl) {
124
- if (arch === "x64") {
125
- if (baseline) return [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
126
- return [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
127
- }
128
- return [`${base}-musl`, base]
129
- }
130
-
131
- if (arch === "x64") {
132
- if (baseline) return [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
133
- return [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
134
- }
135
- return [base, `${base}-musl`]
136
- }
137
-
138
- if (arch === "x64") {
139
- if (baseline) return [`${base}-baseline`, base]
140
- return [base, `${base}-baseline`]
141
- }
142
- return [base]
143
- })()
144
-
145
- function findBinary(startDir) {
146
- let current = startDir
147
- for (;;) {
148
- const modules = path.join(current, "node_modules")
149
- if (fs.existsSync(modules)) {
150
- for (const name of names) {
151
- const candidate = path.join(modules, name, "bin", binary)
152
- if (fs.existsSync(candidate)) return candidate
153
- }
154
- }
155
- const parent = path.dirname(current)
156
- if (parent === current) {
157
- return
158
- }
159
- current = parent
160
- }
161
- }
162
-
163
- const resolved = findBinary(scriptDir)
164
- if (!resolved) {
165
- console.error(
166
- 'It seems that your package manager failed to install the right version of the cerebras CLI for your platform. You can try manually installing the "' +
167
- base +
168
- '" package',
169
- )
170
- process.exit(1)
171
- }
172
-
173
- run(resolved)