@objectql/cli 1.7.2 → 1.7.3
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 +12 -0
- package/LICENSE +118 -21
- 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,17 @@
|
|
|
1
1
|
# @objectql/cli
|
|
2
2
|
|
|
3
|
+
## 1.7.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Release patch version 1.7.3 with latest improvements and bug fixes
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @objectql/core@1.7.3
|
|
10
|
+
- @objectql/driver-sql@1.7.3
|
|
11
|
+
- @objectql/server@1.7.3
|
|
12
|
+
- @objectql/types@1.7.3
|
|
13
|
+
- @objectql/platform-node@1.7.3
|
|
14
|
+
|
|
3
15
|
## 1.7.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
to
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
# PolyForm Shield License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/shield/1.0.0>
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree
|
|
8
|
+
to them as both strict obligations and conditions to all
|
|
9
|
+
your licenses.
|
|
10
|
+
|
|
11
|
+
## Copyright License
|
|
12
|
+
|
|
13
|
+
The licensor grants you a copyright license for the
|
|
14
|
+
software to do everything you might do with the software
|
|
15
|
+
that would otherwise infringe the licensor's copyright
|
|
16
|
+
in it for any permitted purpose. However, you may
|
|
17
|
+
only distribute the software according to [Distribution
|
|
18
|
+
License](#distribution-license) and make changes or new works
|
|
19
|
+
based on the software according to [Changes and New Works
|
|
20
|
+
License](#changes-and-new-works-license).
|
|
21
|
+
|
|
22
|
+
## Distribution License
|
|
23
|
+
|
|
24
|
+
The licensor grants you an additional copyright license
|
|
25
|
+
to distribute copies of the software. Your license
|
|
26
|
+
to distribute covers distributing the software with
|
|
27
|
+
changes and new works permitted by [Changes and New Works
|
|
28
|
+
License](#changes-and-new-works-license).
|
|
29
|
+
|
|
30
|
+
## Notices
|
|
31
|
+
|
|
32
|
+
You must ensure that anyone who gets a copy of any part of
|
|
33
|
+
the software from you also gets a copy of these terms or the
|
|
34
|
+
URL for them above, as well as copies of any plain-text lines
|
|
35
|
+
beginning with `Required Notice:` that the licensor provided
|
|
36
|
+
with the software. For example:
|
|
37
|
+
|
|
38
|
+
> Required Notice: Copyright ObjectQL Contributors (https://github.com/objectql)
|
|
39
|
+
|
|
40
|
+
## Changes and New Works License
|
|
41
|
+
|
|
42
|
+
The licensor grants you an additional copyright license to
|
|
43
|
+
make changes and new works based on the software for any
|
|
44
|
+
permitted purpose.
|
|
45
|
+
|
|
46
|
+
## Patent License
|
|
47
|
+
|
|
48
|
+
The licensor grants you a patent license for the software that
|
|
49
|
+
covers patent claims the licensor can license, or becomes able
|
|
50
|
+
to license, that you would infringe by using the software.
|
|
51
|
+
|
|
52
|
+
## Fair Use
|
|
53
|
+
|
|
54
|
+
You may have "fair use" rights for the software under the
|
|
55
|
+
law. These terms do not limit them.
|
|
56
|
+
|
|
57
|
+
## No Other Rights
|
|
58
|
+
|
|
59
|
+
These terms do not allow you to sublicense or transfer any of
|
|
60
|
+
your licenses to anyone else, or prevent the licensor from
|
|
61
|
+
granting licenses to anyone else. These terms do not imply
|
|
62
|
+
any other licenses.
|
|
63
|
+
|
|
64
|
+
## Patent Defense
|
|
65
|
+
|
|
66
|
+
If you make any written claim that the software infringes or
|
|
67
|
+
contributes to infringement of any patent, your patent license
|
|
68
|
+
for the software granted under these terms ends immediately. If
|
|
69
|
+
your company makes such a claim, your patent license ends
|
|
70
|
+
immediately for work on behalf of your company.
|
|
71
|
+
|
|
72
|
+
## Violations
|
|
73
|
+
|
|
74
|
+
The first time you are notified in writing that you have
|
|
75
|
+
violated any of these terms, or done anything with the software
|
|
76
|
+
not covered by your licenses, your licenses can nonetheless
|
|
77
|
+
continue if you come into full compliance with these terms,
|
|
78
|
+
and take practical steps to correct past violations, within
|
|
79
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
80
|
+
end immediately.
|
|
81
|
+
|
|
82
|
+
## No Liability
|
|
83
|
+
|
|
84
|
+
***As far as the law allows, the software comes as is, without
|
|
85
|
+
any warranty or condition, and the licensor will not be liable
|
|
86
|
+
to you for any damages arising out of these terms or the use
|
|
87
|
+
or nature of the software, under any kind of legal claim.***
|
|
88
|
+
|
|
89
|
+
## Definitions
|
|
90
|
+
|
|
91
|
+
The **licensor** is the individual or entity offering these
|
|
92
|
+
terms, and the **software** is the software the licensor makes
|
|
93
|
+
available under these terms.
|
|
94
|
+
|
|
95
|
+
**You** refers to the individual or entity agreeing to these
|
|
96
|
+
terms.
|
|
97
|
+
|
|
98
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
99
|
+
or other kind of organization that you work for, plus all
|
|
100
|
+
organizations that have control over, are under the control of,
|
|
101
|
+
or are under common control with that organization. **Control**
|
|
102
|
+
means ownership of substantially all the assets of an entity,
|
|
103
|
+
or the power to direct its management and policies by vote,
|
|
104
|
+
contract, or otherwise. Control can be direct or indirect.
|
|
105
|
+
|
|
106
|
+
**Your licenses** are all the licenses granted to you for the
|
|
107
|
+
software under these terms.
|
|
108
|
+
|
|
109
|
+
**Use** means anything you do with the software requiring one
|
|
110
|
+
of your licenses.
|
|
111
|
+
|
|
112
|
+
**Permitted purpose** means any purpose other than competing
|
|
113
|
+
with the licensor or any product the licensor or its affiliates
|
|
114
|
+
provides using the software.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
Required Notice: Copyright (c) 2026 ObjectQL Contributors (https://github.com/objectql)
|
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 {};
|