@hazeljs/cli 0.2.0-alpha.1

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.
Files changed (121) hide show
  1. package/@template/.eslintrc.js +36 -0
  2. package/@template/.lintstagedrc +6 -0
  3. package/@template/README.md +61 -0
  4. package/@template/jest.config.js +28 -0
  5. package/@template/jest.setup.js +81 -0
  6. package/@template/package.json +34 -0
  7. package/@template/src/app.module.ts +7 -0
  8. package/@template/src/hello.controller.ts +9 -0
  9. package/@template/src/index.ts +18 -0
  10. package/@template/tsconfig.json +25 -0
  11. package/LICENSE +192 -0
  12. package/README.md +683 -0
  13. package/dist/commands/add.d.ts +2 -0
  14. package/dist/commands/add.js +176 -0
  15. package/dist/commands/add.test.d.ts +1 -0
  16. package/dist/commands/add.test.js +51 -0
  17. package/dist/commands/build.d.ts +2 -0
  18. package/dist/commands/build.js +52 -0
  19. package/dist/commands/generate-agent.d.ts +2 -0
  20. package/dist/commands/generate-agent.js +58 -0
  21. package/dist/commands/generate-agent.test.d.ts +1 -0
  22. package/dist/commands/generate-agent.test.js +36 -0
  23. package/dist/commands/generate-ai-service.d.ts +2 -0
  24. package/dist/commands/generate-ai-service.js +48 -0
  25. package/dist/commands/generate-ai-service.test.d.ts +1 -0
  26. package/dist/commands/generate-ai-service.test.js +41 -0
  27. package/dist/commands/generate-app.d.ts +2 -0
  28. package/dist/commands/generate-app.js +448 -0
  29. package/dist/commands/generate-auth.d.ts +2 -0
  30. package/dist/commands/generate-auth.js +194 -0
  31. package/dist/commands/generate-auth.test.d.ts +1 -0
  32. package/dist/commands/generate-auth.test.js +48 -0
  33. package/dist/commands/generate-cache.d.ts +2 -0
  34. package/dist/commands/generate-cache.js +64 -0
  35. package/dist/commands/generate-cache.test.d.ts +1 -0
  36. package/dist/commands/generate-cache.test.js +36 -0
  37. package/dist/commands/generate-config.d.ts +2 -0
  38. package/dist/commands/generate-config.js +57 -0
  39. package/dist/commands/generate-config.test.d.ts +1 -0
  40. package/dist/commands/generate-config.test.js +35 -0
  41. package/dist/commands/generate-controller.d.ts +2 -0
  42. package/dist/commands/generate-controller.js +60 -0
  43. package/dist/commands/generate-controller.test.d.ts +1 -0
  44. package/dist/commands/generate-controller.test.js +48 -0
  45. package/dist/commands/generate-cron.d.ts +2 -0
  46. package/dist/commands/generate-cron.js +59 -0
  47. package/dist/commands/generate-cron.test.d.ts +1 -0
  48. package/dist/commands/generate-cron.test.js +42 -0
  49. package/dist/commands/generate-crud.d.ts +2 -0
  50. package/dist/commands/generate-crud.js +177 -0
  51. package/dist/commands/generate-crud.test.d.ts +1 -0
  52. package/dist/commands/generate-crud.test.js +52 -0
  53. package/dist/commands/generate-discovery.d.ts +2 -0
  54. package/dist/commands/generate-discovery.js +61 -0
  55. package/dist/commands/generate-discovery.test.d.ts +1 -0
  56. package/dist/commands/generate-discovery.test.js +36 -0
  57. package/dist/commands/generate-dto.d.ts +2 -0
  58. package/dist/commands/generate-dto.js +69 -0
  59. package/dist/commands/generate-dto.test.d.ts +1 -0
  60. package/dist/commands/generate-dto.test.js +44 -0
  61. package/dist/commands/generate-exception-filter.d.ts +2 -0
  62. package/dist/commands/generate-exception-filter.js +48 -0
  63. package/dist/commands/generate-exception-filter.test.d.ts +1 -0
  64. package/dist/commands/generate-exception-filter.test.js +43 -0
  65. package/dist/commands/generate-guard.d.ts +2 -0
  66. package/dist/commands/generate-guard.js +36 -0
  67. package/dist/commands/generate-guard.test.d.ts +1 -0
  68. package/dist/commands/generate-guard.test.js +41 -0
  69. package/dist/commands/generate-interceptor.d.ts +2 -0
  70. package/dist/commands/generate-interceptor.js +37 -0
  71. package/dist/commands/generate-interceptor.test.d.ts +1 -0
  72. package/dist/commands/generate-interceptor.test.js +41 -0
  73. package/dist/commands/generate-middleware.d.ts +2 -0
  74. package/dist/commands/generate-middleware.js +46 -0
  75. package/dist/commands/generate-middleware.test.d.ts +1 -0
  76. package/dist/commands/generate-middleware.test.js +41 -0
  77. package/dist/commands/generate-module.d.ts +2 -0
  78. package/dist/commands/generate-module.js +106 -0
  79. package/dist/commands/generate-module.test.d.ts +1 -0
  80. package/dist/commands/generate-module.test.js +54 -0
  81. package/dist/commands/generate-pipe.d.ts +2 -0
  82. package/dist/commands/generate-pipe.js +33 -0
  83. package/dist/commands/generate-pipe.test.d.ts +1 -0
  84. package/dist/commands/generate-pipe.test.js +35 -0
  85. package/dist/commands/generate-rag.d.ts +2 -0
  86. package/dist/commands/generate-rag.js +66 -0
  87. package/dist/commands/generate-rag.test.d.ts +1 -0
  88. package/dist/commands/generate-rag.test.js +35 -0
  89. package/dist/commands/generate-repository.d.ts +2 -0
  90. package/dist/commands/generate-repository.js +40 -0
  91. package/dist/commands/generate-repository.test.d.ts +1 -0
  92. package/dist/commands/generate-repository.test.js +41 -0
  93. package/dist/commands/generate-serverless-handler.d.ts +2 -0
  94. package/dist/commands/generate-serverless-handler.js +46 -0
  95. package/dist/commands/generate-serverless-handler.test.d.ts +1 -0
  96. package/dist/commands/generate-serverless-handler.test.js +42 -0
  97. package/dist/commands/generate-service.d.ts +2 -0
  98. package/dist/commands/generate-service.js +52 -0
  99. package/dist/commands/generate-service.test.d.ts +1 -0
  100. package/dist/commands/generate-service.test.js +41 -0
  101. package/dist/commands/generate-websocket-gateway.d.ts +2 -0
  102. package/dist/commands/generate-websocket-gateway.js +47 -0
  103. package/dist/commands/generate-websocket-gateway.test.d.ts +1 -0
  104. package/dist/commands/generate-websocket-gateway.test.js +41 -0
  105. package/dist/commands/info.d.ts +2 -0
  106. package/dist/commands/info.js +91 -0
  107. package/dist/commands/pdf-to-audio.d.ts +2 -0
  108. package/dist/commands/pdf-to-audio.js +170 -0
  109. package/dist/commands/start.d.ts +2 -0
  110. package/dist/commands/start.js +61 -0
  111. package/dist/commands/test.d.ts +2 -0
  112. package/dist/commands/test.js +63 -0
  113. package/dist/index.d.ts +2 -0
  114. package/dist/index.js +75 -0
  115. package/dist/index.test.d.ts +1 -0
  116. package/dist/index.test.js +93 -0
  117. package/dist/utils/generator.d.ts +25 -0
  118. package/dist/utils/generator.js +107 -0
  119. package/dist/utils/generator.test.d.ts +1 -0
  120. package/dist/utils/generator.test.js +137 -0
  121. package/package.json +73 -0
