lua-cli 3.0.0-alpha.4 → 3.0.0-alpha.5
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.
|
@@ -70,16 +70,23 @@ Examples:
|
|
|
70
70
|
program
|
|
71
71
|
.command("push [type]")
|
|
72
72
|
.description("☁️ Push skill, webhook, job, or persona version to server")
|
|
73
|
+
.option('--force', 'Skip all confirmation prompts (auto-confirm)')
|
|
74
|
+
.option('--auto-deploy', 'Automatically deploy to production after push')
|
|
73
75
|
.addHelpText('after', `
|
|
74
76
|
Arguments:
|
|
75
|
-
type Optional: 'skill', 'webhook', 'job',
|
|
77
|
+
type Optional: 'skill', 'webhook', 'job', 'preprocessor', 'postprocessor', 'persona', or 'all' (prompts if not provided)
|
|
78
|
+
|
|
79
|
+
Options:
|
|
80
|
+
--force Skip all confirmation prompts
|
|
81
|
+
--auto-deploy Automatically deploy to production after push
|
|
76
82
|
|
|
77
83
|
Examples:
|
|
78
|
-
$ lua push
|
|
79
|
-
$ lua push skill
|
|
80
|
-
$ lua push webhook
|
|
81
|
-
$ lua push job
|
|
82
|
-
$ lua push
|
|
84
|
+
$ lua push Interactive selection
|
|
85
|
+
$ lua push skill Push a skill directly
|
|
86
|
+
$ lua push webhook Push a webhook directly
|
|
87
|
+
$ lua push job Push a job directly
|
|
88
|
+
$ lua push all --force Push all components from YAML without prompts
|
|
89
|
+
$ lua push all --force --auto-deploy Push and deploy all to production
|
|
83
90
|
`)
|
|
84
91
|
.action(pushCommand);
|
|
85
92
|
program
|
package/dist/commands/push.d.ts
CHANGED
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Note: This does NOT deploy to production. Use `lua deploy` for that.
|
|
19
19
|
*
|
|
20
|
-
* @param type - Optional type argument ('skill' or '
|
|
20
|
+
* @param type - Optional type argument ('skill', 'persona', 'webhook', 'job', 'preprocessor', 'postprocessor', or 'all')
|
|
21
|
+
* @param options - Command options (force, autoDeploy)
|
|
21
22
|
* @returns Promise that resolves when push completes
|
|
22
23
|
*/
|
|
23
|
-
export declare function pushCommand(type?: string
|
|
24
|
+
export declare function pushCommand(type?: string, options?: {
|
|
25
|
+
force?: boolean;
|
|
26
|
+
autoDeploy?: boolean;
|
|
27
|
+
}): Promise<void>;
|
package/dist/commands/push.js
CHANGED
|
@@ -31,17 +31,29 @@ import PostProcessorApi from '../api/postprocessor.api.service.js';
|
|
|
31
31
|
*
|
|
32
32
|
* Note: This does NOT deploy to production. Use `lua deploy` for that.
|
|
33
33
|
*
|
|
34
|
-
* @param type - Optional type argument ('skill' or '
|
|
34
|
+
* @param type - Optional type argument ('skill', 'persona', 'webhook', 'job', 'preprocessor', 'postprocessor', or 'all')
|
|
35
|
+
* @param options - Command options (force, autoDeploy)
|
|
35
36
|
* @returns Promise that resolves when push completes
|
|
36
37
|
*/
|
|
37
|
-
export async function pushCommand(type) {
|
|
38
|
+
export async function pushCommand(type, options) {
|
|
38
39
|
return withErrorHandling(async () => {
|
|
39
40
|
let selectedType;
|
|
41
|
+
// Handle 'all' type with force flag
|
|
42
|
+
if (type === 'all') {
|
|
43
|
+
if (!options?.force) {
|
|
44
|
+
console.error('❌ The "all" type requires the --force flag');
|
|
45
|
+
console.log('\nUsage:');
|
|
46
|
+
console.log(' lua push all --force Push all components without prompts');
|
|
47
|
+
console.log(' lua push all --force --auto-deploy Push and deploy all to production');
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
return await pushAllCommand(options);
|
|
51
|
+
}
|
|
40
52
|
// Step 1: Check if type was provided as argument
|
|
41
53
|
if (type) {
|
|
42
54
|
// Validate the provided type
|
|
43
55
|
if (type !== 'skill' && type !== 'persona' && type !== 'webhook' && type !== 'job' && type !== 'preprocessor' && type !== 'postprocessor') {
|
|
44
|
-
console.error(`❌ Invalid type: "${type}". Must be "skill", "persona", "webhook", "job", "preprocessor", or "
|
|
56
|
+
console.error(`❌ Invalid type: "${type}". Must be "skill", "persona", "webhook", "job", "preprocessor", "postprocessor", or "all".`);
|
|
45
57
|
console.log('\nUsage:');
|
|
46
58
|
console.log(' lua push - Interactive selection');
|
|
47
59
|
console.log(' lua push skill - Push a skill directly');
|
|
@@ -50,6 +62,7 @@ export async function pushCommand(type) {
|
|
|
50
62
|
console.log(' lua push job - Push a job directly');
|
|
51
63
|
console.log(' lua push preprocessor - Push a preprocessor directly');
|
|
52
64
|
console.log(' lua push postprocessor - Push a postprocessor directly');
|
|
65
|
+
console.log(' lua push all --force - Push all components without prompts');
|
|
53
66
|
process.exit(1);
|
|
54
67
|
}
|
|
55
68
|
selectedType = type;
|
|
@@ -1031,3 +1044,394 @@ async function deployVersionAfterPush(apiKey, agentId, selectedSkill, pushedVers
|
|
|
1031
1044
|
console.log('💡 You can deploy later using: lua deploy\n');
|
|
1032
1045
|
}
|
|
1033
1046
|
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Push all command - Pushes all components (skills, webhooks, jobs, processors) without prompts
|
|
1049
|
+
*
|
|
1050
|
+
* This command:
|
|
1051
|
+
* 1. Compiles the project
|
|
1052
|
+
* 2. Reads lua.skill.yaml to get all components
|
|
1053
|
+
* 3. Auto-bumps patch versions
|
|
1054
|
+
* 4. Pushes all components
|
|
1055
|
+
* 5. Optionally auto-deploys to production
|
|
1056
|
+
*
|
|
1057
|
+
* @param options - Command options (force is required, autoDeploy is optional)
|
|
1058
|
+
*/
|
|
1059
|
+
async function pushAllCommand(options) {
|
|
1060
|
+
writeProgress("🚀 Push All - Pushing all components to server...\n");
|
|
1061
|
+
// Step 1: Compile first
|
|
1062
|
+
writeProgress("📦 Compiling project...");
|
|
1063
|
+
await compileCommand();
|
|
1064
|
+
// Step 2: Load configuration and API key
|
|
1065
|
+
const config = readSkillConfig();
|
|
1066
|
+
if (!config?.agent?.agentId) {
|
|
1067
|
+
console.error('❌ No agent ID found in lua.skill.yaml. Run "lua init" first.');
|
|
1068
|
+
process.exit(1);
|
|
1069
|
+
}
|
|
1070
|
+
const apiKey = await loadApiKey();
|
|
1071
|
+
if (!apiKey) {
|
|
1072
|
+
console.error('❌ No API key found. Run "lua auth configure" first.');
|
|
1073
|
+
process.exit(1);
|
|
1074
|
+
}
|
|
1075
|
+
const agentId = config.agent.agentId; // Validated above, safe to assert
|
|
1076
|
+
// Step 3: Read deploy.json for component data
|
|
1077
|
+
const deployJsonPath = path.join(process.cwd(), '.lua', 'deploy.json');
|
|
1078
|
+
if (!fs.existsSync(deployJsonPath)) {
|
|
1079
|
+
console.error('❌ No deploy.json found. Compilation may have failed.');
|
|
1080
|
+
process.exit(1);
|
|
1081
|
+
}
|
|
1082
|
+
const deployData = JSON.parse(fs.readFileSync(deployJsonPath, 'utf8'));
|
|
1083
|
+
// Track results
|
|
1084
|
+
const results = {
|
|
1085
|
+
skills: [],
|
|
1086
|
+
webhooks: [],
|
|
1087
|
+
jobs: [],
|
|
1088
|
+
preprocessors: [],
|
|
1089
|
+
postprocessors: []
|
|
1090
|
+
};
|
|
1091
|
+
// Step 4: Push all skills
|
|
1092
|
+
if (config.skills && config.skills.length > 0) {
|
|
1093
|
+
writeProgress(`\n📦 Pushing ${config.skills.length} skill(s)...`);
|
|
1094
|
+
for (const skillConfig of config.skills) {
|
|
1095
|
+
try {
|
|
1096
|
+
const skillData = deployData.skills.find((s) => s.name === skillConfig.name);
|
|
1097
|
+
if (!skillData) {
|
|
1098
|
+
console.warn(`⚠️ Skill "${skillConfig.name}" not found in deploy.json, skipping`);
|
|
1099
|
+
continue;
|
|
1100
|
+
}
|
|
1101
|
+
// Validate skillId and version exist
|
|
1102
|
+
const skillId = skillConfig.skillId;
|
|
1103
|
+
const currentVersion = skillConfig.version;
|
|
1104
|
+
if (!skillId) {
|
|
1105
|
+
console.warn(`⚠️ Skill "${skillConfig.name}" has no skillId, skipping`);
|
|
1106
|
+
continue;
|
|
1107
|
+
}
|
|
1108
|
+
if (!currentVersion) {
|
|
1109
|
+
console.warn(`⚠️ Skill "${skillConfig.name}" has no version, skipping`);
|
|
1110
|
+
continue;
|
|
1111
|
+
}
|
|
1112
|
+
// Auto-bump patch version
|
|
1113
|
+
const newVersion = bumpPatchVersion(currentVersion);
|
|
1114
|
+
writeInfo(` 📝 ${skillConfig.name}: ${currentVersion} → ${newVersion}`);
|
|
1115
|
+
// Push version
|
|
1116
|
+
const pushResult = await pushVersion(apiKey, agentId, skillId, {
|
|
1117
|
+
version: newVersion,
|
|
1118
|
+
description: skillConfig.description || '',
|
|
1119
|
+
context: skillConfig.context || '',
|
|
1120
|
+
code: skillData.code,
|
|
1121
|
+
executeFunction: skillData.executeFunction,
|
|
1122
|
+
inputSchema: skillData.inputSchema,
|
|
1123
|
+
outputSchema: skillData.outputSchema,
|
|
1124
|
+
});
|
|
1125
|
+
// Update YAML with new version
|
|
1126
|
+
updateSkillVersionInYaml(skillConfig.name, newVersion);
|
|
1127
|
+
results.skills.push({ name: skillConfig.name, version: newVersion, skillId });
|
|
1128
|
+
writeSuccess(` ✅ ${skillConfig.name} v${newVersion} pushed`);
|
|
1129
|
+
// Auto-deploy if requested
|
|
1130
|
+
if (options.autoDeploy) {
|
|
1131
|
+
await publishVersion(apiKey, agentId, skillId, newVersion);
|
|
1132
|
+
writeSuccess(` 🚀 ${skillConfig.name} v${newVersion} deployed to production`);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
catch (error) {
|
|
1136
|
+
console.error(` ❌ Failed to push ${skillConfig.name}:`, error.message);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
// Step 5: Push all webhooks
|
|
1141
|
+
if (config.webhooks && config.webhooks.length > 0) {
|
|
1142
|
+
writeProgress(`\n🪝 Pushing ${config.webhooks.length} webhook(s)...`);
|
|
1143
|
+
for (const webhookConfig of config.webhooks) {
|
|
1144
|
+
try {
|
|
1145
|
+
const webhookData = deployData.webhooks?.find((w) => w.name === webhookConfig.name);
|
|
1146
|
+
if (!webhookData) {
|
|
1147
|
+
console.warn(`⚠️ Webhook "${webhookConfig.name}" not found in deploy.json, skipping`);
|
|
1148
|
+
continue;
|
|
1149
|
+
}
|
|
1150
|
+
// Validate webhookId and version exist
|
|
1151
|
+
if (!webhookConfig.webhookId) {
|
|
1152
|
+
console.warn(`⚠️ Webhook "${webhookConfig.name}" has no webhookId, skipping`);
|
|
1153
|
+
continue;
|
|
1154
|
+
}
|
|
1155
|
+
if (!webhookConfig.version) {
|
|
1156
|
+
console.warn(`⚠️ Webhook "${webhookConfig.name}" has no version, skipping`);
|
|
1157
|
+
continue;
|
|
1158
|
+
}
|
|
1159
|
+
// Auto-bump patch version
|
|
1160
|
+
const newVersion = bumpPatchVersion(webhookConfig.version);
|
|
1161
|
+
writeInfo(` 📝 ${webhookConfig.name}: ${webhookConfig.version} → ${newVersion}`);
|
|
1162
|
+
// Prepare webhook data for push
|
|
1163
|
+
const pushData = {
|
|
1164
|
+
name: webhookConfig.name,
|
|
1165
|
+
version: newVersion,
|
|
1166
|
+
description: webhookData.description || webhookConfig.description || '',
|
|
1167
|
+
context: webhookData.context || webhookConfig.context || '',
|
|
1168
|
+
webhookId: webhookConfig.webhookId,
|
|
1169
|
+
querySchema: webhookData.querySchema,
|
|
1170
|
+
headerSchema: webhookData.headerSchema,
|
|
1171
|
+
bodySchema: webhookData.bodySchema,
|
|
1172
|
+
code: webhookData.code,
|
|
1173
|
+
executeFunction: webhookData.executeFunction
|
|
1174
|
+
};
|
|
1175
|
+
// Push version using fetch (like existing webhook push)
|
|
1176
|
+
const response = await fetch(`${BASE_URLS.API}/developer/webhooks/${agentId}/${webhookConfig.webhookId}/version`, {
|
|
1177
|
+
method: 'POST',
|
|
1178
|
+
headers: {
|
|
1179
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
1180
|
+
'Content-Type': 'application/json'
|
|
1181
|
+
},
|
|
1182
|
+
body: JSON.stringify(pushData)
|
|
1183
|
+
});
|
|
1184
|
+
if (!response.ok) {
|
|
1185
|
+
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
|
|
1186
|
+
}
|
|
1187
|
+
// Update YAML
|
|
1188
|
+
updateWebhookVersionInYaml(webhookConfig.name, newVersion);
|
|
1189
|
+
results.webhooks.push({ name: webhookConfig.name, version: newVersion });
|
|
1190
|
+
writeSuccess(` ✅ ${webhookConfig.name} v${newVersion} pushed`);
|
|
1191
|
+
// Auto-deploy if requested
|
|
1192
|
+
if (options.autoDeploy) {
|
|
1193
|
+
const deployResponse = await fetch(`${BASE_URLS.API}/developer/webhooks/${agentId}/${webhookConfig.webhookId}/${newVersion}/publish`, {
|
|
1194
|
+
method: 'PUT',
|
|
1195
|
+
headers: {
|
|
1196
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
1197
|
+
'Content-Type': 'application/json'
|
|
1198
|
+
}
|
|
1199
|
+
});
|
|
1200
|
+
if (deployResponse.ok) {
|
|
1201
|
+
writeSuccess(` 🚀 ${webhookConfig.name} v${newVersion} deployed to production`);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
catch (error) {
|
|
1206
|
+
console.error(` ❌ Failed to push ${webhookConfig.name}:`, error.message);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
// Step 6: Push all jobs
|
|
1211
|
+
if (config.jobs && config.jobs.length > 0) {
|
|
1212
|
+
writeProgress(`\n⏰ Pushing ${config.jobs.length} job(s)...`);
|
|
1213
|
+
for (const jobConfig of config.jobs) {
|
|
1214
|
+
try {
|
|
1215
|
+
const jobData = deployData.jobs?.find((j) => j.name === jobConfig.name);
|
|
1216
|
+
if (!jobData) {
|
|
1217
|
+
console.warn(`⚠️ Job "${jobConfig.name}" not found in deploy.json, skipping`);
|
|
1218
|
+
continue;
|
|
1219
|
+
}
|
|
1220
|
+
// Validate jobId and version exist
|
|
1221
|
+
if (!jobConfig.jobId) {
|
|
1222
|
+
console.warn(`⚠️ Job "${jobConfig.name}" has no jobId, skipping`);
|
|
1223
|
+
continue;
|
|
1224
|
+
}
|
|
1225
|
+
if (!jobConfig.version) {
|
|
1226
|
+
console.warn(`⚠️ Job "${jobConfig.name}" has no version, skipping`);
|
|
1227
|
+
continue;
|
|
1228
|
+
}
|
|
1229
|
+
// Auto-bump patch version
|
|
1230
|
+
const newVersion = bumpPatchVersion(jobConfig.version);
|
|
1231
|
+
writeInfo(` 📝 ${jobConfig.name}: ${jobConfig.version} → ${newVersion}`);
|
|
1232
|
+
// Prepare job data for push
|
|
1233
|
+
const pushData = {
|
|
1234
|
+
name: jobConfig.name,
|
|
1235
|
+
version: newVersion,
|
|
1236
|
+
description: jobData.description || jobConfig.description || '',
|
|
1237
|
+
context: jobData.context || jobConfig.context || '',
|
|
1238
|
+
jobId: jobConfig.jobId,
|
|
1239
|
+
schedule: jobData.schedule || jobConfig.schedule,
|
|
1240
|
+
timeout: jobData.timeout,
|
|
1241
|
+
retry: jobData.retry,
|
|
1242
|
+
code: jobData.code,
|
|
1243
|
+
executeFunction: jobData.executeFunction,
|
|
1244
|
+
metadata: jobData.metadata || jobConfig.metadata
|
|
1245
|
+
};
|
|
1246
|
+
// Push version using fetch
|
|
1247
|
+
const response = await fetch(`${BASE_URLS.API}/developer/jobs/${agentId}/${jobConfig.jobId}/version`, {
|
|
1248
|
+
method: 'POST',
|
|
1249
|
+
headers: {
|
|
1250
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
1251
|
+
'Content-Type': 'application/json'
|
|
1252
|
+
},
|
|
1253
|
+
body: JSON.stringify(pushData)
|
|
1254
|
+
});
|
|
1255
|
+
if (!response.ok) {
|
|
1256
|
+
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
|
|
1257
|
+
}
|
|
1258
|
+
// Update YAML
|
|
1259
|
+
updateJobVersionInYaml(jobConfig.name, newVersion);
|
|
1260
|
+
results.jobs.push({ name: jobConfig.name, version: newVersion });
|
|
1261
|
+
writeSuccess(` ✅ ${jobConfig.name} v${newVersion} pushed`);
|
|
1262
|
+
// Auto-deploy if requested
|
|
1263
|
+
if (options.autoDeploy) {
|
|
1264
|
+
const deployResponse = await fetch(`${BASE_URLS.API}/developer/jobs/${agentId}/${jobConfig.jobId}/${newVersion}/publish`, {
|
|
1265
|
+
method: 'PUT',
|
|
1266
|
+
headers: {
|
|
1267
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
1268
|
+
'Content-Type': 'application/json'
|
|
1269
|
+
}
|
|
1270
|
+
});
|
|
1271
|
+
if (deployResponse.ok) {
|
|
1272
|
+
writeSuccess(` 🚀 ${jobConfig.name} v${newVersion} deployed to production`);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
catch (error) {
|
|
1277
|
+
console.error(` ❌ Failed to push ${jobConfig.name}:`, error.message);
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
// Step 7: Push all preprocessors
|
|
1282
|
+
if (config.preprocessors && config.preprocessors.length > 0) {
|
|
1283
|
+
writeProgress(`\n📥 Pushing ${config.preprocessors.length} preprocessor(s)...`);
|
|
1284
|
+
const preprocessorService = new PreProcessorApi(BASE_URLS.API, apiKey, agentId);
|
|
1285
|
+
for (const processorConfig of config.preprocessors) {
|
|
1286
|
+
try {
|
|
1287
|
+
const processorData = deployData.preprocessors?.find((p) => p.name === processorConfig.name);
|
|
1288
|
+
if (!processorData) {
|
|
1289
|
+
console.warn(`⚠️ Preprocessor "${processorConfig.name}" not found in deploy.json, skipping`);
|
|
1290
|
+
continue;
|
|
1291
|
+
}
|
|
1292
|
+
// Validate preprocessorId and version exist
|
|
1293
|
+
const preprocessorId = processorConfig.preprocessorId;
|
|
1294
|
+
const currentVersion = processorConfig.version;
|
|
1295
|
+
if (!preprocessorId) {
|
|
1296
|
+
console.warn(`⚠️ Preprocessor "${processorConfig.name}" has no preprocessorId, skipping`);
|
|
1297
|
+
continue;
|
|
1298
|
+
}
|
|
1299
|
+
if (!currentVersion) {
|
|
1300
|
+
console.warn(`⚠️ Preprocessor "${processorConfig.name}" has no version, skipping`);
|
|
1301
|
+
continue;
|
|
1302
|
+
}
|
|
1303
|
+
// Auto-bump patch version
|
|
1304
|
+
const newVersion = bumpPatchVersion(currentVersion);
|
|
1305
|
+
writeInfo(` 📝 ${processorConfig.name}: ${currentVersion} → ${newVersion}`);
|
|
1306
|
+
// Prepare version data
|
|
1307
|
+
const versionData = {
|
|
1308
|
+
name: processorConfig.name,
|
|
1309
|
+
version: newVersion,
|
|
1310
|
+
description: processorData.description || processorConfig.description || '',
|
|
1311
|
+
context: processorData.context || processorConfig.context || '',
|
|
1312
|
+
preprocessorId: preprocessorId,
|
|
1313
|
+
code: processorData.code,
|
|
1314
|
+
executeFunction: processorData.executeFunction,
|
|
1315
|
+
async: Boolean(processorData.async ?? false)
|
|
1316
|
+
};
|
|
1317
|
+
// Push version
|
|
1318
|
+
const result = await preprocessorService.pushPreProcessor(preprocessorId, versionData);
|
|
1319
|
+
if (!result.success) {
|
|
1320
|
+
throw new Error(result.error?.message || 'Failed to push preprocessor');
|
|
1321
|
+
}
|
|
1322
|
+
// Update YAML
|
|
1323
|
+
updateProcessorVersionInYaml('preprocessors', processorConfig.name, newVersion);
|
|
1324
|
+
results.preprocessors.push({ name: processorConfig.name, version: newVersion });
|
|
1325
|
+
writeSuccess(` ✅ ${processorConfig.name} v${newVersion} pushed`);
|
|
1326
|
+
// Auto-deploy if requested
|
|
1327
|
+
if (options.autoDeploy) {
|
|
1328
|
+
const deployResult = await preprocessorService.publishPreProcessorVersion(preprocessorId, newVersion);
|
|
1329
|
+
if (deployResult.success) {
|
|
1330
|
+
writeSuccess(` 🚀 ${processorConfig.name} v${newVersion} deployed to production`);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
catch (error) {
|
|
1335
|
+
console.error(` ❌ Failed to push ${processorConfig.name}:`, error.message);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
// Step 8: Push all postprocessors
|
|
1340
|
+
if (config.postprocessors && config.postprocessors.length > 0) {
|
|
1341
|
+
writeProgress(`\n📤 Pushing ${config.postprocessors.length} postprocessor(s)...`);
|
|
1342
|
+
const postprocessorService = new PostProcessorApi(BASE_URLS.API, apiKey, agentId);
|
|
1343
|
+
for (const processorConfig of config.postprocessors) {
|
|
1344
|
+
try {
|
|
1345
|
+
const processorData = deployData.postprocessors?.find((p) => p.name === processorConfig.name);
|
|
1346
|
+
if (!processorData) {
|
|
1347
|
+
console.warn(`⚠️ Postprocessor "${processorConfig.name}" not found in deploy.json, skipping`);
|
|
1348
|
+
continue;
|
|
1349
|
+
}
|
|
1350
|
+
// Validate postprocessorId and version exist
|
|
1351
|
+
const postprocessorId = processorConfig.postprocessorId;
|
|
1352
|
+
const currentVersion = processorConfig.version;
|
|
1353
|
+
if (!postprocessorId) {
|
|
1354
|
+
console.warn(`⚠️ Postprocessor "${processorConfig.name}" has no postprocessorId, skipping`);
|
|
1355
|
+
continue;
|
|
1356
|
+
}
|
|
1357
|
+
if (!currentVersion) {
|
|
1358
|
+
console.warn(`⚠️ Postprocessor "${processorConfig.name}" has no version, skipping`);
|
|
1359
|
+
continue;
|
|
1360
|
+
}
|
|
1361
|
+
// Auto-bump patch version
|
|
1362
|
+
const newVersion = bumpPatchVersion(currentVersion);
|
|
1363
|
+
writeInfo(` 📝 ${processorConfig.name}: ${currentVersion} → ${newVersion}`);
|
|
1364
|
+
// Prepare version data
|
|
1365
|
+
const versionData = {
|
|
1366
|
+
name: processorConfig.name,
|
|
1367
|
+
version: newVersion,
|
|
1368
|
+
description: processorData.description || processorConfig.description || '',
|
|
1369
|
+
context: processorData.context || processorConfig.context || '',
|
|
1370
|
+
postprocessorId: postprocessorId,
|
|
1371
|
+
code: processorData.code,
|
|
1372
|
+
executeFunction: processorData.executeFunction,
|
|
1373
|
+
async: Boolean(processorData.async ?? false)
|
|
1374
|
+
};
|
|
1375
|
+
// Push version
|
|
1376
|
+
const result = await postprocessorService.pushPostProcessor(postprocessorId, versionData);
|
|
1377
|
+
if (!result.success) {
|
|
1378
|
+
throw new Error(result.error?.message || 'Failed to push postprocessor');
|
|
1379
|
+
}
|
|
1380
|
+
// Update YAML
|
|
1381
|
+
updateProcessorVersionInYaml('postprocessors', processorConfig.name, newVersion);
|
|
1382
|
+
results.postprocessors.push({ name: processorConfig.name, version: newVersion });
|
|
1383
|
+
writeSuccess(` ✅ ${processorConfig.name} v${newVersion} pushed`);
|
|
1384
|
+
// Auto-deploy if requested
|
|
1385
|
+
if (options.autoDeploy) {
|
|
1386
|
+
const deployResult = await postprocessorService.publishPostProcessorVersion(postprocessorId, newVersion);
|
|
1387
|
+
if (deployResult.success) {
|
|
1388
|
+
writeSuccess(` 🚀 ${processorConfig.name} v${newVersion} deployed to production`);
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
catch (error) {
|
|
1393
|
+
console.error(` ❌ Failed to push ${processorConfig.name}:`, error.message);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
// Step 9: Print summary
|
|
1398
|
+
writeSuccess('\n✅ Push All Complete!\n');
|
|
1399
|
+
if (results.skills.length > 0) {
|
|
1400
|
+
console.log(`🛠️ Skills (${results.skills.length}):`);
|
|
1401
|
+
results.skills.forEach(s => console.log(` • ${s.name} v${s.version}`));
|
|
1402
|
+
}
|
|
1403
|
+
if (results.webhooks.length > 0) {
|
|
1404
|
+
console.log(`🪝 Webhooks (${results.webhooks.length}):`);
|
|
1405
|
+
results.webhooks.forEach(w => console.log(` • ${w.name} v${w.version}`));
|
|
1406
|
+
}
|
|
1407
|
+
if (results.jobs.length > 0) {
|
|
1408
|
+
console.log(`⏰ Jobs (${results.jobs.length}):`);
|
|
1409
|
+
results.jobs.forEach(j => console.log(` • ${j.name} v${j.version}`));
|
|
1410
|
+
}
|
|
1411
|
+
if (results.preprocessors.length > 0) {
|
|
1412
|
+
console.log(`📥 PreProcessors (${results.preprocessors.length}):`);
|
|
1413
|
+
results.preprocessors.forEach(p => console.log(` • ${p.name} v${p.version}`));
|
|
1414
|
+
}
|
|
1415
|
+
if (results.postprocessors.length > 0) {
|
|
1416
|
+
console.log(`📤 PostProcessors (${results.postprocessors.length}):`);
|
|
1417
|
+
results.postprocessors.forEach(p => console.log(` • ${p.name} v${p.version}`));
|
|
1418
|
+
}
|
|
1419
|
+
if (options.autoDeploy) {
|
|
1420
|
+
writeSuccess('\n🚀 All components deployed to production!');
|
|
1421
|
+
}
|
|
1422
|
+
console.log('');
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Bumps the patch version of a semantic version string
|
|
1426
|
+
* e.g., "1.2.3" -> "1.2.4"
|
|
1427
|
+
*/
|
|
1428
|
+
function bumpPatchVersion(version) {
|
|
1429
|
+
const parts = version.split('.');
|
|
1430
|
+
if (parts.length !== 3) {
|
|
1431
|
+
// If not a valid semver, just return incremented version
|
|
1432
|
+
return version + '.1';
|
|
1433
|
+
}
|
|
1434
|
+
const [major, minor, patch] = parts;
|
|
1435
|
+
const newPatch = parseInt(patch, 10) + 1;
|
|
1436
|
+
return `${major}.${minor}.${newPatch}`;
|
|
1437
|
+
}
|
package/package.json
CHANGED
package/template/lua.skill.yaml
CHANGED
|
@@ -14,25 +14,25 @@ agent:
|
|
|
14
14
|
welcomeMessage: Hi, I am your AI assistant. How can I help you today?
|
|
15
15
|
skills:
|
|
16
16
|
- name: general-skill
|
|
17
|
-
version: 0.0.
|
|
17
|
+
version: 0.0.4
|
|
18
18
|
skillId: 1faf9b3a-e352-4e63-a6c4-a3deca815361
|
|
19
19
|
- name: user-data-skill
|
|
20
|
-
version: 0.0.
|
|
20
|
+
version: 0.0.2
|
|
21
21
|
skillId: e0c382c1-f469-4880-962a-a756ea3c1411
|
|
22
22
|
- name: product-skill
|
|
23
|
-
version: 0.0.
|
|
23
|
+
version: 0.0.2
|
|
24
24
|
skillId: d4cdc7bc-6d42-4232-902d-2b9cf68bd74a
|
|
25
25
|
- name: basket-skill
|
|
26
|
-
version: 0.0.
|
|
26
|
+
version: 0.0.2
|
|
27
27
|
skillId: 5b06c5ff-7cf3-49c4-8641-142270c81db4
|
|
28
28
|
- name: order-skill
|
|
29
|
-
version: 0.0.
|
|
29
|
+
version: 0.0.2
|
|
30
30
|
skillId: d4045304-7c30-4750-9edd-340eb1357a39
|
|
31
31
|
- name: custom-data-skill
|
|
32
|
-
version: 0.0.
|
|
32
|
+
version: 0.0.2
|
|
33
33
|
skillId: 83fe411c-90a1-4bd3-9271-ac8e03d6a3be
|
|
34
34
|
- name: payment-skill
|
|
35
|
-
version: 0.0.
|
|
35
|
+
version: 0.0.2
|
|
36
36
|
skillId: f2248c02-c6c6-4c3a-89bf-ff09ec11529a
|
|
37
37
|
jobs:
|
|
38
38
|
- name: test-job
|