lua-cli 2.5.7 → 3.0.0-alpha.1

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.
Files changed (124) hide show
  1. package/dist/api/agent.api.service.d.ts +45 -0
  2. package/dist/api/agent.api.service.js +54 -0
  3. package/dist/api/job.api.service.d.ts +210 -0
  4. package/dist/api/job.api.service.js +200 -0
  5. package/dist/api/lazy-instances.d.ts +24 -0
  6. package/dist/api/lazy-instances.js +48 -0
  7. package/dist/api/postprocessor.api.service.d.ts +98 -0
  8. package/dist/api/postprocessor.api.service.js +76 -0
  9. package/dist/api/preprocessor.api.service.d.ts +98 -0
  10. package/dist/api/preprocessor.api.service.js +76 -0
  11. package/dist/api/user.data.api.service.d.ts +28 -0
  12. package/dist/api/user.data.api.service.js +51 -0
  13. package/dist/api/webhook.api.service.d.ts +151 -0
  14. package/dist/api/webhook.api.service.js +134 -0
  15. package/dist/api-exports.d.ts +156 -41
  16. package/dist/api-exports.js +182 -21
  17. package/dist/cli/command-definitions.js +149 -7
  18. package/dist/commands/compile.js +124 -5
  19. package/dist/commands/completion.d.ts +11 -0
  20. package/dist/commands/completion.js +209 -0
  21. package/dist/commands/env.d.ts +3 -2
  22. package/dist/commands/env.js +42 -17
  23. package/dist/commands/features.d.ts +16 -0
  24. package/dist/commands/features.js +352 -0
  25. package/dist/commands/index.d.ts +7 -0
  26. package/dist/commands/index.js +7 -0
  27. package/dist/commands/init.js +53 -7
  28. package/dist/commands/jobs.d.ts +20 -0
  29. package/dist/commands/jobs.js +533 -0
  30. package/dist/commands/logs.js +2 -5
  31. package/dist/commands/persona.d.ts +3 -2
  32. package/dist/commands/persona.js +43 -18
  33. package/dist/commands/postprocessors.d.ts +8 -0
  34. package/dist/commands/postprocessors.js +431 -0
  35. package/dist/commands/preprocessors.d.ts +8 -0
  36. package/dist/commands/preprocessors.js +431 -0
  37. package/dist/commands/push.d.ts +9 -13
  38. package/dist/commands/push.js +937 -69
  39. package/dist/commands/skills.d.ts +16 -0
  40. package/dist/commands/skills.js +438 -0
  41. package/dist/commands/test.d.ts +9 -18
  42. package/dist/commands/test.js +558 -82
  43. package/dist/commands/webhooks.d.ts +18 -0
  44. package/dist/commands/webhooks.js +424 -0
  45. package/dist/common/data.entry.instance.d.ts +7 -0
  46. package/dist/common/data.entry.instance.js +15 -0
  47. package/dist/common/job.instance.d.ts +77 -0
  48. package/dist/common/job.instance.js +108 -0
  49. package/dist/common/order.instance.d.ts +6 -0
  50. package/dist/common/order.instance.js +14 -0
  51. package/dist/common/product.instance.d.ts +6 -0
  52. package/dist/common/product.instance.js +14 -0
  53. package/dist/common/user.instance.d.ts +15 -0
  54. package/dist/common/user.instance.js +38 -0
  55. package/dist/config/constants.d.ts +2 -2
  56. package/dist/config/constants.js +4 -4
  57. package/dist/index.js +14 -3
  58. package/dist/interfaces/agent.d.ts +33 -1
  59. package/dist/interfaces/chat.d.ts +22 -0
  60. package/dist/interfaces/index.d.ts +10 -0
  61. package/dist/interfaces/index.js +7 -0
  62. package/dist/interfaces/jobs.d.ts +172 -0
  63. package/dist/interfaces/jobs.js +5 -0
  64. package/dist/interfaces/message.d.ts +18 -0
  65. package/dist/interfaces/message.js +1 -0
  66. package/dist/interfaces/postprocessors.d.ts +35 -0
  67. package/dist/interfaces/postprocessors.js +4 -0
  68. package/dist/interfaces/preprocessors.d.ts +35 -0
  69. package/dist/interfaces/preprocessors.js +4 -0
  70. package/dist/interfaces/webhooks.d.ts +104 -0
  71. package/dist/interfaces/webhooks.js +5 -0
  72. package/dist/types/api-contracts.d.ts +14 -0
  73. package/dist/types/api-contracts.js +0 -7
  74. package/dist/types/compile.types.d.ts +49 -0
  75. package/dist/types/index.d.ts +1 -1
  76. package/dist/types/index.js +1 -1
  77. package/dist/types/skill.d.ts +502 -0
  78. package/dist/types/skill.js +477 -0
  79. package/dist/utils/agent-management.d.ts +25 -0
  80. package/dist/utils/agent-management.js +67 -0
  81. package/dist/utils/bundling.d.ts +31 -1
  82. package/dist/utils/bundling.js +653 -10
  83. package/dist/utils/compile.d.ts +63 -0
  84. package/dist/utils/compile.js +691 -36
  85. package/dist/utils/deployment.d.ts +2 -1
  86. package/dist/utils/deployment.js +16 -2
  87. package/dist/utils/init-agent.d.ts +3 -1
  88. package/dist/utils/init-agent.js +6 -4
  89. package/dist/utils/init-prompts.d.ts +2 -1
  90. package/dist/utils/init-prompts.js +14 -9
  91. package/dist/utils/job-management.d.ts +24 -0
  92. package/dist/utils/job-management.js +264 -0
  93. package/dist/utils/postprocessor-management.d.ts +9 -0
  94. package/dist/utils/postprocessor-management.js +118 -0
  95. package/dist/utils/preprocessor-management.d.ts +9 -0
  96. package/dist/utils/preprocessor-management.js +118 -0
  97. package/dist/utils/sandbox.d.ts +61 -1
  98. package/dist/utils/sandbox.js +283 -72
  99. package/dist/utils/tool-detection.d.ts +3 -2
  100. package/dist/utils/tool-detection.js +18 -4
  101. package/dist/utils/webhook-management.d.ts +24 -0
  102. package/dist/utils/webhook-management.js +256 -0
  103. package/dist/web/app.css +152 -736
  104. package/dist/web/app.js +45 -45
  105. package/package.json +2 -2
  106. package/template/AGENT_CONFIGURATION.md +251 -0
  107. package/template/COMPLEX_JOB_EXAMPLES.md +795 -0
  108. package/template/DYNAMIC_JOB_CREATION.md +371 -0
  109. package/template/README.md +30 -2
  110. package/template/WEBHOOKS_JOBS_QUICKSTART.md +318 -0
  111. package/template/WEBHOOK_JOB_EXAMPLES.md +817 -0
  112. package/template/package.json +1 -1
  113. package/template/src/index-agent-example.ts +201 -0
  114. package/template/src/index.ts +39 -0
  115. package/template/src/jobs/AbandonedBasketProcessorJob.ts +139 -0
  116. package/template/src/jobs/DailyCleanupJob.ts +100 -0
  117. package/template/src/jobs/DataMigrationJob.ts +133 -0
  118. package/template/src/jobs/HealthCheckJob.ts +87 -0
  119. package/template/src/postprocessors/ResponseFormatter.ts +151 -0
  120. package/template/src/preprocessors/MessageFilter.ts +91 -0
  121. package/template/src/tools/GameScoreTrackerTool.ts +356 -0
  122. package/template/src/tools/SmartBasketTool.ts +188 -0
  123. package/template/src/webhooks/PaymentWebhook.ts +113 -0
  124. package/template/src/webhooks/UserEventWebhook.ts +77 -0
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Skills Command
3
+ * Manages agent skills for sandbox and production environments
4
+ */
5
+ /**
6
+ * Main skills command - manages agent skills
7
+ *
8
+ * Features:
9
+ * - Environment selection (sandbox/staging or production)
10
+ * - Sandbox: view local skills from configuration
11
+ * - Production: view deployed skills, versions, and deploy new versions
12
+ *
13
+ * @param env - Optional environment argument ('sandbox', 'staging', or 'production')
14
+ * @returns Promise that resolves when command completes
15
+ */
16
+ export declare function skillsCommand(env?: string): Promise<void>;
@@ -0,0 +1,438 @@
1
+ /**
2
+ * Skills Command
3
+ * Manages agent skills for sandbox and production environments
4
+ */
5
+ import { loadApiKey, checkApiKey } from '../services/auth.js';
6
+ import { readSkillConfig } from '../utils/files.js';
7
+ import { withErrorHandling, writeProgress, writeSuccess, writeInfo } from '../utils/cli.js';
8
+ import { BASE_URLS } from '../config/constants.js';
9
+ import { safePrompt } from '../utils/prompt-handler.js';
10
+ import { validateConfig, validateAgentConfig, } from '../utils/dev-helpers.js';
11
+ /**
12
+ * Main skills command - manages agent skills
13
+ *
14
+ * Features:
15
+ * - Environment selection (sandbox/staging or production)
16
+ * - Sandbox: view local skills from configuration
17
+ * - Production: view deployed skills, versions, and deploy new versions
18
+ *
19
+ * @param env - Optional environment argument ('sandbox', 'staging', or 'production')
20
+ * @returns Promise that resolves when command completes
21
+ */
22
+ export async function skillsCommand(env) {
23
+ return withErrorHandling(async () => {
24
+ // Step 1: Load configuration first (to get agentId)
25
+ const config = readSkillConfig();
26
+ validateConfig(config);
27
+ validateAgentConfig(config);
28
+ const agentId = config.agent.agentId;
29
+ // Step 2: Authenticate
30
+ const apiKey = await loadApiKey();
31
+ if (!apiKey) {
32
+ console.error("❌ No API key found. Please run 'lua auth configure' to set up your API key.");
33
+ process.exit(1);
34
+ }
35
+ await checkApiKey(apiKey);
36
+ writeProgress("✅ Authenticated");
37
+ let selectedEnvironment;
38
+ // Step 3: Check if environment was provided as argument
39
+ if (env) {
40
+ // Normalize the environment (staging is an alias for sandbox)
41
+ const normalizedEnv = env.toLowerCase();
42
+ if (normalizedEnv === 'sandbox' || normalizedEnv === 'staging') {
43
+ selectedEnvironment = 'sandbox';
44
+ }
45
+ else if (normalizedEnv === 'production') {
46
+ selectedEnvironment = 'production';
47
+ }
48
+ else {
49
+ console.error(`❌ Invalid environment: "${env}". Must be "sandbox", "staging", or "production".`);
50
+ console.log('\nUsage:');
51
+ console.log(' lua skills - Interactive selection');
52
+ console.log(' lua skills sandbox - View sandbox skills directly');
53
+ console.log(' lua skills staging - View staging skills (alias for sandbox)');
54
+ console.log(' lua skills production - Manage production skills directly');
55
+ process.exit(1);
56
+ }
57
+ }
58
+ else {
59
+ // Step 4: Prompt for environment selection
60
+ const envAnswer = await safePrompt([
61
+ {
62
+ type: 'list',
63
+ name: 'environment',
64
+ message: 'Select environment:',
65
+ choices: [
66
+ { name: '🔧 Sandbox (local skills)', value: 'sandbox' },
67
+ { name: '🚀 Production (deployed skills)', value: 'production' }
68
+ ]
69
+ }
70
+ ]);
71
+ if (!envAnswer)
72
+ return;
73
+ selectedEnvironment = envAnswer.environment;
74
+ }
75
+ const context = {
76
+ environment: selectedEnvironment,
77
+ agentId,
78
+ apiKey,
79
+ };
80
+ // Step 5: Start management based on environment
81
+ if (selectedEnvironment === 'sandbox') {
82
+ await manageSandboxSkills(context, config);
83
+ }
84
+ else {
85
+ await manageProductionSkills(context, config);
86
+ }
87
+ }, "skills");
88
+ }
89
+ /**
90
+ * Manage sandbox skills - view local configuration
91
+ */
92
+ async function manageSandboxSkills(context, config) {
93
+ let continueManaging = true;
94
+ while (continueManaging) {
95
+ console.log("\n" + "=".repeat(60));
96
+ console.log("🔧 Sandbox Skills");
97
+ console.log("=".repeat(60) + "\n");
98
+ const skills = config.skills || [];
99
+ if (skills.length === 0) {
100
+ console.log("ℹ️ No skills found in configuration.");
101
+ console.log("💡 Run 'lua compile' to add skills to your configuration.\n");
102
+ }
103
+ else {
104
+ console.log("Local skills in lua.skill.yaml:\n");
105
+ skills.forEach((skill, index) => {
106
+ console.log(`${index + 1}. 📦 ${skill.name}`);
107
+ console.log(` Version: ${skill.version}`);
108
+ console.log(` Skill ID: ${skill.skillId}`);
109
+ console.log();
110
+ });
111
+ }
112
+ const actionAnswer = await safePrompt([
113
+ {
114
+ type: 'list',
115
+ name: 'action',
116
+ message: 'What would you like to do?',
117
+ choices: [
118
+ { name: '🔄 Refresh list', value: 'refresh' },
119
+ { name: '📦 Compile skills', value: 'compile' },
120
+ { name: '☁️ Push a skill', value: 'push' },
121
+ { name: '❌ Exit', value: 'exit' }
122
+ ]
123
+ }
124
+ ]);
125
+ if (!actionAnswer)
126
+ return;
127
+ const { action } = actionAnswer;
128
+ switch (action) {
129
+ case 'refresh':
130
+ // Reload config
131
+ const newConfig = readSkillConfig();
132
+ config.skills = newConfig.skills;
133
+ break;
134
+ case 'compile':
135
+ console.log("\n💡 Run 'lua compile' in your terminal to compile your skills.\n");
136
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
137
+ break;
138
+ case 'push':
139
+ console.log("\n💡 Run 'lua push skill' in your terminal to push a skill.\n");
140
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
141
+ break;
142
+ case 'exit':
143
+ continueManaging = false;
144
+ console.log("\n👋 Goodbye!\n");
145
+ break;
146
+ }
147
+ }
148
+ }
149
+ /**
150
+ * Manage production skills - view and deploy versions
151
+ */
152
+ async function manageProductionSkills(context, config) {
153
+ let continueManaging = true;
154
+ while (continueManaging) {
155
+ console.log("\n" + "=".repeat(60));
156
+ console.log("🚀 Production Skills");
157
+ console.log("=".repeat(60) + "\n");
158
+ const actionAnswer = await safePrompt([
159
+ {
160
+ type: 'list',
161
+ name: 'action',
162
+ message: 'What would you like to do?',
163
+ choices: [
164
+ { name: '👁️ View deployed skills', value: 'view' },
165
+ { name: '📜 View skill versions', value: 'versions' },
166
+ { name: '🚀 Deploy a version', value: 'deploy' },
167
+ { name: '❌ Exit', value: 'exit' }
168
+ ]
169
+ }
170
+ ]);
171
+ if (!actionAnswer)
172
+ return;
173
+ const { action } = actionAnswer;
174
+ switch (action) {
175
+ case 'view':
176
+ await viewDeployedSkills(context, config);
177
+ break;
178
+ case 'versions':
179
+ await viewSkillVersions(context, config);
180
+ break;
181
+ case 'deploy':
182
+ await deploySkillVersion(context, config);
183
+ break;
184
+ case 'exit':
185
+ continueManaging = false;
186
+ console.log("\n👋 Goodbye!\n");
187
+ break;
188
+ }
189
+ }
190
+ }
191
+ /**
192
+ * View deployed skills in production
193
+ */
194
+ async function viewDeployedSkills(context, config) {
195
+ writeProgress("🔄 Loading skill information...");
196
+ try {
197
+ const skills = config.skills || [];
198
+ if (skills.length === 0) {
199
+ console.log("\nℹ️ No skills found in configuration.\n");
200
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
201
+ return;
202
+ }
203
+ console.log("\n" + "=".repeat(60));
204
+ console.log("⚙️ Production Skills");
205
+ console.log("=".repeat(60) + "\n");
206
+ // Fetch version info for each skill
207
+ for (const skill of skills) {
208
+ try {
209
+ const response = await fetch(`${BASE_URLS.API}/developer/skills/${context.agentId}/${skill.skillId}/versions`, {
210
+ method: 'GET',
211
+ headers: {
212
+ 'Authorization': `Bearer ${context.apiKey}`,
213
+ 'Content-Type': 'application/json'
214
+ }
215
+ });
216
+ if (response.ok) {
217
+ const data = await response.json();
218
+ const versions = data.data?.versions || data.versions || [];
219
+ const activeVersionId = data.data?.activeVersionId || data.activeVersionId;
220
+ // Find active version
221
+ const activeVersion = versions.find((v) => v.skillId === activeVersionId);
222
+ console.log(`📦 ${skill.name}`);
223
+ console.log(` Skill ID: ${skill.skillId}`);
224
+ if (activeVersion) {
225
+ console.log(` Deployed Version: ${activeVersion.version} ⭐`);
226
+ const date = new Date(activeVersion.createdAt);
227
+ console.log(` Deployed: ${date.toLocaleString()}`);
228
+ }
229
+ else {
230
+ console.log(` Deployed Version: Not deployed`);
231
+ }
232
+ console.log(` Total Versions: ${versions.length}`);
233
+ console.log();
234
+ }
235
+ else {
236
+ console.log(`📦 ${skill.name}`);
237
+ console.log(` Skill ID: ${skill.skillId}`);
238
+ console.log(` Status: Unable to fetch version info`);
239
+ console.log();
240
+ }
241
+ }
242
+ catch (error) {
243
+ console.log(`📦 ${skill.name}`);
244
+ console.log(` Skill ID: ${skill.skillId}`);
245
+ console.log(` Status: Error loading versions`);
246
+ console.log();
247
+ }
248
+ }
249
+ console.log("=".repeat(60) + "\n");
250
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
251
+ }
252
+ catch (error) {
253
+ console.error('❌ Error loading skill information:', error);
254
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
255
+ }
256
+ }
257
+ /**
258
+ * View versions for a specific skill
259
+ */
260
+ async function viewSkillVersions(context, config) {
261
+ const skills = config.skills || [];
262
+ if (skills.length === 0) {
263
+ console.log("\nℹ️ No skills found in configuration.\n");
264
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
265
+ return;
266
+ }
267
+ // Prompt to select a skill
268
+ const skillAnswer = await safePrompt([
269
+ {
270
+ type: 'list',
271
+ name: 'selectedSkill',
272
+ message: 'Select a skill to view versions:',
273
+ choices: skills.map((skill) => ({
274
+ name: `${skill.name} (${skill.skillId})`,
275
+ value: skill
276
+ }))
277
+ }
278
+ ]);
279
+ if (!skillAnswer)
280
+ return;
281
+ const selectedSkill = skillAnswer.selectedSkill;
282
+ writeProgress(`🔄 Loading versions for ${selectedSkill.name}...`);
283
+ try {
284
+ const response = await fetch(`${BASE_URLS.API}/developer/skills/${context.agentId}/${selectedSkill.skillId}/versions`, {
285
+ method: 'GET',
286
+ headers: {
287
+ 'Authorization': `Bearer ${context.apiKey}`,
288
+ 'Content-Type': 'application/json'
289
+ }
290
+ });
291
+ if (!response.ok) {
292
+ throw new Error(`HTTP error! status: ${response.status}`);
293
+ }
294
+ const data = await response.json();
295
+ const versions = data.data?.versions || data.versions || [];
296
+ const activeVersionId = data.data?.activeVersionId || data.activeVersionId;
297
+ if (versions.length === 0) {
298
+ console.log(`\nℹ️ No versions found for ${selectedSkill.name}.\n`);
299
+ console.log("💡 Push a version first using 'lua push skill'.\n");
300
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
301
+ return;
302
+ }
303
+ console.log("\n" + "=".repeat(60));
304
+ console.log(`📜 Versions for ${selectedSkill.name}`);
305
+ console.log("=".repeat(60) + "\n");
306
+ // Sort versions by date (newest first)
307
+ const sortedVersions = versions.sort((a, b) => {
308
+ const dateA = new Date(a.createdAt).getTime();
309
+ const dateB = new Date(b.createdAt).getTime();
310
+ return dateB - dateA;
311
+ });
312
+ sortedVersions.forEach((version, index) => {
313
+ const isActive = version.skillId === activeVersionId;
314
+ const date = new Date(version.createdAt);
315
+ console.log(`${index + 1}. Version ${version.version}${isActive ? ' ⭐ DEPLOYED' : ''}`);
316
+ console.log(` Created: ${date.toLocaleString()}`);
317
+ console.log(` Version ID: ${version.skillId}`);
318
+ console.log();
319
+ });
320
+ console.log("=".repeat(60) + "\n");
321
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
322
+ }
323
+ catch (error) {
324
+ console.error('❌ Error loading versions:', error);
325
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
326
+ }
327
+ }
328
+ /**
329
+ * Deploy a skill version to production
330
+ */
331
+ async function deploySkillVersion(context, config) {
332
+ const skills = config.skills || [];
333
+ if (skills.length === 0) {
334
+ console.log("\nℹ️ No skills found in configuration.\n");
335
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
336
+ return;
337
+ }
338
+ // Prompt to select a skill
339
+ const skillAnswer = await safePrompt([
340
+ {
341
+ type: 'list',
342
+ name: 'selectedSkill',
343
+ message: 'Select a skill to deploy:',
344
+ choices: skills.map((skill) => ({
345
+ name: `${skill.name} (${skill.skillId})`,
346
+ value: skill
347
+ }))
348
+ }
349
+ ]);
350
+ if (!skillAnswer)
351
+ return;
352
+ const selectedSkill = skillAnswer.selectedSkill;
353
+ writeProgress(`🔄 Loading versions for ${selectedSkill.name}...`);
354
+ try {
355
+ const response = await fetch(`${BASE_URLS.API}/developer/skills/${context.agentId}/${selectedSkill.skillId}/versions`, {
356
+ method: 'GET',
357
+ headers: {
358
+ 'Authorization': `Bearer ${context.apiKey}`,
359
+ 'Content-Type': 'application/json'
360
+ }
361
+ });
362
+ if (!response.ok) {
363
+ throw new Error(`HTTP error! status: ${response.status}`);
364
+ }
365
+ const data = await response.json();
366
+ const versions = data.data?.versions || data.versions || [];
367
+ const activeVersionId = data.data?.activeVersionId || data.activeVersionId;
368
+ if (versions.length === 0) {
369
+ console.log(`\nℹ️ No versions found for ${selectedSkill.name}.\n`);
370
+ console.log("💡 Push a version first using 'lua push skill'.\n");
371
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
372
+ return;
373
+ }
374
+ // Sort versions by date (newest first)
375
+ const sortedVersions = versions.sort((a, b) => {
376
+ const dateA = new Date(a.createdAt).getTime();
377
+ const dateB = new Date(b.createdAt).getTime();
378
+ return dateB - dateA;
379
+ });
380
+ // Prompt to select a version
381
+ const versionAnswer = await safePrompt([
382
+ {
383
+ type: 'list',
384
+ name: 'selectedVersion',
385
+ message: 'Select a version to deploy:',
386
+ choices: sortedVersions.map((version) => {
387
+ const isActive = version.skillId === activeVersionId;
388
+ const date = new Date(version.createdAt);
389
+ return {
390
+ name: `Version ${version.version} (${date.toLocaleDateString()})${isActive ? ' ⭐ CURRENT' : ''}`,
391
+ value: version
392
+ };
393
+ })
394
+ }
395
+ ]);
396
+ if (!versionAnswer)
397
+ return;
398
+ const selectedVersion = versionAnswer.selectedVersion;
399
+ // Show warning
400
+ console.log("\n⚠️ WARNING: You are about to deploy to PRODUCTION!");
401
+ console.log("⚠️ This will affect ALL users immediately.\n");
402
+ console.log(`Skill: ${selectedSkill.name}`);
403
+ console.log(`Version: ${selectedVersion.version}\n`);
404
+ const confirmAnswer = await safePrompt([
405
+ {
406
+ type: 'confirm',
407
+ name: 'confirm',
408
+ message: 'Are you absolutely sure you want to deploy this version?',
409
+ default: false
410
+ }
411
+ ]);
412
+ if (!confirmAnswer || !confirmAnswer.confirm) {
413
+ console.log("\n❌ Deployment cancelled.\n");
414
+ return;
415
+ }
416
+ writeProgress("🔄 Deploying version...");
417
+ const deployResponse = await fetch(`${BASE_URLS.API}/developer/skills/${context.agentId}/${selectedSkill.skillId}/${selectedVersion.version}/publish`, {
418
+ method: 'POST',
419
+ headers: {
420
+ 'Authorization': `Bearer ${context.apiKey}`,
421
+ 'Content-Type': 'application/json'
422
+ },
423
+ body: JSON.stringify({})
424
+ });
425
+ if (!deployResponse.ok) {
426
+ const errorText = await deployResponse.text();
427
+ console.error(`\n❌ Deploy Error: ${deployResponse.status} - ${errorText}\n`);
428
+ throw new Error(`HTTP error! status: ${deployResponse.status}`);
429
+ }
430
+ writeSuccess(`\n✅ Version ${selectedVersion.version} of "${selectedSkill.name}" deployed successfully to production\n`);
431
+ writeInfo("💡 The new version is now active for all users.");
432
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
433
+ }
434
+ catch (error) {
435
+ console.error('\n❌ Error deploying version:', error);
436
+ await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
437
+ }
438
+ }
@@ -3,25 +3,16 @@
3
3
  * Orchestrates the testing of individual tools in a local sandbox environment
