@devness/useai 0.5.48 → 0.6.0

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.
Files changed (2) hide show
  1. package/dist/index.js +57 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -684,7 +684,7 @@ var VERSION;
684
684
  var init_version = __esm({
685
685
  "../shared/dist/constants/version.js"() {
686
686
  "use strict";
687
- VERSION = "0.5.48";
687
+ VERSION = "0.6.0";
688
688
  }
689
689
  });
690
690
 
@@ -5652,6 +5652,21 @@ async function fetchDaemonHealth(port) {
5652
5652
  }
5653
5653
  function findPidsByPort(port) {
5654
5654
  try {
5655
+ if (process.platform === "win32") {
5656
+ const output2 = execSync2(`netstat -ano | findstr :${port} | findstr LISTENING`, {
5657
+ encoding: "utf-8",
5658
+ timeout: 5e3,
5659
+ shell: "cmd.exe"
5660
+ });
5661
+ const pids = /* @__PURE__ */ new Set();
5662
+ for (const line of output2.trim().split("\n")) {
5663
+ const parts = line.trim().split(/\s+/);
5664
+ const pid = parseInt(parts[parts.length - 1], 10);
5665
+ if (!isNaN(pid) && pid > 0)
5666
+ pids.add(pid);
5667
+ }
5668
+ return [...pids];
5669
+ }
5655
5670
  const output = execSync2(`lsof -ti :${port}`, { encoding: "utf-8", timeout: 3e3 });
5656
5671
  return output.trim().split("\n").map((s) => parseInt(s, 10)).filter((n) => !isNaN(n) && n > 0);
5657
5672
  } catch {
@@ -5723,11 +5738,16 @@ async function ensureDaemon(options) {
5723
5738
  }
5724
5739
  }
5725
5740
  }
5741
+ const isWindows2 = process.platform === "win32";
5726
5742
  let npxPath;
5727
- try {
5728
- npxPath = resolveNpxPath();
5729
- } catch {
5743
+ if (isWindows2) {
5730
5744
  npxPath = "npx";
5745
+ } else {
5746
+ try {
5747
+ npxPath = resolveNpxPath();
5748
+ } catch {
5749
+ npxPath = "npx";
5750
+ }
5731
5751
  }
5732
5752
  const usePreferOnline = options?.preferOnline !== false;
5733
5753
  const npxArgs = ["-y"];
@@ -5737,7 +5757,7 @@ async function ensureDaemon(options) {
5737
5757
  const child = spawn(npxPath, npxArgs, {
5738
5758
  detached: true,
5739
5759
  stdio: "ignore",
5740
- shell: process.platform === "win32"
5760
+ shell: isWindows2
5741
5761
  });
5742
5762
  child.unref();
5743
5763
  const start = Date.now();
@@ -15294,18 +15314,36 @@ function showManualHints(installedTools) {
15294
15314
  }
15295
15315
  console.log();
15296
15316
  }
15317
+ function startSpinner(message) {
15318
+ let frame = 0;
15319
+ const interval = setInterval(() => {
15320
+ const symbol = source_default.cyan(SPINNER_FRAMES[frame % SPINNER_FRAMES.length]);
15321
+ process.stdout.write(`\r ${symbol} ${source_default.dim(message)}`);
15322
+ frame++;
15323
+ }, 80);
15324
+ return {
15325
+ stop(finalMessage) {
15326
+ clearInterval(interval);
15327
+ process.stdout.write(`\r${" ".repeat(message.length + 10)}\r`);
15328
+ console.log(finalMessage);
15329
+ }
15330
+ };
15331
+ }
15297
15332
  async function daemonInstallFlow(tools, autoYes, explicit) {
15298
- console.log(source_default.dim(" Ensuring UseAI daemon is running..."));
15333
+ const spinner = startSpinner("Starting UseAI daemon...");
15299
15334
  const daemonOk = await ensureDaemon();
15300
- let useDaemon = true;
15301
- if (daemonOk) {
15302
- console.log(source_default.green(` \u2713 Daemon running on port ${DAEMON_PORT}`));
15303
- console.log(source_default.dim(` Dashboard: http://127.0.0.1:${DAEMON_PORT}/dashboard`));
15304
- } else {
15305
- useDaemon = false;
15306
- console.log(source_default.red(` \u2717 Could not start daemon \u2014 falling back to stdio config`));
15307
- console.log(source_default.dim(` (Run with --foreground to debug: npx @devness/useai@latest daemon --port ${DAEMON_PORT})`));
15335
+ if (!daemonOk) {
15336
+ spinner.stop(source_default.red(` \u2717 Could not start daemon on port ${DAEMON_PORT}`));
15337
+ console.log();
15338
+ console.log(source_default.bold(" To debug, run the daemon in foreground mode:"));
15339
+ console.log(source_default.cyan(` npx @devness/useai@latest daemon --port ${DAEMON_PORT}`));
15340
+ console.log();
15341
+ console.log(source_default.dim(" If you need stdio mode (e.g. containers/CI), use: npx @devness/useai mcp --stdio"));
15342
+ return;
15308
15343
  }
15344
+ const useDaemon = true;
15345
+ spinner.stop(source_default.green(` \u2713 Daemon running on port ${DAEMON_PORT}`));
15346
+ console.log(source_default.dim(` Dashboard: http://127.0.0.1:${DAEMON_PORT}/dashboard`));
15309
15347
  if (useDaemon) {
15310
15348
  const platform = detectPlatform();
15311
15349
  if (platform !== "unsupported") {
@@ -15591,13 +15629,14 @@ async function runSetup(args) {
15591
15629
  await daemonInstallFlow(tools, autoYes, explicit);
15592
15630
  }
15593
15631
  }
15594
- var _shared;
15632
+ var _shared, SPINNER_FRAMES;
15595
15633
  var init_setup = __esm({
15596
15634
  "src/setup.ts"() {
15597
15635
  "use strict";
15598
15636
  init_source();
15599
15637
  init_dist();
15600
15638
  init_tools2();
15639
+ SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
15601
15640
  }
15602
15641
  });
15603
15642
 
@@ -36548,17 +36587,9 @@ if (subcommand === "update") {
36548
36587
  const daemonOk = await ensureDaemon2({ preferOnline: true });
36549
36588
  if (!daemonOk) {
36550
36589
  console.log(chalk2.red(" \u2717 Failed to start updated daemon"));
36551
- if (configuredTools.length > 0) {
36552
- console.log(chalk2.dim("\n Reinstalling MCP configs (stdio fallback)..."));
36553
- for (const tool of configuredTools) {
36554
- try {
36555
- tool.install();
36556
- console.log(chalk2.green(` \u2713 ${tool.name} \u2192 ${chalk2.dim("stdio")}`));
36557
- } catch {
36558
- console.log(chalk2.red(` \u2717 ${tool.name}`));
36559
- }
36560
- }
36561
- }
36590
+ console.log();
36591
+ console.log(chalk2.bold(" To debug, run the daemon in foreground mode:"));
36592
+ console.log(chalk2.cyan(" npx @devness/useai@latest daemon --port 19200"));
36562
36593
  process.exit(1);
36563
36594
  }
36564
36595
  const healthAfter = await fetchDaemonHealth2();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devness/useai",
3
- "version": "0.5.48",
3
+ "version": "0.6.0",
4
4
  "description": "Track your AI-assisted development workflow. MCP server that records usage metrics across all your AI tools.",
5
5
  "keywords": [
6
6
  "mcp",