onkol 0.2.0 → 0.3.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/dist/cli/index.js +84 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -42,11 +42,69 @@ function markStep(homeDir, checkpoint, step) {
|
|
|
42
42
|
checkpoint.completed.push(step);
|
|
43
43
|
saveCheckpoint(homeDir, checkpoint);
|
|
44
44
|
}
|
|
45
|
+
function checkDependencies() {
|
|
46
|
+
console.log(chalk.bold('Checking dependencies...\n'));
|
|
47
|
+
const deps = [
|
|
48
|
+
{
|
|
49
|
+
name: 'claude',
|
|
50
|
+
check: 'claude --version',
|
|
51
|
+
installHint: 'Install Claude Code: https://docs.anthropic.com/en/docs/claude-code/getting-started',
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'bun',
|
|
56
|
+
check: 'bun --version',
|
|
57
|
+
installHint: 'Install Bun: curl -fsSL https://bun.sh/install | bash',
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'tmux',
|
|
62
|
+
check: 'tmux -V',
|
|
63
|
+
installHint: 'Install tmux:\n Ubuntu/Debian: sudo apt install tmux\n RHEL/CentOS: sudo yum install tmux\n Arch: sudo pacman -S tmux\n macOS: brew install tmux',
|
|
64
|
+
required: true,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'jq',
|
|
68
|
+
check: 'jq --version',
|
|
69
|
+
installHint: 'Install jq:\n Ubuntu/Debian: sudo apt install jq\n RHEL/CentOS: sudo yum install jq\n Arch: sudo pacman -S jq\n macOS: brew install jq',
|
|
70
|
+
required: true,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'curl',
|
|
74
|
+
check: 'curl --version',
|
|
75
|
+
installHint: 'Install curl:\n Ubuntu/Debian: sudo apt install curl\n RHEL/CentOS: sudo yum install curl',
|
|
76
|
+
required: true,
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
const missing = [];
|
|
80
|
+
for (const dep of deps) {
|
|
81
|
+
try {
|
|
82
|
+
execSync(dep.check, { stdio: 'pipe' });
|
|
83
|
+
console.log(chalk.green(` ✓ ${dep.name}`));
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
console.log(chalk.red(` ✗ ${dep.name} — not found`));
|
|
87
|
+
missing.push(dep);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (missing.length > 0) {
|
|
91
|
+
console.log(chalk.red(`\nMissing ${missing.length} required dependencies:\n`));
|
|
92
|
+
for (const dep of missing) {
|
|
93
|
+
console.log(chalk.yellow(` ${dep.name}:`));
|
|
94
|
+
console.log(chalk.gray(` ${dep.installHint}\n`));
|
|
95
|
+
}
|
|
96
|
+
console.log(chalk.red('Install the missing dependencies and run `npx onkol setup` again.'));
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
console.log(chalk.green('\n All dependencies found.\n'));
|
|
100
|
+
}
|
|
45
101
|
program
|
|
46
102
|
.command('setup')
|
|
47
103
|
.description('Set up an Onkol node on this VM')
|
|
48
104
|
.action(async () => {
|
|
49
105
|
console.log(chalk.bold('\nWelcome to Onkol Setup\n'));
|
|
106
|
+
// Check all dependencies before doing anything
|
|
107
|
+
checkDependencies();
|
|
50
108
|
const homeDir = process.env.HOME || '/root';
|
|
51
109
|
let answers;
|
|
52
110
|
let checkpoint;
|
|
@@ -379,15 +437,35 @@ program
|
|
|
379
437
|
}
|
|
380
438
|
catch { /* ignore */ }
|
|
381
439
|
}
|
|
382
|
-
// Start orchestrator
|
|
440
|
+
// Start orchestrator — try systemctl first (so service shows active), fall back to script
|
|
383
441
|
console.log(chalk.gray('\nStarting orchestrator...'));
|
|
442
|
+
let started = false;
|
|
384
443
|
try {
|
|
385
|
-
execSync(`
|
|
386
|
-
|
|
444
|
+
execSync(`sudo systemctl start onkol-${answers.nodeName}`, { stdio: 'pipe' });
|
|
445
|
+
// Wait for tmux session to appear
|
|
446
|
+
for (let i = 0; i < 10; i++) {
|
|
447
|
+
try {
|
|
448
|
+
execSync(`tmux has-session -t onkol-${answers.nodeName}`, { stdio: 'pipe' });
|
|
449
|
+
started = true;
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
catch { /* not ready yet */ }
|
|
453
|
+
execSync('sleep 1', { stdio: 'pipe' });
|
|
454
|
+
}
|
|
455
|
+
if (started) {
|
|
456
|
+
console.log(chalk.green(`✓ Orchestrator started via systemd (tmux session "onkol-${answers.nodeName}")`));
|
|
457
|
+
}
|
|
387
458
|
}
|
|
388
|
-
catch
|
|
389
|
-
|
|
390
|
-
|
|
459
|
+
catch { /* systemctl start failed, try direct */ }
|
|
460
|
+
if (!started) {
|
|
461
|
+
try {
|
|
462
|
+
execSync(`bash "${resolve(dir, 'scripts/start-orchestrator.sh')}"`, { stdio: 'pipe' });
|
|
463
|
+
console.log(chalk.green(`✓ Orchestrator started in tmux session "onkol-${answers.nodeName}"`));
|
|
464
|
+
}
|
|
465
|
+
catch {
|
|
466
|
+
console.log(chalk.yellow(`⚠ Could not start orchestrator automatically.`));
|
|
467
|
+
console.log(chalk.yellow(` Start manually: ${dir}/scripts/start-orchestrator.sh`));
|
|
468
|
+
}
|
|
391
469
|
}
|
|
392
470
|
// Setup complete — clear checkpoint
|
|
393
471
|
clearCheckpoint(homeDir);
|