4
4
  */
5
5
  /**
6
- * Main test command - tests a tool in a local sandbox environment.
6
+ * Main test command - tests tools, webhooks, jobs, preprocessors, or postprocessors.
7
7
  *
8
- * This command performs the following steps:
9
- * 1. Compiles the skill to ensure latest code
10
- * 2. Loads deploy.json with tool definitions
11
- * 3. Extracts all available tools
12
- * 4. Prompts user to select a tool
13
- * 5. Collects input values based on tool's input schema
14
- * 6. Executes the tool in a sandboxed environment
15
- * 7. Displays the results
16
- *
17
- * Features:
18
- * - Interactive tool selection from compiled tools
19
- * - Dynamic input prompts based on tool schemas
20
- * - Support for nested object inputs
21
- * - Environment variable injection
22
- * - Secure sandbox execution
23
- * - Detailed error reporting
8
+ * This command can test:
9
+ * - Skills/Tools: Interactive tool execution with input prompts
10
+ * - Webhooks: Test webhook with query params, headers, and body
11
+ * - Jobs: Trigger job execution manually
12
+ * - PreProcessors: Test message preprocessing
13
+ * - PostProcessors: Test response postprocessing
24
14
  *
15
+ * @param type - Optional type argument ('skill', 'webhook', 'job', 'preprocessor', 'postprocessor')
25
16
  * @returns Promise that resolves when test completes
26
17
  */
27
- export declare function testCommand(): Promise<void>;
18
+ export declare function testCommand(type?: string): Promise<void>;