@objectql/cli 1.7.2 → 1.8.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/AI_EXAMPLES.md +154 -0
- package/AI_IMPLEMENTATION_SUMMARY.md +509 -0
- package/AI_TUTORIAL.md +144 -0
- package/CHANGELOG.md +27 -0
- package/LICENSE +1 -1
- package/README.md +132 -0
- package/dist/commands/ai.d.ts +38 -0
- package/dist/commands/ai.js +458 -0
- package/dist/commands/ai.js.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
- package/src/commands/ai.ts +508 -0
- package/src/index.ts +64 -0
- package/tsconfig.tsbuildinfo +1 -1
package/AI_TUTORIAL.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# AI-Powered Application Generation - Tutorial
|
|
2
|
+
|
|
3
|
+
This tutorial will guide you through using ObjectQL's AI-powered features to generate and validate enterprise applications.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
1. Install ObjectQL CLI globally:
|
|
8
|
+
```bash
|
|
9
|
+
npm install -g @objectql/cli
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
2. Get an OpenAI API key from [OpenAI Platform](https://platform.openai.com/)
|
|
13
|
+
|
|
14
|
+
3. Set your API key as an environment variable:
|
|
15
|
+
```bash
|
|
16
|
+
export OPENAI_API_KEY=sk-your-api-key-here
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Tutorial 1: Generate a Simple Task Management System
|
|
20
|
+
|
|
21
|
+
### Step 1: Generate the Application
|
|
22
|
+
|
|
23
|
+
Use the AI generator to create a task management system:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
objectql ai generate \
|
|
27
|
+
-d "A task management system with projects and tasks. Projects should have a name, description, status (planning, active, completed), and owner. Tasks belong to projects and have a title, description, priority (low, medium, high), status (todo, in_progress, done), and assignee." \
|
|
28
|
+
-t complete \
|
|
29
|
+
-o ./my-task-app
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Step 2: Review Generated Files
|
|
33
|
+
|
|
34
|
+
The AI will generate several metadata files:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cd my-task-app
|
|
38
|
+
ls -la
|
|
39
|
+
|
|
40
|
+
# Expected output:
|
|
41
|
+
# project.object.yml
|
|
42
|
+
# task.object.yml
|
|
43
|
+
# project.validation.yml (optional)
|
|
44
|
+
# task.validation.yml (optional)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Step 3: Validate the Generated Metadata
|
|
48
|
+
|
|
49
|
+
Validate the generated files to ensure they follow ObjectQL standards:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
objectql ai validate .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The validator will check for:
|
|
56
|
+
- YAML syntax errors
|
|
57
|
+
- ObjectQL specification compliance
|
|
58
|
+
- Business logic consistency
|
|
59
|
+
- Data modeling best practices
|
|
60
|
+
- Potential security issues
|
|
61
|
+
|
|
62
|
+
### Step 4: Test the Application
|
|
63
|
+
|
|
64
|
+
Start a development server to test your application:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
objectql serve --dir .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Visit `http://localhost:3000` to interact with your application through the API.
|
|
71
|
+
|
|
72
|
+
## Tutorial 2: Generate an Enterprise CRM System
|
|
73
|
+
|
|
74
|
+
### Step 1: Generate with Detailed Requirements
|
|
75
|
+
|
|
76
|
+
For more complex applications, provide detailed requirements:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
objectql ai generate \
|
|
80
|
+
-d "A comprehensive CRM system with the following modules:
|
|
81
|
+
|
|
82
|
+
1. Account Management: Companies with name, industry, revenue, employee count, and status
|
|
83
|
+
2. Contact Management: People working at accounts with name, email, phone, position, and role
|
|
84
|
+
3. Lead Management: Potential customers with source, qualification status, and score
|
|
85
|
+
4. Opportunity Management: Sales opportunities with amount, stage, probability, close date
|
|
86
|
+
5. Activity Tracking: Meetings, calls, emails associated with accounts/contacts
|
|
87
|
+
|
|
88
|
+
Include proper relationships:
|
|
89
|
+
- Contacts belong to accounts
|
|
90
|
+
- Opportunities belong to accounts
|
|
91
|
+
- Activities link to accounts, contacts, or opportunities
|
|
92
|
+
- Include validation rules for data quality
|
|
93
|
+
- Add status transitions for leads and opportunities" \
|
|
94
|
+
-t complete \
|
|
95
|
+
-o ./crm-system
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Step 2: Review and Customize
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
cd crm-system
|
|
102
|
+
ls -la
|
|
103
|
+
|
|
104
|
+
# Review generated files:
|
|
105
|
+
# - account.object.yml
|
|
106
|
+
# - contact.object.yml
|
|
107
|
+
# - lead.object.yml
|
|
108
|
+
# - opportunity.object.yml
|
|
109
|
+
# - activity.object.yml
|
|
110
|
+
# - Various .validation.yml files
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Edit any file to customize fields, validation rules, or relationships.
|
|
114
|
+
|
|
115
|
+
### Step 3: Validate
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
objectql ai validate .
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Address any warnings or errors identified by the AI validator.
|
|
122
|
+
|
|
123
|
+
### Step 4: Generate TypeScript Types
|
|
124
|
+
|
|
125
|
+
Generate TypeScript interfaces for type-safe development:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
objectql generate -s . -o ./types
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Tutorial 3: Using the AI Chat Assistant
|
|
132
|
+
|
|
133
|
+
### Interactive Help
|
|
134
|
+
|
|
135
|
+
Get help with ObjectQL concepts:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
objectql ai chat
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Example conversation:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
You: How do I create a many-to-many relationship?
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @objectql/cli
|
|
2
2
|
|
|
3
|
+
## 1.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Release minor version 1.8.0
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @objectql/core@1.8.0
|
|
13
|
+
- @objectql/driver-sql@2.0.0
|
|
14
|
+
- @objectql/server@2.0.0
|
|
15
|
+
- @objectql/types@1.8.0
|
|
16
|
+
- @objectql/platform-node@1.8.0
|
|
17
|
+
|
|
18
|
+
## 1.7.3
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Release patch version 1.7.3 with latest improvements and bug fixes
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @objectql/core@1.7.3
|
|
25
|
+
- @objectql/driver-sql@1.7.3
|
|
26
|
+
- @objectql/server@1.7.3
|
|
27
|
+
- @objectql/types@1.7.3
|
|
28
|
+
- @objectql/platform-node@1.7.3
|
|
29
|
+
|
|
3
30
|
## 1.7.2
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2026 ObjectQL Contributors
|
|
3
|
+
Copyright (c) 2026 ObjectQL Contributors (https://github.com/objectql)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -12,6 +12,138 @@ pnpm add -D @objectql/cli
|
|
|
12
12
|
|
|
13
13
|
## Commands
|
|
14
14
|
|
|
15
|
+
### AI-Powered Features
|
|
16
|
+
|
|
17
|
+
The `ai` command provides AI-powered application generation and assistance. **By default, it starts in interactive conversational mode** for the best experience.
|
|
18
|
+
|
|
19
|
+
#### Interactive Mode (Default)
|
|
20
|
+
|
|
21
|
+
Simply type `objectql ai` to start building your application through conversation.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Start interactive conversational builder (most common use case)
|
|
25
|
+
objectql ai
|
|
26
|
+
|
|
27
|
+
# Specify output directory
|
|
28
|
+
objectql ai ./src/my-app
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The interactive mode:
|
|
32
|
+
- Guides you step-by-step through application creation
|
|
33
|
+
- Lets you describe what you want in natural language
|
|
34
|
+
- Generates metadata, TypeScript implementations, and tests
|
|
35
|
+
- Allows iterative refinement through dialogue
|
|
36
|
+
- Provides suggestions for next steps
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
#### One-Shot Generation
|
|
41
|
+
|
|
42
|
+
For quick, non-interactive generation from a single description.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Generate from a description
|
|
46
|
+
objectql ai generate -d "A task management system with projects and tasks"
|
|
47
|
+
|
|
48
|
+
# Generate complete enterprise application
|
|
49
|
+
objectql ai generate -d "CRM with customers, contacts, opportunities" -t complete -o ./src
|
|
50
|
+
|
|
51
|
+
# Generation types: basic, complete, custom (default)
|
|
52
|
+
objectql ai generate -d "Inventory system" -t complete
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Options:**
|
|
56
|
+
- `-d, --description <text>` - Application description (required)
|
|
57
|
+
- `-o, --output <path>` - Output directory [default: "./src"]
|
|
58
|
+
- `-t, --type <type>` - Generation type: basic, complete, or custom [default: "custom"]
|
|
59
|
+
|
|
60
|
+
**Generates:**
|
|
61
|
+
- ObjectQL metadata (objects, forms, views, pages, menus, etc.)
|
|
62
|
+
- TypeScript implementations for actions and hooks
|
|
63
|
+
- Jest test files for business logic validation
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
#### Validation
|
|
68
|
+
|
|
69
|
+
Validate metadata files using AI for compliance and best practices.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Validate all metadata files
|
|
73
|
+
objectql ai validate ./src
|
|
74
|
+
|
|
75
|
+
# Validate with detailed output
|
|
76
|
+
objectql ai validate ./src -v
|
|
77
|
+
|
|
78
|
+
# Validate and auto-fix issues
|
|
79
|
+
objectql ai validate ./src --fix
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Options:**
|
|
83
|
+
- `<path>` - Path to metadata directory (required)
|
|
84
|
+
- `--fix` - Automatically fix issues where possible
|
|
85
|
+
- `-v, --verbose` - Show detailed validation output
|
|
86
|
+
|
|
87
|
+
**Checks:**
|
|
88
|
+
- YAML syntax validation
|
|
89
|
+
- ObjectQL specification compliance
|
|
90
|
+
- Business logic consistency
|
|
91
|
+
- Data model best practices
|
|
92
|
+
- Security and performance analysis
|
|
93
|
+
- Falls back to basic validation if no API key is set
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
#### Chat Assistant
|
|
98
|
+
|
|
99
|
+
Interactive AI assistant for ObjectQL questions and guidance.
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Start chat assistant
|
|
103
|
+
objectql ai chat
|
|
104
|
+
|
|
105
|
+
# Start with an initial question
|
|
106
|
+
objectql ai chat -p "How do I create a lookup relationship?"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Options:**
|
|
110
|
+
- `-p, --prompt <text>` - Initial prompt for the AI
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
#### Complete Example Workflow
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Set your API key
|
|
118
|
+
export OPENAI_API_KEY=sk-your-api-key-here
|
|
119
|
+
|
|
120
|
+
# Option 1: Interactive (recommended) - Just type this!
|
|
121
|
+
objectql ai
|
|
122
|
+
|
|
123
|
+
# Option 2: Quick one-shot generation
|
|
124
|
+
objectql ai generate -d "Project management with tasks and milestones" -t complete
|
|
125
|
+
|
|
126
|
+
# Validate the generated files
|
|
127
|
+
objectql ai validate ./src -v
|
|
128
|
+
|
|
129
|
+
# Get help with questions
|
|
130
|
+
objectql ai chat -p "How do I add email notifications?"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### Prerequisites
|
|
136
|
+
|
|
137
|
+
For AI-powered features, set your OpenAI API key:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
export OPENAI_API_KEY=sk-your-api-key-here
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Without an API key, basic validation (YAML syntax) is still available.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
15
147
|
### Project Initialization
|
|
16
148
|
|
|
17
149
|
#### `init`
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ObjectQLAgent } from '@objectql/core';
|
|
2
|
+
/**
|
|
3
|
+
* Create an ObjectQL AI agent instance
|
|
4
|
+
*/
|
|
5
|
+
export declare function createAgent(apiKey: string): ObjectQLAgent;
|
|
6
|
+
interface GenerateOptions {
|
|
7
|
+
description: string;
|
|
8
|
+
output?: string;
|
|
9
|
+
type?: 'basic' | 'complete' | 'custom';
|
|
10
|
+
}
|
|
11
|
+
interface ValidateOptions {
|
|
12
|
+
path: string;
|
|
13
|
+
fix?: boolean;
|
|
14
|
+
verbose?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface ChatOptions {
|
|
17
|
+
initialPrompt?: string;
|
|
18
|
+
}
|
|
19
|
+
interface ConversationalOptions {
|
|
20
|
+
output?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Conversational generation with step-by-step refinement
|
|
24
|
+
*/
|
|
25
|
+
export declare function aiConversational(options: ConversationalOptions): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Generate application metadata using AI
|
|
28
|
+
*/
|
|
29
|
+
export declare function aiGenerate(options: GenerateOptions): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Validate metadata files using AI
|
|
32
|
+
*/
|
|
33
|
+
export declare function aiValidate(options: ValidateOptions): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Interactive AI chat for metadata assistance
|
|
36
|
+
*/
|
|
37
|
+
export declare function aiChat(options: ChatOptions): Promise<void>;
|
|
38
|
+
export {};
|