[PR #5758] [CLOSED] feat(CLI): init CLI refactor - inc plugins #31805

Closed
opened 2026-04-17 22:40:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5758
Author: @ping-maxwell
Created: 11/4/2025
Status: Closed

Base: canaryHead: feat/init-cli-refactor


📝 Commits (10+)

📊 Changes

84 files changed (+13486 additions, -69 deletions)

View changed files

📝 packages/better-auth/src/plugins/admin/client.ts (+6 -0)
📝 packages/better-auth/src/plugins/admin/types.ts (+23 -1)
📝 packages/better-auth/src/plugins/anonymous/index.ts (+6 -0)
📝 packages/better-auth/src/plugins/api-key/types.ts (+61 -0)
📝 packages/better-auth/src/plugins/bearer/index.ts (+3 -0)
📝 packages/better-auth/src/plugins/captcha/types.ts (+17 -0)
📝 packages/better-auth/src/plugins/device-authorization/index.ts (+32 -0)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+34 -4)
📝 packages/better-auth/src/plugins/generic-oauth/index.ts (+3 -1)
📝 packages/better-auth/src/plugins/haveibeenpwned/index.ts (+6 -0)
📝 packages/better-auth/src/plugins/last-login-method/client.ts (+4 -1)
📝 packages/better-auth/src/plugins/last-login-method/index.ts (+11 -2)
📝 packages/better-auth/src/plugins/magic-link/index.ts (+34 -7)
📝 packages/better-auth/src/plugins/mcp/index.ts (+15 -0)
📝 packages/better-auth/src/plugins/multi-session/index.ts (+3 -0)
📝 packages/better-auth/src/plugins/oauth-proxy/index.ts (+8 -0)
📝 packages/better-auth/src/plugins/oidc-provider/types.ts (+48 -14)
📝 packages/better-auth/src/plugins/one-tap/client.ts (+30 -0)
📝 packages/better-auth/src/plugins/one-tap/index.ts (+7 -0)
📝 packages/better-auth/src/plugins/one-time-token/index.ts (+11 -1)

...and 64 more files

📄 Description

WIP.

Current progress:

  • script to use types & JSDoc to generate plugin argument options.
    todo:
  • Should start work on CLI interactive UI to select plugins & DB & framework and whatnot.
  • Got to make route.ts framework endpoints file thing
  • Env update / create
  • etc

Summary by cubic

Refactors the init CLI into a modular auth.ts generator with interactive, nested plugin args, and auto-generates CLI plugin configs from plugin JSDoc. Adds database adapters, import utilities, and tests; the init command currently generates and prints the auth config.

  • New Features

    • Automatic plugin config generator (ts-morph + JSDoc @cli tags), wired into the build; generates configs for admin, twoFactor, username, anonymous, phoneNumber, magicLink, emailOTP, passkey, oneTap, siwe, genericOAuth, apiKey, mcp, oidcProvider, organization, sso, bearer, captcha, deviceAuthorization, haveIBeenPwned, lastLoginMethod, multiSession, oauthProxy, openAPI, oneTimeToken, and jwt.
    • Modular database adapter config (prisma, drizzle, kysely, mongodb) with imports, preCode, and code builders; Zod-backed validation for plugin prompts.
    • CLI init scaffold with Clack prompts and flag parsing; utilities for creating/grouping imports and formatting; tests for generator, imports, database, auth config, and plugins.
  • Refactors

    • Legacy init moved to OLD_init; generators import types from OLD_init.
    • Split the previous init logic into focused utility modules and auto-generated plugin configs.

