@robbiesrobotics/alice-agents 1.0.0 → 1.1.1
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 +134 -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,128 @@ 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
|
+
function getOpenClawVersion() {
|
|
31
|
+
try {
|
|
32
|
+
const output = execSync('openclaw --version', { stdio: 'pipe', encoding: 'utf8' });
|
|
33
|
+
const match = output.match(/(\d{4}\.\d+\.\d+)/);
|
|
34
|
+
return match ? match[1] : null;
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getLatestNpmVersion() {
|
|
41
|
+
try {
|
|
42
|
+
const output = execSync('npm view openclaw version', { stdio: 'pipe', encoding: 'utf8' });
|
|
43
|
+
return output.trim();
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function checkForOpenClawUpdate(auto) {
|
|
50
|
+
const current = getOpenClawVersion();
|
|
51
|
+
if (!current) return;
|
|
52
|
+
|
|
53
|
+
console.log(` OpenClaw version: ${current}`);
|
|
54
|
+
|
|
55
|
+
const latest = getLatestNpmVersion();
|
|
56
|
+
if (!latest) {
|
|
57
|
+
console.log(' ⚠️ Could not check for updates (npm registry unreachable)\n');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (current === latest) {
|
|
62
|
+
console.log(` ✓ OpenClaw is up to date (${latest})\n`);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
console.log(` ⬆️ Update available: ${current} → ${latest}\n`);
|
|
67
|
+
|
|
68
|
+
let shouldUpdate = auto;
|
|
69
|
+
if (!auto) {
|
|
70
|
+
shouldUpdate = await confirm(' Update OpenClaw to latest before continuing?');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (shouldUpdate) {
|
|
74
|
+
console.log(' 📦 Updating OpenClaw...\n');
|
|
75
|
+
try {
|
|
76
|
+
execSync('npm install -g openclaw@latest', { stdio: 'inherit' });
|
|
77
|
+
const updated = getOpenClawVersion();
|
|
78
|
+
console.log(`\n ✓ OpenClaw updated to ${updated || latest}\n`);
|
|
79
|
+
} catch {
|
|
80
|
+
console.log('\n ⚠️ Update failed — continuing with current version\n');
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
console.log();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function installOpenClaw(auto) {
|
|
88
|
+
console.log(' ⚠️ OpenClaw is not installed.\n');
|
|
89
|
+
|
|
90
|
+
if (!auto) {
|
|
91
|
+
const shouldInstall = await confirm(' Would you like to install OpenClaw now?');
|
|
92
|
+
if (!shouldInstall) {
|
|
93
|
+
console.log('\n Install OpenClaw manually:');
|
|
94
|
+
console.log(' npm install -g openclaw');
|
|
95
|
+
console.log(' openclaw configure');
|
|
96
|
+
console.log(`\n Then re-run: npx @robbiesrobotics/alice-agents\n`);
|
|
97
|
+
process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
console.log(' 📦 Installing OpenClaw...\n');
|
|
102
|
+
try {
|
|
103
|
+
execSync('npm install -g openclaw', { stdio: 'inherit' });
|
|
104
|
+
console.log('\n ✓ OpenClaw installed\n');
|
|
105
|
+
} catch (err) {
|
|
106
|
+
console.error('\n ❌ Failed to install OpenClaw. Try manually:');
|
|
107
|
+
console.error(' npm install -g openclaw\n');
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Check if openclaw needs configuration
|
|
112
|
+
if (!configExists()) {
|
|
113
|
+
console.log(' OpenClaw needs initial configuration before A.L.I.C.E. can be set up.');
|
|
114
|
+
console.log(' This will set up your API keys, channels, and preferences.\n');
|
|
115
|
+
|
|
116
|
+
if (!auto) {
|
|
117
|
+
const shouldConfigure = await confirm(' Run openclaw configure now?');
|
|
118
|
+
if (shouldConfigure) {
|
|
119
|
+
try {
|
|
120
|
+
execSync('openclaw configure', { stdio: 'inherit' });
|
|
121
|
+
console.log('\n ✓ OpenClaw configured\n');
|
|
122
|
+
} catch {
|
|
123
|
+
console.error('\n ⚠️ Configuration incomplete. Run manually:');
|
|
124
|
+
console.error(' openclaw configure');
|
|
125
|
+
console.error(` npx @robbiesrobotics/alice-agents\n`);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
console.log('\n Run these commands when ready:');
|
|
130
|
+
console.log(' openclaw configure');
|
|
131
|
+
console.log(` npx @robbiesrobotics/alice-agents\n`);
|
|
132
|
+
process.exit(0);
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
console.error(' ❌ OpenClaw is installed but not configured.');
|
|
136
|
+
console.error(' Run: openclaw configure');
|
|
137
|
+
console.error(` Then: npx @robbiesrobotics/alice-agents\n`);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
20
143
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
144
|
|
|
22
145
|
function loadAgentRegistry() {
|
|
@@ -63,13 +186,20 @@ export async function runInstall(options = {}) {
|
|
|
63
186
|
|
|
64
187
|
printBanner();
|
|
65
188
|
|
|
66
|
-
// 1. Detect OpenClaw
|
|
189
|
+
// 1. Detect OpenClaw — offer to install if missing
|
|
190
|
+
if (!isOpenClawInstalled() || !configExists()) {
|
|
191
|
+
await installOpenClaw(auto);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Final check
|
|
67
195
|
if (!configExists()) {
|
|
68
|
-
console.error(' ❌ OpenClaw not found.
|
|
69
|
-
console.error(' https://openclaw.com/docs/install');
|
|
70
|
-
console.error();
|
|
196
|
+
console.error(' ❌ OpenClaw config not found. Run: openclaw configure\n');
|
|
71
197
|
process.exit(1);
|
|
72
198
|
}
|
|
199
|
+
|
|
200
|
+
// 1b. Check for OpenClaw updates
|
|
201
|
+
await checkForOpenClawUpdate(auto);
|
|
202
|
+
|
|
73
203
|
console.log(' ✓ OpenClaw detected\n');
|
|
74
204
|
|
|
75
205
|
const allAgents = loadAgentRegistry();
|