@betterstart/cli 0.1.2 → 0.1.3

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.
@@ -30,6 +30,9 @@ function initPaths(startDir) {
30
30
  };
31
31
  return _paths;
32
32
  }
33
+ function setPaths(paths) {
34
+ _paths = paths;
35
+ }
33
36
  function getPaths() {
34
37
  if (!_paths) {
35
38
  return initPaths();
@@ -160,6 +163,7 @@ function singularizeLabel(label) {
160
163
 
161
164
  export {
162
165
  initPaths,
166
+ setPaths,
163
167
  getPaths,
164
168
  getProjectRoot,
165
169
  initImportResolver,
@@ -176,4 +180,4 @@ export {
176
180
  quotePropertyName,
177
181
  singularizeLabel
178
182
  };
179
- //# sourceMappingURL=chunk-G4KI4DVB.js.map
183
+ //# sourceMappingURL=chunk-EIH4RRIJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts"],"sourcesContent":["// Utility functions for the codemod system\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { ImportResolver } from './config/import-resolver'\nimport { MONOREPO_IMPORT_PATHS } from './config/presets'\nimport type { BetterstartConfig } from './config/types'\nimport type { MonorepoPaths } from './types'\n\n// Store monorepo paths globally (set during CLI initialization)\nlet _paths: MonorepoPaths | null = null\n\n/**\n * Initialize paths for the monorepo\n * Detects monorepo root and sets up all package paths\n */\nexport function initPaths(startDir?: string): MonorepoPaths {\n const cwd = startDir || process.cwd()\n\n // Find monorepo root by looking for turbo.json or pnpm-workspace.yaml\n let root = cwd\n while (root !== '/') {\n if (\n fs.existsSync(path.join(root, 'turbo.json')) ||\n fs.existsSync(path.join(root, 'pnpm-workspace.yaml'))\n ) {\n break\n }\n root = path.dirname(root)\n }\n\n if (root === '/') {\n throw new Error('Could not find monorepo root (no turbo.json or pnpm-workspace.yaml found)')\n }\n\n _paths = {\n root,\n app: path.join(root, 'apps/web'),\n database: path.join(root, 'packages/database'),\n lib: path.join(root, 'packages/lib'),\n hooks: path.join(root, 'packages/hooks'),\n schemas: path.join(root, 'packages/codegen/src/schemas'),\n data: path.join(root, 'packages/data')\n }\n\n return _paths\n}\n\n/**\n * Set pre-resolved paths (e.g., from config-based resolution)\n * This allows the CLI to seed paths from the config system\n * so that generators work in both monorepo and standalone projects.\n */\nexport function setPaths(paths: MonorepoPaths): void {\n _paths = paths\n}\n\n/**\n * Get monorepo paths (must call initPaths or setPaths first)\n */\nexport function getPaths(): MonorepoPaths {\n if (!_paths) {\n return initPaths()\n }\n return _paths\n}\n\n/**\n * Get the monorepo root directory\n * @deprecated Use getPaths().root instead\n */\nexport function getProjectRoot(): string {\n return getPaths().app\n}\n\n// Store import resolver globally (set during CLI initialization)\nlet _importResolver: ImportResolver | null = null\n\n/**\n * Initialize the import resolver from config\n */\nexport function initImportResolver(config: BetterstartConfig): ImportResolver {\n _importResolver = new ImportResolver(config.imports)\n return _importResolver\n}\n\n/**\n * Get the import resolver (must call initImportResolver first, or falls back to monorepo defaults)\n */\nexport function getImportResolver(): ImportResolver {\n if (!_importResolver) {\n _importResolver = new ImportResolver(MONOREPO_IMPORT_PATHS)\n }\n return _importResolver\n}\n\n/**\n * Convert a string to PascalCase\n */\nexport function toPascalCase(str: string): string {\n return str\n .split(/[-_\\s]+/)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join('')\n}\n\n/**\n * Convert a string to camelCase\n */\nexport function toCamelCase(str: string): string {\n const pascal = toPascalCase(str)\n return pascal.charAt(0).toLowerCase() + pascal.slice(1)\n}\n\n/**\n * Convert a string to kebab-case\n */\nexport function toKebabCase(str: string): string {\n return str\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/[\\s_]+/g, '-')\n .toLowerCase()\n}\n\n/**\n * Convert a string to snake_case\n */\nexport function toSnakeCase(str: string): string {\n return str\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s-]+/g, '_')\n .toLowerCase()\n}\n\n/**\n * Convert a string to SCREAMING_SNAKE_CASE\n */\nexport function toScreamingSnakeCase(str: string): string {\n return str\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s-]+/g, '_')\n .toUpperCase()\n}\n\n/**\n * Ensure a directory exists, create it if it doesn't\n */\nexport function ensureDir(dirPath: string): void {\n if (!fs.existsSync(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true })\n }\n}\n\n/**\n * Format a timestamp for migration files\n */\nexport function getMigrationTimestamp(): string {\n const now = new Date()\n const year = now.getFullYear()\n const month = String(now.getMonth() + 1).padStart(2, '0')\n const day = String(now.getDate()).padStart(2, '0')\n const hours = String(now.getHours()).padStart(2, '0')\n const minutes = String(now.getMinutes()).padStart(2, '0')\n const seconds = String(now.getSeconds()).padStart(2, '0')\n return `${year}${month}${day}${hours}${minutes}${seconds}`\n}\n\n/**\n * Check if a word is already plural\n */\nfunction isPlural(str: string): boolean {\n const pluralPatterns = [\n /ies$/,\n /ves$/,\n /ses$/,\n /xes$/,\n /zes$/,\n /ches$/,\n /shes$/,\n /men$/,\n /people$/\n ]\n\n for (const pattern of pluralPatterns) {\n if (pattern.test(str)) {\n return true\n }\n }\n\n if (str.endsWith('s') && !str.endsWith('ss')) {\n return true\n }\n\n return false\n}\n\n/**\n * Pluralize a string\n */\nexport function pluralize(str: string): string {\n if (isPlural(str)) {\n return str\n }\n\n if (str.endsWith('y') && !['ay', 'ey', 'iy', 'oy', 'uy'].some((v) => str.endsWith(v))) {\n return `${str.slice(0, -1)}ies`\n }\n if (str.endsWith('s') || str.endsWith('x') || str.endsWith('ch') || str.endsWith('sh')) {\n return `${str}es`\n }\n if (str.endsWith('f')) {\n return `${str.slice(0, -1)}ves`\n }\n if (str.endsWith('fe')) {\n return `${str.slice(0, -2)}ves`\n }\n return `${str}s`\n}\n\n/**\n * Singularize a string\n */\nexport function singularize(str: string): string {\n if (!isPlural(str)) {\n return str\n }\n\n if (str.endsWith('ies')) {\n return `${str.slice(0, -3)}y`\n }\n if (str.endsWith('ves')) {\n return `${str.slice(0, -3)}f`\n }\n if (\n str.endsWith('sses') ||\n str.endsWith('xes') ||\n str.endsWith('ches') ||\n str.endsWith('shes') ||\n str.endsWith('zes')\n ) {\n return str.slice(0, -2)\n }\n if (str.endsWith('s') && !str.endsWith('ss')) {\n return str.slice(0, -1)\n }\n return str\n}\n\n/**\n * Quote a property name if it's not a valid JavaScript identifier.\n * Properties with hyphens, spaces, or starting with numbers need quotes.\n */\nexport function quotePropertyName(name: string): string {\n // Valid JS identifier: starts with letter/underscore/$, contains only letters/numbers/underscore/$\n const validIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/\n if (validIdentifier.test(name)) {\n return name\n }\n return `'${name}'`\n}\n\n/**\n * Singularize a label (e.g., \"Trusted Companies\" -> \"Trusted Company\")\n * Handles display labels with proper capitalization\n */\nexport function singularizeLabel(label: string): string {\n const words = label.split(' ')\n if (words.length === 0) {\n return label\n }\n\n // Singularize the last word\n const lastWord = words[words.length - 1]\n const lastWordLower = lastWord.toLowerCase()\n const singularLastWordLower = singularize(lastWordLower)\n\n // Preserve capitalization of the last word\n const capitalizedSingular =\n lastWord[0] === lastWord[0].toUpperCase()\n ? singularLastWordLower.charAt(0).toUpperCase() + singularLastWordLower.slice(1)\n : singularLastWordLower\n\n return [...words.slice(0, -1), capitalizedSingular].join(' ')\n}\n"],"mappings":";;;;;;AAEA,OAAO,QAAQ;AACf,OAAO,UAAU;AAOjB,IAAI,SAA+B;AAM5B,SAAS,UAAU,UAAkC;AAC1D,QAAM,MAAM,YAAY,QAAQ,IAAI;AAGpC,MAAI,OAAO;AACX,SAAO,SAAS,KAAK;AACnB,QACE,GAAG,WAAW,KAAK,KAAK,MAAM,YAAY,CAAC,KAC3C,GAAG,WAAW,KAAK,KAAK,MAAM,qBAAqB,CAAC,GACpD;AACA;AAAA,IACF;AACA,WAAO,KAAK,QAAQ,IAAI;AAAA,EAC1B;AAEA,MAAI,SAAS,KAAK;AAChB,UAAM,IAAI,MAAM,2EAA2E;AAAA,EAC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A,SAAO,IAAI,IAAI;AACjB;AAMO,SAAS,iBAAiB,OAAuB;AACtD,QAAM,QAAQ,MAAM,MAAM,GAAG;AAC7B,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO;AAAA,EACT;AAGA,QAAM,WAAW,MAAM,MAAM,SAAS,CAAC;AACvC,QAAM,gBAAgB,SAAS,YAAY;AAC3C,QAAM,wBAAwB,YAAY,aAAa;AAGvD,QAAM,sBACJ,SAAS,CAAC,MAAM,SAAS,CAAC,EAAE,YAAY,IACpC,sBAAsB,OAAO,CAAC,EAAE,YAAY,IAAI,sBAAsB,MAAM,CAAC,IAC7E;AAEN,SAAO,CAAC,GAAG,MAAM,MAAM,GAAG,EAAE,GAAG,mBAAmB,EAAE,KAAK,GAAG;AAC9D;","names":[]}
package/dist/cli.js CHANGED
@@ -5,9 +5,11 @@ import {
5
5
  resolveConfig
6
6
  } from "./chunk-QLVSHP7X.js";
7
7
  import {
8
+ initImportResolver,
9
+ setPaths,
8
10
  toKebabCase,
9
11
  toPascalCase
10
- } from "./chunk-G4KI4DVB.js";
12
+ } from "./chunk-EIH4RRIJ.js";
11
13
  import {
12
14
  detectPreset,
13
15
  getPresetNames,
@@ -68,6 +70,17 @@ Make sure the schema file exists at: ${schemaPath}`);
68
70
  }
69
71
  logger.success("Schema validated");
70
72
  logger.info("\n\u{1F4E6} Generating files...\n");
73
+ const monorepoPaths = {
74
+ root: resolvedConfig.paths.root,
75
+ app: resolvedConfig.paths.app,
76
+ database: resolvedConfig.paths.database,
77
+ lib: resolvedConfig.paths.lib,
78
+ hooks: resolvedConfig.paths.hooks,
79
+ schemas: resolvedConfig.paths.schemas,
80
+ data: path.join(resolvedConfig.paths.root, "packages/data")
81
+ };
82
+ setPaths(monorepoPaths);
83
+ initImportResolver(resolvedConfig);
71
84
  const { generate } = await import("./index.js");
72
85
  await generate(name, {
73
86
  skipMigration: options.skipMigration,
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli/index.ts","../src/cli/commands/generate.ts","../src/cli/commands/init.ts","../src/cli/commands/remove.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI entry point for @betterstart/cli\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { Command } from 'commander'\nimport { createConsoleLogger, setLogger } from '../core/logger'\nimport { generateCommand } from './commands/generate'\nimport { initCommand } from './commands/init'\nimport { removeCommand } from './commands/remove'\n\n// Read version from package.json\nfunction getVersion(): string {\n try {\n const __dirname = path.dirname(fileURLToPath(import.meta.url))\n // Try dist layout first (built), then source layout\n for (const rel of ['../../package.json', '../package.json']) {\n const pkgPath = path.resolve(__dirname, rel)\n if (fs.existsSync(pkgPath)) {\n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))\n return pkg.version ?? '0.0.0'\n }\n }\n } catch {\n // Fallback\n }\n return '0.0.0'\n}\n\n// Set up console logger\nsetLogger(createConsoleLogger())\n\n/**\n * Create the CLI program\n */\nfunction createProgram(): Command {\n const program = new Command()\n\n program\n .name('betterstart')\n .description('Generate admin CRUD interfaces for your Next.js project')\n .version(getVersion())\n\n // Add commands\n program.addCommand(initCommand())\n program.addCommand(generateCommand())\n program.addCommand(removeCommand())\n\n return program\n}\n\n/**\n * Run the CLI\n */\nexport async function run(args?: string[]): Promise<void> {\n const program = createProgram()\n\n try {\n await program.parseAsync(args || process.argv)\n } catch (error) {\n if (error instanceof Error) {\n console.error(`\\nError: ${error.message}`)\n } else {\n console.error('\\nAn unexpected error occurred')\n }\n process.exit(1)\n }\n}\n\n// Always run when this file is executed\nrun()\n","/**\n * CLI generate command\n * Generates code from a schema\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { Command } from 'commander'\nimport { findProjectRoot, loadConfig, resolveConfig } from '../../config'\nimport { SchemaValidationError } from '../../core/errors'\nimport { getLogger } from '../../core/logger'\nimport type { Schema } from '../../types'\n\n/**\n * Create the generate command\n */\nexport function generateCommand(): Command {\n const command = new Command('generate')\n .alias('g')\n .description('Generate code from a schema')\n .argument('<name>', 'Schema name to generate')\n .option('--skip-migration', 'Skip database migration')\n .option('-f, --force', 'Overwrite existing files')\n .option('--cwd <path>', 'Project root path')\n .option('--generators <generators>', 'Comma-separated list of generators to run')\n .action(async (name, options) => {\n const logger = getLogger()\n const cwd = options.cwd ? path.resolve(options.cwd) : process.cwd()\n\n logger.info('\\n🚀 Betterstart Generator\\n')\n\n try {\n // Find project root and load config\n const projectRoot = findProjectRoot(cwd)\n logger.info(`📁 Project root: ${projectRoot}`)\n\n const config = await loadConfig(projectRoot)\n const resolvedConfig = resolveConfig(config, projectRoot)\n logger.info(`📄 Loading schema: ${name}.json`)\n\n // Find schema file\n const schemaPath = path.join(resolvedConfig.paths.schemas, `${name}.json`)\n\n if (!fs.existsSync(schemaPath)) {\n logger.error(`Schema file not found: ${schemaPath}`)\n logger.info(`\\nMake sure the schema file exists at: ${schemaPath}`)\n logger.info('You can create a schema using:')\n logger.info(` echo '{}' > ${schemaPath}`)\n process.exit(1)\n }\n\n // Load and parse schema\n let schema: Schema\n try {\n const schemaContent = fs.readFileSync(schemaPath, 'utf-8')\n schema = JSON.parse(schemaContent)\n } catch (error) {\n logger.error(\n `Failed to parse schema: ${error instanceof Error ? error.message : String(error)}`\n )\n process.exit(1)\n }\n\n // Validate schema\n const validationErrors = validateSchema(schema)\n if (validationErrors.length > 0) {\n throw new SchemaValidationError('Schema validation failed', validationErrors, {\n schemaPath\n })\n }\n\n logger.success('Schema validated')\n logger.info('\\n📦 Generating files...\\n')\n\n // For now, we'll import the existing generate function\n // In the full refactoring, this would use the new generator system\n const { generate } = await import('../../index')\n\n await generate(name, {\n skipMigration: options.skipMigration,\n force: options.force\n })\n } catch (error) {\n if (error instanceof SchemaValidationError) {\n logger.error('\\nSchema validation failed:\\n')\n for (const validationError of error.validationErrors) {\n logger.error(` - ${validationError}`)\n }\n } else if (error instanceof Error) {\n logger.error(`\\n${error.message}`)\n }\n process.exit(1)\n }\n })\n\n return command\n}\n\n/**\n * Validate schema structure\n */\nfunction validateSchema(schema: Schema): string[] {\n const errors: string[] = []\n\n if (!schema.name || typeof schema.name !== 'string') {\n errors.push('Schema must have a valid \"name\" field')\n }\n\n if (!schema.label || typeof schema.label !== 'string') {\n errors.push('Schema must have a valid \"label\" field')\n }\n\n if (!schema.description || typeof schema.description !== 'string') {\n errors.push('Schema must have a valid \"description\" field')\n }\n\n if (!schema.icon || typeof schema.icon !== 'string') {\n errors.push('Schema must have a valid \"icon\" field')\n }\n\n if (!Array.isArray(schema.fields) || schema.fields.length === 0) {\n errors.push('Schema must have at least one field')\n }\n\n if (!Array.isArray(schema.columns) || schema.columns.length === 0) {\n errors.push('Schema must have at least one column')\n }\n\n // Validate fields\n for (const field of schema.fields || []) {\n if (field.type === 'separator') {\n continue\n }\n if (!field.name || !field.type) {\n errors.push(`Field is missing required properties: ${JSON.stringify(field)}`)\n }\n }\n\n return errors\n}\n","/**\n * CLI init command\n * Initializes betterstart in a project\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { Command } from 'commander'\nimport { findProjectRoot } from '../../config'\nimport { detectPreset, getPresetNames, presets } from '../../config/presets'\nimport { getLogger } from '../../core/logger'\n\n/**\n * Create the init command\n */\nexport function initCommand(): Command {\n const command = new Command('init')\n .description('Initialize betterstart in your project')\n .option('-p, --preset <preset>', 'Use a preset configuration')\n .option('-y, --yes', 'Skip interactive prompts and use defaults')\n .option('--cwd <path>', 'Project root path')\n .action(async (options) => {\n const logger = getLogger()\n const cwd = options.cwd ? path.resolve(options.cwd) : process.cwd()\n\n logger.info('\\n🚀 Initializing betterstart...\\n')\n\n // Find project root\n const projectRoot = findProjectRoot(cwd)\n logger.info(`📁 Project root: ${projectRoot}`)\n\n // Check if config already exists\n const configPath = path.join(projectRoot, 'betterstart.config.ts')\n if (fs.existsSync(configPath)) {\n logger.warn('Configuration file already exists: betterstart.config.ts')\n\n if (!options.yes) {\n logger.info('Use --yes to overwrite')\n return\n }\n }\n\n // Detect or use specified preset\n let presetName = options.preset\n if (!presetName) {\n const detected = detectPreset(projectRoot)\n presetName = detected.name\n logger.info(`🔍 Detected project type: ${presetName}`)\n } else {\n if (!getPresetNames().includes(presetName)) {\n logger.error(`Unknown preset: ${presetName}`)\n logger.info(`Available presets: ${getPresetNames().join(', ')}`)\n process.exit(1)\n }\n logger.info(`📋 Using preset: ${presetName}`)\n }\n\n const preset = presets[presetName]\n\n // Generate config file content\n const configContent = generateConfigFile(presetName, preset.config)\n\n // Write config file\n fs.writeFileSync(configPath, configContent)\n logger.success(`Created: betterstart.config.ts`)\n\n // Create schemas directory if it doesn't exist\n const schemasDir = path.join(projectRoot, preset.config.paths?.schemas || 'schemas')\n if (!fs.existsSync(schemasDir)) {\n fs.mkdirSync(schemasDir, { recursive: true })\n logger.success(`Created: ${preset.config.paths?.schemas || 'schemas'}/`)\n }\n\n // Create example schema\n const exampleSchemaPath = path.join(schemasDir, 'example.json')\n if (!fs.existsSync(exampleSchemaPath)) {\n fs.writeFileSync(exampleSchemaPath, generateExampleSchema())\n logger.success('Created: example.json (sample schema)')\n }\n\n logger.info('\\n✅ Initialization complete!\\n')\n logger.info('Next steps:')\n logger.info(' 1. Review betterstart.config.ts and adjust paths if needed')\n logger.info(' 2. Create your schema in the schemas directory')\n logger.info(' 3. Run: npx betterstart generate <schema-name>')\n logger.info('')\n })\n\n return command\n}\n\n/**\n * Generate the config file content\n */\nfunction generateConfigFile(presetName: string, _config: unknown): string {\n // For monorepo preset, use a simpler config since most paths are defaults\n if (presetName === 'nextjs-monorepo') {\n return `import { defineConfig } from '@betterstart/cli'\n\nexport default defineConfig({\n // Using nextjs-monorepo preset defaults\n // Customize paths if your project structure differs:\n // paths: {\n // app: 'apps/web',\n // database: 'packages/database',\n // lib: 'packages/lib',\n // hooks: 'packages/hooks',\n // schemas: 'schemas',\n // }\n})\n`\n }\n\n // For standalone preset\n if (presetName === 'nextjs-standalone') {\n return `import { defineConfig } from '@betterstart/cli'\n\nexport default defineConfig({\n // Import paths for generated code\n // Customize these to match your project structure:\n imports: {\n database: '@/lib/db',\n adminUi: '@/components/ui',\n webUi: '@/components/ui',\n hooks: '@/hooks',\n utils: '@/lib/utils',\n types: '@/types',\n lib: '@/lib',\n actions: '@/lib/actions/{name}',\n libMarkdown: '@/lib/markdown'\n },\n // Customize paths if your project structure differs:\n // paths: {\n // app: '.',\n // database: '.',\n // lib: '.',\n // hooks: '.',\n // schemas: 'schemas',\n // output: {\n // actions: 'src/actions',\n // hooks: 'src/hooks',\n // components: 'src/components/admin',\n // pages: 'src/app/(admin)/admin',\n // emails: 'src/emails'\n // }\n // }\n})\n`\n }\n\n // For custom preset, include all paths\n return `import { defineConfig } from '@betterstart/cli'\n\nexport default defineConfig({\n // Import paths for generated code\n imports: {\n database: '@/lib/db',\n adminUi: '@/components/ui',\n webUi: '@/components/ui',\n hooks: '@/hooks',\n utils: '@/lib/utils',\n types: '@/types',\n lib: '@/lib',\n actions: '@/lib/actions/{name}',\n libMarkdown: '@/lib/markdown'\n },\n paths: {\n app: '.',\n database: '.',\n lib: '.',\n hooks: '.',\n schemas: 'schemas',\n output: {\n actions: 'src/actions',\n hooks: 'src/hooks',\n components: 'src/components/admin',\n pages: 'src/app/(admin)/admin',\n emails: 'src/emails'\n }\n },\n database: {\n provider: 'drizzle',\n schemaFile: 'src/db/schema.ts',\n migrationsDir: 'src/db/migrations',\n autoMigrate: true\n },\n ui: {\n framework: 'shadcn',\n components: {\n path: '@/components/ui',\n adminPath: '@/components/admin'\n }\n }\n})\n`\n}\n\n/**\n * Generate an example schema\n */\nfunction generateExampleSchema(): string {\n return JSON.stringify(\n {\n $schema: './schema.json',\n name: 'posts',\n label: 'Posts',\n description: 'Blog posts and articles',\n icon: 'FileText',\n fields: [\n {\n name: 'title',\n type: 'string',\n label: 'Title',\n required: true,\n length: 255\n },\n {\n name: 'slug',\n type: 'string',\n label: 'Slug',\n required: true,\n length: 255\n },\n {\n name: 'content',\n type: 'markdown',\n label: 'Content',\n required: true\n },\n {\n name: 'published',\n type: 'boolean',\n label: 'Published',\n default: false\n }\n ],\n columns: [\n {\n accessorKey: 'title',\n header: 'Title',\n type: 'text',\n sortable: true\n },\n {\n accessorKey: 'slug',\n header: 'Slug',\n type: 'text'\n },\n {\n accessorKey: 'published',\n header: 'Status',\n type: 'badge'\n },\n {\n accessorKey: 'createdAt',\n header: 'Created',\n type: 'date',\n sortable: true\n }\n ],\n actions: {\n create: true,\n edit: true,\n delete: true\n }\n },\n null,\n 2\n )\n}\n","/**\n * CLI remove command\n * Removes generated files for a schema\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport readline from 'node:readline'\nimport { Command } from 'commander'\nimport { findProjectRoot, loadConfig, resolveConfig } from '../../config'\nimport { getLogger } from '../../core/logger'\nimport { toKebabCase, toPascalCase } from '../../utils'\n\n/**\n * Create the remove command\n */\nexport function removeCommand(): Command {\n const command = new Command('remove')\n .alias('rm')\n .description('Remove generated files for a schema')\n .argument('<name>', 'Schema name to remove')\n .option('-f, --force', 'Skip confirmation prompt')\n .option('--cwd <path>', 'Project root path')\n .action(async (name, options) => {\n const logger = getLogger()\n const cwd = options.cwd ? path.resolve(options.cwd) : process.cwd()\n\n logger.info('\\n🗑️ Betterstart Remove\\n')\n\n try {\n // Find project root and load config\n const projectRoot = findProjectRoot(cwd)\n const config = await loadConfig(projectRoot)\n const resolvedConfig = resolveConfig(config, projectRoot)\n\n const kebabName = toKebabCase(name)\n const _pascalName = toPascalCase(name)\n\n // Collect files to remove\n const filesToRemove: string[] = []\n\n // Admin pages directory\n const adminPagesDir = path.join(resolvedConfig.paths.output.pages, kebabName)\n if (fs.existsSync(adminPagesDir)) {\n filesToRemove.push(adminPagesDir)\n }\n\n // Server actions file\n const actionsFile = path.join(resolvedConfig.paths.output.actions, `${kebabName}.ts`)\n if (fs.existsSync(actionsFile)) {\n filesToRemove.push(actionsFile)\n }\n\n // Hook file\n const hookFile = path.join(resolvedConfig.paths.output.hooks, `use-${kebabName}.ts`)\n if (fs.existsSync(hookFile)) {\n filesToRemove.push(hookFile)\n }\n\n if (filesToRemove.length === 0) {\n logger.warn(`No generated files found for schema: ${name}`)\n return\n }\n\n // Show files to remove\n logger.info('The following files will be removed:\\n')\n for (const file of filesToRemove) {\n const relativePath = path.relative(projectRoot, file)\n const isDir = fs.statSync(file).isDirectory()\n logger.info(` ${isDir ? '📁' : '📄'} ${relativePath}${isDir ? '/' : ''}`)\n }\n\n // Confirm removal\n if (!options.force) {\n const confirmed = await confirm('\\nAre you sure you want to remove these files?')\n if (!confirmed) {\n logger.info('\\nRemoval cancelled.')\n return\n }\n }\n\n // Remove files\n logger.info('')\n for (const file of filesToRemove) {\n const relativePath = path.relative(projectRoot, file)\n const isDir = fs.statSync(file).isDirectory()\n\n if (isDir) {\n fs.rmSync(file, { recursive: true, force: true })\n } else {\n fs.unlinkSync(file)\n }\n\n logger.success(`Removed: ${relativePath}`)\n }\n\n logger.info('\\n✅ Removal complete!')\n logger.info('\\nNote: The following may need manual cleanup:')\n logger.info(' - Database table (run a migration to drop it)')\n logger.info(' - Navigation entries in navigation.json')\n logger.info(' - Any imports referencing removed files')\n } catch (error) {\n if (error instanceof Error) {\n logger.error(`\\n${error.message}`)\n }\n process.exit(1)\n }\n })\n\n return command\n}\n\n/**\n * Prompt for confirmation\n */\nasync function confirm(message: string): Promise<boolean> {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n })\n\n return new Promise((resolve) => {\n rl.question(`${message} (y/N) `, (answer) => {\n rl.close()\n resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes')\n })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAMA,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,WAAAC,gBAAe;;;ACJxB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,eAAe;AASjB,SAAS,kBAA2B;AACzC,QAAM,UAA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GAAG,OAAO,WAAW,CAAC,WAAW;AAC3C,SAAG,MAAM;AACT,cAAQ,OAAO,YAAY,MAAM,OAAO,OAAO,YAAY,MAAM,KAAK;AAAA,IACxE,CAAC;AAAA,EACH,CAAC;AACH;;;AH/GA,SAAS,aAAqB;AAC5B,MAAI;AACF,UAAM,YAAYC,MAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAE7D,eAAW,OAAO,CAAC,sBAAsB,iBAAiB,GAAG;AAC3D,YAAM,UAAUA,MAAK,QAAQ,WAAW,GAAG;AAC3C,UAAIC,IAAG,WAAW,OAAO,GAAG;AAC1B,cAAM,MAAM,KAAK,MAAMA,IAAG,aAAa,SAAS,OAAO,CAAC;AACxD,eAAO,IAAI,WAAW;AAAA,MACxB;AAAA,IACF;AAAA,EACF,QAAQ;AAAA,EAER;AACA,SAAO;AACT;AAGA,UAAU,oBAAoB,CAAC;AAK/B,SAAS,gBAAyB;AAChC,QAAM,UAAU,IAAIC,SAAQ;AAE5B,UACG,KAAK,aAAa,EAClB,YAAY,yDAAyD,EACrE,QAAQ,WAAW,CAAC;AAGvB,UAAQ,WAAW,YAAY,CAAC;AAChC,UAAQ,WAAW,gBAAgB,CAAC;AACpC,UAAQ,WAAW,cAAc,CAAC;AAElC,SAAO;AACT;AAKA,eAAsB,IAAI,MAAgC;AACxD,QAAM,UAAU,cAAc;AAE9B,MAAI;AACF,UAAM,QAAQ,WAAW,QAAQ,QAAQ,IAAI;AAAA,EAC/C,SAAS,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,cAAQ,MAAM;AAAA,SAAY,MAAM,OAAO,EAAE;AAAA,IAC3C,OAAO;AACL,cAAQ,MAAM,gCAAgC;AAAA,IAChD;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAGA,IAAI;","names":["fs","path","Command","fs","path","Command","Command","path","fs","fs","path","Command","Command","path","fs","path","fs","Command"]}
1
+ {"version":3,"sources":["../src/cli/index.ts","../src/cli/commands/generate.ts","../src/cli/commands/init.ts","../src/cli/commands/remove.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI entry point for @betterstart/cli\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { Command } from 'commander'\nimport { createConsoleLogger, setLogger } from '../core/logger'\nimport { generateCommand } from './commands/generate'\nimport { initCommand } from './commands/init'\nimport { removeCommand } from './commands/remove'\n\n// Read version from package.json\nfunction getVersion(): string {\n try {\n const __dirname = path.dirname(fileURLToPath(import.meta.url))\n // Try dist layout first (built), then source layout\n for (const rel of ['../../package.json', '../package.json']) {\n const pkgPath = path.resolve(__dirname, rel)\n if (fs.existsSync(pkgPath)) {\n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))\n return pkg.version ?? '0.0.0'\n }\n }\n } catch {\n // Fallback\n }\n return '0.0.0'\n}\n\n// Set up console logger\nsetLogger(createConsoleLogger())\n\n/**\n * Create the CLI program\n */\nfunction createProgram(): Command {\n const program = new Command()\n\n program\n .name('betterstart')\n .description('Generate admin CRUD interfaces for your Next.js project')\n .version(getVersion())\n\n // Add commands\n program.addCommand(initCommand())\n program.addCommand(generateCommand())\n program.addCommand(removeCommand())\n\n return program\n}\n\n/**\n * Run the CLI\n */\nexport async function run(args?: string[]): Promise<void> {\n const program = createProgram()\n\n try {\n await program.parseAsync(args || process.argv)\n } catch (error) {\n if (error instanceof Error) {\n console.error(`\\nError: ${error.message}`)\n } else {\n console.error('\\nAn unexpected error occurred')\n }\n process.exit(1)\n }\n}\n\n// Always run when this file is executed\nrun()\n","/**\n * CLI generate command\n * Generates code from a schema\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { Command } from 'commander'\nimport { findProjectRoot, loadConfig, resolveConfig } from '../../config'\nimport { SchemaValidationError } from '../../core/errors'\nimport { getLogger } from '../../core/logger'\nimport type { MonorepoPaths, Schema } from '../../types'\nimport { initImportResolver, setPaths } from '../../utils'\n\n/**\n * Create the generate command\n */\nexport function generateCommand(): Command {\n const command = new Command('generate')\n .alias('g')\n .description('Generate code from a schema')\n .argument('<name>', 'Schema name to generate')\n .option('--skip-migration', 'Skip database migration')\n .option('-f, --force', 'Overwrite existing files')\n .option('--cwd <path>', 'Project root path')\n .option('--generators <generators>', 'Comma-separated list of generators to run')\n .action(async (name, options) => {\n const logger = getLogger()\n const cwd = options.cwd ? path.resolve(options.cwd) : process.cwd()\n\n logger.info('\\n🚀 Betterstart Generator\\n')\n\n try {\n // Find project root and load config\n const projectRoot = findProjectRoot(cwd)\n logger.info(`📁 Project root: ${projectRoot}`)\n\n const config = await loadConfig(projectRoot)\n const resolvedConfig = resolveConfig(config, projectRoot)\n logger.info(`📄 Loading schema: ${name}.json`)\n\n // Find schema file\n const schemaPath = path.join(resolvedConfig.paths.schemas, `${name}.json`)\n\n if (!fs.existsSync(schemaPath)) {\n logger.error(`Schema file not found: ${schemaPath}`)\n logger.info(`\\nMake sure the schema file exists at: ${schemaPath}`)\n logger.info('You can create a schema using:')\n logger.info(` echo '{}' > ${schemaPath}`)\n process.exit(1)\n }\n\n // Load and parse schema\n let schema: Schema\n try {\n const schemaContent = fs.readFileSync(schemaPath, 'utf-8')\n schema = JSON.parse(schemaContent)\n } catch (error) {\n logger.error(\n `Failed to parse schema: ${error instanceof Error ? error.message : String(error)}`\n )\n process.exit(1)\n }\n\n // Validate schema\n const validationErrors = validateSchema(schema)\n if (validationErrors.length > 0) {\n throw new SchemaValidationError('Schema validation failed', validationErrors, {\n schemaPath\n })\n }\n\n logger.success('Schema validated')\n logger.info('\\n📦 Generating files...\\n')\n\n // Seed global paths and import resolver from resolved config\n // so generators work in both monorepo and standalone projects\n const monorepoPaths: MonorepoPaths = {\n root: resolvedConfig.paths.root,\n app: resolvedConfig.paths.app,\n database: resolvedConfig.paths.database,\n lib: resolvedConfig.paths.lib,\n hooks: resolvedConfig.paths.hooks,\n schemas: resolvedConfig.paths.schemas,\n data: path.join(resolvedConfig.paths.root, 'packages/data')\n }\n setPaths(monorepoPaths)\n initImportResolver(resolvedConfig)\n\n const { generate } = await import('../../index')\n\n await generate(name, {\n skipMigration: options.skipMigration,\n force: options.force\n })\n } catch (error) {\n if (error instanceof SchemaValidationError) {\n logger.error('\\nSchema validation failed:\\n')\n for (const validationError of error.validationErrors) {\n logger.error(` - ${validationError}`)\n }\n } else if (error instanceof Error) {\n logger.error(`\\n${error.message}`)\n }\n process.exit(1)\n }\n })\n\n return command\n}\n\n/**\n * Validate schema structure\n */\nfunction validateSchema(schema: Schema): string[] {\n const errors: string[] = []\n\n if (!schema.name || typeof schema.name !== 'string') {\n errors.push('Schema must have a valid \"name\" field')\n }\n\n if (!schema.label || typeof schema.label !== 'string') {\n errors.push('Schema must have a valid \"label\" field')\n }\n\n if (!schema.description || typeof schema.description !== 'string') {\n errors.push('Schema must have a valid \"description\" field')\n }\n\n if (!schema.icon || typeof schema.icon !== 'string') {\n errors.push('Schema must have a valid \"icon\" field')\n }\n\n if (!Array.isArray(schema.fields) || schema.fields.length === 0) {\n errors.push('Schema must have at least one field')\n }\n\n if (!Array.isArray(schema.columns) || schema.columns.length === 0) {\n errors.push('Schema must have at least one column')\n }\n\n // Validate fields\n for (const field of schema.fields || []) {\n if (field.type === 'separator') {\n continue\n }\n if (!field.name || !field.type) {\n errors.push(`Field is missing required properties: ${JSON.stringify(field)}`)\n }\n }\n\n return errors\n}\n","/**\n * CLI init command\n * Initializes betterstart in a project\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport { Command } from 'commander'\nimport { findProjectRoot } from '../../config'\nimport { detectPreset, getPresetNames, presets } from '../../config/presets'\nimport { getLogger } from '../../core/logger'\n\n/**\n * Create the init command\n */\nexport function initCommand(): Command {\n const command = new Command('init')\n .description('Initialize betterstart in your project')\n .option('-p, --preset <preset>', 'Use a preset configuration')\n .option('-y, --yes', 'Skip interactive prompts and use defaults')\n .option('--cwd <path>', 'Project root path')\n .action(async (options) => {\n const logger = getLogger()\n const cwd = options.cwd ? path.resolve(options.cwd) : process.cwd()\n\n logger.info('\\n🚀 Initializing betterstart...\\n')\n\n // Find project root\n const projectRoot = findProjectRoot(cwd)\n logger.info(`📁 Project root: ${projectRoot}`)\n\n // Check if config already exists\n const configPath = path.join(projectRoot, 'betterstart.config.ts')\n if (fs.existsSync(configPath)) {\n logger.warn('Configuration file already exists: betterstart.config.ts')\n\n if (!options.yes) {\n logger.info('Use --yes to overwrite')\n return\n }\n }\n\n // Detect or use specified preset\n let presetName = options.preset\n if (!presetName) {\n const detected = detectPreset(projectRoot)\n presetName = detected.name\n logger.info(`🔍 Detected project type: ${presetName}`)\n } else {\n if (!getPresetNames().includes(presetName)) {\n logger.error(`Unknown preset: ${presetName}`)\n logger.info(`Available presets: ${getPresetNames().join(', ')}`)\n process.exit(1)\n }\n logger.info(`📋 Using preset: ${presetName}`)\n }\n\n const preset = presets[presetName]\n\n // Generate config file content\n const configContent = generateConfigFile(presetName, preset.config)\n\n // Write config file\n fs.writeFileSync(configPath, configContent)\n logger.success(`Created: betterstart.config.ts`)\n\n // Create schemas directory if it doesn't exist\n const schemasDir = path.join(projectRoot, preset.config.paths?.schemas || 'schemas')\n if (!fs.existsSync(schemasDir)) {\n fs.mkdirSync(schemasDir, { recursive: true })\n logger.success(`Created: ${preset.config.paths?.schemas || 'schemas'}/`)\n }\n\n // Create example schema\n const exampleSchemaPath = path.join(schemasDir, 'example.json')\n if (!fs.existsSync(exampleSchemaPath)) {\n fs.writeFileSync(exampleSchemaPath, generateExampleSchema())\n logger.success('Created: example.json (sample schema)')\n }\n\n logger.info('\\n✅ Initialization complete!\\n')\n logger.info('Next steps:')\n logger.info(' 1. Review betterstart.config.ts and adjust paths if needed')\n logger.info(' 2. Create your schema in the schemas directory')\n logger.info(' 3. Run: npx betterstart generate <schema-name>')\n logger.info('')\n })\n\n return command\n}\n\n/**\n * Generate the config file content\n */\nfunction generateConfigFile(presetName: string, _config: unknown): string {\n // For monorepo preset, use a simpler config since most paths are defaults\n if (presetName === 'nextjs-monorepo') {\n return `import { defineConfig } from '@betterstart/cli'\n\nexport default defineConfig({\n // Using nextjs-monorepo preset defaults\n // Customize paths if your project structure differs:\n // paths: {\n // app: 'apps/web',\n // database: 'packages/database',\n // lib: 'packages/lib',\n // hooks: 'packages/hooks',\n // schemas: 'schemas',\n // }\n})\n`\n }\n\n // For standalone preset\n if (presetName === 'nextjs-standalone') {\n return `import { defineConfig } from '@betterstart/cli'\n\nexport default defineConfig({\n // Import paths for generated code\n // Customize these to match your project structure:\n imports: {\n database: '@/lib/db',\n adminUi: '@/components/ui',\n webUi: '@/components/ui',\n hooks: '@/hooks',\n utils: '@/lib/utils',\n types: '@/types',\n lib: '@/lib',\n actions: '@/lib/actions/{name}',\n libMarkdown: '@/lib/markdown'\n },\n // Customize paths if your project structure differs:\n // paths: {\n // app: '.',\n // database: '.',\n // lib: '.',\n // hooks: '.',\n // schemas: 'schemas',\n // output: {\n // actions: 'src/actions',\n // hooks: 'src/hooks',\n // components: 'src/components/admin',\n // pages: 'src/app/(admin)/admin',\n // emails: 'src/emails'\n // }\n // }\n})\n`\n }\n\n // For custom preset, include all paths\n return `import { defineConfig } from '@betterstart/cli'\n\nexport default defineConfig({\n // Import paths for generated code\n imports: {\n database: '@/lib/db',\n adminUi: '@/components/ui',\n webUi: '@/components/ui',\n hooks: '@/hooks',\n utils: '@/lib/utils',\n types: '@/types',\n lib: '@/lib',\n actions: '@/lib/actions/{name}',\n libMarkdown: '@/lib/markdown'\n },\n paths: {\n app: '.',\n database: '.',\n lib: '.',\n hooks: '.',\n schemas: 'schemas',\n output: {\n actions: 'src/actions',\n hooks: 'src/hooks',\n components: 'src/components/admin',\n pages: 'src/app/(admin)/admin',\n emails: 'src/emails'\n }\n },\n database: {\n provider: 'drizzle',\n schemaFile: 'src/db/schema.ts',\n migrationsDir: 'src/db/migrations',\n autoMigrate: true\n },\n ui: {\n framework: 'shadcn',\n components: {\n path: '@/components/ui',\n adminPath: '@/components/admin'\n }\n }\n})\n`\n}\n\n/**\n * Generate an example schema\n */\nfunction generateExampleSchema(): string {\n return JSON.stringify(\n {\n $schema: './schema.json',\n name: 'posts',\n label: 'Posts',\n description: 'Blog posts and articles',\n icon: 'FileText',\n fields: [\n {\n name: 'title',\n type: 'string',\n label: 'Title',\n required: true,\n length: 255\n },\n {\n name: 'slug',\n type: 'string',\n label: 'Slug',\n required: true,\n length: 255\n },\n {\n name: 'content',\n type: 'markdown',\n label: 'Content',\n required: true\n },\n {\n name: 'published',\n type: 'boolean',\n label: 'Published',\n default: false\n }\n ],\n columns: [\n {\n accessorKey: 'title',\n header: 'Title',\n type: 'text',\n sortable: true\n },\n {\n accessorKey: 'slug',\n header: 'Slug',\n type: 'text'\n },\n {\n accessorKey: 'published',\n header: 'Status',\n type: 'badge'\n },\n {\n accessorKey: 'createdAt',\n header: 'Created',\n type: 'date',\n sortable: true\n }\n ],\n actions: {\n create: true,\n edit: true,\n delete: true\n }\n },\n null,\n 2\n )\n}\n","/**\n * CLI remove command\n * Removes generated files for a schema\n */\n\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport readline from 'node:readline'\nimport { Command } from 'commander'\nimport { findProjectRoot, loadConfig, resolveConfig } from '../../config'\nimport { getLogger } from '../../core/logger'\nimport { toKebabCase, toPascalCase } from '../../utils'\n\n/**\n * Create the remove command\n */\nexport function removeCommand(): Command {\n const command = new Command('remove')\n .alias('rm')\n .description('Remove generated files for a schema')\n .argument('<name>', 'Schema name to remove')\n .option('-f, --force', 'Skip confirmation prompt')\n .option('--cwd <path>', 'Project root path')\n .action(async (name, options) => {\n const logger = getLogger()\n const cwd = options.cwd ? path.resolve(options.cwd) : process.cwd()\n\n logger.info('\\n🗑️ Betterstart Remove\\n')\n\n try {\n // Find project root and load config\n const projectRoot = findProjectRoot(cwd)\n const config = await loadConfig(projectRoot)\n const resolvedConfig = resolveConfig(config, projectRoot)\n\n const kebabName = toKebabCase(name)\n const _pascalName = toPascalCase(name)\n\n // Collect files to remove\n const filesToRemove: string[] = []\n\n // Admin pages directory\n const adminPagesDir = path.join(resolvedConfig.paths.output.pages, kebabName)\n if (fs.existsSync(adminPagesDir)) {\n filesToRemove.push(adminPagesDir)\n }\n\n // Server actions file\n const actionsFile = path.join(resolvedConfig.paths.output.actions, `${kebabName}.ts`)\n if (fs.existsSync(actionsFile)) {\n filesToRemove.push(actionsFile)\n }\n\n // Hook file\n const hookFile = path.join(resolvedConfig.paths.output.hooks, `use-${kebabName}.ts`)\n if (fs.existsSync(hookFile)) {\n filesToRemove.push(hookFile)\n }\n\n if (filesToRemove.length === 0) {\n logger.warn(`No generated files found for schema: ${name}`)\n return\n }\n\n // Show files to remove\n logger.info('The following files will be removed:\\n')\n for (const file of filesToRemove) {\n const relativePath = path.relative(projectRoot, file)\n const isDir = fs.statSync(file).isDirectory()\n logger.info(` ${isDir ? '📁' : '📄'} ${relativePath}${isDir ? '/' : ''}`)\n }\n\n // Confirm removal\n if (!options.force) {\n const confirmed = await confirm('\\nAre you sure you want to remove these files?')\n if (!confirmed) {\n logger.info('\\nRemoval cancelled.')\n return\n }\n }\n\n // Remove files\n logger.info('')\n for (const file of filesToRemove) {\n const relativePath = path.relative(projectRoot, file)\n const isDir = fs.statSync(file).isDirectory()\n\n if (isDir) {\n fs.rmSync(file, { recursive: true, force: true })\n } else {\n fs.unlinkSync(file)\n }\n\n logger.success(`Removed: ${relativePath}`)\n }\n\n logger.info('\\n✅ Removal complete!')\n logger.info('\\nNote: The following may need manual cleanup:')\n logger.info(' - Database table (run a migration to drop it)')\n logger.info(' - Navigation entries in navigation.json')\n logger.info(' - Any imports referencing removed files')\n } catch (error) {\n if (error instanceof Error) {\n logger.error(`\\n${error.message}`)\n }\n process.exit(1)\n }\n })\n\n return command\n}\n\n/**\n * Prompt for confirmation\n */\nasync function confirm(message: string): Promise<boolean> {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n })\n\n return new Promise((resolve) => {\n rl.question(`${message} (y/N) `, (answer) => {\n rl.close()\n resolve(answer.toLowerCase() === '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Q,WAAW,CAAC;AAGvB,UAAQ,WAAW,YAAY,CAAC;AAChC,UAAQ,WAAW,gBAAgB,CAAC;AACpC,UAAQ,WAAW,cAAc,CAAC;AAElC,SAAO;AACT;AAKA,eAAsB,IAAI,MAAgC;AACxD,QAAM,UAAU,cAAc;AAE9B,MAAI;AACF,UAAM,QAAQ,WAAW,QAAQ,QAAQ,IAAI;AAAA,EAC/C,SAAS,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,cAAQ,MAAM;AAAA,SAAY,MAAM,OAAO,EAAE;AAAA,IAC3C,OAAO;AACL,cAAQ,MAAM,gCAAgC;AAAA,IAChD;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAGA,IAAI;","names":["fs","path","Command","fs","path","Command","Command","path","fs","fs","path","Command","Command","path","fs","path","fs","Command"]}
@@ -2,7 +2,7 @@ import {
2
2
  quotePropertyName,
3
3
  singularize,
4
4
  toPascalCase
5
- } from "../chunk-G4KI4DVB.js";
5
+ } from "../chunk-EIH4RRIJ.js";
6
6
  import "../chunk-NKRQYAS6.js";
7
7
  import {
8
8
  CodegenError,
package/dist/index.d.ts CHANGED
@@ -191,7 +191,13 @@ declare const extractFileName: (registryPath: string) => string;
191
191
  */
192
192
  declare function initPaths(startDir?: string): MonorepoPaths;
193
193
  /**
194
- * Get monorepo paths (must call initPaths first)
194
+ * Set pre-resolved paths (e.g., from config-based resolution)
195
+ * This allows the CLI to seed paths from the config system
196
+ * so that generators work in both monorepo and standalone projects.
197
+ */
198
+ declare function setPaths(paths: MonorepoPaths): void;
199
+ /**
200
+ * Get monorepo paths (must call initPaths or setPaths first)
195
201
  */
196
202
  declare function getPaths(): MonorepoPaths;
197
203
  /**
@@ -263,4 +269,4 @@ declare function validateSchema(schema: Schema): string[];
263
269
  */
264
270
  declare function generate(schemaName: string, options?: GeneratorOptions): Promise<void>;
265
271
 
266
- export { type AddComponentOptions, DEFAULT_TARGET, FormSchema, GeneratorOptions, MonorepoPaths, type RegistryFile, type RegistryIndex, type RegistryItem, Schema, SchemaField, TARGET_CONFIGS, type TargetConfig, type TargetPackage, addAllComponents, addComponents, ensureDir, ensureIdField, exportExists, extractFileName, fetchComponent, fetchIndex, flattenFields, generate, generateActions, generateCache, generateColumns, generateCreatePage, generateDatabase, generateEditPage, generateEmailTemplate, generateForm$1 as generateForm, generateFormActions, generateFormAdminPages, generateFormComponent, generateFormDatabase, generateFormHook, generateHook, generatePage, generatePageContent, generateForm as generatePublicForm, generateTable, getAvailableComponents, getImportResolver, getMigrationTimestamp, getPaths, getProjectRoot, initImportResolver, initPaths, listComponents, pluralize, quotePropertyName, resolveRegistryDeps, singularize, singularizeLabel, toCamelCase, toKebabCase, toPascalCase, toScreamingSnakeCase, toSnakeCase, transformSource, tryFetchComponent, updateExports, updateFormNavigation, updateNavigation, validateSchema };
272
+ export { type AddComponentOptions, DEFAULT_TARGET, FormSchema, GeneratorOptions, MonorepoPaths, type RegistryFile, type RegistryIndex, type RegistryItem, Schema, SchemaField, TARGET_CONFIGS, type TargetConfig, type TargetPackage, addAllComponents, addComponents, ensureDir, ensureIdField, exportExists, extractFileName, fetchComponent, fetchIndex, flattenFields, generate, generateActions, generateCache, generateColumns, generateCreatePage, generateDatabase, generateEditPage, generateEmailTemplate, generateForm$1 as generateForm, generateFormActions, generateFormAdminPages, generateFormComponent, generateFormDatabase, generateFormHook, generateHook, generatePage, generatePageContent, generateForm as generatePublicForm, generateTable, getAvailableComponents, getImportResolver, getMigrationTimestamp, getPaths, getProjectRoot, initImportResolver, initPaths, listComponents, pluralize, quotePropertyName, resolveRegistryDeps, setPaths, singularize, singularizeLabel, toCamelCase, toKebabCase, toPascalCase, toScreamingSnakeCase, toSnakeCase, transformSource, tryFetchComponent, updateExports, updateFormNavigation, updateNavigation, validateSchema };
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  initPaths,
15
15
  pluralize,
16
16
  quotePropertyName,
17
+ setPaths,
17
18
  singularize,
18
19
  singularizeLabel,
19
20
  toCamelCase,
@@ -21,7 +22,7 @@ import {
21
22
  toPascalCase,
22
23
  toScreamingSnakeCase,
23
24
  toSnakeCase
24
- } from "./chunk-G4KI4DVB.js";
25
+ } from "./chunk-EIH4RRIJ.js";
25
26
  import "./chunk-NKRQYAS6.js";
26
27
  import "./chunk-WY6BC55D.js";
27
28
 
@@ -2970,6 +2971,7 @@ ${junctionDef}`;
2970
2971
  }
2971
2972
  }
2972
2973
  updatedContent = updateImports(updatedContent, requiredImports, needsSql.value);
2974
+ ensureDir(path5.dirname(schemaFilePath));
2973
2975
  fs5.writeFileSync(schemaFilePath, updatedContent, "utf-8");
2974
2976
  }
2975
2977
  function removePreviousMigrations(schemaName, migrationDir) {
@@ -7445,6 +7447,7 @@ async function updateFormNavigation(schema, options) {
7445
7447
  ...users ? [users] : []
7446
7448
  ];
7447
7449
  const code = generateNavigationCode(navigation);
7450
+ ensureDir(path10.dirname(navFilePath));
7448
7451
  fs10.writeFileSync(navFilePath, code, "utf-8");
7449
7452
  }
7450
7453
 
@@ -10153,6 +10156,7 @@ async function updateNavigation(schema, options) {
10153
10156
  ];
10154
10157
  }
10155
10158
  const code = generateNavigationCode2(navigation);
10159
+ ensureDir(path13.dirname(navFilePath));
10156
10160
  fs13.writeFileSync(navFilePath, code, "utf-8");
10157
10161
  }
10158
10162
 
@@ -11162,7 +11166,7 @@ function validateSchema(schema) {
11162
11166
  return errors;
11163
11167
  }
11164
11168
  async function generate(schemaName, options = {}) {
11165
- const paths = initPaths();
11169
+ const paths = getPaths();
11166
11170
  const projectRoot = findProjectRoot(process.cwd());
11167
11171
  const config = await loadConfig(projectRoot);
11168
11172
  const resolvedConfig = resolveConfig(config, projectRoot);
@@ -11360,6 +11364,7 @@ export {
11360
11364
  pluralize,
11361
11365
  quotePropertyName,
11362
11366
  resolveRegistryDeps,
11367
+ setPaths,
11363
11368
  singularize,
11364
11369
  singularizeLabel,
11365
11370
  toCamelCase,