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
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/* Tools Page Styles */
|
|
2
|
+
.tools-page {
|
|
3
|
+
flex: 1;
|
|
4
|
+
background: #1e1e1e;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.tools-loading {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
height: 100%;
|
|
16
|
+
gap: 16px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.loading-spinner {
|
|
20
|
+
width: 32px;
|
|
21
|
+
height: 32px;
|
|
22
|
+
border: 3px solid #3e3e42;
|
|
23
|
+
border-top: 3px solid #007acc;
|
|
24
|
+
border-radius: 50%;
|
|
25
|
+
animation: spin 1s linear infinite;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@keyframes spin {
|
|
29
|
+
0% { transform: rotate(0deg); }
|
|
30
|
+
100% { transform: rotate(360deg); }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Tools List View */
|
|
34
|
+
.tools-list-view {
|
|
35
|
+
flex: 1;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.tools-header {
|
|
42
|
+
background: #2d2d30;
|
|
43
|
+
color: #cccccc;
|
|
44
|
+
padding: 16px 20px;
|
|
45
|
+
border-bottom: 1px solid #3e3e42;
|
|
46
|
+
flex-shrink: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.tools-header h3 {
|
|
50
|
+
margin: 0 0 4px 0;
|
|
51
|
+
font-size: 18px;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
color: #ffffff;
|
|
54
|
+
font-family: inherit;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.tools-header p {
|
|
58
|
+
margin: 0;
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
color: #cccccc;
|
|
61
|
+
font-family: inherit;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.tools-grid {
|
|
65
|
+
flex: 1;
|
|
66
|
+
padding: 20px;
|
|
67
|
+
display: grid;
|
|
68
|
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
|
69
|
+
gap: 12px;
|
|
70
|
+
overflow-y: auto;
|
|
71
|
+
align-content: start;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.tool-card {
|
|
75
|
+
background: #252526;
|
|
76
|
+
border: 1px solid #3e3e42;
|
|
77
|
+
border-radius: 8px;
|
|
78
|
+
padding: 12px;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
transition: all 0.2s;
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
height: fit-content;
|
|
84
|
+
min-height: 100px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.tool-card:hover {
|
|
88
|
+
background: #2d2d30;
|
|
89
|
+
border-color: #007acc;
|
|
90
|
+
transform: translateY(-2px);
|
|
91
|
+
box-shadow: 0 4px 12px rgba(0, 122, 204, 0.1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tool-card-header {
|
|
95
|
+
margin-bottom: 12px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.tool-card-header h4 {
|
|
99
|
+
margin: 0;
|
|
100
|
+
font-size: 16px;
|
|
101
|
+
font-weight: 600;
|
|
102
|
+
color: #ffffff;
|
|
103
|
+
font-family: inherit;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.tool-card-body {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
gap: 8px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.tool-card-body p {
|
|
113
|
+
margin: 0;
|
|
114
|
+
font-size: 14px;
|
|
115
|
+
color: #cccccc;
|
|
116
|
+
line-height: 1.4;
|
|
117
|
+
font-family: inherit;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.tool-card-meta {
|
|
121
|
+
display: flex;
|
|
122
|
+
justify-content: space-between;
|
|
123
|
+
align-items: center;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.input-count {
|
|
127
|
+
font-size: 12px;
|
|
128
|
+
color: #8c8c8c;
|
|
129
|
+
background: #1e1e1e;
|
|
130
|
+
padding: 4px 8px;
|
|
131
|
+
border-radius: 4px;
|
|
132
|
+
font-family: inherit;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Tool Form View */
|
|
136
|
+
.tool-form {
|
|
137
|
+
flex: 1;
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
overflow: hidden;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.tool-form-header {
|
|
144
|
+
background: #2d2d30;
|
|
145
|
+
color: #cccccc;
|
|
146
|
+
padding: 16px 20px;
|
|
147
|
+
border-bottom: 1px solid #3e3e42;
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: 16px;
|
|
151
|
+
flex-shrink: 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.back-button {
|
|
155
|
+
background: #3e3e42;
|
|
156
|
+
color: #cccccc;
|
|
157
|
+
border: none;
|
|
158
|
+
border-radius: 4px;
|
|
159
|
+
padding: 8px 12px;
|
|
160
|
+
font-size: 14px;
|
|
161
|
+
font-family: inherit;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
transition: background-color 0.2s;
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
gap: 4px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.back-button:hover {
|
|
170
|
+
background: #4e4e52;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.tool-form-header h3 {
|
|
174
|
+
margin: 0;
|
|
175
|
+
font-size: 18px;
|
|
176
|
+
font-weight: 600;
|
|
177
|
+
color: #ffffff;
|
|
178
|
+
font-family: inherit;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.tool-form-content {
|
|
182
|
+
flex: 1;
|
|
183
|
+
padding: 20px;
|
|
184
|
+
overflow-y: auto;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.tool-info {
|
|
188
|
+
margin-bottom: 24px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.tool-info p {
|
|
192
|
+
margin: 0;
|
|
193
|
+
font-size: 14px;
|
|
194
|
+
color: #cccccc;
|
|
195
|
+
line-height: 1.5;
|
|
196
|
+
font-family: inherit;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.tool-inputs {
|
|
200
|
+
margin-bottom: 24px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.tool-inputs h4 {
|
|
204
|
+
margin: 0 0 16px 0;
|
|
205
|
+
font-size: 16px;
|
|
206
|
+
font-weight: 600;
|
|
207
|
+
color: #ffffff;
|
|
208
|
+
font-family: inherit;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.input-fields {
|
|
212
|
+
display: flex;
|
|
213
|
+
flex-direction: column;
|
|
214
|
+
gap: 16px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.input-field {
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
gap: 6px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.input-field label {
|
|
224
|
+
font-size: 14px;
|
|
225
|
+
font-weight: 500;
|
|
226
|
+
color: #cccccc;
|
|
227
|
+
font-family: inherit;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.required {
|
|
231
|
+
color: #f85149;
|
|
232
|
+
margin-left: 4px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.tool-input {
|
|
236
|
+
background: #1e1e1e;
|
|
237
|
+
color: #cccccc;
|
|
238
|
+
border: 1px solid #3e3e42;
|
|
239
|
+
border-radius: 4px;
|
|
240
|
+
padding: 8px 12px;
|
|
241
|
+
font-size: 14px;
|
|
242
|
+
font-family: inherit;
|
|
243
|
+
outline: none;
|
|
244
|
+
transition: border-color 0.2s;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.tool-input:focus {
|
|
248
|
+
border-color: #007acc;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.tool-checkbox {
|
|
252
|
+
width: 16px;
|
|
253
|
+
height: 16px;
|
|
254
|
+
accent-color: #007acc;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.input-description {
|
|
258
|
+
font-size: 12px;
|
|
259
|
+
color: #8c8c8c;
|
|
260
|
+
font-style: italic;
|
|
261
|
+
font-family: inherit;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.no-inputs {
|
|
265
|
+
font-size: 14px;
|
|
266
|
+
color: #8c8c8c;
|
|
267
|
+
font-style: italic;
|
|
268
|
+
font-family: inherit;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.tool-actions {
|
|
272
|
+
margin-bottom: 24px;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.test-button {
|
|
276
|
+
background: #007acc;
|
|
277
|
+
color: white;
|
|
278
|
+
border: none;
|
|
279
|
+
border-radius: 6px;
|
|
280
|
+
padding: 12px 24px;
|
|
281
|
+
font-size: 14px;
|
|
282
|
+
font-weight: 500;
|
|
283
|
+
font-family: inherit;
|
|
284
|
+
cursor: pointer;
|
|
285
|
+
transition: background-color 0.2s;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.test-button:hover:not(:disabled) {
|
|
289
|
+
background: #005a9e;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.test-button:disabled {
|
|
293
|
+
background: #3e3e42;
|
|
294
|
+
color: #8c8c8c;
|
|
295
|
+
cursor: not-allowed;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.test-result {
|
|
299
|
+
background: #252526;
|
|
300
|
+
border-radius: 6px;
|
|
301
|
+
padding: 16px;
|
|
302
|
+
border: 1px solid #3e3e42;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.test-result h4 {
|
|
306
|
+
margin: 0 0 12px 0;
|
|
307
|
+
font-size: 16px;
|
|
308
|
+
font-weight: 600;
|
|
309
|
+
color: #ffffff;
|
|
310
|
+
font-family: inherit;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.result-content {
|
|
314
|
+
padding: 12px;
|
|
315
|
+
border-radius: 4px;
|
|
316
|
+
font-family: inherit;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.result-content.success {
|
|
320
|
+
background: #0d4429;
|
|
321
|
+
border: 1px solid #238636;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.result-content.error {
|
|
325
|
+
background: #5d1a1a;
|
|
326
|
+
border: 1px solid #da3633;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.result-label {
|
|
330
|
+
font-size: 14px;
|
|
331
|
+
font-weight: 600;
|
|
332
|
+
margin-bottom: 8px;
|
|
333
|
+
font-family: inherit;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.result-content.success .result-label {
|
|
337
|
+
color: #3fb950;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.result-content.error .result-label {
|
|
341
|
+
color: #f85149;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.result-data {
|
|
345
|
+
background: #1e1e1e;
|
|
346
|
+
color: #cccccc;
|
|
347
|
+
padding: 12px;
|
|
348
|
+
border-radius: 4px;
|
|
349
|
+
font-size: 12px;
|
|
350
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
351
|
+
overflow-x: auto;
|
|
352
|
+
margin: 0;
|
|
353
|
+
white-space: pre-wrap;
|
|
354
|
+
word-break: break-word;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.result-error {
|
|
358
|
+
color: #f85149;
|
|
359
|
+
font-size: 14px;
|
|
360
|
+
font-family: inherit;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/* Responsive design */
|
|
364
|
+
@media (max-width: 768px) {
|
|
365
|
+
.tools-grid {
|
|
366
|
+
grid-template-columns: 1fr;
|
|
367
|
+
padding: 16px;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.tool-form-content {
|
|
371
|
+
padding: 16px;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.tool-form-header {
|
|
375
|
+
padding: 12px 16px;
|
|
376
|
+
}
|
|
377
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lua-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Command-line interface for Lua AI platform - develop, test, and deploy LuaSkills with custom tools",
|
|
5
5
|
"readmeFilename": "README.md",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./dist/index.js",
|
|
9
9
|
"./types": "./dist/types.js",
|
|
10
|
-
"./skill": "./dist/skill.js"
|
|
10
|
+
"./skill": "./dist/skill.js",
|
|
11
|
+
"./user-data-api": "./dist/user-data-api.js"
|
|
11
12
|
},
|
|
12
13
|
"scripts": {
|
|
13
14
|
"clean": "rm -rf dist",
|
|
14
|
-
"build": "
|
|
15
|
+
"build:react": "cd src/web && npx tsx build.ts",
|
|
16
|
+
"build": "npm run clean && npm run build:react && tsc && chmod +x dist/index.js && npm link",
|
|
15
17
|
"prepublishOnly": "npm run build",
|
|
16
18
|
"test": "jest",
|
|
17
19
|
"test:watch": "jest --watch",
|
|
@@ -32,12 +34,12 @@
|
|
|
32
34
|
"deployment",
|
|
33
35
|
"skills"
|
|
34
36
|
],
|
|
35
|
-
"author": "Stefan Kruger <stefan@
|
|
37
|
+
"author": "Stefan Kruger <stefan@lua.dev>",
|
|
36
38
|
"license": "MIT",
|
|
37
39
|
"type": "module",
|
|
38
40
|
"repository": {
|
|
39
41
|
"type": "git",
|
|
40
|
-
"url": "https://github.com/lua-ai-global/lua-cli.git"
|
|
42
|
+
"url": "git+https://github.com/lua-ai-global/lua-cli.git"
|
|
41
43
|
},
|
|
42
44
|
"homepage": "https://github.com/lua-ai-global/lua-cli#readme",
|
|
43
45
|
"readme": "README.md",
|
|
@@ -60,13 +62,24 @@
|
|
|
60
62
|
"inquirer": "^12.9.6",
|
|
61
63
|
"keytar": "^7.9.0",
|
|
62
64
|
"node-fetch": "^3.3.2",
|
|
65
|
+
"open": "^10.1.0",
|
|
66
|
+
"react": "^18.2.0",
|
|
67
|
+
"react-dom": "^18.2.0",
|
|
68
|
+
"socket.io-client": "^4.7.2",
|
|
69
|
+
"ws": "^8.18.3",
|
|
63
70
|
"zod": "^4.1.9"
|
|
64
71
|
},
|
|
65
72
|
"devDependencies": {
|
|
66
73
|
"@types/inquirer": "^9.0.9",
|
|
67
74
|
"@types/jest": "^29.5.8",
|
|
75
|
+
"@types/js-yaml": "^4.0.9",
|
|
68
76
|
"@types/node": "^24.5.1",
|
|
69
77
|
"@types/node-fetch": "^2.6.13",
|
|
78
|
+
"@types/react": "^18.2.0",
|
|
79
|
+
"@types/react-dom": "^18.2.0",
|
|
80
|
+
"@types/ws": "^8.18.1",
|
|
81
|
+
"@typescript-eslint/parser": "^8.44.1",
|
|
82
|
+
"@typescript-eslint/typescript-estree": "^8.44.1",
|
|
70
83
|
"jest": "^29.7.0",
|
|
71
84
|
"ts-jest": "^29.1.1",
|
|
72
85
|
"ts-node": "^10.9.2",
|
|
@@ -10,25 +10,29 @@
|
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@types/inquirer": "^9.0.9",
|
|
13
|
+
"@types/js-yaml": "^4.0.9",
|
|
13
14
|
"axios": "^1.6.0",
|
|
14
15
|
"inquirer": "^12.9.6",
|
|
16
|
+
"js-yaml": "^4.1.0",
|
|
15
17
|
"lua-cli": "file:..",
|
|
16
18
|
"zod": "^4.1.9"
|
|
17
19
|
},
|
|
18
20
|
"devDependencies": {
|
|
19
21
|
"@types/node": "^20.10.0",
|
|
20
22
|
"tsx": "^4.7.0",
|
|
21
|
-
"typescript": "^5.
|
|
23
|
+
"typescript": "^5.9.2"
|
|
22
24
|
}
|
|
23
25
|
},
|
|
24
26
|
"..": {
|
|
25
|
-
"version": "1.1
|
|
27
|
+
"version": "1.3.0-alpha.1",
|
|
26
28
|
"license": "MIT",
|
|
27
29
|
"dependencies": {
|
|
28
30
|
"commander": "^14.0.1",
|
|
31
|
+
"esbuild": "^0.25.10",
|
|
29
32
|
"inquirer": "^12.9.6",
|
|
30
33
|
"keytar": "^7.9.0",
|
|
31
34
|
"node-fetch": "^3.3.2",
|
|
35
|
+
"open": "^10.1.0",
|
|
32
36
|
"zod": "^4.1.9"
|
|
33
37
|
},
|
|
34
38
|
"bin": {
|
|
@@ -39,7 +43,8 @@
|
|
|
39
43
|
"@types/jest": "^29.5.8",
|
|
40
44
|
"@types/node": "^24.5.1",
|
|
41
45
|
"@types/node-fetch": "^2.6.13",
|
|
42
|
-
"
|
|
46
|
+
"@typescript-eslint/parser": "^8.44.1",
|
|
47
|
+
"@typescript-eslint/typescript-estree": "^8.44.1",
|
|
43
48
|
"jest": "^29.7.0",
|
|
44
49
|
"ts-jest": "^29.1.1",
|
|
45
50
|
"ts-node": "^10.9.2",
|
|
@@ -835,6 +840,12 @@
|
|
|
835
840
|
"rxjs": "^7.2.0"
|
|
836
841
|
}
|
|
837
842
|
},
|
|
843
|
+
"node_modules/@types/js-yaml": {
|
|
844
|
+
"version": "4.0.9",
|
|
845
|
+
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz",
|
|
846
|
+
"integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==",
|
|
847
|
+
"license": "MIT"
|
|
848
|
+
},
|
|
838
849
|
"node_modules/@types/node": {
|
|
839
850
|
"version": "20.19.17",
|
|
840
851
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.17.tgz",
|
|
@@ -877,6 +888,12 @@
|
|
|
877
888
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
|
878
889
|
}
|
|
879
890
|
},
|
|
891
|
+
"node_modules/argparse": {
|
|
892
|
+
"version": "2.0.1",
|
|
893
|
+
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
|
894
|
+
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
|
|
895
|
+
"license": "Python-2.0"
|
|
896
|
+
},
|
|
880
897
|
"node_modules/asynckit": {
|
|
881
898
|
"version": "0.4.0",
|
|
882
899
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
|
@@ -1280,6 +1297,18 @@
|
|
|
1280
1297
|
"node": ">=8"
|
|
1281
1298
|
}
|
|
1282
1299
|
},
|
|
1300
|
+
"node_modules/js-yaml": {
|
|
1301
|
+
"version": "4.1.0",
|
|
1302
|
+
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
|
1303
|
+
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
|
1304
|
+
"license": "MIT",
|
|
1305
|
+
"dependencies": {
|
|
1306
|
+
"argparse": "^2.0.1"
|
|
1307
|
+
},
|
|
1308
|
+
"bin": {
|
|
1309
|
+
"js-yaml": "bin/js-yaml.js"
|
|
1310
|
+
}
|
|
1311
|
+
},
|
|
1283
1312
|
"node_modules/lua-cli": {
|
|
1284
1313
|
"resolved": "..",
|
|
1285
1314
|
"link": true
|
package/template/package.json
CHANGED
|
@@ -14,14 +14,16 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@types/inquirer": "^9.0.9",
|
|
17
|
+
"@types/js-yaml": "^4.0.9",
|
|
17
18
|
"axios": "^1.6.0",
|
|
18
19
|
"inquirer": "^12.9.6",
|
|
20
|
+
"js-yaml": "^4.1.0",
|
|
19
21
|
"lua-cli": "file:..",
|
|
20
22
|
"zod": "^4.1.9"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
23
25
|
"@types/node": "^20.10.0",
|
|
24
26
|
"tsx": "^4.7.0",
|
|
25
|
-
"typescript": "^5.
|
|
27
|
+
"typescript": "^5.9.2"
|
|
26
28
|
}
|
|
27
29
|
}
|
|
@@ -4,19 +4,28 @@ import GetUserDataTool from "./tools/GetUserDataTool";
|
|
|
4
4
|
import CreatePostTool from "./tools/CreatePostTool";
|
|
5
5
|
import CalculatorTool from "./tools/CalculatorTool";
|
|
6
6
|
import AdvancedMathTool from "./tools/AdvancedMathTool";
|
|
7
|
+
import { UserPreferencesTool } from "./tools/UserPreferencesTool";
|
|
7
8
|
|
|
8
9
|
// Initialize skill with tools
|
|
9
|
-
const skill = new LuaSkill(
|
|
10
|
+
const skill = new LuaSkill({
|
|
11
|
+
description: "A comprehensive Lua skill with weather, user data, post creation, and mathematical tools",
|
|
12
|
+
context: "This skill provides various utilities including weather information, user data retrieval, post creation, basic calculator operations, and advanced mathematical functions. Use get_weather to fetch current weather conditions for any city, get_user_data to retrieve user information, create_post to publish new posts, calculator for basic arithmetic operations, and advanced_math for complex mathematical computations like factorials, prime checking, fibonacci sequences, and greatest common divisor calculations."
|
|
13
|
+
});
|
|
10
14
|
skill.addTool(new GetWeatherTool());
|
|
11
15
|
skill.addTool(new GetUserDataTool());
|
|
12
|
-
skill.addTool(new
|
|
13
|
-
skill.addTool(new
|
|
14
|
-
skill.addTool(new
|
|
16
|
+
skill.addTool(new UserPreferencesTool());
|
|
17
|
+
// skill.addTool(new CreatePostTool());
|
|
18
|
+
// skill.addTool(new CalculatorTool());
|
|
19
|
+
// skill.addTool(new AdvancedMathTool());
|
|
15
20
|
|
|
16
21
|
// Test cases
|
|
17
22
|
const testCases = [
|
|
18
23
|
{ tool: "get_weather", city: "London" },
|
|
19
24
|
{ tool: "get_user_data", userId: "user123" },
|
|
25
|
+
{ tool: "user_preferences", action: "get" },
|
|
26
|
+
{ tool: "user_preferences", action: "set", key: "theme", value: "dark" },
|
|
27
|
+
{ tool: "user_preferences", action: "set", key: "language", value: "en" },
|
|
28
|
+
{ tool: "user_preferences", action: "get" },
|
|
20
29
|
{ tool: "create_post", title: "Test Post", content: "This is a test post content" },
|
|
21
30
|
{ tool: "calculator", operation: "add", a: 5, b: 3 },
|
|
22
31
|
{ tool: "advanced_math", operation: "factorial", numbers: [5] },
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { LuaTool } from 'lua-cli';
|
|
2
|
+
import { user } from 'lua-cli';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Example tool demonstrating User Data API usage
|
|
7
|
+
* This tool allows users to manage their preferences
|
|
8
|
+
*/
|
|
9
|
+
export class UserPreferencesTool extends LuaTool {
|
|
10
|
+
constructor() {
|
|
11
|
+
super('user-preferences', 'Manage user preferences and settings');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async execute(input: { action: string; key?: string; value?: string }) {
|
|
15
|
+
const { action, key, value } = input;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
switch (action) {
|
|
19
|
+
case 'get':
|
|
20
|
+
const userData = await user.data.get();
|
|
21
|
+
return {
|
|
22
|
+
success: true,
|
|
23
|
+
preferences: userData.preferences || {},
|
|
24
|
+
message: 'Preferences retrieved successfully'
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
case 'set':
|
|
28
|
+
if (!key || !value) {
|
|
29
|
+
throw new Error('Key and value are required for set action');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const currentData = await user.data.get();
|
|
33
|
+
const updatedData = {
|
|
34
|
+
...currentData,
|
|
35
|
+
preferences: {
|
|
36
|
+
...currentData.preferences,
|
|
37
|
+
[key]: value
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
await user.data.update(updatedData);
|
|
42
|
+
return {
|
|
43
|
+
success: true,
|
|
44
|
+
message: `Set ${key} to ${value}`,
|
|
45
|
+
preferences: updatedData.preferences
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
case 'clear':
|
|
49
|
+
await user.data.clear();
|
|
50
|
+
return {
|
|
51
|
+
success: true,
|
|
52
|
+
message: 'All preferences cleared'
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
default:
|
|
56
|
+
throw new Error('Invalid action. Use: get, set, or clear');
|
|
57
|
+
}
|
|
58
|
+
} catch (error) {
|
|
59
|
+
return {
|
|
60
|
+
success: false,
|
|
61
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred'
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getInputSchema() {
|
|
67
|
+
return z.object({
|
|
68
|
+
action: z.enum(['get', 'set', 'clear']).describe('Action to perform: get (retrieve preferences), set (update a preference), or clear (remove all preferences)'),
|
|
69
|
+
key: z.string().optional().describe('Preference key (required for set action)'),
|
|
70
|
+
value: z.string().optional().describe('Preference value (required for set action)')
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|