@proggarapsody/bitbottle 1.0.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.
- package/bin/run.js +12 -0
- package/install.js +83 -0
- package/package.json +17 -0
package/bin/run.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execFileSync } = require("child_process");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
const isWindows = process.platform === "win32";
|
|
6
|
+
const binary = path.join(__dirname, "bitbottle" + (isWindows ? ".exe" : ""));
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
execFileSync(binary, ["mcp", ...process.argv.slice(2)], { stdio: "inherit" });
|
|
10
|
+
} catch (e) {
|
|
11
|
+
process.exit(e.status ?? 1);
|
|
12
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Downloads the correct platform binary during npm postinstall.
|
|
3
|
+
const https = require("https");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const { execSync } = require("child_process");
|
|
7
|
+
|
|
8
|
+
const pkg = require("./package.json");
|
|
9
|
+
// Strip npm wrapper suffix; binary version matches npm version exactly.
|
|
10
|
+
const VERSION = pkg.version;
|
|
11
|
+
const REPO = "proggarapsody/bitbottle";
|
|
12
|
+
|
|
13
|
+
const PLATFORM_MAP = {
|
|
14
|
+
darwin: "darwin",
|
|
15
|
+
linux: "linux",
|
|
16
|
+
win32: "windows",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const ARCH_MAP = {
|
|
20
|
+
x64: "amd64",
|
|
21
|
+
arm64: "arm64",
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const platform = PLATFORM_MAP[process.platform];
|
|
25
|
+
const arch = ARCH_MAP[process.arch];
|
|
26
|
+
|
|
27
|
+
if (!platform || !arch) {
|
|
28
|
+
console.error(
|
|
29
|
+
`Unsupported platform: ${process.platform}/${process.arch}. ` +
|
|
30
|
+
"Download the binary manually from https://github.com/" + REPO + "/releases"
|
|
31
|
+
);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const ext = platform === "windows" ? ".zip" : ".tar.gz";
|
|
36
|
+
const archiveName = `bitbottle_${platform}_${arch}${ext}`;
|
|
37
|
+
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${archiveName}`;
|
|
38
|
+
const binDir = path.join(__dirname, "bin");
|
|
39
|
+
const dest = path.join(binDir, "bitbottle" + (platform === "windows" ? ".exe" : ""));
|
|
40
|
+
|
|
41
|
+
if (!fs.existsSync(binDir)) fs.mkdirSync(binDir, { recursive: true });
|
|
42
|
+
|
|
43
|
+
console.log(`Downloading bitbottle v${VERSION} for ${platform}/${arch}…`);
|
|
44
|
+
|
|
45
|
+
function downloadFile(url, dest, cb) {
|
|
46
|
+
const file = fs.createWriteStream(dest);
|
|
47
|
+
function get(url) {
|
|
48
|
+
https.get(url, (res) => {
|
|
49
|
+
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
50
|
+
return get(res.headers.location);
|
|
51
|
+
}
|
|
52
|
+
if (res.statusCode !== 200) {
|
|
53
|
+
cb(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
res.pipe(file);
|
|
57
|
+
file.on("finish", () => file.close(cb));
|
|
58
|
+
}).on("error", cb);
|
|
59
|
+
}
|
|
60
|
+
get(url);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const archiveDest = path.join(binDir, archiveName);
|
|
64
|
+
downloadFile(url, archiveDest, (err) => {
|
|
65
|
+
if (err) {
|
|
66
|
+
console.error("Download failed:", err.message);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
if (ext === ".tar.gz") {
|
|
72
|
+
execSync(`tar -xzf "${archiveDest}" -C "${binDir}" bitbottle`);
|
|
73
|
+
} else {
|
|
74
|
+
execSync(`unzip -o "${archiveDest}" bitbottle.exe -d "${binDir}"`);
|
|
75
|
+
}
|
|
76
|
+
fs.unlinkSync(archiveDest);
|
|
77
|
+
if (platform !== "windows") fs.chmodSync(dest, 0o755);
|
|
78
|
+
console.log("bitbottle installed successfully.");
|
|
79
|
+
} catch (e) {
|
|
80
|
+
console.error("Extraction failed:", e.message);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proggarapsody/bitbottle",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Bitbucket MCP server — npm wrapper for bitbottle",
|
|
5
|
+
"keywords": ["mcp", "bitbucket", "claude", "ai"],
|
|
6
|
+
"homepage": "https://github.com/proggarapsody/bitbottle",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"bin": {
|
|
9
|
+
"bitbottle": "./bin/run.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"postinstall": "node install.js"
|
|
13
|
+
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18"
|
|
16
|
+
}
|
|
17
|
+
}
|