goatchain-cli 0.0.9-beta.20 → 0.0.9-beta.21

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/package.json CHANGED
@@ -1,16 +1,21 @@
1
1
  {
2
2
  "name": "goatchain-cli",
3
- "version": "0.0.9-beta.20",
4
- "description": "AI coding agent CLI - binary distribution",
3
+ "version": "0.0.9-beta.21",
4
+ "description": "AI coding agent CLI - Ink TUI (default) with optional opentui binary",
5
5
  "license": "MIT",
6
+ "type": "module",
6
7
  "bin": {
7
- "goatchain": "./bin/goatchain"
8
+ "goatchain": "./bin/goatchain.mjs"
8
9
  },
10
+ "files": [
11
+ "bin",
12
+ "dist"
13
+ ],
9
14
  "optionalDependencies": {
10
- "goatchain-cli-darwin-arm64": "0.0.9-beta.20",
11
- "goatchain-cli-darwin-x64": "0.0.9-beta.20",
12
- "goatchain-cli-linux-arm64": "0.0.9-beta.20",
13
- "goatchain-cli-linux-x64": "0.0.9-beta.20",
14
- "goatchain-cli-windows-x64": "0.0.9-beta.20"
15
+ "goatchain-cli-darwin-arm64": "0.0.9-beta.21",
16
+ "goatchain-cli-darwin-x64": "0.0.9-beta.21",
17
+ "goatchain-cli-linux-arm64": "0.0.9-beta.21",
18
+ "goatchain-cli-linux-x64": "0.0.9-beta.21",
19
+ "goatchain-cli-windows-x64": "0.0.9-beta.21"
15
20
  }
16
21
  }
package/bin/goatchain DELETED
@@ -1,118 +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
- const isWindows = os.platform() === "win32"
9
-
10
- let wrapperVersion = ""
11
- try {
12
- const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"))
13
- wrapperVersion = pkg.version || ""
14
- } catch (_) {}
15
-
16
- const wrapperDir = path.join(__dirname, "..").replace(/\\/g, "/").toLowerCase()
17
- const wrapperPm = (wrapperDir.includes(".bun/") || wrapperDir.includes("bun/install/")) ? "bun" : "npm"
18
-
19
- function run(target) {
20
- const env = { ...process.env, DIMCODE_NPM_PACKAGE: "goatchain-cli", DIMCODE_NPM_PACKAGE_MANAGER: wrapperPm }
21
- if (wrapperVersion) env.DIMCODE_NPM_PACKAGE_VERSION = wrapperVersion
22
- const result = childProcess.spawnSync(target, process.argv.slice(2), {
23
- stdio: "inherit",
24
- cwd: process.cwd(),
25
- env,
26
- // On Windows, ensure the child process is spawned in the same console
27
- windowsHide: false,
28
- })
29
- if (result.error) {
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
- }
39
- process.exit(1)
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
- }
46
- process.exit(typeof result.status === "number" ? result.status : 0)
47
- }
48
-
49
- const envPath = process.env.DIMCODE_BIN_PATH
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
- }
55
- run(envPath)
56
- }
57
-
58
- const scriptPath = fs.realpathSync(__filename)
59
- const scriptDir = path.dirname(scriptPath)
60
-
61
- const platformMap = {
62
- darwin: "darwin",
63
- linux: "linux",
64
- win32: "windows",
65
- }
66
- const archMap = {
67
- x64: "x64",
68
- arm64: "arm64",
69
- }
70
-
71
- let platform = platformMap[os.platform()] || os.platform()
72
- let arch = archMap[os.arch()] || os.arch()
73
-
74
- const base = "goatchain-cli-" + platform + "-" + arch
75
- const binary = platform === "windows" ? "goatchain.exe" : "goatchain"
76
-
77
- function findBinary(startDir) {
78
- let current = startDir
79
- for (;;) {
80
- const modules = path.join(current, "node_modules")
81
- if (fs.existsSync(modules)) {
82
- const candidate = path.join(modules, base, "bin", binary)
83
- if (fs.existsSync(candidate)) return candidate
84
- }
85
- const parent = path.dirname(current)
86
- if (parent === current) return
87
- current = parent
88
- }
89
- }
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
-
98
- const resolved = findBinary(scriptDir)
99
- if (!resolved) {
100
- console.error(
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"
110
- )
111
- process.exit(1)
112
- }
113
-
114
- if (process.env.DIMCODE_DEBUG) {
115
- console.error("[goatchain] Resolved binary: " + resolved)
116
- }
117
-
118
- run(resolved)