cerebras-cli 1.0.142 → 1.0.143

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.
Files changed (2) hide show
  1. package/bin/opencode +20 -17
  2. package/package.json +1 -1
package/bin/opencode CHANGED
@@ -1,12 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const childProcess = require("child_process")
4
- const fs = require("fs")
5
- const path = require("path")
6
- const os = require("os")
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
+ const __filename = fileURLToPath(import.meta.url)
7
10
 
8
11
  function run(target) {
9
- const result = childProcess.spawnSync(target, process.argv.slice(2), {
12
+ const result = spawnSync(target, process.argv.slice(2), {
10
13
  stdio: "inherit",
11
14
  })
12
15
  if (result.error) {
@@ -22,8 +25,8 @@ if (envPath) {
22
25
  run(envPath)
23
26
  }
24
27
 
25
- const scriptPath = fs.realpathSync(__filename)
26
- const scriptDir = path.dirname(scriptPath)
28
+ const scriptPath = realpathSync(__filename)
29
+ const scriptDir = dirname(scriptPath)
27
30
 
28
31
  const platformMap = {
29
32
  darwin: "darwin",
@@ -36,13 +39,13 @@ const archMap = {
36
39
  arm: "arm",
37
40
  }
38
41
 
39
- let platform = platformMap[os.platform()]
42
+ let platform = platformMap[osPlatform()]
40
43
  if (!platform) {
41
- platform = os.platform()
44
+ platform = osPlatform()
42
45
  }
43
- let arch = archMap[os.arch()]
46
+ let arch = archMap[osArch()]
44
47
  if (!arch) {
45
- arch = os.arch()
48
+ arch = osArch()
46
49
  }
47
50
  const base = "opencode-" + platform + "-" + arch
48
51
  const binary = platform === "windows" ? "opencode.exe" : "opencode"
@@ -50,20 +53,20 @@ const binary = platform === "windows" ? "opencode.exe" : "opencode"
50
53
  function findBinary(startDir) {
51
54
  let current = startDir
52
55
  for (;;) {
53
- const modules = path.join(current, "node_modules")
54
- if (fs.existsSync(modules)) {
55
- const entries = fs.readdirSync(modules)
56
+ const modules = join(current, "node_modules")
57
+ if (existsSync(modules)) {
58
+ const entries = readdirSync(modules)
56
59
  for (const entry of entries) {
57
60
  if (!entry.startsWith(base)) {
58
61
  continue
59
62
  }
60
- const candidate = path.join(modules, entry, "bin", binary)
61
- if (fs.existsSync(candidate)) {
63
+ const candidate = join(modules, entry, "bin", binary)
64
+ if (existsSync(candidate)) {
62
65
  return candidate
63
66
  }
64
67
  }
65
68
  }
66
- const parent = path.dirname(current)
69
+ const parent = dirname(current)
67
70
  if (parent === current) {
68
71
  return
69
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "1.0.142",
3
+ "version": "1.0.143",
4
4
  "name": "cerebras-cli",
5
5
  "type": "module",
6
6
  "scripts": {