// lib/install-state.ts
//
// Deliberately reads ONLY process.env — no filesystem, no database, no
// Node-specific APIs — so this is safe to import from middleware.ts, which
// runs in the Edge runtime even when self-hosted.
//
// The canonical signal for "installation is complete" is the explicit
// INSTALL_COMPLETE flag, written as the very last step of a successful
// install (by either the /install wizard or `npm run seed`). We do NOT
// infer install state from DATABASE_URL alone, since that could be present
// but pointing at a placeholder/broken value mid-setup.
export function isInstalled(): boolean {
  return process.env.INSTALL_COMPLETE === "true";
}
