lua-cli 3.0.0-alpha.1 → 3.0.0-alpha.5
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/dist/api/job.api.service.d.ts +16 -7
- package/dist/api/job.api.service.js +21 -5
- package/dist/api/postprocessor.api.service.d.ts +61 -1
- package/dist/api/postprocessor.api.service.js +35 -0
- package/dist/api/preprocessor.api.service.d.ts +61 -1
- package/dist/api/preprocessor.api.service.js +35 -0
- package/dist/api-exports.d.ts +26 -6
- package/dist/api-exports.js +42 -29
- package/dist/cli/command-definitions.js +13 -6
- package/dist/commands/chat.js +32 -5
- package/dist/commands/compile.js +16 -2
- package/dist/commands/dev.js +23 -2
- package/dist/commands/push.d.ts +6 -2
- package/dist/commands/push.js +412 -6
- package/dist/commands/test.js +18 -2
- package/dist/common/job.instance.d.ts +3 -0
- package/dist/common/job.instance.js +8 -0
- package/dist/config/constants.d.ts +6 -5
- package/dist/config/constants.js +12 -10
- package/dist/interfaces/chat.d.ts +30 -1
- package/dist/interfaces/jobs.d.ts +21 -0
- package/dist/types/skill.d.ts +75 -56
- package/dist/types/skill.js +53 -59
- package/dist/utils/bundling.d.ts +13 -4
- package/dist/utils/bundling.js +83 -26
- package/dist/utils/compile.js +27 -6
- package/dist/utils/dev-api.d.ts +42 -2
- package/dist/utils/dev-api.js +177 -4
- package/dist/utils/dev-server.d.ts +1 -1
- package/dist/utils/dev-server.js +4 -4
- package/dist/utils/dynamic-job-bundler.d.ts +17 -0
- package/dist/utils/dynamic-job-bundler.js +143 -0
- package/dist/utils/pre-bundle-jobs.d.ts +26 -0
- package/dist/utils/pre-bundle-jobs.js +176 -0
- package/dist/utils/sandbox-storage.d.ts +48 -0
- package/dist/utils/sandbox-storage.js +114 -0
- package/dist/utils/sandbox.d.ts +2 -2
- package/dist/utils/sandbox.js +23 -7
- package/package.json +1 -1
- package/template/lua.skill.yaml +47 -0
- package/template/package-lock.json +10505 -0
- package/template/package.json +2 -1
- package/template/src/index.ts +65 -3
- package/template/src/tools/CreateInlineJob.ts +42 -0
- package/API_REFERENCE.md +0 -1408
- package/CHANGELOG.md +0 -236
- package/CLI_REFERENCE.md +0 -908
- package/GETTING_STARTED.md +0 -1040
- package/INSTANCE_TYPES.md +0 -1158
- package/README.md +0 -865
- package/TEMPLATE_GUIDE.md +0 -1398
- package/USER_DATA_INSTANCE.md +0 -621
- package/template/AGENT_CONFIGURATION.md +0 -251
- package/template/COMPLEX_JOB_EXAMPLES.md +0 -795
- package/template/DYNAMIC_JOB_CREATION.md +0 -371
- package/template/TOOL_EXAMPLES.md +0 -655
- package/template/WEBHOOKS_JOBS_QUICKSTART.md +0 -318
- package/template/WEBHOOK_JOB_EXAMPLES.md +0 -817
- package/template/src/index-agent-example.ts +0 -201
- package/template/src/postprocessors/ResponseFormatter.ts +0 -151
- package/template/src/preprocessors/MessageFilter.ts +0 -91
package/README.md
DELETED
|
@@ -1,865 +0,0 @@
|
|
|
1
|
-
# Lua CLI
|
|
2
|
-
|
|
3
|
-
Build AI agents with custom capabilities using TypeScript.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/lua-cli)
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## 🎯 What is Lua CLI?
|
|
11
|
-
|
|
12
|
-
Lua CLI is a powerful command-line tool for building, testing, and deploying AI skills. A **skill** is a collection of **tools** (functions) that your AI agent can use to accomplish tasks.
|
|
13
|
-
|
|
14
|
-
**Think of it like:**
|
|
15
|
-
- 🤖 **AI Agent** = Your assistant (like ChatGPT)
|
|
16
|
-
- 🎯 **Skills** = What it can do (your custom capabilities)
|
|
17
|
-
- 🛠️ **Tools** = Specific functions (e.g., "get weather", "create order")
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## ⚡ Quick Start
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# Install
|
|
25
|
-
npm install -g lua-cli
|
|
26
|
-
|
|
27
|
-
# Authenticate
|
|
28
|
-
lua auth configure
|
|
29
|
-
|
|
30
|
-
# Create a project
|
|
31
|
-
mkdir my-skill && cd my-skill
|
|
32
|
-
lua init
|
|
33
|
-
|
|
34
|
-
# Test locally
|
|
35
|
-
lua test
|
|
36
|
-
|
|
37
|
-
# Start dev mode
|
|
38
|
-
lua dev
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
**Done!** Your AI skill is running at http://localhost:3000 🎉
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## 📦 Installation
|
|
46
|
-
|
|
47
|
-
### Global Installation (Recommended)
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
npm install -g lua-cli
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Using npx (No Installation)
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npx lua-cli [command]
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Requirements
|
|
60
|
-
|
|
61
|
-
- **Node.js** 16.0.0 or higher
|
|
62
|
-
- **npm** 7.0.0 or higher
|
|
63
|
-
- **TypeScript** knowledge (for development)
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## 🚀 Features
|
|
68
|
-
|
|
69
|
-
### For Developers
|
|
70
|
-
- 🔨 **TypeScript-first** - Full type safety and autocomplete
|
|
71
|
-
- 🎨 **Template System** - 30+ example tools to learn from
|
|
72
|
-
- 🧪 **Interactive Testing** - Test tools before deployment
|
|
73
|
-
- 🔄 **Live Reload** - Dev mode with automatic recompilation
|
|
74
|
-
- 📦 **Auto Bundling** - Dependencies bundled automatically with esbuild
|
|
75
|
-
- ✅ **Input Validation** - Zod schema validation built-in
|
|
76
|
-
|
|
77
|
-
### For Operations
|
|
78
|
-
- 🔐 **Secure Auth** - API key or email OTP authentication
|
|
79
|
-
- 🌐 **Multi-Skill** - Multiple skills in one project
|
|
80
|
-
- 📊 **Version Management** - Push, test, and deploy versions
|
|
81
|
-
- 🎯 **Sandbox Testing** - Test in isolation before production
|
|
82
|
-
- 📝 **Environment Variables** - Secure configuration management
|
|
83
|
-
|
|
84
|
-
### For Users
|
|
85
|
-
- 💬 **Chat Interface** - Test your AI in real conversations
|
|
86
|
-
- 🔍 **Tool Explorer** - Browse and test individual tools
|
|
87
|
-
- 📊 **Real-time Logs** - WebSocket log streaming
|
|
88
|
-
- 🎨 **Beautiful UI** - Modern, intuitive interface
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## 📖 Documentation
|
|
93
|
-
|
|
94
|
-
### 📘 **For Beginners**
|
|
95
|
-
**[Getting Started Guide](GETTING_STARTED.md)** - Zero to deployed skill in one hour
|
|
96
|
-
- Installation and setup
|
|
97
|
-
- Your first skill
|
|
98
|
-
- Step-by-step tutorial
|
|
99
|
-
- Complete restaurant skill example
|
|
100
|
-
|
|
101
|
-
### 🔧 **For Developers**
|
|
102
|
-
**[API Reference](API_REFERENCE.md)** - Complete API documentation
|
|
103
|
-
- All exported APIs (User, Data, Products, Baskets, Orders)
|
|
104
|
-
- Type definitions
|
|
105
|
-
- Code examples
|
|
106
|
-
- Best practices
|
|
107
|
-
|
|
108
|
-
**[Template Guide](TEMPLATE_GUIDE.md)** - Understanding the example project
|
|
109
|
-
- Template structure explained
|
|
110
|
-
- 30+ tool examples
|
|
111
|
-
- Building your first skill
|
|
112
|
-
- Common patterns and recipes
|
|
113
|
-
|
|
114
|
-
### 💻 **For CLI Users**
|
|
115
|
-
**[CLI Reference](CLI_REFERENCE.md)** - All command documentation
|
|
116
|
-
- Complete command reference
|
|
117
|
-
- Flags and options
|
|
118
|
-
- Workflow examples
|
|
119
|
-
- Troubleshooting
|
|
120
|
-
|
|
121
|
-
### 🏗️ **For Contributors**
|
|
122
|
-
**[Developer Guide](DEVELOPER_GUIDE.md)** - Architecture and internals
|
|
123
|
-
- Codebase structure
|
|
124
|
-
- Module organization
|
|
125
|
-
- Contributing guidelines
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## 🎓 Core Concepts
|
|
130
|
-
|
|
131
|
-
### Skills
|
|
132
|
-
|
|
133
|
-
A skill is a collection of related tools:
|
|
134
|
-
|
|
135
|
-
```typescript
|
|
136
|
-
import { LuaSkill } from 'lua-cli';
|
|
137
|
-
|
|
138
|
-
const weatherSkill = new LuaSkill({
|
|
139
|
-
name: "weather-skill",
|
|
140
|
-
version: "1.0.0",
|
|
141
|
-
description: "Provides weather information",
|
|
142
|
-
context: "Use get_weather when users ask about weather...",
|
|
143
|
-
tools: [
|
|
144
|
-
new GetWeatherTool(),
|
|
145
|
-
new GetForecastTool()
|
|
146
|
-
]
|
|
147
|
-
});
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Tools
|
|
151
|
-
|
|
152
|
-
A tool is a single function the AI can call:
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
import { LuaTool } from 'lua-cli';
|
|
156
|
-
import { z } from 'zod';
|
|
157
|
-
|
|
158
|
-
export default class GetWeatherTool implements LuaTool {
|
|
159
|
-
name = "get_weather";
|
|
160
|
-
description = "Get current weather for a city";
|
|
161
|
-
|
|
162
|
-
inputSchema = z.object({
|
|
163
|
-
city: z.string()
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
async execute(input: any) {
|
|
167
|
-
// Call weather API
|
|
168
|
-
return {
|
|
169
|
-
temperature: 72,
|
|
170
|
-
condition: "sunny",
|
|
171
|
-
city: input.city
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### Platform APIs
|
|
178
|
-
|
|
179
|
-
Built-in APIs for common operations:
|
|
180
|
-
|
|
181
|
-
```typescript
|
|
182
|
-
import { User, Data, Products, Baskets, Orders } from 'lua-cli';
|
|
183
|
-
|
|
184
|
-
// User data
|
|
185
|
-
const user = await User.get();
|
|
186
|
-
|
|
187
|
-
// Custom data with vector search
|
|
188
|
-
await Data.create('movies', movieData, searchText);
|
|
189
|
-
const results = await Data.search('movies', 'sci-fi thriller');
|
|
190
|
-
|
|
191
|
-
// Products
|
|
192
|
-
const products = await Products.search('laptop');
|
|
193
|
-
|
|
194
|
-
// Shopping baskets
|
|
195
|
-
const basket = await Baskets.create({ currency: 'USD' });
|
|
196
|
-
await Baskets.addItem(basketId, { id, price, quantity });
|
|
197
|
-
|
|
198
|
-
// Orders
|
|
199
|
-
const order = await Baskets.placeOrder(orderData, basketId);
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## 💡 Examples
|
|
205
|
-
|
|
206
|
-
### Example 1: Simple Weather Tool
|
|
207
|
-
|
|
208
|
-
```typescript
|
|
209
|
-
import { LuaTool } from 'lua-cli';
|
|
210
|
-
import { z } from 'zod';
|
|
211
|
-
|
|
212
|
-
export default class WeatherTool implements LuaTool {
|
|
213
|
-
name = "get_weather";
|
|
214
|
-
description = "Get weather for any city";
|
|
215
|
-
inputSchema = z.object({ city: z.string() });
|
|
216
|
-
|
|
217
|
-
async execute(input: any) {
|
|
218
|
-
const response = await fetch(
|
|
219
|
-
`https://api.open-meteo.com/v1/forecast?city=${input.city}`
|
|
220
|
-
);
|
|
221
|
-
const data = await response.json();
|
|
222
|
-
return { temperature: data.temp, condition: data.condition };
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### Example 2: E-commerce Tool
|
|
228
|
-
|
|
229
|
-
```typescript
|
|
230
|
-
import { LuaTool, Products, Baskets } from 'lua-cli';
|
|
231
|
-
import { z } from 'zod';
|
|
232
|
-
|
|
233
|
-
export default class AddToCartTool implements LuaTool {
|
|
234
|
-
name = "add_to_cart";
|
|
235
|
-
description = "Add product to shopping cart";
|
|
236
|
-
|
|
237
|
-
inputSchema = z.object({
|
|
238
|
-
productId: z.string(),
|
|
239
|
-
quantity: z.number().min(1)
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
async execute(input: any) {
|
|
243
|
-
const product = await Products.getById(input.productId);
|
|
244
|
-
const basket = await Baskets.create({ currency: 'USD' });
|
|
245
|
-
|
|
246
|
-
await Baskets.addItem(basket.id, {
|
|
247
|
-
id: input.productId,
|
|
248
|
-
price: product.price,
|
|
249
|
-
quantity: input.quantity
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
return {
|
|
253
|
-
basketId: basket.id,
|
|
254
|
-
message: `Added ${input.quantity}x ${product.name} to cart`
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### Example 3: Custom Data with Search
|
|
261
|
-
|
|
262
|
-
```typescript
|
|
263
|
-
import { LuaTool, Data } from 'lua-cli';
|
|
264
|
-
import { z } from 'zod';
|
|
265
|
-
|
|
266
|
-
export class CreateMovieTool implements LuaTool {
|
|
267
|
-
name = "create_movie";
|
|
268
|
-
description = "Add a movie to the database";
|
|
269
|
-
|
|
270
|
-
inputSchema = z.object({
|
|
271
|
-
title: z.string(),
|
|
272
|
-
director: z.string(),
|
|
273
|
-
year: z.number()
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
async execute(input: any) {
|
|
277
|
-
const searchText = `${input.title} ${input.director} ${input.year}`;
|
|
278
|
-
const movie = await Data.create('movies', input, searchText);
|
|
279
|
-
return { id: movie.id, message: 'Movie added' };
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export class SearchMoviesTool implements LuaTool {
|
|
284
|
-
name = "search_movies";
|
|
285
|
-
description = "Search movies by title, director, or year";
|
|
286
|
-
inputSchema = z.object({ query: z.string() });
|
|
287
|
-
|
|
288
|
-
async execute(input: any) {
|
|
289
|
-
const results = await Data.search('movies', input.query, 10, 0.7);
|
|
290
|
-
return { movies: results.data, count: results.count };
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
---
|
|
296
|
-
|
|
297
|
-
## 🎯 Commands
|
|
298
|
-
|
|
299
|
-
### Authentication
|
|
300
|
-
```bash
|
|
301
|
-
lua auth configure # Set up API key
|
|
302
|
-
lua auth key # Display API key
|
|
303
|
-
lua auth logout # Delete API key
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
### Skill Management
|
|
307
|
-
```bash
|
|
308
|
-
lua init # Create new skill project
|
|
309
|
-
lua compile # Compile TypeScript to deployable format
|
|
310
|
-
lua test # Test tools interactively
|
|
311
|
-
lua push # Upload version to server
|
|
312
|
-
lua deploy # Deploy version to production
|
|
313
|
-
lua dev # Development mode with live reload
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### Utilities
|
|
317
|
-
```bash
|
|
318
|
-
lua admin # Open Lua Admin Dashboard in browser
|
|
319
|
-
lua docs # Open documentation in browser
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
**See [CLI_REFERENCE.md](CLI_REFERENCE.md) for complete command documentation.**
|
|
323
|
-
|
|
324
|
-
---
|
|
325
|
-
|
|
326
|
-
## 🛠️ Development Workflow
|
|
327
|
-
|
|
328
|
-
### Local Development
|
|
329
|
-
|
|
330
|
-
```bash
|
|
331
|
-
# Start dev mode
|
|
332
|
-
lua dev
|
|
333
|
-
|
|
334
|
-
# Make changes to src/tools/*.ts
|
|
335
|
-
# Save → Auto-recompiles → Auto-pushes to sandbox
|
|
336
|
-
# Test in browser at http://localhost:3000
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### Testing
|
|
340
|
-
|
|
341
|
-
```bash
|
|
342
|
-
# Test individual tools
|
|
343
|
-
lua test
|
|
344
|
-
|
|
345
|
-
# Test conversationally
|
|
346
|
-
lua dev
|
|
347
|
-
# Use chat interface
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
### Deployment
|
|
351
|
-
|
|
352
|
-
```bash
|
|
353
|
-
# Upload new version
|
|
354
|
-
lua push
|
|
355
|
-
|
|
356
|
-
# Deploy to production
|
|
357
|
-
lua deploy
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## 📚 Built-in APIs
|
|
363
|
-
|
|
364
|
-
### User API
|
|
365
|
-
```typescript
|
|
366
|
-
import { User } from 'lua-cli';
|
|
367
|
-
|
|
368
|
-
const user = await User.get();
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
### Custom Data API (with Vector Search)
|
|
372
|
-
```typescript
|
|
373
|
-
import { Data } from 'lua-cli';
|
|
374
|
-
|
|
375
|
-
await Data.create('collection', data, searchText);
|
|
376
|
-
const results = await Data.search('collection', 'query', limit, threshold);
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
### Products API
|
|
380
|
-
```typescript
|
|
381
|
-
import { Products } from 'lua-cli';
|
|
382
|
-
|
|
383
|
-
const products = await Products.search('laptop');
|
|
384
|
-
await Products.create({ name, price });
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
### Baskets API
|
|
388
|
-
```typescript
|
|
389
|
-
import { Baskets, BasketStatus } from 'lua-cli';
|
|
390
|
-
|
|
391
|
-
const basket = await Baskets.create({ currency: 'USD' });
|
|
392
|
-
await Baskets.addItem(basketId, { id, price, quantity });
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
### Orders API
|
|
396
|
-
```typescript
|
|
397
|
-
import { Orders, OrderStatus } from 'lua-cli';
|
|
398
|
-
|
|
399
|
-
const order = await Baskets.placeOrder(orderData, basketId);
|
|
400
|
-
await Orders.updateStatus(OrderStatus.FULFILLED, orderId);
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
**See [API_REFERENCE.md](API_REFERENCE.md) for complete API documentation.**
|
|
404
|
-
|
|
405
|
-
---
|
|
406
|
-
|
|
407
|
-
## 🎨 Template Project
|
|
408
|
-
|
|
409
|
-
The template includes 30+ working examples:
|
|
410
|
-
|
|
411
|
-
- 🌤️ **Weather Tool** - External API integration
|
|
412
|
-
- 👤 **User Data Tools** - User management
|
|
413
|
-
- 🛍️ **Product Tools** - E-commerce catalog
|
|
414
|
-
- 🛒 **Basket Tools** - Shopping cart
|
|
415
|
-
- 📦 **Order Tools** - Order processing
|
|
416
|
-
- 🎬 **Custom Data Tools** - Vector search
|
|
417
|
-
- 💳 **Payment Tool** - Payment integration
|
|
418
|
-
|
|
419
|
-
**See [TEMPLATE_GUIDE.md](TEMPLATE_GUIDE.md) for complete template documentation.**
|
|
420
|
-
|
|
421
|
-
---
|
|
422
|
-
|
|
423
|
-
## 🔒 Security
|
|
424
|
-
|
|
425
|
-
- ✅ API keys stored in system keychain
|
|
426
|
-
- ✅ Environment variables for secrets
|
|
427
|
-
- ✅ Secure VM sandbox for tool execution
|
|
428
|
-
- ✅ No hardcoded credentials
|
|
429
|
-
- ✅ HTTPS for all API calls
|
|
430
|
-
|
|
431
|
-
**Best Practices:**
|
|
432
|
-
```typescript
|
|
433
|
-
import { env } from 'lua-cli';
|
|
434
|
-
|
|
435
|
-
// ✅ Good - Use environment variables
|
|
436
|
-
const apiKey = env('EXTERNAL_API_KEY');
|
|
437
|
-
|
|
438
|
-
// ❌ Bad - Hardcoded secrets
|
|
439
|
-
const apiKey = 'sk_abc123';
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
---
|
|
443
|
-
|
|
444
|
-
## 🧪 Testing
|
|
445
|
-
|
|
446
|
-
### Unit Testing
|
|
447
|
-
|
|
448
|
-
```typescript
|
|
449
|
-
import { describe, it, expect } from '@jest/globals';
|
|
450
|
-
import MyTool from './tools/MyTool';
|
|
451
|
-
|
|
452
|
-
describe('MyTool', () => {
|
|
453
|
-
it('should return expected result', async () => {
|
|
454
|
-
const tool = new MyTool();
|
|
455
|
-
const result = await tool.execute({ input: 'test' });
|
|
456
|
-
expect(result).toHaveProperty('success');
|
|
457
|
-
});
|
|
458
|
-
});
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
### Interactive Testing
|
|
462
|
-
|
|
463
|
-
```bash
|
|
464
|
-
lua test
|
|
465
|
-
# Select tool → Enter inputs → See results
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
### Conversational Testing
|
|
469
|
-
|
|
470
|
-
```bash
|
|
471
|
-
lua dev
|
|
472
|
-
# Chat with AI at http://localhost:3000
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
---
|
|
476
|
-
|
|
477
|
-
## 🎯 Use Cases
|
|
478
|
-
|
|
479
|
-
### Customer Service
|
|
480
|
-
- Answer FAQs from knowledge base
|
|
481
|
-
- Look up order status
|
|
482
|
-
- Create support tickets
|
|
483
|
-
- Search documentation
|
|
484
|
-
|
|
485
|
-
### E-commerce
|
|
486
|
-
- Product search and recommendations
|
|
487
|
-
- Shopping cart management
|
|
488
|
-
- Order creation and tracking
|
|
489
|
-
- Inventory checks
|
|
490
|
-
|
|
491
|
-
### Booking & Scheduling
|
|
492
|
-
- Check availability
|
|
493
|
-
- Create appointments
|
|
494
|
-
- Send confirmations
|
|
495
|
-
- Manage reservations
|
|
496
|
-
|
|
497
|
-
### Data Management
|
|
498
|
-
- CRUD operations on custom data
|
|
499
|
-
- Vector search for semantic queries
|
|
500
|
-
- Data aggregation and reporting
|
|
501
|
-
- Integration with external systems
|
|
502
|
-
|
|
503
|
-
---
|
|
504
|
-
|
|
505
|
-
## 📊 Architecture
|
|
506
|
-
|
|
507
|
-
```
|
|
508
|
-
┌─────────────────┐
|
|
509
|
-
│ AI Agent │
|
|
510
|
-
│ (Lua Platform)│
|
|
511
|
-
└────────┬────────┘
|
|
512
|
-
│
|
|
513
|
-
↓
|
|
514
|
-
┌─────────────────┐
|
|
515
|
-
│ Your Skills │ ← Built with Lua CLI
|
|
516
|
-
│ (TypeScript) │
|
|
517
|
-
└────────┬────────┘
|
|
518
|
-
│
|
|
519
|
-
↓
|
|
520
|
-
┌─────────────────┐
|
|
521
|
-
│ Your Tools │
|
|
522
|
-
│ (Functions) │
|
|
523
|
-
└────────┬────────┘
|
|
524
|
-
│
|
|
525
|
-
↓
|
|
526
|
-
┌─────────────────┐
|
|
527
|
-
│ Platform APIs │ ← User, Products, Data, etc.
|
|
528
|
-
│ External APIs │ ← Weather, Stripe, SendGrid, etc.
|
|
529
|
-
│ Databases │ ← Your own systems
|
|
530
|
-
└─────────────────┘
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
---
|
|
534
|
-
|
|
535
|
-
## 🌟 Key Features
|
|
536
|
-
|
|
537
|
-
### Type-Safe Development
|
|
538
|
-
```typescript
|
|
539
|
-
// Full TypeScript support
|
|
540
|
-
import { LuaTool, Products } from 'lua-cli';
|
|
541
|
-
import { z } from 'zod';
|
|
542
|
-
|
|
543
|
-
// Autocomplete, type checking, and validation
|
|
544
|
-
export default class MyTool implements LuaTool {
|
|
545
|
-
inputSchema = z.object({
|
|
546
|
-
query: z.string() // Validated at runtime
|
|
547
|
-
});
|
|
548
|
-
|
|
549
|
-
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
550
|
-
// input is fully typed!
|
|
551
|
-
return await Products.search(input.query);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
```
|
|
555
|
-
|
|
556
|
-
### Instant Feedback
|
|
557
|
-
```bash
|
|
558
|
-
lua dev
|
|
559
|
-
# Edit file → Save → Auto-reload → Test immediately
|
|
560
|
-
```
|
|
561
|
-
|
|
562
|
-
### Production Ready
|
|
563
|
-
```bash
|
|
564
|
-
lua push # Upload to server
|
|
565
|
-
lua deploy # Deploy to all users
|
|
566
|
-
```
|
|
567
|
-
|
|
568
|
-
---
|
|
569
|
-
|
|
570
|
-
## 📖 Learning Resources
|
|
571
|
-
|
|
572
|
-
### 🟢 **New to Lua?**
|
|
573
|
-
Start here: **[GETTING_STARTED.md](GETTING_STARTED.md)**
|
|
574
|
-
- Installation
|
|
575
|
-
- First skill in 1 hour
|
|
576
|
-
- Complete tutorial
|
|
577
|
-
- Common patterns
|
|
578
|
-
|
|
579
|
-
### 🟡 **Building Skills?**
|
|
580
|
-
Read: **[API_REFERENCE.md](API_REFERENCE.md)**
|
|
581
|
-
- All exported APIs
|
|
582
|
-
- Type definitions
|
|
583
|
-
- Code examples
|
|
584
|
-
- Best practices
|
|
585
|
-
|
|
586
|
-
### 🟠 **Understanding Examples?**
|
|
587
|
-
Read: **[TEMPLATE_GUIDE.md](TEMPLATE_GUIDE.md)**
|
|
588
|
-
- Template structure
|
|
589
|
-
- 30+ tool examples
|
|
590
|
-
- Common recipes
|
|
591
|
-
- Migration guide
|
|
592
|
-
|
|
593
|
-
### 🔵 **Using the CLI?**
|
|
594
|
-
Read: **[CLI_REFERENCE.md](CLI_REFERENCE.md)**
|
|
595
|
-
- All commands
|
|
596
|
-
- Flags and options
|
|
597
|
-
- Workflows
|
|
598
|
-
- Troubleshooting
|
|
599
|
-
|
|
600
|
-
### 🟣 **Contributing?**
|
|
601
|
-
Read: **[DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md)**
|
|
602
|
-
- Architecture
|
|
603
|
-
- Module structure
|
|
604
|
-
- Contribution guidelines
|
|
605
|
-
|
|
606
|
-
---
|
|
607
|
-
|
|
608
|
-
## 🔧 Common Tasks
|
|
609
|
-
|
|
610
|
-
### Create a New Tool
|
|
611
|
-
|
|
612
|
-
```bash
|
|
613
|
-
# Create file
|
|
614
|
-
touch src/tools/MyTool.ts
|
|
615
|
-
```
|
|
616
|
-
|
|
617
|
-
```typescript
|
|
618
|
-
import { LuaTool } from 'lua-cli';
|
|
619
|
-
import { z } from 'zod';
|
|
620
|
-
|
|
621
|
-
export default class MyTool implements LuaTool {
|
|
622
|
-
name = "my_tool";
|
|
623
|
-
description = "What it does";
|
|
624
|
-
inputSchema = z.object({ param: z.string() });
|
|
625
|
-
|
|
626
|
-
async execute(input: any) {
|
|
627
|
-
// Your logic here
|
|
628
|
-
return { success: true };
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
Add to skill in `src/index.ts`:
|
|
634
|
-
```typescript
|
|
635
|
-
import MyTool from './tools/MyTool';
|
|
636
|
-
|
|
637
|
-
const skill = new LuaSkill({
|
|
638
|
-
tools: [new MyTool()]
|
|
639
|
-
});
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
---
|
|
643
|
-
|
|
644
|
-
### Call External APIs
|
|
645
|
-
|
|
646
|
-
```typescript
|
|
647
|
-
import { LuaTool, env } from 'lua-cli';
|
|
648
|
-
|
|
649
|
-
export default class ExternalApiTool implements LuaTool {
|
|
650
|
-
async execute(input: any) {
|
|
651
|
-
const apiKey = env('EXTERNAL_API_KEY');
|
|
652
|
-
|
|
653
|
-
const response = await fetch('https://api.example.com/data', {
|
|
654
|
-
headers: { 'Authorization': `Bearer ${apiKey}` }
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
return await response.json();
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
---
|
|
663
|
-
|
|
664
|
-
### Use Platform APIs
|
|
665
|
-
|
|
666
|
-
```typescript
|
|
667
|
-
import { LuaTool, Products, Baskets } from 'lua-cli';
|
|
668
|
-
|
|
669
|
-
export default class ShoppingTool implements LuaTool {
|
|
670
|
-
async execute(input: any) {
|
|
671
|
-
// Search products
|
|
672
|
-
const products = await Products.search(input.query);
|
|
673
|
-
|
|
674
|
-
// Create basket
|
|
675
|
-
const basket = await Baskets.create({ currency: 'USD' });
|
|
676
|
-
|
|
677
|
-
// Add item
|
|
678
|
-
await Baskets.addItem(basket.id, {
|
|
679
|
-
id: products.data[0].id,
|
|
680
|
-
price: products.data[0].price,
|
|
681
|
-
quantity: 1
|
|
682
|
-
});
|
|
683
|
-
|
|
684
|
-
return { basketId: basket.id };
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
```
|
|
688
|
-
|
|
689
|
-
---
|
|
690
|
-
|
|
691
|
-
### Store Custom Data
|
|
692
|
-
|
|
693
|
-
```typescript
|
|
694
|
-
import { LuaTool, Data } from 'lua-cli';
|
|
695
|
-
|
|
696
|
-
export default class SaveNoteTool implements LuaTool {
|
|
697
|
-
async execute(input: any) {
|
|
698
|
-
// Create
|
|
699
|
-
const note = await Data.create('notes', {
|
|
700
|
-
title: input.title,
|
|
701
|
-
content: input.content,
|
|
702
|
-
tags: input.tags
|
|
703
|
-
}, `${input.title} ${input.content}`);
|
|
704
|
-
|
|
705
|
-
// Search later
|
|
706
|
-
const results = await Data.search('notes', 'meeting notes', 10);
|
|
707
|
-
|
|
708
|
-
return { noteId: note.id };
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
```
|
|
712
|
-
|
|
713
|
-
---
|
|
714
|
-
|
|
715
|
-
## 🎯 Example Projects
|
|
716
|
-
|
|
717
|
-
### Knowledge Base Assistant
|
|
718
|
-
```typescript
|
|
719
|
-
Tools: search_kb, create_article, update_article
|
|
720
|
-
APIs: Data (vector search)
|
|
721
|
-
Use Case: Company documentation, FAQ
|
|
722
|
-
```
|
|
723
|
-
|
|
724
|
-
### E-commerce Bot
|
|
725
|
-
```typescript
|
|
726
|
-
Tools: search_products, add_to_cart, checkout
|
|
727
|
-
APIs: Products, Baskets, Orders
|
|
728
|
-
Use Case: Online shopping assistant
|
|
729
|
-
```
|
|
730
|
-
|
|
731
|
-
### Booking System
|
|
732
|
-
```typescript
|
|
733
|
-
Tools: check_availability, make_reservation, cancel_booking
|
|
734
|
-
APIs: Data (custom collections)
|
|
735
|
-
Use Case: Restaurant/hotel reservations
|
|
736
|
-
```
|
|
737
|
-
|
|
738
|
-
### CRM Assistant
|
|
739
|
-
```typescript
|
|
740
|
-
Tools: find_customer, create_lead, update_contact
|
|
741
|
-
APIs: Data, User
|
|
742
|
-
Use Case: Customer relationship management
|
|
743
|
-
```
|
|
744
|
-
|
|
745
|
-
---
|
|
746
|
-
|
|
747
|
-
## 🚀 Deployment
|
|
748
|
-
|
|
749
|
-
### Development → Production Flow
|
|
750
|
-
|
|
751
|
-
```bash
|
|
752
|
-
# 1. Develop locally
|
|
753
|
-
lua dev
|
|
754
|
-
# Edit, test, iterate
|
|
755
|
-
|
|
756
|
-
# 2. Push to server
|
|
757
|
-
lua push
|
|
758
|
-
|
|
759
|
-
# 3. Test in sandbox
|
|
760
|
-
lua dev
|
|
761
|
-
# Final testing
|
|
762
|
-
|
|
763
|
-
# 4. Deploy to production
|
|
764
|
-
lua deploy
|
|
765
|
-
# Available to all users!
|
|
766
|
-
```
|
|
767
|
-
|
|
768
|
-
### Version Management
|
|
769
|
-
|
|
770
|
-
Update version in `lua.skill.yaml`:
|
|
771
|
-
```yaml
|
|
772
|
-
skills:
|
|
773
|
-
- name: my-skill
|
|
774
|
-
version: 1.0.1 # ← Increment this
|
|
775
|
-
```
|
|
776
|
-
|
|
777
|
-
Then push and deploy:
|
|
778
|
-
```bash
|
|
779
|
-
lua push # Uploads v1.0.1
|
|
780
|
-
lua deploy # Deploys v1.0.1
|
|
781
|
-
```
|
|
782
|
-
|
|
783
|
-
---
|
|
784
|
-
|
|
785
|
-
## ⚙️ Configuration
|
|
786
|
-
|
|
787
|
-
### Environment Variables
|
|
788
|
-
|
|
789
|
-
**`.env` file:**
|
|
790
|
-
```bash
|
|
791
|
-
STRIPE_API_KEY=sk_test_abc123
|
|
792
|
-
SENDGRID_KEY=SG.xyz789
|
|
793
|
-
CUSTOM_API_URL=https://api.example.com
|
|
794
|
-
```
|
|
795
|
-
|
|
796
|
-
**`lua.skill.yaml`:**
|
|
797
|
-
```yaml
|
|
798
|
-
skill:
|
|
799
|
-
env:
|
|
800
|
-
PRODUCTION_API_KEY: sk_live_abc123
|
|
801
|
-
BASE_URL: https://prod.example.com
|
|
802
|
-
```
|
|
803
|
-
|
|
804
|
-
**Access in code:**
|
|
805
|
-
```typescript
|
|
806
|
-
import { env } from 'lua-cli';
|
|
807
|
-
|
|
808
|
-
const key = env('STRIPE_API_KEY');
|
|
809
|
-
```
|
|
810
|
-
|
|
811
|
-
---
|
|
812
|
-
|
|
813
|
-
## 🤝 Contributing
|
|
814
|
-
|
|
815
|
-
We welcome contributions!
|
|
816
|
-
|
|
817
|
-
1. Fork the repository
|
|
818
|
-
2. Create a feature branch
|
|
819
|
-
3. Make your changes
|
|
820
|
-
4. Write tests
|
|
821
|
-
5. Submit a pull request
|
|
822
|
-
|
|
823
|
-
See [DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md) for architecture details.
|
|
824
|
-
|
|
825
|
-
---
|
|
826
|
-
|
|
827
|
-
## 📄 License
|
|
828
|
-
|
|
829
|
-
MIT License - see [LICENSE](LICENSE) file for details.
|
|
830
|
-
|
|
831
|
-
---
|
|
832
|
-
|
|
833
|
-
## 🔗 Links
|
|
834
|
-
|
|
835
|
-
- **Documentation**: https://docs.heylua.ai
|
|
836
|
-
- **Platform**: https://heylua.ai
|
|
837
|
-
- **GitHub**: https://github.com/lua-ai/lua-cli
|
|
838
|
-
- **npm**: https://www.npmjs.com/package/lua-cli
|
|
839
|
-
|
|
840
|
-
---
|
|
841
|
-
|
|
842
|
-
## 💬 Support
|
|
843
|
-
|
|
844
|
-
- **Issues**: [GitHub Issues](https://github.com/lua-ai/lua-cli/issues)
|
|
845
|
-
- **Email**: support@lua.ai
|
|
846
|
-
- **Docs**: https://docs.heylua.ai
|
|
847
|
-
|
|
848
|
-
---
|
|
849
|
-
|
|
850
|
-
## 🎉 Quick Links
|
|
851
|
-
|
|
852
|
-
| I want to... | Read this... |
|
|
853
|
-
|--------------|--------------|
|
|
854
|
-
| **Get started** | [GETTING_STARTED.md](GETTING_STARTED.md) |
|
|
855
|
-
| **Learn the API** | [API_REFERENCE.md](API_REFERENCE.md) |
|
|
856
|
-
| **Use CLI commands** | [CLI_REFERENCE.md](CLI_REFERENCE.md) |
|
|
857
|
-
| **Understand examples** | [TEMPLATE_GUIDE.md](TEMPLATE_GUIDE.md) |
|
|
858
|
-
| **Contribute code** | [DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md) |
|
|
859
|
-
| **See changelog** | [CHANGELOG.md](CHANGELOG.md) |
|
|
860
|
-
|
|
861
|
-
---
|
|
862
|
-
|
|
863
|
-
**Happy building! 🚀**
|
|
864
|
-
|
|
865
|
-
Made with ❤️ by the Lua team
|