@robbiesrobotics/alice-agents 1.0.0 → 1.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/lib/installer.mjs +73 -4
- package/package.json +1 -1
package/lib/installer.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { join, dirname } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { execSync } from 'node:child_process';
|
|
4
5
|
import { configExists, mergeConfig, removeAliceAgents } from './config-merger.mjs';
|
|
5
6
|
import { scaffoldAll } from './workspace-scaffolder.mjs';
|
|
6
7
|
import { readManifest, writeManifest } from './manifest.mjs';
|
|
@@ -17,6 +18,71 @@ import {
|
|
|
17
18
|
detectTimezone,
|
|
18
19
|
} from './prompter.mjs';
|
|
19
20
|
|
|
21
|
+
function isOpenClawInstalled() {
|
|
22
|
+
try {
|
|
23
|
+
execSync('which openclaw', { stdio: 'pipe' });
|
|
24
|
+
return true;
|
|
25
|
+
} catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function installOpenClaw(auto) {
|
|
31
|
+
console.log(' ⚠️ OpenClaw is not installed.\n');
|
|
32
|
+
|
|
33
|
+
if (!auto) {
|
|
34
|
+
const shouldInstall = await confirm(' Would you like to install OpenClaw now?');
|
|
35
|
+
if (!shouldInstall) {
|
|
36
|
+
console.log('\n Install OpenClaw manually:');
|
|
37
|
+
console.log(' npm install -g openclaw');
|
|
38
|
+
console.log(' openclaw configure');
|
|
39
|
+
console.log(`\n Then re-run: npx @robbiesrobotics/alice-agents\n`);
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
console.log(' 📦 Installing OpenClaw...\n');
|
|
45
|
+
try {
|
|
46
|
+
execSync('npm install -g openclaw', { stdio: 'inherit' });
|
|
47
|
+
console.log('\n ✓ OpenClaw installed\n');
|
|
48
|
+
} catch (err) {
|
|
49
|
+
console.error('\n ❌ Failed to install OpenClaw. Try manually:');
|
|
50
|
+
console.error(' npm install -g openclaw\n');
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Check if openclaw needs configuration
|
|
55
|
+
if (!configExists()) {
|
|
56
|
+
console.log(' OpenClaw needs initial configuration before A.L.I.C.E. can be set up.');
|
|
57
|
+
console.log(' This will set up your API keys, channels, and preferences.\n');
|
|
58
|
+
|
|
59
|
+
if (!auto) {
|
|
60
|
+
const shouldConfigure = await confirm(' Run openclaw configure now?');
|
|
61
|
+
if (shouldConfigure) {
|
|
62
|
+
try {
|
|
63
|
+
execSync('openclaw configure', { stdio: 'inherit' });
|
|
64
|
+
console.log('\n ✓ OpenClaw configured\n');
|
|
65
|
+
} catch {
|
|
66
|
+
console.error('\n ⚠️ Configuration incomplete. Run manually:');
|
|
67
|
+
console.error(' openclaw configure');
|
|
68
|
+
console.error(` npx @robbiesrobotics/alice-agents\n`);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
} else {
|
|
72
|
+
console.log('\n Run these commands when ready:');
|
|
73
|
+
console.log(' openclaw configure');
|
|
74
|
+
console.log(` npx @robbiesrobotics/alice-agents\n`);
|
|
75
|
+
process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
console.error(' ❌ OpenClaw is installed but not configured.');
|
|
79
|
+
console.error(' Run: openclaw configure');
|
|
80
|
+
console.error(` Then: npx @robbiesrobotics/alice-agents\n`);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
20
86
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
87
|
|
|
22
88
|
function loadAgentRegistry() {
|
|
@@ -63,11 +129,14 @@ export async function runInstall(options = {}) {
|
|
|
63
129
|
|
|
64
130
|
printBanner();
|
|
65
131
|
|
|
66
|
-
// 1. Detect OpenClaw
|
|
132
|
+
// 1. Detect OpenClaw — offer to install if missing
|
|
133
|
+
if (!isOpenClawInstalled() || !configExists()) {
|
|
134
|
+
await installOpenClaw(auto);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Final check
|
|
67
138
|
if (!configExists()) {
|
|
68
|
-
console.error(' ❌ OpenClaw not found.
|
|
69
|
-
console.error(' https://openclaw.com/docs/install');
|
|
70
|
-
console.error();
|
|
139
|
+
console.error(' ❌ OpenClaw config not found. Run: openclaw configure\n');
|
|
71
140
|
process.exit(1);
|
|
72
141
|
}
|
|
73
142
|
console.log(' ✓ OpenClaw detected\n');
|