@forinda/kickjs 0.2.0 → 1.4.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/cli/cli.ts","../package.json","../src/cli/tasks/init-project.ts","../src/cli/utils/fs.ts","../src/cli/commands/init.ts","../src/cli/tasks/generate-controller.ts","../src/cli/tasks/generate-domain.ts","../src/cli/commands/generate-controller.ts","../src/cli/commands/run.ts","../src/utils/errors.ts","../src/cli/utils/config-loader.ts","../src/cli/utils/shell.ts","../src/cli/commands/custom.ts"],"sourcesContent":["import { Command } from 'commander';\nimport pkg from '../../package.json';\nimport { registerInitCommand } from './commands/init';\nimport { registerGeneratorCommands } from './commands/generate-controller';\nimport { registerRunCommands } from './commands/run';\nimport { loadKickConfig } from './utils/config-loader';\nimport { registerCustomCommands } from './commands/custom';\n\nasync function main() {\n const program = new Command();\n program.name('kick').description('Kick project CLI').version(pkg.version ?? '0.0.0');\n\n const config = await loadKickConfig(process.cwd());\n\n registerInitCommand(program, { structure: config?.structure });\n registerGeneratorCommands(program, {\n controllerRoot: config?.generators?.controllerRoot,\n structure: config?.structure\n });\n registerRunCommands(program);\n registerCustomCommands(program, config);\n\n program.showHelpAfterError();\n\n try {\n await program.parseAsync(process.argv);\n } catch (error) {\n console.error(error instanceof Error ? error.message : error);\n process.exitCode = 1;\n }\n}\n\nmain().catch((error) => {\n console.error(error instanceof Error ? error.message : error);\n process.exitCode = 1;\n});\n","{\n \"name\": \"@forinda/kickjs\",\n \"version\": \"0.2.0\",\n \"description\": \"Express + TypeScript + Inversify starter with reactive state, request telemetry, and Spring Boot-style decorators.\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"files\": [\n \"dist\",\n \"LICENSE\",\n \"README.md\"\n ],\n \"bin\": {\n \"kick\": \"dist/cli.js\"\n },\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"dev\": \"tsup --watch src/index.ts\",\n \"check\": \"tsc --noEmit\",\n \"build\": \"tsup\",\n \"start\": \"node dist/index.js\",\n \"prepublishOnly\": \"npm run build && npm run check && npm test\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"prepare\": \"husky\",\n \"prerelease\": \"npm run clean && npm run build && npm run check && npm test\",\n \"release:patch\": \"node scripts/release.js patch\",\n \"release:minor\": \"node scripts/release.js minor\",\n \"release:major\": \"node scripts/release.js major\",\n \"release:prerelease\": \"node scripts/release.js prerelease\",\n \"release:dry\": \"node scripts/release.js patch --dry-run\",\n \"version\": \"git add package.json && git commit -m \\\"chore: bump version to $(node -p \\\"require('./package.json').version\\\")\\\"\"\n },\n \"keywords\": [\n \"express\",\n \"typescript\",\n \"inversify\",\n \"decorators\",\n \"starter\"\n ],\n \"author\": \"Felix Orinda\",\n \"license\": \"MIT\",\n \"engines\": {\n \"node\": \">=20.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"dependencies\": {\n \"commander\": \"^11.1.0\"\n },\n \"peerDependencies\": {\n \"express\": \"^5.1.0\",\n \"inversify\": \"^7.10.0\",\n \"reflect-metadata\": \"^0.2.2\"\n },\n \"devDependencies\": {\n \"@swc/core\": \"^1.7.28\",\n \"@types/express\": \"^5.0.3\",\n \"@types/node\": \"^24.5.2\",\n \"@types/supertest\": \"^6.0.3\",\n \"@vitest/coverage-v8\": \"^3.2.4\",\n \"express\": \"^5.1.0\",\n \"husky\": \"^9.1.7\",\n \"inversify\": \"^7.10.0\",\n \"joi\": \"^18.0.1\",\n \"node-mocks-http\": \"^1.17.2\",\n \"reflect-metadata\": \"^0.2.2\",\n \"supertest\": \"^7.1.4\",\n \"ts-node\": \"^10.9.2\",\n \"ts-node-dev\": \"^2.0.0\",\n \"tsup\": \"^8.5.0\",\n \"tsx\": \"^4.20.6\",\n \"typescript\": \"^5.9.2\",\n \"vitest\": \"^3.2.4\",\n \"zod\": \"^4.1.9\"\n },\n \"directories\": {\n \"doc\": \"docs\",\n \"example\": \"examples\",\n \"test\": \"tests\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/forinda/kick-js.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/forinda/kick-js/issues\"\n },\n \"homepage\": \"https://github.com/forinda/kick-js#readme\"\n}\n","import path from 'node:path';\nimport { fileExists, ensureDirectory, writeFileSafe, writeJsonFile, readJsonFile } from '../utils/fs';\nimport type { KickStructureConfig } from '../types';\n\nexport interface InitProjectOptions {\n targetDirectory: string;\n force?: boolean;\n packageName?: string;\n structure?: KickStructureConfig;\n}\n\nexport interface InitProjectResult {\n createdFiles: string[];\n skippedFiles: string[];\n}\n\nexport async function initProject(options: InitProjectOptions): Promise<InitProjectResult> {\n const targetDir = path.resolve(process.cwd(), options.targetDirectory || '.');\n const force = options.force ?? false;\n const createdFiles: string[] = [];\n const skippedFiles: string[] = [];\n\n await ensureDirectory(targetDir);\n\n const packageJsonPath = path.join(targetDir, 'package.json');\n const packageJson = (await readJsonFile<Record<string, unknown>>(packageJsonPath)) ?? {};\n if (Object.keys(packageJson).length === 0) {\n const name = options.packageName ??\n (path.basename(targetDir).replace(/[^a-zA-Z0-9-_]/g, '-') || 'kick-app');\n await writeJsonFile(\n packageJsonPath,\n {\n name,\n version: '1.0.0',\n private: true,\n type: 'commonjs',\n main: 'dist/index.js',\n scripts: {\n dev: 'kick dev',\n build: 'kick build',\n start: 'kick start',\n typecheck: 'tsc --noEmit',\n clean: 'rimraf dist'\n },\n dependencies: {\n '@forinda/kickjs': 'latest',\n express: '^5.1.0',\n inversify: '^7.10.0',\n 'reflect-metadata': '^0.2.2'\n },\n devDependencies: {\n '@types/express': '^5.0.3',\n '@types/node': '^24.5.2',\n rimraf: '^5.0.0',\n 'ts-node-dev': '^2.0.0',\n tsup: '^8.5.0',\n tsx: '^4.20.6',\n typescript: '^5.9.2'\n },\n engines: {\n node: '>=20.0.0'\n }\n },\n { force: true }\n );\n createdFiles.push('package.json');\n } else {\n skippedFiles.push('package.json');\n }\n\n const tsconfigPath = path.join(targetDir, 'tsconfig.json');\n const tsconfigExists = await fileExists(tsconfigPath);\n if (!tsconfigExists || force) {\n await writeJsonFile(\n tsconfigPath,\n {\n compilerOptions: {\n target: 'ES2022',\n module: 'CommonJS',\n moduleResolution: 'node',\n lib: ['ES2022'],\n rootDir: 'src',\n outDir: 'dist',\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n forceConsistentCasingInFileNames: true,\n strict: true,\n noImplicitAny: true,\n strictNullChecks: true,\n strictFunctionTypes: true,\n noImplicitReturns: true,\n noFallthroughCasesInSwitch: true,\n noUncheckedIndexedAccess: true,\n noImplicitOverride: true,\n exactOptionalPropertyTypes: true,\n skipLibCheck: true,\n resolveJsonModule: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true,\n declaration: true,\n declarationMap: true,\n sourceMap: true\n },\n include: ['src/**/*'],\n exclude: ['node_modules', 'dist', '**/*.test.ts', '**/*.spec.ts']\n },\n { force: true }\n );\n createdFiles.push('tsconfig.json');\n } else {\n skippedFiles.push('tsconfig.json');\n }\n\n const mainFilePath = path.join(targetDir, 'src', 'index.ts');\n const mainCreated = await writeFileSafe(\n mainFilePath,\n `import 'reflect-metadata';\nimport express from 'express';\nimport { createKickAppWithConfig } from '@forinda/kickjs';\nimport { AppModule } from './app.module';\n\nasync function startApp() {\n const app = express();\n app.use(express.json());\n\n const server = await createKickAppWithConfig({\n app,\n modules: [AppModule]\n });\n\n const port = server.kickApp.getConfig('port') || 3000;\n const host = server.kickApp.getConfig('host') || 'localhost';\n \n server.listen(port, () => {\n console.log(\\`šŸš€ \\${server.kickApp.getConfig('name')} running on http://\\${host}:\\${port}\\`);\n console.log(\\`šŸ“Š App Stats:\\`, server.getStats());\n });\n}\n\nstartApp().catch((error) => {\n console.error('Failed to start application:', error);\n process.exit(1);\n});\n`,\n { force }\n );\n \n if (mainCreated) {\n createdFiles.push('src/index.ts');\n } else {\n skippedFiles.push('src/index.ts');\n }\n\n // Create app module\n const appModulePath = path.join(targetDir, 'src', 'app.module.ts');\n const appModuleCreated = await writeFileSafe(\n appModulePath,\n `import { createModule } from '@forinda/kickjs';\nimport { UserController } from './controllers/user.controller';\nimport { UserService } from './services/user.service';\n\nexport const AppModule = createModule('app', {\n controllers: [UserController],\n services: [UserService]\n});\n`,\n { force }\n );\n \n if (appModuleCreated) {\n createdFiles.push('src/app.module.ts');\n } else {\n skippedFiles.push('src/app.module.ts');\n }\n\n // Create domain structure\n const domainBase = path.join(targetDir, 'src');\n for (const folder of ['controllers', 'services', 'types']) {\n const folderPath = path.join(domainBase, folder);\n const exists = await fileExists(folderPath);\n await ensureDirectory(folderPath);\n const relativePath = path.relative(targetDir, folderPath);\n if (!exists) {\n createdFiles.push(relativePath);\n } else {\n skippedFiles.push(relativePath);\n }\n }\n\n // Create sample controller\n const controllerPath = path.join(targetDir, 'src', 'controllers', 'user.controller.ts');\n const controllerCreated = await writeFileSafe(\n controllerPath,\n `import { \n KickController, \n KickGet, \n KickPost, \n KickRequestContext,\n KickInject \n} from '@forinda/kickjs';\nimport { UserService } from '../services/user.service';\n\n@KickController('/users')\nexport class UserController {\n constructor(\n @KickInject(UserService)\n private readonly userService: UserService\n ) {}\n\n @KickGet('/')\n async getUsers(context: KickRequestContext) {\n const { res } = context;\n const users = await this.userService.findAll();\n \n res.json({\n users,\n requestId: context.meta.requestId,\n timestamp: context.meta.startTime\n });\n }\n\n @KickPost('/')\n async createUser(context: KickRequestContext) {\n const { req, res } = context;\n \n if (!req.body.name || !req.body.email) {\n return res.status(400).json({\n error: 'Name and email are required',\n requestId: context.meta.requestId\n });\n }\n\n const user = await this.userService.create(req.body);\n res.status(201).json({\n user,\n requestId: context.meta.requestId\n });\n }\n}\n`,\n { force }\n );\n const relativeControllerPath = path.relative(targetDir, controllerPath);\n \n if (controllerCreated) {\n createdFiles.push(relativeControllerPath);\n } else {\n skippedFiles.push(relativeControllerPath);\n }\n\n // Create sample service\n const servicePath = path.join(targetDir, 'src', 'services', 'user.service.ts');\n const serviceCreated = await writeFileSafe(\n servicePath,\n `import { KickInjectable } from '@forinda/kickjs';\n\nexport interface User {\n id: string;\n name: string;\n email: string;\n createdAt: Date;\n}\n\n@KickInjectable()\nexport class UserService {\n private users: User[] = [];\n\n async findAll(): Promise<User[]> {\n return this.users;\n }\n\n async create(userData: { name: string; email: string }): Promise<User> {\n const user: User = {\n id: Math.random().toString(36).substr(2, 9),\n name: userData.name,\n email: userData.email,\n createdAt: new Date()\n };\n \n this.users.push(user);\n return user;\n }\n\n async findById(id: string): Promise<User | undefined> {\n return this.users.find(user => user.id === id);\n }\n}\n`,\n { force }\n );\n const relativeServicePath = path.relative(targetDir, servicePath);\n \n if (serviceCreated) {\n createdFiles.push(relativeServicePath);\n } else {\n skippedFiles.push(relativeServicePath);\n }\n\n // Create types file\n const typesPath = path.join(targetDir, 'src', 'types', 'user.types.ts');\n const typesCreated = await writeFileSafe(\n typesPath,\n `export interface User {\n id: string;\n name: string;\n email: string;\n createdAt: Date;\n}\n\nexport interface CreateUserRequest {\n name: string;\n email: string;\n}\n\nexport interface UserResponse {\n user: User;\n requestId: string;\n}\n`,\n { force }\n );\n const relativeTypesPath = path.relative(targetDir, typesPath);\n \n if (typesCreated) {\n createdFiles.push(relativeTypesPath);\n } else {\n skippedFiles.push(relativeTypesPath);\n }\n\n // Create kick configuration\n const configPath = path.join(targetDir, 'kick.config.js');\n const configCreated = await writeFileSafe(\n configPath,\n `module.exports = {\n app: {\n name: '${options.packageName || 'kick-app'}',\n port: 3000,\n host: 'localhost',\n prefix: '/api/v1',\n env: 'development'\n },\n dev: {\n port: 3000,\n host: 'localhost',\n entry: 'src/index.ts',\n watch: true,\n env: {\n NODE_ENV: 'development',\n DEBUG: 'app:*'\n }\n },\n start: {\n port: 3000,\n host: '0.0.0.0',\n entry: 'dist/index.js',\n env: {\n NODE_ENV: 'production'\n }\n }\n};\n`,\n { force }\n );\n \n if (configCreated) {\n createdFiles.push('kick.config.js');\n } else {\n skippedFiles.push('kick.config.js');\n }\n\n // Create additional project files\n \n // Create .gitignore\n const gitignorePath = path.join(targetDir, '.gitignore');\n const gitignoreCreated = await writeFileSafe(\n gitignorePath,\n `# Dependencies\nnode_modules/\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\n\n# Build outputs\ndist/\nbuild/\n*.tsbuildinfo\n\n# Environment variables\n.env\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\n# IDE files\n.vscode/\n.idea/\n*.swp\n*.swo\n*~\n\n# OS files\n.DS_Store\n.DS_Store?\n._*\n.Spotlight-V100\n.Trashes\nehthumbs.db\nThumbs.db\n\n# Logs\nlogs/\n*.log\n\n# Runtime data\npids/\n*.pid\n*.seed\n*.pid.lock\n\n# Coverage directory used by tools like istanbul\ncoverage/\n*.lcov\n\n# nyc test coverage\n.nyc_output\n\n# Dependency directories\njspm_packages/\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n.parcel-cache\n\n# next.js build output\n.next\n\n# nuxt.js build output\n.nuxt\n\n# vuepress build output\n.vuepress/dist\n\n# Serverless directories\n.serverless\n\n# FuseBox cache\n.fusebox/\n\n# DynamoDB Local files\n.dynamodb/\n\n# TernJS port file\n.tern-port\n`,\n { force }\n );\n \n if (gitignoreCreated) {\n createdFiles.push('.gitignore');\n } else {\n skippedFiles.push('.gitignore');\n }\n\n // Create README.md\n const readmePath = path.join(targetDir, 'README.md');\n const readmeCreated = await writeFileSafe(\n readmePath,\n `# ${options.packageName || 'kick-app'}\n\nA modern TypeScript API built with KickJS framework.\n\n## šŸš€ Quick Start\n\n### Prerequisites\n\n- Node.js 18+\n- npm, pnpm, or yarn\n\n### Installation\n\n\\`\\`\\`bash\nnpm install\n\\`\\`\\`\n\n### Development\n\n\\`\\`\\`bash\n# Start development server with hot reload\nnpm run dev\n\\`\\`\\`\n\n### Building\n\n\\`\\`\\`bash\n# Build for production\nnpm run build\n\\`\\`\\`\n\n### Running in Production\n\n\\`\\`\\`bash\n# Start production server\nnpm start\n\\`\\`\\`\n\n## šŸ“ Project Structure\n\n\\`\\`\\`\nsrc/\nā”œā”€ā”€ controllers/ # HTTP route controllers\nā”œā”€ā”€ services/ # Business logic services\nā”œā”€ā”€ types/ # TypeScript type definitions\nā”œā”€ā”€ app.module.ts # Main application module\n└── index.ts # Application entry point\n\\`\\`\\`\n\n## šŸ› ļø Available Scripts\n\n- \\`npm run dev\\` - Start development server with hot reload\n- \\`npm run build\\` - Build for production\n- \\`npm start\\` - Start production server\n- \\`npm run typecheck\\` - Type check without building\n- \\`npm run clean\\` - Clean build directory\n\n## šŸ“š Learn More\n\n- [KickJS Documentation](https://github.com/forinda/kick-js)\n- [Express.js](https://expressjs.com/)\n- [TypeScript](https://www.typescriptlang.org/)\n- [Inversify](https://inversify.io/)\n\n## šŸŽÆ API Endpoints\n\n### Users\n\n- \\`GET /api/v1/users\\` - Get all users\n- \\`POST /api/v1/users\\` - Create a new user\n\nExample request:\n\\`\\`\\`bash\ncurl -X POST http://localhost:3000/api/v1/users \\\\\n -H \"Content-Type: application/json\" \\\\\n -d '{\"name\": \"John Doe\", \"email\": \"john@example.com\"}'\n\\`\\`\\`\n\n## šŸ“„ License\n\nMIT\n`,\n { force }\n );\n \n if (readmeCreated) {\n createdFiles.push('README.md');\n } else {\n skippedFiles.push('README.md');\n }\n\n // Create tsup config for building\n const tsupConfigPath = path.join(targetDir, 'tsup.config.ts');\n const tsupConfigCreated = await writeFileSafe(\n tsupConfigPath,\n `import { defineConfig } from 'tsup';\n\nexport default defineConfig({\n entry: ['src/index.ts'],\n format: ['esm'],\n dts: true,\n clean: true,\n sourcemap: true,\n target: 'node18',\n outDir: 'dist',\n splitting: false,\n minify: false,\n external: ['express']\n});\n`,\n { force }\n );\n \n if (tsupConfigCreated) {\n createdFiles.push('tsup.config.ts');\n } else {\n skippedFiles.push('tsup.config.ts');\n }\n\n return { createdFiles, skippedFiles };\n};\n","import { promises as fs } from 'node:fs';\nimport path from 'node:path';\n\nexport async function ensureDirectory(target: string) {\n await fs.mkdir(target, { recursive: true });\n}\n\nexport async function writeFileSafe(filePath: string, content: string, options: { force?: boolean } = {}) {\n const { force = false } = options;\n try {\n if (!force) {\n await fs.access(filePath);\n return false;\n }\n } catch (error) {\n // File does not exist, safe to write\n }\n\n await ensureDirectory(path.dirname(filePath));\n await fs.writeFile(filePath, content, 'utf8');\n return true;\n}\n\nexport async function fileExists(filePath: string) {\n try {\n await fs.access(filePath);\n return true;\n } catch (error) {\n return false;\n }\n}\n\nexport async function readJsonFile<T>(filePath: string): Promise<T | undefined> {\n try {\n const raw = await fs.readFile(filePath, 'utf8');\n return JSON.parse(raw) as T;\n } catch (error) {\n return undefined;\n }\n}\n\nexport async function writeJsonFile(filePath: string, data: unknown, options: { force?: boolean } = {}) {\n await writeFileSafe(filePath, `${JSON.stringify(data, null, 2)}\\n`, options);\n}\n","import type { Command } from 'commander';\nimport { initProject } from '../tasks/init-project';\nimport type { KickStructureConfig } from '../types';\n\nexport function registerInitCommand(program: Command, defaults: { structure?: KickStructureConfig } = {}) {\n program\n .command('init [directory]')\n .description('Scaffold a new KickJS project with complete setup')\n .option('-f, --force', 'Overwrite existing files when scaffolding', false)\n .option('-n, --name <packageName>', 'Package name to use in package.json')\n .action(async (directory: string | undefined, options: { force?: boolean; name?: string }) => {\n const targetDirectory = directory ?? '.';\n \n console.log('šŸš€ Initializing KickJS project...');\n console.log(`šŸ“ Target directory: ${targetDirectory}`);\n \n const result = await initProject({\n targetDirectory,\n force: options.force,\n packageName: options.name,\n structure: defaults.structure\n });\n\n if (result.createdFiles.length > 0) {\n console.log('\\nāœ… Created files:');\n result.createdFiles.forEach(file => console.log(` āœ“ ${file}`));\n }\n \n if (result.skippedFiles.length > 0) {\n console.log('\\nāš ļø Skipped existing files:');\n result.skippedFiles.forEach(file => console.log(` - ${file}`));\n }\n\n console.log('\\nšŸŽ‰ Project scaffold complete!');\n console.log('\\nšŸ“¦ Next steps:');\n console.log(' 1. Install dependencies:');\n console.log(' npm install');\n console.log('\\n 2. Start development server:');\n console.log(' npm run dev');\n console.log('\\n 3. Build for production:');\n console.log(' npm run build');\n console.log('\\n 4. Run production server:');\n console.log(' npm start');\n console.log('\\n 5. Type check your code:');\n console.log(' npm run typecheck');\n console.log('\\nšŸ“š Learn more at: https://github.com/forinda/kick-js');\n });\n}\n","import path from 'node:path';\nimport { writeFileSafe } from '../utils/fs';\n\nconst SUPPORTED_METHODS = ['get', 'post', 'put', 'patch', 'delete'] as const;\n\nexport type SupportedMethod = (typeof SUPPORTED_METHODS)[number];\n\nexport interface GenerateControllerOptions {\n name: string;\n method?: SupportedMethod | string;\n root?: string;\n force?: boolean;\n tags?: string[];\n}\n\nexport interface GenerateControllerResult {\n filePath: string;\n created: boolean;\n}\n\nexport async function generateController(options: GenerateControllerOptions): Promise<GenerateControllerResult> {\n const method = normalizeMethod(options.method);\n const root = options.root ?? 'src/http';\n const rootPath = path.isAbsolute(root) ? root : path.join(process.cwd(), root);\n const normalizedName = options.name.replace(/\\\\/g, '/');\n const segments = normalizedName.split('/').filter(Boolean);\n const fileSegment = segments.pop() ?? 'index';\n\n const relativeDir = segments.join('/');\n const fileName = `${fileSegment}.${method}.controller.ts`;\n const targetFile = path.join(rootPath, relativeDir, fileName);\n\n const className = buildClassName([...segments, fileSegment], method);\n const methodController = `${capitalize(method)}Controller`;\n\n const template = buildTemplate({ className, methodController, method, tags: options.tags });\n\n const created = await writeFileSafe(targetFile, template, { force: options.force });\n\n return { filePath: targetFile, created };\n}\n\nfunction normalizeMethod(raw?: string): SupportedMethod {\n const method = (raw ?? 'get').toLowerCase();\n if (!SUPPORTED_METHODS.includes(method as SupportedMethod)) {\n throw new Error(`Unsupported method \"${raw}\". Supported methods: ${SUPPORTED_METHODS.join(', ')}`);\n }\n return method as SupportedMethod;\n}\n\nfunction buildTemplate(params: {\n className: string;\n methodController: string;\n method: SupportedMethod;\n tags?: string[];\n}) {\n const tagsBlock = params.tags && params.tags.length > 0 ? ` static tags = ${JSON.stringify(params.tags)};\\n\\n` : '';\n\n const requestType = params.method === 'get' || params.method === 'delete' ? 'Request' : 'Request';\n\n return `import type { Request, Response } from 'express';\\nimport { ${params.methodController} } from '@forinda/kickjs';\\n\\nexport default class ${params.className} extends ${params.methodController} {\\n${tagsBlock} handle(_req: ${requestType}, res: Response) {\\n return this.ok(res, { message: '${humanize(params.method)} ${params.className}' });\\n }\\n}\\n`;\n}\n\nfunction humanize(method: string) {\n return method.toUpperCase();\n}\n\nfunction buildClassName(segments: string[], method: string) {\n const normalizedSegments = segments\n .map((segment) => segment.replace(/\\.\\.\\./g, 'Rest'))\n .map((segment) => segment.replace(/\\[(.+?)]/g, '$1'))\n .flatMap((segment) => segment.split(/[^a-zA-Z0-9]+/g))\n .filter(Boolean)\n .map(capitalize);\n\n if (normalizedSegments.length === 0) {\n normalizedSegments.push('Root');\n }\n\n normalizedSegments.push(capitalize(method), 'Controller');\n return normalizedSegments.join('');\n}\n\nfunction capitalize(value: string) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\n","import path from 'node:path';\nimport { ensureDirectory, writeFileSafe, fileExists } from '../utils/fs';\nimport type { KickStructureConfig } from '../types';\n\nexport interface GenerateDomainOptions {\n name: string;\n structure?: KickStructureConfig;\n force?: boolean;\n withController?: boolean;\n}\n\nexport interface GenerateDomainResult {\n root: string;\n createdFolders: string[];\n existingFolders: string[];\n controllerPath?: string;\n controllerCreated?: boolean;\n}\n\nexport async function generateDomain(options: GenerateDomainOptions): Promise<GenerateDomainResult> {\n const structure = options.structure ?? {\n domainRoot: 'src/domains',\n domainFolders: ['controllers', 'services', 'domain'],\n defaultDomain: 'app'\n };\n\n const domainRoot = structure.domainRoot ?? 'src/domains';\n const domainRootBase = path.isAbsolute(domainRoot) ? domainRoot : path.join(process.cwd(), domainRoot);\n const folders = structure.domainFolders && structure.domainFolders.length > 0 ? structure.domainFolders : ['controllers'];\n const targetRoot = path.join(domainRootBase, options.name);\n\n const createdFolders: string[] = [];\n const existingFolders: string[] = [];\n\n for (const folder of folders) {\n const folderPath = path.join(targetRoot, folder);\n const alreadyExists = await fileExists(folderPath);\n await ensureDirectory(folderPath);\n if (alreadyExists) {\n existingFolders.push(path.relative(process.cwd(), folderPath));\n } else {\n createdFolders.push(path.relative(process.cwd(), folderPath));\n }\n }\n\n let controllerPath: string | undefined;\n let controllerCreated: boolean | undefined;\n\n if (options.withController !== false && folders.includes('controllers')) {\n controllerPath = path.join(targetRoot, 'controllers', 'index.get.controller.ts');\n controllerCreated = await writeFileSafe(\n controllerPath,\n `import type { Request, Response } from 'express';\\nimport { GetController } from '@forinda/kickjs';\\n\\nexport default class ${capitalize(options.name)}IndexGetController extends GetController {\\n handle(_req: Request, res: Response) {\\n return this.ok(res, { domain: '${options.name}', message: 'Hello from ${options.name}' });\\n }\\n}\\n`,\n { force: options.force }\n );\n if (controllerCreated) {\n createdFolders.push(path.relative(process.cwd(), controllerPath));\n } else if (controllerPath) {\n existingFolders.push(path.relative(process.cwd(), controllerPath));\n }\n }\n\n return {\n root: targetRoot,\n createdFolders,\n existingFolders,\n controllerPath,\n controllerCreated\n };\n}\n\nfunction capitalize(value: string) {\n if (!value) {\n return 'Domain';\n }\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\n","import type { Command } from 'commander';\nimport { generateController } from '../tasks/generate-controller';\nimport type { KickStructureConfig } from '../types';\nimport { generateDomain } from '../tasks/generate-domain';\n\nexport function registerGeneratorCommands(\n program: Command,\n defaults: { controllerRoot?: string; structure?: KickStructureConfig } = {}\n) {\n const generate = program.command('generate').description('Generate Kick resources');\n\n generate\n .command('domain <name>')\n .description('Scaffold a domain folder with optional default files')\n .option('-f, --force', 'Overwrite existing generated files', false)\n .option('--no-controller', 'Do not create a default controller')\n .action(async (name: string, options: { force?: boolean; controller?: boolean }) => {\n const result = await generateDomain({\n name,\n structure: defaults.structure,\n force: options.force,\n withController: options.controller\n });\n\n console.log(`Domain root: ${result.root}`);\n if (result.createdFolders.length > 0) {\n console.log(`Created:\\n - ${result.createdFolders.join('\\n - ')}`);\n }\n if (result.existingFolders.length > 0) {\n console.log(`Existing:\\n - ${result.existingFolders.join('\\n - ')}`);\n }\n });\n\n generate\n .command('controller <name>')\n .description('Generate a file-system discovered controller')\n .option('-m, --method <verb>', 'HTTP verb to use (get, post, put, patch, delete)', 'get')\n .option('-r, --root <path>', 'Root directory for generated controllers', defaults.controllerRoot ?? 'src/http')\n .option('-f, --force', 'Overwrite the controller if it already exists', false)\n .option('--tags <tags>', 'Comma separated tags to assign to the controller')\n .action(async (name: string, options: { method?: string; root?: string; force?: boolean; tags?: string }) => {\n const tags = options.tags\n ? options.tags\n .split(',')\n .map((tag) => tag.trim())\n .filter(Boolean)\n : undefined;\n\n const defaultRoot = computeDefaultControllerRoot(defaults, name);\n const result = await generateController({\n name,\n method: options.method,\n root: options.root ?? defaultRoot,\n force: options.force,\n tags\n });\n\n if (result.created) {\n console.log(`Created controller at ${result.filePath}`);\n } else {\n console.log(`Controller already exists at ${result.filePath}`);\n }\n });\n}\n\nfunction computeDefaultControllerRoot(\n defaults: { controllerRoot?: string; structure?: KickStructureConfig },\n name: string\n) {\n if (defaults.controllerRoot) {\n return defaults.controllerRoot;\n }\n\n const structure = defaults.structure;\n if (!structure) {\n return 'src/http';\n }\n\n const domainRoot = structure.domainRoot ?? 'src/domains';\n const defaultDomain = structure.defaultDomain ?? 'app';\n\n if (name.includes('/')) {\n const [maybeDomain] = name.split('/');\n return `${domainRoot}/${maybeDomain}/controllers`;\n }\n\n return `${domainRoot}/${defaultDomain}/controllers`;\n}\n","import { Command } from 'commander';\nimport { spawn } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport { createError } from '../../utils/errors';\nimport { loadKickConfig, mergeConfigWithOptions } from '../utils/config-loader';\n\ninterface RunOptions {\n port?: string;\n host?: string;\n watch?: boolean;\n entry?: string;\n}\n\nexport function registerRunCommands(program: Command) {\n // kick dev command\n program\n .command('dev')\n .description('Start the application in development mode with hot reload')\n .option('-p, --port <port>', 'Port to run the server on')\n .option('-h, --host <host>', 'Host to bind the server to')\n .option('-e, --entry <entry>', 'Entry file path')\n .action(async (options: RunOptions) => {\n await runDev(options);\n });\n\n // kick start command\n program\n .command('start')\n .description('Start the application in production mode')\n .option('-p, --port <port>', 'Port to run the server on')\n .option('-h, --host <host>', 'Host to bind the server to')\n .option('-e, --entry <entry>', 'Entry file path')\n .action(async (options: RunOptions) => {\n await runStart(options);\n });\n}\n\nasync function runDev(options: RunOptions) {\n // Load configuration\n const kickConfig = await loadKickConfig();\n const config = mergeConfigWithOptions(kickConfig, options, 'dev');\n \n const entryFile = config.entry!;\n const cwd = process.cwd();\n const entryPath = path.resolve(cwd, entryFile);\n\n if (!existsSync(entryPath)) {\n throw createError('ENTRY_FILE_NOT_FOUND', `Entry file not found: ${entryPath}`);\n }\n\n console.log(`šŸš€ Starting development server...`);\n if (kickConfig.configPath) {\n console.log(`āš™ļø Config: ${path.relative(cwd, kickConfig.configPath)}`);\n }\n console.log(`šŸ“ Entry: ${entryFile}`);\n console.log(`🌐 Port: ${config.port}`);\n console.log(`šŸ  Host: ${config.host}`);\n\n // Try tsx first (preferred), then ts-node-dev, then ts-node\n const runners = [\n { cmd: 'tsx', args: ['watch', entryFile] },\n { cmd: 'ts-node-dev', args: ['--respawn', '--transpile-only', entryFile] },\n { cmd: 'ts-node', args: [entryFile] }\n ];\n\n let runner = null;\n for (const r of runners) {\n if (await commandExists(r.cmd)) {\n runner = r;\n break;\n }\n }\n\n if (!runner) {\n throw createError(\n 'DEV_RUNNER_NOT_FOUND',\n 'No development runner found. Please install one of: tsx, ts-node-dev, or ts-node\\n' +\n 'npm install --save-dev tsx\\n' +\n '# or\\n' +\n 'npm install --save-dev ts-node-dev\\n' +\n '# or\\n' +\n 'npm install --save-dev ts-node'\n );\n }\n\n const env = {\n ...process.env,\n ...config.env,\n PORT: config.port?.toString(),\n HOST: config.host\n };\n\n console.log(`šŸ”§ Using runner: ${runner.cmd}`);\n \n // Check if we should use local binary\n const localBinPath = path.resolve(cwd, 'node_modules', '.bin', runner.cmd);\n const commandToRun = existsSync(localBinPath) ? localBinPath : runner.cmd;\n \n const child = spawn(commandToRun, runner.args, {\n stdio: 'inherit',\n env,\n cwd\n });\n\n child.on('error', (error) => {\n console.error(`āŒ Failed to start development server: ${error.message}`);\n process.exit(1);\n });\n\n child.on('exit', (code) => {\n if (code !== 0) {\n console.error(`āŒ Development server exited with code ${code}`);\n process.exit(code || 1);\n }\n });\n\n // Handle graceful shutdown\n process.on('SIGINT', () => {\n console.log('\\nšŸ›‘ Shutting down development server...');\n child.kill('SIGINT');\n });\n\n process.on('SIGTERM', () => {\n console.log('\\nšŸ›‘ Shutting down development server...');\n child.kill('SIGTERM');\n });\n}\n\nasync function runStart(options: RunOptions) {\n // Load configuration\n const kickConfig = await loadKickConfig();\n const config = mergeConfigWithOptions(kickConfig, options, 'start');\n \n const entryFile = config.entry!;\n const cwd = process.cwd();\n const entryPath = path.resolve(cwd, entryFile);\n\n if (!existsSync(entryPath)) {\n throw createError(\n 'ENTRY_FILE_NOT_FOUND', \n `Entry file not found: ${entryPath}\\n` +\n 'Make sure to build your application first with: npm run build'\n );\n }\n\n console.log(`šŸš€ Starting production server...`);\n if (kickConfig.configPath) {\n console.log(`āš™ļø Config: ${path.relative(cwd, kickConfig.configPath)}`);\n }\n console.log(`šŸ“ Entry: ${entryFile}`);\n console.log(`🌐 Port: ${config.port}`);\n console.log(`šŸ  Host: ${config.host}`);\n\n const env = {\n ...process.env,\n ...config.env,\n PORT: config.port?.toString(),\n HOST: config.host\n };\n\n const child = spawn('node', [entryFile], {\n stdio: 'inherit',\n env,\n cwd\n });\n\n child.on('error', (error) => {\n console.error(`āŒ Failed to start production server: ${error.message}`);\n process.exit(1);\n });\n\n child.on('exit', (code) => {\n if (code !== 0) {\n console.error(`āŒ Production server exited with code ${code}`);\n process.exit(code || 1);\n }\n });\n\n // Handle graceful shutdown\n process.on('SIGINT', () => {\n console.log('\\nšŸ›‘ Shutting down production server...');\n child.kill('SIGINT');\n });\n\n process.on('SIGTERM', () => {\n console.log('\\nšŸ›‘ Shutting down production server...');\n child.kill('SIGTERM');\n });\n}\n\nasync function commandExists(command: string): Promise<boolean> {\n return new Promise((resolve) => {\n // First try local node_modules/.bin\n const localBinPath = path.resolve(process.cwd(), 'node_modules', '.bin', command);\n if (existsSync(localBinPath)) {\n resolve(true);\n return;\n }\n \n // Then try global installation\n const child = spawn('which', [command], { stdio: 'ignore' });\n child.on('close', (code) => {\n resolve(code === 0);\n });\n child.on('error', () => {\n resolve(false);\n });\n });\n}","export interface AppErrorOptions {\n status?: number;\n cause?: unknown;\n details?: Record<string, unknown>;\n}\n\nexport class AppError extends Error {\n readonly code: string;\n readonly status?: number;\n readonly details?: Record<string, unknown>;\n\n constructor(code: string, message: string, options: AppErrorOptions = {}) {\n super(message);\n this.code = code;\n this.status = options.status;\n this.details = options.details;\n\n if (options.cause) {\n // @ts-expect-error cause is standard on Error but not typed in older TS libs\n this.cause = options.cause;\n }\n\n this.name = 'AppError';\n }\n}\n\nexport function createError(code: string, message: string, options: AppErrorOptions = {}) {\n return new AppError(code, message, options);\n}\n\nexport function isAppError(error: unknown): error is AppError {\n return error instanceof AppError;\n}\n","import { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport { KickConfig, KickAppConfig, KickDevConfig, KickStartConfig, KickCommandDefinition } from '../types';\n\nconst CONFIG_FILE_NAMES = [\n 'kick.config.ts',\n 'kick.config.js',\n 'kick.config.mjs',\n 'kickjs.config.ts',\n 'kickjs.config.js',\n 'kickjs.config.mjs'\n];\n\nexport interface LoadedKickConfig extends KickConfig {\n configPath?: string;\n commands?: KickCommandDefinition[];\n}\n\n/**\n * Load KickJS configuration from the current working directory\n */\nexport async function loadKickConfig(cwd?: string): Promise<LoadedKickConfig> {\n const workingDir = cwd || process.cwd();\n \n // Try to find config file\n for (const configFileName of CONFIG_FILE_NAMES) {\n const configPath = path.resolve(workingDir, configFileName);\n \n if (existsSync(configPath)) {\n try {\n // Dynamic import to handle both .ts and .js files\n const configModule = await import(configPath);\n const config = configModule.default || configModule;\n \n return {\n ...config,\n configPath\n };\n } catch (error) {\n console.warn(`āš ļø Failed to load config from ${configPath}:`, error);\n }\n }\n }\n \n // Return default config if no file found\n return getDefaultConfig();\n}\n\n/**\n * Get default configuration\n */\nexport function getDefaultConfig(): KickConfig {\n return {\n app: {\n name: 'KickJS App',\n port: 3000,\n host: 'localhost',\n prefix: '',\n env: 'development'\n },\n dev: {\n port: 3000,\n host: 'localhost',\n entry: 'src/index.ts',\n watch: true,\n env: {\n NODE_ENV: 'development'\n }\n },\n start: {\n port: 3000,\n host: '0.0.0.0',\n entry: 'dist/index.js',\n env: {\n NODE_ENV: 'production'\n }\n },\n structure: {\n domainRoot: 'src/domains',\n domainFolders: ['controllers', 'services', 'domain'],\n defaultDomain: 'app'\n },\n generators: {\n controllerRoot: 'src/domains/app/controllers'\n },\n commands: []\n };\n}\n\n/**\n * Merge config with CLI options\n */\nexport function mergeConfigWithOptions(\n config: KickConfig,\n cliOptions: Record<string, any>,\n command: 'dev' | 'start'\n): KickDevConfig | KickStartConfig {\n const defaultConfig = getDefaultConfig();\n const baseConfig = command === 'dev' \n ? (config.dev || defaultConfig.dev)\n : (config.start || defaultConfig.start);\n \n return {\n ...baseConfig,\n port: cliOptions.port ? parseInt(cliOptions.port) : baseConfig?.port,\n host: cliOptions.host || baseConfig?.host,\n entry: cliOptions.entry || baseConfig?.entry,\n env: {\n ...baseConfig?.env,\n ...cliOptions.env\n }\n };\n}\n\n/**\n * Get app config merged with overrides\n */\nexport function getAppConfig(\n config: KickConfig,\n overrides: Partial<KickAppConfig> = {}\n): KickAppConfig {\n return {\n ...getDefaultConfig().app,\n ...config.app,\n ...overrides\n };\n}","import { spawn } from 'node:child_process';\n\nexport function runShellCommand(command: string, options: { cwd?: string } = {}) {\n return new Promise<void>((resolve, reject) => {\n const child = spawn(command, {\n cwd: options.cwd,\n stdio: 'inherit',\n shell: true\n });\n\n child.on('exit', (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error(`Command failed with exit code ${code}: ${command}`));\n }\n });\n\n child.on('error', (error) => {\n reject(error);\n });\n });\n}\n","import type { Command } from 'commander';\nimport { LoadedKickConfig } from '../utils/config-loader';\nimport { runShellCommand } from '../utils/shell';\n\nexport function registerCustomCommands(program: Command, config?: LoadedKickConfig) {\n if (!config?.commands) {\n return;\n }\n\n config.commands.forEach((command) => {\n const cmd = program\n .command(command.name)\n .description(command.description ?? 'Custom command defined in kick.config');\n\n cmd.action(async () => {\n if (!command.steps || command.steps.length === 0) {\n console.warn(`No steps defined for command \"${command.name}\".`);\n return;\n }\n\n for (const step of command.steps) {\n await runShellCommand(step);\n }\n });\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAwB;;;ACAxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,SAAW;AAAA,IACT,KAAK;AAAA,MACH,SAAW;AAAA,MACX,OAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,KAAO;AAAA,IACL,MAAQ;AAAA,EACV;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,KAAO;AAAA,IACP,OAAS;AAAA,IACT,OAAS;AAAA,IACT,OAAS;AAAA,IACT,gBAAkB;AAAA,IAClB,MAAQ;AAAA,IACR,cAAc;AAAA,IACd,SAAW;AAAA,IACX,YA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,QAAMC,UAAU,IAAIC,yBAAAA;AACpBD,UAAQE,KAAK,MAAA,EAAQC,YAAY,kBAAA,EAAoBC,QAAQC,gBAAID,WAAW,OAAA;AAE5E,QAAME,SAAS,MAAMC,eAAeC,QAAQC,IAAG,CAAA;AAE/CC,sBAAoBV,SAAS;IAAEW,WAAWL,QAAQK;EAAU,CAAA;AAC5DC,4BAA0BZ,SAAS;IACjCa,gBAAgBP,QAAQQ,YAAYD;IACpCF,WAAWL,QAAQK;EACrB,CAAA;AACAI,sBAAoBf,OAAAA;AACpBgB,yBAAuBhB,SAASM,MAAAA;AAEhCN,UAAQiB,mBAAkB;AAE1B,MAAI;AACF,UAAMjB,QAAQkB,WAAWV,QAAQW,IAAI;EACvC,SAASC,OAAO;AACdC,YAAQD,MAAMA,iBAAiBE,QAAQF,MAAMG,UAAUH,KAAAA;AACvDZ,YAAQgB,WAAW;EACrB;AACF;AAtBezB;AAwBfA,KAAAA,EAAO0B,MAAM,CAACL,UAAAA;AACZC,UAAQD,MAAMA,iBAAiBE,QAAQF,MAAMG,UAAUH,KAAAA;AACvDZ,UAAQgB,WAAW;AACrB,CAAA;","names":["import_node_path","ensureDirectory","target","fs","mkdir","recursive","writeFileSafe","filePath","content","options","force","access","error","path","dirname","writeFile","fileExists","readJsonFile","raw","readFile","JSON","parse","undefined","writeJsonFile","data","stringify","initProject","options","targetDir","path","resolve","process","cwd","targetDirectory","force","createdFiles","skippedFiles","ensureDirectory","packageJsonPath","join","packageJson","readJsonFile","Object","keys","length","name","packageName","basename","replace","writeJsonFile","version","private","type","main","scripts","dev","build","start","typecheck","clean","dependencies","express","inversify","devDependencies","rimraf","tsup","tsx","typescript","engines","node","push","tsconfigPath","tsconfigExists","fileExists","compilerOptions","target","module","moduleResolution","lib","rootDir","outDir","allowSyntheticDefaultImports","esModuleInterop","forceConsistentCasingInFileNames","strict","noImplicitAny","strictNullChecks","strictFunctionTypes","noImplicitReturns","noFallthroughCasesInSwitch","noUncheckedIndexedAccess","noImplicitOverride","exactOptionalPropertyTypes","skipLibCheck","resolveJsonModule","experimentalDecorators","emitDecoratorMetadata","declaration","declarationMap","sourceMap","include","exclude","mainFilePath","mainCreated","writeFileSafe","appModulePath","appModuleCreated","domainBase","folder","folderPath","exists","relativePath","relative","controllerPath","controllerCreated","relativeControllerPath","servicePath","serviceCreated","relativeServicePath","typesPath","typesCreated","relativeTypesPath","configPath","configCreated","gitignorePath","gitignoreCreated","readmePath","readmeCreated","tsupConfigPath","tsupConfigCreated","registerInitCommand","program","defaults","command","description","option","action","directory","options","targetDirectory","console","log","result","initProject","force","packageName","name","structure","createdFiles","length","forEach","file","skippedFiles","import_node_path","SUPPORTED_METHODS","generateController","options","method","normalizeMethod","root","rootPath","path","isAbsolute","join","process","cwd","normalizedName","name","replace","segments","split","filter","Boolean","fileSegment","pop","relativeDir","fileName","targetFile","className","buildClassName","methodController","capitalize","template","buildTemplate","tags","created","writeFileSafe","force","filePath","raw","toLowerCase","includes","Error","params","tagsBlock","length","JSON","stringify","requestType","humanize","toUpperCase","normalizedSegments","map","segment","flatMap","push","value","charAt","slice","import_node_path","generateDomain","options","structure","domainRoot","domainFolders","defaultDomain","domainRootBase","path","isAbsolute","join","process","cwd","folders","length","targetRoot","name","createdFolders","existingFolders","folder","folderPath","alreadyExists","fileExists","ensureDirectory","push","relative","controllerPath","controllerCreated","withController","includes","writeFileSafe","capitalize","force","root","value","charAt","toUpperCase","slice","registerGeneratorCommands","program","defaults","generate","command","description","option","action","name","options","result","generateDomain","structure","force","withController","controller","console","log","root","createdFolders","length","join","existingFolders","controllerRoot","tags","split","map","tag","trim","filter","Boolean","undefined","defaultRoot","computeDefaultControllerRoot","generateController","method","created","filePath","domainRoot","defaultDomain","includes","maybeDomain","import_node_fs","import_node_path","AppError","Error","code","status","details","message","options","cause","name","createError","import_node_fs","import_node_path","CONFIG_FILE_NAMES","loadKickConfig","cwd","workingDir","process","configFileName","configPath","path","resolve","existsSync","configModule","config","default","error","console","warn","getDefaultConfig","app","name","port","host","prefix","env","dev","entry","watch","NODE_ENV","start","structure","domainRoot","domainFolders","defaultDomain","generators","controllerRoot","commands","mergeConfigWithOptions","cliOptions","command","defaultConfig","baseConfig","parseInt","registerRunCommands","program","command","description","option","action","options","runDev","runStart","kickConfig","loadKickConfig","config","mergeConfigWithOptions","entryFile","entry","cwd","process","entryPath","path","resolve","existsSync","createError","console","log","configPath","relative","port","host","runners","cmd","args","runner","r","commandExists","env","PORT","toString","HOST","localBinPath","commandToRun","child","spawn","stdio","on","error","message","exit","code","kill","Promise","import_node_child_process","runShellCommand","command","options","Promise","resolve","reject","child","spawn","cwd","stdio","shell","on","code","Error","error","registerCustomCommands","program","config","commands","forEach","command","cmd","name","description","action","steps","length","console","warn","step","runShellCommand","main","program","Command","name","description","version","pkg","config","loadKickConfig","process","cwd","registerInitCommand","structure","registerGeneratorCommands","controllerRoot","generators","registerRunCommands","registerCustomCommands","showHelpAfterError","parseAsync","argv","error","console","Error","message","exitCode","catch"]}