import { fileURLToPath as __fileURLToPath } from 'url';
import { dirname as __pathDirname } from 'path';
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
function isLocalOnly() {
  return process.env["STACKMEMORY_LOCAL"] === "true" || process.env["STACKMEMORY_LOCAL"] === "1" || process.env["LOCAL_ONLY"] === "true";
}
function isFeatureEnabled(feature) {
  if (feature === "core") return true;
  if (isLocalOnly()) return false;
  switch (feature) {
    case "linear":
      return process.env["STACKMEMORY_LINEAR"] !== "false" && (!!process.env["LINEAR_API_KEY"] || !!process.env["LINEAR_OAUTH_TOKEN"]);
    case "whatsapp":
      return process.env["STACKMEMORY_WHATSAPP"] !== "false" && !!process.env["TWILIO_ACCOUNT_SID"];
    case "chromadb":
      return process.env["STACKMEMORY_CHROMADB"] === "true";
    case "aiSummaries":
      return process.env["STACKMEMORY_AI"] !== "false" && (!!process.env["ANTHROPIC_API_KEY"] || !!process.env["OPENAI_API_KEY"]);
    case "skills":
      return process.env["STACKMEMORY_SKILLS"] === "true" || process.env["STACKMEMORY_SKILLS"] === "1";
    default:
      return false;
  }
}
function getFeatureFlags() {
  return {
    core: true,
    linear: isFeatureEnabled("linear"),
    whatsapp: isFeatureEnabled("whatsapp"),
    chromadb: isFeatureEnabled("chromadb"),
    aiSummaries: isFeatureEnabled("aiSummaries"),
    skills: isFeatureEnabled("skills")
  };
}
function logFeatureStatus() {
  const flags = getFeatureFlags();
  const local = isLocalOnly();
  console.log(
    `StackMemory Mode: ${local ? "LOCAL (no external services)" : "FULL"}`
  );
  if (!local) {
    console.log(
      `  Linear: ${flags.linear ? "enabled" : "disabled (no API key)"}`
    );
    console.log(
      `  WhatsApp: ${flags.whatsapp ? "enabled" : "disabled (no Twilio)"}`
    );
    console.log(`  ChromaDB: ${flags.chromadb ? "enabled" : "disabled"}`);
    console.log(
      `  AI Summaries: ${flags.aiSummaries ? "enabled" : "disabled (no API key)"}`
    );
    console.log(
      `  Skills: ${flags.skills ? "enabled" : "disabled (set STACKMEMORY_SKILLS=true)"}`
    );
  }
}
export {
  getFeatureFlags,
  isFeatureEnabled,
  isLocalOnly,
  logFeatureStatus
};
//# sourceMappingURL=feature-flags.js.map
