Files
CatoandClaude Opus 5.5 405ba372d4 feat(auth): stage AccountKit beside Auth.js, switch off (#209)
* feat(auth): stage AccountKit beside Auth.js, switch off

Kivvi moves from Auth.js to @bitbaum/accountkit one reversible step at a
time, the same way evig did. This step adds everything the switch needs and
changes nothing while AUTH_RUNTIME is unset.

- Migration 0038: AccountKit's tables under an `auth_` prefix, plus the
  users <-> auth_users mirror functions, inert until attached.
- scripts/db/accountkit-import.sql: copies accounts under their own ids and
  bcrypt hashes byte for byte, refuses address collisions, drift or a live
  shared runtime, then attaches the mirror triggers. The rehearsal CLI always
  rolls back and prints only counts.
- apps/web/lib/accountkit/: the runtime (ids: 'uuid', legacy bcrypt, AccountKit
  0.16.0), a session reader in Kivvi's shape re-read from `users` and the
  membership on every request, and a bridge that answers next-auth/react.
  AccountKit's own credential endpoints stay closed: Kivvi's sign-up, reset and
  password change remain the only writers, and the triggers carry them over.
  Changing your own password keeps that session and ends the others.
- apps/web/lib/session-claims.ts: the company/role/onboarding rule, written
  once and used by both runtimes.
- The middleware has one routing function and two session sources, and runs
  on Node so it can read a database session.
- browser-smoke.yml runs the account journey once per runtime; the AccountKit
  leg first runs the rehearsal and the real-database journeys.

docs/ACCOUNTKIT-MIGRATION.md records what is left before switching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML

* fix(web): load tailwindcss-animate by import; keep the switch-off password path unchanged

Node 24 loads tailwind.config.ts natively as ESM, where require() is not
defined, and next dev exited in the chatkit smoke. The settings password change
now uses a transaction only when it has a shared session to keep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmud6zcK4rStBGmYSML

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-01 08:32:07 +01:00
..