lua-cli 2.2.8-alpha.2 → 2.3.0-alpha.2

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 (195) hide show
  1. package/API_REFERENCE.md +1408 -0
  2. package/CLI_REFERENCE.md +818 -0
  3. package/GETTING_STARTED.md +1040 -0
  4. package/README.md +738 -424
  5. package/TEMPLATE_GUIDE.md +1398 -0
  6. package/dist/api/agent.api.service.d.ts +33 -6
  7. package/dist/api/agent.api.service.js +27 -0
  8. package/dist/api/auth.api.service.d.ts +31 -2
  9. package/dist/api/auth.api.service.js +29 -0
  10. package/dist/api/basket.api.service.d.ts +53 -11
  11. package/dist/api/basket.api.service.js +63 -14
  12. package/dist/api/chat.api.service.d.ts +15 -3
  13. package/dist/api/chat.api.service.js +12 -0
  14. package/dist/api/credentials.d.ts +24 -0
  15. package/dist/api/credentials.js +46 -0
  16. package/dist/api/custom.data.api.service.d.ts +45 -9
  17. package/dist/api/custom.data.api.service.js +43 -9
  18. package/dist/api/lazy-instances.d.ts +49 -0
  19. package/dist/api/lazy-instances.js +95 -0
  20. package/dist/api/order.api.service.d.ts +34 -4
  21. package/dist/api/order.api.service.js +41 -3
  22. package/dist/api/products.api.service.d.ts +39 -9
  23. package/dist/api/products.api.service.js +43 -5
  24. package/dist/api/skills.api.service.d.ts +49 -2
  25. package/dist/api/skills.api.service.js +47 -1
  26. package/dist/api/tool.api.service.d.ts +39 -1
  27. package/dist/api/tool.api.service.js +38 -0
  28. package/dist/api/user.data.api.service.d.ts +23 -1
  29. package/dist/api/user.data.api.service.js +22 -0
  30. package/dist/api-exports.d.ts +236 -5
  31. package/dist/api-exports.js +264 -81
  32. package/dist/cli/command-definitions.d.ts +30 -0
  33. package/dist/cli/command-definitions.js +71 -0
  34. package/dist/commands/agents.d.ts +20 -0
  35. package/dist/commands/agents.js +24 -2
  36. package/dist/commands/apiKey.d.ts +23 -0
  37. package/dist/commands/apiKey.js +23 -0
  38. package/dist/commands/compile.d.ts +24 -0
  39. package/dist/commands/compile.js +67 -759
  40. package/dist/commands/configure.d.ts +24 -0
  41. package/dist/commands/configure.js +31 -96
  42. package/dist/commands/deploy.d.ts +31 -19
  43. package/dist/commands/deploy.js +45 -74
  44. package/dist/commands/destroy.d.ts +27 -0
  45. package/dist/commands/destroy.js +27 -1
  46. package/dist/commands/dev.d.ts +25 -62
  47. package/dist/commands/dev.js +58 -878
  48. package/dist/commands/init.d.ts +27 -0
  49. package/dist/commands/init.js +98 -260
  50. package/dist/commands/push.d.ts +24 -21
  51. package/dist/commands/push.js +39 -92
  52. package/dist/commands/test.d.ts +26 -0
  53. package/dist/commands/test.js +41 -188
  54. package/dist/common/basket.instance.d.ts +54 -3
  55. package/dist/common/basket.instance.js +56 -3
  56. package/dist/common/data.entry.instance.d.ts +25 -2
  57. package/dist/common/data.entry.instance.js +24 -0
  58. package/dist/common/http.client.d.ts +51 -1
  59. package/dist/common/http.client.js +50 -0
  60. package/dist/common/order.instance.d.ts +22 -0
  61. package/dist/common/order.instance.js +31 -4
  62. package/dist/common/product.instance.d.ts +22 -1
  63. package/dist/common/product.instance.js +24 -6
  64. package/dist/common/product.pagination.instance.d.ts +22 -2
  65. package/dist/common/product.pagination.instance.js +22 -1
  66. package/dist/common/product.search.instance.d.ts +13 -3
  67. package/dist/common/product.search.instance.js +12 -1
  68. package/dist/common/user.instance.d.ts +27 -3
  69. package/dist/common/user.instance.js +28 -7
  70. package/dist/config/auth.constants.d.ts +11 -0
  71. package/dist/config/auth.constants.js +11 -0
  72. package/dist/config/compile.constants.d.ts +67 -0
  73. package/dist/config/compile.constants.js +99 -0
  74. package/dist/config/constants.d.ts +5 -0
  75. package/dist/config/constants.js +5 -0
  76. package/dist/config/dev.constants.d.ts +65 -0
  77. package/dist/config/dev.constants.js +79 -0
  78. package/dist/config/init.constants.d.ts +23 -0
  79. package/dist/config/init.constants.js +41 -0
  80. package/dist/index.d.ts +19 -3
  81. package/dist/index.js +28 -44
  82. package/dist/interfaces/admin.d.ts +56 -50
  83. package/dist/interfaces/admin.js +4 -0
  84. package/dist/interfaces/agent.d.ts +21 -0
  85. package/dist/interfaces/agent.js +4 -0
  86. package/dist/interfaces/baskets.d.ts +60 -0
  87. package/dist/interfaces/baskets.js +12 -0
  88. package/dist/interfaces/chat.d.ts +48 -4
  89. package/dist/interfaces/chat.js +4 -0
  90. package/dist/interfaces/common.d.ts +62 -0
  91. package/dist/interfaces/common.js +8 -0
  92. package/dist/interfaces/compile.d.ts +11 -0
  93. package/dist/interfaces/compile.js +4 -0
  94. package/dist/interfaces/custom.data.d.ts +49 -19
  95. package/dist/interfaces/custom.data.js +4 -0
  96. package/dist/interfaces/deploy.d.ts +29 -0
  97. package/dist/interfaces/deploy.js +4 -0
  98. package/dist/interfaces/dev.d.ts +53 -0
  99. package/dist/interfaces/dev.js +5 -0
  100. package/dist/interfaces/init.d.ts +60 -0
  101. package/dist/interfaces/init.js +4 -0
  102. package/dist/interfaces/orders.d.ts +37 -0
  103. package/dist/interfaces/orders.js +12 -0
  104. package/dist/interfaces/product.d.ts +38 -10
  105. package/dist/interfaces/product.js +4 -0
  106. package/dist/interfaces/push.d.ts +26 -0
  107. package/dist/interfaces/push.js +4 -0
  108. package/dist/interfaces/test.d.ts +36 -0
  109. package/dist/interfaces/test.js +4 -0
  110. package/dist/services/auth.d.ts +54 -99
  111. package/dist/services/auth.js +76 -12
  112. package/dist/types/api-contracts.d.ts +211 -0
  113. package/dist/types/api-contracts.js +8 -0
  114. package/dist/types/compile.types.d.ts +76 -0
  115. package/dist/types/compile.types.js +4 -0
  116. package/dist/types/index.d.ts +23 -121
  117. package/dist/types/index.js +25 -14
  118. package/dist/types/skill.d.ts +142 -0
  119. package/dist/{skill.js → types/skill.js} +66 -17
  120. package/dist/types/tool-validation.d.ts +34 -0
  121. package/dist/types/tool-validation.js +42 -0
  122. package/dist/utils/auth-flows.d.ts +26 -0
  123. package/dist/utils/auth-flows.js +141 -0
  124. package/dist/utils/bundling.d.ts +36 -0
  125. package/dist/utils/bundling.js +137 -0
  126. package/dist/utils/compile.d.ts +37 -0
  127. package/dist/utils/compile.js +242 -0
  128. package/dist/utils/deploy-api.d.ts +26 -0
  129. package/dist/utils/deploy-api.js +53 -0
  130. package/dist/utils/deploy-helpers.d.ts +46 -0
  131. package/dist/utils/deploy-helpers.js +86 -0
  132. package/dist/utils/deployment.d.ts +25 -0
  133. package/dist/utils/deployment.js +161 -0
  134. package/dist/utils/dev-api.d.ts +61 -0
  135. package/dist/utils/dev-api.js +262 -0
  136. package/dist/utils/dev-helpers.d.ts +46 -0
  137. package/dist/utils/dev-helpers.js +83 -0
  138. package/dist/utils/dev-server.d.ts +24 -0
  139. package/dist/utils/dev-server.js +555 -0
  140. package/dist/utils/dev-watcher.d.ts +31 -0
  141. package/dist/utils/dev-watcher.js +110 -0
  142. package/dist/utils/files.js +0 -5
  143. package/dist/utils/init-agent.d.ts +34 -0
  144. package/dist/utils/init-agent.js +129 -0
  145. package/dist/utils/init-helpers.d.ts +41 -0
  146. package/dist/utils/init-helpers.js +73 -0
  147. package/dist/utils/init-prompts.d.ts +47 -0
  148. package/dist/utils/init-prompts.js +168 -0
  149. package/dist/utils/push-api.d.ts +15 -0
  150. package/dist/utils/push-api.js +48 -0
  151. package/dist/utils/push-helpers.d.ts +38 -0
  152. package/dist/utils/push-helpers.js +84 -0
  153. package/dist/utils/sandbox-storage.d.ts +27 -0
  154. package/dist/utils/sandbox-storage.js +71 -0
  155. package/dist/utils/sandbox.js +78 -114
  156. package/dist/utils/skill-management.d.ts +14 -0
  157. package/dist/utils/skill-management.js +148 -0
  158. package/dist/utils/test-helpers.d.ts +40 -0
  159. package/dist/utils/test-helpers.js +92 -0
  160. package/dist/utils/test-prompts.d.ts +23 -0
  161. package/dist/utils/test-prompts.js +186 -0
  162. package/dist/utils/tool-detection.d.ts +18 -0
  163. package/dist/utils/tool-detection.js +110 -0
  164. package/dist/web/app.css +941 -17
  165. package/dist/web/app.js +174 -22
  166. package/dist/web/index.html +7 -1
  167. package/package.json +13 -4
  168. package/template/QUICKSTART.md +299 -144
  169. package/template/README.md +928 -349
  170. package/template/TOOL_EXAMPLES.md +655 -0
  171. package/template/package-lock.json +5 -5
  172. package/template/package.json +1 -1
  173. package/template/src/index.ts +147 -207
  174. package/template/src/tools/BasketTool.ts +128 -0
  175. package/template/src/tools/CustomDataTool.ts +7 -13
  176. package/template/src/tools/OrderTool.ts +54 -0
  177. package/template/src/tools/PaymentTool.ts +1 -1
  178. package/template/src/tools/ProductsTool.ts +56 -118
  179. package/template/src/tools/UserDataTool.ts +4 -26
  180. package/dist/common/config.d.ts +0 -5
  181. package/dist/common/config.js +0 -5
  182. package/dist/custom-data-api.d.ts +0 -72
  183. package/dist/custom-data-api.js +0 -174
  184. package/dist/product-api.d.ts +0 -189
  185. package/dist/product-api.js +0 -141
  186. package/dist/services/api.d.ts +0 -549
  187. package/dist/services/api.js +0 -596
  188. package/dist/skill.d.ts +0 -50
  189. package/dist/types.d.ts +0 -1
  190. package/dist/types.js +0 -2
  191. package/dist/user-data-api.d.ts +0 -39
  192. package/dist/user-data-api.js +0 -50
  193. package/template/API.md +0 -604
  194. package/template/DEVELOPER.md +0 -771
  195. package/template/lua.skill.yaml +0 -7
