murmur-tui 0.1.7
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/install.js +112 -0
- package/package.json +40 -0
- package/run.js +19 -0
package/install.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
const https = require("https");
|
|
9
|
+
const { execFileSync } = require("child_process");
|
|
10
|
+
|
|
11
|
+
const REPO = "steadymoka/murmur";
|
|
12
|
+
const NAME = "murmur";
|
|
13
|
+
|
|
14
|
+
const PLATFORM_MAP = {
|
|
15
|
+
"darwin-arm64": { target: "aarch64-apple-darwin", archive: "tar.gz" },
|
|
16
|
+
"darwin-x64": { target: "x86_64-apple-darwin", archive: "tar.gz" },
|
|
17
|
+
"linux-x64": { target: "x86_64-unknown-linux-gnu", archive: "tar.gz" },
|
|
18
|
+
"linux-arm64": { target: "aarch64-unknown-linux-gnu", archive: "tar.gz" },
|
|
19
|
+
"win32-x64": { target: "x86_64-pc-windows-msvc", archive: "zip" },
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function getPlatformInfo() {
|
|
23
|
+
const key = `${os.platform()}-${os.arch()}`;
|
|
24
|
+
const info = PLATFORM_MAP[key];
|
|
25
|
+
if (!info) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`Unsupported platform: ${key}\nSupported: ${Object.keys(PLATFORM_MAP).join(", ")}`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return info;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getVersion() {
|
|
34
|
+
const pkg = JSON.parse(
|
|
35
|
+
fs.readFileSync(path.join(__dirname, "package.json"), "utf8")
|
|
36
|
+
);
|
|
37
|
+
return pkg.version;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function fetch(url) {
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
https
|
|
43
|
+
.get(url, { headers: { "User-Agent": "murmur-tui-npm" } }, (res) => {
|
|
44
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
45
|
+
return fetch(res.headers.location).then(resolve, reject);
|
|
46
|
+
}
|
|
47
|
+
if (res.statusCode !== 200) {
|
|
48
|
+
return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
49
|
+
}
|
|
50
|
+
const chunks = [];
|
|
51
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
52
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
53
|
+
res.on("error", reject);
|
|
54
|
+
})
|
|
55
|
+
.on("error", reject);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function extractTarGz(buffer, destDir) {
|
|
60
|
+
const archivePath = path.join(destDir, "archive.tar.gz");
|
|
61
|
+
fs.writeFileSync(archivePath, buffer);
|
|
62
|
+
execFileSync("tar", ["xzf", archivePath, "-C", destDir]);
|
|
63
|
+
fs.unlinkSync(archivePath);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function extractZip(buffer, destDir) {
|
|
67
|
+
const archivePath = path.join(destDir, "archive.zip");
|
|
68
|
+
fs.writeFileSync(archivePath, buffer);
|
|
69
|
+
execFileSync("powershell", [
|
|
70
|
+
"-NoProfile",
|
|
71
|
+
"-Command",
|
|
72
|
+
`Expand-Archive -Path '${archivePath}' -DestinationPath '${destDir}' -Force`,
|
|
73
|
+
]);
|
|
74
|
+
fs.unlinkSync(archivePath);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function main() {
|
|
78
|
+
const { target, archive } = getPlatformInfo();
|
|
79
|
+
const version = getVersion();
|
|
80
|
+
const binDir = path.join(__dirname, "bin");
|
|
81
|
+
const binaryName = os.platform() === "win32" ? `${NAME}.exe` : NAME;
|
|
82
|
+
const binaryPath = path.join(binDir, binaryName);
|
|
83
|
+
|
|
84
|
+
if (fs.existsSync(binaryPath)) {
|
|
85
|
+
console.log(`murmur binary already exists at ${binaryPath}`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const url = `https://github.com/${REPO}/releases/download/v${version}/${NAME}-${target}.${archive}`;
|
|
90
|
+
console.log(`Downloading murmur v${version} for ${target}...`);
|
|
91
|
+
|
|
92
|
+
const buffer = await fetch(url);
|
|
93
|
+
|
|
94
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
95
|
+
|
|
96
|
+
if (archive === "tar.gz") {
|
|
97
|
+
extractTarGz(buffer, binDir);
|
|
98
|
+
} else {
|
|
99
|
+
extractZip(buffer, binDir);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (os.platform() !== "win32") {
|
|
103
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
console.log(`Installed murmur to ${binaryPath}`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
main().catch((err) => {
|
|
110
|
+
console.error(`Failed to install murmur: ${err.message}`);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "murmur-tui",
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"description": "Terminal command center for AI coding sessions",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/steadymoka/murmur"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/steadymoka/murmur",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"tui",
|
|
13
|
+
"terminal",
|
|
14
|
+
"ai",
|
|
15
|
+
"claude",
|
|
16
|
+
"kanban"
|
|
17
|
+
],
|
|
18
|
+
"bin": {
|
|
19
|
+
"murmur-tui": "run.js"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"postinstall": "node install.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"install.js",
|
|
26
|
+
"run.js"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=16"
|
|
30
|
+
},
|
|
31
|
+
"os": [
|
|
32
|
+
"darwin",
|
|
33
|
+
"linux",
|
|
34
|
+
"win32"
|
|
35
|
+
],
|
|
36
|
+
"cpu": [
|
|
37
|
+
"x64",
|
|
38
|
+
"arm64"
|
|
39
|
+
]
|
|
40
|
+
}
|
package/run.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const { execFileSync } = require("child_process");
|
|
8
|
+
|
|
9
|
+
const binaryName = os.platform() === "win32" ? "murmur.exe" : "murmur";
|
|
10
|
+
const binaryPath = path.join(__dirname, "bin", binaryName);
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
execFileSync(binaryPath, process.argv.slice(2), { stdio: "inherit" });
|
|
14
|
+
} catch (err) {
|
|
15
|
+
if (err.status !== null) {
|
|
16
|
+
process.exit(err.status);
|
|
17
|
+
}
|
|
18
|
+
throw err;
|
|
19
|
+
}
|