import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
import {
  runCuration
} from "./chunk-PQWQC3RF.js";
import {
  VectorIndex
} from "./chunk-4RMSHZE4.js";
import "./chunk-ALBVNGCF.js";
import "./chunk-RGVBGTD6.js";
import {
  createEmbeddingProvider,
  createLlmProvider
} from "./chunk-V5R6O6RP.js";
import "./chunk-RY76WEN3.js";
import "./chunk-6FQISQNA.js";
import {
  MycoIndex
} from "./chunk-TWSTAVLO.js";
import "./chunk-MWW62YZP.js";
import {
  loadConfig
} from "./chunk-YG6MLLGL.js";
import "./chunk-JSK7L46L.js";
import "./chunk-RNWALAFP.js";
import "./chunk-WBLTISAK.js";
import "./chunk-PZUWP5VK.js";

// src/cli/curate.ts
import path from "path";
async function run(args, vaultDir) {
  const isDryRun = args.includes("--dry-run");
  const config = loadConfig(vaultDir);
  const index = new MycoIndex(path.join(vaultDir, "index.db"));
  const llmProvider = createLlmProvider(config.intelligence.llm);
  const embeddingProvider = createEmbeddingProvider(config.intelligence.embedding);
  let vectorIndex = null;
  try {
    const testEmbed = await embeddingProvider.embed("test");
    vectorIndex = new VectorIndex(path.join(vaultDir, "vectors.db"), testEmbed.dimensions);
  } catch (e) {
    console.error(`Vector index unavailable: ${e.message}`);
    console.error("Curate requires a working embedding provider.");
    index.close();
    process.exit(1);
  }
  try {
    if (isDryRun) {
      console.log("Dry run \u2014 no changes will be written.\n");
    }
    const result = await runCuration(
      {
        vaultDir,
        config,
        index,
        vectorIndex,
        llmProvider,
        embeddingProvider,
        log: (_level, message) => console.log(`  ${message}`)
      },
      isDryRun
    );
    console.log(`
Curation complete:`);
    console.log(`  Scanned: ${result.scanned} active spores`);
    console.log(`  Clusters evaluated: ${result.clustersEvaluated}`);
    if (isDryRun) {
      console.log(`  Would supersede: ${result.superseded}`);
    } else {
      console.log(`  Superseded: ${result.superseded}`);
    }
  } finally {
    index.close();
    vectorIndex?.close();
  }
}
export {
  run
};
//# sourceMappingURL=curate-DYE4VCBJ.js.map