@@ -1 +1,25 @@
1
+ /**
2
+ * Configure Command
3
+ * Orchestrates the authentication setup process
4
+ */
5
+ /**
6
+ * Main configure command - sets up authentication credentials.
7
+ *
8
+ * This command performs the following steps:
9
+ * 1. Prompts user to choose authentication method (API key or email)
10
+ * 2. Executes the appropriate authentication flow
11
+ * 3. Saves credentials securely using keytar
12
+ *
13
+ * Authentication Methods:
14
+ * - **API Key**: Direct entry of existing API key
15
+ * - **Email**: OTP-based authentication that generates a new API key
16
+ *
17
+ * Features:
18
+ * - Secure credential storage via keytar
19
+ * - Email validation
20
+ * - OTP verification with retry logic
21
+ * - Automatic API key generation for email auth
22
+ *
23
+ * @returns Promise that resolves when configuration is complete
24
+ */
1
25
  export declare function configureCommand(): Promise<void>;
@@ -1,105 +1,40 @@
1
- import inquirer from "inquirer";
2
- import { saveApiKey, checkApiKey, requestEmailOTP, verifyOTPAndGetToken, generateApiKey } from "../services/auth.js";
3
- import { withErrorHandling, clearPromptLines, writeProgress, writeSuccess } from "../utils/cli.js";
1
+ /**
2
+ * Configure Command
3
+ * Orchestrates the authentication setup process
4
+ */
5
+ import { withErrorHandling, clearPromptLines } from "../utils/cli.js";
6
+ import { promptAuthMethod, handleApiKeyAuth, handleEmailAuth, } from "../utils/auth-flows.js";
7
+ /**
8
+ * Main configure command - sets up authentication credentials.
9
+ *
10
+ * This command performs the following steps:
11
+ * 1. Prompts user to choose authentication method (API key or email)
12
+ * 2. Executes the appropriate authentication flow
13
+ * 3. Saves credentials securely using keytar
14
+ *
15
+ * Authentication Methods:
16
+ * - **API Key**: Direct entry of existing API key
17
+ * - **Email**: OTP-based authentication that generates a new API key
18
+ *
19
+ * Features:
20
+ * - Secure credential storage via keytar
21
+ * - Email validation
22
+ * - OTP verification with retry logic
23
+ * - Automatic API key generation for email auth
24
+ *
25
+ * @returns Promise that resolves when configuration is complete
26
+ */
4
27
  export async function configureCommand() {
5
28
  return withErrorHandling(async () => {
6
- // Choose authentication method
7
- const { authMethod } = await inquirer.prompt([
8
- {
9
- type: "list",
10
- name: "authMethod",
11
- message: "Choose authentication method:",
12
- choices: [
13
- { name: "API Key", value: "api-key" },
14
- { name: "Email", value: "email" }
15
- ]
16
- }
17
- ]);
18
- // Clear the authentication method prompt lines
29
+ // Step 1: Choose authentication method
30
+ const authMethod = await promptAuthMethod();
19
31
  clearPromptLines(2);
32
+ // Step 2: Execute appropriate authentication flow
20
33
  if (authMethod === "api-key") {
21
- // Existing API key flow
22
- const answers = await inquirer.prompt([
23
- {
24
- type: "password",
25
- name: "apiKey",
26
- message: "Enter your API key",
27
- mask: "*",
28
- },
29
- ]);
30
- const data = await checkApiKey(answers.apiKey);
31
- if (!data) {
32
- console.error("❌ Invalid API key");
33
- process.exit(1);
34
- }
35
- await saveApiKey(answers.apiKey);
36
- writeSuccess("✅ API key saved securely.");
34
+ await handleApiKeyAuth();
37
35
  }
38
36
  else if (authMethod === "email") {
39
- // Email authentication flow
40
- const { email } = await inquirer.prompt([
41
- {
42
- type: "input",
43
- name: "email",
44
- message: "Enter your email address:",
45
- validate: (input) => {
46
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
47
- return emailRegex.test(input) || "Please enter a valid email address";
48
- }
49
- }
50
- ]);
51
- // Clear the email prompt lines
52
- clearPromptLines(2);
53
- writeProgress("📧 Sending OTP to your email...");
54
- const otpSent = await requestEmailOTP(email);
55
- if (!otpSent) {
56
- console.error("❌ Failed to send OTP. Please try again.");
57
- process.exit(1);
58
- }
59
- writeProgress("✅ OTP sent successfully!");
60
- // OTP verification with retry logic
61
- let otpVerified = false;
62
- let attempts = 0;
63
- let signInToken = null;
64
- const maxAttempts = 3;
65
- while (!otpVerified && attempts < maxAttempts) {
66
- const { pin } = await inquirer.prompt([
67
- {
68
- type: "input",
69
- name: "pin",
70
- message: "Enter the OTP code:",
71
- validate: (input) => {
72
- return input.length === 6 || "OTP must be 6 digits";
73
- }
74
- }
75
- ]);
76
- // Clear the OTP prompt lines
77
- clearPromptLines(2);
78
- writeProgress("🔐 Verifying OTP...");
79
- signInToken = await verifyOTPAndGetToken(email, pin);
80
- if (signInToken) {
81
- otpVerified = true;
82
- writeProgress("✅ OTP verified successfully!");
83
- writeProgress("🔑 Generating API key...");
84
- }
85
- else {
86
- attempts++;
87
- if (attempts < maxAttempts) {
88
- console.log(`❌ Invalid OTP. ${maxAttempts - attempts} attempts remaining.`);
89
- }
90
- else {
91
- console.error("❌ Invalid OTP. Maximum attempts reached. Please try again later.");
92
- process.exit(1);
93
- }
94
- }
95
- }
96
- const apiKey = await generateApiKey(signInToken);
97
- if (!apiKey) {
98
- console.error("❌ Failed to generate API key. Please try again.");
99
- process.exit(1);
100
- }
101
- await saveApiKey(apiKey);
102
- writeSuccess("✅ API key generated and saved securely.");
37
+ await handleEmailAuth();
103
38
  }
104
39
  }, "configuration");
105
40
  }
