import BaseDataBridgeCommand from './base.js'; /** * TEACHING NOTE: This is an oclif Command class * - oclif automatically finds commands in src/commands/ * - Each command extends Command base class * - Static properties define metadata (description, flags) * - run() method contains the actual logic */ export default class Init extends BaseDataBridgeCommand { static description: string; static hidden: boolean; static examples: string[]; static args: { projectName: import("@oclif/core/interfaces").Arg>; }; static flags: { 'skip-prompts': import("@oclif/core/interfaces").BooleanFlag; 'auto-generate': import("@oclif/core/interfaces").BooleanFlag; frameworks: import("@oclif/core/interfaces").OptionFlag; language: import("@oclif/core/interfaces").OptionFlag; 'db-url': import("@oclif/core/interfaces").OptionFlag; port: import("@oclif/core/interfaces").OptionFlag; 'package-manager': import("@oclif/core/interfaces").OptionFlag; verbose: import("@oclif/core/interfaces").BooleanFlag; }; /** * Main command logic - runs when user types "databridge init" */ run(): Promise; /** * Prompt for project name */ private promptProjectName; /** * Setup project directory - create folder or warn about current directory * @returns true if a new folder was created, false if using current directory */ private setupProjectDirectory; /** * TEACHING NOTE: Custom prompt utility for interactive CLI prompts * Built in-house to avoid ESM/CommonJS dependency issues * Shows questions and collects answers from the user */ private promptUser; /** * TEACHING NOTE: fs-extra is like fs (Node's file system) but with extra features * - ensureDir: Creates directory if it doesn't exist (no error if exists) * - writeJSON: Writes JavaScript object as formatted JSON file */ private createConfig; /** * Create package.json with required dependencies * This ensures the project has all needed packages with correct versions */ private createPackageJson; /** * TEACHING NOTE: This creates the initial Prisma schema file * Prisma is an ORM (Object-Relational Mapping) tool * schema.prisma defines your database structure */ private initPrismaSchema; /** * Copy databridge.types.ts helper file to project root */ private copyDatabridgeTypes; /** * TEACHING NOTE: Generates a random secret for JWT tokens * - crypto is Node's built-in cryptography module * - randomBytes(32) generates 32 random bytes * - toString('hex') converts to hexadecimal string */ private generateSecret; /** * Create tsconfig.json for the generated project * Extracted from postInstallSetup so it runs regardless of git availability */ private createTsConfig; /** * Create prisma.config.ts for Prisma 7 * This replaces the datasource url in schema.prisma */ private createPrismaConfig; /** * TEACHING NOTE: Auto-install dependencies * Runs package manager install automatically after project initialization * Soft-fails so the rest of init (next steps, git init) still completes */ private autoInstallDependencies; /** * Detect which package manager the user prefers * Priority: lockfile in cwd > npm_config_user_agent env > npm fallback */ private detectPackageManager; /** * Post-install setup: auto-introspect, auto-generate, git init * Provides the best DX by automating common next steps */ private postInstallSetup; /** * Check if database URL looks valid (not the default placeholder) */ private isDatabaseUrlValid; /** * Run Prisma introspection via databridge introspect command */ private runPrismaIntrospect; /** * Count how many models exist in Prisma schema */ private countPrismaModels; /** * Run databridge generate command with optional framework and language flags */ private runDataBridgeGenerate; /** * Prompt user to run the development server */ private promptToRunServe; /** * Print beautiful success message with context-aware next steps */ private printSuccessMessage; } //# sourceMappingURL=init.d.ts.map