import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
import {
  gatherStats
} from "./chunk-HRGHDMYI.js";
import "./chunk-4RMSHZE4.js";
import {
  MycoIndex
} from "./chunk-TWSTAVLO.js";
import "./chunk-25DJSF2K.js";
import "./chunk-SAKJMNSR.js";
import "./chunk-MWW62YZP.js";
import "./chunk-RNWALAFP.js";
import "./chunk-WBLTISAK.js";
import "./chunk-PZUWP5VK.js";

// src/cli/stats.ts
import fs from "fs";
import path from "path";
function run(_args, vaultDir) {
  const index = new MycoIndex(path.join(vaultDir, "index.db"));
  const stats = gatherStats(vaultDir, index);
  console.log("=== Myco Vault ===");
  console.log(`Path: ${stats.vault.path}`);
  console.log();
  console.log("--- Index ---");
  console.log(`Sessions:  ${stats.vault.session_count}`);
  console.log(`Spores:    ${Object.values(stats.vault.spore_counts).reduce((a, b) => a + b, 0)}`);
  console.log(`Plans:     ${stats.vault.plan_count}`);
  if (Object.keys(stats.vault.spore_counts).length > 0) {
    console.log("\n--- Spores by Type ---");
    for (const [t, c] of Object.entries(stats.vault.spore_counts).sort((a, b) => b[1] - a[1])) {
      console.log(`  ${t}: ${c}`);
    }
  }
  const vecDb = path.join(vaultDir, "vectors.db");
  if (fs.existsSync(vecDb)) {
    console.log(`
--- Vectors ---`);
    console.log(`Embeddings: ${stats.index.vector_count}`);
  } else {
    console.log("\nVectors: not initialized");
  }
  if (stats.daemon) {
    const d = stats.daemon;
    console.log(`
--- Daemon ---`);
    console.log(`PID:      ${d.pid} (${d.alive ? "running" : "dead"})`);
    console.log(`Port:     ${d.port}`);
    console.log(`Dashboard: http://localhost:${d.port}/`);
    console.log(`Started:  ${d.started}`);
    console.log(`Sessions: ${d.active_sessions.length}`);
  }
  index.close();
}
export {
  run
};
//# sourceMappingURL=stats-2OUQSEZO.js.map