@agora-build/atem 0.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.
- package/bin/atem +3 -0
- package/install.js +95 -0
- package/package.json +41 -0
package/bin/atem
ADDED
package/install.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const https = require("https");
|
|
5
|
+
const http = require("http");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const { execSync } = require("child_process");
|
|
9
|
+
const os = require("os");
|
|
10
|
+
|
|
11
|
+
const pkg = require("./package.json");
|
|
12
|
+
const VERSION = `v${pkg.version}`;
|
|
13
|
+
const REPO = "Agora-Build/Atem";
|
|
14
|
+
const BIN_DIR = path.join(__dirname, "bin");
|
|
15
|
+
const BIN_PATH = path.join(BIN_DIR, "atem");
|
|
16
|
+
|
|
17
|
+
function getPlatformKey() {
|
|
18
|
+
const platform = os.platform();
|
|
19
|
+
const arch = os.arch();
|
|
20
|
+
|
|
21
|
+
const map = {
|
|
22
|
+
"linux-x64": "linux-x86_64",
|
|
23
|
+
"linux-arm64": "linux-aarch64",
|
|
24
|
+
"darwin-x64": "darwin-x86_64",
|
|
25
|
+
"darwin-arm64": "darwin-aarch64",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const key = `${platform}-${arch}`;
|
|
29
|
+
if (!map[key]) {
|
|
30
|
+
console.error(`Unsupported platform: ${key}`);
|
|
31
|
+
console.error("Supported: linux-x64, linux-arm64, darwin-x64, darwin-arm64");
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
return map[key];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getDownloadUrl() {
|
|
38
|
+
const platformKey = getPlatformKey();
|
|
39
|
+
return `https://github.com/${REPO}/releases/download/${VERSION}/atem-${VERSION}-${platformKey}.tar.gz`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function fetch(url, redirects = 0) {
|
|
43
|
+
if (redirects > 5) {
|
|
44
|
+
return Promise.reject(new Error("Too many redirects"));
|
|
45
|
+
}
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
const client = url.startsWith("https") ? https : http;
|
|
48
|
+
client
|
|
49
|
+
.get(url, { headers: { "User-Agent": "atem-npm-installer" } }, (res) => {
|
|
50
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
51
|
+
return resolve(fetch(res.headers.location, redirects + 1));
|
|
52
|
+
}
|
|
53
|
+
if (res.statusCode !== 200) {
|
|
54
|
+
return reject(new Error(`Download failed: HTTP ${res.statusCode} for ${url}`));
|
|
55
|
+
}
|
|
56
|
+
const chunks = [];
|
|
57
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
58
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
59
|
+
res.on("error", reject);
|
|
60
|
+
})
|
|
61
|
+
.on("error", reject);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function install() {
|
|
66
|
+
const url = getDownloadUrl();
|
|
67
|
+
console.log(`Downloading atem ${VERSION} for ${getPlatformKey()}...`);
|
|
68
|
+
console.log(` ${url}`);
|
|
69
|
+
|
|
70
|
+
const tarball = await fetch(url);
|
|
71
|
+
|
|
72
|
+
// Write tarball to temp file and extract
|
|
73
|
+
const tmpFile = path.join(os.tmpdir(), `atem-${Date.now()}.tar.gz`);
|
|
74
|
+
fs.writeFileSync(tmpFile, tarball);
|
|
75
|
+
|
|
76
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
execSync(`tar -xzf "${tmpFile}" -C "${BIN_DIR}"`, { stdio: "pipe" });
|
|
80
|
+
} finally {
|
|
81
|
+
fs.unlinkSync(tmpFile);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Ensure the binary is executable
|
|
85
|
+
fs.chmodSync(BIN_PATH, 0o755);
|
|
86
|
+
console.log(`Installed atem ${VERSION} to ${BIN_PATH}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
install().catch((err) => {
|
|
90
|
+
console.error(`Failed to install atem: ${err.message}`);
|
|
91
|
+
console.error("");
|
|
92
|
+
console.error("You can manually download the binary from:");
|
|
93
|
+
console.error(` https://github.com/${REPO}/releases/tag/${VERSION}`);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agora-build/atem",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Agora AI development terminal — TUI for managing projects, Claude Code, and eval agents",
|
|
5
|
+
"bin": {
|
|
6
|
+
"atem": "bin/atem"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node install.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"install.js"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/Agora-Build/Atem.git"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"agora",
|
|
21
|
+
"ai",
|
|
22
|
+
"terminal",
|
|
23
|
+
"tui",
|
|
24
|
+
"claude",
|
|
25
|
+
"development"
|
|
26
|
+
],
|
|
27
|
+
"author": "Agora Build <build@agora.io>",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/Agora-Build/Atem/issues"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/Agora-Build/Atem#readme",
|
|
33
|
+
"os": [
|
|
34
|
+
"linux",
|
|
35
|
+
"darwin"
|
|
36
|
+
],
|
|
37
|
+
"cpu": [
|
|
38
|
+
"x64",
|
|
39
|
+
"arm64"
|
|
40
|
+
]
|
|
41
|
+
}
|