auth 1.5.2 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["generateSecretHash","fs","fs","possiblePaths","createMockAdapter","z","fs","getVersion","packageJsonStrategy","prettierFormat","z","getDatabaseCode","fs","log","fs","generateSecretHash","os","path","fs","z","z"],"sources":["../src/generators/drizzle.ts","../src/generators/kysely.ts","../src/utils/helper.ts","../src/utils/get-package-info.ts","../src/generators/prisma.ts","../src/generators/index.ts","../src/utils/add-cloudflare-modules.ts","../src/utils/add-svelte-kit-env-modules.ts","../src/utils/get-tsconfig-info.ts","../src/utils/get-config.ts","../src/commands/generate.ts","../src/commands/info.ts","../src/utils/check-package-managers.ts","../src/utils/config-paths.ts","../src/utils/install-dependencies.ts","../src/commands/init/configs/frameworks.config.ts","../src/commands/init/configs/social-providers.config.ts","../src/commands/init/utility/format.ts","../src/commands/init/utility/imports.ts","../src/commands/init/configs/temp-plugins.config.ts","../src/commands/init/utility/prompt.ts","../src/commands/init/utility/plugin.ts","../src/commands/init/utility/auth-config.ts","../src/commands/init/configs/databases.config.ts","../src/commands/init/utility/database.ts","../src/commands/init/generate-auth.ts","../src/commands/init/utility/auth-client-config.ts","../src/commands/init/generate-auth-client.ts","../src/commands/init/utility/env.ts","../src/commands/init/utility/framework.ts","../src/commands/init/index.ts","../src/commands/login.ts","../src/commands/mcp.ts","../src/commands/migrate.ts","../src/commands/secret.ts","../src/utils/fetch-latest-version.ts","../src/commands/upgrade.ts","../src/index.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { initGetFieldName, initGetModelName } from \"better-auth/adapters\";\nimport type { BetterAuthDBSchema, DBFieldAttribute } from \"better-auth/db\";\nimport { getAuthTables } from \"better-auth/db\";\nimport type { BetterAuthOptions } from \"better-auth/types\";\nimport prettier from \"prettier\";\nimport type { SchemaGenerator } from \"./types\";\n\nfunction convertToSnakeCase(str: string, camelCase?: boolean) {\n\tif (camelCase) {\n\t\treturn str;\n\t}\n\t// Handle consecutive capitals (like ID, URL, API) by treating them as a single word\n\treturn str\n\t\t.replace(/([A-Z]+)([A-Z][a-z])/g, \"$1_$2\") // Handle AABb -> AA_Bb\n\t\t.replace(/([a-z\\d])([A-Z])/g, \"$1_$2\") // Handle aBb -> a_Bb\n\t\t.toLowerCase();\n}\n\nexport const generateDrizzleSchema: SchemaGenerator = async ({\n\toptions,\n\tfile,\n\tadapter,\n}) => {\n\tconst tables = getAuthTables(options);\n\tconst filePath = file || \"./auth-schema.ts\";\n\tconst databaseType: \"sqlite\" | \"mysql\" | \"pg\" | undefined =\n\t\tadapter.options?.provider;\n\n\tif (!databaseType) {\n\t\tthrow new Error(\n\t\t\t`Database provider type is undefined during Drizzle schema generation. Please define a \\`provider\\` in the Drizzle adapter config. Read more at https://better-auth.com/docs/adapters/drizzle`,\n\t\t);\n\t}\n\tconst fileExist = existsSync(filePath);\n\n\tlet code: string = generateImport({\n\t\tdatabaseType,\n\t\ttables,\n\t\toptions,\n\t});\n\n\tconst getModelName = initGetModelName({\n\t\tschema: tables,\n\t\tusePlural: adapter.options?.adapterConfig?.usePlural,\n\t});\n\n\tconst getFieldName = initGetFieldName({\n\t\tschema: tables,\n\t\tusePlural: adapter.options?.adapterConfig?.usePlural,\n\t});\n\n\tfor (const tableKey in tables) {\n\t\tconst table = tables[tableKey]!;\n\t\tconst modelName = getModelName(tableKey);\n\t\tconst fields = table.fields;\n\n\t\tfunction getType(name: string, field: DBFieldAttribute) {\n\t\t\t// Not possible to reach, it's here to make typescript happy\n\t\t\tif (!databaseType) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Database provider type is undefined during Drizzle schema generation. Please define a \\`provider\\` in the Drizzle adapter config. Read more at https://better-auth.com/docs/adapters/drizzle`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tname = convertToSnakeCase(name, adapter.options?.camelCase);\n\t\t\tif (field.references?.field === \"id\") {\n\t\t\t\tconst useNumberId = options.advanced?.database?.generateId === \"serial\";\n\t\t\t\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\t\t\t\tif (useNumberId) {\n\t\t\t\t\tif (databaseType === \"pg\") {\n\t\t\t\t\t\treturn `integer('${name}')`;\n\t\t\t\t\t} else if (databaseType === \"mysql\") {\n\t\t\t\t\t\treturn `int('${name}')`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// using sqlite\n\t\t\t\t\t\treturn `integer('${name}')`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (useUUIDs && databaseType === \"pg\") {\n\t\t\t\t\treturn `uuid('${name}')`;\n\t\t\t\t}\n\t\t\t\tif (field.references.field) {\n\t\t\t\t\tif (databaseType === \"mysql\") {\n\t\t\t\t\t\treturn `varchar('${name}', { length: 36 })`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn `text('${name}')`;\n\t\t\t}\n\t\t\tconst type = field.type;\n\t\t\tif (typeof type !== \"string\") {\n\t\t\t\tif (Array.isArray(type) && type.every((x) => typeof x === \"string\")) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsqlite: `text({ enum: [${type.map((x) => `'${x}'`).join(\", \")}] })`,\n\t\t\t\t\t\tpg: `text('${name}', { enum: [${type.map((x) => `'${x}'`).join(\", \")}] })`,\n\t\t\t\t\t\tmysql: `mysqlEnum([${type.map((x) => `'${x}'`).join(\", \")}])`,\n\t\t\t\t\t}[databaseType];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\t`Invalid field type for field ${name} in model ${modelName}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst typeMap: Record<\n\t\t\t\ttypeof type,\n\t\t\t\tRecord<typeof databaseType, string>\n\t\t\t> = {\n\t\t\t\tstring: {\n\t\t\t\t\tsqlite: `text('${name}')`,\n\t\t\t\t\tpg: `text('${name}')`,\n\t\t\t\t\tmysql: field.unique\n\t\t\t\t\t\t? `varchar('${name}', { length: 255 })`\n\t\t\t\t\t\t: field.references\n\t\t\t\t\t\t\t? `varchar('${name}', { length: 36 })`\n\t\t\t\t\t\t\t: field.sortable\n\t\t\t\t\t\t\t\t? `varchar('${name}', { length: 255 })`\n\t\t\t\t\t\t\t\t: field.index\n\t\t\t\t\t\t\t\t\t? `varchar('${name}', { length: 255 })`\n\t\t\t\t\t\t\t\t\t: `text('${name}')`,\n\t\t\t\t},\n\t\t\t\tboolean: {\n\t\t\t\t\tsqlite: `integer('${name}', { mode: 'boolean' })`,\n\t\t\t\t\tpg: `boolean('${name}')`,\n\t\t\t\t\tmysql: `boolean('${name}')`,\n\t\t\t\t},\n\t\t\t\tnumber: {\n\t\t\t\t\tsqlite: `integer('${name}')`,\n\t\t\t\t\tpg: field.bigint\n\t\t\t\t\t\t? `bigint('${name}', { mode: 'number' })`\n\t\t\t\t\t\t: `integer('${name}')`,\n\t\t\t\t\tmysql: field.bigint\n\t\t\t\t\t\t? `bigint('${name}', { mode: 'number' })`\n\t\t\t\t\t\t: `int('${name}')`,\n\t\t\t\t},\n\t\t\t\tdate: {\n\t\t\t\t\tsqlite: `integer('${name}', { mode: 'timestamp_ms' })`,\n\t\t\t\t\tpg: `timestamp('${name}')`,\n\t\t\t\t\tmysql: `timestamp('${name}', { fsp: 3 })`,\n\t\t\t\t},\n\t\t\t\t\"number[]\": {\n\t\t\t\t\tsqlite: `text('${name}', { mode: \"json\" })`,\n\t\t\t\t\tpg: field.bigint\n\t\t\t\t\t\t? `bigint('${name}', { mode: 'number' }).array()`\n\t\t\t\t\t\t: `integer('${name}').array()`,\n\t\t\t\t\tmysql: `text('${name}', { mode: 'json' })`,\n\t\t\t\t},\n\t\t\t\t\"string[]\": {\n\t\t\t\t\tsqlite: `text('${name}', { mode: \"json\" })`,\n\t\t\t\t\tpg: `text('${name}').array()`,\n\t\t\t\t\tmysql: `text('${name}', { mode: \"json\" })`,\n\t\t\t\t},\n\t\t\t\tjson: {\n\t\t\t\t\tsqlite: `text('${name}', { mode: \"json\" })`,\n\t\t\t\t\tpg: `jsonb('${name}')`,\n\t\t\t\t\tmysql: `json('${name}', { mode: \"json\" })`,\n\t\t\t\t},\n\t\t\t} as const;\n\t\t\tconst dbTypeMap = (\n\t\t\t\ttypeMap as Record<string, Record<typeof databaseType, string>>\n\t\t\t)[type as string];\n\t\t\tif (!dbTypeMap) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unsupported field type '${field.type}' for field '${name}'.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn dbTypeMap[databaseType];\n\t\t}\n\n\t\tlet id: string = \"\";\n\n\t\tconst useNumberId = options.advanced?.database?.generateId === \"serial\";\n\t\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\n\t\tif (useUUIDs && databaseType === \"pg\") {\n\t\t\tid = `uuid(\"id\").default(sql\\`pg_catalog.gen_random_uuid()\\`).primaryKey()`;\n\t\t} else if (useNumberId) {\n\t\t\tif (databaseType === \"pg\") {\n\t\t\t\tid = `integer(\"id\").generatedByDefaultAsIdentity().primaryKey()`;\n\t\t\t} else if (databaseType === \"sqlite\") {\n\t\t\t\tid = `integer(\"id\", { mode: \"number\" }).primaryKey({ autoIncrement: true })`;\n\t\t\t} else {\n\t\t\t\tid = `int(\"id\").autoincrement().primaryKey()`;\n\t\t\t}\n\t\t} else {\n\t\t\tif (databaseType === \"mysql\") {\n\t\t\t\tid = `varchar('id', { length: 36 }).primaryKey()`;\n\t\t\t} else if (databaseType === \"pg\") {\n\t\t\t\tid = `text('id').primaryKey()`;\n\t\t\t} else {\n\t\t\t\tid = `text('id').primaryKey()`;\n\t\t\t}\n\t\t}\n\n\t\ttype Index = { type: \"uniqueIndex\" | \"index\"; name: string; on: string };\n\n\t\tconst indexes: Index[] = [];\n\n\t\tconst assignIndexes = (indexes: Index[]): string => {\n\t\t\tif (!indexes.length) return \"\";\n\n\t\t\tconst code: string[] = [`, (table) => [`];\n\n\t\t\tfor (const index of indexes) {\n\t\t\t\tcode.push(` ${index.type}(\"${index.name}\").on(table.${index.on}),`);\n\t\t\t}\n\n\t\t\tcode.push(`]`);\n\n\t\t\treturn code.join(\"\\n\");\n\t\t};\n\n\t\tconst schema = `export const ${modelName} = ${databaseType}Table(\"${convertToSnakeCase(\n\t\t\tmodelName,\n\t\t\tadapter.options?.camelCase,\n\t\t)}\", {\n\t\t\t\t\tid: ${id},\n\t\t\t\t\t${Object.keys(fields)\n\t\t\t\t\t\t.map((field) => {\n\t\t\t\t\t\t\tconst attr = fields[field]!;\n\t\t\t\t\t\t\tconst fieldName = attr.fieldName || field;\n\t\t\t\t\t\t\tlet type = getType(fieldName, attr);\n\n\t\t\t\t\t\t\tif (attr.index && !attr.unique) {\n\t\t\t\t\t\t\t\tindexes.push({\n\t\t\t\t\t\t\t\t\ttype: \"index\",\n\t\t\t\t\t\t\t\t\tname: `${modelName}_${fieldName}_idx`,\n\t\t\t\t\t\t\t\t\ton: fieldName,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else if (attr.index && attr.unique) {\n\t\t\t\t\t\t\t\tindexes.push({\n\t\t\t\t\t\t\t\t\ttype: \"uniqueIndex\",\n\t\t\t\t\t\t\t\t\tname: `${modelName}_${fieldName}_uidx`,\n\t\t\t\t\t\t\t\t\ton: fieldName,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tattr.defaultValue !== null &&\n\t\t\t\t\t\t\t\ttypeof attr.defaultValue !== \"undefined\"\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tif (typeof attr.defaultValue === \"function\") {\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tattr.type === \"date\" &&\n\t\t\t\t\t\t\t\t\t\tattr.defaultValue.toString().includes(\"new Date()\")\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tif (databaseType === \"sqlite\") {\n\t\t\t\t\t\t\t\t\t\t\ttype += `.default(sql\\`(cast(unixepoch('subsecond') * 1000 as integer))\\`)`;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ttype += `.defaultNow()`;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t// we are intentionally not adding .$defaultFn(${attr.defaultValue})\n\t\t\t\t\t\t\t\t\t\t// this is because if the defaultValue is a function, it could have\n\t\t\t\t\t\t\t\t\t\t// custom logic within that function that might not work in drizzle's context.\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (typeof attr.defaultValue === \"string\") {\n\t\t\t\t\t\t\t\t\ttype += `.default(\"${attr.defaultValue}\")`;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ttype += `.default(${attr.defaultValue})`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Add .$onUpdate() for fields with onUpdate property\n\t\t\t\t\t\t\t// Supported for all database types: PostgreSQL, MySQL, and SQLite\n\t\t\t\t\t\t\tif (attr.onUpdate && attr.type === \"date\") {\n\t\t\t\t\t\t\t\tif (typeof attr.onUpdate === \"function\") {\n\t\t\t\t\t\t\t\t\ttype += `.$onUpdate(${attr.onUpdate})`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn `${fieldName}: ${type}${attr.required ? \".notNull()\" : \"\"}${\n\t\t\t\t\t\t\t\tattr.unique ? \".unique()\" : \"\"\n\t\t\t\t\t\t\t}${\n\t\t\t\t\t\t\t\tattr.references\n\t\t\t\t\t\t\t\t\t? `.references(()=> ${getModelName(\n\t\t\t\t\t\t\t\t\t\t\tattr.references.model,\n\t\t\t\t\t\t\t\t\t\t)}.${getFieldName({ model: attr.references.model, field: attr.references.field })}, { onDelete: '${\n\t\t\t\t\t\t\t\t\t\t\tattr.references.onDelete || \"cascade\"\n\t\t\t\t\t\t\t\t\t\t}' })`\n\t\t\t\t\t\t\t\t\t: \"\"\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\",\\n \")}\n\t\t\t\t\t}${assignIndexes(indexes)});`;\n\t\tcode += `\\n${schema}\\n`;\n\t}\n\n\tlet relationsString: string = \"\";\n\tfor (const tableKey in tables) {\n\t\tconst table = tables[tableKey]!;\n\t\tconst modelName = getModelName(tableKey);\n\n\t\ttype Relation = {\n\t\t\t/**\n\t\t\t * The key of the relation that will be defined in the Drizzle schema.\n\t\t\t * For \"one\" relations: singular (e.g., \"user\")\n\t\t\t * For \"many\" relations: plural (e.g., \"posts\")\n\t\t\t */\n\t\t\tkey: string;\n\t\t\t/**\n\t\t\t * The model name being referenced.\n\t\t\t */\n\t\t\tmodel: string;\n\t\t\t/**\n\t\t\t * The type of the relation: \"one\" (many-to-one) or \"many\" (one-to-many).\n\t\t\t */\n\t\t\ttype: \"one\" | \"many\";\n\t\t\t/**\n\t\t\t * Foreign key field name and reference details (only for \"one\" relations).\n\t\t\t */\n\t\t\treference?: {\n\t\t\t\tfield: string;\n\t\t\t\treferences: string;\n\t\t\t\tfieldName: string; // Original field name for generating unique relation export names\n\t\t\t};\n\t\t};\n\n\t\tconst oneRelations: Relation[] = [];\n\t\tconst manyRelations: Relation[] = [];\n\t\t// Set to track \"many\" relations by key to prevent duplicates\n\t\tconst manyRelationsSet = new Set<string>();\n\n\t\t// 1. Find all foreign keys in THIS table (creates \"one\" relations)\n\t\tconst fields = Object.entries(table.fields);\n\t\tconst foreignFields = fields.filter(([_, field]) => field.references);\n\n\t\tfor (const [fieldName, field] of foreignFields) {\n\t\t\tconst referencedModel = field.references!.model;\n\t\t\tconst relationKey = getModelName(referencedModel);\n\t\t\tconst fieldRef = `${getModelName(tableKey)}.${getFieldName({ model: tableKey, field: fieldName })}`;\n\t\t\tconst referenceRef = `${getModelName(referencedModel)}.${getFieldName({ model: referencedModel, field: field.references!.field || \"id\" })}`;\n\n\t\t\t// Create a separate relation for each foreign key\n\t\t\toneRelations.push({\n\t\t\t\tkey: relationKey,\n\t\t\t\tmodel: getModelName(referencedModel),\n\t\t\t\ttype: \"one\",\n\t\t\t\treference: {\n\t\t\t\t\tfield: fieldRef,\n\t\t\t\t\treferences: referenceRef,\n\t\t\t\t\tfieldName: fieldName,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// 2. Find all OTHER tables that reference THIS table (creates \"many\" relations)\n\t\tconst otherModels = Object.entries(tables).filter(\n\t\t\t([modelName]) => modelName !== tableKey,\n\t\t);\n\n\t\t// Map to track relations by model name to determine if unique or many\n\t\tconst modelRelationsMap = new Map<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tmodelName: string;\n\t\t\t\thasUnique: boolean;\n\t\t\t\thasMany: boolean;\n\t\t\t}\n\t\t>();\n\n\t\tfor (const [modelName, otherTable] of otherModels) {\n\t\t\tconst foreignKeysPointingHere = Object.entries(otherTable.fields).filter(\n\t\t\t\t([_, field]) =>\n\t\t\t\t\tfield.references?.model === tableKey ||\n\t\t\t\t\tfield.references?.model === getModelName(tableKey),\n\t\t\t);\n\n\t\t\tif (foreignKeysPointingHere.length === 0) continue;\n\n\t\t\t// Check if any foreign key is unique\n\t\t\tconst hasUnique = foreignKeysPointingHere.some(\n\t\t\t\t([_, field]) => !!field.unique,\n\t\t\t);\n\t\t\tconst hasMany = foreignKeysPointingHere.some(\n\t\t\t\t([_, field]) => !field.unique,\n\t\t\t);\n\n\t\t\tmodelRelationsMap.set(modelName, {\n\t\t\t\tmodelName,\n\t\t\t\thasUnique,\n\t\t\t\thasMany,\n\t\t\t});\n\t\t}\n\n\t\t// Add relations, deduplicating by relationKey\n\t\tfor (const { modelName, hasMany } of modelRelationsMap.values()) {\n\t\t\t// Determine relation type: if all are unique, it's \"one\", otherwise \"many\"\n\t\t\tconst relationType = hasMany ? \"many\" : \"one\";\n\t\t\tlet relationKey = getModelName(modelName);\n\n\t\t\t// We have to apply this after checking if they have usePlural because otherwise they will end up seeing:\n\t\t\t/* cspell:disable-next-line */\n\t\t\t// \"sesionss\", or \"accountss\" - double s's.\n\t\t\tif (\n\t\t\t\t!adapter.options?.adapterConfig?.usePlural &&\n\t\t\t\trelationType === \"many\"\n\t\t\t) {\n\t\t\t\trelationKey = `${relationKey}s`;\n\t\t\t}\n\n\t\t\t// Only add if we haven't seen this key before\n\t\t\tif (!manyRelationsSet.has(relationKey)) {\n\t\t\t\tmanyRelationsSet.add(relationKey);\n\t\t\t\tmanyRelations.push({\n\t\t\t\t\tkey: relationKey,\n\t\t\t\t\tmodel: getModelName(modelName),\n\t\t\t\t\ttype: relationType,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Group \"one\" relations by referenced model to detect duplicates\n\t\tconst relationsByModel = new Map<string, Relation[]>();\n\t\tfor (const relation of oneRelations) {\n\t\t\tif (relation.reference) {\n\t\t\t\tconst modelKey = relation.key;\n\t\t\t\tif (!relationsByModel.has(modelKey)) {\n\t\t\t\t\trelationsByModel.set(modelKey, []);\n\t\t\t\t}\n\t\t\t\trelationsByModel.get(modelKey)!.push(relation);\n\t\t\t}\n\t\t}\n\n\t\t// Separate relations with duplicates (same model) from those without\n\t\tconst duplicateRelations: Relation[] = [];\n\t\tconst singleRelations: Relation[] = [];\n\n\t\tfor (const [_modelKey, relations] of relationsByModel.entries()) {\n\t\t\tif (relations.length > 1) {\n\t\t\t\t// Multiple relations to the same model - these need field-specific naming\n\t\t\t\tduplicateRelations.push(...relations);\n\t\t\t} else {\n\t\t\t\t// Single relation to this model - can be combined with others\n\t\t\t\tsingleRelations.push(relations[0]!);\n\t\t\t}\n\t\t}\n\n\t\t// Generate field-specific exports for duplicate relations\n\t\tfor (const relation of duplicateRelations) {\n\t\t\tif (relation.reference) {\n\t\t\t\tconst fieldName = relation.reference.fieldName;\n\t\t\t\tconst relationExportName = `${modelName}${fieldName.charAt(0).toUpperCase() + fieldName.slice(1)}Relations`;\n\n\t\t\t\tconst tableRelation = `export const ${relationExportName} = relations(${getModelName(\n\t\t\t\t\ttable.modelName,\n\t\t\t\t)}, ({ one }) => ({\n\t\t\t\t${relation.key}: one(${relation.model}, {\n\t\t\t\t\tfields: [${relation.reference.field}],\n\t\t\t\t\treferences: [${relation.reference.references}],\n\t\t\t\t})\n\t\t\t}))`;\n\n\t\t\t\trelationsString += `\\n${tableRelation}\\n`;\n\t\t\t}\n\t\t}\n\n\t\t// Combine all single \"one\" relations and \"many\" relations into exports\n\t\tconst hasOne = singleRelations.length > 0;\n\t\tconst hasMany = manyRelations.length > 0;\n\n\t\tif (hasOne && hasMany) {\n\t\t\t// Both \"one\" and \"many\" relations exist - combine in one export\n\t\t\tconst tableRelation = `export const ${modelName}Relations = relations(${getModelName(\n\t\t\t\ttable.modelName,\n\t\t\t)}, ({ one, many }) => ({\n\t\t\t\t${singleRelations\n\t\t\t\t\t.map((relation) =>\n\t\t\t\t\t\trelation.reference\n\t\t\t\t\t\t\t? ` ${relation.key}: one(${relation.model}, {\n\t\t\t\t\tfields: [${relation.reference.field}],\n\t\t\t\t\treferences: [${relation.reference.references}],\n\t\t\t\t})`\n\t\t\t\t\t\t\t: \"\",\n\t\t\t\t\t)\n\t\t\t\t\t.filter((x) => x !== \"\")\n\t\t\t\t\t.join(\",\\n \")}${\n\t\t\t\t\tsingleRelations.length > 0 && manyRelations.length > 0 ? \",\" : \"\"\n\t\t\t\t}\n\t\t\t\t${manyRelations\n\t\t\t\t\t.map(({ key, model }) => ` ${key}: many(${model})`)\n\t\t\t\t\t.join(\",\\n \")}\n\t\t\t}))`;\n\n\t\t\trelationsString += `\\n${tableRelation}\\n`;\n\t\t} else if (hasOne) {\n\t\t\t// Only \"one\" relations exist\n\t\t\tconst tableRelation = `export const ${modelName}Relations = relations(${getModelName(\n\t\t\t\ttable.modelName,\n\t\t\t)}, ({ one }) => ({\n\t\t\t\t${singleRelations\n\t\t\t\t\t.map((relation) =>\n\t\t\t\t\t\trelation.reference\n\t\t\t\t\t\t\t? ` ${relation.key}: one(${relation.model}, {\n\t\t\t\t\tfields: [${relation.reference.field}],\n\t\t\t\t\treferences: [${relation.reference.references}],\n\t\t\t\t})`\n\t\t\t\t\t\t\t: \"\",\n\t\t\t\t\t)\n\t\t\t\t\t.filter((x) => x !== \"\")\n\t\t\t\t\t.join(\",\\n \")}\n\t\t\t}))`;\n\n\t\t\trelationsString += `\\n${tableRelation}\\n`;\n\t\t} else if (hasMany) {\n\t\t\t// Only \"many\" relations exist\n\t\t\tconst tableRelation = `export const ${modelName}Relations = relations(${getModelName(\n\t\t\t\ttable.modelName,\n\t\t\t)}, ({ many }) => ({\n\t\t\t\t${manyRelations\n\t\t\t\t\t.map(({ key, model }) => ` ${key}: many(${model})`)\n\t\t\t\t\t.join(\",\\n \")}\n\t\t\t}))`;\n\n\t\t\trelationsString += `\\n${tableRelation}\\n`;\n\t\t}\n\t}\n\tcode += `\\n${relationsString}`;\n\n\tconst formattedCode = await prettier.format(code, {\n\t\tparser: \"typescript\",\n\t});\n\treturn {\n\t\tcode: formattedCode,\n\t\tfileName: filePath,\n\t\toverwrite: fileExist,\n\t};\n};\n\nfunction generateImport({\n\tdatabaseType,\n\ttables,\n\toptions,\n}: {\n\tdatabaseType: \"sqlite\" | \"mysql\" | \"pg\";\n\ttables: BetterAuthDBSchema;\n\toptions: BetterAuthOptions;\n}) {\n\tconst rootImports: string[] = [\"relations\"];\n\tconst coreImports: string[] = [];\n\n\tlet hasBigint = false;\n\tlet hasJson = false;\n\n\tfor (const table of Object.values(tables)) {\n\t\tfor (const field of Object.values(table.fields)) {\n\t\t\tif (field.bigint) hasBigint = true;\n\t\t\tif (field.type === \"json\") hasJson = true;\n\t\t}\n\t\tif (hasJson && hasBigint) break;\n\t}\n\n\tconst useNumberId = options.advanced?.database?.generateId === \"serial\";\n\n\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\n\tcoreImports.push(`${databaseType}Table`);\n\tcoreImports.push(\n\t\tdatabaseType === \"mysql\"\n\t\t\t? \"varchar, text\"\n\t\t\t: databaseType === \"pg\"\n\t\t\t\t? \"text\"\n\t\t\t\t: \"text\",\n\t);\n\tcoreImports.push(\n\t\thasBigint ? (databaseType !== \"sqlite\" ? \"bigint\" : \"\") : \"\",\n\t);\n\tcoreImports.push(databaseType !== \"sqlite\" ? \"timestamp, boolean\" : \"\");\n\tif (databaseType === \"mysql\") {\n\t\t// Only include int for MySQL if actually needed\n\t\tconst hasNonBigintNumber = Object.values(tables).some((table) =>\n\t\t\tObject.values(table.fields).some(\n\t\t\t\t(field) =>\n\t\t\t\t\t(field.type === \"number\" || field.type === \"number[]\") &&\n\t\t\t\t\t!field.bigint,\n\t\t\t),\n\t\t);\n\t\tconst needsInt = useNumberId || hasNonBigintNumber;\n\t\tif (needsInt) {\n\t\t\tcoreImports.push(\"int\");\n\t\t}\n\t\tconst hasEnum = Object.values(tables).some((table) =>\n\t\t\tObject.values(table.fields).some(\n\t\t\t\t(field) =>\n\t\t\t\t\ttypeof field.type !== \"string\" &&\n\t\t\t\t\tArray.isArray(field.type) &&\n\t\t\t\t\tfield.type.every((x) => typeof x === \"string\"),\n\t\t\t),\n\t\t);\n\t\tif (hasEnum) {\n\t\t\tcoreImports.push(\"mysqlEnum\");\n\t\t}\n\t} else if (databaseType === \"pg\") {\n\t\tif (useUUIDs) {\n\t\t\trootImports.push(\"sql\");\n\t\t}\n\n\t\t// Only include integer for PG if actually needed\n\t\tconst hasNonBigintNumber = Object.values(tables).some((table) =>\n\t\t\tObject.values(table.fields).some(\n\t\t\t\t(field) =>\n\t\t\t\t\t(field.type === \"number\" || field.type === \"number[]\") &&\n\t\t\t\t\t!field.bigint,\n\t\t\t),\n\t\t);\n\t\tconst hasFkToId = Object.values(tables).some((table) =>\n\t\t\tObject.values(table.fields).some(\n\t\t\t\t(field) => field.references?.field === \"id\",\n\t\t\t),\n\t\t);\n\t\t// handles the references field with useNumberId\n\t\tconst needsInteger =\n\t\t\thasNonBigintNumber ||\n\t\t\t(options.advanced?.database?.generateId === \"serial\" && hasFkToId);\n\t\tif (needsInteger) {\n\t\t\tcoreImports.push(\"integer\");\n\t\t}\n\t} else {\n\t\tcoreImports.push(\"integer\");\n\t}\n\tif (databaseType === \"pg\" && useUUIDs) {\n\t\tcoreImports.push(\"uuid\");\n\t}\n\n\t//handle json last on the import order\n\tif (hasJson) {\n\t\tif (databaseType === \"pg\") coreImports.push(\"jsonb\");\n\t\tif (databaseType === \"mysql\") coreImports.push(\"json\");\n\t\t// sqlite uses text for JSON, so there's no need to handle this case\n\t}\n\n\t// Add sql import for SQLite timestamps with defaultNow\n\tconst hasSQLiteTimestamp =\n\t\tdatabaseType === \"sqlite\" &&\n\t\tObject.values(tables).some((table) =>\n\t\t\tObject.values(table.fields).some(\n\t\t\t\t(field) =>\n\t\t\t\t\tfield.type === \"date\" &&\n\t\t\t\t\tfield.defaultValue &&\n\t\t\t\t\ttypeof field.defaultValue === \"function\" &&\n\t\t\t\t\tfield.defaultValue.toString().includes(\"new Date()\"),\n\t\t\t),\n\t\t);\n\n\tif (hasSQLiteTimestamp) {\n\t\trootImports.push(\"sql\");\n\t}\n\n\t//handle indexes\n\tconst hasIndexes = Object.values(tables).some((table) =>\n\t\tObject.values(table.fields).some((field) => field.index && !field.unique),\n\t);\n\tconst hasUniqueIndexes = Object.values(tables).some((table) =>\n\t\tObject.values(table.fields).some((field) => field.unique && field.index),\n\t);\n\tif (hasIndexes) {\n\t\tcoreImports.push(\"index\");\n\t}\n\tif (hasUniqueIndexes) {\n\t\tcoreImports.push(\"uniqueIndex\");\n\t}\n\n\treturn `${rootImports.length > 0 ? `import { ${rootImports.join(\", \")} } from \"drizzle-orm\";\\n` : \"\"}import { ${coreImports\n\t\t.map((x) => x.trim())\n\t\t.filter((x) => x !== \"\")\n\t\t.join(\", \")} } from \"drizzle-orm/${databaseType}-core\";\\n`;\n}\n","import { getMigrations } from \"better-auth/db/migration\";\nimport type { SchemaGenerator } from \"./types\";\n\nexport const generateKyselySchema: SchemaGenerator = async ({\n\toptions,\n\tfile,\n}) => {\n\tconst { compileMigrations } = await getMigrations(options);\n\tconst migrations = await compileMigrations();\n\treturn {\n\t\tcode: migrations.trim() === \";\" ? \"\" : migrations,\n\t\tfileName:\n\t\t\tfile ||\n\t\t\t`./better-auth_migrations/${new Date()\n\t\t\t\t.toISOString()\n\t\t\t\t.replace(/:/g, \"-\")}.sql`,\n\t};\n};\n","import { spawn } from \"node:child_process\";\nimport Crypto from \"node:crypto\";\n\ntype Success<T> = {\n\tdata: T;\n\terror: null;\n};\n\ntype Failure<E> = {\n\tdata: null;\n\terror: E;\n};\n\nexport type Result<T, E = Error> = Success<T> | Failure<E>;\n\nexport async function tryCatch<T, E = Error>(\n\tpromise: Promise<T>,\n): Promise<Result<T, E>> {\n\ttry {\n\t\tconst data = await promise;\n\t\treturn { data, error: null };\n\t} catch (error) {\n\t\treturn { data: null, error: error as E };\n\t}\n}\n\nexport function enterAlternateScreen() {\n\tprocess.stdout.write(\"\\u001B[?1049h\");\n\tprocess.stdout.write(\"\\u001B[2J\"); // Clear screen\n\tprocess.stdout.write(\"\\u001B[H\"); // Move cursor to home\n}\n\nexport function exitAlternateScreen() {\n\tprocess.stdout.write(\"\\u001B[?1049l\");\n}\n\nexport const generateSecretHash = () => {\n\treturn Crypto.randomBytes(16).toString(\"hex\");\n};\n\nexport const spawnCommand = (cmd: string, cwd: string = process.cwd()) =>\n\tnew Promise<void>((resolve, reject) => {\n\t\tconst child = spawn(cmd, {\n\t\t\tcwd,\n\t\t\tstdio: \"inherit\",\n\t\t\tshell: true,\n\t\t});\n\t\tchild.on(\"close\", (code, signal) => {\n\t\t\tif (code !== 0 && code !== null) {\n\t\t\t\treject(new Error(`Exited with code ${code}`));\n\t\t\t} else if (signal) {\n\t\t\t\treject(new Error(`Killed with signal ${signal}`));\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t\tchild.on(\"error\", reject);\n\t});\n","import { readFileSync } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { tryCatch } from \"./helper\";\n\nexport function getPackageInfo(cwd?: string) {\n\tconst packageJsonPath = cwd\n\t\t? path.join(cwd, \"package.json\")\n\t\t: path.join(\"package.json\");\n\treturn JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n}\n\nexport function getPrismaVersion(cwd?: string): number | null {\n\ttry {\n\t\tconst packageInfo = getPackageInfo(cwd);\n\t\tconst prismaVersion =\n\t\t\tpackageInfo.dependencies?.prisma ||\n\t\t\tpackageInfo.devDependencies?.prisma ||\n\t\t\tpackageInfo.dependencies?.[\"@prisma/client\"] ||\n\t\t\tpackageInfo.devDependencies?.[\"@prisma/client\"];\n\n\t\tif (!prismaVersion) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Extract major version number from version string\n\t\t// Handles versions like \"^5.0.0\", \"~7.1.0\", \"7.0.0\", etc.\n\t\tconst match = prismaVersion.match(/(\\d+)/);\n\t\treturn match ? parseInt(match[1], 10) : null;\n\t} catch {\n\t\t// If package.json doesn't exist or can't be read, return null\n\t\treturn null;\n\t}\n}\n\n/**\n * Checks if a package has a specific dependency.\n *\n * @param packageJson The package.json object\n * @param dependency The dependency to check for\n * @returns true if the package has the dependency\n */\nexport function hasDependency(packageJson: any, dependency: string) {\n\tlet hasDependency = false;\n\n\tif (\n\t\tpackageJson.dependencies?.[dependency] ||\n\t\tpackageJson.devDependencies?.[dependency] ||\n\t\tpackageJson.peerDependencies?.[dependency] ||\n\t\tpackageJson.optionalDependencies?.[dependency]\n\t) {\n\t\thasDependency = true;\n\t}\n\n\treturn hasDependency;\n}\n\n/**\n * Checks if a directory is a monorepo root by looking for common monorepo indicators.\n *\n * @param dir Directory to check\n * @returns true if the directory appears to be a monorepo root\n */\nasync function isMonorepoRoot(dir: string) {\n\tconst { data: files } = await tryCatch(fs.readdir(dir, \"utf-8\"));\n\tif (!files) return false;\n\n\t// Check for pnpm workspace\n\tif (files.includes(\"pnpm-workspace.yaml\")) {\n\t\treturn true;\n\t}\n\n\t// Check for yarn/npm workspaces in package.json\n\tif (files.includes(\"package.json\")) {\n\t\tconst packageJsonPath = path.join(dir, \"package.json\");\n\t\tconst { data } = await tryCatch(fs.readFile(packageJsonPath, \"utf-8\"));\n\t\tif (data) {\n\t\t\ttry {\n\t\t\t\tconst packageJson = JSON.parse(data);\n\t\t\t\t// Check for workspaces field (npm/yarn workspaces)\n\t\t\t\t// Workspaces can be an array or an object\n\t\t\t\tif (\n\t\t\t\t\tpackageJson.workspaces &&\n\t\t\t\t\t(Array.isArray(packageJson.workspaces) ||\n\t\t\t\t\t\ttypeof packageJson.workspaces === \"object\")\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Ignore JSON parse errors\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check for other monorepo indicators\n\tconst monorepoIndicators = [\n\t\t\"lerna.json\", // Lerna\n\t\t/* cSpell:disable */\n\t\t\"turbo.json\", // Turborepo\n\t\t\"nx.json\", // Nx\n\t\t\"rush.json\", // Rush\n\t];\n\n\treturn monorepoIndicators.some((indicator) => files.includes(indicator));\n}\n\n/**\n * Finds the monorepo root by walking up the directory tree.\n *\n * @param startDir Starting directory\n * @returns Path to monorepo root, or null if not found\n */\nexport async function findMonorepoRoot(\n\tstartDir: string,\n): Promise<string | null> {\n\tlet currentDir = path.resolve(startDir);\n\tconst root = path.parse(currentDir).root;\n\n\twhile (currentDir !== root) {\n\t\tif (await isMonorepoRoot(currentDir)) {\n\t\t\treturn currentDir;\n\t\t}\n\t\tconst parentDir = path.dirname(currentDir);\n\t\tif (parentDir === currentDir) {\n\t\t\tbreak;\n\t\t}\n\t\tcurrentDir = parentDir;\n\t}\n\n\treturn null;\n}\n","import { existsSync } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { capitalizeFirstLetter } from \"@better-auth/core/utils/string\";\nimport { produceSchema } from \"@mrleebo/prisma-ast\";\nimport { initGetFieldName, initGetModelName } from \"better-auth/adapters\";\nimport type { DBFieldType } from \"better-auth/db\";\nimport { getAuthTables } from \"better-auth/db\";\nimport { getPrismaVersion } from \"../utils/get-package-info\";\nimport type { SchemaGenerator } from \"./types\";\n\nexport const generatePrismaSchema: SchemaGenerator = async ({\n\tadapter,\n\toptions,\n\tfile,\n}) => {\n\tconst provider: \"sqlite\" | \"postgresql\" | \"mysql\" | \"mongodb\" =\n\t\tadapter.options?.provider || \"postgresql\";\n\tconst tables = getAuthTables(options);\n\tconst filePath = file || \"./prisma/schema.prisma\";\n\tconst schemaPrismaExist = existsSync(path.join(process.cwd(), filePath));\n\n\tconst getModelName = initGetModelName({\n\t\tschema: getAuthTables(options),\n\t\tusePlural: adapter.options?.adapterConfig?.usePlural,\n\t});\n\tconst getFieldName = initGetFieldName({\n\t\tschema: getAuthTables(options),\n\t\tusePlural: false,\n\t});\n\n\tlet schemaPrisma = \"\";\n\tif (schemaPrismaExist) {\n\t\tschemaPrisma = await fs.readFile(\n\t\t\tpath.join(process.cwd(), filePath),\n\t\t\t\"utf-8\",\n\t\t);\n\t} else {\n\t\tschemaPrisma = getNewPrisma(provider, process.cwd());\n\t}\n\n\t// Update generator and datasource blocks for Prisma v7+ in existing schemas\n\tconst prismaVersion = getPrismaVersion(process.cwd());\n\tif (prismaVersion && prismaVersion >= 7 && schemaPrismaExist) {\n\t\tschemaPrisma = produceSchema(schemaPrisma, (builder) => {\n\t\t\tconst generator: any = builder.findByType(\"generator\", {\n\t\t\t\tname: \"client\",\n\t\t\t});\n\t\t\tif (generator && generator.properties) {\n\t\t\t\tconst providerProp = generator.properties.find(\n\t\t\t\t\t(prop: any) => prop.type === \"assignment\" && prop.key === \"provider\",\n\t\t\t\t);\n\t\t\t\tif (providerProp && providerProp.value === '\"prisma-client-js\"') {\n\t\t\t\t\tproviderProp.value = '\"prisma-client\"';\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Remove url from datasource block (now configured in prisma.config.ts)\n\t\t\tconst datasource: any = builder.findByType(\"datasource\", {\n\t\t\t\tname: \"db\",\n\t\t\t});\n\t\t\tif (datasource && datasource.properties) {\n\t\t\t\tconst urlIndex = datasource.properties.findIndex(\n\t\t\t\t\t(prop: any) => prop.type === \"assignment\" && prop.key === \"url\",\n\t\t\t\t);\n\t\t\t\tif (urlIndex !== -1) {\n\t\t\t\t\tdatasource.properties.splice(urlIndex, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tconst manyToManyRelations = new Map();\n\n\tfor (const table in tables) {\n\t\tconst fields = tables[table]?.fields;\n\t\tfor (const field in fields) {\n\t\t\tconst attr = fields[field]!;\n\t\t\tif (attr.references) {\n\t\t\t\tconst referencedOriginalModel = attr.references.model;\n\t\t\t\tconst referencedCustomModel =\n\t\t\t\t\ttables[referencedOriginalModel]?.modelName || referencedOriginalModel;\n\t\t\t\tconst referencedModelNameCap = capitalizeFirstLetter(\n\t\t\t\t\tgetModelName(referencedCustomModel),\n\t\t\t\t);\n\n\t\t\t\tif (!manyToManyRelations.has(referencedModelNameCap)) {\n\t\t\t\t\tmanyToManyRelations.set(referencedModelNameCap, new Set());\n\t\t\t\t}\n\n\t\t\t\tconst currentCustomModel = tables[table]?.modelName || table;\n\t\t\t\tconst currentModelNameCap = capitalizeFirstLetter(\n\t\t\t\t\tgetModelName(currentCustomModel),\n\t\t\t\t);\n\n\t\t\t\tmanyToManyRelations\n\t\t\t\t\t.get(referencedModelNameCap)\n\t\t\t\t\t.add(currentModelNameCap);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst indexedFields = new Map<string, string[]>();\n\tfor (const table in tables) {\n\t\tconst fields = tables[table]?.fields;\n\t\tconst customModelName = tables[table]?.modelName || table;\n\t\tconst modelName = capitalizeFirstLetter(getModelName(customModelName));\n\t\tindexedFields.set(modelName, []);\n\n\t\tfor (const field in fields) {\n\t\t\tconst attr = fields[field]!;\n\t\t\tif (attr.index && !attr.unique) {\n\t\t\t\tconst fieldName = attr.fieldName || field;\n\t\t\t\tindexedFields.get(modelName)!.push(fieldName);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst schema = produceSchema(schemaPrisma, (builder) => {\n\t\tfor (const table in tables) {\n\t\t\tconst originalTableName = table;\n\t\t\tconst customModelName = tables[table]?.modelName || table;\n\t\t\tconst modelName = capitalizeFirstLetter(getModelName(customModelName));\n\t\t\tconst fields = tables[table]?.fields;\n\t\t\tfunction getType({\n\t\t\t\tisBigint,\n\t\t\t\tisOptional,\n\t\t\t\ttype,\n\t\t\t}: {\n\t\t\t\ttype: DBFieldType;\n\t\t\t\tisOptional: boolean;\n\t\t\t\tisBigint: boolean;\n\t\t\t}) {\n\t\t\t\tif (type === \"string\") {\n\t\t\t\t\treturn isOptional ? \"String?\" : \"String\";\n\t\t\t\t}\n\t\t\t\tif (type === \"number\" && isBigint) {\n\t\t\t\t\treturn isOptional ? \"BigInt?\" : \"BigInt\";\n\t\t\t\t}\n\t\t\t\tif (type === \"number\") {\n\t\t\t\t\treturn isOptional ? \"Int?\" : \"Int\";\n\t\t\t\t}\n\t\t\t\tif (type === \"boolean\") {\n\t\t\t\t\treturn isOptional ? \"Boolean?\" : \"Boolean\";\n\t\t\t\t}\n\t\t\t\tif (type === \"date\") {\n\t\t\t\t\treturn isOptional ? \"DateTime?\" : \"DateTime\";\n\t\t\t\t}\n\t\t\t\tif (type === \"json\") {\n\t\t\t\t\tif (provider === \"sqlite\" || provider === \"mysql\") {\n\t\t\t\t\t\treturn isOptional ? \"String?\" : \"String\";\n\t\t\t\t\t}\n\t\t\t\t\treturn isOptional ? \"Json?\" : \"Json\";\n\t\t\t\t}\n\t\t\t\tif (type === \"string[]\") {\n\t\t\t\t\t// SQLite and MySQL don't support array of strings, so we use string instead\n\t\t\t\t\t// adapter should handle JSON.stringify and JSON.parse conversion for these fields\n\t\t\t\t\tif (provider === \"sqlite\" || provider === \"mysql\") {\n\t\t\t\t\t\treturn isOptional ? \"String?\" : \"String\";\n\t\t\t\t\t}\n\t\t\t\t\treturn \"String[]\";\n\t\t\t\t}\n\t\t\t\tif (type === \"number[]\") {\n\t\t\t\t\t// SQLite and MySQL don't support array of numbers, so we use int instead\n\t\t\t\t\t// adapter should handle JSON.stringify and JSON.parse conversion for these fields\n\t\t\t\t\tif (provider === \"sqlite\" || provider === \"mysql\") {\n\t\t\t\t\t\treturn \"String\";\n\t\t\t\t\t}\n\t\t\t\t\treturn \"Int[]\";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst prismaModel = builder.findByType(\"model\", {\n\t\t\t\tname: modelName,\n\t\t\t});\n\n\t\t\tif (!prismaModel) {\n\t\t\t\tif (provider === \"mongodb\") {\n\t\t\t\t\t// Mongo DB doesn't support auto increment, so just use their normal _id.\n\t\t\t\t\tbuilder\n\t\t\t\t\t\t.model(modelName)\n\t\t\t\t\t\t.field(\"id\", \"String\")\n\t\t\t\t\t\t.attribute(\"id\")\n\t\t\t\t\t\t.attribute(`map(\"_id\")`);\n\t\t\t\t} else {\n\t\t\t\t\tconst useNumberId =\n\t\t\t\t\t\toptions.advanced?.database?.generateId === \"serial\";\n\t\t\t\t\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\t\t\t\t\tif (useNumberId) {\n\t\t\t\t\t\tbuilder\n\t\t\t\t\t\t\t.model(modelName)\n\t\t\t\t\t\t\t.field(\"id\", \"Int\")\n\t\t\t\t\t\t\t.attribute(\"id\")\n\t\t\t\t\t\t\t.attribute(\"default(autoincrement())\");\n\t\t\t\t\t} else if (useUUIDs && provider === \"postgresql\") {\n\t\t\t\t\t\tbuilder\n\t\t\t\t\t\t\t.model(modelName)\n\t\t\t\t\t\t\t.field(\"id\", \"String\")\n\t\t\t\t\t\t\t.attribute(\"id\")\n\t\t\t\t\t\t\t.attribute('default(dbgenerated(\"pg_catalog.gen_random_uuid()\"))')\n\t\t\t\t\t\t\t.attribute(\"db.Uuid\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuilder.model(modelName).field(\"id\", \"String\").attribute(\"id\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const field in fields) {\n\t\t\t\tconst attr = fields[field]!;\n\t\t\t\tconst fieldName = attr.fieldName || field;\n\n\t\t\t\tif (prismaModel) {\n\t\t\t\t\tconst isAlreadyExist = builder.findByType(\"field\", {\n\t\t\t\t\t\tname: fieldName,\n\t\t\t\t\t\twithin: prismaModel.properties,\n\t\t\t\t\t});\n\t\t\t\t\tif (isAlreadyExist) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\t\t\t\tconst useNumberId = options.advanced?.database?.generateId === \"serial\";\n\t\t\t\tconst fieldBuilder = builder.model(modelName).field(\n\t\t\t\t\tfieldName,\n\t\t\t\t\tfield === \"id\" && useNumberId\n\t\t\t\t\t\t? getType({\n\t\t\t\t\t\t\t\tisBigint: false,\n\t\t\t\t\t\t\t\tisOptional: false,\n\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: getType({\n\t\t\t\t\t\t\t\tisBigint: attr?.bigint || false,\n\t\t\t\t\t\t\t\tisOptional: !attr?.required,\n\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\tattr.references?.field === \"id\"\n\t\t\t\t\t\t\t\t\t\t? useNumberId\n\t\t\t\t\t\t\t\t\t\t\t? \"number\"\n\t\t\t\t\t\t\t\t\t\t\t: \"string\"\n\t\t\t\t\t\t\t\t\t\t: attr.type,\n\t\t\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tif (field === \"id\") {\n\t\t\t\t\tfieldBuilder.attribute(\"id\");\n\t\t\t\t\tif (provider === \"mongodb\") {\n\t\t\t\t\t\tfieldBuilder.attribute(`map(\"_id\")`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (attr.unique) {\n\t\t\t\t\tbuilder.model(modelName).blockAttribute(`unique([${fieldName}])`);\n\t\t\t\t}\n\n\t\t\t\tif (attr.defaultValue !== undefined) {\n\t\t\t\t\tif (Array.isArray(attr.defaultValue)) {\n\t\t\t\t\t\t// for json objects and array of object\n\n\t\t\t\t\t\tif (attr.type === \"json\") {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tObject.prototype.toString.call(attr.defaultValue[0]) ===\n\t\t\t\t\t\t\t\t\"[object Object]\"\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tfieldBuilder.attribute(\n\t\t\t\t\t\t\t\t\t`default(\"${JSON.stringify(attr.defaultValue).replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\")`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst jsonArray = [];\n\t\t\t\t\t\t\tfor (const value of attr.defaultValue) jsonArray.push(value);\n\t\t\t\t\t\t\tfieldBuilder.attribute(\n\t\t\t\t\t\t\t\t`default(\"${JSON.stringify(jsonArray).replace(/\"/g, '\\\\\"')}\")`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (attr.defaultValue.length === 0) {\n\t\t\t\t\t\t\tfieldBuilder.attribute(`default([])`);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\ttypeof attr.defaultValue[0] === \"string\" &&\n\t\t\t\t\t\t\tattr.type === \"string[]\"\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst valueArray = [];\n\t\t\t\t\t\t\tfor (const value of attr.defaultValue)\n\t\t\t\t\t\t\t\tvalueArray.push(JSON.stringify(value));\n\t\t\t\t\t\t\tfieldBuilder.attribute(`default([${valueArray}])`);\n\t\t\t\t\t\t} else if (typeof attr.defaultValue[0] === \"number\") {\n\t\t\t\t\t\t\tconst valueArray = [];\n\t\t\t\t\t\t\tfor (const value of attr.defaultValue)\n\t\t\t\t\t\t\t\tvalueArray.push(`${value}`);\n\t\t\t\t\t\t\tfieldBuilder.attribute(`default([${valueArray}])`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// for json objects\n\t\t\t\t\telse if (\n\t\t\t\t\t\ttypeof attr.defaultValue === \"object\" &&\n\t\t\t\t\t\t!Array.isArray(attr.defaultValue) &&\n\t\t\t\t\t\tattr.defaultValue !== null\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tObject.entries(attr.defaultValue as Record<string, any>)\n\t\t\t\t\t\t\t\t.length === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tfieldBuilder.attribute(`default(\"{}\")`);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfieldBuilder.attribute(\n\t\t\t\t\t\t\t`default(\"${JSON.stringify(attr.defaultValue).replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\")`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (field === \"createdAt\") {\n\t\t\t\t\t\tfieldBuilder.attribute(\"default(now())\");\n\t\t\t\t\t} else if (\n\t\t\t\t\t\ttypeof attr.defaultValue === \"string\" &&\n\t\t\t\t\t\tprovider !== \"mysql\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tfieldBuilder.attribute(`default(\"${attr.defaultValue}\")`);\n\t\t\t\t\t} else if (\n\t\t\t\t\t\ttypeof attr.defaultValue === \"boolean\" ||\n\t\t\t\t\t\ttypeof attr.defaultValue === \"number\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tfieldBuilder.attribute(`default(${attr.defaultValue})`);\n\t\t\t\t\t} else if (typeof attr.defaultValue === \"function\") {\n\t\t\t\t\t\t// we are intentionally not adding the default value here\n\t\t\t\t\t\t// this is because if the defaultValue is a function, it could have\n\t\t\t\t\t\t// custom logic within that function that might not work in prisma's context.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// This is a special handling for updatedAt fields\n\t\t\t\tif (field === \"updatedAt\" && attr.onUpdate) {\n\t\t\t\t\tfieldBuilder.attribute(\"updatedAt\");\n\t\t\t\t} else if (attr.onUpdate) {\n\t\t\t\t\t// we are intentionally not adding the onUpdate value here\n\t\t\t\t\t// this is because if the onUpdate is a function, it could have\n\t\t\t\t\t// custom logic within that function that might not work in prisma's context.\n\t\t\t\t}\n\n\t\t\t\tif (attr.references) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tuseUUIDs &&\n\t\t\t\t\t\tprovider === \"postgresql\" &&\n\t\t\t\t\t\tattr.references?.field === \"id\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tbuilder.model(modelName).field(fieldName).attribute(`db.Uuid`);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst referencedOriginalModelName = getModelName(\n\t\t\t\t\t\tattr.references.model,\n\t\t\t\t\t);\n\t\t\t\t\tconst referencedCustomModelName =\n\t\t\t\t\t\ttables[referencedOriginalModelName]?.modelName ||\n\t\t\t\t\t\treferencedOriginalModelName;\n\t\t\t\t\tlet action = \"Cascade\";\n\t\t\t\t\tif (attr.references.onDelete === \"no action\") action = \"NoAction\";\n\t\t\t\t\telse if (attr.references.onDelete === \"set null\") action = \"SetNull\";\n\t\t\t\t\telse if (attr.references.onDelete === \"set default\")\n\t\t\t\t\t\taction = \"SetDefault\";\n\t\t\t\t\telse if (attr.references.onDelete === \"restrict\") action = \"Restrict\";\n\n\t\t\t\t\tconst relationField = `relation(fields: [${getFieldName({ model: originalTableName, field: fieldName })}], references: [${getFieldName({ model: attr.references.model, field: attr.references.field })}], onDelete: ${action})`;\n\t\t\t\t\tbuilder\n\t\t\t\t\t\t.model(modelName)\n\t\t\t\t\t\t.field(\n\t\t\t\t\t\t\treferencedCustomModelName.toLowerCase(),\n\t\t\t\t\t\t\t`${capitalizeFirstLetter(referencedCustomModelName)}${\n\t\t\t\t\t\t\t\t!attr.required ? \"?\" : \"\"\n\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.attribute(relationField);\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\t!attr.unique &&\n\t\t\t\t\t!attr.references &&\n\t\t\t\t\tprovider === \"mysql\" &&\n\t\t\t\t\tattr.type === \"string\"\n\t\t\t\t) {\n\t\t\t\t\tbuilder.model(modelName).field(fieldName).attribute(\"db.Text\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add many-to-many fields\n\t\t\tif (manyToManyRelations.has(modelName)) {\n\t\t\t\tfor (const relatedModel of manyToManyRelations.get(modelName)) {\n\t\t\t\t\t// Find the FK field on the related model that points to this model\n\t\t\t\t\tconst relatedTableName = Object.keys(tables).find(\n\t\t\t\t\t\t(key) =>\n\t\t\t\t\t\t\tcapitalizeFirstLetter(tables[key]?.modelName || key) ===\n\t\t\t\t\t\t\trelatedModel,\n\t\t\t\t\t);\n\t\t\t\t\tconst relatedFields = relatedTableName\n\t\t\t\t\t\t? tables[relatedTableName]?.fields\n\t\t\t\t\t\t: {};\n\t\t\t\t\tconst fkField = Object.entries(relatedFields || {}).find(\n\t\t\t\t\t\t([_fieldName, fieldAttr]: any) =>\n\t\t\t\t\t\t\tfieldAttr.references &&\n\t\t\t\t\t\t\tgetModelName(fieldAttr.references.model) ===\n\t\t\t\t\t\t\t\tgetModelName(originalTableName),\n\t\t\t\t\t);\n\t\t\t\t\tconst [_fieldKey, fkFieldAttr] = fkField || [];\n\t\t\t\t\tconst isUnique = fkFieldAttr?.unique === true;\n\n\t\t\t\t\tconst fieldName =\n\t\t\t\t\t\tisUnique || adapter.options?.usePlural === true\n\t\t\t\t\t\t\t? `${relatedModel.toLowerCase()}`\n\t\t\t\t\t\t\t: `${relatedModel.toLowerCase()}s`;\n\t\t\t\t\tconst existingField = builder.findByType(\"field\", {\n\t\t\t\t\t\tname: fieldName,\n\t\t\t\t\t\twithin: prismaModel?.properties,\n\t\t\t\t\t});\n\t\t\t\t\tif (!existingField) {\n\t\t\t\t\t\tbuilder\n\t\t\t\t\t\t\t.model(modelName)\n\t\t\t\t\t\t\t.field(fieldName, `${relatedModel}${isUnique ? \"?\" : \"[]\"}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add indexes\n\t\t\tconst indexedFieldsForModel = indexedFields.get(modelName);\n\t\t\tif (indexedFieldsForModel && indexedFieldsForModel.length > 0) {\n\t\t\t\tfor (const fieldName of indexedFieldsForModel) {\n\t\t\t\t\tif (prismaModel) {\n\t\t\t\t\t\tconst indexExist = prismaModel.properties.some(\n\t\t\t\t\t\t\t(v) =>\n\t\t\t\t\t\t\t\tv.type === \"attribute\" &&\n\t\t\t\t\t\t\t\tv.name === \"index\" &&\n\t\t\t\t\t\t\t\tJSON.stringify(v.args[0]?.value).includes(fieldName),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (indexExist) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst field = Object.entries(fields!).find(\n\t\t\t\t\t\t([key, attr]) => (attr.fieldName || key) === fieldName,\n\t\t\t\t\t)?.[1];\n\n\t\t\t\t\tlet indexField = fieldName;\n\t\t\t\t\tif (provider === \"mysql\" && field && field.type === \"string\") {\n\t\t\t\t\t\tconst useNumberId =\n\t\t\t\t\t\t\toptions.advanced?.database?.generateId === \"serial\";\n\t\t\t\t\t\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\t\t\t\t\t\tif (field.references?.field === \"id\" && (useNumberId || useUUIDs)) {\n\t\t\t\t\t\t\tindexField = `${fieldName}`;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindexField = `${fieldName}(length: 191)`; // length of 191 because String in Prisma is varchar(191)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbuilder.model(modelName).blockAttribute(`index([${indexField}])`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst hasAttribute = builder.findByType(\"attribute\", {\n\t\t\t\tname: \"map\",\n\t\t\t\twithin: prismaModel?.properties,\n\t\t\t});\n\t\t\tconst hasChanged = customModelName !== originalTableName;\n\t\t\tif (!hasAttribute) {\n\t\t\t\tbuilder\n\t\t\t\t\t.model(modelName)\n\t\t\t\t\t.blockAttribute(\n\t\t\t\t\t\t\"map\",\n\t\t\t\t\t\t`${getModelName(hasChanged ? customModelName : originalTableName)}`,\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\t});\n\n\tconst schemaChanged = schema.trim() !== schemaPrisma.trim();\n\n\treturn {\n\t\tcode: schemaChanged ? schema : \"\",\n\t\tfileName: filePath,\n\t\toverwrite: schemaPrismaExist && schemaChanged,\n\t};\n};\n\nconst getNewPrisma = (provider: string, cwd?: string) => {\n\tconst prismaVersion = getPrismaVersion(cwd);\n\tconst isV7 = prismaVersion && prismaVersion >= 7;\n\t// Use \"prisma-client\" for Prisma v7+, otherwise use \"prisma-client-js\"\n\tconst clientProvider = isV7 ? \"prisma-client\" : \"prisma-client-js\";\n\n\t// In Prisma v7+, the url is configured in prisma.config.ts instead of the schema\n\tif (isV7) {\n\t\treturn `generator client {\n provider = \"${clientProvider}\"\n }\n\n datasource db {\n provider = \"${provider}\"\n }`;\n\t}\n\n\treturn `generator client {\n provider = \"${clientProvider}\"\n }\n\n datasource db {\n provider = \"${provider}\"\n url = ${\n\t\t\tprovider === \"sqlite\" ? `\"file:./dev.db\"` : `env(\"DATABASE_URL\")`\n\t\t}\n }`;\n};\n","import type { BetterAuthOptions } from \"@better-auth/core\";\nimport type { DBAdapter } from \"@better-auth/core/db/adapter\";\nimport { generateDrizzleSchema } from \"./drizzle\";\nimport { generateKyselySchema } from \"./kysely\";\nimport { generatePrismaSchema } from \"./prisma\";\n\nexport const adapters = {\n\tprisma: generatePrismaSchema,\n\tdrizzle: generateDrizzleSchema,\n\tkysely: generateKyselySchema,\n};\n\nexport const generateSchema = (opts: {\n\tadapter: DBAdapter;\n\tfile?: string;\n\toptions: BetterAuthOptions;\n}) => {\n\tconst adapter = opts.adapter;\n\tconst generator =\n\t\tadapter.id in adapters\n\t\t\t? adapters[adapter.id as keyof typeof adapters]\n\t\t\t: null;\n\tif (generator) {\n\t\t// generator from the built-in list above\n\t\treturn generator(opts);\n\t}\n\tif (adapter.createSchema) {\n\t\t// use the custom adapter's createSchema method\n\t\treturn adapter\n\t\t\t.createSchema(opts.options, opts.file)\n\t\t\t.then(({ code, path: fileName, overwrite }) => ({\n\t\t\t\tcode,\n\t\t\t\tfileName,\n\t\t\t\toverwrite,\n\t\t\t}));\n\t}\n\n\tthrow new Error(\n\t\t`${adapter.id} is not supported. If it is a custom adapter, please request the maintainer to implement createSchema`,\n\t);\n};\n","const createModule = () => {\n\tconst moduleSource = `\nconst createStub = (label) => {\n const handler = {\n get(_, prop) {\n if (prop === \"toString\") return () => label;\n if (prop === \"valueOf\") return () => label;\n if (prop === Symbol.toPrimitive) return () => label;\n if (prop === Symbol.toStringTag) return \"Object\";\n if (prop === \"then\") return undefined;\n return createStub(label + \".\" + String(prop));\n },\n apply(_, __, args) {\n return createStub(label + \"()\")\n },\n construct() {\n return createStub(label + \"#instance\");\n },\n };\n const fn = () => createStub(label + \"()\");\n return new Proxy(fn, handler);\n};\n\nclass WorkerEntrypoint {\n constructor(ctx, env) {\n this.ctx = ctx;\n this.env = env;\n }\n}\n\nclass DurableObject {\n constructor(state, env) {\n this.state = state;\n this.env = env;\n }\n}\n\nclass RpcTarget {\n constructor(value) {\n this.value = value;\n }\n}\n\nconst RpcStub = RpcTarget;\n\nconst env = createStub(\"env\");\nconst caches = createStub(\"caches\");\nconst scheduler = createStub(\"scheduler\");\nconst executionCtx = createStub(\"executionCtx\");\n\nexport { DurableObject, RpcStub, RpcTarget, WorkerEntrypoint, caches, env, executionCtx, scheduler };\n\nconst defaultExport = {\n DurableObject,\n RpcStub,\n RpcTarget,\n WorkerEntrypoint,\n caches,\n env,\n executionCtx,\n scheduler,\n};\n\nexport default defaultExport;\n// jiti dirty hack: .unknown\n`;\n\n\treturn `data:text/javascript;charset=utf-8,${encodeURIComponent(moduleSource)}`;\n};\n\nconst CLOUDFLARE_STUB_MODULE = createModule();\n\nexport function addCloudflareModules(\n\taliases: Record<string, string>,\n\t_cwd?: string,\n) {\n\tif (!aliases[\"cloudflare:workers\"]) {\n\t\taliases[\"cloudflare:workers\"] = CLOUDFLARE_STUB_MODULE;\n\t}\n\tif (!aliases[\"cloudflare:test\"]) {\n\t\taliases[\"cloudflare:test\"] = CLOUDFLARE_STUB_MODULE;\n\t}\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * Adds SvelteKit environment modules and path aliases\n * @param aliases - The aliases object to populate\n * @param cwd - Current working directory (optional, defaults to process.cwd())\n */\nexport function addSvelteKitEnvModules(\n\taliases: Record<string, string>,\n\tcwd?: string,\n) {\n\tconst workingDir = cwd || process.cwd();\n\n\t// Add SvelteKit environment modules\n\taliases[\"$env/dynamic/private\"] = createDataUriModule(\n\t\tcreateDynamicEnvModule(),\n\t);\n\taliases[\"$env/dynamic/public\"] = createDataUriModule(\n\t\tcreateDynamicEnvModule(),\n\t);\n\taliases[\"$env/static/private\"] = createDataUriModule(\n\t\tcreateStaticEnvModule(filterPrivateEnv(\"PUBLIC_\", \"\")),\n\t);\n\taliases[\"$env/static/public\"] = createDataUriModule(\n\t\tcreateStaticEnvModule(filterPublicEnv(\"PUBLIC_\", \"\")),\n\t);\n\n\tconst svelteKitAliases = getSvelteKitPathAliases(workingDir);\n\tObject.assign(aliases, svelteKitAliases);\n}\n\nfunction getSvelteKitPathAliases(cwd: string): Record<string, string> {\n\tconst aliases: Record<string, string> = {};\n\n\tconst packageJsonPath = path.join(cwd, \"package.json\");\n\tconst svelteConfigPath = path.join(cwd, \"svelte.config.js\");\n\tconst svelteConfigTsPath = path.join(cwd, \"svelte.config.ts\");\n\n\tlet isSvelteKitProject = false;\n\n\tif (fs.existsSync(packageJsonPath)) {\n\t\ttry {\n\t\t\tconst packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n\t\t\tconst deps = {\n\t\t\t\t...packageJson.dependencies,\n\t\t\t\t...packageJson.devDependencies,\n\t\t\t};\n\t\t\tisSvelteKitProject = !!deps[\"@sveltejs/kit\"];\n\t\t} catch {\n\t\t\t// Ignore JSON parse errors\n\t\t}\n\t}\n\n\tif (!isSvelteKitProject) {\n\t\tisSvelteKitProject =\n\t\t\tfs.existsSync(svelteConfigPath) || fs.existsSync(svelteConfigTsPath);\n\t}\n\n\tif (!isSvelteKitProject) {\n\t\treturn aliases;\n\t}\n\n\tconst libPaths = [path.join(cwd, \"src\", \"lib\"), path.join(cwd, \"lib\")];\n\n\tfor (const libPath of libPaths) {\n\t\tif (fs.existsSync(libPath)) {\n\t\t\taliases[\"$lib\"] = libPath;\n\t\t\t// handles a common subpaths\n\t\t\tconst commonSubPaths = [\"server\", \"utils\", \"components\", \"stores\"];\n\t\t\tfor (const subPath of commonSubPaths) {\n\t\t\t\tconst subDir = path.join(libPath, subPath);\n\t\t\t\tif (fs.existsSync(subDir)) {\n\t\t\t\t\taliases[`$lib/${subPath}`] = subDir;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\t// Add simple stub for $app/server to prevent CLI errors\n\taliases[\"$app/server\"] = createDataUriModule(createAppServerModule());\n\n\tconst customAliases = getSvelteConfigAliases(cwd);\n\tObject.assign(aliases, customAliases);\n\n\treturn aliases;\n}\n// for custom aliases in svelte.config.js/ts\nfunction getSvelteConfigAliases(cwd: string): Record<string, string> {\n\tconst aliases: Record<string, string> = {};\n\tconst configPaths = [\n\t\tpath.join(cwd, \"svelte.config.js\"),\n\t\tpath.join(cwd, \"svelte.config.ts\"),\n\t];\n\n\tfor (const configPath of configPaths) {\n\t\tif (fs.existsSync(configPath)) {\n\t\t\ttry {\n\t\t\t\tconst content = fs.readFileSync(configPath, \"utf-8\");\n\t\t\t\tconst aliasMatch = content.match(/alias\\s*:\\s*\\{([^}]+)\\}/);\n\t\t\t\tif (aliasMatch && aliasMatch[1]) {\n\t\t\t\t\tconst aliasContent = aliasMatch[1];\n\t\t\t\t\tconst aliasMatches = aliasContent.matchAll(\n\t\t\t\t\t\t/['\"`](\\$[^'\"`]+)['\"`]\\s*:\\s*['\"`]([^'\"`]+)['\"`]/g,\n\t\t\t\t\t);\n\n\t\t\t\t\tfor (const match of aliasMatches) {\n\t\t\t\t\t\tconst [, alias, target] = match;\n\t\t\t\t\t\tif (alias && target) {\n\t\t\t\t\t\t\taliases[alias + \"/*\"] = path.resolve(cwd, target) + \"/*\";\n\t\t\t\t\t\t\taliases[alias] = path.resolve(cwd, target);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Ignore file reading/parsing errors\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn aliases;\n}\n\nfunction createAppServerModule(): string {\n\treturn `\n// $app/server stub for CLI compatibility\nexport default {};\n// jiti dirty hack: .unknown\n`;\n}\n\nfunction createDataUriModule(module: string) {\n\treturn `data:text/javascript;charset=utf-8,${encodeURIComponent(module)}`;\n}\n\nfunction createStaticEnvModule(env: Record<string, string>) {\n\tconst declarations = Object.keys(env)\n\t\t.filter((k) => validIdentifier.test(k) && !reserved.has(k))\n\t\t.map((k) => `export const ${k} = ${JSON.stringify(env[k])};`);\n\n\treturn `\n ${declarations.join(\"\\n\")}\n // jiti dirty hack: .unknown\n `;\n}\n\nfunction createDynamicEnvModule() {\n\treturn `\n export const env = process.env;\n // jiti dirty hack: .unknown\n `;\n}\n\nfunction filterPrivateEnv(publicPrefix: string, privatePrefix: string) {\n\treturn Object.fromEntries(\n\t\tObject.entries(process.env).filter(\n\t\t\t([k]) =>\n\t\t\t\tk.startsWith(privatePrefix) &&\n\t\t\t\t(publicPrefix === \"\" || !k.startsWith(publicPrefix)),\n\t\t),\n\t) as Record<string, string>;\n}\n\nfunction filterPublicEnv(publicPrefix: string, privatePrefix: string) {\n\treturn Object.fromEntries(\n\t\tObject.entries(process.env).filter(\n\t\t\t([k]) =>\n\t\t\t\tk.startsWith(publicPrefix) &&\n\t\t\t\t(privatePrefix === \"\" || !k.startsWith(privatePrefix)),\n\t\t),\n\t) as Record<string, string>;\n}\n\nconst validIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;\nconst reserved = new Set([\n\t\"do\",\n\t\"if\",\n\t\"in\",\n\t\"for\",\n\t\"let\",\n\t\"new\",\n\t\"try\",\n\t\"var\",\n\t\"case\",\n\t\"else\",\n\t\"enum\",\n\t\"eval\",\n\t\"null\",\n\t\"this\",\n\t\"true\",\n\t\"void\",\n\t\"with\",\n\t\"await\",\n\t\"break\",\n\t\"catch\",\n\t\"class\",\n\t\"const\",\n\t\"false\",\n\t\"super\",\n\t\"throw\",\n\t\"while\",\n\t\"yield\",\n\t\"delete\",\n\t\"export\",\n\t\"import\",\n\t\"public\",\n\t\"return\",\n\t\"static\",\n\t\"switch\",\n\t\"typeof\",\n\t\"default\",\n\t\"extends\",\n\t\"finally\",\n\t\"package\",\n\t\"private\",\n\t\"continue\",\n\t\"debugger\",\n\t\"function\",\n\t\"arguments\",\n\t\"interface\",\n\t\"protected\",\n\t\"implements\",\n\t\"instanceof\",\n]);\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nfunction stripJsonComments(jsonString: string): string {\n\treturn jsonString\n\t\t.replace(/\\\\\"|\"(?:\\\\\"|[^\"])*\"|(\\/\\/.*|\\/\\*[\\s\\S]*?\\*\\/)/g, (m, g) =>\n\t\t\tg ? \"\" : m,\n\t\t)\n\t\t.replace(/,(?=\\s*[}\\]])/g, \"\");\n}\n\nexport function getTsconfigInfo(cwd?: string, flatPath?: string) {\n\tlet tsConfigPath: string;\n\tif (flatPath) {\n\t\ttsConfigPath = flatPath;\n\t} else {\n\t\ttsConfigPath = cwd\n\t\t\t? path.join(cwd, \"tsconfig.json\")\n\t\t\t: path.join(\"tsconfig.json\");\n\t}\n\ttry {\n\t\tconst text = fs.readFileSync(tsConfigPath, \"utf-8\");\n\t\treturn JSON.parse(stripJsonComments(text));\n\t} catch (error) {\n\t\tthrow error;\n\t}\n}\n","import fs, { existsSync } from \"node:fs\";\nimport path from \"node:path\";\n// @ts-expect-error\nimport babelPresetReact from \"@babel/preset-react\";\n// @ts-expect-error\nimport babelPresetTypeScript from \"@babel/preset-typescript\";\nimport type { BetterAuthOptions } from \"@better-auth/core\";\nimport { BetterAuthError } from \"@better-auth/core/error\";\nimport { loadConfig } from \"c12\";\nimport type { JitiOptions } from \"jiti\";\nimport { addCloudflareModules } from \"./add-cloudflare-modules\";\nimport { addSvelteKitEnvModules } from \"./add-svelte-kit-env-modules\";\nimport { getTsconfigInfo } from \"./get-tsconfig-info\";\n\nlet possiblePaths = [\n\t\"auth.ts\",\n\t\"auth.tsx\",\n\t\"auth.js\",\n\t\"auth.jsx\",\n\t\"auth.server.js\",\n\t\"auth.server.ts\",\n\t\"auth/index.ts\",\n\t\"auth/index.tsx\",\n\t\"auth/index.js\",\n\t\"auth/index.jsx\",\n\t\"auth/index.server.js\",\n\t\"auth/index.server.ts\",\n];\n\npossiblePaths = [\n\t...possiblePaths,\n\t...possiblePaths.map((it) => `lib/server/${it}`),\n\t...possiblePaths.map((it) => `server/auth/${it}`),\n\t...possiblePaths.map((it) => `server/${it}`),\n\t...possiblePaths.map((it) => `auth/${it}`),\n\t...possiblePaths.map((it) => `lib/${it}`),\n\t...possiblePaths.map((it) => `utils/${it}`),\n];\npossiblePaths = [\n\t...possiblePaths,\n\t...possiblePaths.map((it) => `src/${it}`),\n\t...possiblePaths.map((it) => `app/${it}`),\n];\n\nfunction resolveReferencePath(configDir: string, refPath: string): string {\n\tconst resolvedPath = path.resolve(configDir, refPath);\n\n\t// If it ends with .json, treat as direct file reference\n\tif (refPath.endsWith(\".json\")) {\n\t\treturn resolvedPath;\n\t}\n\n\t// If the exact path exists and is a file, use it\n\tif (fs.existsSync(resolvedPath)) {\n\t\ttry {\n\t\t\tconst stats = fs.statSync(resolvedPath);\n\t\t\tif (stats.isFile()) {\n\t\t\t\treturn resolvedPath;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to directory handling\n\t\t}\n\t}\n\n\t// Otherwise, assume directory reference\n\treturn path.resolve(configDir, refPath, \"tsconfig.json\");\n}\n\nfunction getPathAliasesRecursive(\n\ttsconfigPath: string,\n\tvisited = new Set<string>(),\n): Record<string, string> {\n\tif (visited.has(tsconfigPath)) {\n\t\treturn {};\n\t}\n\tvisited.add(tsconfigPath);\n\n\tif (!fs.existsSync(tsconfigPath)) {\n\t\tconsole.warn(`Referenced tsconfig not found: ${tsconfigPath}`);\n\t\treturn {};\n\t}\n\n\ttry {\n\t\tconst tsConfig = getTsconfigInfo(undefined, tsconfigPath);\n\t\tconst { paths = {}, baseUrl = \".\" } = tsConfig.compilerOptions || {};\n\t\tconst result: Record<string, string> = {};\n\n\t\tconst configDir = path.dirname(tsconfigPath);\n\t\tconst obj = Object.entries(paths) as [string, string[]][];\n\t\tfor (const [alias, aliasPaths] of obj) {\n\t\t\tfor (const aliasedPath of aliasPaths) {\n\t\t\t\tconst resolvedBaseUrl = path.resolve(configDir, baseUrl);\n\t\t\t\tconst finalAlias = alias.slice(-1) === \"*\" ? alias.slice(0, -1) : alias;\n\t\t\t\tconst finalAliasedPath =\n\t\t\t\t\taliasedPath.slice(-1) === \"*\"\n\t\t\t\t\t\t? aliasedPath.slice(0, -1)\n\t\t\t\t\t\t: aliasedPath;\n\n\t\t\t\tresult[finalAlias || \"\"] = path.join(resolvedBaseUrl, finalAliasedPath);\n\t\t\t}\n\t\t}\n\n\t\tif (tsConfig.references) {\n\t\t\tfor (const ref of tsConfig.references) {\n\t\t\t\tconst refPath = resolveReferencePath(configDir, ref.path);\n\t\t\t\tconst refAliases = getPathAliasesRecursive(refPath, visited);\n\t\t\t\tfor (const [alias, aliasPath] of Object.entries(refAliases)) {\n\t\t\t\t\tif (!(alias in result)) {\n\t\t\t\t\t\tresult[alias] = aliasPath;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t} catch (error) {\n\t\tconsole.warn(`Error parsing tsconfig at ${tsconfigPath}: ${error}`);\n\t\treturn {};\n\t}\n}\n\nfunction getPathAliases(cwd: string): Record<string, string> | null {\n\tlet tsConfigPath = path.join(cwd, \"tsconfig.json\");\n\tif (!fs.existsSync(tsConfigPath)) {\n\t\ttsConfigPath = path.join(cwd, \"jsconfig.json\");\n\t}\n\tif (!fs.existsSync(tsConfigPath)) {\n\t\treturn null;\n\t}\n\ttry {\n\t\tconst result = getPathAliasesRecursive(tsConfigPath);\n\t\taddSvelteKitEnvModules(result);\n\t\taddCloudflareModules(result);\n\t\treturn result;\n\t} catch (error) {\n\t\tconsole.error(error);\n\t\tthrow new BetterAuthError(\"Error parsing tsconfig.json\");\n\t}\n}\n/**\n * .tsx files are not supported by Jiti.\n */\nconst jitiOptions = (cwd: string): JitiOptions => {\n\tconst alias = getPathAliases(cwd) || {};\n\treturn {\n\t\ttransformOptions: {\n\t\t\tbabel: {\n\t\t\t\tpresets: [\n\t\t\t\t\t[\n\t\t\t\t\t\tbabelPresetTypeScript,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tisTSX: true,\n\t\t\t\t\t\t\tallExtensions: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t[babelPresetReact, { runtime: \"automatic\" }],\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\textensions: [\".ts\", \".tsx\", \".js\", \".jsx\"],\n\t\talias,\n\t};\n};\n\nconst isDefaultExport = (\n\tobject: Record<string, unknown>,\n): object is BetterAuthOptions => {\n\treturn (\n\t\ttypeof object === \"object\" &&\n\t\tobject !== null &&\n\t\t!Array.isArray(object) &&\n\t\tObject.keys(object).length > 0 &&\n\t\t\"options\" in object\n\t);\n};\nexport async function getConfig({\n\tcwd,\n\tconfigPath,\n\tshouldThrowOnError = false,\n}: {\n\tcwd: string;\n\tconfigPath?: string;\n\tshouldThrowOnError?: boolean;\n}) {\n\ttry {\n\t\tlet configFile: BetterAuthOptions | null = null;\n\t\tif (configPath) {\n\t\t\tlet resolvedPath: string = path.join(cwd, configPath);\n\t\t\tif (existsSync(configPath)) resolvedPath = configPath; // If the configPath is a file, use it as is, as it means the path wasn't relative.\n\t\t\tconst { config } = await loadConfig<\n\t\t\t\t| {\n\t\t\t\t\t\tauth: {\n\t\t\t\t\t\t\toptions: BetterAuthOptions;\n\t\t\t\t\t\t};\n\t\t\t\t }\n\t\t\t\t| {\n\t\t\t\t\t\toptions: BetterAuthOptions;\n\t\t\t\t }\n\t\t\t>({\n\t\t\t\tconfigFile: resolvedPath,\n\t\t\t\tdotenv: {\n\t\t\t\t\tfileName: [\".env\", \".env.local\"],\n\t\t\t\t},\n\t\t\t\tjitiOptions: jitiOptions(cwd),\n\t\t\t\tcwd,\n\t\t\t});\n\t\t\tif (!(\"auth\" in config) && !isDefaultExport(config)) {\n\t\t\t\tif (shouldThrowOnError) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Couldn't read your auth config in ${resolvedPath}. Make sure to default export your auth instance or to export as a variable named auth.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[#better-auth]: Couldn't read your auth config in ${resolvedPath}. Make sure to default export your auth instance or to export as a variable named auth.`,\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tconfigFile = \"auth\" in config ? config.auth?.options : config.options;\n\t\t}\n\n\t\tif (!configFile) {\n\t\t\tfor (const possiblePath of possiblePaths) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { config } = await loadConfig<{\n\t\t\t\t\t\tauth: {\n\t\t\t\t\t\t\toptions: BetterAuthOptions;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tdefault?: {\n\t\t\t\t\t\t\toptions: BetterAuthOptions;\n\t\t\t\t\t\t};\n\t\t\t\t\t}>({\n\t\t\t\t\t\tconfigFile: possiblePath,\n\t\t\t\t\t\tdotenv: {\n\t\t\t\t\t\t\tfileName: [\".env\", \".env.local\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tjitiOptions: jitiOptions(cwd),\n\t\t\t\t\t\tcwd,\n\t\t\t\t\t});\n\t\t\t\t\tconst hasConfig = Object.keys(config).length > 0;\n\t\t\t\t\tif (hasConfig) {\n\t\t\t\t\t\tconfigFile =\n\t\t\t\t\t\t\tconfig.auth?.options || config.default?.options || null;\n\t\t\t\t\t\tif (!configFile) {\n\t\t\t\t\t\t\tif (shouldThrowOnError) {\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\"Couldn't read your auth config. Make sure to default export your auth instance or to export as a variable named auth.\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconsole.error(\"[#better-auth]: Couldn't read your auth config.\");\n\t\t\t\t\t\t\tconsole.log(\"\");\n\t\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\t\t\"[#better-auth]: Make sure to default export your auth instance or to export as a variable named auth.\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tprocess.exit(1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof e === \"object\" &&\n\t\t\t\t\t\te &&\n\t\t\t\t\t\t\"message\" in e &&\n\t\t\t\t\t\ttypeof e.message === \"string\" &&\n\t\t\t\t\t\te.message.includes(\n\t\t\t\t\t\t\t\"This module cannot be imported from a Client Component module\",\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (shouldThrowOnError) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Please remove import 'server-only' from your auth config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`Please remove import 'server-only' from your auth config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tprocess.exit(1);\n\t\t\t\t\t}\n\t\t\t\t\tif (shouldThrowOnError) {\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t\tconsole.error(\"[#better-auth]: Couldn't read your auth config.\", e);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn configFile;\n\t} catch (e) {\n\t\tif (\n\t\t\ttypeof e === \"object\" &&\n\t\t\te &&\n\t\t\t\"message\" in e &&\n\t\t\ttypeof e.message === \"string\" &&\n\t\t\te.message.includes(\n\t\t\t\t\"This module cannot be imported from a Client Component module\",\n\t\t\t)\n\t\t) {\n\t\t\tif (shouldThrowOnError) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Please remove import 'server-only' from your auth config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconsole.error(\n\t\t\t\t`Please remove import 'server-only' from your auth config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`,\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tif (shouldThrowOnError) {\n\t\t\tthrow e;\n\t\t}\n\n\t\tconsole.error(\"Couldn't read your auth config.\", e);\n\t\tprocess.exit(1);\n\t}\n}\n","import { existsSync } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { DBAdapter } from \"@better-auth/core/db/adapter\";\nimport {\n\tcreateTelemetry,\n\tgetTelemetryAuthConfig,\n} from \"@better-auth/telemetry\";\nimport { getAdapter } from \"better-auth/db/adapter\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport prompts from \"prompts\";\nimport yoctoSpinner from \"yocto-spinner\";\nimport * as z from \"zod/v4\";\nimport { generateSchema } from \"../generators\";\nimport { getConfig } from \"../utils/get-config\";\n\nfunction createMockAdapter(adapterId: string, dialect?: string): DBAdapter {\n\t// Map dialect to provider format for each adapter\n\tlet provider: string | undefined;\n\tif (dialect) {\n\t\tif (adapterId === \"drizzle\") {\n\t\t\t// Drizzle uses: pg, mysql, sqlite\n\t\t\tif (dialect === \"postgresql\") {\n\t\t\t\tprovider = \"pg\";\n\t\t\t} else if (dialect === \"mysql\" || dialect === \"sqlite\") {\n\t\t\t\tprovider = dialect;\n\t\t\t} else {\n\t\t\t\t// For other dialects, try to use as-is or default to pg\n\t\t\t\tprovider = dialect;\n\t\t\t}\n\t\t} else if (adapterId === \"prisma\") {\n\t\t\t// Prisma uses: postgresql, mysql, sqlite, mongodb, etc.\n\t\t\tprovider = dialect;\n\t\t}\n\t}\n\n\treturn {\n\t\tid: adapterId,\n\t\tcreate: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tfindOne: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tfindMany: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tcount: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tupdate: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tupdateMany: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tdelete: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tdeleteMany: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\ttransaction: async (callback) => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\toptions: {\n\t\t\tadapterConfig: {\n\t\t\t\tadapterId,\n\t\t\t},\n\t\t\t...(provider && { provider }),\n\t\t},\n\t};\n}\n\nasync function generateAction(opts: any) {\n\tconst options = z\n\t\t.object({\n\t\t\tcwd: z.string(),\n\t\t\tconfig: z.string().optional(),\n\t\t\toutput: z.string().optional(),\n\t\t\tadapter: z.string().optional(),\n\t\t\tdialect: z.string().optional(),\n\t\t\ty: z.boolean().optional(),\n\t\t\tyes: z.boolean().optional(),\n\t\t})\n\t\t.parse(opts);\n\n\tconst cwd = path.resolve(options.cwd);\n\tif (!existsSync(cwd)) {\n\t\tconsole.error(`The directory \"${cwd}\" does not exist.`);\n\t\tprocess.exit(1);\n\t}\n\tconst config = await getConfig({\n\t\tcwd,\n\t\tconfigPath: options.config,\n\t});\n\tif (!config) {\n\t\tconsole.error(\n\t\t\t\"No configuration file found. Add a `auth.ts` file to your project or pass the path to the configuration file using the `--config` flag.\",\n\t\t);\n\t\treturn;\n\t}\n\n\tlet adapter: DBAdapter;\n\tif (options.adapter) {\n\t\t// Use mock adapter when --adapter flag is provided\n\t\tadapter = createMockAdapter(options.adapter, options.dialect);\n\t} else {\n\t\t// Get adapter from config (existing behavior)\n\t\tadapter = await getAdapter(config).catch((e) => {\n\t\t\tconsole.error(e.message);\n\t\t\tprocess.exit(1);\n\t\t});\n\t}\n\n\tconst spinner = yoctoSpinner({ text: \"preparing schema...\" }).start();\n\n\tconst schema = await generateSchema({\n\t\tadapter,\n\t\tfile: options.output,\n\t\toptions: config,\n\t});\n\n\tspinner.stop();\n\tif (!schema.code) {\n\t\tconsole.log(\"Your schema is already up to date.\");\n\t\t// telemetry: track generate attempted, no changes\n\t\ttry {\n\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\tawait telemetry.publish({\n\t\t\t\ttype: \"cli_generate\",\n\t\t\t\tpayload: {\n\t\t\t\t\toutcome: \"no_changes\",\n\t\t\t\t\tconfig: await getTelemetryAuthConfig(config, {\n\t\t\t\t\t\tadapter: adapter.id,\n\t\t\t\t\t\tdatabase:\n\t\t\t\t\t\t\ttypeof config.database === \"function\" ? \"adapter\" : \"kysely\",\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {}\n\t\tprocess.exit(0);\n\t}\n\tif (schema.overwrite) {\n\t\tlet confirm = options.y || options.yes;\n\t\tif (!confirm) {\n\t\t\tconst response = await prompts({\n\t\t\t\ttype: \"confirm\",\n\t\t\t\tname: \"confirm\",\n\t\t\t\tmessage: `The file ${\n\t\t\t\t\tschema.fileName\n\t\t\t\t} already exists. Do you want to ${chalk.yellow(\n\t\t\t\t\t`${schema.overwrite ? \"overwrite\" : \"append\"}`,\n\t\t\t\t)} the schema to the file?`,\n\t\t\t});\n\t\t\tconfirm = response.confirm;\n\t\t}\n\n\t\tif (confirm) {\n\t\t\tconst exist = existsSync(path.join(cwd, schema.fileName));\n\t\t\tif (!exist) {\n\t\t\t\tawait fs.mkdir(path.dirname(path.join(cwd, schema.fileName)), {\n\t\t\t\t\trecursive: true,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (schema.overwrite) {\n\t\t\t\tawait fs.writeFile(path.join(cwd, schema.fileName), schema.code);\n\t\t\t} else {\n\t\t\t\tawait fs.appendFile(path.join(cwd, schema.fileName), schema.code);\n\t\t\t}\n\t\t\tconsole.log(\n\t\t\t\t`🚀 Schema was ${\n\t\t\t\t\tschema.overwrite ? \"overwritten\" : \"appended\"\n\t\t\t\t} successfully!`,\n\t\t\t);\n\t\t\t// telemetry: track generate success overwrite/append\n\t\t\ttry {\n\t\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\t\tawait telemetry.publish({\n\t\t\t\t\ttype: \"cli_generate\",\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\toutcome: schema.overwrite ? \"overwritten\" : \"appended\",\n\t\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t\tprocess.exit(0);\n\t\t} else {\n\t\t\tconsole.error(\"Schema generation aborted.\");\n\t\t\t// telemetry: track generate aborted\n\t\t\ttry {\n\t\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\t\tawait telemetry.publish({\n\t\t\t\t\ttype: \"cli_generate\",\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\toutcome: \"aborted\",\n\t\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\n\tif (options.y) {\n\t\tconsole.warn(\"WARNING: --y is deprecated. Consider -y or --yes\");\n\t\toptions.yes = true;\n\t}\n\n\tlet confirm = options.yes;\n\n\tif (!confirm) {\n\t\tconst response = await prompts({\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"confirm\",\n\t\t\tmessage: `Do you want to generate the schema to ${chalk.yellow(\n\t\t\t\tschema.fileName,\n\t\t\t)}?`,\n\t\t});\n\t\tconfirm = response.confirm;\n\t}\n\n\tif (!confirm) {\n\t\tconsole.error(\"Schema generation aborted.\");\n\t\t// telemetry: track generate aborted before write\n\t\ttry {\n\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\tawait telemetry.publish({\n\t\t\t\ttype: \"cli_generate\",\n\t\t\t\tpayload: {\n\t\t\t\t\toutcome: \"aborted\",\n\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {}\n\t\tprocess.exit(1);\n\t}\n\n\tif (!options.output) {\n\t\tconst dirExist = existsSync(path.dirname(path.join(cwd, schema.fileName)));\n\t\tif (!dirExist) {\n\t\t\tawait fs.mkdir(path.dirname(path.join(cwd, schema.fileName)), {\n\t\t\t\trecursive: true,\n\t\t\t});\n\t\t}\n\t}\n\tawait fs.writeFile(\n\t\toptions.output || path.join(cwd, schema.fileName),\n\t\tschema.code,\n\t);\n\tconsole.log(`🚀 Schema was generated successfully!`);\n\t// telemetry: track generate success\n\ttry {\n\t\tconst telemetry = await createTelemetry(config);\n\t\tawait telemetry.publish({\n\t\t\ttype: \"cli_generate\",\n\t\t\tpayload: {\n\t\t\t\toutcome: \"generated\",\n\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t},\n\t\t});\n\t} catch {}\n\tprocess.exit(0);\n}\n\nexport const generate = new Command(\"generate\")\n\t.option(\n\t\t\"-c, --cwd <cwd>\",\n\t\t\"the working directory. defaults to the current directory.\",\n\t\tprocess.cwd(),\n\t)\n\t.option(\n\t\t\"--config <config>\",\n\t\t\"the path to the configuration file. defaults to the first configuration file found.\",\n\t)\n\t.option(\"--output <output>\", \"the file to output to the generated schema\")\n\t.option(\n\t\t\"--adapter <adapter>\",\n\t\t\"specify the adapter type (e.g., prisma, drizzle, kysely) without requiring a configured adapter\",\n\t)\n\t.option(\n\t\t\"--dialect <dialect>\",\n\t\t\"specify the database dialect/provider (e.g., postgresql, mysql, sqlite). For drizzle, postgresql maps to 'pg'\",\n\t)\n\t.option(\"-y, --yes\", \"automatically answer yes to all prompts\", false)\n\t.option(\"--y\", \"(deprecated) same as --yes\", false)\n\t.action(generateAction);\n","import { execSync } from \"node:child_process\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport { getConfig } from \"../utils/get-config\";\nimport { getPackageInfo } from \"../utils/get-package-info\";\n\nfunction getSystemInfo() {\n\tconst platform = os.platform();\n\tconst arch = os.arch();\n\tconst version = os.version();\n\tconst release = os.release();\n\tconst cpus = os.cpus();\n\tconst memory = os.totalmem();\n\tconst freeMemory = os.freemem();\n\n\treturn {\n\t\tplatform,\n\t\tarch,\n\t\tversion,\n\t\trelease,\n\t\tcpuCount: cpus.length,\n\t\tcpuModel: cpus[0]?.model || \"Unknown\",\n\t\ttotalMemory: `${(memory / 1024 / 1024 / 1024).toFixed(2)} GB`,\n\t\tfreeMemory: `${(freeMemory / 1024 / 1024 / 1024).toFixed(2)} GB`,\n\t};\n}\n\nfunction getNodeInfo() {\n\treturn {\n\t\tversion: process.version,\n\t\tenv: process.env.NODE_ENV || \"development\",\n\t};\n}\n\nfunction getPackageManager() {\n\tconst userAgent = process.env.npm_config_user_agent || \"\";\n\n\tif (userAgent.includes(\"yarn\")) {\n\t\treturn { name: \"yarn\", version: getVersion(\"yarn\") };\n\t}\n\tif (userAgent.includes(\"pnpm\")) {\n\t\treturn { name: \"pnpm\", version: getVersion(\"pnpm\") };\n\t}\n\tif (userAgent.includes(\"bun\")) {\n\t\treturn { name: \"bun\", version: getVersion(\"bun\") };\n\t}\n\treturn { name: \"npm\", version: getVersion(\"npm\") };\n}\n\nfunction getVersion(command: string): string {\n\ttry {\n\t\tconst output = execSync(`${command} --version`, { encoding: \"utf8\" });\n\t\treturn output.trim();\n\t} catch {\n\t\treturn \"Not installed\";\n\t}\n}\n\nfunction getFrameworkInfo(projectRoot: string) {\n\tconst packageJsonPath = path.join(projectRoot, \"package.json\");\n\n\tif (!existsSync(packageJsonPath)) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\"));\n\t\tconst deps = {\n\t\t\t...packageJson.dependencies,\n\t\t\t...packageJson.devDependencies,\n\t\t};\n\n\t\tconst frameworks: Record<string, string | undefined> = {\n\t\t\tnext: deps[\"next\"],\n\t\t\treact: deps[\"react\"],\n\t\t\tvue: deps[\"vue\"],\n\t\t\tnuxt: deps[\"nuxt\"],\n\t\t\tsvelte: deps[\"svelte\"],\n\t\t\t\"@sveltejs/kit\": deps[\"@sveltejs/kit\"],\n\t\t\texpress: deps[\"express\"],\n\t\t\tfastify: deps[\"fastify\"],\n\t\t\thono: deps[\"hono\"],\n\t\t\t\"react-router\": deps[\"react-router\"],\n\t\t\tastro: deps[\"astro\"],\n\t\t\tsolid: deps[\"solid-js\"],\n\t\t\tqwik: deps[\"@builder.io/qwik\"],\n\t\t};\n\n\t\tconst installedFrameworks = Object.entries(frameworks)\n\t\t\t.filter(([_, version]) => version)\n\t\t\t.map(([name, version]) => ({ name, version }));\n\n\t\treturn installedFrameworks.length > 0 ? installedFrameworks : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction getDatabaseInfo(projectRoot: string) {\n\tconst packageJsonPath = path.join(projectRoot, \"package.json\");\n\n\tif (!existsSync(packageJsonPath)) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\"));\n\t\tconst deps = {\n\t\t\t...packageJson.dependencies,\n\t\t\t...packageJson.devDependencies,\n\t\t};\n\n\t\tconst databases: Record<string, string | undefined> = {\n\t\t\t\"better-sqlite3\": deps[\"better-sqlite3\"],\n\t\t\t\"@libsql/client\": deps[\"@libsql/client\"],\n\t\t\t\"@libsql/kysely-libsql\": deps[\"@libsql/kysely-libsql\"],\n\t\t\tmysql2: deps[\"mysql2\"],\n\t\t\tpg: deps[\"pg\"],\n\t\t\tpostgres: deps[\"postgres\"],\n\t\t\t\"@prisma/client\": deps[\"@prisma/client\"],\n\t\t\tdrizzle: deps[\"drizzle-orm\"],\n\t\t\tkysely: deps[\"kysely\"],\n\t\t\tmongodb: deps[\"mongodb\"],\n\t\t\t\"@neondatabase/serverless\": deps[\"@neondatabase/serverless\"],\n\t\t\t\"@vercel/postgres\": deps[\"@vercel/postgres\"],\n\t\t\t\"@planetscale/database\": deps[\"@planetscale/database\"],\n\t\t};\n\n\t\tconst installedDatabases = Object.entries(databases)\n\t\t\t.filter(([_, version]) => version)\n\t\t\t.map(([name, version]) => ({ name, version }));\n\n\t\treturn installedDatabases.length > 0 ? installedDatabases : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction sanitizeBetterAuthConfig(config: any): any {\n\tif (!config) return null;\n\n\tconst sanitized = JSON.parse(JSON.stringify(config));\n\n\t// List of sensitive keys to redact\n\tconst sensitiveKeys = [\n\t\t\"secret\",\n\t\t\"clientSecret\",\n\t\t\"clientId\",\n\t\t\"authToken\",\n\t\t\"apiKey\",\n\t\t\"apiSecret\",\n\t\t\"privateKey\",\n\t\t\"publicKey\",\n\t\t\"password\",\n\t\t\"token\",\n\t\t\"webhook\",\n\t\t\"connectionString\",\n\t\t\"databaseUrl\",\n\t\t\"databaseURL\",\n\t\t\"TURSO_AUTH_TOKEN\",\n\t\t\"TURSO_DATABASE_URL\",\n\t\t\"MYSQL_DATABASE_URL\",\n\t\t\"DATABASE_URL\",\n\t\t\"POSTGRES_URL\",\n\t\t\"MONGODB_URI\",\n\t\t\"stripeKey\",\n\t\t\"stripeWebhookSecret\",\n\t];\n\n\t// Keys that should NOT be redacted even if they contain sensitive keywords\n\tconst allowedKeys = [\n\t\t\"baseURL\",\n\t\t\"callbackURL\",\n\t\t\"redirectURL\",\n\t\t\"trustedOrigins\",\n\t\t\"appName\",\n\t];\n\n\tfunction redactSensitive(obj: any, parentKey?: string): any {\n\t\tif (typeof obj !== \"object\" || obj === null) {\n\t\t\t// Check if the parent key is sensitive\n\t\t\tif (parentKey && typeof obj === \"string\" && obj.length > 0) {\n\t\t\t\t// First check if it's in the allowed list\n\t\t\t\tif (\n\t\t\t\t\tallowedKeys.some(\n\t\t\t\t\t\t(allowed) => parentKey.toLowerCase() === allowed.toLowerCase(),\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn obj;\n\t\t\t\t}\n\n\t\t\t\tconst lowerKey = parentKey.toLowerCase();\n\t\t\t\tif (\n\t\t\t\t\tsensitiveKeys.some((key) => {\n\t\t\t\t\t\tconst lowerSensitiveKey = key.toLowerCase();\n\t\t\t\t\t\t// Exact match or the key ends with the sensitive key\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tlowerKey === lowerSensitiveKey ||\n\t\t\t\t\t\t\tlowerKey.endsWith(lowerSensitiveKey)\n\t\t\t\t\t\t);\n\t\t\t\t\t})\n\t\t\t\t) {\n\t\t\t\t\treturn \"[REDACTED]\";\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn obj;\n\t\t}\n\n\t\tif (Array.isArray(obj)) {\n\t\t\treturn obj.map((item) => redactSensitive(item, parentKey));\n\t\t}\n\n\t\tconst result: any = {};\n\t\tfor (const [key, value] of Object.entries(obj)) {\n\t\t\t// First check if this key is in the allowed list\n\t\t\tif (\n\t\t\t\tallowedKeys.some(\n\t\t\t\t\t(allowed) => key.toLowerCase() === allowed.toLowerCase(),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tresult[key] = value;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst lowerKey = key.toLowerCase();\n\n\t\t\t// Check if this key should be redacted\n\t\t\tif (\n\t\t\t\tsensitiveKeys.some((sensitiveKey) => {\n\t\t\t\t\tconst lowerSensitiveKey = sensitiveKey.toLowerCase();\n\t\t\t\t\t// Exact match or the key ends with the sensitive key\n\t\t\t\t\treturn (\n\t\t\t\t\t\tlowerKey === lowerSensitiveKey ||\n\t\t\t\t\t\tlowerKey.endsWith(lowerSensitiveKey)\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t) {\n\t\t\t\tif (typeof value === \"string\" && value.length > 0) {\n\t\t\t\t\tresult[key] = \"[REDACTED]\";\n\t\t\t\t} else if (typeof value === \"object\" && value !== null) {\n\t\t\t\t\t// Still recurse into objects but mark them as potentially sensitive\n\t\t\t\t\tresult[key] = redactSensitive(value, key);\n\t\t\t\t} else {\n\t\t\t\t\tresult[key] = value;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresult[key] = redactSensitive(value, key);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t// Special handling for specific config sections\n\tif (sanitized.database) {\n\t\t// Redact database connection details\n\t\tif (typeof sanitized.database === \"string\") {\n\t\t\tsanitized.database = \"[REDACTED]\";\n\t\t} else if (sanitized.database.url) {\n\t\t\tsanitized.database.url = \"[REDACTED]\";\n\t\t}\n\t\tif (sanitized.database.authToken) {\n\t\t\tsanitized.database.authToken = \"[REDACTED]\";\n\t\t}\n\t}\n\n\tif (sanitized.socialProviders) {\n\t\t// Redact all social provider secrets\n\t\tfor (const provider in sanitized.socialProviders) {\n\t\t\tif (sanitized.socialProviders[provider]) {\n\t\t\t\tsanitized.socialProviders[provider] = redactSensitive(\n\t\t\t\t\tsanitized.socialProviders[provider],\n\t\t\t\t\tprovider,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (sanitized.emailAndPassword?.sendResetPassword) {\n\t\tsanitized.emailAndPassword.sendResetPassword = \"[Function]\";\n\t}\n\n\tif (sanitized.emailVerification?.sendVerificationEmail) {\n\t\tsanitized.emailVerification.sendVerificationEmail = \"[Function]\";\n\t}\n\n\t// Redact plugin configurations\n\tif (sanitized.plugins && Array.isArray(sanitized.plugins)) {\n\t\tsanitized.plugins = sanitized.plugins.map((plugin: any) => {\n\t\t\tif (typeof plugin === \"function\") {\n\t\t\t\treturn \"[Plugin Function]\";\n\t\t\t}\n\t\t\tif (plugin && typeof plugin === \"object\") {\n\t\t\t\t// Get plugin name if available\n\t\t\t\tconst pluginName = plugin.id || plugin.name || \"unknown\";\n\t\t\t\treturn {\n\t\t\t\t\tname: pluginName,\n\t\t\t\t\tconfig: redactSensitive(plugin.config || plugin),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn plugin;\n\t\t});\n\t}\n\n\treturn redactSensitive(sanitized);\n}\n\nasync function getBetterAuthInfo(\n\tprojectRoot: string,\n\tconfigPath?: string,\n\tsuppressLogs = false,\n) {\n\ttry {\n\t\t// Temporarily suppress console output if needed\n\t\tconst originalLog = console.log;\n\t\tconst originalWarn = console.warn;\n\t\tconst originalError = console.error;\n\n\t\tif (suppressLogs) {\n\t\t\tconsole.log = () => {};\n\t\t\tconsole.warn = () => {};\n\t\t\tconsole.error = () => {};\n\t\t}\n\n\t\ttry {\n\t\t\tconst config = await getConfig({\n\t\t\t\tcwd: projectRoot,\n\t\t\t\tconfigPath,\n\t\t\t\tshouldThrowOnError: true,\n\t\t\t});\n\t\t\tconst packageInfo = await getPackageInfo();\n\t\t\tconst betterAuthVersion =\n\t\t\t\tpackageInfo.dependencies?.[\"better-auth\"] ||\n\t\t\t\tpackageInfo.devDependencies?.[\"better-auth\"] ||\n\t\t\t\tpackageInfo.peerDependencies?.[\"better-auth\"] ||\n\t\t\t\tpackageInfo.optionalDependencies?.[\"better-auth\"] ||\n\t\t\t\t\"Unknown\";\n\n\t\t\treturn {\n\t\t\t\tversion: betterAuthVersion,\n\t\t\t\tconfig: sanitizeBetterAuthConfig(config),\n\t\t\t};\n\t\t} finally {\n\t\t\t// Restore console methods\n\t\t\tif (suppressLogs) {\n\t\t\t\tconsole.log = originalLog;\n\t\t\t\tconsole.warn = originalWarn;\n\t\t\t\tconsole.error = originalError;\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\treturn {\n\t\t\tversion: \"Unknown\",\n\t\t\tconfig: null,\n\t\t\terror:\n\t\t\t\terror instanceof Error\n\t\t\t\t\t? error.message\n\t\t\t\t\t: \"Failed to load Better Auth config\",\n\t\t};\n\t}\n}\n\nfunction formatOutput(data: any, indent = 0): string {\n\tconst spaces = \" \".repeat(indent);\n\n\tif (data === null || data === undefined) {\n\t\treturn `${spaces}${chalk.gray(\"N/A\")}`;\n\t}\n\n\tif (\n\t\ttypeof data === \"string\" ||\n\t\ttypeof data === \"number\" ||\n\t\ttypeof data === \"boolean\"\n\t) {\n\t\treturn `${spaces}${data}`;\n\t}\n\n\tif (Array.isArray(data)) {\n\t\tif (data.length === 0) {\n\t\t\treturn `${spaces}${chalk.gray(\"[]\")}`;\n\t\t}\n\t\treturn data.map((item) => formatOutput(item, indent)).join(\"\\n\");\n\t}\n\n\tif (typeof data === \"object\") {\n\t\tconst entries = Object.entries(data);\n\t\tif (entries.length === 0) {\n\t\t\treturn `${spaces}${chalk.gray(\"{}\")}`;\n\t\t}\n\n\t\treturn entries\n\t\t\t.map(([key, value]) => {\n\t\t\t\tif (\n\t\t\t\t\ttypeof value === \"object\" &&\n\t\t\t\t\tvalue !== null &&\n\t\t\t\t\t!Array.isArray(value)\n\t\t\t\t) {\n\t\t\t\t\treturn `${spaces}${chalk.cyan(key)}:\\n${formatOutput(value, indent + 2)}`;\n\t\t\t\t}\n\t\t\t\treturn `${spaces}${chalk.cyan(key)}: ${formatOutput(value, 0)}`;\n\t\t\t})\n\t\t\t.join(\"\\n\");\n\t}\n\n\treturn `${spaces}${JSON.stringify(data)}`;\n}\n\nexport const info = new Command(\"info\")\n\t.description(\"Display system and Better Auth configuration information\")\n\t.option(\"--cwd <cwd>\", \"The working directory\", process.cwd())\n\t.option(\"--config <config>\", \"Path to the Better Auth configuration file\")\n\t.option(\"-j, --json\", \"Output as JSON\")\n\t.option(\"-c, --copy\", \"Copy output to clipboard (requires pbcopy/xclip)\")\n\t.action(async (options) => {\n\t\tconst projectRoot = path.resolve(options.cwd || process.cwd());\n\n\t\t// Collect all information\n\t\tconst systemInfo = getSystemInfo();\n\t\tconst nodeInfo = getNodeInfo();\n\t\tconst packageManager = getPackageManager();\n\t\tconst frameworks = getFrameworkInfo(projectRoot);\n\t\tconst databases = getDatabaseInfo(projectRoot);\n\t\tconst betterAuthInfo = await getBetterAuthInfo(\n\t\t\tprojectRoot,\n\t\t\toptions.config,\n\t\t\toptions.json,\n\t\t);\n\n\t\tconst fullInfo = {\n\t\t\tsystem: systemInfo,\n\t\t\tnode: nodeInfo,\n\t\t\tpackageManager,\n\t\t\tframeworks,\n\t\t\tdatabases,\n\t\t\tbetterAuth: betterAuthInfo,\n\t\t};\n\n\t\tif (options.json) {\n\t\t\tconst jsonOutput = JSON.stringify(fullInfo, null, 2);\n\t\t\tconsole.log(jsonOutput);\n\n\t\t\tif (options.copy) {\n\t\t\t\ttry {\n\t\t\t\t\tconst platform = os.platform();\n\t\t\t\t\tif (platform === \"darwin\") {\n\t\t\t\t\t\texecSync(\"pbcopy\", { input: jsonOutput });\n\t\t\t\t\t\tconsole.log(chalk.green(\"\\n✓ Copied to clipboard\"));\n\t\t\t\t\t} else if (platform === \"linux\") {\n\t\t\t\t\t\texecSync(\"xclip -selection clipboard\", { input: jsonOutput });\n\t\t\t\t\t\tconsole.log(chalk.green(\"\\n✓ Copied to clipboard\"));\n\t\t\t\t\t} else if (platform === \"win32\") {\n\t\t\t\t\t\texecSync(\"clip\", { input: jsonOutput });\n\t\t\t\t\t\tconsole.log(chalk.green(\"\\n✓ Copied to clipboard\"));\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\tconsole.log(chalk.yellow(\"\\n⚠ Could not copy to clipboard\"));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Format and display output\n\t\tconsole.log(chalk.bold(\"\\n📊 Better Auth System Information\\n\"));\n\t\tconsole.log(chalk.gray(\"=\".repeat(50)));\n\n\t\tconsole.log(chalk.bold.white(\"\\n🖥️ System Information:\"));\n\t\tconsole.log(formatOutput(systemInfo, 2));\n\n\t\tconsole.log(chalk.bold.white(\"\\n📦 Node.js:\"));\n\t\tconsole.log(formatOutput(nodeInfo, 2));\n\n\t\tconsole.log(chalk.bold.white(\"\\n📦 Package Manager:\"));\n\t\tconsole.log(formatOutput(packageManager, 2));\n\n\t\tif (frameworks) {\n\t\t\tconsole.log(chalk.bold.white(\"\\n🚀 Frameworks:\"));\n\t\t\tconsole.log(formatOutput(frameworks, 2));\n\t\t}\n\n\t\tif (databases) {\n\t\t\tconsole.log(chalk.bold.white(\"\\n💾 Database Clients:\"));\n\t\t\tconsole.log(formatOutput(databases, 2));\n\t\t}\n\n\t\tconsole.log(chalk.bold.white(\"\\n🔐 Better Auth:\"));\n\t\tif (betterAuthInfo.error) {\n\t\t\tconsole.log(` ${chalk.red(\"Error:\")} ${betterAuthInfo.error}`);\n\t\t} else {\n\t\t\tconsole.log(` ${chalk.cyan(\"Version\")}: ${betterAuthInfo.version}`);\n\t\t\tif (betterAuthInfo.config) {\n\t\t\t\tconsole.log(` ${chalk.cyan(\"Configuration\")}:`);\n\t\t\t\tconsole.log(formatOutput(betterAuthInfo.config, 4));\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(chalk.gray(\"\\n\" + \"=\".repeat(50)));\n\t\tconsole.log(chalk.gray(\"\\n💡 Tip: Use --json flag for JSON output\"));\n\t\tconsole.log(chalk.gray(\"💡 Use --copy flag to copy output to clipboard\"));\n\t\tconsole.log(\n\t\t\tchalk.gray(\"💡 When reporting issues, include this information\\n\"),\n\t\t);\n\n\t\tif (options.copy) {\n\t\t\tconst textOutput = `\nBetter Auth System Information\n==============================\n\nSystem Information:\n${JSON.stringify(systemInfo, null, 2)}\n\nNode.js:\n${JSON.stringify(nodeInfo, null, 2)}\n\nPackage Manager:\n${JSON.stringify(packageManager, null, 2)}\n\nFrameworks:\n${JSON.stringify(frameworks, null, 2)}\n\nDatabase Clients:\n${JSON.stringify(databases, null, 2)}\n\nBetter Auth:\n${JSON.stringify(betterAuthInfo, null, 2)}\n`;\n\n\t\t\ttry {\n\t\t\t\tconst platform = os.platform();\n\t\t\t\tif (platform === \"darwin\") {\n\t\t\t\t\texecSync(\"pbcopy\", { input: textOutput });\n\t\t\t\t\tconsole.log(chalk.green(\"✓ Copied to clipboard\"));\n\t\t\t\t} else if (platform === \"linux\") {\n\t\t\t\t\texecSync(\"xclip -selection clipboard\", { input: textOutput });\n\t\t\t\t\tconsole.log(chalk.green(\"✓ Copied to clipboard\"));\n\t\t\t\t} else if (platform === \"win32\") {\n\t\t\t\t\texecSync(\"clip\", { input: textOutput });\n\t\t\t\t\tconsole.log(chalk.green(\"✓ Copied to clipboard\"));\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tconsole.log(chalk.yellow(\"⚠ Could not copy to clipboard\"));\n\t\t\t}\n\t\t}\n\t});\n","import { exec } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { Awaitable, LiteralString } from \"@better-auth/core\";\nimport { env } from \"@better-auth/core/env\";\nimport type { PackageJson } from \"type-fest\";\nimport { findMonorepoRoot } from \"./get-package-info\";\n\nexport async function checkPackageManagers() {\n\tconst hasPnpm = await getVersion(\"pnpm\");\n\tconst hasBun = await getVersion(\"bun\");\n\tconst hasYarn = await getVersion(\"yarn\");\n\n\treturn {\n\t\thasPnpm,\n\t\thasBun,\n\t\thasYarn,\n\t};\n}\n\nexport const PACKAGE_MANAGER = [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as const;\nexport type PackageManager = (typeof PACKAGE_MANAGER)[number];\n\nexport async function detectPackageManager(\n\tcwd: string,\n\tpackageJson: PackageJson,\n): Promise<{\n\tpackageManager: PackageManager;\n\tversion?: string | undefined;\n}> {\n\tconst monorepoRoot = await findMonorepoRoot(cwd);\n\tfor (const strategy of [\n\t\tenvStrategy,\n\t\tpackageJsonStrategy,\n\t\tlockFileStrategy,\n\t\tconfigStrategy,\n\t\tcliStrategy,\n\t]) {\n\t\tconst result = await strategy({ cwd: monorepoRoot ?? cwd, packageJson });\n\t\tif (\n\t\t\tresult !== null &&\n\t\t\tPACKAGE_MANAGER.includes(\n\t\t\t\tresult.packageManager.toLowerCase() as PackageManager,\n\t\t\t)\n\t\t) {\n\t\t\treturn result as { packageManager: PackageManager };\n\t\t}\n\t}\n\treturn { packageManager: \"npm\" };\n}\n\ntype Strategy = (ctx: { cwd: string; packageJson: PackageJson }) => Awaitable<{\n\tpackageManager: PackageManager | LiteralString;\n\tversion?: string | undefined;\n} | null>;\n\nconst envStrategy: Strategy = () => {\n\tconst userAgent = env.npm_config_user_agent;\n\tif (!userAgent) {\n\t\treturn null;\n\t}\n\n\tconst pmSpec = userAgent.split(\" \")[0]!;\n\tconst separatorPos = pmSpec.lastIndexOf(\"/\");\n\tconst packageManager = pmSpec.substring(0, separatorPos) as PackageManager;\n\tconst version = pmSpec.substring(separatorPos + 1);\n\n\treturn {\n\t\tpackageManager,\n\t\tversion,\n\t};\n};\n\nconst lockFileStrategy: Strategy = ({ cwd }) => {\n\tif (existsSync(join(cwd, \"package-lock.json\"))) {\n\t\treturn { packageManager: \"npm\" };\n\t}\n\tif (existsSync(join(cwd, \"yarn.lock\"))) {\n\t\treturn { packageManager: \"yarn\" };\n\t}\n\tif (existsSync(join(cwd, \"pnpm-lock.yaml\"))) {\n\t\treturn { packageManager: \"pnpm\" };\n\t}\n\tif (existsSync(join(cwd, \"bun.lock\")) || existsSync(join(cwd, \"bun.lockb\"))) {\n\t\treturn { packageManager: \"bun\" };\n\t}\n\treturn null;\n};\n\nconst packageJsonStrategy: Strategy = ({ packageJson }) => {\n\tconst [packageManager, version] =\n\t\tpackageJson.packageManager?.split(\"@\", 2) ?? [];\n\tif (\n\t\tpackageManager &&\n\t\tPACKAGE_MANAGER.includes(packageManager.toLowerCase() as PackageManager)\n\t) {\n\t\treturn { packageManager, version };\n\t}\n\treturn null;\n};\n\nconst configStrategy: Strategy = ({ cwd, packageJson }) => {\n\tif (typeof packageJson.workspaces === \"object\") {\n\t\tif (\"nohoist\" in packageJson.workspaces) {\n\t\t\treturn { packageManager: \"yarn\" };\n\t\t}\n\t\tif (\"catalog\" in packageJson.workspaces) {\n\t\t\treturn { packageManager: \"bun\" };\n\t\t}\n\t}\n\tif (\n\t\ttypeof packageJson.pnpm !== \"undefined\" ||\n\t\texistsSync(join(cwd, \"pnpm-workspace.yaml\"))\n\t) {\n\t\treturn { packageManager: \"pnpm\" };\n\t}\n\tif (\n\t\texistsSync(join(cwd, \".yarnrc.yml\")) ||\n\t\texistsSync(join(cwd, \".yarnrc\"))\n\t) {\n\t\treturn { packageManager: \"yarn\" };\n\t}\n\tif (existsSync(join(cwd, \"bunfig.toml\"))) {\n\t\treturn { packageManager: \"bun\" };\n\t}\n\treturn null;\n};\n\nconst cliStrategy: Strategy = async ({ cwd }) => {\n\tconst { hasBun, hasPnpm, hasYarn } = await checkPackageManagers();\n\n\tif (hasBun) {\n\t\treturn { packageManager: \"bun\" };\n\t}\n\tif (hasPnpm) {\n\t\treturn { packageManager: \"pnpm\" };\n\t}\n\tif (hasYarn) {\n\t\treturn { packageManager: \"yarn\" };\n\t}\n\treturn null;\n};\n\nfunction stripQuotes(s: string): string {\n\tconst trimmed = s.trim();\n\tif (\n\t\t(trimmed.startsWith('\"') && trimmed.endsWith('\"')) ||\n\t\t(trimmed.startsWith(\"'\") && trimmed.endsWith(\"'\"))\n\t) {\n\t\treturn trimmed.slice(1, -1);\n\t}\n\treturn trimmed;\n}\n\nfunction _parseCatalogLine(line: string): [string, string] | [] {\n\tconst entry = line.trim().replace(/^- /, \"\").trim();\n\tconst delimiterIndex = entry.indexOf(\":\");\n\tif (delimiterIndex === -1) return [];\n\tconst key = stripQuotes(entry.slice(0, delimiterIndex));\n\tconst value = stripQuotes(entry.slice(delimiterIndex + 1));\n\treturn [key, value];\n}\n\nexport function getPkgManagerStr({\n\tpackageManager,\n\tversion,\n}: {\n\tpackageManager: PackageManager;\n\tversion?: string | null | undefined;\n}) {\n\tif (!version) {\n\t\treturn packageManager;\n\t}\n\treturn `${packageManager}@${version}`;\n}\n\nexport async function getVersion(\n\tpkgManager: PackageManager,\n): Promise<string | null> {\n\tconst version = await new Promise<string | null>((resolve) => {\n\t\texec(`${pkgManager} -v`, (err, stdout) => {\n\t\t\tif (err) {\n\t\t\t\tresolve(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(stdout.trim());\n\t\t});\n\t});\n\n\treturn version;\n}\n","let possiblePaths = [\n\t\"auth.ts\",\n\t\"auth.tsx\",\n\t\"auth.js\",\n\t\"auth.jsx\",\n\t\"auth.server.js\",\n\t\"auth.server.ts\",\n\t\"auth/index.ts\",\n\t\"auth/index.tsx\",\n\t\"auth/index.js\",\n\t\"auth/index.jsx\",\n\t\"auth/index.server.js\",\n\t\"auth/index.server.ts\",\n];\n\npossiblePaths = [\n\t...possiblePaths,\n\t...possiblePaths.map((it) => `lib/server/${it}`),\n\t...possiblePaths.map((it) => `server/auth/${it}`),\n\t...possiblePaths.map((it) => `server/${it}`),\n\t...possiblePaths.map((it) => `auth/${it}`),\n\t...possiblePaths.map((it) => `lib/${it}`),\n\t...possiblePaths.map((it) => `utils/${it}`),\n];\npossiblePaths = [\n\t...possiblePaths,\n\t...possiblePaths.map((it) => `src/${it}`),\n\t...possiblePaths.map((it) => `app/${it}`),\n];\n\nexport const possibleAuthConfigPaths = possiblePaths;\n\nlet _possibleClientConfigPaths = [\n\t\"auth-client.ts\",\n\t\"auth-client.tsx\",\n\t\"auth-client.js\",\n\t\"auth-client.jsx\",\n\t\"auth-client.server.js\",\n\t\"auth-client.server.ts\",\n\t\"auth-client/index.ts\",\n\t\"auth-client/index.tsx\",\n\t\"auth-client/index.js\",\n\t\"auth-client/index.jsx\",\n\t\"auth-client/index.server.js\",\n\t\"auth-client/index.server.ts\",\n];\n\n_possibleClientConfigPaths = [\n\t..._possibleClientConfigPaths,\n\t..._possibleClientConfigPaths.map((it) => `lib/server/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `server/auth/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `server/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `auth/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `lib/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `utils/${it}`),\n];\n_possibleClientConfigPaths = [\n\t..._possibleClientConfigPaths,\n\t..._possibleClientConfigPaths.map((it) => `src/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `app/${it}`),\n];\n\nexport const possibleClientConfigPaths = _possibleClientConfigPaths;\n","import { exec } from \"node:child_process\";\nimport type { LiteralString } from \"@better-auth/core\";\n\nconst flagsMap = {\n\tnpm: {\n\t\tdev: \"--save-dev\",\n\t\toptional: \"--save-optional\",\n\t},\n\tpnpm: {\n\t\tdev: \"--save-dev\",\n\t\tpeer: \"--save-peer\",\n\t\toptional: \"--save-optional\",\n\t\tcatalog: (name?: string) => {\n\t\t\tif (name) {\n\t\t\t\treturn `--save-catalog-name ${name}`;\n\t\t\t}\n\t\t\treturn \"--save-catalog\";\n\t\t},\n\t},\n\tbun: {\n\t\tdev: \"--dev\",\n\t\tpeer: \"--peer\",\n\t\toptional: \"--optional\",\n\t},\n\tyarn: {\n\t\tdev: \"--dev\",\n\t\tpeer: \"--peer\",\n\t\toptional: \"--optional\",\n\t},\n};\n\nexport function installDependencies({\n\tdependencies,\n\tpackageManager,\n\tcwd,\n\ttype = \"prod\",\n\tcatalogName,\n}: {\n\tdependencies: string | string[];\n\tpackageManager: \"npm\" | \"pnpm\" | \"bun\" | \"yarn\" | LiteralString;\n\tcwd: string;\n\ttype?: \"prod\" | \"peer\" | \"optional\" | \"dev\" | \"catalog\" | undefined;\n\tcatalogName?: string;\n}): Promise<boolean> {\n\tlet installCommand: string;\n\tconst flags: string[] = [];\n\tswitch (packageManager) {\n\t\tcase \"npm\":\n\t\t\tinstallCommand = \"npm install\";\n\t\t\tflags.push(\"--force\");\n\t\t\tbreak;\n\t\tcase \"pnpm\":\n\t\t\tinstallCommand = \"pnpm add\";\n\t\t\tbreak;\n\t\tcase \"bun\":\n\t\t\tinstallCommand = \"bun install\";\n\t\t\tbreak;\n\t\tcase \"yarn\":\n\t\t\tinstallCommand = \"yarn install\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(\"Invalid package manager\");\n\t}\n\n\tconst flagMap = flagsMap[packageManager as \"pnpm\" | \"npm\"];\n\tif (type === \"catalog\") {\n\t\tif (\"catalog\" in flagMap) {\n\t\t\tconst catalogFlag = flagMap[\"catalog\"];\n\t\t\tflags.push(catalogFlag(catalogName));\n\t\t} else {\n\t\t\tthrow new Error(`Catalog flag is not supported by \"${packageManager}\"`);\n\t\t}\n\t} else {\n\t\tconst flag = flagMap?.[type as keyof typeof flagMap];\n\t\tif (flag) {\n\t\t\tflags.push(flag);\n\t\t}\n\t}\n\tconst command = `${installCommand}${flags.length > 0 ? ` ${flags.join(\" \")}` : \"\"} ${Array.isArray(dependencies) ? dependencies.join(\" \") : dependencies}`;\n\n\treturn new Promise((resolve, reject) => {\n\t\texec(command, { cwd }, (error, stdout, stderr) => {\n\t\t\tif (error) {\n\t\t\t\treject(new Error(stderr));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(true);\n\t\t});\n\t});\n}\n","export const FRAMEWORKS = [\n\t{\n\t\tname: \"Astro\",\n\t\tid: \"astro\",\n\t\tdependency: \"astro\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/react\", // assume react is used for astro\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: \"pages/api/auth/[...all].ts\",\n\t\t\tcode: `import { auth } from \"~/auth\";\nimport type { APIRoute } from \"astro\";\n\nexport const ALL: APIRoute = async (ctx) => {\n\t// If you want to use rate limiting, make sure to set the 'x-forwarded-for' header to the request headers from the context\n\t// ctx.request.headers.set(\"x-forwarded-for\", ctx.clientAddress);\n\treturn auth.handler(ctx.request);\n};`,\n\t\t},\n\t\tconfigPaths: [\n\t\t\t\"astro.config.mjs\",\n\t\t\t\"astro.config.ts\",\n\t\t\t\"astro.config.js\",\n\t\t\t\"astro.config.cjs\",\n\t\t],\n\t},\n\t// todo: remove in future versions\n\t{\n\t\tname: \"Remix\",\n\t\tid: \"remix\",\n\t\tdependency: \"@remix-run/server-runtime\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/react\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: \"app/lib/auth.server.ts\",\n\t\t\tcode: `import { betterAuth } from \"better-auth\"\n\nexport const auth = betterAuth({\n database: {\n provider: \"postgres\", //change this to your database provider\n url: process.env.DATABASE_URL, // path to your database or connection string\n }\n})`,\n\t\t},\n\t\tconfigPaths: [\"remix.config.js\"],\n\t},\n\t{\n\t\tname: \"React Router v7\",\n\t\tid: \"react-router-v7\",\n\t\tdependency: \"react-router\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/react\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: \"app/lib/auth.server.ts\",\n\t\t\tcode: `import { betterAuth } from \"better-auth\"\n\nexport const auth = betterAuth({\n database: {\n provider: \"postgres\", //change this to your database provider\n url: process.env.DATABASE_URL, // path to your database or connection string\n }\n})`,\n\t\t},\n\t\tconfigPaths: [\"react-router.config.ts\"],\n\t},\n\t{\n\t\tname: \"Next.js\",\n\t\tid: \"next\",\n\t\tdependency: \"next\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/react\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: \"api/auth/[...all]/route.ts\",\n\t\t\tcode: `import { auth } from \"@/lib/auth\";\nimport { toNextJsHandler } from \"better-auth/next-js\";\nexport const { GET, POST } = toNextJsHandler(auth.handler);`,\n\t\t},\n\t\tconfigPaths: [\n\t\t\t\"next.config.js\",\n\t\t\t\"next.config.ts\",\n\t\t\t\"next.config.mjs\",\n\t\t\t\".next/server/next.config.js\",\n\t\t\t\".next/server/next.config.ts\",\n\t\t\t\".next/server/next.config.mjs\",\n\t\t],\n\t},\n\t{\n\t\tname: \"Nuxt\",\n\t\tid: \"nuxt\",\n\t\tdependency: \"nuxt\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/vue\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: \"server/api/auth/[...all].ts\",\n\t\t\tcode: `import { auth } from \"~/lib/auth\"; // import your auth config\n\nexport default defineEventHandler((event) => {\n\treturn auth.handler(toWebRequest(event));\n});`,\n\t\t},\n\t\tconfigPaths: [\n\t\t\t\"nuxt.config.js\",\n\t\t\t\"nuxt.config.ts\",\n\t\t\t\"nuxt.config.mjs\",\n\t\t\t\"nuxt.config.cjs\",\n\t\t],\n\t},\n\t{\n\t\tname: \"SvelteKit\",\n\t\tid: \"sveltekit\",\n\t\tdependency: \"@sveltejs/kit\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/svelte\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: `hooks.server.ts`,\n\t\t\tcode: `import { auth } from \"$lib/auth\";\nimport { svelteKitHandler } from \"better-auth/svelte-kit\";\nimport { building } from \"$app/environment\";\n\nexport async function handle({ event, resolve }) {\n return svelteKitHandler({ event, resolve, auth, building });\n}`,\n\t\t},\n\t\tconfigPaths: [\n\t\t\t\"svelte.config.js\",\n\t\t\t\"svelte.config.ts\",\n\t\t\t\"svelte.config.mjs\",\n\t\t\t\"svelte.config.cjs\",\n\t\t],\n\t},\n\t{\n\t\tname: \"Solid Start\",\n\t\tid: \"solid-start\",\n\t\tdependency: \"solid-start\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/solid\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: `routes/api/auth/*auth.ts`,\n\t\t\tcode: `import { auth } from \"~/lib/auth\";\nimport { toSolidStartHandler } from \"better-auth/solid-start\";\n\nexport const { GET, POST } = toSolidStartHandler(auth);`,\n\t\t},\n\t\tconfigPaths: [\"app.config.ts\"],\n\t},\n\t{\n\t\tname: \"Tanstack Start\",\n\t\tid: \"tanstack-start\",\n\t\tdependency: \"tanstack-start\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/react\", // assume react is used for tanstack start\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: `src/routes/api/auth/$.ts`,\n\t\t\tcode: `import { auth } from '@/lib/auth'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/auth/$')({\n server: {\n handlers: {\n GET: ({ request }) => {\n return auth.handler(request)\n },\n POST: ({ request }) => {\n return auth.handler(request)\n },\n },\n },\n})`,\n\t\t},\n\t\tconfigPaths: null,\n\t},\n\t{\n\t\tname: \"Hono\",\n\t\tid: \"hono\",\n\t\tdependency: \"hono\",\n\t\tauthClient: null,\n\t\trouteHandler: null,\n\t\tconfigPaths: null,\n\t},\n\t{\n\t\tname: \"Fastify\",\n\t\tid: \"fastify\",\n\t\tdependency: \"fastify\",\n\t\tauthClient: null,\n\t\trouteHandler: null,\n\t\tconfigPaths: null,\n\t},\n\t{\n\t\tname: \"Express\",\n\t\tid: \"express\",\n\t\tdependency: \"express\",\n\t\tauthClient: null,\n\t\trouteHandler: null,\n\t\tconfigPaths: null,\n\t},\n\t{\n\t\tname: \"Elysia\",\n\t\tid: \"elysia\",\n\t\tdependency: \"elysia\",\n\t\tauthClient: null,\n\t\trouteHandler: null,\n\t\tconfigPaths: null,\n\t},\n\t{\n\t\tname: \"Nitro\",\n\t\tid: \"nitro\",\n\t\tdependency: \"nitro\",\n\t\tauthClient: null,\n\t\trouteHandler: null,\n\t\tconfigPaths: [\"nitro.config.ts\"],\n\t},\n] as const satisfies {\n\tname: string;\n\tid: string;\n\tdependency: string;\n\tauthClient: {\n\t\timportPath: string;\n\t} | null;\n\trouteHandler: {\n\t\tpath: string;\n\t\tcode: string;\n\t} | null;\n\tconfigPaths: string[] | null;\n}[];\n\nexport type Framework = (typeof FRAMEWORKS)[number];\n","export const SOCIAL_PROVIDERS = [\n\t\"apple\",\n\t\"atlassian\",\n\t\"cognito\",\n\t\"discord\",\n\t\"dropbox\",\n\t\"facebook\",\n\t\"figma\",\n\t\"github\",\n\t\"gitlab\",\n\t\"google\",\n\t\"huggingface\",\n\t\"kakao\",\n\t\"kick\",\n\t\"line\",\n\t\"linear\",\n\t\"linkedin\",\n\t\"microsoft\",\n\t\"naver\",\n\t\"notion\",\n\t\"paybin\",\n\t\"paypal\",\n\t\"polar\",\n\t\"reddit\",\n\t\"roblox\",\n\t\"salesforce\",\n\t\"slack\",\n\t\"spotify\",\n\t\"tiktok\",\n\t\"twitch\",\n\t\"twitter\",\n\t\"vercel\",\n\t\"vk\",\n\t\"zoom\",\n] as const;\n\nexport type SocialProvider = (typeof SOCIAL_PROVIDERS)[number];\n\nexport type ProviderOption = {\n\tname: string;\n\tenvVar: string;\n};\n\nexport type ProviderConfig = {\n\toptions: ProviderOption[];\n};\n\n/**\n * Configuration for each social provider specifying what options are required\n */\nexport const SOCIAL_PROVIDER_CONFIGS: Record<SocialProvider, ProviderConfig> = {\n\tapple: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"APPLE_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"APPLE_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tatlassian: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"ATLASSIAN_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"ATLASSIAN_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tcognito: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"COGNITO_CLIENT_ID\" },\n\t\t\t{ name: \"domain\", envVar: \"COGNITO_DOMAIN\" },\n\t\t\t{ name: \"region\", envVar: \"COGNITO_REGION\" },\n\t\t\t{ name: \"userPoolId\", envVar: \"COGNITO_USERPOOL_ID\" },\n\t\t],\n\t},\n\tdiscord: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"DISCORD_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"DISCORD_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tdropbox: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"DROPBOX_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"DROPBOX_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tfacebook: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"FACEBOOK_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"FACEBOOK_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tfigma: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"FIGMA_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"FIGMA_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tgithub: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"GITHUB_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"GITHUB_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tgitlab: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"GITLAB_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"GITLAB_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tgoogle: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"GOOGLE_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"GOOGLE_CLIENT_SECRET\" },\n\t\t],\n\t},\n\thuggingface: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"HUGGINGFACE_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"HUGGINGFACE_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tkakao: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"KAKAO_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"KAKAO_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tkick: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"KICK_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"KICK_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tline: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"LINE_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"LINE_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tlinear: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"LINEAR_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"LINEAR_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tlinkedin: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"LINKEDIN_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"LINKEDIN_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tmicrosoft: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"MICROSOFT_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"MICROSOFT_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tnaver: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"NAVER_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"NAVER_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tnotion: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"NOTION_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"NOTION_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tpaybin: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"PAYBIN_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"PAYBIN_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tpaypal: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"PAYPAL_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"PAYPAL_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tpolar: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"POLAR_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"POLAR_CLIENT_SECRET\" },\n\t\t],\n\t},\n\treddit: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"REDDIT_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"REDDIT_CLIENT_SECRET\" },\n\t\t],\n\t},\n\troblox: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"ROBLOX_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"ROBLOX_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tsalesforce: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"SALESFORCE_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"SALESFORCE_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tslack: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"SLACK_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"SLACK_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tspotify: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"SPOTIFY_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"SPOTIFY_CLIENT_SECRET\" },\n\t\t],\n\t},\n\ttiktok: {\n\t\toptions: [\n\t\t\t{ name: \"clientKey\", envVar: \"TIKTOK_CLIENT_KEY\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"TIKTOK_CLIENT_SECRET\" },\n\t\t],\n\t},\n\ttwitch: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"TWITCH_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"TWITCH_CLIENT_SECRET\" },\n\t\t],\n\t},\n\ttwitter: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"TWITTER_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"TWITTER_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tvercel: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"VERCEL_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"VERCEL_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tvk: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"VK_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"VK_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tzoom: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"ZOOM_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"ZOOM_CLIENT_SECRET\" },\n\t\t],\n\t},\n};\n","import { format as prettierFormat } from \"prettier\";\n\nexport const formatCode = async (code: string) => {\n\treturn await prettierFormat(code, {\n\t\tparser: \"typescript\",\n\t});\n};\n","import { formatCode } from \"./format\";\n\nexport type NamedImportGroup = {\n\t/**\n\t * The path of the import\n\t */\n\tpath: string;\n\t/**\n\t * The imports in the group.\n\t */\n\timports: Import;\n\t/**\n\t * Wether the import is importing from a `default export` or a `named export`\n\t */\n\tisNamedImport: true;\n};\n\nexport type NormalImportGroup = {\n\t/**\n\t * The path of the import\n\t */\n\tpath: string;\n\t/**\n\t * The imports in the group.\n\t */\n\timports: Import[];\n\t/**\n\t * Wether the import is a default import\n\t */\n\tisNamedImport: false;\n};\n\n/**\n * A collection of imports that are grouped by the same path.\n */\nexport type ImportGroup = NormalImportGroup | NamedImportGroup;\n\n/**\n * An import. Doesn't necessarily represent a single import statement. (Unless the `isDefaultExport` is `true`)\n */\nexport type Import = {\n\tname: string;\n\talias: string | null;\n\tasType: boolean;\n};\n\n/**\n * Helper function to create an import object.\n */\nexport const createImport = ({\n\tname,\n\talias,\n\tasType,\n}: {\n\tname: string;\n\talias?: string;\n\tasType?: boolean;\n}) => {\n\treturn {\n\t\tname,\n\t\talias: alias ?? null,\n\t\tasType: asType ?? false,\n\t} satisfies Import;\n};\n\n/**\n * Converts an import object to a string. This is specifically for the variables in the import.\n * For the full import statement, use the `getImportString` function.\n */\nconst getImportVariableString = (import_: Import) => {\n\tconst alias = import_.alias ? ` as ${import_.alias}` : \"\";\n\tconst asType = import_.asType ? \"type \" : \"\";\n\treturn `${asType}${import_.name}${alias}`.trim();\n};\n\n/**\n * Takes a collection of imports and returns a string of import statements.\n */\nexport const getImportString = async (imports: ImportGroup[]) => {\n\tconst groupedImports = groupImports(imports);\n\tlet importString = \"\";\n\tfor (const { imports, path, isNamedImport } of groupedImports) {\n\t\tconst vars = isNamedImport\n\t\t\t? getImportVariableString(imports)\n\t\t\t: `{ ${imports.map(getImportVariableString).join(\", \")} }`;\n\t\timportString += `import ${vars} from \"${path}\";\\n`;\n\t}\n\treturn (await formatCode(importString)).trim();\n};\n\n/**\n * Takes a collection of imports and groups them by path.\n */\nexport const groupImports = (imports: ImportGroup[]) => {\n\tconst result: ImportGroup[] = [];\n\n\tfor (const import_ of imports) {\n\t\t// If the import is a named import, add it to the result.\n\t\tif (import_.isNamedImport) {\n\t\t\tresult.push(import_);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// If the import is a normal import, check if it already exists in the result.\n\t\tconst existingIndex = result.findIndex(\n\t\t\t(x) => x.path === import_.path && !x.isNamedImport,\n\t\t);\n\n\t\t// If the import already exists, add the imports to the existing import.\n\t\tif (existingIndex !== -1) {\n\t\t\t(result[existingIndex]!.imports as Import[]).push(...import_.imports);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// If the import is not in the result, add it.\n\t\tresult.push(import_);\n\t}\n\n\t// Sort the result by path, with named imports at the end.\n\treturn result.sort((a, b) => {\n\t\tif (a.isNamedImport && !b.isNamedImport) return 1;\n\t\tif (!a.isNamedImport && b.isNamedImport) return -1;\n\t\treturn a.path.localeCompare(b.path);\n\t});\n};\n","// This is a temporary plugin config file until we support actually using the plugin config files.\n\nimport * as z from \"zod/v4\";\nimport type { GetArgumentsOptions } from \"../generate-auth\";\nimport type { ImportGroup } from \"../utility/imports\";\nimport { createImport } from \"../utility/imports\";\n\nexport type Plugin = keyof typeof tempPluginsConfig;\n\ntype DependenciesConfig = {\n\tdependencies?: string[];\n\tdevDependencies?: string[];\n};\n\nexport type PluginConfig = {\n\tdisplayName: string;\n\tauth: {\n\t\tfunction: string;\n\t\timports: ImportGroup[];\n\t\targuments?: GetArgumentsOptions[];\n\t} & DependenciesConfig;\n\tauthClient:\n\t\t| ({\n\t\t\t\tfunction: string;\n\t\t\t\timports: ImportGroup[];\n\t\t\t\targuments?: GetArgumentsOptions[];\n\t\t } & DependenciesConfig)\n\t\t| null;\n} & DependenciesConfig;\n\nexport type PluginsConfig = {\n\t[key in Plugin]: PluginConfig;\n};\n\nexport const tempPluginsConfig = {\n\ttwoFactor: {\n\t\tdisplayName: \"Two Factor\",\n\t\tauth: {\n\t\t\tfunction: \"twoFactor\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"twoFactor\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"two-factor-issuer\",\n\t\t\t\t\tquestion: \"What is the issuer for the two factor authentication?\",\n\t\t\t\t\tdescription: \"The issuer for the two factor authentication.\",\n\t\t\t\t\tdefaultValue: \"My App\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"issuer\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"skip-verification-on-enable\",\n\t\t\t\t\tquestion: \"Skip verification on enable two factor authentication?\",\n\t\t\t\t\tdescription: \"Skip verification on enable two factor authentication.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"skipVerificationOnEnable\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"totp\",\n\t\t\t\t\tdescription: \"The number of digits for the TOTP code.\",\n\t\t\t\t\tdefaultValue: \"My App\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"totp-otp-digits\",\n\t\t\t\t\t\t\tquestion: \"What is the number of digits for the TOTP code?\",\n\t\t\t\t\t\t\tdescription: \"The number of digits for the TOTP code.\",\n\t\t\t\t\t\t\tdefaultValue: 6,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"digits\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"totp-otp-period\",\n\t\t\t\t\t\t\tquestion: \"What is the period for the TOTP code?\",\n\t\t\t\t\t\t\tdescription: \"The period for the TOTP code.\",\n\t\t\t\t\t\t\tdefaultValue: 30,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"period\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"totp\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"otp\",\n\t\t\t\t\tdescription: \"The options for the OTP code.\",\n\t\t\t\t\tdefaultValue: 3,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"otp-period\",\n\t\t\t\t\t\t\tquestion: \"What is the period for the OTP code?\",\n\t\t\t\t\t\t\tdescription: \"The period for the OTP code.\",\n\t\t\t\t\t\t\tdefaultValue: 3,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"period\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"otp-store-otp\",\n\t\t\t\t\t\t\tquestion: \"How do you want to store the OTP code?\",\n\t\t\t\t\t\t\tdescription: \"The function to store the OTP code.\",\n\t\t\t\t\t\t\tdefaultValue: \"storeOTP\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t\t\t{ value: \"plain\", label: \"Plain text\" },\n\t\t\t\t\t\t\t\t{ value: \"encrypted\", label: \"Encrypted\" },\n\t\t\t\t\t\t\t\t{ value: \"hashed\", label: \"Hashed\" },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"storeOTP\",\n\t\t\t\t\t\t\t\tschema: z.enum([\"plain\", \"encrypted\", \"hashed\"]).optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"otp\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"backup-code\",\n\t\t\t\t\tdescription: \"The options for the backup code.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"backup-code-amount\",\n\t\t\t\t\t\t\tquestion: \"What is the amount of backup codes to generate?\",\n\t\t\t\t\t\t\tdescription: \"The amount of backup codes to generate.\",\n\t\t\t\t\t\t\tdefaultValue: 10,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"amount\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"backup-code-length\",\n\t\t\t\t\t\t\tquestion: \"What is the length of the backup codes?\",\n\t\t\t\t\t\t\tdescription: \"The length of the backup codes.\",\n\t\t\t\t\t\t\tdefaultValue: 10,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"length\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"backupCodeOptions\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"two-factor-schema\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"schema\",\n\t\t\t\t\t},\n\t\t\t\t\tdescription: \"The schema for the two factor plugin.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"two-factor-table\",\n\t\t\t\t\t\t\tquestion: \"What is the name of the two factor table?\",\n\t\t\t\t\t\t\tdescription: \"The name of the two factor table.\",\n\t\t\t\t\t\t\tdefaultValue: \"twoFactor\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"twoFactorTable\",\n\t\t\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"twoFactorClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"twoFactorClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tusername: {\n\t\tdisplayName: \"Username\",\n\t\tauth: {\n\t\t\tfunction: \"username\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"username\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"username-max-username-length\",\n\t\t\t\t\tquestion: \"What is the maximum length of the username?\",\n\t\t\t\t\tdescription: \"The maximum length of the username.\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"maxUsernameLength\",\n\t\t\t\t\t\tschema: z.coerce.number().min(0).positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"username-min-username-length\",\n\t\t\t\t\tquestion: \"What is the minimum length of the username?\",\n\t\t\t\t\tdescription: \"The minimum length of the username.\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"minUsernameLength\",\n\t\t\t\t\t\tschema: z.coerce.number().min(0).positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"username-validation-order\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The order of validation for username and display username.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"username-validation-order-username\",\n\t\t\t\t\t\t\tquestion: \"When should username validation occur?\",\n\t\t\t\t\t\t\tdescription: \"The order of username validation.\",\n\t\t\t\t\t\t\tdefaultValue: \"pre-normalization\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t\t\t{ value: \"pre-normalization\", label: \"Pre-normalization\" },\n\t\t\t\t\t\t\t\t{ value: \"post-normalization\", label: \"Post-normalization\" },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"username\",\n\t\t\t\t\t\t\t\tschema: z\n\t\t\t\t\t\t\t\t\t.enum([\"pre-normalization\", \"post-normalization\"])\n\t\t\t\t\t\t\t\t\t.optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"username-validation-order-display-username\",\n\t\t\t\t\t\t\tquestion: \"When should display username validation occur?\",\n\t\t\t\t\t\t\tdescription: \"The order of display username validation.\",\n\t\t\t\t\t\t\tdefaultValue: \"pre-normalization\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t\t\t{ value: \"pre-normalization\", label: \"Pre-normalization\" },\n\t\t\t\t\t\t\t\t{ value: \"post-normalization\", label: \"Post-normalization\" },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"displayUsername\",\n\t\t\t\t\t\t\t\tschema: z\n\t\t\t\t\t\t\t\t\t.enum([\"pre-normalization\", \"post-normalization\"])\n\t\t\t\t\t\t\t\t\t.optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"validationOrder\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"usernameClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"usernameClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tmagicLink: {\n\t\tdisplayName: \"Magic Link\",\n\t\tauth: {\n\t\t\tfunction: \"magicLink\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"magicLink\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"magic-link-expires-in\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Time in seconds until the magic link expires. Default is (60 * 5) 5 minutes\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"[Magic Link] What is the expiration time for the magic link in seconds?\",\n\t\t\t\t\tdefaultValue: 300,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"expiresIn\",\n\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"magic-link-send-magic-link\",\n\t\t\t\t\tdescription: \"Send magic link implementation.\",\n\t\t\t\t\tquestion: \"[Magic Link] What is the send magic link?\",\n\t\t\t\t\tdefaultValue: `async ({ email, url, token }, request) => {\n\t // Send magic link to the user\n\t}`,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisRequired: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"sendMagicLink\",\n\t\t\t\t\t\tschema: z.coerce.string(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"magic-link-rate-limit\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Rate limit configuration. Default window is 60 seconds and max is 5 requests.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"magic-link-rate-limit-window\",\n\t\t\t\t\t\t\tdescription: \"Window in seconds. Default is 60 seconds.\",\n\t\t\t\t\t\t\tquestion: \"[Magic Link] What is the window in seconds?\",\n\t\t\t\t\t\t\tdefaultValue: 60,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisNumber: true,\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"window\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"magic-link-rate-limit-max\",\n\t\t\t\t\t\t\tdescription: \"Max requests. Default is 5 requests.\",\n\t\t\t\t\t\t\tquestion: \"[Magic Link] What is the max requests?\",\n\t\t\t\t\t\t\tdefaultValue: 5,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisNumber: true,\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"max\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"rateLimit\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"magic-link-store-token\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"This option allows you to configure how the token is stored in your database. Note: This will not affect the token that's sent, it will only affect the token stored in your database.\",\n\t\t\t\t\tquestion: \"[Magic Link] How would you like to store the token?\",\n\t\t\t\t\tdefaultValue: \"plain\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t{ value: \"plain\", label: \"Plain\" },\n\t\t\t\t\t\t{ value: \"hashed\", label: \"Hashed\" },\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"storeToken\",\n\t\t\t\t\t\tschema: z.enum([\"plain\", \"hashed\"]).optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"magicLinkClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"magicLinkClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\temailOTP: {\n\t\tdisplayName: \"Email OTP\",\n\t\tauth: {\n\t\t\tfunction: \"emailOTP\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"emailOTP\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-send-verification-otp\",\n\t\t\t\t\tdescription: \"Function to send email verification\",\n\t\t\t\t\tquestion: \"[Email OTP] What is the send verification o t p?\",\n\t\t\t\t\tdefaultValue: `async ({ email, otp, type }, request) => {\n // Send email with OTP\n}`,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisRequired: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"sendVerificationOTP\",\n\t\t\t\t\t\tschema: z.coerce.string(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-otp-length\",\n\t\t\t\t\tdescription: \"Length of the OTP\",\n\t\t\t\t\tquestion: \"[Email OTP] What is the length of the OTP?\",\n\t\t\t\t\tdefaultValue: 6,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"otpLength\",\n\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-expires-in\",\n\t\t\t\t\tdescription: \"Expiry time of the OTP in seconds default is 5 minutes\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"[Email OTP] What is the expiry time of the OTP in seconds?\",\n\t\t\t\t\tdefaultValue: 300,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"expiresIn\",\n\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-send-verification-on-sign-up\",\n\t\t\t\t\tdescription: \"Send email verification on sign-up\",\n\t\t\t\t\tquestion: \"[Email OTP] Would you like to send the OTP on sign-up?\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"sendVerificationOnSignUp\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-disable-sign-up\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"A boolean value that determines whether to prevent automatic sign-up when the user is not registered.\",\n\t\t\t\t\tquestion: \"[Email OTP] Would you like to disable sign-up?\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableSignUp\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-allowed-attempts\",\n\t\t\t\t\tdescription: \"Allowed attempts for the OTP code\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"[Email OTP] What is the allowed attempts for the OTP code?\",\n\t\t\t\t\tdefaultValue: 3,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"allowedAttempts\",\n\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-store-otp\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Store the OTP in your database in a secure way Note: This will not affect the OTP sent to the user, it will only affect the OTP stored in your database\",\n\t\t\t\t\tquestion: \"[Email OTP] How would you like to store the OTP code?\",\n\t\t\t\t\tdefaultValue: \"plain\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t{ value: \"plain\", label: \"Plain\" },\n\t\t\t\t\t\t{ value: \"encrypted\", label: \"Encrypted\" },\n\t\t\t\t\t\t{ value: \"hashed\", label: \"Hashed\" },\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"storeOTP\",\n\t\t\t\t\t\tschema: z.enum([\"plain\", \"encrypted\", \"hashed\"]).optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-override-default-email-verification\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Override the default email verification to use email otp instead\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"[Email OTP] Would you like to override the default email verification?\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"overrideDefaultEmailVerification\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"emailOTPClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"emailOTPClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tgenericOAuth: {\n\t\tdisplayName: \"Generic OAuth\",\n\t\tauth: {\n\t\t\tfunction: \"genericOAuth\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"genericOAuth\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"genericOAuthClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"genericOAuthClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tanonymous: {\n\t\tdisplayName: \"Anonymous\",\n\t\tauth: {\n\t\t\tfunction: \"anonymous\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"anonymous\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"anonymousClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"anonymousClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tphoneNumber: {\n\t\tdisplayName: \"Phone Number\",\n\t\tauth: {\n\t\t\tfunction: \"phoneNumber\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"phoneNumber\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"phoneNumberClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"phoneNumberClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tpasskey: {\n\t\tdisplayName: \"Passkey\",\n\t\tauth: {\n\t\t\tfunction: \"passkey\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins/passkey\",\n\t\t\t\t\timports: [createImport({ name: \"passkey\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"passkeyClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"passkeyClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\toidc: {\n\t\tdisplayName: \"OIDC\",\n\t\tauth: {\n\t\t\tfunction: \"oidc\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oidc\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"oidcClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oidcClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tadmin: {\n\t\tdisplayName: \"Admin\",\n\t\tauth: {\n\t\t\tfunction: \"admin\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"admin\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"admin-default-role\",\n\t\t\t\t\tquestion: \"What is the default role for new users?\",\n\t\t\t\t\tdescription: \"The default role assigned to new users.\",\n\t\t\t\t\tdefaultValue: \"user\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"defaultRole\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"admin-roles\",\n\t\t\t\t\tquestion: \"What are the admin roles?\",\n\t\t\t\t\tdescription: \"Array of roles that are considered admin roles.\",\n\t\t\t\t\tdefaultValue: [\"admin\"],\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"adminRoles\",\n\t\t\t\t\t\tschema: z.array(z.string()).optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"adminClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"adminClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tapiKey: {\n\t\tdisplayName: \"API Key\",\n\t\tauth: {\n\t\t\tfunction: \"apiKey\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"apiKey\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"api-key-headers\",\n\t\t\t\t\tquestion: \"What header name should be used for API keys?\",\n\t\t\t\t\tdescription: \"The header name to check for API key.\",\n\t\t\t\t\tdefaultValue: \"x-api-key\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"apiKeyHeaders\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"api-key-length\",\n\t\t\t\t\tquestion: \"What is the default length of API keys?\",\n\t\t\t\t\tdescription: \"The length of the API key. Longer is better.\",\n\t\t\t\t\tdefaultValue: 64,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"defaultKeyLength\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"api-key-disable-hashing\",\n\t\t\t\t\tquestion: \"Disable hashing of API keys?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Disable hashing of the API key. Not recommended for security.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableKeyHashing\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"api-key-enable-metadata\",\n\t\t\t\t\tquestion: \"Enable metadata for API keys?\",\n\t\t\t\t\tdescription: \"Whether to enable metadata for an API key.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"enableMetadata\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"api-key-enable-session\",\n\t\t\t\t\tquestion: \"Enable session for API keys?\",\n\t\t\t\t\tdescription: \"An API Key can represent a valid session.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"enableSessionForAPIKeys\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"apiKeyClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"apiKeyClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tbearer: {\n\t\tdisplayName: \"Bearer\",\n\t\tauth: {\n\t\t\tfunction: \"bearer\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"bearer\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"bearer-require-signature\",\n\t\t\t\t\tquestion: \"Require signature for bearer tokens?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"If true, only signed tokens will be converted to session cookies.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"requireSignature\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\tcaptcha: {\n\t\tdisplayName: \"CAPTCHA\",\n\t\tauth: {\n\t\t\tfunction: \"captcha\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"captcha\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"captcha-provider\",\n\t\t\t\t\tquestion: \"Which CAPTCHA provider do you want to use?\",\n\t\t\t\t\tdescription: \"The CAPTCHA provider to use.\",\n\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t{ value: \"google-recaptcha\", label: \"Google reCAPTCHA\" },\n\t\t\t\t\t\t{ value: \"cloudflare-turnstile\", label: \"Cloudflare Turnstile\" },\n\t\t\t\t\t\t{ value: \"hcaptcha\", label: \"hCaptcha\" },\n\t\t\t\t\t\t{ value: \"captchafox\", label: \"CaptchaFox\" },\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"provider\",\n\t\t\t\t\t\tschema: z.enum([\n\t\t\t\t\t\t\t\"google-recaptcha\",\n\t\t\t\t\t\t\t\"cloudflare-turnstile\",\n\t\t\t\t\t\t\t\"hcaptcha\",\n\t\t\t\t\t\t\t\"captchafox\",\n\t\t\t\t\t\t]),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"captcha-secret-key\",\n\t\t\t\t\tquestion: \"What is your CAPTCHA secret key?\",\n\t\t\t\t\tdescription: \"The secret key for the CAPTCHA provider.\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"secretKey\",\n\t\t\t\t\t\tschema: z.coerce.string(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"captcha-site-key\",\n\t\t\t\t\tquestion: \"What is your CAPTCHA site key?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The site key for the CAPTCHA provider (required for hCaptcha and CaptchaFox).\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"siteKey\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"captcha-min-score\",\n\t\t\t\t\tquestion: \"What is the minimum score for Google reCAPTCHA?\",\n\t\t\t\t\tdescription: \"The minimum score for Google reCAPTCHA v3 (0-1).\",\n\t\t\t\t\tdefaultValue: 0.5,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"minScore\",\n\t\t\t\t\t\tschema: z.coerce.number().min(0).max(1).optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\tcustomSession: {\n\t\tdisplayName: \"Custom Session\",\n\t\tauth: {\n\t\t\tfunction: \"customSession\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"customSession\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"custom-session-mutate-list-device-sessions\",\n\t\t\t\t\tquestion: \"Should the list-device-sessions endpoint be mutated?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Determine if the list-device-sessions endpoint should be mutated to the custom session data.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"shouldMutateListDeviceSessionsEndpoint\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"customSessionClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"customSessionClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tdeviceAuthorization: {\n\t\tdisplayName: \"Device Authorization\",\n\t\tauth: {\n\t\t\tfunction: \"deviceAuthorization\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"deviceAuthorization\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"device-auth-expires-in\",\n\t\t\t\t\tquestion: \"When should device codes expire?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Time until the device code expires. Use formats like '30m', '5s', '1h'.\",\n\t\t\t\t\tdefaultValue: \"30m\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"expiresIn\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"device-auth-interval\",\n\t\t\t\t\tquestion: \"What is the polling interval?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Time between polling attempts. Use formats like '30m', '5s', '1h'.\",\n\t\t\t\t\tdefaultValue: \"5s\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"interval\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"device-auth-device-code-length\",\n\t\t\t\t\tquestion: \"What is the length of the device code?\",\n\t\t\t\t\tdescription: \"Length of the device code to be generated.\",\n\t\t\t\t\tdefaultValue: 40,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"deviceCodeLength\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"device-auth-user-code-length\",\n\t\t\t\t\tquestion: \"What is the length of the user code?\",\n\t\t\t\t\tdescription: \"Length of the user code to be generated.\",\n\t\t\t\t\tdefaultValue: 8,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"userCodeLength\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"deviceAuthorizationClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"deviceAuthorizationClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\thaveIBeenPwned: {\n\t\tdisplayName: \"Have I Been Pwned\",\n\t\tauth: {\n\t\t\tfunction: \"haveIBeenPwned\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"haveIBeenPwned\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"haveibeenpwned-custom-message\",\n\t\t\t\t\tquestion: \"What is the custom message for compromised passwords?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Custom message to display when a password is compromised.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"customPasswordCompromisedMessage\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\tjwt: {\n\t\tdisplayName: \"JWT\",\n\t\tauth: {\n\t\t\tfunction: \"jwt\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"jwt\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"jwt-disable-setting-jwt-header\",\n\t\t\t\t\tquestion: \"Disable setting JWT header?\",\n\t\t\t\t\tdescription: \"If true, the JWT header will not be set in responses.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableSettingJwtHeader\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"jwtClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"jwtClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tlastLoginMethod: {\n\t\tdisplayName: \"Last Login Method\",\n\t\tauth: {\n\t\t\tfunction: \"lastLoginMethod\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"lastLoginMethod\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"last-login-method-cookie-name\",\n\t\t\t\t\tquestion: \"What is the cookie name for last login method?\",\n\t\t\t\t\tdescription: \"Name of the cookie to store the last login method.\",\n\t\t\t\t\tdefaultValue: \"better-auth.last_used_login_method\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"cookieName\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"last-login-method-max-age\",\n\t\t\t\t\tquestion: \"What is the cookie expiration time in seconds?\",\n\t\t\t\t\tdescription: \"Cookie expiration time in seconds.\",\n\t\t\t\t\tdefaultValue: 2592000,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"maxAge\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"last-login-method-store-in-database\",\n\t\t\t\t\tquestion: \"Store the last login method in the database?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Store the last login method in the database. This will create a new field in the user table.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"storeInDatabase\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"lastLoginMethodClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"lastLoginMethodClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tmcp: {\n\t\tdisplayName: \"MCP\",\n\t\tauth: {\n\t\t\tfunction: \"mcp\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"mcp\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"mcp-login-page\",\n\t\t\t\t\tquestion: \"What is the login page URL?\",\n\t\t\t\t\tdescription: \"The login page URL for MCP.\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"loginPage\",\n\t\t\t\t\t\tschema: z.coerce.string(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"mcp-resource\",\n\t\t\t\t\tquestion: \"What is the resource URL?\",\n\t\t\t\t\tdescription: \"The resource URL for MCP.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"resource\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\tmultiSession: {\n\t\tdisplayName: \"Multi Session\",\n\t\tauth: {\n\t\t\tfunction: \"multiSession\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"multiSession\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"multi-session-maximum-sessions\",\n\t\t\t\t\tquestion: \"What is the maximum number of sessions a user can have?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The maximum number of sessions a user can have at a time.\",\n\t\t\t\t\tdefaultValue: 5,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"maximumSessions\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"multiSessionClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"multiSessionClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\toauthProxy: {\n\t\tdisplayName: \"OAuth Proxy\",\n\t\tauth: {\n\t\t\tfunction: \"oAuthProxy\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oAuthProxy\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"oauth-proxy-current-url\",\n\t\t\t\t\tquestion: \"What is the current URL of the application?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The current URL of the application. The plugin will attempt to infer this from your environment.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"currentURL\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"oauth-proxy-production-url\",\n\t\t\t\t\tquestion: \"What is the production URL?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"If a request is in a production URL it won't be proxied.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"productionURL\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\toneTap: {\n\t\tdisplayName: \"One Tap\",\n\t\tauth: {\n\t\t\tfunction: \"oneTap\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oneTap\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"one-tap-disable-signup\",\n\t\t\t\t\tquestion: \"Disable the signup flow?\",\n\t\t\t\t\tdescription: \"Disable the signup flow.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableSignup\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"one-tap-client-id\",\n\t\t\t\t\tquestion: \"What is your Google Client ID?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Google Client ID. If a client ID is provided in the social provider configuration, it will be used.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"clientId\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"oneTapClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oneTapClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\toneTimeToken: {\n\t\tdisplayName: \"One Time Token\",\n\t\tauth: {\n\t\t\tfunction: \"oneTimeToken\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oneTimeToken\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"one-time-token-expires-in\",\n\t\t\t\t\tquestion: \"When should tokens expire (in minutes)?\",\n\t\t\t\t\tdescription: \"Expires in minutes.\",\n\t\t\t\t\tdefaultValue: 3,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"expiresIn\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"one-time-token-disable-client-request\",\n\t\t\t\t\tquestion: \"Disable client requests?\",\n\t\t\t\t\tdescription: \"Only allow server initiated requests.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableClientRequest\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"one-time-token-store-token\",\n\t\t\t\t\tquestion: \"How should tokens be stored?\",\n\t\t\t\t\tdescription: \"Configure how the token is stored in your database.\",\n\t\t\t\t\tdefaultValue: \"plain\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t{ value: \"plain\", label: \"Plain text\" },\n\t\t\t\t\t\t{ value: \"hashed\", label: \"Hashed\" },\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"storeToken\",\n\t\t\t\t\t\tschema: z.enum([\"plain\", \"hashed\"]).optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"oneTimeTokenClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oneTimeTokenClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\topenAPI: {\n\t\tdisplayName: \"Open API\",\n\t\tauth: {\n\t\t\tfunction: \"openAPI\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"openAPI\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"open-api-path\",\n\t\t\t\t\tquestion: \"What is the path to the OpenAPI reference page?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The path to the OpenAPI reference page. This will be appended to the base URL `/api/auth` path.\",\n\t\t\t\t\tdefaultValue: \"/reference\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"path\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"open-api-disable-default-reference\",\n\t\t\t\t\tquestion: \"Disable the default reference page?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Disable the default reference page that is generated by Scalar.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableDefaultReference\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"open-api-theme\",\n\t\t\t\t\tquestion: \"What theme should be used for the OpenAPI reference page?\",\n\t\t\t\t\tdescription: \"Theme of the OpenAPI reference page.\",\n\t\t\t\t\tdefaultValue: \"default\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t{ value: \"alternate\", label: \"Alternate\" },\n\t\t\t\t\t\t{ value: \"default\", label: \"Default\" },\n\t\t\t\t\t\t{ value: \"moon\", label: \"Moon\" },\n\t\t\t\t\t\t{ value: \"purple\", label: \"Purple\" },\n\t\t\t\t\t\t{ value: \"solarized\", label: \"Solarized\" },\n\t\t\t\t\t\t{ value: \"bluePlanet\", label: \"Blue Planet\" },\n\t\t\t\t\t\t{ value: \"saturn\", label: \"Saturn\" },\n\t\t\t\t\t\t{ value: \"kepler\", label: \"Kepler\" },\n\t\t\t\t\t\t{ value: \"mars\", label: \"Mars\" },\n\t\t\t\t\t\t{ value: \"deepSpace\", label: \"Deep Space\" },\n\t\t\t\t\t\t{ value: \"laserwave\", label: \"Laserwave\" },\n\t\t\t\t\t\t{ value: \"none\", label: \"None\" },\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"theme\",\n\t\t\t\t\t\tschema: z\n\t\t\t\t\t\t\t.enum([\n\t\t\t\t\t\t\t\t\"alternate\",\n\t\t\t\t\t\t\t\t\"default\",\n\t\t\t\t\t\t\t\t\"moon\",\n\t\t\t\t\t\t\t\t\"purple\",\n\t\t\t\t\t\t\t\t\"solarized\",\n\t\t\t\t\t\t\t\t\"bluePlanet\",\n\t\t\t\t\t\t\t\t\"saturn\",\n\t\t\t\t\t\t\t\t\"kepler\",\n\t\t\t\t\t\t\t\t\"mars\",\n\t\t\t\t\t\t\t\t\"deepSpace\",\n\t\t\t\t\t\t\t\t\"laserwave\",\n\t\t\t\t\t\t\t\t\"none\",\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\torganization: {\n\t\tdisplayName: \"Organization\",\n\t\tauth: {\n\t\t\tfunction: \"organization\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"organization\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"organization-allow-user-to-create\",\n\t\t\t\t\tquestion: \"Allow users to create organizations?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Configure whether new users are able to create new organizations.\",\n\t\t\t\t\tdefaultValue: true,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"allowUserToCreateOrganization\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"organization-creator-role\",\n\t\t\t\t\tquestion: \"What role should be assigned to the creator?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The role that is assigned to the creator of the organization.\",\n\t\t\t\t\tdefaultValue: \"owner\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"creatorRole\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"organization-membership-limit\",\n\t\t\t\t\tquestion: \"What is the maximum number of members allowed?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The maximum number of members allowed in an organization.\",\n\t\t\t\t\tdefaultValue: 100,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"membershipLimit\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"organizationClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"organizationClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tsiwe: {\n\t\tdisplayName: \"SIWE\",\n\t\tauth: {\n\t\t\tfunction: \"siwe\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"siwe\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"siwe-domain\",\n\t\t\t\t\tquestion: \"What is the domain for SIWE?\",\n\t\t\t\t\tdescription: \"The domain for SIWE.\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"domain\",\n\t\t\t\t\t\tschema: z.coerce.string(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"siwe-email-domain-name\",\n\t\t\t\t\tquestion: \"What is the email domain name?\",\n\t\t\t\t\tdescription: \"The email domain name for anonymous users.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"emailDomainName\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"siwe-anonymous\",\n\t\t\t\t\tquestion: \"Allow anonymous users?\",\n\t\t\t\t\tdescription: \"Allow anonymous users.\",\n\t\t\t\t\tdefaultValue: true,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"anonymous\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"siweClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"siweClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tscim: {\n\t\tdisplayName: \"SCIM\",\n\t\tdependencies: [\"@better-auth/scim\"],\n\t\tauth: {\n\t\t\tfunction: \"scim\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/scim\",\n\t\t\t\t\timports: [createImport({ name: \"scim\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"scimClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/scim/client\",\n\t\t\t\t\timports: [createImport({ name: \"scimClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tsso: {\n\t\tdisplayName: \"SSO\",\n\t\tdependencies: [\"@better-auth/sso\"],\n\t\tauth: {\n\t\t\tfunction: \"sso\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/sso\",\n\t\t\t\t\timports: [createImport({ name: \"sso\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-default-override-user-info\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"Do you want to override the user info with the provider info?\",\n\t\t\t\t\tdescription: \"Override the user info with the provider info.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"defaultOverrideUserInfo\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-disable-implicit-sign-up\",\n\t\t\t\t\tquestion: \"Do you want to disable implicit sign up?\",\n\t\t\t\t\tdescription: \"Disable implicit sign up.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableImplicitSignUp\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-providers-limit\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"What is the maximum number of SSO providers a user can register?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The maximum number of SSO providers a user can register.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\tdefaultValue: 10,\n\t\t\t\t\tisRequired: false,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"providersLimit\",\n\t\t\t\t\t\tschema: z.coerce.number().int().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-trust-email-verified\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"Do you want to trust the email verified flag from the provider?\",\n\t\t\t\t\tdescription: \"Trust the email verified flag from the provider.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"trustEmailVerified\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-domain-verification\",\n\t\t\t\t\tquestion: \"Do you want to setup domain verification?\",\n\t\t\t\t\tdescription: \"Setup domain verification.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"domainVerification\",\n\t\t\t\t\t\tschema: z\n\t\t\t\t\t\t\t.object({\n\t\t\t\t\t\t\t\tenabled: z.coerce.boolean().optional(),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.optional(),\n\t\t\t\t\t},\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"sso-domain-verification-enabled\",\n\t\t\t\t\t\t\tquestion: \"Do you want to enable domain verification?\",\n\t\t\t\t\t\t\tdescription: \"Enable domain verification.\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"enabled\",\n\t\t\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"ssoClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/sso/client\",\n\t\t\t\t\timports: [createImport({ name: \"ssoClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-client-domain-verification\",\n\t\t\t\t\tquestion: \"Do you want to setup domain verification?\",\n\t\t\t\t\tdescription: \"Setup domain verification.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"domainVerification\",\n\t\t\t\t\t\tschema: z\n\t\t\t\t\t\t\t.object({\n\t\t\t\t\t\t\t\tenabled: z.coerce.boolean().optional(),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.optional(),\n\t\t\t\t\t},\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"sso-client-domain-verification-enabled\",\n\t\t\t\t\t\t\tquestion: \"Do you want to enable domain verification?\",\n\t\t\t\t\t\t\tdescription: \"Enable domain verification.\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"enabled\",\n\t\t\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tstripe: {\n\t\tdisplayName: \"Stripe\",\n\t\tdependencies: [\"stripe\", \"@better-auth/stripe\"],\n\t\tauth: {\n\t\t\tfunction: \"stripe\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/stripe\",\n\t\t\t\t\timports: [createImport({ name: \"stripe\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"stripeClient\",\n\t\t\timports: [],\n\t\t\targuments: [],\n\t\t},\n\t},\n\ti18n: {\n\t\tdisplayName: \"I18n\",\n\t\tdependencies: [\"@better-auth/i18n\"],\n\t\tauth: {\n\t\t\tfunction: \"i18n\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/i18n\",\n\t\t\t\t\timports: [createImport({ name: \"i18n\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"i18nClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/i18n/client\",\n\t\t\t\t\timports: [createImport({ name: \"i18nClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n} as const satisfies Record<string, PluginConfig>;\n","import prompts from \"prompts\";\nimport type { PluginConfig } from \"../configs/temp-plugins.config\";\nimport type { GetArgumentsFn, GetArgumentsOptions } from \"../generate-auth\";\n\nexport const getFlagVariable = (flag: string) => {\n\treturn flag.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nconst collectPromptableArgs = (\n\targs: GetArgumentsOptions[] | undefined,\n\toptions: Record<string, unknown>,\n): GetArgumentsOptions[] => {\n\tif (!args) return [];\n\tconst result: GetArgumentsOptions[] = [];\n\tfor (const arg of args) {\n\t\tif (arg.isNestedObject && Array.isArray(arg.isNestedObject)) {\n\t\t\tresult.push(...collectPromptableArgs(arg.isNestedObject, options));\n\t\t} else {\n\t\t\tconst flagVar = getFlagVariable(arg.flag);\n\t\t\tconst hasFlag = options[flagVar] !== undefined && options[flagVar] !== \"\";\n\t\t\tif (arg.skip === \"always\" || arg.skip === \"prompt\") continue;\n\t\t\tif (arg.skip === \"flag\") {\n\t\t\t\tresult.push(arg);\n\t\t\t} else {\n\t\t\t\tif (!hasFlag) result.push(arg);\n\t\t\t}\n\t\t}\n\t}\n\treturn result;\n};\n\nconst toPromptQuestion = (arg: GetArgumentsOptions) => {\n\tconst name = getFlagVariable(arg.flag);\n\tconst message = arg.question ?? arg.description ?? \"\";\n\tconst base = { name, message, initial: arg.defaultValue };\n\n\tif (arg.isMultiselectOptions) {\n\t\treturn {\n\t\t\t...base,\n\t\t\ttype: \"multiselect\" as const,\n\t\t\tchoices: arg.isMultiselectOptions.map((opt) => ({\n\t\t\t\ttitle: opt.label ?? String(opt.value),\n\t\t\t\tvalue: opt.value,\n\t\t\t\tdescription: opt.hint,\n\t\t\t})),\n\t\t\tformat: (v: unknown) => (Array.isArray(v) ? v.join(\", \") : v),\n\t\t};\n\t}\n\tif (arg.isSelectOptions) {\n\t\treturn {\n\t\t\t...base,\n\t\t\ttype: \"select\" as const,\n\t\t\tchoices: arg.isSelectOptions.map((opt) => ({\n\t\t\t\ttitle: opt.label ?? String(opt.value),\n\t\t\t\tvalue: opt.value,\n\t\t\t\tdescription: opt.hint,\n\t\t\t})),\n\t\t};\n\t}\n\tif (arg.isConfirmation) {\n\t\treturn { ...base, type: \"confirm\" as const };\n\t}\n\tif (arg.isNumber) {\n\t\treturn {\n\t\t\t...base,\n\t\t\ttype: \"number\" as const,\n\t\t\tvalidate: (v: number) =>\n\t\t\t\targ.isRequired && (v == null || Number.isNaN(v))\n\t\t\t\t\t? \"This field is required\"\n\t\t\t\t\t: true,\n\t\t};\n\t}\n\treturn {\n\t\t...base,\n\t\ttype: \"text\" as const,\n\t\tvalidate: (v: string) => {\n\t\t\tif (arg.isRequired && (!v || !v.trim())) return \"This field is required\";\n\t\t\tif (arg.argument.schema) {\n\t\t\t\tconst parsed = arg.argument.schema.safeParse(\n\t\t\t\t\targ.cliTransform ? arg.cliTransform(v) : v,\n\t\t\t\t);\n\t\t\t\treturn parsed.success ? true : parsed.error.message;\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t};\n};\n\nexport const getArgumentsPrompt = async (\n\toptions: Record<string, unknown>,\n\tplugins: PluginConfig[],\n\ttarget: \"auth\" | \"authClient\",\n): Promise<GetArgumentsFn> => {\n\tconst opts = options;\n\tconst allPromptableArgs: GetArgumentsOptions[] = [];\n\tfor (const plugin of plugins) {\n\t\tif (target === \"auth\" && plugin.auth.arguments) {\n\t\t\tallPromptableArgs.push(\n\t\t\t\t...collectPromptableArgs(plugin.auth.arguments, opts),\n\t\t\t);\n\t\t} else if (\n\t\t\ttarget === \"authClient\" &&\n\t\t\tplugin.authClient &&\n\t\t\tplugin.authClient.arguments\n\t\t) {\n\t\t\tallPromptableArgs.push(\n\t\t\t\t...collectPromptableArgs(plugin.authClient.arguments, opts),\n\t\t\t);\n\t\t}\n\t}\n\n\tlet batchAnswers: Record<string, unknown> = {};\n\tif (allPromptableArgs.length > 0) {\n\t\tconst questions = allPromptableArgs.map(toPromptQuestion);\n\t\tconst res = await prompts(questions, {\n\t\t\tonCancel: () => {\n\t\t\t\tconsole.log(\"✋ Operation cancelled.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t},\n\t\t});\n\t\tbatchAnswers = (res ?? {}) as Record<string, unknown>;\n\t}\n\n\treturn (arg: GetArgumentsOptions) => {\n\t\tconst flagVar = getFlagVariable(arg.flag);\n\t\tconst hasFlag = opts[flagVar] !== undefined && opts[flagVar] !== \"\";\n\n\t\tif (arg.skip === \"always\") {\n\t\t\treturn arg.isRequired && arg.defaultValue !== undefined\n\t\t\t\t? arg.defaultValue\n\t\t\t\t: undefined;\n\t\t}\n\t\tif (arg.skip === \"prompt\") {\n\t\t\tif (hasFlag) {\n\t\t\t\tconst val = opts[flagVar];\n\t\t\t\treturn arg.cliTransform ? arg.cliTransform(val) : val;\n\t\t\t}\n\t\t\treturn arg.isRequired && arg.defaultValue !== undefined\n\t\t\t\t? arg.defaultValue\n\t\t\t\t: undefined;\n\t\t}\n\t\tif (arg.skip === \"flag\") {\n\t\t\tif (batchAnswers[flagVar] !== undefined) {\n\t\t\t\tlet val = batchAnswers[flagVar];\n\t\t\t\tif (arg.cliTransform) val = arg.cliTransform(val);\n\t\t\t\treturn val;\n\t\t\t}\n\t\t\treturn arg.isRequired && arg.defaultValue !== undefined\n\t\t\t\t? arg.defaultValue\n\t\t\t\t: undefined;\n\t\t}\n\t\tif (hasFlag) {\n\t\t\tconst val = opts[flagVar];\n\t\t\treturn arg.cliTransform ? arg.cliTransform(val) : val;\n\t\t}\n\t\tif (batchAnswers[flagVar] !== undefined) {\n\t\t\tlet val = batchAnswers[flagVar];\n\t\t\tif (arg.cliTransform) val = arg.cliTransform(val);\n\t\t\treturn val;\n\t\t}\n\t\treturn arg.isRequired && arg.defaultValue !== undefined\n\t\t\t? arg.defaultValue\n\t\t\t: undefined;\n\t};\n};\n","import type { Awaitable } from \"@better-auth/core\";\nimport type { Plugin, PluginConfig } from \"../configs/temp-plugins.config\";\nimport { tempPluginsConfig } from \"../configs/temp-plugins.config\";\nimport type { GetArgumentsFn, GetArgumentsOptions } from \"../generate-auth\";\nimport { formatCode } from \"./format\";\nimport { getArgumentsPrompt } from \"./prompt\";\n\nexport const getPluginConfigs = (plugins: Plugin[]) => {\n\treturn plugins.map((plugin) => {\n\t\tconst pluginConfig = tempPluginsConfig[plugin];\n\t\tif (!pluginConfig) {\n\t\t\tthrow new Error(`Plugin ${plugin} not found`);\n\t\t}\n\t\treturn pluginConfig;\n\t});\n};\n\n/**\n * Helper function to process nested arguments and build a nested object\n */\nconst processNestedArguments = async (\n\tnestedArguments: GetArgumentsOptions[],\n\tgetArguments: GetArgumentsFn,\n): Promise<Record<string, any>> => {\n\tconst nestedObject: Record<string, any> = {};\n\n\tfor (const nestedArg of nestedArguments) {\n\t\tlet nestedValue: any;\n\n\t\t// Check if this nested argument itself has nested objects\n\t\tif (nestedArg.isNestedObject && Array.isArray(nestedArg.isNestedObject)) {\n\t\t\t// Recursively process nested objects\n\t\t\tnestedValue = await processNestedArguments(\n\t\t\t\tnestedArg.isNestedObject,\n\t\t\t\tgetArguments,\n\t\t\t);\n\t\t} else {\n\t\t\t// Process regular nested argument\n\t\t\tlet result = await getArguments(nestedArg);\n\t\t\t// Apply cliTransform if provided\n\t\t\tif (nestedArg.cliTransform) {\n\t\t\t\tresult = nestedArg.cliTransform(result);\n\t\t\t}\n\t\t\tconst schema = nestedArg.argument.schema?.safeParse(result) ?? {\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: result,\n\t\t\t};\n\t\t\tif (!schema.success) {\n\t\t\t\tthrow new Error(`Invalid nested argument: ${schema.error.message}`);\n\t\t\t}\n\t\t\tnestedValue = schema.data;\n\t\t}\n\n\t\t// If the nested argument has a property name, merge it with existing properties\n\t\tif (nestedArg.argument.isProperty) {\n\t\t\tconst propertyName = nestedArg.argument.isProperty;\n\t\t\tif (typeof nestedValue !== \"undefined\") {\n\t\t\t\t// If property already exists and both are objects, merge them\n\t\t\t\tif (\n\t\t\t\t\tnestedObject[propertyName] &&\n\t\t\t\t\ttypeof nestedObject[propertyName] === \"object\" &&\n\t\t\t\t\ttypeof nestedValue === \"object\" &&\n\t\t\t\t\tnestedValue !== null &&\n\t\t\t\t\t!(typeof nestedValue === \"string\" && nestedValue.includes(\"=>\"))\n\t\t\t\t) {\n\t\t\t\t\tnestedObject[propertyName] = {\n\t\t\t\t\t\t...nestedObject[propertyName],\n\t\t\t\t\t\t...nestedValue,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tnestedObject[propertyName] = nestedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (typeof nestedValue !== \"undefined\") {\n\t\t\t// If no property name, this shouldn't happen in nested objects, but handle it anyway\n\t\t\tthrow new Error(`Nested argument must have isProperty set`);\n\t\t}\n\t}\n\n\treturn nestedObject;\n};\n\n/**\n * Recursively clean objects by removing undefined values and setting empty nested objects to undefined\n */\nconst cleanNestedObjects = (value: any): any => {\n\tif (typeof value === \"undefined\") {\n\t\treturn undefined;\n\t}\n\t// Don't process function strings - they should be preserved as-is\n\tif (typeof value === \"string\" && value.includes(\"=>\")) {\n\t\treturn value;\n\t}\n\tif (typeof value === \"object\" && value !== null && !Array.isArray(value)) {\n\t\tconst cleaned: Record<string, any> = {};\n\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\tconst cleanedValue = cleanNestedObjects(val);\n\t\t\tif (typeof cleanedValue !== \"undefined\") {\n\t\t\t\tcleaned[key] = cleanedValue;\n\t\t\t}\n\t\t}\n\t\t// If the object is empty after cleaning, return undefined\n\t\tif (Object.keys(cleaned).length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn cleaned;\n\t}\n\treturn value;\n};\n\n/**\n * Process a single argument (handles both nested and regular arguments)\n */\nconst processArgument = async (\n\targument: GetArgumentsOptions,\n\tgetArguments: GetArgumentsFn,\n\tfunctionName: string,\n): Promise<any> => {\n\tlet value: any;\n\n\t// Check if this argument has nested objects\n\tif (argument.isNestedObject && Array.isArray(argument.isNestedObject)) {\n\t\t// Process nested arguments recursively\n\t\tvalue = await processNestedArguments(argument.isNestedObject, getArguments);\n\t\t// Validate the nested object if there's a schema\n\t\tif (argument.argument.schema) {\n\t\t\tconst schema = argument.argument.schema.safeParse(value);\n\t\t\tif (!schema.success) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid nested object for ${functionName}: ${schema.error.message}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tvalue = schema.data;\n\t\t}\n\t} else {\n\t\t// Process regular argument\n\t\tlet result = await getArguments(argument);\n\t\t// Apply cliTransform if provided\n\t\tif (argument.cliTransform) {\n\t\t\tresult = argument.cliTransform(result);\n\t\t}\n\t\tconst schema = argument.argument.schema?.safeParse(result) ?? {\n\t\t\tsuccess: true,\n\t\t\tdata: result,\n\t\t};\n\t\tif (!schema.success) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid argument for ${functionName} on flag \"${argument.flag}\": ${schema.error.message}`,\n\t\t\t);\n\t\t}\n\t\tvalue = schema.data;\n\t}\n\n\treturn value;\n};\n\n/**\n * Build argumentsCode map from arguments array\n */\nconst buildArgumentsCode = async (\n\targumentOptions: GetArgumentsOptions[] | undefined,\n\tgetArguments: GetArgumentsFn,\n\tfunctionName: string,\n): Promise<Map<number, any>> => {\n\tconst argumentsCode: Map<number, any> = new Map();\n\tif (!argumentOptions) return argumentsCode;\n\n\tfor (const argument of argumentOptions) {\n\t\tconst value = await processArgument(argument, getArguments, functionName);\n\t\tconst index = argument.argument.index;\n\t\tif (argument.argument.isProperty) {\n\t\t\tif (argumentsCode.has(index)) {\n\t\t\t\tconst previous = argumentsCode.get(index) || {};\n\t\t\t\tif (typeof previous !== \"object\") {\n\t\t\t\t\tthrow new Error(`Argument at index ${index} is not an object`);\n\t\t\t\t}\n\t\t\t\targumentsCode.set(index, {\n\t\t\t\t\t...previous,\n\t\t\t\t\t[argument.argument.isProperty]: value,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\targumentsCode.set(index, {\n\t\t\t\t\t[argument.argument.isProperty]: value,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\targumentsCode.set(index, value);\n\t\t}\n\t}\n\n\treturn argumentsCode;\n};\n\n/**\n * Convert argumentsCode map to an array of string values\n */\nconst convertArgumentsCodeToStringArray = (\n\targumentsCode: Map<number, any>,\n): string[] => {\n\tconst hasFunctionString = (obj: any): boolean => {\n\t\tfor (const val of Object.values(obj)) {\n\t\t\tif (typeof val === \"string\" && val.includes(\"=>\")) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (typeof val === \"object\" && val !== null && !Array.isArray(val)) {\n\t\t\t\tif (hasFunctionString(val)) return true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t};\n\n\tconst buildObjectString = (obj: any): string => {\n\t\tconst entries = Object.entries(obj).map(([key, val]) => {\n\t\t\tif (typeof val === \"string\" && val.includes(\"=>\")) {\n\t\t\t\t// Output function directly, not as a string\n\t\t\t\treturn `${key}: ${val}`;\n\t\t\t}\n\t\t\tif (typeof val === \"object\" && val !== null && !Array.isArray(val)) {\n\t\t\t\treturn `${key}: ${buildObjectString(val)}`;\n\t\t\t}\n\t\t\treturn `${key}: ${JSON.stringify(val)}`;\n\t\t});\n\t\treturn `{${entries.join(\", \")}}`;\n\t};\n\n\treturn Array.from(argumentsCode.values()).map((value) => {\n\t\tconst cleaned = cleanNestedObjects(value);\n\t\tif (typeof cleaned === \"undefined\") return \"undefined\";\n\t\t// Handle function strings - they should be output as actual functions, not strings\n\t\tif (typeof cleaned === \"string\" && cleaned.includes(\"=>\")) {\n\t\t\t// Check if it's a function string (contains arrow function syntax)\n\t\t\t// Output it directly as a function, not as a string\n\t\t\treturn cleaned;\n\t\t}\n\t\t// For objects, check if any property contains a function string (recursively)\n\t\tif (\n\t\t\ttypeof cleaned === \"object\" &&\n\t\t\tcleaned !== null &&\n\t\t\t!Array.isArray(cleaned)\n\t\t) {\n\t\t\tif (hasFunctionString(cleaned)) {\n\t\t\t\t// Build object with functions output directly (recursively)\n\t\t\t\treturn buildObjectString(cleaned);\n\t\t\t}\n\t\t}\n\t\treturn JSON.stringify(cleaned);\n\t});\n};\n\n/**\n * Remove trailing undefined values from args array\n */\nconst removeTrailingUndefined = (args: string[]): void => {\n\tfor (let i = args.length - 1; i >= 0; i--) {\n\t\tif (args[i] !== \"undefined\") break;\n\t\targs.pop();\n\t}\n};\n\nexport const getAuthPluginsCode = async ({\n\tplugins,\n\toptions = {},\n\tinstallDependency,\n}: {\n\tplugins?: PluginConfig[];\n\toptions?: Record<string, unknown>;\n\tinstallDependency: (\n\t\tdependencies: string | string[],\n\t\ttype?: \"dev\" | \"prod\",\n\t) => Awaitable<unknown>;\n}) => {\n\tif (!plugins || plugins.length === 0) return;\n\n\tconst getArguments = await getArgumentsPrompt(options, plugins, \"auth\");\n\n\tconst pluginsCode: string[] = [];\n\tfor (const plugin of plugins) {\n\t\tconst argumentsCode = await buildArgumentsCode(\n\t\t\tplugin.auth.arguments,\n\t\t\tgetArguments,\n\t\t\tplugin.auth.function,\n\t\t);\n\t\tconst args = convertArgumentsCodeToStringArray(argumentsCode);\n\t\tremoveTrailingUndefined(args);\n\t\tpluginsCode.push(`${plugin.auth.function}(${args.join(\", \")})`);\n\n\t\t// dependencies\n\t\tconst dependencies = new Set<string>([\n\t\t\t...(plugin.dependencies || []),\n\t\t\t...(plugin.auth.dependencies || []),\n\t\t]);\n\t\tconst devDependencies = new Set<string>([\n\t\t\t...(plugin.devDependencies || []),\n\t\t\t...(plugin.auth.devDependencies || []),\n\t\t]);\n\t\tif (dependencies.size > 0) {\n\t\t\tawait installDependency([...dependencies]);\n\t\t}\n\t\tif (devDependencies.size > 0) {\n\t\t\tawait installDependency([...devDependencies], \"dev\");\n\t\t}\n\t}\n\treturn (await formatCode(`[${pluginsCode.join(\", \")}]`)).trim().slice(0, -1);\n};\n\nexport const getAuthClientPluginsCode = async ({\n\tplugins,\n\toptions = {},\n\tinstallDependency,\n}: {\n\tplugins?: PluginConfig[];\n\toptions?: Record<string, unknown>;\n\tinstallDependency: (\n\t\tdependencies: string | string[],\n\t\ttype?: \"dev\" | \"prod\",\n\t) => Awaitable<unknown>;\n}) => {\n\tif (!plugins || plugins.length === 0) return;\n\tconst pluginsWithClient = plugins.filter(\n\t\t(plugin) => plugin.authClient !== null,\n\t);\n\tif (pluginsWithClient.length === 0) return;\n\n\tconst getArguments = await getArgumentsPrompt(options, plugins, \"authClient\");\n\n\tconst pluginsCode: string[] = [];\n\tfor (const plugin of pluginsWithClient) {\n\t\tif (!plugin.authClient) continue;\n\t\tconst argumentsCode = await buildArgumentsCode(\n\t\t\tplugin.authClient.arguments,\n\t\t\tgetArguments,\n\t\t\tplugin.authClient.function,\n\t\t);\n\t\tconst args = convertArgumentsCodeToStringArray(argumentsCode);\n\t\tremoveTrailingUndefined(args);\n\t\tpluginsCode.push(`${plugin.authClient.function}(${args.join(\", \")})`);\n\n\t\t// dependencies\n\t\tconst dependencies = new Set<string>([\n\t\t\t...(plugin.dependencies || []),\n\t\t\t...(plugin.authClient.dependencies || []),\n\t\t]);\n\t\tconst devDependencies = new Set<string>([\n\t\t\t...(plugin.devDependencies || []),\n\t\t\t...(plugin.authClient.devDependencies || []),\n\t\t]);\n\t\tif (dependencies.size > 0) {\n\t\t\tawait installDependency([...dependencies]);\n\t\t}\n\t\tif (devDependencies.size > 0) {\n\t\t\tawait installDependency([...devDependencies], \"dev\");\n\t\t}\n\t}\n\treturn (await formatCode(`[${pluginsCode.join(\", \")}]`)).trim().slice(0, -1);\n};\n","import type { Awaitable } from \"@better-auth/core\";\nimport type { DatabasesConfig } from \"../configs/databases.config\";\nimport { SOCIAL_PROVIDER_CONFIGS } from \"../configs/social-providers.config\";\nimport type { PluginConfig } from \"../configs/temp-plugins.config\";\nimport { getAuthPluginsCode } from \"./plugin\";\n\ntype GenerateAuthConfigStringOptions = {\n\tdatabase?: DatabasesConfig | null;\n\tplugins?: PluginConfig[];\n\tappName?: string;\n\tbaseURL?: string;\n\temailAndPassword?: boolean;\n\tsocialProviders?: string[];\n\toptions?: Record<string, unknown>;\n\tinstallDependency: (\n\t\tdependencies: string | string[],\n\t\ttype?: \"dev\" | \"prod\",\n\t) => Awaitable<unknown>;\n};\n\nexport const generateInnerAuthConfigCode = async ({\n\tdatabase,\n\tplugins,\n\tappName,\n\tbaseURL,\n\temailAndPassword,\n\tsocialProviders,\n\toptions,\n\tinstallDependency,\n}: GenerateAuthConfigStringOptions) => {\n\tconst code: Record<string, string | undefined> = {\n\t\tdatabase: getDatabaseCode(database),\n\t\tappName: getAppNameCode(appName),\n\t\tbaseURL: getBaseURLCode(baseURL),\n\t\temailAndPassword: getEmailAndPasswordCode(emailAndPassword),\n\t\tsocialProviders: getSocialProvidersCode(socialProviders),\n\t\tplugins: await getAuthPluginsCode({ plugins, options, installDependency }),\n\t};\n\n\tlet stringCode = \"\";\n\tfor (const key in code) {\n\t\tif (!code[key]) continue;\n\t\tstringCode += `${key}: ${code[key]},\\n`;\n\t}\n\treturn stringCode;\n};\n\nconst getEmailAndPasswordCode = (enabled?: boolean) => {\n\tif (!enabled) return undefined;\n\treturn `{ enabled: true }`;\n};\n\nconst getSocialProvidersCode = (providers?: string[]) => {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst providersConfig = providers\n\t\t.map((provider) => {\n\t\t\tconst config =\n\t\t\t\tSOCIAL_PROVIDER_CONFIGS[\n\t\t\t\t\tprovider as keyof typeof SOCIAL_PROVIDER_CONFIGS\n\t\t\t\t];\n\t\t\tif (!config) {\n\t\t\t\t// Fallback for unknown providers\n\t\t\t\tconst providerUpper = provider.toUpperCase();\n\t\t\t\treturn `\t\t${provider}: {\n\t\t\tclientId: process.env.${providerUpper}_CLIENT_ID!,\n\t\t\tclientSecret: process.env.${providerUpper}_CLIENT_SECRET!,\n\t\t}`;\n\t\t\t}\n\n\t\t\t// Generate config based on provider-specific options\n\t\t\tconst options = config.options\n\t\t\t\t.map((opt) => {\n\t\t\t\t\treturn `\t\t\t${opt.name}: process.env.${opt.envVar}!,`;\n\t\t\t\t})\n\t\t\t\t.join(\"\\n\");\n\n\t\t\treturn `\t\t${provider}: {\\n${options}\\n\t\t}`;\n\t\t})\n\t\t.join(\",\\n\");\n\treturn `{\\n${providersConfig}\\n\t}`;\n};\n\nconst getAppNameCode = (appName?: string) => {\n\tif (!appName) return;\n\tif (typeof appName !== \"string\") {\n\t\tthrow new Error(\"appName must be a string\");\n\t}\n\treturn JSON.stringify(appName);\n};\n\nconst getBaseURLCode = (baseURL?: string) => {\n\tif (!baseURL) return;\n\tif (typeof baseURL !== \"string\") {\n\t\tthrow new Error(\"baseURL must be a string\");\n\t}\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(baseURL);\n\t} catch {\n\t\tthrow new Error(\"baseURL must be a valid URL\");\n\t}\n\n\treturn JSON.stringify(url.toString());\n};\n\nconst getDatabaseCode = (database?: DatabasesConfig | null) => {\n\tif (!database) return undefined;\n\treturn database.code({});\n};\n","import type { ImportGroup } from \"../utility\";\nimport { createImport } from \"../utility/imports\";\n\nexport type DatabaseAdapter =\n\t// prisma\n\t| \"prisma-sqlite\"\n\t| \"prisma-mysql\"\n\t| \"prisma-postgresql\"\n\t// drizzle\n\t| \"drizzle-sqlite-better-sqlite3\"\n\t| \"drizzle-sqlite-bun\"\n\t| \"drizzle-sqlite-node\"\n\t| \"drizzle-mysql\"\n\t| \"drizzle-postgresql\"\n\t// kysely\n\t| \"sqlite-better-sqlite3\"\n\t| \"sqlite-bun\"\n\t| \"sqlite-node\"\n\t| \"mysql\"\n\t| \"postgresql\"\n\t| \"mssql\"\n\t// mongodb\n\t| \"mongodb\";\n\nexport type DatabasesConfig = {\n\tadapter: DatabaseAdapter;\n\timports: ImportGroup[];\n\t/**\n\t * this is code that is placed before the auth config code.\n\t */\n\tpreCode?: string;\n\tcode: (attributes: { additionalOptions?: Record<string, any> }) => string;\n\tdependencies: string[];\n\tdevDependencies?: string[] | undefined;\n};\n\nconst prismaCode = ({\n\tprovider,\n\tadditionalOptions,\n}: {\n\tprovider: \"sqlite\" | \"mysql\" | \"postgresql\";\n\tadditionalOptions?: Record<string, any>;\n}) => {\n\treturn `prismaAdapter(client, { provider: \"${provider}\", ${\n\t\tadditionalOptions\n\t\t\t? Object.entries(additionalOptions)\n\t\t\t\t\t.map(([key, value]) => `${key}: ${value}`)\n\t\t\t\t\t.join(\", \")\n\t\t\t: \"\"\n\t} })`;\n};\n\nconst drizzleCode = ({\n\tprovider,\n\tadditionalOptions,\n}: {\n\tprovider: \"sqlite\" | \"mysql\" | \"pg\";\n\tadditionalOptions?: Record<string, any>;\n}) => {\n\treturn `drizzleAdapter(db, { provider: \"${provider}\", schema, ${\n\t\tadditionalOptions\n\t\t\t? Object.entries(additionalOptions)\n\t\t\t\t\t.map(([key, value]) => `${key}: ${value}`)\n\t\t\t\t\t.join(\", \")\n\t\t\t: \"\"\n\t} })`;\n};\n\nconst kyselyCode = ({\n\tprovider,\n\tadditionalOptions,\n}: {\n\tprovider: \"sqlite\" | \"mysql\" | \"postgresql\" | \"mssql\";\n\tadditionalOptions?: Record<string, any>;\n}) => {\n\treturn `{dialect, type: \"${provider}\", ${\n\t\tadditionalOptions\n\t\t\t? Object.entries(additionalOptions)\n\t\t\t\t\t.map(([key, value]) => `${key}: ${value}`)\n\t\t\t\t\t.join(\", \")\n\t\t\t: \"\"\n\t} }`;\n};\n\nconst mongodbCode = ({\n\tadditionalOptions,\n}: {\n\tadditionalOptions?: Record<string, any>;\n}) => {\n\tlet optsString = \"\";\n\tif (additionalOptions) {\n\t\toptsString = \", {\";\n\t\toptsString += Object.entries(additionalOptions)\n\t\t\t.map(([key, value]) => `${key}: ${value}`)\n\t\t\t.join(\", \");\n\t\toptsString += \"}\";\n\t}\n\treturn `mongodbAdapter(db${optsString})`;\n};\n\nexport const databasesConfig = [\n\t// Prisma\n\t{\n\t\tadapter: \"prisma-sqlite\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/prisma\",\n\t\t\t\timports: [createImport({ name: \"prismaAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"@prisma/client\",\n\t\t\t\timports: [createImport({ name: \"PrismaClient\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: \"const client = new PrismaClient();\",\n\t\tcode: ({ additionalOptions }) => {\n\t\t\treturn prismaCode({ provider: \"sqlite\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"@prisma/client\"],\n\t\tdevDependencies: [\"prisma\"],\n\t},\n\t{\n\t\tadapter: \"prisma-mysql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/prisma\",\n\t\t\t\timports: [createImport({ name: \"prismaAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"@prisma/client\",\n\t\t\t\timports: [createImport({ name: \"PrismaClient\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: \"const client = new PrismaClient();\",\n\t\tcode: ({ additionalOptions }) => {\n\t\t\treturn prismaCode({ provider: \"mysql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"@prisma/client\"],\n\t\tdevDependencies: [\"prisma\"],\n\t},\n\t{\n\t\tadapter: \"prisma-postgresql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/prisma\",\n\t\t\t\timports: [createImport({ name: \"prismaAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"@prisma/client\",\n\t\t\t\timports: [createImport({ name: \"PrismaClient\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: \"const client = new PrismaClient();\",\n\t\tcode: ({ additionalOptions }) => {\n\t\t\treturn prismaCode({ provider: \"postgresql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"@prisma/client\"],\n\t\tdevDependencies: [\"prisma\"],\n\t},\n\t// Drizzle\n\t{\n\t\tadapter: \"drizzle-sqlite-better-sqlite3\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/drizzle\",\n\t\t\t\timports: [createImport({ name: \"drizzleAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"drizzle-orm/better-sqlite3\",\n\t\t\t\timports: [createImport({ name: \"drizzle\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"better-sqlite3\",\n\t\t\t\timports: createImport({ name: \"Database\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"./auth-schema\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"schema\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const db = drizzle(new Database(\"database.sqlite\"), { schema });`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn drizzleCode({ provider: \"sqlite\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"drizzle-orm\", \"better-sqlite3\"],\n\t\tdevDependencies: [\"@types/better-sqlite3\"],\n\t},\n\t{\n\t\tadapter: \"drizzle-sqlite-bun\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/drizzle\",\n\t\t\t\timports: [createImport({ name: \"drizzleAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"drizzle-orm/bun-sqlite\",\n\t\t\t\timports: [createImport({ name: \"drizzle\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"bun:sqlite\",\n\t\t\t\timports: [createImport({ name: \"Database\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"./auth-schema\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"schema\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const db = drizzle({ client: new Database('sqlite.db'), schema });`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn drizzleCode({ provider: \"sqlite\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"drizzle-orm\", \"bun\"],\n\t\tdevDependencies: [\"@types/bun\"],\n\t},\n\t{\n\t\tadapter: \"drizzle-postgresql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/drizzle\",\n\t\t\t\timports: [createImport({ name: \"drizzleAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"drizzle-orm/node-postgres\",\n\t\t\t\timports: [createImport({ name: \"drizzle\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"pg\",\n\t\t\t\timports: [createImport({ name: \"Pool\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"./auth-schema\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"schema\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const db = drizzle(new Pool({ connectionString: process.env.DATABASE_URL }), { schema });`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn drizzleCode({ provider: \"pg\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"drizzle-orm\", \"pg\"],\n\t\tdevDependencies: [\"@types/pg\"],\n\t},\n\t{\n\t\tadapter: \"drizzle-mysql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/drizzle\",\n\t\t\t\timports: [createImport({ name: \"drizzleAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"drizzle-orm/mysql2\",\n\t\t\t\timports: [createImport({ name: \"drizzle\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"mysql2/promise\",\n\t\t\t\timports: [createImport({ name: \"createPool\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"./auth-schema\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"schema\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const db = drizzle(createPool(process.env.DATABASE_URL!), { schema, mode: \"default\" });`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn drizzleCode({ provider: \"mysql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"drizzle-orm\", \"mysql2\"],\n\t},\n\t// Kysely\n\t{\n\t\tadapter: \"sqlite-better-sqlite3\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-sqlite3\",\n\t\t\t\timports: createImport({ name: \"Database\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const database = new Database(\"auth.db\")`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn `database`;\n\t\t},\n\t\tdependencies: [\"better-sqlite3\"],\n\t\tdevDependencies: [\"@types/better-sqlite3\"],\n\t},\n\t{\n\t\tadapter: \"sqlite-bun\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"bun:sqlite\",\n\t\t\t\timports: [createImport({ name: \"Database\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const database = new Database(\"auth.db\")`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn `database`;\n\t\t},\n\t\tdependencies: [],\n\t},\n\t{\n\t\tadapter: \"sqlite-node\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"node:sqlite\",\n\t\t\t\timports: [createImport({ name: \"DatabaseSync\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const database = new DatabaseSync(\"auth.db\")`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn `database`;\n\t\t},\n\t\tdependencies: [],\n\t},\n\t{\n\t\tadapter: \"mysql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"mysql2/promise\",\n\t\t\t\timports: [createImport({ name: \"createPool\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const dialect = createPool({ host: \"localhost\", user: \"root\", password: \"password\", database: \"database\", timezone: \"Z\" })`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn kyselyCode({ provider: \"mysql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"mysql2\"],\n\t},\n\t{\n\t\tadapter: \"postgresql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"pg\",\n\t\t\t\timports: [createImport({ name: \"Pool\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const dialect = new Pool({ connectionString: \"postgresql://postgres:password@localhost:5432/database\" })`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn kyselyCode({ provider: \"postgresql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"pg\"],\n\t\tdevDependencies: [\"@types/pg\"],\n\t},\n\t{\n\t\tadapter: \"mssql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"kysely\",\n\t\t\t\timports: [createImport({ name: \"MssqlDialect\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"tedious\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"Tedious\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"tarn\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"Tarn\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const dialect = new MssqlDialect({\n tarn: {\n ...Tarn,\n options: {\n min: 0,\n max: 10,\n },\n },\n tedious: {\n ...Tedious,\n connectionFactory: () => new Tedious.Connection({\n authentication: {\n options: {\n password: 'password',\n userName: 'username',\n },\n type: 'default',\n },\n options: {\n database: 'some_db',\n port: 1433,\n trustServerCertificate: true,\n },\n server: 'localhost',\n }),\n\t\t\t\t\t\tTYPES: {\n\t\t\t\t\t\t\t\t...Tedious.TYPES,\n\t\t\t\t\t\t\t\tDateTime: Tedious.TYPES.DateTime2,\n\t\t\t\t\t\t\t},\n },\n })`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn kyselyCode({ provider: \"mssql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"kysely\", \"tedious\", \"tarn\"],\n\t},\n\t// MongoDB\n\t{\n\t\tadapter: \"mongodb\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/mongodb\",\n\t\t\t\timports: [createImport({ name: \"mongodbAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"mongodb\",\n\t\t\t\timports: [createImport({ name: \"MongoClient\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const client = new MongoClient(process.env.DATABASE_URL!);\\nconst db = client.db();`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn mongodbCode({ additionalOptions });\n\t\t},\n\t\tdependencies: [\"mongodb\"],\n\t},\n] satisfies DatabasesConfig[];\n","import type {\n\tDatabaseAdapter,\n\tDatabasesConfig,\n} from \"../configs/databases.config\";\nimport { databasesConfig } from \"../configs/databases.config\";\n\nexport const getDatabaseCode = <A extends DatabaseAdapter | null>(\n\tadapter: A,\n): A extends DatabaseAdapter ? DatabasesConfig : null => {\n\tif (!adapter) return null as any;\n\tconst database = databasesConfig.find(\n\t\t(database) => database.adapter === adapter,\n\t)!;\n\n\treturn database as any;\n};\n\n/**\n * Extract ORM name from adapter string\n * Examples:\n * - \"prisma-sqlite\" -> \"prisma\"\n * - \"drizzle-postgresql\" -> \"drizzle\"\n * - \"drizzle-sqlite-better-sqlite3\" -> \"drizzle\"\n * - \"sqlite-better-sqlite3\" -> \"kysely\"\n * - \"sqlite-bun\" -> \"kysely\"\n * - \"mongodb\" -> \"mongodb\"\n */\nexport const getORMFromAdapter = (adapter: DatabaseAdapter): string => {\n\tif (adapter.includes(\"-\")) {\n\t\tconst parts = adapter.split(\"-\");\n\t\t// Handle kysely adapters like \"sqlite-better-sqlite3\" or \"sqlite-bun\"\n\t\tif (parts[0] === \"sqlite\" && parts.length > 1) {\n\t\t\treturn \"kysely\";\n\t\t}\n\t\t// For other adapters, return the first part (ORM name)\n\t\treturn parts[0]!;\n\t}\n\t// Kysely adapters (mysql, postgresql, mssql) are grouped as \"kysely\"\n\tif ([\"mysql\", \"postgresql\", \"mssql\"].includes(adapter)) {\n\t\treturn \"kysely\";\n\t}\n\t// mongodb is its own ORM\n\treturn adapter;\n};\n\n/**\n * Check if an adapter is a kysely dialect\n */\nexport const isKyselyDialect = (adapter: string): boolean => {\n\treturn (\n\t\tadapter.startsWith(\"sqlite-\") ||\n\t\t[\"mysql\", \"postgresql\", \"mssql\"].includes(adapter)\n\t);\n};\n\n/**\n * Check if an adapter should be returned directly without dialect selection\n * (Kysely dialects and MongoDB don't have sub-dialects)\n */\nexport const isDirectAdapter = (adapter: string): boolean => {\n\treturn isKyselyDialect(adapter) || adapter === \"mongodb\";\n};\n\n/**\n * Format adapter name for display\n */\nconst formatAdapterLabel = (adapter: DatabaseAdapter): string => {\n\t// Handle kysely sqlite variants\n\tif (adapter === \"sqlite-better-sqlite3\") {\n\t\treturn \"SQLite (better-sqlite3)\";\n\t}\n\tif (adapter === \"sqlite-bun\") {\n\t\treturn \"SQLite (bun)\";\n\t}\n\tif (adapter === \"sqlite-node\") {\n\t\treturn \"SQLite (node:sqlite)\";\n\t}\n\t// Handle drizzle sqlite variants\n\tif (adapter === \"drizzle-sqlite-better-sqlite3\") {\n\t\treturn \"SQLite (better-sqlite3)\";\n\t}\n\tif (adapter === \"drizzle-sqlite-bun\") {\n\t\treturn \"SQLite (bun)\";\n\t}\n\tif (adapter === \"drizzle-sqlite-node\") {\n\t\treturn \"SQLite (node:sqlite)\";\n\t}\n\t// Default: capitalize first letter\n\treturn adapter.charAt(0).toUpperCase() + adapter.slice(1);\n};\n\n/**\n * Get all unique ORMs from the database config\n * SQLite variants are grouped under a single \"SQLite\" option\n */\nexport const getAvailableORMs = (): Array<{\n\tvalue: string;\n\tlabel: string;\n\tadapter?: DatabaseAdapter;\n}> => {\n\tconst options: Array<{\n\t\tvalue: string;\n\t\tlabel: string;\n\t\tadapter?: DatabaseAdapter;\n\t}> = [];\n\tconst seenORMs = new Set<string>();\n\n\tfor (const db of databasesConfig) {\n\t\tconst dbORM = getORMFromAdapter(db.adapter);\n\n\t\t// Group all SQLite variants under a single \"SQLite\" option\n\t\tif (db.adapter.startsWith(\"sqlite-\")) {\n\t\t\tif (!seenORMs.has(\"sqlite\")) {\n\t\t\t\tseenORMs.add(\"sqlite\");\n\t\t\t\toptions.push({\n\t\t\t\t\tvalue: \"sqlite\",\n\t\t\t\t\tlabel: \"SQLite\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else if (dbORM === \"kysely\" || dbORM === \"mongodb\") {\n\t\t\t// For non-SQLite kysely dialects and mongodb, add them directly\n\t\t\toptions.push({\n\t\t\t\tvalue: db.adapter,\n\t\t\t\tlabel: formatAdapterLabel(db.adapter),\n\t\t\t\tadapter: db.adapter,\n\t\t\t});\n\t\t} else if (!seenORMs.has(dbORM)) {\n\t\t\t// For other ORMs, add them once\n\t\t\tseenORMs.add(dbORM);\n\t\t\toptions.push({\n\t\t\t\tvalue: dbORM,\n\t\t\t\tlabel: dbORM.charAt(0).toUpperCase() + dbORM.slice(1),\n\t\t\t});\n\t\t}\n\t}\n\n\t// Custom sort order: SQLite, PostgreSQL, MySQL, Drizzle, Prisma, MongoDB, MSSQL\n\tconst sortOrder = [\n\t\t\"sqlite\",\n\t\t\"postgresql\",\n\t\t\"mysql\",\n\t\t\"drizzle\",\n\t\t\"prisma\",\n\t\t\"mongodb\",\n\t\t\"mssql\",\n\t];\n\n\treturn options.sort((a, b) => {\n\t\tconst aIndex = sortOrder.indexOf(a.value);\n\t\tconst bIndex = sortOrder.indexOf(b.value);\n\t\tif (aIndex !== -1 && bIndex !== -1) {\n\t\t\treturn aIndex - bIndex;\n\t\t}\n\t\tif (aIndex !== -1) return -1;\n\t\tif (bIndex !== -1) return 1;\n\t\treturn a.value.localeCompare(b.value);\n\t});\n};\n\n/**\n * Get available dialects for a specific ORM\n */\nexport const getDialectsForORM = (\n\torm: string,\n): Array<{ value: string; label: string; adapter: DatabaseAdapter }> => {\n\tconst dialects: Array<{\n\t\tvalue: string;\n\t\tlabel: string;\n\t\tadapter: DatabaseAdapter;\n\t}> = [];\n\n\tfor (const db of databasesConfig) {\n\t\tconst dbORM = getORMFromAdapter(db.adapter);\n\t\tif (dbORM === orm) {\n\t\t\tlet label: string;\n\n\t\t\tif (db.adapter.includes(\"-\")) {\n\t\t\t\tconst parts = db.adapter.split(\"-\");\n\t\t\t\t// Handle drizzle sqlite variants: \"drizzle-sqlite-better-sqlite3\" -> \"SQLite (better-sqlite3)\"\n\t\t\t\tif (orm === \"drizzle\" && parts[1] === \"sqlite\") {\n\t\t\t\t\tlabel = formatAdapterLabel(db.adapter);\n\t\t\t\t} else {\n\t\t\t\t\t// Standard case: \"drizzle-mysql\" -> \"MySQL\", \"drizzle-postgresql\" -> \"PostgreSQL\"\n\t\t\t\t\tconst dialectName = parts.slice(1).join(\"-\");\n\t\t\t\t\tlabel = dialectName.charAt(0).toUpperCase() + dialectName.slice(1);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// For mongodb, the adapter itself is the dialect\n\t\t\t\tlabel = formatAdapterLabel(db.adapter);\n\t\t\t}\n\t\t\tdialects.push({\n\t\t\t\tvalue: db.adapter,\n\t\t\t\tlabel,\n\t\t\t\tadapter: db.adapter,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn dialects.sort((a, b) => a.value.localeCompare(b.value));\n};\n","import type { Awaitable } from \"@better-auth/core\";\nimport type { ZodSchema } from \"zod\";\nimport type { DatabaseAdapter } from \"./configs/databases.config\";\nimport type { Framework } from \"./configs/frameworks.config\";\nimport type { Plugin } from \"./configs/temp-plugins.config\";\nimport {\n\tformatCode,\n\tgenerateInnerAuthConfigCode,\n\tgetDatabaseCode,\n} from \"./utility\";\nimport type { ImportGroup } from \"./utility/imports\";\nimport { createImport, getImportString } from \"./utility/imports\";\nimport { getPluginConfigs } from \"./utility/plugin\";\n\nexport type BaseGetArgumentsOptions = {\n\t/**\n\t * Unique flag identifier for the question.\n\t * Allows for CLIs to override the question based on provided CLI flags.\n\t */\n\tflag: string;\n\t/**\n\t * Description of this argument. Used to display documentation in the CLI --help flag.\n\t */\n\tdescription: string;\n\t/**\n\t * The question to ask the user.\n\t */\n\tquestion?: string;\n\t/**\n\t * The options for the multiselect question.\n\t */\n\tisMultiselectOptions?: {\n\t\tvalue: any;\n\t\tlabel?: string;\n\t\thint?: string;\n\t}[];\n\t/**\n\t * The options for the select question.\n\t */\n\tisSelectOptions?: {\n\t\tvalue: any;\n\t\tlabel?: string;\n\t\thint?: string;\n\t}[];\n\t/**\n\t * Whether the argument is a confirmation question.\n\t */\n\tisConfirmation?: boolean;\n\t/**\n\t * Whether the argument is a number question.\n\t */\n\tisNumber?: boolean;\n\t/**\n\t * Whether the argument is required.\n\t * If not provided, the argument is optional.\n\t */\n\tisRequired?: boolean;\n\t/**\n\t * Whether the argument is a nested object, thus meaning this specific argument\n\t * cannot be prompted for, but rather the arguments for the nested object should be prompted for.\n\t */\n\tisNestedObject?: false | BaseGetArgumentsOptions[] | undefined;\n\t/**\n\t * When to skip prompting or flag checking:\n\t * - \"always\": Always skip prompt, use default (never prompt, never check flags)\n\t * - \"prompt\": Skip the prompt but still listen for CLI flags (use flag if present, else default)\n\t * - \"flag\": Keep the prompt but skip checking CLI flags (always prompt, ignore flags)\n\t */\n\tskip?: \"always\" | \"prompt\" | \"flag\";\n\t/**\n\t * Default value for the argument of no value is provided.\n\t */\n\tdefaultValue?: any;\n\t/**\n\t * Transform function to apply to the CLI input before schema validation.\n\t * Useful for converting string input (e.g., comma-separated) into arrays.\n\t */\n\tcliTransform?: (value: any) => any;\n\t/**\n\t * Argument details\n\t */\n\targument: {\n\t\t/**\n\t\t * The index of the argument in the function.\n\t\t */\n\t\tindex: number;\n\t\t/**\n\t\t * If it's a property, this means that this index is an object and the property name is this string value.\n\t\t * Else if `false`, it means this index is an entire value represented by this argument value.\n\t\t */\n\t\tisProperty: false | string;\n\t\t/**\n\t\t * Zod schema for validation and transformation of the argument value.\n\t\t */\n\t\tschema?: ZodSchema;\n\t};\n};\nexport type GetArgumentsOptions = BaseGetArgumentsOptions;\n\nexport type GetArgumentsFn = (\n\toptions: GetArgumentsOptions,\n) => any | Promise<any>;\n\nexport type GenerateAuthFileOptions = {\n\tplugins: Plugin[];\n\tdatabase: DatabaseAdapter | null;\n\tframework: Framework;\n\tappName?: string;\n\tbaseURL?: string;\n\temailAndPassword?: boolean;\n\tsocialProviders?: string[];\n\tinstallDependency: (\n\t\tdependencies: string | string[],\n\t\ttype?: \"dev\" | \"prod\",\n\t) => Awaitable<unknown>;\n\t/** CLI options (used for batch prompting) */\n\toptions?: Record<string, unknown>;\n};\n\nexport const generateAuthConfigCode = async ({\n\tplugins: pluginsConfig,\n\tdatabase: databaseConfig,\n\tappName,\n\tbaseURL,\n\temailAndPassword,\n\tsocialProviders,\n\tinstallDependency,\n\toptions,\n}: GenerateAuthFileOptions) => {\n\tconst database = getDatabaseCode(databaseConfig);\n\tconst plugins = getPluginConfigs(pluginsConfig);\n\n\tconst imports: ImportGroup[] = [\n\t\t{\n\t\t\timports: [createImport({ name: \"betterAuth\" })],\n\t\t\tpath: \"better-auth\",\n\t\t\tisNamedImport: false,\n\t\t},\n\t\t...Object.values(plugins)\n\t\t\t.map(({ auth }) => auth.imports)\n\t\t\t.flat(),\n\t\t...(database?.imports ?? []),\n\t];\n\n\tconst authConfigCode = await generateInnerAuthConfigCode({\n\t\tplugins,\n\t\tdatabase,\n\t\tappName,\n\t\tbaseURL,\n\t\temailAndPassword,\n\t\tsocialProviders,\n\t\toptions,\n\t\tinstallDependency,\n\t});\n\n\tconst segmentedCode = {\n\t\timports: await getImportString(imports),\n\t\texports: \"\",\n\t\tpreAuthConfig: database?.preCode ?? \"\",\n\t\tauthConfig: authConfigCode,\n\t\tpostAuthConfig: \"\",\n\t};\n\n\t// Database dependencies are now installed in the Configure Database step\n\n\tconst code: string[] = [\n\t\tsegmentedCode.imports,\n\t\t``,\n\t\tsegmentedCode.preAuthConfig,\n\t\t``,\n\t\t`export const auth = betterAuth({`,\n\t\tsegmentedCode.authConfig,\n\t\t`});`,\n\t\t``,\n\t\tsegmentedCode.postAuthConfig,\n\t\t``,\n\t\tsegmentedCode.exports,\n\t];\n\treturn await formatCode(code.join(\"\\n\"));\n};\n","import type { Awaitable } from \"@better-auth/core\";\nimport type { DatabasesConfig } from \"../configs/databases.config\";\nimport type { PluginConfig } from \"../configs/temp-plugins.config\";\nimport { getAuthClientPluginsCode } from \"./plugin\";\n\ntype GenerateAuthClientConfigStringOptions = {\n\tdatabase?: DatabasesConfig | null;\n\tplugins?: PluginConfig[];\n\tappName?: string;\n\tbaseURL?: string;\n\toptions?: Record<string, unknown>;\n\tinstallDependency: (\n\t\tdependencies: string | string[],\n\t\ttype?: \"dev\" | \"prod\",\n\t) => Awaitable<unknown>;\n};\n\nexport const generateInnerAuthClientConfigCode = async ({\n\tplugins,\n\toptions,\n\tinstallDependency,\n}: GenerateAuthClientConfigStringOptions) => {\n\tconst code: Record<string, string | undefined> = {\n\t\tplugins: await getAuthClientPluginsCode({\n\t\t\tplugins,\n\t\t\toptions,\n\t\t\tinstallDependency,\n\t\t}),\n\t};\n\n\tlet stringCode = \"\";\n\tfor (const key in code) {\n\t\tif (!code[key]) continue;\n\t\tstringCode += `${key}: ${code[key]},\\n`;\n\t}\n\treturn stringCode;\n};\n","import type { GenerateAuthFileOptions } from \"./generate-auth\";\nimport { formatCode } from \"./utility\";\nimport { generateInnerAuthClientConfigCode } from \"./utility/auth-client-config\";\nimport type { ImportGroup } from \"./utility/imports\";\nimport { createImport, getImportString } from \"./utility/imports\";\nimport { getPluginConfigs } from \"./utility/plugin\";\n\nexport const generateAuthClientConfigCode = async ({\n\tplugins: pluginsConfig,\n\tdatabase: databaseConfig,\n\tframework,\n\toptions,\n\tinstallDependency,\n}: GenerateAuthFileOptions) => {\n\tconst plugins = getPluginConfigs(pluginsConfig);\n\n\tconst imports: ImportGroup[] = [\n\t\t...(!framework.authClient\n\t\t\t? ([\n\t\t\t\t\t{\n\t\t\t\t\t\timports: [createImport({ name: \"createAuthClient\" })],\n\t\t\t\t\t\tpath: \"better-auth/client\",\n\t\t\t\t\t\tisNamedImport: false,\n\t\t\t\t\t},\n\t\t\t\t] satisfies ImportGroup[])\n\t\t\t: ([\n\t\t\t\t\t{\n\t\t\t\t\t\timports: [createImport({ name: \"createAuthClient\" })],\n\t\t\t\t\t\tpath: framework.authClient.importPath as string,\n\t\t\t\t\t\tisNamedImport: false,\n\t\t\t\t\t},\n\t\t\t\t] satisfies ImportGroup[])),\n\t\t...Object.values(plugins)\n\t\t\t.map(({ authClient }) => (!authClient ? [] : authClient.imports))\n\t\t\t.flat(),\n\t];\n\n\tconst authClientCode = await generateInnerAuthClientConfigCode({\n\t\tplugins,\n\t\toptions,\n\t\tinstallDependency,\n\t});\n\n\tconst segmentedCode = {\n\t\timports: await getImportString(imports),\n\t\texports: \"\",\n\t\tpreAuthConfig: \"\",\n\t\tauthConfig: authClientCode ? `{${authClientCode}}` : \"\",\n\t\tpostAuthConfig: \"\",\n\t};\n\n\tconst code: string[] = [\n\t\tsegmentedCode.imports,\n\t\t``,\n\t\tsegmentedCode.preAuthConfig,\n\t\t``,\n\t\t`export const authClient = createAuthClient(`,\n\t\tsegmentedCode.authConfig,\n\t\t`);`,\n\t\t``,\n\t\tsegmentedCode.postAuthConfig,\n\t\t``,\n\t\tsegmentedCode.exports,\n\t];\n\treturn await formatCode(code.join(\"\\n\"));\n};\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const getEnvFiles = async (cwd: string): Promise<string[]> => {\n\tconst envFiles = await fs.readdir(cwd, \"utf-8\");\n\treturn envFiles\n\t\t.filter((file) => file.startsWith(\".env\") && file !== \".env.example\")\n\t\t.map((file) => path.join(cwd, file));\n};\n\nexport const parseEnvFiles = async (envFiles: string[]) => {\n\tconst result = new Map<string, string[]>();\n\tfor (const file of envFiles) {\n\t\tconst content = await fs.readFile(file, \"utf-8\");\n\t\tconst existingVars = content\n\t\t\t.split(\"\\n\")\n\t\t\t.filter((line) => line.trim())\n\t\t\t.map((x) => x.split(\"=\")[0])\n\t\t\t.filter((x) => x && x.trim())\n\t\t\t.filter((x) => !x?.includes(\" \"))\n\t\t\t.filter((x) => !x?.startsWith(\"#\")) as string[];\n\t\tresult.set(file, existingVars);\n\t}\n\n\treturn result;\n};\n\nexport const updateEnvFiles = async (\n\tenvFiles: string[],\n\tenvs: string[],\n): Promise<void> => {\n\tfor (const file of envFiles) {\n\t\tconst content = await fs.readFile(file, \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tlines.push(...envs);\n\t\tawait fs.writeFile(file, lines.join(\"\\n\"), \"utf-8\");\n\t}\n};\n\n/**\n * Gets the missing env variables in the env files\n *\n * @param envFiles - The list of env files to check\n * @param envVar - The env variable to check\n * @returns The list of env files that are missing the env variable\n */\nexport const getMissingEnvVars = async (\n\tenvFiles: Map<string, string[]>,\n\tenvVar: string | string[],\n): Promise<{ file: string; var: string[] }[]> => {\n\tconst missingVarInFiles: { file: string; var: string[] }[] = [];\n\tfor (const [file, existingVars] of envFiles) {\n\t\tif (Array.isArray(envVar)) {\n\t\t\tconst missingVars = envVar.filter((v) => !existingVars.includes(v));\n\t\t\tif (missingVars.length > 0) {\n\t\t\t\tmissingVarInFiles.push({\n\t\t\t\t\tfile,\n\t\t\t\t\tvar: missingVars,\n\t\t\t\t});\n\t\t\t}\n\t\t} else if (typeof envVar === \"string\" && !existingVars.includes(envVar)) {\n\t\t\tmissingVarInFiles.push({ file, var: [envVar] });\n\t\t}\n\t}\n\treturn missingVarInFiles;\n};\n\nexport const createEnvFile = async (\n\tcwd: string,\n\tenvVariables: string[],\n): Promise<void> => {\n\tconst envFile = path.join(cwd, \".env\");\n\tawait fs.writeFile(envFile, envVariables.join(\"\\n\"), \"utf-8\");\n};\n","import { readdirSync } from \"node:fs\";\nimport type { Awaitable } from \"@better-auth/core\";\nimport type { PackageJson } from \"type-fest\";\nimport { hasDependency } from \"../../../utils/get-package-info\";\nimport type { Framework } from \"../configs/frameworks.config\";\nimport { FRAMEWORKS } from \"../configs/frameworks.config\";\n\nexport async function detectFramework(cwd: string, packageJson: PackageJson) {\n\tfor (const strategy of [packageJsonStrategy, fileStrategy]) {\n\t\tconst result = await strategy({ cwd, packageJson });\n\t\tif (result !== null) {\n\t\t\treturn result;\n\t\t}\n\t}\n\treturn null;\n}\n\ntype Strategy = (ctx: {\n\tcwd: string;\n\tpackageJson: PackageJson;\n}) => Awaitable<Framework | null>;\n\nconst packageJsonStrategy: Strategy = ({ packageJson }) => {\n\tfor (const framework of FRAMEWORKS) {\n\t\tif (hasDependency(packageJson, framework.dependency)) {\n\t\t\treturn framework;\n\t\t}\n\t}\n\treturn null;\n};\n\nconst fileStrategy: Strategy = ({ cwd }) => {\n\tconst cwdFiles = readdirSync(cwd);\n\n\tfor (const framework of FRAMEWORKS) {\n\t\tif (!framework.configPaths?.length) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const configPath of framework.configPaths) {\n\t\t\tif (cwdFiles.includes(configPath)) {\n\t\t\t\treturn framework;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n};\n","import { exec } from \"node:child_process\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport open from \"open\";\nimport prompts from \"prompts\";\nimport yoctoSpinner from \"yocto-spinner\";\nimport z from \"zod\";\nimport { cliVersion } from \"../..\";\nimport { generateDrizzleSchema } from \"../../generators/drizzle\";\nimport { generatePrismaSchema } from \"../../generators/prisma\";\nimport {\n\tdetectPackageManager,\n\tgetPkgManagerStr,\n\tPACKAGE_MANAGER,\n} from \"../../utils/check-package-managers\";\nimport {\n\tpossibleAuthConfigPaths,\n\tpossibleClientConfigPaths,\n} from \"../../utils/config-paths\";\nimport { getPackageInfo, hasDependency } from \"../../utils/get-package-info\";\nimport { generateSecretHash, tryCatch } from \"../../utils/helper\";\nimport { installDependencies } from \"../../utils/install-dependencies\";\nimport type { DatabaseAdapter } from \"./configs/databases.config\";\nimport type { Framework } from \"./configs/frameworks.config\";\nimport { FRAMEWORKS } from \"./configs/frameworks.config\";\nimport {\n\tSOCIAL_PROVIDER_CONFIGS,\n\tSOCIAL_PROVIDERS,\n} from \"./configs/social-providers.config\";\nimport type { Plugin, PluginsConfig } from \"./configs/temp-plugins.config\";\nimport { tempPluginsConfig } from \"./configs/temp-plugins.config\";\nimport type { GetArgumentsOptions } from \"./generate-auth\";\nimport { generateAuthConfigCode } from \"./generate-auth\";\nimport { generateAuthClientConfigCode } from \"./generate-auth-client\";\nimport {\n\tgetAvailableORMs,\n\tgetDatabaseCode,\n\tgetDialectsForORM,\n\tisDirectAdapter,\n\tisKyselyDialect,\n} from \"./utility/database\";\nimport {\n\tcreateEnvFile,\n\tgetEnvFiles,\n\tgetMissingEnvVars,\n\tparseEnvFiles,\n\tupdateEnvFiles,\n} from \"./utility/env\";\nimport { detectFramework } from \"./utility/framework\";\nimport { getFlagVariable } from \"./utility/prompt\";\n\n// Helper functions to replace @clack/prompts\nconst confirm = async (options: { message: string; initial?: boolean }) => {\n\tconst response = await prompts({\n\t\ttype: \"confirm\",\n\t\tname: \"value\",\n\t\tmessage: options.message,\n\t\tinitial: options.initial ?? true,\n\t});\n\treturn response?.value ?? null;\n};\n\nconst select = async (options: {\n\tmessage: string;\n\toptions: Array<{ value: string; label: string }>;\n\tinitialValue?: string;\n}) => {\n\tconst response = await prompts({\n\t\ttype: \"select\",\n\t\tname: \"value\",\n\t\tmessage: options.message,\n\t\tchoices: options.options.map((opt) => ({\n\t\t\ttitle: opt.label,\n\t\t\tvalue: opt.value,\n\t\t})),\n\t\tinitial: options.initialValue\n\t\t\t? options.options.findIndex((opt) => opt.value === options.initialValue)\n\t\t\t: undefined,\n\t});\n\treturn response?.value ?? null;\n};\n\nconst multiselect = async (options: {\n\tmessage: string;\n\toptions: Array<{ value: string; label: string }>;\n}) => {\n\tconst response = await prompts({\n\t\ttype: \"multiselect\",\n\t\tname: \"value\",\n\t\tmessage: options.message,\n\t\tchoices: options.options.map((opt) => ({\n\t\t\ttitle: opt.label,\n\t\t\tvalue: opt.value,\n\t\t})),\n\t\tinstructions: false,\n\t});\n\treturn response?.value ?? null;\n};\n\nconst isCancel = (value: any): boolean => {\n\treturn value === null || value === undefined;\n};\n\nconst cancel = (message: string) => {\n\tconsole.log(message);\n\tprocess.exit(0);\n};\n\nconst log = {\n\tinfo: (message: string) => console.log(message),\n\tsuccess: (message: string) => console.log(chalk.green(message)),\n\terror: (message: string) => console.error(chalk.red(message)),\n};\n\n/**\n * Extract database provider from database adapter string\n */\nconst getDatabaseProvider = (\n\tdatabase: string,\n): \"sqlite\" | \"mysql\" | \"postgresql\" | \"pg\" | null => {\n\tif (database.startsWith(\"drizzle-\")) {\n\t\tif (database.includes(\"postgresql\")) {\n\t\t\treturn \"pg\";\n\t\t}\n\t\tif (database.includes(\"mysql\")) {\n\t\t\treturn \"mysql\";\n\t\t}\n\t\tif (database.includes(\"sqlite\")) {\n\t\t\treturn \"sqlite\";\n\t\t}\n\t}\n\tif (database.startsWith(\"prisma-\")) {\n\t\tif (database.includes(\"postgresql\")) {\n\t\t\treturn \"postgresql\";\n\t\t}\n\t\tif (database.includes(\"mysql\")) {\n\t\t\treturn \"mysql\";\n\t\t}\n\t\tif (database.includes(\"sqlite\")) {\n\t\t\treturn \"sqlite\";\n\t\t}\n\t}\n\treturn null;\n};\n\n/**\n * Create a minimal BetterAuthOptions config for schema generation\n */\nconst createMinimalConfig = (plugins: Plugin[], baseURL: string): any => {\n\t// Convert plugin keys to actual plugin instances if needed\n\t// For now, plugins array is empty, so we'll create a minimal config\n\tconst pluginInstances = plugins\n\t\t.map((pluginKey) => {\n\t\t\tconst pluginConfig = tempPluginsConfig[pluginKey];\n\t\t\tif (!pluginConfig) return null;\n\t\t\t// We need to import the actual plugin, but for schema generation\n\t\t\t// we only need the schema property from the plugin\n\t\t\t// Since plugins are currently skipped (return []), this will be empty\n\t\t\treturn null;\n\t\t})\n\t\t.filter(Boolean);\n\n\treturn {\n\t\tsecret: \"temp-secret-for-schema-generation\",\n\t\tbaseURL,\n\t\tplugins: pluginInstances,\n\t};\n};\n\n/**\n * Create a mock adapter object for schema generation\n */\nconst createMockAdapter = (\n\tdatabase: string,\n\tprovider: \"sqlite\" | \"mysql\" | \"postgresql\" | \"pg\",\n): any => {\n\tconst isDrizzle = database.startsWith(\"drizzle-\");\n\tconst isPrisma = database.startsWith(\"prisma-\");\n\n\treturn {\n\t\tid: isDrizzle ? \"drizzle\" : isPrisma ? \"prisma\" : \"unknown\",\n\t\toptions: {\n\t\t\tprovider: provider === \"pg\" ? \"pg\" : provider,\n\t\t},\n\t};\n};\n\n/**\n * Generate the correct import path for the auth file in route handlers\n */\nconst generateAuthImportPath = async (\n\tcwd: string,\n\tauthFilePath: string,\n\trouteHandlerPath: string,\n\tframework?: Framework,\n): Promise<string> => {\n\t// Resolve both paths relative to cwd\n\tconst absoluteAuthPath = path.resolve(cwd, authFilePath);\n\tconst resolvedRouteHandlerPath = path.resolve(cwd, routeHandlerPath);\n\tconst routeHandlerDir = path.dirname(resolvedRouteHandlerPath);\n\n\t// Special handling for SvelteKit's $lib alias\n\tif (framework?.id === \"sveltekit\") {\n\t\tconst relativeAuthPath = path.relative(cwd, absoluteAuthPath);\n\t\tconst normalizedPath = relativeAuthPath.replace(/\\\\/g, \"/\");\n\n\t\t// Check if auth file is in src/lib\n\t\tif (normalizedPath.startsWith(\"src/lib/\") || normalizedPath === \"src/lib\") {\n\t\t\tconst pathAfterLib = normalizedPath.slice(\"src/lib/\".length);\n\t\t\tconst pathWithoutExt = pathAfterLib.replace(/\\.(ts|js|tsx|jsx)$/, \"\");\n\t\t\treturn pathWithoutExt ? `$lib/${pathWithoutExt}` : \"$lib/auth\";\n\t\t}\n\t}\n\n\t// Special handling for Hono - use relative imports\n\tif (framework?.id === \"hono\") {\n\t\tlet relativePath = path.relative(routeHandlerDir, absoluteAuthPath);\n\t\trelativePath = relativePath.replace(/\\.(ts|js|tsx|jsx)$/, \"\");\n\t\tif (!relativePath.startsWith(\".\")) {\n\t\t\trelativePath = `./${relativePath}`;\n\t\t}\n\t\treturn relativePath.replace(/\\\\/g, \"/\");\n\t}\n\n\t// Read tsconfig.json to check for path aliases\n\tconst tsconfigPath = path.join(cwd, \"tsconfig.json\");\n\tconst { data: tsconfigContent } = await tryCatch(\n\t\tfs.readFile(tsconfigPath, \"utf-8\"),\n\t);\n\n\tlet aliasPrefix: string | null = null;\n\tlet aliasBasePath: string | null = null;\n\n\tif (tsconfigContent) {\n\t\ttry {\n\t\t\t// Remove comments from JSON (simple approach)\n\t\t\tconst cleanedContent = tsconfigContent.replace(\n\t\t\t\t/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/.*/g,\n\t\t\t\t\"\",\n\t\t\t);\n\t\t\tconst tsconfig = JSON.parse(cleanedContent);\n\t\t\tconst compilerOptions = tsconfig?.compilerOptions;\n\t\t\tconst paths = compilerOptions?.paths;\n\t\t\tconst baseUrl = compilerOptions?.baseUrl;\n\n\t\t\tif (paths) {\n\t\t\t\t// Look for common aliases like @/*, ~/* etc\n\t\t\t\tfor (const [alias, targets] of Object.entries(paths)) {\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof alias === \"string\" &&\n\t\t\t\t\t\talias.endsWith(\"/*\") &&\n\t\t\t\t\t\tArray.isArray(targets) &&\n\t\t\t\t\t\ttargets.length > 0\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst target = targets[0] as string;\n\t\t\t\t\t\tif (target.endsWith(\"/*\")) {\n\t\t\t\t\t\t\taliasPrefix = alias.slice(0, -2); // Remove /*\n\t\t\t\t\t\t\tlet basePath = target.slice(0, -2); // Remove /*\n\n\t\t\t\t\t\t\t// If baseUrl is set, resolve the base path relative to it\n\t\t\t\t\t\t\tif (baseUrl && baseUrl !== \".\") {\n\t\t\t\t\t\t\t\tbasePath = path.join(baseUrl, basePath);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\taliasBasePath = basePath;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (_e) {\n\t\t\t// Ignore tsconfig parsing errors\n\t\t}\n\t}\n\n\t// Get relative path from cwd to auth file\n\tconst relativeAuthPath = path.relative(cwd, absoluteAuthPath);\n\n\t// If we have an alias, try to use it\n\tif (aliasPrefix && aliasBasePath !== null) {\n\t\t// Normalize the base path (handle . and ./ and empty string)\n\t\tconst normalizedBasePath = path.normalize(aliasBasePath);\n\n\t\tconsole.log(chalk.dim(` normalizedBasePath: ${normalizedBasePath}`));\n\n\t\t// If base path is \".\" or empty, it means the alias points to the project root\n\t\tif (\n\t\t\tnormalizedBasePath === \".\" ||\n\t\t\tnormalizedBasePath === \"\" ||\n\t\t\tnormalizedBasePath === \"./\"\n\t\t) {\n\t\t\t// The auth file is relative to cwd, so we can use the alias directly\n\t\t\tconst pathWithoutExt = relativeAuthPath.replace(/\\.(ts|js|tsx|jsx)$/, \"\");\n\t\t\tconst result = `${aliasPrefix}/${pathWithoutExt}`.replace(/\\\\/g, \"/\");\n\t\t\tconsole.log(chalk.dim(` Using alias, returning: ${result}`));\n\t\t\treturn result;\n\t\t}\n\n\t\t// For other base paths like \"src\" or \"app\", check if auth file is within that path\n\t\t// Ensure we're comparing normalized paths\n\t\tconst normalizedRelativePath = relativeAuthPath.replace(/\\\\/g, \"/\");\n\t\tconst normalizedBasePathForward = normalizedBasePath.replace(/\\\\/g, \"/\");\n\n\t\tif (\n\t\t\tnormalizedRelativePath === normalizedBasePathForward ||\n\t\t\tnormalizedRelativePath.startsWith(normalizedBasePathForward + \"/\")\n\t\t) {\n\t\t\t// Remove the base path and use the alias\n\t\t\tlet pathAfterBase: string;\n\t\t\tif (normalizedRelativePath === normalizedBasePathForward) {\n\t\t\t\tpathAfterBase = \"\";\n\t\t\t} else {\n\t\t\t\tpathAfterBase = normalizedRelativePath.slice(\n\t\t\t\t\tnormalizedBasePathForward.length + 1,\n\t\t\t\t);\n\t\t\t}\n\t\t\t// Remove file extension\n\t\t\tconst pathWithoutExt = pathAfterBase.replace(/\\.(ts|js|tsx|jsx)$/, \"\");\n\t\t\treturn pathWithoutExt ? `${aliasPrefix}/${pathWithoutExt}` : aliasPrefix;\n\t\t}\n\t}\n\n\tlet relativePath = path.relative(routeHandlerDir, absoluteAuthPath);\n\n\t// Remove file extension\n\trelativePath = relativePath.replace(/\\.(ts|js|tsx|jsx)$/, \"\");\n\n\t// Ensure it starts with ./ or ../\n\tif (!relativePath.startsWith(\".\")) {\n\t\trelativePath = `./${relativePath}`;\n\t}\n\n\t// Convert Windows paths to Unix paths\n\treturn relativePath.replace(/\\\\/g, \"/\");\n};\n\nexport async function initAction(opts: any) {\n\tconst options = initActionOptionsSchema.parse(opts);\n\tconst cwd = options.cwd;\n\n\t// Check if package.json exists (not an empty project)\n\tlet packageJson: Record<string, any> | null = null;\n\ttry {\n\t\tpackageJson = await getPackageInfo(cwd);\n\t} catch {\n\t\t//\n\t}\n\tif (typeof packageJson !== \"object\" || packageJson === null) {\n\t\tconst pm = options.packageManager || \"npm\";\n\t\tconst initCommand =\n\t\t\tpm === \"bun\" ? \"bun init\" : pm === \"yarn\" ? \"yarn init\" : `${pm} init`;\n\t\tconsole.error(\n\t\t\tchalk.red(\n\t\t\t\t`\\nThis appears to be an empty project. No package.json found.\\n`,\n\t\t\t),\n\t\t);\n\t\tconsole.error(\n\t\t\tchalk.yellow(\n\t\t\t\t`Please initialize a new project first by running:\\n\\n ${chalk.bold(initCommand)}\\n`,\n\t\t\t),\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tlet currentStep = 0;\n\n\tconst nextStep = async (text: string) => {\n\t\tcurrentStep++;\n\t\tconsole.log(chalk.white(`\\n${currentStep}. ${text}`));\n\t};\n\n\tconst additionalSteps: (() => Promise<unknown>)[] = [];\n\n\t// Render hero\n\t//${chalk.italic(chalk.dim(cliVersion.padStart(41, \" \")))}\n\tconsole.log(\n\t\t// boxen(\n\t\t\"\\n\" +\n\t\t\t[\n\t\t\t\t` ██ ████`,\n\t\t\t\t` ████ ██ ${chalk.bold(`Better Auth CLI`)} ${chalk.dim(`(${cliVersion})`)}`,\n\t\t\t\t` ██ ████ ${chalk.gray(\"Welcome to the Better Auth CLI! Let's get you set up.\")}`,\n\t\t\t]\n\t\t\t\t// .map((x) => x.padStart(10))\n\t\t\t\t.join(\"\\n\"),\n\t\t// \t{\n\t\t// \t\tpadding: 1,\n\t\t// \t\tborderStyle: \"doubleSingle\",\n\t\t// \t\tdimBorder: true,\n\t\t// \t},\n\t\t// ),\n\t);\n\n\t// Get package manager information\n\tconst { pm, pmString: _pmString } = await (async () => {\n\t\tif (options.packageManager) {\n\t\t\tconst [pm, version] = [options.packageManager, null];\n\t\t\tconst pmString = getPkgManagerStr({ packageManager: pm, version });\n\t\t\treturn { pm, pmString };\n\t\t}\n\n\t\tconst { packageManager, version } = await detectPackageManager(\n\t\t\tcwd,\n\t\t\tpackageJson,\n\t\t);\n\t\tconst pmString = getPkgManagerStr({ packageManager, version });\n\t\treturn { pm: packageManager, pmString };\n\t})();\n\n\tconst depsToInstall = new Map<\n\t\tstring,\n\t\tPartial<Record<\"prod\" | \"dev\" | \"peer\" | \"optional\", boolean>>\n\t>();\n\tconst filesToWrite: (() => Promise<unknown>)[] = [];\n\n\t// Install Better Auth\n\tawait (async () => {\n\t\tconst hasBetterAuth = await hasDependency(packageJson, \"better-auth\");\n\t\tif (hasBetterAuth) return;\n\t\tawait nextStep(\"Install Better Auth\");\n\n\t\tconst shouldInstallBetterAuth = await confirm({\n\t\t\tmessage: `Would you like to install better-auth using ${chalk.bold(pm)}?`,\n\t\t\tinitial: true,\n\t\t});\n\t\tif (isCancel(shouldInstallBetterAuth)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tif (shouldInstallBetterAuth) {\n\t\t\tdepsToInstall.set(\"better-auth\", {\n\t\t\t\tprod: true,\n\t\t\t});\n\t\t}\n\t})();\n\n\tlet envFiles = new Map<string, string[]>();\n\n\t// Handle ENV files\n\tawait (async () => {\n\t\tenvFiles = await parseEnvFiles(await getEnvFiles(cwd));\n\n\t\t// If no existing ENV files, ask to allow creation of a new one.\n\t\tif (envFiles.size === 0) {\n\t\t\tawait nextStep(\"Set Environment Variables\");\n\n\t\t\tconst shouldCreateEnv = await confirm({\n\t\t\t\tmessage: `Would you like to set environment variables?`,\n\t\t\t});\n\t\t\tif (isCancel(shouldCreateEnv)) {\n\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t\tif (shouldCreateEnv) {\n\t\t\t\tconst { providedSecret } = await prompts({\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\tname: \"providedSecret\",\n\t\t\t\t\tmessage: `Better Auth secret (used for encryption, hashing, and signing). ${chalk.dim(\"(Press Enter to auto generate)\")}`,\n\t\t\t\t});\n\t\t\t\tif (isCancel(providedSecret)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\t\t\t\tconst { providedURL } = await prompts({\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\tname: \"providedURL\",\n\t\t\t\t\tmessage: `Better Auth Base URL (your auth server URL):`,\n\t\t\t\t\tinitial: \"http://localhost:3000\",\n\t\t\t\t});\n\t\t\t\tif (isCancel(providedURL)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tconst secret = providedSecret || generateSecretHash();\n\t\t\t\tconst envs = [\n\t\t\t\t\t`BETTER_AUTH_SECRET=\"${secret}\"`,\n\t\t\t\t\t`BETTER_AUTH_URL=\"${providedURL}\"`,\n\t\t\t\t];\n\t\t\t\tenvFiles.set(\".env\", envs);\n\t\t\t\tfilesToWrite.push(() => createEnvFile(cwd, envs));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Check for missing ENV variables (basic ones only - social providers handled later)\n\t\tconst missingEnvVars = await getMissingEnvVars(envFiles, [\n\t\t\t\"BETTER_AUTH_SECRET\",\n\t\t\t\"BETTER_AUTH_URL\",\n\t\t]);\n\n\t\tif (!missingEnvVars.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait nextStep(\"Set Environment Variables\");\n\n\t\t// If only one file is missing env variables, just show confirmation prompt\n\t\tif (missingEnvVars.length === 1) {\n\t\t\tconst { file, var: missingVars } = missingEnvVars[0]!;\n\t\t\tconst confirmed = await confirm({\n\t\t\t\tmessage: `Add required environment variables to ${chalk.bold(file.split(\"/\").pop())}? (${missingVars.map((v) => chalk.cyan(v)).join(\", \")})`,\n\t\t\t});\n\t\t\tif (isCancel(confirmed)) {\n\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t\tif (confirmed) {\n\t\t\t\tconst envs: string[] = [];\n\n\t\t\t\tfor (const v of missingVars) {\n\t\t\t\t\tif (v === \"BETTER_AUTH_SECRET\") {\n\t\t\t\t\t\tconst { providedSecret } = await prompts({\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tname: \"providedSecret\",\n\t\t\t\t\t\t\tmessage: `Better Auth secret (used for encryption, hashing, and signing). ${chalk.dim(\"(Press Enter to auto generate)\")}`,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (isCancel(providedSecret)) {\n\t\t\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\t\t\tprocess.exit(0);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenvs.push(\n\t\t\t\t\t\t\t`BETTER_AUTH_SECRET=\"${providedSecret || generateSecretHash()}\"`,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (v === \"BETTER_AUTH_URL\") {\n\t\t\t\t\t\tconst { providedURL } = await prompts({\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tname: \"providedURL\",\n\t\t\t\t\t\t\tmessage: `Better Auth base URL (your auth server URL):`,\n\t\t\t\t\t\t\tinitial: \"http://localhost:3000\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (isCancel(providedURL)) {\n\t\t\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\t\t\tprocess.exit(0);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenvs.push(`BETTER_AUTH_URL=\"${providedURL}\"`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tenvFiles.set(file, envs);\n\t\t\t\tfilesToWrite.push(() => updateEnvFiles([file], envs));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// If multiple files are missing env variables, ask to select the files to update.\n\t\tconst filesToUpdate = await multiselect({\n\t\t\tmessage: `Add required environment variables to the following files?`,\n\t\t\toptions: missingEnvVars.map((x) => ({\n\t\t\t\tvalue: x.file,\n\t\t\t\tlabel: `${chalk.bold(x.file)}: ${x.var.map((v) => chalk.cyan(v)).join(\", \")}`,\n\t\t\t})),\n\t\t});\n\n\t\tif (isCancel(filesToUpdate)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (filesToUpdate) {\n\t\t\tconst secretHash = generateSecretHash();\n\t\t\tfor (const file of filesToUpdate) {\n\t\t\t\tconst envs = missingEnvVars\n\t\t\t\t\t.find((x) => x.file === file)!\n\t\t\t\t\t.var.map((v) => {\n\t\t\t\t\t\tif (v === \"BETTER_AUTH_SECRET\") {\n\t\t\t\t\t\t\treturn `BETTER_AUTH_SECRET=\"${secretHash}\"`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (v === \"BETTER_AUTH_URL\") {\n\t\t\t\t\t\t\treturn 'BETTER_AUTH_URL=\"http://localhost:3000\"';\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn `${v}=${v}`;\n\t\t\t\t\t});\n\t\t\t\tfilesToWrite.push(() => updateEnvFiles([file], envs));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t})();\n\n\t// Auto-detect framework silently\n\tconst detectedFramework = await detectFramework(cwd, packageJson);\n\tlet framework: Framework =\n\t\tdetectedFramework || FRAMEWORKS.find((f) => f.id === \"next\")!;\n\tconst frameworkWasDetected = !!detectedFramework;\n\n\t// For Next.js, detect if using App Router or Pages Router\n\tif (framework.id === \"next\" && framework.routeHandler) {\n\t\tconst { data: rootFiles } = await tryCatch(fs.readdir(cwd, \"utf-8\"));\n\t\tconst hasAppDir = rootFiles?.some((file) => file === \"app\");\n\t\tconst hasPagesDir = rootFiles?.some((file) => file === \"pages\");\n\t\tconst hasSrcDir = rootFiles?.some((file) => file === \"src\");\n\n\t\tlet routeHandlerPath = \"app/api/auth/[...all]/route.ts\";\n\n\t\t// Check for src/app or src/pages\n\t\tif (hasSrcDir) {\n\t\t\tconst { data: srcFiles } = await tryCatch(\n\t\t\t\tfs.readdir(path.join(cwd, \"src\"), \"utf-8\"),\n\t\t\t);\n\t\t\tconst hasSrcApp = srcFiles?.some((file) => file === \"app\");\n\t\t\tconst hasSrcPages = srcFiles?.some((file) => file === \"pages\");\n\n\t\t\tif (hasSrcPages) {\n\t\t\t\trouteHandlerPath = \"src/pages/api/auth/[...all].ts\";\n\t\t\t} else if (hasSrcApp) {\n\t\t\t\trouteHandlerPath = \"src/app/api/auth/[...all]/route.ts\";\n\t\t\t}\n\t\t} else if (hasPagesDir) {\n\t\t\trouteHandlerPath = \"pages/api/auth/[...all].ts\";\n\t\t} else if (hasAppDir) {\n\t\t\trouteHandlerPath = \"app/api/auth/[...all]/route.ts\";\n\t\t}\n\n\t\t// Update the framework with the correct path\n\t\tframework = {\n\t\t\t...framework,\n\t\t\trouteHandler: {\n\t\t\t\t...framework.routeHandler,\n\t\t\t\tpath: routeHandlerPath as typeof framework.routeHandler.path,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Prompt for auth config file location\n\tlet authConfigFilePath: string | null = null;\n\tconst hasAuthConfigAlready = await (async () => {\n\t\tfor (const path_ of possibleAuthConfigPaths) {\n\t\t\tconst fullPath = path.join(cwd, path_);\n\t\t\tconst { error } = await tryCatch(fs.access(fullPath, fs.constants.F_OK));\n\t\t\tif (!error) {\n\t\t\t\tauthConfigFilePath = fullPath;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t})();\n\n\tif (!hasAuthConfigAlready) {\n\t\tawait nextStep(\"Create A Better Auth Instance\");\n\n\t\tconst { data: allFiles, error } = await tryCatch(fs.readdir(cwd, \"utf-8\"));\n\t\tif (error) {\n\t\t\tlog.error(`Failed to read directory: ${error.message}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\t// Determine default auth config path based on project structure\n\t\t// Priority: src/lib/ if src/ exists, otherwise lib/\n\t\tconst hasSrc = allFiles.some((node) => node === \"src\");\n\n\t\tlet defaultAuthConfigPath: string;\n\t\tif (hasSrc) {\n\t\t\tdefaultAuthConfigPath = path.join(cwd, \"src\", \"lib\", \"auth.ts\");\n\t\t} else {\n\t\t\tdefaultAuthConfigPath = path.join(cwd, \"lib\", \"auth.ts\");\n\t\t}\n\n\t\t// Convert absolute path to relative path for display\n\t\tconst relativeDefaultPath = path.relative(cwd, defaultAuthConfigPath);\n\n\t\tconst { filePath } = await prompts({\n\t\t\ttype: \"text\",\n\t\t\tname: \"filePath\",\n\t\t\tmessage: `Where would you like to create the auth instance?`,\n\t\t\tinitial: relativeDefaultPath,\n\t\t});\n\n\t\tif (isCancel(filePath)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// Convert relative path back to absolute path\n\t\t// Remove leading slash if present (user might enter /lib/auth.ts meaning relative to project root)\n\t\tconst cleanPath = filePath.startsWith(\"/\") ? filePath.slice(1) : filePath;\n\t\tconst absoluteFilePath = path.isAbsolute(cleanPath)\n\t\t\t? cleanPath\n\t\t\t: path.join(cwd, cleanPath);\n\n\t\tauthConfigFilePath = absoluteFilePath;\n\n\t\t// Generate minimal boilerplate auth config immediately\n\t\tconst boilerplateCode = `import { betterAuth } from \"better-auth\";\n\nexport const auth = betterAuth({\n\t// Configuration will be added here\n});\n`;\n\n\t\tfilesToWrite.push(async () => {\n\t\t\tconst { error: mkdirError } = await tryCatch(\n\t\t\t\tfs.mkdir(path.dirname(absoluteFilePath), { recursive: true }),\n\t\t\t);\n\t\t\tif (mkdirError) {\n\t\t\t\tconst error = `Failed to create auth directory at ${path.dirname(absoluteFilePath)}: ${mkdirError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tconst { error: writeFileError } = await tryCatch(\n\t\t\t\tfs.writeFile(absoluteFilePath, boilerplateCode, \"utf-8\"),\n\t\t\t);\n\t\t\tif (writeFileError) {\n\t\t\t\tconst error = `Failed to write auth file at ${absoluteFilePath}: ${writeFileError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Select the database to use.\n\tlet databaseChoice: \"yes\" | \"stateless\" | \"skip\" | null = null;\n\tlet database: string | null = null;\n\tlet shouldGenerateSchema = false;\n\tlet shouldRunMigration = false;\n\tawait (async () => {\n\t\tawait nextStep(\"Configure Database\");\n\n\t\tconst dbChoice = await select({\n\t\t\tmessage: `Would you like to configure a database?`,\n\t\t\toptions: [\n\t\t\t\t{ value: \"yes\", label: \"Yes - Configure a database\" },\n\t\t\t\t{\n\t\t\t\t\tvalue: \"stateless\",\n\t\t\t\t\tlabel: \"Stateless - Skip database (stateless mode)\",\n\t\t\t\t},\n\t\t\t\t{ value: \"skip\", label: \"Skip - Don't setup database now\" },\n\t\t\t],\n\t\t});\n\t\tif (isCancel(dbChoice)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tdatabaseChoice = (dbChoice as \"yes\" | \"stateless\" | \"skip\") || null;\n\n\t\tif (databaseChoice === \"yes\") {\n\t\t\t// First, select the ORM or kysely dialect\n\t\t\tconst availableORMs = getAvailableORMs();\n\t\t\tconst selectedOption = await select({\n\t\t\t\tmessage: `Select the database you want to use:`,\n\t\t\t\toptions: availableORMs.map((opt) => ({\n\t\t\t\t\tvalue: opt.adapter || opt.value,\n\t\t\t\t\tlabel: opt.label,\n\t\t\t\t})),\n\t\t\t});\n\t\t\tif (isCancel(selectedOption)) {\n\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\t// If \"sqlite\" was selected, show SQLite variant options\n\t\t\tif (selectedOption === \"sqlite\") {\n\t\t\t\t// Filter SQLite options based on package manager\n\t\t\t\tconst sqliteOptions = [];\n\n\t\t\t\t// Always show better-sqlite3\n\t\t\t\tsqliteOptions.push({\n\t\t\t\t\tvalue: \"sqlite-better-sqlite3\",\n\t\t\t\t\tlabel: \"better-sqlite3\",\n\t\t\t\t});\n\n\t\t\t\t// Show Bun SQLite only if using Bun as package manager or has @types/bun\n\t\t\t\tif (pm === \"bun\") {\n\t\t\t\t\tsqliteOptions.push({\n\t\t\t\t\t\tvalue: \"sqlite-bun\",\n\t\t\t\t\t\tlabel: \"Bun SQLite\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Show Node SQLite only if NOT using Bun\n\t\t\t\t\tsqliteOptions.push({\n\t\t\t\t\t\tvalue: \"sqlite-node\",\n\t\t\t\t\t\tlabel: \"Node SQLite\",\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst sqliteVariants = await select({\n\t\t\t\t\tmessage: `Select SQLite driver:`,\n\t\t\t\t\toptions: sqliteOptions,\n\t\t\t\t});\n\t\t\t\tif (isCancel(sqliteVariants)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\t\t\t\tdatabase = sqliteVariants;\n\t\t\t} else if (isDirectAdapter(selectedOption)) {\n\t\t\t\t// If a direct adapter (kysely dialect or mongodb) was selected, use it directly\n\t\t\t\tdatabase = selectedOption;\n\t\t\t} else {\n\t\t\t\t// Otherwise, select the database dialect for the chosen ORM\n\t\t\t\tconst availableDialects = getDialectsForORM(selectedOption);\n\t\t\t\tconst selectedDialect = await select({\n\t\t\t\t\tmessage: `Select the database dialect:`,\n\t\t\t\t\toptions: availableDialects.map((d) => ({\n\t\t\t\t\t\tvalue: d.adapter,\n\t\t\t\t\t\tlabel: d.label,\n\t\t\t\t\t})),\n\t\t\t\t});\n\t\t\t\tif (isCancel(selectedDialect)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tdatabase = selectedDialect;\n\t\t\t}\n\t\t}\n\n\t\t// Install database dependencies if a database was selected\n\t\tif (database) {\n\t\t\tconst databaseConfig = getDatabaseCode(database as DatabaseAdapter);\n\t\t\tif (databaseConfig && databaseConfig.dependencies.length > 0) {\n\t\t\t\tconst { shouldInstallDeps } = await prompts({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"shouldInstallDeps\",\n\t\t\t\t\tmessage: `Would you like to install the following dependencies: ${[\n\t\t\t\t\t\t...new Set([\n\t\t\t\t\t\t\t...databaseConfig.dependencies,\n\t\t\t\t\t\t\t...(databaseConfig.devDependencies || []),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]\n\t\t\t\t\t\t.map((x) => chalk.cyan(x))\n\t\t\t\t\t\t.join(\", \")}?`,\n\t\t\t\t\tinitial: true,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(shouldInstallDeps)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tif (shouldInstallDeps) {\n\t\t\t\t\tfor (const dep of databaseConfig.dependencies) {\n\t\t\t\t\t\tdepsToInstall.set(dep, {\n\t\t\t\t\t\t\t...(depsToInstall.get(dep) || {}),\n\t\t\t\t\t\t\tprod: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tfor (const dep of databaseConfig.devDependencies || []) {\n\t\t\t\t\t\tdepsToInstall.set(dep, {\n\t\t\t\t\t\t\t...(depsToInstall.get(dep) || {}),\n\t\t\t\t\t\t\tdev: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle schema generation and migration\n\t\t\tconst dbString = String(database);\n\t\t\tconst isDrizzle = dbString.startsWith(\"drizzle-\");\n\t\t\tconst isPrisma = dbString.startsWith(\"prisma-\");\n\t\t\tconst isKysely = isKyselyDialect(dbString);\n\t\t\tconst isMongoDB = dbString === \"mongodb\";\n\n\t\t\t// For ORMs (Drizzle, Prisma), ask to generate schema\n\t\t\tif (isDrizzle || isPrisma) {\n\t\t\t\tconst response = await prompts({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"shouldGenerate\",\n\t\t\t\t\tmessage: `Would you like to generate the database schema?`,\n\t\t\t\t\tinitial: true,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(response.shouldGenerate)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tshouldGenerateSchema = response.shouldGenerate || false;\n\n\t\t\t\tif (shouldGenerateSchema) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\tchalk.dim(\n\t\t\t\t\t\t\t`\\n Schema will be generated after auth configuration is complete.\\n`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For Kysely dialects (SQLite, MySQL, PostgreSQL, MSSQL), ask to run migration\n\t\t\tif (isKysely) {\n\t\t\t\tconst response = await prompts({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"shouldMigrate\",\n\t\t\t\t\tmessage: `Would you like to run database migration?`,\n\t\t\t\t\tinitial: true,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(response.shouldMigrate)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tshouldRunMigration = response.shouldMigrate || false;\n\n\t\t\t\tif (shouldRunMigration) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\tchalk.dim(\n\t\t\t\t\t\t\t`\\n Migration will run after auth configuration is complete.\\n`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For MongoDB, just show info\n\t\t\tif (isMongoDB) {\n\t\t\t\tconsole.log(\n\t\t\t\t\tchalk.dim(\n\t\t\t\t\t\t`\\n MongoDB adapter will automatically create collections as needed.\\n`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t})();\n\n\t// Prompt for email & password authentication (skip if stateless)\n\tlet emailAndPassword = false;\n\tif (databaseChoice && databaseChoice !== \"stateless\") {\n\t\tawait nextStep(\"Configure Email & Password\");\n\t\tconst confirmed = await confirm({\n\t\t\tmessage: `Would you like to enable email & password authentication?`,\n\t\t\tinitial: true,\n\t\t});\n\t\tif (isCancel(confirmed)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\temailAndPassword = confirmed || false;\n\t}\n\n\t// Prompt for social providers\n\tlet selectedSocialProviders: string[] = [];\n\tawait (async () => {\n\t\tawait nextStep(\"Configure Social Providers\");\n\t\tconst shouldSetupSocial = await confirm({\n\t\t\tmessage: `Would you like to setup social providers?`,\n\t\t\tinitial: true,\n\t\t});\n\t\tif (isCancel(shouldSetupSocial)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (shouldSetupSocial) {\n\t\t\tconst providers = await multiselect({\n\t\t\t\tmessage: `Select the social providers you want to enable:`,\n\t\t\t\toptions: SOCIAL_PROVIDERS.map((provider) => ({\n\t\t\t\t\tvalue: provider,\n\t\t\t\t\tlabel: provider.charAt(0).toUpperCase() + provider.slice(1),\n\t\t\t\t})),\n\t\t\t});\n\t\t\tif (isCancel(providers)) {\n\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t\tselectedSocialProviders = providers || [];\n\t\t}\n\t})();\n\n\t// Add social provider environment variables\n\tif (selectedSocialProviders.length > 0) {\n\t\tawait (async () => {\n\t\t\tif (envFiles.size === 0) return; // No env files to update\n\n\t\t\tconst socialProviderEnvVars = selectedSocialProviders.flatMap(\n\t\t\t\t(provider) => {\n\t\t\t\t\tconst config =\n\t\t\t\t\t\tSOCIAL_PROVIDER_CONFIGS[\n\t\t\t\t\t\t\tprovider as keyof typeof SOCIAL_PROVIDER_CONFIGS\n\t\t\t\t\t\t];\n\t\t\t\t\tif (!config) {\n\t\t\t\t\t\t// Fallback for unknown providers\n\t\t\t\t\t\tconst providerUpper = provider.toUpperCase();\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t`${providerUpper}_CLIENT_ID`,\n\t\t\t\t\t\t\t`${providerUpper}_CLIENT_SECRET`,\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\treturn config.options.map((opt) => opt.envVar);\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tconst missingSocialEnvVars = await getMissingEnvVars(\n\t\t\t\tenvFiles,\n\t\t\t\tsocialProviderEnvVars,\n\t\t\t);\n\n\t\t\tif (missingSocialEnvVars.length > 0 && envFiles.size > 0) {\n\t\t\t\t// Add missing social provider env vars to the file with shortest length\n\t\t\t\tconst firstEnvFile = [...envFiles.keys()].sort(\n\t\t\t\t\t(a, b) => path.basename(a).length - path.basename(b).length,\n\t\t\t\t)[0]!;\n\t\t\t\tconst envVarsToAdd = missingSocialEnvVars\n\t\t\t\t\t.filter((x) => x.file === firstEnvFile)\n\t\t\t\t\t.flatMap((x) => x.var.map((v) => `${v}=\"\"`));\n\n\t\t\t\tif (envVarsToAdd.length > 0) {\n\t\t\t\t\tconst resolvedPath = path.isAbsolute(firstEnvFile)\n\t\t\t\t\t\t? firstEnvFile\n\t\t\t\t\t\t: path.join(cwd, firstEnvFile);\n\t\t\t\t\tfilesToWrite.push(() => updateEnvFiles([resolvedPath], envVarsToAdd));\n\t\t\t\t}\n\t\t\t}\n\t\t})();\n\t}\n\t// Select the plugins to use. For now this is skipped.\n\tconst plugins = await (async (): Promise<Plugin[]> => {\n\t\t// For now we do not want to allow configurations of plugins.\n\t\t// Possibly in the future we can support this.\n\t\tconst skip = true;\n\t\tif (skip) return [];\n\t\tif (hasAuthConfigAlready) return [];\n\n\t\tawait nextStep(\"Select Plugins\");\n\n\t\tconst shouldConfigurePlugins = await confirm({\n\t\t\tmessage: \"Would you like to configure plugins?\",\n\t\t\tinitial: true,\n\t\t});\n\t\tif (isCancel(shouldConfigurePlugins)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (!shouldConfigurePlugins) return [];\n\n\t\tconst selectedPlugins = await multiselect({\n\t\t\tmessage: `Select the plugins you want to use:`,\n\t\t\toptions: Object.entries(tempPluginsConfig).map(([id, plugin]) => ({\n\t\t\t\tvalue: id,\n\t\t\t\tlabel: plugin.displayName,\n\t\t\t})),\n\t\t});\n\t\tif (isCancel(selectedPlugins)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\treturn (selectedPlugins ?? []) as Plugin[];\n\t})();\n\n\t// Generate the auth config file with all selected options\n\tawait (async () => {\n\t\tif (!authConfigFilePath) return;\n\n\t\tconst authConfigCode = await generateAuthConfigCode({\n\t\t\tplugins,\n\t\t\tdatabase: database as DatabaseAdapter | null,\n\t\t\tframework,\n\t\t\tbaseURL: \"http://localhost:3000\",\n\t\t\temailAndPassword,\n\t\t\tsocialProviders: selectedSocialProviders,\n\t\t\toptions,\n\t\t\tinstallDependency: (d, type) => {\n\t\t\t\tconst dependencies = Array.isArray(d) ? d : [d];\n\t\t\t\tfor (const dep of dependencies) {\n\t\t\t\t\tdepsToInstall.set(dep, {\n\t\t\t\t\t\t...(depsToInstall.get(dep) || {}),\n\t\t\t\t\t\t[type || \"prod\"]: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tfilesToWrite.push(async () => {\n\t\t\tif (!authConfigFilePath) return;\n\t\t\tconst { error: writeFileError } = await tryCatch(\n\t\t\t\tfs.writeFile(authConfigFilePath, authConfigCode, \"utf-8\"),\n\t\t\t);\n\t\t\tif (writeFileError) {\n\t\t\t\tconst error = `Failed to write auth file at ${authConfigFilePath}: ${writeFileError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t});\n\t})();\n\n\t// Generate database schema\n\tawait (async () => {\n\t\tif (hasAuthConfigAlready) return;\n\t\tif (!database) return; // Skip if no database selected\n\t\tconst dbString = String(database);\n\t\tif (dbString === \"mongodb\") return; // Skip for MongoDB\n\n\t\t// Determine which generator to use based on database type\n\t\tconst isDrizzle = dbString.startsWith(\"drizzle-\");\n\t\tconst isPrisma = dbString.startsWith(\"prisma-\");\n\t\tconst isKysely = isKyselyDialect(dbString);\n\n\t\t// Handle Kysely migrations\n\t\tif (isKysely && shouldRunMigration) {\n\t\t\tadditionalSteps.push(async () => {\n\t\t\t\tawait nextStep(\"Migrate Database\");\n\n\t\t\t\tconst s = yoctoSpinner({\n\t\t\t\t\ttext: \"Running database migration...\",\n\t\t\t\t\tcolor: \"white\",\n\t\t\t\t});\n\t\t\t\ts.start();\n\n\t\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\t\texec(`npx auth migrate`, { cwd }, (error, stdout, stderr) => {\n\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\ts.stop();\n\t\t\t\t\t\t\tlog.error(`Failed to run migration: ${error.message}`);\n\t\t\t\t\t\t\tif (stderr) log.error(stderr);\n\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ts.success(\"Database migration completed successfully!\");\n\t\t\t\t\t\tif (stdout) console.log(stdout);\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (!isDrizzle && !isPrisma) {\n\t\t\t// Unknown database type, skip\n\t\t\treturn;\n\t\t}\n\n\t\t// Only generate schema if user chose to\n\t\tif (!shouldGenerateSchema) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst provider = getDatabaseProvider(dbString);\n\t\tif (!provider) {\n\t\t\tlog.error(`Unable to determine database provider for ${database}`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst s = yoctoSpinner({\n\t\t\ttext: `Generating database schema...`,\n\t\t\tcolor: \"white\",\n\t\t});\n\t\ts.start();\n\n\t\ttry {\n\t\t\t// Create minimal config for schema generation\n\t\t\tconst config = createMinimalConfig(plugins, \"http://localhost:3000\");\n\n\t\t\t// Create mock adapter\n\t\t\tconst adapter = createMockAdapter(database, provider);\n\n\t\t\tlet schemaResult: {\n\t\t\t\tcode?: string;\n\t\t\t\tfileName: string;\n\t\t\t\toverwrite?: boolean;\n\t\t\t};\n\n\t\t\tlet outputPath: string;\n\n\t\t\tif (isDrizzle) {\n\t\t\t\t// For Drizzle, output to auth-schema.ts next to auth config\n\t\t\t\tif (!authConfigFilePath) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Auth config file path is required for Drizzle schema generation\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Resolve auth config path relative to cwd\n\t\t\t\tconst resolvedAuthConfigPath = path.isAbsolute(authConfigFilePath)\n\t\t\t\t\t? authConfigFilePath\n\t\t\t\t\t: path.join(cwd, authConfigFilePath);\n\t\t\t\tconst authConfigDir = path.dirname(resolvedAuthConfigPath);\n\t\t\t\tconst schemaFileName = \"auth-schema.ts\";\n\t\t\t\tconst fullOutputPath = path.join(authConfigDir, schemaFileName);\n\t\t\t\t// Convert to relative path from cwd for the generator\n\t\t\t\toutputPath = path.relative(cwd, fullOutputPath);\n\n\t\t\t\tschemaResult = await generateDrizzleSchema({\n\t\t\t\t\tadapter,\n\t\t\t\t\toptions: config,\n\t\t\t\t\tfile: outputPath,\n\t\t\t\t});\n\t\t\t} else if (isPrisma) {\n\t\t\t\t// For Prisma, output to prisma/schema.prisma\n\t\t\t\toutputPath = \"prisma/schema.prisma\";\n\t\t\t\tschemaResult = await generatePrismaSchema({\n\t\t\t\t\tadapter,\n\t\t\t\t\toptions: config,\n\t\t\t\t\tfile: outputPath,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Unsupported database type: ${dbString}`);\n\t\t\t}\n\n\t\t\tif (!schemaResult.code) {\n\t\t\t\ts.stop();\n\t\t\t\tlog.info(\"Schema is already up to date.\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Resolve full output path for file operations\n\t\t\tconst fullOutputPath = path.isAbsolute(outputPath)\n\t\t\t\t? outputPath\n\t\t\t\t: path.join(cwd, outputPath);\n\t\t\tconst fileExists = await fs\n\t\t\t\t.access(fullOutputPath)\n\t\t\t\t.then(() => true)\n\t\t\t\t.catch(() => false);\n\n\t\t\tif (fileExists && schemaResult.overwrite) {\n\t\t\t\ts.stop();\n\t\t\t\tconst shouldOverwrite = await confirm({\n\t\t\t\t\tmessage: `The file ${chalk.yellow(outputPath)} already exists. Do you want to overwrite it?`,\n\t\t\t\t\tinitial: false,\n\t\t\t\t});\n\t\t\t\tif (isCancel(shouldOverwrite) || !shouldOverwrite) {\n\t\t\t\t\tlog.info(\"Schema generation cancelled.\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ts.start();\n\t\t\t}\n\n\t\t\tfilesToWrite.push(async () => {\n\t\t\t\tif (!schemaResult.code) return;\n\t\t\t\t// Create directory if it doesn't exist\n\t\t\t\tconst outputDir = path.dirname(fullOutputPath);\n\t\t\t\tawait fs.mkdir(outputDir, { recursive: true });\n\n\t\t\t\t// Write schema file\n\t\t\t\tawait fs.writeFile(fullOutputPath, schemaResult.code, \"utf-8\");\n\t\t\t});\n\n\t\t\ts.success(\n\t\t\t\t`Schema generated successfully at ${chalk.yellow(outputPath)}!`,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\ts.stop();\n\t\t\tlog.error(\n\t\t\t\t`Failed to generate schema: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\t})();\n\n\t// Generate the route handler file.\n\tawait (async () => {\n\t\t// Skip route handler generation if framework wasn't detected\n\t\tif (!frameworkWasDetected) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!framework.routeHandler) return;\n\t\tif (!authConfigFilePath) return;\n\n\t\tconst { routeHandler } = framework;\n\n\t\tconst fullPath = path.resolve(cwd, routeHandler.path);\n\t\tconst access = fs.access(fullPath, fs.constants.F_OK);\n\t\tconst { error } = await tryCatch(access);\n\n\t\tif (!error) {\n\t\t\treturn;\n\t\t}\n\t\tawait nextStep(\"Generate Route Handler\");\n\n\t\t// Convert absolute path to relative path for display\n\t\tconst relativeHandlerPath = path.relative(cwd, fullPath);\n\n\t\tconst { filePath } = await prompts({\n\t\t\ttype: \"text\",\n\t\t\tname: \"filePath\",\n\t\t\tmessage: `Enter the path to the route handler file:`,\n\t\t\tinitial: relativeHandlerPath,\n\t\t});\n\t\tif (isCancel(filePath)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// Convert user input back to absolute path\n\t\tconst cleanHandlerPath = filePath.startsWith(\"/\")\n\t\t\t? filePath.slice(1)\n\t\t\t: filePath;\n\t\tconst absoluteHandlerPath = path.isAbsolute(cleanHandlerPath)\n\t\t\t? cleanHandlerPath\n\t\t\t: path.join(cwd, cleanHandlerPath);\n\n\t\t// Generate the correct import path for the auth file\n\t\tconst authImportPath = await generateAuthImportPath(\n\t\t\tcwd,\n\t\t\tauthConfigFilePath,\n\t\t\tabsoluteHandlerPath,\n\t\t\tframework,\n\t\t);\n\n\t\t// Replace the hardcoded import path in the route handler code with the generated one\n\t\t// Common patterns to replace:\n\t\t// - import { auth } from \"@/lib/auth\"\n\t\t// - import { auth } from \"~/lib/auth\"\n\t\t// - import { auth } from \"$lib/auth\"\n\t\t// - import { auth } from \"./auth\"\n\t\tlet updatedCode = routeHandler.code as string;\n\t\tconst importPatterns = [\n\t\t\t/from\\s+[\"']@\\/[^\"']+[\"']/,\n\t\t\t/from\\s+[\"']~\\/[^\"']+[\"']/,\n\t\t\t/from\\s+[\"']\\$lib\\/[^\"']+[\"']/,\n\t\t\t/from\\s+[\"']\\.\\/[^\"']+[\"']/,\n\t\t\t/from\\s+[\"']\\.\\.\\/[^\"']+[\"']/,\n\t\t];\n\n\t\tfor (const pattern of importPatterns) {\n\t\t\tconst newCode = updatedCode.replace(pattern, `from \"${authImportPath}\"`);\n\t\t\tif (newCode !== updatedCode) {\n\t\t\t\tupdatedCode = newCode;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tfilesToWrite.push(async () => {\n\t\t\tconst mkdir = fs.mkdir(path.dirname(absoluteHandlerPath), {\n\t\t\t\trecursive: true,\n\t\t\t});\n\t\t\tconst { error: mkdirError } = await tryCatch(mkdir);\n\t\t\tif (mkdirError) {\n\t\t\t\tconst error = `Failed to create directory at ${path.dirname(absoluteHandlerPath)}: ${mkdirError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tconst writeFile = fs.writeFile(absoluteHandlerPath, updatedCode, \"utf-8\");\n\t\t\tconst { error: writeFileError } = await tryCatch(writeFile);\n\t\t\tif (writeFileError) {\n\t\t\t\tconst error = `Failed to write file at ${absoluteHandlerPath}: ${writeFileError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t});\n\n\t\treturn;\n\t})();\n\n\t// Generate the `auth-client.ts` file.\n\tawait (async () => {\n\t\tconst hasAuthClientConfigAlready = await (async () => {\n\t\t\tfor (const path_ of possibleClientConfigPaths) {\n\t\t\t\tconst fullPath = path.join(cwd, path_);\n\t\t\t\tconst { error } = await tryCatch(\n\t\t\t\t\tfs.access(fullPath, fs.constants.F_OK),\n\t\t\t\t);\n\t\t\t\tif (!error) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t})();\n\t\tif (hasAuthClientConfigAlready) return;\n\t\tawait nextStep(\"Generate Auth Client Configuration\");\n\n\t\tconsole.log(\n\t\t\tchalk.dim(\n\t\t\t\t\"Note: If you have a separated client-server project architecture, you may want to skip generating the auth client file here and create it in your client project instead.\",\n\t\t\t),\n\t\t);\n\n\t\tconst shouldGenerateAuthClient = await confirm({\n\t\t\tmessage: `Would you like to generate the auth client configuration file?`,\n\t\t\tinitial: true,\n\t\t});\n\t\tif (isCancel(shouldGenerateAuthClient)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (!shouldGenerateAuthClient) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst authClientCode = await generateAuthClientConfigCode({\n\t\t\tplugins,\n\t\t\tdatabase,\n\t\t\tframework,\n\t\t\tbaseURL: \"http://localhost:3000\",\n\t\t\toptions,\n\t\t\tinstallDependency: (d, type) => {\n\t\t\t\tconst dependencies = Array.isArray(d) ? d : [d];\n\t\t\t\tfor (const dep of dependencies) {\n\t\t\t\t\tdepsToInstall.set(dep, {\n\t\t\t\t\t\t...(depsToInstall.get(dep) || {}),\n\t\t\t\t\t\t[type || \"prod\"]: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tconst { data: allFiles, error } = await tryCatch(fs.readdir(cwd, \"utf-8\"));\n\t\tif (error) {\n\t\t\tlog.error(`Failed to read directory: ${error.message}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\t// Determine default auth-client config path based on project structure\n\t\t// Priority: src/lib/ if src/ exists, otherwise lib/\n\t\tconst hasSrc = allFiles.some((node) => node === \"src\");\n\n\t\tlet defaultAuthClientPath: string;\n\t\tif (hasSrc) {\n\t\t\tdefaultAuthClientPath = path.join(cwd, \"src\", \"lib\", \"auth-client.ts\");\n\t\t} else {\n\t\t\tdefaultAuthClientPath = path.join(cwd, \"lib\", \"auth-client.ts\");\n\t\t}\n\n\t\t// Convert absolute path to relative path for display\n\t\tconst relativeDefaultClientPath = path.relative(cwd, defaultAuthClientPath);\n\n\t\tconst { filePath } = await prompts({\n\t\t\ttype: \"text\",\n\t\t\tname: \"filePath\",\n\t\t\tmessage: `Enter the path to the auth-client.ts file:`,\n\t\t\tinitial: relativeDefaultClientPath,\n\t\t});\n\t\tif (isCancel(filePath)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// Convert relative path back to absolute path\n\t\tconst cleanPath = filePath.startsWith(\"/\") ? filePath.slice(1) : filePath;\n\t\tconst absoluteClientFilePath = path.isAbsolute(cleanPath)\n\t\t\t? cleanPath\n\t\t\t: path.join(cwd, cleanPath);\n\n\t\tfilesToWrite.push(async () => {\n\t\t\tconst { error: mkdirError } = await tryCatch(\n\t\t\t\tfs.mkdir(path.dirname(absoluteClientFilePath), { recursive: true }),\n\t\t\t);\n\t\t\tif (mkdirError) {\n\t\t\t\tconst error = `Failed to create auth client directory at ${path.dirname(absoluteClientFilePath)}: ${mkdirError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tconst { error: writeFileError } = await tryCatch(\n\t\t\t\tfs.writeFile(absoluteClientFilePath, authClientCode, \"utf-8\"),\n\t\t\t);\n\t\t\tif (writeFileError) {\n\t\t\t\tconst error = `Failed to write auth client file at ${absoluteClientFilePath}: ${writeFileError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t});\n\t})();\n\n\t// generate and update files\n\tawait (async () => {\n\t\tif (filesToWrite.length === 0) return;\n\t\tawait nextStep(\"Generate Files\");\n\n\t\tconst s = yoctoSpinner({\n\t\t\ttext: \"Generating files...\",\n\t\t\tcolor: \"white\",\n\t\t});\n\t\ts.start();\n\n\t\tfor (const exec of filesToWrite) {\n\t\t\tawait exec();\n\t\t}\n\n\t\ts.success(\"Files generated successfully!\");\n\t})();\n\n\t// Install dependencies\n\tawait (async () => {\n\t\tif (depsToInstall.size === 0) return;\n\t\tawait nextStep(\"Install Dependencies\");\n\n\t\tconst s = yoctoSpinner({\n\t\t\ttext: \"Installing dependencies...\",\n\t\t\tcolor: \"white\",\n\t\t});\n\t\ts.start();\n\n\t\tconst deps = {\n\t\t\tprod: new Set<string>(),\n\t\t\tdev: new Set<string>(),\n\t\t};\n\t\tfor (const [dep, cfg] of depsToInstall) {\n\t\t\tif (cfg.prod) {\n\t\t\t\tdeps.prod.add(dep);\n\t\t\t}\n\t\t\tif (cfg.dev) {\n\t\t\t\tdeps.dev.add(dep);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [type, dependencies] of Object.entries(deps)) {\n\t\t\tawait installDependencies({\n\t\t\t\tcwd,\n\t\t\t\tdependencies: [...dependencies],\n\t\t\t\tpackageManager: pm,\n\t\t\t\ttype: type as keyof typeof deps,\n\t\t\t});\n\t\t}\n\n\t\ts.success(\"Dependencies installed successfully!\");\n\t})();\n\n\tfor (const step of additionalSteps) {\n\t\tawait step();\n\t}\n\n\tconst connectResponse = await prompts({\n\t\ttype: \"confirm\",\n\t\tname: \"connect\",\n\t\tmessage:\n\t\t\t\"Would you like to connect your app to Better Auth infrastructure?\",\n\t\tinitial: true,\n\t});\n\t// If the user cancels the prompt, `connect` will be undefined.\n\t// Treat this as a cancellation of the remaining init flow.\n\tif (connectResponse.connect === undefined) {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\"\\n✖ \") +\n\t\t\t\t\"Setup cancelled before connecting to Better Auth infrastructure.\\n\",\n\t\t);\n\t\treturn;\n\t}\n\t// If the user cancels the prompt, `connect` will be undefined.\n\t// Treat this as a cancellation of the remaining init flow.\n\tif (connectResponse.connect === undefined) {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\"\\n✖ \") +\n\t\t\t\t\"Setup cancelled before connecting to Better Auth infrastructure.\\n\",\n\t\t);\n\t\treturn;\n\t}\n\tif (connectResponse.connect) {\n\t\tawait open(\"https://better-auth.com/onboarding\");\n\t\tconsole.log(\n\t\t\tchalk.cyan(\"\\n→ \") +\n\t\t\t\t\"Opening Better Auth onboarding in your browser...\\n\",\n\t\t);\n\t}\n\n\tconsole.log(\n\t\tchalk.green(`\\n✔ `) + chalk.bold(\"Success! \") + \"Project setup complete.\\n\",\n\t);\n\n\tconst logs: string[] = [];\n\n\tlet nextStepNum = 1;\n\n\tif (databaseChoice === \"yes\" && database) {\n\t\tlogs.push(\n\t\t\t` ${nextStepNum}. Set up your database with necessary environment variables`,\n\t\t);\n\t\tnextStepNum++;\n\n\t\t// Determine migration command based on database type\n\t\tconst dbString = String(database);\n\t\tconst isDrizzle = dbString.startsWith(\"drizzle-\");\n\t\tconst isPrisma = dbString.startsWith(\"prisma-\");\n\t\tconst isKysely = isKyselyDialect(dbString);\n\n\t\t// Only show migration tip for Drizzle, Prisma, or Kysely\n\t\tif ((isDrizzle || isPrisma || isKysely) && !shouldRunMigration) {\n\t\t\tlet command: string;\n\t\t\tif (isDrizzle) {\n\t\t\t\tcommand = \"npx drizzle-kit push\";\n\t\t\t} else if (isPrisma) {\n\t\t\t\tcommand = \"npx prisma migrate dev\";\n\t\t\t} else {\n\t\t\t\tcommand = \"npx auth migrate\";\n\t\t\t}\n\t\t\tlogs.push(` ${nextStepNum}. Run ${chalk.cyan(command)} to apply schema`);\n\t\t\tnextStepNum++;\n\t\t}\n\t}\n\n\t// Show mount handler instructions if framework wasn't detected\n\tif (!frameworkWasDetected) {\n\t\tlogs.push(` ${nextStepNum}. Mount the auth handler`);\n\t\tlogs.push(\n\t\t\t` Use ${chalk.cyan(\"auth.handler\")} with a Web API compatible request object\\n` +\n\t\t\t\t` Default route: ${chalk.cyan('\"/api/auth\"')} (configurable via ${chalk.cyan(\"basePath\")})`,\n\t\t);\n\t\tnextStepNum++;\n\t}\n\n\tif (selectedSocialProviders.length > 0) {\n\t\tconst providerList = selectedSocialProviders\n\t\t\t.map((provider) => {\n\t\t\t\tconst config =\n\t\t\t\t\tSOCIAL_PROVIDER_CONFIGS[\n\t\t\t\t\t\tprovider as keyof typeof SOCIAL_PROVIDER_CONFIGS\n\t\t\t\t\t];\n\t\t\t\tif (!config) {\n\t\t\t\t\tconst providerUpper = provider.toUpperCase();\n\t\t\t\t\treturn `\\n - ${chalk.cyan(`${providerUpper}_CLIENT_ID`)} and ${chalk.cyan(`${providerUpper}_CLIENT_SECRET`)}`;\n\t\t\t\t}\n\t\t\t\tconst envVars = config.options\n\t\t\t\t\t.map((opt) => chalk.cyan(opt.envVar))\n\t\t\t\t\t.join(\" and \");\n\t\t\t\treturn `\\n - ${envVars}`;\n\t\t\t})\n\t\t\t.join(\"\");\n\t\tlogs.push(\n\t\t\t` ${nextStepNum}. Add social provider credentials to .env:${providerList}`,\n\t\t);\n\t\tnextStepNum++;\n\t}\n\n\tif (logs.length > 0) {\n\t\tconsole.log(chalk.bold(\"Next steps:\"));\n\t\tconsole.log(logs.join(\"\\n\"));\n\t}\n}\nconst initBuilder = new Command(\"init\")\n\t.option(\"-c, --cwd <cwd>\", \"The working directory.\", process.cwd())\n\t.option(\n\t\t\"--config <config>\",\n\t\t\"The path to the auth configuration file. defaults to the first `auth.ts` file found.\",\n\t)\n\t.option(\n\t\t\"--package-manager <package-manager>\",\n\t\t\"The package manager to use. defaults to the package manager found in the current working directory.\",\n\t);\n/**\n * Track used flags to ensure uniqueness\n */\nconst usedFlags = new Set<string>();\n\n/**\n * Recursively process arguments and nested objects to add CLI options\n * Each flag is unique and not compound (no parent prefix)\n */\nconst processArguments = (\n\targs: GetArgumentsOptions[],\n\tpluginDisplayName: string,\n) => {\n\tif (!args) return;\n\n\tfor (const argument of args) {\n\t\t// Skip if it's a nested object container (we'll process its children instead)\n\t\tif (argument.isNestedObject && Array.isArray(argument.isNestedObject)) {\n\t\t\t// Recursively process nested arguments (without prefix)\n\t\t\tprocessArguments(argument.isNestedObject, pluginDisplayName);\n\t\t} else {\n\t\t\t// Process regular argument with its original flag (no prefix)\n\t\t\tconst flag = argument.flag;\n\n\t\t\t// Ensure flag uniqueness\n\t\t\tif (usedFlags.has(flag)) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Warning: Flag \"${flag}\" is already used. Skipping duplicate.`,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tusedFlags.add(flag);\n\n\t\t\tinitBuilder.option(\n\t\t\t\t`--${flag} <${flag}>`,\n\t\t\t\t`[${pluginDisplayName}] ${argument.description}`,\n\t\t\t);\n\t\t\tpluginArgumentOptionsSchema[getFlagVariable(flag)] = z.coerce\n\t\t\t\t.string()\n\t\t\t\t.optional();\n\t\t}\n\t}\n};\n\nconst pluginArgumentOptionsSchema: Record<string, z.ZodType<any>> = {};\n\nfor (const plugin of Object.values(\n\ttempPluginsConfig as never as PluginsConfig,\n)) {\n\tif (plugin.auth.arguments) {\n\t\tprocessArguments(plugin.auth.arguments, plugin.displayName);\n\t}\n\n\tif (plugin.authClient && plugin.authClient.arguments) {\n\t\tprocessArguments(plugin.authClient.arguments, plugin.displayName);\n\t}\n}\n\nexport const init = initBuilder.action(initAction);\n\nexport const initActionOptionsSchema = z.object({\n\tcwd: z.string().transform((val) => path.resolve(val)),\n\tconfig: z.string().optional(),\n\tpackageManager: z.enum(PACKAGE_MANAGER).optional(),\n\t...pluginArgumentOptionsSchema,\n});\n","import { log } from \"@clack/prompts\";\nimport { Command } from \"commander\";\nimport { spawnCommand } from \"../utils/helper\";\n\nasync function loginAction() {\n\ttry {\n\t\tawait spawnCommand(\"npx @better-auth/cli@latest login\");\n\t} catch (error: any) {\n\t\tlog.error(error.message || \"An unknown error occurred\");\n\t\tprocess.exit(1);\n\t}\n\n\tprocess.exit(0);\n}\n\nexport const login = new Command(\"login\")\n\t.description(\"Login to Better Auth Infrastructure\")\n\t.action(loginAction);\n\nasync function logoutAction() {\n\ttry {\n\t\tawait spawnCommand(\"npx @better-auth/cli@latest logout\");\n\t} catch (error: any) {\n\t\tlog.error(error.message || \"An unknown error occurred\");\n\t\tprocess.exit(1);\n\t}\n\n\tprocess.exit(0);\n}\n\nexport const logout = new Command(\"logout\")\n\t.description(\"Logout from Better Auth Infrastructure\")\n\t.action(logoutAction);\n","import { execSync } from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { base64 } from \"@better-auth/utils/base64\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\n\ninterface MCPOptions {\n\tcursor?: boolean;\n\tclaudeCode?: boolean;\n\topenCode?: boolean;\n\tmanual?: boolean;\n}\n\nconst REMOTE_MCP_URL = \"https://mcp.inkeep.com/better-auth/mcp\";\n\nasync function mcpAction(options: MCPOptions) {\n\tif (options.cursor) {\n\t\tawait handleCursorAction();\n\t} else if (options.claudeCode) {\n\t\thandleClaudeCodeAction();\n\t} else if (options.openCode) {\n\t\thandleOpenCodeAction();\n\t} else if (options.manual) {\n\t\thandleManualAction();\n\t} else {\n\t\tshowAllOptions();\n\t}\n}\n\nasync function handleCursorAction() {\n\tconsole.log(chalk.bold.blue(\"🚀 Adding Better Auth MCP to Cursor...\"));\n\n\tconst platform = os.platform();\n\tlet openCommand: string;\n\n\tswitch (platform) {\n\t\tcase \"darwin\":\n\t\t\topenCommand = \"open\";\n\t\t\tbreak;\n\t\tcase \"win32\":\n\t\t\topenCommand = \"start\";\n\t\t\tbreak;\n\t\tcase \"linux\":\n\t\t\topenCommand = \"xdg-open\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(`Unsupported platform: ${platform}`);\n\t}\n\n\tconst remoteConfig = { url: REMOTE_MCP_URL };\n\tconst encodedRemote = base64.encode(\n\t\tnew TextEncoder().encode(JSON.stringify(remoteConfig)),\n\t);\n\tconst remoteDeeplink = `cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(\"better-auth\")}&config=${encodedRemote}`;\n\n\ttry {\n\t\tconst cmd =\n\t\t\tplatform === \"win32\"\n\t\t\t\t? `start \"\" \"${remoteDeeplink}\"`\n\t\t\t\t: `${openCommand} \"${remoteDeeplink}\"`;\n\t\texecSync(cmd, { stdio: \"inherit\" });\n\t\tconsole.log(chalk.green(\"\\n✓ Better Auth MCP server installed!\"));\n\t} catch {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\n\t\t\t\t\"\\n⚠ Could not automatically open Cursor for MCP installation.\",\n\t\t\t),\n\t\t);\n\t}\n\n\tconsole.log(chalk.bold.white(\"\\n✨ Next Steps:\"));\n\tconsole.log(\n\t\tchalk.gray(\"• The MCP server will be added to your Cursor configuration\"),\n\t);\n\tconsole.log(\n\t\tchalk.gray(\"• You can now use Better Auth features directly in Cursor\"),\n\t);\n\tconsole.log(\n\t\tchalk.gray(\n\t\t\t'• Try: \"Set up Better Auth with Google login\" or \"Help me debug my auth\"',\n\t\t),\n\t);\n}\n\nfunction handleClaudeCodeAction() {\n\tconsole.log(chalk.bold.blue(\"🤖 Adding Better Auth MCP to Claude Code...\"));\n\n\tconst command = `claude mcp add --transport http better-auth ${REMOTE_MCP_URL}`;\n\n\ttry {\n\t\texecSync(command, { stdio: \"inherit\" });\n\t\tconsole.log(chalk.green(\"\\n✓ Claude Code MCP configured!\"));\n\t} catch {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\n\t\t\t\t\"\\n⚠ Could not automatically add to Claude Code. Please run this command manually:\",\n\t\t\t),\n\t\t);\n\t\tconsole.log(chalk.cyan(command));\n\t}\n\n\tconsole.log(chalk.bold.white(\"\\n✨ Next Steps:\"));\n\tconsole.log(\n\t\tchalk.gray(\n\t\t\t\"• The MCP server will be added to your Claude Code configuration\",\n\t\t),\n\t);\n\tconsole.log(\n\t\tchalk.gray(\n\t\t\t\"• You can now use Better Auth features directly in Claude Code\",\n\t\t),\n\t);\n}\n\nfunction handleOpenCodeAction() {\n\tconsole.log(chalk.bold.blue(\"🔧 Adding Better Auth MCP to Open Code...\"));\n\n\tconst openCodeConfig = {\n\t\t$schema: \"https://opencode.ai/config.json\",\n\t\tmcp: {\n\t\t\t\"better-auth\": {\n\t\t\t\ttype: \"remote\",\n\t\t\t\turl: REMOTE_MCP_URL,\n\t\t\t\tenabled: true,\n\t\t\t},\n\t\t},\n\t};\n\n\tconst configPath = path.join(process.cwd(), \"opencode.json\");\n\n\ttry {\n\t\tlet existingConfig: {\n\t\t\tmcp?: Record<string, unknown>;\n\t\t\t[key: string]: unknown;\n\t\t} = {};\n\t\tif (fs.existsSync(configPath)) {\n\t\t\tconst existingContent = fs.readFileSync(configPath, \"utf8\");\n\t\t\texistingConfig = JSON.parse(existingContent);\n\t\t}\n\n\t\tconst mergedConfig = {\n\t\t\t...existingConfig,\n\t\t\t...openCodeConfig,\n\t\t\tmcp: {\n\t\t\t\t...existingConfig.mcp,\n\t\t\t\t...openCodeConfig.mcp,\n\t\t\t},\n\t\t};\n\n\t\tfs.writeFileSync(configPath, JSON.stringify(mergedConfig, null, 2));\n\t\tconsole.log(\n\t\t\tchalk.green(`\\n✓ Open Code configuration written to ${configPath}`),\n\t\t);\n\t\tconsole.log(chalk.green(\"✓ Better Auth MCP server added successfully!\"));\n\t} catch {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\n\t\t\t\t\"\\n⚠ Could not automatically write opencode.json. Please add this configuration manually:\",\n\t\t\t),\n\t\t);\n\t\tconsole.log(chalk.cyan(JSON.stringify(openCodeConfig, null, 2)));\n\t}\n\n\tconsole.log(chalk.bold.white(\"\\n✨ Next Steps:\"));\n\tconsole.log(chalk.gray(\"• Restart Open Code to load the new MCP server\"));\n\tconsole.log(\n\t\tchalk.gray(\"• You can now use Better Auth features directly in Open Code\"),\n\t);\n}\n\nfunction handleManualAction() {\n\tconsole.log(chalk.bold.blue(\"📝 Better Auth MCP Configuration...\"));\n\n\tconst manualConfig = {\n\t\t\"better-auth\": {\n\t\t\turl: REMOTE_MCP_URL,\n\t\t},\n\t};\n\n\tconst configPath = path.join(process.cwd(), \"mcp.json\");\n\n\ttry {\n\t\tlet existingConfig = {};\n\t\tif (fs.existsSync(configPath)) {\n\t\t\tconst existingContent = fs.readFileSync(configPath, \"utf8\");\n\t\t\texistingConfig = JSON.parse(existingContent);\n\t\t}\n\n\t\tconst mergedConfig = {\n\t\t\t...existingConfig,\n\t\t\t...manualConfig,\n\t\t};\n\n\t\tfs.writeFileSync(configPath, JSON.stringify(mergedConfig, null, 2));\n\t\tconsole.log(chalk.green(`\\n✓ MCP configuration written to ${configPath}`));\n\t\tconsole.log(chalk.green(\"✓ Better Auth MCP server added successfully!\"));\n\t} catch {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\n\t\t\t\t\"\\n⚠ Could not automatically write mcp.json. Please add this configuration manually:\",\n\t\t\t),\n\t\t);\n\t\tconsole.log(chalk.cyan(JSON.stringify(manualConfig, null, 2)));\n\t}\n\n\tconsole.log(chalk.bold.white(\"\\n✨ Next Steps:\"));\n\tconsole.log(chalk.gray(\"• Restart your MCP client to load the new server\"));\n\tconsole.log(\n\t\tchalk.gray(\n\t\t\t\"• You can now use Better Auth features directly in your MCP client\",\n\t\t),\n\t);\n}\n\nfunction showAllOptions() {\n\tconsole.log(chalk.bold.blue(\"🔌 Better Auth MCP Server\"));\n\tconsole.log(chalk.gray(\"Choose your MCP client to get started:\"));\n\tconsole.log();\n\n\tconsole.log(chalk.bold.white(\"MCP Clients:\"));\n\tconsole.log(chalk.cyan(\" --cursor \") + chalk.gray(\"Add to Cursor\"));\n\tconsole.log(\n\t\tchalk.cyan(\" --claude-code \") + chalk.gray(\"Add to Claude Code\"),\n\t);\n\tconsole.log(chalk.cyan(\" --open-code \") + chalk.gray(\"Add to Open Code\"));\n\tconsole.log(\n\t\tchalk.cyan(\" --manual \") + chalk.gray(\"Manual configuration\"),\n\t);\n\tconsole.log();\n\n\tconsole.log(chalk.bold.white(\"Server:\"));\n\tconsole.log(\n\t\tchalk.gray(\" • \") +\n\t\t\tchalk.white(\"better-auth\") +\n\t\t\tchalk.gray(\" - Search documentation, code examples, setup assistance\"),\n\t);\n\tconsole.log();\n}\n\nexport const mcp = new Command(\"mcp\")\n\t.description(\"Add Better Auth MCP server to MCP Clients\")\n\t.option(\"--cursor\", \"Automatically open Cursor with the MCP configuration\")\n\t.option(\"--claude-code\", \"Show Claude Code MCP configuration command\")\n\t.option(\"--open-code\", \"Show Open Code MCP configuration\")\n\t.option(\"--manual\", \"Show manual MCP configuration for mcp.json\")\n\t.action(mcpAction);\n","import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport {\n\tcreateTelemetry,\n\tgetTelemetryAuthConfig,\n} from \"@better-auth/telemetry\";\nimport { getAdapter } from \"better-auth/db/adapter\";\nimport { getMigrations } from \"better-auth/db/migration\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport prompts from \"prompts\";\nimport yoctoSpinner from \"yocto-spinner\";\nimport * as z from \"zod/v4\";\nimport { getConfig } from \"../utils/get-config\";\n\n/** @internal */\nexport async function migrateAction(opts: any) {\n\tconst options = z\n\t\t.object({\n\t\t\tcwd: z.string(),\n\t\t\tconfig: z.string().optional(),\n\t\t\ty: z.boolean().optional(),\n\t\t\tyes: z.boolean().optional(),\n\t\t})\n\t\t.parse(opts);\n\n\tconst cwd = path.resolve(options.cwd);\n\tif (!existsSync(cwd)) {\n\t\tconsole.error(`The directory \"${cwd}\" does not exist.`);\n\t\tprocess.exit(1);\n\t}\n\n\tconst config = await getConfig({\n\t\tcwd,\n\t\tconfigPath: options.config,\n\t});\n\tif (!config) {\n\t\tconsole.error(\n\t\t\t\"No configuration file found. Add a `auth.ts` file to your project or pass the path to the configuration file using the `--config` flag.\",\n\t\t);\n\t\treturn;\n\t}\n\n\tconst db = await getAdapter(config);\n\n\tif (!db) {\n\t\tconsole.error(\n\t\t\t\"Invalid database configuration. Make sure you're not using adapters. Migrate command only works with built-in Kysely adapter.\",\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tif (db.id !== \"kysely\") {\n\t\tif (db.id === \"prisma\") {\n\t\t\tconsole.error(\n\t\t\t\t\"The migrate command only works with the built-in Kysely adapter. For Prisma, run `npx auth generate` to create the schema, then use Prisma's migrate or push to apply it.\",\n\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\t\tawait telemetry.publish({\n\t\t\t\t\ttype: \"cli_migrate\",\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\toutcome: \"unsupported_adapter\",\n\t\t\t\t\t\tadapter: \"prisma\",\n\t\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (db.id === \"drizzle\") {\n\t\t\tconsole.error(\n\t\t\t\t\"The migrate command only works with the built-in Kysely adapter. For Drizzle, run `npx auth generate` to create the schema, then use Drizzle's migrate or push to apply it.\",\n\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\t\tawait telemetry.publish({\n\t\t\t\t\ttype: \"cli_migrate\",\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\toutcome: \"unsupported_adapter\",\n\t\t\t\t\t\tadapter: \"drizzle\",\n\t\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tconsole.error(\"Migrate command isn't supported for this adapter.\");\n\t\ttry {\n\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\tawait telemetry.publish({\n\t\t\t\ttype: \"cli_migrate\",\n\t\t\t\tpayload: {\n\t\t\t\t\toutcome: \"unsupported_adapter\",\n\t\t\t\t\tadapter: db.id,\n\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {}\n\t\tprocess.exit(1);\n\t}\n\n\tconst spinner = yoctoSpinner({ text: \"preparing migration...\" }).start();\n\n\tconst { toBeAdded, toBeCreated, runMigrations } = await getMigrations(config);\n\n\tif (!toBeAdded.length && !toBeCreated.length) {\n\t\tspinner.stop();\n\t\tconsole.log(\"🚀 No migrations needed.\");\n\t\ttry {\n\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\tawait telemetry.publish({\n\t\t\t\ttype: \"cli_migrate\",\n\t\t\t\tpayload: {\n\t\t\t\t\toutcome: \"no_changes\",\n\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {}\n\t\tprocess.exit(0);\n\t}\n\n\tspinner.stop();\n\tconsole.log(`🔑 The migration will affect the following:`);\n\n\tfor (const table of [...toBeCreated, ...toBeAdded]) {\n\t\tconsole.log(\n\t\t\t\"->\",\n\t\t\tchalk.magenta(Object.keys(table.fields).join(\", \")),\n\t\t\tchalk.white(\"fields on\"),\n\t\t\tchalk.yellow(`${table.table}`),\n\t\t\tchalk.white(\"table.\"),\n\t\t);\n\t}\n\n\tif (options.y) {\n\t\tconsole.warn(\"WARNING: --y is deprecated. Consider -y or --yes\");\n\t\toptions.yes = true;\n\t}\n\n\tlet migrate = options.yes;\n\tif (!migrate) {\n\t\tconst response = await prompts({\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"migrate\",\n\t\t\tmessage: \"Are you sure you want to run these migrations?\",\n\t\t\tinitial: false,\n\t\t});\n\t\tmigrate = response.migrate;\n\t}\n\n\tif (!migrate) {\n\t\tconsole.log(\"Migration cancelled.\");\n\t\ttry {\n\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\tawait telemetry.publish({\n\t\t\t\ttype: \"cli_migrate\",\n\t\t\t\tpayload: {\n\t\t\t\t\toutcome: \"aborted\",\n\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {}\n\t\tprocess.exit(0);\n\t}\n\n\tspinner?.start(\"migrating...\");\n\tawait runMigrations();\n\tspinner.stop();\n\tconsole.log(\"🚀 migration was completed successfully!\");\n\ttry {\n\t\tconst telemetry = await createTelemetry(config);\n\t\tawait telemetry.publish({\n\t\t\ttype: \"cli_migrate\",\n\t\t\tpayload: {\n\t\t\t\toutcome: \"migrated\",\n\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t},\n\t\t});\n\t} catch {}\n\tprocess.exit(0);\n}\n\nexport const migrate = new Command(\"migrate\")\n\t.option(\n\t\t\"-c, --cwd <cwd>\",\n\t\t\"the working directory. defaults to the current directory.\",\n\t\tprocess.cwd(),\n\t)\n\t.option(\n\t\t\"--config <config>\",\n\t\t\"the path to the configuration file. defaults to the first configuration file found.\",\n\t)\n\t.option(\n\t\t\"-y, --yes\",\n\t\t\"automatically accept and run migrations without prompting\",\n\t\tfalse,\n\t)\n\t.option(\"--y\", \"(deprecated) same as --yes\", false)\n\t.action(migrateAction);\n","import Crypto from \"node:crypto\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\n\nexport const generateSecret = new Command(\"secret\").action(() => {\n\tconst secret = generateSecretHash();\n\tconsole.log(`\\nAdd the following to your .env file: \n${\n\tchalk.gray(\"# Auth Secret\") + chalk.green(`\\nBETTER_AUTH_SECRET=${secret}`)\n}`);\n});\n\nexport const generateSecretHash = () => {\n\treturn Crypto.randomBytes(32).toString(\"hex\");\n};\n","export async function fetchLatestVersion(\n\tpackageName: string,\n): Promise<string | null> {\n\tconst encoded = packageName.startsWith(\"@\")\n\t\t? `@${encodeURIComponent(packageName.slice(1))}`\n\t\t: encodeURIComponent(packageName);\n\ttry {\n\t\tconst response = await fetch(\n\t\t\t`https://registry.npmjs.org/${encoded}/latest`,\n\t\t);\n\t\tif (!response.ok) {\n\t\t\treturn null;\n\t\t}\n\t\tconst data = (await response.json()) as { version?: string };\n\t\treturn data.version ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n","import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport prompts from \"prompts\";\nimport * as semver from \"semver\";\nimport yoctoSpinner from \"yocto-spinner\";\nimport * as z from \"zod/v4\";\nimport { detectPackageManager } from \"../utils/check-package-managers\";\nimport { fetchLatestVersion } from \"../utils/fetch-latest-version\";\nimport { getPackageInfo } from \"../utils/get-package-info\";\nimport { installDependencies } from \"../utils/install-dependencies\";\n\nfunction isBetterAuthPackage(name: string): boolean {\n\treturn name === \"better-auth\" || name.startsWith(\"@better-auth/\");\n}\n\ninterface UpgradeEntry {\n\tname: string;\n\tcurrent: string;\n\tlatest: string;\n\tdepType: \"prod\" | \"dev\";\n}\n\nexport async function upgradeAction(opts: unknown) {\n\tconst options = z\n\t\t.object({\n\t\t\tcwd: z.string(),\n\t\t\tyes: z.boolean().optional(),\n\t\t})\n\t\t.parse(opts);\n\n\tconst cwd = path.resolve(options.cwd);\n\tif (!existsSync(cwd)) {\n\t\tconsole.error(`The directory \"${cwd}\" does not exist.`);\n\t\tprocess.exit(1);\n\t}\n\n\tlet packageJson: Record<string, any>;\n\ttry {\n\t\tpackageJson = getPackageInfo(cwd);\n\t} catch {\n\t\tconsole.error(\n\t\t\t`Could not read package.json in \"${cwd}\". Make sure you are in a project directory.`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst deps = packageJson.dependencies ?? {};\n\tconst devDeps = packageJson.devDependencies ?? {};\n\n\tconst candidates: {\n\t\tname: string;\n\t\tcurrent: string;\n\t\tdepType: \"prod\" | \"dev\";\n\t}[] = [];\n\n\tfor (const [name, version] of Object.entries(deps) as [string, string][]) {\n\t\tif (isBetterAuthPackage(name) && !version.startsWith(\"workspace:\")) {\n\t\t\tcandidates.push({ name, current: version, depType: \"prod\" });\n\t\t}\n\t}\n\tfor (const [name, version] of Object.entries(devDeps) as [string, string][]) {\n\t\tif (isBetterAuthPackage(name) && !version.startsWith(\"workspace:\")) {\n\t\t\tcandidates.push({ name, current: version, depType: \"dev\" });\n\t\t}\n\t}\n\n\tif (candidates.length === 0) {\n\t\tconsole.log(\"No better-auth packages found in this project.\");\n\t\treturn;\n\t}\n\n\tconst spinner = yoctoSpinner({ text: \"checking for updates...\" }).start();\n\n\tconst results = await Promise.allSettled(\n\t\tcandidates.map(async (c) => {\n\t\t\tconst latest = await fetchLatestVersion(c.name);\n\t\t\treturn { ...c, latest };\n\t\t}),\n\t);\n\n\tconst upgrades: UpgradeEntry[] = [];\n\tfor (const result of results) {\n\t\tif (result.status !== \"fulfilled\" || !result.value.latest) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst { name, current, latest, depType } = result.value;\n\t\tconst coerced = semver.coerce(current);\n\t\tif (coerced && semver.lt(coerced, latest)) {\n\t\t\tupgrades.push({ name, current, latest, depType });\n\t\t}\n\t}\n\n\tspinner.stop();\n\n\tif (upgrades.length === 0) {\n\t\tconsole.log(\"All better-auth packages are up to date.\");\n\t\treturn;\n\t}\n\n\tconsole.log(`\\nThe following packages can be upgraded:\\n`);\n\tfor (const u of upgrades) {\n\t\tconsole.log(\n\t\t\t` ${chalk.cyan(u.name)} ${chalk.gray(u.current)} ${chalk.white(\"→\")} ${chalk.green(u.latest)}`,\n\t\t);\n\t}\n\tconsole.log();\n\n\tlet confirmed = options.yes;\n\tif (!confirmed) {\n\t\tconst response = await prompts({\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"confirmed\",\n\t\t\tmessage: \"Do you want to upgrade these packages?\",\n\t\t\tinitial: true,\n\t\t});\n\t\tconfirmed = response.confirmed;\n\t}\n\n\tif (!confirmed) {\n\t\tconsole.log(\"Upgrade cancelled.\");\n\t\treturn;\n\t}\n\n\tconst { packageManager } = await detectPackageManager(cwd, packageJson);\n\n\tconst prodUpgrades = upgrades\n\t\t.filter((u) => u.depType === \"prod\")\n\t\t.map((u) => `${u.name}@${u.latest}`);\n\tconst devUpgrades = upgrades\n\t\t.filter((u) => u.depType === \"dev\")\n\t\t.map((u) => `${u.name}@${u.latest}`);\n\n\tconst installSpinner = yoctoSpinner({\n\t\ttext: \"installing updates...\",\n\t}).start();\n\n\ttry {\n\t\tif (prodUpgrades.length > 0) {\n\t\t\tawait installDependencies({\n\t\t\t\tdependencies: prodUpgrades,\n\t\t\t\tpackageManager,\n\t\t\t\tcwd,\n\t\t\t\ttype: \"prod\",\n\t\t\t});\n\t\t}\n\t\tif (devUpgrades.length > 0) {\n\t\t\tawait installDependencies({\n\t\t\t\tdependencies: devUpgrades,\n\t\t\t\tpackageManager,\n\t\t\t\tcwd,\n\t\t\t\ttype: \"dev\",\n\t\t\t});\n\t\t}\n\t\tinstallSpinner.stop();\n\t\tconsole.log(chalk.green(\"Successfully upgraded better-auth packages.\"));\n\t} catch (error) {\n\t\tinstallSpinner.stop();\n\t\tconsole.error(\"Failed to install updates:\", error);\n\t\tprocess.exit(1);\n\t}\n}\n\nexport const upgrade = new Command(\"upgrade\")\n\t.description(\"Upgrade better-auth packages to their latest versions\")\n\t.option(\n\t\t\"-c, --cwd <cwd>\",\n\t\t\"the working directory. defaults to the current directory.\",\n\t\tprocess.cwd(),\n\t)\n\t.option(\n\t\t\"-y, --yes\",\n\t\t\"automatically accept and upgrade without prompting\",\n\t\tfalse,\n\t)\n\t.action(upgradeAction);\n","#!/usr/bin/env node\n\nimport { Command } from \"commander\";\nimport { generate } from \"./commands/generate\";\nimport { info } from \"./commands/info\";\nimport { init } from \"./commands/init\";\nimport { login, logout } from \"./commands/login\";\nimport { mcp } from \"./commands/mcp\";\nimport { migrate } from \"./commands/migrate\";\nimport { generateSecret } from \"./commands/secret\";\nimport { upgrade } from \"./commands/upgrade\";\nimport { getPackageInfo } from \"./utils/get-package-info\";\n\nimport \"dotenv/config\";\n\n// handle exit\nprocess.on(\"SIGINT\", () => process.exit(0));\nprocess.on(\"SIGTERM\", () => process.exit(0));\n\nexport let cliVersion = \"1.1.2\";\n\nasync function main() {\n\tconst program = new Command(\"better-auth\");\n\n\tlet packageInfo: Record<string, any> = {};\n\ttry {\n\t\tpackageInfo = await getPackageInfo();\n\t\tcliVersion = packageInfo.version || \"1.1.2\";\n\t} catch {\n\t\t// it doesn't matter if we can't read the package.json file, we'll just use an empty object\n\t}\n\tprogram\n\t\t.addCommand(init)\n\t\t.addCommand(migrate)\n\t\t.addCommand(generate)\n\t\t.addCommand(generateSecret)\n\t\t.addCommand(info)\n\t\t.addCommand(login)\n\t\t.addCommand(logout)\n\t\t.addCommand(mcp)\n\t\t.addCommand(upgrade)\n\t\t.version(cliVersion)\n\t\t.description(\"Better Auth CLI\")\n\t\t.action(() => program.help());\n\n\tprogram.parse();\n}\n\nmain().catch((error) => {\n\tconsole.error(\"Error running Better Auth CLI:\", error);\n\tprocess.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAS,mBAAmB,KAAa,WAAqB;AAC7D,KAAI,UACH,QAAO;AAGR,QAAO,IACL,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,qBAAqB,QAAQ,CACrC,aAAa;;AAGhB,MAAa,wBAAyC,OAAO,EAC5D,SACA,MACA,cACK;CACL,MAAM,SAAS,cAAc,QAAQ;CACrC,MAAM,WAAW,QAAQ;CACzB,MAAM,eACL,QAAQ,SAAS;AAElB,KAAI,CAAC,aACJ,OAAM,IAAI,MACT,+LACA;CAEF,MAAM,YAAY,WAAW,SAAS;CAEtC,IAAI,OAAe,eAAe;EACjC;EACA;EACA;EACA,CAAC;CAEF,MAAM,eAAe,iBAAiB;EACrC,QAAQ;EACR,W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rB,UAAQ,MAAM,8BAA8B,MAAM;AAClD,UAAQ,KAAK,EAAE;;;AAIjB,MAAa,UAAU,IAAI,QAAQ,UAAU,CAC3C,YAAY,wDAAwD,CACpE,OACA,mBACA,6DACA,QAAQ,KAAK,CACb,CACA,OACA,aACA,sDACA,MACA,CACA,OAAO,cAAc;;;;AChKvB,QAAQ,GAAG,gBAAgB,QAAQ,KAAK,EAAE,CAAC;AAC3C,QAAQ,GAAG,iBAAiB,QAAQ,KAAK,EAAE,CAAC;AAE5C,IAAW,aAAa;AAExB,eAAe,OAAO;CACrB,MAAM,UAAU,IAAI,QAAQ,cAAc;CAE1C,IAAI,cAAmC,EAAE;AACzC,KAAI;AACH,gBAAc,MAAM,gBAAgB;AACpC,eAAa,YAAY,WAAW;SAC7B;AAGR,SACE,WAAW,KAAK,CAChB,WAAW,QAAQ,CACnB,WAAW,SAAS,CACpB,WAAW,eAAe,CAC1B,WAAW,KAAK,CAChB,WAAW,MAAM,CACjB,WAAW,OAAO,CAClB,WAAW,IAAI,CACf,WAAW,QAAQ,CACnB,QAAQ,WAAW,CACnB,YAAY,kBAAkB,CAC9B,aAAa,QAAQ,MAAM,CAAC;AAE9B,SAAQ,OAAO;;AAGhB,MAAM,CAAC,OAAO,UAAU;AACvB,SAAQ,MAAM,kCAAkC,MAAM;AACtD,SAAQ,KAAK,EAAE;EACd"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["generateSecretHash","fs","fs","possiblePaths","createMockAdapter","z","fs","getVersion","packageJsonStrategy","prettierFormat","z","getDatabaseCode","fs","log","fs","generateSecretHash","os","path","fs","z","z"],"sources":["../src/generators/drizzle.ts","../src/generators/kysely.ts","../src/utils/helper.ts","../src/utils/get-package-info.ts","../src/generators/prisma.ts","../src/generators/index.ts","../src/utils/add-cloudflare-modules.ts","../src/utils/add-svelte-kit-env-modules.ts","../src/utils/get-tsconfig-info.ts","../src/utils/get-config.ts","../src/commands/generate.ts","../src/commands/info.ts","../src/utils/check-package-managers.ts","../src/utils/config-paths.ts","../src/utils/install-dependencies.ts","../src/commands/init/configs/frameworks.config.ts","../src/commands/init/configs/social-providers.config.ts","../src/commands/init/utility/format.ts","../src/commands/init/utility/imports.ts","../src/commands/init/configs/temp-plugins.config.ts","../src/commands/init/utility/prompt.ts","../src/commands/init/utility/plugin.ts","../src/commands/init/utility/auth-config.ts","../src/commands/init/configs/databases.config.ts","../src/commands/init/utility/database.ts","../src/commands/init/generate-auth.ts","../src/commands/init/utility/auth-client-config.ts","../src/commands/init/generate-auth-client.ts","../src/commands/init/utility/env.ts","../src/commands/init/utility/framework.ts","../src/commands/init/index.ts","../src/commands/login.ts","../src/commands/mcp.ts","../src/commands/migrate.ts","../src/commands/secret.ts","../src/utils/fetch-latest-version.ts","../src/commands/upgrade.ts","../src/index.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { initGetFieldName, initGetModelName } from \"better-auth/adapters\";\nimport type { BetterAuthDBSchema, DBFieldAttribute } from \"better-auth/db\";\nimport { getAuthTables } from \"better-auth/db\";\nimport type { BetterAuthOptions } from \"better-auth/types\";\nimport prettier from \"prettier\";\nimport type { SchemaGenerator } from \"./types\";\n\nfunction convertToSnakeCase(str: string, camelCase?: boolean) {\n\tif (camelCase) {\n\t\treturn str;\n\t}\n\t// Handle consecutive capitals (like ID, URL, API) by treating them as a single word\n\treturn str\n\t\t.replace(/([A-Z]+)([A-Z][a-z])/g, \"$1_$2\") // Handle AABb -> AA_Bb\n\t\t.replace(/([a-z\\d])([A-Z])/g, \"$1_$2\") // Handle aBb -> a_Bb\n\t\t.toLowerCase();\n}\n\nexport const generateDrizzleSchema: SchemaGenerator = async ({\n\toptions,\n\tfile,\n\tadapter,\n}) => {\n\tconst tables = getAuthTables(options);\n\tconst filePath = file || \"./auth-schema.ts\";\n\tconst databaseType: \"sqlite\" | \"mysql\" | \"pg\" | undefined =\n\t\tadapter.options?.provider;\n\n\tif (!databaseType) {\n\t\tthrow new Error(\n\t\t\t`Database provider type is undefined during Drizzle schema generation. Please define a \\`provider\\` in the Drizzle adapter config. Read more at https://better-auth.com/docs/adapters/drizzle`,\n\t\t);\n\t}\n\tconst fileExist = existsSync(filePath);\n\n\tlet code: string = generateImport({\n\t\tdatabaseType,\n\t\ttables,\n\t\toptions,\n\t});\n\n\tconst getModelName = initGetModelName({\n\t\tschema: tables,\n\t\tusePlural: adapter.options?.adapterConfig?.usePlural,\n\t});\n\n\tconst getFieldName = initGetFieldName({\n\t\tschema: tables,\n\t\tusePlural: adapter.options?.adapterConfig?.usePlural,\n\t});\n\n\tfor (const tableKey in tables) {\n\t\tconst table = tables[tableKey]!;\n\t\tconst modelName = getModelName(tableKey);\n\t\tconst fields = table.fields;\n\n\t\tfunction getType(name: string, field: DBFieldAttribute) {\n\t\t\t// Not possible to reach, it's here to make typescript happy\n\t\t\tif (!databaseType) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Database provider type is undefined during Drizzle schema generation. Please define a \\`provider\\` in the Drizzle adapter config. Read more at https://better-auth.com/docs/adapters/drizzle`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tname = convertToSnakeCase(name, adapter.options?.camelCase);\n\t\t\tif (field.references?.field === \"id\") {\n\t\t\t\tconst useNumberId = options.advanced?.database?.generateId === \"serial\";\n\t\t\t\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\t\t\t\tif (useNumberId) {\n\t\t\t\t\tif (databaseType === \"pg\") {\n\t\t\t\t\t\treturn `integer('${name}')`;\n\t\t\t\t\t} else if (databaseType === \"mysql\") {\n\t\t\t\t\t\treturn `int('${name}')`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// using sqlite\n\t\t\t\t\t\treturn `integer('${name}')`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (useUUIDs && databaseType === \"pg\") {\n\t\t\t\t\treturn `uuid('${name}')`;\n\t\t\t\t}\n\t\t\t\tif (field.references.field) {\n\t\t\t\t\tif (databaseType === \"mysql\") {\n\t\t\t\t\t\treturn `varchar('${name}', { length: 36 })`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn `text('${name}')`;\n\t\t\t}\n\t\t\tconst type = field.type;\n\t\t\tif (typeof type !== \"string\") {\n\t\t\t\tif (Array.isArray(type) && type.every((x) => typeof x === \"string\")) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsqlite: `text({ enum: [${type.map((x) => `'${x}'`).join(\", \")}] })`,\n\t\t\t\t\t\tpg: `text('${name}', { enum: [${type.map((x) => `'${x}'`).join(\", \")}] })`,\n\t\t\t\t\t\tmysql: `mysqlEnum([${type.map((x) => `'${x}'`).join(\", \")}])`,\n\t\t\t\t\t}[databaseType];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\t`Invalid field type for field ${name} in model ${modelName}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst typeMap: Record<\n\t\t\t\ttypeof type,\n\t\t\t\tRecord<typeof databaseType, string>\n\t\t\t> = {\n\t\t\t\tstring: {\n\t\t\t\t\tsqlite: `text('${name}')`,\n\t\t\t\t\tpg: `text('${name}')`,\n\t\t\t\t\tmysql: field.unique\n\t\t\t\t\t\t? `varchar('${name}', { length: 255 })`\n\t\t\t\t\t\t: field.references\n\t\t\t\t\t\t\t? `varchar('${name}', { length: 36 })`\n\t\t\t\t\t\t\t: field.sortable\n\t\t\t\t\t\t\t\t? `varchar('${name}', { length: 255 })`\n\t\t\t\t\t\t\t\t: field.index\n\t\t\t\t\t\t\t\t\t? `varchar('${name}', { length: 255 })`\n\t\t\t\t\t\t\t\t\t: `text('${name}')`,\n\t\t\t\t},\n\t\t\t\tboolean: {\n\t\t\t\t\tsqlite: `integer('${name}', { mode: 'boolean' })`,\n\t\t\t\t\tpg: `boolean('${name}')`,\n\t\t\t\t\tmysql: `boolean('${name}')`,\n\t\t\t\t},\n\t\t\t\tnumber: {\n\t\t\t\t\tsqlite: `integer('${name}')`,\n\t\t\t\t\tpg: field.bigint\n\t\t\t\t\t\t? `bigint('${name}', { mode: 'number' })`\n\t\t\t\t\t\t: `integer('${name}')`,\n\t\t\t\t\tmysql: field.bigint\n\t\t\t\t\t\t? `bigint('${name}', { mode: 'number' })`\n\t\t\t\t\t\t: `int('${name}')`,\n\t\t\t\t},\n\t\t\t\tdate: {\n\t\t\t\t\tsqlite: `integer('${name}', { mode: 'timestamp_ms' })`,\n\t\t\t\t\tpg: `timestamp('${name}')`,\n\t\t\t\t\tmysql: `timestamp('${name}', { fsp: 3 })`,\n\t\t\t\t},\n\t\t\t\t\"number[]\": {\n\t\t\t\t\tsqlite: `text('${name}', { mode: \"json\" })`,\n\t\t\t\t\tpg: field.bigint\n\t\t\t\t\t\t? `bigint('${name}', { mode: 'number' }).array()`\n\t\t\t\t\t\t: `integer('${name}').array()`,\n\t\t\t\t\tmysql: `text('${name}', { mode: 'json' })`,\n\t\t\t\t},\n\t\t\t\t\"string[]\": {\n\t\t\t\t\tsqlite: `text('${name}', { mode: \"json\" })`,\n\t\t\t\t\tpg: `text('${name}').array()`,\n\t\t\t\t\tmysql: `text('${name}', { mode: \"json\" })`,\n\t\t\t\t},\n\t\t\t\tjson: {\n\t\t\t\t\tsqlite: `text('${name}', { mode: \"json\" })`,\n\t\t\t\t\tpg: `jsonb('${name}')`,\n\t\t\t\t\tmysql: `json('${name}', { mode: \"json\" })`,\n\t\t\t\t},\n\t\t\t} as const;\n\t\t\tconst dbTypeMap = (\n\t\t\t\ttypeMap as Record<string, Record<typeof databaseType, string>>\n\t\t\t)[type as string];\n\t\t\tif (!dbTypeMap) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unsupported field type '${field.type}' for field '${name}'.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn dbTypeMap[databaseType];\n\t\t}\n\n\t\tlet id: string = \"\";\n\n\t\tconst useNumberId = options.advanced?.database?.generateId === \"serial\";\n\t\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\n\t\tif (useUUIDs && databaseType === \"pg\") {\n\t\t\tid = `uuid(\"id\").default(sql\\`pg_catalog.gen_random_uuid()\\`).primaryKey()`;\n\t\t} else if (useNumberId) {\n\t\t\tif (databaseType === \"pg\") {\n\t\t\t\tid = `integer(\"id\").generatedByDefaultAsIdentity().primaryKey()`;\n\t\t\t} else if (databaseType === \"sqlite\") {\n\t\t\t\tid = `integer(\"id\", { mode: \"number\" }).primaryKey({ autoIncrement: true })`;\n\t\t\t} else {\n\t\t\t\tid = `int(\"id\").autoincrement().primaryKey()`;\n\t\t\t}\n\t\t} else {\n\t\t\tif (databaseType === \"mysql\") {\n\t\t\t\tid = `varchar('id', { length: 36 }).primaryKey()`;\n\t\t\t} else if (databaseType === \"pg\") {\n\t\t\t\tid = `text('id').primaryKey()`;\n\t\t\t} else {\n\t\t\t\tid = `text('id').primaryKey()`;\n\t\t\t}\n\t\t}\n\n\t\ttype Index = { type: \"uniqueIndex\" | \"index\"; name: string; on: string };\n\n\t\tconst indexes: Index[] = [];\n\n\t\tconst assignIndexes = (indexes: Index[]): string => {\n\t\t\tif (!indexes.length) return \"\";\n\n\t\t\tconst code: string[] = [`, (table) => [`];\n\n\t\t\tfor (const index of indexes) {\n\t\t\t\tcode.push(` ${index.type}(\"${index.name}\").on(table.${index.on}),`);\n\t\t\t}\n\n\t\t\tcode.push(`]`);\n\n\t\t\treturn code.join(\"\\n\");\n\t\t};\n\n\t\tconst schema = `export const ${modelName} = ${databaseType}Table(\"${convertToSnakeCase(\n\t\t\tmodelName,\n\t\t\tadapter.options?.camelCase,\n\t\t)}\", {\n\t\t\t\t\tid: ${id},\n\t\t\t\t\t${Object.keys(fields)\n\t\t\t\t\t\t.map((field) => {\n\t\t\t\t\t\t\tconst attr = fields[field]!;\n\t\t\t\t\t\t\tconst fieldName = attr.fieldName || field;\n\t\t\t\t\t\t\tlet type = getType(fieldName, attr);\n\n\t\t\t\t\t\t\tif (attr.index && !attr.unique) {\n\t\t\t\t\t\t\t\tindexes.push({\n\t\t\t\t\t\t\t\t\ttype: \"index\",\n\t\t\t\t\t\t\t\t\tname: `${modelName}_${fieldName}_idx`,\n\t\t\t\t\t\t\t\t\ton: fieldName,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else if (attr.index && attr.unique) {\n\t\t\t\t\t\t\t\tindexes.push({\n\t\t\t\t\t\t\t\t\ttype: \"uniqueIndex\",\n\t\t\t\t\t\t\t\t\tname: `${modelName}_${fieldName}_uidx`,\n\t\t\t\t\t\t\t\t\ton: fieldName,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tattr.defaultValue !== null &&\n\t\t\t\t\t\t\t\ttypeof attr.defaultValue !== \"undefined\"\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tif (typeof attr.defaultValue === \"function\") {\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tattr.type === \"date\" &&\n\t\t\t\t\t\t\t\t\t\tattr.defaultValue.toString().includes(\"new Date()\")\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tif (databaseType === \"sqlite\") {\n\t\t\t\t\t\t\t\t\t\t\ttype += `.default(sql\\`(cast(unixepoch('subsecond') * 1000 as integer))\\`)`;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ttype += `.defaultNow()`;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t// we are intentionally not adding .$defaultFn(${attr.defaultValue})\n\t\t\t\t\t\t\t\t\t\t// this is because if the defaultValue is a function, it could have\n\t\t\t\t\t\t\t\t\t\t// custom logic within that function that might not work in drizzle's context.\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (typeof attr.defaultValue === \"string\") {\n\t\t\t\t\t\t\t\t\ttype += `.default(\"${attr.defaultValue}\")`;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ttype += `.default(${attr.defaultValue})`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Add .$onUpdate() for fields with onUpdate property\n\t\t\t\t\t\t\t// Supported for all database types: PostgreSQL, MySQL, and SQLite\n\t\t\t\t\t\t\tif (attr.onUpdate && attr.type === \"date\") {\n\t\t\t\t\t\t\t\tif (typeof attr.onUpdate === \"function\") {\n\t\t\t\t\t\t\t\t\ttype += `.$onUpdate(${attr.onUpdate})`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn `${fieldName}: ${type}${attr.required ? \".notNull()\" : \"\"}${\n\t\t\t\t\t\t\t\tattr.unique ? \".unique()\" : \"\"\n\t\t\t\t\t\t\t}${\n\t\t\t\t\t\t\t\tattr.references\n\t\t\t\t\t\t\t\t\t? `.references(()=> ${getModelName(\n\t\t\t\t\t\t\t\t\t\t\tattr.references.model,\n\t\t\t\t\t\t\t\t\t\t)}.${getFieldName({ model: attr.references.model, field: attr.references.field })}, { onDelete: '${\n\t\t\t\t\t\t\t\t\t\t\tattr.references.onDelete || \"cascade\"\n\t\t\t\t\t\t\t\t\t\t}' })`\n\t\t\t\t\t\t\t\t\t: \"\"\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\",\\n \")}\n\t\t\t\t\t}${assignIndexes(indexes)});`;\n\t\tcode += `\\n${schema}\\n`;\n\t}\n\n\tlet relationsString: string = \"\";\n\tfor (const tableKey in tables) {\n\t\tconst table = tables[tableKey]!;\n\t\tconst modelName = getModelName(tableKey);\n\n\t\ttype Relation = {\n\t\t\t/**\n\t\t\t * The key of the relation that will be defined in the Drizzle schema.\n\t\t\t * For \"one\" relations: singular (e.g., \"user\")\n\t\t\t * For \"many\" relations: plural (e.g., \"posts\")\n\t\t\t */\n\t\t\tkey: string;\n\t\t\t/**\n\t\t\t * The model name being referenced.\n\t\t\t */\n\t\t\tmodel: string;\n\t\t\t/**\n\t\t\t * The type of the relation: \"one\" (many-to-one) or \"many\" (one-to-many).\n\t\t\t */\n\t\t\ttype: \"one\" | \"many\";\n\t\t\t/**\n\t\t\t * Foreign key field name and reference details (only for \"one\" relations).\n\t\t\t */\n\t\t\treference?: {\n\t\t\t\tfield: string;\n\t\t\t\treferences: string;\n\t\t\t\tfieldName: string; // Original field name for generating unique relation export names\n\t\t\t};\n\t\t};\n\n\t\tconst oneRelations: Relation[] = [];\n\t\tconst manyRelations: Relation[] = [];\n\t\t// Set to track \"many\" relations by key to prevent duplicates\n\t\tconst manyRelationsSet = new Set<string>();\n\n\t\t// 1. Find all foreign keys in THIS table (creates \"one\" relations)\n\t\tconst fields = Object.entries(table.fields);\n\t\tconst foreignFields = fields.filter(([_, field]) => field.references);\n\n\t\tfor (const [fieldName, field] of foreignFields) {\n\t\t\tconst referencedModel = field.references!.model;\n\t\t\tconst relationKey = getModelName(referencedModel);\n\t\t\tconst fieldRef = `${getModelName(tableKey)}.${getFieldName({ model: tableKey, field: fieldName })}`;\n\t\t\tconst referenceRef = `${getModelName(referencedModel)}.${getFieldName({ model: referencedModel, field: field.references!.field || \"id\" })}`;\n\n\t\t\t// Create a separate relation for each foreign key\n\t\t\toneRelations.push({\n\t\t\t\tkey: relationKey,\n\t\t\t\tmodel: getModelName(referencedModel),\n\t\t\t\ttype: \"one\",\n\t\t\t\treference: {\n\t\t\t\t\tfield: fieldRef,\n\t\t\t\t\treferences: referenceRef,\n\t\t\t\t\tfieldName: fieldName,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// 2. Find all OTHER tables that reference THIS table (creates \"many\" relations)\n\t\tconst otherModels = Object.entries(tables).filter(\n\t\t\t([modelName]) => modelName !== tableKey,\n\t\t);\n\n\t\t// Map to track relations by model name to determine if unique or many\n\t\tconst modelRelationsMap = new Map<\n\t\t\tstring,\n\t\t\t{\n\t\t\t\tmodelName: string;\n\t\t\t\thasUnique: boolean;\n\t\t\t\thasMany: boolean;\n\t\t\t}\n\t\t>();\n\n\t\tfor (const [modelName, otherTable] of otherModels) {\n\t\t\tconst foreignKeysPointingHere = Object.entries(otherTable.fields).filter(\n\t\t\t\t([_, field]) =>\n\t\t\t\t\tfield.references?.model === tableKey ||\n\t\t\t\t\tfield.references?.model === getModelName(tableKey),\n\t\t\t);\n\n\t\t\tif (foreignKeysPointingHere.length === 0) continue;\n\n\t\t\t// Check if any foreign key is unique\n\t\t\tconst hasUnique = foreignKeysPointingHere.some(\n\t\t\t\t([_, field]) => !!field.unique,\n\t\t\t);\n\t\t\tconst hasMany = foreignKeysPointingHere.some(\n\t\t\t\t([_, field]) => !field.unique,\n\t\t\t);\n\n\t\t\tmodelRelationsMap.set(modelName, {\n\t\t\t\tmodelName,\n\t\t\t\thasUnique,\n\t\t\t\thasMany,\n\t\t\t});\n\t\t}\n\n\t\t// Add relations, deduplicating by relationKey\n\t\tfor (const { modelName, hasMany } of modelRelationsMap.values()) {\n\t\t\t// Determine relation type: if all are unique, it's \"one\", otherwise \"many\"\n\t\t\tconst relationType = hasMany ? \"many\" : \"one\";\n\t\t\tlet relationKey = getModelName(modelName);\n\n\t\t\t// We have to apply this after checking if they have usePlural because otherwise they will end up seeing:\n\t\t\t/* cspell:disable-next-line */\n\t\t\t// \"sesionss\", or \"accountss\" - double s's.\n\t\t\tif (\n\t\t\t\t!adapter.options?.adapterConfig?.usePlural &&\n\t\t\t\trelationType === \"many\"\n\t\t\t) {\n\t\t\t\trelationKey = `${relationKey}s`;\n\t\t\t}\n\n\t\t\t// Only add if we haven't seen this key before\n\t\t\tif (!manyRelationsSet.has(relationKey)) {\n\t\t\t\tmanyRelationsSet.add(relationKey);\n\t\t\t\tmanyRelations.push({\n\t\t\t\t\tkey: relationKey,\n\t\t\t\t\tmodel: getModelName(modelName),\n\t\t\t\t\ttype: relationType,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Group \"one\" relations by referenced model to detect duplicates\n\t\tconst relationsByModel = new Map<string, Relation[]>();\n\t\tfor (const relation of oneRelations) {\n\t\t\tif (relation.reference) {\n\t\t\t\tconst modelKey = relation.key;\n\t\t\t\tif (!relationsByModel.has(modelKey)) {\n\t\t\t\t\trelationsByModel.set(modelKey, []);\n\t\t\t\t}\n\t\t\t\trelationsByModel.get(modelKey)!.push(relation);\n\t\t\t}\n\t\t}\n\n\t\t// Separate relations with duplicates (same model) from those without\n\t\tconst duplicateRelations: Relation[] = [];\n\t\tconst singleRelations: Relation[] = [];\n\n\t\tfor (const [_modelKey, relations] of relationsByModel.entries()) {\n\t\t\tif (relations.length > 1) {\n\t\t\t\t// Multiple relations to the same model - these need field-specific naming\n\t\t\t\tduplicateRelations.push(...relations);\n\t\t\t} else {\n\t\t\t\t// Single relation to this model - can be combined with others\n\t\t\t\tsingleRelations.push(relations[0]!);\n\t\t\t}\n\t\t}\n\n\t\t// Generate field-specific exports for duplicate relations\n\t\tfor (const relation of duplicateRelations) {\n\t\t\tif (relation.reference) {\n\t\t\t\tconst fieldName = relation.reference.fieldName;\n\t\t\t\tconst relationExportName = `${modelName}${fieldName.charAt(0).toUpperCase() + fieldName.slice(1)}Relations`;\n\n\t\t\t\tconst tableRelation = `export const ${relationExportName} = relations(${getModelName(\n\t\t\t\t\ttable.modelName,\n\t\t\t\t)}, ({ one }) => ({\n\t\t\t\t${relation.key}: one(${relation.model}, {\n\t\t\t\t\tfields: [${relation.reference.field}],\n\t\t\t\t\treferences: [${relation.reference.references}],\n\t\t\t\t})\n\t\t\t}))`;\n\n\t\t\t\trelationsString += `\\n${tableRelation}\\n`;\n\t\t\t}\n\t\t}\n\n\t\t// Combine all single \"one\" relations and \"many\" relations into exports\n\t\tconst hasOne = singleRelations.length > 0;\n\t\tconst hasMany = manyRelations.length > 0;\n\n\t\tif (hasOne && hasMany) {\n\t\t\t// Both \"one\" and \"many\" relations exist - combine in one export\n\t\t\tconst tableRelation = `export const ${modelName}Relations = relations(${getModelName(\n\t\t\t\ttable.modelName,\n\t\t\t)}, ({ one, many }) => ({\n\t\t\t\t${singleRelations\n\t\t\t\t\t.map((relation) =>\n\t\t\t\t\t\trelation.reference\n\t\t\t\t\t\t\t? ` ${relation.key}: one(${relation.model}, {\n\t\t\t\t\tfields: [${relation.reference.field}],\n\t\t\t\t\treferences: [${relation.reference.references}],\n\t\t\t\t})`\n\t\t\t\t\t\t\t: \"\",\n\t\t\t\t\t)\n\t\t\t\t\t.filter((x) => x !== \"\")\n\t\t\t\t\t.join(\",\\n \")}${\n\t\t\t\t\tsingleRelations.length > 0 && manyRelations.length > 0 ? \",\" : \"\"\n\t\t\t\t}\n\t\t\t\t${manyRelations\n\t\t\t\t\t.map(({ key, model }) => ` ${key}: many(${model})`)\n\t\t\t\t\t.join(\",\\n \")}\n\t\t\t}))`;\n\n\t\t\trelationsString += `\\n${tableRelation}\\n`;\n\t\t} else if (hasOne) {\n\t\t\t// Only \"one\" relations exist\n\t\t\tconst tableRelation = `export const ${modelName}Relations = relations(${getModelName(\n\t\t\t\ttable.modelName,\n\t\t\t)}, ({ one }) => ({\n\t\t\t\t${singleRelations\n\t\t\t\t\t.map((relation) =>\n\t\t\t\t\t\trelation.reference\n\t\t\t\t\t\t\t? ` ${relation.key}: one(${relation.model}, {\n\t\t\t\t\tfields: [${relation.reference.field}],\n\t\t\t\t\treferences: [${relation.reference.references}],\n\t\t\t\t})`\n\t\t\t\t\t\t\t: \"\",\n\t\t\t\t\t)\n\t\t\t\t\t.filter((x) => x !== \"\")\n\t\t\t\t\t.join(\",\\n \")}\n\t\t\t}))`;\n\n\t\t\trelationsString += `\\n${tableRelation}\\n`;\n\t\t} else if (hasMany) {\n\t\t\t// Only \"many\" relations exist\n\t\t\tconst tableRelation = `export const ${modelName}Relations = relations(${getModelName(\n\t\t\t\ttable.modelName,\n\t\t\t)}, ({ many }) => ({\n\t\t\t\t${manyRelations\n\t\t\t\t\t.map(({ key, model }) => ` ${key}: many(${model})`)\n\t\t\t\t\t.join(\",\\n \")}\n\t\t\t}))`;\n\n\t\t\trelationsString += `\\n${tableRelation}\\n`;\n\t\t}\n\t}\n\tcode += `\\n${relationsString}`;\n\n\tconst formattedCode = await prettier.format(code, {\n\t\tparser: \"typescript\",\n\t});\n\treturn {\n\t\tcode: formattedCode,\n\t\tfileName: filePath,\n\t\toverwrite: fileExist,\n\t};\n};\n\nfunction generateImport({\n\tdatabaseType,\n\ttables,\n\toptions,\n}: {\n\tdatabaseType: \"sqlite\" | \"mysql\" | \"pg\";\n\ttables: BetterAuthDBSchema;\n\toptions: BetterAuthOptions;\n}) {\n\tconst rootImports: string[] = [\"relations\"];\n\tconst coreImports: string[] = [];\n\n\tlet hasBigint = false;\n\tlet hasJson = false;\n\n\tfor (const table of Object.values(tables)) {\n\t\tfor (const field of Object.values(table.fields)) {\n\t\t\tif (field.bigint) hasBigint = true;\n\t\t\tif (field.type === \"json\") hasJson = true;\n\t\t}\n\t\tif (hasJson && hasBigint) break;\n\t}\n\n\tconst useNumberId = options.advanced?.database?.generateId === \"serial\";\n\n\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\n\tcoreImports.push(`${databaseType}Table`);\n\tcoreImports.push(\n\t\tdatabaseType === \"mysql\"\n\t\t\t? \"varchar, text\"\n\t\t\t: databaseType === \"pg\"\n\t\t\t\t? \"text\"\n\t\t\t\t: \"text\",\n\t);\n\tcoreImports.push(\n\t\thasBigint ? (databaseType !== \"sqlite\" ? \"bigint\" : \"\") : \"\",\n\t);\n\tcoreImports.push(databaseType !== \"sqlite\" ? \"timestamp, boolean\" : \"\");\n\tif (databaseType === \"mysql\") {\n\t\t// Only include int for MySQL if actually needed\n\t\tconst hasNonBigintNumber = Object.values(tables).some((table) =>\n\t\t\tObject.values(table.fields).some(\n\t\t\t\t(field) =>\n\t\t\t\t\t(field.type === \"number\" || field.type === \"number[]\") &&\n\t\t\t\t\t!field.bigint,\n\t\t\t),\n\t\t);\n\t\tconst needsInt = useNumberId || hasNonBigintNumber;\n\t\tif (needsInt) {\n\t\t\tcoreImports.push(\"int\");\n\t\t}\n\t\tconst hasEnum = Object.values(tables).some((table) =>\n\t\t\tObject.values(table.fields).some(\n\t\t\t\t(field) =>\n\t\t\t\t\ttypeof field.type !== \"string\" &&\n\t\t\t\t\tArray.isArray(field.type) &&\n\t\t\t\t\tfield.type.every((x) => typeof x === \"string\"),\n\t\t\t),\n\t\t);\n\t\tif (hasEnum) {\n\t\t\tcoreImports.push(\"mysqlEnum\");\n\t\t}\n\t} else if (databaseType === \"pg\") {\n\t\tif (useUUIDs) {\n\t\t\trootImports.push(\"sql\");\n\t\t}\n\n\t\t// Only include integer for PG if actually needed\n\t\tconst hasNonBigintNumber = Object.values(tables).some((table) =>\n\t\t\tObject.values(table.fields).some(\n\t\t\t\t(field) =>\n\t\t\t\t\t(field.type === \"number\" || field.type === \"number[]\") &&\n\t\t\t\t\t!field.bigint,\n\t\t\t),\n\t\t);\n\t\tconst hasFkToId = Object.values(tables).some((table) =>\n\t\t\tObject.values(table.fields).some(\n\t\t\t\t(field) => field.references?.field === \"id\",\n\t\t\t),\n\t\t);\n\t\t// handles the references field with useNumberId\n\t\tconst needsInteger =\n\t\t\thasNonBigintNumber ||\n\t\t\t(options.advanced?.database?.generateId === \"serial\" && hasFkToId);\n\t\tif (needsInteger) {\n\t\t\tcoreImports.push(\"integer\");\n\t\t}\n\t} else {\n\t\tcoreImports.push(\"integer\");\n\t}\n\tif (databaseType === \"pg\" && useUUIDs) {\n\t\tcoreImports.push(\"uuid\");\n\t}\n\n\t//handle json last on the import order\n\tif (hasJson) {\n\t\tif (databaseType === \"pg\") coreImports.push(\"jsonb\");\n\t\tif (databaseType === \"mysql\") coreImports.push(\"json\");\n\t\t// sqlite uses text for JSON, so there's no need to handle this case\n\t}\n\n\t// Add sql import for SQLite timestamps with defaultNow\n\tconst hasSQLiteTimestamp =\n\t\tdatabaseType === \"sqlite\" &&\n\t\tObject.values(tables).some((table) =>\n\t\t\tObject.values(table.fields).some(\n\t\t\t\t(field) =>\n\t\t\t\t\tfield.type === \"date\" &&\n\t\t\t\t\tfield.defaultValue &&\n\t\t\t\t\ttypeof field.defaultValue === \"function\" &&\n\t\t\t\t\tfield.defaultValue.toString().includes(\"new Date()\"),\n\t\t\t),\n\t\t);\n\n\tif (hasSQLiteTimestamp) {\n\t\trootImports.push(\"sql\");\n\t}\n\n\t//handle indexes\n\tconst hasIndexes = Object.values(tables).some((table) =>\n\t\tObject.values(table.fields).some((field) => field.index && !field.unique),\n\t);\n\tconst hasUniqueIndexes = Object.values(tables).some((table) =>\n\t\tObject.values(table.fields).some((field) => field.unique && field.index),\n\t);\n\tif (hasIndexes) {\n\t\tcoreImports.push(\"index\");\n\t}\n\tif (hasUniqueIndexes) {\n\t\tcoreImports.push(\"uniqueIndex\");\n\t}\n\n\treturn `${rootImports.length > 0 ? `import { ${rootImports.join(\", \")} } from \"drizzle-orm\";\\n` : \"\"}import { ${coreImports\n\t\t.map((x) => x.trim())\n\t\t.filter((x) => x !== \"\")\n\t\t.join(\", \")} } from \"drizzle-orm/${databaseType}-core\";\\n`;\n}\n","import { getMigrations } from \"better-auth/db/migration\";\nimport type { SchemaGenerator } from \"./types\";\n\nexport const generateKyselySchema: SchemaGenerator = async ({\n\toptions,\n\tfile,\n}) => {\n\tconst { compileMigrations } = await getMigrations(options);\n\tconst migrations = await compileMigrations();\n\treturn {\n\t\tcode: migrations.trim() === \";\" ? \"\" : migrations,\n\t\tfileName:\n\t\t\tfile ||\n\t\t\t`./better-auth_migrations/${new Date()\n\t\t\t\t.toISOString()\n\t\t\t\t.replace(/:/g, \"-\")}.sql`,\n\t};\n};\n","import { spawn } from \"node:child_process\";\nimport Crypto from \"node:crypto\";\n\ntype Success<T> = {\n\tdata: T;\n\terror: null;\n};\n\ntype Failure<E> = {\n\tdata: null;\n\terror: E;\n};\n\nexport type Result<T, E = Error> = Success<T> | Failure<E>;\n\nexport async function tryCatch<T, E = Error>(\n\tpromise: Promise<T>,\n): Promise<Result<T, E>> {\n\ttry {\n\t\tconst data = await promise;\n\t\treturn { data, error: null };\n\t} catch (error) {\n\t\treturn { data: null, error: error as E };\n\t}\n}\n\nexport function enterAlternateScreen() {\n\tprocess.stdout.write(\"\\u001B[?1049h\");\n\tprocess.stdout.write(\"\\u001B[2J\"); // Clear screen\n\tprocess.stdout.write(\"\\u001B[H\"); // Move cursor to home\n}\n\nexport function exitAlternateScreen() {\n\tprocess.stdout.write(\"\\u001B[?1049l\");\n}\n\nexport const generateSecretHash = () => {\n\treturn Crypto.randomBytes(16).toString(\"hex\");\n};\n\nexport const spawnCommand = (cmd: string, cwd: string = process.cwd()) =>\n\tnew Promise<void>((resolve, reject) => {\n\t\tconst child = spawn(cmd, {\n\t\t\tcwd,\n\t\t\tstdio: \"inherit\",\n\t\t\tshell: true,\n\t\t});\n\t\tchild.on(\"close\", (code, signal) => {\n\t\t\tif (code !== 0 && code !== null) {\n\t\t\t\treject(new Error(`Exited with code ${code}`));\n\t\t\t} else if (signal) {\n\t\t\t\treject(new Error(`Killed with signal ${signal}`));\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t\tchild.on(\"error\", reject);\n\t});\n","import { readFileSync } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { tryCatch } from \"./helper\";\n\nexport function getPackageInfo(cwd?: string) {\n\tconst packageJsonPath = cwd\n\t\t? path.join(cwd, \"package.json\")\n\t\t: path.join(\"package.json\");\n\treturn JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n}\n\nexport function getPrismaVersion(cwd?: string): number | null {\n\ttry {\n\t\tconst packageInfo = getPackageInfo(cwd);\n\t\tconst prismaVersion =\n\t\t\tpackageInfo.dependencies?.prisma ||\n\t\t\tpackageInfo.devDependencies?.prisma ||\n\t\t\tpackageInfo.dependencies?.[\"@prisma/client\"] ||\n\t\t\tpackageInfo.devDependencies?.[\"@prisma/client\"];\n\n\t\tif (!prismaVersion) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Extract major version number from version string\n\t\t// Handles versions like \"^5.0.0\", \"~7.1.0\", \"7.0.0\", etc.\n\t\tconst match = prismaVersion.match(/(\\d+)/);\n\t\treturn match ? parseInt(match[1], 10) : null;\n\t} catch {\n\t\t// If package.json doesn't exist or can't be read, return null\n\t\treturn null;\n\t}\n}\n\n/**\n * Checks if a package has a specific dependency.\n *\n * @param packageJson The package.json object\n * @param dependency The dependency to check for\n * @returns true if the package has the dependency\n */\nexport function hasDependency(packageJson: any, dependency: string) {\n\tlet hasDependency = false;\n\n\tif (\n\t\tpackageJson.dependencies?.[dependency] ||\n\t\tpackageJson.devDependencies?.[dependency] ||\n\t\tpackageJson.peerDependencies?.[dependency] ||\n\t\tpackageJson.optionalDependencies?.[dependency]\n\t) {\n\t\thasDependency = true;\n\t}\n\n\treturn hasDependency;\n}\n\n/**\n * Checks if a directory is a monorepo root by looking for common monorepo indicators.\n *\n * @param dir Directory to check\n * @returns true if the directory appears to be a monorepo root\n */\nasync function isMonorepoRoot(dir: string) {\n\tconst { data: files } = await tryCatch(fs.readdir(dir, \"utf-8\"));\n\tif (!files) return false;\n\n\t// Check for pnpm workspace\n\tif (files.includes(\"pnpm-workspace.yaml\")) {\n\t\treturn true;\n\t}\n\n\t// Check for yarn/npm workspaces in package.json\n\tif (files.includes(\"package.json\")) {\n\t\tconst packageJsonPath = path.join(dir, \"package.json\");\n\t\tconst { data } = await tryCatch(fs.readFile(packageJsonPath, \"utf-8\"));\n\t\tif (data) {\n\t\t\ttry {\n\t\t\t\tconst packageJson = JSON.parse(data);\n\t\t\t\t// Check for workspaces field (npm/yarn workspaces)\n\t\t\t\t// Workspaces can be an array or an object\n\t\t\t\tif (\n\t\t\t\t\tpackageJson.workspaces &&\n\t\t\t\t\t(Array.isArray(packageJson.workspaces) ||\n\t\t\t\t\t\ttypeof packageJson.workspaces === \"object\")\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Ignore JSON parse errors\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check for other monorepo indicators\n\tconst monorepoIndicators = [\n\t\t\"lerna.json\", // Lerna\n\t\t/* cSpell:disable */\n\t\t\"turbo.json\", // Turborepo\n\t\t\"nx.json\", // Nx\n\t\t\"rush.json\", // Rush\n\t];\n\n\treturn monorepoIndicators.some((indicator) => files.includes(indicator));\n}\n\n/**\n * Finds the monorepo root by walking up the directory tree.\n *\n * @param startDir Starting directory\n * @returns Path to monorepo root, or null if not found\n */\nexport async function findMonorepoRoot(\n\tstartDir: string,\n): Promise<string | null> {\n\tlet currentDir = path.resolve(startDir);\n\tconst root = path.parse(currentDir).root;\n\n\twhile (currentDir !== root) {\n\t\tif (await isMonorepoRoot(currentDir)) {\n\t\t\treturn currentDir;\n\t\t}\n\t\tconst parentDir = path.dirname(currentDir);\n\t\tif (parentDir === currentDir) {\n\t\t\tbreak;\n\t\t}\n\t\tcurrentDir = parentDir;\n\t}\n\n\treturn null;\n}\n","import { existsSync } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { capitalizeFirstLetter } from \"@better-auth/core/utils/string\";\nimport { produceSchema } from \"@mrleebo/prisma-ast\";\nimport { initGetFieldName, initGetModelName } from \"better-auth/adapters\";\nimport type { DBFieldType } from \"better-auth/db\";\nimport { getAuthTables } from \"better-auth/db\";\nimport { getPrismaVersion } from \"../utils/get-package-info\";\nimport type { SchemaGenerator } from \"./types\";\n\nexport const generatePrismaSchema: SchemaGenerator = async ({\n\tadapter,\n\toptions,\n\tfile,\n}) => {\n\tconst provider: \"sqlite\" | \"postgresql\" | \"mysql\" | \"mongodb\" =\n\t\tadapter.options?.provider || \"postgresql\";\n\tconst tables = getAuthTables(options);\n\tconst filePath = file || \"./prisma/schema.prisma\";\n\tconst schemaPrismaExist = existsSync(path.join(process.cwd(), filePath));\n\n\tconst getModelName = initGetModelName({\n\t\tschema: getAuthTables(options),\n\t\tusePlural: adapter.options?.adapterConfig?.usePlural,\n\t});\n\tconst getFieldName = initGetFieldName({\n\t\tschema: getAuthTables(options),\n\t\tusePlural: false,\n\t});\n\n\tlet schemaPrisma = \"\";\n\tif (schemaPrismaExist) {\n\t\tschemaPrisma = await fs.readFile(\n\t\t\tpath.join(process.cwd(), filePath),\n\t\t\t\"utf-8\",\n\t\t);\n\t} else {\n\t\tschemaPrisma = getNewPrisma(provider, process.cwd());\n\t}\n\n\t// Update generator and datasource blocks for Prisma v7+ in existing schemas\n\tconst prismaVersion = getPrismaVersion(process.cwd());\n\tif (prismaVersion && prismaVersion >= 7 && schemaPrismaExist) {\n\t\tschemaPrisma = produceSchema(schemaPrisma, (builder) => {\n\t\t\tconst generator: any = builder.findByType(\"generator\", {\n\t\t\t\tname: \"client\",\n\t\t\t});\n\t\t\tif (generator && generator.properties) {\n\t\t\t\tconst providerProp = generator.properties.find(\n\t\t\t\t\t(prop: any) => prop.type === \"assignment\" && prop.key === \"provider\",\n\t\t\t\t);\n\t\t\t\tif (providerProp && providerProp.value === '\"prisma-client-js\"') {\n\t\t\t\t\tproviderProp.value = '\"prisma-client\"';\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Remove url from datasource block (now configured in prisma.config.ts)\n\t\t\tconst datasource: any = builder.findByType(\"datasource\", {\n\t\t\t\tname: \"db\",\n\t\t\t});\n\t\t\tif (datasource && datasource.properties) {\n\t\t\t\tconst urlIndex = datasource.properties.findIndex(\n\t\t\t\t\t(prop: any) => prop.type === \"assignment\" && prop.key === \"url\",\n\t\t\t\t);\n\t\t\t\tif (urlIndex !== -1) {\n\t\t\t\t\tdatasource.properties.splice(urlIndex, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tconst manyToManyRelations = new Map();\n\n\tfor (const table in tables) {\n\t\tconst fields = tables[table]?.fields;\n\t\tfor (const field in fields) {\n\t\t\tconst attr = fields[field]!;\n\t\t\tif (attr.references) {\n\t\t\t\tconst referencedOriginalModel = attr.references.model;\n\t\t\t\tconst referencedCustomModel =\n\t\t\t\t\ttables[referencedOriginalModel]?.modelName || referencedOriginalModel;\n\t\t\t\tconst referencedModelNameCap = capitalizeFirstLetter(\n\t\t\t\t\tgetModelName(referencedCustomModel),\n\t\t\t\t);\n\n\t\t\t\tif (!manyToManyRelations.has(referencedModelNameCap)) {\n\t\t\t\t\tmanyToManyRelations.set(referencedModelNameCap, new Set());\n\t\t\t\t}\n\n\t\t\t\tconst currentCustomModel = tables[table]?.modelName || table;\n\t\t\t\tconst currentModelNameCap = capitalizeFirstLetter(\n\t\t\t\t\tgetModelName(currentCustomModel),\n\t\t\t\t);\n\n\t\t\t\tmanyToManyRelations\n\t\t\t\t\t.get(referencedModelNameCap)\n\t\t\t\t\t.add(currentModelNameCap);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst indexedFields = new Map<string, string[]>();\n\tfor (const table in tables) {\n\t\tconst fields = tables[table]?.fields;\n\t\tconst customModelName = tables[table]?.modelName || table;\n\t\tconst modelName = capitalizeFirstLetter(getModelName(customModelName));\n\t\tindexedFields.set(modelName, []);\n\n\t\tfor (const field in fields) {\n\t\t\tconst attr = fields[field]!;\n\t\t\tif (attr.index && !attr.unique) {\n\t\t\t\tconst fieldName = attr.fieldName || field;\n\t\t\t\tindexedFields.get(modelName)!.push(fieldName);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst schema = produceSchema(schemaPrisma, (builder) => {\n\t\tfor (const table in tables) {\n\t\t\tconst originalTableName = table;\n\t\t\tconst customModelName = tables[table]?.modelName || table;\n\t\t\tconst modelName = capitalizeFirstLetter(getModelName(customModelName));\n\t\t\tconst fields = tables[table]?.fields;\n\t\t\tfunction getType({\n\t\t\t\tisBigint,\n\t\t\t\tisOptional,\n\t\t\t\ttype,\n\t\t\t}: {\n\t\t\t\ttype: DBFieldType;\n\t\t\t\tisOptional: boolean;\n\t\t\t\tisBigint: boolean;\n\t\t\t}) {\n\t\t\t\tif (type === \"string\") {\n\t\t\t\t\treturn isOptional ? \"String?\" : \"String\";\n\t\t\t\t}\n\t\t\t\tif (type === \"number\" && isBigint) {\n\t\t\t\t\treturn isOptional ? \"BigInt?\" : \"BigInt\";\n\t\t\t\t}\n\t\t\t\tif (type === \"number\") {\n\t\t\t\t\treturn isOptional ? \"Int?\" : \"Int\";\n\t\t\t\t}\n\t\t\t\tif (type === \"boolean\") {\n\t\t\t\t\treturn isOptional ? \"Boolean?\" : \"Boolean\";\n\t\t\t\t}\n\t\t\t\tif (type === \"date\") {\n\t\t\t\t\treturn isOptional ? \"DateTime?\" : \"DateTime\";\n\t\t\t\t}\n\t\t\t\tif (type === \"json\") {\n\t\t\t\t\tif (provider === \"sqlite\" || provider === \"mysql\") {\n\t\t\t\t\t\treturn isOptional ? \"String?\" : \"String\";\n\t\t\t\t\t}\n\t\t\t\t\treturn isOptional ? \"Json?\" : \"Json\";\n\t\t\t\t}\n\t\t\t\tif (type === \"string[]\") {\n\t\t\t\t\t// SQLite and MySQL don't support array of strings, so we use string instead\n\t\t\t\t\t// adapter should handle JSON.stringify and JSON.parse conversion for these fields\n\t\t\t\t\tif (provider === \"sqlite\" || provider === \"mysql\") {\n\t\t\t\t\t\treturn isOptional ? \"String?\" : \"String\";\n\t\t\t\t\t}\n\t\t\t\t\treturn \"String[]\";\n\t\t\t\t}\n\t\t\t\tif (type === \"number[]\") {\n\t\t\t\t\t// SQLite and MySQL don't support array of numbers, so we use int instead\n\t\t\t\t\t// adapter should handle JSON.stringify and JSON.parse conversion for these fields\n\t\t\t\t\tif (provider === \"sqlite\" || provider === \"mysql\") {\n\t\t\t\t\t\treturn \"String\";\n\t\t\t\t\t}\n\t\t\t\t\treturn \"Int[]\";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst prismaModel = builder.findByType(\"model\", {\n\t\t\t\tname: modelName,\n\t\t\t});\n\n\t\t\tif (!prismaModel) {\n\t\t\t\tif (provider === \"mongodb\") {\n\t\t\t\t\t// Mongo DB doesn't support auto increment, so just use their normal _id.\n\t\t\t\t\tbuilder\n\t\t\t\t\t\t.model(modelName)\n\t\t\t\t\t\t.field(\"id\", \"String\")\n\t\t\t\t\t\t.attribute(\"id\")\n\t\t\t\t\t\t.attribute(`map(\"_id\")`);\n\t\t\t\t} else {\n\t\t\t\t\tconst useNumberId =\n\t\t\t\t\t\toptions.advanced?.database?.generateId === \"serial\";\n\t\t\t\t\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\t\t\t\t\tif (useNumberId) {\n\t\t\t\t\t\tbuilder\n\t\t\t\t\t\t\t.model(modelName)\n\t\t\t\t\t\t\t.field(\"id\", \"Int\")\n\t\t\t\t\t\t\t.attribute(\"id\")\n\t\t\t\t\t\t\t.attribute(\"default(autoincrement())\");\n\t\t\t\t\t} else if (useUUIDs && provider === \"postgresql\") {\n\t\t\t\t\t\tbuilder\n\t\t\t\t\t\t\t.model(modelName)\n\t\t\t\t\t\t\t.field(\"id\", \"String\")\n\t\t\t\t\t\t\t.attribute(\"id\")\n\t\t\t\t\t\t\t.attribute('default(dbgenerated(\"pg_catalog.gen_random_uuid()\"))')\n\t\t\t\t\t\t\t.attribute(\"db.Uuid\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuilder.model(modelName).field(\"id\", \"String\").attribute(\"id\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const field in fields) {\n\t\t\t\tconst attr = fields[field]!;\n\t\t\t\tconst fieldName = attr.fieldName || field;\n\n\t\t\t\tif (prismaModel) {\n\t\t\t\t\tconst isAlreadyExist = builder.findByType(\"field\", {\n\t\t\t\t\t\tname: fieldName,\n\t\t\t\t\t\twithin: prismaModel.properties,\n\t\t\t\t\t});\n\t\t\t\t\tif (isAlreadyExist) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\t\t\t\tconst useNumberId = options.advanced?.database?.generateId === \"serial\";\n\t\t\t\tconst fieldBuilder = builder.model(modelName).field(\n\t\t\t\t\tfieldName,\n\t\t\t\t\tfield === \"id\" && useNumberId\n\t\t\t\t\t\t? getType({\n\t\t\t\t\t\t\t\tisBigint: false,\n\t\t\t\t\t\t\t\tisOptional: false,\n\t\t\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: getType({\n\t\t\t\t\t\t\t\tisBigint: attr?.bigint || false,\n\t\t\t\t\t\t\t\tisOptional: !attr?.required,\n\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\tattr.references?.field === \"id\"\n\t\t\t\t\t\t\t\t\t\t? useNumberId\n\t\t\t\t\t\t\t\t\t\t\t? \"number\"\n\t\t\t\t\t\t\t\t\t\t\t: \"string\"\n\t\t\t\t\t\t\t\t\t\t: attr.type,\n\t\t\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tif (field === \"id\") {\n\t\t\t\t\tfieldBuilder.attribute(\"id\");\n\t\t\t\t\tif (provider === \"mongodb\") {\n\t\t\t\t\t\tfieldBuilder.attribute(`map(\"_id\")`);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (attr.unique) {\n\t\t\t\t\tbuilder.model(modelName).blockAttribute(`unique([${fieldName}])`);\n\t\t\t\t}\n\n\t\t\t\tif (attr.defaultValue !== undefined) {\n\t\t\t\t\tif (Array.isArray(attr.defaultValue)) {\n\t\t\t\t\t\t// for json objects and array of object\n\n\t\t\t\t\t\tif (attr.type === \"json\") {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tObject.prototype.toString.call(attr.defaultValue[0]) ===\n\t\t\t\t\t\t\t\t\"[object Object]\"\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tfieldBuilder.attribute(\n\t\t\t\t\t\t\t\t\t`default(\"${JSON.stringify(attr.defaultValue).replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\")`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst jsonArray = [];\n\t\t\t\t\t\t\tfor (const value of attr.defaultValue) jsonArray.push(value);\n\t\t\t\t\t\t\tfieldBuilder.attribute(\n\t\t\t\t\t\t\t\t`default(\"${JSON.stringify(jsonArray).replace(/\"/g, '\\\\\"')}\")`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (attr.defaultValue.length === 0) {\n\t\t\t\t\t\t\tfieldBuilder.attribute(`default([])`);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\ttypeof attr.defaultValue[0] === \"string\" &&\n\t\t\t\t\t\t\tattr.type === \"string[]\"\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst valueArray = [];\n\t\t\t\t\t\t\tfor (const value of attr.defaultValue)\n\t\t\t\t\t\t\t\tvalueArray.push(JSON.stringify(value));\n\t\t\t\t\t\t\tfieldBuilder.attribute(`default([${valueArray}])`);\n\t\t\t\t\t\t} else if (typeof attr.defaultValue[0] === \"number\") {\n\t\t\t\t\t\t\tconst valueArray = [];\n\t\t\t\t\t\t\tfor (const value of attr.defaultValue)\n\t\t\t\t\t\t\t\tvalueArray.push(`${value}`);\n\t\t\t\t\t\t\tfieldBuilder.attribute(`default([${valueArray}])`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// for json objects\n\t\t\t\t\telse if (\n\t\t\t\t\t\ttypeof attr.defaultValue === \"object\" &&\n\t\t\t\t\t\t!Array.isArray(attr.defaultValue) &&\n\t\t\t\t\t\tattr.defaultValue !== null\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tObject.entries(attr.defaultValue as Record<string, any>)\n\t\t\t\t\t\t\t\t.length === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tfieldBuilder.attribute(`default(\"{}\")`);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfieldBuilder.attribute(\n\t\t\t\t\t\t\t`default(\"${JSON.stringify(attr.defaultValue).replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\")`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (field === \"createdAt\") {\n\t\t\t\t\t\tfieldBuilder.attribute(\"default(now())\");\n\t\t\t\t\t} else if (\n\t\t\t\t\t\ttypeof attr.defaultValue === \"string\" &&\n\t\t\t\t\t\tprovider !== \"mysql\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tfieldBuilder.attribute(`default(\"${attr.defaultValue}\")`);\n\t\t\t\t\t} else if (\n\t\t\t\t\t\ttypeof attr.defaultValue === \"boolean\" ||\n\t\t\t\t\t\ttypeof attr.defaultValue === \"number\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tfieldBuilder.attribute(`default(${attr.defaultValue})`);\n\t\t\t\t\t} else if (typeof attr.defaultValue === \"function\") {\n\t\t\t\t\t\t// we are intentionally not adding the default value here\n\t\t\t\t\t\t// this is because if the defaultValue is a function, it could have\n\t\t\t\t\t\t// custom logic within that function that might not work in prisma's context.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// This is a special handling for updatedAt fields\n\t\t\t\tif (field === \"updatedAt\" && attr.onUpdate) {\n\t\t\t\t\tfieldBuilder.attribute(\"updatedAt\");\n\t\t\t\t} else if (attr.onUpdate) {\n\t\t\t\t\t// we are intentionally not adding the onUpdate value here\n\t\t\t\t\t// this is because if the onUpdate is a function, it could have\n\t\t\t\t\t// custom logic within that function that might not work in prisma's context.\n\t\t\t\t}\n\n\t\t\t\tif (attr.references) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tuseUUIDs &&\n\t\t\t\t\t\tprovider === \"postgresql\" &&\n\t\t\t\t\t\tattr.references?.field === \"id\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tbuilder.model(modelName).field(fieldName).attribute(`db.Uuid`);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst referencedOriginalModelName = getModelName(\n\t\t\t\t\t\tattr.references.model,\n\t\t\t\t\t);\n\t\t\t\t\tconst referencedCustomModelName =\n\t\t\t\t\t\ttables[referencedOriginalModelName]?.modelName ||\n\t\t\t\t\t\treferencedOriginalModelName;\n\t\t\t\t\tlet action = \"Cascade\";\n\t\t\t\t\tif (attr.references.onDelete === \"no action\") action = \"NoAction\";\n\t\t\t\t\telse if (attr.references.onDelete === \"set null\") action = \"SetNull\";\n\t\t\t\t\telse if (attr.references.onDelete === \"set default\")\n\t\t\t\t\t\taction = \"SetDefault\";\n\t\t\t\t\telse if (attr.references.onDelete === \"restrict\") action = \"Restrict\";\n\n\t\t\t\t\tconst relationField = `relation(fields: [${getFieldName({ model: originalTableName, field: fieldName })}], references: [${getFieldName({ model: attr.references.model, field: attr.references.field })}], onDelete: ${action})`;\n\t\t\t\t\tbuilder\n\t\t\t\t\t\t.model(modelName)\n\t\t\t\t\t\t.field(\n\t\t\t\t\t\t\treferencedCustomModelName.toLowerCase(),\n\t\t\t\t\t\t\t`${capitalizeFirstLetter(referencedCustomModelName)}${\n\t\t\t\t\t\t\t\t!attr.required ? \"?\" : \"\"\n\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.attribute(relationField);\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\t!attr.unique &&\n\t\t\t\t\t!attr.references &&\n\t\t\t\t\tprovider === \"mysql\" &&\n\t\t\t\t\tattr.type === \"string\"\n\t\t\t\t) {\n\t\t\t\t\tbuilder.model(modelName).field(fieldName).attribute(\"db.Text\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add many-to-many fields\n\t\t\tif (manyToManyRelations.has(modelName)) {\n\t\t\t\tfor (const relatedModel of manyToManyRelations.get(modelName)) {\n\t\t\t\t\t// Find the FK field on the related model that points to this model\n\t\t\t\t\tconst relatedTableName = Object.keys(tables).find(\n\t\t\t\t\t\t(key) =>\n\t\t\t\t\t\t\tcapitalizeFirstLetter(tables[key]?.modelName || key) ===\n\t\t\t\t\t\t\trelatedModel,\n\t\t\t\t\t);\n\t\t\t\t\tconst relatedFields = relatedTableName\n\t\t\t\t\t\t? tables[relatedTableName]?.fields\n\t\t\t\t\t\t: {};\n\t\t\t\t\tconst fkField = Object.entries(relatedFields || {}).find(\n\t\t\t\t\t\t([_fieldName, fieldAttr]: any) =>\n\t\t\t\t\t\t\tfieldAttr.references &&\n\t\t\t\t\t\t\tgetModelName(fieldAttr.references.model) ===\n\t\t\t\t\t\t\t\tgetModelName(originalTableName),\n\t\t\t\t\t);\n\t\t\t\t\tconst [_fieldKey, fkFieldAttr] = fkField || [];\n\t\t\t\t\tconst isUnique = fkFieldAttr?.unique === true;\n\n\t\t\t\t\tconst fieldName =\n\t\t\t\t\t\tisUnique || adapter.options?.usePlural === true\n\t\t\t\t\t\t\t? `${relatedModel.toLowerCase()}`\n\t\t\t\t\t\t\t: `${relatedModel.toLowerCase()}s`;\n\t\t\t\t\tconst existingField = builder.findByType(\"field\", {\n\t\t\t\t\t\tname: fieldName,\n\t\t\t\t\t\twithin: prismaModel?.properties,\n\t\t\t\t\t});\n\t\t\t\t\tif (!existingField) {\n\t\t\t\t\t\tbuilder\n\t\t\t\t\t\t\t.model(modelName)\n\t\t\t\t\t\t\t.field(fieldName, `${relatedModel}${isUnique ? \"?\" : \"[]\"}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add indexes\n\t\t\tconst indexedFieldsForModel = indexedFields.get(modelName);\n\t\t\tif (indexedFieldsForModel && indexedFieldsForModel.length > 0) {\n\t\t\t\tfor (const fieldName of indexedFieldsForModel) {\n\t\t\t\t\tif (prismaModel) {\n\t\t\t\t\t\tconst indexExist = prismaModel.properties.some(\n\t\t\t\t\t\t\t(v) =>\n\t\t\t\t\t\t\t\tv.type === \"attribute\" &&\n\t\t\t\t\t\t\t\tv.name === \"index\" &&\n\t\t\t\t\t\t\t\tJSON.stringify(v.args[0]?.value).includes(fieldName),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (indexExist) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst field = Object.entries(fields!).find(\n\t\t\t\t\t\t([key, attr]) => (attr.fieldName || key) === fieldName,\n\t\t\t\t\t)?.[1];\n\n\t\t\t\t\tlet indexField = fieldName;\n\t\t\t\t\tif (provider === \"mysql\" && field && field.type === \"string\") {\n\t\t\t\t\t\tconst useNumberId =\n\t\t\t\t\t\t\toptions.advanced?.database?.generateId === \"serial\";\n\t\t\t\t\t\tconst useUUIDs = options.advanced?.database?.generateId === \"uuid\";\n\t\t\t\t\t\tif (field.references?.field === \"id\" && (useNumberId || useUUIDs)) {\n\t\t\t\t\t\t\tindexField = `${fieldName}`;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindexField = `${fieldName}(length: 191)`; // length of 191 because String in Prisma is varchar(191)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbuilder.model(modelName).blockAttribute(`index([${indexField}])`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst hasAttribute = builder.findByType(\"attribute\", {\n\t\t\t\tname: \"map\",\n\t\t\t\twithin: prismaModel?.properties,\n\t\t\t});\n\t\t\tconst hasChanged = customModelName !== originalTableName;\n\t\t\tif (!hasAttribute) {\n\t\t\t\tbuilder\n\t\t\t\t\t.model(modelName)\n\t\t\t\t\t.blockAttribute(\n\t\t\t\t\t\t\"map\",\n\t\t\t\t\t\t`${getModelName(hasChanged ? customModelName : originalTableName)}`,\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\t});\n\n\tconst schemaChanged = schema.trim() !== schemaPrisma.trim();\n\n\treturn {\n\t\tcode: schemaChanged ? schema : \"\",\n\t\tfileName: filePath,\n\t\toverwrite: schemaPrismaExist && schemaChanged,\n\t};\n};\n\nconst getNewPrisma = (provider: string, cwd?: string) => {\n\tconst prismaVersion = getPrismaVersion(cwd);\n\tconst isV7 = prismaVersion && prismaVersion >= 7;\n\t// Use \"prisma-client\" for Prisma v7+, otherwise use \"prisma-client-js\"\n\tconst clientProvider = isV7 ? \"prisma-client\" : \"prisma-client-js\";\n\n\t// In Prisma v7+, the url is configured in prisma.config.ts instead of the schema\n\tif (isV7) {\n\t\treturn `generator client {\n provider = \"${clientProvider}\"\n }\n\n datasource db {\n provider = \"${provider}\"\n }`;\n\t}\n\n\treturn `generator client {\n provider = \"${clientProvider}\"\n }\n\n datasource db {\n provider = \"${provider}\"\n url = ${\n\t\t\tprovider === \"sqlite\" ? `\"file:./dev.db\"` : `env(\"DATABASE_URL\")`\n\t\t}\n }`;\n};\n","import type { BetterAuthOptions } from \"@better-auth/core\";\nimport type { DBAdapter } from \"@better-auth/core/db/adapter\";\nimport { generateDrizzleSchema } from \"./drizzle\";\nimport { generateKyselySchema } from \"./kysely\";\nimport { generatePrismaSchema } from \"./prisma\";\n\nexport const adapters = {\n\tprisma: generatePrismaSchema,\n\tdrizzle: generateDrizzleSchema,\n\tkysely: generateKyselySchema,\n};\n\nexport const generateSchema = (opts: {\n\tadapter: DBAdapter;\n\tfile?: string;\n\toptions: BetterAuthOptions;\n}) => {\n\tconst adapter = opts.adapter;\n\tconst generator =\n\t\tadapter.id in adapters\n\t\t\t? adapters[adapter.id as keyof typeof adapters]\n\t\t\t: null;\n\tif (generator) {\n\t\t// generator from the built-in list above\n\t\treturn generator(opts);\n\t}\n\tif (adapter.createSchema) {\n\t\t// use the custom adapter's createSchema method\n\t\treturn adapter\n\t\t\t.createSchema(opts.options, opts.file)\n\t\t\t.then(({ code, path: fileName, overwrite }) => ({\n\t\t\t\tcode,\n\t\t\t\tfileName,\n\t\t\t\toverwrite,\n\t\t\t}));\n\t}\n\n\tthrow new Error(\n\t\t`${adapter.id} is not supported. If it is a custom adapter, please request the maintainer to implement createSchema`,\n\t);\n};\n","const createModule = () => {\n\tconst moduleSource = `\nconst createStub = (label) => {\n const handler = {\n get(_, prop) {\n if (prop === \"toString\") return () => label;\n if (prop === \"valueOf\") return () => label;\n if (prop === Symbol.toPrimitive) return () => label;\n if (prop === Symbol.toStringTag) return \"Object\";\n if (prop === \"then\") return undefined;\n return createStub(label + \".\" + String(prop));\n },\n apply(_, __, args) {\n return createStub(label + \"()\")\n },\n construct() {\n return createStub(label + \"#instance\");\n },\n };\n const fn = () => createStub(label + \"()\");\n return new Proxy(fn, handler);\n};\n\nclass WorkerEntrypoint {\n constructor(ctx, env) {\n this.ctx = ctx;\n this.env = env;\n }\n}\n\nclass DurableObject {\n constructor(state, env) {\n this.state = state;\n this.env = env;\n }\n}\n\nclass RpcTarget {\n constructor(value) {\n this.value = value;\n }\n}\n\nconst RpcStub = RpcTarget;\n\nconst env = createStub(\"env\");\nconst caches = createStub(\"caches\");\nconst scheduler = createStub(\"scheduler\");\nconst executionCtx = createStub(\"executionCtx\");\n\nexport { DurableObject, RpcStub, RpcTarget, WorkerEntrypoint, caches, env, executionCtx, scheduler };\n\nconst defaultExport = {\n DurableObject,\n RpcStub,\n RpcTarget,\n WorkerEntrypoint,\n caches,\n env,\n executionCtx,\n scheduler,\n};\n\nexport default defaultExport;\n// jiti dirty hack: .unknown\n`;\n\n\treturn `data:text/javascript;charset=utf-8,${encodeURIComponent(moduleSource)}`;\n};\n\nconst CLOUDFLARE_STUB_MODULE = createModule();\n\nexport function addCloudflareModules(\n\taliases: Record<string, string>,\n\t_cwd?: string,\n) {\n\tif (!aliases[\"cloudflare:workers\"]) {\n\t\taliases[\"cloudflare:workers\"] = CLOUDFLARE_STUB_MODULE;\n\t}\n\tif (!aliases[\"cloudflare:test\"]) {\n\t\taliases[\"cloudflare:test\"] = CLOUDFLARE_STUB_MODULE;\n\t}\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * Adds SvelteKit environment modules and path aliases\n * @param aliases - The aliases object to populate\n * @param cwd - Current working directory (optional, defaults to process.cwd())\n */\nexport function addSvelteKitEnvModules(\n\taliases: Record<string, string>,\n\tcwd?: string,\n) {\n\tconst workingDir = cwd || process.cwd();\n\n\t// Add SvelteKit environment modules\n\taliases[\"$env/dynamic/private\"] = createDataUriModule(\n\t\tcreateDynamicEnvModule(),\n\t);\n\taliases[\"$env/dynamic/public\"] = createDataUriModule(\n\t\tcreateDynamicEnvModule(),\n\t);\n\taliases[\"$env/static/private\"] = createDataUriModule(\n\t\tcreateStaticEnvModule(filterPrivateEnv(\"PUBLIC_\", \"\")),\n\t);\n\taliases[\"$env/static/public\"] = createDataUriModule(\n\t\tcreateStaticEnvModule(filterPublicEnv(\"PUBLIC_\", \"\")),\n\t);\n\n\tconst svelteKitAliases = getSvelteKitPathAliases(workingDir);\n\tObject.assign(aliases, svelteKitAliases);\n}\n\nfunction getSvelteKitPathAliases(cwd: string): Record<string, string> {\n\tconst aliases: Record<string, string> = {};\n\n\tconst packageJsonPath = path.join(cwd, \"package.json\");\n\tconst svelteConfigPath = path.join(cwd, \"svelte.config.js\");\n\tconst svelteConfigTsPath = path.join(cwd, \"svelte.config.ts\");\n\n\tlet isSvelteKitProject = false;\n\n\tif (fs.existsSync(packageJsonPath)) {\n\t\ttry {\n\t\t\tconst packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n\t\t\tconst deps = {\n\t\t\t\t...packageJson.dependencies,\n\t\t\t\t...packageJson.devDependencies,\n\t\t\t};\n\t\t\tisSvelteKitProject = !!deps[\"@sveltejs/kit\"];\n\t\t} catch {\n\t\t\t// Ignore JSON parse errors\n\t\t}\n\t}\n\n\tif (!isSvelteKitProject) {\n\t\tisSvelteKitProject =\n\t\t\tfs.existsSync(svelteConfigPath) || fs.existsSync(svelteConfigTsPath);\n\t}\n\n\tif (!isSvelteKitProject) {\n\t\treturn aliases;\n\t}\n\n\tconst libPaths = [path.join(cwd, \"src\", \"lib\"), path.join(cwd, \"lib\")];\n\n\tfor (const libPath of libPaths) {\n\t\tif (fs.existsSync(libPath)) {\n\t\t\taliases[\"$lib\"] = libPath;\n\t\t\t// handles a common subpaths\n\t\t\tconst commonSubPaths = [\"server\", \"utils\", \"components\", \"stores\"];\n\t\t\tfor (const subPath of commonSubPaths) {\n\t\t\t\tconst subDir = path.join(libPath, subPath);\n\t\t\t\tif (fs.existsSync(subDir)) {\n\t\t\t\t\taliases[`$lib/${subPath}`] = subDir;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\t// Add simple stub for $app/server to prevent CLI errors\n\taliases[\"$app/server\"] = createDataUriModule(createAppServerModule());\n\n\tconst customAliases = getSvelteConfigAliases(cwd);\n\tObject.assign(aliases, customAliases);\n\n\treturn aliases;\n}\n// for custom aliases in svelte.config.js/ts\nfunction getSvelteConfigAliases(cwd: string): Record<string, string> {\n\tconst aliases: Record<string, string> = {};\n\tconst configPaths = [\n\t\tpath.join(cwd, \"svelte.config.js\"),\n\t\tpath.join(cwd, \"svelte.config.ts\"),\n\t];\n\n\tfor (const configPath of configPaths) {\n\t\tif (fs.existsSync(configPath)) {\n\t\t\ttry {\n\t\t\t\tconst content = fs.readFileSync(configPath, \"utf-8\");\n\t\t\t\tconst aliasMatch = content.match(/alias\\s*:\\s*\\{([^}]+)\\}/);\n\t\t\t\tif (aliasMatch && aliasMatch[1]) {\n\t\t\t\t\tconst aliasContent = aliasMatch[1];\n\t\t\t\t\tconst aliasMatches = aliasContent.matchAll(\n\t\t\t\t\t\t/['\"`](\\$[^'\"`]+)['\"`]\\s*:\\s*['\"`]([^'\"`]+)['\"`]/g,\n\t\t\t\t\t);\n\n\t\t\t\t\tfor (const match of aliasMatches) {\n\t\t\t\t\t\tconst [, alias, target] = match;\n\t\t\t\t\t\tif (alias && target) {\n\t\t\t\t\t\t\taliases[alias + \"/*\"] = path.resolve(cwd, target) + \"/*\";\n\t\t\t\t\t\t\taliases[alias] = path.resolve(cwd, target);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Ignore file reading/parsing errors\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn aliases;\n}\n\nfunction createAppServerModule(): string {\n\treturn `\n// $app/server stub for CLI compatibility\nexport default {};\n// jiti dirty hack: .unknown\n`;\n}\n\nfunction createDataUriModule(module: string) {\n\treturn `data:text/javascript;charset=utf-8,${encodeURIComponent(module)}`;\n}\n\nfunction createStaticEnvModule(env: Record<string, string>) {\n\tconst declarations = Object.keys(env)\n\t\t.filter((k) => validIdentifier.test(k) && !reserved.has(k))\n\t\t.map((k) => `export const ${k} = ${JSON.stringify(env[k])};`);\n\n\treturn `\n ${declarations.join(\"\\n\")}\n // jiti dirty hack: .unknown\n `;\n}\n\nfunction createDynamicEnvModule() {\n\treturn `\n export const env = process.env;\n // jiti dirty hack: .unknown\n `;\n}\n\nfunction filterPrivateEnv(publicPrefix: string, privatePrefix: string) {\n\treturn Object.fromEntries(\n\t\tObject.entries(process.env).filter(\n\t\t\t([k]) =>\n\t\t\t\tk.startsWith(privatePrefix) &&\n\t\t\t\t(publicPrefix === \"\" || !k.startsWith(publicPrefix)),\n\t\t),\n\t) as Record<string, string>;\n}\n\nfunction filterPublicEnv(publicPrefix: string, privatePrefix: string) {\n\treturn Object.fromEntries(\n\t\tObject.entries(process.env).filter(\n\t\t\t([k]) =>\n\t\t\t\tk.startsWith(publicPrefix) &&\n\t\t\t\t(privatePrefix === \"\" || !k.startsWith(privatePrefix)),\n\t\t),\n\t) as Record<string, string>;\n}\n\nconst validIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;\nconst reserved = new Set([\n\t\"do\",\n\t\"if\",\n\t\"in\",\n\t\"for\",\n\t\"let\",\n\t\"new\",\n\t\"try\",\n\t\"var\",\n\t\"case\",\n\t\"else\",\n\t\"enum\",\n\t\"eval\",\n\t\"null\",\n\t\"this\",\n\t\"true\",\n\t\"void\",\n\t\"with\",\n\t\"await\",\n\t\"break\",\n\t\"catch\",\n\t\"class\",\n\t\"const\",\n\t\"false\",\n\t\"super\",\n\t\"throw\",\n\t\"while\",\n\t\"yield\",\n\t\"delete\",\n\t\"export\",\n\t\"import\",\n\t\"public\",\n\t\"return\",\n\t\"static\",\n\t\"switch\",\n\t\"typeof\",\n\t\"default\",\n\t\"extends\",\n\t\"finally\",\n\t\"package\",\n\t\"private\",\n\t\"continue\",\n\t\"debugger\",\n\t\"function\",\n\t\"arguments\",\n\t\"interface\",\n\t\"protected\",\n\t\"implements\",\n\t\"instanceof\",\n]);\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nfunction stripJsonComments(jsonString: string): string {\n\treturn jsonString\n\t\t.replace(/\\\\\"|\"(?:\\\\\"|[^\"])*\"|(\\/\\/.*|\\/\\*[\\s\\S]*?\\*\\/)/g, (m, g) =>\n\t\t\tg ? \"\" : m,\n\t\t)\n\t\t.replace(/,(?=\\s*[}\\]])/g, \"\");\n}\n\nexport function getTsconfigInfo(cwd?: string, flatPath?: string) {\n\tlet tsConfigPath: string;\n\tif (flatPath) {\n\t\ttsConfigPath = flatPath;\n\t} else {\n\t\ttsConfigPath = cwd\n\t\t\t? path.join(cwd, \"tsconfig.json\")\n\t\t\t: path.join(\"tsconfig.json\");\n\t}\n\ttry {\n\t\tconst text = fs.readFileSync(tsConfigPath, \"utf-8\");\n\t\treturn JSON.parse(stripJsonComments(text));\n\t} catch (error) {\n\t\tthrow error;\n\t}\n}\n","import fs, { existsSync } from \"node:fs\";\nimport path from \"node:path\";\n// @ts-expect-error\nimport babelPresetReact from \"@babel/preset-react\";\n// @ts-expect-error\nimport babelPresetTypeScript from \"@babel/preset-typescript\";\nimport type { BetterAuthOptions } from \"@better-auth/core\";\nimport { BetterAuthError } from \"@better-auth/core/error\";\nimport { loadConfig } from \"c12\";\nimport type { JitiOptions } from \"jiti\";\nimport { addCloudflareModules } from \"./add-cloudflare-modules\";\nimport { addSvelteKitEnvModules } from \"./add-svelte-kit-env-modules\";\nimport { getTsconfigInfo } from \"./get-tsconfig-info\";\n\nlet possiblePaths = [\n\t\"auth.ts\",\n\t\"auth.tsx\",\n\t\"auth.js\",\n\t\"auth.jsx\",\n\t\"auth.server.js\",\n\t\"auth.server.ts\",\n\t\"auth/index.ts\",\n\t\"auth/index.tsx\",\n\t\"auth/index.js\",\n\t\"auth/index.jsx\",\n\t\"auth/index.server.js\",\n\t\"auth/index.server.ts\",\n];\n\npossiblePaths = [\n\t...possiblePaths,\n\t...possiblePaths.map((it) => `lib/server/${it}`),\n\t...possiblePaths.map((it) => `server/auth/${it}`),\n\t...possiblePaths.map((it) => `server/${it}`),\n\t...possiblePaths.map((it) => `auth/${it}`),\n\t...possiblePaths.map((it) => `lib/${it}`),\n\t...possiblePaths.map((it) => `utils/${it}`),\n];\npossiblePaths = [\n\t...possiblePaths,\n\t...possiblePaths.map((it) => `src/${it}`),\n\t...possiblePaths.map((it) => `app/${it}`),\n];\n\nfunction resolveReferencePath(configDir: string, refPath: string): string {\n\tconst resolvedPath = path.resolve(configDir, refPath);\n\n\t// If it ends with .json, treat as direct file reference\n\tif (refPath.endsWith(\".json\")) {\n\t\treturn resolvedPath;\n\t}\n\n\t// If the exact path exists and is a file, use it\n\tif (fs.existsSync(resolvedPath)) {\n\t\ttry {\n\t\t\tconst stats = fs.statSync(resolvedPath);\n\t\t\tif (stats.isFile()) {\n\t\t\t\treturn resolvedPath;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to directory handling\n\t\t}\n\t}\n\n\t// Otherwise, assume directory reference\n\treturn path.resolve(configDir, refPath, \"tsconfig.json\");\n}\n\nfunction getPathAliasesRecursive(\n\ttsconfigPath: string,\n\tvisited = new Set<string>(),\n): Record<string, string> {\n\tif (visited.has(tsconfigPath)) {\n\t\treturn {};\n\t}\n\tvisited.add(tsconfigPath);\n\n\tif (!fs.existsSync(tsconfigPath)) {\n\t\tconsole.warn(`Referenced tsconfig not found: ${tsconfigPath}`);\n\t\treturn {};\n\t}\n\n\ttry {\n\t\tconst tsConfig = getTsconfigInfo(undefined, tsconfigPath);\n\t\tconst { paths = {}, baseUrl = \".\" } = tsConfig.compilerOptions || {};\n\t\tconst result: Record<string, string> = {};\n\n\t\tconst configDir = path.dirname(tsconfigPath);\n\t\tconst obj = Object.entries(paths) as [string, string[]][];\n\t\tfor (const [alias, aliasPaths] of obj) {\n\t\t\tfor (const aliasedPath of aliasPaths) {\n\t\t\t\tconst resolvedBaseUrl = path.resolve(configDir, baseUrl);\n\t\t\t\tconst finalAlias = alias.slice(-1) === \"*\" ? alias.slice(0, -1) : alias;\n\t\t\t\tconst finalAliasedPath =\n\t\t\t\t\taliasedPath.slice(-1) === \"*\"\n\t\t\t\t\t\t? aliasedPath.slice(0, -1)\n\t\t\t\t\t\t: aliasedPath;\n\n\t\t\t\tresult[finalAlias || \"\"] = path.join(resolvedBaseUrl, finalAliasedPath);\n\t\t\t}\n\t\t}\n\n\t\tif (tsConfig.references) {\n\t\t\tfor (const ref of tsConfig.references) {\n\t\t\t\tconst refPath = resolveReferencePath(configDir, ref.path);\n\t\t\t\tconst refAliases = getPathAliasesRecursive(refPath, visited);\n\t\t\t\tfor (const [alias, aliasPath] of Object.entries(refAliases)) {\n\t\t\t\t\tif (!(alias in result)) {\n\t\t\t\t\t\tresult[alias] = aliasPath;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t} catch (error) {\n\t\tconsole.warn(`Error parsing tsconfig at ${tsconfigPath}: ${error}`);\n\t\treturn {};\n\t}\n}\n\nfunction getPathAliases(cwd: string): Record<string, string> | null {\n\tlet tsConfigPath = path.join(cwd, \"tsconfig.json\");\n\tif (!fs.existsSync(tsConfigPath)) {\n\t\ttsConfigPath = path.join(cwd, \"jsconfig.json\");\n\t}\n\tif (!fs.existsSync(tsConfigPath)) {\n\t\treturn null;\n\t}\n\ttry {\n\t\tconst result = getPathAliasesRecursive(tsConfigPath);\n\t\taddSvelteKitEnvModules(result);\n\t\taddCloudflareModules(result);\n\t\treturn result;\n\t} catch (error) {\n\t\tconsole.error(error);\n\t\tthrow new BetterAuthError(\"Error parsing tsconfig.json\");\n\t}\n}\n/**\n * .tsx files are not supported by Jiti.\n */\nconst jitiOptions = (cwd: string): JitiOptions => {\n\tconst alias = getPathAliases(cwd) || {};\n\treturn {\n\t\ttransformOptions: {\n\t\t\tbabel: {\n\t\t\t\tpresets: [\n\t\t\t\t\t[\n\t\t\t\t\t\tbabelPresetTypeScript,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tisTSX: true,\n\t\t\t\t\t\t\tallExtensions: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t[babelPresetReact, { runtime: \"automatic\" }],\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\textensions: [\".ts\", \".tsx\", \".js\", \".jsx\"],\n\t\talias,\n\t};\n};\n\nconst isDefaultExport = (\n\tobject: Record<string, unknown>,\n): object is BetterAuthOptions => {\n\treturn (\n\t\ttypeof object === \"object\" &&\n\t\tobject !== null &&\n\t\t!Array.isArray(object) &&\n\t\tObject.keys(object).length > 0 &&\n\t\t\"options\" in object\n\t);\n};\nexport async function getConfig({\n\tcwd,\n\tconfigPath,\n\tshouldThrowOnError = false,\n}: {\n\tcwd: string;\n\tconfigPath?: string;\n\tshouldThrowOnError?: boolean;\n}) {\n\ttry {\n\t\tlet configFile: BetterAuthOptions | null = null;\n\t\tif (configPath) {\n\t\t\tlet resolvedPath: string = path.join(cwd, configPath);\n\t\t\tif (existsSync(configPath)) resolvedPath = configPath; // If the configPath is a file, use it as is, as it means the path wasn't relative.\n\t\t\tconst { config } = await loadConfig<\n\t\t\t\t| {\n\t\t\t\t\t\tauth: {\n\t\t\t\t\t\t\toptions: BetterAuthOptions;\n\t\t\t\t\t\t};\n\t\t\t\t }\n\t\t\t\t| {\n\t\t\t\t\t\toptions: BetterAuthOptions;\n\t\t\t\t }\n\t\t\t>({\n\t\t\t\tconfigFile: resolvedPath,\n\t\t\t\tdotenv: {\n\t\t\t\t\tfileName: [\".env\", \".env.local\"],\n\t\t\t\t},\n\t\t\t\tjitiOptions: jitiOptions(cwd),\n\t\t\t\tcwd,\n\t\t\t});\n\t\t\tif (!(\"auth\" in config) && !isDefaultExport(config)) {\n\t\t\t\tif (shouldThrowOnError) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Couldn't read your auth config in ${resolvedPath}. Make sure to default export your auth instance or to export as a variable named auth.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[#better-auth]: Couldn't read your auth config in ${resolvedPath}. Make sure to default export your auth instance or to export as a variable named auth.`,\n\t\t\t\t);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tconfigFile = \"auth\" in config ? config.auth?.options : config.options;\n\t\t}\n\n\t\tif (!configFile) {\n\t\t\tfor (const possiblePath of possiblePaths) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { config } = await loadConfig<{\n\t\t\t\t\t\tauth: {\n\t\t\t\t\t\t\toptions: BetterAuthOptions;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tdefault?: {\n\t\t\t\t\t\t\toptions: BetterAuthOptions;\n\t\t\t\t\t\t};\n\t\t\t\t\t}>({\n\t\t\t\t\t\tconfigFile: possiblePath,\n\t\t\t\t\t\tdotenv: {\n\t\t\t\t\t\t\tfileName: [\".env\", \".env.local\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tjitiOptions: jitiOptions(cwd),\n\t\t\t\t\t\tcwd,\n\t\t\t\t\t});\n\t\t\t\t\tconst hasConfig = Object.keys(config).length > 0;\n\t\t\t\t\tif (hasConfig) {\n\t\t\t\t\t\tconfigFile =\n\t\t\t\t\t\t\tconfig.auth?.options || config.default?.options || null;\n\t\t\t\t\t\tif (!configFile) {\n\t\t\t\t\t\t\tif (shouldThrowOnError) {\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\"Couldn't read your auth config. Make sure to default export your auth instance or to export as a variable named auth.\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconsole.error(\"[#better-auth]: Couldn't read your auth config.\");\n\t\t\t\t\t\t\tconsole.log(\"\");\n\t\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\t\t\"[#better-auth]: Make sure to default export your auth instance or to export as a variable named auth.\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tprocess.exit(1);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof e === \"object\" &&\n\t\t\t\t\t\te &&\n\t\t\t\t\t\t\"message\" in e &&\n\t\t\t\t\t\ttypeof e.message === \"string\" &&\n\t\t\t\t\t\te.message.includes(\n\t\t\t\t\t\t\t\"This module cannot be imported from a Client Component module\",\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (shouldThrowOnError) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Please remove import 'server-only' from your auth config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`Please remove import 'server-only' from your auth config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tprocess.exit(1);\n\t\t\t\t\t}\n\t\t\t\t\tif (shouldThrowOnError) {\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t\tconsole.error(\"[#better-auth]: Couldn't read your auth config.\", e);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn configFile;\n\t} catch (e) {\n\t\tif (\n\t\t\ttypeof e === \"object\" &&\n\t\t\te &&\n\t\t\t\"message\" in e &&\n\t\t\ttypeof e.message === \"string\" &&\n\t\t\te.message.includes(\n\t\t\t\t\"This module cannot be imported from a Client Component module\",\n\t\t\t)\n\t\t) {\n\t\t\tif (shouldThrowOnError) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Please remove import 'server-only' from your auth config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconsole.error(\n\t\t\t\t`Please remove import 'server-only' from your auth config file temporarily. The CLI cannot resolve the configuration with it included. You can re-add it after running the CLI.`,\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tif (shouldThrowOnError) {\n\t\t\tthrow e;\n\t\t}\n\n\t\tconsole.error(\"Couldn't read your auth config.\", e);\n\t\tprocess.exit(1);\n\t}\n}\n","import { existsSync } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { DBAdapter } from \"@better-auth/core/db/adapter\";\nimport {\n\tcreateTelemetry,\n\tgetTelemetryAuthConfig,\n} from \"@better-auth/telemetry\";\nimport { getAdapter } from \"better-auth/db/adapter\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport prompts from \"prompts\";\nimport yoctoSpinner from \"yocto-spinner\";\nimport * as z from \"zod/v4\";\nimport { generateSchema } from \"../generators\";\nimport { getConfig } from \"../utils/get-config\";\n\nfunction createMockAdapter(adapterId: string, dialect?: string): DBAdapter {\n\t// Map dialect to provider format for each adapter\n\tlet provider: string | undefined;\n\tif (dialect) {\n\t\tif (adapterId === \"drizzle\") {\n\t\t\t// Drizzle uses: pg, mysql, sqlite\n\t\t\tif (dialect === \"postgresql\") {\n\t\t\t\tprovider = \"pg\";\n\t\t\t} else if (dialect === \"mysql\" || dialect === \"sqlite\") {\n\t\t\t\tprovider = dialect;\n\t\t\t} else {\n\t\t\t\t// For other dialects, try to use as-is or default to pg\n\t\t\t\tprovider = dialect;\n\t\t\t}\n\t\t} else if (adapterId === \"prisma\") {\n\t\t\t// Prisma uses: postgresql, mysql, sqlite, mongodb, etc.\n\t\t\tprovider = dialect;\n\t\t}\n\t}\n\n\treturn {\n\t\tid: adapterId,\n\t\tcreate: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tfindOne: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tfindMany: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tcount: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tupdate: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tupdateMany: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tdelete: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\tdeleteMany: async () => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\ttransaction: async (callback) => {\n\t\t\tthrow new Error(\"Mock adapter methods should not be called\");\n\t\t},\n\t\toptions: {\n\t\t\tadapterConfig: {\n\t\t\t\tadapterId,\n\t\t\t},\n\t\t\t...(provider && { provider }),\n\t\t},\n\t};\n}\n\nasync function generateAction(opts: any) {\n\tconst options = z\n\t\t.object({\n\t\t\tcwd: z.string(),\n\t\t\tconfig: z.string().optional(),\n\t\t\toutput: z.string().optional(),\n\t\t\tadapter: z.string().optional(),\n\t\t\tdialect: z.string().optional(),\n\t\t\ty: z.boolean().optional(),\n\t\t\tyes: z.boolean().optional(),\n\t\t})\n\t\t.parse(opts);\n\n\tconst cwd = path.resolve(options.cwd);\n\tif (!existsSync(cwd)) {\n\t\tconsole.error(`The directory \"${cwd}\" does not exist.`);\n\t\tprocess.exit(1);\n\t}\n\tconst config = await getConfig({\n\t\tcwd,\n\t\tconfigPath: options.config,\n\t});\n\tif (!config) {\n\t\tconsole.error(\n\t\t\t\"No configuration file found. Add a `auth.ts` file to your project or pass the path to the configuration file using the `--config` flag.\",\n\t\t);\n\t\treturn;\n\t}\n\n\tlet adapter: DBAdapter;\n\tif (options.adapter) {\n\t\t// Use mock adapter when --adapter flag is provided\n\t\tadapter = createMockAdapter(options.adapter, options.dialect);\n\t} else {\n\t\t// Get adapter from config (existing behavior)\n\t\tadapter = await getAdapter(config).catch((e) => {\n\t\t\tconsole.error(e.message);\n\t\t\tprocess.exit(1);\n\t\t});\n\t}\n\n\tconst spinner = yoctoSpinner({ text: \"preparing schema...\" }).start();\n\n\tconst schema = await generateSchema({\n\t\tadapter,\n\t\tfile: options.output,\n\t\toptions: config,\n\t});\n\n\tspinner.stop();\n\tif (!schema.code) {\n\t\tconsole.log(\"Your schema is already up to date.\");\n\t\t// telemetry: track generate attempted, no changes\n\t\ttry {\n\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\tawait telemetry.publish({\n\t\t\t\ttype: \"cli_generate\",\n\t\t\t\tpayload: {\n\t\t\t\t\toutcome: \"no_changes\",\n\t\t\t\t\tconfig: await getTelemetryAuthConfig(config, {\n\t\t\t\t\t\tadapter: adapter.id,\n\t\t\t\t\t\tdatabase:\n\t\t\t\t\t\t\ttypeof config.database === \"function\" ? \"adapter\" : \"kysely\",\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {}\n\t\tprocess.exit(0);\n\t}\n\tif (schema.overwrite) {\n\t\tlet confirm = options.y || options.yes;\n\t\tif (!confirm) {\n\t\t\tconst response = await prompts({\n\t\t\t\ttype: \"confirm\",\n\t\t\t\tname: \"confirm\",\n\t\t\t\tmessage: `The file ${\n\t\t\t\t\tschema.fileName\n\t\t\t\t} already exists. Do you want to ${chalk.yellow(\n\t\t\t\t\t`${schema.overwrite ? \"overwrite\" : \"append\"}`,\n\t\t\t\t)} the schema to the file?`,\n\t\t\t});\n\t\t\tconfirm = response.confirm;\n\t\t}\n\n\t\tif (confirm) {\n\t\t\tconst exist = existsSync(path.join(cwd, schema.fileName));\n\t\t\tif (!exist) {\n\t\t\t\tawait fs.mkdir(path.dirname(path.join(cwd, schema.fileName)), {\n\t\t\t\t\trecursive: true,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (schema.overwrite) {\n\t\t\t\tawait fs.writeFile(path.join(cwd, schema.fileName), schema.code);\n\t\t\t} else {\n\t\t\t\tawait fs.appendFile(path.join(cwd, schema.fileName), schema.code);\n\t\t\t}\n\t\t\tconsole.log(\n\t\t\t\t`🚀 Schema was ${\n\t\t\t\t\tschema.overwrite ? \"overwritten\" : \"appended\"\n\t\t\t\t} successfully!`,\n\t\t\t);\n\t\t\t// telemetry: track generate success overwrite/append\n\t\t\ttry {\n\t\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\t\tawait telemetry.publish({\n\t\t\t\t\ttype: \"cli_generate\",\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\toutcome: schema.overwrite ? \"overwritten\" : \"appended\",\n\t\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t\tprocess.exit(0);\n\t\t} else {\n\t\t\tconsole.error(\"Schema generation aborted.\");\n\t\t\t// telemetry: track generate aborted\n\t\t\ttry {\n\t\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\t\tawait telemetry.publish({\n\t\t\t\t\ttype: \"cli_generate\",\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\toutcome: \"aborted\",\n\t\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\n\tif (options.y) {\n\t\tconsole.warn(\"WARNING: --y is deprecated. Consider -y or --yes\");\n\t\toptions.yes = true;\n\t}\n\n\tlet confirm = options.yes;\n\n\tif (!confirm) {\n\t\tconst response = await prompts({\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"confirm\",\n\t\t\tmessage: `Do you want to generate the schema to ${chalk.yellow(\n\t\t\t\tschema.fileName,\n\t\t\t)}?`,\n\t\t});\n\t\tconfirm = response.confirm;\n\t}\n\n\tif (!confirm) {\n\t\tconsole.error(\"Schema generation aborted.\");\n\t\t// telemetry: track generate aborted before write\n\t\ttry {\n\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\tawait telemetry.publish({\n\t\t\t\ttype: \"cli_generate\",\n\t\t\t\tpayload: {\n\t\t\t\t\toutcome: \"aborted\",\n\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {}\n\t\tprocess.exit(1);\n\t}\n\n\tif (!options.output) {\n\t\tconst dirExist = existsSync(path.dirname(path.join(cwd, schema.fileName)));\n\t\tif (!dirExist) {\n\t\t\tawait fs.mkdir(path.dirname(path.join(cwd, schema.fileName)), {\n\t\t\t\trecursive: true,\n\t\t\t});\n\t\t}\n\t}\n\tawait fs.writeFile(\n\t\toptions.output || path.join(cwd, schema.fileName),\n\t\tschema.code,\n\t);\n\tconsole.log(`🚀 Schema was generated successfully!`);\n\t// telemetry: track generate success\n\ttry {\n\t\tconst telemetry = await createTelemetry(config);\n\t\tawait telemetry.publish({\n\t\t\ttype: \"cli_generate\",\n\t\t\tpayload: {\n\t\t\t\toutcome: \"generated\",\n\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t},\n\t\t});\n\t} catch {}\n\tprocess.exit(0);\n}\n\nexport const generate = new Command(\"generate\")\n\t.option(\n\t\t\"-c, --cwd <cwd>\",\n\t\t\"the working directory. defaults to the current directory.\",\n\t\tprocess.cwd(),\n\t)\n\t.option(\n\t\t\"--config <config>\",\n\t\t\"the path to the configuration file. defaults to the first configuration file found.\",\n\t)\n\t.option(\"--output <output>\", \"the file to output to the generated schema\")\n\t.option(\n\t\t\"--adapter <adapter>\",\n\t\t\"specify the adapter type (e.g., prisma, drizzle, kysely) without requiring a configured adapter\",\n\t)\n\t.option(\n\t\t\"--dialect <dialect>\",\n\t\t\"specify the database dialect/provider (e.g., postgresql, mysql, sqlite). For drizzle, postgresql maps to 'pg'\",\n\t)\n\t.option(\"-y, --yes\", \"automatically answer yes to all prompts\", false)\n\t.option(\"--y\", \"(deprecated) same as --yes\", false)\n\t.action(generateAction);\n","import { execSync } from \"node:child_process\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport { getConfig } from \"../utils/get-config\";\nimport { getPackageInfo } from \"../utils/get-package-info\";\n\nfunction getSystemInfo() {\n\tconst platform = os.platform();\n\tconst arch = os.arch();\n\tconst version = os.version();\n\tconst release = os.release();\n\tconst cpus = os.cpus();\n\tconst memory = os.totalmem();\n\tconst freeMemory = os.freemem();\n\n\treturn {\n\t\tplatform,\n\t\tarch,\n\t\tversion,\n\t\trelease,\n\t\tcpuCount: cpus.length,\n\t\tcpuModel: cpus[0]?.model || \"Unknown\",\n\t\ttotalMemory: `${(memory / 1024 / 1024 / 1024).toFixed(2)} GB`,\n\t\tfreeMemory: `${(freeMemory / 1024 / 1024 / 1024).toFixed(2)} GB`,\n\t};\n}\n\nfunction getNodeInfo() {\n\treturn {\n\t\tversion: process.version,\n\t\tenv: process.env.NODE_ENV || \"development\",\n\t};\n}\n\nfunction getPackageManager() {\n\tconst userAgent = process.env.npm_config_user_agent || \"\";\n\n\tif (userAgent.includes(\"yarn\")) {\n\t\treturn { name: \"yarn\", version: getVersion(\"yarn\") };\n\t}\n\tif (userAgent.includes(\"pnpm\")) {\n\t\treturn { name: \"pnpm\", version: getVersion(\"pnpm\") };\n\t}\n\tif (userAgent.includes(\"bun\")) {\n\t\treturn { name: \"bun\", version: getVersion(\"bun\") };\n\t}\n\treturn { name: \"npm\", version: getVersion(\"npm\") };\n}\n\nfunction getVersion(command: string): string {\n\ttry {\n\t\tconst output = execSync(`${command} --version`, { encoding: \"utf8\" });\n\t\treturn output.trim();\n\t} catch {\n\t\treturn \"Not installed\";\n\t}\n}\n\nfunction getFrameworkInfo(projectRoot: string) {\n\tconst packageJsonPath = path.join(projectRoot, \"package.json\");\n\n\tif (!existsSync(packageJsonPath)) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\"));\n\t\tconst deps = {\n\t\t\t...packageJson.dependencies,\n\t\t\t...packageJson.devDependencies,\n\t\t};\n\n\t\tconst frameworks: Record<string, string | undefined> = {\n\t\t\tnext: deps[\"next\"],\n\t\t\treact: deps[\"react\"],\n\t\t\tvue: deps[\"vue\"],\n\t\t\tnuxt: deps[\"nuxt\"],\n\t\t\tsvelte: deps[\"svelte\"],\n\t\t\t\"@sveltejs/kit\": deps[\"@sveltejs/kit\"],\n\t\t\texpress: deps[\"express\"],\n\t\t\tfastify: deps[\"fastify\"],\n\t\t\thono: deps[\"hono\"],\n\t\t\t\"react-router\": deps[\"react-router\"],\n\t\t\tastro: deps[\"astro\"],\n\t\t\tsolid: deps[\"solid-js\"],\n\t\t\tqwik: deps[\"@builder.io/qwik\"],\n\t\t};\n\n\t\tconst installedFrameworks = Object.entries(frameworks)\n\t\t\t.filter(([_, version]) => version)\n\t\t\t.map(([name, version]) => ({ name, version }));\n\n\t\treturn installedFrameworks.length > 0 ? installedFrameworks : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction getDatabaseInfo(projectRoot: string) {\n\tconst packageJsonPath = path.join(projectRoot, \"package.json\");\n\n\tif (!existsSync(packageJsonPath)) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\"));\n\t\tconst deps = {\n\t\t\t...packageJson.dependencies,\n\t\t\t...packageJson.devDependencies,\n\t\t};\n\n\t\tconst databases: Record<string, string | undefined> = {\n\t\t\t\"better-sqlite3\": deps[\"better-sqlite3\"],\n\t\t\t\"@libsql/client\": deps[\"@libsql/client\"],\n\t\t\t\"@libsql/kysely-libsql\": deps[\"@libsql/kysely-libsql\"],\n\t\t\tmysql2: deps[\"mysql2\"],\n\t\t\tpg: deps[\"pg\"],\n\t\t\tpostgres: deps[\"postgres\"],\n\t\t\t\"@prisma/client\": deps[\"@prisma/client\"],\n\t\t\tdrizzle: deps[\"drizzle-orm\"],\n\t\t\tkysely: deps[\"kysely\"],\n\t\t\tmongodb: deps[\"mongodb\"],\n\t\t\t\"@neondatabase/serverless\": deps[\"@neondatabase/serverless\"],\n\t\t\t\"@vercel/postgres\": deps[\"@vercel/postgres\"],\n\t\t\t\"@planetscale/database\": deps[\"@planetscale/database\"],\n\t\t};\n\n\t\tconst installedDatabases = Object.entries(databases)\n\t\t\t.filter(([_, version]) => version)\n\t\t\t.map(([name, version]) => ({ name, version }));\n\n\t\treturn installedDatabases.length > 0 ? installedDatabases : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction sanitizeBetterAuthConfig(config: any): any {\n\tif (!config) return null;\n\n\tconst sanitized = JSON.parse(JSON.stringify(config));\n\n\t// List of sensitive keys to redact\n\tconst sensitiveKeys = [\n\t\t\"secret\",\n\t\t\"clientSecret\",\n\t\t\"clientId\",\n\t\t\"authToken\",\n\t\t\"apiKey\",\n\t\t\"apiSecret\",\n\t\t\"privateKey\",\n\t\t\"publicKey\",\n\t\t\"password\",\n\t\t\"token\",\n\t\t\"webhook\",\n\t\t\"connectionString\",\n\t\t\"databaseUrl\",\n\t\t\"databaseURL\",\n\t\t\"TURSO_AUTH_TOKEN\",\n\t\t\"TURSO_DATABASE_URL\",\n\t\t\"MYSQL_DATABASE_URL\",\n\t\t\"DATABASE_URL\",\n\t\t\"POSTGRES_URL\",\n\t\t\"MONGODB_URI\",\n\t\t\"stripeKey\",\n\t\t\"stripeWebhookSecret\",\n\t];\n\n\t// Keys that should NOT be redacted even if they contain sensitive keywords\n\tconst allowedKeys = [\n\t\t\"baseURL\",\n\t\t\"callbackURL\",\n\t\t\"redirectURL\",\n\t\t\"trustedOrigins\",\n\t\t\"appName\",\n\t];\n\n\tfunction redactSensitive(obj: any, parentKey?: string): any {\n\t\tif (typeof obj !== \"object\" || obj === null) {\n\t\t\t// Check if the parent key is sensitive\n\t\t\tif (parentKey && typeof obj === \"string\" && obj.length > 0) {\n\t\t\t\t// First check if it's in the allowed list\n\t\t\t\tif (\n\t\t\t\t\tallowedKeys.some(\n\t\t\t\t\t\t(allowed) => parentKey.toLowerCase() === allowed.toLowerCase(),\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn obj;\n\t\t\t\t}\n\n\t\t\t\tconst lowerKey = parentKey.toLowerCase();\n\t\t\t\tif (\n\t\t\t\t\tsensitiveKeys.some((key) => {\n\t\t\t\t\t\tconst lowerSensitiveKey = key.toLowerCase();\n\t\t\t\t\t\t// Exact match or the key ends with the sensitive key\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tlowerKey === lowerSensitiveKey ||\n\t\t\t\t\t\t\tlowerKey.endsWith(lowerSensitiveKey)\n\t\t\t\t\t\t);\n\t\t\t\t\t})\n\t\t\t\t) {\n\t\t\t\t\treturn \"[REDACTED]\";\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn obj;\n\t\t}\n\n\t\tif (Array.isArray(obj)) {\n\t\t\treturn obj.map((item) => redactSensitive(item, parentKey));\n\t\t}\n\n\t\tconst result: any = {};\n\t\tfor (const [key, value] of Object.entries(obj)) {\n\t\t\t// First check if this key is in the allowed list\n\t\t\tif (\n\t\t\t\tallowedKeys.some(\n\t\t\t\t\t(allowed) => key.toLowerCase() === allowed.toLowerCase(),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tresult[key] = value;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst lowerKey = key.toLowerCase();\n\n\t\t\t// Check if this key should be redacted\n\t\t\tif (\n\t\t\t\tsensitiveKeys.some((sensitiveKey) => {\n\t\t\t\t\tconst lowerSensitiveKey = sensitiveKey.toLowerCase();\n\t\t\t\t\t// Exact match or the key ends with the sensitive key\n\t\t\t\t\treturn (\n\t\t\t\t\t\tlowerKey === lowerSensitiveKey ||\n\t\t\t\t\t\tlowerKey.endsWith(lowerSensitiveKey)\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t) {\n\t\t\t\tif (typeof value === \"string\" && value.length > 0) {\n\t\t\t\t\tresult[key] = \"[REDACTED]\";\n\t\t\t\t} else if (typeof value === \"object\" && value !== null) {\n\t\t\t\t\t// Still recurse into objects but mark them as potentially sensitive\n\t\t\t\t\tresult[key] = redactSensitive(value, key);\n\t\t\t\t} else {\n\t\t\t\t\tresult[key] = value;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresult[key] = redactSensitive(value, key);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t// Special handling for specific config sections\n\tif (sanitized.database) {\n\t\t// Redact database connection details\n\t\tif (typeof sanitized.database === \"string\") {\n\t\t\tsanitized.database = \"[REDACTED]\";\n\t\t} else if (sanitized.database.url) {\n\t\t\tsanitized.database.url = \"[REDACTED]\";\n\t\t}\n\t\tif (sanitized.database.authToken) {\n\t\t\tsanitized.database.authToken = \"[REDACTED]\";\n\t\t}\n\t}\n\n\tif (sanitized.socialProviders) {\n\t\t// Redact all social provider secrets\n\t\tfor (const provider in sanitized.socialProviders) {\n\t\t\tif (sanitized.socialProviders[provider]) {\n\t\t\t\tsanitized.socialProviders[provider] = redactSensitive(\n\t\t\t\t\tsanitized.socialProviders[provider],\n\t\t\t\t\tprovider,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (sanitized.emailAndPassword?.sendResetPassword) {\n\t\tsanitized.emailAndPassword.sendResetPassword = \"[Function]\";\n\t}\n\n\tif (sanitized.emailVerification?.sendVerificationEmail) {\n\t\tsanitized.emailVerification.sendVerificationEmail = \"[Function]\";\n\t}\n\n\t// Redact plugin configurations\n\tif (sanitized.plugins && Array.isArray(sanitized.plugins)) {\n\t\tsanitized.plugins = sanitized.plugins.map((plugin: any) => {\n\t\t\tif (typeof plugin === \"function\") {\n\t\t\t\treturn \"[Plugin Function]\";\n\t\t\t}\n\t\t\tif (plugin && typeof plugin === \"object\") {\n\t\t\t\t// Get plugin name if available\n\t\t\t\tconst pluginName = plugin.id || plugin.name || \"unknown\";\n\t\t\t\treturn {\n\t\t\t\t\tname: pluginName,\n\t\t\t\t\tconfig: redactSensitive(plugin.config || plugin),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn plugin;\n\t\t});\n\t}\n\n\treturn redactSensitive(sanitized);\n}\n\nasync function getBetterAuthInfo(\n\tprojectRoot: string,\n\tconfigPath?: string,\n\tsuppressLogs = false,\n) {\n\ttry {\n\t\t// Temporarily suppress console output if needed\n\t\tconst originalLog = console.log;\n\t\tconst originalWarn = console.warn;\n\t\tconst originalError = console.error;\n\n\t\tif (suppressLogs) {\n\t\t\tconsole.log = () => {};\n\t\t\tconsole.warn = () => {};\n\t\t\tconsole.error = () => {};\n\t\t}\n\n\t\ttry {\n\t\t\tconst config = await getConfig({\n\t\t\t\tcwd: projectRoot,\n\t\t\t\tconfigPath,\n\t\t\t\tshouldThrowOnError: true,\n\t\t\t});\n\t\t\tconst packageInfo = await getPackageInfo();\n\t\t\tconst betterAuthVersion =\n\t\t\t\tpackageInfo.dependencies?.[\"better-auth\"] ||\n\t\t\t\tpackageInfo.devDependencies?.[\"better-auth\"] ||\n\t\t\t\tpackageInfo.peerDependencies?.[\"better-auth\"] ||\n\t\t\t\tpackageInfo.optionalDependencies?.[\"better-auth\"] ||\n\t\t\t\t\"Unknown\";\n\n\t\t\treturn {\n\t\t\t\tversion: betterAuthVersion,\n\t\t\t\tconfig: sanitizeBetterAuthConfig(config),\n\t\t\t};\n\t\t} finally {\n\t\t\t// Restore console methods\n\t\t\tif (suppressLogs) {\n\t\t\t\tconsole.log = originalLog;\n\t\t\t\tconsole.warn = originalWarn;\n\t\t\t\tconsole.error = originalError;\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\treturn {\n\t\t\tversion: \"Unknown\",\n\t\t\tconfig: null,\n\t\t\terror:\n\t\t\t\terror instanceof Error\n\t\t\t\t\t? error.message\n\t\t\t\t\t: \"Failed to load Better Auth config\",\n\t\t};\n\t}\n}\n\nfunction formatOutput(data: any, indent = 0): string {\n\tconst spaces = \" \".repeat(indent);\n\n\tif (data === null || data === undefined) {\n\t\treturn `${spaces}${chalk.gray(\"N/A\")}`;\n\t}\n\n\tif (\n\t\ttypeof data === \"string\" ||\n\t\ttypeof data === \"number\" ||\n\t\ttypeof data === \"boolean\"\n\t) {\n\t\treturn `${spaces}${data}`;\n\t}\n\n\tif (Array.isArray(data)) {\n\t\tif (data.length === 0) {\n\t\t\treturn `${spaces}${chalk.gray(\"[]\")}`;\n\t\t}\n\t\treturn data.map((item) => formatOutput(item, indent)).join(\"\\n\");\n\t}\n\n\tif (typeof data === \"object\") {\n\t\tconst entries = Object.entries(data);\n\t\tif (entries.length === 0) {\n\t\t\treturn `${spaces}${chalk.gray(\"{}\")}`;\n\t\t}\n\n\t\treturn entries\n\t\t\t.map(([key, value]) => {\n\t\t\t\tif (\n\t\t\t\t\ttypeof value === \"object\" &&\n\t\t\t\t\tvalue !== null &&\n\t\t\t\t\t!Array.isArray(value)\n\t\t\t\t) {\n\t\t\t\t\treturn `${spaces}${chalk.cyan(key)}:\\n${formatOutput(value, indent + 2)}`;\n\t\t\t\t}\n\t\t\t\treturn `${spaces}${chalk.cyan(key)}: ${formatOutput(value, 0)}`;\n\t\t\t})\n\t\t\t.join(\"\\n\");\n\t}\n\n\treturn `${spaces}${JSON.stringify(data)}`;\n}\n\nexport const info = new Command(\"info\")\n\t.description(\"Display system and Better Auth configuration information\")\n\t.option(\"--cwd <cwd>\", \"The working directory\", process.cwd())\n\t.option(\"--config <config>\", \"Path to the Better Auth configuration file\")\n\t.option(\"-j, --json\", \"Output as JSON\")\n\t.option(\"-c, --copy\", \"Copy output to clipboard (requires pbcopy/xclip)\")\n\t.action(async (options) => {\n\t\tconst projectRoot = path.resolve(options.cwd || process.cwd());\n\n\t\t// Collect all information\n\t\tconst systemInfo = getSystemInfo();\n\t\tconst nodeInfo = getNodeInfo();\n\t\tconst packageManager = getPackageManager();\n\t\tconst frameworks = getFrameworkInfo(projectRoot);\n\t\tconst databases = getDatabaseInfo(projectRoot);\n\t\tconst betterAuthInfo = await getBetterAuthInfo(\n\t\t\tprojectRoot,\n\t\t\toptions.config,\n\t\t\toptions.json,\n\t\t);\n\n\t\tconst fullInfo = {\n\t\t\tsystem: systemInfo,\n\t\t\tnode: nodeInfo,\n\t\t\tpackageManager,\n\t\t\tframeworks,\n\t\t\tdatabases,\n\t\t\tbetterAuth: betterAuthInfo,\n\t\t};\n\n\t\tif (options.json) {\n\t\t\tconst jsonOutput = JSON.stringify(fullInfo, null, 2);\n\t\t\tconsole.log(jsonOutput);\n\n\t\t\tif (options.copy) {\n\t\t\t\ttry {\n\t\t\t\t\tconst platform = os.platform();\n\t\t\t\t\tif (platform === \"darwin\") {\n\t\t\t\t\t\texecSync(\"pbcopy\", { input: jsonOutput });\n\t\t\t\t\t\tconsole.log(chalk.green(\"\\n✓ Copied to clipboard\"));\n\t\t\t\t\t} else if (platform === \"linux\") {\n\t\t\t\t\t\texecSync(\"xclip -selection clipboard\", { input: jsonOutput });\n\t\t\t\t\t\tconsole.log(chalk.green(\"\\n✓ Copied to clipboard\"));\n\t\t\t\t\t} else if (platform === \"win32\") {\n\t\t\t\t\t\texecSync(\"clip\", { input: jsonOutput });\n\t\t\t\t\t\tconsole.log(chalk.green(\"\\n✓ Copied to clipboard\"));\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\tconsole.log(chalk.yellow(\"\\n⚠ Could not copy to clipboard\"));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Format and display output\n\t\tconsole.log(chalk.bold(\"\\n📊 Better Auth System Information\\n\"));\n\t\tconsole.log(chalk.gray(\"=\".repeat(50)));\n\n\t\tconsole.log(chalk.bold.white(\"\\n🖥️ System Information:\"));\n\t\tconsole.log(formatOutput(systemInfo, 2));\n\n\t\tconsole.log(chalk.bold.white(\"\\n📦 Node.js:\"));\n\t\tconsole.log(formatOutput(nodeInfo, 2));\n\n\t\tconsole.log(chalk.bold.white(\"\\n📦 Package Manager:\"));\n\t\tconsole.log(formatOutput(packageManager, 2));\n\n\t\tif (frameworks) {\n\t\t\tconsole.log(chalk.bold.white(\"\\n🚀 Frameworks:\"));\n\t\t\tconsole.log(formatOutput(frameworks, 2));\n\t\t}\n\n\t\tif (databases) {\n\t\t\tconsole.log(chalk.bold.white(\"\\n💾 Database Clients:\"));\n\t\t\tconsole.log(formatOutput(databases, 2));\n\t\t}\n\n\t\tconsole.log(chalk.bold.white(\"\\n🔐 Better Auth:\"));\n\t\tif (betterAuthInfo.error) {\n\t\t\tconsole.log(` ${chalk.red(\"Error:\")} ${betterAuthInfo.error}`);\n\t\t} else {\n\t\t\tconsole.log(` ${chalk.cyan(\"Version\")}: ${betterAuthInfo.version}`);\n\t\t\tif (betterAuthInfo.config) {\n\t\t\t\tconsole.log(` ${chalk.cyan(\"Configuration\")}:`);\n\t\t\t\tconsole.log(formatOutput(betterAuthInfo.config, 4));\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(chalk.gray(\"\\n\" + \"=\".repeat(50)));\n\t\tconsole.log(chalk.gray(\"\\n💡 Tip: Use --json flag for JSON output\"));\n\t\tconsole.log(chalk.gray(\"💡 Use --copy flag to copy output to clipboard\"));\n\t\tconsole.log(\n\t\t\tchalk.gray(\"💡 When reporting issues, include this information\\n\"),\n\t\t);\n\n\t\tif (options.copy) {\n\t\t\tconst textOutput = `\nBetter Auth System Information\n==============================\n\nSystem Information:\n${JSON.stringify(systemInfo, null, 2)}\n\nNode.js:\n${JSON.stringify(nodeInfo, null, 2)}\n\nPackage Manager:\n${JSON.stringify(packageManager, null, 2)}\n\nFrameworks:\n${JSON.stringify(frameworks, null, 2)}\n\nDatabase Clients:\n${JSON.stringify(databases, null, 2)}\n\nBetter Auth:\n${JSON.stringify(betterAuthInfo, null, 2)}\n`;\n\n\t\t\ttry {\n\t\t\t\tconst platform = os.platform();\n\t\t\t\tif (platform === \"darwin\") {\n\t\t\t\t\texecSync(\"pbcopy\", { input: textOutput });\n\t\t\t\t\tconsole.log(chalk.green(\"✓ Copied to clipboard\"));\n\t\t\t\t} else if (platform === \"linux\") {\n\t\t\t\t\texecSync(\"xclip -selection clipboard\", { input: textOutput });\n\t\t\t\t\tconsole.log(chalk.green(\"✓ Copied to clipboard\"));\n\t\t\t\t} else if (platform === \"win32\") {\n\t\t\t\t\texecSync(\"clip\", { input: textOutput });\n\t\t\t\t\tconsole.log(chalk.green(\"✓ Copied to clipboard\"));\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tconsole.log(chalk.yellow(\"⚠ Could not copy to clipboard\"));\n\t\t\t}\n\t\t}\n\t});\n","import { exec } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { Awaitable, LiteralString } from \"@better-auth/core\";\nimport { env } from \"@better-auth/core/env\";\nimport type { PackageJson } from \"type-fest\";\nimport { findMonorepoRoot } from \"./get-package-info\";\n\nexport async function checkPackageManagers() {\n\tconst hasPnpm = await getVersion(\"pnpm\");\n\tconst hasBun = await getVersion(\"bun\");\n\tconst hasYarn = await getVersion(\"yarn\");\n\n\treturn {\n\t\thasPnpm,\n\t\thasBun,\n\t\thasYarn,\n\t};\n}\n\nexport const PACKAGE_MANAGER = [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as const;\nexport type PackageManager = (typeof PACKAGE_MANAGER)[number];\n\nexport async function detectPackageManager(\n\tcwd: string,\n\tpackageJson: PackageJson,\n): Promise<{\n\tpackageManager: PackageManager;\n\tversion?: string | undefined;\n}> {\n\tconst monorepoRoot = await findMonorepoRoot(cwd);\n\tfor (const strategy of [\n\t\tenvStrategy,\n\t\tpackageJsonStrategy,\n\t\tlockFileStrategy,\n\t\tconfigStrategy,\n\t\tcliStrategy,\n\t]) {\n\t\tconst result = await strategy({ cwd: monorepoRoot ?? cwd, packageJson });\n\t\tif (\n\t\t\tresult !== null &&\n\t\t\tPACKAGE_MANAGER.includes(\n\t\t\t\tresult.packageManager.toLowerCase() as PackageManager,\n\t\t\t)\n\t\t) {\n\t\t\treturn result as { packageManager: PackageManager };\n\t\t}\n\t}\n\treturn { packageManager: \"npm\" };\n}\n\ntype Strategy = (ctx: { cwd: string; packageJson: PackageJson }) => Awaitable<{\n\tpackageManager: PackageManager | LiteralString;\n\tversion?: string | undefined;\n} | null>;\n\nconst envStrategy: Strategy = () => {\n\tconst userAgent = env.npm_config_user_agent;\n\tif (!userAgent) {\n\t\treturn null;\n\t}\n\n\tconst pmSpec = userAgent.split(\" \")[0]!;\n\tconst separatorPos = pmSpec.lastIndexOf(\"/\");\n\tconst packageManager = pmSpec.substring(0, separatorPos) as PackageManager;\n\tconst version = pmSpec.substring(separatorPos + 1);\n\n\treturn {\n\t\tpackageManager,\n\t\tversion,\n\t};\n};\n\nconst lockFileStrategy: Strategy = ({ cwd }) => {\n\tif (existsSync(join(cwd, \"package-lock.json\"))) {\n\t\treturn { packageManager: \"npm\" };\n\t}\n\tif (existsSync(join(cwd, \"yarn.lock\"))) {\n\t\treturn { packageManager: \"yarn\" };\n\t}\n\tif (existsSync(join(cwd, \"pnpm-lock.yaml\"))) {\n\t\treturn { packageManager: \"pnpm\" };\n\t}\n\tif (existsSync(join(cwd, \"bun.lock\")) || existsSync(join(cwd, \"bun.lockb\"))) {\n\t\treturn { packageManager: \"bun\" };\n\t}\n\treturn null;\n};\n\nconst packageJsonStrategy: Strategy = ({ packageJson }) => {\n\tconst [packageManager, version] =\n\t\tpackageJson.packageManager?.split(\"@\", 2) ?? [];\n\tif (\n\t\tpackageManager &&\n\t\tPACKAGE_MANAGER.includes(packageManager.toLowerCase() as PackageManager)\n\t) {\n\t\treturn { packageManager, version };\n\t}\n\treturn null;\n};\n\nconst configStrategy: Strategy = ({ cwd, packageJson }) => {\n\tif (typeof packageJson.workspaces === \"object\") {\n\t\tif (\"nohoist\" in packageJson.workspaces) {\n\t\t\treturn { packageManager: \"yarn\" };\n\t\t}\n\t\tif (\"catalog\" in packageJson.workspaces) {\n\t\t\treturn { packageManager: \"bun\" };\n\t\t}\n\t}\n\tif (\n\t\ttypeof packageJson.pnpm !== \"undefined\" ||\n\t\texistsSync(join(cwd, \"pnpm-workspace.yaml\"))\n\t) {\n\t\treturn { packageManager: \"pnpm\" };\n\t}\n\tif (\n\t\texistsSync(join(cwd, \".yarnrc.yml\")) ||\n\t\texistsSync(join(cwd, \".yarnrc\"))\n\t) {\n\t\treturn { packageManager: \"yarn\" };\n\t}\n\tif (existsSync(join(cwd, \"bunfig.toml\"))) {\n\t\treturn { packageManager: \"bun\" };\n\t}\n\treturn null;\n};\n\nconst cliStrategy: Strategy = async ({ cwd }) => {\n\tconst { hasBun, hasPnpm, hasYarn } = await checkPackageManagers();\n\n\tif (hasBun) {\n\t\treturn { packageManager: \"bun\" };\n\t}\n\tif (hasPnpm) {\n\t\treturn { packageManager: \"pnpm\" };\n\t}\n\tif (hasYarn) {\n\t\treturn { packageManager: \"yarn\" };\n\t}\n\treturn null;\n};\n\nfunction stripQuotes(s: string): string {\n\tconst trimmed = s.trim();\n\tif (\n\t\t(trimmed.startsWith('\"') && trimmed.endsWith('\"')) ||\n\t\t(trimmed.startsWith(\"'\") && trimmed.endsWith(\"'\"))\n\t) {\n\t\treturn trimmed.slice(1, -1);\n\t}\n\treturn trimmed;\n}\n\nfunction _parseCatalogLine(line: string): [string, string] | [] {\n\tconst entry = line.trim().replace(/^- /, \"\").trim();\n\tconst delimiterIndex = entry.indexOf(\":\");\n\tif (delimiterIndex === -1) return [];\n\tconst key = stripQuotes(entry.slice(0, delimiterIndex));\n\tconst value = stripQuotes(entry.slice(delimiterIndex + 1));\n\treturn [key, value];\n}\n\nexport function getPkgManagerStr({\n\tpackageManager,\n\tversion,\n}: {\n\tpackageManager: PackageManager;\n\tversion?: string | null | undefined;\n}) {\n\tif (!version) {\n\t\treturn packageManager;\n\t}\n\treturn `${packageManager}@${version}`;\n}\n\nexport async function getVersion(\n\tpkgManager: PackageManager,\n): Promise<string | null> {\n\tconst version = await new Promise<string | null>((resolve) => {\n\t\texec(`${pkgManager} -v`, (err, stdout) => {\n\t\t\tif (err) {\n\t\t\t\tresolve(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(stdout.trim());\n\t\t});\n\t});\n\n\treturn version;\n}\n","let possiblePaths = [\n\t\"auth.ts\",\n\t\"auth.tsx\",\n\t\"auth.js\",\n\t\"auth.jsx\",\n\t\"auth.server.js\",\n\t\"auth.server.ts\",\n\t\"auth/index.ts\",\n\t\"auth/index.tsx\",\n\t\"auth/index.js\",\n\t\"auth/index.jsx\",\n\t\"auth/index.server.js\",\n\t\"auth/index.server.ts\",\n];\n\npossiblePaths = [\n\t...possiblePaths,\n\t...possiblePaths.map((it) => `lib/server/${it}`),\n\t...possiblePaths.map((it) => `server/auth/${it}`),\n\t...possiblePaths.map((it) => `server/${it}`),\n\t...possiblePaths.map((it) => `auth/${it}`),\n\t...possiblePaths.map((it) => `lib/${it}`),\n\t...possiblePaths.map((it) => `utils/${it}`),\n];\npossiblePaths = [\n\t...possiblePaths,\n\t...possiblePaths.map((it) => `src/${it}`),\n\t...possiblePaths.map((it) => `app/${it}`),\n];\n\nexport const possibleAuthConfigPaths = possiblePaths;\n\nlet _possibleClientConfigPaths = [\n\t\"auth-client.ts\",\n\t\"auth-client.tsx\",\n\t\"auth-client.js\",\n\t\"auth-client.jsx\",\n\t\"auth-client.server.js\",\n\t\"auth-client.server.ts\",\n\t\"auth-client/index.ts\",\n\t\"auth-client/index.tsx\",\n\t\"auth-client/index.js\",\n\t\"auth-client/index.jsx\",\n\t\"auth-client/index.server.js\",\n\t\"auth-client/index.server.ts\",\n];\n\n_possibleClientConfigPaths = [\n\t..._possibleClientConfigPaths,\n\t..._possibleClientConfigPaths.map((it) => `lib/server/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `server/auth/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `server/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `auth/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `lib/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `utils/${it}`),\n];\n_possibleClientConfigPaths = [\n\t..._possibleClientConfigPaths,\n\t..._possibleClientConfigPaths.map((it) => `src/${it}`),\n\t..._possibleClientConfigPaths.map((it) => `app/${it}`),\n];\n\nexport const possibleClientConfigPaths = _possibleClientConfigPaths;\n","import { exec } from \"node:child_process\";\nimport type { LiteralString } from \"@better-auth/core\";\n\nconst flagsMap = {\n\tnpm: {\n\t\tdev: \"--save-dev\",\n\t\toptional: \"--save-optional\",\n\t},\n\tpnpm: {\n\t\tdev: \"--save-dev\",\n\t\tpeer: \"--save-peer\",\n\t\toptional: \"--save-optional\",\n\t\tcatalog: (name?: string) => {\n\t\t\tif (name) {\n\t\t\t\treturn `--save-catalog-name ${name}`;\n\t\t\t}\n\t\t\treturn \"--save-catalog\";\n\t\t},\n\t},\n\tbun: {\n\t\tdev: \"--dev\",\n\t\tpeer: \"--peer\",\n\t\toptional: \"--optional\",\n\t},\n\tyarn: {\n\t\tdev: \"--dev\",\n\t\tpeer: \"--peer\",\n\t\toptional: \"--optional\",\n\t},\n};\n\nexport function installDependencies({\n\tdependencies,\n\tpackageManager,\n\tcwd,\n\ttype = \"prod\",\n\tcatalogName,\n}: {\n\tdependencies: string | string[];\n\tpackageManager: \"npm\" | \"pnpm\" | \"bun\" | \"yarn\" | LiteralString;\n\tcwd: string;\n\ttype?: \"prod\" | \"peer\" | \"optional\" | \"dev\" | \"catalog\" | undefined;\n\tcatalogName?: string;\n}): Promise<boolean> {\n\tlet installCommand: string;\n\tconst flags: string[] = [];\n\tswitch (packageManager) {\n\t\tcase \"npm\":\n\t\t\tinstallCommand = \"npm install\";\n\t\t\tflags.push(\"--force\");\n\t\t\tbreak;\n\t\tcase \"pnpm\":\n\t\t\tinstallCommand = \"pnpm add\";\n\t\t\tbreak;\n\t\tcase \"bun\":\n\t\t\tinstallCommand = \"bun install\";\n\t\t\tbreak;\n\t\tcase \"yarn\":\n\t\t\tinstallCommand = \"yarn install\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(\"Invalid package manager\");\n\t}\n\n\tconst flagMap = flagsMap[packageManager as \"pnpm\" | \"npm\"];\n\tif (type === \"catalog\") {\n\t\tif (\"catalog\" in flagMap) {\n\t\t\tconst catalogFlag = flagMap[\"catalog\"];\n\t\t\tflags.push(catalogFlag(catalogName));\n\t\t} else {\n\t\t\tthrow new Error(`Catalog flag is not supported by \"${packageManager}\"`);\n\t\t}\n\t} else {\n\t\tconst flag = flagMap?.[type as keyof typeof flagMap];\n\t\tif (flag) {\n\t\t\tflags.push(flag);\n\t\t}\n\t}\n\tconst command = `${installCommand}${flags.length > 0 ? ` ${flags.join(\" \")}` : \"\"} ${Array.isArray(dependencies) ? dependencies.join(\" \") : dependencies}`;\n\n\treturn new Promise((resolve, reject) => {\n\t\texec(command, { cwd }, (error, stdout, stderr) => {\n\t\t\tif (error) {\n\t\t\t\treject(new Error(stderr));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(true);\n\t\t});\n\t});\n}\n","export const FRAMEWORKS = [\n\t{\n\t\tname: \"Astro\",\n\t\tid: \"astro\",\n\t\tdependency: \"astro\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/react\", // assume react is used for astro\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: \"pages/api/auth/[...all].ts\",\n\t\t\tcode: `import { auth } from \"~/auth\";\nimport type { APIRoute } from \"astro\";\n\nexport const ALL: APIRoute = async (ctx) => {\n\t// If you want to use rate limiting, make sure to set the 'x-forwarded-for' header to the request headers from the context\n\t// ctx.request.headers.set(\"x-forwarded-for\", ctx.clientAddress);\n\treturn auth.handler(ctx.request);\n};`,\n\t\t},\n\t\tconfigPaths: [\n\t\t\t\"astro.config.mjs\",\n\t\t\t\"astro.config.ts\",\n\t\t\t\"astro.config.js\",\n\t\t\t\"astro.config.cjs\",\n\t\t],\n\t},\n\t// todo: remove in future versions\n\t{\n\t\tname: \"Remix\",\n\t\tid: \"remix\",\n\t\tdependency: \"@remix-run/server-runtime\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/react\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: \"app/lib/auth.server.ts\",\n\t\t\tcode: `import { betterAuth } from \"better-auth\"\n\nexport const auth = betterAuth({\n database: {\n provider: \"postgres\", //change this to your database provider\n url: process.env.DATABASE_URL, // path to your database or connection string\n }\n})`,\n\t\t},\n\t\tconfigPaths: [\"remix.config.js\"],\n\t},\n\t{\n\t\tname: \"React Router v7\",\n\t\tid: \"react-router-v7\",\n\t\tdependency: \"react-router\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/react\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: \"app/lib/auth.server.ts\",\n\t\t\tcode: `import { betterAuth } from \"better-auth\"\n\nexport const auth = betterAuth({\n database: {\n provider: \"postgres\", //change this to your database provider\n url: process.env.DATABASE_URL, // path to your database or connection string\n }\n})`,\n\t\t},\n\t\tconfigPaths: [\"react-router.config.ts\"],\n\t},\n\t{\n\t\tname: \"Next.js\",\n\t\tid: \"next\",\n\t\tdependency: \"next\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/react\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: \"api/auth/[...all]/route.ts\",\n\t\t\tcode: `import { auth } from \"@/lib/auth\";\nimport { toNextJsHandler } from \"better-auth/next-js\";\nexport const { GET, POST } = toNextJsHandler(auth.handler);`,\n\t\t},\n\t\tconfigPaths: [\n\t\t\t\"next.config.js\",\n\t\t\t\"next.config.ts\",\n\t\t\t\"next.config.mjs\",\n\t\t\t\".next/server/next.config.js\",\n\t\t\t\".next/server/next.config.ts\",\n\t\t\t\".next/server/next.config.mjs\",\n\t\t],\n\t},\n\t{\n\t\tname: \"Nuxt\",\n\t\tid: \"nuxt\",\n\t\tdependency: \"nuxt\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/vue\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: \"server/api/auth/[...all].ts\",\n\t\t\tcode: `import { auth } from \"~/lib/auth\"; // import your auth config\n\nexport default defineEventHandler((event) => {\n\treturn auth.handler(toWebRequest(event));\n});`,\n\t\t},\n\t\tconfigPaths: [\n\t\t\t\"nuxt.config.js\",\n\t\t\t\"nuxt.config.ts\",\n\t\t\t\"nuxt.config.mjs\",\n\t\t\t\"nuxt.config.cjs\",\n\t\t],\n\t},\n\t{\n\t\tname: \"SvelteKit\",\n\t\tid: \"sveltekit\",\n\t\tdependency: \"@sveltejs/kit\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/svelte\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: `hooks.server.ts`,\n\t\t\tcode: `import { auth } from \"$lib/auth\";\nimport { svelteKitHandler } from \"better-auth/svelte-kit\";\nimport { building } from \"$app/environment\";\n\nexport async function handle({ event, resolve }) {\n return svelteKitHandler({ event, resolve, auth, building });\n}`,\n\t\t},\n\t\tconfigPaths: [\n\t\t\t\"svelte.config.js\",\n\t\t\t\"svelte.config.ts\",\n\t\t\t\"svelte.config.mjs\",\n\t\t\t\"svelte.config.cjs\",\n\t\t],\n\t},\n\t{\n\t\tname: \"Solid Start\",\n\t\tid: \"solid-start\",\n\t\tdependency: \"solid-start\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/solid\",\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: `routes/api/auth/*auth.ts`,\n\t\t\tcode: `import { auth } from \"~/lib/auth\";\nimport { toSolidStartHandler } from \"better-auth/solid-start\";\n\nexport const { GET, POST } = toSolidStartHandler(auth);`,\n\t\t},\n\t\tconfigPaths: [\"app.config.ts\"],\n\t},\n\t{\n\t\tname: \"Tanstack Start\",\n\t\tid: \"tanstack-start\",\n\t\tdependency: \"tanstack-start\",\n\t\tauthClient: {\n\t\t\timportPath: \"better-auth/react\", // assume react is used for tanstack start\n\t\t},\n\t\trouteHandler: {\n\t\t\tpath: `src/routes/api/auth/$.ts`,\n\t\t\tcode: `import { auth } from '@/lib/auth'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/auth/$')({\n server: {\n handlers: {\n GET: ({ request }) => {\n return auth.handler(request)\n },\n POST: ({ request }) => {\n return auth.handler(request)\n },\n },\n },\n})`,\n\t\t},\n\t\tconfigPaths: null,\n\t},\n\t{\n\t\tname: \"Hono\",\n\t\tid: \"hono\",\n\t\tdependency: \"hono\",\n\t\tauthClient: null,\n\t\trouteHandler: null,\n\t\tconfigPaths: null,\n\t},\n\t{\n\t\tname: \"Fastify\",\n\t\tid: \"fastify\",\n\t\tdependency: \"fastify\",\n\t\tauthClient: null,\n\t\trouteHandler: null,\n\t\tconfigPaths: null,\n\t},\n\t{\n\t\tname: \"Express\",\n\t\tid: \"express\",\n\t\tdependency: \"express\",\n\t\tauthClient: null,\n\t\trouteHandler: null,\n\t\tconfigPaths: null,\n\t},\n\t{\n\t\tname: \"Elysia\",\n\t\tid: \"elysia\",\n\t\tdependency: \"elysia\",\n\t\tauthClient: null,\n\t\trouteHandler: null,\n\t\tconfigPaths: null,\n\t},\n\t{\n\t\tname: \"Nitro\",\n\t\tid: \"nitro\",\n\t\tdependency: \"nitro\",\n\t\tauthClient: null,\n\t\trouteHandler: null,\n\t\tconfigPaths: [\"nitro.config.ts\"],\n\t},\n] as const satisfies {\n\tname: string;\n\tid: string;\n\tdependency: string;\n\tauthClient: {\n\t\timportPath: string;\n\t} | null;\n\trouteHandler: {\n\t\tpath: string;\n\t\tcode: string;\n\t} | null;\n\tconfigPaths: string[] | null;\n}[];\n\nexport type Framework = (typeof FRAMEWORKS)[number];\n","export const SOCIAL_PROVIDERS = [\n\t\"apple\",\n\t\"atlassian\",\n\t\"cognito\",\n\t\"discord\",\n\t\"dropbox\",\n\t\"facebook\",\n\t\"figma\",\n\t\"github\",\n\t\"gitlab\",\n\t\"google\",\n\t\"huggingface\",\n\t\"kakao\",\n\t\"kick\",\n\t\"line\",\n\t\"linear\",\n\t\"linkedin\",\n\t\"microsoft\",\n\t\"naver\",\n\t\"notion\",\n\t\"paybin\",\n\t\"paypal\",\n\t\"polar\",\n\t\"reddit\",\n\t\"roblox\",\n\t\"salesforce\",\n\t\"slack\",\n\t\"spotify\",\n\t\"tiktok\",\n\t\"twitch\",\n\t\"twitter\",\n\t\"vercel\",\n\t\"vk\",\n\t\"zoom\",\n] as const;\n\nexport type SocialProvider = (typeof SOCIAL_PROVIDERS)[number];\n\nexport type ProviderOption = {\n\tname: string;\n\tenvVar: string;\n};\n\nexport type ProviderConfig = {\n\toptions: ProviderOption[];\n};\n\n/**\n * Configuration for each social provider specifying what options are required\n */\nexport const SOCIAL_PROVIDER_CONFIGS: Record<SocialProvider, ProviderConfig> = {\n\tapple: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"APPLE_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"APPLE_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tatlassian: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"ATLASSIAN_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"ATLASSIAN_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tcognito: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"COGNITO_CLIENT_ID\" },\n\t\t\t{ name: \"domain\", envVar: \"COGNITO_DOMAIN\" },\n\t\t\t{ name: \"region\", envVar: \"COGNITO_REGION\" },\n\t\t\t{ name: \"userPoolId\", envVar: \"COGNITO_USERPOOL_ID\" },\n\t\t],\n\t},\n\tdiscord: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"DISCORD_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"DISCORD_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tdropbox: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"DROPBOX_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"DROPBOX_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tfacebook: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"FACEBOOK_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"FACEBOOK_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tfigma: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"FIGMA_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"FIGMA_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tgithub: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"GITHUB_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"GITHUB_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tgitlab: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"GITLAB_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"GITLAB_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tgoogle: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"GOOGLE_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"GOOGLE_CLIENT_SECRET\" },\n\t\t],\n\t},\n\thuggingface: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"HUGGINGFACE_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"HUGGINGFACE_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tkakao: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"KAKAO_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"KAKAO_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tkick: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"KICK_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"KICK_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tline: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"LINE_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"LINE_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tlinear: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"LINEAR_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"LINEAR_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tlinkedin: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"LINKEDIN_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"LINKEDIN_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tmicrosoft: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"MICROSOFT_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"MICROSOFT_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tnaver: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"NAVER_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"NAVER_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tnotion: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"NOTION_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"NOTION_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tpaybin: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"PAYBIN_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"PAYBIN_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tpaypal: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"PAYPAL_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"PAYPAL_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tpolar: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"POLAR_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"POLAR_CLIENT_SECRET\" },\n\t\t],\n\t},\n\treddit: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"REDDIT_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"REDDIT_CLIENT_SECRET\" },\n\t\t],\n\t},\n\troblox: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"ROBLOX_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"ROBLOX_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tsalesforce: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"SALESFORCE_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"SALESFORCE_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tslack: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"SLACK_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"SLACK_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tspotify: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"SPOTIFY_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"SPOTIFY_CLIENT_SECRET\" },\n\t\t],\n\t},\n\ttiktok: {\n\t\toptions: [\n\t\t\t{ name: \"clientKey\", envVar: \"TIKTOK_CLIENT_KEY\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"TIKTOK_CLIENT_SECRET\" },\n\t\t],\n\t},\n\ttwitch: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"TWITCH_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"TWITCH_CLIENT_SECRET\" },\n\t\t],\n\t},\n\ttwitter: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"TWITTER_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"TWITTER_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tvercel: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"VERCEL_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"VERCEL_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tvk: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"VK_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"VK_CLIENT_SECRET\" },\n\t\t],\n\t},\n\tzoom: {\n\t\toptions: [\n\t\t\t{ name: \"clientId\", envVar: \"ZOOM_CLIENT_ID\" },\n\t\t\t{ name: \"clientSecret\", envVar: \"ZOOM_CLIENT_SECRET\" },\n\t\t],\n\t},\n};\n","import { format as prettierFormat } from \"prettier\";\n\nexport const formatCode = async (code: string) => {\n\treturn await prettierFormat(code, {\n\t\tparser: \"typescript\",\n\t});\n};\n","import { formatCode } from \"./format\";\n\nexport type NamedImportGroup = {\n\t/**\n\t * The path of the import\n\t */\n\tpath: string;\n\t/**\n\t * The imports in the group.\n\t */\n\timports: Import;\n\t/**\n\t * Wether the import is importing from a `default export` or a `named export`\n\t */\n\tisNamedImport: true;\n};\n\nexport type NormalImportGroup = {\n\t/**\n\t * The path of the import\n\t */\n\tpath: string;\n\t/**\n\t * The imports in the group.\n\t */\n\timports: Import[];\n\t/**\n\t * Wether the import is a default import\n\t */\n\tisNamedImport: false;\n};\n\n/**\n * A collection of imports that are grouped by the same path.\n */\nexport type ImportGroup = NormalImportGroup | NamedImportGroup;\n\n/**\n * An import. Doesn't necessarily represent a single import statement. (Unless the `isDefaultExport` is `true`)\n */\nexport type Import = {\n\tname: string;\n\talias: string | null;\n\tasType: boolean;\n};\n\n/**\n * Helper function to create an import object.\n */\nexport const createImport = ({\n\tname,\n\talias,\n\tasType,\n}: {\n\tname: string;\n\talias?: string;\n\tasType?: boolean;\n}) => {\n\treturn {\n\t\tname,\n\t\talias: alias ?? null,\n\t\tasType: asType ?? false,\n\t} satisfies Import;\n};\n\n/**\n * Converts an import object to a string. This is specifically for the variables in the import.\n * For the full import statement, use the `getImportString` function.\n */\nconst getImportVariableString = (import_: Import) => {\n\tconst alias = import_.alias ? ` as ${import_.alias}` : \"\";\n\tconst asType = import_.asType ? \"type \" : \"\";\n\treturn `${asType}${import_.name}${alias}`.trim();\n};\n\n/**\n * Takes a collection of imports and returns a string of import statements.\n */\nexport const getImportString = async (imports: ImportGroup[]) => {\n\tconst groupedImports = groupImports(imports);\n\tlet importString = \"\";\n\tfor (const { imports, path, isNamedImport } of groupedImports) {\n\t\tconst vars = isNamedImport\n\t\t\t? getImportVariableString(imports)\n\t\t\t: `{ ${imports.map(getImportVariableString).join(\", \")} }`;\n\t\timportString += `import ${vars} from \"${path}\";\\n`;\n\t}\n\treturn (await formatCode(importString)).trim();\n};\n\n/**\n * Takes a collection of imports and groups them by path.\n */\nexport const groupImports = (imports: ImportGroup[]) => {\n\tconst result: ImportGroup[] = [];\n\n\tfor (const import_ of imports) {\n\t\t// If the import is a named import, add it to the result.\n\t\tif (import_.isNamedImport) {\n\t\t\tresult.push(import_);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// If the import is a normal import, check if it already exists in the result.\n\t\tconst existingIndex = result.findIndex(\n\t\t\t(x) => x.path === import_.path && !x.isNamedImport,\n\t\t);\n\n\t\t// If the import already exists, add the imports to the existing import.\n\t\tif (existingIndex !== -1) {\n\t\t\t(result[existingIndex]!.imports as Import[]).push(...import_.imports);\n\t\t\tcontinue;\n\t\t}\n\n\t\t// If the import is not in the result, add it.\n\t\tresult.push(import_);\n\t}\n\n\t// Sort the result by path, with named imports at the end.\n\treturn result.sort((a, b) => {\n\t\tif (a.isNamedImport && !b.isNamedImport) return 1;\n\t\tif (!a.isNamedImport && b.isNamedImport) return -1;\n\t\treturn a.path.localeCompare(b.path);\n\t});\n};\n","// This is a temporary plugin config file until we support actually using the plugin config files.\n\nimport * as z from \"zod/v4\";\nimport type { GetArgumentsOptions } from \"../generate-auth\";\nimport type { ImportGroup } from \"../utility/imports\";\nimport { createImport } from \"../utility/imports\";\n\nexport type Plugin = keyof typeof tempPluginsConfig;\n\ntype DependenciesConfig = {\n\tdependencies?: string[];\n\tdevDependencies?: string[];\n};\n\nexport type PluginConfig = {\n\tdisplayName: string;\n\tauth: {\n\t\tfunction: string;\n\t\timports: ImportGroup[];\n\t\targuments?: GetArgumentsOptions[];\n\t} & DependenciesConfig;\n\tauthClient:\n\t\t| ({\n\t\t\t\tfunction: string;\n\t\t\t\timports: ImportGroup[];\n\t\t\t\targuments?: GetArgumentsOptions[];\n\t\t } & DependenciesConfig)\n\t\t| null;\n} & DependenciesConfig;\n\nexport type PluginsConfig = {\n\t[key in Plugin]: PluginConfig;\n};\n\nexport const tempPluginsConfig = {\n\ttwoFactor: {\n\t\tdisplayName: \"Two Factor\",\n\t\tauth: {\n\t\t\tfunction: \"twoFactor\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"twoFactor\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"two-factor-issuer\",\n\t\t\t\t\tquestion: \"What is the issuer for the two factor authentication?\",\n\t\t\t\t\tdescription: \"The issuer for the two factor authentication.\",\n\t\t\t\t\tdefaultValue: \"My App\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"issuer\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"skip-verification-on-enable\",\n\t\t\t\t\tquestion: \"Skip verification on enable two factor authentication?\",\n\t\t\t\t\tdescription: \"Skip verification on enable two factor authentication.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"skipVerificationOnEnable\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"totp\",\n\t\t\t\t\tdescription: \"The number of digits for the TOTP code.\",\n\t\t\t\t\tdefaultValue: \"My App\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"totp-otp-digits\",\n\t\t\t\t\t\t\tquestion: \"What is the number of digits for the TOTP code?\",\n\t\t\t\t\t\t\tdescription: \"The number of digits for the TOTP code.\",\n\t\t\t\t\t\t\tdefaultValue: 6,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"digits\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"totp-otp-period\",\n\t\t\t\t\t\t\tquestion: \"What is the period for the TOTP code?\",\n\t\t\t\t\t\t\tdescription: \"The period for the TOTP code.\",\n\t\t\t\t\t\t\tdefaultValue: 30,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"period\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"totp\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"otp\",\n\t\t\t\t\tdescription: \"The options for the OTP code.\",\n\t\t\t\t\tdefaultValue: 3,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"otp-period\",\n\t\t\t\t\t\t\tquestion: \"What is the period for the OTP code?\",\n\t\t\t\t\t\t\tdescription: \"The period for the OTP code.\",\n\t\t\t\t\t\t\tdefaultValue: 3,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"period\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"otp-store-otp\",\n\t\t\t\t\t\t\tquestion: \"How do you want to store the OTP code?\",\n\t\t\t\t\t\t\tdescription: \"The function to store the OTP code.\",\n\t\t\t\t\t\t\tdefaultValue: \"storeOTP\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t\t\t{ value: \"plain\", label: \"Plain text\" },\n\t\t\t\t\t\t\t\t{ value: \"encrypted\", label: \"Encrypted\" },\n\t\t\t\t\t\t\t\t{ value: \"hashed\", label: \"Hashed\" },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"storeOTP\",\n\t\t\t\t\t\t\t\tschema: z.enum([\"plain\", \"encrypted\", \"hashed\"]).optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"otp\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"backup-code\",\n\t\t\t\t\tdescription: \"The options for the backup code.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"backup-code-amount\",\n\t\t\t\t\t\t\tquestion: \"What is the amount of backup codes to generate?\",\n\t\t\t\t\t\t\tdescription: \"The amount of backup codes to generate.\",\n\t\t\t\t\t\t\tdefaultValue: 10,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"amount\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"backup-code-length\",\n\t\t\t\t\t\t\tquestion: \"What is the length of the backup codes?\",\n\t\t\t\t\t\t\tdescription: \"The length of the backup codes.\",\n\t\t\t\t\t\t\tdefaultValue: 10,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"length\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"backupCodeOptions\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"two-factor-schema\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"schema\",\n\t\t\t\t\t},\n\t\t\t\t\tdescription: \"The schema for the two factor plugin.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"two-factor-table\",\n\t\t\t\t\t\t\tquestion: \"What is the name of the two factor table?\",\n\t\t\t\t\t\t\tdescription: \"The name of the two factor table.\",\n\t\t\t\t\t\t\tdefaultValue: \"twoFactor\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"twoFactorTable\",\n\t\t\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"twoFactorClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"twoFactorClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tusername: {\n\t\tdisplayName: \"Username\",\n\t\tauth: {\n\t\t\tfunction: \"username\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"username\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"username-max-username-length\",\n\t\t\t\t\tquestion: \"What is the maximum length of the username?\",\n\t\t\t\t\tdescription: \"The maximum length of the username.\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"maxUsernameLength\",\n\t\t\t\t\t\tschema: z.coerce.number().min(0).positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"username-min-username-length\",\n\t\t\t\t\tquestion: \"What is the minimum length of the username?\",\n\t\t\t\t\tdescription: \"The minimum length of the username.\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"minUsernameLength\",\n\t\t\t\t\t\tschema: z.coerce.number().min(0).positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"username-validation-order\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The order of validation for username and display username.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"username-validation-order-username\",\n\t\t\t\t\t\t\tquestion: \"When should username validation occur?\",\n\t\t\t\t\t\t\tdescription: \"The order of username validation.\",\n\t\t\t\t\t\t\tdefaultValue: \"pre-normalization\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t\t\t{ value: \"pre-normalization\", label: \"Pre-normalization\" },\n\t\t\t\t\t\t\t\t{ value: \"post-normalization\", label: \"Post-normalization\" },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"username\",\n\t\t\t\t\t\t\t\tschema: z\n\t\t\t\t\t\t\t\t\t.enum([\"pre-normalization\", \"post-normalization\"])\n\t\t\t\t\t\t\t\t\t.optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"username-validation-order-display-username\",\n\t\t\t\t\t\t\tquestion: \"When should display username validation occur?\",\n\t\t\t\t\t\t\tdescription: \"The order of display username validation.\",\n\t\t\t\t\t\t\tdefaultValue: \"pre-normalization\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t\t\t{ value: \"pre-normalization\", label: \"Pre-normalization\" },\n\t\t\t\t\t\t\t\t{ value: \"post-normalization\", label: \"Post-normalization\" },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"displayUsername\",\n\t\t\t\t\t\t\t\tschema: z\n\t\t\t\t\t\t\t\t\t.enum([\"pre-normalization\", \"post-normalization\"])\n\t\t\t\t\t\t\t\t\t.optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"validationOrder\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"usernameClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"usernameClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tmagicLink: {\n\t\tdisplayName: \"Magic Link\",\n\t\tauth: {\n\t\t\tfunction: \"magicLink\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"magicLink\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"magic-link-expires-in\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Time in seconds until the magic link expires. Default is (60 * 5) 5 minutes\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"[Magic Link] What is the expiration time for the magic link in seconds?\",\n\t\t\t\t\tdefaultValue: 300,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"expiresIn\",\n\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"magic-link-send-magic-link\",\n\t\t\t\t\tdescription: \"Send magic link implementation.\",\n\t\t\t\t\tquestion: \"[Magic Link] What is the send magic link?\",\n\t\t\t\t\tdefaultValue: `async ({ email, url, token }, request) => {\n\t // Send magic link to the user\n\t}`,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisRequired: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"sendMagicLink\",\n\t\t\t\t\t\tschema: z.coerce.string(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"magic-link-rate-limit\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Rate limit configuration. Default window is 60 seconds and max is 5 requests.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"magic-link-rate-limit-window\",\n\t\t\t\t\t\t\tdescription: \"Window in seconds. Default is 60 seconds.\",\n\t\t\t\t\t\t\tquestion: \"[Magic Link] What is the window in seconds?\",\n\t\t\t\t\t\t\tdefaultValue: 60,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisNumber: true,\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"window\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"magic-link-rate-limit-max\",\n\t\t\t\t\t\t\tdescription: \"Max requests. Default is 5 requests.\",\n\t\t\t\t\t\t\tquestion: \"[Magic Link] What is the max requests?\",\n\t\t\t\t\t\t\tdefaultValue: 5,\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisNumber: true,\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"max\",\n\t\t\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"rateLimit\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"magic-link-store-token\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"This option allows you to configure how the token is stored in your database. Note: This will not affect the token that's sent, it will only affect the token stored in your database.\",\n\t\t\t\t\tquestion: \"[Magic Link] How would you like to store the token?\",\n\t\t\t\t\tdefaultValue: \"plain\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t{ value: \"plain\", label: \"Plain\" },\n\t\t\t\t\t\t{ value: \"hashed\", label: \"Hashed\" },\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"storeToken\",\n\t\t\t\t\t\tschema: z.enum([\"plain\", \"hashed\"]).optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"magicLinkClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"magicLinkClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\temailOTP: {\n\t\tdisplayName: \"Email OTP\",\n\t\tauth: {\n\t\t\tfunction: \"emailOTP\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"emailOTP\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-send-verification-otp\",\n\t\t\t\t\tdescription: \"Function to send email verification\",\n\t\t\t\t\tquestion: \"[Email OTP] What is the send verification o t p?\",\n\t\t\t\t\tdefaultValue: `async ({ email, otp, type }, request) => {\n // Send email with OTP\n}`,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisRequired: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"sendVerificationOTP\",\n\t\t\t\t\t\tschema: z.coerce.string(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-otp-length\",\n\t\t\t\t\tdescription: \"Length of the OTP\",\n\t\t\t\t\tquestion: \"[Email OTP] What is the length of the OTP?\",\n\t\t\t\t\tdefaultValue: 6,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"otpLength\",\n\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-expires-in\",\n\t\t\t\t\tdescription: \"Expiry time of the OTP in seconds default is 5 minutes\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"[Email OTP] What is the expiry time of the OTP in seconds?\",\n\t\t\t\t\tdefaultValue: 300,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"expiresIn\",\n\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-send-verification-on-sign-up\",\n\t\t\t\t\tdescription: \"Send email verification on sign-up\",\n\t\t\t\t\tquestion: \"[Email OTP] Would you like to send the OTP on sign-up?\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"sendVerificationOnSignUp\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-disable-sign-up\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"A boolean value that determines whether to prevent automatic sign-up when the user is not registered.\",\n\t\t\t\t\tquestion: \"[Email OTP] Would you like to disable sign-up?\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableSignUp\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-allowed-attempts\",\n\t\t\t\t\tdescription: \"Allowed attempts for the OTP code\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"[Email OTP] What is the allowed attempts for the OTP code?\",\n\t\t\t\t\tdefaultValue: 3,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"allowedAttempts\",\n\t\t\t\t\t\tschema: z.coerce.number().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-store-otp\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Store the OTP in your database in a secure way Note: This will not affect the OTP sent to the user, it will only affect the OTP stored in your database\",\n\t\t\t\t\tquestion: \"[Email OTP] How would you like to store the OTP code?\",\n\t\t\t\t\tdefaultValue: \"plain\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t{ value: \"plain\", label: \"Plain\" },\n\t\t\t\t\t\t{ value: \"encrypted\", label: \"Encrypted\" },\n\t\t\t\t\t\t{ value: \"hashed\", label: \"Hashed\" },\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"storeOTP\",\n\t\t\t\t\t\tschema: z.enum([\"plain\", \"encrypted\", \"hashed\"]).optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"email-otp-override-default-email-verification\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Override the default email verification to use email otp instead\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"[Email OTP] Would you like to override the default email verification?\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"overrideDefaultEmailVerification\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"emailOTPClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"emailOTPClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tgenericOAuth: {\n\t\tdisplayName: \"Generic OAuth\",\n\t\tauth: {\n\t\t\tfunction: \"genericOAuth\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"genericOAuth\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"genericOAuthClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"genericOAuthClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tanonymous: {\n\t\tdisplayName: \"Anonymous\",\n\t\tauth: {\n\t\t\tfunction: \"anonymous\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"anonymous\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"anonymousClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"anonymousClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tphoneNumber: {\n\t\tdisplayName: \"Phone Number\",\n\t\tauth: {\n\t\t\tfunction: \"phoneNumber\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"phoneNumber\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"phoneNumberClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"phoneNumberClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tpasskey: {\n\t\tdisplayName: \"Passkey\",\n\t\tauth: {\n\t\t\tfunction: \"passkey\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins/passkey\",\n\t\t\t\t\timports: [createImport({ name: \"passkey\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"passkeyClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"passkeyClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\toidc: {\n\t\tdisplayName: \"OIDC\",\n\t\tauth: {\n\t\t\tfunction: \"oidc\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oidc\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"oidcClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oidcClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tadmin: {\n\t\tdisplayName: \"Admin\",\n\t\tauth: {\n\t\t\tfunction: \"admin\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"admin\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"admin-default-role\",\n\t\t\t\t\tquestion: \"What is the default role for new users?\",\n\t\t\t\t\tdescription: \"The default role assigned to new users.\",\n\t\t\t\t\tdefaultValue: \"user\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"defaultRole\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"admin-roles\",\n\t\t\t\t\tquestion: \"What are the admin roles?\",\n\t\t\t\t\tdescription: \"Array of roles that are considered admin roles.\",\n\t\t\t\t\tdefaultValue: [\"admin\"],\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"adminRoles\",\n\t\t\t\t\t\tschema: z.array(z.string()).optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"adminClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"adminClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tapiKey: {\n\t\tdisplayName: \"API Key\",\n\t\tauth: {\n\t\t\tfunction: \"apiKey\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"apiKey\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"api-key-headers\",\n\t\t\t\t\tquestion: \"What header name should be used for API keys?\",\n\t\t\t\t\tdescription: \"The header name to check for API key.\",\n\t\t\t\t\tdefaultValue: \"x-api-key\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"apiKeyHeaders\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"api-key-length\",\n\t\t\t\t\tquestion: \"What is the default length of API keys?\",\n\t\t\t\t\tdescription: \"The length of the API key. Longer is better.\",\n\t\t\t\t\tdefaultValue: 64,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"defaultKeyLength\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"api-key-disable-hashing\",\n\t\t\t\t\tquestion: \"Disable hashing of API keys?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Disable hashing of the API key. Not recommended for security.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableKeyHashing\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"api-key-enable-metadata\",\n\t\t\t\t\tquestion: \"Enable metadata for API keys?\",\n\t\t\t\t\tdescription: \"Whether to enable metadata for an API key.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"enableMetadata\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"api-key-enable-session\",\n\t\t\t\t\tquestion: \"Enable session for API keys?\",\n\t\t\t\t\tdescription: \"An API Key can represent a valid session.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"enableSessionForAPIKeys\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"apiKeyClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"apiKeyClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tbearer: {\n\t\tdisplayName: \"Bearer\",\n\t\tauth: {\n\t\t\tfunction: \"bearer\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"bearer\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"bearer-require-signature\",\n\t\t\t\t\tquestion: \"Require signature for bearer tokens?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"If true, only signed tokens will be converted to session cookies.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"requireSignature\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\tcaptcha: {\n\t\tdisplayName: \"CAPTCHA\",\n\t\tauth: {\n\t\t\tfunction: \"captcha\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"captcha\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"captcha-provider\",\n\t\t\t\t\tquestion: \"Which CAPTCHA provider do you want to use?\",\n\t\t\t\t\tdescription: \"The CAPTCHA provider to use.\",\n\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t{ value: \"google-recaptcha\", label: \"Google reCAPTCHA\" },\n\t\t\t\t\t\t{ value: \"cloudflare-turnstile\", label: \"Cloudflare Turnstile\" },\n\t\t\t\t\t\t{ value: \"hcaptcha\", label: \"hCaptcha\" },\n\t\t\t\t\t\t{ value: \"captchafox\", label: \"CaptchaFox\" },\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"provider\",\n\t\t\t\t\t\tschema: z.enum([\n\t\t\t\t\t\t\t\"google-recaptcha\",\n\t\t\t\t\t\t\t\"cloudflare-turnstile\",\n\t\t\t\t\t\t\t\"hcaptcha\",\n\t\t\t\t\t\t\t\"captchafox\",\n\t\t\t\t\t\t]),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"captcha-secret-key\",\n\t\t\t\t\tquestion: \"What is your CAPTCHA secret key?\",\n\t\t\t\t\tdescription: \"The secret key for the CAPTCHA provider.\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"secretKey\",\n\t\t\t\t\t\tschema: z.coerce.string(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"captcha-site-key\",\n\t\t\t\t\tquestion: \"What is your CAPTCHA site key?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The site key for the CAPTCHA provider (required for hCaptcha and CaptchaFox).\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"siteKey\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"captcha-min-score\",\n\t\t\t\t\tquestion: \"What is the minimum score for Google reCAPTCHA?\",\n\t\t\t\t\tdescription: \"The minimum score for Google reCAPTCHA v3 (0-1).\",\n\t\t\t\t\tdefaultValue: 0.5,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"minScore\",\n\t\t\t\t\t\tschema: z.coerce.number().min(0).max(1).optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\tcustomSession: {\n\t\tdisplayName: \"Custom Session\",\n\t\tauth: {\n\t\t\tfunction: \"customSession\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"customSession\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"custom-session-mutate-list-device-sessions\",\n\t\t\t\t\tquestion: \"Should the list-device-sessions endpoint be mutated?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Determine if the list-device-sessions endpoint should be mutated to the custom session data.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"shouldMutateListDeviceSessionsEndpoint\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"customSessionClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"customSessionClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tdeviceAuthorization: {\n\t\tdisplayName: \"Device Authorization\",\n\t\tauth: {\n\t\t\tfunction: \"deviceAuthorization\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"deviceAuthorization\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"device-auth-expires-in\",\n\t\t\t\t\tquestion: \"When should device codes expire?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Time until the device code expires. Use formats like '30m', '5s', '1h'.\",\n\t\t\t\t\tdefaultValue: \"30m\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"expiresIn\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"device-auth-interval\",\n\t\t\t\t\tquestion: \"What is the polling interval?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Time between polling attempts. Use formats like '30m', '5s', '1h'.\",\n\t\t\t\t\tdefaultValue: \"5s\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"interval\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"device-auth-device-code-length\",\n\t\t\t\t\tquestion: \"What is the length of the device code?\",\n\t\t\t\t\tdescription: \"Length of the device code to be generated.\",\n\t\t\t\t\tdefaultValue: 40,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"deviceCodeLength\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"device-auth-user-code-length\",\n\t\t\t\t\tquestion: \"What is the length of the user code?\",\n\t\t\t\t\tdescription: \"Length of the user code to be generated.\",\n\t\t\t\t\tdefaultValue: 8,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"userCodeLength\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"deviceAuthorizationClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"deviceAuthorizationClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\thaveIBeenPwned: {\n\t\tdisplayName: \"Have I Been Pwned\",\n\t\tauth: {\n\t\t\tfunction: \"haveIBeenPwned\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"haveIBeenPwned\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"haveibeenpwned-custom-message\",\n\t\t\t\t\tquestion: \"What is the custom message for compromised passwords?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Custom message to display when a password is compromised.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"customPasswordCompromisedMessage\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\tjwt: {\n\t\tdisplayName: \"JWT\",\n\t\tauth: {\n\t\t\tfunction: \"jwt\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"jwt\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"jwt-disable-setting-jwt-header\",\n\t\t\t\t\tquestion: \"Disable setting JWT header?\",\n\t\t\t\t\tdescription: \"If true, the JWT header will not be set in responses.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableSettingJwtHeader\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"jwtClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"jwtClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tlastLoginMethod: {\n\t\tdisplayName: \"Last Login Method\",\n\t\tauth: {\n\t\t\tfunction: \"lastLoginMethod\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"lastLoginMethod\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"last-login-method-cookie-name\",\n\t\t\t\t\tquestion: \"What is the cookie name for last login method?\",\n\t\t\t\t\tdescription: \"Name of the cookie to store the last login method.\",\n\t\t\t\t\tdefaultValue: \"better-auth.last_used_login_method\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"cookieName\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"last-login-method-max-age\",\n\t\t\t\t\tquestion: \"What is the cookie expiration time in seconds?\",\n\t\t\t\t\tdescription: \"Cookie expiration time in seconds.\",\n\t\t\t\t\tdefaultValue: 2592000,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"maxAge\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"last-login-method-store-in-database\",\n\t\t\t\t\tquestion: \"Store the last login method in the database?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Store the last login method in the database. This will create a new field in the user table.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"storeInDatabase\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"lastLoginMethodClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"lastLoginMethodClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tmcp: {\n\t\tdisplayName: \"MCP\",\n\t\tauth: {\n\t\t\tfunction: \"mcp\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"mcp\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"mcp-login-page\",\n\t\t\t\t\tquestion: \"What is the login page URL?\",\n\t\t\t\t\tdescription: \"The login page URL for MCP.\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"loginPage\",\n\t\t\t\t\t\tschema: z.coerce.string(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"mcp-resource\",\n\t\t\t\t\tquestion: \"What is the resource URL?\",\n\t\t\t\t\tdescription: \"The resource URL for MCP.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"resource\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\tmultiSession: {\n\t\tdisplayName: \"Multi Session\",\n\t\tauth: {\n\t\t\tfunction: \"multiSession\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"multiSession\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"multi-session-maximum-sessions\",\n\t\t\t\t\tquestion: \"What is the maximum number of sessions a user can have?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The maximum number of sessions a user can have at a time.\",\n\t\t\t\t\tdefaultValue: 5,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"maximumSessions\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"multiSessionClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"multiSessionClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\toauthProxy: {\n\t\tdisplayName: \"OAuth Proxy\",\n\t\tauth: {\n\t\t\tfunction: \"oAuthProxy\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oAuthProxy\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"oauth-proxy-current-url\",\n\t\t\t\t\tquestion: \"What is the current URL of the application?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The current URL of the application. The plugin will attempt to infer this from your environment.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"currentURL\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"oauth-proxy-production-url\",\n\t\t\t\t\tquestion: \"What is the production URL?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"If a request is in a production URL it won't be proxied.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"productionURL\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\toneTap: {\n\t\tdisplayName: \"One Tap\",\n\t\tauth: {\n\t\t\tfunction: \"oneTap\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oneTap\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"one-tap-disable-signup\",\n\t\t\t\t\tquestion: \"Disable the signup flow?\",\n\t\t\t\t\tdescription: \"Disable the signup flow.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableSignup\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"one-tap-client-id\",\n\t\t\t\t\tquestion: \"What is your Google Client ID?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Google Client ID. If a client ID is provided in the social provider configuration, it will be used.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"clientId\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"oneTapClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oneTapClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\toneTimeToken: {\n\t\tdisplayName: \"One Time Token\",\n\t\tauth: {\n\t\t\tfunction: \"oneTimeToken\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oneTimeToken\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"one-time-token-expires-in\",\n\t\t\t\t\tquestion: \"When should tokens expire (in minutes)?\",\n\t\t\t\t\tdescription: \"Expires in minutes.\",\n\t\t\t\t\tdefaultValue: 3,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"expiresIn\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"one-time-token-disable-client-request\",\n\t\t\t\t\tquestion: \"Disable client requests?\",\n\t\t\t\t\tdescription: \"Only allow server initiated requests.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableClientRequest\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"one-time-token-store-token\",\n\t\t\t\t\tquestion: \"How should tokens be stored?\",\n\t\t\t\t\tdescription: \"Configure how the token is stored in your database.\",\n\t\t\t\t\tdefaultValue: \"plain\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t{ value: \"plain\", label: \"Plain text\" },\n\t\t\t\t\t\t{ value: \"hashed\", label: \"Hashed\" },\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"storeToken\",\n\t\t\t\t\t\tschema: z.enum([\"plain\", \"hashed\"]).optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"oneTimeTokenClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"oneTimeTokenClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\topenAPI: {\n\t\tdisplayName: \"Open API\",\n\t\tauth: {\n\t\t\tfunction: \"openAPI\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"openAPI\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"open-api-path\",\n\t\t\t\t\tquestion: \"What is the path to the OpenAPI reference page?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The path to the OpenAPI reference page. This will be appended to the base URL `/api/auth` path.\",\n\t\t\t\t\tdefaultValue: \"/reference\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"path\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"open-api-disable-default-reference\",\n\t\t\t\t\tquestion: \"Disable the default reference page?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Disable the default reference page that is generated by Scalar.\",\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableDefaultReference\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"open-api-theme\",\n\t\t\t\t\tquestion: \"What theme should be used for the OpenAPI reference page?\",\n\t\t\t\t\tdescription: \"Theme of the OpenAPI reference page.\",\n\t\t\t\t\tdefaultValue: \"default\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisSelectOptions: [\n\t\t\t\t\t\t{ value: \"alternate\", label: \"Alternate\" },\n\t\t\t\t\t\t{ value: \"default\", label: \"Default\" },\n\t\t\t\t\t\t{ value: \"moon\", label: \"Moon\" },\n\t\t\t\t\t\t{ value: \"purple\", label: \"Purple\" },\n\t\t\t\t\t\t{ value: \"solarized\", label: \"Solarized\" },\n\t\t\t\t\t\t{ value: \"bluePlanet\", label: \"Blue Planet\" },\n\t\t\t\t\t\t{ value: \"saturn\", label: \"Saturn\" },\n\t\t\t\t\t\t{ value: \"kepler\", label: \"Kepler\" },\n\t\t\t\t\t\t{ value: \"mars\", label: \"Mars\" },\n\t\t\t\t\t\t{ value: \"deepSpace\", label: \"Deep Space\" },\n\t\t\t\t\t\t{ value: \"laserwave\", label: \"Laserwave\" },\n\t\t\t\t\t\t{ value: \"none\", label: \"None\" },\n\t\t\t\t\t],\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"theme\",\n\t\t\t\t\t\tschema: z\n\t\t\t\t\t\t\t.enum([\n\t\t\t\t\t\t\t\t\"alternate\",\n\t\t\t\t\t\t\t\t\"default\",\n\t\t\t\t\t\t\t\t\"moon\",\n\t\t\t\t\t\t\t\t\"purple\",\n\t\t\t\t\t\t\t\t\"solarized\",\n\t\t\t\t\t\t\t\t\"bluePlanet\",\n\t\t\t\t\t\t\t\t\"saturn\",\n\t\t\t\t\t\t\t\t\"kepler\",\n\t\t\t\t\t\t\t\t\"mars\",\n\t\t\t\t\t\t\t\t\"deepSpace\",\n\t\t\t\t\t\t\t\t\"laserwave\",\n\t\t\t\t\t\t\t\t\"none\",\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t.optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: null,\n\t},\n\torganization: {\n\t\tdisplayName: \"Organization\",\n\t\tauth: {\n\t\t\tfunction: \"organization\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"organization\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"organization-allow-user-to-create\",\n\t\t\t\t\tquestion: \"Allow users to create organizations?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Configure whether new users are able to create new organizations.\",\n\t\t\t\t\tdefaultValue: true,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"allowUserToCreateOrganization\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"organization-creator-role\",\n\t\t\t\t\tquestion: \"What role should be assigned to the creator?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The role that is assigned to the creator of the organization.\",\n\t\t\t\t\tdefaultValue: \"owner\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"creatorRole\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"organization-membership-limit\",\n\t\t\t\t\tquestion: \"What is the maximum number of members allowed?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The maximum number of members allowed in an organization.\",\n\t\t\t\t\tdefaultValue: 100,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"membershipLimit\",\n\t\t\t\t\t\tschema: z.coerce.number().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"organizationClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"organizationClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tsiwe: {\n\t\tdisplayName: \"SIWE\",\n\t\tauth: {\n\t\t\tfunction: \"siwe\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"siwe\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"siwe-domain\",\n\t\t\t\t\tquestion: \"What is the domain for SIWE?\",\n\t\t\t\t\tdescription: \"The domain for SIWE.\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"domain\",\n\t\t\t\t\t\tschema: z.coerce.string(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"siwe-email-domain-name\",\n\t\t\t\t\tquestion: \"What is the email domain name?\",\n\t\t\t\t\tdescription: \"The email domain name for anonymous users.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"emailDomainName\",\n\t\t\t\t\t\tschema: z.coerce.string().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"siwe-anonymous\",\n\t\t\t\t\tquestion: \"Allow anonymous users?\",\n\t\t\t\t\tdescription: \"Allow anonymous users.\",\n\t\t\t\t\tdefaultValue: true,\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"anonymous\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"siweClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"better-auth/client/plugins\",\n\t\t\t\t\timports: [createImport({ name: \"siweClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tscim: {\n\t\tdisplayName: \"SCIM\",\n\t\tdependencies: [\"@better-auth/scim\"],\n\t\tauth: {\n\t\t\tfunction: \"scim\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/scim\",\n\t\t\t\t\timports: [createImport({ name: \"scim\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"scimClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/scim/client\",\n\t\t\t\t\timports: [createImport({ name: \"scimClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tsso: {\n\t\tdisplayName: \"SSO\",\n\t\tdependencies: [\"@better-auth/sso\"],\n\t\tauth: {\n\t\t\tfunction: \"sso\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/sso\",\n\t\t\t\t\timports: [createImport({ name: \"sso\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-default-override-user-info\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"Do you want to override the user info with the provider info?\",\n\t\t\t\t\tdescription: \"Override the user info with the provider info.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"defaultOverrideUserInfo\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-disable-implicit-sign-up\",\n\t\t\t\t\tquestion: \"Do you want to disable implicit sign up?\",\n\t\t\t\t\tdescription: \"Disable implicit sign up.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"disableImplicitSignUp\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-providers-limit\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"What is the maximum number of SSO providers a user can register?\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"The maximum number of SSO providers a user can register.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisNumber: true,\n\t\t\t\t\tdefaultValue: 10,\n\t\t\t\t\tisRequired: false,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"providersLimit\",\n\t\t\t\t\t\tschema: z.coerce.number().int().positive().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-trust-email-verified\",\n\t\t\t\t\tquestion:\n\t\t\t\t\t\t\"Do you want to trust the email verified flag from the provider?\",\n\t\t\t\t\tdescription: \"Trust the email verified flag from the provider.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"trustEmailVerified\",\n\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-domain-verification\",\n\t\t\t\t\tquestion: \"Do you want to setup domain verification?\",\n\t\t\t\t\tdescription: \"Setup domain verification.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"domainVerification\",\n\t\t\t\t\t\tschema: z\n\t\t\t\t\t\t\t.object({\n\t\t\t\t\t\t\t\tenabled: z.coerce.boolean().optional(),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.optional(),\n\t\t\t\t\t},\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"sso-domain-verification-enabled\",\n\t\t\t\t\t\t\tquestion: \"Do you want to enable domain verification?\",\n\t\t\t\t\t\t\tdescription: \"Enable domain verification.\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"enabled\",\n\t\t\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"ssoClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/sso/client\",\n\t\t\t\t\timports: [createImport({ name: \"ssoClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [\n\t\t\t\t{\n\t\t\t\t\tflag: \"sso-client-domain-verification\",\n\t\t\t\t\tquestion: \"Do you want to setup domain verification?\",\n\t\t\t\t\tdescription: \"Setup domain verification.\",\n\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\targument: {\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tisProperty: \"domainVerification\",\n\t\t\t\t\t\tschema: z\n\t\t\t\t\t\t\t.object({\n\t\t\t\t\t\t\t\tenabled: z.coerce.boolean().optional(),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.optional(),\n\t\t\t\t\t},\n\t\t\t\t\tisNestedObject: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tflag: \"sso-client-domain-verification-enabled\",\n\t\t\t\t\t\t\tquestion: \"Do you want to enable domain verification?\",\n\t\t\t\t\t\t\tdescription: \"Enable domain verification.\",\n\t\t\t\t\t\t\tskip: \"prompt\",\n\t\t\t\t\t\t\tisConfirmation: true,\n\t\t\t\t\t\t\tdefaultValue: false,\n\t\t\t\t\t\t\targument: {\n\t\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\t\tisProperty: \"enabled\",\n\t\t\t\t\t\t\t\tschema: z.coerce.boolean().optional(),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tstripe: {\n\t\tdisplayName: \"Stripe\",\n\t\tdependencies: [\"stripe\", \"@better-auth/stripe\"],\n\t\tauth: {\n\t\t\tfunction: \"stripe\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/stripe\",\n\t\t\t\t\timports: [createImport({ name: \"stripe\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"stripeClient\",\n\t\t\timports: [],\n\t\t\targuments: [],\n\t\t},\n\t},\n\ti18n: {\n\t\tdisplayName: \"I18n\",\n\t\tdependencies: [\"@better-auth/i18n\"],\n\t\tauth: {\n\t\t\tfunction: \"i18n\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/i18n\",\n\t\t\t\t\timports: [createImport({ name: \"i18n\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t\targuments: [],\n\t\t},\n\t\tauthClient: {\n\t\t\tfunction: \"i18nClient\",\n\t\t\timports: [\n\t\t\t\t{\n\t\t\t\t\tpath: \"@better-auth/i18n/client\",\n\t\t\t\t\timports: [createImport({ name: \"i18nClient\" })],\n\t\t\t\t\tisNamedImport: false,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n} as const satisfies Record<string, PluginConfig>;\n","import prompts from \"prompts\";\nimport type { PluginConfig } from \"../configs/temp-plugins.config\";\nimport type { GetArgumentsFn, GetArgumentsOptions } from \"../generate-auth\";\n\nexport const getFlagVariable = (flag: string) => {\n\treturn flag.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nconst collectPromptableArgs = (\n\targs: GetArgumentsOptions[] | undefined,\n\toptions: Record<string, unknown>,\n): GetArgumentsOptions[] => {\n\tif (!args) return [];\n\tconst result: GetArgumentsOptions[] = [];\n\tfor (const arg of args) {\n\t\tif (arg.isNestedObject && Array.isArray(arg.isNestedObject)) {\n\t\t\tresult.push(...collectPromptableArgs(arg.isNestedObject, options));\n\t\t} else {\n\t\t\tconst flagVar = getFlagVariable(arg.flag);\n\t\t\tconst hasFlag = options[flagVar] !== undefined && options[flagVar] !== \"\";\n\t\t\tif (arg.skip === \"always\" || arg.skip === \"prompt\") continue;\n\t\t\tif (arg.skip === \"flag\") {\n\t\t\t\tresult.push(arg);\n\t\t\t} else {\n\t\t\t\tif (!hasFlag) result.push(arg);\n\t\t\t}\n\t\t}\n\t}\n\treturn result;\n};\n\nconst toPromptQuestion = (arg: GetArgumentsOptions) => {\n\tconst name = getFlagVariable(arg.flag);\n\tconst message = arg.question ?? arg.description ?? \"\";\n\tconst base = { name, message, initial: arg.defaultValue };\n\n\tif (arg.isMultiselectOptions) {\n\t\treturn {\n\t\t\t...base,\n\t\t\ttype: \"multiselect\" as const,\n\t\t\tchoices: arg.isMultiselectOptions.map((opt) => ({\n\t\t\t\ttitle: opt.label ?? String(opt.value),\n\t\t\t\tvalue: opt.value,\n\t\t\t\tdescription: opt.hint,\n\t\t\t})),\n\t\t\tformat: (v: unknown) => (Array.isArray(v) ? v.join(\", \") : v),\n\t\t};\n\t}\n\tif (arg.isSelectOptions) {\n\t\treturn {\n\t\t\t...base,\n\t\t\ttype: \"select\" as const,\n\t\t\tchoices: arg.isSelectOptions.map((opt) => ({\n\t\t\t\ttitle: opt.label ?? String(opt.value),\n\t\t\t\tvalue: opt.value,\n\t\t\t\tdescription: opt.hint,\n\t\t\t})),\n\t\t};\n\t}\n\tif (arg.isConfirmation) {\n\t\treturn { ...base, type: \"confirm\" as const };\n\t}\n\tif (arg.isNumber) {\n\t\treturn {\n\t\t\t...base,\n\t\t\ttype: \"number\" as const,\n\t\t\tvalidate: (v: number) =>\n\t\t\t\targ.isRequired && (v == null || Number.isNaN(v))\n\t\t\t\t\t? \"This field is required\"\n\t\t\t\t\t: true,\n\t\t};\n\t}\n\treturn {\n\t\t...base,\n\t\ttype: \"text\" as const,\n\t\tvalidate: (v: string) => {\n\t\t\tif (arg.isRequired && (!v || !v.trim())) return \"This field is required\";\n\t\t\tif (arg.argument.schema) {\n\t\t\t\tconst parsed = arg.argument.schema.safeParse(\n\t\t\t\t\targ.cliTransform ? arg.cliTransform(v) : v,\n\t\t\t\t);\n\t\t\t\treturn parsed.success ? true : parsed.error.message;\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t};\n};\n\nexport const getArgumentsPrompt = async (\n\toptions: Record<string, unknown>,\n\tplugins: PluginConfig[],\n\ttarget: \"auth\" | \"authClient\",\n): Promise<GetArgumentsFn> => {\n\tconst opts = options;\n\tconst allPromptableArgs: GetArgumentsOptions[] = [];\n\tfor (const plugin of plugins) {\n\t\tif (target === \"auth\" && plugin.auth.arguments) {\n\t\t\tallPromptableArgs.push(\n\t\t\t\t...collectPromptableArgs(plugin.auth.arguments, opts),\n\t\t\t);\n\t\t} else if (\n\t\t\ttarget === \"authClient\" &&\n\t\t\tplugin.authClient &&\n\t\t\tplugin.authClient.arguments\n\t\t) {\n\t\t\tallPromptableArgs.push(\n\t\t\t\t...collectPromptableArgs(plugin.authClient.arguments, opts),\n\t\t\t);\n\t\t}\n\t}\n\n\tlet batchAnswers: Record<string, unknown> = {};\n\tif (allPromptableArgs.length > 0) {\n\t\tconst questions = allPromptableArgs.map(toPromptQuestion);\n\t\tconst res = await prompts(questions, {\n\t\t\tonCancel: () => {\n\t\t\t\tconsole.log(\"✋ Operation cancelled.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t},\n\t\t});\n\t\tbatchAnswers = (res ?? {}) as Record<string, unknown>;\n\t}\n\n\treturn (arg: GetArgumentsOptions) => {\n\t\tconst flagVar = getFlagVariable(arg.flag);\n\t\tconst hasFlag = opts[flagVar] !== undefined && opts[flagVar] !== \"\";\n\n\t\tif (arg.skip === \"always\") {\n\t\t\treturn arg.isRequired && arg.defaultValue !== undefined\n\t\t\t\t? arg.defaultValue\n\t\t\t\t: undefined;\n\t\t}\n\t\tif (arg.skip === \"prompt\") {\n\t\t\tif (hasFlag) {\n\t\t\t\tconst val = opts[flagVar];\n\t\t\t\treturn arg.cliTransform ? arg.cliTransform(val) : val;\n\t\t\t}\n\t\t\treturn arg.isRequired && arg.defaultValue !== undefined\n\t\t\t\t? arg.defaultValue\n\t\t\t\t: undefined;\n\t\t}\n\t\tif (arg.skip === \"flag\") {\n\t\t\tif (batchAnswers[flagVar] !== undefined) {\n\t\t\t\tlet val = batchAnswers[flagVar];\n\t\t\t\tif (arg.cliTransform) val = arg.cliTransform(val);\n\t\t\t\treturn val;\n\t\t\t}\n\t\t\treturn arg.isRequired && arg.defaultValue !== undefined\n\t\t\t\t? arg.defaultValue\n\t\t\t\t: undefined;\n\t\t}\n\t\tif (hasFlag) {\n\t\t\tconst val = opts[flagVar];\n\t\t\treturn arg.cliTransform ? arg.cliTransform(val) : val;\n\t\t}\n\t\tif (batchAnswers[flagVar] !== undefined) {\n\t\t\tlet val = batchAnswers[flagVar];\n\t\t\tif (arg.cliTransform) val = arg.cliTransform(val);\n\t\t\treturn val;\n\t\t}\n\t\treturn arg.isRequired && arg.defaultValue !== undefined\n\t\t\t? arg.defaultValue\n\t\t\t: undefined;\n\t};\n};\n","import type { Awaitable } from \"@better-auth/core\";\nimport type { Plugin, PluginConfig } from \"../configs/temp-plugins.config\";\nimport { tempPluginsConfig } from \"../configs/temp-plugins.config\";\nimport type { GetArgumentsFn, GetArgumentsOptions } from \"../generate-auth\";\nimport { formatCode } from \"./format\";\nimport { getArgumentsPrompt } from \"./prompt\";\n\nexport const getPluginConfigs = (plugins: Plugin[]) => {\n\treturn plugins.map((plugin) => {\n\t\tconst pluginConfig = tempPluginsConfig[plugin];\n\t\tif (!pluginConfig) {\n\t\t\tthrow new Error(`Plugin ${plugin} not found`);\n\t\t}\n\t\treturn pluginConfig;\n\t});\n};\n\n/**\n * Helper function to process nested arguments and build a nested object\n */\nconst processNestedArguments = async (\n\tnestedArguments: GetArgumentsOptions[],\n\tgetArguments: GetArgumentsFn,\n): Promise<Record<string, any>> => {\n\tconst nestedObject: Record<string, any> = {};\n\n\tfor (const nestedArg of nestedArguments) {\n\t\tlet nestedValue: any;\n\n\t\t// Check if this nested argument itself has nested objects\n\t\tif (nestedArg.isNestedObject && Array.isArray(nestedArg.isNestedObject)) {\n\t\t\t// Recursively process nested objects\n\t\t\tnestedValue = await processNestedArguments(\n\t\t\t\tnestedArg.isNestedObject,\n\t\t\t\tgetArguments,\n\t\t\t);\n\t\t} else {\n\t\t\t// Process regular nested argument\n\t\t\tlet result = await getArguments(nestedArg);\n\t\t\t// Apply cliTransform if provided\n\t\t\tif (nestedArg.cliTransform) {\n\t\t\t\tresult = nestedArg.cliTransform(result);\n\t\t\t}\n\t\t\tconst schema = nestedArg.argument.schema?.safeParse(result) ?? {\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: result,\n\t\t\t};\n\t\t\tif (!schema.success) {\n\t\t\t\tthrow new Error(`Invalid nested argument: ${schema.error.message}`);\n\t\t\t}\n\t\t\tnestedValue = schema.data;\n\t\t}\n\n\t\t// If the nested argument has a property name, merge it with existing properties\n\t\tif (nestedArg.argument.isProperty) {\n\t\t\tconst propertyName = nestedArg.argument.isProperty;\n\t\t\tif (typeof nestedValue !== \"undefined\") {\n\t\t\t\t// If property already exists and both are objects, merge them\n\t\t\t\tif (\n\t\t\t\t\tnestedObject[propertyName] &&\n\t\t\t\t\ttypeof nestedObject[propertyName] === \"object\" &&\n\t\t\t\t\ttypeof nestedValue === \"object\" &&\n\t\t\t\t\tnestedValue !== null &&\n\t\t\t\t\t!(typeof nestedValue === \"string\" && nestedValue.includes(\"=>\"))\n\t\t\t\t) {\n\t\t\t\t\tnestedObject[propertyName] = {\n\t\t\t\t\t\t...nestedObject[propertyName],\n\t\t\t\t\t\t...nestedValue,\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tnestedObject[propertyName] = nestedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (typeof nestedValue !== \"undefined\") {\n\t\t\t// If no property name, this shouldn't happen in nested objects, but handle it anyway\n\t\t\tthrow new Error(`Nested argument must have isProperty set`);\n\t\t}\n\t}\n\n\treturn nestedObject;\n};\n\n/**\n * Recursively clean objects by removing undefined values and setting empty nested objects to undefined\n */\nconst cleanNestedObjects = (value: any): any => {\n\tif (typeof value === \"undefined\") {\n\t\treturn undefined;\n\t}\n\t// Don't process function strings - they should be preserved as-is\n\tif (typeof value === \"string\" && value.includes(\"=>\")) {\n\t\treturn value;\n\t}\n\tif (typeof value === \"object\" && value !== null && !Array.isArray(value)) {\n\t\tconst cleaned: Record<string, any> = {};\n\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\tconst cleanedValue = cleanNestedObjects(val);\n\t\t\tif (typeof cleanedValue !== \"undefined\") {\n\t\t\t\tcleaned[key] = cleanedValue;\n\t\t\t}\n\t\t}\n\t\t// If the object is empty after cleaning, return undefined\n\t\tif (Object.keys(cleaned).length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn cleaned;\n\t}\n\treturn value;\n};\n\n/**\n * Process a single argument (handles both nested and regular arguments)\n */\nconst processArgument = async (\n\targument: GetArgumentsOptions,\n\tgetArguments: GetArgumentsFn,\n\tfunctionName: string,\n): Promise<any> => {\n\tlet value: any;\n\n\t// Check if this argument has nested objects\n\tif (argument.isNestedObject && Array.isArray(argument.isNestedObject)) {\n\t\t// Process nested arguments recursively\n\t\tvalue = await processNestedArguments(argument.isNestedObject, getArguments);\n\t\t// Validate the nested object if there's a schema\n\t\tif (argument.argument.schema) {\n\t\t\tconst schema = argument.argument.schema.safeParse(value);\n\t\t\tif (!schema.success) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid nested object for ${functionName}: ${schema.error.message}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tvalue = schema.data;\n\t\t}\n\t} else {\n\t\t// Process regular argument\n\t\tlet result = await getArguments(argument);\n\t\t// Apply cliTransform if provided\n\t\tif (argument.cliTransform) {\n\t\t\tresult = argument.cliTransform(result);\n\t\t}\n\t\tconst schema = argument.argument.schema?.safeParse(result) ?? {\n\t\t\tsuccess: true,\n\t\t\tdata: result,\n\t\t};\n\t\tif (!schema.success) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid argument for ${functionName} on flag \"${argument.flag}\": ${schema.error.message}`,\n\t\t\t);\n\t\t}\n\t\tvalue = schema.data;\n\t}\n\n\treturn value;\n};\n\n/**\n * Build argumentsCode map from arguments array\n */\nconst buildArgumentsCode = async (\n\targumentOptions: GetArgumentsOptions[] | undefined,\n\tgetArguments: GetArgumentsFn,\n\tfunctionName: string,\n): Promise<Map<number, any>> => {\n\tconst argumentsCode: Map<number, any> = new Map();\n\tif (!argumentOptions) return argumentsCode;\n\n\tfor (const argument of argumentOptions) {\n\t\tconst value = await processArgument(argument, getArguments, functionName);\n\t\tconst index = argument.argument.index;\n\t\tif (argument.argument.isProperty) {\n\t\t\tif (argumentsCode.has(index)) {\n\t\t\t\tconst previous = argumentsCode.get(index) || {};\n\t\t\t\tif (typeof previous !== \"object\") {\n\t\t\t\t\tthrow new Error(`Argument at index ${index} is not an object`);\n\t\t\t\t}\n\t\t\t\targumentsCode.set(index, {\n\t\t\t\t\t...previous,\n\t\t\t\t\t[argument.argument.isProperty]: value,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\targumentsCode.set(index, {\n\t\t\t\t\t[argument.argument.isProperty]: value,\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\targumentsCode.set(index, value);\n\t\t}\n\t}\n\n\treturn argumentsCode;\n};\n\n/**\n * Convert argumentsCode map to an array of string values\n */\nconst convertArgumentsCodeToStringArray = (\n\targumentsCode: Map<number, any>,\n): string[] => {\n\tconst hasFunctionString = (obj: any): boolean => {\n\t\tfor (const val of Object.values(obj)) {\n\t\t\tif (typeof val === \"string\" && val.includes(\"=>\")) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (typeof val === \"object\" && val !== null && !Array.isArray(val)) {\n\t\t\t\tif (hasFunctionString(val)) return true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t};\n\n\tconst buildObjectString = (obj: any): string => {\n\t\tconst entries = Object.entries(obj).map(([key, val]) => {\n\t\t\tif (typeof val === \"string\" && val.includes(\"=>\")) {\n\t\t\t\t// Output function directly, not as a string\n\t\t\t\treturn `${key}: ${val}`;\n\t\t\t}\n\t\t\tif (typeof val === \"object\" && val !== null && !Array.isArray(val)) {\n\t\t\t\treturn `${key}: ${buildObjectString(val)}`;\n\t\t\t}\n\t\t\treturn `${key}: ${JSON.stringify(val)}`;\n\t\t});\n\t\treturn `{${entries.join(\", \")}}`;\n\t};\n\n\treturn Array.from(argumentsCode.values()).map((value) => {\n\t\tconst cleaned = cleanNestedObjects(value);\n\t\tif (typeof cleaned === \"undefined\") return \"undefined\";\n\t\t// Handle function strings - they should be output as actual functions, not strings\n\t\tif (typeof cleaned === \"string\" && cleaned.includes(\"=>\")) {\n\t\t\t// Check if it's a function string (contains arrow function syntax)\n\t\t\t// Output it directly as a function, not as a string\n\t\t\treturn cleaned;\n\t\t}\n\t\t// For objects, check if any property contains a function string (recursively)\n\t\tif (\n\t\t\ttypeof cleaned === \"object\" &&\n\t\t\tcleaned !== null &&\n\t\t\t!Array.isArray(cleaned)\n\t\t) {\n\t\t\tif (hasFunctionString(cleaned)) {\n\t\t\t\t// Build object with functions output directly (recursively)\n\t\t\t\treturn buildObjectString(cleaned);\n\t\t\t}\n\t\t}\n\t\treturn JSON.stringify(cleaned);\n\t});\n};\n\n/**\n * Remove trailing undefined values from args array\n */\nconst removeTrailingUndefined = (args: string[]): void => {\n\tfor (let i = args.length - 1; i >= 0; i--) {\n\t\tif (args[i] !== \"undefined\") break;\n\t\targs.pop();\n\t}\n};\n\nexport const getAuthPluginsCode = async ({\n\tplugins,\n\toptions = {},\n\tinstallDependency,\n}: {\n\tplugins?: PluginConfig[];\n\toptions?: Record<string, unknown>;\n\tinstallDependency: (\n\t\tdependencies: string | string[],\n\t\ttype?: \"dev\" | \"prod\",\n\t) => Awaitable<unknown>;\n}) => {\n\tif (!plugins || plugins.length === 0) return;\n\n\tconst getArguments = await getArgumentsPrompt(options, plugins, \"auth\");\n\n\tconst pluginsCode: string[] = [];\n\tfor (const plugin of plugins) {\n\t\tconst argumentsCode = await buildArgumentsCode(\n\t\t\tplugin.auth.arguments,\n\t\t\tgetArguments,\n\t\t\tplugin.auth.function,\n\t\t);\n\t\tconst args = convertArgumentsCodeToStringArray(argumentsCode);\n\t\tremoveTrailingUndefined(args);\n\t\tpluginsCode.push(`${plugin.auth.function}(${args.join(\", \")})`);\n\n\t\t// dependencies\n\t\tconst dependencies = new Set<string>([\n\t\t\t...(plugin.dependencies || []),\n\t\t\t...(plugin.auth.dependencies || []),\n\t\t]);\n\t\tconst devDependencies = new Set<string>([\n\t\t\t...(plugin.devDependencies || []),\n\t\t\t...(plugin.auth.devDependencies || []),\n\t\t]);\n\t\tif (dependencies.size > 0) {\n\t\t\tawait installDependency([...dependencies]);\n\t\t}\n\t\tif (devDependencies.size > 0) {\n\t\t\tawait installDependency([...devDependencies], \"dev\");\n\t\t}\n\t}\n\treturn (await formatCode(`[${pluginsCode.join(\", \")}]`)).trim().slice(0, -1);\n};\n\nexport const getAuthClientPluginsCode = async ({\n\tplugins,\n\toptions = {},\n\tinstallDependency,\n}: {\n\tplugins?: PluginConfig[];\n\toptions?: Record<string, unknown>;\n\tinstallDependency: (\n\t\tdependencies: string | string[],\n\t\ttype?: \"dev\" | \"prod\",\n\t) => Awaitable<unknown>;\n}) => {\n\tif (!plugins || plugins.length === 0) return;\n\tconst pluginsWithClient = plugins.filter(\n\t\t(plugin) => plugin.authClient !== null,\n\t);\n\tif (pluginsWithClient.length === 0) return;\n\n\tconst getArguments = await getArgumentsPrompt(options, plugins, \"authClient\");\n\n\tconst pluginsCode: string[] = [];\n\tfor (const plugin of pluginsWithClient) {\n\t\tif (!plugin.authClient) continue;\n\t\tconst argumentsCode = await buildArgumentsCode(\n\t\t\tplugin.authClient.arguments,\n\t\t\tgetArguments,\n\t\t\tplugin.authClient.function,\n\t\t);\n\t\tconst args = convertArgumentsCodeToStringArray(argumentsCode);\n\t\tremoveTrailingUndefined(args);\n\t\tpluginsCode.push(`${plugin.authClient.function}(${args.join(\", \")})`);\n\n\t\t// dependencies\n\t\tconst dependencies = new Set<string>([\n\t\t\t...(plugin.dependencies || []),\n\t\t\t...(plugin.authClient.dependencies || []),\n\t\t]);\n\t\tconst devDependencies = new Set<string>([\n\t\t\t...(plugin.devDependencies || []),\n\t\t\t...(plugin.authClient.devDependencies || []),\n\t\t]);\n\t\tif (dependencies.size > 0) {\n\t\t\tawait installDependency([...dependencies]);\n\t\t}\n\t\tif (devDependencies.size > 0) {\n\t\t\tawait installDependency([...devDependencies], \"dev\");\n\t\t}\n\t}\n\treturn (await formatCode(`[${pluginsCode.join(\", \")}]`)).trim().slice(0, -1);\n};\n","import type { Awaitable } from \"@better-auth/core\";\nimport type { DatabasesConfig } from \"../configs/databases.config\";\nimport { SOCIAL_PROVIDER_CONFIGS } from \"../configs/social-providers.config\";\nimport type { PluginConfig } from \"../configs/temp-plugins.config\";\nimport { getAuthPluginsCode } from \"./plugin\";\n\ntype GenerateAuthConfigStringOptions = {\n\tdatabase?: DatabasesConfig | null;\n\tplugins?: PluginConfig[];\n\tappName?: string;\n\tbaseURL?: string;\n\temailAndPassword?: boolean;\n\tsocialProviders?: string[];\n\toptions?: Record<string, unknown>;\n\tinstallDependency: (\n\t\tdependencies: string | string[],\n\t\ttype?: \"dev\" | \"prod\",\n\t) => Awaitable<unknown>;\n};\n\nexport const generateInnerAuthConfigCode = async ({\n\tdatabase,\n\tplugins,\n\tappName,\n\tbaseURL,\n\temailAndPassword,\n\tsocialProviders,\n\toptions,\n\tinstallDependency,\n}: GenerateAuthConfigStringOptions) => {\n\tconst code: Record<string, string | undefined> = {\n\t\tdatabase: getDatabaseCode(database),\n\t\tappName: getAppNameCode(appName),\n\t\tbaseURL: getBaseURLCode(baseURL),\n\t\temailAndPassword: getEmailAndPasswordCode(emailAndPassword),\n\t\tsocialProviders: getSocialProvidersCode(socialProviders),\n\t\tplugins: await getAuthPluginsCode({ plugins, options, installDependency }),\n\t};\n\n\tlet stringCode = \"\";\n\tfor (const key in code) {\n\t\tif (!code[key]) continue;\n\t\tstringCode += `${key}: ${code[key]},\\n`;\n\t}\n\treturn stringCode;\n};\n\nconst getEmailAndPasswordCode = (enabled?: boolean) => {\n\tif (!enabled) return undefined;\n\treturn `{ enabled: true }`;\n};\n\nconst getSocialProvidersCode = (providers?: string[]) => {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst providersConfig = providers\n\t\t.map((provider) => {\n\t\t\tconst config =\n\t\t\t\tSOCIAL_PROVIDER_CONFIGS[\n\t\t\t\t\tprovider as keyof typeof SOCIAL_PROVIDER_CONFIGS\n\t\t\t\t];\n\t\t\tif (!config) {\n\t\t\t\t// Fallback for unknown providers\n\t\t\t\tconst providerUpper = provider.toUpperCase();\n\t\t\t\treturn `\t\t${provider}: {\n\t\t\tclientId: process.env.${providerUpper}_CLIENT_ID!,\n\t\t\tclientSecret: process.env.${providerUpper}_CLIENT_SECRET!,\n\t\t}`;\n\t\t\t}\n\n\t\t\t// Generate config based on provider-specific options\n\t\t\tconst options = config.options\n\t\t\t\t.map((opt) => {\n\t\t\t\t\treturn `\t\t\t${opt.name}: process.env.${opt.envVar}!,`;\n\t\t\t\t})\n\t\t\t\t.join(\"\\n\");\n\n\t\t\treturn `\t\t${provider}: {\\n${options}\\n\t\t}`;\n\t\t})\n\t\t.join(\",\\n\");\n\treturn `{\\n${providersConfig}\\n\t}`;\n};\n\nconst getAppNameCode = (appName?: string) => {\n\tif (!appName) return;\n\tif (typeof appName !== \"string\") {\n\t\tthrow new Error(\"appName must be a string\");\n\t}\n\treturn JSON.stringify(appName);\n};\n\nconst getBaseURLCode = (baseURL?: string) => {\n\tif (!baseURL) return;\n\tif (typeof baseURL !== \"string\") {\n\t\tthrow new Error(\"baseURL must be a string\");\n\t}\n\tlet url: URL;\n\ttry {\n\t\turl = new URL(baseURL);\n\t} catch {\n\t\tthrow new Error(\"baseURL must be a valid URL\");\n\t}\n\n\treturn JSON.stringify(url.toString());\n};\n\nconst getDatabaseCode = (database?: DatabasesConfig | null) => {\n\tif (!database) return undefined;\n\treturn database.code({});\n};\n","import type { ImportGroup } from \"../utility\";\nimport { createImport } from \"../utility/imports\";\n\nexport type DatabaseAdapter =\n\t// prisma\n\t| \"prisma-sqlite\"\n\t| \"prisma-mysql\"\n\t| \"prisma-postgresql\"\n\t// drizzle\n\t| \"drizzle-sqlite-better-sqlite3\"\n\t| \"drizzle-sqlite-bun\"\n\t| \"drizzle-sqlite-node\"\n\t| \"drizzle-mysql\"\n\t| \"drizzle-postgresql\"\n\t// kysely\n\t| \"sqlite-better-sqlite3\"\n\t| \"sqlite-bun\"\n\t| \"sqlite-node\"\n\t| \"mysql\"\n\t| \"postgresql\"\n\t| \"mssql\"\n\t// mongodb\n\t| \"mongodb\";\n\nexport type DatabasesConfig = {\n\tadapter: DatabaseAdapter;\n\timports: ImportGroup[];\n\t/**\n\t * this is code that is placed before the auth config code.\n\t */\n\tpreCode?: string;\n\tcode: (attributes: { additionalOptions?: Record<string, any> }) => string;\n\tdependencies: string[];\n\tdevDependencies?: string[] | undefined;\n};\n\nconst prismaCode = ({\n\tprovider,\n\tadditionalOptions,\n}: {\n\tprovider: \"sqlite\" | \"mysql\" | \"postgresql\";\n\tadditionalOptions?: Record<string, any>;\n}) => {\n\treturn `prismaAdapter(client, { provider: \"${provider}\", ${\n\t\tadditionalOptions\n\t\t\t? Object.entries(additionalOptions)\n\t\t\t\t\t.map(([key, value]) => `${key}: ${value}`)\n\t\t\t\t\t.join(\", \")\n\t\t\t: \"\"\n\t} })`;\n};\n\nconst drizzleCode = ({\n\tprovider,\n\tadditionalOptions,\n}: {\n\tprovider: \"sqlite\" | \"mysql\" | \"pg\";\n\tadditionalOptions?: Record<string, any>;\n}) => {\n\treturn `drizzleAdapter(db, { provider: \"${provider}\", schema, ${\n\t\tadditionalOptions\n\t\t\t? Object.entries(additionalOptions)\n\t\t\t\t\t.map(([key, value]) => `${key}: ${value}`)\n\t\t\t\t\t.join(\", \")\n\t\t\t: \"\"\n\t} })`;\n};\n\nconst kyselyCode = ({\n\tprovider,\n\tadditionalOptions,\n}: {\n\tprovider: \"sqlite\" | \"mysql\" | \"postgresql\" | \"mssql\";\n\tadditionalOptions?: Record<string, any>;\n}) => {\n\treturn `{dialect, type: \"${provider}\", ${\n\t\tadditionalOptions\n\t\t\t? Object.entries(additionalOptions)\n\t\t\t\t\t.map(([key, value]) => `${key}: ${value}`)\n\t\t\t\t\t.join(\", \")\n\t\t\t: \"\"\n\t} }`;\n};\n\nconst mongodbCode = ({\n\tadditionalOptions,\n}: {\n\tadditionalOptions?: Record<string, any>;\n}) => {\n\tlet optsString = \"\";\n\tif (additionalOptions) {\n\t\toptsString = \", {\";\n\t\toptsString += Object.entries(additionalOptions)\n\t\t\t.map(([key, value]) => `${key}: ${value}`)\n\t\t\t.join(\", \");\n\t\toptsString += \"}\";\n\t}\n\treturn `mongodbAdapter(db${optsString})`;\n};\n\nexport const databasesConfig = [\n\t// Prisma\n\t{\n\t\tadapter: \"prisma-sqlite\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/prisma\",\n\t\t\t\timports: [createImport({ name: \"prismaAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"@prisma/client\",\n\t\t\t\timports: [createImport({ name: \"PrismaClient\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: \"const client = new PrismaClient();\",\n\t\tcode: ({ additionalOptions }) => {\n\t\t\treturn prismaCode({ provider: \"sqlite\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"@prisma/client\"],\n\t\tdevDependencies: [\"prisma\"],\n\t},\n\t{\n\t\tadapter: \"prisma-mysql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/prisma\",\n\t\t\t\timports: [createImport({ name: \"prismaAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"@prisma/client\",\n\t\t\t\timports: [createImport({ name: \"PrismaClient\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: \"const client = new PrismaClient();\",\n\t\tcode: ({ additionalOptions }) => {\n\t\t\treturn prismaCode({ provider: \"mysql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"@prisma/client\"],\n\t\tdevDependencies: [\"prisma\"],\n\t},\n\t{\n\t\tadapter: \"prisma-postgresql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/prisma\",\n\t\t\t\timports: [createImport({ name: \"prismaAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"@prisma/client\",\n\t\t\t\timports: [createImport({ name: \"PrismaClient\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: \"const client = new PrismaClient();\",\n\t\tcode: ({ additionalOptions }) => {\n\t\t\treturn prismaCode({ provider: \"postgresql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"@prisma/client\"],\n\t\tdevDependencies: [\"prisma\"],\n\t},\n\t// Drizzle\n\t{\n\t\tadapter: \"drizzle-sqlite-better-sqlite3\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/drizzle\",\n\t\t\t\timports: [createImport({ name: \"drizzleAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"drizzle-orm/better-sqlite3\",\n\t\t\t\timports: [createImport({ name: \"drizzle\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"better-sqlite3\",\n\t\t\t\timports: createImport({ name: \"Database\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"./auth-schema\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"schema\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const db = drizzle(new Database(\"database.sqlite\"), { schema });`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn drizzleCode({ provider: \"sqlite\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"drizzle-orm\", \"better-sqlite3\"],\n\t\tdevDependencies: [\"@types/better-sqlite3\"],\n\t},\n\t{\n\t\tadapter: \"drizzle-sqlite-bun\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/drizzle\",\n\t\t\t\timports: [createImport({ name: \"drizzleAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"drizzle-orm/bun-sqlite\",\n\t\t\t\timports: [createImport({ name: \"drizzle\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"bun:sqlite\",\n\t\t\t\timports: [createImport({ name: \"Database\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"./auth-schema\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"schema\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const db = drizzle({ client: new Database('sqlite.db'), schema });`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn drizzleCode({ provider: \"sqlite\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"drizzle-orm\", \"bun\"],\n\t\tdevDependencies: [\"@types/bun\"],\n\t},\n\t{\n\t\tadapter: \"drizzle-postgresql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/drizzle\",\n\t\t\t\timports: [createImport({ name: \"drizzleAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"drizzle-orm/node-postgres\",\n\t\t\t\timports: [createImport({ name: \"drizzle\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"pg\",\n\t\t\t\timports: [createImport({ name: \"Pool\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"./auth-schema\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"schema\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const db = drizzle(new Pool({ connectionString: process.env.DATABASE_URL }), { schema });`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn drizzleCode({ provider: \"pg\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"drizzle-orm\", \"pg\"],\n\t\tdevDependencies: [\"@types/pg\"],\n\t},\n\t{\n\t\tadapter: \"drizzle-mysql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/drizzle\",\n\t\t\t\timports: [createImport({ name: \"drizzleAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"drizzle-orm/mysql2\",\n\t\t\t\timports: [createImport({ name: \"drizzle\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"mysql2/promise\",\n\t\t\t\timports: [createImport({ name: \"createPool\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"./auth-schema\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"schema\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const db = drizzle(createPool(process.env.DATABASE_URL!), { schema, mode: \"default\" });`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn drizzleCode({ provider: \"mysql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"drizzle-orm\", \"mysql2\"],\n\t},\n\t// Kysely\n\t{\n\t\tadapter: \"sqlite-better-sqlite3\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-sqlite3\",\n\t\t\t\timports: createImport({ name: \"Database\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const database = new Database(\"auth.db\")`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn `database`;\n\t\t},\n\t\tdependencies: [\"better-sqlite3\"],\n\t\tdevDependencies: [\"@types/better-sqlite3\"],\n\t},\n\t{\n\t\tadapter: \"sqlite-bun\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"bun:sqlite\",\n\t\t\t\timports: [createImport({ name: \"Database\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const database = new Database(\"auth.db\")`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn `database`;\n\t\t},\n\t\tdependencies: [],\n\t},\n\t{\n\t\tadapter: \"sqlite-node\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"node:sqlite\",\n\t\t\t\timports: [createImport({ name: \"DatabaseSync\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const database = new DatabaseSync(\"auth.db\")`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn `database`;\n\t\t},\n\t\tdependencies: [],\n\t},\n\t{\n\t\tadapter: \"mysql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"mysql2/promise\",\n\t\t\t\timports: [createImport({ name: \"createPool\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const dialect = createPool({ host: \"localhost\", user: \"root\", password: \"password\", database: \"database\", timezone: \"Z\" })`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn kyselyCode({ provider: \"mysql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"mysql2\"],\n\t},\n\t{\n\t\tadapter: \"postgresql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"pg\",\n\t\t\t\timports: [createImport({ name: \"Pool\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const dialect = new Pool({ connectionString: \"postgresql://postgres:password@localhost:5432/database\" })`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn kyselyCode({ provider: \"postgresql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"pg\"],\n\t\tdevDependencies: [\"@types/pg\"],\n\t},\n\t{\n\t\tadapter: \"mssql\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"kysely\",\n\t\t\t\timports: [createImport({ name: \"MssqlDialect\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"tedious\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"Tedious\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"tarn\",\n\t\t\t\timports: createImport({ name: \"*\", alias: \"Tarn\" }),\n\t\t\t\tisNamedImport: true,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const dialect = new MssqlDialect({\n tarn: {\n ...Tarn,\n options: {\n min: 0,\n max: 10,\n },\n },\n tedious: {\n ...Tedious,\n connectionFactory: () => new Tedious.Connection({\n authentication: {\n options: {\n password: 'password',\n userName: 'username',\n },\n type: 'default',\n },\n options: {\n database: 'some_db',\n port: 1433,\n trustServerCertificate: true,\n },\n server: 'localhost',\n }),\n\t\t\t\t\t\tTYPES: {\n\t\t\t\t\t\t\t\t...Tedious.TYPES,\n\t\t\t\t\t\t\t\tDateTime: Tedious.TYPES.DateTime2,\n\t\t\t\t\t\t\t},\n },\n })`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn kyselyCode({ provider: \"mssql\", additionalOptions });\n\t\t},\n\t\tdependencies: [\"kysely\", \"tedious\", \"tarn\"],\n\t},\n\t// MongoDB\n\t{\n\t\tadapter: \"mongodb\",\n\t\timports: [\n\t\t\t{\n\t\t\t\tpath: \"better-auth/adapters/mongodb\",\n\t\t\t\timports: [createImport({ name: \"mongodbAdapter\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tpath: \"mongodb\",\n\t\t\t\timports: [createImport({ name: \"MongoClient\" })],\n\t\t\t\tisNamedImport: false,\n\t\t\t},\n\t\t],\n\t\tpreCode: `const client = new MongoClient(process.env.DATABASE_URL!);\\nconst db = client.db();`,\n\t\tcode({ additionalOptions }) {\n\t\t\treturn mongodbCode({ additionalOptions });\n\t\t},\n\t\tdependencies: [\"mongodb\"],\n\t},\n] satisfies DatabasesConfig[];\n","import type {\n\tDatabaseAdapter,\n\tDatabasesConfig,\n} from \"../configs/databases.config\";\nimport { databasesConfig } from \"../configs/databases.config\";\n\nexport const getDatabaseCode = <A extends DatabaseAdapter | null>(\n\tadapter: A,\n): A extends DatabaseAdapter ? DatabasesConfig : null => {\n\tif (!adapter) return null as any;\n\tconst database = databasesConfig.find(\n\t\t(database) => database.adapter === adapter,\n\t)!;\n\n\treturn database as any;\n};\n\n/**\n * Extract ORM name from adapter string\n * Examples:\n * - \"prisma-sqlite\" -> \"prisma\"\n * - \"drizzle-postgresql\" -> \"drizzle\"\n * - \"drizzle-sqlite-better-sqlite3\" -> \"drizzle\"\n * - \"sqlite-better-sqlite3\" -> \"kysely\"\n * - \"sqlite-bun\" -> \"kysely\"\n * - \"mongodb\" -> \"mongodb\"\n */\nexport const getORMFromAdapter = (adapter: DatabaseAdapter): string => {\n\tif (adapter.includes(\"-\")) {\n\t\tconst parts = adapter.split(\"-\");\n\t\t// Handle kysely adapters like \"sqlite-better-sqlite3\" or \"sqlite-bun\"\n\t\tif (parts[0] === \"sqlite\" && parts.length > 1) {\n\t\t\treturn \"kysely\";\n\t\t}\n\t\t// For other adapters, return the first part (ORM name)\n\t\treturn parts[0]!;\n\t}\n\t// Kysely adapters (mysql, postgresql, mssql) are grouped as \"kysely\"\n\tif ([\"mysql\", \"postgresql\", \"mssql\"].includes(adapter)) {\n\t\treturn \"kysely\";\n\t}\n\t// mongodb is its own ORM\n\treturn adapter;\n};\n\n/**\n * Check if an adapter is a kysely dialect\n */\nexport const isKyselyDialect = (adapter: string): boolean => {\n\treturn (\n\t\tadapter.startsWith(\"sqlite-\") ||\n\t\t[\"mysql\", \"postgresql\", \"mssql\"].includes(adapter)\n\t);\n};\n\n/**\n * Check if an adapter should be returned directly without dialect selection\n * (Kysely dialects and MongoDB don't have sub-dialects)\n */\nexport const isDirectAdapter = (adapter: string): boolean => {\n\treturn isKyselyDialect(adapter) || adapter === \"mongodb\";\n};\n\n/**\n * Format adapter name for display\n */\nconst formatAdapterLabel = (adapter: DatabaseAdapter): string => {\n\t// Handle kysely sqlite variants\n\tif (adapter === \"sqlite-better-sqlite3\") {\n\t\treturn \"SQLite (better-sqlite3)\";\n\t}\n\tif (adapter === \"sqlite-bun\") {\n\t\treturn \"SQLite (bun)\";\n\t}\n\tif (adapter === \"sqlite-node\") {\n\t\treturn \"SQLite (node:sqlite)\";\n\t}\n\t// Handle drizzle sqlite variants\n\tif (adapter === \"drizzle-sqlite-better-sqlite3\") {\n\t\treturn \"SQLite (better-sqlite3)\";\n\t}\n\tif (adapter === \"drizzle-sqlite-bun\") {\n\t\treturn \"SQLite (bun)\";\n\t}\n\tif (adapter === \"drizzle-sqlite-node\") {\n\t\treturn \"SQLite (node:sqlite)\";\n\t}\n\t// Default: capitalize first letter\n\treturn adapter.charAt(0).toUpperCase() + adapter.slice(1);\n};\n\n/**\n * Get all unique ORMs from the database config\n * SQLite variants are grouped under a single \"SQLite\" option\n */\nexport const getAvailableORMs = (): Array<{\n\tvalue: string;\n\tlabel: string;\n\tadapter?: DatabaseAdapter;\n}> => {\n\tconst options: Array<{\n\t\tvalue: string;\n\t\tlabel: string;\n\t\tadapter?: DatabaseAdapter;\n\t}> = [];\n\tconst seenORMs = new Set<string>();\n\n\tfor (const db of databasesConfig) {\n\t\tconst dbORM = getORMFromAdapter(db.adapter);\n\n\t\t// Group all SQLite variants under a single \"SQLite\" option\n\t\tif (db.adapter.startsWith(\"sqlite-\")) {\n\t\t\tif (!seenORMs.has(\"sqlite\")) {\n\t\t\t\tseenORMs.add(\"sqlite\");\n\t\t\t\toptions.push({\n\t\t\t\t\tvalue: \"sqlite\",\n\t\t\t\t\tlabel: \"SQLite\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else if (dbORM === \"kysely\" || dbORM === \"mongodb\") {\n\t\t\t// For non-SQLite kysely dialects and mongodb, add them directly\n\t\t\toptions.push({\n\t\t\t\tvalue: db.adapter,\n\t\t\t\tlabel: formatAdapterLabel(db.adapter),\n\t\t\t\tadapter: db.adapter,\n\t\t\t});\n\t\t} else if (!seenORMs.has(dbORM)) {\n\t\t\t// For other ORMs, add them once\n\t\t\tseenORMs.add(dbORM);\n\t\t\toptions.push({\n\t\t\t\tvalue: dbORM,\n\t\t\t\tlabel: dbORM.charAt(0).toUpperCase() + dbORM.slice(1),\n\t\t\t});\n\t\t}\n\t}\n\n\t// Custom sort order: SQLite, PostgreSQL, MySQL, Drizzle, Prisma, MongoDB, MSSQL\n\tconst sortOrder = [\n\t\t\"sqlite\",\n\t\t\"postgresql\",\n\t\t\"mysql\",\n\t\t\"drizzle\",\n\t\t\"prisma\",\n\t\t\"mongodb\",\n\t\t\"mssql\",\n\t];\n\n\treturn options.sort((a, b) => {\n\t\tconst aIndex = sortOrder.indexOf(a.value);\n\t\tconst bIndex = sortOrder.indexOf(b.value);\n\t\tif (aIndex !== -1 && bIndex !== -1) {\n\t\t\treturn aIndex - bIndex;\n\t\t}\n\t\tif (aIndex !== -1) return -1;\n\t\tif (bIndex !== -1) return 1;\n\t\treturn a.value.localeCompare(b.value);\n\t});\n};\n\n/**\n * Get available dialects for a specific ORM\n */\nexport const getDialectsForORM = (\n\torm: string,\n): Array<{ value: string; label: string; adapter: DatabaseAdapter }> => {\n\tconst dialects: Array<{\n\t\tvalue: string;\n\t\tlabel: string;\n\t\tadapter: DatabaseAdapter;\n\t}> = [];\n\n\tfor (const db of databasesConfig) {\n\t\tconst dbORM = getORMFromAdapter(db.adapter);\n\t\tif (dbORM === orm) {\n\t\t\tlet label: string;\n\n\t\t\tif (db.adapter.includes(\"-\")) {\n\t\t\t\tconst parts = db.adapter.split(\"-\");\n\t\t\t\t// Handle drizzle sqlite variants: \"drizzle-sqlite-better-sqlite3\" -> \"SQLite (better-sqlite3)\"\n\t\t\t\tif (orm === \"drizzle\" && parts[1] === \"sqlite\") {\n\t\t\t\t\tlabel = formatAdapterLabel(db.adapter);\n\t\t\t\t} else {\n\t\t\t\t\t// Standard case: \"drizzle-mysql\" -> \"MySQL\", \"drizzle-postgresql\" -> \"PostgreSQL\"\n\t\t\t\t\tconst dialectName = parts.slice(1).join(\"-\");\n\t\t\t\t\tlabel = dialectName.charAt(0).toUpperCase() + dialectName.slice(1);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// For mongodb, the adapter itself is the dialect\n\t\t\t\tlabel = formatAdapterLabel(db.adapter);\n\t\t\t}\n\t\t\tdialects.push({\n\t\t\t\tvalue: db.adapter,\n\t\t\t\tlabel,\n\t\t\t\tadapter: db.adapter,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn dialects.sort((a, b) => a.value.localeCompare(b.value));\n};\n","import type { Awaitable } from \"@better-auth/core\";\nimport type { ZodSchema } from \"zod\";\nimport type { DatabaseAdapter } from \"./configs/databases.config\";\nimport type { Framework } from \"./configs/frameworks.config\";\nimport type { Plugin } from \"./configs/temp-plugins.config\";\nimport {\n\tformatCode,\n\tgenerateInnerAuthConfigCode,\n\tgetDatabaseCode,\n} from \"./utility\";\nimport type { ImportGroup } from \"./utility/imports\";\nimport { createImport, getImportString } from \"./utility/imports\";\nimport { getPluginConfigs } from \"./utility/plugin\";\n\nexport type BaseGetArgumentsOptions = {\n\t/**\n\t * Unique flag identifier for the question.\n\t * Allows for CLIs to override the question based on provided CLI flags.\n\t */\n\tflag: string;\n\t/**\n\t * Description of this argument. Used to display documentation in the CLI --help flag.\n\t */\n\tdescription: string;\n\t/**\n\t * The question to ask the user.\n\t */\n\tquestion?: string;\n\t/**\n\t * The options for the multiselect question.\n\t */\n\tisMultiselectOptions?: {\n\t\tvalue: any;\n\t\tlabel?: string;\n\t\thint?: string;\n\t}[];\n\t/**\n\t * The options for the select question.\n\t */\n\tisSelectOptions?: {\n\t\tvalue: any;\n\t\tlabel?: string;\n\t\thint?: string;\n\t}[];\n\t/**\n\t * Whether the argument is a confirmation question.\n\t */\n\tisConfirmation?: boolean;\n\t/**\n\t * Whether the argument is a number question.\n\t */\n\tisNumber?: boolean;\n\t/**\n\t * Whether the argument is required.\n\t * If not provided, the argument is optional.\n\t */\n\tisRequired?: boolean;\n\t/**\n\t * Whether the argument is a nested object, thus meaning this specific argument\n\t * cannot be prompted for, but rather the arguments for the nested object should be prompted for.\n\t */\n\tisNestedObject?: false | BaseGetArgumentsOptions[] | undefined;\n\t/**\n\t * When to skip prompting or flag checking:\n\t * - \"always\": Always skip prompt, use default (never prompt, never check flags)\n\t * - \"prompt\": Skip the prompt but still listen for CLI flags (use flag if present, else default)\n\t * - \"flag\": Keep the prompt but skip checking CLI flags (always prompt, ignore flags)\n\t */\n\tskip?: \"always\" | \"prompt\" | \"flag\";\n\t/**\n\t * Default value for the argument of no value is provided.\n\t */\n\tdefaultValue?: any;\n\t/**\n\t * Transform function to apply to the CLI input before schema validation.\n\t * Useful for converting string input (e.g., comma-separated) into arrays.\n\t */\n\tcliTransform?: (value: any) => any;\n\t/**\n\t * Argument details\n\t */\n\targument: {\n\t\t/**\n\t\t * The index of the argument in the function.\n\t\t */\n\t\tindex: number;\n\t\t/**\n\t\t * If it's a property, this means that this index is an object and the property name is this string value.\n\t\t * Else if `false`, it means this index is an entire value represented by this argument value.\n\t\t */\n\t\tisProperty: false | string;\n\t\t/**\n\t\t * Zod schema for validation and transformation of the argument value.\n\t\t */\n\t\tschema?: ZodSchema;\n\t};\n};\nexport type GetArgumentsOptions = BaseGetArgumentsOptions;\n\nexport type GetArgumentsFn = (\n\toptions: GetArgumentsOptions,\n) => any | Promise<any>;\n\nexport type GenerateAuthFileOptions = {\n\tplugins: Plugin[];\n\tdatabase: DatabaseAdapter | null;\n\tframework: Framework;\n\tappName?: string;\n\tbaseURL?: string;\n\temailAndPassword?: boolean;\n\tsocialProviders?: string[];\n\tinstallDependency: (\n\t\tdependencies: string | string[],\n\t\ttype?: \"dev\" | \"prod\",\n\t) => Awaitable<unknown>;\n\t/** CLI options (used for batch prompting) */\n\toptions?: Record<string, unknown>;\n};\n\nexport const generateAuthConfigCode = async ({\n\tplugins: pluginsConfig,\n\tdatabase: databaseConfig,\n\tappName,\n\tbaseURL,\n\temailAndPassword,\n\tsocialProviders,\n\tinstallDependency,\n\toptions,\n}: GenerateAuthFileOptions) => {\n\tconst database = getDatabaseCode(databaseConfig);\n\tconst plugins = getPluginConfigs(pluginsConfig);\n\n\tconst imports: ImportGroup[] = [\n\t\t{\n\t\t\timports: [createImport({ name: \"betterAuth\" })],\n\t\t\tpath: \"better-auth\",\n\t\t\tisNamedImport: false,\n\t\t},\n\t\t...Object.values(plugins)\n\t\t\t.map(({ auth }) => auth.imports)\n\t\t\t.flat(),\n\t\t...(database?.imports ?? []),\n\t];\n\n\tconst authConfigCode = await generateInnerAuthConfigCode({\n\t\tplugins,\n\t\tdatabase,\n\t\tappName,\n\t\tbaseURL,\n\t\temailAndPassword,\n\t\tsocialProviders,\n\t\toptions,\n\t\tinstallDependency,\n\t});\n\n\tconst segmentedCode = {\n\t\timports: await getImportString(imports),\n\t\texports: \"\",\n\t\tpreAuthConfig: database?.preCode ?? \"\",\n\t\tauthConfig: authConfigCode,\n\t\tpostAuthConfig: \"\",\n\t};\n\n\t// Database dependencies are now installed in the Configure Database step\n\n\tconst code: string[] = [\n\t\tsegmentedCode.imports,\n\t\t``,\n\t\tsegmentedCode.preAuthConfig,\n\t\t``,\n\t\t`export const auth = betterAuth({`,\n\t\tsegmentedCode.authConfig,\n\t\t`});`,\n\t\t``,\n\t\tsegmentedCode.postAuthConfig,\n\t\t``,\n\t\tsegmentedCode.exports,\n\t];\n\treturn await formatCode(code.join(\"\\n\"));\n};\n","import type { Awaitable } from \"@better-auth/core\";\nimport type { DatabasesConfig } from \"../configs/databases.config\";\nimport type { PluginConfig } from \"../configs/temp-plugins.config\";\nimport { getAuthClientPluginsCode } from \"./plugin\";\n\ntype GenerateAuthClientConfigStringOptions = {\n\tdatabase?: DatabasesConfig | null;\n\tplugins?: PluginConfig[];\n\tappName?: string;\n\tbaseURL?: string;\n\toptions?: Record<string, unknown>;\n\tinstallDependency: (\n\t\tdependencies: string | string[],\n\t\ttype?: \"dev\" | \"prod\",\n\t) => Awaitable<unknown>;\n};\n\nexport const generateInnerAuthClientConfigCode = async ({\n\tplugins,\n\toptions,\n\tinstallDependency,\n}: GenerateAuthClientConfigStringOptions) => {\n\tconst code: Record<string, string | undefined> = {\n\t\tplugins: await getAuthClientPluginsCode({\n\t\t\tplugins,\n\t\t\toptions,\n\t\t\tinstallDependency,\n\t\t}),\n\t};\n\n\tlet stringCode = \"\";\n\tfor (const key in code) {\n\t\tif (!code[key]) continue;\n\t\tstringCode += `${key}: ${code[key]},\\n`;\n\t}\n\treturn stringCode;\n};\n","import type { GenerateAuthFileOptions } from \"./generate-auth\";\nimport { formatCode } from \"./utility\";\nimport { generateInnerAuthClientConfigCode } from \"./utility/auth-client-config\";\nimport type { ImportGroup } from \"./utility/imports\";\nimport { createImport, getImportString } from \"./utility/imports\";\nimport { getPluginConfigs } from \"./utility/plugin\";\n\nexport const generateAuthClientConfigCode = async ({\n\tplugins: pluginsConfig,\n\tdatabase: databaseConfig,\n\tframework,\n\toptions,\n\tinstallDependency,\n}: GenerateAuthFileOptions) => {\n\tconst plugins = getPluginConfigs(pluginsConfig);\n\n\tconst imports: ImportGroup[] = [\n\t\t...(!framework.authClient\n\t\t\t? ([\n\t\t\t\t\t{\n\t\t\t\t\t\timports: [createImport({ name: \"createAuthClient\" })],\n\t\t\t\t\t\tpath: \"better-auth/client\",\n\t\t\t\t\t\tisNamedImport: false,\n\t\t\t\t\t},\n\t\t\t\t] satisfies ImportGroup[])\n\t\t\t: ([\n\t\t\t\t\t{\n\t\t\t\t\t\timports: [createImport({ name: \"createAuthClient\" })],\n\t\t\t\t\t\tpath: framework.authClient.importPath as string,\n\t\t\t\t\t\tisNamedImport: false,\n\t\t\t\t\t},\n\t\t\t\t] satisfies ImportGroup[])),\n\t\t...Object.values(plugins)\n\t\t\t.map(({ authClient }) => (!authClient ? [] : authClient.imports))\n\t\t\t.flat(),\n\t];\n\n\tconst authClientCode = await generateInnerAuthClientConfigCode({\n\t\tplugins,\n\t\toptions,\n\t\tinstallDependency,\n\t});\n\n\tconst segmentedCode = {\n\t\timports: await getImportString(imports),\n\t\texports: \"\",\n\t\tpreAuthConfig: \"\",\n\t\tauthConfig: authClientCode ? `{${authClientCode}}` : \"\",\n\t\tpostAuthConfig: \"\",\n\t};\n\n\tconst code: string[] = [\n\t\tsegmentedCode.imports,\n\t\t``,\n\t\tsegmentedCode.preAuthConfig,\n\t\t``,\n\t\t`export const authClient = createAuthClient(`,\n\t\tsegmentedCode.authConfig,\n\t\t`);`,\n\t\t``,\n\t\tsegmentedCode.postAuthConfig,\n\t\t``,\n\t\tsegmentedCode.exports,\n\t];\n\treturn await formatCode(code.join(\"\\n\"));\n};\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const getEnvFiles = async (cwd: string): Promise<string[]> => {\n\tconst envFiles = await fs.readdir(cwd, \"utf-8\");\n\treturn envFiles\n\t\t.filter((file) => file.startsWith(\".env\") && file !== \".env.example\")\n\t\t.map((file) => path.join(cwd, file));\n};\n\nexport const parseEnvFiles = async (envFiles: string[]) => {\n\tconst result = new Map<string, string[]>();\n\tfor (const file of envFiles) {\n\t\tconst content = await fs.readFile(file, \"utf-8\");\n\t\tconst existingVars = content\n\t\t\t.split(\"\\n\")\n\t\t\t.filter((line) => line.trim())\n\t\t\t.map((x) => x.split(\"=\")[0])\n\t\t\t.filter((x) => x && x.trim())\n\t\t\t.filter((x) => !x?.includes(\" \"))\n\t\t\t.filter((x) => !x?.startsWith(\"#\")) as string[];\n\t\tresult.set(file, existingVars);\n\t}\n\n\treturn result;\n};\n\nexport const updateEnvFiles = async (\n\tenvFiles: string[],\n\tenvs: string[],\n): Promise<void> => {\n\tfor (const file of envFiles) {\n\t\tconst content = await fs.readFile(file, \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tlines.push(...envs);\n\t\tawait fs.writeFile(file, lines.join(\"\\n\"), \"utf-8\");\n\t}\n};\n\n/**\n * Gets the missing env variables in the env files\n *\n * @param envFiles - The list of env files to check\n * @param envVar - The env variable to check\n * @returns The list of env files that are missing the env variable\n */\nexport const getMissingEnvVars = async (\n\tenvFiles: Map<string, string[]>,\n\tenvVar: string | string[],\n): Promise<{ file: string; var: string[] }[]> => {\n\tconst missingVarInFiles: { file: string; var: string[] }[] = [];\n\tfor (const [file, existingVars] of envFiles) {\n\t\tif (Array.isArray(envVar)) {\n\t\t\tconst missingVars = envVar.filter((v) => !existingVars.includes(v));\n\t\t\tif (missingVars.length > 0) {\n\t\t\t\tmissingVarInFiles.push({\n\t\t\t\t\tfile,\n\t\t\t\t\tvar: missingVars,\n\t\t\t\t});\n\t\t\t}\n\t\t} else if (typeof envVar === \"string\" && !existingVars.includes(envVar)) {\n\t\t\tmissingVarInFiles.push({ file, var: [envVar] });\n\t\t}\n\t}\n\treturn missingVarInFiles;\n};\n\nexport const createEnvFile = async (\n\tcwd: string,\n\tenvVariables: string[],\n): Promise<void> => {\n\tconst envFile = path.join(cwd, \".env\");\n\tawait fs.writeFile(envFile, envVariables.join(\"\\n\"), \"utf-8\");\n};\n","import { readdirSync } from \"node:fs\";\nimport type { Awaitable } from \"@better-auth/core\";\nimport type { PackageJson } from \"type-fest\";\nimport { hasDependency } from \"../../../utils/get-package-info\";\nimport type { Framework } from \"../configs/frameworks.config\";\nimport { FRAMEWORKS } from \"../configs/frameworks.config\";\n\nexport async function detectFramework(cwd: string, packageJson: PackageJson) {\n\tfor (const strategy of [packageJsonStrategy, fileStrategy]) {\n\t\tconst result = await strategy({ cwd, packageJson });\n\t\tif (result !== null) {\n\t\t\treturn result;\n\t\t}\n\t}\n\treturn null;\n}\n\ntype Strategy = (ctx: {\n\tcwd: string;\n\tpackageJson: PackageJson;\n}) => Awaitable<Framework | null>;\n\nconst packageJsonStrategy: Strategy = ({ packageJson }) => {\n\tfor (const framework of FRAMEWORKS) {\n\t\tif (hasDependency(packageJson, framework.dependency)) {\n\t\t\treturn framework;\n\t\t}\n\t}\n\treturn null;\n};\n\nconst fileStrategy: Strategy = ({ cwd }) => {\n\tconst cwdFiles = readdirSync(cwd);\n\n\tfor (const framework of FRAMEWORKS) {\n\t\tif (!framework.configPaths?.length) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const configPath of framework.configPaths) {\n\t\t\tif (cwdFiles.includes(configPath)) {\n\t\t\t\treturn framework;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n};\n","import { exec } from \"node:child_process\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport open from \"open\";\nimport prompts from \"prompts\";\nimport yoctoSpinner from \"yocto-spinner\";\nimport z from \"zod\";\nimport { cliVersion } from \"../..\";\nimport { generateDrizzleSchema } from \"../../generators/drizzle\";\nimport { generatePrismaSchema } from \"../../generators/prisma\";\nimport {\n\tdetectPackageManager,\n\tgetPkgManagerStr,\n\tPACKAGE_MANAGER,\n} from \"../../utils/check-package-managers\";\nimport {\n\tpossibleAuthConfigPaths,\n\tpossibleClientConfigPaths,\n} from \"../../utils/config-paths\";\nimport { getPackageInfo, hasDependency } from \"../../utils/get-package-info\";\nimport { generateSecretHash, tryCatch } from \"../../utils/helper\";\nimport { installDependencies } from \"../../utils/install-dependencies\";\nimport type { DatabaseAdapter } from \"./configs/databases.config\";\nimport type { Framework } from \"./configs/frameworks.config\";\nimport { FRAMEWORKS } from \"./configs/frameworks.config\";\nimport {\n\tSOCIAL_PROVIDER_CONFIGS,\n\tSOCIAL_PROVIDERS,\n} from \"./configs/social-providers.config\";\nimport type { Plugin, PluginsConfig } from \"./configs/temp-plugins.config\";\nimport { tempPluginsConfig } from \"./configs/temp-plugins.config\";\nimport type { GetArgumentsOptions } from \"./generate-auth\";\nimport { generateAuthConfigCode } from \"./generate-auth\";\nimport { generateAuthClientConfigCode } from \"./generate-auth-client\";\nimport {\n\tgetAvailableORMs,\n\tgetDatabaseCode,\n\tgetDialectsForORM,\n\tisDirectAdapter,\n\tisKyselyDialect,\n} from \"./utility/database\";\nimport {\n\tcreateEnvFile,\n\tgetEnvFiles,\n\tgetMissingEnvVars,\n\tparseEnvFiles,\n\tupdateEnvFiles,\n} from \"./utility/env\";\nimport { detectFramework } from \"./utility/framework\";\nimport { getFlagVariable } from \"./utility/prompt\";\n\n// Helper functions to replace @clack/prompts\nconst confirm = async (options: { message: string; initial?: boolean }) => {\n\tconst response = await prompts({\n\t\ttype: \"confirm\",\n\t\tname: \"value\",\n\t\tmessage: options.message,\n\t\tinitial: options.initial ?? true,\n\t});\n\treturn response?.value ?? null;\n};\n\nconst select = async (options: {\n\tmessage: string;\n\toptions: Array<{ value: string; label: string }>;\n\tinitialValue?: string;\n}) => {\n\tconst response = await prompts({\n\t\ttype: \"select\",\n\t\tname: \"value\",\n\t\tmessage: options.message,\n\t\tchoices: options.options.map((opt) => ({\n\t\t\ttitle: opt.label,\n\t\t\tvalue: opt.value,\n\t\t})),\n\t\tinitial: options.initialValue\n\t\t\t? options.options.findIndex((opt) => opt.value === options.initialValue)\n\t\t\t: undefined,\n\t});\n\treturn response?.value ?? null;\n};\n\nconst multiselect = async (options: {\n\tmessage: string;\n\toptions: Array<{ value: string; label: string }>;\n}) => {\n\tconst response = await prompts({\n\t\ttype: \"multiselect\",\n\t\tname: \"value\",\n\t\tmessage: options.message,\n\t\tchoices: options.options.map((opt) => ({\n\t\t\ttitle: opt.label,\n\t\t\tvalue: opt.value,\n\t\t})),\n\t\tinstructions: false,\n\t});\n\treturn response?.value ?? null;\n};\n\nconst isCancel = (value: any): boolean => {\n\treturn value === null || value === undefined;\n};\n\nconst cancel = (message: string) => {\n\tconsole.log(message);\n\tprocess.exit(0);\n};\n\nconst log = {\n\tinfo: (message: string) => console.log(message),\n\tsuccess: (message: string) => console.log(chalk.green(message)),\n\terror: (message: string) => console.error(chalk.red(message)),\n};\n\n/**\n * Extract database provider from database adapter string\n */\nconst getDatabaseProvider = (\n\tdatabase: string,\n): \"sqlite\" | \"mysql\" | \"postgresql\" | \"pg\" | null => {\n\tif (database.startsWith(\"drizzle-\")) {\n\t\tif (database.includes(\"postgresql\")) {\n\t\t\treturn \"pg\";\n\t\t}\n\t\tif (database.includes(\"mysql\")) {\n\t\t\treturn \"mysql\";\n\t\t}\n\t\tif (database.includes(\"sqlite\")) {\n\t\t\treturn \"sqlite\";\n\t\t}\n\t}\n\tif (database.startsWith(\"prisma-\")) {\n\t\tif (database.includes(\"postgresql\")) {\n\t\t\treturn \"postgresql\";\n\t\t}\n\t\tif (database.includes(\"mysql\")) {\n\t\t\treturn \"mysql\";\n\t\t}\n\t\tif (database.includes(\"sqlite\")) {\n\t\t\treturn \"sqlite\";\n\t\t}\n\t}\n\treturn null;\n};\n\n/**\n * Create a minimal BetterAuthOptions config for schema generation\n */\nconst createMinimalConfig = (plugins: Plugin[], baseURL: string): any => {\n\t// Convert plugin keys to actual plugin instances if needed\n\t// For now, plugins array is empty, so we'll create a minimal config\n\tconst pluginInstances = plugins\n\t\t.map((pluginKey) => {\n\t\t\tconst pluginConfig = tempPluginsConfig[pluginKey];\n\t\t\tif (!pluginConfig) return null;\n\t\t\t// We need to import the actual plugin, but for schema generation\n\t\t\t// we only need the schema property from the plugin\n\t\t\t// Since plugins are currently skipped (return []), this will be empty\n\t\t\treturn null;\n\t\t})\n\t\t.filter(Boolean);\n\n\treturn {\n\t\tsecret: \"temp-secret-for-schema-generation\",\n\t\tbaseURL,\n\t\tplugins: pluginInstances,\n\t};\n};\n\n/**\n * Create a mock adapter object for schema generation\n */\nconst createMockAdapter = (\n\tdatabase: string,\n\tprovider: \"sqlite\" | \"mysql\" | \"postgresql\" | \"pg\",\n): any => {\n\tconst isDrizzle = database.startsWith(\"drizzle-\");\n\tconst isPrisma = database.startsWith(\"prisma-\");\n\n\treturn {\n\t\tid: isDrizzle ? \"drizzle\" : isPrisma ? \"prisma\" : \"unknown\",\n\t\toptions: {\n\t\t\tprovider: provider === \"pg\" ? \"pg\" : provider,\n\t\t},\n\t};\n};\n\n/**\n * Generate the correct import path for the auth file in route handlers\n */\nconst generateAuthImportPath = async (\n\tcwd: string,\n\tauthFilePath: string,\n\trouteHandlerPath: string,\n\tframework?: Framework,\n): Promise<string> => {\n\t// Resolve both paths relative to cwd\n\tconst absoluteAuthPath = path.resolve(cwd, authFilePath);\n\tconst resolvedRouteHandlerPath = path.resolve(cwd, routeHandlerPath);\n\tconst routeHandlerDir = path.dirname(resolvedRouteHandlerPath);\n\n\t// Special handling for SvelteKit's $lib alias\n\tif (framework?.id === \"sveltekit\") {\n\t\tconst relativeAuthPath = path.relative(cwd, absoluteAuthPath);\n\t\tconst normalizedPath = relativeAuthPath.replace(/\\\\/g, \"/\");\n\n\t\t// Check if auth file is in src/lib\n\t\tif (normalizedPath.startsWith(\"src/lib/\") || normalizedPath === \"src/lib\") {\n\t\t\tconst pathAfterLib = normalizedPath.slice(\"src/lib/\".length);\n\t\t\tconst pathWithoutExt = pathAfterLib.replace(/\\.(ts|js|tsx|jsx)$/, \"\");\n\t\t\treturn pathWithoutExt ? `$lib/${pathWithoutExt}` : \"$lib/auth\";\n\t\t}\n\t}\n\n\t// Special handling for Hono - use relative imports\n\tif (framework?.id === \"hono\") {\n\t\tlet relativePath = path.relative(routeHandlerDir, absoluteAuthPath);\n\t\trelativePath = relativePath.replace(/\\.(ts|js|tsx|jsx)$/, \"\");\n\t\tif (!relativePath.startsWith(\".\")) {\n\t\t\trelativePath = `./${relativePath}`;\n\t\t}\n\t\treturn relativePath.replace(/\\\\/g, \"/\");\n\t}\n\n\t// Read tsconfig.json to check for path aliases\n\tconst tsconfigPath = path.join(cwd, \"tsconfig.json\");\n\tconst { data: tsconfigContent } = await tryCatch(\n\t\tfs.readFile(tsconfigPath, \"utf-8\"),\n\t);\n\n\tlet aliasPrefix: string | null = null;\n\tlet aliasBasePath: string | null = null;\n\n\tif (tsconfigContent) {\n\t\ttry {\n\t\t\t// Remove comments from JSON (simple approach)\n\t\t\tconst cleanedContent = tsconfigContent.replace(\n\t\t\t\t/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/.*/g,\n\t\t\t\t\"\",\n\t\t\t);\n\t\t\tconst tsconfig = JSON.parse(cleanedContent);\n\t\t\tconst compilerOptions = tsconfig?.compilerOptions;\n\t\t\tconst paths = compilerOptions?.paths;\n\t\t\tconst baseUrl = compilerOptions?.baseUrl;\n\n\t\t\tif (paths) {\n\t\t\t\t// Look for common aliases like @/*, ~/* etc\n\t\t\t\tfor (const [alias, targets] of Object.entries(paths)) {\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof alias === \"string\" &&\n\t\t\t\t\t\talias.endsWith(\"/*\") &&\n\t\t\t\t\t\tArray.isArray(targets) &&\n\t\t\t\t\t\ttargets.length > 0\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst target = targets[0] as string;\n\t\t\t\t\t\tif (target.endsWith(\"/*\")) {\n\t\t\t\t\t\t\taliasPrefix = alias.slice(0, -2); // Remove /*\n\t\t\t\t\t\t\tlet basePath = target.slice(0, -2); // Remove /*\n\n\t\t\t\t\t\t\t// If baseUrl is set, resolve the base path relative to it\n\t\t\t\t\t\t\tif (baseUrl && baseUrl !== \".\") {\n\t\t\t\t\t\t\t\tbasePath = path.join(baseUrl, basePath);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\taliasBasePath = basePath;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (_e) {\n\t\t\t// Ignore tsconfig parsing errors\n\t\t}\n\t}\n\n\t// Get relative path from cwd to auth file\n\tconst relativeAuthPath = path.relative(cwd, absoluteAuthPath);\n\n\t// If we have an alias, try to use it\n\tif (aliasPrefix && aliasBasePath !== null) {\n\t\t// Normalize the base path (handle . and ./ and empty string)\n\t\tconst normalizedBasePath = path.normalize(aliasBasePath);\n\n\t\tconsole.log(chalk.dim(` normalizedBasePath: ${normalizedBasePath}`));\n\n\t\t// If base path is \".\" or empty, it means the alias points to the project root\n\t\tif (\n\t\t\tnormalizedBasePath === \".\" ||\n\t\t\tnormalizedBasePath === \"\" ||\n\t\t\tnormalizedBasePath === \"./\"\n\t\t) {\n\t\t\t// The auth file is relative to cwd, so we can use the alias directly\n\t\t\tconst pathWithoutExt = relativeAuthPath.replace(/\\.(ts|js|tsx|jsx)$/, \"\");\n\t\t\tconst result = `${aliasPrefix}/${pathWithoutExt}`.replace(/\\\\/g, \"/\");\n\t\t\tconsole.log(chalk.dim(` Using alias, returning: ${result}`));\n\t\t\treturn result;\n\t\t}\n\n\t\t// For other base paths like \"src\" or \"app\", check if auth file is within that path\n\t\t// Ensure we're comparing normalized paths\n\t\tconst normalizedRelativePath = relativeAuthPath.replace(/\\\\/g, \"/\");\n\t\tconst normalizedBasePathForward = normalizedBasePath.replace(/\\\\/g, \"/\");\n\n\t\tif (\n\t\t\tnormalizedRelativePath === normalizedBasePathForward ||\n\t\t\tnormalizedRelativePath.startsWith(normalizedBasePathForward + \"/\")\n\t\t) {\n\t\t\t// Remove the base path and use the alias\n\t\t\tlet pathAfterBase: string;\n\t\t\tif (normalizedRelativePath === normalizedBasePathForward) {\n\t\t\t\tpathAfterBase = \"\";\n\t\t\t} else {\n\t\t\t\tpathAfterBase = normalizedRelativePath.slice(\n\t\t\t\t\tnormalizedBasePathForward.length + 1,\n\t\t\t\t);\n\t\t\t}\n\t\t\t// Remove file extension\n\t\t\tconst pathWithoutExt = pathAfterBase.replace(/\\.(ts|js|tsx|jsx)$/, \"\");\n\t\t\treturn pathWithoutExt ? `${aliasPrefix}/${pathWithoutExt}` : aliasPrefix;\n\t\t}\n\t}\n\n\tlet relativePath = path.relative(routeHandlerDir, absoluteAuthPath);\n\n\t// Remove file extension\n\trelativePath = relativePath.replace(/\\.(ts|js|tsx|jsx)$/, \"\");\n\n\t// Ensure it starts with ./ or ../\n\tif (!relativePath.startsWith(\".\")) {\n\t\trelativePath = `./${relativePath}`;\n\t}\n\n\t// Convert Windows paths to Unix paths\n\treturn relativePath.replace(/\\\\/g, \"/\");\n};\n\nexport async function initAction(opts: any) {\n\tconst options = initActionOptionsSchema.parse(opts);\n\tconst cwd = options.cwd;\n\n\t// Check if package.json exists (not an empty project)\n\tlet packageJson: Record<string, any> | null = null;\n\ttry {\n\t\tpackageJson = await getPackageInfo(cwd);\n\t} catch {\n\t\t//\n\t}\n\tif (typeof packageJson !== \"object\" || packageJson === null) {\n\t\tconst pm = options.packageManager || \"npm\";\n\t\tconst initCommand =\n\t\t\tpm === \"bun\" ? \"bun init\" : pm === \"yarn\" ? \"yarn init\" : `${pm} init`;\n\t\tconsole.error(\n\t\t\tchalk.red(\n\t\t\t\t`\\nThis appears to be an empty project. No package.json found.\\n`,\n\t\t\t),\n\t\t);\n\t\tconsole.error(\n\t\t\tchalk.yellow(\n\t\t\t\t`Please initialize a new project first by running:\\n\\n ${chalk.bold(initCommand)}\\n`,\n\t\t\t),\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tlet currentStep = 0;\n\n\tconst nextStep = async (text: string) => {\n\t\tcurrentStep++;\n\t\tconsole.log(chalk.white(`\\n${currentStep}. ${text}`));\n\t};\n\n\tconst additionalSteps: (() => Promise<unknown>)[] = [];\n\n\t// Render hero\n\t//${chalk.italic(chalk.dim(cliVersion.padStart(41, \" \")))}\n\tconsole.log(\n\t\t// boxen(\n\t\t\"\\n\" +\n\t\t\t[\n\t\t\t\t` ██ ████`,\n\t\t\t\t` ████ ██ ${chalk.bold(`Better Auth CLI`)} ${chalk.dim(`(${cliVersion})`)}`,\n\t\t\t\t` ██ ████ ${chalk.gray(\"Welcome to the Better Auth CLI! Let's get you set up.\")}`,\n\t\t\t]\n\t\t\t\t// .map((x) => x.padStart(10))\n\t\t\t\t.join(\"\\n\"),\n\t\t// \t{\n\t\t// \t\tpadding: 1,\n\t\t// \t\tborderStyle: \"doubleSingle\",\n\t\t// \t\tdimBorder: true,\n\t\t// \t},\n\t\t// ),\n\t);\n\n\t// Get package manager information\n\tconst { pm, pmString: _pmString } = await (async () => {\n\t\tif (options.packageManager) {\n\t\t\tconst [pm, version] = [options.packageManager, null];\n\t\t\tconst pmString = getPkgManagerStr({ packageManager: pm, version });\n\t\t\treturn { pm, pmString };\n\t\t}\n\n\t\tconst { packageManager, version } = await detectPackageManager(\n\t\t\tcwd,\n\t\t\tpackageJson,\n\t\t);\n\t\tconst pmString = getPkgManagerStr({ packageManager, version });\n\t\treturn { pm: packageManager, pmString };\n\t})();\n\n\tconst depsToInstall = new Map<\n\t\tstring,\n\t\tPartial<Record<\"prod\" | \"dev\" | \"peer\" | \"optional\", boolean>>\n\t>();\n\tconst filesToWrite: (() => Promise<unknown>)[] = [];\n\n\t// Install Better Auth\n\tawait (async () => {\n\t\tconst hasBetterAuth = await hasDependency(packageJson, \"better-auth\");\n\t\tif (hasBetterAuth) return;\n\t\tawait nextStep(\"Install Better Auth\");\n\n\t\tconst shouldInstallBetterAuth = await confirm({\n\t\t\tmessage: `Would you like to install better-auth using ${chalk.bold(pm)}?`,\n\t\t\tinitial: true,\n\t\t});\n\t\tif (isCancel(shouldInstallBetterAuth)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\tif (shouldInstallBetterAuth) {\n\t\t\tdepsToInstall.set(\"better-auth\", {\n\t\t\t\tprod: true,\n\t\t\t});\n\t\t}\n\t})();\n\n\tlet envFiles = new Map<string, string[]>();\n\n\t// Handle ENV files\n\tawait (async () => {\n\t\tenvFiles = await parseEnvFiles(await getEnvFiles(cwd));\n\n\t\t// If no existing ENV files, ask to allow creation of a new one.\n\t\tif (envFiles.size === 0) {\n\t\t\tawait nextStep(\"Set Environment Variables\");\n\n\t\t\tconst shouldCreateEnv = await confirm({\n\t\t\t\tmessage: `Would you like to set environment variables?`,\n\t\t\t});\n\t\t\tif (isCancel(shouldCreateEnv)) {\n\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t\tif (shouldCreateEnv) {\n\t\t\t\tconst { providedSecret } = await prompts({\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\tname: \"providedSecret\",\n\t\t\t\t\tmessage: `Better Auth secret (used for encryption, hashing, and signing). ${chalk.dim(\"(Press Enter to auto generate)\")}`,\n\t\t\t\t});\n\t\t\t\tif (isCancel(providedSecret)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\t\t\t\tconst { providedURL } = await prompts({\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\tname: \"providedURL\",\n\t\t\t\t\tmessage: `Better Auth Base URL (your auth server URL):`,\n\t\t\t\t\tinitial: \"http://localhost:3000\",\n\t\t\t\t});\n\t\t\t\tif (isCancel(providedURL)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tconst secret = providedSecret || generateSecretHash();\n\t\t\t\tconst envs = [\n\t\t\t\t\t`BETTER_AUTH_SECRET=\"${secret}\"`,\n\t\t\t\t\t`BETTER_AUTH_URL=\"${providedURL}\"`,\n\t\t\t\t];\n\t\t\t\tenvFiles.set(\".env\", envs);\n\t\t\t\tfilesToWrite.push(() => createEnvFile(cwd, envs));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Check for missing ENV variables (basic ones only - social providers handled later)\n\t\tconst missingEnvVars = await getMissingEnvVars(envFiles, [\n\t\t\t\"BETTER_AUTH_SECRET\",\n\t\t\t\"BETTER_AUTH_URL\",\n\t\t]);\n\n\t\tif (!missingEnvVars.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait nextStep(\"Set Environment Variables\");\n\n\t\t// If only one file is missing env variables, just show confirmation prompt\n\t\tif (missingEnvVars.length === 1) {\n\t\t\tconst { file, var: missingVars } = missingEnvVars[0]!;\n\t\t\tconst confirmed = await confirm({\n\t\t\t\tmessage: `Add required environment variables to ${chalk.bold(file.split(\"/\").pop())}? (${missingVars.map((v) => chalk.cyan(v)).join(\", \")})`,\n\t\t\t});\n\t\t\tif (isCancel(confirmed)) {\n\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t\tif (confirmed) {\n\t\t\t\tconst envs: string[] = [];\n\n\t\t\t\tfor (const v of missingVars) {\n\t\t\t\t\tif (v === \"BETTER_AUTH_SECRET\") {\n\t\t\t\t\t\tconst { providedSecret } = await prompts({\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tname: \"providedSecret\",\n\t\t\t\t\t\t\tmessage: `Better Auth secret (used for encryption, hashing, and signing). ${chalk.dim(\"(Press Enter to auto generate)\")}`,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (isCancel(providedSecret)) {\n\t\t\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\t\t\tprocess.exit(0);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenvs.push(\n\t\t\t\t\t\t\t`BETTER_AUTH_SECRET=\"${providedSecret || generateSecretHash()}\"`,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (v === \"BETTER_AUTH_URL\") {\n\t\t\t\t\t\tconst { providedURL } = await prompts({\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\tname: \"providedURL\",\n\t\t\t\t\t\t\tmessage: `Better Auth base URL (your auth server URL):`,\n\t\t\t\t\t\t\tinitial: \"http://localhost:3000\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (isCancel(providedURL)) {\n\t\t\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\t\t\tprocess.exit(0);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenvs.push(`BETTER_AUTH_URL=\"${providedURL}\"`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tenvFiles.set(file, envs);\n\t\t\t\tfilesToWrite.push(() => updateEnvFiles([file], envs));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// If multiple files are missing env variables, ask to select the files to update.\n\t\tconst filesToUpdate = await multiselect({\n\t\t\tmessage: `Add required environment variables to the following files?`,\n\t\t\toptions: missingEnvVars.map((x) => ({\n\t\t\t\tvalue: x.file,\n\t\t\t\tlabel: `${chalk.bold(x.file)}: ${x.var.map((v) => chalk.cyan(v)).join(\", \")}`,\n\t\t\t})),\n\t\t});\n\n\t\tif (isCancel(filesToUpdate)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (filesToUpdate) {\n\t\t\tconst secretHash = generateSecretHash();\n\t\t\tfor (const file of filesToUpdate) {\n\t\t\t\tconst envs = missingEnvVars\n\t\t\t\t\t.find((x) => x.file === file)!\n\t\t\t\t\t.var.map((v) => {\n\t\t\t\t\t\tif (v === \"BETTER_AUTH_SECRET\") {\n\t\t\t\t\t\t\treturn `BETTER_AUTH_SECRET=\"${secretHash}\"`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (v === \"BETTER_AUTH_URL\") {\n\t\t\t\t\t\t\treturn 'BETTER_AUTH_URL=\"http://localhost:3000\"';\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn `${v}=${v}`;\n\t\t\t\t\t});\n\t\t\t\tfilesToWrite.push(() => updateEnvFiles([file], envs));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t})();\n\n\t// Auto-detect framework silently\n\tconst detectedFramework = await detectFramework(cwd, packageJson);\n\tlet framework: Framework =\n\t\tdetectedFramework || FRAMEWORKS.find((f) => f.id === \"next\")!;\n\tconst frameworkWasDetected = !!detectedFramework;\n\n\t// For Next.js, detect if using App Router or Pages Router\n\tif (framework.id === \"next\" && framework.routeHandler) {\n\t\tconst { data: rootFiles } = await tryCatch(fs.readdir(cwd, \"utf-8\"));\n\t\tconst hasAppDir = rootFiles?.some((file) => file === \"app\");\n\t\tconst hasPagesDir = rootFiles?.some((file) => file === \"pages\");\n\t\tconst hasSrcDir = rootFiles?.some((file) => file === \"src\");\n\n\t\tlet routeHandlerPath = \"app/api/auth/[...all]/route.ts\";\n\n\t\t// Check for src/app or src/pages\n\t\tif (hasSrcDir) {\n\t\t\tconst { data: srcFiles } = await tryCatch(\n\t\t\t\tfs.readdir(path.join(cwd, \"src\"), \"utf-8\"),\n\t\t\t);\n\t\t\tconst hasSrcApp = srcFiles?.some((file) => file === \"app\");\n\t\t\tconst hasSrcPages = srcFiles?.some((file) => file === \"pages\");\n\n\t\t\tif (hasSrcPages) {\n\t\t\t\trouteHandlerPath = \"src/pages/api/auth/[...all].ts\";\n\t\t\t} else if (hasSrcApp) {\n\t\t\t\trouteHandlerPath = \"src/app/api/auth/[...all]/route.ts\";\n\t\t\t}\n\t\t} else if (hasPagesDir) {\n\t\t\trouteHandlerPath = \"pages/api/auth/[...all].ts\";\n\t\t} else if (hasAppDir) {\n\t\t\trouteHandlerPath = \"app/api/auth/[...all]/route.ts\";\n\t\t}\n\n\t\t// Update the framework with the correct path\n\t\tframework = {\n\t\t\t...framework,\n\t\t\trouteHandler: {\n\t\t\t\t...framework.routeHandler,\n\t\t\t\tpath: routeHandlerPath as typeof framework.routeHandler.path,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Prompt for auth config file location\n\tlet authConfigFilePath: string | null = null;\n\tconst hasAuthConfigAlready = await (async () => {\n\t\tfor (const path_ of possibleAuthConfigPaths) {\n\t\t\tconst fullPath = path.join(cwd, path_);\n\t\t\tconst { error } = await tryCatch(fs.access(fullPath, fs.constants.F_OK));\n\t\t\tif (!error) {\n\t\t\t\tauthConfigFilePath = fullPath;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t})();\n\n\tif (!hasAuthConfigAlready) {\n\t\tawait nextStep(\"Create A Better Auth Instance\");\n\n\t\tconst { data: allFiles, error } = await tryCatch(fs.readdir(cwd, \"utf-8\"));\n\t\tif (error) {\n\t\t\tlog.error(`Failed to read directory: ${error.message}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\t// Determine default auth config path based on project structure\n\t\t// Priority: src/lib/ if src/ exists, otherwise lib/\n\t\tconst hasSrc = allFiles.some((node) => node === \"src\");\n\n\t\tlet defaultAuthConfigPath: string;\n\t\tif (hasSrc) {\n\t\t\tdefaultAuthConfigPath = path.join(cwd, \"src\", \"lib\", \"auth.ts\");\n\t\t} else {\n\t\t\tdefaultAuthConfigPath = path.join(cwd, \"lib\", \"auth.ts\");\n\t\t}\n\n\t\t// Convert absolute path to relative path for display\n\t\tconst relativeDefaultPath = path.relative(cwd, defaultAuthConfigPath);\n\n\t\tconst { filePath } = await prompts({\n\t\t\ttype: \"text\",\n\t\t\tname: \"filePath\",\n\t\t\tmessage: `Where would you like to create the auth instance?`,\n\t\t\tinitial: relativeDefaultPath,\n\t\t});\n\n\t\tif (isCancel(filePath)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// Convert relative path back to absolute path\n\t\t// Remove leading slash if present (user might enter /lib/auth.ts meaning relative to project root)\n\t\tconst cleanPath = filePath.startsWith(\"/\") ? filePath.slice(1) : filePath;\n\t\tconst absoluteFilePath = path.isAbsolute(cleanPath)\n\t\t\t? cleanPath\n\t\t\t: path.join(cwd, cleanPath);\n\n\t\tauthConfigFilePath = absoluteFilePath;\n\n\t\t// Generate minimal boilerplate auth config immediately\n\t\tconst boilerplateCode = `import { betterAuth } from \"better-auth\";\n\nexport const auth = betterAuth({\n\t// Configuration will be added here\n});\n`;\n\n\t\tfilesToWrite.push(async () => {\n\t\t\tconst { error: mkdirError } = await tryCatch(\n\t\t\t\tfs.mkdir(path.dirname(absoluteFilePath), { recursive: true }),\n\t\t\t);\n\t\t\tif (mkdirError) {\n\t\t\t\tconst error = `Failed to create auth directory at ${path.dirname(absoluteFilePath)}: ${mkdirError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tconst { error: writeFileError } = await tryCatch(\n\t\t\t\tfs.writeFile(absoluteFilePath, boilerplateCode, \"utf-8\"),\n\t\t\t);\n\t\t\tif (writeFileError) {\n\t\t\t\tconst error = `Failed to write auth file at ${absoluteFilePath}: ${writeFileError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Select the database to use.\n\tlet databaseChoice: \"yes\" | \"stateless\" | \"skip\" | null = null;\n\tlet database: string | null = null;\n\tlet shouldGenerateSchema = false;\n\tlet shouldRunMigration = false;\n\tawait (async () => {\n\t\tawait nextStep(\"Configure Database\");\n\n\t\tconst dbChoice = await select({\n\t\t\tmessage: `Would you like to configure a database?`,\n\t\t\toptions: [\n\t\t\t\t{ value: \"yes\", label: \"Yes - Configure a database\" },\n\t\t\t\t{\n\t\t\t\t\tvalue: \"stateless\",\n\t\t\t\t\tlabel: \"Stateless - Skip database (stateless mode)\",\n\t\t\t\t},\n\t\t\t\t{ value: \"skip\", label: \"Skip - Don't setup database now\" },\n\t\t\t],\n\t\t});\n\t\tif (isCancel(dbChoice)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tdatabaseChoice = (dbChoice as \"yes\" | \"stateless\" | \"skip\") || null;\n\n\t\tif (databaseChoice === \"yes\") {\n\t\t\t// First, select the ORM or kysely dialect\n\t\t\tconst availableORMs = getAvailableORMs();\n\t\t\tconst selectedOption = await select({\n\t\t\t\tmessage: `Select the database you want to use:`,\n\t\t\t\toptions: availableORMs.map((opt) => ({\n\t\t\t\t\tvalue: opt.adapter || opt.value,\n\t\t\t\t\tlabel: opt.label,\n\t\t\t\t})),\n\t\t\t});\n\t\t\tif (isCancel(selectedOption)) {\n\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\n\t\t\t// If \"sqlite\" was selected, show SQLite variant options\n\t\t\tif (selectedOption === \"sqlite\") {\n\t\t\t\t// Filter SQLite options based on package manager\n\t\t\t\tconst sqliteOptions = [];\n\n\t\t\t\t// Always show better-sqlite3\n\t\t\t\tsqliteOptions.push({\n\t\t\t\t\tvalue: \"sqlite-better-sqlite3\",\n\t\t\t\t\tlabel: \"better-sqlite3\",\n\t\t\t\t});\n\n\t\t\t\t// Show Bun SQLite only if using Bun as package manager or has @types/bun\n\t\t\t\tif (pm === \"bun\") {\n\t\t\t\t\tsqliteOptions.push({\n\t\t\t\t\t\tvalue: \"sqlite-bun\",\n\t\t\t\t\t\tlabel: \"Bun SQLite\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Show Node SQLite only if NOT using Bun\n\t\t\t\t\tsqliteOptions.push({\n\t\t\t\t\t\tvalue: \"sqlite-node\",\n\t\t\t\t\t\tlabel: \"Node SQLite\",\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst sqliteVariants = await select({\n\t\t\t\t\tmessage: `Select SQLite driver:`,\n\t\t\t\t\toptions: sqliteOptions,\n\t\t\t\t});\n\t\t\t\tif (isCancel(sqliteVariants)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\t\t\t\tdatabase = sqliteVariants;\n\t\t\t} else if (isDirectAdapter(selectedOption)) {\n\t\t\t\t// If a direct adapter (kysely dialect or mongodb) was selected, use it directly\n\t\t\t\tdatabase = selectedOption;\n\t\t\t} else {\n\t\t\t\t// Otherwise, select the database dialect for the chosen ORM\n\t\t\t\tconst availableDialects = getDialectsForORM(selectedOption);\n\t\t\t\tconst selectedDialect = await select({\n\t\t\t\t\tmessage: `Select the database dialect:`,\n\t\t\t\t\toptions: availableDialects.map((d) => ({\n\t\t\t\t\t\tvalue: d.adapter,\n\t\t\t\t\t\tlabel: d.label,\n\t\t\t\t\t})),\n\t\t\t\t});\n\t\t\t\tif (isCancel(selectedDialect)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tdatabase = selectedDialect;\n\t\t\t}\n\t\t}\n\n\t\t// Install database dependencies if a database was selected\n\t\tif (database) {\n\t\t\tconst databaseConfig = getDatabaseCode(database as DatabaseAdapter);\n\t\t\tif (databaseConfig && databaseConfig.dependencies.length > 0) {\n\t\t\t\tconst { shouldInstallDeps } = await prompts({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"shouldInstallDeps\",\n\t\t\t\t\tmessage: `Would you like to install the following dependencies: ${[\n\t\t\t\t\t\t...new Set([\n\t\t\t\t\t\t\t...databaseConfig.dependencies,\n\t\t\t\t\t\t\t...(databaseConfig.devDependencies || []),\n\t\t\t\t\t\t]),\n\t\t\t\t\t]\n\t\t\t\t\t\t.map((x) => chalk.cyan(x))\n\t\t\t\t\t\t.join(\", \")}?`,\n\t\t\t\t\tinitial: true,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(shouldInstallDeps)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tif (shouldInstallDeps) {\n\t\t\t\t\tfor (const dep of databaseConfig.dependencies) {\n\t\t\t\t\t\tdepsToInstall.set(dep, {\n\t\t\t\t\t\t\t...(depsToInstall.get(dep) || {}),\n\t\t\t\t\t\t\tprod: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tfor (const dep of databaseConfig.devDependencies || []) {\n\t\t\t\t\t\tdepsToInstall.set(dep, {\n\t\t\t\t\t\t\t...(depsToInstall.get(dep) || {}),\n\t\t\t\t\t\t\tdev: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle schema generation and migration\n\t\t\tconst dbString = String(database);\n\t\t\tconst isDrizzle = dbString.startsWith(\"drizzle-\");\n\t\t\tconst isPrisma = dbString.startsWith(\"prisma-\");\n\t\t\tconst isKysely = isKyselyDialect(dbString);\n\t\t\tconst isMongoDB = dbString === \"mongodb\";\n\n\t\t\t// For ORMs (Drizzle, Prisma), ask to generate schema\n\t\t\tif (isDrizzle || isPrisma) {\n\t\t\t\tconst response = await prompts({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"shouldGenerate\",\n\t\t\t\t\tmessage: `Would you like to generate the database schema?`,\n\t\t\t\t\tinitial: true,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(response.shouldGenerate)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tshouldGenerateSchema = response.shouldGenerate || false;\n\n\t\t\t\tif (shouldGenerateSchema) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\tchalk.dim(\n\t\t\t\t\t\t\t`\\n Schema will be generated after auth configuration is complete.\\n`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For Kysely dialects (SQLite, MySQL, PostgreSQL, MSSQL), ask to run migration\n\t\t\tif (isKysely) {\n\t\t\t\tconst response = await prompts({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"shouldMigrate\",\n\t\t\t\t\tmessage: `Would you like to run database migration?`,\n\t\t\t\t\tinitial: true,\n\t\t\t\t});\n\n\t\t\t\tif (isCancel(response.shouldMigrate)) {\n\t\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\n\t\t\t\tshouldRunMigration = response.shouldMigrate || false;\n\n\t\t\t\tif (shouldRunMigration) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\tchalk.dim(\n\t\t\t\t\t\t\t`\\n Migration will run after auth configuration is complete.\\n`,\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For MongoDB, just show info\n\t\t\tif (isMongoDB) {\n\t\t\t\tconsole.log(\n\t\t\t\t\tchalk.dim(\n\t\t\t\t\t\t`\\n MongoDB adapter will automatically create collections as needed.\\n`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t})();\n\n\t// Prompt for email & password authentication (skip if stateless)\n\tlet emailAndPassword = false;\n\tif (databaseChoice && databaseChoice !== \"stateless\") {\n\t\tawait nextStep(\"Configure Email & Password\");\n\t\tconst confirmed = await confirm({\n\t\t\tmessage: `Would you like to enable email & password authentication?`,\n\t\t\tinitial: true,\n\t\t});\n\t\tif (isCancel(confirmed)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\temailAndPassword = confirmed || false;\n\t}\n\n\t// Prompt for social providers\n\tlet selectedSocialProviders: string[] = [];\n\tawait (async () => {\n\t\tawait nextStep(\"Configure Social Providers\");\n\t\tconst shouldSetupSocial = await confirm({\n\t\t\tmessage: `Would you like to setup social providers?`,\n\t\t\tinitial: true,\n\t\t});\n\t\tif (isCancel(shouldSetupSocial)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (shouldSetupSocial) {\n\t\t\tconst providers = await multiselect({\n\t\t\t\tmessage: `Select the social providers you want to enable:`,\n\t\t\t\toptions: SOCIAL_PROVIDERS.map((provider) => ({\n\t\t\t\t\tvalue: provider,\n\t\t\t\t\tlabel: provider.charAt(0).toUpperCase() + provider.slice(1),\n\t\t\t\t})),\n\t\t\t});\n\t\t\tif (isCancel(providers)) {\n\t\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t\tselectedSocialProviders = providers || [];\n\t\t}\n\t})();\n\n\t// Add social provider environment variables\n\tif (selectedSocialProviders.length > 0) {\n\t\tawait (async () => {\n\t\t\tif (envFiles.size === 0) return; // No env files to update\n\n\t\t\tconst socialProviderEnvVars = selectedSocialProviders.flatMap(\n\t\t\t\t(provider) => {\n\t\t\t\t\tconst config =\n\t\t\t\t\t\tSOCIAL_PROVIDER_CONFIGS[\n\t\t\t\t\t\t\tprovider as keyof typeof SOCIAL_PROVIDER_CONFIGS\n\t\t\t\t\t\t];\n\t\t\t\t\tif (!config) {\n\t\t\t\t\t\t// Fallback for unknown providers\n\t\t\t\t\t\tconst providerUpper = provider.toUpperCase();\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t`${providerUpper}_CLIENT_ID`,\n\t\t\t\t\t\t\t`${providerUpper}_CLIENT_SECRET`,\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\treturn config.options.map((opt) => opt.envVar);\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tconst missingSocialEnvVars = await getMissingEnvVars(\n\t\t\t\tenvFiles,\n\t\t\t\tsocialProviderEnvVars,\n\t\t\t);\n\n\t\t\tif (missingSocialEnvVars.length > 0 && envFiles.size > 0) {\n\t\t\t\t// Add missing social provider env vars to the file with shortest length\n\t\t\t\tconst firstEnvFile = [...envFiles.keys()].sort(\n\t\t\t\t\t(a, b) => path.basename(a).length - path.basename(b).length,\n\t\t\t\t)[0]!;\n\t\t\t\tconst envVarsToAdd = missingSocialEnvVars\n\t\t\t\t\t.filter((x) => x.file === firstEnvFile)\n\t\t\t\t\t.flatMap((x) => x.var.map((v) => `${v}=\"\"`));\n\n\t\t\t\tif (envVarsToAdd.length > 0) {\n\t\t\t\t\tconst resolvedPath = path.isAbsolute(firstEnvFile)\n\t\t\t\t\t\t? firstEnvFile\n\t\t\t\t\t\t: path.join(cwd, firstEnvFile);\n\t\t\t\t\tfilesToWrite.push(() => updateEnvFiles([resolvedPath], envVarsToAdd));\n\t\t\t\t}\n\t\t\t}\n\t\t})();\n\t}\n\t// Select the plugins to use. For now this is skipped.\n\tconst plugins = await (async (): Promise<Plugin[]> => {\n\t\t// For now we do not want to allow configurations of plugins.\n\t\t// Possibly in the future we can support this.\n\t\tconst skip = true;\n\t\tif (skip) return [];\n\t\tif (hasAuthConfigAlready) return [];\n\n\t\tawait nextStep(\"Select Plugins\");\n\n\t\tconst shouldConfigurePlugins = await confirm({\n\t\t\tmessage: \"Would you like to configure plugins?\",\n\t\t\tinitial: true,\n\t\t});\n\t\tif (isCancel(shouldConfigurePlugins)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (!shouldConfigurePlugins) return [];\n\n\t\tconst selectedPlugins = await multiselect({\n\t\t\tmessage: `Select the plugins you want to use:`,\n\t\t\toptions: Object.entries(tempPluginsConfig).map(([id, plugin]) => ({\n\t\t\t\tvalue: id,\n\t\t\t\tlabel: plugin.displayName,\n\t\t\t})),\n\t\t});\n\t\tif (isCancel(selectedPlugins)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\treturn (selectedPlugins ?? []) as Plugin[];\n\t})();\n\n\t// Generate the auth config file with all selected options\n\tawait (async () => {\n\t\tif (!authConfigFilePath) return;\n\n\t\tconst authConfigCode = await generateAuthConfigCode({\n\t\t\tplugins,\n\t\t\tdatabase: database as DatabaseAdapter | null,\n\t\t\tframework,\n\t\t\tbaseURL: \"http://localhost:3000\",\n\t\t\temailAndPassword,\n\t\t\tsocialProviders: selectedSocialProviders,\n\t\t\toptions,\n\t\t\tinstallDependency: (d, type) => {\n\t\t\t\tconst dependencies = Array.isArray(d) ? d : [d];\n\t\t\t\tfor (const dep of dependencies) {\n\t\t\t\t\tdepsToInstall.set(dep, {\n\t\t\t\t\t\t...(depsToInstall.get(dep) || {}),\n\t\t\t\t\t\t[type || \"prod\"]: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tfilesToWrite.push(async () => {\n\t\t\tif (!authConfigFilePath) return;\n\t\t\tconst { error: writeFileError } = await tryCatch(\n\t\t\t\tfs.writeFile(authConfigFilePath, authConfigCode, \"utf-8\"),\n\t\t\t);\n\t\t\tif (writeFileError) {\n\t\t\t\tconst error = `Failed to write auth file at ${authConfigFilePath}: ${writeFileError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t});\n\t})();\n\n\t// Generate database schema\n\tawait (async () => {\n\t\tif (hasAuthConfigAlready) return;\n\t\tif (!database) return; // Skip if no database selected\n\t\tconst dbString = String(database);\n\t\tif (dbString === \"mongodb\") return; // Skip for MongoDB\n\n\t\t// Determine which generator to use based on database type\n\t\tconst isDrizzle = dbString.startsWith(\"drizzle-\");\n\t\tconst isPrisma = dbString.startsWith(\"prisma-\");\n\t\tconst isKysely = isKyselyDialect(dbString);\n\n\t\t// Handle Kysely migrations\n\t\tif (isKysely && shouldRunMigration) {\n\t\t\tadditionalSteps.push(async () => {\n\t\t\t\tawait nextStep(\"Migrate Database\");\n\n\t\t\t\tconst s = yoctoSpinner({\n\t\t\t\t\ttext: \"Running database migration...\",\n\t\t\t\t\tcolor: \"white\",\n\t\t\t\t});\n\t\t\t\ts.start();\n\n\t\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\t\texec(`npx auth migrate`, { cwd }, (error, stdout, stderr) => {\n\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\ts.stop();\n\t\t\t\t\t\t\tlog.error(`Failed to run migration: ${error.message}`);\n\t\t\t\t\t\t\tif (stderr) log.error(stderr);\n\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ts.success(\"Database migration completed successfully!\");\n\t\t\t\t\t\tif (stdout) console.log(stdout);\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (!isDrizzle && !isPrisma) {\n\t\t\t// Unknown database type, skip\n\t\t\treturn;\n\t\t}\n\n\t\t// Only generate schema if user chose to\n\t\tif (!shouldGenerateSchema) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst provider = getDatabaseProvider(dbString);\n\t\tif (!provider) {\n\t\t\tlog.error(`Unable to determine database provider for ${database}`);\n\t\t\treturn;\n\t\t}\n\n\t\tconst s = yoctoSpinner({\n\t\t\ttext: `Generating database schema...`,\n\t\t\tcolor: \"white\",\n\t\t});\n\t\ts.start();\n\n\t\ttry {\n\t\t\t// Create minimal config for schema generation\n\t\t\tconst config = createMinimalConfig(plugins, \"http://localhost:3000\");\n\n\t\t\t// Create mock adapter\n\t\t\tconst adapter = createMockAdapter(database, provider);\n\n\t\t\tlet schemaResult: {\n\t\t\t\tcode?: string;\n\t\t\t\tfileName: string;\n\t\t\t\toverwrite?: boolean;\n\t\t\t};\n\n\t\t\tlet outputPath: string;\n\n\t\t\tif (isDrizzle) {\n\t\t\t\t// For Drizzle, output to auth-schema.ts next to auth config\n\t\t\t\tif (!authConfigFilePath) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Auth config file path is required for Drizzle schema generation\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Resolve auth config path relative to cwd\n\t\t\t\tconst resolvedAuthConfigPath = path.isAbsolute(authConfigFilePath)\n\t\t\t\t\t? authConfigFilePath\n\t\t\t\t\t: path.join(cwd, authConfigFilePath);\n\t\t\t\tconst authConfigDir = path.dirname(resolvedAuthConfigPath);\n\t\t\t\tconst schemaFileName = \"auth-schema.ts\";\n\t\t\t\tconst fullOutputPath = path.join(authConfigDir, schemaFileName);\n\t\t\t\t// Convert to relative path from cwd for the generator\n\t\t\t\toutputPath = path.relative(cwd, fullOutputPath);\n\n\t\t\t\tschemaResult = await generateDrizzleSchema({\n\t\t\t\t\tadapter,\n\t\t\t\t\toptions: config,\n\t\t\t\t\tfile: outputPath,\n\t\t\t\t});\n\t\t\t} else if (isPrisma) {\n\t\t\t\t// For Prisma, output to prisma/schema.prisma\n\t\t\t\toutputPath = \"prisma/schema.prisma\";\n\t\t\t\tschemaResult = await generatePrismaSchema({\n\t\t\t\t\tadapter,\n\t\t\t\t\toptions: config,\n\t\t\t\t\tfile: outputPath,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Unsupported database type: ${dbString}`);\n\t\t\t}\n\n\t\t\tif (!schemaResult.code) {\n\t\t\t\ts.stop();\n\t\t\t\tlog.info(\"Schema is already up to date.\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Resolve full output path for file operations\n\t\t\tconst fullOutputPath = path.isAbsolute(outputPath)\n\t\t\t\t? outputPath\n\t\t\t\t: path.join(cwd, outputPath);\n\t\t\tconst fileExists = await fs\n\t\t\t\t.access(fullOutputPath)\n\t\t\t\t.then(() => true)\n\t\t\t\t.catch(() => false);\n\n\t\t\tif (fileExists && schemaResult.overwrite) {\n\t\t\t\ts.stop();\n\t\t\t\tconst shouldOverwrite = await confirm({\n\t\t\t\t\tmessage: `The file ${chalk.yellow(outputPath)} already exists. Do you want to overwrite it?`,\n\t\t\t\t\tinitial: false,\n\t\t\t\t});\n\t\t\t\tif (isCancel(shouldOverwrite) || !shouldOverwrite) {\n\t\t\t\t\tlog.info(\"Schema generation cancelled.\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ts.start();\n\t\t\t}\n\n\t\t\tfilesToWrite.push(async () => {\n\t\t\t\tif (!schemaResult.code) return;\n\t\t\t\t// Create directory if it doesn't exist\n\t\t\t\tconst outputDir = path.dirname(fullOutputPath);\n\t\t\t\tawait fs.mkdir(outputDir, { recursive: true });\n\n\t\t\t\t// Write schema file\n\t\t\t\tawait fs.writeFile(fullOutputPath, schemaResult.code, \"utf-8\");\n\t\t\t});\n\n\t\t\ts.success(\n\t\t\t\t`Schema generated successfully at ${chalk.yellow(outputPath)}!`,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\ts.stop();\n\t\t\tlog.error(\n\t\t\t\t`Failed to generate schema: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\t})();\n\n\t// Generate the route handler file.\n\tawait (async () => {\n\t\t// Skip route handler generation if framework wasn't detected\n\t\tif (!frameworkWasDetected) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!framework.routeHandler) return;\n\t\tif (!authConfigFilePath) return;\n\n\t\tconst { routeHandler } = framework;\n\n\t\tconst fullPath = path.resolve(cwd, routeHandler.path);\n\t\tconst access = fs.access(fullPath, fs.constants.F_OK);\n\t\tconst { error } = await tryCatch(access);\n\n\t\tif (!error) {\n\t\t\treturn;\n\t\t}\n\t\tawait nextStep(\"Generate Route Handler\");\n\n\t\t// Convert absolute path to relative path for display\n\t\tconst relativeHandlerPath = path.relative(cwd, fullPath);\n\n\t\tconst { filePath } = await prompts({\n\t\t\ttype: \"text\",\n\t\t\tname: \"filePath\",\n\t\t\tmessage: `Enter the path to the route handler file:`,\n\t\t\tinitial: relativeHandlerPath,\n\t\t});\n\t\tif (isCancel(filePath)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// Convert user input back to absolute path\n\t\tconst cleanHandlerPath = filePath.startsWith(\"/\")\n\t\t\t? filePath.slice(1)\n\t\t\t: filePath;\n\t\tconst absoluteHandlerPath = path.isAbsolute(cleanHandlerPath)\n\t\t\t? cleanHandlerPath\n\t\t\t: path.join(cwd, cleanHandlerPath);\n\n\t\t// Generate the correct import path for the auth file\n\t\tconst authImportPath = await generateAuthImportPath(\n\t\t\tcwd,\n\t\t\tauthConfigFilePath,\n\t\t\tabsoluteHandlerPath,\n\t\t\tframework,\n\t\t);\n\n\t\t// Replace the hardcoded import path in the route handler code with the generated one\n\t\t// Common patterns to replace:\n\t\t// - import { auth } from \"@/lib/auth\"\n\t\t// - import { auth } from \"~/lib/auth\"\n\t\t// - import { auth } from \"$lib/auth\"\n\t\t// - import { auth } from \"./auth\"\n\t\tlet updatedCode = routeHandler.code as string;\n\t\tconst importPatterns = [\n\t\t\t/from\\s+[\"']@\\/[^\"']+[\"']/,\n\t\t\t/from\\s+[\"']~\\/[^\"']+[\"']/,\n\t\t\t/from\\s+[\"']\\$lib\\/[^\"']+[\"']/,\n\t\t\t/from\\s+[\"']\\.\\/[^\"']+[\"']/,\n\t\t\t/from\\s+[\"']\\.\\.\\/[^\"']+[\"']/,\n\t\t];\n\n\t\tfor (const pattern of importPatterns) {\n\t\t\tconst newCode = updatedCode.replace(pattern, `from \"${authImportPath}\"`);\n\t\t\tif (newCode !== updatedCode) {\n\t\t\t\tupdatedCode = newCode;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tfilesToWrite.push(async () => {\n\t\t\tconst mkdir = fs.mkdir(path.dirname(absoluteHandlerPath), {\n\t\t\t\trecursive: true,\n\t\t\t});\n\t\t\tconst { error: mkdirError } = await tryCatch(mkdir);\n\t\t\tif (mkdirError) {\n\t\t\t\tconst error = `Failed to create directory at ${path.dirname(absoluteHandlerPath)}: ${mkdirError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tconst writeFile = fs.writeFile(absoluteHandlerPath, updatedCode, \"utf-8\");\n\t\t\tconst { error: writeFileError } = await tryCatch(writeFile);\n\t\t\tif (writeFileError) {\n\t\t\t\tconst error = `Failed to write file at ${absoluteHandlerPath}: ${writeFileError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t});\n\n\t\treturn;\n\t})();\n\n\t// Generate the `auth-client.ts` file.\n\tawait (async () => {\n\t\tconst hasAuthClientConfigAlready = await (async () => {\n\t\t\tfor (const path_ of possibleClientConfigPaths) {\n\t\t\t\tconst fullPath = path.join(cwd, path_);\n\t\t\t\tconst { error } = await tryCatch(\n\t\t\t\t\tfs.access(fullPath, fs.constants.F_OK),\n\t\t\t\t);\n\t\t\t\tif (!error) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t})();\n\t\tif (hasAuthClientConfigAlready) return;\n\t\tawait nextStep(\"Generate Auth Client Configuration\");\n\n\t\tconsole.log(\n\t\t\tchalk.dim(\n\t\t\t\t\"Note: If you have a separated client-server project architecture, you may want to skip generating the auth client file here and create it in your client project instead.\",\n\t\t\t),\n\t\t);\n\n\t\tconst shouldGenerateAuthClient = await confirm({\n\t\t\tmessage: `Would you like to generate the auth client configuration file?`,\n\t\t\tinitial: true,\n\t\t});\n\t\tif (isCancel(shouldGenerateAuthClient)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (!shouldGenerateAuthClient) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst authClientCode = await generateAuthClientConfigCode({\n\t\t\tplugins,\n\t\t\tdatabase,\n\t\t\tframework,\n\t\t\tbaseURL: \"http://localhost:3000\",\n\t\t\toptions,\n\t\t\tinstallDependency: (d, type) => {\n\t\t\t\tconst dependencies = Array.isArray(d) ? d : [d];\n\t\t\t\tfor (const dep of dependencies) {\n\t\t\t\t\tdepsToInstall.set(dep, {\n\t\t\t\t\t\t...(depsToInstall.get(dep) || {}),\n\t\t\t\t\t\t[type || \"prod\"]: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tconst { data: allFiles, error } = await tryCatch(fs.readdir(cwd, \"utf-8\"));\n\t\tif (error) {\n\t\t\tlog.error(`Failed to read directory: ${error.message}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\t// Determine default auth-client config path based on project structure\n\t\t// Priority: src/lib/ if src/ exists, otherwise lib/\n\t\tconst hasSrc = allFiles.some((node) => node === \"src\");\n\n\t\tlet defaultAuthClientPath: string;\n\t\tif (hasSrc) {\n\t\t\tdefaultAuthClientPath = path.join(cwd, \"src\", \"lib\", \"auth-client.ts\");\n\t\t} else {\n\t\t\tdefaultAuthClientPath = path.join(cwd, \"lib\", \"auth-client.ts\");\n\t\t}\n\n\t\t// Convert absolute path to relative path for display\n\t\tconst relativeDefaultClientPath = path.relative(cwd, defaultAuthClientPath);\n\n\t\tconst { filePath } = await prompts({\n\t\t\ttype: \"text\",\n\t\t\tname: \"filePath\",\n\t\t\tmessage: `Enter the path to the auth-client.ts file:`,\n\t\t\tinitial: relativeDefaultClientPath,\n\t\t});\n\t\tif (isCancel(filePath)) {\n\t\t\tcancel(\"✋ Operation cancelled.\");\n\t\t\tprocess.exit(0);\n\t\t}\n\n\t\t// Convert relative path back to absolute path\n\t\tconst cleanPath = filePath.startsWith(\"/\") ? filePath.slice(1) : filePath;\n\t\tconst absoluteClientFilePath = path.isAbsolute(cleanPath)\n\t\t\t? cleanPath\n\t\t\t: path.join(cwd, cleanPath);\n\n\t\tfilesToWrite.push(async () => {\n\t\t\tconst { error: mkdirError } = await tryCatch(\n\t\t\t\tfs.mkdir(path.dirname(absoluteClientFilePath), { recursive: true }),\n\t\t\t);\n\t\t\tif (mkdirError) {\n\t\t\t\tconst error = `Failed to create auth client directory at ${path.dirname(absoluteClientFilePath)}: ${mkdirError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tconst { error: writeFileError } = await tryCatch(\n\t\t\t\tfs.writeFile(absoluteClientFilePath, authClientCode, \"utf-8\"),\n\t\t\t);\n\t\t\tif (writeFileError) {\n\t\t\t\tconst error = `Failed to write auth client file at ${absoluteClientFilePath}: ${writeFileError.message}`;\n\t\t\t\tlog.error(error);\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t});\n\t})();\n\n\t// generate and update files\n\tawait (async () => {\n\t\tif (filesToWrite.length === 0) return;\n\t\tawait nextStep(\"Generate Files\");\n\n\t\tconst s = yoctoSpinner({\n\t\t\ttext: \"Generating files...\",\n\t\t\tcolor: \"white\",\n\t\t});\n\t\ts.start();\n\n\t\tfor (const exec of filesToWrite) {\n\t\t\tawait exec();\n\t\t}\n\n\t\ts.success(\"Files generated successfully!\");\n\t})();\n\n\t// Install dependencies\n\tawait (async () => {\n\t\tif (depsToInstall.size === 0) return;\n\t\tawait nextStep(\"Install Dependencies\");\n\n\t\tconst s = yoctoSpinner({\n\t\t\ttext: \"Installing dependencies...\",\n\t\t\tcolor: \"white\",\n\t\t});\n\t\ts.start();\n\n\t\tconst deps = {\n\t\t\tprod: new Set<string>(),\n\t\t\tdev: new Set<string>(),\n\t\t};\n\t\tfor (const [dep, cfg] of depsToInstall) {\n\t\t\tif (cfg.prod) {\n\t\t\t\tdeps.prod.add(dep);\n\t\t\t}\n\t\t\tif (cfg.dev) {\n\t\t\t\tdeps.dev.add(dep);\n\t\t\t}\n\t\t}\n\n\t\tfor (const [type, dependencies] of Object.entries(deps)) {\n\t\t\tawait installDependencies({\n\t\t\t\tcwd,\n\t\t\t\tdependencies: [...dependencies],\n\t\t\t\tpackageManager: pm,\n\t\t\t\ttype: type as keyof typeof deps,\n\t\t\t});\n\t\t}\n\n\t\ts.success(\"Dependencies installed successfully!\");\n\t})();\n\n\tfor (const step of additionalSteps) {\n\t\tawait step();\n\t}\n\n\tconst connectResponse = await prompts({\n\t\ttype: \"confirm\",\n\t\tname: \"connect\",\n\t\tmessage:\n\t\t\t\"Would you like to connect your app to Better Auth infrastructure?\",\n\t\tinitial: true,\n\t});\n\t// If the user cancels the prompt, `connect` will be undefined.\n\t// Treat this as a cancellation of the remaining init flow.\n\tif (connectResponse.connect === undefined) {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\"\\n✖ \") +\n\t\t\t\t\"Setup cancelled before connecting to Better Auth infrastructure.\\n\",\n\t\t);\n\t\treturn;\n\t}\n\t// If the user cancels the prompt, `connect` will be undefined.\n\t// Treat this as a cancellation of the remaining init flow.\n\tif (connectResponse.connect === undefined) {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\"\\n✖ \") +\n\t\t\t\t\"Setup cancelled before connecting to Better Auth infrastructure.\\n\",\n\t\t);\n\t\treturn;\n\t}\n\tif (connectResponse.connect) {\n\t\tawait open(\"https://dash.better-auth.com/onboarding\");\n\t\tconsole.log(\n\t\t\tchalk.cyan(\"\\n→ \") +\n\t\t\t\t\"Opening Better Auth onboarding in your browser...\\n\",\n\t\t);\n\t}\n\n\tconsole.log(\n\t\tchalk.green(`\\n✔ `) + chalk.bold(\"Success! \") + \"Project setup complete.\\n\",\n\t);\n\n\tconst logs: string[] = [];\n\n\tlet nextStepNum = 1;\n\n\tif (databaseChoice === \"yes\" && database) {\n\t\tlogs.push(\n\t\t\t` ${nextStepNum}. Set up your database with necessary environment variables`,\n\t\t);\n\t\tnextStepNum++;\n\n\t\t// Determine migration command based on database type\n\t\tconst dbString = String(database);\n\t\tconst isDrizzle = dbString.startsWith(\"drizzle-\");\n\t\tconst isPrisma = dbString.startsWith(\"prisma-\");\n\t\tconst isKysely = isKyselyDialect(dbString);\n\n\t\t// Only show migration tip for Drizzle, Prisma, or Kysely\n\t\tif ((isDrizzle || isPrisma || isKysely) && !shouldRunMigration) {\n\t\t\tlet command: string;\n\t\t\tif (isDrizzle) {\n\t\t\t\tcommand = \"npx drizzle-kit push\";\n\t\t\t} else if (isPrisma) {\n\t\t\t\tcommand = \"npx prisma migrate dev\";\n\t\t\t} else {\n\t\t\t\tcommand = \"npx auth migrate\";\n\t\t\t}\n\t\t\tlogs.push(` ${nextStepNum}. Run ${chalk.cyan(command)} to apply schema`);\n\t\t\tnextStepNum++;\n\t\t}\n\t}\n\n\t// Show mount handler instructions if framework wasn't detected\n\tif (!frameworkWasDetected) {\n\t\tlogs.push(` ${nextStepNum}. Mount the auth handler`);\n\t\tlogs.push(\n\t\t\t` Use ${chalk.cyan(\"auth.handler\")} with a Web API compatible request object\\n` +\n\t\t\t\t` Default route: ${chalk.cyan('\"/api/auth\"')} (configurable via ${chalk.cyan(\"basePath\")})`,\n\t\t);\n\t\tnextStepNum++;\n\t}\n\n\tif (selectedSocialProviders.length > 0) {\n\t\tconst providerList = selectedSocialProviders\n\t\t\t.map((provider) => {\n\t\t\t\tconst config =\n\t\t\t\t\tSOCIAL_PROVIDER_CONFIGS[\n\t\t\t\t\t\tprovider as keyof typeof SOCIAL_PROVIDER_CONFIGS\n\t\t\t\t\t];\n\t\t\t\tif (!config) {\n\t\t\t\t\tconst providerUpper = provider.toUpperCase();\n\t\t\t\t\treturn `\\n - ${chalk.cyan(`${providerUpper}_CLIENT_ID`)} and ${chalk.cyan(`${providerUpper}_CLIENT_SECRET`)}`;\n\t\t\t\t}\n\t\t\t\tconst envVars = config.options\n\t\t\t\t\t.map((opt) => chalk.cyan(opt.envVar))\n\t\t\t\t\t.join(\" and \");\n\t\t\t\treturn `\\n - ${envVars}`;\n\t\t\t})\n\t\t\t.join(\"\");\n\t\tlogs.push(\n\t\t\t` ${nextStepNum}. Add social provider credentials to .env:${providerList}`,\n\t\t);\n\t\tnextStepNum++;\n\t}\n\n\tif (logs.length > 0) {\n\t\tconsole.log(chalk.bold(\"Next steps:\"));\n\t\tconsole.log(logs.join(\"\\n\"));\n\t}\n}\nconst initBuilder = new Command(\"init\")\n\t.option(\"-c, --cwd <cwd>\", \"The working directory.\", process.cwd())\n\t.option(\n\t\t\"--config <config>\",\n\t\t\"The path to the auth configuration file. defaults to the first `auth.ts` file found.\",\n\t)\n\t.option(\n\t\t\"--package-manager <package-manager>\",\n\t\t\"The package manager to use. defaults to the package manager found in the current working directory.\",\n\t);\n/**\n * Track used flags to ensure uniqueness\n */\nconst usedFlags = new Set<string>();\n\n/**\n * Recursively process arguments and nested objects to add CLI options\n * Each flag is unique and not compound (no parent prefix)\n */\nconst processArguments = (\n\targs: GetArgumentsOptions[],\n\tpluginDisplayName: string,\n) => {\n\tif (!args) return;\n\n\tfor (const argument of args) {\n\t\t// Skip if it's a nested object container (we'll process its children instead)\n\t\tif (argument.isNestedObject && Array.isArray(argument.isNestedObject)) {\n\t\t\t// Recursively process nested arguments (without prefix)\n\t\t\tprocessArguments(argument.isNestedObject, pluginDisplayName);\n\t\t} else {\n\t\t\t// Process regular argument with its original flag (no prefix)\n\t\t\tconst flag = argument.flag;\n\n\t\t\t// Ensure flag uniqueness\n\t\t\tif (usedFlags.has(flag)) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Warning: Flag \"${flag}\" is already used. Skipping duplicate.`,\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tusedFlags.add(flag);\n\n\t\t\tinitBuilder.option(\n\t\t\t\t`--${flag} <${flag}>`,\n\t\t\t\t`[${pluginDisplayName}] ${argument.description}`,\n\t\t\t);\n\t\t\tpluginArgumentOptionsSchema[getFlagVariable(flag)] = z.coerce\n\t\t\t\t.string()\n\t\t\t\t.optional();\n\t\t}\n\t}\n};\n\nconst pluginArgumentOptionsSchema: Record<string, z.ZodType<any>> = {};\n\nfor (const plugin of Object.values(\n\ttempPluginsConfig as never as PluginsConfig,\n)) {\n\tif (plugin.auth.arguments) {\n\t\tprocessArguments(plugin.auth.arguments, plugin.displayName);\n\t}\n\n\tif (plugin.authClient && plugin.authClient.arguments) {\n\t\tprocessArguments(plugin.authClient.arguments, plugin.displayName);\n\t}\n}\n\nexport const init = initBuilder.action(initAction);\n\nexport const initActionOptionsSchema = z.object({\n\tcwd: z.string().transform((val) => path.resolve(val)),\n\tconfig: z.string().optional(),\n\tpackageManager: z.enum(PACKAGE_MANAGER).optional(),\n\t...pluginArgumentOptionsSchema,\n});\n","import { log } from \"@clack/prompts\";\nimport { Command } from \"commander\";\nimport { spawnCommand } from \"../utils/helper\";\n\nasync function loginAction() {\n\ttry {\n\t\tawait spawnCommand(\"npx @better-auth/cli@latest login\");\n\t} catch (error: any) {\n\t\tlog.error(error.message || \"An unknown error occurred\");\n\t\tprocess.exit(1);\n\t}\n\n\tprocess.exit(0);\n}\n\nexport const login = new Command(\"login\")\n\t.description(\"Login to Better Auth Infrastructure\")\n\t.action(loginAction);\n\nasync function logoutAction() {\n\ttry {\n\t\tawait spawnCommand(\"npx @better-auth/cli@latest logout\");\n\t} catch (error: any) {\n\t\tlog.error(error.message || \"An unknown error occurred\");\n\t\tprocess.exit(1);\n\t}\n\n\tprocess.exit(0);\n}\n\nexport const logout = new Command(\"logout\")\n\t.description(\"Logout from Better Auth Infrastructure\")\n\t.action(logoutAction);\n","import { execSync } from \"node:child_process\";\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { base64 } from \"@better-auth/utils/base64\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\n\ninterface MCPOptions {\n\tcursor?: boolean;\n\tclaudeCode?: boolean;\n\topenCode?: boolean;\n\tmanual?: boolean;\n}\n\nconst REMOTE_MCP_URL = \"https://mcp.inkeep.com/better-auth/mcp\";\n\nasync function mcpAction(options: MCPOptions) {\n\tif (options.cursor) {\n\t\tawait handleCursorAction();\n\t} else if (options.claudeCode) {\n\t\thandleClaudeCodeAction();\n\t} else if (options.openCode) {\n\t\thandleOpenCodeAction();\n\t} else if (options.manual) {\n\t\thandleManualAction();\n\t} else {\n\t\tshowAllOptions();\n\t}\n}\n\nasync function handleCursorAction() {\n\tconsole.log(chalk.bold.blue(\"🚀 Adding Better Auth MCP to Cursor...\"));\n\n\tconst platform = os.platform();\n\tlet openCommand: string;\n\n\tswitch (platform) {\n\t\tcase \"darwin\":\n\t\t\topenCommand = \"open\";\n\t\t\tbreak;\n\t\tcase \"win32\":\n\t\t\topenCommand = \"start\";\n\t\t\tbreak;\n\t\tcase \"linux\":\n\t\t\topenCommand = \"xdg-open\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error(`Unsupported platform: ${platform}`);\n\t}\n\n\tconst remoteConfig = { url: REMOTE_MCP_URL };\n\tconst encodedRemote = base64.encode(\n\t\tnew TextEncoder().encode(JSON.stringify(remoteConfig)),\n\t);\n\tconst remoteDeeplink = `cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(\"better-auth\")}&config=${encodedRemote}`;\n\n\ttry {\n\t\tconst cmd =\n\t\t\tplatform === \"win32\"\n\t\t\t\t? `start \"\" \"${remoteDeeplink}\"`\n\t\t\t\t: `${openCommand} \"${remoteDeeplink}\"`;\n\t\texecSync(cmd, { stdio: \"inherit\" });\n\t\tconsole.log(chalk.green(\"\\n✓ Better Auth MCP server installed!\"));\n\t} catch {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\n\t\t\t\t\"\\n⚠ Could not automatically open Cursor for MCP installation.\",\n\t\t\t),\n\t\t);\n\t}\n\n\tconsole.log(chalk.bold.white(\"\\n✨ Next Steps:\"));\n\tconsole.log(\n\t\tchalk.gray(\"• The MCP server will be added to your Cursor configuration\"),\n\t);\n\tconsole.log(\n\t\tchalk.gray(\"• You can now use Better Auth features directly in Cursor\"),\n\t);\n\tconsole.log(\n\t\tchalk.gray(\n\t\t\t'• Try: \"Set up Better Auth with Google login\" or \"Help me debug my auth\"',\n\t\t),\n\t);\n}\n\nfunction handleClaudeCodeAction() {\n\tconsole.log(chalk.bold.blue(\"🤖 Adding Better Auth MCP to Claude Code...\"));\n\n\tconst command = `claude mcp add --transport http better-auth ${REMOTE_MCP_URL}`;\n\n\ttry {\n\t\texecSync(command, { stdio: \"inherit\" });\n\t\tconsole.log(chalk.green(\"\\n✓ Claude Code MCP configured!\"));\n\t} catch {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\n\t\t\t\t\"\\n⚠ Could not automatically add to Claude Code. Please run this command manually:\",\n\t\t\t),\n\t\t);\n\t\tconsole.log(chalk.cyan(command));\n\t}\n\n\tconsole.log(chalk.bold.white(\"\\n✨ Next Steps:\"));\n\tconsole.log(\n\t\tchalk.gray(\n\t\t\t\"• The MCP server will be added to your Claude Code configuration\",\n\t\t),\n\t);\n\tconsole.log(\n\t\tchalk.gray(\n\t\t\t\"• You can now use Better Auth features directly in Claude Code\",\n\t\t),\n\t);\n}\n\nfunction handleOpenCodeAction() {\n\tconsole.log(chalk.bold.blue(\"🔧 Adding Better Auth MCP to Open Code...\"));\n\n\tconst openCodeConfig = {\n\t\t$schema: \"https://opencode.ai/config.json\",\n\t\tmcp: {\n\t\t\t\"better-auth\": {\n\t\t\t\ttype: \"remote\",\n\t\t\t\turl: REMOTE_MCP_URL,\n\t\t\t\tenabled: true,\n\t\t\t},\n\t\t},\n\t};\n\n\tconst configPath = path.join(process.cwd(), \"opencode.json\");\n\n\ttry {\n\t\tlet existingConfig: {\n\t\t\tmcp?: Record<string, unknown>;\n\t\t\t[key: string]: unknown;\n\t\t} = {};\n\t\tif (fs.existsSync(configPath)) {\n\t\t\tconst existingContent = fs.readFileSync(configPath, \"utf8\");\n\t\t\texistingConfig = JSON.parse(existingContent);\n\t\t}\n\n\t\tconst mergedConfig = {\n\t\t\t...existingConfig,\n\t\t\t...openCodeConfig,\n\t\t\tmcp: {\n\t\t\t\t...existingConfig.mcp,\n\t\t\t\t...openCodeConfig.mcp,\n\t\t\t},\n\t\t};\n\n\t\tfs.writeFileSync(configPath, JSON.stringify(mergedConfig, null, 2));\n\t\tconsole.log(\n\t\t\tchalk.green(`\\n✓ Open Code configuration written to ${configPath}`),\n\t\t);\n\t\tconsole.log(chalk.green(\"✓ Better Auth MCP server added successfully!\"));\n\t} catch {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\n\t\t\t\t\"\\n⚠ Could not automatically write opencode.json. Please add this configuration manually:\",\n\t\t\t),\n\t\t);\n\t\tconsole.log(chalk.cyan(JSON.stringify(openCodeConfig, null, 2)));\n\t}\n\n\tconsole.log(chalk.bold.white(\"\\n✨ Next Steps:\"));\n\tconsole.log(chalk.gray(\"• Restart Open Code to load the new MCP server\"));\n\tconsole.log(\n\t\tchalk.gray(\"• You can now use Better Auth features directly in Open Code\"),\n\t);\n}\n\nfunction handleManualAction() {\n\tconsole.log(chalk.bold.blue(\"📝 Better Auth MCP Configuration...\"));\n\n\tconst manualConfig = {\n\t\t\"better-auth\": {\n\t\t\turl: REMOTE_MCP_URL,\n\t\t},\n\t};\n\n\tconst configPath = path.join(process.cwd(), \"mcp.json\");\n\n\ttry {\n\t\tlet existingConfig = {};\n\t\tif (fs.existsSync(configPath)) {\n\t\t\tconst existingContent = fs.readFileSync(configPath, \"utf8\");\n\t\t\texistingConfig = JSON.parse(existingContent);\n\t\t}\n\n\t\tconst mergedConfig = {\n\t\t\t...existingConfig,\n\t\t\t...manualConfig,\n\t\t};\n\n\t\tfs.writeFileSync(configPath, JSON.stringify(mergedConfig, null, 2));\n\t\tconsole.log(chalk.green(`\\n✓ MCP configuration written to ${configPath}`));\n\t\tconsole.log(chalk.green(\"✓ Better Auth MCP server added successfully!\"));\n\t} catch {\n\t\tconsole.log(\n\t\t\tchalk.yellow(\n\t\t\t\t\"\\n⚠ Could not automatically write mcp.json. Please add this configuration manually:\",\n\t\t\t),\n\t\t);\n\t\tconsole.log(chalk.cyan(JSON.stringify(manualConfig, null, 2)));\n\t}\n\n\tconsole.log(chalk.bold.white(\"\\n✨ Next Steps:\"));\n\tconsole.log(chalk.gray(\"• Restart your MCP client to load the new server\"));\n\tconsole.log(\n\t\tchalk.gray(\n\t\t\t\"• You can now use Better Auth features directly in your MCP client\",\n\t\t),\n\t);\n}\n\nfunction showAllOptions() {\n\tconsole.log(chalk.bold.blue(\"🔌 Better Auth MCP Server\"));\n\tconsole.log(chalk.gray(\"Choose your MCP client to get started:\"));\n\tconsole.log();\n\n\tconsole.log(chalk.bold.white(\"MCP Clients:\"));\n\tconsole.log(chalk.cyan(\" --cursor \") + chalk.gray(\"Add to Cursor\"));\n\tconsole.log(\n\t\tchalk.cyan(\" --claude-code \") + chalk.gray(\"Add to Claude Code\"),\n\t);\n\tconsole.log(chalk.cyan(\" --open-code \") + chalk.gray(\"Add to Open Code\"));\n\tconsole.log(\n\t\tchalk.cyan(\" --manual \") + chalk.gray(\"Manual configuration\"),\n\t);\n\tconsole.log();\n\n\tconsole.log(chalk.bold.white(\"Server:\"));\n\tconsole.log(\n\t\tchalk.gray(\" • \") +\n\t\t\tchalk.white(\"better-auth\") +\n\t\t\tchalk.gray(\" - Search documentation, code examples, setup assistance\"),\n\t);\n\tconsole.log();\n}\n\nexport const mcp = new Command(\"mcp\")\n\t.description(\"Add Better Auth MCP server to MCP Clients\")\n\t.option(\"--cursor\", \"Automatically open Cursor with the MCP configuration\")\n\t.option(\"--claude-code\", \"Show Claude Code MCP configuration command\")\n\t.option(\"--open-code\", \"Show Open Code MCP configuration\")\n\t.option(\"--manual\", \"Show manual MCP configuration for mcp.json\")\n\t.action(mcpAction);\n","import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport {\n\tcreateTelemetry,\n\tgetTelemetryAuthConfig,\n} from \"@better-auth/telemetry\";\nimport { getAdapter } from \"better-auth/db/adapter\";\nimport { getMigrations } from \"better-auth/db/migration\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport prompts from \"prompts\";\nimport yoctoSpinner from \"yocto-spinner\";\nimport * as z from \"zod/v4\";\nimport { getConfig } from \"../utils/get-config\";\n\n/** @internal */\nexport async function migrateAction(opts: any) {\n\tconst options = z\n\t\t.object({\n\t\t\tcwd: z.string(),\n\t\t\tconfig: z.string().optional(),\n\t\t\ty: z.boolean().optional(),\n\t\t\tyes: z.boolean().optional(),\n\t\t})\n\t\t.parse(opts);\n\n\tconst cwd = path.resolve(options.cwd);\n\tif (!existsSync(cwd)) {\n\t\tconsole.error(`The directory \"${cwd}\" does not exist.`);\n\t\tprocess.exit(1);\n\t}\n\n\tconst config = await getConfig({\n\t\tcwd,\n\t\tconfigPath: options.config,\n\t});\n\tif (!config) {\n\t\tconsole.error(\n\t\t\t\"No configuration file found. Add a `auth.ts` file to your project or pass the path to the configuration file using the `--config` flag.\",\n\t\t);\n\t\treturn;\n\t}\n\n\tconst db = await getAdapter(config);\n\n\tif (!db) {\n\t\tconsole.error(\n\t\t\t\"Invalid database configuration. Make sure you're not using adapters. Migrate command only works with built-in Kysely adapter.\",\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tif (db.id !== \"kysely\") {\n\t\tif (db.id === \"prisma\") {\n\t\t\tconsole.error(\n\t\t\t\t\"The migrate command only works with the built-in Kysely adapter. For Prisma, run `npx auth generate` to create the schema, then use Prisma's migrate or push to apply it.\",\n\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\t\tawait telemetry.publish({\n\t\t\t\t\ttype: \"cli_migrate\",\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\toutcome: \"unsupported_adapter\",\n\t\t\t\t\t\tadapter: \"prisma\",\n\t\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tif (db.id === \"drizzle\") {\n\t\t\tconsole.error(\n\t\t\t\t\"The migrate command only works with the built-in Kysely adapter. For Drizzle, run `npx auth generate` to create the schema, then use Drizzle's migrate or push to apply it.\",\n\t\t\t);\n\t\t\ttry {\n\t\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\t\tawait telemetry.publish({\n\t\t\t\t\ttype: \"cli_migrate\",\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\toutcome: \"unsupported_adapter\",\n\t\t\t\t\t\tadapter: \"drizzle\",\n\t\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch {}\n\t\t\tprocess.exit(0);\n\t\t}\n\t\tconsole.error(\"Migrate command isn't supported for this adapter.\");\n\t\ttry {\n\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\tawait telemetry.publish({\n\t\t\t\ttype: \"cli_migrate\",\n\t\t\t\tpayload: {\n\t\t\t\t\toutcome: \"unsupported_adapter\",\n\t\t\t\t\tadapter: db.id,\n\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {}\n\t\tprocess.exit(1);\n\t}\n\n\tconst spinner = yoctoSpinner({ text: \"preparing migration...\" }).start();\n\n\tconst { toBeAdded, toBeCreated, runMigrations } = await getMigrations(config);\n\n\tif (!toBeAdded.length && !toBeCreated.length) {\n\t\tspinner.stop();\n\t\tconsole.log(\"🚀 No migrations needed.\");\n\t\ttry {\n\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\tawait telemetry.publish({\n\t\t\t\ttype: \"cli_migrate\",\n\t\t\t\tpayload: {\n\t\t\t\t\toutcome: \"no_changes\",\n\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {}\n\t\tprocess.exit(0);\n\t}\n\n\tspinner.stop();\n\tconsole.log(`🔑 The migration will affect the following:`);\n\n\tfor (const table of [...toBeCreated, ...toBeAdded]) {\n\t\tconsole.log(\n\t\t\t\"->\",\n\t\t\tchalk.magenta(Object.keys(table.fields).join(\", \")),\n\t\t\tchalk.white(\"fields on\"),\n\t\t\tchalk.yellow(`${table.table}`),\n\t\t\tchalk.white(\"table.\"),\n\t\t);\n\t}\n\n\tif (options.y) {\n\t\tconsole.warn(\"WARNING: --y is deprecated. Consider -y or --yes\");\n\t\toptions.yes = true;\n\t}\n\n\tlet migrate = options.yes;\n\tif (!migrate) {\n\t\tconst response = await prompts({\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"migrate\",\n\t\t\tmessage: \"Are you sure you want to run these migrations?\",\n\t\t\tinitial: false,\n\t\t});\n\t\tmigrate = response.migrate;\n\t}\n\n\tif (!migrate) {\n\t\tconsole.log(\"Migration cancelled.\");\n\t\ttry {\n\t\t\tconst telemetry = await createTelemetry(config);\n\t\t\tawait telemetry.publish({\n\t\t\t\ttype: \"cli_migrate\",\n\t\t\t\tpayload: {\n\t\t\t\t\toutcome: \"aborted\",\n\t\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t\t},\n\t\t\t});\n\t\t} catch {}\n\t\tprocess.exit(0);\n\t}\n\n\tspinner?.start(\"migrating...\");\n\tawait runMigrations();\n\tspinner.stop();\n\tconsole.log(\"🚀 migration was completed successfully!\");\n\ttry {\n\t\tconst telemetry = await createTelemetry(config);\n\t\tawait telemetry.publish({\n\t\t\ttype: \"cli_migrate\",\n\t\t\tpayload: {\n\t\t\t\toutcome: \"migrated\",\n\t\t\t\tconfig: await getTelemetryAuthConfig(config),\n\t\t\t},\n\t\t});\n\t} catch {}\n\tprocess.exit(0);\n}\n\nexport const migrate = new Command(\"migrate\")\n\t.option(\n\t\t\"-c, --cwd <cwd>\",\n\t\t\"the working directory. defaults to the current directory.\",\n\t\tprocess.cwd(),\n\t)\n\t.option(\n\t\t\"--config <config>\",\n\t\t\"the path to the configuration file. defaults to the first configuration file found.\",\n\t)\n\t.option(\n\t\t\"-y, --yes\",\n\t\t\"automatically accept and run migrations without prompting\",\n\t\tfalse,\n\t)\n\t.option(\"--y\", \"(deprecated) same as --yes\", false)\n\t.action(migrateAction);\n","import Crypto from \"node:crypto\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\n\nexport const generateSecret = new Command(\"secret\").action(() => {\n\tconst secret = generateSecretHash();\n\tconsole.log(`\\nAdd the following to your .env file: \n${\n\tchalk.gray(\"# Auth Secret\") + chalk.green(`\\nBETTER_AUTH_SECRET=${secret}`)\n}`);\n});\n\nexport const generateSecretHash = () => {\n\treturn Crypto.randomBytes(32).toString(\"hex\");\n};\n","export async function fetchLatestVersion(\n\tpackageName: string,\n): Promise<string | null> {\n\tconst encoded = packageName.startsWith(\"@\")\n\t\t? `@${encodeURIComponent(packageName.slice(1))}`\n\t\t: encodeURIComponent(packageName);\n\ttry {\n\t\tconst response = await fetch(\n\t\t\t`https://registry.npmjs.org/${encoded}/latest`,\n\t\t);\n\t\tif (!response.ok) {\n\t\t\treturn null;\n\t\t}\n\t\tconst data = (await response.json()) as { version?: string };\n\t\treturn data.version ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n","import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport prompts from \"prompts\";\nimport * as semver from \"semver\";\nimport yoctoSpinner from \"yocto-spinner\";\nimport * as z from \"zod/v4\";\nimport { detectPackageManager } from \"../utils/check-package-managers\";\nimport { fetchLatestVersion } from \"../utils/fetch-latest-version\";\nimport { getPackageInfo } from \"../utils/get-package-info\";\nimport { installDependencies } from \"../utils/install-dependencies\";\n\nfunction isBetterAuthPackage(name: string): boolean {\n\treturn name === \"better-auth\" || name.startsWith(\"@better-auth/\");\n}\n\ninterface UpgradeEntry {\n\tname: string;\n\tcurrent: string;\n\tlatest: string;\n\tdepType: \"prod\" | \"dev\";\n}\n\nexport async function upgradeAction(opts: unknown) {\n\tconst options = z\n\t\t.object({\n\t\t\tcwd: z.string(),\n\t\t\tyes: z.boolean().optional(),\n\t\t})\n\t\t.parse(opts);\n\n\tconst cwd = path.resolve(options.cwd);\n\tif (!existsSync(cwd)) {\n\t\tconsole.error(`The directory \"${cwd}\" does not exist.`);\n\t\tprocess.exit(1);\n\t}\n\n\tlet packageJson: Record<string, any>;\n\ttry {\n\t\tpackageJson = getPackageInfo(cwd);\n\t} catch {\n\t\tconsole.error(\n\t\t\t`Could not read package.json in \"${cwd}\". Make sure you are in a project directory.`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst deps = packageJson.dependencies ?? {};\n\tconst devDeps = packageJson.devDependencies ?? {};\n\n\tconst candidates: {\n\t\tname: string;\n\t\tcurrent: string;\n\t\tdepType: \"prod\" | \"dev\";\n\t}[] = [];\n\n\tfor (const [name, version] of Object.entries(deps) as [string, string][]) {\n\t\tif (isBetterAuthPackage(name) && !version.startsWith(\"workspace:\")) {\n\t\t\tcandidates.push({ name, current: version, depType: \"prod\" });\n\t\t}\n\t}\n\tfor (const [name, version] of Object.entries(devDeps) as [string, string][]) {\n\t\tif (isBetterAuthPackage(name) && !version.startsWith(\"workspace:\")) {\n\t\t\tcandidates.push({ name, current: version, depType: \"dev\" });\n\t\t}\n\t}\n\n\tif (candidates.length === 0) {\n\t\tconsole.log(\"No better-auth packages found in this project.\");\n\t\treturn;\n\t}\n\n\tconst spinner = yoctoSpinner({ text: \"checking for updates...\" }).start();\n\n\tconst results = await Promise.allSettled(\n\t\tcandidates.map(async (c) => {\n\t\t\tconst latest = await fetchLatestVersion(c.name);\n\t\t\treturn { ...c, latest };\n\t\t}),\n\t);\n\n\tconst upgrades: UpgradeEntry[] = [];\n\tfor (const result of results) {\n\t\tif (result.status !== \"fulfilled\" || !result.value.latest) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst { name, current, latest, depType } = result.value;\n\t\tconst coerced = semver.coerce(current);\n\t\tif (coerced && semver.lt(coerced, latest)) {\n\t\t\tupgrades.push({ name, current, latest, depType });\n\t\t}\n\t}\n\n\tspinner.stop();\n\n\tif (upgrades.length === 0) {\n\t\tconsole.log(\"All better-auth packages are up to date.\");\n\t\treturn;\n\t}\n\n\tconsole.log(`\\nThe following packages can be upgraded:\\n`);\n\tfor (const u of upgrades) {\n\t\tconsole.log(\n\t\t\t` ${chalk.cyan(u.name)} ${chalk.gray(u.current)} ${chalk.white(\"→\")} ${chalk.green(u.latest)}`,\n\t\t);\n\t}\n\tconsole.log();\n\n\tlet confirmed = options.yes;\n\tif (!confirmed) {\n\t\tconst response = await prompts({\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"confirmed\",\n\t\t\tmessage: \"Do you want to upgrade these packages?\",\n\t\t\tinitial: true,\n\t\t});\n\t\tconfirmed = response.confirmed;\n\t}\n\n\tif (!confirmed) {\n\t\tconsole.log(\"Upgrade cancelled.\");\n\t\treturn;\n\t}\n\n\tconst { packageManager } = await detectPackageManager(cwd, packageJson);\n\n\tconst prodUpgrades = upgrades\n\t\t.filter((u) => u.depType === \"prod\")\n\t\t.map((u) => `${u.name}@${u.latest}`);\n\tconst devUpgrades = upgrades\n\t\t.filter((u) => u.depType === \"dev\")\n\t\t.map((u) => `${u.name}@${u.latest}`);\n\n\tconst installSpinner = yoctoSpinner({\n\t\ttext: \"installing updates...\",\n\t}).start();\n\n\ttry {\n\t\tif (prodUpgrades.length > 0) {\n\t\t\tawait installDependencies({\n\t\t\t\tdependencies: prodUpgrades,\n\t\t\t\tpackageManager,\n\t\t\t\tcwd,\n\t\t\t\ttype: \"prod\",\n\t\t\t});\n\t\t}\n\t\tif (devUpgrades.length > 0) {\n\t\t\tawait installDependencies({\n\t\t\t\tdependencies: devUpgrades,\n\t\t\t\tpackageManager,\n\t\t\t\tcwd,\n\t\t\t\ttype: \"dev\",\n\t\t\t});\n\t\t}\n\t\tinstallSpinner.stop();\n\t\tconsole.log(chalk.green(\"Successfully upgraded better-auth packages.\"));\n\t} catch (error) {\n\t\tinstallSpinner.stop();\n\t\tconsole.error(\"Failed to install updates:\", error);\n\t\tprocess.exit(1);\n\t}\n}\n\nexport const upgrade = new Command(\"upgrade\")\n\t.description(\"Upgrade better-auth packages to their latest versions\")\n\t.option(\n\t\t\"-c, --cwd <cwd>\",\n\t\t\"the working directory. defaults to the current directory.\",\n\t\tprocess.cwd(),\n\t)\n\t.option(\n\t\t\"-y, --yes\",\n\t\t\"automatically accept and upgrade without prompting\",\n\t\tfalse,\n\t)\n\t.action(upgradeAction);\n","#!/usr/bin/env node\n\nimport { Command } from \"commander\";\nimport { generate } from \"./commands/generate\";\nimport { info } from \"./commands/info\";\nimport { init } from \"./commands/init\";\nimport { login, logout } from \"./commands/login\";\nimport { mcp } from \"./commands/mcp\";\nimport { migrate } from \"./commands/migrate\";\nimport { generateSecret } from \"./commands/secret\";\nimport { upgrade } from \"./commands/upgrade\";\nimport { getPackageInfo } from \"./utils/get-package-info\";\n\nimport \"dotenv/config\";\n\n// handle exit\nprocess.on(\"SIGINT\", () => process.exit(0));\nprocess.on(\"SIGTERM\", () => process.exit(0));\n\nexport let cliVersion = \"1.1.2\";\n\nasync function main() {\n\tconst program = new Command(\"better-auth\");\n\n\tlet packageInfo: Record<string, any> = {};\n\ttry {\n\t\tpackageInfo = await getPackageInfo();\n\t\tcliVersion = packageInfo.version || \"1.1.2\";\n\t} catch {\n\t\t// it doesn't matter if we can't read the package.json file, we'll just use an empty object\n\t}\n\tprogram\n\t\t.addCommand(init)\n\t\t.addCommand(migrate)\n\t\t.addCommand(generate)\n\t\t.addCommand(generateSecret)\n\t\t.addCommand(info)\n\t\t.addCommand(login)\n\t\t.addCommand(logout)\n\t\t.addCommand(mcp)\n\t\t.addCommand(upgrade)\n\t\t.version(cliVersion)\n\t\t.description(\"Better Auth CLI\")\n\t\t.action(() => program.help());\n\n\tprogram.parse();\n}\n\nmain().catch((error) => {\n\tconsole.error(\"Error running Better Auth CLI:\", error);\n\tprocess.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAS,mBAAmB,KAAa,WAAqB;AAC7D,KAAI,UACH,QAAO;AAGR,QAAO,IACL,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,qBAAqB,QAAQ,CACrC,aAAa;;AAGhB,MAAa,wBAAyC,OAAO,EAC5D,SACA,MACA,cACK;CACL,MAAM,SAAS,cAAc,QAAQ;CACrC,MAAM,WAAW,QAAQ;CACzB,MAAM,eACL,QAAQ,SAAS;AAElB,KAAI,CAAC,aACJ,OAAM,IAAI,MACT,+LACA;CAEF,MAAM,YAAY,WAAW,SAAS;CAEtC,IAAI,OAAe,eAAe;EACjC;EACA;EACA;EACA,CAAC;CAEF,MAAM,eAAe,iBAAiB;EACrC,QAAQ;EACR,WAAW,QAAQ,SAAS,eAAe;EAC3C,CAAC;CAEF,MAAM,eAAe,iBAAiB;EACrC,QAAQ;EACR,WAAW,QAAQ,SAAS,eAAe;EAC3C,CAAC;AAEF,MAAK,MAAM,YAAY,QAAQ;EAC9B,MAAM,QAAQ,OAAO;EACrB,MAAM,YAAY,aAAa,SAAS;EACxC,MAAM,SAAS,MAAM;EAErB,SAAS,QAAQ,MAAc,OAAyB;AAEvD,OAAI,CAAC,aACJ,OAAM,IAAI,MACT,+LACA;AAEF,UAAO,mBAAmB,MAAM,QAAQ,SAAS,UAAU;AAC3D,OAAI,MAAM,YAAY,UAAU,MAAM;IACrC,MAAM,cAAc,QAAQ,UAAU,UAAU,eAAe;IAC/D,MAAM,WAAW,QAAQ,UAAU,UAAU,eAAe;AAC5D,QAAI,YACH,KAAI,iBAAiB,KACpB,QAAO,YAAY,KAAK;aACd,iBAAiB,QAC3B,QAAO,QAAQ,KAAK;QAGpB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