[PR #6325] feat(CLI): init CLI refactor #6594

Open
opened 2026-03-13 13:04:37 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6325
Author: @ping-maxwell
Created: 11/26/2025
Status: 🔄 Open

Base: canaryHead: init-cli-refactor-2


📝 Commits (10+)

📊 Changes

71 files changed (+11954 additions, -2115 deletions)

View changed files

📝 docs/content/docs/adapters/mssql.mdx (+4 -4)
📝 docs/content/docs/installation.mdx (+18 -0)
packages/auth-cli/package.json (+59 -0)
packages/auth-cli/server/api/auth/[...all].ts (+5 -0)
packages/auth-cli/src/commands/init/configs/databases.config.ts (+435 -0)
packages/auth-cli/src/commands/init/configs/frameworks.config.ts (+177 -0)
packages/auth-cli/src/commands/init/configs/plugins-index.config.ts (+24 -0)
packages/auth-cli/src/commands/init/configs/social-providers.config.ts (+252 -0)
packages/auth-cli/src/commands/init/configs/temp-plugins.config.ts (+1593 -0)
packages/auth-cli/src/commands/init/generate-auth-client.ts (+58 -0)
packages/auth-cli/src/commands/init/generate-auth.ts (+175 -0)
packages/auth-cli/src/commands/init/hero-renderer.ts (+415 -0)
packages/auth-cli/src/commands/init/index.test.ts (+1074 -0)
packages/auth-cli/src/commands/init/index.ts (+1542 -0)
packages/auth-cli/src/commands/init/utility/auth-client-config.ts (+28 -0)
packages/auth-cli/src/commands/init/utility/auth-config.test.ts (+78 -0)
packages/auth-cli/src/commands/init/utility/auth-config.ts (+104 -0)
packages/auth-cli/src/commands/init/utility/database.test.ts (+204 -0)
packages/auth-cli/src/commands/init/utility/database.ts (+201 -0)
packages/auth-cli/src/commands/init/utility/env.test.ts (+235 -0)

...and 51 more files

📄 Description

Init CLI (without the plugin configuration options)


Summary by cubic

Refactors the init CLI into a modular, framework-aware flow that generates both server and client auth configs. Introduces a new standalone auth-cli with an auth binary, enhanced env handling, and smarter package manager detection.

  • New Features

    • Rebuilt init command with modular utilities (database adapters, prompts, imports, env, formatting).
    • Generates auth and auth client config with framework-aware imports.
    • Auto-detects framework and package manager (incl. monorepos), scaffolds route handlers, and installs required database dependencies.
    • Supports nested args, select/multiselect, examples, defaults, and schema validation.
    • Added standalone auth CLI with a small TUI hero renderer.
    • Added secret command to generate BETTER_AUTH_SECRET.
    • Annotated plugins with clearer JSDoc and defaults (e.g., email-otp, magic-link, siwe, two-factor, one-tap, organization, OIDC provider).
    • Added extensive tests for config generation and utilities.
    • Added ts-morph dev dependency.
    • Temporary plugin config is used by init until generated configs are fully wired in.
    • Removed old init from @better-auth/cli; exported generators for auth-cli use.
  • Migration

    • Use the new auth init command.

Written for commit af00ffdd4b. 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/6325 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 11/26/2025 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `init-cli-refactor-2` --- ### 📝 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 **71 files changed** (+11954 additions, -2115 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/adapters/mssql.mdx` (+4 -4) 📝 `docs/content/docs/installation.mdx` (+18 -0) ➕ `packages/auth-cli/package.json` (+59 -0) ➕ `packages/auth-cli/server/api/auth/[...all].ts` (+5 -0) ➕ `packages/auth-cli/src/commands/init/configs/databases.config.ts` (+435 -0) ➕ `packages/auth-cli/src/commands/init/configs/frameworks.config.ts` (+177 -0) ➕ `packages/auth-cli/src/commands/init/configs/plugins-index.config.ts` (+24 -0) ➕ `packages/auth-cli/src/commands/init/configs/social-providers.config.ts` (+252 -0) ➕ `packages/auth-cli/src/commands/init/configs/temp-plugins.config.ts` (+1593 -0) ➕ `packages/auth-cli/src/commands/init/generate-auth-client.ts` (+58 -0) ➕ `packages/auth-cli/src/commands/init/generate-auth.ts` (+175 -0) ➕ `packages/auth-cli/src/commands/init/hero-renderer.ts` (+415 -0) ➕ `packages/auth-cli/src/commands/init/index.test.ts` (+1074 -0) ➕ `packages/auth-cli/src/commands/init/index.ts` (+1542 -0) ➕ `packages/auth-cli/src/commands/init/utility/auth-client-config.ts` (+28 -0) ➕ `packages/auth-cli/src/commands/init/utility/auth-config.test.ts` (+78 -0) ➕ `packages/auth-cli/src/commands/init/utility/auth-config.ts` (+104 -0) ➕ `packages/auth-cli/src/commands/init/utility/database.test.ts` (+204 -0) ➕ `packages/auth-cli/src/commands/init/utility/database.ts` (+201 -0) ➕ `packages/auth-cli/src/commands/init/utility/env.test.ts` (+235 -0) _...and 51 more files_ </details> ### 📄 Description Init CLI (without the plugin configuration options) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Refactors the init CLI into a modular, framework-aware flow that generates both server and client auth configs. Introduces a new standalone auth-cli with an auth binary, enhanced env handling, and smarter package manager detection. - **New Features** - Rebuilt init command with modular utilities (database adapters, prompts, imports, env, formatting). - Generates auth and auth client config with framework-aware imports. - Auto-detects framework and package manager (incl. monorepos), scaffolds route handlers, and installs required database dependencies. - Supports nested args, select/multiselect, examples, defaults, and schema validation. - Added standalone auth CLI with a small TUI hero renderer. - Added secret command to generate BETTER_AUTH_SECRET. - Annotated plugins with clearer JSDoc and defaults (e.g., email-otp, magic-link, siwe, two-factor, one-tap, organization, OIDC provider). - Added extensive tests for config generation and utilities. - Added ts-morph dev dependency. - Temporary plugin config is used by init until generated configs are fully wired in. - Removed old init from @better-auth/cli; exported generators for auth-cli use. - **Migration** - Use the new auth init command. <sup>Written for commit af00ffdd4b4e789c2be38f598611a87f0983c1b5. 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-03-13 13:04:37 -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#6594