goatcode-cli 2.1.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Arhan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # goatcode-cli
2
+
3
+ The open-source terminal coding agent. **Any provider** (183), **your
4
+ subscriptions** (Claude Pro/Max, ChatGPT, Gemini, Copilot, Kimi, Grok via
5
+ OAuth), MCP servers, skills, plugins — and built-in **desktop control**
6
+ (see the screen, drive real apps). One standalone binary; this npm package
7
+ fetches it for your platform.
8
+
9
+ ```bash
10
+ npm install -g goatcode-cli
11
+ goat
12
+ ```
13
+
14
+ First steps once installed:
15
+
16
+ ```
17
+ goat auth anthropic --key *** # or: goat auth claude --oauth
18
+ goat auth --list-oauth # Claude · ChatGPT · Gemini · Copilot · Kimi · Grok
19
+ goat -m openrouter/deepseek-ai/deepseek-v3.2 "explain @src"
20
+ ```
21
+
22
+ Full docs, demo GIF, and the comparison vs Claude Code / Codex:
23
+ **https://github.com/Arhan-w/GoatCode**
24
+
25
+ MIT licensed. Binary is downloaded from
26
+ [GitHub Releases](https://github.com/Arhan-w/GoatCode/releases); nothing is
27
+ built or executed from source at install time. If the download is skipped
28
+ (offline, `--ignore-scripts`), `goat` fetches it on first run.
package/bin/goat.js ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ /*
3
+ * `goat` launcher. Runs the platform binary installed by postinstall; if the
4
+ * binary is missing (offline install, skipped scripts), it downloads once,
5
+ * then proceeds. Transparent stdin/stdout — full interactive TUI works.
6
+ */
7
+ "use strict";
8
+
9
+ const { spawnSync } = require("child_process");
10
+ const fs = require("fs");
11
+ const path = require("path");
12
+ const { install, targetPath } = require("../scripts/install-binary.js");
13
+
14
+ function runBinary() {
15
+ const bin = targetPath();
16
+ if (!fs.existsSync(bin)) return null;
17
+ const r = spawnSync(bin, process.argv.slice(2), { stdio: "inherit", windowsHide: true });
18
+ if (r.error) {
19
+ console.error(`[goatcode-cli] failed to run ${bin}: ${r.error.message}`);
20
+ process.exit(1);
21
+ }
22
+ return r.status === null ? 1 : r.status;
23
+ }
24
+
25
+ function main(retryDownload) {
26
+ const code = runBinary();
27
+ if (code !== null) process.exit(code);
28
+
29
+ if (!retryDownload) {
30
+ console.error("[goatcode-cli] binary missing and no download allowed — reinstall: npm i -g goatcode-cli");
31
+ process.exit(1);
32
+ }
33
+ process.stderr.write("[goatcode-cli] first run: fetching the GoatCode binary...\n");
34
+ install((err) => {
35
+ if (err) {
36
+ console.error(`[goatcode-cli] download failed: ${err.message}`);
37
+ console.error("[goatcode-cli] manual install: see https://github.com/Arhan-w/GoatCode#install");
38
+ process.exit(1);
39
+ }
40
+ const code = runBinary();
41
+ process.exit(code === null ? 1 : code);
42
+ });
43
+ }
44
+
45
+ // GOATCODE_NO_DOWNLOAD=1 makes a missing binary a hard error (CI/hermetic use)
46
+ main(!process.env.GOATCODE_NO_DOWNLOAD);
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "goatcode-cli",
3
+ "version": "2.1.3",
4
+ "description": "GoatCode — open-source terminal coding agent. Any provider (183), your subscriptions (Claude/ChatGPT/Gemini/Copilot OAuth), MCP, skills, built-in desktop control. One binary.",
5
+ "keywords": ["ai", "cli", "coding-agent", "agent", "terminal", "llm", "mcp", "anthropic", "openai", "gemini", "copilot", "developer-tools", "skills", "automation"],
6
+ "license": "MIT",
7
+ "author": "Arhan (Goated)",
8
+ "homepage": "https://github.com/Arhan-w/GoatCode#readme",
9
+ "repository": { "type": "git", "url": "git+https://github.com/Arhan-w/GoatCode.git" },
10
+ "bugs": { "url": "https://github.com/Arhan-w/GoatCode/issues" },
11
+ "bin": { "goat": "bin/goat.js" },
12
+ "files": ["bin/goat.js", "scripts/install-binary.js", "README.md"],
13
+ "engines": { "node": ">=16" },
14
+ "os": ["darwin", "linux", "win32"],
15
+ "cpu": ["x64", "arm64"],
16
+ "scripts": {
17
+ "postinstall": "node scripts/install-binary.js",
18
+ "test": "node bin/goat.js --version"
19
+ }
20
+ }
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env node
2
+ /*
3
+ * GoatCode binary installer (runs as npm postinstall; also importable by the
4
+ * launcher for self-heal). Downloads the standalone binary for this platform
5
+ * from GitHub releases into goatcode/bin/goat(.exe).
6
+ *
7
+ * Never fails the install: a network hiccup here just means the launcher
8
+ * re-tries on first run.
9
+ */
10
+ "use strict";
11
+
12
+ const fs = require("fs");
13
+ const path = require("path");
14
+ const https = require("https");
15
+
16
+ const REPO = "Arhan-w/GoatCode";
17
+ const VERSION = require("../package.json").version; // keep in lock-step with releases
18
+ const PKG_BIN = path.join(__dirname, "..", "bin");
19
+
20
+ function assetName() {
21
+ const osMap = { darwin: "darwin", linux: "linux", win32: "windows" };
22
+ const archMap = { x64: "x64", arm64: "arm64" };
23
+ const os = osMap[process.platform];
24
+ const arch = archMap[process.arch];
25
+ if (!os || !arch) return null;
26
+ const exe = os === "windows" ? ".exe" : "";
27
+ return `goat-${os}-${arch}${exe}`;
28
+ }
29
+
30
+ function targetPath() {
31
+ return path.join(PKG_BIN, process.platform === "win32" ? "goat.exe" : "goat");
32
+ }
33
+
34
+ function get(url, redirects, file, done) {
35
+ https.get(url, { headers: { "User-Agent": "goatcode-npm" } }, (res) => {
36
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location && redirects > 0) {
37
+ res.resume();
38
+ return get(new URL(res.headers.location, url).toString(), redirects - 1, file, done);
39
+ }
40
+ if (res.statusCode !== 200) {
41
+ res.resume();
42
+ return done(new Error(`HTTP ${res.statusCode}`));
43
+ }
44
+ const out = fs.createWriteStream(file);
45
+ res.pipe(out);
46
+ out.on("finish", () => out.close(() => done(null)));
47
+ out.on("error", done);
48
+ }).on("error", done);
49
+ }
50
+
51
+ function install(cb) {
52
+ const name = assetName();
53
+ if (!name) return cb(new Error(`unsupported platform ${process.platform}/${process.arch}`));
54
+ fs.mkdirSync(PKG_BIN, { recursive: true });
55
+ const target = targetPath();
56
+ const part = target + ".download";
57
+ const urls = [
58
+ `https://github.com/${REPO}/releases/download/v${VERSION}/${name}`,
59
+ `https://github.com/${REPO}/releases/latest/download/${name}`,
60
+ ];
61
+ (function next(i) {
62
+ if (i >= urls.length) return cb(new Error("all download URLs failed"));
63
+ get(urls[i], 5, part, (err) => {
64
+ if (!err) {
65
+ try {
66
+ // sanity: real binaries are ~90 MB; anything small is an error page
67
+ if (fs.statSync(part).size < 1_000_000) throw new Error("downloaded file too small");
68
+ fs.renameSync(part, target);
69
+ fs.chmodSync(target, 0o755);
70
+ return cb(null, target);
71
+ } catch (e) { err = e; }
72
+ }
73
+ try { fs.rmSync(part, { force: true }); } catch { /* */ }
74
+ next(i + 1);
75
+ });
76
+ })(0);
77
+ }
78
+
79
+ if (require.main === module) {
80
+ install((err, target) => {
81
+ if (err) {
82
+ // intentionally quiet-ish: the launcher retries on first run
83
+ console.log(`[goatcode] binary download skipped (${err.message}) — will retry on first run`);
84
+ process.exit(0);
85
+ }
86
+ console.log(`[goatcode] installed ${path.basename(target)}`);
87
+ });
88
+ }
89
+
90
+ module.exports = { install, assetName, targetPath };