@vizzor/cli 0.14.5 → 0.14.6

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/README.md CHANGED
@@ -256,6 +256,7 @@ vizzor chronovisor start # Start engine
256
256
  vizzor chronovisor stop # Stop engine
257
257
  vizzor chronovisor status # Engine health check
258
258
  vizzor predictions reset # Reset prediction history
259
+ vizzor update # Update to latest version
259
260
  vizzor health # Check config, API keys, and service connectivity
260
261
  ```
261
262
 
package/dist/index.js CHANGED
@@ -40953,6 +40953,7 @@ __export(service_exports, {
40953
40953
  });
40954
40954
  import { randomUUID as randomUUID5 } from "crypto";
40955
40955
  import { execSync } from "child_process";
40956
+ import { existsSync as existsSync4 } from "fs";
40956
40957
  import { resolve as resolve3, dirname as dirname2 } from "path";
40957
40958
  import { fileURLToPath as fileURLToPath2 } from "url";
40958
40959
  function registerTUICallback(cb) {
@@ -41110,7 +41111,12 @@ function getVizzorIconPath() {
41110
41111
  const thisDir = dirname2(fileURLToPath2(import.meta.url));
41111
41112
  const isLightMode = detectSystemLightMode();
41112
41113
  const iconFile = isLightMode ? "vizzor_logodarkicon.png" : "vizzor_logoicon.png";
41113
- return resolve3(thisDir, `../../web/public/${iconFile}`);
41114
+ const candidates = [
41115
+ resolve3(thisDir, "..", iconFile),
41116
+ resolve3(thisDir, "..", "..", iconFile),
41117
+ resolve3(thisDir, "..", "..", "web", "public", iconFile)
41118
+ ];
41119
+ return candidates.find((p) => existsSync4(p));
41114
41120
  } catch {
41115
41121
  return void 0;
41116
41122
  }
@@ -41410,7 +41416,7 @@ var init_server = __esm({
41410
41416
 
41411
41417
  // src/ml/env-detect.ts
41412
41418
  import { execFile } from "child_process";
41413
- import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
41419
+ import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
41414
41420
  import { join as join5 } from "path";
41415
41421
  function getEngineDir() {
41416
41422
  return join5(getConfigDir(), "chronovisor");
@@ -41450,11 +41456,11 @@ function detectDocker() {
41450
41456
  });
41451
41457
  }
41452
41458
  function isInstalled() {
41453
- return existsSync4(join5(getEngineDir(), "engine", "pyproject.toml"));
41459
+ return existsSync5(join5(getEngineDir(), "engine", "pyproject.toml"));
41454
41460
  }
41455
41461
  function getInstalledVersion() {
41456
41462
  const versionFile = join5(getEngineDir(), "version");
41457
- if (!existsSync4(versionFile)) return "";
41463
+ if (!existsSync5(versionFile)) return "";
41458
41464
  try {
41459
41465
  return readFileSync4(versionFile, "utf-8").trim();
41460
41466
  } catch {
@@ -41475,11 +41481,11 @@ __export(engine_manager_exports, {
41475
41481
  getEngineManager: () => getEngineManager
41476
41482
  });
41477
41483
  import { spawn, execFile as execFile2 } from "child_process";
41478
- import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4, unlinkSync as unlinkSync2 } from "fs";
41484
+ import { existsSync as existsSync6, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4, unlinkSync as unlinkSync2 } from "fs";
41479
41485
  import { join as join6 } from "path";
41480
41486
  function readPidFile(path) {
41481
41487
  try {
41482
- if (!existsSync5(path)) return null;
41488
+ if (!existsSync6(path)) return null;
41483
41489
  const pid = parseInt(readFileSync5(path, "utf-8").trim(), 10);
41484
41490
  return Number.isFinite(pid) ? pid : null;
41485
41491
  } catch {
@@ -41496,7 +41502,7 @@ function isProcessAlive(pid) {
41496
41502
  }
41497
41503
  function readContainerId(path) {
41498
41504
  try {
41499
- if (!existsSync5(path)) return null;
41505
+ if (!existsSync6(path)) return null;
41500
41506
  const id = readFileSync5(path, "utf-8").trim();
41501
41507
  return id || null;
41502
41508
  } catch {
@@ -41742,11 +41748,11 @@ var init_engine_manager = __esm({
41742
41748
  const venvBin = join6(dir, ".venv", "bin");
41743
41749
  const pidFile = join6(dir, "engine.pid");
41744
41750
  const logFile = join6(dir, "engine.log");
41745
- if (!existsSync5(join6(engineDir, "pyproject.toml"))) {
41751
+ if (!existsSync6(join6(engineDir, "pyproject.toml"))) {
41746
41752
  throw new Error("Engine source not installed \u2014 run `vizzor chronovisor setup`");
41747
41753
  }
41748
41754
  const pythonPath = join6(venvBin, "python");
41749
- if (!existsSync5(pythonPath)) {
41755
+ if (!existsSync6(pythonPath)) {
41750
41756
  throw new Error("Python venv not found \u2014 run `vizzor chronovisor setup`");
41751
41757
  }
41752
41758
  const { openSync, closeSync } = await import("fs");
@@ -41893,7 +41899,7 @@ __export(setup_chronovisor_exports, {
41893
41899
  handleSetupChronovisor: () => handleSetupChronovisor
41894
41900
  });
41895
41901
  import { randomBytes as randomBytes4 } from "crypto";
41896
- import { existsSync as existsSync6, mkdirSync as mkdirSync5, cpSync, writeFileSync as writeFileSync5 } from "fs";
41902
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, cpSync, writeFileSync as writeFileSync5 } from "fs";
41897
41903
  import { join as join7, resolve as resolve4, dirname as dirname3 } from "path";
41898
41904
  import { fileURLToPath as fileURLToPath3 } from "url";
41899
41905
  import chalk10 from "chalk";
@@ -41957,7 +41963,7 @@ async function handleSetupChronovisor(opts) {
41957
41963
  const bundledDir = getBundledEngineDir();
41958
41964
  const engineDest = join7(engineDir, "engine");
41959
41965
  const venvDir = join7(engineDir, ".venv");
41960
- if (!existsSync6(join7(bundledDir, "pyproject.toml"))) {
41966
+ if (!existsSync7(join7(bundledDir, "pyproject.toml"))) {
41961
41967
  console.log(chalk10.red(" Bundled engine source not found at:"), chalk10.dim(bundledDir));
41962
41968
  console.log(" This may happen if you installed from a minimal build. Try Docker instead.");
41963
41969
  return;
@@ -41970,7 +41976,7 @@ async function handleSetupChronovisor(opts) {
41970
41976
  } else {
41971
41977
  console.log(" Engine source already installed.");
41972
41978
  }
41973
- if (!existsSync6(join7(venvDir, "bin", "python")) || opts.force) {
41979
+ if (!existsSync7(join7(venvDir, "bin", "python")) || opts.force) {
41974
41980
  console.log(" Creating Python virtualenv...");
41975
41981
  const { execFileSync } = await import("child_process");
41976
41982
  try {
@@ -42269,6 +42275,41 @@ var init_wallet2 = __esm({
42269
42275
  }
42270
42276
  });
42271
42277
 
42278
+ // src/cli/commands/update.ts
42279
+ var update_exports = {};
42280
+ __export(update_exports, {
42281
+ handleUpdateCommand: () => handleUpdateCommand
42282
+ });
42283
+ import chalk12 from "chalk";
42284
+ import ora from "ora";
42285
+ import { execSync as execSync2 } from "child_process";
42286
+ async function handleUpdateCommand(currentVersion) {
42287
+ const spinner = ora({ text: "Checking for updates...", spinner: "dots" }).start();
42288
+ let latestVersion;
42289
+ try {
42290
+ latestVersion = execSync2("npm view @vizzor/cli version", { encoding: "utf-8" }).trim();
42291
+ } catch {
42292
+ spinner.fail("Failed to check for updates. Are you connected to the internet?");
42293
+ return;
42294
+ }
42295
+ if (currentVersion === latestVersion) {
42296
+ spinner.succeed(chalk12.green(`Already up to date (v${currentVersion})`));
42297
+ return;
42298
+ }
42299
+ spinner.text = `Updating Vizzor v${currentVersion} \u2192 v${latestVersion}...`;
42300
+ try {
42301
+ execSync2("npm install -g @vizzor/cli@latest", { encoding: "utf-8", stdio: "pipe" });
42302
+ spinner.succeed(chalk12.green(`Updated Vizzor: v${currentVersion} \u2192 v${latestVersion}`));
42303
+ } catch {
42304
+ spinner.fail("Update failed. Try running manually: npm install -g @vizzor/cli@latest");
42305
+ }
42306
+ }
42307
+ var init_update = __esm({
42308
+ "src/cli/commands/update.ts"() {
42309
+ "use strict";
42310
+ }
42311
+ });
42312
+
42272
42313
  // src/tui/components/price-ticker.tsx
42273
42314
  import { Box, Text, Spacer } from "ink";
42274
42315
  import Spinner from "ink-spinner";
@@ -46309,7 +46350,7 @@ __export(app_exports, {
46309
46350
  });
46310
46351
  import { useState as useState7, useEffect as useEffect4, useCallback as useCallback6, useRef as useRef5, useMemo } from "react";
46311
46352
  import { render, Box as Box8, Text as Text8, useInput as useInput2, useStdout } from "ink";
46312
- import chalk12 from "chalk";
46353
+ import chalk13 from "chalk";
46313
46354
  import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
46314
46355
  function fmtTime2() {
46315
46356
  return (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
@@ -46320,11 +46361,11 @@ function fmtTime2() {
46320
46361
  }
46321
46362
  function styleLine(line) {
46322
46363
  if (/^#{1,3}\s/.test(line)) {
46323
- return chalk12.bold(line.replace(/^#{1,3}\s*/, ""));
46364
+ return chalk13.bold(line.replace(/^#{1,3}\s*/, ""));
46324
46365
  }
46325
46366
  let out = line;
46326
- out = out.replace(/\*\*(.+?)\*\*/g, (_, t) => chalk12.bold(t));
46327
- out = out.replace(/`([^`]+)`/g, (_, t) => chalk12.gray(t));
46367
+ out = out.replace(/\*\*(.+?)\*\*/g, (_, t) => chalk13.bold(t));
46368
+ out = out.replace(/`([^`]+)`/g, (_, t) => chalk13.gray(t));
46328
46369
  return out;
46329
46370
  }
46330
46371
  function logMessage(role, content) {
@@ -46333,7 +46374,7 @@ function logMessage(role, content) {
46333
46374
  const color = isUser ? C_USER : C_VIZZOR;
46334
46375
  const icon = isUser ? "\u25CF" : "\u25C6";
46335
46376
  const label = isUser ? "You" : "Vizzor";
46336
- const lines = ["", ` ${color(icon)} ${color.bold(label)} ${chalk12.dim(time)}`];
46377
+ const lines = ["", ` ${color(icon)} ${color.bold(label)} ${chalk13.dim(time)}`];
46337
46378
  for (const line of content.split("\n")) {
46338
46379
  const styled = isUser ? line : styleLine(line);
46339
46380
  lines.push(` ${color("\u2502")} ${styled}`);
@@ -46950,8 +46991,8 @@ var init_app = __esm({
46950
46991
  init_tool_handler();
46951
46992
  init_tools();
46952
46993
  init_token_resolver();
46953
- C_USER = chalk12.hex("#FFA500");
46954
- C_VIZZOR = chalk12.hex("#4A9EFF");
46994
+ C_USER = chalk13.hex("#FFA500");
46995
+ C_VIZZOR = chalk13.hex("#4A9EFF");
46955
46996
  SEVERITY_COLORS = {
46956
46997
  info: "green",
46957
46998
  warning: "yellow",
@@ -47078,6 +47119,10 @@ cvCmd.command("status").description("Show ChronoVisor engine status").action(asy
47078
47119
  });
47079
47120
  var { registerWalletCommand: registerWalletCommand2 } = await Promise.resolve().then(() => (init_wallet2(), wallet_exports));
47080
47121
  registerWalletCommand2(program);
47122
+ program.command("update").description("Update Vizzor to the latest version").action(async () => {
47123
+ const { handleUpdateCommand: handleUpdateCommand2 } = await Promise.resolve().then(() => (init_update(), update_exports));
47124
+ await handleUpdateCommand2(pkg.version);
47125
+ });
47081
47126
  var args = process.argv.slice(2);
47082
47127
  if (args.length === 0) {
47083
47128
  let config3 = await loadConfig();
@@ -47095,8 +47140,8 @@ if (args.length === 0) {
47095
47140
  config3 = await loadConfig();
47096
47141
  }
47097
47142
  }
47098
- const ora = (await import("ora")).default;
47099
- const spinner = ora({ text: "Starting Vizzor...", spinner: "dots" }).start();
47143
+ const ora2 = (await import("ora")).default;
47144
+ const spinner = ora2({ text: "Starting Vizzor...", spinner: "dots" }).start();
47100
47145
  const { setConfig: setConfig2, setToolHandler: setToolHandler2 } = await Promise.resolve().then(() => (init_client2(), client_exports2));
47101
47146
  const { handleTool: handleTool2 } = await Promise.resolve().then(() => (init_tool_handler(), tool_handler_exports));
47102
47147
  setConfig2(config3);