How nicoalbanese/kirimase works
Main Components
a. CLI Entrypoint
• bin/kirimase (not shown in file tree but defined in package.json “bin”)
• Invokes src/index.ts
b. Command Dispatcher / Parser
• Uses a command‐parsing library (e.g. Commander or Oclif)
• Analyzes process.argv and routes to handlers
c. Command Handlers
• src/commands/init
• src/commands/add
• src/commands/generate
• (Plus filePaths, shared utils)
d. Sub‐Command Generators
– add/auth/* (clerk, next-auth, lucia, kinde)
– add/orm/* (drizzle, prisma)
– add/componentLib/shadcn-ui
– add/misc/* (stripe, resend, trpc, navbar, defaultStyles)
– generate/generators/(model, views, apiRoute, serverActions, trpcRoute)
e. Shared Utilities
• src/utils.ts, src/commands/*/utils.ts, src/types.d.ts
• Template resolution, file path computation, prompts, file I/O
f. File System / Templates
• Template files (embedded in generator code)
• Output into the user’s Next.js project folder
g. External Dependencies
• Node.js FS module, Chalk, Inquirer/Prompts, TS-Node, ESM commonjs loader
Relationships & Data Flows
• User types kirimase <command> [options] →
→ CLI Entrypoint → Command Parser → Selected Command Handler
• Handler loads relevant sub‐command modules →
→ Sub‐Command Generators orchestrate:
• Read templates & config
• Prompt user (if interactive)
• Transform/generate code (TypeScript AST or string templates)
• Write files to disk
• Update package.json, .env, tsconfig.json, etc.
• Shared Utilities support all handlers with:
• Path resolution
• Logging/progress
• Option parsing
Architectural Patterns & Principles
• Command Pattern: each top‐level command (init, add, generate) and sub‐commands implement a common interface (e.g., run() method)
• Modular Architecture: one folder per command, one file per generator
• Single Responsibility: each generator focuses on a single feature (e.g., “add/auth/clerk”)
• Dependency Injection (implicit): shared utils imported by handlers
• Template-Driven Code Generation
Key Technologies & Libraries
• TypeScript for code safety
• Node.js CLI (shebang + ESM)
• Commander or similar for parsing (inferred)
• FS + Path modules for file operations
• Zod (indirectly, when scaffolding drizzle/prisma)
• External CLIs: drizzle-kit, prisma, next-auth, clerk, lucia, kinde, trpc
• Prettier / ESLint configurations