⚠️ Deprecated: AI commands are no longer part of@objectql/cli. This document is preserved for historical reference only.
This document provides comprehensive examples of using ObjectQL's AI-powered features.
# Interactive mode (default, most common)
objectql ai [output-dir]
# One-shot generation
objectql ai generate -d "description" [-o output] [-t type]
# Validation
objectql ai validate <path> [--fix] [-v]
# Chat assistant
objectql ai chat [-p "prompt"]# Simply type this to start!
objectql ai
# Or specify output directory
objectql ai ./my-app- AI greets you and asks what you want to build
- You describe your application in natural language
- AI generates files incrementally based on your conversation
- You can request changes, additions, or improvements
- Files are created in real-time
- Type "done" to finish and save, "exit" to quit
AI: What would you like to build today?
You: A blog system with posts, comments, and categories
AI: Great! I'll create a blog system. Let me start with the core entities...
[Generates post.object.yml, comment.object.yml, category.object.yml]
AI: I've created the basic objects. Would you like me to add forms and views?
You: Yes, and also add tags for posts
AI: Adding forms, views, and a tag system...
[Generates additional files]
objectql ai generate \
-d "A blogging platform with posts, comments, categories, and tags. Posts have title, content, author, published status, and publish date. Comments belong to posts. Posts can have multiple categories and tags." \
-t complete \
-o ./blog-systemThe AI will generate:
post.object.yml- Blog post entitycomment.object.yml- Comment entitycategory.object.yml- Category entitytag.object.yml- Tag entitypost.validation.yml- Validation rules for postspublish_post.action.ts- TypeScript action implementationpost.hook.ts- Lifecycle hookspost.test.ts- Jest tests
label: Post
fields:
title:
type: text
required: true
validation:
min_length: 3
max_length: 200
content:
type: textarea
required: true
author:
type: lookup
reference_to: users
required: true
published:
type: boolean
default: false
publish_date:
type: datetime
categories:
type: lookup
reference_to: category
multiple: true
tags:
type: lookup
reference_to: tag
multiple: trueobjectql ai validate ./my-app -vFound 4 metadata file(s)
📄 customer.object.yml
✓ 5 field(s) defined
📄 order.object.yml
✓ 8 field(s) defined
📄 order.validation.yml
✓ 3 validation rule(s) found
📄 product.object.yml
✓ 6 field(s) defined
============================================================
✓ Basic validation passed
objectql ai generate \
-d "An e-commerce platform with products, categories, shopping cart, orders, and customers. Include inventory tracking, pricing tiers, and order status workflow." \
-t complete \
-o ./ecommerceobjectql ai validate ./src --verboseThis provides detailed information about each validation check performed.