goatchain-cli 0.0.8-beta.8 → 0.0.9-beta.11
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 +42 -3
- package/package.json +6 -9
- package/postinstall.mjs +0 -37
package/bin/goatchain
CHANGED
|
@@ -5,6 +5,8 @@ const fs = require("fs")
|
|
|
5
5
|
const path = require("path")
|
|
6
6
|
const os = require("os")
|
|
7
7
|
|
|
8
|
+
const isWindows = os.platform() === "win32"
|
|
9
|
+
|
|
8
10
|
let wrapperVersion = ""
|
|
9
11
|
try {
|
|
10
12
|
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"))
|
|
@@ -21,16 +23,35 @@ function run(target) {
|
|
|
21
23
|
stdio: "inherit",
|
|
22
24
|
cwd: process.cwd(),
|
|
23
25
|
env,
|
|
26
|
+
// On Windows, ensure the child process is spawned in the same console
|
|
27
|
+
windowsHide: false,
|
|
24
28
|
})
|
|
25
29
|
if (result.error) {
|
|
26
|
-
console.error(result.error.message)
|
|
30
|
+
console.error("[goatchain] Failed to start binary: " + result.error.message)
|
|
31
|
+
if (isWindows) {
|
|
32
|
+
console.error("[goatchain] Binary path: " + target)
|
|
33
|
+
console.error("[goatchain] Ensure the binary exists and is executable.")
|
|
34
|
+
if (result.error.code === "ENOENT") {
|
|
35
|
+
console.error("[goatchain] The binary file was not found. Try reinstalling:")
|
|
36
|
+
console.error(" npm uninstall -g goatchain-cli && npm install -g goatchain-cli")
|
|
37
|
+
}
|
|
38
|
+
}
|
|
27
39
|
process.exit(1)
|
|
28
40
|
}
|
|
41
|
+
if (result.status !== 0 && result.status !== null) {
|
|
42
|
+
if (process.env.DIMCODE_DEBUG) {
|
|
43
|
+
console.error("[goatchain] Binary exited with code: " + result.status)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
29
46
|
process.exit(typeof result.status === "number" ? result.status : 0)
|
|
30
47
|
}
|
|
31
48
|
|
|
32
49
|
const envPath = process.env.DIMCODE_BIN_PATH
|
|
33
50
|
if (envPath) {
|
|
51
|
+
if (!fs.existsSync(envPath)) {
|
|
52
|
+
console.error("[goatchain] DIMCODE_BIN_PATH is set but file not found: " + envPath)
|
|
53
|
+
process.exit(1)
|
|
54
|
+
}
|
|
34
55
|
run(envPath)
|
|
35
56
|
}
|
|
36
57
|
|
|
@@ -67,13 +88,31 @@ function findBinary(startDir) {
|
|
|
67
88
|
}
|
|
68
89
|
}
|
|
69
90
|
|
|
91
|
+
if (process.env.DIMCODE_DEBUG) {
|
|
92
|
+
console.error("[goatchain] Wrapper version: " + wrapperVersion)
|
|
93
|
+
console.error("[goatchain] Platform: " + platform + " Arch: " + arch)
|
|
94
|
+
console.error("[goatchain] Looking for package: " + base)
|
|
95
|
+
console.error("[goatchain] Script dir: " + scriptDir)
|
|
96
|
+
}
|
|
97
|
+
|
|
70
98
|
const resolved = findBinary(scriptDir)
|
|
71
99
|
if (!resolved) {
|
|
72
100
|
console.error(
|
|
73
|
-
|
|
74
|
-
|
|
101
|
+
"[goatchain] Could not find the binary for your platform.\n" +
|
|
102
|
+
"\n" +
|
|
103
|
+
" Platform: " + os.platform() + " (" + platform + ")\n" +
|
|
104
|
+
" Arch: " + os.arch() + " (" + arch + ")\n" +
|
|
105
|
+
" Expected: " + base + "/bin/" + binary + "\n" +
|
|
106
|
+
" Searched: " + scriptDir + " (and parent directories)\n" +
|
|
107
|
+
"\n" +
|
|
108
|
+
"Try manually installing the platform package:\n" +
|
|
109
|
+
" npm install " + base + "\n"
|
|
75
110
|
)
|
|
76
111
|
process.exit(1)
|
|
77
112
|
}
|
|
78
113
|
|
|
114
|
+
if (process.env.DIMCODE_DEBUG) {
|
|
115
|
+
console.error("[goatchain] Resolved binary: " + resolved)
|
|
116
|
+
}
|
|
117
|
+
|
|
79
118
|
run(resolved)
|
package/package.json
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goatchain-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9-beta.11",
|
|
4
4
|
"description": "AI coding agent CLI - binary distribution",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
7
7
|
"goatchain": "./bin/goatchain"
|
|
8
8
|
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"postinstall": "node ./postinstall.mjs"
|
|
11
|
-
},
|
|
12
9
|
"optionalDependencies": {
|
|
13
|
-
"goatchain-cli-darwin-arm64": "0.0.
|
|
14
|
-
"goatchain-cli-darwin-x64": "0.0.
|
|
15
|
-
"goatchain-cli-linux-arm64": "0.0.
|
|
16
|
-
"goatchain-cli-linux-x64": "0.0.
|
|
17
|
-
"goatchain-cli-windows-x64": "0.0.
|
|
10
|
+
"goatchain-cli-darwin-arm64": "0.0.9-beta.11",
|
|
11
|
+
"goatchain-cli-darwin-x64": "0.0.9-beta.11",
|
|
12
|
+
"goatchain-cli-linux-arm64": "0.0.9-beta.11",
|
|
13
|
+
"goatchain-cli-linux-x64": "0.0.9-beta.11",
|
|
14
|
+
"goatchain-cli-windows-x64": "0.0.9-beta.11"
|
|
18
15
|
}
|
|
19
16
|
}
|
package/postinstall.mjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const stdout = process.stdout
|
|
4
|
-
const isTTY = Boolean(stdout && stdout.isTTY)
|
|
5
|
-
const isCI = Boolean(
|
|
6
|
-
process.env.CI
|
|
7
|
-
|| process.env.GITHUB_ACTIONS
|
|
8
|
-
|| process.env.BUILD_NUMBER
|
|
9
|
-
|| process.env.JENKINS_URL
|
|
10
|
-
|| process.env.GITLAB_CI
|
|
11
|
-
|| process.env.BUILDKITE
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
const lines = [
|
|
15
|
-
'',
|
|
16
|
-
' GoatChain CLI installed.',
|
|
17
|
-
' Run: goatchain to start.',
|
|
18
|
-
'',
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
if (!isTTY || isCI) {
|
|
22
|
-
stdout.write(lines.join('\n') + '\n')
|
|
23
|
-
} else {
|
|
24
|
-
const frames = ['[= ]', '[== ]', '[=== ]', '[==== ]', '[===== ]', '[======]', '[===== ]', '[==== ]', '[=== ]', '[== ]']
|
|
25
|
-
let idx = 0
|
|
26
|
-
const label = 'Setting up GoatChain '
|
|
27
|
-
const interval = setInterval(() => {
|
|
28
|
-
stdout.write(`\r${label}${frames[idx % frames.length]}`)
|
|
29
|
-
idx += 1
|
|
30
|
-
}, 90)
|
|
31
|
-
|
|
32
|
-
setTimeout(() => {
|
|
33
|
-
clearInterval(interval)
|
|
34
|
-
stdout.write('\r' + ' '.repeat(label.length + frames[0].length) + '\r\n')
|
|
35
|
-
stdout.write(lines.join('\n') + '\n')
|
|
36
|
-
}, 800)
|
|
37
|
-
}
|