lua-cli 3.1.0-alpha.1 → 3.1.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/README.md +8 -1
- package/dist/api/marketplace.api.service.d.ts +25 -0
- package/dist/api/marketplace.api.service.js +105 -0
- package/dist/cli/command-definitions.d.ts +6 -0
- package/dist/cli/command-definitions.js +25 -1
- package/dist/commands/env.d.ts +11 -0
- package/dist/commands/env.js +1 -79
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +1 -0
- package/dist/commands/marketplace.d.ts +12 -0
- package/dist/commands/marketplace.js +1593 -0
- package/dist/common/user.instance.js +1 -1
- package/dist/config/constants.d.ts +1 -1
- package/dist/config/constants.js +5 -1
- package/dist/index.js +6 -4
- package/dist/interfaces/marketplace.d.ts +99 -0
- package/dist/interfaces/marketplace.js +2 -0
- package/dist/types/compile.types.d.ts +48 -41
- package/dist/types/compile.types.js +1 -0
- package/dist/utils/env-loader.utils.d.ts +9 -0
- package/dist/utils/env-loader.utils.js +88 -0
- package/dist/utils/job-management.d.ts +3 -3
- package/dist/utils/postprocessor-management.d.ts +3 -3
- package/dist/utils/preprocessor-management.d.ts +3 -3
- package/dist/utils/semver.d.ts +27 -0
- package/dist/utils/semver.js +75 -0
- package/dist/utils/skill-management.d.ts +4 -4
- package/dist/utils/webhook-management.d.ts +3 -3
- package/dist/web/app.css +0 -358
- package/package.json +1 -1
- package/template/README.md +13 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Base URLs for the API, Auth, and Chat - Development
|
|
6
6
|
*/
|
|
7
7
|
export declare const BASE_URLS: {
|
|
8
|
-
readonly API: "
|
|
8
|
+
readonly API: "http://localhost:3001";
|
|
9
9
|
readonly AUTH: "https://auth.heylua.ai";
|
|
10
10
|
readonly CHAT: "https://api.heylua.ai";
|
|
11
11
|
readonly WEBHOOK: "https://webhook.heylua.ai";
|
package/dist/config/constants.js
CHANGED
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
* Base URLs for the API, Auth, and Chat - Development
|
|
12
12
|
*/
|
|
13
13
|
export const BASE_URLS = {
|
|
14
|
-
API: 'https://api.heylua.ai',
|
|
14
|
+
// API: 'https://api.heylua.ai',
|
|
15
|
+
// AUTH: 'https://auth.heylua.ai',
|
|
16
|
+
// CHAT: 'https://api.heylua.ai',
|
|
17
|
+
// WEBHOOK: 'https://webhook.heylua.ai',
|
|
18
|
+
API: 'http://localhost:3001',
|
|
15
19
|
AUTH: 'https://auth.heylua.ai',
|
|
16
20
|
CHAT: 'https://api.heylua.ai',
|
|
17
21
|
WEBHOOK: 'https://webhook.heylua.ai',
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* For more information: https://docs.heylua.ai
|
|
10
10
|
*/
|
|
11
11
|
import { Command } from "commander";
|
|
12
|
-
import { setupAuthCommands, setupSkillCommands } from "./cli/command-definitions.js";
|
|
12
|
+
import { setupAuthCommands, setupSkillCommands, setupMarketplaceCommands } from "./cli/command-definitions.js";
|
|
13
13
|
import { readFileSync } from "fs";
|
|
14
14
|
import { fileURLToPath } from "url";
|
|
15
15
|
import { dirname, join } from "path";
|
|
@@ -63,12 +63,14 @@ Examples:
|
|
|
63
63
|
$ lua admin 🔧 Open admin dashboard
|
|
64
64
|
$ lua docs 📖 Open documentation
|
|
65
65
|
$ lua completion 🎯 Enable shell autocomplete
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
🌙
|
|
66
|
+
$ lua marketplace 🛍️ Interact with the Lua Marketplace
|
|
67
|
+
|
|
68
|
+
🌙 Documentation: https://docs.heylua.ai
|
|
69
|
+
🌙 Support: https://heylua.ai/support
|
|
69
70
|
`);
|
|
70
71
|
// Set up all command groups
|
|
71
72
|
setupAuthCommands(program);
|
|
72
73
|
setupSkillCommands(program);
|
|
74
|
+
setupMarketplaceCommands(program);
|
|
73
75
|
// Parse command-line arguments
|
|
74
76
|
program.parse(process.argv);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export interface EnvVarMetadata {
|
|
2
|
+
description: string;
|
|
3
|
+
required: boolean;
|
|
4
|
+
example?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Marketplace Skill Version Response
|
|
8
|
+
*/
|
|
9
|
+
export interface MarketplaceVersionResponse {
|
|
10
|
+
id: string;
|
|
11
|
+
marketplaceSkillId: string;
|
|
12
|
+
version: string;
|
|
13
|
+
description: string;
|
|
14
|
+
changelog?: string;
|
|
15
|
+
context?: any;
|
|
16
|
+
tools?: any;
|
|
17
|
+
envVarsMetadata?: Record<string, EnvVarMetadata>;
|
|
18
|
+
approvalStatus: string;
|
|
19
|
+
published: boolean;
|
|
20
|
+
approvalNotes?: string;
|
|
21
|
+
approvedBy?: string;
|
|
22
|
+
approvedAt?: Date | string;
|
|
23
|
+
createdBy: string;
|
|
24
|
+
createdAt: Date | string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Complete Marketplace Skill Response with all details and versions
|
|
28
|
+
*/
|
|
29
|
+
export interface MarketplaceSkillWithVersionsResponse {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
displayName: string;
|
|
33
|
+
description: string;
|
|
34
|
+
longDescription?: string;
|
|
35
|
+
category?: string;
|
|
36
|
+
tags: string[];
|
|
37
|
+
creatorId: string;
|
|
38
|
+
sourceSkillId: string;
|
|
39
|
+
listed: boolean;
|
|
40
|
+
verified: boolean;
|
|
41
|
+
featured: boolean;
|
|
42
|
+
published: boolean;
|
|
43
|
+
installCount: number;
|
|
44
|
+
activeInstallCount: number;
|
|
45
|
+
iconUrl?: string;
|
|
46
|
+
screenshots?: string[];
|
|
47
|
+
repositoryUrl?: string;
|
|
48
|
+
documentationUrl?: string;
|
|
49
|
+
listedAt?: Date | string;
|
|
50
|
+
createdAt: Date | string;
|
|
51
|
+
updatedAt: Date | string;
|
|
52
|
+
versions: MarketplaceVersionResponse[];
|
|
53
|
+
versionsCount: number;
|
|
54
|
+
pendingVersionsCount: number;
|
|
55
|
+
approvedVersionsCount: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Skill Response (including installed marketplace skills)
|
|
59
|
+
*/
|
|
60
|
+
export interface SkillResponse {
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
title: string;
|
|
64
|
+
description: string;
|
|
65
|
+
public: boolean;
|
|
66
|
+
agentId: string;
|
|
67
|
+
active: boolean;
|
|
68
|
+
activeVersionId?: string;
|
|
69
|
+
version?: any;
|
|
70
|
+
versionContext?: string;
|
|
71
|
+
installedFromMarketplace: boolean;
|
|
72
|
+
marketplaceSkillId?: string;
|
|
73
|
+
marketplaceInstallMetadata?: {
|
|
74
|
+
installedVersionId: string;
|
|
75
|
+
installedBy: string;
|
|
76
|
+
installedAt: Date | string;
|
|
77
|
+
};
|
|
78
|
+
createdBy: string;
|
|
79
|
+
createdAt: Date | string;
|
|
80
|
+
updatedAt: Date | string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Unpublish Version Response
|
|
84
|
+
*/
|
|
85
|
+
export interface UnpublishVersionResponse {
|
|
86
|
+
message: string;
|
|
87
|
+
success: boolean;
|
|
88
|
+
skillUnlisted: boolean;
|
|
89
|
+
versionId: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Unlist Skill Response
|
|
93
|
+
*/
|
|
94
|
+
export interface UnlistSkillResponse {
|
|
95
|
+
message: string;
|
|
96
|
+
success: boolean;
|
|
97
|
+
unlisted: boolean;
|
|
98
|
+
versionsUnpublished: number;
|
|
99
|
+
}
|
|
@@ -47,47 +47,54 @@ export interface JobMetadata {
|
|
|
47
47
|
/**
|
|
48
48
|
* Configuration from lua.skill.yaml
|
|
49
49
|
*/
|
|
50
|
-
export interface
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
50
|
+
export interface LegacyYamlConfigSkill {
|
|
51
|
+
name?: string;
|
|
52
|
+
version?: string;
|
|
53
|
+
skillId?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
context?: string;
|
|
56
|
+
env?: Record<string, string>;
|
|
57
|
+
}
|
|
58
|
+
export interface YamlConfigAgent {
|
|
59
|
+
agentId?: string;
|
|
60
|
+
orgId?: string;
|
|
61
|
+
persona?: string;
|
|
62
|
+
welcomeMessage?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface YamlConfigSkill {
|
|
65
|
+
name: string;
|
|
66
|
+
version: string;
|
|
67
|
+
skillId: string;
|
|
68
|
+
}
|
|
69
|
+
export interface YamlConfigWebhook {
|
|
70
|
+
name: string;
|
|
71
|
+
version: string;
|
|
72
|
+
webhookId: string;
|
|
73
|
+
}
|
|
74
|
+
export interface YamlConfigJob {
|
|
75
|
+
name: string;
|
|
76
|
+
version: string;
|
|
77
|
+
jobId: string;
|
|
78
|
+
schedule?: any;
|
|
79
|
+
}
|
|
80
|
+
export interface YamlConfigPreprocessor {
|
|
81
|
+
name: string;
|
|
82
|
+
version: string;
|
|
83
|
+
preprocessorId: string;
|
|
84
|
+
}
|
|
85
|
+
export interface YamlConfigPostprocessor {
|
|
86
|
+
name: string;
|
|
87
|
+
version: string;
|
|
88
|
+
postprocessorId: string;
|
|
89
|
+
}
|
|
90
|
+
export interface YamlConfig {
|
|
91
|
+
skill?: LegacyYamlConfigSkill;
|
|
92
|
+
agent?: YamlConfigAgent;
|
|
93
|
+
skills?: YamlConfigSkill[];
|
|
94
|
+
webhooks?: YamlConfigWebhook[];
|
|
95
|
+
jobs?: YamlConfigJob[];
|
|
96
|
+
preprocessors?: YamlConfigPreprocessor[];
|
|
97
|
+
postprocessors?: YamlConfigPostprocessor[];
|
|
91
98
|
}
|
|
92
99
|
/**
|
|
93
100
|
* Deployment data format for new deployment system
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EnvCommandContext, EnvVariable } from "../commands/env";
|
|
2
|
+
/**
|
|
3
|
+
* Load environment variables based on context
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadEnvironmentVariables(context: EnvCommandContext): Promise<EnvVariable[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Load sandbox environment variables from .env file
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadSandboxEnvVariables(): EnvVariable[];
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
/**
|
|
4
|
+
* Load environment variables based on context
|
|
5
|
+
*/
|
|
6
|
+
export async function loadEnvironmentVariables(context) {
|
|
7
|
+
if (context.environment === "sandbox") {
|
|
8
|
+
return loadSandboxEnvVariables();
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return loadProductionEnvVariables(context);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Load sandbox environment variables from .env file
|
|
16
|
+
*/
|
|
17
|
+
export function loadSandboxEnvVariables() {
|
|
18
|
+
const envFilePath = path.join(process.cwd(), ".env");
|
|
19
|
+
if (!fs.existsSync(envFilePath)) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const content = fs.readFileSync(envFilePath, "utf8");
|
|
24
|
+
return parseEnvContent(content);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error("❌ Error reading .env file:", error);
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Load production environment variables from API
|
|
33
|
+
*/
|
|
34
|
+
async function loadProductionEnvVariables(context) {
|
|
35
|
+
try {
|
|
36
|
+
if (!context.developerApi) {
|
|
37
|
+
throw new Error("Developer API not initialized");
|
|
38
|
+
}
|
|
39
|
+
const response = await context.developerApi.getEnvironmentVariables();
|
|
40
|
+
if (!response.success) {
|
|
41
|
+
throw new Error(response.error?.message || "Failed to load environment variables");
|
|
42
|
+
}
|
|
43
|
+
// The API returns environment variables nested in a 'data' property
|
|
44
|
+
// Response structure: { success: true, data: { data: { KEY: "value", ... }, _id: "...", ... } }
|
|
45
|
+
const envData = response.data?.data || response.data;
|
|
46
|
+
if (envData && typeof envData === "object") {
|
|
47
|
+
// Filter out metadata fields like _id, agentId, createdAt, updatedAt, __v
|
|
48
|
+
const metadataKeys = [
|
|
49
|
+
"_id",
|
|
50
|
+
"agentId",
|
|
51
|
+
"data",
|
|
52
|
+
"createdAt",
|
|
53
|
+
"updatedAt",
|
|
54
|
+
"__v",
|
|
55
|
+
];
|
|
56
|
+
return Object.entries(envData)
|
|
57
|
+
.filter(([key]) => !metadataKeys.includes(key))
|
|
58
|
+
.map(([key, value]) => ({
|
|
59
|
+
key,
|
|
60
|
+
value: String(value),
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
console.error("❌ Error loading production env variables:", error);
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Parse .env file content into variables
|
|
72
|
+
*/
|
|
73
|
+
function parseEnvContent(content) {
|
|
74
|
+
if (!content.trim())
|
|
75
|
+
return [];
|
|
76
|
+
return content
|
|
77
|
+
.split("\n")
|
|
78
|
+
.map((line) => line.trim())
|
|
79
|
+
.filter((line) => line && !line.startsWith("#"))
|
|
80
|
+
.map((line) => {
|
|
81
|
+
const [key, ...valueParts] = line.split("=");
|
|
82
|
+
return {
|
|
83
|
+
key: key?.trim() || "",
|
|
84
|
+
value: valueParts.join("=") || "",
|
|
85
|
+
};
|
|
86
|
+
})
|
|
87
|
+
.filter((item) => item.key);
|
|
88
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Job Management Utilities
|
|
3
3
|
* Handles job creation via API and YAML configuration management
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { YamlConfig } from '../types/compile.types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Ensures all detected jobs exist in the YAML config with valid job IDs.
|
|
8
8
|
* If a job doesn't exist or has no ID, creates it via the API.
|
|
@@ -11,7 +11,7 @@ import { SkillConfig } from '../types/compile.types.js';
|
|
|
11
11
|
* @param config - The skill configuration from lua.skill.yaml
|
|
12
12
|
* @returns Updated jobs array with valid job IDs
|
|
13
13
|
*/
|
|
14
|
-
export declare function ensureJobsExistInYaml(jobsArray: any[], config:
|
|
14
|
+
export declare function ensureJobsExistInYaml(jobsArray: any[], config: YamlConfig): Promise<any[]>;
|
|
15
15
|
/**
|
|
16
16
|
* Syncs the server jobs with the YAML configuration.
|
|
17
17
|
* Performs a two-way sync:
|
|
@@ -21,4 +21,4 @@ export declare function ensureJobsExistInYaml(jobsArray: any[], config: SkillCon
|
|
|
21
21
|
* @param config - The skill configuration from lua.skill.yaml
|
|
22
22
|
* @returns Array of messages about sync operations
|
|
23
23
|
*/
|
|
24
|
-
export declare function syncServerJobsWithYaml(config:
|
|
24
|
+
export declare function syncServerJobsWithYaml(config: YamlConfig): Promise<string[]>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PostProcessor Management Utilities
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { YamlConfig } from '../types/compile.types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Ensures all detected postprocessors exist in the YAML config with valid IDs.
|
|
7
7
|
*/
|
|
8
|
-
export declare function ensurePostProcessorsExistInYaml(postprocessorsArray: any[], config:
|
|
9
|
-
export declare function syncServerPostProcessorsWithYaml(config:
|
|
8
|
+
export declare function ensurePostProcessorsExistInYaml(postprocessorsArray: any[], config: YamlConfig): Promise<any[]>;
|
|
9
|
+
export declare function syncServerPostProcessorsWithYaml(config: YamlConfig): Promise<string[]>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PreProcessor Management Utilities
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { YamlConfig } from '../types/compile.types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Ensures all detected preprocessors exist in the YAML config with valid IDs.
|
|
7
7
|
*/
|
|
8
|
-
export declare function ensurePreProcessorsExistInYaml(preprocessorsArray: any[], config:
|
|
9
|
-
export declare function syncServerPreProcessorsWithYaml(config:
|
|
8
|
+
export declare function ensurePreProcessorsExistInYaml(preprocessorsArray: any[], config: YamlConfig): Promise<any[]>;
|
|
9
|
+
export declare function syncServerPreProcessorsWithYaml(config: YamlConfig): Promise<string[]>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic Versioning Utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Parses a semantic version string into its components.
|
|
6
|
+
* Supports standard semver (X.Y.Z) and pre-release tags (X.Y.Z-tag).
|
|
7
|
+
*
|
|
8
|
+
* @param version The version string to parse
|
|
9
|
+
* @returns Object containing major, minor, patch, and preRelease components
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseVersion(version: string): {
|
|
12
|
+
major: number;
|
|
13
|
+
minor: number;
|
|
14
|
+
patch: number;
|
|
15
|
+
preRelease: string | null;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Compares two semantic version strings.
|
|
19
|
+
*
|
|
20
|
+
* @param version1 First version string
|
|
21
|
+
* @param version2 Second version string
|
|
22
|
+
* @returns number:
|
|
23
|
+
* - negative if version1 < version2
|
|
24
|
+
* - positive if version1 > version2
|
|
25
|
+
* - 0 if version1 === version2
|
|
26
|
+
*/
|
|
27
|
+
export declare function compareVersions(version1: string, version2: string): number;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic Versioning Utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Parses a semantic version string into its components.
|
|
6
|
+
* Supports standard semver (X.Y.Z) and pre-release tags (X.Y.Z-tag).
|
|
7
|
+
*
|
|
8
|
+
* @param version The version string to parse
|
|
9
|
+
* @returns Object containing major, minor, patch, and preRelease components
|
|
10
|
+
*/
|
|
11
|
+
export function parseVersion(version) {
|
|
12
|
+
const [versionPart, preReleasePart] = version.split('-');
|
|
13
|
+
const [major, minor, patch] = versionPart.split('.').map(Number);
|
|
14
|
+
const preRelease = preReleasePart ? preReleasePart.split('+')[0] : null;
|
|
15
|
+
return {
|
|
16
|
+
major: isNaN(major) ? 0 : major,
|
|
17
|
+
minor: isNaN(minor) ? 0 : minor,
|
|
18
|
+
patch: isNaN(patch) ? 0 : patch,
|
|
19
|
+
preRelease
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Compares two semantic version strings.
|
|
24
|
+
*
|
|
25
|
+
* @param version1 First version string
|
|
26
|
+
* @param version2 Second version string
|
|
27
|
+
* @returns number:
|
|
28
|
+
* - negative if version1 < version2
|
|
29
|
+
* - positive if version1 > version2
|
|
30
|
+
* - 0 if version1 === version2
|
|
31
|
+
*/
|
|
32
|
+
export function compareVersions(version1, version2) {
|
|
33
|
+
const v1 = parseVersion(version1);
|
|
34
|
+
const v2 = parseVersion(version2);
|
|
35
|
+
// Compare major.minor.patch first
|
|
36
|
+
if (v1.major !== v2.major)
|
|
37
|
+
return v1.major - v2.major;
|
|
38
|
+
if (v1.minor !== v2.minor)
|
|
39
|
+
return v1.minor - v2.minor;
|
|
40
|
+
if (v1.patch !== v2.patch)
|
|
41
|
+
return v1.patch - v2.patch;
|
|
42
|
+
// If major.minor.patch are equal, compare pre-release identifiers
|
|
43
|
+
// A version without a pre-release tag is always greater than one with a tag
|
|
44
|
+
if (v1.preRelease && !v2.preRelease)
|
|
45
|
+
return -1; // pre-release is lower than release
|
|
46
|
+
if (!v1.preRelease && v2.preRelease)
|
|
47
|
+
return 1; // release is higher than pre-release
|
|
48
|
+
if (!v1.preRelease && !v2.preRelease)
|
|
49
|
+
return 0; // both are releases
|
|
50
|
+
// Both have pre-release identifiers, compare them
|
|
51
|
+
const preReleaseOrder = ['alpha', 'beta', 'rc', 'preview', 'dev'];
|
|
52
|
+
const getPreReleaseType = (preRelease) => {
|
|
53
|
+
// Extract the type part (e.g., "alpha" from "alpha.1")
|
|
54
|
+
const type = preRelease.toLowerCase().split('.')[0].replace(/[0-9]/g, '');
|
|
55
|
+
const index = preReleaseOrder.indexOf(type);
|
|
56
|
+
return index === -1 ? preReleaseOrder.length : index; // Unknown types go to end
|
|
57
|
+
};
|
|
58
|
+
const type1 = getPreReleaseType(v1.preRelease);
|
|
59
|
+
const type2 = getPreReleaseType(v2.preRelease);
|
|
60
|
+
if (type1 !== type2)
|
|
61
|
+
return type1 - type2;
|
|
62
|
+
// Same pre-release type, compare the full pre-release string lexicographically
|
|
63
|
+
// or try to compare numeric parts if they exist (e.g., alpha.1 vs alpha.2)
|
|
64
|
+
const getPreReleaseNum = (preRelease) => {
|
|
65
|
+
const parts = preRelease.split('.');
|
|
66
|
+
const num = parts.length > 1 ? parseInt(parts[parts.length - 1], 10) : -1;
|
|
67
|
+
return isNaN(num) ? -1 : num;
|
|
68
|
+
};
|
|
69
|
+
const num1 = getPreReleaseNum(v1.preRelease);
|
|
70
|
+
const num2 = getPreReleaseNum(v2.preRelease);
|
|
71
|
+
if (num1 !== -1 && num2 !== -1 && num1 !== num2) {
|
|
72
|
+
return num1 - num2;
|
|
73
|
+
}
|
|
74
|
+
return v1.preRelease.localeCompare(v2.preRelease);
|
|
75
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Skill Management Utilities
|
|
3
3
|
* Handles skill creation via API and YAML configuration management
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { YamlConfig } from '../types/compile.types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Ensures all detected skills exist in the YAML config with valid skill IDs.
|
|
8
8
|
* If a skill doesn't exist or has no ID, creates it via the API.
|
|
@@ -11,7 +11,7 @@ import { SkillConfig } from '../types/compile.types.js';
|
|
|
11
11
|
* @param config - The skill configuration from lua.skill.yaml
|
|
12
12
|
* @returns Updated skills array with valid skill IDs
|
|
13
13
|
*/
|
|
14
|
-
export declare function ensureSkillsExistInYaml(skillsArray: any[], config:
|
|
14
|
+
export declare function ensureSkillsExistInYaml(skillsArray: any[], config: YamlConfig): Promise<any[]>;
|
|
15
15
|
/**
|
|
16
16
|
* Updates the YAML file with skills from the deploy.json file.
|
|
17
17
|
* This ensures the YAML reflects what's actually in the compiled code.
|
|
@@ -21,7 +21,7 @@ export declare function ensureSkillsExistInYaml(skillsArray: any[], config: Skil
|
|
|
21
21
|
* @param deployJsonPath - Path to the deploy.json file
|
|
22
22
|
* @param config - Current skill configuration
|
|
23
23
|
*/
|
|
24
|
-
export declare function syncYamlWithDeployJson(deployJsonPath: string, config:
|
|
24
|
+
export declare function syncYamlWithDeployJson(deployJsonPath: string, config: YamlConfig): Promise<void>;
|
|
25
25
|
/**
|
|
26
26
|
* Syncs the server skills with the YAML configuration.
|
|
27
27
|
* Performs a two-way sync:
|
|
@@ -31,4 +31,4 @@ export declare function syncYamlWithDeployJson(deployJsonPath: string, config: S
|
|
|
31
31
|
* @param config - The skill configuration from lua.skill.yaml
|
|
32
32
|
* @returns Array of messages about sync operations
|
|
33
33
|
*/
|
|
34
|
-
export declare function syncServerSkillsWithYaml(config:
|
|
34
|
+
export declare function syncServerSkillsWithYaml(config: YamlConfig): Promise<string[]>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Webhook Management Utilities
|
|
3
3
|
* Handles webhook creation via API and YAML configuration management
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { YamlConfig } from '../types/compile.types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Ensures all detected webhooks exist in the YAML config with valid webhook IDs.
|
|
8
8
|
* If a webhook doesn't exist or has no ID, creates it via the API.
|
|
@@ -11,7 +11,7 @@ import { SkillConfig } from '../types/compile.types.js';
|
|
|
11
11
|
* @param config - The skill configuration from lua.skill.yaml
|
|
12
12
|
* @returns Updated webhooks array with valid webhook IDs
|
|
13
13
|
*/
|
|
14
|
-
export declare function ensureWebhooksExistInYaml(webhooksArray: any[], config:
|
|
14
|
+
export declare function ensureWebhooksExistInYaml(webhooksArray: any[], config: YamlConfig): Promise<any[]>;
|
|
15
15
|
/**
|
|
16
16
|
* Syncs the server webhooks with the YAML configuration.
|
|
17
17
|
* Performs a two-way sync:
|
|
@@ -21,4 +21,4 @@ export declare function ensureWebhooksExistInYaml(webhooksArray: any[], config:
|
|
|
21
21
|
* @param config - The skill configuration from lua.skill.yaml
|
|
22
22
|
* @returns Array of messages about sync operations
|
|
23
23
|
*/
|
|
24
|
-
export declare function syncServerWebhooksWithYaml(config:
|
|
24
|
+
export declare function syncServerWebhooksWithYaml(config: YamlConfig): Promise<string[]>;
|