package/README.md ADDED
@@ -0,0 +1,683 @@
1
+ # @hazeljs/cli
2
+
3
+ **From zero to CRUD in one command.**
4
+
5
+ Generate controllers, services, modules, DTOs — or a full CRUD resource. Interactive project setup, package management, and code that follows best practices. Stop copy-pasting, start shipping.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@hazeljs/cli.svg)](https://www.npmjs.com/package/@hazeljs/cli)
8
+ [![npm downloads](https://img.shields.io/npm/dm/@hazeljs/cli)](https://www.npmjs.com/package/@hazeljs/cli)
9
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
10
+
11
+ ## Features
12
+
13
+ - 🚀 **Project Scaffolding** - Create new HazelJS applications instantly with interactive setup
14
+ - 🎨 **Code Generation** - Generate controllers, services, modules, and more
15
+ - 🏗️ **Best Practices** - Generated code follows HazelJS conventions
16
+ - 🔧 **Customizable** - Specify paths and options for generated files
17
+ - 📦 **Multiple Templates** - Support for various component types
18
+ - ⚡ **Fast Development** - Reduce boilerplate and speed up development
19
+ - 🎯 **TypeScript First** - All generated code is fully typed
20
+ - 🛠️ **Utility Commands** - Build, start, test, and manage your project
21
+ - 📊 **Project Info** - Display comprehensive project information
22
+ - ➕ **Package Management** - Add HazelJS packages interactively
23
+ - 🎭 **CRUD Generator** - Generate complete CRUD resources in one command
24
+
25
+ ## Installation
26
+
27
+ ### Global Installation (Recommended)
28
+
29
+ ```bash
30
+ npm install -g @hazeljs/cli
31
+ ```
32
+
33
+ ### Local Installation
34
+
35
+ ```bash
36
+ npm install --save-dev @hazeljs/cli
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ The CLI provides commands to generate various HazelJS components, create new applications, and manage your project.
42
+
43
+ ## Commands
44
+
45
+ ### Project Management
46
+
47
+ #### Create New Application
48
+
49
+ ```bash
50
+ hazel new <appName> [options]
51
+ ```
52
+
53
+ Creates a new HazelJS application with optional interactive setup.
54
+
55
+ **Options:**
56
+ - `-d, --dest <path>` - Destination path (default: current directory)
57
+ - `-i, --interactive` - Interactive setup with package selection
58
+ - `--skip-install` - Skip npm install
59
+ - `--skip-git` - Skip git initialization
60
+
61
+ **Examples:**
62
+ ```bash
63
+ # Basic project creation
64
+ hazel new my-app
65
+
66
+ # Interactive setup with package selection
67
+ hazel new my-app -i
68
+
69
+ # Create without installing dependencies
70
+ hazel new my-app --skip-install
71
+ ```
72
+
73
+ #### Project Information
74
+
75
+ ```bash
76
+ hazel info
77
+ ```
78
+
79
+ Display comprehensive information about your HazelJS project including:
80
+ - Project name, version, and description
81
+ - Installed HazelJS packages
82
+ - Project structure
83
+ - Environment details
84
+ - Configuration files
85
+
86
+ #### Add Packages
87
+
88
+ ```bash
89
+ hazel add [package]
90
+ ```
91
+
92
+ Add HazelJS packages to your project interactively.
93
+
94
+ **Examples:**
95
+ ```bash
96
+ # Interactive package selection
97
+ hazel add
98
+
99
+ # Add specific package
100
+ hazel add ai
101
+ hazel add auth
102
+ hazel add prisma
103
+ ```
104
+
105
+ **Available packages:**
106
+ - `ai` - AI Integration (@hazeljs/ai)
107
+ - `agent` - AI Agents (@hazeljs/agent)
108
+ - `audit` - Audit Logging (@hazeljs/audit)
109
+ - `auth` - Authentication (@hazeljs/auth)
110
+ - `cache` - Caching (@hazeljs/cache)
111
+ - `config` - Configuration (@hazeljs/config)
112
+ - `cron` - Cron Jobs (@hazeljs/cron)
113
+ - `data` - Data/ETL (@hazeljs/data)
114
+ - `mcp` - Model Context Protocol (@hazeljs/mcp)
115
+ - `ml` - Machine Learning (@hazeljs/ml)
116
+ - `prisma` - Prisma ORM (@hazeljs/prisma)
117
+ - `prompts` - Typed prompt templates (@hazeljs/prompts)
118
+ - `rag` - RAG/Vector Search (@hazeljs/rag)
119
+ - `serverless` - Serverless (@hazeljs/serverless)
120
+ - `swagger` - Swagger/OpenAPI (@hazeljs/swagger)
121
+ - `typeorm` - TypeORM (@hazeljs/typeorm)
122
+ - `websocket` - WebSocket (@hazeljs/websocket)
123
+
124
+ #### Build Project
125
+
126
+ ```bash
127
+ hazel build [options]
128
+ ```
129
+
130
+ Build your HazelJS project.
131
+
132
+ **Options:**
133
+ - `-w, --watch` - Watch mode
134
+ - `-p, --production` - Production build
135
+
136
+ **Examples:**
137
+ ```bash
138
+ # Standard build
139
+ hazel build
140
+
141
+ # Watch mode
142
+ hazel build -w
143
+
144
+ # Production build
145
+ hazel build -p
146
+ ```
147
+
148
+ #### Start Application
149
+
150
+ ```bash
151
+ hazel start [options]
152
+ ```
153
+
154
+ Start your HazelJS application.
155
+
156
+ **Options:**
157
+ - `-d, --dev` - Start in development mode
158
+ - `-p, --port <port>` - Specify port
159
+
160
+ **Examples:**
161
+ ```bash
162
+ # Start in production mode
163
+ hazel start
164
+
165
+ # Start in development mode with hot reload
166
+ hazel start -d
167
+
168
+ # Start on specific port
169
+ hazel start -p 8080
170
+ ```
171
+
172
+ #### Run Tests
173
+
174
+ ```bash
175
+ hazel test [pattern] [options]
176
+ ```
177
+
178
+ Run tests for your HazelJS project.
179
+
180
+ **Options:**
181
+ - `-w, --watch` - Watch mode
182
+ - `-c, --coverage` - Generate coverage report
183
+ - `--ci` - Run in CI mode
184
+
185
+ **Examples:**
186
+ ```bash
187
+ # Run all tests
188
+ hazel test
189
+
190
+ # Run specific test file
191
+ hazel test user.test
192
+
193
+ # Watch mode
194
+ hazel test -w
195
+
196
+ # Generate coverage
197
+ hazel test -c
198
+ ```
199
+
200
+ ### Code Generation
201
+
202
+ ```bash
203
+ hazel generate <component> <name> [options]
204
+ ```
205
+
206
+ Or using the shorter alias:
207
+
208
+ ```bash
209
+ hazel g <component> <name> [options]
210
+ ```
211
+
212
+ ### Available Generators
213
+
214
+ #### Core Components
215
+ - `controller` / `c` - Generate a new controller
216
+ - `service` / `s` - Generate a new service
217
+ - `module` / `m` - Generate a new module
218
+ - `dto` - Generate create and update DTOs
219
+ - `guard` - Generate a new guard
220
+ - `interceptor` / `i` - Generate a new interceptor
221
+ - `middleware` / `mw` - Generate a new middleware
222
+
223
+ #### Advanced Generators
224
+ - **`crud`** - Generate complete CRUD resource (controller + service + module + DTOs)
225
+ - `gateway` / `ws` - Generate a WebSocket gateway
226
+ - `filter` / `f` - Generate an exception filter
227
+ - `pipe` / `p` - Generate a transformation pipe
228
+ - `repository` / `repo` - Generate a Prisma repository
229
+ - `ai-service` / `ai` - Generate an AI service with decorators
230
+ - `serverless` / `sls` - Generate a serverless handler (Lambda/Cloud Function)
231
+
232
+ ### Generator Options
233
+
234
+ - `-p, --path <path>` - Specify the path where the component should be generated (default: 'src')
235
+ - `-r, --route <route>` - Specify the route path (for CRUD generator)
236
+ - `--platform <platform>` - For serverless, specify platform: `lambda` or `cloud-function` (default: 'lambda')
237
+
238
+ ### Generator Examples
239
+
240
+ #### CRUD Generator (Recommended)
241
+
242
+ Generate a complete CRUD resource with controller, service, module, and DTOs:
243
+ ```bash
244
+ hazel g crud user
245
+
246
+ # With custom path
247
+ hazel g crud product -p src/products
248
+
249
+ # With custom route
250
+ hazel g crud article -r /api/articles
251
+ ```
252
+
253
+ This creates:
254
+ - `user.controller.ts` - Full CRUD controller
255
+ - `user.service.ts` - Service with all CRUD methods
256
+ - `user.module.ts` - Module configuration
257
+ - `dto/user.dto.ts` - Create and Update DTOs
258
+
259
+ #### Core Components
260
+
261
+ Generate a new user controller:
262
+ ```bash
263
+ hazel g controller user
264
+ ```
265
+
266
+ Generate a new auth service in a specific path:
267
+ ```bash
268
+ hazel g service auth -p src/auth
269
+ ```
270
+
271
+ Generate create and update DTOs for a product:
272
+ ```bash
273
+ hazel g dto product
274
+ ```
275
+
276
+ Generate a new authentication guard:
277
+ ```bash
278
+ hazel g guard auth
279
+ ```
280
+
281
+ Generate a new logging interceptor:
282
+ ```bash
283
+ hazel g interceptor logging
284
+ ```
285
+
286
+ Generate a new middleware:
287
+ ```bash
288
+ hazel g middleware logging
289
+ # or
290
+ hazel g mw cors -p src/middleware
291
+ ```
292
+
293
+ #### Advanced Generators
294
+
295
+ Generate a WebSocket gateway:
296
+ ```bash
297
+ hazel g gateway notifications
298
+ # or
299
+ hazel g ws notifications
300
+ ```
301
+
302
+ Generate an exception filter:
303
+ ```bash
304
+ hazel g filter http-exception
305
+ # or
306
+ hazel g f http-exception
307
+ ```
308
+
309
+ Generate a validation pipe:
310
+ ```bash
311
+ hazel g pipe validation
312
+ # or
313
+ hazel g p validation
314
+ ```
315
+
316
+ Generate a Prisma repository:
317
+ ```bash
318
+ hazel g repository user
319
+ # or
320
+ hazel g repo user
321
+ ```
322
+
323
+ Generate an AI service:
324
+ ```bash
325
+ hazel g ai-service chat
326
+ # or
327
+ hazel g ai chat
328
+ ```
329
+
330
+ Generate a Lambda handler:
331
+ ```bash
332
+ hazel g serverless handler --platform lambda
333
+ # or
334
+ hazel g sls handler
335
+ ```
336
+
337
+ Generate a Cloud Function handler:
338
+ ```bash
339
+ hazel g serverless handler --platform cloud-function
340
+ ```
341
+
342
+ ## Generated File Structure
343
+
344
+ ### Controller
345
+
346
+ ```typescript
347
+ import { Controller, Get, Post, Put, Delete, Body, Param } from '@hazeljs/core';
348
+ import { UserService } from './user.service';
349
+
350
+ @Controller('/users')
351
+ export class UserController {
352
+ constructor(private userService: UserService) {}
353
+
354
+ @Get()
355
+ findAll() {
356
+ return this.userService.findAll();
357
+ }
358
+
359
+ @Get('/:id')
360
+ findOne(@Param('id') id: string) {
361
+ return this.userService.findOne(id);
362
+ }
363
+
364
+ @Post()
365
+ create(@Body() createDto: any) {
366
+ return this.userService.create(createDto);
367
+ }
368
+
369
+ @Put('/:id')
370
+ update(@Param('id') id: string, @Body() updateDto: any) {
371
+ return this.userService.update(id, updateDto);
372
+ }
373
+
374
+ @Delete('/:id')
375
+ delete(@Param('id') id: string) {
376
+ return this.userService.delete(id);
377
+ }
378
+ }
379
+ ```
380
+
381
+ ### Service
382
+
383
+ ```typescript
384
+ import { Injectable } from '@hazeljs/core';
385
+
386
+ @Injectable()
387
+ export class UserService {
388
+ findAll() {
389
+ return [];
390
+ }
391
+
392
+ findOne(id: string) {
393
+ return { id };
394
+ }
395
+
396
+ create(data: any) {
397
+ return { id: '1', ...data };
398
+ }
399
+
400
+ update(id: string, data: any) {
401
+ return { id, ...data };
402
+ }
403
+
404
+ delete(id: string) {
405
+ return { id };
406
+ }
407
+ }
408
+ ```
409
+
410
+ ### Module
411
+
412
+ ```typescript
413
+ import { HazelModule } from '@hazeljs/core';
414
+ import { UserController } from './user.controller';
415
+ import { UserService } from './user.service';
416
+
417
+ @HazelModule({
418
+ controllers: [UserController],
419
+ providers: [UserService],
420
+ })
421
+ export class UserModule {}
422
+ ```
423
+
424
+ ### DTO
425
+
426
+ ```typescript
427
+ import { IsString, IsEmail, MinLength } from 'class-validator';
428
+
429
+ export class CreateUserDto {
430
+ @IsEmail()
431
+ email: string;
432
+
433
+ @IsString()
434
+ @MinLength(8)
435
+ password: string;
436
+
437
+ @IsString()
438
+ name: string;
439
+ }
440
+
441
+ export class UpdateUserDto {
442
+ @IsEmail()
443
+ email?: string;
444
+
445
+ @IsString()
446
+ name?: string;
447
+ }
448
+ ```
449
+
450
+ ## Best Practices
451
+
452
+ 1. **Organize by Feature** - Group related components in feature modules
453
+ 2. **Use DTOs** - Always generate and use DTOs for validation
454
+ 3. **Follow Naming Conventions** - Use singular names for entities (User, not Users)
455
+ 4. **Specify Paths** - Use `-p` flag to organize files properly
456
+ 5. **Generate Complete Features** - Generate controller, service, module, and DTOs together
457
+
458
+ ## Common Workflows
459
+
460
+ ### Create a Complete CRUD Feature
461
+
462
+ **Option 1: Using CRUD Generator (Recommended)**
463
+ ```bash
464
+ # Generate everything in one command
465
+ hazel g crud user -p src/user
466
+ ```
467
+
468
+ **Option 2: Manual Generation**
469
+ ```bash
470
+ # Generate all components separately
471
+ hazel g module user -p src/user
472
+ hazel g controller user -p src/user
473
+ hazel g service user -p src/user
474
+ hazel g dto user -p src/user
475
+ ```
476
+
477
+ ### Create a Microservice
478
+
479
+ ```bash
480
+ # Create new app with interactive setup
481
+ hazel new my-microservice -i
482
+
483
+ # Navigate to project
484
+ cd my-microservice
485
+
486
+ # Generate CRUD resources
487
+ hazel g crud user
488
+ hazel g crud product
489
+ hazel g crud order
490
+
491
+ # Add additional packages
492
+ hazel add swagger
493
+ hazel add auth
494
+
495
+ # Start development
496
+ hazel start -d
497
+ ```
498
+
499
+ ### Add WebSocket Support
500
+
501
+ ```bash
502
+ # Generate WebSocket gateway
503
+ hazel g gateway chat -p src/chat
504
+ hazel g service chat -p src/chat
505
+ ```
506
+
507
+ ### Add AI Integration
508
+
509
+ ```bash
510
+ # Generate AI service
511
+ hazel g ai-service assistant -p src/ai
512
+ ```
513
+
514
+ ### Prepare for Serverless
515
+
516
+ ```bash
517
+ # Generate Lambda handler
518
+ hazel g serverless handler --platform lambda
519
+ ```
520
+
521
+ ## Quick Reference
522
+
523
+ ### All Available Commands
524
+
525
+ ```bash
526
+ # Project Management
527
+ hazel new <name> [-i] # Create new project
528
+ hazel info # Show project info
529
+ hazel add [package] # Add HazelJS packages
530
+ hazel build [-w] [-p] # Build project
531
+ hazel start [-d] [-p <port>] # Start application
532
+ hazel test [pattern] [-w] [-c] # Run tests
533
+
534
+ # Code Generation (alias: g)
535
+ hazel g crud <name> # Complete CRUD resource
536
+ hazel g controller <name> # Controller
537
+ hazel g service <name> # Service
538
+ hazel g module <name> # Module
539
+ hazel g middleware <name> # Middleware
540
+ hazel g guard <name> # Guard
541
+ hazel g interceptor <name> # Interceptor
542
+ hazel g filter <name> # Exception filter
543
+ hazel g pipe <name> # Pipe
544
+ hazel g dto <name> # DTOs
545
+ hazel g repository <name> # Prisma repository
546
+ hazel g ai-service <name> # AI service
547
+ hazel g gateway <name> # WebSocket gateway
548
+ hazel g serverless <name> # Serverless handler
549
+ ```
550
+
551
+ ## Configuration
552
+
553
+ Create a `.hazelrc.json` file in your project root for custom configuration:
554
+
555
+ ```json
556
+ {
557
+ "defaultPath": "src",
558
+ "typescript": true,
559
+ "generateTests": true,
560
+ "styleGuide": "airbnb"
561
+ }
562
+ ```
563
+
564
+ ## Tips & Tricks
565
+
566
+ ### Use Aliases
567
+
568
+ ```bash
569
+ # These are equivalent
570
+ hazel generate controller user
571
+ hazel g c user
572
+
573
+ # CRUD generator is the fastest way
574
+ hazel g crud user
575
+ ```
576
+
577
+ ### Interactive Setup
578
+
579
+ ```bash
580
+ # Use interactive mode for new projects
581
+ hazel new my-app -i
582
+
583
+ # Select packages interactively
584
+ hazel add
585
+ ```
586
+
587
+ ### Batch Generation
588
+
589
+ ```bash
590
+ # Use CRUD generator instead of multiple commands
591
+ hazel g crud user # Better than:
592
+ # hazel g controller user && hazel g service user && hazel g module user && hazel g dto user
593
+ ```
594
+
595
+ ### Custom Paths
596
+
597
+ ```bash
598
+ # Organize by feature
599
+ hazel g crud user -p src/features/user
600
+ hazel g middleware logging -p src/common/middleware
601
+ ```
602
+
603
+ ### Development Workflow
604
+
605
+ ```bash
606
+ # Quick development cycle
607
+ hazel new my-app -i # Create with interactive setup
608
+ cd my-app
609
+ hazel g crud user # Generate CRUD resource
610
+ hazel add swagger # Add API documentation
611
+ hazel start -d # Start in dev mode
612
+
613
+ # In another terminal
614
+ hazel test -w # Run tests in watch mode
615
+ ```
616
+
617
+ ## Troubleshooting
618
+
619
+ ### Command Not Found
620
+
621
+ If `hazel` command is not found after global installation:
622
+
623
+ ```bash
624
+ # Check npm global bin path
625
+ npm config get prefix
626
+
627
+ # Add to PATH (macOS/Linux)
628
+ export PATH="$(npm config get prefix)/bin:$PATH"
629
+
630
+ # Or reinstall globally
631
+ npm install -g @hazeljs/cli
632
+ ```
633
+
634
+ ### Permission Errors
635
+
636
+ ```bash
637
+ # Use sudo (not recommended)
638
+ sudo npm install -g @hazeljs/cli
639
+
640
+ # Or fix npm permissions
641
+ mkdir ~/.npm-global
642
+ npm config set prefix '~/.npm-global'
643
+ export PATH=~/.npm-global/bin:$PATH
644
+ ```
645
+
646
+ ## Development
647
+
648
+ ### Building
649
+
650
+ ```bash
651
+ npm run build
652
+ ```
653
+
654
+ ### Testing
655
+
656
+ ```bash
657
+ npm test
658
+ ```
659
+
660
+ ### Linting
661
+
662
+ ```bash
663
+ npm run lint
664
+ ```
665
+
666
+ ## Examples
667
+
668
+ See the [examples](../../example) directory for complete working examples of generated code.
669
+
670
+ ## Contributing
671
+
672
+ Contributions are welcome! Please read our [Contributing Guide](../../CONTRIBUTING.md) for details.
673
+
674
+ ## License
675
+
676
+ Apache 2.0 © [HazelJS](https://hazeljs.com)
677
+
678
+ ## Links
679
+
680
+ - [Documentation](https://hazeljs.com/docs/packages/cli)
681
+ - [GitHub](https://github.com/hazel-js/hazeljs)
682
+ - [Issues](https://github.com/hazel-js/hazeljs/issues)
683
+ - [Discord](https://discord.com/channels/1448263814238965833/1448263814859456575)
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function addCommand(program: Command): void;