arisa 2.2.4 → 2.2.6
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/arisa.js +16 -29
- package/package.json +1 -1
package/bin/arisa.js
CHANGED
|
@@ -414,7 +414,7 @@ function arisaUserExists() {
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
function isProvisioned() {
|
|
417
|
-
return arisaUserExists() && existsSync("/home/arisa/.bun/bin/bun");
|
|
417
|
+
return arisaUserExists() && existsSync("/home/arisa/.bun/bin/bun") && existsSync(SHARED_ARISA_ROOT);
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
function isArisaConfigured() {
|
|
@@ -438,6 +438,8 @@ function step(ok, msg) {
|
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
const ARISA_BUN_ENV = 'export BUN_INSTALL=/home/arisa/.bun && export PATH=/home/arisa/.bun/bin:$PATH';
|
|
441
|
+
const SHARED_ARISA_ROOT = "/opt/arisa/node_modules/arisa";
|
|
442
|
+
const sharedDaemonEntry = join(SHARED_ARISA_ROOT, "src", "daemon", "index.ts");
|
|
441
443
|
|
|
442
444
|
function runAsInherit(cmd) {
|
|
443
445
|
return spawnSync("su", ["-", "arisa", "-c", `${ARISA_BUN_ENV} && ${cmd}`], {
|
|
@@ -465,7 +467,7 @@ function provisionArisaUser() {
|
|
|
465
467
|
spawnSync("usermod", ["-aG", group, "arisa"], { stdio: "ignore" });
|
|
466
468
|
}
|
|
467
469
|
|
|
468
|
-
// 2. Install bun (
|
|
470
|
+
// 2. Install bun (curl, not bun — low memory footprint)
|
|
469
471
|
process.stdout.write(" Installing bun (this may take a minute)...\n");
|
|
470
472
|
const bunInstall = runAsInherit("curl -fsSL https://bun.sh/install | bash");
|
|
471
473
|
if (bunInstall.status !== 0) {
|
|
@@ -483,30 +485,15 @@ function provisionArisaUser() {
|
|
|
483
485
|
spawnSync("chown", ["arisa:arisa", profilePath], { stdio: "ignore" });
|
|
484
486
|
}
|
|
485
487
|
|
|
486
|
-
// 3. Copy
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
488
|
+
// 3. Copy global node_modules to shared location (lightweight cp, no bun)
|
|
489
|
+
const sharedDir = "/opt/arisa";
|
|
490
|
+
const globalModules = resolve(pkgRoot, "..");
|
|
491
|
+
mkdirSync(sharedDir, { recursive: true });
|
|
492
|
+
spawnSync("cp", ["-r", globalModules, join(sharedDir, "node_modules")], { stdio: "pipe" });
|
|
493
|
+
spawnSync("chown", ["-R", "arisa:arisa", sharedDir], { stdio: "pipe" });
|
|
494
|
+
step(true, "Arisa copied to /opt/arisa");
|
|
490
495
|
|
|
491
|
-
//
|
|
492
|
-
process.stdout.write(" Installing dependencies...\n");
|
|
493
|
-
const install = runAsInherit("cd ~/arisa && ~/.bun/bin/bun install && ~/.bun/bin/bun add -g .");
|
|
494
|
-
if (install.status !== 0) {
|
|
495
|
-
step(false, "Failed to install dependencies");
|
|
496
|
-
process.exit(1);
|
|
497
|
-
}
|
|
498
|
-
step(true, "Arisa installed for arisa");
|
|
499
|
-
|
|
500
|
-
// 4. Install AI CLIs (before daemon starts — avoids OOM in low-memory environments)
|
|
501
|
-
process.stdout.write(" Installing Claude Code CLI...\n");
|
|
502
|
-
const claudeInstall = runAsInherit("~/.bun/bin/bun add -g @anthropic-ai/claude-code");
|
|
503
|
-
step(claudeInstall.status === 0, "Claude Code CLI");
|
|
504
|
-
|
|
505
|
-
process.stdout.write(" Installing Codex CLI...\n");
|
|
506
|
-
const codexInstall = runAsInherit("~/.bun/bin/bun add -g @openai/codex");
|
|
507
|
-
step(codexInstall.status === 0, "Codex CLI");
|
|
508
|
-
|
|
509
|
-
// 5. Migrate data
|
|
496
|
+
// 4. Migrate data
|
|
510
497
|
const rootArisa = "/root/.arisa";
|
|
511
498
|
if (existsSync(rootArisa)) {
|
|
512
499
|
const destArisa = "/home/arisa/.arisa";
|
|
@@ -529,11 +516,11 @@ Wants=network-online.target
|
|
|
529
516
|
[Service]
|
|
530
517
|
Type=simple
|
|
531
518
|
User=arisa
|
|
532
|
-
WorkingDirectory
|
|
533
|
-
ExecStart=/home/arisa/.bun/bin/bun
|
|
519
|
+
WorkingDirectory=${SHARED_ARISA_ROOT}
|
|
520
|
+
ExecStart=/home/arisa/.bun/bin/bun ${sharedDaemonEntry}
|
|
534
521
|
Restart=always
|
|
535
522
|
RestartSec=5
|
|
536
|
-
Environment=ARISA_PROJECT_DIR
|
|
523
|
+
Environment=ARISA_PROJECT_DIR=${SHARED_ARISA_ROOT}
|
|
537
524
|
Environment=BUN_INSTALL=/home/arisa/.bun
|
|
538
525
|
Environment=PATH=/home/arisa/.bun/bin:/usr/local/bin:/usr/bin:/bin
|
|
539
526
|
|
|
@@ -593,7 +580,7 @@ function canUseSystemdSystem() {
|
|
|
593
580
|
}
|
|
594
581
|
|
|
595
582
|
function runArisaForeground() {
|
|
596
|
-
const su = spawnSync("su", ["-", "arisa", "-c", `${ARISA_BUN_ENV} && /home/arisa/.bun/bin/bun
|
|
583
|
+
const su = spawnSync("su", ["-", "arisa", "-c", `${ARISA_BUN_ENV} && export ARISA_PROJECT_DIR=${SHARED_ARISA_ROOT} && /home/arisa/.bun/bin/bun ${sharedDaemonEntry}`], {
|
|
597
584
|
stdio: "inherit",
|
|
598
585
|
});
|
|
599
586
|
return su.status ?? 1;
|