@codefast/cli 0.3.1-canary.12 → 0.3.1-canary.14

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["webpack://@codefast/cli/./src/commands/create-project/utils.ts","webpack://@codefast/cli/./src/commands/create-project/project-name.ts","webpack://@codefast/cli/./src/commands/create-project/check-existing-project.ts","webpack://@codefast/cli/./src/commands/create-project/constants.ts","webpack://@codefast/cli/./src/commands/create-project/config-files.ts","webpack://@codefast/cli/./src/commands/create-project/dependencies.ts","webpack://@codefast/cli/./src/commands/create-project/environment.ts","webpack://@codefast/cli/./src/commands/create-project/next-project.ts","webpack://@codefast/cli/./src/commands/create-project/command.ts","webpack://@codefast/cli/./src/commands/update-exports/analyze-imports.ts","webpack://@codefast/cli/./src/commands/update-exports/types.ts","webpack://@codefast/cli/./src/commands/update-exports/config.ts","webpack://@codefast/cli/./src/commands/update-exports/file-utils.ts","webpack://@codefast/cli/./src/commands/update-exports/generate-exports.ts","webpack://@codefast/cli/./src/commands/update-exports/process-package.ts","webpack://@codefast/cli/./src/commands/update-exports/command.ts","webpack://@codefast/cli/./src/lib/package-info.ts","webpack://@codefast/cli/./src/index.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport readline from \"node:readline\";\n\n/**\n * Represents an interface for reading and writing data to the console or other input/output streams.\n *\n * This interface allows interaction with standard input and output streams by reading input and writing output\n * in a controlled manner. It is commonly used for creating command-line interfaces or handling user input.\n */\nexport const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n});\n\n/**\n * Asks a user a question and returns their response as a trimmed string.\n *\n * @param question - The question to present to the user.\n * @returns A promise that resolves with the user's response as a trimmed string.\n */\nexport function prompt(question: string): Promise<string> {\n return new Promise((resolve) => {\n rl.question(question, (answer) => {\n resolve(answer.trim());\n });\n });\n}\n\n/**\n * Executes a shell command synchronously and inherits the output behavior of the current process.\n *\n * @param command - The shell command to be executed.\n * @returns void\n */\nexport function runCommand(command: string): void {\n execSync(command, { stdio: \"inherit\" });\n}\n\n/**\n * File operation and validation utilities for configuration management\n */\nexport const FileUtils = {\n /**\n * Checks if a file exists at the specified path\n */\n exists(filePath: string): boolean {\n return fs.existsSync(filePath);\n },\n\n /**\n * Reads a file's content with error handling\n */\n readFile(filePath: string): string {\n try {\n return fs.readFileSync(filePath, \"utf8\");\n } catch (error) {\n throw new Error(`Failed to read file ${filePath}: ${getErrorMessage(error)}`);\n }\n },\n\n /**\n * Writes content to a file with error handling\n */\n writeFile(filePath: string, content: string): void {\n try {\n fs.writeFileSync(filePath, content);\n } catch (error) {\n throw new Error(`Failed to write to file ${filePath}: ${getErrorMessage(error)}`);\n }\n },\n\n /**\n * Writes configuration content to a specified file.\n *\n * @param filePath - The path of the file where the configuration content should be written.\n * @param content - The configuration content to write into the file.\n * @returns void\n */\n writeConfigFile(filePath: string, content: string): void {\n fs.writeFileSync(filePath, content);\n console.log(`📝 Created ${filePath}`);\n },\n\n /**\n * Validates a file path and logs appropriate warning if not found\n * @returns true if a file exists, false otherwise\n */\n validatePath(filePath: string, filename: string): boolean {\n if (!this.exists(filePath)) {\n console.warn(`⚠️ ${filename} not found, skipping update.`);\n\n return false;\n }\n\n return true;\n },\n};\n\n/**\n * Extracts an error message from any error type\n */\nexport function getErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : \"Unknown error occurred\";\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { prompt } from \"@/commands/create-project/utils\";\n\n/**\n * Validates the given project name against various criteria to ensure it is suitable for use.\n *\n * The validation checks include:\n * - Ensuring the name is not empty or comprised only of whitespace.\n * - Restricting the maximum length of the name to 100 characters.\n * - Enforcing URL-friendly naming conventions, prohibiting special characters such as `@` or names resembling scoped\n * packages.\n * - Preventing the use of prohibited project names such as '.' or '..'.\n * - Restricting the use of reserved system names on Windows.\n * - Ensuring that the specified project name does not conflict with an existing directory in the current working\n * directory.\n * - Verifying that the current directory has write permissions for the creation of a new project.\n *\n * @param name - The proposed project name to be validated.\n * @returns An object indicating whether the project name is valid. If invalid, an error message is provided.\n */\nfunction validateProjectName(name: string): { valid: boolean; error?: string } {\n // Check if the name is empty or contains only spaces.\n if (!name || /^\\s*$/.test(name)) {\n return { valid: false, error: \"Project name cannot be empty or contain only whitespace.\" };\n }\n\n // Check the name length\n if (name.length > 100) {\n return { valid: false, error: \"Project name is too long (maximum 100 characters).\" };\n }\n\n // Check the package name format according to npm standard (scoped packages are not allowed).\n const npmNameRegex = /^[a-z0-9-~][a-z0-9-._~]*$/;\n\n if (!npmNameRegex.test(name)) {\n return {\n valid: false,\n error:\n \"Project name must be URL-friendly (letters, numbers, hyphens, underscores, dots; no @ or scoped packages).\",\n };\n }\n\n // Check if the name contains only dots.\n if (name === \".\" || name === \"..\") {\n return { valid: false, error: \"Project name cannot be '.' or '..'.\" };\n }\n\n // Checking system keywords on Windows\n const reservedNames = /^(?<reserved>CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i;\n\n if (reservedNames.test(name)) {\n return { valid: false, error: `Project name \"${name}\" is a reserved system name.` };\n }\n\n // Check the existence of the directory\n const fullPath = path.resolve(process.cwd(), name);\n\n if (fs.existsSync(fullPath)) {\n return { valid: false, error: `A directory named \"${name}\" already exists.` };\n }\n\n // Check write permission\n try {\n fs.accessSync(process.cwd(), fs.constants.W_OK);\n } catch {\n return { valid: false, error: \"Cannot create project: No write permission in current directory.\" };\n }\n\n return { valid: true };\n}\n\n/**\n * Asynchronously prompts the user to enter a valid project name, validating the input and retrying up to a specified\n * number of attempts if necessary.\n *\n * @param initialName - An optional initial project name to validate; if not provided, the user will be prompted to\n * enter a name.\n * @param attempts - The current number of validation attempts made. Defaults to 0.\n * @param maxAttempts - The maximum number of validation attempts allowed. Defaults to 3.\n * @returns A promise that resolves to a valid project name as a string.\n * @throws An error if the maximum number of validation attempts is exceeded.\n */\nexport async function getValidProjectName(initialName?: string, attempts = 0, maxAttempts = 3): Promise<string> {\n const projectName = initialName ?? (await prompt(\"Enter project name: \"));\n\n const validation = validateProjectName(projectName);\n\n if (validation.valid) {\n return projectName;\n }\n\n if (attempts >= maxAttempts - 1) {\n throw new Error(`❌ Exceeded maximum attempts to enter a valid project name.`);\n }\n\n console.error(`❌ ${validation.error} (${maxAttempts - attempts - 1} attempts remaining)`);\n\n return getValidProjectName(undefined, attempts + 1, maxAttempts);\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { getValidProjectName } from \"@/commands/create-project/project-name\";\nimport { prompt } from \"@/commands/create-project/utils\";\n\n/**\n * Checks if a package.json file exists in the current directory and determines the project name.\n * If package.json exists, it prompts the user to confirm continuing with the existing project\n * and retrieves the project name from package.json or the provided argument.\n * If package.json does not exist, it validates the provided project name or prompts for a new one.\n *\n * @param projectNameArg - Optional project name provided as an argument.\n * @returns A promise that resolves to an object containing the project name and a boolean indicating if package.json\n * exists.\n * @throws An error if the user aborts the operation or if the project name cannot be determined.\n */\nexport async function checkExistingProject(\n projectNameArg?: string,\n): Promise<{ packageJsonExists: boolean; projectName: string }> {\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n const packageJsonExists = fs.existsSync(packageJsonPath);\n\n if (packageJsonExists) {\n console.log(`⚠️ A package.json file has been detected in the current directory.`);\n const confirm = await prompt(\"Do you want to continue configuring this existing project? [Y/n]: \");\n\n // Default to 'Y' if the input is empty; otherwise, check for 'y' or 'Y'\n if (confirm === \"\" || confirm.toLowerCase() === \"y\") {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\"));\n const projectName = packageJson.name ?? (await getValidProjectName(projectNameArg));\n\n return { projectName, packageJsonExists };\n }\n\n console.log(\"Aborting...\");\n throw new Error(\"User aborted the operation.\");\n }\n\n const projectName = await getValidProjectName(projectNameArg);\n\n return { projectName, packageJsonExists };\n}\n","/**\n * Main dependencies need to be installed\n */\nexport const MAIN_DEPENDENCIES = [\n \"@codefast/ui\",\n \"@codefast/hooks\",\n \"recharts\",\n \"react-hook-form\",\n \"next-themes\",\n \"date-fns\",\n \"lucide-react\",\n];\n\n/**\n * Development dependencies are grouped by function.\n */\nexport const DEV_DEPENDENCIES = {\n commitLint: [\"@commitlint/cli\", \"@commitlint/config-conventional\", \"@commitlint/types\"],\n gitTools: [\"simple-git-hooks\"],\n formatting: [\"prettier\", \"prettier-plugin-packagejson\", \"prettier-plugin-tailwindcss\", \"lint-staged\"],\n linting: [\"@codefast/eslint-config\"],\n};\n\n/**\n * Packages that need to be removed from the project\n */\nexport const PACKAGES_TO_REMOVE = [\"@eslint/eslintrc\", \"eslint-config-next\"];\n\n/**\n * Define a schema for a configuration file\n */\nexport interface ConfigFile {\n /** Configuration file content */\n content: string;\n /** Path to the configuration file */\n path: string;\n /** Description of file purpose options */\n description?: string;\n}\n\n/**\n * Define configuration categories\n */\nexport type ConfigCategory = \"deployment\" | \"formatting\" | \"linting\" | \"styles\";\n\n/**\n * Type for the configuration groups\n */\nexport type ConfigGroups = Record<ConfigCategory, ConfigFile[]>;\n\n/**\n * Group configurations by tool type\n */\nexport const configGroups: ConfigGroups = {\n deployment: [\n {\n path: \".vercelignore\",\n content: `#-------------------------------------------------------------------------------\n# Dependencies and package managers\n#-------------------------------------------------------------------------------\n\n# Node dependencies\nnode_modules\n.pnpm-store\n.yarn\n\n#-------------------------------------------------------------------------------\n# Development and environment\n#-------------------------------------------------------------------------------\n\n# Environment variables (except examples)\n.env*\n!.env.example\n\n# Build artifacts\n.next\nbuild\ndist\n.git\n.github\n.turbo\n.changeset\n.eslintcache\n\n# Debug logs\nnpm-debug.log*\nyarn-debug.log*\n\n#-------------------------------------------------------------------------------\n# Testing\n#-------------------------------------------------------------------------------\n\n# Test coverage reports and config snapshots\ncoverage\n*.test.*\n*.e2e.*\n\n#-------------------------------------------------------------------------------\n# Editor and IDE configuration\n#-------------------------------------------------------------------------------\n\n# IDE project files\n.idea\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n\n#-------------------------------------------------------------------------------\n# Operating system files\n#-------------------------------------------------------------------------------\n\n# System metadata files\n.DS_Store\nThumbs.db\n\n#-------------------------------------------------------------------------------\n# Deployment\n#-------------------------------------------------------------------------------\n\n# Vercel deployment configuration\n.vercel\n`,\n description: \"Ignore files that should not be deployed to Vercel\",\n },\n ],\n formatting: [\n {\n path: \"prettier.config.mjs\",\n content: `/**\n * @see https://prettier.io/docs/en/configuration.html\n * @type {import('prettier').Config}\n */\nconst config = {\n plugins: [\"prettier-plugin-packagejson\", \"prettier-plugin-tailwindcss\"],\n printWidth: 100,\n tailwindAttributes: [\"classNames\"],\n tailwindFunctions: [\"tv\"],\n};\n\nexport default config;\n`,\n description: \"Prettier configuration for source code formatting\",\n },\n {\n path: \".editorconfig\",\n content: `# https://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\ninsert_final_newline = true\n\nend_of_line = lf\nindent_style = space\nindent_size = 2\nmax_line_length = 120\n\ntrim_trailing_whitespace = true\n\n[Makefile]\nindent_style = tab\n\n[{go.mod,go.sum,*.go}]\nindent_style = tab\n\n[*.rs]\n# Keep in sync with rustfmt\nindent_size = 4\n`,\n description: \"Editor configuration for source code formatting\",\n },\n {\n path: \".prettierignore\",\n content: `# changesets\n.changeset\n\n# debug\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n.pnpm-debug.log*\n\n# lock files\npackage-lock.json\nyarn.lock\npnpm-lock.yaml\n`,\n description: \"\",\n },\n ],\n linting: [\n {\n path: \"commitlint.config.mjs\",\n content: `/**\n * @see https://commitlint.js.org/reference/configuration.html\n * @type {import('@commitlint/types').UserConfig}\n */\nconst config = {\n extends: [\"@commitlint/config-conventional\"],\n rules: {\n \"body-max-line-length\": [2, \"always\", 350],\n },\n};\n\nexport default config;\n`,\n description: \"Commitlint configuration\",\n },\n {\n path: \"eslint.config.mjs\",\n content: `import { config } from \"@codefast/eslint-config/next\";\n\n/**\n * @see https://eslint.org/docs/latest/use/configure/configuration-files\n * @type {import('eslint').Linter.Config[]}\n */\nconst eslintConfig = [...config];\n\nexport default eslintConfig;\n`,\n description: \"ESLint configuration for the project\",\n },\n {\n path: \"lint-staged.config.mjs\",\n content: `import { relative } from \"node:path\";\n\n/**\n * Builds an ESLint command with the given filenames.\n *\n * @param {string[]} filenames - An array of filenames to be passed to the\n * ESLint command.\n * @returns {string} - The generated ESLint command.\n */\nfunction buildEslintCommand(filenames) {\n return \\`next lint --fix --max-warnings 0 --file \\${filenames.map((file) => relative(import.meta.dirname, file)).\n join(\" --file \")}\\`;\n}\n\n/**\n * @see https://www.npmjs.com/package/lint-staged\n * @type {import('lint-staged').Configuration}\n */\nconst config = {\n \"*.{js,mjs,jsx,ts,tsx}\": [buildEslintCommand, \"prettier --list-different --write\"],\n \"*.{json,css,md,mdx}\": [\"prettier --list-different --write\"],\n};\n\nexport default config;\n`,\n description: \"Configure lint-staged for pre-commit checks\",\n },\n ],\n styles: [\n {\n path: \"src/lib/fonts.ts\",\n content: `import { cn } from \"@codefast/ui\";\nimport { Geist, Geist_Mono as GeistMono } from \"next/font/google\";\n\nconst fontGeistSans = Geist({\n subsets: [\"latin\"],\n variable: \"--font-geist-sans\",\n});\n\nconst fontGeistMono = GeistMono({\n subsets: [\"latin\"],\n variable: \"--font-geist-mono\",\n});\n\nexport const fontVariables = cn(fontGeistSans.variable, fontGeistMono.variable);\n`,\n description: \"Font configuration for the application\",\n },\n {\n path: \"src/app/globals.css\",\n content: `@import \"tailwindcss\";\n\n@import \"@codefast/ui/styles.css\";\n\n@source '../../node_modules/@codefast/ui';\n\n@custom-variant dark (&:where(.dark, .dark *));\n\n@layer base {\n :root {\n --font-sans: var(--font-geist-sans);\n --font-mono: var(--font-geist-mono);\n\n --input: var(--color-neutral-200);\n --border: var(--color-neutral-200);\n --ring: var(--color-neutral-400);\n --background: var(--color-white);\n --foreground: var(--color-neutral-950);\n --primary: var(--color-sky-500);\n --primary-foreground: var(--color-neutral-50);\n --secondary: var(--color-neutral-100);\n --secondary-foreground: var(--color-neutral-900);\n --destructive: var(--color-red-600);\n --accent: var(--color-neutral-100);\n --accent-foreground: var(--color-neutral-900);\n --muted: var(--color-neutral-100);\n --muted-foreground: var(--color-neutral-500);\n --popover: var(--color-white);\n --popover-foreground: var(--color-neutral-950);\n --popover-overlay: --alpha(var(--color-neutral-900) / 20%);\n --card: var(--color-white);\n --card-foreground: var(--color-neutral-950);\n --sidebar: var(--color-neutral-50);\n --sidebar-foreground: var(--color-neutral-950);\n --sidebar-primary: var(--color-sky-500);\n --sidebar-primary-foreground: var(--color-neutral-50);\n --sidebar-accent: var(--color-neutral-100);\n --sidebar-accent-foreground: var(--color-neutral-900);\n --sidebar-border: var(--color-neutral-200);\n --sidebar-ring: var(--color-neutral-400);\n --chart-1: var(--color-orange-600);\n --chart-2: var(--color-teal-600);\n --chart-3: var(--color-cyan-600);\n --chart-4: var(--color-amber-600);\n --chart-5: var(--color-amber-500);\n }\n\n .dark {\n --input: var(--color-neutral-700);\n --border: --alpha(var(--color-neutral-700) / 50%);\n --ring: var(--color-neutral-500);\n --background: var(--color-neutral-950);\n --foreground: var(--color-neutral-50);\n --primary: var(--color-sky-700);\n --primary-foreground: var(--color-neutral-50);\n --secondary: var(--color-neutral-800);\n --secondary-foreground: var(--color-neutral-50);\n --destructive: var(--color-red-400);\n --accent: var(--color-neutral-700);\n --accent-foreground: var(--color-neutral-50);\n --muted: var(--color-neutral-800);\n --muted-foreground: var(--color-neutral-400);\n --popover: var(--color-neutral-800);\n --popover-foreground: var(--color-neutral-50);\n --popover-overlay: --alpha(var(--color-neutral-900) / 80%);\n --card: var(--color-neutral-900);\n --card-foreground: var(--color-neutral-50);\n --sidebar: var(--color-neutral-900);\n --sidebar-foreground: var(--color-neutral-50);\n --sidebar-primary: var(--color-sky-700);\n --sidebar-primary-foreground: var(--color-neutral-50);\n --sidebar-accent: var(--color-neutral-800);\n --sidebar-accent-foreground: var(--color-neutral-50);\n --sidebar-border: var(--color-neutral-800);\n --sidebar-ring: var(--color-neutral-600);\n --chart-1: var(--color-blue-700);\n --chart-2: var(--color-emerald-500);\n --chart-3: var(--color-amber-500);\n --chart-4: var(--color-purple-500);\n --chart-5: var(--color-rose-500);\n }\n}\n`,\n description: \"Global CSS variables for the application\",\n },\n ],\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { configGroups } from \"@/commands/create-project/constants\";\nimport { FileUtils, getErrorMessage } from \"@/commands/create-project/utils\";\n\n/**\n * Updates a file if it exists and doesn't already have the specified modifications\n */\nfunction updateFileIfNeeded(\n filePath: string,\n filename: string,\n checkFn: (content: string) => boolean,\n updateFn: (content: string) => string,\n successMessage: string,\n alreadyUpdatedMessage: string,\n): void {\n if (!FileUtils.validatePath(filePath, filename)) {\n return;\n }\n\n const content = FileUtils.readFile(filePath);\n\n if (checkFn(content)) {\n console.log(`📝 ${alreadyUpdatedMessage}`);\n\n return;\n }\n\n try {\n const updatedContent = updateFn(content);\n\n FileUtils.writeFile(filePath, updatedContent);\n console.log(`📝 ${successMessage}`);\n } catch (error) {\n console.warn(`⚠️ Failed to update ${filename}: ${getErrorMessage(error)}`);\n }\n}\n\n/**\n * Updates the PostCSS configuration file by adding a type comment for improved editor support\n */\nexport function updatePostcssConfig(projectDir: string): void {\n const postcssConfigPath = path.join(projectDir, \"postcss.config.mjs\");\n const typeComment = `/** @type {import('postcss-load-config').Config} */\\n`;\n\n updateFileIfNeeded(\n postcssConfigPath,\n \"postcss.config.mjs\",\n (content) => content.includes(typeComment),\n (content) => content.replace(\"const config = {\", `${typeComment}const config = {`),\n \"Updated postcss.config.mjs with type comment.\",\n \"postcss.config.mjs already contains type comment, no changes made.\",\n );\n}\n\n/**\n * Updates the layout file to use fontVariables and apply proper configurations\n */\nexport function updateLayoutFile(projectDir: string): void {\n const layoutPath = path.join(projectDir, \"src/app/layout.tsx\");\n const htmlTarget = '<html className={cn(fontVariables, \"antialiased\")} lang=\"en\">';\n\n updateFileIfNeeded(\n layoutPath,\n \"src/app/layout.tsx\",\n (content) => content.includes(htmlTarget),\n (content) => {\n // Import replacements\n const newImports = `import type { Metadata } from \"next\";\nimport type { JSX, ReactNode } from \"react\";\nimport { cn } from \"@codefast/ui\";\nimport { fontVariables } from \"@/lib/fonts\";\nimport \"@/app/globals.css\";`;\n\n let result = content;\n\n // Remove existing font imports and definitions\n result = result.replaceAll(/import\\s+{[^}]+}\\s+from\\s+[\"']next\\/font\\/google[\"'];\\s*/g, \"\");\n result = result.replace(/const\\s+geistSans\\s*=[^;]+;\\s*const\\s+geistMono\\s*=[^;]+;\\s*/, \"\");\n result = result.replace(\n /import\\s+type\\s+{[^}]+}\\s+from\\s+[\"']next[\"'];\\s*import\\s+[\"']\\.\\/globals\\.css[\"'];\\s*/,\n newImports,\n );\n\n // Update React.ReactNode to ReactNode and add a return type\n result = result.replace(\n /export default function RootLayout\\({\\s*children,\\s*}\\s*:\\s*Readonly<{\\s*children:\\s*React\\.ReactNode;\\s*}>\\)\\s*{/,\n `export default function RootLayout({ children }: Readonly<{ children: ReactNode }>): JSX.Element {`,\n );\n\n // Update HTML and body tags\n result = result.replace(/<html\\s+lang=\"en\"\\s*>/, htmlTarget);\n result = result.replace(/<body\\s+className={`[^`]*`}\\s*>/, `<body>`);\n\n return result;\n },\n \"Updated src/app/layout.tsx to use fontVariables in html tag, removed className from body, modified ReactNode import, and added return type to RootLayout\",\n \"src/app/layout.tsx already uses fontVariables in html tag, no changes made.\",\n );\n}\n\n/**\n * Updates the scripts and hooks in the package.json file\n */\nexport function updatePackageJson(projectDir: string): void {\n const packageJsonPath = path.join(projectDir, \"package.json\");\n\n if (!FileUtils.validatePath(packageJsonPath, \"package.json\")) {\n return;\n }\n\n try {\n const packageJson = JSON.parse(FileUtils.readFile(packageJsonPath));\n\n packageJson.scripts = {\n ...packageJson.scripts,\n \"deploy:preview\": \"vercel deploy --archive=tgz\",\n \"deploy:prod\": \"vercel deploy --archive=tgz --prod\",\n format: \"prettier --write --ignore-unknown .\",\n \"format:check\": \"prettier --check --ignore-unknown .\",\n lint: \"next lint --fix --max-warnings 0\",\n \"lint:check\": \"next lint --max-warnings 0\",\n \"package:install\": \"pnpm install\",\n \"package:outdated\": \"pnpm outdated\",\n \"package:upgrade\": \"pnpm update --latest\",\n preview: \"pnpm build && pnpm start\",\n };\n\n packageJson[\"simple-git-hooks\"] = {\n \"pre-commit\": \"pnpm lint-staged\",\n \"commit-msg\": \"pnpm commitlint --edit\",\n };\n\n FileUtils.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));\n console.log(`📝 Updated package.json`);\n } catch (error) {\n console.warn(`⚠️ Failed to update package.json: ${getErrorMessage(error)}`);\n }\n}\n\n/**\n * Updates the Next.js configuration file to add experimental optimizePackageImports\n */\nexport function updateNextConfig(projectDir: string): void {\n const nextConfigPath = path.join(projectDir, \"next.config.ts\");\n const optimizePackagesConfig = 'optimizePackageImports: [\"@codefast/ui\"]';\n\n updateFileIfNeeded(\n nextConfigPath,\n \"next.config.ts\",\n (content) => content.includes(optimizePackagesConfig),\n (content) =>\n content.replace(\n /const nextConfig: NextConfig = \\{/,\n `const nextConfig: NextConfig = {\n experimental: {\n optimizePackageImports: [\"@codefast/ui\"],\n },`,\n ),\n \"Updated next.config.ts with optimizePackageImports configuration.\",\n \"next.config.ts already contains optimizePackageImports configuration, no changes made.\",\n );\n}\n\n/**\n * Updates the page.tsx file by adding JSX.Element return type to the Home component\n */\nexport function updatePageFile(projectDir: string): void {\n const pagePath = path.join(projectDir, \"src/app/page.tsx\");\n\n updateFileIfNeeded(\n pagePath,\n \"src/app/page.tsx\",\n (content) => content.includes(\"): JSX.Element\"),\n (content) => {\n let result = content;\n\n // Add JSX import if not present\n if (!result.includes(\"import type { JSX }\")) {\n if (result.includes(\"import type {\")) {\n // Add JSX to existing type import\n result = result.replace(\n /import type {(?<types>[^}]+)} from \"react\";/,\n 'import type {$1, JSX } from \"react\";',\n );\n } else if (result.includes(\"import {\")) {\n // Add type import before the first import\n result = result.replace(/import {/, 'import type { JSX } from \"react\";\\n\\nimport {');\n } else {\n // Add type import at the beginning of the file\n result = `import type { JSX } from \"react\";\\n\\n${result}`;\n }\n }\n\n // Add JSX.Element return type to the Home component\n result = result.replace(/export default function Home\\(\\) {/, \"export default function Home(): JSX.Element {\");\n\n return result;\n },\n \"Updated src/app/page.tsx to add JSX.Element return type to Home component\",\n \"src/app/page.tsx already has JSX.Element return type, no changes made.\",\n );\n}\n\n/**\n * Creates configuration files in the specified project directory\n */\nexport function createConfigFiles(projectDir: string): void {\n console.log(`\\n📝 Creating configuration files...`);\n\n // Iterate through each configuration category (linting, formatting, styles)\n for (const [category, configs] of Object.entries(configGroups)) {\n console.log(`\\n📂 Setting up ${category} configurations:`);\n\n for (const { path: filePath, content, description } of configs) {\n const fullPath = path.join(projectDir, filePath);\n const dir = path.dirname(fullPath);\n\n // Create a directory if it doesn't exist\n if (!FileUtils.exists(dir)) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n // Write the configuration file and log its description\n FileUtils.writeConfigFile(fullPath, content);\n\n if (description) {\n console.log(` ℹ️ ${filePath}: ${description}`);\n }\n }\n }\n}\n","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport { DEV_DEPENDENCIES, MAIN_DEPENDENCIES, PACKAGES_TO_REMOVE } from \"@/commands/create-project/constants\";\nimport { getErrorMessage, runCommand } from \"@/commands/create-project/utils\";\n\n/**\n * Installs project dependencies and development tools required for the application.\n *\n * This function handles the installation of both runtime and development dependencies\n * using the package manager. It ensures the necessary libraries and tools are added to the project\n * for proper operation and coding standards enforcement.\n *\n * @returns void - Does not return a value.\n */\nexport function installDependencies(): void {\n console.log(`\\n📚 Installing dependencies...`);\n\n // Install main dependencies\n if (MAIN_DEPENDENCIES.length > 0) {\n runCommand(`pnpm add ${MAIN_DEPENDENCIES.join(\" \")}`);\n }\n\n // Install development dependencies\n const allDevDependencies = Object.values(DEV_DEPENDENCIES).flat().join(\" \");\n\n if (allDevDependencies) {\n runCommand(`pnpm add -D ${allDevDependencies}`);\n }\n}\n\n/**\n * Removes unnecessary packages that might conflict with the project configuration\n * or are redundant due to alternative packages being used.\n *\n * @returns void - Does not return a value.\n */\nexport function cleanupPackages(): void {\n console.log(`\\n🧹 Cleaning up unnecessary packages...`);\n\n // Read package.json to check existing dependencies\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n\n if (!fs.existsSync(packageJsonPath)) {\n console.warn(`⚠️ package.json not found, skipping cleanup.`);\n\n return;\n }\n\n let packageJson;\n\n try {\n packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\"));\n } catch (error) {\n console.warn(`⚠️ Error reading package.json: ${getErrorMessage(error)}, skipping cleanup.`);\n\n return;\n }\n\n // Get existing dependencies and devDependencies\n const dependencies = packageJson.dependencies ?? {};\n const devDependencies = packageJson.devDependencies ?? {};\n\n // Filter packages to remove only those that exist in package.json\n const packagesToRemove = PACKAGES_TO_REMOVE.filter((pkg) => pkg in dependencies || pkg in devDependencies);\n\n if (packagesToRemove.length > 0) {\n runCommand(`pnpm remove ${packagesToRemove.join(\" \")}`);\n } else {\n console.log(`ℹ️ No unnecessary packages found in package.json to remove.`);\n }\n}\n","import { execSync } from \"node:child_process\";\n\n/**\n * Checks the current environment to ensure PNPM is installed.\n * If PNPM is not detected, logs an error message and terminates the process.\n *\n * @returns void\n */\nexport function checkEnvironment(): void {\n try {\n execSync(\"pnpm --version\", { stdio: \"ignore\" });\n } catch {\n console.error(`❌ PNPM chưa được cài đặt. Vui lòng cài đặt PNPM trước.`);\n process.exit(1);\n }\n}\n","import { runCommand } from \"@/commands/create-project/utils\";\n\n/**\n * Creates a new Next.js project with predefined configuration flags.\n *\n * @param projectName - The name of the project to be created.\n * @returns void\n */\nexport function createNextProject(projectName: string): void {\n console.log(`📦 Creating Next.js project...`);\n const flags = [\n \"--ts\",\n \"--tailwind\",\n \"--eslint\",\n \"--app\",\n \"--turbo\",\n \"--use-pnpm\",\n \"--src-dir\",\n \"--turbopack\",\n '--import-alias \"@/*\"',\n ].join(\" \");\n\n runCommand(`npx create-next-app@latest ${projectName} ${flags}`);\n}\n","import type { Command } from \"commander\";\n\nimport { checkExistingProject } from \"@/commands/create-project/check-existing-project\";\nimport {\n createConfigFiles,\n updateLayoutFile,\n updateNextConfig,\n updatePackageJson,\n updatePageFile,\n updatePostcssConfig,\n} from \"@/commands/create-project/config-files\";\nimport { cleanupPackages, installDependencies } from \"@/commands/create-project/dependencies\";\nimport { checkEnvironment } from \"@/commands/create-project/environment\";\nimport { createNextProject } from \"@/commands/create-project/next-project\";\nimport { getErrorMessage, rl, runCommand } from \"@/commands/create-project/utils\";\n\n/**\n * Sets up the \"create-project\" command in the provided CLI program. This command allows users\n * to create a new Next.js project with a recommended configuration.\n *\n * The \"create-project\" command includes features such as scaffolding a Next.js project, applying\n * TypeScript, TailwindCSS, ESLint, Prettier, Git hooks, and other tools, ensuring a streamlined\n * development experience.\n *\n * @param program - The CLI program instance in which the command will be registered.\n */\nexport function createProjectCommand(program: Command): void {\n program\n .command(\"create-project [name]\")\n .description(\"Create a new Next.js project with recommended setup\")\n .action(async (projectNameArg) => {\n try {\n // Check environment (PNPM, write permissions)\n checkEnvironment();\n\n // Check if package.json exists and get the project name\n const { projectName, packageJsonExists } = await checkExistingProject(projectNameArg);\n\n if (!packageJsonExists) {\n console.log(`\\n🚀 Starting project creation for ${projectName}...\\n`);\n createNextProject(projectName);\n process.chdir(projectName);\n console.log(`📂 Moved to ${projectName}`);\n }\n\n // Update layout.tsx to use fontVariables\n updateLayoutFile(process.cwd());\n\n // Update page.tsx to add JSX.Element return types\n updatePageFile(process.cwd());\n\n // Edit the postcss.config.mjs file\n updatePostcssConfig(process.cwd());\n\n // Install dependencies\n installDependencies();\n\n // Remove unwanted packages\n cleanupPackages();\n\n // Create configuration files\n createConfigFiles(process.cwd());\n\n // Update next.config.ts with experimental configuration\n updateNextConfig(process.cwd());\n\n // Update package.json\n updatePackageJson(process.cwd());\n\n // Enable git hooks\n console.log(`\\n🔄 Activating git hooks...`);\n runCommand(\"pnpm simple-git-hooks\");\n\n // Run Prettier to format the file\n console.log(`\\n📝 Formatting files with Prettier...`);\n runCommand(\"pnpm format\");\n\n // Run ESLint\n console.log(`\\n🔍 Running ESLint to check code style...`);\n runCommand(\"pnpm lint\");\n\n // Completion notice\n console.log(`\\n✅ Project ${packageJsonExists ? \"configured\" : \"created\"} successfully!`);\n console.log(`- Project: ${projectName}`);\n console.log(\"- Next.js with TypeScript\");\n console.log(\"- TailwindCSS and @codefast/ui\");\n console.log(\"- ESLint, Prettier, Commitlint, and Git Hooks\");\n console.log(\"- Lint-staged for pre-commit checks\");\n console.log(`\\n📁 Project directory: ${process.cwd()}`);\n console.log(`\\n🚀 To start development:`);\n console.log(`cd ${projectName} && pnpm dev`);\n } catch (error) {\n console.error(`\\n❌ An error occurred: ${getErrorMessage(error)}`);\n process.exit(1);\n } finally {\n // Close readline interface\n rl.close();\n }\n });\n}\n","import type { SourceFile } from \"ts-morph\";\n\nimport { Project } from \"ts-morph\";\n\nimport type { AnalysisResult, ImportPath, PackageConfig } from \"@/commands/update-exports/types\";\n\n/**\n * Creates a regex to remove specified prefixes from paths\n * @param prefixes - Array of prefixes to remove\n * @returns RegExp matching any prefix\n */\nfunction makeRegexPrefixesToRemove(prefixes: string[]): RegExp {\n // Matches: ^\\.?\\/?(prefix1|prefix2)\\/(.*)\n // - ^\\.?\\/? : Optional ./ or /\n // - (prefix1|prefix2): Any prefix from the list\n // - \\/(.*) : Remaining path after prefix\n const prefixPattern = prefixes.join(\"|\");\n\n return new RegExp(`^.?\\\\/?(?:${prefixPattern})\\\\/(.*)$`);\n}\n\n/**\n * Processes an export path by removing specified prefixes\n * @param modulePath - Path to process\n * @param regexPattern - Regex for prefix removal\n * @returns Processed path starting with ./\n */\nfunction processExportPath(modulePath: string, regexPattern: RegExp): string {\n let processedPath = modulePath;\n const match = processedPath.match(regexPattern);\n\n if (match) {\n const remainingPath = match[1];\n\n processedPath = remainingPath.startsWith(\"./\") ? remainingPath : `./${remainingPath}`;\n }\n\n return processedPath;\n}\n\n/**\n * Analyzes imports from an index.ts file\n * @param indexFilePath - Path to index.ts\n * @param packageConfig - Package configuration\n * @returns AnalysisResult containing import paths\n */\nexport function analyzeImports(indexFilePath: string, packageConfig: PackageConfig): AnalysisResult {\n const project = new Project();\n let sourceFile: SourceFile;\n\n try {\n sourceFile = project.addSourceFileAtPath(indexFilePath);\n } catch (error) {\n console.error(`Error loading source file at ${indexFilePath}:`, error);\n\n return { imports: [] };\n }\n\n const imports: ImportPath[] = [];\n const prefixesToRemove = packageConfig.exportPathPrefixesToRemove ?? [];\n const regexPattern = makeRegexPrefixesToRemove(prefixesToRemove);\n\n for (const exportDecl of sourceFile.getExportDeclarations()) {\n let moduleSpecifier = exportDecl.getModuleSpecifierValue();\n\n if (!moduleSpecifier) {\n continue;\n }\n\n // Normalize @/ to ./\n if (moduleSpecifier.startsWith(\"@/\")) {\n moduleSpecifier = `./${moduleSpecifier.slice(2)}`;\n }\n\n const isExternal = !moduleSpecifier.startsWith(\".\");\n\n if (isExternal) {\n continue;\n }\n\n const parts = moduleSpecifier.split(\"/\").filter(Boolean);\n\n if (parts.length < 2) {\n continue;\n }\n\n let directory;\n\n if (parts.length <= 1) {\n directory = \".\";\n } else {\n directory = parts.slice(0, -1).join(\"/\");\n\n if (directory.startsWith(\"./\")) {\n directory = directory.slice(2);\n }\n }\n\n const name = parts.at(-1) ?? \"\";\n\n const importPath: ImportPath = {\n originalPath: moduleSpecifier,\n directory,\n name,\n exportPath: processExportPath(moduleSpecifier, regexPattern),\n };\n\n imports.push(importPath);\n }\n\n return { imports };\n}\n","import { z } from \"zod\";\n\n/**\n * Represents the schema for package configuration.\n *\n * @param cjsOutputPattern - A string specifying the output pattern for the CommonJS format.\n * @param esmOutputPattern - A string specifying the output pattern for the ESM format.\n * @param packageJsonPath - A string representing the path to the package.json file.\n * @param srcIndexPath - A string specifying the path to the source index file.\n * @param typesOutputCjsPattern - A string defining the output pattern for type declarations in the CommonJS format.\n * @param typesOutputPattern - A string defining the output pattern for type declarations in general.\n * @param exportPathPrefixesToRemove - An optional array of strings specifying prefixes to remove from export paths.\n */\nexport const PackageConfigSchema = z.interface({\n cjsOutputPattern: z.string(),\n esmOutputPattern: z.string(),\n packageJsonPath: z.string(),\n srcIndexPath: z.string(),\n typesOutputCjsPattern: z.string(),\n typesOutputPattern: z.string(),\n \"exportPathPrefixesToRemove?\": z.array(z.string()),\n});\n\n/**\n * Represents the schema structure for the script configuration.\n *\n * This schema outlines the required and optional fields necessary for defining\n * configurations for custom packages, default package settings, and the pattern\n * used for finding package files.\n *\n * @param customPackageConfigs - A record where keys are strings and values are partials of PackageConfigSchema giving\n * the configurations for custom packages. This allows defining overrides or additional\n * configuration for specific packages.\n * @param defaultPackageConfig - The default package configuration, uniformly applied unless overridden by customPackageConfigs.\n * @param packagesGlob - A string indicating the glob pattern used to identify package files.\n */\nexport const ScriptConfigSchema = z.interface({\n customPackageConfigs: z.record(z.string(), PackageConfigSchema.partial()),\n defaultPackageConfig: PackageConfigSchema,\n packagesGlob: z.string(),\n});\n\n/**\n * Represents the configuration settings for a package.\n *\n * This type is derived from the `PackageConfigSchema` using the `zod` library.\n *\n * @typeParam T - The inferred type of the package configuration schema.\n *\n * @returns The inferred type from `PackageConfigSchema` representing the package configuration.\n */\nexport type PackageConfig = z.infer<typeof PackageConfigSchema>;\n/**\n * Represents the configuration for a script based on the `ScriptConfigSchema`.\n * This type infers its structure using `z.infer`.\n *\n * @typeParam T - The type inferred from the schema definition.\n *\n * @returns The inferred type that matches the schema.\n */\nexport type ScriptConfig = z.infer<typeof ScriptConfigSchema>;\n\n/**\n * Represents an import path for a module or file, including its directory, export path, name, and original path.\n *\n * @param directory - The directory containing the import.\n * @param exportPath - The resolved path of the export from the directory.\n * @param name - The name of the import.\n * @param originalPath - The original unresolved path of the import as provided in the source.\n */\nexport interface ImportPath {\n directory: string;\n exportPath: string;\n name: string;\n originalPath: string;\n}\n\n/**\n * Represents the result of an analysis process, including the identified import paths.\n *\n * @typeParam ImportPath - The type representing an individual import path.\n */\nexport interface AnalysisResult {\n imports: ImportPath[];\n}\n\n/**\n * Represents the configuration settings for exporting modules in different formats.\n *\n * This interface defines the required structure for specifying export configurations\n * in terms of import and require formats, including default exports and type exports.\n */\nexport interface ExportConfig {\n import: {\n default: string;\n types: string;\n };\n require: {\n default: string;\n types: string;\n };\n}\n\n/**\n * Represents a target for export, which can either be an `ExportConfig` object\n * or a string defining the target.\n *\n * @typeParam ExportConfig - Defines the configuration type for export when not using a string as a target.\n */\nexport type ExportTarget = ExportConfig | string;\n/**\n * Represents the structure of package exports, mapping export paths to their targets.\n *\n * This type is primarily used to define a dictionary where the keys are export paths\n * (strings) and the values are the targets to which these paths resolve.\n *\n * @typeParam ExportTarget - The type representing the value of each export target.\n * @returns A record that maps export path strings to their corresponding export targets.\n */\nexport type PackageExports = Record<string, ExportTarget>;\n\n/**\n * Represents the structure of a `package.json` file in a Node.js project.\n *\n * This interface defines the essential fields for describing a package, such as its name, version,\n * and an optional `exports` field used for specifying module exports.\n *\n * @typeParam T - An optional type parameter for customizing the `exports` field (if applicable).\n * @returns An object adhering to the `PackageJson` structure.\n */\nexport interface PackageJson {\n name: string;\n version: string;\n exports?: PackageExports;\n}\n\n/**\n * Represents the configuration options for a process.\n *\n * The `ProcessOptions` interface allows the customization of process behavior\n * through various optional parameters.\n *\n * @param dryRun - Indicates if the process should run in a simulation mode without making changes.\n * @param configPath - Specifies the file path to a configuration file, if provided.\n * @param packageFilter - Filters packages that should be processed, if specified.\n */\nexport interface ProcessOptions {\n dryRun: boolean;\n configPath?: string;\n packageFilter?: string;\n}\n","import { merge } from \"lodash-es\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { PackageConfig, ScriptConfig } from \"@/commands/update-exports/types\";\n\nimport { ScriptConfigSchema } from \"@/commands/update-exports/types\";\n\n// Cache for storing configuration to avoid repeated file reads\nlet cachedConfig: null | ScriptConfig = null;\n\n/**\n * Loads and validates configuration from a file\n * @param configPath - Optional path to the config file\n * @returns Partial ScriptConfig or empty object if not found/invalid\n */\nfunction loadConfigFile(configPath?: string): Partial<ScriptConfig> {\n if (!configPath) {\n return {};\n }\n\n try {\n const fullPath = path.resolve(configPath);\n\n if (!fs.existsSync(fullPath)) {\n console.warn(`Configuration file not found at ${fullPath}`);\n\n return {};\n }\n\n const configContent = fs.readFileSync(fullPath, \"utf8\");\n const config = JSON.parse(configContent);\n\n // Validate against schema\n return ScriptConfigSchema.parse(config);\n } catch (error) {\n console.error(\"Error reading configuration file:\", error);\n\n return {};\n }\n}\n\n/**\n * Retrieves merged configuration, using cache if no path is provided\n * @param configPath - Optional path to override default config\n * @returns Merged ScriptConfig\n */\nexport function getConfig(configPath?: string): ScriptConfig {\n if (cachedConfig && !configPath) {\n return cachedConfig;\n }\n\n const userConfig = loadConfigFile(configPath);\n const config = merge({}, defaultConfig, userConfig) as ScriptConfig;\n\n // Cache config if no path is provided\n if (!configPath) {\n cachedConfig = config;\n }\n\n return config;\n}\n\n/**\n * Retrieves configuration for a specific package\n * @param packageName - Name of the package\n * @param config - Optional ScriptConfig to use\n * @returns PackageConfig combining defaults and custom settings\n */\nexport function getPackageConfig(packageName: string, config?: ScriptConfig): PackageConfig {\n const configObj = config ?? getConfig();\n const customConfig = configObj.customPackageConfigs[packageName] ?? {};\n\n return {\n ...configObj.defaultPackageConfig,\n ...customConfig,\n };\n}\n\n// Default configuration for the script\nexport const defaultConfig: ScriptConfig = {\n packagesGlob: \"./packages/**/package.json\",\n defaultPackageConfig: {\n cjsOutputPattern: \"./dist/cjs/{dir}/{name}.cjs\",\n esmOutputPattern: \"./dist/esm/{dir}/{name}.js\",\n packageJsonPath: \"package.json\",\n srcIndexPath: \"src/index.ts\",\n typesOutputCjsPattern: \"./dist/types/{dir}/{name}.d.ts\",\n typesOutputPattern: \"./dist/types/{dir}/{name}.d.ts\",\n },\n customPackageConfigs: {\n \"@codefast/ui\": {\n exportPathPrefixesToRemove: [\"components\"],\n },\n \"@codefast/style-guide\": {\n exportPathPrefixesToRemove: [\"configs\"],\n },\n },\n};\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { AnalysisResult, PackageExports, PackageJson } from \"@/commands/update-exports/types\";\n\n// Constants for file operations\nconst EXPORTS_ANALYSIS_DIR = \".exports-analysis\";\nconst EXPORTS_PREVIEW_FILE = \"exports-preview.json\";\nconst EXPORTS_ANALYSIS_FILE = \"exports-analysis.json\";\nconst ENCODING = \"utf8\";\nconst JSON_INDENT = 2;\n/**\n * Utility functions for file and directory operations\n */\nconst FileUtils = {\n /**\n * Checks if a file exists\n * @param filePath - Path to check\n * @returns True if a file exists\n */\n exists(filePath: string): boolean {\n return fs.existsSync(filePath);\n },\n\n /**\n * Creates a directory if it doesn't exist\n * @param dirPath - Directory path\n */\n ensureDirectoryExists(dirPath: string): void {\n if (!fs.existsSync(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n },\n\n /**\n * Reads and parses a JSON file\n * @param filePath - Path to JSON file\n * @returns Parsed content or null if error\n */\n readJsonFile<T>(filePath: string): null | T {\n try {\n const content = fs.readFileSync(filePath, ENCODING);\n\n return JSON.parse(content) as T;\n } catch (error) {\n console.error(`Error reading JSON file at ${filePath}:`, error);\n\n return null;\n }\n },\n\n /**\n * Writes content to a JSON file\n * @param filePath - Path to write\n * @param content - Content to write\n * @returns True if successful\n */\n writeJsonFile<T>(filePath: string, content: T): boolean {\n try {\n fs.writeFileSync(filePath, `${JSON.stringify(content, null, JSON_INDENT)}\\n`, ENCODING);\n\n return true;\n } catch (error) {\n console.error(`Error writing JSON file at ${filePath}:`, error);\n\n return false;\n }\n },\n\n /**\n * Gets the exports analysis directory path\n * @param packageDir - Package directory\n * @returns Analysis directory path\n */\n getAnalysisDir(packageDir: string): string {\n const outputDir = path.join(packageDir, EXPORTS_ANALYSIS_DIR);\n\n this.ensureDirectoryExists(outputDir);\n\n return outputDir;\n },\n\n /**\n * Creates a timestamped backup filename\n * @param baseFilename - Original filename\n * @returns Backup filename with timestamp\n */\n createBackupFilename(baseFilename: string): string {\n const timestamp = new Date().toISOString().replaceAll(/[:.]/g, \"-\");\n\n return `${baseFilename}.backup.${timestamp}`;\n },\n};\n\n/**\n * Checks if a file exists\n * @param filePath - Path to check\n * @returns True if a file exists\n */\nexport function fileExists(filePath: string): boolean {\n return FileUtils.exists(filePath);\n}\n\n/**\n * Reads and parses package.json content\n * @param filePath - Path to package.json\n * @returns Parsed PackageJson or null if error\n */\nexport function readPackageJson(filePath: string): null | PackageJson {\n return FileUtils.readJsonFile<PackageJson>(filePath);\n}\n\n/**\n * Creates a backup of package.json\n * @param filePath - Path to package.json\n * @returns True if backup was successful\n */\nexport function backupPackageJson(filePath: string): boolean {\n try {\n const content = fs.readFileSync(filePath, ENCODING);\n const dir = path.dirname(filePath);\n const backupDir = path.join(dir, EXPORTS_ANALYSIS_DIR);\n\n FileUtils.ensureDirectoryExists(backupDir);\n\n const baseName = path.basename(filePath);\n const backupPath = path.join(backupDir, FileUtils.createBackupFilename(baseName));\n\n fs.writeFileSync(backupPath, content, ENCODING);\n\n return true;\n } catch (error) {\n console.error(`Error backing up package.json at ${filePath}:`, error);\n\n return false;\n }\n}\n\n/**\n * Saves updated package.json content\n * @param filePath - Path to package.json\n * @param content - Updated content\n * @returns True if save was successful\n */\nexport function savePackageJson(filePath: string, content: PackageJson): boolean {\n return FileUtils.writeJsonFile(filePath, content);\n}\n\n/**\n * Saves the given JSON content to a specified file within the analysis directory.\n *\n * @param packageDir - The root directory where the analysis directory resides.\n * @param fileName - The name of the file to which the JSON content will be written.\n * @param content - The JSON content to save to the file.\n */\nexport function saveJsonToFile<T>(packageDir: string, fileName: string, content: T): void {\n const outputDir = FileUtils.getAnalysisDir(packageDir);\n\n FileUtils.writeJsonFile(path.join(outputDir, fileName), content);\n}\n\n/**\n * Saves exports analysis results\n * @param packageDir - Package directory\n * @param analysis - Analysis results\n */\nexport function saveExportsAnalysis(packageDir: string, analysis: AnalysisResult): void {\n saveJsonToFile(packageDir, EXPORTS_ANALYSIS_FILE, analysis);\n}\n\n/**\n * Saves preview of generated exports\n * @param packageDir - Package directory\n * @param exports - Generated exports\n */\nexport function saveExportsPreview(packageDir: string, exports: PackageExports): void {\n saveJsonToFile(packageDir, EXPORTS_PREVIEW_FILE, exports);\n}\n","import type { ImportPath, PackageExports, ScriptConfig } from \"@/commands/update-exports/types\";\n\nimport { getPackageConfig } from \"@/commands/update-exports/config\";\n\n/**\n * Formats an output path based on a pattern, directory, and name\n * @param pattern - Output pattern\n * @param directory - Directory path\n * @param name - Module name\n * @returns Formatted output path\n */\nfunction formatOutputPath(pattern: string, directory: string, name: string): string {\n const dirPart = directory === \".\" ? \"\" : `${directory}/`;\n\n return pattern.replace(\"{dir}/\", dirPart).replace(\"{dir}\", directory).replace(\"{name}\", name);\n}\n\n/**\n * Generates export structure for package.json\n * @param packageName - Name of the package\n * @param imports - Analyzed import paths\n * @param existingExports - Current exports to preserve\n * @param config - Optional ScriptConfig\n * @returns Updated PackageExports\n */\nexport function generateExports(\n packageName: string,\n imports: ImportPath[],\n existingExports: PackageExports = {},\n config?: ScriptConfig,\n): PackageExports {\n const packageConfig = getPackageConfig(packageName, config);\n\n const exports: PackageExports = {\n \".\": existingExports[\".\"] ?? {\n import: {\n types: \"./dist/types/index.d.ts\",\n default: \"./dist/esm/index.js\",\n },\n require: {\n types: \"./dist/types/index.d.cts\",\n default: \"./dist/cjs/index.cjs\",\n },\n },\n };\n\n // Preserve existing CSS exports\n if (existingExports[\"./styles.css\"]) {\n exports[\"./styles.css\"] = existingExports[\"./styles.css\"];\n }\n\n // Generate exports for each import path\n for (const importPath of imports) {\n const { directory, name, exportPath } = importPath;\n\n const esmOutput = formatOutputPath(packageConfig.esmOutputPattern, directory, name);\n const cjsOutput = formatOutputPath(packageConfig.cjsOutputPattern, directory, name);\n const typesOutput = formatOutputPath(packageConfig.typesOutputPattern, directory, name);\n const typesCjsOutput = formatOutputPath(packageConfig.typesOutputCjsPattern, directory, name);\n\n exports[exportPath] = {\n import: {\n types: typesOutput,\n default: esmOutput,\n },\n require: {\n types: typesCjsOutput,\n default: cjsOutput,\n },\n };\n }\n\n return exports;\n}\n","import { glob } from \"glob\";\nimport path from \"node:path\";\n\nimport type { ProcessOptions, ScriptConfig } from \"@/commands/update-exports/types\";\n\nimport { analyzeImports } from \"@/commands/update-exports/analyze-imports\";\nimport { getConfig, getPackageConfig } from \"@/commands/update-exports/config\";\nimport {\n backupPackageJson,\n fileExists,\n readPackageJson,\n saveExportsAnalysis,\n saveExportsPreview,\n savePackageJson,\n} from \"@/commands/update-exports/file-utils\";\nimport { generateExports } from \"@/commands/update-exports/generate-exports\";\n\nconst DEFAULT_IGNORE_PATTERN = [\"**/node_modules/**\"];\n\n/**\n * Finds all package.json files in the workspace\n * @param config - Optional ScriptConfig\n * @returns Array of package.json paths\n */\nexport async function findAllPackages(config?: ScriptConfig): Promise<string[]> {\n const configObj = config ?? getConfig();\n\n return await glob(configObj.packagesGlob, {\n ignore: DEFAULT_IGNORE_PATTERN,\n });\n}\n\n/**\n * Processes a single package\n * @param packageJsonPath - Path to package.json\n * @param options - Processing options\n * @returns True if processing was successful\n */\nexport function processPackage(packageJsonPath: string, options: ProcessOptions): boolean {\n const packageDir = path.dirname(packageJsonPath);\n const packageJson = readPackageJson(packageJsonPath);\n\n if (!packageJson) {\n console.error(`Failed to read ${packageJsonPath}`);\n\n return false;\n }\n\n const packageName = packageJson.name;\n\n // Skip if package doesn't match filter\n if (options.packageFilter && packageName !== options.packageFilter) {\n console.debug(`Skipping ${packageName} (does not match filter)`);\n\n return false;\n }\n\n console.info(`Processing package: ${packageName}`);\n\n const config = getConfig(options.configPath);\n const packageConfig = getPackageConfig(packageName, config);\n const srcIndexPath = path.join(packageDir, packageConfig.srcIndexPath);\n\n if (!fileExists(srcIndexPath)) {\n console.error(`Source file not found at ${srcIndexPath}`);\n\n return false;\n }\n\n // Analyze imports\n console.info(`Analyzing imports from ${srcIndexPath}...`);\n const { imports } = analyzeImports(srcIndexPath, packageConfig);\n\n if (imports.length === 0) {\n console.warn(`No imports found to analyze in ${packageName}`);\n\n return false;\n }\n\n console.log(`Analysis complete. Found ${imports.length} subpath exports.`);\n\n // Save analysis results\n saveExportsAnalysis(packageDir, { imports });\n\n // Generate new exports\n const newExports = generateExports(packageName, imports, packageJson.exports, config);\n\n // Compare export counts\n const currentExportsCount = packageJson.exports ? Object.keys(packageJson.exports).length : 0;\n const newExportsCount = Object.keys(newExports).length;\n\n console.info(`Exports: ${currentExportsCount} -> ${newExportsCount}`);\n\n if (options.dryRun) {\n saveExportsPreview(packageDir, newExports);\n console.warn(`Saved exports preview to .exports-analysis`);\n console.warn(`Dry run: no changes saved for ${packageName}`);\n\n return true;\n }\n\n // Backup package.json\n if (backupPackageJson(packageJsonPath)) {\n console.log(`Backed up ${packageJsonPath}`);\n }\n\n // Update package.json\n const updatedPackageJson = { ...packageJson, exports: newExports };\n\n if (savePackageJson(packageJsonPath, updatedPackageJson)) {\n console.log(`Updated exports for ${packageName}`);\n\n return true;\n }\n\n console.error(`Failed to update ${packageJsonPath}`);\n\n return false;\n}\n\n/**\n * Processes all packages in the workspace\n * @param options - Processing options\n */\nexport async function processAllPackages(options: ProcessOptions): Promise<void> {\n try {\n console.info(\"Searching for packages...\");\n const config = getConfig(options.configPath);\n const packageJsonPaths = await findAllPackages(config);\n\n if (packageJsonPaths.length === 0) {\n console.warn(\"No packages found.\");\n\n return;\n }\n\n console.log(`Found ${packageJsonPaths.length} packages.`);\n\n let successCount = 0;\n let skipCount = 0;\n let errorCount = 0;\n\n for (const packageJsonPath of packageJsonPaths) {\n const result = processPackage(packageJsonPath, options);\n\n if (result) {\n successCount++;\n } else if (options.packageFilter) {\n skipCount++;\n } else {\n errorCount++;\n }\n }\n\n console.log(\"Completed exports update.\");\n console.info(`Stats: ${successCount} succeeded, ${skipCount} skipped, ${errorCount} failed`);\n } catch (error) {\n console.error(\"Error processing packages:\", error);\n throw error;\n }\n}\n","import type { Command } from \"commander\";\n\nimport type { ProcessOptions } from \"@/commands/update-exports/types\";\n\nimport { processAllPackages } from \"@/commands/update-exports/process-package\";\n\n/**\n * Creates a commander command for updating exports\n * @param program - Commander program instance\n */\nexport function createUpdateExportsCommand(program: Command): void {\n // noinspection RequiredAttributes\n program\n .command(\"update-exports\")\n .description(\"Updates exports for all packages\")\n .option(\"-p, --package <package>\", \"Filter by package name\")\n .option(\"-d, --dry-run\", \"Run without making changes\")\n .option(\"-c, --config <path>\", \"Path to configuration file\")\n .action(async (options) => {\n const processorOptions: ProcessOptions = {\n packageFilter: options.package,\n dryRun: Boolean(options.dryRun),\n configPath: options.config,\n };\n\n try {\n await processAllPackages(processorOptions);\n } catch (error) {\n console.error(\"Error processing packages:\", error);\n process.exit(1);\n }\n });\n}\n","import { readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport interface PackageInfo {\n name: string;\n version: string;\n}\n\nexport function getPackageInfo(): PackageInfo {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n const packageJsonPath = resolve(__dirname, \"../package.json\");\n\n return JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as PackageInfo;\n}\n\nexport function getPackageVersion(): string {\n return getPackageInfo().version;\n}\n","\n\nimport { Command } from \"commander\";\n\nimport { createProjectCommand } from \"@/commands/create-project/command\";\nimport { createUpdateExportsCommand } from \"@/commands/update-exports\";\nimport { getPackageVersion } from \"@/lib/package-info\";\n\nfunction main(): void {\n const program = new Command();\n\n program\n .name(\"codefast\")\n .description(\"CodeFast CLI - A development toolkit for CodeFast.\")\n .version(getPackageVersion(), \"-v, --version\", \"display CLI version\");\n\n createUpdateExportsCommand(program);\n createProjectCommand(program);\n\n program.parse(process.argv);\n}\n\nmain();\n"],"names":["rl","readline","process","prompt","question","Promise","resolve","answer","runCommand","command","execSync","FileUtils","filePath","fs","error","Error","getErrorMessage","content","console","filename","validateProjectName","name","npmNameRegex","reservedNames","fullPath","path","getValidProjectName","initialName","attempts","maxAttempts","projectName","validation","undefined","checkExistingProject","projectNameArg","packageJsonPath","packageJsonExists","confirm","packageJson","JSON","MAIN_DEPENDENCIES","DEV_DEPENDENCIES","PACKAGES_TO_REMOVE","configGroups","updateFileIfNeeded","checkFn","updateFn","successMessage","alreadyUpdatedMessage","updatedContent","updatePostcssConfig","projectDir","postcssConfigPath","typeComment","updateLayoutFile","layoutPath","htmlTarget","newImports","result","updatePackageJson","updateNextConfig","nextConfigPath","optimizePackagesConfig","updatePageFile","pagePath","createConfigFiles","category","configs","Object","description","dir","installDependencies","allDevDependencies","cleanupPackages","dependencies","devDependencies","packagesToRemove","pkg","checkEnvironment","createNextProject","flags","createProjectCommand","program","makeRegexPrefixesToRemove","prefixes","prefixPattern","RegExp","processExportPath","modulePath","regexPattern","processedPath","match","remainingPath","analyzeImports","indexFilePath","packageConfig","project","Project","sourceFile","imports","prefixesToRemove","exportDecl","moduleSpecifier","isExternal","parts","Boolean","directory","importPath","PackageConfigSchema","z","ScriptConfigSchema","cachedConfig","loadConfigFile","configPath","configContent","config","getConfig","userConfig","merge","defaultConfig","getPackageConfig","packageName","configObj","customConfig","EXPORTS_ANALYSIS_DIR","EXPORTS_PREVIEW_FILE","EXPORTS_ANALYSIS_FILE","ENCODING","JSON_INDENT","dirPath","packageDir","outputDir","baseFilename","timestamp","Date","fileExists","readPackageJson","backupPackageJson","backupDir","baseName","backupPath","savePackageJson","saveJsonToFile","fileName","saveExportsAnalysis","analysis","saveExportsPreview","exports","formatOutputPath","pattern","dirPart","generateExports","existingExports","exportPath","esmOutput","cjsOutput","typesOutput","typesCjsOutput","DEFAULT_IGNORE_PATTERN","findAllPackages","glob","processPackage","options","srcIndexPath","newExports","currentExportsCount","newExportsCount","updatedPackageJson","processAllPackages","packageJsonPaths","successCount","skipCount","errorCount","createUpdateExportsCommand","processorOptions","getPackageInfo","__filename","fileURLToPath","__dirname","dirname","readFileSync","getPackageVersion","main","Command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I,CAAC,YACL,WAAW,CAAC,sDACZ,OAAO,CAACmG,qBAAqB,iBAAiB;IAEjDR,2BAA2B3F;IAC3BD,qBAAqBC;IAErBA,QAAQ,KAAK,CAAChF,QAAQ,IAAI;AAC5B;AAEAoL"}
1
+ {"version":3,"file":"index.cjs","sources":["webpack://@codefast/cli/./src/ioc/types.ts","webpack://@codefast/cli/./src/application/commands/create-project.command.ts","webpack://@codefast/cli/./src/application/commands/update-exports.command.ts","webpack://@codefast/cli/./src/application/utilities/error-handler.ts","webpack://@codefast/cli/./src/infrastructure/services/config.service.ts","webpack://@codefast/cli/./src/application/use-cases/create-project.use-case.ts","webpack://@codefast/cli/./src/application/use-cases/update-exports.use-case.ts","webpack://@codefast/cli/./src/infrastructure/adapters/cli.adapter.ts","webpack://@codefast/cli/./src/domain/entities/package-config.ts","webpack://@codefast/cli/./src/infrastructure/adapters/node-command-executor.adapter.ts","webpack://@codefast/cli/./src/infrastructure/adapters/node-file-system.adapter.ts","webpack://@codefast/cli/./src/infrastructure/adapters/node-prompt.adapter.ts","webpack://@codefast/cli/./src/infrastructure/adapters/ts-morph-analysis.adapter.ts","webpack://@codefast/cli/./src/infrastructure/repositories/file-system-package.repository.ts","webpack://@codefast/cli/./src/domain/entities/project.ts","webpack://@codefast/cli/./src/infrastructure/repositories/file-system-project.repository.ts","webpack://@codefast/cli/./src/infrastructure/services/dependency-config.service.ts","webpack://@codefast/cli/./src/infrastructure/services/node-package-info.service.ts","webpack://@codefast/cli/./src/infrastructure/utilities/file-system-utility.ts","webpack://@codefast/cli/./src/ioc/container.ts","webpack://@codefast/cli/./src/index.ts"],"sourcesContent":["export const TYPES = {\n ProjectRepository: Symbol.for(\"ProjectRepository\"),\n PackageRepository: Symbol.for(\"PackageRepository\"),\n\n FileSystemPort: Symbol.for(\"FileSystemPort\"),\n CommandExecutorPort: Symbol.for(\"CommandExecutorPort\"),\n PromptPort: Symbol.for(\"PromptPort\"),\n AnalysisPort: Symbol.for(\"AnalysisPort\"),\n\n PackageInfoService: Symbol.for(\"PackageInfoService\"),\n DependencyConfigService: Symbol.for(\"DependencyConfigService\"),\n ConfigService: Symbol.for(\"ConfigService\"),\n\n FileSystemUtility: Symbol.for(\"FileSystemUtility\"),\n\n CreateProjectUseCase: Symbol.for(\"CreateProjectUseCase\"),\n UpdateExportsUseCase: Symbol.for(\"UpdateExportsUseCase\"),\n\n CreateProjectCommand: Symbol.for(\"CreateProjectCommand\"),\n UpdateExportsCommand: Symbol.for(\"UpdateExportsCommand\"),\n\n CLIAdapter: Symbol.for(\"CLIAdapter\"),\n};\n","import { Command } from \"commander\";\nimport { inject, injectable } from \"inversify\";\nimport process from \"node:process\";\n\nimport type { CreateProjectUseCase } from \"@/application/use-cases/create-project.use-case\";\n\nimport { TYPES } from \"@/ioc/types\";\n\n@injectable()\nexport class CreateProjectCommand {\n constructor(@inject(TYPES.CreateProjectUseCase) private createProjectUseCase: CreateProjectUseCase) {}\n\n /**\n * Returns a Commander.js command for creating or configuring a project.\n *\n * @returns Configured Commander.js command.\n */\n getCommand(): Command {\n return new Command()\n .name(\"create-project\")\n .description(\"Create a new Next.js project with TypeScript, TailwindCSS, and linting setup\")\n .argument(\"[project-name]\", \"Name of the project to create\")\n .action(async (projectName: string) => {\n await this.createProjectUseCase.execute(projectName);\n\n process.exit(0);\n });\n }\n}\n","import { Command } from \"commander\";\nimport { inject, injectable } from \"inversify\";\nimport * as process from \"node:process\";\n\nimport type { UpdateExportsUseCase } from \"@/application/use-cases/update-exports.use-case\";\n\nimport { TYPES } from \"@/ioc/types\";\n\n@injectable()\nexport class UpdateExportsCommand {\n constructor(@inject(TYPES.UpdateExportsUseCase) private updateExportsUseCase: UpdateExportsUseCase) {}\n\n /**\n * Returns a Commander.js command for updating package exports.\n *\n * @returns Configured Commander.js command.\n */\n getCommand(): Command {\n return new Command()\n .name(\"update-exports\")\n .description(\"Updates exports for all packages\")\n .option(\"-p, --package <package>\", \"Filter by package name\")\n .option(\"-d, --dry-run\", \"Run without making changes\")\n .option(\"-c, --config <path>\", \"Path to configuration file\")\n .action(async (options: { config?: string; dryRun?: string; package?: string }) => {\n await this.updateExportsUseCase.execute({\n packageFilter: options.package,\n dryRun: Boolean(options.dryRun),\n configPath: options.config,\n });\n\n process.exit(0);\n });\n }\n}\n","/**\n * Utility function for handling errors consistently across use cases and repositories.\n * @param error - The error object or unknown value.\n * @param defaultMessage - Default message to display if an error message is unavailable.\n */\nexport function handleError(error: unknown, defaultMessage: string): void {\n const message = error instanceof Error ? error.message : defaultMessage;\n\n console.error(`\\n❌ ${message}`);\n}\n","import { injectable } from \"inversify\";\n\nimport type { ConfigGroups } from \"@/domain/entities/config-file\";\nimport type { ConfigServiceInterface } from \"@/domain/interfaces/config.service\";\n\n@injectable()\nexport class ConfigService implements ConfigServiceInterface {\n private readonly configGroups: ConfigGroups = {\n deployment: [\n {\n path: \".vercelignore\",\n content: `#-------------------------------------------------------------------------------\n# Dependencies and package managers\n#-------------------------------------------------------------------------------\n\n# Node dependencies\nnode_modules\n.pnpm-store\n.yarn\n\n#-------------------------------------------------------------------------------\n# Development and environment\n#-------------------------------------------------------------------------------\n\n# Environment variables (except examples)\n.env*\n!.env.example\n\n# Build artifacts\n.next\nbuild\ndist\n.git\n.github\n.turbo\n.changeset\n.eslintcache\n\n# Debug logs\nnpm-debug.log*\nyarn-debug.log*\n\n#-------------------------------------------------------------------------------\n# Testing\n#-------------------------------------------------------------------------------\n\n# Test coverage reports and config snapshots\ncoverage\n*.test.*\n*.e2e.*\n\n#-------------------------------------------------------------------------------\n# Editor and IDE configuration\n#-------------------------------------------------------------------------------\n\n# IDE project files\n.idea\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n\n#-------------------------------------------------------------------------------\n# Operating system files\n#-------------------------------------------------------------------------------\n\n# System metadata files\n.DS_Store\nThumbs.db\n\n#-------------------------------------------------------------------------------\n# Deployment\n#-------------------------------------------------------------------------------\n\n# Vercel deployment configuration\n.vercel\n`,\n description: \"Ignore files that should not be deployed to Vercel\",\n },\n ],\n formatting: [\n {\n path: \"prettier.config.mjs\",\n content: `/**\n * @see https://prettier.io/docs/en/configuration.html\n * @type {import('prettier').Config}\n */\nconst config = {\n plugins: [\"prettier-plugin-packagejson\", \"prettier-plugin-tailwindcss\"],\n printWidth: 100,\n tailwindAttributes: [\"classNames\"],\n tailwindFunctions: [\"tv\"],\n};\n\nexport default config;\n`,\n description: \"Prettier configuration for source code formatting\",\n },\n {\n path: \".editorconfig\",\n content: `# https://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\ninsert_final_newline = true\n\nend_of_line = lf\nindent_style = space\nindent_size = 2\nmax_line_length = 120\n\ntrim_trailing_whitespace = true\n\n[Makefile]\nindent_style = tab\n\n[{go.mod,go.sum,*.go}]\nindent_style = tab\n\n[*.rs]\n# Keep in sync with rustfmt\nindent_size = 4\n`,\n description: \"Editor configuration for source code formatting\",\n },\n {\n path: \".prettierignore\",\n content: `# changesets\n.changeset\n\n# debug\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n.pnpm-debug.log*\n\n# lock files\npackage-lock.json\nyarn.lock\npnpm-lock.yaml\n`,\n description: \"\",\n },\n ],\n linting: [\n {\n path: \"commitlint.config.mjs\",\n content: `/**\n * @see https://commitlint.js.org/reference/configuration.html\n * @type {import('@commitlint/types').UserConfig}\n */\nconst config = {\n extends: [\"@commitlint/config-conventional\"],\n rules: {\n \"body-max-line-length\": [2, \"always\", 350],\n \"header-max-length\": [2, \"always\", 150],\n },\n};\n\nexport default config;\n`,\n description: \"Commitlint configuration\",\n },\n {\n path: \"eslint.config.mjs\",\n content: `import { config } from \"@codefast/eslint-config/next\";\n\n/**\n * @see https://eslint.org/docs/latest/use/configure/configuration-files\n * @type {import('eslint').Linter.Config[]}\n */\nconst eslintConfig = [...config];\n\nexport default eslintConfig;\n`,\n description: \"ESLint configuration for the project\",\n },\n {\n path: \"lint-staged.config.mjs\",\n content: `import { relative } from \"node:path\";\n\n/**\n * Builds an ESLint command with the given filenames.\n *\n * @param {string[]} filenames - An array of filenames to be passed to the\n * ESLint command.\n * @returns {string} - The generated ESLint command.\n */\nfunction buildEslintCommand(filenames) {\n return \\`next lint --fix --max-warnings 0 --file \\${filenames.map((file) => relative(import.meta.dirname, file)).\n join(\" --file \")}\\`;\n}\n\n/**\n * @see https://www.npmjs.com/package/lint-staged\n * @type {import('lint-staged').Configuration}\n */\nconst config = {\n \"*.{js,mjs,jsx,ts,tsx}\": [buildEslintCommand, \"prettier --list-different --write\"],\n \"*.{json,css,md,mdx}\": [\"prettier --list-different --write\"],\n};\n\nexport default config;\n`,\n description: \"Configure lint-staged for pre-commit checks\",\n },\n ],\n styles: [\n {\n path: \"src/lib/fonts.ts\",\n content: `import { cn } from \"@codefast/ui\";\nimport { Geist, Geist_Mono as GeistMono } from \"next/font/google\";\n\nconst fontGeistSans = Geist({\n subsets: [\"latin\"],\n variable: \"--font-geist-sans\",\n});\n\nconst fontGeistMono = GeistMono({\n subsets: [\"latin\"],\n variable: \"--font-geist-mono\",\n});\n\nexport const fontVariables = cn(fontGeistSans.variable, fontGeistMono.variable);\n`,\n description: \"Font configuration for the application\",\n },\n {\n path: \"src/app/globals.css\",\n content: `@import \"tailwindcss\";\n\n@import \"@codefast/ui/styles.css\";\n\n@source '../../node_modules/@codefast/ui';\n\n@custom-variant dark (&:where(.dark, .dark *));\n\n@layer base {\n :root {\n --font-sans: var(--font-geist-sans);\n --font-mono: var(--font-geist-mono);\n\n --input: var(--color-neutral-200);\n --border: var(--color-neutral-200);\n --ring: var(--color-neutral-400);\n --background: var(--color-white);\n --foreground: var(--color-neutral-950);\n --primary: var(--color-sky-500);\n --primary-foreground: var(--color-neutral-50);\n --secondary: var(--color-neutral-100);\n --secondary-foreground: var(--color-neutral-900);\n --destructive: var(--color-red-600);\n --accent: var(--color-neutral-100);\n --accent-foreground: var(--color-neutral-900);\n --muted: var(--color-neutral-100);\n --muted-foreground: var(--color-neutral-500);\n --popover: var(--color-white);\n --popover-foreground: var(--color-neutral-950);\n --popover-overlay: --alpha(var(--color-neutral-900) / 20%);\n --card: var(--color-white);\n --card-foreground: var(--color-neutral-950);\n --sidebar: var(--color-neutral-50);\n --sidebar-foreground: var(--color-neutral-950);\n --sidebar-primary: var(--color-sky-500);\n --sidebar-primary-foreground: var(--color-neutral-50);\n --sidebar-accent: var(--color-neutral-100);\n --sidebar-accent-foreground: var(--color-neutral-900);\n --sidebar-border: var(--color-neutral-200);\n --sidebar-ring: var(--color-neutral-400);\n --chart-1: var(--color-orange-600);\n --chart-2: var(--color-teal-600);\n --chart-3: var(--color-cyan-600);\n --chart-4: var(--color-amber-600);\n --chart-5: var(--color-amber-500);\n }\n\n .dark {\n --input: var(--color-neutral-700);\n --border: --alpha(var(--color-neutral-700) / 50%);\n --ring: var(--color-neutral-500);\n --background: var(--color-neutral-950);\n --foreground: var(--color-neutral-50);\n --primary: var(--color-sky-700);\n --primary-foreground: var(--color-neutral-50);\n --secondary: var(--color-neutral-800);\n --secondary-foreground: var(--color-neutral-50);\n --destructive: var(--color-red-400);\n --accent: var(--color-neutral-700);\n --accent-foreground: var(--color-neutral-50);\n --muted: var(--color-neutral-800);\n --muted-foreground: var(--color-neutral-400);\n --popover: var(--color-neutral-800);\n --popover-foreground: var(--color-neutral-50);\n --popover-overlay: --alpha(var(--color-neutral-900) / 80%);\n --card: var(--color-neutral-900);\n --card-foreground: var(--color-neutral-50);\n --sidebar: var(--color-neutral-900);\n --sidebar-foreground: var(--color-neutral-50);\n --sidebar-primary: var(--color-sky-700);\n --sidebar-primary-foreground: var(--color-neutral-50);\n --sidebar-accent: var(--color-neutral-800);\n --sidebar-accent-foreground: var(--color-neutral-50);\n --sidebar-border: var(--color-neutral-800);\n --sidebar-ring: var(--color-neutral-600);\n --chart-1: var(--color-blue-700);\n --chart-2: var(--color-emerald-500);\n --chart-3: var(--color-amber-500);\n --chart-4: var(--color-purple-500);\n --chart-5: var(--color-rose-500);\n }\n}\n`,\n description: \"Global CSS variables for the application\",\n },\n ],\n };\n\n getConfigGroups(): ConfigGroups {\n return this.configGroups;\n }\n}\n","import { inject, injectable } from \"inversify\";\n\nimport type { CommandExecutorPort } from \"@/application/ports/command-executor.port\";\nimport type { FileSystemPort } from \"@/application/ports/file-system.port\";\nimport type { PromptPort } from \"@/application/ports/prompt.port\";\nimport type { ConfigGroups } from \"@/domain/entities/config-file\";\nimport type { Project } from \"@/domain/entities/project\";\nimport type { ProjectRepositoryInterface } from \"@/domain/interfaces/project.repository\";\n\nimport { handleError } from \"@/application/utilities/error-handler\";\nimport { ConfigService } from \"@/infrastructure/services/config.service\";\nimport { TYPES } from \"@/ioc/types\";\n\n@injectable()\nexport class CreateProjectUseCase {\n constructor(\n @inject(TYPES.ProjectRepository) private projectRepository: ProjectRepositoryInterface,\n @inject(TYPES.FileSystemPort) private fileSystemPort: FileSystemPort,\n @inject(TYPES.CommandExecutorPort) private commandExecutorPort: CommandExecutorPort,\n @inject(TYPES.PromptPort) private promptPort: PromptPort,\n @inject(TYPES.ConfigService) private configService: ConfigService,\n ) {}\n\n /**\n * Executes the project creation or configuration process.\n * @param projectName - Optional project name provided via CLI.\n *\n * @returns The created or configured project.\n */\n async execute(projectName?: string): Promise<Project> {\n try {\n this.commandExecutorPort.checkEnvironment();\n const project = await this.checkExistingProject(projectName);\n const configGroups = this.configService.getConfigGroups();\n\n this.createOrConfigureProject(project, configGroups);\n this.displaySuccessMessage(project);\n\n return project;\n } catch (error) {\n handleError(error, \"Failed to create or configure project\");\n throw error;\n } finally {\n this.promptPort.close();\n }\n }\n\n private async checkExistingProject(projectNameArg?: string): Promise<Project> {\n return await this.projectRepository.checkExistingProject(projectNameArg);\n }\n\n private createOrConfigureProject(project: Project, configGroups: ConfigGroups): void {\n if (!project.packageJsonExists) {\n console.log(`\\n🚀 Starting project creation for ${project.name}...\\n`);\n this.projectRepository.createNextProject(project.name);\n process.chdir(project.name);\n console.log(`📂 Moved to ${project.name}`);\n }\n\n this.updateProjectFiles(project.directory);\n this.commandExecutorPort.installDependencies();\n this.commandExecutorPort.cleanupPackages();\n this.fileSystemPort.createConfigFiles(project.directory, configGroups);\n this.projectRepository.updateNextConfig(project.directory);\n this.projectRepository.updatePackageJson(project.directory);\n this.commandExecutorPort.enableGitHooks();\n this.commandExecutorPort.runFormatter();\n this.commandExecutorPort.runLinter();\n }\n\n private updateProjectFiles(projectDir: string): void {\n this.projectRepository.updateLayoutFile(projectDir);\n this.projectRepository.updatePageFile(projectDir);\n this.projectRepository.updatePostcssConfig(projectDir);\n }\n\n private displaySuccessMessage(project: Project): void {\n console.log(`\\n✅ Project ${project.packageJsonExists ? \"configured\" : \"created\"} successfully!`);\n console.log(`- Project: ${project.name}`);\n console.log(\"- Next.js with TypeScript\");\n console.log(\"- TailwindCSS and @codefast/ui\");\n console.log(\"- ESLint, Prettier, Commitlint, and Git Hooks\");\n console.log(\"- Lint-staged for pre-commit checks\");\n console.log(`\\n📁 Project directory: ${process.cwd()}`);\n console.log(`\\n🚀 To start development:`);\n console.log(`${project.packageJsonExists ? `cd ${project.name} && ` : \"\"}pnpm dev`);\n }\n}\n","import { inject, injectable } from \"inversify\";\n\nimport type { PackageRepository } from \"@/domain/interfaces/package.repository\";\n\nimport { handleError } from \"@/application/utilities/error-handler\";\nimport { TYPES } from \"@/ioc/types\";\n\n@injectable()\nexport class UpdateExportsUseCase {\n constructor(@inject(TYPES.PackageRepository) private packageRepository: PackageRepository) {}\n\n /**\n * Updates exports for all packages based on provided options and configuration.\n * @param options - Options for dry run, config path, and package filter.\n */\n async execute(options: { dryRun: boolean; configPath?: string; packageFilter?: string }): Promise<void> {\n try {\n console.info(\"♢‒ Searching for packages...\");\n const packageJsonPaths = await this.packageRepository.findAllPackages(options.configPath);\n\n if (packageJsonPaths.length === 0) {\n console.warn(\"No packages found.\");\n\n return;\n }\n\n console.log(` Found ${packageJsonPaths.length} packages.`);\n\n let successCount = 0;\n let skipCount = 0;\n let errorCount = 0;\n\n for (const packageJsonPath of packageJsonPaths) {\n const result = this.packageRepository.processPackage(packageJsonPath, options);\n\n if (result) {\n successCount++;\n } else if (options.packageFilter) {\n skipCount++;\n } else {\n errorCount++;\n }\n }\n\n console.log(\"♢‒ Completed exports update.\\n\");\n console.info(`Stats: ${successCount} succeeded, ${skipCount} skipped, ${errorCount} failed`);\n } catch (error) {\n handleError(error, \"Error processing packages\");\n throw error;\n }\n }\n}\n","import { Command } from \"commander\";\nimport { inject, injectable } from \"inversify\";\n\nimport type { PackageInfoServiceInterface } from \"@/domain/interfaces/package-info.service\";\n\nimport { CreateProjectCommand } from \"@/application/commands/create-project.command\";\nimport { UpdateExportsCommand } from \"@/application/commands/update-exports.command\";\nimport { TYPES } from \"@/ioc/types\";\n\n@injectable()\nexport class CLIAdapter {\n constructor(\n @inject(TYPES.CreateProjectCommand) private createProjectCommand: CreateProjectCommand,\n @inject(TYPES.UpdateExportsCommand) private updateExportsCommand: UpdateExportsCommand,\n @inject(TYPES.PackageInfoService) private packageInfoService: PackageInfoServiceInterface,\n ) {}\n\n /**\n * Initializes the CLI with commands for project creation and export updates.\n */\n initialize(): void {\n const program = new Command();\n\n program\n .name(\"codefast\")\n .description(\"CodeFast CLI - A development toolkit for CodeFast.\")\n .version(this.packageInfoService.getPackageVersion(), \"-v, --version\", \"display CLI version\")\n .addCommand(this.createProjectCommand.getCommand())\n .addCommand(this.updateExportsCommand.getCommand())\n .parse(process.argv);\n }\n}\n","import { z } from \"zod\";\n\nexport const packageConfigSchema = z.object({\n cjsOutputPattern: z.string().describe(\"Output pattern for CommonJS format, e.g., './dist/cjs/{dir}/{name}.cjs'\"),\n esmOutputPattern: z.string().describe(\"Output pattern for ESM format, e.g., './dist/esm/{dir}/{name}.js'\"),\n packageJsonPath: z.string().describe(\"Path to the package.json file, e.g., 'package.json'\"),\n srcIndexPath: z.string().describe(\"Path to the source index file, e.g., 'src/index.ts'\"),\n typesOutputCjsPattern: z\n .string()\n .describe(\"Output pattern for CommonJS type declarations, e.g., './dist/types/{dir}/{name}.d.cts'\"),\n typesOutputPattern: z\n .string()\n .describe(\"Output pattern for type declarations, e.g., './dist/types/{dir}/{name}.d.ts'\"),\n exportPathPrefixesToRemove: z\n .array(z.string())\n .optional()\n .describe(\"Prefixes to remove from export paths, e.g., ['components']\"),\n});\n\nexport const scriptConfigSchema = z.object({\n customPackageConfigs: z\n .record(z.string(), packageConfigSchema.partial())\n .describe(\"Custom configurations for specific packages\"),\n defaultPackageConfig: packageConfigSchema.describe(\"Default configuration applied to all packages unless overridden\"),\n packagesGlob: z.string().describe(\"Glob pattern to find package.json files, e.g., './packages/**/package.json'\"),\n});\n\nexport const importPathSchema = z.object({\n directory: z.string().describe(\"Directory containing the import, e.g., 'components'\"),\n exportPath: z.string().describe(\"Resolved export path from the directory, e.g., './button'\"),\n name: z.string().describe(\"Name of the import, e.g., 'Button'\"),\n originalPath: z.string().describe(\"Original unresolved path, e.g., './components/button'\"),\n});\n\nexport const exportConfigSchema = z.object({\n import: z.object({\n default: z.string().describe(\"ESM default export path\"),\n types: z.string().describe(\"ESM types export path\"),\n }),\n require: z.object({\n default: z.string().describe(\"CommonJS default export path\"),\n types: z.string().describe(\"CommonJS types export path\"),\n }),\n});\n\nexport const PackageExportsSchema = z.record(z.string(), z.union([exportConfigSchema, z.string()]));\n\nexport const packageJsonSchema = z\n .object({\n dependencies: z\n .record(z.string(), z.string())\n .optional()\n .describe(\"List of runtime dependencies with their versions\"),\n devDependencies: z\n .record(z.string(), z.string())\n .optional()\n .describe(\"List of development dependencies with their versions\"),\n exports: PackageExportsSchema.optional().describe(\"Export mappings for the package\"),\n name: z.string().describe(\"Name of the package\"),\n scripts: z.record(z.string(), z.string()).describe(\"Script commands defined for the package\"),\n \"simple-git-hooks\": z.record(z.string(), z.string()).optional().describe(\"Git hooks configuration for the package\"),\n version: z.string().optional().describe(\"Version of the package\"),\n })\n .catchall(z.unknown());\n\nexport type PackageConfig = z.infer<typeof packageConfigSchema>;\n\nexport type ScriptConfig = z.infer<typeof scriptConfigSchema>;\n\nexport type ImportPath = z.infer<typeof importPathSchema>;\n\nexport type ExportConfig = z.infer<typeof exportConfigSchema>;\n\nexport type PackageExports = z.infer<typeof PackageExportsSchema>;\n\nexport type PackageJson = z.infer<typeof packageJsonSchema>;\n\nexport interface AnalysisResult {\n imports: ImportPath[];\n}\n","import { inject, injectable } from \"inversify\";\nimport { execSync } from \"node:child_process\";\nimport path from \"node:path\";\n\nimport type { CommandExecutorPort } from \"@/application/ports/command-executor.port\";\nimport type { FileSystemPort } from \"@/application/ports/file-system.port\";\nimport type { DependencyConfigServiceInterface } from \"@/domain/interfaces/dependency-config.service\";\n\nimport { packageJsonSchema } from \"@/domain/entities/package-config\";\nimport { TYPES } from \"@/ioc/types\";\n\n@injectable()\nexport class NodeCommandExecutorAdapter implements CommandExecutorPort {\n constructor(\n @inject(TYPES.FileSystemPort) private fileSystemPort: FileSystemPort,\n @inject(TYPES.DependencyConfigService) private dependencyConfigService: DependencyConfigServiceInterface,\n ) {}\n\n runCommand(command: string): void {\n execSync(command, { stdio: \"inherit\" });\n }\n\n checkEnvironment(): void {\n try {\n this.runCommand(\"pnpm --version\");\n } catch {\n throw new Error(\"PNPM is not installed. Please install PNPM first.\");\n }\n }\n\n installDependencies(): void {\n console.log(`\\n📚 Installing dependencies...`);\n const mainDependencies = this.dependencyConfigService.getMainDependencies();\n\n if (mainDependencies.length > 0) {\n this.runCommand(`pnpm add ${mainDependencies.join(\" \")}`);\n }\n\n const devDependencies = this.dependencyConfigService.getDevDependencies();\n const allDevDependencies = Object.values(devDependencies).flat().join(\" \");\n\n if (allDevDependencies) {\n this.runCommand(`pnpm add -D ${allDevDependencies}`);\n }\n }\n\n cleanupPackages(): void {\n console.log(`\\n🧹 Cleaning up unnecessary packages...`);\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n\n if (!this.fileSystemPort.exists(packageJsonPath)) {\n console.warn(`⚠️ package.json not found, skipping cleanup.`);\n\n return;\n }\n\n let packageJson;\n\n try {\n packageJson = packageJsonSchema.parse(JSON.parse(this.fileSystemPort.readFile(packageJsonPath)));\n } catch (error) {\n console.warn(\n `⚠️ Error reading package.json: ${error instanceof Error ? error.message : \"Unknown error\"}, skipping cleanup.`,\n );\n\n return;\n }\n\n const dependencies = packageJson.dependencies ?? {};\n const devDependencies = packageJson.devDependencies ?? {};\n const packagesToRemove = this.dependencyConfigService\n .getPackagesToRemove()\n .filter((pkg) => pkg in dependencies || pkg in devDependencies);\n\n if (packagesToRemove.length > 0) {\n this.runCommand(`pnpm remove ${packagesToRemove.join(\" \")}`);\n } else {\n console.log(`ℹ️ No unnecessary packages found in package.json to remove.`);\n }\n }\n\n enableGitHooks(): void {\n console.log(`\\n🔄 Activating git hooks...`);\n this.runCommand(\"pnpm simple-git-hooks\");\n }\n\n runFormatter(): void {\n console.log(`\\n📝 Formatting files with Prettier...`);\n this.runCommand(\"pnpm format\");\n }\n\n runLinter(): void {\n console.log(`\\n🔍 Running ESLint to check code style...`);\n this.runCommand(\"pnpm lint\");\n }\n}\n","import { injectable } from \"inversify\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { FileSystemPort } from \"@/application/ports/file-system.port\";\nimport type { ConfigGroups } from \"@/domain/entities/config-file\";\n\n@injectable()\nexport class NodeFileSystemAdapter implements FileSystemPort {\n exists(filePath: string): boolean {\n return fs.existsSync(filePath);\n }\n\n access(filePath: string): void {\n fs.accessSync(filePath, fs.constants.W_OK);\n }\n\n readFile(filePath: string): string {\n try {\n return fs.readFileSync(filePath, \"utf8\");\n } catch (error) {\n throw new Error(`Failed to read file ${filePath}: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n }\n }\n\n writeFile(filePath: string, content: string): void {\n try {\n const dir = path.dirname(filePath);\n\n this.createDirectory(dir);\n fs.writeFileSync(filePath, content);\n } catch (error) {\n throw new Error(\n `Failed to write to file ${filePath}: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n );\n }\n }\n\n createDirectory(dirPath: string): void {\n if (!this.exists(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n }\n\n writeConfigFile(filePath: string, content: string): void {\n this.writeFile(filePath, content);\n console.log(`📝 Created ${filePath}`);\n }\n\n createConfigFiles(projectDir: string, configGroups: ConfigGroups): void {\n console.log(`\\n📝 Creating configuration files...`);\n\n for (const [category, configs] of Object.entries(configGroups)) {\n console.log(`\\n📂 Setting up ${category} configurations:`);\n\n for (const config of configs) {\n const fullPath = path.join(projectDir, config.path);\n\n this.writeConfigFile(fullPath, config.content);\n\n if (config.description) {\n console.log(`ℹ️ ${config.path}: ${config.description}`);\n }\n }\n }\n }\n}\n","import { injectable } from \"inversify\";\nimport readline from \"node:readline\";\n\nimport type { PromptPort } from \"@/application/ports/prompt.port\";\n\n@injectable()\nexport class NodePromptAdapter implements PromptPort {\n private rl: readline.Interface;\n\n constructor() {\n this.rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n }\n\n async prompt(message: string): Promise<string> {\n return new Promise((resolve) => {\n this.rl.question(message, (answer) => {\n resolve(answer.trim());\n });\n });\n }\n\n close(): void {\n this.rl.close();\n }\n}\n","import { injectable } from \"inversify\";\nimport { Project, SourceFile } from \"ts-morph\";\n\nimport type { AnalysisPort } from \"@/application/ports/analysis.port\";\nimport type { AnalysisResult, ImportPath, PackageConfig } from \"@/domain/entities/package-config\";\n\n@injectable()\nexport class TsMorphAnalysisAdapter implements AnalysisPort {\n analyzeImports(indexFilePath: string, packageConfig: PackageConfig): AnalysisResult {\n const project = new Project();\n let sourceFile: SourceFile;\n\n try {\n sourceFile = project.addSourceFileAtPath(indexFilePath);\n } catch (error) {\n console.error(\n `Error loading source file at ${indexFilePath}: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n );\n\n return { imports: [] };\n }\n\n const imports: ImportPath[] = [];\n const prefixesToRemove = packageConfig.exportPathPrefixesToRemove ?? [];\n const regexPattern = new RegExp(`^.?\\\\/?(?:${prefixesToRemove.join(\"|\")})\\\\/(.*)$`);\n\n for (const exportDecl of sourceFile.getExportDeclarations()) {\n let moduleSpecifier = exportDecl.getModuleSpecifierValue();\n\n if (!moduleSpecifier) {\n continue;\n }\n\n // Normalize @/ to ./\n if (moduleSpecifier.startsWith(\"@/\")) {\n moduleSpecifier = `./${moduleSpecifier.slice(2)}`;\n }\n\n const isExternal = !moduleSpecifier.startsWith(\".\");\n\n if (isExternal) {\n continue;\n }\n\n const parts = moduleSpecifier.split(\"/\").filter(Boolean);\n\n if (parts.length < 2) {\n continue;\n }\n\n let directory = parts.length <= 1 ? \".\" : parts.slice(0, -1).join(\"/\");\n\n if (directory.startsWith(\"./\")) {\n directory = directory.slice(2);\n }\n\n const name = parts.at(-1) ?? \"\";\n const exportPath = this.processExportPath(moduleSpecifier, regexPattern);\n\n imports.push({\n originalPath: moduleSpecifier,\n directory,\n name,\n exportPath,\n });\n }\n\n return { imports };\n }\n\n private processExportPath(modulePath: string, regexPattern: RegExp): string {\n const match = modulePath.match(regexPattern);\n\n if (match) {\n const remainingPath = match[1];\n\n return remainingPath.startsWith(\"./\") ? remainingPath : `./${remainingPath}`;\n }\n\n return modulePath;\n }\n}\n","import { glob } from \"glob\";\nimport { inject, injectable } from \"inversify\";\nimport { merge } from \"lodash-es\";\nimport path from \"node:path\";\n\nimport type { AnalysisPort } from \"@/application/ports/analysis.port\";\nimport type { FileSystemPort } from \"@/application/ports/file-system.port\";\nimport type {\n AnalysisResult,\n PackageConfig,\n PackageExports,\n PackageJson,\n ScriptConfig,\n} from \"@/domain/entities/package-config\";\nimport type { PackageRepository } from \"@/domain/interfaces/package.repository\";\nimport type { FileSystemUtility } from \"@/infrastructure/utilities/file-system-utility\";\n\nimport { scriptConfigSchema } from \"@/domain/entities/package-config\";\nimport { TYPES } from \"@/ioc/types\";\n\n@injectable()\nexport class FileSystemPackageRepository implements PackageRepository {\n private readonly DEFAULT_IGNORE_PATTERN = [\"**/node_modules/**\"];\n private cachedConfig: null | ScriptConfig = null;\n private defaultConfig: ScriptConfig = {\n packagesGlob: \"./packages/**/package.json\",\n defaultPackageConfig: {\n cjsOutputPattern: \"./dist/cjs/{dir}/{name}.cjs\",\n esmOutputPattern: \"./dist/esm/{dir}/{name}.js\",\n packageJsonPath: \"package.json\",\n srcIndexPath: \"src/index.ts\",\n typesOutputCjsPattern: \"./dist/types/{dir}/{name}.d.ts\",\n typesOutputPattern: \"./dist/types/{dir}/{name}.d.ts\",\n },\n customPackageConfigs: {\n \"@codefast/ui\": {\n exportPathPrefixesToRemove: [\"components\"],\n },\n \"@codefast/style-guide\": {\n exportPathPrefixesToRemove: [\"configs\"],\n },\n },\n };\n\n constructor(\n @inject(TYPES.FileSystemPort) private fileSystemPort: FileSystemPort,\n @inject(TYPES.AnalysisPort) private analysisPort: AnalysisPort,\n @inject(TYPES.FileSystemUtility) private fileSystemUtility: FileSystemUtility,\n ) {}\n\n async findAllPackages(configPath?: string): Promise<string[]> {\n const config = this.getConfig(configPath);\n\n return await glob(config.packagesGlob, {\n ignore: this.DEFAULT_IGNORE_PATTERN,\n });\n }\n\n processPackage(\n packageJsonPath: string,\n options: {\n dryRun: boolean;\n configPath?: string;\n packageFilter?: string;\n },\n ): boolean {\n const packageDir = path.dirname(packageJsonPath);\n let packageJson;\n\n try {\n packageJson = JSON.parse(this.fileSystemPort.readFile(packageJsonPath)) as PackageJson;\n } catch (error) {\n console.error(`Failed to parse ${packageJsonPath}: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\n return false;\n }\n\n const packageName = packageJson.name;\n\n if (options.packageFilter && packageName !== options.packageFilter) {\n console.debug(`Skipping ${packageName} (does not match filter)`);\n\n return false;\n }\n\n console.info(`♢‒ Processing package: ${packageName}`);\n\n const config = this.getConfig(options.configPath);\n const packageConfig = this.getPackageConfig(packageName, config);\n const srcIndexPath = path.join(packageDir, packageConfig.srcIndexPath);\n\n if (!this.fileSystemPort.exists(srcIndexPath)) {\n console.error(`⎹ ⛔︎ Source file not found at ${srcIndexPath}`);\n\n return false;\n }\n\n console.info(`⎹ Analyzing imports from ${srcIndexPath}...`);\n const analysis = this.analyzeImports(srcIndexPath, packageConfig);\n\n if (analysis.imports.length === 0) {\n console.warn(`⎹ ⛔︎ No imports found to analyze in ${packageName}`);\n\n return false;\n }\n\n console.log(`⎹ Analysis complete. Found ${analysis.imports.length} subpath exports.`);\n\n this.saveExportsAnalysis(packageDir, analysis);\n\n const newExports = this.generateExports(packageName, analysis.imports, packageJson.exports ?? {}, config);\n\n const currentExportsCount = packageJson.exports ? Object.keys(packageJson.exports).length : 0;\n const newExportsCount = Object.keys(newExports).length;\n\n console.info(`⎹ Exports: ${currentExportsCount} -> ${newExportsCount}`);\n\n if (options.dryRun) {\n this.saveExportsPreview(packageDir, newExports);\n console.warn(`⎹ Saved exports preview to .exports-analysis`);\n console.warn(`⎹ Dry run: no changes saved for ${packageName}`);\n\n return true;\n }\n\n this.fileSystemUtility.backupFile(packageJsonPath, \".exports-analysis\");\n console.log(`⎹ Backed up ${packageJsonPath}`);\n\n const updatedPackageJson = { ...packageJson, exports: newExports };\n\n this.fileSystemPort.writeFile(packageJsonPath, `${JSON.stringify(updatedPackageJson, null, 2)}\\n`);\n console.log(`⎹ Updated exports for ${packageName}`);\n\n return true;\n }\n\n analyzeImports(indexFilePath: string, packageConfig: PackageConfig): AnalysisResult {\n return this.analysisPort.analyzeImports(indexFilePath, packageConfig);\n }\n\n generateExports(\n packageName: string,\n imports: AnalysisResult[\"imports\"],\n existingExports: PackageExports,\n config: ScriptConfig,\n ): PackageExports {\n const packageConfig = this.getPackageConfig(packageName, config);\n const exports: PackageExports = {\n \".\": existingExports[\".\"] ?? {\n import: {\n default: \"./dist/esm/index.js\",\n types: \"./dist/types/index.d.ts\",\n },\n require: {\n default: \"./dist/cjs/index.cjs\",\n types: \"./dist/types/index.d.cts\",\n },\n },\n };\n\n if (existingExports[\"./styles.css\"]) {\n exports[\"./styles.css\"] = existingExports[\"./styles.css\"];\n }\n\n for (const importPath of imports) {\n const { directory, name, exportPath } = importPath;\n const esmOutput = this.formatOutputPath(packageConfig.esmOutputPattern, directory, name);\n const cjsOutput = this.formatOutputPath(packageConfig.cjsOutputPattern, directory, name);\n const typesOutput = this.formatOutputPath(packageConfig.typesOutputPattern, directory, name);\n const typesCjsOutput = this.formatOutputPath(packageConfig.typesOutputCjsPattern, directory, name);\n\n exports[exportPath] = {\n import: {\n default: esmOutput,\n types: typesOutput,\n },\n require: {\n default: cjsOutput,\n types: typesCjsOutput,\n },\n };\n }\n\n return exports;\n }\n\n private getConfig(configPath?: string): ScriptConfig {\n if (this.cachedConfig && !configPath) {\n return this.cachedConfig;\n }\n\n const userConfig = this.loadConfigFile(configPath);\n const config = merge({}, this.defaultConfig, userConfig) as ScriptConfig;\n\n if (!configPath) {\n this.cachedConfig = config;\n }\n\n return config;\n }\n\n private loadConfigFile(configPath?: string): Partial<ScriptConfig> {\n if (!configPath) {\n return {};\n }\n\n try {\n const fullPath = path.resolve(configPath);\n\n if (!this.fileSystemPort.exists(fullPath)) {\n console.warn(`Configuration file not found at ${fullPath}`);\n\n return {};\n }\n\n const configContent = this.fileSystemPort.readFile(fullPath);\n\n return scriptConfigSchema.parse(JSON.parse(configContent));\n } catch (error) {\n console.error(`Error reading configuration file: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\n return {};\n }\n }\n\n private getPackageConfig(packageName: string, config: ScriptConfig): PackageConfig {\n const customConfig = config.customPackageConfigs[packageName] ?? {};\n\n return { ...config.defaultPackageConfig, ...customConfig };\n }\n\n private formatOutputPath(pattern: string, directory: string, name: string): string {\n const dirPart = directory === \".\" ? \"\" : `${directory}/`;\n\n return pattern.replace(\"{dir}/\", dirPart).replace(\"{dir}\", directory).replace(\"{name}\", name);\n }\n\n private saveExportsAnalysis(packageDir: string, analysis: AnalysisResult): void {\n const outputDir = path.join(packageDir, \".exports-analysis\");\n\n this.fileSystemPort.createDirectory(outputDir);\n this.fileSystemPort.writeFile(path.join(outputDir, \"exports-analysis.json\"), JSON.stringify(analysis, null, 2));\n }\n\n private saveExportsPreview(packageDir: string, exports: PackageExports): void {\n const outputDir = path.join(packageDir, \".exports-analysis\");\n\n this.fileSystemPort.createDirectory(outputDir);\n this.fileSystemPort.writeFile(path.join(outputDir, \"exports-preview.json\"), JSON.stringify(exports, null, 2));\n }\n}\n","import { z } from \"zod\";\n\n/**\n * Schema for validating project configuration.\n * Ensures the project name is URL-friendly, not reserved, and the directory is valid.\n */\nexport const projectSchema = z.object({\n name: z\n .string()\n .min(1, \"Project name cannot be empty\")\n .max(100, \"Project name is too long (maximum 100 characters)\")\n .regex(/^[a-z0-9-~][a-z0-9-._~]*$/, {\n message:\n \"Project name must be URL-friendly (letters, numbers, hyphens, underscores, dots; no @ or scoped packages)\",\n })\n .refine((name) => name !== \".\" && name !== \"..\", {\n message: \"Project name cannot be '.' or '..'\",\n })\n .refine((name) => !/^(?<reserved>CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i.test(name), {\n message: \"Project name is a reserved system name\",\n }),\n directory: z.string().describe(\"Project directory path\"),\n packageJsonExists: z.boolean().describe(\"Whether package.json exists in the project directory\"),\n});\n\nexport type Project = z.infer<typeof projectSchema>;\n","import { inject, injectable } from \"inversify\";\nimport path from \"node:path\";\n\nimport type { CommandExecutorPort } from \"@/application/ports/command-executor.port\";\nimport type { FileSystemPort } from \"@/application/ports/file-system.port\";\nimport type { PromptPort } from \"@/application/ports/prompt.port\";\nimport type { Project } from \"@/domain/entities/project\";\nimport type { ProjectRepositoryInterface } from \"@/domain/interfaces/project.repository\";\nimport type { FileSystemUtility } from \"@/infrastructure/utilities/file-system-utility\";\n\nimport { PackageJson, packageJsonSchema } from \"@/domain/entities/package-config\";\nimport { projectSchema } from \"@/domain/entities/project\";\nimport { TYPES } from \"@/ioc/types\";\n\n@injectable()\nexport class FileSystemProjectRepository implements ProjectRepositoryInterface {\n constructor(\n @inject(TYPES.FileSystemPort) private fileSystemPort: FileSystemPort,\n @inject(TYPES.CommandExecutorPort) private commandExecutorPort: CommandExecutorPort,\n @inject(TYPES.PromptPort) private promptPort: PromptPort,\n @inject(TYPES.FileSystemUtility) private fileSystemUtility: FileSystemUtility,\n ) {}\n\n async checkExistingProject(projectName?: string): Promise<Project> {\n let fullPath = process.cwd();\n let name = \"\";\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n const packageJsonExists = this.fileSystemPort.exists(packageJsonPath);\n\n if (packageJsonExists) {\n const result = packageJsonSchema.safeParse(JSON.parse(this.fileSystemPort.readFile(packageJsonPath)));\n\n if (result.success) {\n name = result.data.name;\n }\n } else {\n name = await this.getValidProjectName(projectName);\n\n fullPath = path.resolve(process.cwd(), name);\n }\n\n return {\n name,\n directory: fullPath,\n packageJsonExists,\n };\n }\n\n createNextProject(projectName: string): void {\n const flags = [\n \"--ts\",\n \"--tailwind\",\n \"--eslint\",\n \"--app\",\n \"--turbo\",\n \"--use-pnpm\",\n \"--src-dir\",\n \"--turbopack\",\n '--import-alias \"@/*\"',\n ].join(\" \");\n\n this.commandExecutorPort.runCommand(`npx create-next-app@latest ${projectName} ${flags}`);\n }\n\n updateLayoutFile(projectDir: string): void {\n const layoutPath = path.join(projectDir, \"src\", \"app\", \"layout.tsx\");\n const htmlTarget = '<html className={cn(fontVariables, \"antialiased\")} lang=\"en\">';\n\n this.fileSystemUtility.updateFileIfNeeded(\n layoutPath,\n (content) => content.includes(htmlTarget),\n (content) => {\n // Import replacements\n const newImports = `import type { Metadata } from \"next\";\nimport type { JSX, ReactNode } from \"react\";\nimport { cn } from \"@codefast/ui\";\nimport { fontVariables } from \"@/lib/fonts\";\nimport \"@/app/globals.css\";`;\n\n let result = content;\n\n // Remove existing font imports and definitions\n result = result.replaceAll(/import\\s+{[^}]+}\\s+from\\s+[\"']next\\/font\\/google[\"'];\\s*/g, \"\");\n result = result.replace(/const\\s+geistSans\\s*=[^;]+;\\s*const\\s+geistMono\\s*=[^;]+;\\s*/, \"\");\n result = result.replace(\n /import\\s+type\\s+{[^}]+}\\s+from\\s+[\"']next[\"'];\\s*import\\s+[\"']\\.\\/globals\\.css[\"'];\\s*/,\n newImports,\n );\n\n // Update React.ReactNode to ReactNode and add a return type\n result = result.replace(\n /export default function RootLayout\\({\\s*children,\\s*}\\s*:\\s*Readonly<{\\s*children:\\s*React\\.ReactNode;\\s*}>\\)\\s*{/,\n `export default function RootLayout({ children }: Readonly<{ children: ReactNode }>): JSX.Element {`,\n );\n\n // Update HTML and body tags\n result = result.replace(/<html\\s+lang=\"en\"\\s*>/, htmlTarget);\n result = result.replace(/<body\\s+className={`[^`]*`}\\s*>/, `<body>`);\n\n return result;\n },\n );\n }\n\n updatePageFile(projectDir: string): void {\n const pagePath = path.join(projectDir, \"src\", \"app\", \"page.tsx\");\n\n this.fileSystemUtility.updateFileIfNeeded(\n pagePath,\n (content) => content.includes(\"): JSX.Element\"),\n (content) => {\n let result = content;\n\n // Add JSX import if not present\n if (!result.includes(\"import type { JSX }\")) {\n if (result.includes(\"import type {\")) {\n // Add JSX to existing type import\n result = result.replace(\n /import type {(?<types>[^}]+)} from \"react\";/,\n 'import type {$1, JSX } from \"react\";',\n );\n } else if (result.includes(\"import {\")) {\n // Add type import before the first import\n result = result.replace(/import {/, 'import type { JSX } from \"react\";\\n\\nimport {');\n } else {\n // Add type import at the beginning of the file\n result = `import type { JSX } from \"react\";\\n\\n${result}`;\n }\n }\n\n // Add JSX.Element return type to the Home component\n result = result.replace(/export default function Home\\(\\) {/, \"export default function Home(): JSX.Element {\");\n\n return result;\n },\n );\n }\n\n updatePostcssConfig(projectDir: string): void {\n const postcssConfigPath = path.join(projectDir, \"postcss.config.mjs\");\n const typeComment = `/** @type {import('postcss-load-config').Config} */\\n`;\n\n this.fileSystemUtility.updateFileIfNeeded(\n postcssConfigPath,\n (content) => content.includes(typeComment),\n (content) => content.replace(\"const config = {\", `${typeComment}const config = {`),\n );\n }\n\n updateNextConfig(projectDir: string): void {\n const nextConfigPath = path.join(projectDir, \"next.config.ts\");\n const optimizePackagesConfig = 'optimizePackageImports: [\"@codefast/ui\"]';\n\n this.fileSystemUtility.updateFileIfNeeded(\n nextConfigPath,\n (content) => content.includes(optimizePackagesConfig),\n (content) =>\n content.replace(\n /const nextConfig: NextConfig = \\{/,\n `const nextConfig: NextConfig = {\n experimental: {\n optimizePackageImports: [\"@codefast/ui\"],\n },`,\n ),\n );\n }\n\n updatePackageJson(projectDir: string): void {\n const packageJsonPath = path.join(projectDir, \"package.json\");\n\n if (!this.fileSystemPort.exists(packageJsonPath)) {\n console.warn(`⚠️ package.json not found, skipping update.`);\n\n return;\n }\n\n let packageJson: PackageJson | undefined;\n\n try {\n packageJson = packageJsonSchema.parse(JSON.parse(this.fileSystemPort.readFile(packageJsonPath)));\n } catch {\n console.warn(`Failed to parse ${packageJsonPath}, skipping update.`);\n\n return;\n }\n\n packageJson.scripts = {\n ...packageJson.scripts,\n \"check-types\": \"tsc --noEmit\",\n \"deploy:preview\": \"vercel deploy --archive=tgz\",\n \"deploy:prod\": \"vercel deploy --archive=tgz --prod\",\n format: \"prettier --write --ignore-unknown .\",\n \"format:check\": \"prettier --check --ignore-unknown .\",\n lint: \"next lint --fix --max-warnings 0\",\n \"lint:check\": \"next lint --max-warnings 0\",\n \"package:install\": \"pnpm install\",\n \"package:outdated\": \"pnpm outdated\",\n \"package:upgrade\": \"pnpm update --latest\",\n preview: \"pnpm build && pnpm start\",\n };\n\n packageJson[\"simple-git-hooks\"] = {\n \"pre-commit\": \"pnpm lint-staged\",\n \"commit-msg\": \"pnpm commitlint --edit\",\n };\n\n this.fileSystemPort.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));\n console.log(`📝 Updated ${packageJsonPath}`);\n }\n\n private async getValidProjectName(initialName?: string, attempts = 0, maxAttempts = 3): Promise<string> {\n const projectName = initialName ?? (await this.promptPort.prompt(\"Enter project name: \"));\n const result = projectSchema.safeParse({ name: projectName, directory: \"\", packageJsonExists: false });\n\n if (result.success) {\n const fullPath = path.resolve(process.cwd(), projectName);\n\n if (this.fileSystemPort.exists(fullPath)) {\n throw new Error(`A directory named \"${projectName}\" already exists.`);\n }\n\n try {\n this.fileSystemPort.access(process.cwd());\n } catch {\n throw new Error(\"Cannot create project: No write permission in current directory.\");\n }\n\n return projectName;\n }\n\n if (attempts >= maxAttempts - 1) {\n throw new Error(`Exceeded maximum attempts to enter a valid project name.`);\n }\n\n console.error(`❌ ${result.error.message} (${maxAttempts - attempts - 1} attempts remaining)`);\n\n return this.getValidProjectName(undefined, attempts + 1, maxAttempts);\n }\n}\n","import { injectable } from \"inversify\";\n\nimport type { DependencyConfigServiceInterface } from \"@/domain/interfaces/dependency-config.service\";\n\n@injectable()\nexport class DependencyConfigService implements DependencyConfigServiceInterface {\n private readonly MAIN_DEPENDENCIES: string[] = [\n \"@codefast/ui\",\n \"@codefast/hooks\",\n \"recharts\",\n \"react-hook-form\",\n \"next-themes\",\n \"date-fns\",\n \"lucide-react\",\n ];\n\n private readonly DEV_DEPENDENCIES: Record<string, string[]> = {\n commitLint: [\"@commitlint/cli\", \"@commitlint/config-conventional\", \"@commitlint/types\"],\n gitTools: [\"simple-git-hooks\"],\n formatting: [\"prettier\", \"prettier-plugin-packagejson\", \"prettier-plugin-tailwindcss\", \"lint-staged\"],\n linting: [\"@codefast/eslint-config\"],\n };\n\n private readonly PACKAGES_TO_REMOVE: string[] = [\"@eslint/eslintrc\", \"eslint-config-next\"];\n\n getMainDependencies(): string[] {\n return this.MAIN_DEPENDENCIES;\n }\n\n getDevDependencies(): Record<string, string[]> {\n return this.DEV_DEPENDENCIES;\n }\n\n getPackagesToRemove(): string[] {\n return this.PACKAGES_TO_REMOVE;\n }\n}\n","import { inject, injectable } from \"inversify\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport type { FileSystemPort } from \"@/application/ports/file-system.port\";\nimport type { PackageInfoServiceInterface } from \"@/domain/interfaces/package-info.service\";\n\nimport { packageJsonSchema } from \"@/domain/entities/package-config\";\nimport { TYPES } from \"@/ioc/types\";\n\n@injectable()\nexport class NodePackageInfoService implements PackageInfoServiceInterface {\n constructor(@inject(TYPES.FileSystemPort) private fileSystemPort: FileSystemPort) {}\n\n getPackageVersion(): string {\n try {\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n const packageJsonPath = path.resolve(__dirname, \"..\", \"package.json\");\n const packageJsonResult = packageJsonSchema.parse(JSON.parse(this.fileSystemPort.readFile(packageJsonPath)));\n\n return packageJsonResult.version ?? \"0.0.0\";\n } catch (error) {\n console.warn(`Failed to read package version: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n\n return \"unknown\";\n }\n }\n}\n","import { inject, injectable } from \"inversify\";\nimport path from \"node:path\";\n\nimport type { FileSystemPort } from \"@/application/ports/file-system.port\";\n\nimport { TYPES } from \"@/ioc/types\";\n\n@injectable()\nexport class FileSystemUtility {\n constructor(@inject(TYPES.FileSystemPort) private fileSystemPort: FileSystemPort) {}\n\n /**\n * Updates the file content if a condition is met.\n *\n * @param filePath - The path of the file to potentially update.\n * @param checkFn - A function that determines if the current content needs updating.\n * It takes the current content as input and returns a boolean indicating whether an update is\n * necessary.\n * @param updateFn - A function that generates new content for the file based on its current content.\n * It takes the current content as input and returns the updated content as output.\n *\n * This method checks if the specified file exists in the file system. If it does, it reads the current content of\n * the file and uses `checkFn` to determine whether an update is required. If `checkFn` returns true, indicating no\n * updates are needed, a log message is displayed. Otherwise, `updateFn` is used to generate new content for the\n * file. The file system is then updated with this new content, and a success message is logged. In case of an\n * error during the update process, a warning message is logged instead.\n *\n * @returns void - This method does not return any value.\n */\n updateFileIfNeeded(\n filePath: string,\n checkFn: (content: string) => boolean,\n updateFn: (content: string) => string,\n ): void {\n if (!this.fileSystemPort.exists(filePath)) {\n return;\n }\n\n const currentContent = this.fileSystemPort.readFile(filePath);\n\n if (checkFn(currentContent)) {\n console.log(`ℹ️ ${filePath} is already up to date`);\n\n return;\n }\n\n try {\n const updatedContent = updateFn(currentContent);\n\n this.fileSystemPort.writeFile(filePath, updatedContent);\n console.log(`📝 Updated ${filePath}`);\n } catch (error) {\n console.warn(`⚠️ Failed to update ${filePath}: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n }\n }\n\n /**\n * Backs up a file to a specified backup directory with a timestamped filename.\n *\n * @param filePath - The path of the file to be backed up.\n * @param backupDir - The name of the subdirectory under the original file's directory where the backup should be\n * stored. This directory will be created if it does not exist.\n *\n * @returns void\n */\n backupFile(filePath: string, backupDir: string): void {\n try {\n const content = this.fileSystemPort.readFile(filePath);\n const baseName = path.basename(filePath);\n const timestamp = new Date().toISOString().replaceAll(/[:.]/g, \"-\");\n const backupPath = path.join(path.dirname(filePath), backupDir, `${baseName}.backup.${timestamp}`);\n\n this.fileSystemPort.createDirectory(path.dirname(backupPath));\n this.fileSystemPort.writeFile(backupPath, content);\n } catch (error) {\n console.error(`Error backing up ${filePath}: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n }\n }\n}\n","import { Container } from \"inversify\";\n\nimport type { AnalysisPort } from \"@/application/ports/analysis.port\";\nimport type { CommandExecutorPort } from \"@/application/ports/command-executor.port\";\nimport type { FileSystemPort } from \"@/application/ports/file-system.port\";\nimport type { PromptPort } from \"@/application/ports/prompt.port\";\nimport type { ConfigServiceInterface } from \"@/domain/interfaces/config.service\";\nimport type { DependencyConfigServiceInterface } from \"@/domain/interfaces/dependency-config.service\";\nimport type { PackageInfoServiceInterface } from \"@/domain/interfaces/package-info.service\";\nimport type { PackageRepository } from \"@/domain/interfaces/package.repository\";\nimport type { ProjectRepositoryInterface } from \"@/domain/interfaces/project.repository\";\n\nimport { CreateProjectCommand } from \"@/application/commands/create-project.command\";\nimport { UpdateExportsCommand } from \"@/application/commands/update-exports.command\";\nimport { CreateProjectUseCase } from \"@/application/use-cases/create-project.use-case\";\nimport { UpdateExportsUseCase } from \"@/application/use-cases/update-exports.use-case\";\nimport { CLIAdapter } from \"@/infrastructure/adapters/cli.adapter\";\nimport { NodeCommandExecutorAdapter } from \"@/infrastructure/adapters/node-command-executor.adapter\";\nimport { NodeFileSystemAdapter } from \"@/infrastructure/adapters/node-file-system.adapter\";\nimport { NodePromptAdapter } from \"@/infrastructure/adapters/node-prompt.adapter\";\nimport { TsMorphAnalysisAdapter } from \"@/infrastructure/adapters/ts-morph-analysis.adapter\";\nimport { FileSystemPackageRepository } from \"@/infrastructure/repositories/file-system-package.repository\";\nimport { FileSystemProjectRepository } from \"@/infrastructure/repositories/file-system-project.repository\";\nimport { ConfigService } from \"@/infrastructure/services/config.service\";\nimport { DependencyConfigService } from \"@/infrastructure/services/dependency-config.service\";\nimport { NodePackageInfoService } from \"@/infrastructure/services/node-package-info.service\";\nimport { FileSystemUtility } from \"@/infrastructure/utilities/file-system-utility\";\nimport { TYPES } from \"@/ioc/types\";\n\nconst container = new Container();\n\n// Domain bindings\ncontainer.bind<ProjectRepositoryInterface>(TYPES.ProjectRepository).to(FileSystemProjectRepository).inSingletonScope(); // Handles project creation and file updates\ncontainer.bind<PackageRepository>(TYPES.PackageRepository).to(FileSystemPackageRepository).inSingletonScope(); // Manages package.json exports\n\ncontainer.bind<PackageInfoServiceInterface>(TYPES.PackageInfoService).to(NodePackageInfoService).inSingletonScope(); // Provides package version\ncontainer\n .bind<DependencyConfigServiceInterface>(TYPES.DependencyConfigService)\n .to(DependencyConfigService)\n .inSingletonScope(); // Provides dependency configuration\ncontainer.bind<ConfigServiceInterface>(TYPES.ConfigService).to(ConfigService).inSingletonScope(); // Provides CLI configuration\n\n// Application bindings\ncontainer.bind<FileSystemPort>(TYPES.FileSystemPort).to(NodeFileSystemAdapter).inSingletonScope(); // File system operations\ncontainer.bind<CommandExecutorPort>(TYPES.CommandExecutorPort).to(NodeCommandExecutorAdapter).inSingletonScope(); // Command execution\ncontainer.bind<PromptPort>(TYPES.PromptPort).to(NodePromptAdapter).inSingletonScope(); // User input prompting\ncontainer.bind<AnalysisPort>(TYPES.AnalysisPort).to(TsMorphAnalysisAdapter).inSingletonScope(); // Import analysis\n\ncontainer.bind<CreateProjectUseCase>(TYPES.CreateProjectUseCase).to(CreateProjectUseCase).inSingletonScope(); // Project creation logic\ncontainer.bind<UpdateExportsUseCase>(TYPES.UpdateExportsUseCase).to(UpdateExportsUseCase).inSingletonScope(); // Export update logic\n\ncontainer.bind<CreateProjectCommand>(TYPES.CreateProjectCommand).to(CreateProjectCommand).inSingletonScope(); // CLI command for project creation\ncontainer.bind<UpdateExportsCommand>(TYPES.UpdateExportsCommand).to(UpdateExportsCommand).inSingletonScope(); // CLI command for export updates\n\n// Infrastructure bindings\ncontainer.bind<CLIAdapter>(TYPES.CLIAdapter).to(CLIAdapter).inSingletonScope(); // CLI setup and command registration\n\ncontainer.bind<FileSystemUtility>(TYPES.FileSystemUtility).to(FileSystemUtility).inSingletonScope(); // File system utility functions\n\nexport { container };\n","\n\nimport type { CLIAdapter } from \"@/infrastructure/adapters/cli.adapter\";\n\nimport { container } from \"@/ioc/container\";\nimport { TYPES } from \"@/ioc/types\";\n\nfunction main(): void {\n const cliAdapter = container.get<CLIAdapter>(TYPES.CLIAdapter);\n\n cliAdapter.initialize();\n}\n\nmain();\n"],"names":["TYPES","Symbol","CreateProjectCommand","createProjectUseCase","Command","projectName","process","UpdateExportsCommand","updateExportsUseCase","options","Boolean","handleError","error","defaultMessage","message","Error","console","ConfigService","CreateProjectUseCase","projectRepository","fileSystemPort","commandExecutorPort","promptPort","configService","project","configGroups","projectNameArg","projectDir","UpdateExportsUseCase","packageRepository","packageJsonPaths","successCount","skipCount","errorCount","packageJsonPath","result","CLIAdapter","createProjectCommand","updateExportsCommand","packageInfoService","program","packageConfigSchema","z","scriptConfigSchema","exportConfigSchema","PackageExportsSchema","packageJsonSchema","NodeCommandExecutorAdapter","dependencyConfigService","command","execSync","mainDependencies","devDependencies","allDevDependencies","Object","path","packageJson","JSON","dependencies","packagesToRemove","pkg","NodeFileSystemAdapter","filePath","fs","content","dir","dirPath","category","configs","config","fullPath","NodePromptAdapter","readline","Promise","resolve","answer","TsMorphAnalysisAdapter","indexFilePath","packageConfig","Project","sourceFile","imports","prefixesToRemove","regexPattern","RegExp","exportDecl","moduleSpecifier","isExternal","parts","directory","name","exportPath","modulePath","match","remainingPath","FileSystemPackageRepository","analysisPort","fileSystemUtility","configPath","glob","packageDir","packageName","srcIndexPath","analysis","newExports","currentExportsCount","newExportsCount","updatedPackageJson","existingExports","exports","importPath","esmOutput","cjsOutput","typesOutput","typesCjsOutput","userConfig","merge","configContent","customConfig","pattern","dirPart","outputDir","projectSchema","FileSystemProjectRepository","packageJsonExists","flags","layoutPath","htmlTarget","newImports","pagePath","postcssConfigPath","typeComment","nextConfigPath","optimizePackagesConfig","initialName","attempts","maxAttempts","undefined","DependencyConfigService","NodePackageInfoService","__filename","fileURLToPath","__dirname","packageJsonResult","FileSystemUtility","checkFn","updateFn","currentContent","updatedContent","backupDir","baseName","timestamp","Date","backupPath","container","Container","main","cliAdapter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,QAAQ;IACnB,mBAAmBC,OAAO,GAAG,CAAC;IAC9B,mBAAmBA,OAAO,GAAG,CAAC;IAE9B,gBAAgBA,OAAO,GAAG,CAAC;IAC3B,qBAAqBA,OAAO,GAAG,CAAC;IAChC,YAAYA,OAAO,GAAG,CAAC;IACvB,cAAcA,OAAO,GAAG,CAAC;IAEzB,oBAAoBA,OAAO,GAAG,CAAC;IAC/B,yBAAyBA,OAAO,GAAG,CAAC;IACpC,eAAeA,OAAO,GAAG,CAAC;IAE1B,mBAAmBA,OAAO,GAAG,CAAC;IAE9B,sBAAsBA,OAAO,GAAG,CAAC;IACjC,sBAAsBA,OAAO,GAAG,CAAC;IAEjC,sBAAsBA,OAAO,GAAG,CAAC;IACjC,sBAAsBA,OAAO,GAAG,CAAC;IAEjC,YAAYA,OAAO,GAAG,CAAC;AACzB;;;;;;;;;;;;;;;ACbO,MAAMC;IACX,YAAwDC,oBAA0C,CAAE;aAA5CA,oBAAoB,GAApBA;IAA6C;IAOrG,aAAsB;QACpB,OAAO,IAAIC,mCAAAA,OAAOA,GACf,IAAI,CAAC,kBACL,WA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