cerebras-cli 1.0.153 → 1.0.158

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.
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Cerebras CLI Bin Loader
4
+ *
5
+ * This script finds and executes the correct platform-specific binary.
6
+ */
7
+ const childProcess = require("child_process")
8
+ const fs = require("fs")
9
+ const path = require("path")
10
+ const os = require("os")
11
+
12
+ function run(target) {
13
+ const result = childProcess.spawnSync(target, process.argv.slice(2), { stdio: "inherit" })
14
+ if (result.error) {
15
+ console.error(result.error.message)
16
+ process.exit(1)
17
+ }
18
+ process.exit(typeof result.status === "number" ? result.status : 0)
19
+ }
20
+
21
+ // Allow override via environment variable
22
+ const envPath = process.env.CEREBRAS_CLI_BIN_PATH
23
+ if (envPath) run(envPath)
24
+
25
+ const scriptDir = path.dirname(fs.realpathSync(__filename))
26
+ const platformMap = { darwin: "darwin", linux: "linux", win32: "windows" }
27
+ const archMap = { x64: "x64", arm64: "arm64", arm: "arm" }
28
+ const base = "cerebras-cli-" + (platformMap[os.platform()] || os.platform()) + "-" + (archMap[os.arch()] || os.arch())
29
+ const binary = os.platform() === "win32" ? "cerebras-cli.exe" : "cerebras-cli"
30
+
31
+ function findBinary(startDir) {
32
+ let current = startDir
33
+ while (true) {
34
+ const modules = path.join(current, "node_modules")
35
+ if (fs.existsSync(modules)) {
36
+ for (const entry of fs.readdirSync(modules)) {
37
+ if (entry.startsWith(base)) {
38
+ const candidate = path.join(modules, entry, "bin", binary)
39
+ if (fs.existsSync(candidate)) return candidate
40
+ }
41
+ }
42
+ }
43
+ const parent = path.dirname(current)
44
+ if (parent === current) return
45
+ current = parent
46
+ }
47
+ }
48
+
49
+ const resolved = findBinary(scriptDir)
50
+ if (!resolved) {
51
+ console.error(`Cerebras CLI binary not found for ${base}`)
52
+ console.error(`Please ensure the correct platform package is installed.`)
53
+ console.error(`Expected: ${base}`)
54
+ process.exit(1)
55
+ }
56
+
57
+ run(resolved)
package/package.json CHANGED
@@ -1,99 +1,8 @@
1
1
  {
2
- "$schema": "https://json.schemastore.org/package.json",
3
- "version": "1.0.153",
4
2
  "name": "cerebras-cli",
5
- "description": "Cerebras Code CLI - The fastest AI coding assistant",
6
- "type": "module",
7
- "scripts": {
8
- "typecheck": "tsgo --noEmit",
9
- "test": "bun test",
10
- "build": "./script/build.ts",
11
- "dev": "bun run --conditions=browser ./src/index.ts"
12
- },
13
- "bin": {
14
- "cerebras-cli": "bin/cerebras-cli"
15
- },
16
- "optionalDependencies": {
17
- "cerebras-cli-darwin-arm64": "1.0.153"
18
- },
19
- "devDependencies": {
20
- "@babel/core": "7.28.4",
21
- "@octokit/webhooks-types": "7.6.1",
22
- "@parcel/watcher-darwin-arm64": "2.5.1",
23
- "@parcel/watcher-darwin-x64": "2.5.1",
24
- "@parcel/watcher-linux-arm64-glibc": "2.5.1",
25
- "@parcel/watcher-linux-arm64-musl": "2.5.1",
26
- "@parcel/watcher-linux-x64-glibc": "2.5.1",
27
- "@parcel/watcher-linux-x64-musl": "2.5.1",
28
- "@parcel/watcher-win32-x64": "2.5.1",
29
- "@standard-schema/spec": "1.0.0",
30
- "@tsconfig/bun": "1.0.9",
31
- "@types/babel__core": "7.20.5",
32
- "@types/bun": "1.3.3",
33
- "@types/turndown": "5.0.5",
34
- "@types/yargs": "17.0.33",
35
- "typescript": "5.8.2",
36
- "@typescript/native-preview": "7.0.0-dev.20251207.1",
37
- "vscode-languageserver-types": "3.17.5",
38
- "why-is-node-running": "3.2.2",
39
- "zod-to-json-schema": "3.24.5"
40
- },
41
- "dependencies": {
42
- "@actions/core": "1.11.1",
43
- "@actions/github": "6.0.1",
44
- "@agentclientprotocol/sdk": "0.5.1",
45
- "@ai-sdk/amazon-bedrock": "3.0.57",
46
- "@ai-sdk/anthropic": "2.0.50",
47
- "@ai-sdk/azure": "2.0.73",
48
- "@ai-sdk/google": "2.0.44",
49
- "@ai-sdk/google-vertex": "3.0.81",
50
- "@ai-sdk/mcp": "0.0.8",
51
- "@ai-sdk/openai": "2.0.71",
52
- "@ai-sdk/openai-compatible": "1.0.27",
53
- "@ai-sdk/provider": "2.0.0",
54
- "@ai-sdk/provider-utils": "3.0.18",
55
- "@clack/prompts": "1.0.0-alpha.1",
56
- "@hono/standard-validator": "0.1.5",
57
- "@hono/zod-validator": "0.4.2",
58
- "@modelcontextprotocol/sdk": "1.15.1",
59
- "@octokit/graphql": "9.0.2",
60
- "@octokit/rest": "22.0.0",
61
- "@openauthjs/openauth": "0.0.0-20250322224806",
62
- "@openrouter/ai-sdk-provider": "1.2.8",
63
- "@opentui/core": "0.1.59",
64
- "@opentui/solid": "0.1.59",
65
- "@parcel/watcher": "2.5.1",
66
- "@pierre/precision-diffs": "0.6.0-beta.10",
67
- "@solid-primitives/event-bus": "1.1.2",
68
- "@standard-schema/spec": "1.0.0",
69
- "@zip.js/zip.js": "2.7.62",
70
- "ai": "5.0.97",
71
- "bun-pty": "0.4.2",
72
- "chokidar": "4.0.3",
73
- "clipboardy": "4.0.0",
74
- "decimal.js": "10.5.0",
75
- "diff": "8.0.2",
76
- "fuzzysort": "3.1.0",
77
- "gray-matter": "4.0.3",
78
- "hono": "4.10.7",
79
- "hono-openapi": "1.1.2",
80
- "ignore": "7.0.5",
81
- "jsonc-parser": "3.3.1",
82
- "minimatch": "10.0.3",
83
- "open": "10.1.2",
84
- "opentui-spinner": "0.0.6",
85
- "partial-json": "0.1.7",
86
- "remeda": "2.26.0",
87
- "solid-js": "1.9.10",
88
- "strip-ansi": "7.1.2",
89
- "tree-sitter-bash": "0.25.0",
90
- "turndown": "7.2.0",
91
- "ulid": "3.0.1",
92
- "vscode-jsonrpc": "8.2.1",
93
- "web-tree-sitter": "0.25.10",
94
- "xdg-basedir": "5.1.0",
95
- "yargs": "18.0.0",
96
- "zod": "4.1.8",
97
- "zod-to-json-schema": "3.24.5"
98
- }
3
+ "version": "1.0.158",
4
+ "description": "The fastest AI coding assistant, powered by Cerebras inference",
5
+ "bin": { "cerebras-cli": "./bin/cerebras-cli.cjs" },
6
+ "optionalDependencies": { "cerebras-cli-darwin-arm64": "1.0.158" },
7
+ "license": "MIT"
99
8
  }
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Cerebras CLI Postinstall Script
4
+ *
5
+ * Creates symlinks to the platform-specific binary after npm install.
6
+ */
7
+
8
+ import fs from "fs"
9
+ import path from "path"
10
+ import os from "os"
11
+ import { fileURLToPath } from "url"
12
+ import { createRequire } from "module"
13
+
14
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
15
+ const require = createRequire(import.meta.url)
16
+
17
+ function detectPlatformAndArch() {
18
+ let platform
19
+ switch (os.platform()) {
20
+ case "darwin":
21
+ platform = "darwin"
22
+ break
23
+ case "linux":
24
+ platform = "linux"
25
+ break
26
+ case "win32":
27
+ platform = "windows"
28
+ break
29
+ default:
30
+ platform = os.platform()
31
+ break
32
+ }
33
+
34
+ let arch
35
+ switch (os.arch()) {
36
+ case "x64":
37
+ arch = "x64"
38
+ break
39
+ case "arm64":
40
+ arch = "arm64"
41
+ break
42
+ case "arm":
43
+ arch = "arm"
44
+ break
45
+ default:
46
+ arch = os.arch()
47
+ break
48
+ }
49
+
50
+ return { platform, arch }
51
+ }
52
+
53
+ function findBinary() {
54
+ const { platform, arch } = detectPlatformAndArch()
55
+ const packageName = `cerebras-cli-${platform}-${arch}`
56
+ const binaryName = platform === "windows" ? "cerebras-cli.exe" : "cerebras-cli"
57
+
58
+ try {
59
+ const packageJsonPath = require.resolve(`${packageName}/package.json`)
60
+ const packageDir = path.dirname(packageJsonPath)
61
+ const binaryPath = path.join(packageDir, "bin", binaryName)
62
+
63
+ if (!fs.existsSync(binaryPath)) {
64
+ throw new Error(`Binary not found at ${binaryPath}`)
65
+ }
66
+
67
+ return { binaryPath, binaryName }
68
+ } catch (error) {
69
+ throw new Error(`Could not find package ${packageName}: ${error.message}`)
70
+ }
71
+ }
72
+
73
+ function prepareBinDirectory(binaryName) {
74
+ const binDir = path.join(__dirname, "bin")
75
+ const targetPath = path.join(binDir, binaryName)
76
+
77
+ if (!fs.existsSync(binDir)) {
78
+ fs.mkdirSync(binDir, { recursive: true })
79
+ }
80
+
81
+ if (fs.existsSync(targetPath)) {
82
+ fs.unlinkSync(targetPath)
83
+ }
84
+
85
+ return { binDir, targetPath }
86
+ }
87
+
88
+ function symlinkBinary(sourcePath, binaryName) {
89
+ const { targetPath } = prepareBinDirectory(binaryName)
90
+
91
+ fs.symlinkSync(sourcePath, targetPath)
92
+ console.log(`cerebras-cli binary symlinked: ${targetPath} -> ${sourcePath}`)
93
+
94
+ if (!fs.existsSync(targetPath)) {
95
+ throw new Error(`Failed to symlink binary to ${targetPath}`)
96
+ }
97
+ }
98
+
99
+ async function main() {
100
+ try {
101
+ if (os.platform() === "win32") {
102
+ console.log("Windows detected: binary setup not needed (using packaged .exe)")
103
+ return
104
+ }
105
+
106
+ const { binaryPath, binaryName } = findBinary()
107
+ symlinkBinary(binaryPath, binaryName)
108
+ } catch (error) {
109
+ console.error("Failed to setup cerebras-cli binary:", error.message)
110
+ process.exit(1)
111
+ }
112
+ }
113
+
114
+ try {
115
+ main()
116
+ } catch (error) {
117
+ console.error("Postinstall script error:", error.message)
118
+ process.exit(0)
119
+ }
package/README.md DELETED
@@ -1,19 +0,0 @@
1
- # Cerebras Code CLI
2
-
3
- The fastest AI coding assistant, powered by Cerebras inference.
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm install -g cerebras-cli
9
- ```
10
-
11
- ## Run
12
-
13
- ```bash
14
- cerebras-cli
15
- ```
16
-
17
- ## Get Your API Key
18
-
19
- Get a free Cerebras API key at [cloud.cerebras.ai](https://cloud.cerebras.ai)
package/bin/cerebras-cli DELETED
@@ -1,86 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { spawnSync } from "child_process"
4
- import { existsSync, readdirSync, realpathSync } from "fs"
5
- import { dirname, join } from "path"
6
- import { platform as osPlatform, arch as osArch } from "os"
7
- import { fileURLToPath } from "url"
8
-
9
- function run(target) {
10
- const result = spawnSync(target, process.argv.slice(2), {
11
- stdio: "inherit",
12
- })
13
- if (result.error) {
14
- console.error(result.error.message)
15
- process.exit(1)
16
- }
17
- const code = typeof result.status === "number" ? result.status : 0
18
- process.exit(code)
19
- }
20
-
21
- const envPath = process.env.CEREBRAS_CLI_BIN_PATH || process.env.OPENCODE_BIN_PATH
22
- if (envPath) {
23
- run(envPath)
24
- }
25
-
26
- const __filename = fileURLToPath(import.meta.url)
27
- const scriptPath = realpathSync(__filename)
28
- const scriptDir = dirname(scriptPath)
29
-
30
- const platformMap = {
31
- darwin: "darwin",
32
- linux: "linux",
33
- win32: "windows",
34
- }
35
- const archMap = {
36
- x64: "x64",
37
- arm64: "arm64",
38
- arm: "arm",
39
- }
40
-
41
- let platform = platformMap[osPlatform()]
42
- if (!platform) {
43
- platform = osPlatform()
44
- }
45
- let arch = archMap[osArch()]
46
- if (!arch) {
47
- arch = osArch()
48
- }
49
- const base = "cerebras-cli-" + platform + "-" + arch
50
- const binary = platform === "windows" ? "cerebras-cli.exe" : "cerebras-cli"
51
-
52
- function findBinary(startDir) {
53
- let current = startDir
54
- for (;;) {
55
- const modules = join(current, "node_modules")
56
- if (existsSync(modules)) {
57
- const entries = readdirSync(modules)
58
- for (const entry of entries) {
59
- if (!entry.startsWith(base)) {
60
- continue
61
- }
62
- const candidate = join(modules, entry, "bin", binary)
63
- if (existsSync(candidate)) {
64
- return candidate
65
- }
66
- }
67
- }
68
- const parent = dirname(current)
69
- if (parent === current) {
70
- return
71
- }
72
- current = parent
73
- }
74
- }
75
-
76
- const resolved = findBinary(scriptDir)
77
- if (!resolved) {
78
- console.error(
79
- '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 "' +
80
- base +
81
- '" package',
82
- )
83
- process.exit(1)
84
- }
85
-
86
- run(resolved)