@evoapi/evo-nexus 0.18.2 → 0.18.4
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/cli.mjs +67 -2
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -133,7 +133,43 @@ async function main() {
|
|
|
133
133
|
const targetDir = filteredArgs[0] || ".";
|
|
134
134
|
const targetPath = resolve(process.cwd(), targetDir);
|
|
135
135
|
|
|
136
|
-
if (
|
|
136
|
+
// Detect if target is an existing EvoNexus installation (git repo with pyproject.toml)
|
|
137
|
+
const isExistingInstall = existsSync(resolve(targetPath, ".git")) && existsSync(resolve(targetPath, "pyproject.toml"));
|
|
138
|
+
|
|
139
|
+
if (isExistingInstall) {
|
|
140
|
+
// ── Update mode ─────────────────────────────
|
|
141
|
+
console.log(` ${GREEN}Existing EvoNexus installation detected.${RESET}\n`);
|
|
142
|
+
|
|
143
|
+
// Show current version
|
|
144
|
+
try {
|
|
145
|
+
const { readFileSync } = await import("fs");
|
|
146
|
+
const pyproject = readFileSync(resolve(targetPath, "pyproject.toml"), "utf-8");
|
|
147
|
+
const match = pyproject.match(/^version\s*=\s*"([^"]+)"/m);
|
|
148
|
+
if (match) console.log(` Current version: ${DIM}${match[1]}${RESET}`);
|
|
149
|
+
} catch {}
|
|
150
|
+
|
|
151
|
+
// Stop running services before updating
|
|
152
|
+
console.log(` ${DIM}Stopping services...${RESET}`);
|
|
153
|
+
try { run("pkill -f 'terminal-server/bin/server.js' 2>/dev/null || true", { cwd: targetPath }); } catch {}
|
|
154
|
+
try { run("pkill -f 'app.py' 2>/dev/null || true", { cwd: targetPath }); } catch {}
|
|
155
|
+
|
|
156
|
+
// Pull latest
|
|
157
|
+
console.log(`\n ${BOLD}Pulling latest changes...${RESET}\n`);
|
|
158
|
+
run("git fetch origin", { cwd: targetPath });
|
|
159
|
+
// Detect current branch
|
|
160
|
+
const branch = execSync("git rev-parse --abbrev-ref HEAD", { cwd: targetPath, encoding: "utf-8" }).trim();
|
|
161
|
+
run(`git pull origin ${branch}`, { cwd: targetPath });
|
|
162
|
+
|
|
163
|
+
// Show new version
|
|
164
|
+
try {
|
|
165
|
+
const { readFileSync } = await import("fs");
|
|
166
|
+
const pyproject = readFileSync(resolve(targetPath, "pyproject.toml"), "utf-8");
|
|
167
|
+
const match = pyproject.match(/^version\s*=\s*"([^"]+)"/m);
|
|
168
|
+
if (match) console.log(`\n Updated to: ${GREEN}${BOLD}${match[1]}${RESET}`);
|
|
169
|
+
} catch {}
|
|
170
|
+
|
|
171
|
+
console.log();
|
|
172
|
+
} else if (targetDir === ".") {
|
|
137
173
|
// Clone into current directory
|
|
138
174
|
const { readdirSync } = await import("fs");
|
|
139
175
|
const files = readdirSync(targetPath).filter(f => !f.startsWith("."));
|
|
@@ -176,7 +212,36 @@ async function main() {
|
|
|
176
212
|
console.log(`\n ${GREEN}✓${RESET} Frontend dependencies installed`);
|
|
177
213
|
}
|
|
178
214
|
|
|
179
|
-
// ──
|
|
215
|
+
// ── Update mode: rebuild + restart, skip setup wizard ─────
|
|
216
|
+
if (isExistingInstall) {
|
|
217
|
+
console.log(`\n ${DIM}Building dashboard frontend...${RESET}`);
|
|
218
|
+
try {
|
|
219
|
+
run("npm run build --silent", { cwd: frontendDir });
|
|
220
|
+
console.log(` ${GREEN}✓${RESET} Dashboard rebuilt`);
|
|
221
|
+
} catch {
|
|
222
|
+
console.log(` ${YELLOW}!${RESET} Frontend build failed — run: cd dashboard/frontend && npm run build`);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Restart services if start-services.sh exists
|
|
226
|
+
const startScript = resolve(targetPath, "start-services.sh");
|
|
227
|
+
if (existsSync(startScript)) {
|
|
228
|
+
console.log(`\n ${DIM}Restarting services...${RESET}`);
|
|
229
|
+
run(`bash ${startScript}`, { cwd: targetPath });
|
|
230
|
+
// Wait and verify
|
|
231
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
232
|
+
try {
|
|
233
|
+
execSync("curl -sf http://localhost:8080/api/version", { timeout: 5000 });
|
|
234
|
+
console.log(` ${GREEN}✓${RESET} Dashboard restarted`);
|
|
235
|
+
} catch {
|
|
236
|
+
console.log(` ${YELLOW}!${RESET} Dashboard may not have started — check logs/dashboard.log`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
console.log(`\n ${GREEN}${BOLD}EvoNexus updated successfully!${RESET}\n`);
|
|
241
|
+
process.exit(0);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// ── Run setup wizard (fresh install only) ─────
|
|
180
245
|
console.log(`\n ${BOLD}Starting setup wizard...${RESET}\n`);
|
|
181
246
|
|
|
182
247
|
const pythonCmd = check("uv --version") ? "uv run python" : "python3";
|