nexus-agent-installer 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/README.md +19 -0
- package/install.js +88 -0
- package/package.json +30 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# nexus-agent-installer
|
|
2
|
+
|
|
3
|
+
**Nexus Agent** 설치용 npm 패키지입니다. 설치 시 [nexus-agent-releases](https://github.com/EJCHO-salary/nexus-agent-releases)에서 플랫폼에 맞는 wheel을 내려받아 [uv](https://docs.astral.sh/uv/)로 설치합니다 (`uv`가 없으면 자동 설치).
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g nexus-agent-installer
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
설치가 끝나면 `nexus-agent` 명령을 바로 사용할 수 있습니다.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
nexus-agent init # ~/.nexus-agent/ 초기 설정 생성
|
|
13
|
+
nexus-agent start # 서버 시작 → http://localhost:4821
|
|
14
|
+
nexus-agent update # 최신 버전 업데이트
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
이 패키지는 다운로더 역할만 하므로, 이후 업데이트는 npm이 아닌 `nexus-agent update`로 하면 됩니다.
|
|
18
|
+
|
|
19
|
+
지원 플랫폼은 macOS (Apple Silicon/Intel), Linux (x86_64), Windows (x64)이며 Node.js 18 이상이 필요합니다.
|
package/install.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Nexus Agent npm postinstall 스크립트 — 최신 릴리스 wheel을 받아 uv tool로 설치한다.
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require("node:child_process");
|
|
5
|
+
const fs = require("node:fs");
|
|
6
|
+
const os = require("node:os");
|
|
7
|
+
const path = require("node:path");
|
|
8
|
+
|
|
9
|
+
const REPO = "EJCHO-salary/nexus-agent-releases";
|
|
10
|
+
const IS_WIN = process.platform === "win32";
|
|
11
|
+
|
|
12
|
+
function fail(msg) {
|
|
13
|
+
console.error(`오류: ${msg}`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function whlSuffix() {
|
|
18
|
+
const { platform, arch } = process;
|
|
19
|
+
if (platform === "darwin") {
|
|
20
|
+
return arch === "arm64" ? "macosx_11_0_arm64.whl" : "macosx_10_12_x86_64.whl";
|
|
21
|
+
}
|
|
22
|
+
if (platform === "linux") {
|
|
23
|
+
if (arch !== "x64") fail(`Linux는 x86_64만 지원합니다 (현재: ${arch}).`);
|
|
24
|
+
return "manylinux";
|
|
25
|
+
}
|
|
26
|
+
if (platform === "win32") {
|
|
27
|
+
if (arch !== "x64") fail(`Windows는 x64만 지원합니다 (현재: ${arch}).`);
|
|
28
|
+
return "win_amd64.whl";
|
|
29
|
+
}
|
|
30
|
+
fail(`지원하지 않는 플랫폼입니다: ${platform}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function run(cmd, args, opts = {}) {
|
|
34
|
+
return spawnSync(cmd, args, { stdio: "inherit", shell: IS_WIN, ...opts });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function hasUv() {
|
|
38
|
+
return spawnSync("uv", ["--version"], { stdio: "ignore", shell: IS_WIN }).status === 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function installUv() {
|
|
42
|
+
console.log("uv가 없어 설치합니다...");
|
|
43
|
+
const result = IS_WIN
|
|
44
|
+
? run("powershell", ["-ExecutionPolicy", "ByPass", "-c", "irm https://astral.sh/uv/install.ps1 | iex"])
|
|
45
|
+
: run("sh", ["-c", "curl -LsSf https://astral.sh/uv/install.sh | sh"]);
|
|
46
|
+
if (result.status !== 0) fail("uv 설치에 실패했습니다. https://docs.astral.sh/uv/ 를 참고해 수동 설치 후 다시 시도하세요.");
|
|
47
|
+
// 설치 직후 현재 프로세스의 PATH에 uv 경로 반영
|
|
48
|
+
process.env.PATH = `${path.join(os.homedir(), ".local", "bin")}${path.delimiter}${process.env.PATH}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function main() {
|
|
52
|
+
const suffix = whlSuffix();
|
|
53
|
+
|
|
54
|
+
if (!hasUv()) installUv();
|
|
55
|
+
|
|
56
|
+
console.log("최신 릴리스 확인 중...");
|
|
57
|
+
const headers = { "User-Agent": "nexus-agent-installer", Accept: "application/vnd.github+json" };
|
|
58
|
+
const resp = await fetch(`https://api.github.com/repos/${REPO}/releases/latest`, { headers });
|
|
59
|
+
if (!resp.ok) fail(`릴리스 조회 실패: HTTP ${resp.status}`);
|
|
60
|
+
const release = await resp.json();
|
|
61
|
+
|
|
62
|
+
const asset = (release.assets || []).find((a) => a.name.endsWith(".whl") && a.name.includes(suffix));
|
|
63
|
+
if (!asset) fail(`현재 플랫폼(${process.platform}/${process.arch})에 맞는 wheel을 찾지 못했습니다.`);
|
|
64
|
+
|
|
65
|
+
console.log(`다운로드: ${asset.name}`);
|
|
66
|
+
const dl = await fetch(asset.browser_download_url, { headers: { "User-Agent": "nexus-agent-installer" } });
|
|
67
|
+
if (!dl.ok) fail(`다운로드 실패: HTTP ${dl.status}`);
|
|
68
|
+
|
|
69
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "nexus-agent-install-"));
|
|
70
|
+
const whlPath = path.join(tmpDir, asset.name);
|
|
71
|
+
try {
|
|
72
|
+
fs.writeFileSync(whlPath, Buffer.from(await dl.arrayBuffer()));
|
|
73
|
+
|
|
74
|
+
const result = run("uv", ["tool", "install", "--force", "--python", "3.13", whlPath]);
|
|
75
|
+
if (result.status !== 0) fail("uv tool install이 실패했습니다.");
|
|
76
|
+
} finally {
|
|
77
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
console.log("");
|
|
81
|
+
console.log("✓ Nexus Agent 설치 완료");
|
|
82
|
+
console.log(" 다음 단계:");
|
|
83
|
+
console.log(" nexus-agent init # ~/.nexus-agent/ 초기 설정 생성");
|
|
84
|
+
console.log(" nexus-agent start # 서버 시작 (http://localhost:4821)");
|
|
85
|
+
console.log(" nexus-agent update # 이후 최신 버전 업데이트");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
main().catch((e) => fail(e.message));
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nexus-agent-installer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Installer for Nexus Agent — downloads the platform wheel from GitHub Releases and installs it via uv",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"postinstall": "node install.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"install.js",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"os": [
|
|
13
|
+
"darwin",
|
|
14
|
+
"linux",
|
|
15
|
+
"win32"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/EJCHO-salary/nexus-agent-releases.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"nexus-agent",
|
|
26
|
+
"installer",
|
|
27
|
+
"ai-agent"
|
|
28
|
+
],
|
|
29
|
+
"license": "UNLICENSED"
|
|
30
|
+
}
|