nexus-agent-installer 0.1.3 → 0.1.5

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.
Files changed (3) hide show
  1. package/README.md +6 -1
  2. package/install.js +37 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,6 +14,11 @@ nexus-agent start # 서버 시작 → http://localhost:4821
14
14
  nexus-agent update # 최신 버전 업데이트
15
15
  ```
16
16
 
17
- 패키지는 다운로더 역할만 하므로, 이후 업데이트는 npm이 아닌 `nexus-agent update`로 하면 됩니다.
17
+ 대화형 터미널에서 `nexus-agent start`를 실행하면 버전이 있을 업데이트 여부를
18
+ 묻고, 동의하면 설치 후 같은 옵션으로 서버를 다시 시작합니다. 확인을 생략하려면
19
+ `nexus-agent start --no-update-check` 또는 `NEXUS_NO_UPDATE_CHECK=1`을 사용합니다.
20
+
21
+ 이 패키지는 다운로더 역할만 하므로 이후 업데이트를 위해 npm 패키지를 다시
22
+ 설치할 필요는 없습니다. 시작 시 질문 또는 `nexus-agent update`를 사용하면 됩니다.
18
23
 
19
24
  지원 플랫폼은 macOS (Apple Silicon/Intel), Linux (x86_64), Windows (x64)이며 Node.js 18 이상이 필요합니다.
package/install.js CHANGED
@@ -42,7 +42,10 @@ const STOP_TOOL_PROCESSES_PS = [
42
42
  "if ($processes.Count -eq 0) { exit 0 }",
43
43
  "$processIds = @($processes | ForEach-Object { [int]$_.ProcessId })",
44
44
  "foreach ($processId in $processIds) { Stop-Process -Id $processId -Force -ErrorAction SilentlyContinue }",
45
- "foreach ($processId in $processIds) { Wait-Process -Id $processId -ErrorAction SilentlyContinue }",
45
+ "foreach ($processId in $processIds) {",
46
+ " Wait-Process -Id $processId -Timeout 30 -ErrorAction SilentlyContinue",
47
+ ' if (Get-Process -Id $processId -ErrorAction SilentlyContinue) { throw "Nexus process stop timed out: $processId" }',
48
+ "}",
46
49
  '$processIds -join ","',
47
50
  ].join("\n");
48
51
 
@@ -53,7 +56,8 @@ function fail(msg) {
53
56
  function whlSuffix() {
54
57
  const { platform, arch } = process;
55
58
  if (platform === "darwin") {
56
- return arch === "arm64" ? "macosx_11_0_arm64.whl" : "macosx_10_12_x86_64.whl";
59
+ if (arch !== "arm64") fail(`macOS는 Apple Silicon(arm64)만 지원합니다 (현재: ${arch}).`);
60
+ return "macosx_11_0_arm64.whl";
57
61
  }
58
62
  if (platform === "linux") {
59
63
  if (arch !== "x64") fail(`Linux는 x86_64만 지원합니다 (현재: ${arch}).`);
@@ -189,6 +193,12 @@ function stopNexusToolProcesses() {
189
193
  },
190
194
  },
191
195
  );
196
+ if (result.status !== 0) {
197
+ const detail = result.error?.code || (result.signal
198
+ ? `signal ${result.signal}`
199
+ : `exit code ${result.status ?? "unknown"}`);
200
+ fail(`Nexus Agent 프로세스를 확인·종료하지 못해 설치를 중단합니다 (${detail}).`);
201
+ }
192
202
  const stopped = String(result.stdout || "").trim();
193
203
  if (stopped) {
194
204
  console.log(`실행 중인 Nexus Agent 프로세스를 종료했습니다: ${stopped}`);
@@ -207,6 +217,12 @@ function verifyRuntime() {
207
217
  }
208
218
  const result = run(paths.python, ["-I", "-m", INTEGRITY_MODULE]);
209
219
  if (result.status !== 0) fail("Nexus Agent 설치 무결성 검증에 실패했습니다.");
220
+ if (!paths.launcher || !fs.existsSync(paths.launcher)) {
221
+ fail(`설치된 실행 파일을 찾을 수 없습니다: ${paths.launcher}`);
222
+ }
223
+ const launched = run(paths.launcher, ["--version"]);
224
+ if (launched.status !== 0) fail("Nexus Agent 실행 검증에 실패했습니다.");
225
+ return paths;
210
226
  }
211
227
 
212
228
  function removeDamagedTool() {
@@ -245,7 +261,8 @@ function installUv() {
245
261
  async function main() {
246
262
  const suffix = whlSuffix();
247
263
 
248
- if (!hasUv()) installUv();
264
+ const installedUv = !hasUv();
265
+ if (installedUv) installUv();
249
266
  // ensureSafeWindowsUv가 uv tool uninstall을 부를 수 있으므로 그 전에 잠금을 푼다.
250
267
  stopNexusToolProcesses();
251
268
  ensureSafeWindowsUv();
@@ -275,6 +292,7 @@ async function main() {
275
292
  const whlPath = path.join(tmpDir, asset.name);
276
293
  const depDir = path.join(tmpDir, "deps");
277
294
  let installationCompleted = false;
295
+ let installedPaths;
278
296
  try {
279
297
  fs.writeFileSync(whlPath, Buffer.from(await dl.arrayBuffer()));
280
298
  fs.mkdirSync(depDir);
@@ -309,7 +327,7 @@ async function main() {
309
327
  fail(`uv tool install이 실패했습니다 (${detail}).`);
310
328
  }
311
329
  installationCompleted = true;
312
- verifyRuntime();
330
+ installedPaths = verifyRuntime();
313
331
  } catch (error) {
314
332
  if (installationCompleted) removeDamagedTool();
315
333
  reportSecuritySoftwareDiagnostics();
@@ -320,6 +338,21 @@ async function main() {
320
338
 
321
339
  console.log("");
322
340
  console.log("✓ Nexus Agent 설치 완료");
341
+ const launcherDirectory = path.dirname(installedPaths.launcher);
342
+ const normalizedDirectory = IS_WIN ? launcherDirectory.toLowerCase() : launcherDirectory;
343
+ const onPath = String(process.env.PATH || process.env.Path || "").split(path.delimiter).some((entry) => {
344
+ const directory = path.resolve(entry.replace(/^"|"$/g, ""));
345
+ return (IS_WIN ? directory.toLowerCase() : directory) === normalizedDirectory;
346
+ });
347
+ if (installedUv) {
348
+ console.log(" uv를 새로 설치했습니다. 새 터미널에서 nexus-agent 명령을 실행하세요.");
349
+ }
350
+ if (!onPath) {
351
+ console.log(" 명령 경로를 등록하려면 uv tool update-shell 실행 후 새 터미널을 여세요.");
352
+ }
353
+ if (installedUv || !onPath) {
354
+ console.log(` 검증된 실행 파일: ${installedPaths.launcher}`);
355
+ }
323
356
  console.log(" 다음 단계:");
324
357
  console.log(" nexus-agent init # ~/.nexus-agent/ 초기 설정 생성");
325
358
  console.log(" nexus-agent start # 서버 시작 (http://localhost:4821)");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexus-agent-installer",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Installer for Nexus Agent — downloads the platform wheel from GitHub Releases and installs it via uv",
5
5
  "scripts": {
6
6
  "postinstall": "node install.js"