import { select, input } from "@inquirer/prompts";
import { saveInitConfig, readInitConfig } from "./utils/config-writer.js";
async function promptExtras(dataDir) {
  const existing = readInitConfig(dataDir);
  const result = {};
  try {
    const engine = await select({
      message: "Search engine? (v1 = direct engines + verticals, searxng = legacy)",
      choices: [
        { name: "skip (keep current setting)", value: "skip" },
        { name: "v1 (recommended)", value: "v1" },
        { name: "searxng (legacy)", value: "searxng" }
      ],
      default: "skip"
    });
    if (engine !== "skip") result.engine = engine;
    const rss = await input({
      message: "RSS feed URLs to include in the news vertical (comma-separated, blank to skip)",
      default: typeof existing.rssFeeds === "string" ? existing.rssFeeds : ""
    });
    const feeds = rss.split(",").map((s) => s.trim()).filter(Boolean);
    if (feeds.length > 0) result.rssFeeds = feeds;
    const llm = await input({
      message: "Local LLM endpoint URL for research/extract fallback (blank to skip)",
      default: typeof existing.llmEndpoint === "string" ? existing.llmEndpoint : ""
    });
    if (llm.trim()) result.llmEndpoint = llm.trim();
  } catch (err) {
    if (err instanceof Error && /ExitPromptError|force closed/i.test(err.message)) {
      return {};
    }
    throw err;
  }
  if (Object.keys(result).length > 0) {
    saveInitConfig(dataDir, result);
  }
  return result;
}
export {
  promptExtras
};
//# sourceMappingURL=extras-prompt.js.map