@robbiesrobotics/alice-agents 1.1.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 +61 -0
- package/package.json +1 -1
package/lib/installer.mjs
CHANGED
|
@@ -27,6 +27,63 @@ function isOpenClawInstalled() {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
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
|
+
|
|
30
87
|
async function installOpenClaw(auto) {
|
|
31
88
|
console.log(' ⚠️ OpenClaw is not installed.\n');
|
|
32
89
|
|
|
@@ -139,6 +196,10 @@ export async function runInstall(options = {}) {
|
|
|
139
196
|
console.error(' ❌ OpenClaw config not found. Run: openclaw configure\n');
|
|
140
197
|
process.exit(1);
|
|
141
198
|
}
|
|
199
|
+
|
|
200
|
+
// 1b. Check for OpenClaw updates
|
|
201
|
+
await checkForOpenClawUpdate(auto);
|
|
202
|
+
|
|
142
203
|
console.log(' ✓ OpenClaw detected\n');
|
|
143
204
|
|
|
144
205
|
const allAgents = loadAgentRegistry();
|