@@ -1,20 +1,32 @@
1
- export interface VersionInfo {
2
- version: string;
3
- createdDate: string;
4
- createdBy: string;
5
- isCurrent: boolean;
6
- createdByEmail: string;
7
- createdByFullName: string;
8
- }
9
- export interface VersionsResponse {
10
- versions: VersionInfo[];
11
- }
12
- export interface PublishResponse {
13
- message: string;
14
- skillId: string;
15
- activeVersionId: string;
16
- publishedAt: string;
17
- }
18
- export declare function fetchVersions(apiKey: string, agentId: string, skillId: string): Promise<VersionsResponse>;
19
- export declare function publishVersion(apiKey: string, agentId: string, skillId: string, version: string): Promise<PublishResponse>;
1
+ /**
2
+ * Deploy Command
3
+ * Orchestrates deployment of skill versions to production
4
+ */
5
+ /**
6
+ * Main deploy command - deploys a skill version to production.
7
+ *
8
+ * This command performs the following steps:
9
+ * 1. Validates configuration has required fields
10
+ * 2. Authenticates the user
11
+ * 3. Fetches available versions from server
12
+ * 4. Prompts user to select a version
13
+ * 5. Shows warning and requests confirmation
14
+ * 6. Publishes selected version to production
15
+ *
16
+ * Features:
17
+ * - Lists all available versions with metadata
18
+ * - Shows which version is currently deployed
19
+ * - Sorts versions by date (newest first)
20
+ * - Requires explicit confirmation before deployment
21
+ * - Safety warning about production deployment
22
+ *
23
+ * Use this command to:
24
+ * - Deploy a tested version to production
25
+ * - Make your skill available to all users
26
+ * - Roll back to a previous version
27
+ *
28
+ * ⚠️ WARNING: This deploys to ALL users immediately!
29
+ *
30
+ * @returns Promise that resolves when deployment completes
31
+ */
20
32
  export declare function deployCommand(): Promise<void>;
