@hazeljs/cli 0.4.1 → 0.5.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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @hazeljs/cli
2
2
 
3
- **From zero to CRUD in one command.**
3
+ **From zero to AI-powered apps in one command.**
4
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.
5
+ Generate controllers, services, modules, AI agents, RAG systems — or create a complete AI-Native application with PostgreSQL, Redis, and Docker. Interactive project setup, package management, and code that follows best practices. Stop copy-pasting, start shipping intelligent applications.
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@hazeljs/cli.svg)](https://www.npmjs.com/package/@hazeljs/cli)
8
8
  [![npm downloads](https://img.shields.io/npm/dm/@hazeljs/cli)](https://www.npmjs.com/package/@hazeljs/cli)
@@ -10,17 +10,19 @@ Generate controllers, services, modules, DTOs — or a full CRUD resource. Inter
10
10
 
11
11
  ## Features
12
12
 
13
+ - 🤖 **AI-Native Templates** - Create complete AI applications with agents, RAG, PostgreSQL, and Docker
13
14
  - 🚀 **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
15
+ - 🎨 **Code Generation** - Generate controllers, services, AI agents, RAG systems, and more
16
+ - 🏗️ **Best Practices** - Generated code follows HazelJS conventions and AI patterns
16
17
  - 🔧 **Customizable** - Specify paths and options for generated files
17
- - 📦 **Multiple Templates** - Support for various component types
18
+ - 📦 **Multiple Templates** - Support for various component types including AI components
18
19
  - ⚡ **Fast Development** - Reduce boilerplate and speed up development
19
- - 🎯 **TypeScript First** - All generated code is fully typed
20
+ - 🎯 **TypeScript First** - All generated code is fully typed with AI safety
20
21
  - 🛠️ **Utility Commands** - Build, start, test, and manage your project
21
22
  - 📊 **Project Info** - Display comprehensive project information
22
23
  - ➕ **Package Management** - Add HazelJS packages interactively
23
24
  - 🎭 **CRUD Generator** - Generate complete CRUD resources in one command
25
+ - 🧠 **AI Components** - Generate agents, tools, RAG pipelines, and AI services
24
26
 
25
27
  ## Installation
26
28
 
@@ -46,6 +48,19 @@ The CLI provides commands to generate various HazelJS components, create new app
46
48
 
47
49
  #### Create new application
48
50
 
51
+ **🤖 AI-Native Application (Recommended for AI Projects):**
52
+ ```bash
53
+ hazel g app <appName> --template=ai-native
54
+ # Then: cd <appName> && npm install && cp .env.example .env && docker-compose up -d && npm run dev
55
+ ```
56
+
57
+ Creates a complete AI-powered application with:
58
+ - 🤖 AI Agents with tools and memory
59
+ - 📚 RAG System with PostgreSQL + pgvector
60
+ - 🗄️ Database Setup (PostgreSQL, Redis)
61
+ - 🐳 Docker Configuration for production
62
+ - 📊 Complete API endpoints ready to use
63
+
49
64
  **Skeleton app (quick start, like create-next-app):**
50
65
  ```bash
51
66
  hazel g app <appName>
@@ -57,7 +72,7 @@ hazel g app <appName>
57
72
  hazel new <appName> [options]
58
73
  ```
59
74
 
60
- Creates a new HazelJS application. Use `hazel g app <name>` for a minimal skeleton; use `hazel new <name> -i` for interactive setup with optional packages.
75
+ Creates a new HazelJS application. Use `hazel g app <name> --template=ai-native` for AI applications; `hazel g app <name>` for a minimal skeleton; use `hazel new <name> -i` for interactive setup with optional packages.
61
76
 
62
77
  **Options:**
63
78
  - `-d, --dest <path>` - Destination path (default: current directory)
@@ -67,6 +82,9 @@ Creates a new HazelJS application. Use `hazel g app <name>` for a minimal skelet
67
82
 
68
83
  **Examples:**
69
84
  ```bash
85
+ # AI-Native application (recommended for AI projects)
86
+ hazel g app my-ai-app --template=ai-native
87
+
70
88
  # Basic project creation
71
89
  hazel new my-app
72
90
 
@@ -239,8 +257,12 @@ hazel g module orders --dry-run
239
257
 
240
258
  ### Available Generators
241
259
 
242
- #### Skeleton app
243
- - `app` - Generate a skeleton HazelJS application (minimal template, like create-next-app). Use `hazel g app my-app` then `cd my-app && npm install && npm run dev`.
260
+ #### Application Templates
261
+ - `app` - Generate a HazelJS application. Use `hazel g app my-app --template=ai-native` for AI applications or `hazel g app my-app` for minimal template.
262
+
263
+ **Available Templates:**
264
+ - `ai-native` - Complete AI application with agents, RAG, PostgreSQL, Redis, and Docker
265
+ - `default` - Minimal HazelJS application (like create-next-app)
244
266
 
245
267
  #### Package setup
246
268
  - `setup` / `st` - Generate a minimal setup starter file for a HazelJS package (e.g. `hazel g setup swagger`).
@@ -261,6 +283,9 @@ hazel g module orders --dry-run
261
283
  - `pipe` / `p` - Generate a transformation pipe
262
284
  - `repository` / `repo` - Generate a Prisma repository
263
285
  - `ai-service` / `ai` - Generate an AI service with decorators
286
+ - `agent` - Generate an AI agent with tools and memory
287
+ - `rag-controller` - Generate a RAG controller with document ingestion and search
288
+ - `tool` - Generate an AI tool for agents
264
289
  - `serverless` / `sls` - Generate a serverless handler (Lambda/Cloud Function)
265
290
 
266
291
  ### Generator Options
@@ -349,6 +374,28 @@ hazel g pipe validation
349
374
  hazel g p validation
350
375
  ```
351
376
 
377
+ Generate an AI service with decorators:
378
+ ```bash
379
+ hazel g ai-service chat
380
+ # or
381
+ hazel g ai chat
382
+ ```
383
+
384
+ Generate an AI agent with tools and memory:
385
+ ```bash
386
+ hazel g agent support
387
+ ```
388
+
389
+ Generate a RAG controller with document ingestion and search:
390
+ ```bash
391
+ hazel g rag-controller knowledge
392
+ ```
393
+
394
+ Generate an AI tool for agents:
395
+ ```bash
396
+ hazel g tool weather
397
+ ```
398
+
352
399
  Generate a Prisma repository:
353
400
  ```bash
354
401
  hazel g repository user
@@ -717,4 +764,4 @@ Apache 2.0 © [HazelJS](https://hazeljs.ai)
717
764
  - [Documentation](https://hazeljs.ai/docs/packages/cli)
718
765
  - [GitHub](https://github.com/hazel-js/hazeljs)
719
766
  - [Issues](https://github.com/hazel-js/hazeljs/issues)
720
- - [Discord](https://discord.gg/rnxaDcXx)
767
+ - [Discord](https://discord.gg/xe495BvE)
@@ -293,6 +293,7 @@ function generateApp(program) {
293
293
  .option('--skip-install', 'Skip npm install')
294
294
  .option('--skip-git', 'Skip git initialization')
295
295
  .option('-i, --interactive', 'Interactive setup')
296
+ .option('-t, --template <template>', 'Project template (basic, ai-native)', 'basic')
296
297
  .action(async (appName, options) => {
297
298
  try {
298
299
  let projectConfig = {
@@ -371,17 +372,18 @@ function generateApp(program) {
371
372
  console.error(chalk_1.default.red(`✗ Destination already exists: ${destPath}`));
372
373
  process.exit(1);
373
374
  }
374
- // Use local template
375
- const templatePath = path_1.default.join(__dirname, '../../@template');
375
+ // Use template based on option
376
+ const templateDir = options.template === 'ai-native' ? '@template-ai-native' : '@template';
377
+ const templatePath = path_1.default.join(__dirname, '../../', templateDir);
376
378
  if (fs_1.default.existsSync(templatePath)) {
377
- console.log(chalk_1.default.blue('📋 Copying template files...'));
379
+ console.log(chalk_1.default.blue(`📋 Copying ${options.template} template files...`));
378
380
  copyRecursiveSync(templatePath, destPath);
379
381
  // Update package.json
380
382
  updatePackageJson(destPath, projectConfig.name, projectConfig.description);
381
- console.log(chalk_1.default.green('✓ Template files copied'));
383
+ console.log(chalk_1.default.green(`✓ ${options.template} template files copied`));
382
384
  }
383
385
  else {
384
- console.log(chalk_1.default.yellow('⚠ Local template not found, creating basic structure...'));
386
+ console.log(chalk_1.default.yellow(`⚠ ${options.template} template not found, creating basic structure...`));
385
387
  // Create basic structure
386
388
  fs_1.default.mkdirSync(destPath, { recursive: true });
387
389
  fs_1.default.mkdirSync(path_1.default.join(destPath, 'src'), { recursive: true });
@@ -529,7 +531,7 @@ coverage/
529
531
  }
530
532
  console.log(chalk_1.default.gray(' npm run dev'));
531
533
  console.log(chalk_1.default.gray('\nDocumentation: https://hazeljs.ai/docs'));
532
- console.log(chalk_1.default.gray('Discord: https://discord.gg/rnxaDcXx\n'));
534
+ console.log(chalk_1.default.gray('Discord: https://discord.gg/xe495BvE\n'));
533
535
  }
534
536
  catch (error) {
535
537
  console.error(chalk_1.default.red('\n✗ Failed to create project:'), error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hazeljs/cli",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Command-line interface for scaffolding and generating HazelJS applications and components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -69,5 +69,5 @@
69
69
  "type": "opencollective",
70
70
  "url": "https://opencollective.com/hazeljs"
71
71
  },
72
- "gitHead": "151d5678aa2aeddd75fb75b1b5c55fabe8cb8050"
72
+ "gitHead": "c23649207e4aba030252b8763752f7f10776f256"
73
73
  }