@devness/useai 0.8.7 → 0.8.8
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/index.js +38 -29
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -215,7 +215,7 @@ var VERSION;
|
|
|
215
215
|
var init_version = __esm({
|
|
216
216
|
"../shared/dist/constants/version.js"() {
|
|
217
217
|
"use strict";
|
|
218
|
-
VERSION = "0.8.
|
|
218
|
+
VERSION = "0.8.8";
|
|
219
219
|
}
|
|
220
220
|
});
|
|
221
221
|
|
|
@@ -36315,23 +36315,26 @@ if (!command && process.stdin.isTTY) {
|
|
|
36315
36315
|
}
|
|
36316
36316
|
}
|
|
36317
36317
|
if (command === "update") {
|
|
36318
|
+
const p = await import("@clack/prompts");
|
|
36318
36319
|
const { fetchLatestVersion: fetchLatestVersion2, fetchDaemonHealth: fetchDaemonHealth2, killDaemon: killDaemon2, ensureDaemon: ensureDaemon2, installClaudeCodeHooks: installClaudeCodeHooks2, VERSION: VERSION3 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
36319
36320
|
const { AI_TOOLS: AI_TOOLS2 } = await Promise.resolve().then(() => (init_tools2(), tools_exports));
|
|
36320
|
-
|
|
36321
|
+
p.intro(import_picocolors2.default.bgCyan(import_picocolors2.default.black(" useai update ")));
|
|
36322
|
+
const checkSpinner = p.spinner();
|
|
36323
|
+
checkSpinner.start("Checking for updates...");
|
|
36321
36324
|
const latest = await fetchLatestVersion2();
|
|
36322
36325
|
if (!latest) {
|
|
36323
|
-
|
|
36326
|
+
checkSpinner.stop("Could not reach npm registry");
|
|
36327
|
+
p.log.error("Failed to check for updates. Please check your network connection.");
|
|
36324
36328
|
process.exit(1);
|
|
36325
36329
|
}
|
|
36326
36330
|
const healthBefore = await fetchDaemonHealth2();
|
|
36327
36331
|
const runningVersion = healthBefore?.version ?? VERSION3;
|
|
36328
36332
|
if (runningVersion === latest && VERSION3 === latest) {
|
|
36329
|
-
|
|
36333
|
+
checkSpinner.stop(`Already up to date (v${latest})`);
|
|
36334
|
+
p.outro("Nothing to do.");
|
|
36330
36335
|
process.exit(0);
|
|
36331
36336
|
}
|
|
36332
|
-
|
|
36333
|
-
console.log(` ${import_picocolors2.default.dim("Latest:")} v${latest}`);
|
|
36334
|
-
console.log();
|
|
36337
|
+
checkSpinner.stop(`Update available: v${runningVersion} \u2192 v${latest}`);
|
|
36335
36338
|
const configuredTools = AI_TOOLS2.filter((t) => {
|
|
36336
36339
|
try {
|
|
36337
36340
|
return t.isConfigured();
|
|
@@ -36339,66 +36342,72 @@ if (command === "update") {
|
|
|
36339
36342
|
return false;
|
|
36340
36343
|
}
|
|
36341
36344
|
});
|
|
36345
|
+
const updateSpinner = p.spinner();
|
|
36342
36346
|
if (configuredTools.length > 0) {
|
|
36343
|
-
|
|
36347
|
+
updateSpinner.start(`Removing MCP configs from ${configuredTools.length} tools...`);
|
|
36344
36348
|
for (const tool of configuredTools) {
|
|
36345
36349
|
try {
|
|
36346
36350
|
tool.remove();
|
|
36347
|
-
console.log(import_picocolors2.default.dim(` \u21BB ${tool.name}`));
|
|
36348
36351
|
} catch {
|
|
36349
|
-
console.log(import_picocolors2.default.red(` \u2717 Failed to remove ${tool.name}`));
|
|
36350
36352
|
}
|
|
36351
36353
|
}
|
|
36352
|
-
|
|
36354
|
+
updateSpinner.stop(`Removed configs from ${configuredTools.length} tools`);
|
|
36353
36355
|
}
|
|
36354
|
-
|
|
36356
|
+
const daemonSpinner = p.spinner();
|
|
36357
|
+
daemonSpinner.start("Stopping daemon and clearing cache...");
|
|
36355
36358
|
await killDaemon2();
|
|
36356
|
-
console.log(import_picocolors2.default.dim(" Clearing npx cache..."));
|
|
36357
36359
|
const { execSync: execSync4 } = await import("child_process");
|
|
36358
36360
|
try {
|
|
36359
36361
|
execSync4("npm cache clean --force", { stdio: "ignore", timeout: 15e3 });
|
|
36360
36362
|
} catch {
|
|
36361
36363
|
}
|
|
36362
|
-
|
|
36364
|
+
daemonSpinner.message("Starting updated daemon...");
|
|
36363
36365
|
const daemonOk = await ensureDaemon2({ preferOnline: true });
|
|
36364
36366
|
if (!daemonOk) {
|
|
36365
|
-
|
|
36366
|
-
|
|
36367
|
-
|
|
36368
|
-
|
|
36367
|
+
daemonSpinner.stop("Failed to start updated daemon");
|
|
36368
|
+
p.note(
|
|
36369
|
+
[
|
|
36370
|
+
"Run in foreground to debug:",
|
|
36371
|
+
` npx @devness/useai daemon --port 19200`
|
|
36372
|
+
].join("\n"),
|
|
36373
|
+
"Troubleshooting"
|
|
36374
|
+
);
|
|
36369
36375
|
process.exit(1);
|
|
36370
36376
|
}
|
|
36371
36377
|
const healthAfter = await fetchDaemonHealth2();
|
|
36372
36378
|
const newVersion = healthAfter?.version ?? "unknown";
|
|
36373
|
-
|
|
36374
|
-
\u2713 Daemon updated: v${runningVersion} \u2192 v${newVersion}`));
|
|
36379
|
+
daemonSpinner.stop(`Daemon updated: v${runningVersion} \u2192 v${newVersion}`);
|
|
36375
36380
|
if (configuredTools.length > 0) {
|
|
36376
|
-
|
|
36381
|
+
const httpOk = [];
|
|
36382
|
+
const stdioOk = [];
|
|
36383
|
+
const failed = [];
|
|
36377
36384
|
for (const tool of configuredTools) {
|
|
36378
36385
|
try {
|
|
36379
36386
|
if (tool.supportsUrl) {
|
|
36380
36387
|
tool.installHttp();
|
|
36381
|
-
|
|
36388
|
+
httpOk.push(tool.name);
|
|
36382
36389
|
} else {
|
|
36383
36390
|
tool.install();
|
|
36384
|
-
|
|
36391
|
+
stdioOk.push(tool.name);
|
|
36385
36392
|
}
|
|
36386
36393
|
} catch {
|
|
36387
|
-
|
|
36394
|
+
failed.push(tool.name);
|
|
36388
36395
|
}
|
|
36389
36396
|
}
|
|
36397
|
+
if (httpOk.length > 0) p.log.success(`HTTP (daemon): ${httpOk.join(", ")}`);
|
|
36398
|
+
if (stdioOk.length > 0) p.log.success(`stdio: ${stdioOk.join(", ")}`);
|
|
36399
|
+
if (failed.length > 0) p.log.error(`Failed: ${failed.join(", ")}`);
|
|
36390
36400
|
}
|
|
36391
36401
|
try {
|
|
36392
36402
|
const hooksInstalled = installClaudeCodeHooks2();
|
|
36393
36403
|
if (hooksInstalled) {
|
|
36394
|
-
|
|
36404
|
+
p.log.success("Claude Code hooks reinstalled");
|
|
36395
36405
|
}
|
|
36396
36406
|
} catch {
|
|
36397
36407
|
}
|
|
36398
|
-
|
|
36399
|
-
|
|
36400
|
-
|
|
36401
|
-
`));
|
|
36408
|
+
const dashboard = `
|
|
36409
|
+
Dashboard \u2192 ${import_picocolors2.default.cyan("http://127.0.0.1:19200/dashboard")}`;
|
|
36410
|
+
p.outro(`UseAI updated to v${newVersion} in ${import_picocolors2.default.bold(String(configuredTools.length))} tool${configuredTools.length === 1 ? "" : "s"}.${dashboard}`);
|
|
36402
36411
|
process.exit(0);
|
|
36403
36412
|
}
|
|
36404
36413
|
if (command === "daemon") {
|