@shiploom/cli 1.1.0

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.
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ // bin/shiploom.js — passthrough to the vendored Go binary.
3
+ "use strict";
4
+
5
+ const { spawnSync } = require("child_process");
6
+ const { existsSync } = require("fs");
7
+ const { join } = require("path");
8
+
9
+ const bin = join(__dirname, "..", "vendor", process.platform === "win32" ? "shiploom.exe" : "shiploom");
10
+ if (!existsSync(bin)) {
11
+ process.stderr.write("shiploom: binary missing (run `npm install` again)\n");
12
+ process.exit(1);
13
+ }
14
+ const child = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
15
+ process.exit(child.status === null ? 1 : child.status);
package/install.js ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ // install.js — fetch the platform Go binary from GitHub releases (stdlib-only:
3
+ // global fetch, no dependencies). The binary itself runs fully offline.
4
+ "use strict";
5
+
6
+ const { createWriteStream, chmodSync, mkdirSync, existsSync } = require("fs");
7
+ const { get } = require("https");
8
+ const { join } = require("path");
9
+ const { spawnSync } = require("child_process");
10
+
11
+ const VERSION = require("./package.json").version;
12
+
13
+ const ASSETS = {
14
+ "darwin-arm64": "shiploom-VERSION-darwin-arm64",
15
+ "darwin-x64": "shiploom-VERSION-darwin-amd64",
16
+ "linux-arm64": "shiploom-VERSION-linux-arm64",
17
+ "linux-x64": "shiploom-VERSION-linux-amd64",
18
+ "win32-arm64": "shiploom-VERSION-windows-amd64.exe",
19
+ "win32-x64": "shiploom-VERSION-windows-amd64.exe",
20
+ };
21
+
22
+ function asset() {
23
+ const key = `${process.platform}-${process.arch}`;
24
+ const name = ASSETS[key];
25
+ if (!name) throw new Error(`unsupported platform: ${key}`);
26
+ return name.replace(/VERSION/g, VERSION);
27
+ }
28
+
29
+ function download(url, dest) {
30
+ return new Promise((resolve, reject) => {
31
+ get(url, { headers: { "User-Agent": "shiploom-npx" } }, (res) => {
32
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
33
+ return resolve(download(res.headers.location, dest));
34
+ }
35
+ if (res.statusCode !== 200) {
36
+ return reject(new Error(`download failed: HTTP ${res.statusCode} for ${url}`));
37
+ }
38
+ const out = createWriteStream(dest, { mode: 0o755 });
39
+ res.pipe(out);
40
+ out.on("finish", () => resolve());
41
+ out.on("error", reject);
42
+ }).on("error", reject);
43
+ });
44
+ }
45
+
46
+ (async () => {
47
+ const dir = join(__dirname, "vendor");
48
+ mkdirSync(dir, { recursive: true });
49
+ const dest = join(dir, process.platform === "win32" ? "shiploom.exe" : "shiploom");
50
+ if (existsSync(dest)) {
51
+ const check = spawnSync(dest, ["--version"], { encoding: "utf8" });
52
+ if (check.status === 0 && String(check.stdout).includes(VERSION)) return;
53
+ }
54
+ const url = `https://github.com/shiploom/ai-builder/releases/download/v${VERSION}/${asset()}`;
55
+ process.stderr.write(`shiploom: downloading ${asset()} ...\n`);
56
+ await download(url, dest);
57
+ chmodSync(dest, 0o755);
58
+ })().catch((err) => {
59
+ process.stderr.write(`shiploom: install failed: ${err.message}\n`);
60
+ process.exit(1);
61
+ });
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@shiploom/cli",
3
+ "version": "1.1.0",
4
+ "description": "Shiploom Core — portable AI software-engineering layer (single Go binary, offline-first)",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/shiploom/ai-builder.git"
9
+ },
10
+ "engines": {
11
+ "node": ">=18"
12
+ },
13
+ "bin": {
14
+ "shiploom": "bin/shiploom.js"
15
+ },
16
+ "scripts": {
17
+ "postinstall": "node ./install.js"
18
+ },
19
+ "files": [
20
+ "bin/",
21
+ "install.js"
22
+ ]
23
+ }