Written for commit 9b15a730e7. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5758 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 11/4/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/init-cli-refactor` --- ### 📝 Commits (10+) - [`9db0b12`](https://github.com/better-auth/better-auth/commit/9db0b12e8ac48551ce648d4a565c78b8afefac32) feat(CLI): `init` CLI refactor - [`36e47c5`](https://github.com/better-auth/better-auth/commit/36e47c544d0057806d4d596d8546ce5262cb2014) update: plugin generation - [`bca6b96`](https://github.com/better-auth/better-auth/commit/bca6b963f53bc01b1dba97a6a0b4a73f21d0c8a9) Merge branch 'canary' into feat/init-cli-refactor - [`4e5a6b7`](https://github.com/better-auth/better-auth/commit/4e5a6b7a8387a2f5ec15cbbb0630f1a59b7b2da0) update: support nested args - [`c63a8fe`](https://github.com/better-auth/better-auth/commit/c63a8feaadbedd0c0f3e1acd2f158e9f0c7a1072) add: plugin config generator script - [`dc2fc6a`](https://github.com/better-auth/better-auth/commit/dc2fc6aa2ad884a3167e074ad1a84e8d8fe66ee2) chore: lint - [`87c4ca5`](https://github.com/better-auth/better-auth/commit/87c4ca564a63ca695b316226e24962a60162be1e) chore: lint - [`104daee`](https://github.com/better-auth/better-auth/commit/104daee1ca801a1da496a0e3f1cd77d358d50042) update: progress - [`51d467e`](https://github.com/better-auth/better-auth/commit/51d467e36529519b64513755d083d72039db13f2) update: support a few more plugins - [`9bf69ec`](https://github.com/better-auth/better-auth/commit/9bf69ecc1d5ef0e91840e248ac4b5360bf88f84c) chore: lint ### 📊 Changes **84 files changed** (+13486 additions, -69 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/admin/client.ts` (+6 -0) 📝 `packages/better-auth/src/plugins/admin/types.ts` (+23 -1) 📝 `packages/better-auth/src/plugins/anonymous/index.ts` (+6 -0) 📝 `packages/better-auth/src/plugins/api-key/types.ts` (+61 -0) 📝 `packages/better-auth/src/plugins/bearer/index.ts` (+3 -0) 📝 `packages/better-auth/src/plugins/captcha/types.ts` (+17 -0) 📝 `packages/better-auth/src/plugins/device-authorization/index.ts` (+32 -0) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+34 -4) 📝 `packages/better-auth/src/plugins/generic-oauth/index.ts` (+3 -1) 📝 `packages/better-auth/src/plugins/haveibeenpwned/index.ts` (+6 -0) 📝 `packages/better-auth/src/plugins/last-login-method/client.ts` (+4 -1) 📝 `packages/better-auth/src/plugins/last-login-method/index.ts` (+11 -2) 📝 `packages/better-auth/src/plugins/magic-link/index.ts` (+34 -7) 📝 `packages/better-auth/src/plugins/mcp/index.ts` (+15 -0) 📝 `packages/better-auth/src/plugins/multi-session/index.ts` (+3 -0) 📝 `packages/better-auth/src/plugins/oauth-proxy/index.ts` (+8 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/types.ts` (+48 -14) 📝 `packages/better-auth/src/plugins/one-tap/client.ts` (+30 -0) 📝 `packages/better-auth/src/plugins/one-tap/index.ts` (+7 -0) 📝 `packages/better-auth/src/plugins/one-time-token/index.ts` (+11 -1) _...and 64 more files_ </details> ### 📄 Description WIP. Current progress: - script to use types & JSDoc to generate plugin argument options. todo: - Should start work on CLI interactive UI to select plugins & DB & framework and whatnot. - Got to make `route.ts` framework endpoints file thing - Env update / create - etc <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Refactors the init CLI into a modular auth.ts generator with interactive, nested plugin args, and auto-generates CLI plugin configs from plugin JSDoc. Adds database adapters, import utilities, and tests; the init command currently generates and prints the auth config. - **New Features** - Automatic plugin config generator (ts-morph + JSDoc @cli tags), wired into the build; generates configs for admin, twoFactor, username, anonymous, phoneNumber, magicLink, emailOTP, passkey, oneTap, siwe, genericOAuth, apiKey, mcp, oidcProvider, organization, sso, bearer, captcha, deviceAuthorization, haveIBeenPwned, lastLoginMethod, multiSession, oauthProxy, openAPI, oneTimeToken, and jwt. - Modular database adapter config (prisma, drizzle, kysely, mongodb) with imports, preCode, and code builders; Zod-backed validation for plugin prompts. - CLI init scaffold with Clack prompts and flag parsing; utilities for creating/grouping imports and formatting; tests for generator, imports, database, auth config, and plugins. - **Refactors** - Legacy init moved to OLD_init; generators import types from OLD_init. - Split the previous init logic into focused utility modules and auto-generated plugin configs. <sup>Written for commit 9b15a730e7ef5e1d08b58d049089c27a2b9bfaa6. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 22:40:49 -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#31805