function generateEnvExample(context) {
  const { manifest } = context;
  const envVars = aggregateEnvironmentVariables(context.implementationTypes || []);
  const byCategory = {};
  for (const envVar of envVars) {
    const category = envVar.category || "Configuration";
    if (!byCategory[category]) {
      byCategory[category] = [];
    }
    byCategory[category].push(envVar);
  }
  const lines = [
    "# Environment Configuration",
    "# Copy this file to .env and fill in your values",
    ""
  ];
  for (const [category, vars] of Object.entries(byCategory)) {
    lines.push(`# ${category}`);
    for (const envVar of vars) {
      if (envVar.description) {
        lines.push(`# ${envVar.description}`);
      }
      if (envVar.required) {
        lines.push(`# REQUIRED`);
      }
      const value = envVar.example || "";
      lines.push(`${envVar.name}="${value}"`);
    }
    lines.push("");
  }
  return lines.join("\n");
}
function aggregateEnvironmentVariables(implementationTypes) {
  const envVarsMap = /* @__PURE__ */ new Map();
  if (!implementationTypes || implementationTypes.length === 0) {
    return [];
  }
  for (const implType of implementationTypes) {
    if (implType.requirements?.environment) {
      for (const envVar of implType.requirements.environment) {
        if (!envVarsMap.has(envVar.name)) {
          envVarsMap.set(envVar.name, envVar);
        }
      }
    }
  }
  return Array.from(envVarsMap.values());
}
export {
  generateEnvExample as default
};