@@ -1,95 +1,66 @@
1
- import inquirer from 'inquirer';
1
+ /**
2
+ * Deploy Command
3
+ * Orchestrates deployment of skill versions to production
4
+ */
2
5
  import { loadApiKey, checkApiKey } from '../services/auth.js';
3
- import { ApiService } from '../services/api.js';
4
6
  import { readSkillConfig } from '../utils/files.js';
5
- import { withErrorHandling, clearPromptLines, writeProgress, writeSuccess } from '../utils/cli.js';
6
- export async function fetchVersions(apiKey, agentId, skillId) {
7
- try {
8
- const response = await ApiService.Skill.getSkillVersions(apiKey, agentId, skillId);
9
- if (!response.success) {
10
- throw new Error(`Failed to fetch versions: ${response.error?.message || 'Unknown error'}`);
11
- }
12
- return response.data;
13
- }
14
- catch (error) {
15
- console.error("❌ Error fetching versions:", error);
16
- throw error;
17
- }
18
- }
19
- export async function publishVersion(apiKey, agentId, skillId, version) {
20
- try {
21
- const response = await ApiService.Skill.publishSkillVersion(apiKey, agentId, skillId, version);
22
- if (!response.success) {
23
- throw new Error(`Failed to publish version: ${response.error?.message || 'Unknown error'}`);
24
- }
25
- return response.data;
26
- }
27
- catch (error) {
28
- console.error("❌ Error publishing version:", error);
29
- throw error;
30
- }
31
- }
32
- function formatVersionChoice(version) {
33
- const currentIndicator = version.isCurrent ? ' (CURRENT)' : '';
34
- const date = new Date(version.createdDate).toLocaleDateString();
35
- return `${version.version}${currentIndicator} - Created: ${date} by ${version.createdByEmail}`;
36
- }
7
+ import { withErrorHandling, writeProgress, writeSuccess } from '../utils/cli.js';
8
+ import { sortVersionsByDate, promptVersionSelection, confirmDeployment, validateDeployConfig, validateVersionsAvailable, } from '../utils/deploy-helpers.js';
9
+ import { fetchVersions, publishVersion } from '../utils/deploy-api.js';
10
+ /**
11
+ * Main deploy command - deploys a skill version to production.
12
+ *
13
+ * This command performs the following steps:
14
+ * 1. Validates configuration has required fields
15
+ * 2. Authenticates the user
16
+ * 3. Fetches available versions from server
17
+ * 4. Prompts user to select a version
18
+ * 5. Shows warning and requests confirmation
19
+ * 6. Publishes selected version to production
20
+ *
21
+ * Features:
22
+ * - Lists all available versions with metadata
23
+ * - Shows which version is currently deployed
24
+ * - Sorts versions by date (newest first)
25
+ * - Requires explicit confirmation before deployment
26
+ * - Safety warning about production deployment
27
+ *
28
+ * Use this command to:
29
+ * - Deploy a tested version to production
30
+ * - Make your skill available to all users
31
+ * - Roll back to a previous version
32
+ *
33
+ * ⚠️ WARNING: This deploys to ALL users immediately!
34
+ *
35
+ * @returns Promise that resolves when deployment completes
36
+ */
37
37
  export async function deployCommand() {
38
38
  return withErrorHandling(async () => {
39
- // Check if we're in a skill directory
39
+ // Step 1: Validate configuration
40
40
  const config = readSkillConfig();
41
- if (!config || !config.agent?.agentId || !config.skill?.skillId) {
42
- console.error("❌ No lua.skill.yaml found or missing agentId/skillId. Please run this command from a skill directory.");
43
- process.exit(1);
44
- }
45
- // Load API key
41
+ validateDeployConfig(config);
42
+ // Step 2: Authenticate
46
43
  const apiKey = await loadApiKey();
47
44
  if (!apiKey) {
48
45
  console.error("❌ No API key found. Please run 'lua auth configure' to set up your API key.");
49
46
  process.exit(1);
50
47
  }
51
- // Validate API key
52
48
  const userData = await checkApiKey(apiKey);
53
49
  writeProgress("✅ Authenticated");
54
- // Fetch available versions
50
+ // Step 3: Fetch available versions
55
51
  writeProgress("🔄 Fetching available versions...");
56
52
  const versionsResponse = await fetchVersions(apiKey, config.agent.agentId, config.skill.skillId);
57
- if (!versionsResponse.versions || versionsResponse.versions.length === 0) {
58
- console.log("❌ No versions found for this skill.");
59
- process.exit(1);
60
- }
61
- // Sort versions by creation date (newest first)
62
- const sortedVersions = versionsResponse.versions.sort((a, b) => new Date(b.createdDate).getTime() - new Date(a.createdDate).getTime());
63
- // Let user select a version
64
- const { selectedVersion } = await inquirer.prompt([
65
- {
66
- type: "list",
67
- name: "selectedVersion",
68
- message: "Select a version to deploy:",
69
- choices: sortedVersions.map(version => ({
70
- name: formatVersionChoice(version),
71
- value: version.version
72
- }))
73
- }
74
- ]);
75
- // Clear the selection prompt lines
76
- clearPromptLines(2);
77
- // Show warning and confirm deployment
78
- const { confirmed } = await inquirer.prompt([
79
- {
80
- type: "confirm",
81
- name: "confirmed",
82
- message: "⚠️ Warning: This version will be deployed to all users. Do you want to proceed?",
83
- default: false
84
- }
85
- ]);
86
- // Clear the confirmation prompt lines
87
- clearPromptLines(2);
53
+ validateVersionsAvailable(versionsResponse.versions);
54
+ // Step 4: Sort and display versions
55
+ const sortedVersions = sortVersionsByDate(versionsResponse.versions);
56
+ const selectedVersion = await promptVersionSelection(sortedVersions);
57
+ // Step 5: Confirm deployment
58
+ const confirmed = await confirmDeployment();
88
59
  if (!confirmed) {
89
60
  console.log("❌ Deployment cancelled.");
90
61
  process.exit(0);
91
62
  }
92
- // Publish the selected version
63
+ // Step 6: Publish the selected version
93
64
  writeProgress("🔄 Publishing version...");
94
65
  const publishResponse = await publishVersion(apiKey, config.agent.agentId, config.skill.skillId, selectedVersion);
95
66
  writeSuccess(`✅ Version ${publishResponse.activeVersionId} deployed successfully`);
@@ -1 +1,28 @@
1
+ /**
2
+ * Destroy Command
3
+ * Securely deletes stored authentication credentials
4
+ */
5
+ /**
6
+ * Main destroy command - deletes stored API key with confirmation.
7
+ *
8
+ * This command:
9
+ * 1. Checks if an API key exists
10
+ * 2. Prompts for confirmation before deletion
11
+ * 3. Deletes the API key from secure storage if confirmed
12
+ *
13
+ * Security:
14
+ * - Requires explicit confirmation to prevent accidental deletion
15
+ * - Action cannot be undone (must reconfigure to use CLI again)
16
+ *
17
+ * Use this command to:
18
+ * - Log out of the CLI
19
+ * - Remove credentials from your machine
20
+ * - Switch to a different API key
21
+ *
22
+ * After running this command:
23
+ * - You will need to run `lua auth configure` again to use the CLI
24
+ * - Your API key remains valid on the server (only local storage is cleared)
25
+ *
26
+ * @returns Promise that resolves when command completes
27
+ */
1
28
  export declare function destroyCommand(): Promise<void>;
@@ -1,6 +1,33 @@
1
+ /**
2
+ * Destroy Command
3
+ * Securely deletes stored authentication credentials
4
+ */
1
5
  import inquirer from "inquirer";
2
6
  import { loadApiKey, deleteApiKey } from "../services/auth.js";
3
7
  import { withErrorHandling, clearPromptLines, writeProgress, writeSuccess } from "../utils/cli.js";
8
+ /**
9
+ * Main destroy command - deletes stored API key with confirmation.
10
+ *
11
+ * This command:
12
+ * 1. Checks if an API key exists
13
+ * 2. Prompts for confirmation before deletion
14
+ * 3. Deletes the API key from secure storage if confirmed
15
+ *
16
+ * Security:
17
+ * - Requires explicit confirmation to prevent accidental deletion
18
+ * - Action cannot be undone (must reconfigure to use CLI again)
19
+ *
20
+ * Use this command to:
21
+ * - Log out of the CLI
22
+ * - Remove credentials from your machine
23
+ * - Switch to a different API key
24
+ *
25
+ * After running this command:
26
+ * - You will need to run `lua auth configure` again to use the CLI
27
+ * - Your API key remains valid on the server (only local storage is cleared)
28
+ *
29
+ * @returns Promise that resolves when command completes
30
+ */
4
31
  export async function destroyCommand() {
5
32
  return withErrorHandling(async () => {
6
33
  const apiKey = await loadApiKey();
@@ -16,7 +43,6 @@ export async function destroyCommand() {
16
43
  default: false
17
44
  }
18
45
  ]);
19
- // Clear the confirmation prompt lines
20
46
  clearPromptLines(2);
21
47
  if (confirm) {
22
48
  const deleted = await deleteApiKey();
@@ -1,63 +1,26 @@
1
- export interface DevVersionResponse {
2
- success: boolean;
3
- data?: {
4
- message: string;
5
- skillId: string;
6
- version: string;
7
- publishedAt: string;
8
- };
9
- error?: {
10
- message: string;
11
- error: string;
12
- statusCode: number;
13
- };
14
- }
15
- export interface UpdateDevVersionResponse {
16
- success: boolean;
17
- data?: {
18
- message: string;
19
- skillId: string;
20
- version: string;
21
- updatedAt: string;
22
- };
23
- error?: {
24
- message: string;
25
- error: string;
26
- statusCode: number;
27
- };
28
- }
29
- export interface ChatMessage {
30
- type: "text";
31
- text: string;
32
- }
33
- export interface ChatRequest {
34
- messages: ChatMessage[];
35
- navigate: boolean;
36
- skillOverride: Array<{
37
- skillId: string;
38
- sandboxId: string;
39
- }>;
40
- personaOverride?: string;
41
- }
42
- export interface ChatResponse {
43
- text: string;
44
- files: any[];
45
- reasoningDetails: any[];
46
- toolCalls: any[];
47
- toolResults: any[];
48
- finishReason: string;
49
- usage: {
50
- promptTokens: number;
51
- completionTokens: number;
52
- totalTokens: number;
53
- };
54
- warnings: any[];
55
- request: any;
56
- response: any;
57
- steps: any[];
58
- sources: any[];
59
- }
60
- export declare function sendChatMessage(apiKey: string, agentId: string, skillId: string, sandboxId: string, message: string, persona?: string): Promise<string | null>;
61
- export declare function updateDevVersion(apiKey: string, agentId: string, skillId: string, sandboxVersionId: string, versionData: any): Promise<UpdateDevVersionResponse>;
62
- export declare function pushDevVersion(apiKey: string, agentId: string, skillId: string, versionData: any): Promise<DevVersionResponse>;
1
+ /**
2
+ * Dev Command
3
+ * Orchestrates the development mode with live reloading, chat interface, and tool testing
4
+ */
5
+ /**
6
+ * Main dev command - starts development mode with live reloading.
7
+ *
8
+ * This command performs the following steps:
9
+ * 1. Validates configuration and authentication
10
+ * 2. Compiles the skill
11
+ * 3. Pushes all skills to sandbox environment
12
+ * 4. Starts web server with chat interface and tool testing
13
+ * 5. Opens browser to chat interface
14
+ * 6. Watches for file changes and auto-recompiles
15
+ *
16
+ * Features:
17
+ * - Live chat interface for testing skills
18
+ * - Real-time tool testing with WebSocket log streaming
19
+ * - Automatic recompilation and push on file changes
20
+ * - Environment variable management
21
+ * - Persona configuration
22
+ * - Multi-skill support
23
+ *
24
+ * @returns Promise that resolves when dev mode is stopped (never resolves normally)
25
+ */
63
26
  export declare function devCommand(): Promise<void>;