goatchain-cli 0.0.9-beta.9 → 0.0.10
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/goatchain.mjs +183 -0
- package/dist/ink.mjs +1307 -0
- package/package.json +13 -9
- package/bin/goatchain +0 -79
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goatchain-cli",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "AI coding agent CLI
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.10",
|
|
4
|
+
"description": "dimcode - AI coding agent CLI",
|
|
5
|
+
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"goatchain": "./bin/goatchain"
|
|
7
|
+
"goatchain": "./bin/goatchain.mjs"
|
|
8
8
|
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
9
13
|
"optionalDependencies": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
14
|
+
"dimcode-darwin-arm64": "0.0.10",
|
|
15
|
+
"dimcode-darwin-x64": "0.0.10",
|
|
16
|
+
"dimcode-linux-arm64": "0.0.10",
|
|
17
|
+
"dimcode-linux-x64": "0.0.10",
|
|
18
|
+
"dimcode-windows-x64": "0.0.10"
|
|
15
19
|
}
|
|
16
20
|
}
|
package/bin/goatchain
DELETED
|
@@ -1,79 +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
|
-
let wrapperVersion = ""
|
|
9
|
-
try {
|
|
10
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"))
|
|
11
|
-
wrapperVersion = pkg.version || ""
|
|
12
|
-
} catch (_) {}
|
|
13
|
-
|
|
14
|
-
const wrapperDir = path.join(__dirname, "..").replace(/\\/g, "/").toLowerCase()
|
|
15
|
-
const wrapperPm = (wrapperDir.includes(".bun/") || wrapperDir.includes("bun/install/")) ? "bun" : "npm"
|
|
16
|
-
|
|
17
|
-
function run(target) {
|
|
18
|
-
const env = { ...process.env, DIMCODE_NPM_PACKAGE: "goatchain-cli", DIMCODE_NPM_PACKAGE_MANAGER: wrapperPm }
|
|
19
|
-
if (wrapperVersion) env.DIMCODE_NPM_PACKAGE_VERSION = wrapperVersion
|
|
20
|
-
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
21
|
-
stdio: "inherit",
|
|
22
|
-
cwd: process.cwd(),
|
|
23
|
-
env,
|
|
24
|
-
})
|
|
25
|
-
if (result.error) {
|
|
26
|
-
console.error(result.error.message)
|
|
27
|
-
process.exit(1)
|
|
28
|
-
}
|
|
29
|
-
process.exit(typeof result.status === "number" ? result.status : 0)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const envPath = process.env.DIMCODE_BIN_PATH
|
|
33
|
-
if (envPath) {
|
|
34
|
-
run(envPath)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const scriptPath = fs.realpathSync(__filename)
|
|
38
|
-
const scriptDir = path.dirname(scriptPath)
|
|
39
|
-
|
|
40
|
-
const platformMap = {
|
|
41
|
-
darwin: "darwin",
|
|
42
|
-
linux: "linux",
|
|
43
|
-
win32: "windows",
|
|
44
|
-
}
|
|
45
|
-
const archMap = {
|
|
46
|
-
x64: "x64",
|
|
47
|
-
arm64: "arm64",
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
let platform = platformMap[os.platform()] || os.platform()
|
|
51
|
-
let arch = archMap[os.arch()] || os.arch()
|
|
52
|
-
|
|
53
|
-
const base = "goatchain-cli-" + platform + "-" + arch
|
|
54
|
-
const binary = platform === "windows" ? "goatchain.exe" : "goatchain"
|
|
55
|
-
|
|
56
|
-
function findBinary(startDir) {
|
|
57
|
-
let current = startDir
|
|
58
|
-
for (;;) {
|
|
59
|
-
const modules = path.join(current, "node_modules")
|
|
60
|
-
if (fs.existsSync(modules)) {
|
|
61
|
-
const candidate = path.join(modules, base, "bin", binary)
|
|
62
|
-
if (fs.existsSync(candidate)) return candidate
|
|
63
|
-
}
|
|
64
|
-
const parent = path.dirname(current)
|
|
65
|
-
if (parent === current) return
|
|
66
|
-
current = parent
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const resolved = findBinary(scriptDir)
|
|
71
|
-
if (!resolved) {
|
|
72
|
-
console.error(
|
|
73
|
-
`It seems that your package manager failed to install the right binary package for your platform.\n` +
|
|
74
|
-
`You can try manually installing the "${base}" package.`
|
|
75
|
-
)
|
|
76
|
-
process.exit(1)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
run(resolved)
|