cerebras-cli-test 0.0.1
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 +3 -0
- package/bin/cerebras-cli-test.cjs +39 -0
- package/package.json +12 -0
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
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 scriptDir = path.dirname(fs.realpathSync(__filename))
|
|
14
|
+
const platformMap = { darwin: "darwin", linux: "linux", win32: "windows" }
|
|
15
|
+
const archMap = { x64: "x64", arm64: "arm64" }
|
|
16
|
+
const base = "cerebras-cli-test-" + (platformMap[os.platform()] || os.platform()) + "-" + (archMap[os.arch()] || os.arch())
|
|
17
|
+
const binary = os.platform() === "win32" ? "cerebras-cli-test.exe" : "cerebras-cli-test"
|
|
18
|
+
|
|
19
|
+
function findBinary(startDir) {
|
|
20
|
+
let current = startDir
|
|
21
|
+
while (true) {
|
|
22
|
+
const modules = path.join(current, "node_modules")
|
|
23
|
+
if (fs.existsSync(modules)) {
|
|
24
|
+
for (const entry of fs.readdirSync(modules)) {
|
|
25
|
+
if (entry.startsWith(base)) {
|
|
26
|
+
const candidate = path.join(modules, entry, "bin", binary)
|
|
27
|
+
if (fs.existsSync(candidate)) return candidate
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const parent = path.dirname(current)
|
|
32
|
+
if (parent === current) return
|
|
33
|
+
current = parent
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const resolved = findBinary(scriptDir)
|
|
38
|
+
if (!resolved) { console.error("Binary not found for " + base); process.exit(1) }
|
|
39
|
+
run(resolved)
|
package/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cerebras-cli-test",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "TEST PACKAGE - Cerebras CLI testing",
|
|
5
|
+
"bin": {
|
|
6
|
+
"cerebras-cli-test": "./bin/cerebras-cli-test.cjs"
|
|
7
|
+
},
|
|
8
|
+
"optionalDependencies": {
|
|
9
|
+
"cerebras-cli-test-darwin-arm64": "0.0.1"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT"
|
|
12
|
+
}
|