// Auto-discovers feature modules under modules/ — any folder with a
// module.jsx exporting MANIFEST ({key,label,icon,order}) + Component is
// picked up automatically. Add a new module folder and it appears in the
// Modules hover menu with no edits here.
const discovered = import.meta.glob("./*/module.jsx", { eager: true });

export const MODULES = Object.values(discovered)
  .filter(m => m.MANIFEST && m.Component)
  .map(m => ({ ...m.MANIFEST, Component: m.Component }))
  .sort((a, b) => (a.order ?? 99) - (b.order ?? 99));
