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.
- package/API_REFERENCE.md +1408 -0
- package/CLI_REFERENCE.md +818 -0
- package/GETTING_STARTED.md +1040 -0
- package/README.md +738 -424
- package/TEMPLATE_GUIDE.md +1398 -0
- package/dist/api/agent.api.service.d.ts +33 -6
- package/dist/api/agent.api.service.js +27 -0
- package/dist/api/auth.api.service.d.ts +31 -2
- package/dist/api/auth.api.service.js +29 -0
- package/dist/api/basket.api.service.d.ts +53 -11
- package/dist/api/basket.api.service.js +63 -14
- package/dist/api/chat.api.service.d.ts +15 -3
- package/dist/api/chat.api.service.js +12 -0
- package/dist/api/credentials.d.ts +24 -0
- package/dist/api/credentials.js +46 -0
- package/dist/api/custom.data.api.service.d.ts +45 -9
- package/dist/api/custom.data.api.service.js +43 -9
- package/dist/api/lazy-instances.d.ts +49 -0
- package/dist/api/lazy-instances.js +95 -0
- package/dist/api/order.api.service.d.ts +34 -4
- package/dist/api/order.api.service.js +41 -3
- package/dist/api/products.api.service.d.ts +39 -9
- package/dist/api/products.api.service.js +43 -5
- package/dist/api/skills.api.service.d.ts +49 -2
- package/dist/api/skills.api.service.js +47 -1
- package/dist/api/tool.api.service.d.ts +39 -1
- package/dist/api/tool.api.service.js +38 -0
- package/dist/api/user.data.api.service.d.ts +23 -1
- package/dist/api/user.data.api.service.js +22 -0
- package/dist/api-exports.d.ts +236 -5
- package/dist/api-exports.js +264 -81
- package/dist/cli/command-definitions.d.ts +30 -0
- package/dist/cli/command-definitions.js +71 -0
- package/dist/commands/agents.d.ts +20 -0
- package/dist/commands/agents.js +24 -2
- package/dist/commands/apiKey.d.ts +23 -0
- package/dist/commands/apiKey.js +23 -0
- package/dist/commands/compile.d.ts +24 -0
- package/dist/commands/compile.js +67 -759
- package/dist/commands/configure.d.ts +24 -0
- package/dist/commands/configure.js +31 -96
- package/dist/commands/deploy.d.ts +31 -19
- package/dist/commands/deploy.js +45 -74
- package/dist/commands/destroy.d.ts +27 -0
- package/dist/commands/destroy.js +27 -1
- package/dist/commands/dev.d.ts +25 -62
- package/dist/commands/dev.js +58 -878
- package/dist/commands/init.d.ts +27 -0
- package/dist/commands/init.js +98 -260
- package/dist/commands/push.d.ts +24 -21
- package/dist/commands/push.js +39 -92
- package/dist/commands/test.d.ts +26 -0
- package/dist/commands/test.js +41 -188
- package/dist/common/basket.instance.d.ts +54 -3
- package/dist/common/basket.instance.js +56 -3
- package/dist/common/data.entry.instance.d.ts +25 -2
- package/dist/common/data.entry.instance.js +24 -0
- package/dist/common/http.client.d.ts +51 -1
- package/dist/common/http.client.js +50 -0
- package/dist/common/order.instance.d.ts +22 -0
- package/dist/common/order.instance.js +31 -4
- package/dist/common/product.instance.d.ts +22 -1
- package/dist/common/product.instance.js +24 -6
- package/dist/common/product.pagination.instance.d.ts +22 -2
- package/dist/common/product.pagination.instance.js +22 -1
- package/dist/common/product.search.instance.d.ts +13 -3
- package/dist/common/product.search.instance.js +12 -1
- package/dist/common/user.instance.d.ts +27 -3
- package/dist/common/user.instance.js +28 -7
- package/dist/config/auth.constants.d.ts +11 -0
- package/dist/config/auth.constants.js +11 -0
- package/dist/config/compile.constants.d.ts +67 -0
- package/dist/config/compile.constants.js +99 -0
- package/dist/config/constants.d.ts +5 -0
- package/dist/config/constants.js +5 -0
- package/dist/config/dev.constants.d.ts +65 -0
- package/dist/config/dev.constants.js +79 -0
- package/dist/config/init.constants.d.ts +23 -0
- package/dist/config/init.constants.js +41 -0
- package/dist/index.d.ts +19 -3
- package/dist/index.js +28 -44
- package/dist/interfaces/admin.d.ts +56 -50
- package/dist/interfaces/admin.js +4 -0
- package/dist/interfaces/agent.d.ts +21 -0
- package/dist/interfaces/agent.js +4 -0
- package/dist/interfaces/baskets.d.ts +60 -0
- package/dist/interfaces/baskets.js +12 -0
- package/dist/interfaces/chat.d.ts +48 -4
- package/dist/interfaces/chat.js +4 -0
- package/dist/interfaces/common.d.ts +62 -0
- package/dist/interfaces/common.js +8 -0
- package/dist/interfaces/compile.d.ts +11 -0
- package/dist/interfaces/compile.js +4 -0
- package/dist/interfaces/custom.data.d.ts +49 -19
- package/dist/interfaces/custom.data.js +4 -0
- package/dist/interfaces/deploy.d.ts +29 -0
- package/dist/interfaces/deploy.js +4 -0
- package/dist/interfaces/dev.d.ts +53 -0
- package/dist/interfaces/dev.js +5 -0
- package/dist/interfaces/init.d.ts +60 -0
- package/dist/interfaces/init.js +4 -0
- package/dist/interfaces/orders.d.ts +37 -0
- package/dist/interfaces/orders.js +12 -0
- package/dist/interfaces/product.d.ts +38 -10
- package/dist/interfaces/product.js +4 -0
- package/dist/interfaces/push.d.ts +26 -0
- package/dist/interfaces/push.js +4 -0
- package/dist/interfaces/test.d.ts +36 -0
- package/dist/interfaces/test.js +4 -0
- package/dist/services/auth.d.ts +54 -99
- package/dist/services/auth.js +76 -12
- package/dist/types/api-contracts.d.ts +211 -0
- package/dist/types/api-contracts.js +8 -0
- package/dist/types/compile.types.d.ts +76 -0
- package/dist/types/compile.types.js +4 -0
- package/dist/types/index.d.ts +23 -121
- package/dist/types/index.js +25 -14
- package/dist/types/skill.d.ts +142 -0
- package/dist/{skill.js → types/skill.js} +66 -17
- package/dist/types/tool-validation.d.ts +34 -0
- package/dist/types/tool-validation.js +42 -0
- package/dist/utils/auth-flows.d.ts +26 -0
- package/dist/utils/auth-flows.js +141 -0
- package/dist/utils/bundling.d.ts +36 -0
- package/dist/utils/bundling.js +137 -0
- package/dist/utils/compile.d.ts +37 -0
- package/dist/utils/compile.js +242 -0
- package/dist/utils/deploy-api.d.ts +26 -0
- package/dist/utils/deploy-api.js +53 -0
- package/dist/utils/deploy-helpers.d.ts +46 -0
- package/dist/utils/deploy-helpers.js +86 -0
- package/dist/utils/deployment.d.ts +25 -0
- package/dist/utils/deployment.js +161 -0
- package/dist/utils/dev-api.d.ts +61 -0
- package/dist/utils/dev-api.js +262 -0
- package/dist/utils/dev-helpers.d.ts +46 -0
- package/dist/utils/dev-helpers.js +83 -0
- package/dist/utils/dev-server.d.ts +24 -0
- package/dist/utils/dev-server.js +555 -0
- package/dist/utils/dev-watcher.d.ts +31 -0
- package/dist/utils/dev-watcher.js +110 -0
- package/dist/utils/files.js +0 -5
- package/dist/utils/init-agent.d.ts +34 -0
- package/dist/utils/init-agent.js +129 -0
- package/dist/utils/init-helpers.d.ts +41 -0
- package/dist/utils/init-helpers.js +73 -0
- package/dist/utils/init-prompts.d.ts +47 -0
- package/dist/utils/init-prompts.js +168 -0
- package/dist/utils/push-api.d.ts +15 -0
- package/dist/utils/push-api.js +48 -0
- package/dist/utils/push-helpers.d.ts +38 -0
- package/dist/utils/push-helpers.js +84 -0
- package/dist/utils/sandbox-storage.d.ts +27 -0
- package/dist/utils/sandbox-storage.js +71 -0
- package/dist/utils/sandbox.js +78 -114
- package/dist/utils/skill-management.d.ts +14 -0
- package/dist/utils/skill-management.js +148 -0
- package/dist/utils/test-helpers.d.ts +40 -0
- package/dist/utils/test-helpers.js +92 -0
- package/dist/utils/test-prompts.d.ts +23 -0
- package/dist/utils/test-prompts.js +186 -0
- package/dist/utils/tool-detection.d.ts +18 -0
- package/dist/utils/tool-detection.js +110 -0
- package/dist/web/app.css +941 -17
- package/dist/web/app.js +174 -22
- package/dist/web/index.html +7 -1
- package/package.json +13 -4
- package/template/QUICKSTART.md +299 -144
- package/template/README.md +928 -349
- package/template/TOOL_EXAMPLES.md +655 -0
- package/template/package-lock.json +5 -5
- package/template/package.json +1 -1
- package/template/src/index.ts +147 -207
- package/template/src/tools/BasketTool.ts +128 -0
- package/template/src/tools/CustomDataTool.ts +7 -13
- package/template/src/tools/OrderTool.ts +54 -0
- package/template/src/tools/PaymentTool.ts +1 -1
- package/template/src/tools/ProductsTool.ts +56 -118
- package/template/src/tools/UserDataTool.ts +4 -26
- package/dist/common/config.d.ts +0 -5
- package/dist/common/config.js +0 -5
- package/dist/custom-data-api.d.ts +0 -72
- package/dist/custom-data-api.js +0 -174
- package/dist/product-api.d.ts +0 -189
- package/dist/product-api.js +0 -141
- package/dist/services/api.d.ts +0 -549
- package/dist/services/api.js +0 -596
- package/dist/skill.d.ts +0 -50
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -2
- package/dist/user-data-api.d.ts +0 -39
- package/dist/user-data-api.js +0 -50
- package/template/API.md +0 -604
- package/template/DEVELOPER.md +0 -771
- 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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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>;
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,95 +1,66 @@
|
|
|
1
|
-
|
|
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,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
//
|
|
39
|
+
// Step 1: Validate configuration
|
|
40
40
|
const config = readSkillConfig();
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
const
|
|
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>;
|
package/dist/commands/destroy.js
CHANGED
|
@@ -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();
|
package/dist/commands/dev.d.ts
CHANGED
|
@@ -1,63 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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>;
|