goatchain-cli 0.0.5-beta.2 → 0.0.5-beta.20

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 ADDED
@@ -0,0 +1,67 @@
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
+ function run(target) {
9
+ const result = childProcess.spawnSync(target, process.argv.slice(2), {
10
+ stdio: "inherit",
11
+ cwd: path.dirname(target),
12
+ })
13
+ if (result.error) {
14
+ console.error(result.error.message)
15
+ process.exit(1)
16
+ }
17
+ process.exit(typeof result.status === "number" ? result.status : 0)
18
+ }
19
+
20
+ const envPath = process.env.GOATCHAIN_BIN_PATH
21
+ if (envPath) {
22
+ run(envPath)
23
+ }
24
+
25
+ const scriptPath = fs.realpathSync(__filename)
26
+ const scriptDir = path.dirname(scriptPath)
27
+
28
+ const platformMap = {
29
+ darwin: "darwin",
30
+ linux: "linux",
31
+ win32: "windows",
32
+ }
33
+ const archMap = {
34
+ x64: "x64",
35
+ arm64: "arm64",
36
+ }
37
+
38
+ let platform = platformMap[os.platform()] || os.platform()
39
+ let arch = archMap[os.arch()] || os.arch()
40
+
41
+ const base = "goatchain-cli-" + platform + "-" + arch
42
+ const binary = platform === "windows" ? "goatchain.exe" : "goatchain"
43
+
44
+ function findBinary(startDir) {
45
+ let current = startDir
46
+ for (;;) {
47
+ const modules = path.join(current, "node_modules")
48
+ if (fs.existsSync(modules)) {
49
+ const candidate = path.join(modules, base, "bin", binary)
50
+ if (fs.existsSync(candidate)) return candidate
51
+ }
52
+ const parent = path.dirname(current)
53
+ if (parent === current) return
54
+ current = parent
55
+ }
56
+ }
57
+
58
+ const resolved = findBinary(scriptDir)
59
+ if (!resolved) {
60
+ console.error(
61
+ `It seems that your package manager failed to install the right binary package for your platform.\n` +
62
+ `You can try manually installing the "${base}" package.`
63
+ )
64
+ process.exit(1)
65
+ }
66
+
67
+ run(resolved)
package/package.json CHANGED
@@ -1,59 +1,19 @@
1
1
  {
2
2
  "name": "goatchain-cli",
3
- "type": "module",
4
- "version": "0.0.5-beta.2",
5
- "description": "GoatChain CLI built on @simon_he/vue-tui",
6
- "exports": {
7
- ".": {
8
- "types": "./dist/index.d.ts",
9
- "import": "./dist/index.js"
10
- },
11
- "./cli": {
12
- "types": "./dist/cli.d.ts",
13
- "import": "./dist/cli.js"
14
- }
15
- },
16
- "main": "./dist/index.js",
17
- "types": "./dist/index.d.ts",
3
+ "version": "0.0.5-beta.20",
4
+ "description": "AI coding agent CLI - binary distribution",
5
+ "license": "MIT",
18
6
  "bin": {
19
- "goatchain": "./cli.mjs"
7
+ "goatchain": "./bin/goatchain"
20
8
  },
21
- "files": [
22
- "cli.mjs",
23
- "dist"
24
- ],
25
9
  "scripts": {
26
- "build": "bun run build.mjs",
27
- "build:npm": "tsdown",
28
- "build:binary": "bun run build.mjs --binary",
29
- "build:binary:macos": "bun run build.mjs --binary --target=bun-darwin-arm64",
30
- "build:binary:macos-x64": "bun run build.mjs --binary --target=bun-darwin-x64",
31
- "build:binary:linux": "bun run build.mjs --binary --target=bun-linux-x64",
32
- "build:binary:linux-arm64": "bun run build.mjs --binary --target=bun-linux-arm64",
33
- "build:binary:windows": "bun run build.mjs --binary --target=bun-windows-x64",
34
- "cli": "bun src/cli.ts",
35
- "test": "bun test --preload ./test/setup.ts",
36
- "smoke": "bun run build && bun dist/cli.mjs --help",
37
- "lint": "eslint src/**/*.ts",
38
- "lint:fix": "eslint src/**/*.ts --fix",
39
- "prepack": "bun run build",
40
- "fix-package": "bun run fix-package.mjs",
41
- "restore-package": "bun run restore-package.mjs",
42
- "release": "bumpp --commit --no-tag --no-push && bun run build && bun publish",
43
- "release:npm": "bumpp --commit --no-tag --no-push && bun run build:npm && npm publish"
44
- },
45
- "dependencies": {
46
- "goatchain": "latest",
47
- "open": "^10.1.2",
48
- "semver": "^7.7.3",
49
- "shiki": "^3.20.0",
50
- "vue": "^3.4.0"
10
+ "postinstall": "node ./postinstall.mjs"
51
11
  },
52
- "devDependencies": {
53
- "@types/node": "^18.19.111",
54
- "happy-dom": "^17.5.0",
55
- "tsdown": "^0.20.0-beta.3",
56
- "typescript": "5.8.3",
57
- "vitest": "^4.0.17"
12
+ "optionalDependencies": {
13
+ "goatchain-cli-darwin-arm64": "0.0.5-beta.20",
14
+ "goatchain-cli-darwin-x64": "0.0.5-beta.20",
15
+ "goatchain-cli-linux-x64": "0.0.5-beta.20",
16
+ "goatchain-cli-linux-arm64": "0.0.5-beta.20",
17
+ "goatchain-cli-windows-x64": "0.0.5-beta.20"
58
18
  }
59
- }
19
+ }
@@ -0,0 +1,37 @@
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
+ }
package/cli.mjs DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- await import('./dist/cli.mjs')