lua-cli 1.2.1 → 1.3.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/CHANGELOG.md +50 -0
- package/README.md +244 -63
- package/dist/commands/agents.js +17 -17
- package/dist/commands/apiKey.js +24 -19
- package/dist/commands/compile.d.ts +1 -0
- package/dist/commands/compile.js +1004 -0
- package/dist/commands/configure.js +93 -68
- package/dist/commands/deploy-new.d.ts +0 -0
- package/dist/commands/deploy-new.js +130 -0
- package/dist/commands/deploy.d.ts +19 -0
- package/dist/commands/deploy.js +81 -763
- package/dist/commands/destroy.js +26 -21
- package/dist/commands/dev.d.ts +63 -0
- package/dist/commands/dev.js +656 -0
- package/dist/commands/index.d.ts +4 -2
- package/dist/commands/index.js +4 -2
- package/dist/commands/init.js +297 -62
- package/dist/commands/push.d.ts +22 -0
- package/dist/commands/push.js +127 -0
- package/dist/commands/test.js +14 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js +35 -19
- package/dist/services/api.d.ts +195 -0
- package/dist/services/api.js +209 -0
- package/dist/services/auth.d.ts +102 -0
- package/dist/services/auth.js +129 -40
- package/dist/skill.d.ts +22 -1
- package/dist/skill.js +21 -1
- package/dist/types/index.d.ts +16 -2
- package/dist/types/index.js +16 -1
- package/dist/user-data-api.d.ts +52 -0
- package/dist/user-data-api.js +151 -0
- package/dist/utils/cli.d.ts +34 -0
- package/dist/utils/cli.js +58 -0
- package/dist/utils/files.d.ts +4 -1
- package/dist/utils/files.js +61 -14
- package/dist/web/app.css +1050 -0
- package/dist/web/app.js +79 -0
- package/dist/web/tools-page.css +377 -0
- package/package.json +18 -5
- package/template/package-lock.json +32 -3
- package/template/package.json +3 -1
- package/template/{index.ts → src/index.ts} +13 -4
- package/template/src/tools/UserPreferencesTool.ts +73 -0
- package/template/tools/UserPreferencesTool.ts +73 -0
- package/template/tsconfig.json +1 -1
- package/template/.lua/deploy.json +0 -145
- /package/template/{services → src/services}/ApiService.ts +0 -0
- /package/template/{services → src/services}/GetWeather.ts +0 -0
- /package/template/{services → src/services}/MathService.ts +0 -0
- /package/template/{tools → src/tools}/AdvancedMathTool.ts +0 -0
- /package/template/{tools → src/tools}/CalculatorTool.ts +0 -0
- /package/template/{tools → src/tools}/CreatePostTool.ts +0 -0
- /package/template/{tools → src/tools}/GetUserDataTool.ts +0 -0
- /package/template/{tools → src/tools}/GetWeatherTool.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,56 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.3.0-alpha.1] - 2024-12-19
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Centralized CLI Utilities**: New `src/utils/cli.ts` module for consistent error handling and output management
|
|
12
|
+
- **Command Restructuring**: Reorganized commands into logical groups:
|
|
13
|
+
- `lua auth` - Authentication management (configure, logout, key)
|
|
14
|
+
- `lua skill` - Skill development (init, compile, test, push, dev, deploy)
|
|
15
|
+
- **Enhanced Error Handling**: Graceful handling of Ctrl+C (SIGINT) across all commands
|
|
16
|
+
- **Consistent Output Management**: Standardized progress messages, success messages, and prompt clearing
|
|
17
|
+
- **Tool Name Validation**: Regex-based validation for tool names (alphanumeric, hyphens, underscores only)
|
|
18
|
+
- **Version Management**: TOML-based version tracking with automatic versioning
|
|
19
|
+
- **Skill Push/Deploy/Dev**: New commands for version management, sandbox development, and production deployment
|
|
20
|
+
- **Smart Sandbox Management**: Dev command intelligently reuses existing sandbox skill IDs and falls back to creating new ones when needed
|
|
21
|
+
- **File Watching Mode**: Dev command now watches for file changes and automatically recompiles and pushes to sandbox
|
|
22
|
+
- **Web Chat Interface**: Dev command now includes a beautiful web-based chat interface for real-time skill testing
|
|
23
|
+
- **Live Log Panel**: Real-time log feed with WebSocket connection for monitoring execution details
|
|
24
|
+
- **Log Details Support**: Enhanced log display with detailed information sections and proper error handling
|
|
25
|
+
- **Comprehensive Testing**: 100% test coverage for CLI utilities with 44 passing tests
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- **Command Structure**:
|
|
29
|
+
- `lua configure` → `lua auth configure`
|
|
30
|
+
- `lua destroy` → `lua auth logout`
|
|
31
|
+
- `lua apiKey` → `lua auth key`
|
|
32
|
+
- `lua init` → `lua skill init`
|
|
33
|
+
- `lua compile` → `lua skill compile`
|
|
34
|
+
- `lua test` → `lua skill test`
|
|
35
|
+
- Added `lua skill push`, `lua skill dev`, and `lua skill deploy`
|
|
36
|
+
- **LuaSkill Constructor**: Now accepts object `{description, context}` instead of separate parameters
|
|
37
|
+
- **TOML Configuration**: Added `version` and `skillId` fields to `lua.skill.toml`
|
|
38
|
+
- **Error Messages**: Standardized format: `"❌ Error during [command]: [message]"`
|
|
39
|
+
- **Output Consistency**: All commands now use centralized utilities for consistent UX
|
|
40
|
+
|
|
41
|
+
### Technical Improvements
|
|
42
|
+
- **Zero Code Duplication**: Centralized error handling eliminates repetitive code
|
|
43
|
+
- **Professional UX**: Clean, consistent output with preserved command history
|
|
44
|
+
- **Maintainable Architecture**: Single source of truth for CLI patterns
|
|
45
|
+
- **Type Safety**: Enhanced TypeScript interfaces and validation
|
|
46
|
+
- **Test Coverage**: Comprehensive test suite with 100% CLI utility coverage
|
|
47
|
+
|
|
48
|
+
### Security
|
|
49
|
+
- **Input Validation**: Tool name validation prevents injection attacks
|
|
50
|
+
- **Graceful Cancellation**: Proper handling of user interruptions
|
|
51
|
+
- **Error Isolation**: Centralized error handling prevents crashes
|
|
52
|
+
|
|
53
|
+
### Documentation
|
|
54
|
+
- **Updated README**: Reflects new command structure and features
|
|
55
|
+
- **Developer Guide**: Enhanced documentation for LuaSkill constructor
|
|
56
|
+
- **API Reference**: Updated examples and usage patterns
|
|
57
|
+
|
|
8
58
|
## [1.2.1] - 2024-09-19
|
|
9
59
|
|
|
10
60
|
### Fixed
|
package/README.md
CHANGED
|
@@ -27,21 +27,22 @@ lua --help
|
|
|
27
27
|
- 🧪 **Interactive Testing**: Test your tools with real-time execution
|
|
28
28
|
- 🚀 **Deployment**: Compile and deploy skills to the Lua platform
|
|
29
29
|
- 🔑 **API Key Management**: Securely store, view, and manage your API keys
|
|
30
|
+
- 💾 **User Data API**: Built-in API for persistent user data storage in your tools
|
|
30
31
|
- 📚 **Comprehensive Documentation**: Complete guides and examples
|
|
31
32
|
|
|
32
33
|
## Quick Start
|
|
33
34
|
|
|
34
35
|
1. **Configure your authentication:**
|
|
35
36
|
```bash
|
|
36
|
-
lua configure
|
|
37
|
+
lua auth configure
|
|
37
38
|
```
|
|
38
39
|
Choose between API key or email authentication methods.
|
|
39
40
|
|
|
40
41
|
2. **Initialize a new skill project:**
|
|
41
42
|
```bash
|
|
42
|
-
lua init
|
|
43
|
+
lua skill init
|
|
43
44
|
```
|
|
44
|
-
|
|
45
|
+
Choose between selecting an existing agent or creating a new one, then provide skill details.
|
|
45
46
|
|
|
46
47
|
3. **Develop your tools:**
|
|
47
48
|
```bash
|
|
@@ -51,25 +52,27 @@ lua --help
|
|
|
51
52
|
|
|
52
53
|
4. **Compile your skill:**
|
|
53
54
|
```bash
|
|
54
|
-
lua compile
|
|
55
|
+
lua skill compile
|
|
55
56
|
```
|
|
56
57
|
Bundles dependencies and creates deployable files.
|
|
57
58
|
|
|
58
59
|
5. **Test your tools:**
|
|
59
60
|
```bash
|
|
60
|
-
lua test
|
|
61
|
+
lua skill test
|
|
61
62
|
```
|
|
62
63
|
Interactive testing interface for your tools.
|
|
63
64
|
|
|
64
65
|
6. **Deploy your skill:**
|
|
65
66
|
```bash
|
|
66
|
-
lua deploy
|
|
67
|
+
lua skill deploy
|
|
67
68
|
```
|
|
68
69
|
Deploy to the Lua platform.
|
|
69
70
|
|
|
70
71
|
## Commands
|
|
71
72
|
|
|
72
|
-
###
|
|
73
|
+
### Authentication Commands
|
|
74
|
+
|
|
75
|
+
#### `lua auth configure`
|
|
73
76
|
|
|
74
77
|
Set up your authentication credentials. You can choose between:
|
|
75
78
|
|
|
@@ -77,55 +80,56 @@ Set up your authentication credentials. You can choose between:
|
|
|
77
80
|
- **Email**: Email-based OTP authentication
|
|
78
81
|
|
|
79
82
|
```bash
|
|
80
|
-
lua configure
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### `lua init`
|
|
84
|
-
|
|
85
|
-
Initialize a new Lua skill project in the current directory.
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
lua init
|
|
83
|
+
lua auth configure
|
|
89
84
|
```
|
|
90
85
|
|
|
91
|
-
|
|
92
|
-
- Fetch your organizations and agents from the API
|
|
93
|
-
- Let you select an organization by name
|
|
94
|
-
- Let you choose an agent from the selected organization
|
|
95
|
-
- Prompt for skill name and description
|
|
96
|
-
- Create a `lua.skill.toml` configuration file
|
|
97
|
-
- Copy template files to the current directory
|
|
98
|
-
|
|
99
|
-
### `lua apiKey`
|
|
86
|
+
#### `lua auth key`
|
|
100
87
|
|
|
101
88
|
Display your stored API key (with confirmation prompt).
|
|
102
89
|
|
|
103
90
|
```bash
|
|
104
|
-
lua
|
|
91
|
+
lua auth key
|
|
105
92
|
```
|
|
106
93
|
|
|
107
|
-
|
|
94
|
+
#### `lua auth logout`
|
|
108
95
|
|
|
109
|
-
|
|
96
|
+
Delete your stored API key and credentials.
|
|
110
97
|
|
|
111
98
|
```bash
|
|
112
|
-
lua
|
|
99
|
+
lua auth logout
|
|
113
100
|
```
|
|
114
101
|
|
|
115
|
-
###
|
|
102
|
+
### Skill Management Commands
|
|
116
103
|
|
|
117
|
-
|
|
104
|
+
#### `lua skill init`
|
|
105
|
+
|
|
106
|
+
Initialize a new Lua skill project in the current directory.
|
|
118
107
|
|
|
119
108
|
```bash
|
|
120
|
-
lua
|
|
109
|
+
lua skill init
|
|
121
110
|
```
|
|
122
111
|
|
|
123
|
-
|
|
112
|
+
This command will:
|
|
113
|
+
- Fetch your organizations and agents from the API
|
|
114
|
+
- Let you select an organization by name
|
|
115
|
+
- **Choose between existing agents or creating a new one:**
|
|
116
|
+
- **Existing Agent**: Select from your current agents
|
|
117
|
+
- **New Agent**: Create a custom agent with:
|
|
118
|
+
- Agent type selection (Base Agent, Shopify, WooCommerce, etc.)
|
|
119
|
+
- Required metadata collection (API keys, IDs, etc.)
|
|
120
|
+
- Feature configuration (RAG, tickets, web search, etc.)
|
|
121
|
+
- Business information (name, type, personality, traits)
|
|
122
|
+
- Automatic persona generation and welcome message
|
|
123
|
+
- Prompt for skill name and description
|
|
124
|
+
- Create a `lua.skill.yaml` configuration file with agent details
|
|
125
|
+
- Copy template files to the current directory
|
|
126
|
+
|
|
127
|
+
#### `lua skill compile`
|
|
124
128
|
|
|
125
129
|
Compile your LuaSkill and bundle all dependencies.
|
|
126
130
|
|
|
127
131
|
```bash
|
|
128
|
-
lua compile
|
|
132
|
+
lua skill compile
|
|
129
133
|
```
|
|
130
134
|
|
|
131
135
|
This command will:
|
|
@@ -139,12 +143,12 @@ This command will:
|
|
|
139
143
|
- `--watch` - Watch for changes and recompile automatically
|
|
140
144
|
- `--minify` - Minify the bundled code
|
|
141
145
|
|
|
142
|
-
|
|
146
|
+
#### `lua skill test`
|
|
143
147
|
|
|
144
148
|
Interactive testing interface for your tools.
|
|
145
149
|
|
|
146
150
|
```bash
|
|
147
|
-
lua test
|
|
151
|
+
lua skill test
|
|
148
152
|
```
|
|
149
153
|
|
|
150
154
|
Features:
|
|
@@ -154,23 +158,75 @@ Features:
|
|
|
154
158
|
- Error reporting and debugging
|
|
155
159
|
- Mock data support
|
|
156
160
|
|
|
157
|
-
|
|
161
|
+
#### `lua skill push`
|
|
158
162
|
|
|
159
|
-
|
|
163
|
+
Push your compiled skill version to the server.
|
|
160
164
|
|
|
161
165
|
```bash
|
|
162
|
-
lua
|
|
166
|
+
lua skill push
|
|
163
167
|
```
|
|
164
168
|
|
|
169
|
+
This command will:
|
|
170
|
+
- Compile your skill first
|
|
171
|
+
- Confirm the version you want to push
|
|
172
|
+
- Send the compiled skill data to the server
|
|
173
|
+
- Store the skill ID in your YAML file
|
|
174
|
+
|
|
175
|
+
#### `lua skill dev`
|
|
176
|
+
|
|
177
|
+
Push your compiled skill version to the sandbox for development and testing with automatic file watching and web chat interface.
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
lua skill dev
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
This command will:
|
|
184
|
+
- Compile your skill first
|
|
185
|
+
- Confirm the version you want to push to sandbox
|
|
186
|
+
- **Smart Sandbox Management**:
|
|
187
|
+
- If you have a previous sandbox skill ID stored, it will try to update the existing sandbox
|
|
188
|
+
- If the update fails or no sandbox exists, it will create a new one
|
|
189
|
+
- The sandbox skill ID is securely stored on your machine for future use
|
|
190
|
+
- Display the sandbox skill ID for testing
|
|
191
|
+
- **Web Chat Interface**:
|
|
192
|
+
- Automatically opens a beautiful chat interface in your browser
|
|
193
|
+
- Test your sandbox skill in real-time with natural language
|
|
194
|
+
- Messages are sent to the sandbox environment via the chat API
|
|
195
|
+
- Available at `http://localhost:3000` (opens automatically)
|
|
196
|
+
- **Live Log Panel**:
|
|
197
|
+
- Real-time log feed showing execution details
|
|
198
|
+
- WebSocket connection to `wss://api.lua.dev/feed`
|
|
199
|
+
- Console-style interface with color-coded log levels
|
|
200
|
+
- Shows tool calls, errors, metrics, and execution metadata
|
|
201
|
+
- Displays detailed information in expandable sections
|
|
202
|
+
- Connection status indicator and automatic reconnection
|
|
203
|
+
- Supports log types: error, debug, warn, info
|
|
204
|
+
- **File Watching Mode**:
|
|
205
|
+
- Watches for file changes in the current directory
|
|
206
|
+
- Automatically recompiles and pushes to sandbox when files change
|
|
207
|
+
- Ignores build artifacts (`.lua/`, `node_modules/`, `.git/`, etc.)
|
|
208
|
+
- Debounces rapid changes to prevent excessive builds
|
|
209
|
+
- Press `Ctrl+C` to stop watching and exit
|
|
210
|
+
|
|
211
|
+
#### `lua skill deploy`
|
|
212
|
+
|
|
213
|
+
Deploy a version to production.
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
lua skill deploy
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
This command will:
|
|
220
|
+
- Fetch available versions from the server
|
|
221
|
+
- Let you select which version to deploy
|
|
222
|
+
- Show a warning about deploying to all users
|
|
223
|
+
- Publish the selected version to production
|
|
224
|
+
|
|
165
225
|
**Requirements:**
|
|
166
|
-
- Valid API key (configured with `lua configure`)
|
|
167
|
-
- Compiled skill (run `lua compile` first)
|
|
226
|
+
- Valid API key (configured with `lua auth configure`)
|
|
227
|
+
- Compiled skill (run `lua skill compile` first)
|
|
168
228
|
- Active internet connection
|
|
169
229
|
|
|
170
|
-
**Output:**
|
|
171
|
-
- Skill deployed to your selected agent
|
|
172
|
-
- Deployment confirmation and status
|
|
173
|
-
|
|
174
230
|
## Template System
|
|
175
231
|
|
|
176
232
|
The Lua CLI includes a comprehensive template system with examples and documentation:
|
|
@@ -225,30 +281,33 @@ template/
|
|
|
225
281
|
|
|
226
282
|
## Configuration File
|
|
227
283
|
|
|
228
|
-
The `lua.skill.
|
|
284
|
+
The `lua.skill.yaml` file is created when you run `lua skill init`:
|
|
229
285
|
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
agentId
|
|
233
|
-
orgId
|
|
286
|
+
```yaml
|
|
287
|
+
agent:
|
|
288
|
+
agentId: "your-agent-id"
|
|
289
|
+
orgId: "your-organization-id"
|
|
290
|
+
persona: "Generated persona description" # Only for newly created agents
|
|
291
|
+
welcomeMessage: "Welcome message" # Only for newly created agents
|
|
234
292
|
|
|
235
|
-
|
|
236
|
-
name
|
|
237
|
-
|
|
293
|
+
skill:
|
|
294
|
+
name: "Your Skill Name"
|
|
295
|
+
version: "0.0.1"
|
|
296
|
+
skillId: "your-skill-id"
|
|
238
297
|
```
|
|
239
298
|
|
|
240
299
|
## Authentication Methods
|
|
241
300
|
|
|
242
301
|
### API Key Authentication
|
|
243
302
|
|
|
244
|
-
1. Run `lua configure`
|
|
303
|
+
1. Run `lua auth configure`
|
|
245
304
|
2. Select "API Key"
|
|
246
305
|
3. Enter your API key when prompted
|
|
247
306
|
4. The key is validated and stored securely
|
|
248
307
|
|
|
249
308
|
### Email Authentication
|
|
250
309
|
|
|
251
|
-
1. Run `lua configure`
|
|
310
|
+
1. Run `lua auth configure`
|
|
252
311
|
2. Select "Email"
|
|
253
312
|
3. Enter your email address
|
|
254
313
|
4. Check your email for the OTP code
|
|
@@ -267,7 +326,7 @@ description = "Description of your skill"
|
|
|
267
326
|
### 1. Project Setup
|
|
268
327
|
```bash
|
|
269
328
|
# Initialize a new skill project
|
|
270
|
-
lua init
|
|
329
|
+
lua skill init
|
|
271
330
|
|
|
272
331
|
# Or copy the template
|
|
273
332
|
cp -r template/ my-skill/
|
|
@@ -285,26 +344,32 @@ npm install
|
|
|
285
344
|
### 3. Testing
|
|
286
345
|
```bash
|
|
287
346
|
# Compile your skill
|
|
288
|
-
lua compile
|
|
347
|
+
lua skill compile
|
|
289
348
|
|
|
290
349
|
# Test your tools interactively
|
|
291
|
-
lua test
|
|
350
|
+
lua skill test
|
|
292
351
|
```
|
|
293
352
|
|
|
294
353
|
### 4. Deployment
|
|
295
354
|
```bash
|
|
296
|
-
#
|
|
297
|
-
lua
|
|
355
|
+
# Push version to server
|
|
356
|
+
lua skill push
|
|
357
|
+
|
|
358
|
+
# Deploy to production
|
|
359
|
+
lua skill deploy
|
|
298
360
|
```
|
|
299
361
|
|
|
300
362
|
### 5. Iteration
|
|
301
363
|
```bash
|
|
302
364
|
# Make changes to your tools
|
|
303
365
|
# Recompile and test
|
|
304
|
-
lua compile && lua test
|
|
366
|
+
lua skill compile && lua skill test
|
|
367
|
+
|
|
368
|
+
# Push updates
|
|
369
|
+
lua skill push
|
|
305
370
|
|
|
306
371
|
# Deploy updates
|
|
307
|
-
lua deploy
|
|
372
|
+
lua skill deploy
|
|
308
373
|
```
|
|
309
374
|
|
|
310
375
|
## Requirements
|
|
@@ -329,14 +394,130 @@ To contribute to this project:
|
|
|
329
394
|
|
|
330
395
|
MIT License - see [LICENSE](LICENSE) file for details.
|
|
331
396
|
|
|
397
|
+
## User Data API
|
|
398
|
+
|
|
399
|
+
The Lua CLI provides a built-in User Data API that allows your tools to interact with persistent user data stored in the Lua system.
|
|
400
|
+
|
|
401
|
+
### Basic Usage
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
import { user } from 'lua-cli';
|
|
405
|
+
|
|
406
|
+
// Get user data
|
|
407
|
+
const userData = await user.data.get();
|
|
408
|
+
console.log('User data:', userData);
|
|
409
|
+
|
|
410
|
+
// Create or update user data
|
|
411
|
+
await user.data.create({
|
|
412
|
+
name: 'John Doe',
|
|
413
|
+
preferences: {
|
|
414
|
+
theme: 'dark',
|
|
415
|
+
language: 'en'
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
// Update existing data
|
|
420
|
+
await user.data.update({
|
|
421
|
+
name: 'Jane Doe',
|
|
422
|
+
preferences: {
|
|
423
|
+
theme: 'light',
|
|
424
|
+
language: 'es'
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
// Clear all user data
|
|
429
|
+
await user.data.clear();
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Using in Tools
|
|
433
|
+
|
|
434
|
+
```typescript
|
|
435
|
+
import { LuaTool } from 'lua-cli';
|
|
436
|
+
import { user } from 'lua-cli';
|
|
437
|
+
import { z } from 'zod';
|
|
438
|
+
|
|
439
|
+
export class UserPreferencesTool extends LuaTool {
|
|
440
|
+
constructor() {
|
|
441
|
+
super('user-preferences', 'Manage user preferences');
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
async execute(input: { action: string; key?: string; value?: string }) {
|
|
445
|
+
const { action, key, value } = input;
|
|
446
|
+
|
|
447
|
+
switch (action) {
|
|
448
|
+
case 'get':
|
|
449
|
+
const userData = await user.data.get();
|
|
450
|
+
return { preferences: userData.preferences || {} };
|
|
451
|
+
|
|
452
|
+
case 'set':
|
|
453
|
+
if (!key || !value) {
|
|
454
|
+
throw new Error('Key and value are required for set action');
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const currentData = await user.data.get();
|
|
458
|
+
const updatedData = {
|
|
459
|
+
...currentData,
|
|
460
|
+
preferences: {
|
|
461
|
+
...currentData.preferences,
|
|
462
|
+
[key]: value
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
await user.data.update(updatedData);
|
|
467
|
+
return { success: true, message: `Set ${key} to ${value}` };
|
|
468
|
+
|
|
469
|
+
case 'clear':
|
|
470
|
+
await user.data.clear();
|
|
471
|
+
return { success: true, message: 'All preferences cleared' };
|
|
472
|
+
|
|
473
|
+
default:
|
|
474
|
+
throw new Error('Invalid action. Use: get, set, or clear');
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
getInputSchema() {
|
|
479
|
+
return z.object({
|
|
480
|
+
action: z.enum(['get', 'set', 'clear']).describe('Action to perform'),
|
|
481
|
+
key: z.string().optional().describe('Preference key (required for set action)'),
|
|
482
|
+
value: z.string().optional().describe('Preference value (required for set action)')
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### API Reference
|
|
489
|
+
|
|
490
|
+
- `user.data.get()` - Retrieves current user data
|
|
491
|
+
- `user.data.create(data)` - Creates or updates user data
|
|
492
|
+
- `user.data.update(data)` - Updates existing user data (alias for create)
|
|
493
|
+
- `user.data.clear()` - Clears all user data
|
|
494
|
+
|
|
495
|
+
For more details, see [USER_DATA_API.md](./USER_DATA_API.md).
|
|
496
|
+
|
|
332
497
|
## Support
|
|
333
498
|
|
|
334
499
|
For support and questions:
|
|
335
500
|
- Create an issue on [GitHub](https://github.com/lua-ai-global/lua-cli/issues)
|
|
336
|
-
- Contact: stefan@
|
|
501
|
+
- Contact: stefan@lua.dev
|
|
337
502
|
|
|
338
503
|
## Changelog
|
|
339
504
|
|
|
505
|
+
### 1.4.0
|
|
506
|
+
- **Agent Creation**: Added ability to create new agents during `lua skill init`
|
|
507
|
+
- **Agent Type Selection**: Choose from various agent types (Base Agent, Shopify, WooCommerce, etc.)
|
|
508
|
+
- **Metadata Collection**: Automatic collection of required metadata for agent types
|
|
509
|
+
- **Feature Configuration**: Enable/disable features like RAG, tickets, web search
|
|
510
|
+
- **Persona Generation**: Automatic persona and welcome message generation for new agents
|
|
511
|
+
- **Enhanced YAML**: Added persona and welcome message fields to configuration file
|
|
512
|
+
|
|
513
|
+
### 1.3.0
|
|
514
|
+
- **Command Restructure**: Reorganized commands under `lua auth` and `lua skill` groups
|
|
515
|
+
- **New Push Command**: Added `lua skill push` to push versions to server
|
|
516
|
+
- **New Deploy Command**: Added `lua skill deploy` to deploy versions to production
|
|
517
|
+
- **Version Management**: Added version field to YAML configuration
|
|
518
|
+
- **Improved UX**: Better command organization and intuitive naming
|
|
519
|
+
- **Enhanced Workflow**: Complete skill lifecycle from init to production deployment
|
|
520
|
+
|
|
340
521
|
### 1.2.0
|
|
341
522
|
- **Tool Development Framework**: Complete LuaSkill and LuaTool framework
|
|
342
523
|
- **Dependency Bundling**: Automatic bundling of npm packages using esbuild
|
package/dist/commands/agents.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ApiService } from '../services/api.js';
|
|
2
2
|
import { loadApiKey } from "../services/auth.js";
|
|
3
|
+
import { withErrorHandling, writeSuccess } from "../utils/cli.js";
|
|
3
4
|
export async function agentsCommand() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
console.log("✅ Agents:", JSON.stringify(data, null, 2));
|
|
5
|
+
return withErrorHandling(async () => {
|
|
6
|
+
const apiKey = await loadApiKey();
|
|
7
|
+
if (!apiKey) {
|
|
8
|
+
console.error("❌ No API key found. Run `lua configure` first.");
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
const response = await ApiService.Agent.getOrganizations(apiKey);
|
|
12
|
+
if (!response.success) {
|
|
13
|
+
console.error(`❌ Error: ${response.error?.message || 'Unknown error'}`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
const data = response.data;
|
|
17
|
+
writeSuccess("✅ Agents retrieved successfully:");
|
|
18
|
+
console.log(JSON.stringify(data, null, 2));
|
|
19
|
+
}, "agents listing");
|
|
20
20
|
}
|
package/dist/commands/apiKey.js
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import inquirer from "inquirer";
|
|
2
2
|
import { loadApiKey } from "../services/auth.js";
|
|
3
|
+
import { withErrorHandling, clearPromptLines, writeProgress, writeSuccess } from "../utils/cli.js";
|
|
3
4
|
export async function apiKeyCommand() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const { confirm } = await inquirer.prompt([
|
|
10
|
-
{
|
|
11
|
-
type: "confirm",
|
|
12
|
-
name: "confirm",
|
|
13
|
-
message: "This will display your API key. Are you sure you want to continue?",
|
|
14
|
-
default: false
|
|
5
|
+
return withErrorHandling(async () => {
|
|
6
|
+
const apiKey = await loadApiKey();
|
|
7
|
+
if (!apiKey) {
|
|
8
|
+
writeProgress("ℹ️ No API key found. Run `lua configure` first.");
|
|
9
|
+
return;
|
|
15
10
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
const { confirm } = await inquirer.prompt([
|
|
12
|
+
{
|
|
13
|
+
type: "confirm",
|
|
14
|
+
name: "confirm",
|
|
15
|
+
message: "This will display your API key. Are you sure you want to continue?",
|
|
16
|
+
default: false
|
|
17
|
+
}
|
|
18
|
+
]);
|
|
19
|
+
// Clear the confirmation prompt lines
|
|
20
|
+
clearPromptLines(2);
|
|
21
|
+
if (confirm) {
|
|
22
|
+
writeSuccess("🔑 Your API key:");
|
|
23
|
+
console.log(apiKey);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
writeProgress("ℹ️ API key display cancelled.");
|
|
27
|
+
}
|
|
28
|
+
}, "key display");
|
|
24
29
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function compileCommand(): Promise<void>;
|