[PR #8637] fix(cli): warn when old @better-auth/cli is used with better-auth v1.5.x+ #16356

Closed
opened 2026-04-13 10:30:06 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/8637

State: closed
Merged: Yes


Summary

Closes #8622

  • When the old @better-auth/cli detects better-auth >= 1.5.0 is installed, it prints a warning directing users to npx auth@latest
  • Uses createRequire from the user's CWD to resolve better-auth's package.json and semver.gte for version comparison
  • Uses chalk for terminal colors (consistent with the rest of the CLI, respects NO_COLOR)
  • Silently skips the check if better-auth is not installed yet

This is the correct target branch (v1.4.x) since the warning belongs in the old @better-auth/cli package, not the new auth CLI on canary.

See also: #8624 (same intent but incorrectly targets canary)

Test plan

  • Install better-auth@1.5.0 in a test project, run npx @better-auth/cli generate — should see the yellow warning
  • Install better-auth@1.4.21 in a test project, run npx @better-auth/cli generate — should NOT see a warning
  • Uninstall better-auth entirely, run npx @better-auth/cli init — should NOT see a warning (silent skip)
**Original Pull Request:** https://github.com/better-auth/better-auth/pull/8637 **State:** closed **Merged:** Yes --- ## Summary Closes #8622 - When the old `@better-auth/cli` detects `better-auth` >= 1.5.0 is installed, it prints a warning directing users to `npx auth@latest` - Uses `createRequire` from the user's CWD to resolve `better-auth`'s `package.json` and `semver.gte` for version comparison - Uses `chalk` for terminal colors (consistent with the rest of the CLI, respects `NO_COLOR`) - Silently skips the check if `better-auth` is not installed yet This is the correct target branch (`v1.4.x`) since the warning belongs in the **old** `@better-auth/cli` package, not the new `auth` CLI on `canary`. See also: #8624 (same intent but incorrectly targets `canary`) ## Test plan - [ ] Install `better-auth@1.5.0` in a test project, run `npx @better-auth/cli generate` — should see the yellow warning - [ ] Install `better-auth@1.4.21` in a test project, run `npx @better-auth/cli generate` — should NOT see a warning - [ ] Uninstall `better-auth` entirely, run `npx @better-auth/cli init` — should NOT see a warning (silent skip)
GiteaMirror added the pull-request label 2026-04-13 10:30:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#16356