lua-cli 3.2.0 ā 3.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/dist/api/logs.api.service.d.ts +1 -1
- package/dist/api/logs.api.service.js.map +1 -1
- package/dist/api/products.api.service.d.ts +17 -5
- package/dist/api/products.api.service.js +21 -9
- package/dist/api/products.api.service.js.map +1 -1
- package/dist/api-exports.d.ts +17 -5
- package/dist/api-exports.js +20 -5
- package/dist/api-exports.js.map +1 -1
- package/dist/cli/command-definitions.js +320 -88
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/apiKey.d.ts +5 -2
- package/dist/commands/apiKey.js +8 -2
- package/dist/commands/apiKey.js.map +1 -1
- package/dist/commands/channels.d.ts +4 -9
- package/dist/commands/channels.js +140 -84
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.d.ts +4 -2
- package/dist/commands/chat.js +126 -32
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/chatClear.d.ts +3 -2
- package/dist/commands/chatClear.js +16 -15
- package/dist/commands/chatClear.js.map +1 -1
- package/dist/commands/compile.js +67 -4
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/deploy.d.ts +5 -24
- package/dist/commands/deploy.js +75 -48
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/destroy.d.ts +5 -2
- package/dist/commands/destroy.js +14 -2
- package/dist/commands/destroy.js.map +1 -1
- package/dist/commands/env.d.ts +3 -1
- package/dist/commands/env.js +322 -122
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/features.d.ts +5 -9
- package/dist/commands/features.js +249 -129
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/init.d.ts +7 -1
- package/dist/commands/init.js +242 -59
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/jobs.d.ts +5 -13
- package/dist/commands/jobs.js +449 -364
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/logs.d.ts +5 -10
- package/dist/commands/logs.js +259 -103
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/marketplace.d.ts +23 -2
- package/dist/commands/marketplace.js +530 -7
- package/dist/commands/marketplace.js.map +1 -1
- package/dist/commands/mcp.d.ts +5 -11
- package/dist/commands/mcp.js +303 -288
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/persona.d.ts +5 -9
- package/dist/commands/persona.js +349 -232
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/postprocessors.d.ts +6 -2
- package/dist/commands/postprocessors.js +387 -280
- package/dist/commands/postprocessors.js.map +1 -1
- package/dist/commands/preprocessors.d.ts +6 -2
- package/dist/commands/preprocessors.js +387 -280
- package/dist/commands/preprocessors.js.map +1 -1
- package/dist/commands/production.d.ts +5 -8
- package/dist/commands/production.js +317 -228
- package/dist/commands/production.js.map +1 -1
- package/dist/commands/push.js +385 -427
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/resources.d.ts +5 -10
- package/dist/commands/resources.js +219 -154
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/skills.d.ts +5 -9
- package/dist/commands/skills.js +354 -277
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/sync.d.ts +10 -8
- package/dist/commands/sync.js +110 -19
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/test.d.ts +1 -11
- package/dist/commands/test.js +395 -438
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/webhooks.d.ts +5 -11
- package/dist/commands/webhooks.js +356 -290
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/interfaces/mcp.d.ts +28 -1
- package/dist/interfaces/product.d.ts +26 -0
- package/dist/types/api-contracts.d.ts +8 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/skill.d.ts +92 -17
- package/dist/types/skill.js +15 -11
- package/dist/types/skill.js.map +1 -1
- package/dist/utils/bundling.d.ts +17 -0
- package/dist/utils/bundling.js +96 -0
- package/dist/utils/bundling.js.map +1 -1
- package/dist/utils/compile.d.ts +4 -0
- package/dist/utils/compile.js +5 -0
- package/dist/utils/compile.js.map +1 -1
- package/dist/utils/dev-helpers.d.ts +3 -2
- package/dist/utils/dev-helpers.js +3 -5
- package/dist/utils/dev-helpers.js.map +1 -1
- package/dist/utils/mcp-server-management.d.ts +1 -1
- package/dist/utils/mcp-server-management.js +13 -14
- package/dist/utils/mcp-server-management.js.map +1 -1
- package/package.json +1 -1
- package/template/package.json +1 -1
|
@@ -8,17 +8,17 @@ import { withErrorHandling, writeProgress, writeSuccess } from '../utils/cli.js'
|
|
|
8
8
|
import { BASE_URLS } from '../config/constants.js';
|
|
9
9
|
import { safePrompt } from '../utils/prompt-handler.js';
|
|
10
10
|
import { validateConfig, validateAgentConfig, } from '../utils/dev-helpers.js';
|
|
11
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
12
|
+
// Main Command Entry
|
|
13
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
11
14
|
/**
|
|
12
|
-
* Main production command - overview of production environment
|
|
15
|
+
* Main production command - overview of production environment.
|
|
13
16
|
*
|
|
14
|
-
*
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
* - Manage environment variables
|
|
18
|
-
*
|
|
19
|
-
* @returns Promise that resolves when command completes
|
|
17
|
+
* Supports both interactive and non-interactive modes:
|
|
18
|
+
* - Interactive: menu-driven management
|
|
19
|
+
* - Non-interactive: use action argument to display specific section
|
|
20
20
|
*/
|
|
21
|
-
export async function productionCommand() {
|
|
21
|
+
export async function productionCommand(action) {
|
|
22
22
|
return withErrorHandling(async () => {
|
|
23
23
|
// Step 1: Load configuration
|
|
24
24
|
const config = readSkillConfig();
|
|
@@ -37,57 +37,22 @@ export async function productionCommand() {
|
|
|
37
37
|
agentId,
|
|
38
38
|
apiKey,
|
|
39
39
|
};
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Main production management loop
|
|
46
|
-
*/
|
|
47
|
-
async function manageProduction(context, config) {
|
|
48
|
-
let continueManaging = true;
|
|
49
|
-
while (continueManaging) {
|
|
50
|
-
console.log("\n" + "=".repeat(60));
|
|
51
|
-
console.log("š Production Environment");
|
|
52
|
-
console.log("=".repeat(60) + "\n");
|
|
53
|
-
const actionAnswer = await safePrompt([
|
|
54
|
-
{
|
|
55
|
-
type: 'list',
|
|
56
|
-
name: 'action',
|
|
57
|
-
message: 'What would you like to view?',
|
|
58
|
-
choices: [
|
|
59
|
-
{ name: 'š¤ Persona - View current persona and versions', value: 'persona' },
|
|
60
|
-
{ name: 'āļø Skills - View deployed skills and versions', value: 'skills' },
|
|
61
|
-
{ name: 'š Environment Variables - Manage production env', value: 'env' },
|
|
62
|
-
{ name: 'ā Exit', value: 'exit' }
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
]);
|
|
66
|
-
if (!actionAnswer)
|
|
67
|
-
return;
|
|
68
|
-
const { action } = actionAnswer;
|
|
69
|
-
switch (action) {
|
|
70
|
-
case 'persona':
|
|
71
|
-
await viewProductionPersona(context);
|
|
72
|
-
break;
|
|
73
|
-
case 'skills':
|
|
74
|
-
await viewProductionSkills(context, config);
|
|
75
|
-
break;
|
|
76
|
-
case 'env':
|
|
77
|
-
await manageProductionEnv(context);
|
|
78
|
-
break;
|
|
79
|
-
case 'exit':
|
|
80
|
-
continueManaging = false;
|
|
81
|
-
console.log("\nš Goodbye!\n");
|
|
82
|
-
break;
|
|
40
|
+
// Determine mode
|
|
41
|
+
if (action) {
|
|
42
|
+
await executeNonInteractive(context, config, action);
|
|
83
43
|
}
|
|
84
|
-
|
|
44
|
+
else {
|
|
45
|
+
await manageProductionInteractive(context, config);
|
|
46
|
+
}
|
|
47
|
+
}, "production");
|
|
85
48
|
}
|
|
49
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
50
|
+
// Shared Core Functions
|
|
51
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
86
52
|
/**
|
|
87
|
-
*
|
|
53
|
+
* Fetches persona versions from the API.
|
|
88
54
|
*/
|
|
89
|
-
async function
|
|
90
|
-
writeProgress("š Loading persona information...");
|
|
55
|
+
async function fetchPersonaVersionsCore(context) {
|
|
91
56
|
try {
|
|
92
57
|
const response = await fetch(`${BASE_URLS.API}/developer/agents/${context.agentId}/persona/versions`, {
|
|
93
58
|
method: 'GET',
|
|
@@ -98,8 +63,8 @@ async function viewProductionPersona(context) {
|
|
|
98
63
|
});
|
|
99
64
|
if (!response.ok) {
|
|
100
65
|
const errorText = await response.text();
|
|
101
|
-
console.error(
|
|
102
|
-
|
|
66
|
+
console.error(`ā API Error: ${response.status} - ${errorText}`);
|
|
67
|
+
return null;
|
|
103
68
|
}
|
|
104
69
|
const data = await response.json();
|
|
105
70
|
let versions = [];
|
|
@@ -112,146 +77,322 @@ async function viewProductionPersona(context) {
|
|
|
112
77
|
else if (data.versions && Array.isArray(data.versions)) {
|
|
113
78
|
versions = data.versions;
|
|
114
79
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
80
|
+
return versions;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.error('ā Error loading persona information:', error);
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Displays current persona information.
|
|
89
|
+
*/
|
|
90
|
+
function displayPersonaCore(versions) {
|
|
91
|
+
const currentVersion = versions.find(v => v.isCurrent);
|
|
92
|
+
console.log("\n" + "=".repeat(60));
|
|
93
|
+
console.log("š¤ Current Production Persona");
|
|
94
|
+
console.log("=".repeat(60) + "\n");
|
|
95
|
+
if (currentVersion) {
|
|
96
|
+
const date = new Date(currentVersion.createdDate);
|
|
97
|
+
console.log(`Version: ${currentVersion.version} ā`);
|
|
98
|
+
console.log(`Deployed: ${date.toLocaleString()}`);
|
|
99
|
+
if (currentVersion.createdBy) {
|
|
100
|
+
console.log(`Created by: ${currentVersion.createdBy}`);
|
|
126
101
|
}
|
|
127
|
-
|
|
128
|
-
|
|
102
|
+
console.log("\n" + "-".repeat(60) + "\n");
|
|
103
|
+
console.log(currentVersion.persona);
|
|
129
104
|
console.log("\n" + "=".repeat(60));
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
console.log(`Deployed: ${date.toLocaleString()}`);
|
|
136
|
-
if (currentVersion.createdBy) {
|
|
137
|
-
console.log(`Created by: ${currentVersion.createdBy}`);
|
|
138
|
-
}
|
|
139
|
-
console.log("\n" + "-".repeat(60) + "\n");
|
|
140
|
-
console.log(currentVersion.persona);
|
|
141
|
-
console.log("\n" + "=".repeat(60) + "\n");
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
console.log("ā ļø No persona currently deployed.");
|
|
145
|
-
console.log("š” Deploy a version using: lua persona ā Production ā Deploy\n");
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
console.log("ā ļø No persona currently deployed.");
|
|
108
|
+
console.log("š” Deploy a version using: lua persona production deploy -v <version>\n");
|
|
109
|
+
if (versions.length > 0) {
|
|
146
110
|
console.log("Available versions:\n");
|
|
147
111
|
versions.forEach((v, i) => {
|
|
148
112
|
const date = new Date(v.createdDate);
|
|
149
113
|
console.log(` ${i + 1}. Version ${v.version} - ${date.toLocaleDateString()}`);
|
|
150
114
|
});
|
|
151
|
-
console.log();
|
|
152
115
|
}
|
|
153
|
-
|
|
154
|
-
console.log(`Total versions available: ${versions.length}\n`);
|
|
155
|
-
await safePrompt([
|
|
156
|
-
{
|
|
157
|
-
type: 'input',
|
|
158
|
-
name: 'continue',
|
|
159
|
-
message: 'Press Enter to continue...'
|
|
160
|
-
}
|
|
161
|
-
]);
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
console.error('ā Error loading persona information:', error);
|
|
165
|
-
if (error instanceof Error) {
|
|
166
|
-
console.error(` ${error.message}\n`);
|
|
167
|
-
}
|
|
168
|
-
await safePrompt([
|
|
169
|
-
{
|
|
170
|
-
type: 'input',
|
|
171
|
-
name: 'continue',
|
|
172
|
-
message: 'Press Enter to continue...'
|
|
173
|
-
}
|
|
174
|
-
]);
|
|
116
|
+
console.log("\n" + "=".repeat(60));
|
|
175
117
|
}
|
|
118
|
+
console.log(`\nTotal versions available: ${versions.length}`);
|
|
176
119
|
}
|
|
177
120
|
/**
|
|
178
|
-
*
|
|
121
|
+
* Displays deployed skills information.
|
|
179
122
|
*/
|
|
180
|
-
async function
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
console.log(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
console.log(` Deployed Version: ${activeVersion.version} ā`);
|
|
211
|
-
const date = new Date(activeVersion.createdAt);
|
|
212
|
-
console.log(` Deployed: ${date.toLocaleString()}`);
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
console.log(` Deployed Version: Not deployed`);
|
|
216
|
-
}
|
|
217
|
-
console.log(` Total Versions: ${versions.length}`);
|
|
218
|
-
console.log();
|
|
123
|
+
async function displaySkillsCore(context, config) {
|
|
124
|
+
const skills = config.skills || [];
|
|
125
|
+
console.log("\n" + "=".repeat(60));
|
|
126
|
+
console.log("āļø Production Skills");
|
|
127
|
+
console.log("=".repeat(60) + "\n");
|
|
128
|
+
if (skills.length === 0) {
|
|
129
|
+
console.log("ā¹ļø No skills found in configuration.\n");
|
|
130
|
+
console.log("=".repeat(60));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
for (const skill of skills) {
|
|
134
|
+
try {
|
|
135
|
+
const response = await fetch(`${BASE_URLS.API}/developer/skills/${context.agentId}/${skill.skillId}/versions`, {
|
|
136
|
+
method: 'GET',
|
|
137
|
+
headers: {
|
|
138
|
+
'Authorization': `Bearer ${context.apiKey}`,
|
|
139
|
+
'Content-Type': 'application/json'
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
if (response.ok) {
|
|
143
|
+
const data = await response.json();
|
|
144
|
+
const versions = data.data?.versions || data.versions || [];
|
|
145
|
+
const activeVersionId = data.data?.activeVersionId || data.activeVersionId;
|
|
146
|
+
const activeVersion = versions.find((v) => v.skillId === activeVersionId);
|
|
147
|
+
console.log(`š¦ ${skill.name}`);
|
|
148
|
+
console.log(` Skill ID: ${skill.skillId}`);
|
|
149
|
+
if (activeVersion) {
|
|
150
|
+
console.log(` Deployed Version: ${activeVersion.version} ā`);
|
|
151
|
+
const date = new Date(activeVersion.createdAt);
|
|
152
|
+
console.log(` Deployed: ${date.toLocaleString()}`);
|
|
219
153
|
}
|
|
220
154
|
else {
|
|
221
|
-
console.log(
|
|
222
|
-
console.log(` Skill ID: ${skill.skillId}`);
|
|
223
|
-
console.log(` Status: Unable to fetch version info`);
|
|
224
|
-
console.log();
|
|
155
|
+
console.log(` Deployed Version: Not deployed`);
|
|
225
156
|
}
|
|
157
|
+
console.log(` Total Versions: ${versions.length}`);
|
|
158
|
+
console.log();
|
|
226
159
|
}
|
|
227
|
-
|
|
160
|
+
else {
|
|
228
161
|
console.log(`š¦ ${skill.name}`);
|
|
229
162
|
console.log(` Skill ID: ${skill.skillId}`);
|
|
230
|
-
console.log(` Status:
|
|
163
|
+
console.log(` Status: Unable to fetch version info`);
|
|
231
164
|
console.log();
|
|
232
165
|
}
|
|
233
166
|
}
|
|
167
|
+
catch {
|
|
168
|
+
console.log(`š¦ ${skill.name}`);
|
|
169
|
+
console.log(` Skill ID: ${skill.skillId}`);
|
|
170
|
+
console.log(` Status: Error loading versions`);
|
|
171
|
+
console.log();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
console.log("=".repeat(60));
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Fetches environment variables from the API.
|
|
178
|
+
*/
|
|
179
|
+
async function fetchEnvVariablesCore(context) {
|
|
180
|
+
try {
|
|
181
|
+
const response = await fetch(`${BASE_URLS.API}/developer/agents/${context.agentId}/env`, {
|
|
182
|
+
method: 'GET',
|
|
183
|
+
headers: {
|
|
184
|
+
'accept': 'application/json',
|
|
185
|
+
'Authorization': `Bearer ${context.apiKey}`
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
if (!response.ok) {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
const data = await response.json();
|
|
192
|
+
if (data.data && typeof data.data === 'object') {
|
|
193
|
+
return Object.entries(data.data).map(([key, value]) => ({
|
|
194
|
+
key,
|
|
195
|
+
value: String(value)
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
198
|
+
return [];
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
console.error('ā ļø Error loading environment variables');
|
|
202
|
+
return [];
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Displays environment variables (masked).
|
|
207
|
+
*/
|
|
208
|
+
function displayEnvVariablesCore(variables) {
|
|
209
|
+
console.log("\n" + "=".repeat(60));
|
|
210
|
+
console.log("š Production Environment Variables");
|
|
211
|
+
console.log("=".repeat(60) + "\n");
|
|
212
|
+
if (variables.length === 0) {
|
|
213
|
+
console.log("ā¹ļø No environment variables configured.\n");
|
|
214
|
+
console.log("=".repeat(60));
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
variables.forEach((v, index) => {
|
|
218
|
+
const maskedValue = v.value.length > 4
|
|
219
|
+
? v.value.substring(0, 4) + '*'.repeat(Math.min(v.value.length - 4, 20))
|
|
220
|
+
: '*'.repeat(v.value.length);
|
|
221
|
+
console.log(`${index + 1}. ${v.key} = ${maskedValue}`);
|
|
222
|
+
});
|
|
223
|
+
console.log("\n" + "=".repeat(60));
|
|
224
|
+
console.log(`Total: ${variables.length} variable(s)`);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Displays production overview (summary of all sections).
|
|
228
|
+
*/
|
|
229
|
+
async function displayOverviewCore(context, config) {
|
|
230
|
+
console.log("\n" + "=".repeat(60));
|
|
231
|
+
console.log("š Production Environment Overview");
|
|
232
|
+
console.log("=".repeat(60) + "\n");
|
|
233
|
+
// Persona summary
|
|
234
|
+
writeProgress("Loading persona...");
|
|
235
|
+
const versions = await fetchPersonaVersionsCore(context);
|
|
236
|
+
const currentPersona = versions?.find(v => v.isCurrent);
|
|
237
|
+
console.log("š¤ Persona:");
|
|
238
|
+
if (currentPersona) {
|
|
239
|
+
const preview = currentPersona.persona.length > 80
|
|
240
|
+
? currentPersona.persona.substring(0, 80) + '...'
|
|
241
|
+
: currentPersona.persona;
|
|
242
|
+
console.log(` Version ${currentPersona.version} ā deployed`);
|
|
243
|
+
console.log(` Preview: ${preview}`);
|
|
244
|
+
}
|
|
245
|
+
else if (versions && versions.length > 0) {
|
|
246
|
+
console.log(` ā ļø Not deployed (${versions.length} version(s) available)`);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
console.log(` ā¹ļø No versions found`);
|
|
250
|
+
}
|
|
251
|
+
console.log();
|
|
252
|
+
// Skills summary
|
|
253
|
+
writeProgress("Loading skills...");
|
|
254
|
+
const skills = config.skills || [];
|
|
255
|
+
console.log("āļø Skills:");
|
|
256
|
+
if (skills.length === 0) {
|
|
257
|
+
console.log(" ā¹ļø No skills configured");
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
console.log(` ${skills.length} skill(s) configured`);
|
|
261
|
+
for (const skill of skills.slice(0, 3)) {
|
|
262
|
+
console.log(` - ${skill.name}`);
|
|
263
|
+
}
|
|
264
|
+
if (skills.length > 3) {
|
|
265
|
+
console.log(` ... and ${skills.length - 3} more`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
console.log();
|
|
269
|
+
// Env variables summary
|
|
270
|
+
writeProgress("Loading environment variables...");
|
|
271
|
+
const envVars = await fetchEnvVariablesCore(context);
|
|
272
|
+
console.log("š Environment Variables:");
|
|
273
|
+
if (envVars.length === 0) {
|
|
274
|
+
console.log(" ā¹ļø No variables configured");
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
console.log(` ${envVars.length} variable(s) configured`);
|
|
278
|
+
envVars.slice(0, 3).forEach(v => {
|
|
279
|
+
console.log(` - ${v.key}`);
|
|
280
|
+
});
|
|
281
|
+
if (envVars.length > 3) {
|
|
282
|
+
console.log(` ... and ${envVars.length - 3} more`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
console.log("\n" + "=".repeat(60));
|
|
286
|
+
}
|
|
287
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
288
|
+
// Non-Interactive Mode
|
|
289
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
290
|
+
async function executeNonInteractive(context, config, action) {
|
|
291
|
+
const validActions = ['overview', 'persona', 'skills', 'env'];
|
|
292
|
+
const normalizedAction = action.toLowerCase();
|
|
293
|
+
if (!validActions.includes(normalizedAction)) {
|
|
294
|
+
console.error(`ā Invalid action: "${action}"`);
|
|
295
|
+
console.log('\nValid actions: overview, persona, skills, env');
|
|
296
|
+
console.log('\nExamples:');
|
|
297
|
+
console.log(' lua production overview Show production summary');
|
|
298
|
+
console.log(' lua production persona View current persona');
|
|
299
|
+
console.log(' lua production skills View deployed skills');
|
|
300
|
+
console.log(' lua production env List environment variables');
|
|
301
|
+
process.exit(1);
|
|
302
|
+
}
|
|
303
|
+
switch (normalizedAction) {
|
|
304
|
+
case 'overview':
|
|
305
|
+
await displayOverviewCore(context, config);
|
|
306
|
+
break;
|
|
307
|
+
case 'persona': {
|
|
308
|
+
writeProgress("š Loading persona information...");
|
|
309
|
+
const versions = await fetchPersonaVersionsCore(context);
|
|
310
|
+
if (!versions)
|
|
311
|
+
process.exit(1);
|
|
312
|
+
displayPersonaCore(versions);
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
case 'skills':
|
|
316
|
+
writeProgress("š Loading skill information...");
|
|
317
|
+
await displaySkillsCore(context, config);
|
|
318
|
+
break;
|
|
319
|
+
case 'env': {
|
|
320
|
+
writeProgress("š Loading environment variables...");
|
|
321
|
+
const envVars = await fetchEnvVariablesCore(context);
|
|
322
|
+
displayEnvVariablesCore(envVars);
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
328
|
+
// Interactive Mode
|
|
329
|
+
// āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
330
|
+
async function manageProductionInteractive(context, config) {
|
|
331
|
+
let continueManaging = true;
|
|
332
|
+
while (continueManaging) {
|
|
333
|
+
console.log("\n" + "=".repeat(60));
|
|
334
|
+
console.log("š Production Environment");
|
|
234
335
|
console.log("=".repeat(60) + "\n");
|
|
235
|
-
await safePrompt([
|
|
336
|
+
const actionAnswer = await safePrompt([
|
|
236
337
|
{
|
|
237
|
-
type: '
|
|
238
|
-
name: '
|
|
239
|
-
message: '
|
|
338
|
+
type: 'list',
|
|
339
|
+
name: 'action',
|
|
340
|
+
message: 'What would you like to view?',
|
|
341
|
+
choices: [
|
|
342
|
+
{ name: 'š¤ Persona - View current persona and versions', value: 'persona' },
|
|
343
|
+
{ name: 'āļø Skills - View deployed skills and versions', value: 'skills' },
|
|
344
|
+
{ name: 'š Environment Variables - Manage production env', value: 'env' },
|
|
345
|
+
{ name: 'ā Exit', value: 'exit' }
|
|
346
|
+
]
|
|
240
347
|
}
|
|
241
348
|
]);
|
|
349
|
+
if (!actionAnswer)
|
|
350
|
+
return;
|
|
351
|
+
const { action } = actionAnswer;
|
|
352
|
+
switch (action) {
|
|
353
|
+
case 'persona':
|
|
354
|
+
await viewProductionPersonaInteractive(context);
|
|
355
|
+
break;
|
|
356
|
+
case 'skills':
|
|
357
|
+
await viewProductionSkillsInteractive(context, config);
|
|
358
|
+
break;
|
|
359
|
+
case 'env':
|
|
360
|
+
await manageProductionEnvInteractive(context);
|
|
361
|
+
break;
|
|
362
|
+
case 'exit':
|
|
363
|
+
continueManaging = false;
|
|
364
|
+
console.log("\nš Goodbye!\n");
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
242
367
|
}
|
|
243
|
-
|
|
244
|
-
|
|
368
|
+
}
|
|
369
|
+
async function viewProductionPersonaInteractive(context) {
|
|
370
|
+
writeProgress("š Loading persona information...");
|
|
371
|
+
const versions = await fetchPersonaVersionsCore(context);
|
|
372
|
+
if (!versions) {
|
|
373
|
+
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
if (versions.length === 0) {
|
|
377
|
+
console.log("\nā¹ļø No persona versions found.");
|
|
378
|
+
console.log("š” Create a persona version first using: lua persona\n");
|
|
379
|
+
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
380
|
+
return;
|
|
245
381
|
}
|
|
382
|
+
displayPersonaCore(versions);
|
|
383
|
+
console.log();
|
|
384
|
+
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
246
385
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
386
|
+
async function viewProductionSkillsInteractive(context, config) {
|
|
387
|
+
writeProgress("š Loading skill information...");
|
|
388
|
+
await displaySkillsCore(context, config);
|
|
389
|
+
console.log();
|
|
390
|
+
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
391
|
+
}
|
|
392
|
+
async function manageProductionEnvInteractive(context) {
|
|
251
393
|
let continueManaging = true;
|
|
252
394
|
while (continueManaging) {
|
|
253
|
-
|
|
254
|
-
const variables = await loadProductionEnvVariables(context);
|
|
395
|
+
const variables = await fetchEnvVariablesCore(context);
|
|
255
396
|
console.log("\n" + "=".repeat(60));
|
|
256
397
|
console.log("š Production Environment Variables");
|
|
257
398
|
console.log("=".repeat(60) + "\n");
|
|
@@ -260,7 +401,6 @@ async function manageProductionEnv(context) {
|
|
|
260
401
|
}
|
|
261
402
|
else {
|
|
262
403
|
variables.forEach((v, index) => {
|
|
263
|
-
// Mask values partially for security
|
|
264
404
|
const maskedValue = v.value.length > 4
|
|
265
405
|
? v.value.substring(0, 4) + '*'.repeat(Math.min(v.value.length - 4, 20))
|
|
266
406
|
: '*'.repeat(v.value.length);
|
|
@@ -288,19 +428,18 @@ async function manageProductionEnv(context) {
|
|
|
288
428
|
const { action } = actionAnswer;
|
|
289
429
|
switch (action) {
|
|
290
430
|
case 'add':
|
|
291
|
-
await
|
|
431
|
+
await addProductionVariableInteractive(context, variables);
|
|
292
432
|
break;
|
|
293
433
|
case 'update':
|
|
294
|
-
await
|
|
434
|
+
await updateProductionVariableInteractive(context, variables);
|
|
295
435
|
break;
|
|
296
436
|
case 'delete':
|
|
297
|
-
await
|
|
437
|
+
await deleteProductionVariableInteractive(context, variables);
|
|
298
438
|
break;
|
|
299
439
|
case 'view':
|
|
300
|
-
await
|
|
440
|
+
await viewProductionVariableInteractive(variables);
|
|
301
441
|
break;
|
|
302
442
|
case 'refresh':
|
|
303
|
-
// Just loop again
|
|
304
443
|
break;
|
|
305
444
|
case 'back':
|
|
306
445
|
continueManaging = false;
|
|
@@ -308,38 +447,6 @@ async function manageProductionEnv(context) {
|
|
|
308
447
|
}
|
|
309
448
|
}
|
|
310
449
|
}
|
|
311
|
-
/**
|
|
312
|
-
* Load production environment variables
|
|
313
|
-
*/
|
|
314
|
-
async function loadProductionEnvVariables(context) {
|
|
315
|
-
try {
|
|
316
|
-
const response = await fetch(`${BASE_URLS.API}/developer/agents/${context.agentId}/env`, {
|
|
317
|
-
method: 'GET',
|
|
318
|
-
headers: {
|
|
319
|
-
'accept': 'application/json',
|
|
320
|
-
'Authorization': `Bearer ${context.apiKey}`
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
if (!response.ok) {
|
|
324
|
-
return [];
|
|
325
|
-
}
|
|
326
|
-
const data = await response.json();
|
|
327
|
-
if (data.data && typeof data.data === 'object') {
|
|
328
|
-
return Object.entries(data.data).map(([key, value]) => ({
|
|
329
|
-
key,
|
|
330
|
-
value: String(value)
|
|
331
|
-
}));
|
|
332
|
-
}
|
|
333
|
-
return [];
|
|
334
|
-
}
|
|
335
|
-
catch (error) {
|
|
336
|
-
console.error('ā ļø Error loading environment variables');
|
|
337
|
-
return [];
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Save production environment variables
|
|
342
|
-
*/
|
|
343
450
|
async function saveProductionEnvVariables(context, variables) {
|
|
344
451
|
try {
|
|
345
452
|
const envData = {};
|
|
@@ -367,10 +474,7 @@ async function saveProductionEnvVariables(context, variables) {
|
|
|
367
474
|
return false;
|
|
368
475
|
}
|
|
369
476
|
}
|
|
370
|
-
|
|
371
|
-
* Add a new production environment variable
|
|
372
|
-
*/
|
|
373
|
-
async function addProductionVariable(context, currentVariables) {
|
|
477
|
+
async function addProductionVariableInteractive(context, currentVariables) {
|
|
374
478
|
const answers = await safePrompt([
|
|
375
479
|
{
|
|
376
480
|
type: 'input',
|
|
@@ -410,10 +514,7 @@ async function addProductionVariable(context, currentVariables) {
|
|
|
410
514
|
console.error("ā Failed to save variable");
|
|
411
515
|
}
|
|
412
516
|
}
|
|
413
|
-
|
|
414
|
-
* Update an existing production environment variable
|
|
415
|
-
*/
|
|
416
|
-
async function updateProductionVariable(context, currentVariables) {
|
|
517
|
+
async function updateProductionVariableInteractive(context, currentVariables) {
|
|
417
518
|
if (currentVariables.length === 0) {
|
|
418
519
|
console.log("\nā¹ļø No variables to update.\n");
|
|
419
520
|
return;
|
|
@@ -452,10 +553,7 @@ async function updateProductionVariable(context, currentVariables) {
|
|
|
452
553
|
console.error("ā Failed to update variable");
|
|
453
554
|
}
|
|
454
555
|
}
|
|
455
|
-
|
|
456
|
-
* Delete a production environment variable
|
|
457
|
-
*/
|
|
458
|
-
async function deleteProductionVariable(context, currentVariables) {
|
|
556
|
+
async function deleteProductionVariableInteractive(context, currentVariables) {
|
|
459
557
|
if (currentVariables.length === 0) {
|
|
460
558
|
console.log("\nā¹ļø No variables to delete.\n");
|
|
461
559
|
return;
|
|
@@ -495,10 +593,7 @@ async function deleteProductionVariable(context, currentVariables) {
|
|
|
495
593
|
console.error("ā Failed to delete variable");
|
|
496
594
|
}
|
|
497
595
|
}
|
|
498
|
-
|
|
499
|
-
* View a variable's full value (unmasked)
|
|
500
|
-
*/
|
|
501
|
-
async function viewProductionVariable(currentVariables) {
|
|
596
|
+
async function viewProductionVariableInteractive(currentVariables) {
|
|
502
597
|
if (currentVariables.length === 0) {
|
|
503
598
|
console.log("\nā¹ļø No variables to view.\n");
|
|
504
599
|
return;
|
|
@@ -522,12 +617,6 @@ async function viewProductionVariable(currentVariables) {
|
|
|
522
617
|
console.log("=".repeat(60));
|
|
523
618
|
console.log(variable.value);
|
|
524
619
|
console.log("=".repeat(60) + "\n");
|
|
525
|
-
await safePrompt([
|
|
526
|
-
{
|
|
527
|
-
type: 'input',
|
|
528
|
-
name: 'continue',
|
|
529
|
-
message: 'Press Enter to continue...'
|
|
530
|
-
}
|
|
531
|
-
]);
|
|
620
|
+
await safePrompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
532
621
|
}
|
|
533
622
|
//# sourceMappingURL=production.js.map
|