lua-cli 3.0.0-alpha.8 → 3.0.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 +850 -0
- package/dist/api/chat.api.service.d.ts +8 -0
- package/dist/api/chat.api.service.js +55 -0
- package/dist/api/products.api.service.d.ts +2 -1
- package/dist/api/products.api.service.js +11 -10
- package/dist/api-exports.d.ts +1 -1
- package/dist/api-exports.js +6 -1
- package/dist/commands/chat.js +39 -34
- package/dist/commands/init.js +10 -2
- package/dist/index.js +2 -2
- package/dist/interfaces/message.d.ts +2 -2
- package/dist/utils/agent-management.d.ts +1 -1
- package/dist/utils/agent-management.js +5 -3
- package/dist/utils/init-helpers.d.ts +10 -1
- package/dist/utils/init-helpers.js +44 -1
- package/dist/utils/pre-bundle-jobs.js +9 -9
- package/dist/utils/sandbox.js +1 -2
- package/package.json +3 -3
- package/template/QUICKSTART.md +693 -191
- package/template/README.md +673 -802
- package/template/lua.skill.yaml +6 -28
- package/template/package.json +1 -1
- package/template/src/index.ts +18 -252
- package/template/src/postprocessors/modifyResponse.ts +21 -0
- package/template/src/preprocessors/messageMatching.ts +22 -0
- package/template/src/skills/basket.skill.ts +12 -0
- package/template/src/skills/product.skill.ts +13 -0
- package/template/src/{tools → skills/tools}/ProductsTool.ts +2 -1
- package/template/src/skills/tools/UserDataTool.ts +75 -0
- package/template/src/skills/user.skill.ts +13 -0
- package/template/src/seed.ts +0 -46
- package/template/src/tools/UserDataTool.ts +0 -33
- /package/template/src/{tools → skills/tools}/BasketTool.ts +0 -0
- /package/template/src/{tools → skills/tools}/CreateInlineJob.ts +0 -0
- /package/template/src/{tools → skills/tools}/CreatePostTool.ts +0 -0
- /package/template/src/{tools → skills/tools}/CustomDataTool.ts +0 -0
- /package/template/src/{tools → skills/tools}/GameScoreTrackerTool.ts +0 -0
- /package/template/src/{tools → skills/tools}/GetWeatherTool.ts +0 -0
- /package/template/src/{tools → skills/tools}/OrderTool.ts +0 -0
- /package/template/src/{tools → skills/tools}/PaymentTool.ts +0 -0
- /package/template/src/{tools → skills/tools}/SmartBasketTool.ts +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,850 @@
|
|
|
1
|
+
# Lua CLI
|
|
2
|
+
|
|
3
|
+
> Build, test, and deploy AI agents with custom tools, webhooks, and scheduled jobs
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/lua-cli)
|
|
6
|
+
[](https://github.com/heylua/lua-cli/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
**Lua CLI** is a command-line interface for building intelligent AI agents on the Lua AI platform. Create custom tools, integrate with external APIs, schedule automated tasks, and deploy to production—all from your terminal.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ✨ Features
|
|
13
|
+
|
|
14
|
+
- 🤖 **LuaAgent** - Unified agent configuration with persona, skills, webhooks, and jobs
|
|
15
|
+
- 🛠️ **Custom Tools** - Build TypeScript tools with full type safety and Zod validation
|
|
16
|
+
- 🪝 **Webhooks** - HTTP endpoints for external integrations (Stripe, Shopify, etc.)
|
|
17
|
+
- ⏰ **Scheduled Jobs** - Cron-based and one-time background tasks
|
|
18
|
+
- 📥 **Preprocessors** - Filter and route messages before they reach your agent
|
|
19
|
+
- 📤 **Postprocessors** - Transform and format agent responses
|
|
20
|
+
- 💬 **Streaming Chat** - Real-time chat interface with typing indicators
|
|
21
|
+
- 🧪 **Local Testing** - Test tools, webhooks, and jobs before deploying
|
|
22
|
+
- 🚀 **Batch Deployment** - Push all components with one command
|
|
23
|
+
- 🔄 **Auto-Sync** - YAML and code stay synchronized automatically
|
|
24
|
+
- 🌐 **CI/CD Ready** - Environment variable support for automated deployments
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 📦 Installation
|
|
29
|
+
|
|
30
|
+
### Global Installation (Recommended)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g lua-cli
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Project Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install lua-cli
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Verify Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
lua --version
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🚀 Quick Start
|
|
51
|
+
|
|
52
|
+
### 1. Authenticate
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
lua auth configure
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Enter your API key when prompted (get one at https://admin.heylua.ai).
|
|
59
|
+
|
|
60
|
+
### 2. Initialize Project
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
mkdir my-agent
|
|
64
|
+
cd my-agent
|
|
65
|
+
lua init
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Follow the prompts to:
|
|
69
|
+
- Select or create an agent
|
|
70
|
+
- Configure persona and welcome message
|
|
71
|
+
- Set up your project
|
|
72
|
+
|
|
73
|
+
### 3. Test Your Agent
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Test individual tools
|
|
77
|
+
lua test
|
|
78
|
+
|
|
79
|
+
# Chat with your agent
|
|
80
|
+
lua chat
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 4. Deploy to Production
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Interactive deployment
|
|
87
|
+
lua push
|
|
88
|
+
|
|
89
|
+
# Or batch deployment
|
|
90
|
+
lua push all --force --auto-deploy
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 🎯 Core Concepts
|
|
96
|
+
|
|
97
|
+
### LuaAgent
|
|
98
|
+
|
|
99
|
+
The unified configuration for your AI agent:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { LuaAgent, LuaSkill, LuaWebhook, LuaJob } from 'lua-cli';
|
|
103
|
+
|
|
104
|
+
export const agent = new LuaAgent({
|
|
105
|
+
name: 'my-assistant',
|
|
106
|
+
persona: 'You are a helpful AI assistant...',
|
|
107
|
+
welcomeMessage: 'Hello! How can I help you today?',
|
|
108
|
+
|
|
109
|
+
skills: [customerSupportSkill, productSkill],
|
|
110
|
+
webhooks: [paymentWebhook],
|
|
111
|
+
jobs: [dailyReportJob],
|
|
112
|
+
preProcessors: [messageFilter],
|
|
113
|
+
postProcessors: [responseFormatter]
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Skills
|
|
118
|
+
|
|
119
|
+
Group related tools together:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { LuaSkill } from 'lua-cli';
|
|
123
|
+
|
|
124
|
+
const weatherSkill = new LuaSkill({
|
|
125
|
+
name: 'weather-skill',
|
|
126
|
+
description: 'Weather information tools',
|
|
127
|
+
context: 'Use these tools to get weather data for any location',
|
|
128
|
+
tools: [
|
|
129
|
+
new GetWeatherTool(),
|
|
130
|
+
new GetForecastTool()
|
|
131
|
+
]
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Tools
|
|
136
|
+
|
|
137
|
+
Individual functions your agent can use:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import { LuaTool } from 'lua-cli/skill';
|
|
141
|
+
import { z } from 'zod';
|
|
142
|
+
|
|
143
|
+
export default class GetWeatherTool implements LuaTool {
|
|
144
|
+
name = 'get_weather';
|
|
145
|
+
description = 'Get current weather for a city';
|
|
146
|
+
|
|
147
|
+
inputSchema = z.object({
|
|
148
|
+
city: z.string()
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
152
|
+
// Your logic here
|
|
153
|
+
return { temperature: 72, condition: 'sunny' };
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Webhooks
|
|
159
|
+
|
|
160
|
+
Receive HTTP requests from external systems:
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
import { LuaWebhook } from 'lua-cli';
|
|
164
|
+
import { z } from 'zod';
|
|
165
|
+
|
|
166
|
+
export default new LuaWebhook({
|
|
167
|
+
name: 'payment-webhook',
|
|
168
|
+
version: '1.0.0',
|
|
169
|
+
description: 'Handle payment notifications',
|
|
170
|
+
|
|
171
|
+
bodySchema: z.object({
|
|
172
|
+
orderId: z.string(),
|
|
173
|
+
amount: z.number(),
|
|
174
|
+
status: z.string()
|
|
175
|
+
}),
|
|
176
|
+
|
|
177
|
+
execute: async ({ body, headers, query }) => {
|
|
178
|
+
// Process payment event
|
|
179
|
+
return {
|
|
180
|
+
status: 200,
|
|
181
|
+
body: { received: true }
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Jobs
|
|
188
|
+
|
|
189
|
+
Schedule automated tasks:
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
import { LuaJob } from 'lua-cli';
|
|
193
|
+
|
|
194
|
+
export default new LuaJob({
|
|
195
|
+
name: 'daily-cleanup',
|
|
196
|
+
version: '1.0.0',
|
|
197
|
+
description: 'Clean up old data daily',
|
|
198
|
+
|
|
199
|
+
schedule: {
|
|
200
|
+
type: 'cron',
|
|
201
|
+
pattern: '0 0 * * *' // Midnight every day
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
execute: async (job) => {
|
|
205
|
+
// Cleanup logic
|
|
206
|
+
return { success: true, deleted: 42 };
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 📚 Available APIs
|
|
214
|
+
|
|
215
|
+
Access powerful APIs in your tools and jobs:
|
|
216
|
+
|
|
217
|
+
### User API
|
|
218
|
+
```typescript
|
|
219
|
+
import { User } from 'lua-cli';
|
|
220
|
+
|
|
221
|
+
const user = await User.get();
|
|
222
|
+
await user.update({ preferences: 'dark-mode' });
|
|
223
|
+
await user.send([{ type: 'text', text: 'Hello!' }]);
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Products API
|
|
227
|
+
```typescript
|
|
228
|
+
import { Products } from 'lua-cli';
|
|
229
|
+
|
|
230
|
+
const products = await Products.get();
|
|
231
|
+
const product = await Products.create({ name: 'Widget', price: 29.99 });
|
|
232
|
+
await product.update({ price: 24.99 });
|
|
233
|
+
await product.delete();
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Baskets API
|
|
237
|
+
```typescript
|
|
238
|
+
import { Baskets } from 'lua-cli';
|
|
239
|
+
|
|
240
|
+
const basket = await Baskets.create();
|
|
241
|
+
await basket.addItem({ productId: '123', quantity: 2 });
|
|
242
|
+
await basket.placeOrder();
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Orders API
|
|
246
|
+
```typescript
|
|
247
|
+
import { Orders } from 'lua-cli';
|
|
248
|
+
|
|
249
|
+
const orders = await Orders.get();
|
|
250
|
+
await Orders.updateStatus('confirmed', orderId);
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Custom Data API
|
|
254
|
+
```typescript
|
|
255
|
+
import { Data } from 'lua-cli';
|
|
256
|
+
|
|
257
|
+
const movies = await Data.get('movies');
|
|
258
|
+
await Data.create('movies', { title: 'Inception', year: 2010 });
|
|
259
|
+
const results = await Data.search('movies', 'action thriller');
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Jobs API
|
|
263
|
+
```typescript
|
|
264
|
+
import { Jobs } from 'lua-cli';
|
|
265
|
+
|
|
266
|
+
const job = await Jobs.create({
|
|
267
|
+
name: 'remind-user',
|
|
268
|
+
metadata: { message: 'Meeting in 1 hour' },
|
|
269
|
+
schedule: {
|
|
270
|
+
type: 'once',
|
|
271
|
+
executeAt: new Date(Date.now() + 3600000)
|
|
272
|
+
},
|
|
273
|
+
execute: async (job) => {
|
|
274
|
+
const user = await job.user();
|
|
275
|
+
await user.send([{ type: 'text', text: job.metadata.message }]);
|
|
276
|
+
return { success: true };
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## 🛠️ CLI Commands
|
|
284
|
+
|
|
285
|
+
### Project Setup
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
lua auth configure # Set up API key
|
|
289
|
+
lua init # Initialize new project
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Development
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
lua compile # Compile TypeScript to deployable format
|
|
296
|
+
lua test # Test tools/webhooks/jobs interactively
|
|
297
|
+
lua chat # Interactive chat with your agent
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Deployment
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
lua push # Push new version (interactive)
|
|
304
|
+
lua push all --force # Push all components without prompts
|
|
305
|
+
lua deploy # Deploy version to production
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Management
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
lua production # View production status
|
|
312
|
+
lua env # Manage environment variables
|
|
313
|
+
lua persona # Update agent persona
|
|
314
|
+
lua logs # View agent logs
|
|
315
|
+
lua skills # Manage skills
|
|
316
|
+
lua webhooks # Manage webhooks
|
|
317
|
+
lua jobs # Manage scheduled jobs
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Utilities
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
lua admin # Open admin dashboard
|
|
324
|
+
lua docs # Open documentation
|
|
325
|
+
lua channels # Manage chat channels
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## 🔧 Advanced Features
|
|
331
|
+
|
|
332
|
+
### Streaming Chat
|
|
333
|
+
|
|
334
|
+
Real-time chat responses with typing indicators:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
lua chat
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
- ✅ Animated typing indicator while waiting
|
|
341
|
+
- ✅ Text streams character-by-character as AI generates
|
|
342
|
+
- ✅ Custom welcome message from `lua.skill.yaml`
|
|
343
|
+
- ✅ Sandbox and production environments
|
|
344
|
+
|
|
345
|
+
### Batch Deployment
|
|
346
|
+
|
|
347
|
+
Deploy all components at once:
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
# Push everything without prompts
|
|
351
|
+
lua push all --force
|
|
352
|
+
|
|
353
|
+
# Push and deploy to production
|
|
354
|
+
lua push all --force --auto-deploy
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Perfect for CI/CD pipelines:
|
|
358
|
+
- ✅ Auto-bumps patch versions
|
|
359
|
+
- ✅ No user interaction required
|
|
360
|
+
- ✅ Handles all component types
|
|
361
|
+
- ✅ Comprehensive error handling
|
|
362
|
+
|
|
363
|
+
### API Key Fallback
|
|
364
|
+
|
|
365
|
+
Flexible authentication for different environments:
|
|
366
|
+
|
|
367
|
+
**Priority:**
|
|
368
|
+
1. System keychain (macOS Keychain, Windows Credential Vault, Linux libsecret)
|
|
369
|
+
2. `LUA_API_KEY` environment variable
|
|
370
|
+
3. `LUA_API_KEY` in `.env` file
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
# CI/CD usage
|
|
374
|
+
export LUA_API_KEY=your-api-key
|
|
375
|
+
lua push all --force --auto-deploy
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Auto-Sync Configuration
|
|
379
|
+
|
|
380
|
+
Your `lua.skill.yaml` and `LuaAgent` stay synchronized:
|
|
381
|
+
|
|
382
|
+
- Run `lua init` → Syncs agent metadata to both YAML and code
|
|
383
|
+
- Run `lua compile` → Syncs LuaAgent changes back to YAML
|
|
384
|
+
- Edit either file → Changes propagate automatically
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## 📖 Example Tool
|
|
389
|
+
|
|
390
|
+
```typescript
|
|
391
|
+
import { LuaTool, User } from 'lua-cli/skill';
|
|
392
|
+
import { z } from 'zod';
|
|
393
|
+
import axios from 'axios';
|
|
394
|
+
|
|
395
|
+
export default class WeatherTool implements LuaTool {
|
|
396
|
+
name = 'get_weather';
|
|
397
|
+
description = 'Get current weather for any city';
|
|
398
|
+
|
|
399
|
+
inputSchema = z.object({
|
|
400
|
+
city: z.string().describe('City name'),
|
|
401
|
+
units: z.enum(['metric', 'imperial']).optional()
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
outputSchema = z.object({
|
|
405
|
+
temperature: z.number(),
|
|
406
|
+
condition: z.string(),
|
|
407
|
+
city: z.string()
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
411
|
+
const response = await axios.get('https://api.weather.com/current', {
|
|
412
|
+
params: {
|
|
413
|
+
city: input.city,
|
|
414
|
+
units: input.units || 'metric',
|
|
415
|
+
apiKey: process.env.WEATHER_API_KEY
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
return {
|
|
420
|
+
temperature: response.data.temp,
|
|
421
|
+
condition: response.data.condition,
|
|
422
|
+
city: input.city
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
## 🏗️ Project Structure
|
|
431
|
+
|
|
432
|
+
```
|
|
433
|
+
your-project/
|
|
434
|
+
├── src/
|
|
435
|
+
│ ├── index.ts # LuaAgent configuration
|
|
436
|
+
│ ├── skills/ # Tool collections
|
|
437
|
+
│ │ ├── tools/ # Individual tools
|
|
438
|
+
│ │ └── *.skill.ts # Skill definitions
|
|
439
|
+
│ ├── webhooks/ # HTTP endpoints
|
|
440
|
+
│ ├── jobs/ # Scheduled tasks
|
|
441
|
+
│ ├── preprocessors/ # Message filters
|
|
442
|
+
│ ├── postprocessors/ # Response formatters
|
|
443
|
+
│ └── services/ # Shared utilities
|
|
444
|
+
├── lua.skill.yaml # Agent metadata
|
|
445
|
+
├── .env # Environment variables
|
|
446
|
+
├── package.json
|
|
447
|
+
└── tsconfig.json
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## 🔐 Security
|
|
453
|
+
|
|
454
|
+
### API Keys
|
|
455
|
+
|
|
456
|
+
- ✅ Stored securely in system keychain
|
|
457
|
+
- ✅ Never committed to version control
|
|
458
|
+
- ✅ Environment variable fallback for CI/CD
|
|
459
|
+
- ✅ Per-environment configuration
|
|
460
|
+
|
|
461
|
+
### Webhooks
|
|
462
|
+
|
|
463
|
+
- ✅ Signature validation support
|
|
464
|
+
- ✅ Request body validation with Zod
|
|
465
|
+
- ✅ HTTPS endpoints only
|
|
466
|
+
- ✅ Rate limiting ready
|
|
467
|
+
|
|
468
|
+
### User Data
|
|
469
|
+
|
|
470
|
+
- ✅ Encrypted at rest
|
|
471
|
+
- ✅ Scoped to authenticated users
|
|
472
|
+
- ✅ GDPR-compliant deletion
|
|
473
|
+
- ✅ Privacy-first design
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## 🧪 Testing
|
|
478
|
+
|
|
479
|
+
### Test Individual Components
|
|
480
|
+
|
|
481
|
+
```bash
|
|
482
|
+
# Test a tool
|
|
483
|
+
lua test
|
|
484
|
+
# Select: Tool → get_weather
|
|
485
|
+
# Input: { city: "London" }
|
|
486
|
+
# Output: { temperature: 15, condition: "cloudy" }
|
|
487
|
+
|
|
488
|
+
# Test a webhook
|
|
489
|
+
lua test
|
|
490
|
+
# Select: Webhook → payment-webhook
|
|
491
|
+
# Input body, headers, query
|
|
492
|
+
# See response
|
|
493
|
+
|
|
494
|
+
# Test a job
|
|
495
|
+
lua test
|
|
496
|
+
# Select: Job → daily-cleanup
|
|
497
|
+
# Execute immediately
|
|
498
|
+
# See results
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
### Interactive Chat Testing
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
lua chat
|
|
505
|
+
# Select environment: Sandbox or Production
|
|
506
|
+
# Chat with your agent
|
|
507
|
+
# See tools in action
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
## 🚀 Deployment
|
|
513
|
+
|
|
514
|
+
### Development Workflow
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
# 1. Make changes to your code
|
|
518
|
+
vim src/skills/tools/MyTool.ts
|
|
519
|
+
|
|
520
|
+
# 2. Test locally
|
|
521
|
+
lua test
|
|
522
|
+
|
|
523
|
+
# 3. Test with chat
|
|
524
|
+
lua chat # Sandbox mode
|
|
525
|
+
|
|
526
|
+
# 4. Compile
|
|
527
|
+
lua compile
|
|
528
|
+
|
|
529
|
+
# 5. Push to server
|
|
530
|
+
lua push
|
|
531
|
+
|
|
532
|
+
# 6. Deploy to production
|
|
533
|
+
lua deploy
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### CI/CD Workflow
|
|
537
|
+
|
|
538
|
+
```yaml
|
|
539
|
+
# .github/workflows/deploy.yml
|
|
540
|
+
- name: Deploy Agent
|
|
541
|
+
run: lua push all --force --auto-deploy
|
|
542
|
+
env:
|
|
543
|
+
LUA_API_KEY: ${{ secrets.LUA_API_KEY }}
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
---
|
|
547
|
+
|
|
548
|
+
## 📝 Configuration
|
|
549
|
+
|
|
550
|
+
### lua.skill.yaml
|
|
551
|
+
|
|
552
|
+
Central configuration file:
|
|
553
|
+
|
|
554
|
+
```yaml
|
|
555
|
+
agent:
|
|
556
|
+
agentId: your-agent-id
|
|
557
|
+
orgId: your-org-id
|
|
558
|
+
persona: |
|
|
559
|
+
You are a helpful AI assistant...
|
|
560
|
+
welcomeMessage: Hello! How can I help you today?
|
|
561
|
+
|
|
562
|
+
skills:
|
|
563
|
+
- name: general-skill
|
|
564
|
+
version: 1.0.0
|
|
565
|
+
skillId: skill-id-123
|
|
566
|
+
|
|
567
|
+
webhooks:
|
|
568
|
+
- name: payment-webhook
|
|
569
|
+
version: 1.0.0
|
|
570
|
+
webhookId: webhook-id-456
|
|
571
|
+
|
|
572
|
+
jobs:
|
|
573
|
+
- name: daily-cleanup
|
|
574
|
+
version: 1.0.0
|
|
575
|
+
jobId: job-id-789
|
|
576
|
+
schedule:
|
|
577
|
+
type: cron
|
|
578
|
+
pattern: "0 0 * * *"
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
### Environment Variables
|
|
582
|
+
|
|
583
|
+
```.env
|
|
584
|
+
# Lua Platform
|
|
585
|
+
LUA_API_KEY=your-lua-api-key # Optional: for CI/CD
|
|
586
|
+
|
|
587
|
+
# External Services
|
|
588
|
+
OPENAI_API_KEY=sk-...
|
|
589
|
+
STRIPE_SECRET_KEY=sk_live_...
|
|
590
|
+
PINECONE_API_KEY=...
|
|
591
|
+
|
|
592
|
+
# Custom Configuration
|
|
593
|
+
BASE_URL=https://api.example.com
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
---
|
|
597
|
+
|
|
598
|
+
## 🎓 Documentation
|
|
599
|
+
|
|
600
|
+
### Getting Started
|
|
601
|
+
- [Quick Start Guide](template/QUICKSTART.md) - Complete tutorial
|
|
602
|
+
- [CLI Reference](#cli-commands) - All available commands
|
|
603
|
+
- [API Reference](src/api-exports.ts) - TypeScript API documentation
|
|
604
|
+
|
|
605
|
+
### Advanced Topics
|
|
606
|
+
- [Webhooks & Jobs Guide](WEBHOOKS_JOBS_USAGE_GUIDE.md) - External integrations
|
|
607
|
+
- [Processors Guide](PROCESSORS_GUIDE.md) - Message processing
|
|
608
|
+
- [Dynamic Jobs](DYNAMIC_JOB_CREATION_API.md) - Creating jobs programmatically
|
|
609
|
+
- [Agent Configuration](LUAAGENT_IMPLEMENTATION.md) - LuaAgent deep dive
|
|
610
|
+
|
|
611
|
+
### Examples
|
|
612
|
+
- [Template Project](template/) - Full working example
|
|
613
|
+
- [Complex Job Examples](template/COMPLEX_JOB_EXAMPLES.md)
|
|
614
|
+
- [Webhook Examples](template/WEBHOOK_JOB_EXAMPLES.md)
|
|
615
|
+
- [Tool Examples](template/TOOL_EXAMPLES.md)
|
|
616
|
+
|
|
617
|
+
---
|
|
618
|
+
|
|
619
|
+
## 💻 Development
|
|
620
|
+
|
|
621
|
+
### Prerequisites
|
|
622
|
+
|
|
623
|
+
- Node.js 16+
|
|
624
|
+
- npm or yarn
|
|
625
|
+
- TypeScript 5+
|
|
626
|
+
|
|
627
|
+
### Building from Source
|
|
628
|
+
|
|
629
|
+
```bash
|
|
630
|
+
# Clone repository
|
|
631
|
+
git clone https://github.com/heylua/lua-cli.git
|
|
632
|
+
cd lua-cli
|
|
633
|
+
|
|
634
|
+
# Install dependencies
|
|
635
|
+
npm install
|
|
636
|
+
|
|
637
|
+
# Build
|
|
638
|
+
npm run build
|
|
639
|
+
|
|
640
|
+
# Link globally
|
|
641
|
+
npm link
|
|
642
|
+
|
|
643
|
+
# Run tests
|
|
644
|
+
npm test
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
### Project Scripts
|
|
648
|
+
|
|
649
|
+
```bash
|
|
650
|
+
npm run build # Compile TypeScript
|
|
651
|
+
npm run build:react # Build web interface
|
|
652
|
+
npm run clean # Clean dist folder
|
|
653
|
+
npm test # Run test suite
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
---
|
|
657
|
+
|
|
658
|
+
## 🌟 What's New in v3.0.0
|
|
659
|
+
|
|
660
|
+
### Major Features
|
|
661
|
+
|
|
662
|
+
#### LuaAgent - Unified Configuration
|
|
663
|
+
- ✅ Single source of truth for all agent components
|
|
664
|
+
- ✅ Cleaner, more intuitive API
|
|
665
|
+
- ✅ Automatic sync with `lua.skill.yaml`
|
|
666
|
+
|
|
667
|
+
#### Streaming Chat Interface
|
|
668
|
+
- ✅ Real-time text streaming as AI generates responses
|
|
669
|
+
- ✅ Animated typing indicators
|
|
670
|
+
- ✅ Custom welcome messages from YAML
|
|
671
|
+
- ✅ Improved user experience
|
|
672
|
+
|
|
673
|
+
#### Batch Deployment
|
|
674
|
+
- ✅ `lua push all --force` - Deploy everything at once
|
|
675
|
+
- ✅ Auto-bump patch versions
|
|
676
|
+
- ✅ `--auto-deploy` flag for production
|
|
677
|
+
- ✅ Perfect for CI/CD pipelines
|
|
678
|
+
|
|
679
|
+
#### Enhanced Bundling
|
|
680
|
+
- ✅ Optimized bundle sizes (excludes lua-cli internals)
|
|
681
|
+
- ✅ Better import resolution
|
|
682
|
+
- ✅ Faster compilation
|
|
683
|
+
- ✅ Reduced deployment size
|
|
684
|
+
|
|
685
|
+
#### Improved Authentication
|
|
686
|
+
- ✅ Multi-source API key loading
|
|
687
|
+
- ✅ Environment variable support
|
|
688
|
+
- ✅ `.env` file fallback
|
|
689
|
+
- ✅ CI/CD friendly
|
|
690
|
+
|
|
691
|
+
### Breaking Changes from v2.x
|
|
692
|
+
|
|
693
|
+
- **LuaAgent required** - Use `new LuaAgent()` instead of exporting individual skills
|
|
694
|
+
- **Streaming endpoints** - Chat uses `/chat/stream` instead of `/chat/generate`
|
|
695
|
+
- **Jobs.create signature** - Metadata field recommended for passing data
|
|
696
|
+
|
|
697
|
+
See [CHANGELOG.md](CHANGELOG.md) for complete list of changes.
|
|
698
|
+
|
|
699
|
+
---
|
|
700
|
+
|
|
701
|
+
## 🤝 Contributing
|
|
702
|
+
|
|
703
|
+
We welcome contributions! Please see our contributing guidelines:
|
|
704
|
+
|
|
705
|
+
1. Fork the repository
|
|
706
|
+
2. Create a feature branch
|
|
707
|
+
3. Make your changes
|
|
708
|
+
4. Add tests
|
|
709
|
+
5. Submit a pull request
|
|
710
|
+
|
|
711
|
+
### Development Setup
|
|
712
|
+
|
|
713
|
+
```bash
|
|
714
|
+
git clone https://github.com/heylua/lua-cli.git
|
|
715
|
+
cd lua-cli
|
|
716
|
+
npm install
|
|
717
|
+
npm run build
|
|
718
|
+
npm link
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
---
|
|
722
|
+
|
|
723
|
+
## 📊 Use Cases
|
|
724
|
+
|
|
725
|
+
### Customer Support
|
|
726
|
+
- Handle product queries
|
|
727
|
+
- Process returns and refunds
|
|
728
|
+
- Escalate complex issues
|
|
729
|
+
- Track support tickets
|
|
730
|
+
|
|
731
|
+
### E-commerce
|
|
732
|
+
- Product recommendations
|
|
733
|
+
- Shopping cart management
|
|
734
|
+
- Order processing
|
|
735
|
+
- Payment integration
|
|
736
|
+
|
|
737
|
+
### Data Analysis
|
|
738
|
+
- Query databases
|
|
739
|
+
- Generate reports
|
|
740
|
+
- Visualize data
|
|
741
|
+
- Schedule analytics jobs
|
|
742
|
+
|
|
743
|
+
### Automation
|
|
744
|
+
- Scheduled reminders
|
|
745
|
+
- Data synchronization
|
|
746
|
+
- Health monitoring
|
|
747
|
+
- Batch processing
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
## 🆘 Support
|
|
752
|
+
|
|
753
|
+
### Getting Help
|
|
754
|
+
|
|
755
|
+
- **Documentation:** https://docs.heylua.ai
|
|
756
|
+
- **Email:** support@heylua.ai
|
|
757
|
+
- **GitHub Issues:** https://github.com/heylua/lua-cli/issues
|
|
758
|
+
- **Community:** https://community.heylua.ai
|
|
759
|
+
|
|
760
|
+
### Common Issues
|
|
761
|
+
|
|
762
|
+
**Q: How do I get an API key?**
|
|
763
|
+
Visit https://admin.heylua.ai and create an account.
|
|
764
|
+
|
|
765
|
+
**Q: Can I use this in production?**
|
|
766
|
+
Yes! v3.0.0 is production-ready with comprehensive testing and error handling.
|
|
767
|
+
|
|
768
|
+
**Q: How do I update to the latest version?**
|
|
769
|
+
```bash
|
|
770
|
+
npm install -g lua-cli@latest
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
**Q: Does this work with TypeScript?**
|
|
774
|
+
Yes! Full TypeScript support with type definitions included.
|
|
775
|
+
|
|
776
|
+
**Q: Can I deploy from CI/CD?**
|
|
777
|
+
Yes! Use environment variables and `lua push all --force --auto-deploy`.
|
|
778
|
+
|
|
779
|
+
---
|
|
780
|
+
|
|
781
|
+
## 📜 License
|
|
782
|
+
|
|
783
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
784
|
+
|
|
785
|
+
---
|
|
786
|
+
|
|
787
|
+
## 🙏 Acknowledgments
|
|
788
|
+
|
|
789
|
+
Built with:
|
|
790
|
+
- [TypeScript](https://www.typescriptlang.org/)
|
|
791
|
+
- [Zod](https://zod.dev/) - Schema validation
|
|
792
|
+
- [esbuild](https://esbuild.github.io/) - Fast bundling
|
|
793
|
+
- [Commander.js](https://github.com/tj/commander.js/) - CLI framework
|
|
794
|
+
- [Inquirer](https://github.com/SBoudrias/Inquirer.js/) - Interactive prompts
|
|
795
|
+
|
|
796
|
+
---
|
|
797
|
+
|
|
798
|
+
## 🔗 Links
|
|
799
|
+
|
|
800
|
+
- **Website:** https://heylua.ai
|
|
801
|
+
- **Documentation:** https://docs.heylua.ai
|
|
802
|
+
- **Admin Dashboard:** https://admin.heylua.ai
|
|
803
|
+
- **npm Package:** https://www.npmjs.com/package/lua-cli
|
|
804
|
+
- **GitHub:** https://github.com/heylua/lua-cli
|
|
805
|
+
|
|
806
|
+
---
|
|
807
|
+
|
|
808
|
+
## 📈 Roadmap
|
|
809
|
+
|
|
810
|
+
### Coming Soon
|
|
811
|
+
- 🔄 Real-time collaboration tools
|
|
812
|
+
- 📊 Built-in analytics dashboard
|
|
813
|
+
- 🎨 Visual skill builder
|
|
814
|
+
- 🔌 More integration templates
|
|
815
|
+
- 📱 Mobile SDK
|
|
816
|
+
|
|
817
|
+
### In Progress
|
|
818
|
+
- ✅ Enhanced error reporting
|
|
819
|
+
- ✅ Performance optimizations
|
|
820
|
+
- ✅ More example templates
|
|
821
|
+
- ✅ Improved documentation
|
|
822
|
+
|
|
823
|
+
---
|
|
824
|
+
|
|
825
|
+
## 💬 Community
|
|
826
|
+
|
|
827
|
+
Join the Lua community:
|
|
828
|
+
|
|
829
|
+
- **Discord:** Coming soon
|
|
830
|
+
- **Twitter:** @heylua_ai
|
|
831
|
+
- **Blog:** https://heylua.ai/blog
|
|
832
|
+
|
|
833
|
+
Share your agents, get help, and learn from others!
|
|
834
|
+
|
|
835
|
+
---
|
|
836
|
+
|
|
837
|
+
*Made with ❤️ by the Lua team*
|
|
838
|
+
|
|
839
|
+
**Version:** 3.0.0
|
|
840
|
+
**Last Updated:** October 2025
|
|
841
|
+
|
|
842
|
+
---
|
|
843
|
+
|
|
844
|
+
## Quick Links
|
|
845
|
+
|
|
846
|
+
- [Quick Start →](template/QUICKSTART.md)
|
|
847
|
+
- [API Documentation →](API_REFERENCE.md)
|
|
848
|
+
- [Template Examples →](template/)
|
|
849
|
+
- [Changelog →](CHANGELOG.md)
|
|
850
|
+
|