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/CLI_REFERENCE.md
DELETED
|
@@ -1,908 +0,0 @@
|
|
|
1
|
-
# Lua CLI - Command Reference
|
|
2
|
-
|
|
3
|
-
Complete reference guide for all Lua CLI commands.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 📋 Table of Contents
|
|
8
|
-
|
|
9
|
-
- [Installation](#installation)
|
|
10
|
-
- [Quick Start](#quick-start)
|
|
11
|
-
- [Authentication Commands](#authentication-commands)
|
|
12
|
-
- [Skill Management Commands](#skill-management-commands)
|
|
13
|
-
- [Command Reference](#command-reference)
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install -g lua-cli
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Or use with npx (no installation required):
|
|
24
|
-
```bash
|
|
25
|
-
npx lua-cli [command]
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Quick Start
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
# 1. Authenticate
|
|
34
|
-
lua auth configure
|
|
35
|
-
|
|
36
|
-
# 2. Initialize a new skill project
|
|
37
|
-
mkdir my-skill && cd my-skill
|
|
38
|
-
lua init
|
|
39
|
-
|
|
40
|
-
# 3. Test your skill locally
|
|
41
|
-
lua test
|
|
42
|
-
|
|
43
|
-
# 4. Push to development environment
|
|
44
|
-
lua push
|
|
45
|
-
|
|
46
|
-
# 5. Start development mode with live reload
|
|
47
|
-
lua dev
|
|
48
|
-
|
|
49
|
-
# 6. Deploy to production
|
|
50
|
-
lua deploy
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Authentication Commands
|
|
56
|
-
|
|
57
|
-
### `lua auth configure`
|
|
58
|
-
|
|
59
|
-
Sets up your Lua CLI authentication credentials.
|
|
60
|
-
|
|
61
|
-
**Usage:**
|
|
62
|
-
```bash
|
|
63
|
-
lua auth configure
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
**Interactive Prompts:**
|
|
67
|
-
1. Choose authentication method:
|
|
68
|
-
- **API Key**: Enter an existing API key
|
|
69
|
-
- **Email**: Get API key via email OTP
|
|
70
|
-
|
|
71
|
-
**For API Key Method:**
|
|
72
|
-
- Prompts for your API key
|
|
73
|
-
- Validates the key with the server
|
|
74
|
-
- Stores securely in system keychain
|
|
75
|
-
|
|
76
|
-
**For Email Method:**
|
|
77
|
-
- Prompts for email address
|
|
78
|
-
- Sends 6-digit OTP code to your email
|
|
79
|
-
- Allows 3 attempts to enter correct OTP
|
|
80
|
-
- Automatically generates and saves API key
|
|
81
|
-
|
|
82
|
-
**Storage:**
|
|
83
|
-
- Credentials stored in system keychain
|
|
84
|
-
- macOS: Keychain
|
|
85
|
-
- Windows: Credential Vault
|
|
86
|
-
- Linux: libsecret
|
|
87
|
-
|
|
88
|
-
**Example:**
|
|
89
|
-
```bash
|
|
90
|
-
$ lua auth configure
|
|
91
|
-
? Choose authentication method: Email
|
|
92
|
-
? Enter your email address: you@example.com
|
|
93
|
-
📧 Sending OTP to your email...
|
|
94
|
-
✅ OTP sent successfully!
|
|
95
|
-
? Enter the OTP code: 123456
|
|
96
|
-
🔐 Verifying OTP...
|
|
97
|
-
✅ OTP verified successfully!
|
|
98
|
-
🔑 Generating API key...
|
|
99
|
-
✅ API key generated and saved securely.
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
### `lua auth key`
|
|
105
|
-
|
|
106
|
-
Displays your stored API key.
|
|
107
|
-
|
|
108
|
-
**Usage:**
|
|
109
|
-
```bash
|
|
110
|
-
lua auth key
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**Interactive Prompts:**
|
|
114
|
-
- Confirmation prompt before displaying (security)
|
|
115
|
-
|
|
116
|
-
**Output:**
|
|
117
|
-
```bash
|
|
118
|
-
$ lua auth key
|
|
119
|
-
? This will display your API key. Are you sure you want to continue? Yes
|
|
120
|
-
🔑 Your API key:
|
|
121
|
-
lsk_abc123def456...
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
**Security Note:** Only displays after explicit confirmation to prevent accidental exposure.
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
### `lua auth logout`
|
|
129
|
-
|
|
130
|
-
Deletes your stored API key from the system.
|
|
131
|
-
|
|
132
|
-
**Usage:**
|
|
133
|
-
```bash
|
|
134
|
-
lua auth logout
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Interactive Prompts:**
|
|
138
|
-
- Confirmation prompt (action cannot be undone)
|
|
139
|
-
|
|
140
|
-
**What it does:**
|
|
141
|
-
- Removes API key from system keychain
|
|
142
|
-
- Does NOT invalidate the key on the server
|
|
143
|
-
- You'll need to run `lua auth configure` again to use the CLI
|
|
144
|
-
|
|
145
|
-
**Example:**
|
|
146
|
-
```bash
|
|
147
|
-
$ lua auth logout
|
|
148
|
-
? Are you sure you want to delete your API key? This action cannot be undone. Yes
|
|
149
|
-
✅ API key deleted successfully.
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## Skill Management Commands
|
|
155
|
-
|
|
156
|
-
### `lua init`
|
|
157
|
-
|
|
158
|
-
Initializes a new Lua skill project in the current directory.
|
|
159
|
-
|
|
160
|
-
**Usage:**
|
|
161
|
-
```bash
|
|
162
|
-
mkdir my-skill && cd my-skill
|
|
163
|
-
lua init
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
**Interactive Prompts:**
|
|
167
|
-
|
|
168
|
-
**Step 1: Choose Agent**
|
|
169
|
-
- **Select existing agent**: Choose from your organizations and agents
|
|
170
|
-
- **Create new agent**: Create a new AI agent
|
|
171
|
-
|
|
172
|
-
**Step 2a: For Existing Agent**
|
|
173
|
-
- Select organization
|
|
174
|
-
- Select agent from organization
|
|
175
|
-
|
|
176
|
-
**Step 2b: For New Agent**
|
|
177
|
-
- Enter business name (default: "Private")
|
|
178
|
-
- Enter agent name (required)
|
|
179
|
-
- Select business type from list
|
|
180
|
-
- Select brand personality
|
|
181
|
-
- Enter brand traits (optional)
|
|
182
|
-
- Configure features (enable/disable)
|
|
183
|
-
|
|
184
|
-
**What it creates:**
|
|
185
|
-
```
|
|
186
|
-
my-skill/
|
|
187
|
-
├── src/
|
|
188
|
-
│ ├── index.ts # Skill entry point
|
|
189
|
-
│ ├── tools/ # Tool implementations
|
|
190
|
-
│ │ ├── GetWeatherTool.ts
|
|
191
|
-
│ │ ├── UserDataTool.ts
|
|
192
|
-
│ │ ├── ProductsTool.ts
|
|
193
|
-
│ │ └── ... (more examples)
|
|
194
|
-
│ └── services/ # Helper services
|
|
195
|
-
├── lua.skill.yaml # Skill configuration
|
|
196
|
-
├── package.json # Dependencies
|
|
197
|
-
├── tsconfig.json # TypeScript config
|
|
198
|
-
├── .env.example # Environment variables template
|
|
199
|
-
└── README.md # Project documentation
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**Configuration File (`lua.skill.yaml`):**
|
|
203
|
-
```yaml
|
|
204
|
-
agent:
|
|
205
|
-
agentId: agent_abc123
|
|
206
|
-
orgId: org_xyz789
|
|
207
|
-
persona: "..."
|
|
208
|
-
welcomeMessage: "..."
|
|
209
|
-
|
|
210
|
-
skills: [] # Auto-populated during compilation
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
**Example:**
|
|
214
|
-
```bash
|
|
215
|
-
$ lua init
|
|
216
|
-
? What would you like to do? Create new agent
|
|
217
|
-
? Enter business name: My Coffee Shop
|
|
218
|
-
? Enter agent name: CoffeeBot
|
|
219
|
-
? Select business type: Food & Beverage (e.g. restaurant, bakery)
|
|
220
|
-
? Select brand personality: Friendly
|
|
221
|
-
? Enter brand traits: Warm, welcoming, knowledgeable about coffee
|
|
222
|
-
🔄 Creating agent...
|
|
223
|
-
✅ Agent created successfully!
|
|
224
|
-
⏳ Waiting for agent to be ready...
|
|
225
|
-
✅ Created lua.skill.yaml
|
|
226
|
-
✅ Copied template files
|
|
227
|
-
📦 Installing dependencies...
|
|
228
|
-
✅ Lua skill project initialized successfully!
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
### `lua compile`
|
|
234
|
-
|
|
235
|
-
Compiles your TypeScript skill into deployable JavaScript bundles.
|
|
236
|
-
|
|
237
|
-
**Usage:**
|
|
238
|
-
```bash
|
|
239
|
-
lua compile
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
**What it does:**
|
|
243
|
-
1. Analyzes your TypeScript code to detect tools
|
|
244
|
-
2. Bundles each tool individually with esbuild
|
|
245
|
-
3. Bundles the main index file
|
|
246
|
-
4. Extracts tool metadata and schemas
|
|
247
|
-
5. Creates deployment artifacts
|
|
248
|
-
6. Automatically creates skills via API if needed
|
|
249
|
-
|
|
250
|
-
**Output:**
|
|
251
|
-
```
|
|
252
|
-
dist/
|
|
253
|
-
├── deployment.json # Deployment metadata
|
|
254
|
-
├── index.js # Main skill bundle
|
|
255
|
-
└── tools/ # Individual tool bundles
|
|
256
|
-
├── GetWeatherTool.js
|
|
257
|
-
├── UserDataTool.js
|
|
258
|
-
└── ...
|
|
259
|
-
|
|
260
|
-
.lua/
|
|
261
|
-
├── deploy.json # Legacy format
|
|
262
|
-
├── get_weather.js # Uncompressed (for debugging)
|
|
263
|
-
└── ...
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
**Example:**
|
|
267
|
-
```bash
|
|
268
|
-
$ lua compile
|
|
269
|
-
🔨 Compiling Lua skill...
|
|
270
|
-
📦 Found 15 tools to bundle...
|
|
271
|
-
📦 Bundling GetWeatherTool...
|
|
272
|
-
📦 Bundling UserDataTool...
|
|
273
|
-
... (more tools)
|
|
274
|
-
📦 Bundling main index...
|
|
275
|
-
✅ Skill compiled successfully - 15 tools bundled
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
**Notes:**
|
|
279
|
-
- Automatically detects tools from `new LuaSkill({ tools: [...] })`
|
|
280
|
-
- Automatically detects tools from `skill.addTools([...])`
|
|
281
|
-
- Creates skills in `lua.skill.yaml` if they don't exist
|
|
282
|
-
- Updates existing skills with new tools
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
### `lua test`
|
|
287
|
-
|
|
288
|
-
Tests individual tools locally in a sandboxed environment.
|
|
289
|
-
|
|
290
|
-
**Usage:**
|
|
291
|
-
```bash
|
|
292
|
-
lua test
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
**Interactive Prompts:**
|
|
296
|
-
1. Select a tool from the list
|
|
297
|
-
2. Enter input values based on the tool's schema
|
|
298
|
-
3. View execution results
|
|
299
|
-
|
|
300
|
-
**What it does:**
|
|
301
|
-
1. Compiles the skill
|
|
302
|
-
2. Lists all available tools
|
|
303
|
-
3. Prompts for tool selection
|
|
304
|
-
4. Dynamically generates input prompts based on tool's input schema
|
|
305
|
-
5. Executes tool in secure VM sandbox
|
|
306
|
-
6. Displays results or errors
|
|
307
|
-
|
|
308
|
-
**Features:**
|
|
309
|
-
- Supports nested object inputs
|
|
310
|
-
- Validates required vs optional fields
|
|
311
|
-
- Loads environment variables from `.env` and `lua.skill.yaml`
|
|
312
|
-
- Secure sandbox execution (isolated from host system)
|
|
313
|
-
- Detailed error reporting
|
|
314
|
-
|
|
315
|
-
**Example:**
|
|
316
|
-
```bash
|
|
317
|
-
$ lua test
|
|
318
|
-
🧪 Testing Lua skill...
|
|
319
|
-
📦 Compiling code first...
|
|
320
|
-
✅ Skill compiled successfully
|
|
321
|
-
📄 Loaded environment variables from .env file
|
|
322
|
-
|
|
323
|
-
? 🔧 Select a tool to test:
|
|
324
|
-
❯ get_weather - Get the weather for a given city
|
|
325
|
-
create_product - Create a new product
|
|
326
|
-
get_user_data - Get user data
|
|
327
|
-
|
|
328
|
-
✅ Selected tool: get_weather
|
|
329
|
-
|
|
330
|
-
📝 Enter input values:
|
|
331
|
-
? city (required): London
|
|
332
|
-
|
|
333
|
-
🚀 Executing tool...
|
|
334
|
-
Input: {
|
|
335
|
-
"city": "London"
|
|
336
|
-
}
|
|
337
|
-
✅ Tool execution successful!
|
|
338
|
-
Output: {
|
|
339
|
-
"weather": "3",
|
|
340
|
-
"city": "London",
|
|
341
|
-
"temperature": 15.2,
|
|
342
|
-
"description": "Windspeed 12.3 km/h"
|
|
343
|
-
}
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
---
|
|
347
|
-
|
|
348
|
-
### `lua push`
|
|
349
|
-
|
|
350
|
-
Pushes your compiled skill version to the Lua server.
|
|
351
|
-
|
|
352
|
-
**Usage:**
|
|
353
|
-
```bash
|
|
354
|
-
lua push
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
**Interactive Prompts:**
|
|
358
|
-
- Confirmation to push version
|
|
359
|
-
|
|
360
|
-
**What it does:**
|
|
361
|
-
1. Reads version from `lua.skill.yaml`
|
|
362
|
-
2. Prompts for confirmation
|
|
363
|
-
3. Authenticates with API key
|
|
364
|
-
4. Compiles the skill
|
|
365
|
-
5. Validates deploy.json matches config
|
|
366
|
-
6. Uploads version to server
|
|
367
|
-
|
|
368
|
-
**Requirements:**
|
|
369
|
-
- Must be in a skill directory (has `lua.skill.yaml`)
|
|
370
|
-
- Must have run `lua init`
|
|
371
|
-
- Must have valid API key
|
|
372
|
-
|
|
373
|
-
**Example:**
|
|
374
|
-
```bash
|
|
375
|
-
$ lua push
|
|
376
|
-
? Are you sure you want to push version 1.0.0? Yes
|
|
377
|
-
✅ Authenticated
|
|
378
|
-
🔄 Compiling skill...
|
|
379
|
-
✅ Skill compiled successfully - 10 tools bundled
|
|
380
|
-
🔄 Pushing version to server...
|
|
381
|
-
✅ Version 1.0.0 pushed successfully
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
**Note:** This uploads to the server but does NOT deploy to production. Use `lua deploy` for production deployment.
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
### `lua deploy`
|
|
389
|
-
|
|
390
|
-
Deploys a specific version to production (all users).
|
|
391
|
-
|
|
392
|
-
**Usage:**
|
|
393
|
-
```bash
|
|
394
|
-
lua deploy
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
**Interactive Prompts:**
|
|
398
|
-
1. Select version to deploy from list
|
|
399
|
-
2. Confirm deployment with warning
|
|
400
|
-
|
|
401
|
-
**What it does:**
|
|
402
|
-
1. Fetches all available versions from server
|
|
403
|
-
2. Displays versions with metadata:
|
|
404
|
-
- Version number
|
|
405
|
-
- Current status (if currently deployed)
|
|
406
|
-
- Created date
|
|
407
|
-
- Creator email
|
|
408
|
-
3. Prompts for version selection
|
|
409
|
-
4. Shows warning about production deployment
|
|
410
|
-
5. Publishes selected version
|
|
411
|
-
|
|
412
|
-
**Features:**
|
|
413
|
-
- Lists all pushed versions
|
|
414
|
-
- Shows which version is currently active
|
|
415
|
-
- Sorts by date (newest first)
|
|
416
|
-
- Requires explicit confirmation
|
|
417
|
-
|
|
418
|
-
**Example:**
|
|
419
|
-
```bash
|
|
420
|
-
$ lua deploy
|
|
421
|
-
✅ Authenticated
|
|
422
|
-
🔄 Fetching available versions...
|
|
423
|
-
|
|
424
|
-
? Select a version to deploy:
|
|
425
|
-
1.0.2 - Created: Oct 3, 2025 by you@example.com
|
|
426
|
-
1.0.1 - Created: Oct 2, 2025 by you@example.com
|
|
427
|
-
❯ 1.0.0 (CURRENT) - Created: Oct 1, 2025 by you@example.com
|
|
428
|
-
|
|
429
|
-
? ⚠️ Warning: This version will be deployed to all users. Do you want to proceed? Yes
|
|
430
|
-
🔄 Publishing version...
|
|
431
|
-
✅ Version 1.0.0 deployed successfully
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
**⚠️ WARNING:** This immediately deploys to ALL users. Test thoroughly with `lua dev` first!
|
|
435
|
-
|
|
436
|
-
---
|
|
437
|
-
|
|
438
|
-
### `lua dev`
|
|
439
|
-
|
|
440
|
-
Starts development mode with live reloading and chat interface.
|
|
441
|
-
|
|
442
|
-
**Usage:**
|
|
443
|
-
```bash
|
|
444
|
-
lua dev
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
**What it does:**
|
|
448
|
-
1. Compiles the skill
|
|
449
|
-
2. Pushes all skills to sandbox environment
|
|
450
|
-
3. Starts local web server on port 3000
|
|
451
|
-
4. Opens chat interface in your browser
|
|
452
|
-
5. Watches for file changes
|
|
453
|
-
6. Auto-recompiles and pushes on changes
|
|
454
|
-
|
|
455
|
-
**Features:**
|
|
456
|
-
- **Live Chat Interface**: Test your skill with conversational AI
|
|
457
|
-
- **Tool Testing**: Test individual tools with custom inputs
|
|
458
|
-
- **WebSocket Logging**: Real-time log streaming
|
|
459
|
-
- **Auto-Reload**: Automatic recompilation on file changes
|
|
460
|
-
- **Environment Management**: Edit `.env` variables in UI
|
|
461
|
-
- **Persona Configuration**: Customize agent behavior
|
|
462
|
-
- **Multi-Skill Support**: Works with multiple skills in one project
|
|
463
|
-
|
|
464
|
-
**Chat Interface Features:**
|
|
465
|
-
```
|
|
466
|
-
http://localhost:3000
|
|
467
|
-
|
|
468
|
-
Tabs:
|
|
469
|
-
├── Chat # Chat with your AI agent using sandbox skills
|
|
470
|
-
├── Tools # Test individual tools with custom inputs
|
|
471
|
-
├── User Data # View and modify user data
|
|
472
|
-
├── Environment # Manage environment variables
|
|
473
|
-
├── Persona # Configure agent personality
|
|
474
|
-
└── Skills # View all skills and their tools
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
**File Watching:**
|
|
478
|
-
- Watches: `.ts` files in `src/`
|
|
479
|
-
- Ignores: `node_modules/`, `dist/`, `.lua/`, `.git/`
|
|
480
|
-
- Debounce: 500ms (prevents multiple compilations)
|
|
481
|
-
|
|
482
|
-
**Example:**
|
|
483
|
-
```bash
|
|
484
|
-
$ lua dev
|
|
485
|
-
✅ Authenticated
|
|
486
|
-
🔄 Compiling skill...
|
|
487
|
-
✅ Skill compiled successfully - 10 tools bundled
|
|
488
|
-
🔄 Pushing skills to sandbox...
|
|
489
|
-
✅ Pushed 3 skills to sandbox
|
|
490
|
-
🌐 Chat interface opened in your browser
|
|
491
|
-
🔍 Watching for file changes... (Press Ctrl+C to stop)
|
|
492
|
-
|
|
493
|
-
# Edit a file...
|
|
494
|
-
🔄 File changed: src/tools/MyTool.ts - Compiling and pushing...
|
|
495
|
-
✅ Compilation completed
|
|
496
|
-
✅ Successfully pushed 3 skills to sandbox
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
**Stopping Dev Mode:**
|
|
500
|
-
Press `Ctrl+C` to stop the file watcher and server.
|
|
501
|
-
|
|
502
|
-
---
|
|
503
|
-
|
|
504
|
-
### `lua admin`
|
|
505
|
-
|
|
506
|
-
Opens the Lua Admin Dashboard in your default browser.
|
|
507
|
-
|
|
508
|
-
**Usage:**
|
|
509
|
-
```bash
|
|
510
|
-
lua admin
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
**What it does:**
|
|
514
|
-
1. Loads your API key from secure storage
|
|
515
|
-
2. Reads your skill configuration (agentId and orgId)
|
|
516
|
-
3. Constructs authenticated admin dashboard URL
|
|
517
|
-
4. Opens the dashboard in your default browser
|
|
518
|
-
|
|
519
|
-
**Requirements:**
|
|
520
|
-
- Must be authenticated (`lua auth configure`)
|
|
521
|
-
- Must be in a skill directory (has `lua.skill.yaml`)
|
|
522
|
-
- Config must contain `agent.agentId` and `agent.orgId`
|
|
523
|
-
|
|
524
|
-
**What You Can Do:**
|
|
525
|
-
- **📊 Usage Analytics** - View API calls, skill usage, performance
|
|
526
|
-
- **⚙️ Agent Configuration** - Manage settings, persona, metadata
|
|
527
|
-
- **💳 Billing & Subscriptions** - View plans, payment, billing history
|
|
528
|
-
- **👥 Team Management** - Add/remove members, permissions
|
|
529
|
-
- **🔑 API Key Management** - View, generate, revoke keys
|
|
530
|
-
|
|
531
|
-
**Example:**
|
|
532
|
-
```bash
|
|
533
|
-
$ lua admin
|
|
534
|
-
✓ Lua Admin Dashboard opened in your browser
|
|
535
|
-
|
|
536
|
-
Dashboard URL: https://admin.heylua.ai
|
|
537
|
-
Agent ID: agent-abc123
|
|
538
|
-
Organization ID: org-xyz789
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
**Errors:**
|
|
542
|
-
```bash
|
|
543
|
-
# No API key
|
|
544
|
-
❌ Error during admin: No API key found. Please run "lua configure" first.
|
|
545
|
-
|
|
546
|
-
# Not in skill directory
|
|
547
|
-
❌ Error during admin: Could not read lua.skill.yaml. Please ensure you are in a Lua skill directory.
|
|
548
|
-
|
|
549
|
-
# Missing configuration
|
|
550
|
-
❌ Error during admin: No agentId found in lua.skill.yaml. Please ensure your configuration is valid.
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
---
|
|
554
|
-
|
|
555
|
-
### `lua docs`
|
|
556
|
-
|
|
557
|
-
Opens the Lua documentation website in your default browser.
|
|
558
|
-
|
|
559
|
-
**Usage:**
|
|
560
|
-
```bash
|
|
561
|
-
lua docs
|
|
562
|
-
```
|
|
563
|
-
|
|
564
|
-
**What it does:**
|
|
565
|
-
Opens https://docs.heylua.ai in your default browser for quick access to:
|
|
566
|
-
- Platform overview and concepts
|
|
567
|
-
- CLI command reference
|
|
568
|
-
- API documentation and guides
|
|
569
|
-
- Tool examples (30+ examples)
|
|
570
|
-
- Integration tutorials
|
|
571
|
-
- Best practices and tips
|
|
572
|
-
|
|
573
|
-
**Requirements:**
|
|
574
|
-
None - works from anywhere
|
|
575
|
-
|
|
576
|
-
**Example:**
|
|
577
|
-
```bash
|
|
578
|
-
$ lua docs
|
|
579
|
-
✓ Lua Documentation opened in your browser
|
|
580
|
-
|
|
581
|
-
Documentation: https://docs.heylua.ai
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
**Documentation Sections:**
|
|
585
|
-
- **Overview** - Platform introduction and key concepts
|
|
586
|
-
- **CLI** - Complete command reference
|
|
587
|
-
- **API Reference** - Platform APIs (Products, Baskets, Orders, Data)
|
|
588
|
-
- **Tool Examples** - E-commerce, integrations, custom logic
|
|
589
|
-
- **Demos** - Full example implementations
|
|
590
|
-
- **Best Practices** - Tips for building effective agents
|
|
591
|
-
|
|
592
|
-
---
|
|
593
|
-
|
|
594
|
-
## Command Reference
|
|
595
|
-
|
|
596
|
-
### Global Flags
|
|
597
|
-
|
|
598
|
-
All commands support:
|
|
599
|
-
- `--help` - Show command help
|
|
600
|
-
- `--version` - Show CLI version
|
|
601
|
-
|
|
602
|
-
### Error Handling
|
|
603
|
-
|
|
604
|
-
All commands include:
|
|
605
|
-
- Descriptive error messages
|
|
606
|
-
- Exit codes (0 = success, 1 = error)
|
|
607
|
-
- Helpful troubleshooting hints
|
|
608
|
-
|
|
609
|
-
### Common Errors
|
|
610
|
-
|
|
611
|
-
**"No API key found"**
|
|
612
|
-
```bash
|
|
613
|
-
❌ No API key found. Run `lua auth configure` first.
|
|
614
|
-
```
|
|
615
|
-
**Solution:** Run `lua auth configure` to set up authentication.
|
|
616
|
-
|
|
617
|
-
**"No lua.skill.yaml found"**
|
|
618
|
-
```bash
|
|
619
|
-
❌ No lua.skill.yaml found. Please run this command from a skill directory.
|
|
620
|
-
```
|
|
621
|
-
**Solution:** Run command from a skill directory or run `lua init` first.
|
|
622
|
-
|
|
623
|
-
**"Missing agentId or skillId"**
|
|
624
|
-
```bash
|
|
625
|
-
❌ Missing agentId or skillId in skill configuration
|
|
626
|
-
```
|
|
627
|
-
**Solution:** Run `lua init` to set up your skill properly.
|
|
628
|
-
|
|
629
|
-
---
|
|
630
|
-
|
|
631
|
-
## Workflow Examples
|
|
632
|
-
|
|
633
|
-
### **Complete Workflow: New Project**
|
|
634
|
-
|
|
635
|
-
```bash
|
|
636
|
-
# 1. Set up authentication
|
|
637
|
-
lua auth configure
|
|
638
|
-
|
|
639
|
-
# 2. Create new project
|
|
640
|
-
mkdir my-weather-skill
|
|
641
|
-
cd my-weather-skill
|
|
642
|
-
lua init
|
|
643
|
-
|
|
644
|
-
# 3. Customize your tools (edit src/tools/*.ts)
|
|
645
|
-
# 4. Test locally
|
|
646
|
-
lua test
|
|
647
|
-
|
|
648
|
-
# 5. Push to server
|
|
649
|
-
lua push
|
|
650
|
-
|
|
651
|
-
# 6. Start development mode
|
|
652
|
-
lua dev
|
|
653
|
-
# Test in chat interface at http://localhost:3000
|
|
654
|
-
|
|
655
|
-
# 7. When ready, deploy to production
|
|
656
|
-
lua deploy
|
|
657
|
-
```
|
|
658
|
-
|
|
659
|
-
---
|
|
660
|
-
|
|
661
|
-
### **Development Workflow**
|
|
662
|
-
|
|
663
|
-
```bash
|
|
664
|
-
# Start dev mode
|
|
665
|
-
lua dev
|
|
666
|
-
|
|
667
|
-
# Edit files - auto-reloads
|
|
668
|
-
# Test in chat interface
|
|
669
|
-
# When satisfied, push new version
|
|
670
|
-
|
|
671
|
-
# Stop dev mode (Ctrl+C)
|
|
672
|
-
|
|
673
|
-
# Push production version
|
|
674
|
-
lua push
|
|
675
|
-
|
|
676
|
-
# Deploy to all users
|
|
677
|
-
lua deploy
|
|
678
|
-
```
|
|
679
|
-
|
|
680
|
-
---
|
|
681
|
-
|
|
682
|
-
### **Testing Workflow**
|
|
683
|
-
|
|
684
|
-
```bash
|
|
685
|
-
# Test individual tools
|
|
686
|
-
lua test
|
|
687
|
-
# Select tool, enter inputs, see results
|
|
688
|
-
|
|
689
|
-
# Test in conversational context
|
|
690
|
-
lua dev
|
|
691
|
-
# Use chat interface to test natural language interaction
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
---
|
|
695
|
-
|
|
696
|
-
## Environment Variables
|
|
697
|
-
|
|
698
|
-
### Loading Priority
|
|
699
|
-
|
|
700
|
-
Environment variables are loaded in this order (later overrides earlier):
|
|
701
|
-
|
|
702
|
-
1. System environment (`process.env`)
|
|
703
|
-
2. `.env` file in project root
|
|
704
|
-
3. `lua.skill.yaml` under `skill.env`
|
|
705
|
-
|
|
706
|
-
### Using in Tools
|
|
707
|
-
|
|
708
|
-
```typescript
|
|
709
|
-
import { env } from 'lua-cli';
|
|
710
|
-
|
|
711
|
-
export class MyTool implements LuaTool {
|
|
712
|
-
async execute(input: any) {
|
|
713
|
-
const apiKey = env('EXTERNAL_API_KEY');
|
|
714
|
-
const baseUrl = env('API_BASE_URL') || 'https://default.com';
|
|
715
|
-
|
|
716
|
-
// Use environment variables...
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
### Setting Variables
|
|
722
|
-
|
|
723
|
-
**Option 1: `.env` file**
|
|
724
|
-
```bash
|
|
725
|
-
# .env
|
|
726
|
-
EXTERNAL_API_KEY=your_key_here
|
|
727
|
-
API_BASE_URL=https://api.example.com
|
|
728
|
-
```
|
|
729
|
-
|
|
730
|
-
**Option 2: `lua.skill.yaml`**
|
|
731
|
-
```yaml
|
|
732
|
-
skill:
|
|
733
|
-
name: my-skill
|
|
734
|
-
version: 1.0.0
|
|
735
|
-
env:
|
|
736
|
-
EXTERNAL_API_KEY: your_key_here
|
|
737
|
-
API_BASE_URL: https://api.example.com
|
|
738
|
-
```
|
|
739
|
-
|
|
740
|
-
**Option 3: Dev Mode UI**
|
|
741
|
-
- Go to http://localhost:3000 during `lua dev`
|
|
742
|
-
- Click "Environment" tab
|
|
743
|
-
- Edit variables in UI
|
|
744
|
-
- Changes saved to `.env` file
|
|
745
|
-
|
|
746
|
-
---
|
|
747
|
-
|
|
748
|
-
## Configuration File
|
|
749
|
-
|
|
750
|
-
### `lua.skill.yaml`
|
|
751
|
-
|
|
752
|
-
Created by `lua init`, updated by compilation.
|
|
753
|
-
|
|
754
|
-
**Structure:**
|
|
755
|
-
```yaml
|
|
756
|
-
# Agent Configuration
|
|
757
|
-
agent:
|
|
758
|
-
agentId: agent_abc123 # Your agent ID
|
|
759
|
-
orgId: org_xyz789 # Organization ID
|
|
760
|
-
persona: "..." # Agent personality (optional)
|
|
761
|
-
welcomeMessage: "..." # Welcome message (optional)
|
|
762
|
-
|
|
763
|
-
# Legacy single skill format (deprecated)
|
|
764
|
-
skill:
|
|
765
|
-
name: my-skill
|
|
766
|
-
version: 1.0.0
|
|
767
|
-
skillId: skill_legacy123
|
|
768
|
-
|
|
769
|
-
# New multi-skill format (recommended)
|
|
770
|
-
skills:
|
|
771
|
-
- name: general-skill
|
|
772
|
-
version: 1.0.0
|
|
773
|
-
skillId: skill_abc123
|
|
774
|
-
- name: product-skill
|
|
775
|
-
version: 1.0.0
|
|
776
|
-
skillId: skill_def456
|
|
777
|
-
|
|
778
|
-
# Environment Variables (optional)
|
|
779
|
-
skill:
|
|
780
|
-
env:
|
|
781
|
-
API_KEY: your_key_here
|
|
782
|
-
BASE_URL: https://api.example.com
|
|
783
|
-
```
|
|
784
|
-
|
|
785
|
-
**Auto-managed Fields:**
|
|
786
|
-
- `skillId` - Automatically created during compilation
|
|
787
|
-
- `skills` array - Auto-populated from your code
|
|
788
|
-
|
|
789
|
-
**Manual Fields:**
|
|
790
|
-
- `agentId` - Set during `lua init`
|
|
791
|
-
- `orgId` - Set during `lua init`
|
|
792
|
-
- `version` - Update manually when releasing new versions
|
|
793
|
-
- `env` - Set your environment variables here
|
|
794
|
-
|
|
795
|
-
---
|
|
796
|
-
|
|
797
|
-
## Troubleshooting
|
|
798
|
-
|
|
799
|
-
### Common Issues
|
|
800
|
-
|
|
801
|
-
**Skill not found during dev**
|
|
802
|
-
```bash
|
|
803
|
-
💡 The skill doesn't exist on the server.
|
|
804
|
-
Please run "lua push" first to deploy your skill, then try "lua dev" again.
|
|
805
|
-
```
|
|
806
|
-
**Solution:** Run `lua push` before `lua dev`.
|
|
807
|
-
|
|
808
|
-
**Compilation fails**
|
|
809
|
-
```bash
|
|
810
|
-
❌ No index.ts found in current directory or src/ directory
|
|
811
|
-
```
|
|
812
|
-
**Solution:** Create `index.ts` or `src/index.ts` with your skill definition.
|
|
813
|
-
|
|
814
|
-
**Version mismatch**
|
|
815
|
-
```bash
|
|
816
|
-
❌ Version mismatch: config has 1.0.1, deploy.json has 1.0.0
|
|
817
|
-
```
|
|
818
|
-
**Solution:** Recompile after changing version in `lua.skill.yaml`.
|
|
819
|
-
|
|
820
|
-
### Getting Help
|
|
821
|
-
|
|
822
|
-
- Check command help: `lua [command] --help`
|
|
823
|
-
- Visit documentation: https://docs.heylua.ai
|
|
824
|
-
- View examples in template: Check `template/` directory after install
|
|
825
|
-
|
|
826
|
-
---
|
|
827
|
-
|
|
828
|
-
## Best Practices
|
|
829
|
-
|
|
830
|
-
### Versioning
|
|
831
|
-
- Use semantic versioning: `MAJOR.MINOR.PATCH`
|
|
832
|
-
- Increment PATCH for bug fixes
|
|
833
|
-
- Increment MINOR for new features
|
|
834
|
-
- Increment MAJOR for breaking changes
|
|
835
|
-
|
|
836
|
-
### Development
|
|
837
|
-
- Always test with `lua test` before pushing
|
|
838
|
-
- Use `lua dev` for iterative development
|
|
839
|
-
- Test thoroughly before deploying to production
|
|
840
|
-
- Keep `.env` file in `.gitignore`
|
|
841
|
-
|
|
842
|
-
### Deployment
|
|
843
|
-
- Push new versions frequently for testing
|
|
844
|
-
- Only deploy stable versions to production
|
|
845
|
-
- Document changes between versions
|
|
846
|
-
- Test in sandbox (dev mode) before deploying
|
|
847
|
-
|
|
848
|
-
---
|
|
849
|
-
|
|
850
|
-
## Advanced Usage
|
|
851
|
-
|
|
852
|
-
### Multiple Skills in One Project
|
|
853
|
-
|
|
854
|
-
You can define multiple skills in `index.ts`:
|
|
855
|
-
|
|
856
|
-
```typescript
|
|
857
|
-
const skill1 = new LuaSkill({
|
|
858
|
-
name: 'general-skill',
|
|
859
|
-
description: '...',
|
|
860
|
-
context: '...',
|
|
861
|
-
tools: [tool1, tool2]
|
|
862
|
-
});
|
|
863
|
-
|
|
864
|
-
const skill2 = new LuaSkill({
|
|
865
|
-
name: 'ecommerce-skill',
|
|
866
|
-
description: '...',
|
|
867
|
-
context: '...',
|
|
868
|
-
tools: [tool3, tool4]
|
|
869
|
-
});
|
|
870
|
-
```
|
|
871
|
-
|
|
872
|
-
The CLI automatically:
|
|
873
|
-
- Detects all skills
|
|
874
|
-
- Creates separate skill IDs
|
|
875
|
-
- Bundles all tools
|
|
876
|
-
- Manages multi-skill deployments
|
|
877
|
-
|
|
878
|
-
### Custom Build Configuration
|
|
879
|
-
|
|
880
|
-
Modify `tsconfig.json` for TypeScript settings.
|
|
881
|
-
|
|
882
|
-
The CLI uses:
|
|
883
|
-
- **esbuild** for fast bundling
|
|
884
|
-
- **ts-morph** for AST analysis
|
|
885
|
-
- **VM sandboxing** for secure execution
|
|
886
|
-
|
|
887
|
-
---
|
|
888
|
-
|
|
889
|
-
## Command Summary
|
|
890
|
-
|
|
891
|
-
| Command | Purpose | Requires |
|
|
892
|
-
|---------|---------|----------|
|
|
893
|
-
| `lua auth configure` | Set up API key | Nothing |
|
|
894
|
-
| `lua auth key` | Show API key | API key |
|
|
895
|
-
| `lua auth logout` | Delete API key | API key |
|
|
896
|
-
| `lua init` | Initialize project | API key |
|
|
897
|
-
| `lua compile` | Compile skill | Skill directory |
|
|
898
|
-
| `lua test` | Test tools | Compiled skill |
|
|
899
|
-
| `lua push` | Upload version | Compiled skill, API key |
|
|
900
|
-
| `lua deploy` | Deploy to prod | Pushed versions |
|
|
901
|
-
| `lua dev` | Dev mode | Compiled skill, pushed version |
|
|
902
|
-
|
|
903
|
-
---
|
|
904
|
-
|
|
905
|
-
**For detailed API documentation, see `API_REFERENCE.md`**
|
|
906
|
-
**For template documentation, see `TEMPLATE_GUIDE.md`**
|
|
907
|
-
**For development guide, see `DEVELOPER_GUIDE.md`**
|
|
908
|
-
|