lua-cli 1.3.2-alpha.3 → 2.0.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.
@@ -16,19 +16,6 @@
16
16
  gap: 16px;
17
17
  }
18
18
 
19
- .loading-spinner {
20
- width: 32px;
21
- height: 32px;
22
- border: 3px solid #3e3e42;
23
- border-top: 3px solid #007acc;
24
- border-radius: 50%;
25
- animation: spin 1s linear infinite;
26
- }
27
-
28
- @keyframes spin {
29
- 0% { transform: rotate(0deg); }
30
- 100% { transform: rotate(360deg); }
31
- }
32
19
 
33
20
  /* Tools List View */
34
21
  .tools-list-view {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lua-cli",
3
- "version": "1.3.2-alpha.3",
3
+ "version": "2.0.0",
4
4
  "description": "Command-line interface for Lua AI platform - develop, test, and deploy LuaSkills with custom tools",
5
5
  "readmeFilename": "README.md",
6
6
  "main": "dist/index.js",
@@ -68,7 +68,8 @@
68
68
  "socket.io-client": "^4.7.2",
69
69
  "ts-morph": "^27.0.0",
70
70
  "ws": "^8.18.3",
71
- "zod": "^4.1.9"
71
+ "zod": "^3.24.1",
72
+ "zod-to-json-schema": "^3.24.6"
72
73
  },
73
74
  "devDependencies": {
74
75
  "@types/inquirer": "^9.0.9",
@@ -0,0 +1,17 @@
1
+ # Example environment variables file
2
+ # Copy this to .env and update with your actual API keys
3
+
4
+ # OpenAI API Key (for AI tools)
5
+ OPENAI_API_KEY=your-openai-api-key-here
6
+
7
+ # Pinecone API Key (for vector search tools)
8
+ PINECONE_API_KEY=your-pinecone-api-key-here
9
+
10
+ # Stripe API Key (for payment tools)
11
+ STRIPE_SECRET_KEY=your-stripe-secret-key-here
12
+
13
+ # Custom application settings
14
+ BASE_URL=http://localhost:3000
15
+ API_KEY=your-api-key-here
16
+
17
+ # Note: Values in lua.skill.yaml will override values in this .env file
@@ -1,17 +1,15 @@
1
1
  agent:
2
- agentId: "baseAgent_agent_1758705162448_cyu7ybbhx"
3
- orgId: "ae25d3f8-5446-4135-806f-daf4ec55d010"
4
- persona: |
5
- Your name is Richard always remember that
6
- welcomeMessage: "Hi, I am your AI assistant. How can I help you today?"
7
-
8
- skill:
9
- name: "test-3"
10
- version: "0.0.1"
11
- skillId: "0aa3b6fe-45b2-40a9-a19c-b7bf85cbc798"
12
- env:
13
- PINECONE_API_KEY: "your-pinecone-api-key-here"
14
- OPENAI_API_KEY: "your-openai-api-key-here"
15
- STRIPE_SECRET_KEY: "your-stripe-secret-key-here"
16
- BASE_URL: "http://localhost:3000"
17
- API_KEY: "1234567890"
2
+ agentId: baseAgent_agent_1758705162448_cyu7ybbhx
3
+ orgId: ae25d3f8-5446-4135-806f-daf4ec55d010
4
+ persona: Your name is Stefan always remember that
5
+ welcomeMessage: 'Hi, I am your AI assistant. How can I help you today?'
6
+ skills:
7
+ - name: general-skill
8
+ version: 0.0.2
9
+ skillId: 24294a5a-bd95-4167-89b1-aebad352196a
10
+ - name: user-data-skill
11
+ version: 0.0.1
12
+ skillId: 5c167305-9f59-4e20-84e9-fd1b50856ec4
13
+ - name: eccomerce-skill
14
+ version: 0.0.1
15
+ skillId: dbec43db-9786-4223-9eac-8087d976d22d
@@ -19,7 +19,7 @@
19
19
  "axios": "^1.6.0",
20
20
  "inquirer": "^12.9.6",
21
21
  "js-yaml": "^4.1.0",
22
- "lua-cli": "1.3.2-alpha.2",
22
+ "lua-cli": "2.0.0",
23
23
  "openai": "^5.23.0",
24
24
  "zod": "^4.1.9"
25
25
  },
@@ -1,5 +1,4 @@
1
1
  import { LuaSkill } from "lua-cli/skill";
2
-
3
2
  import GetWeatherTool from "./tools/GetWeatherTool";
4
3
  import { GetUserDataTool, CreateUserDataTool, UpdateUserDataTool } from "./tools/UserDataTool";
5
4
  import CreatePostTool from "./tools/CreatePostTool";
@@ -7,19 +6,45 @@ import { SearchProductsTool } from "./tools/SearchProducts";
7
6
  import CreatePaymentLinkTool from "./tools/PaymentTool";
8
7
 
9
8
  // Initialize skill with tools
10
- const skill = new LuaSkill({
9
+ const generalSkill = new LuaSkill({
10
+ name: "general-skill",
11
+ version: "0.0.2",
11
12
  description: "A comprehensive Lua skill with weather, user data, post creation, and mathematical tools",
12
13
  context: "This skill provides various utilities including weather information, user data retrieval, post creation, basic calculator operations, and advanced mathematical functions. Use get_weather to fetch current weather conditions for any city, get_user_data to retrieve user information, create_post to publish new posts, calculator for basic arithmetic operations, and advanced_math for complex mathematical computations like factorials, prime checking, fibonacci sequences, and greatest common divisor calculations."
13
14
  });
14
- skill.addTools([
15
- new GetWeatherTool(),
16
- new GetUserDataTool(),
17
- new CreateUserDataTool(),
18
- new UpdateUserDataTool(),
19
- new CreatePostTool(),
20
- new SearchProductsTool(),
21
- new CreatePaymentLinkTool()]
22
- );
15
+
16
+
17
+ generalSkill.addTools([
18
+ new GetWeatherTool(),
19
+ new CreatePostTool()
20
+ ]);
21
+
22
+
23
+ const userDataSkill = new LuaSkill({
24
+ name: "user-data-skill",
25
+ version: "0.0.1",
26
+ description: "A specific Lua skill with user data",
27
+ context: "This skill provides various utilities including user data retrieval, creation, and updating.",
28
+ tools: [
29
+ new GetUserDataTool(),
30
+ new CreateUserDataTool(),
31
+ new UpdateUserDataTool()
32
+ ]
33
+ });
34
+
35
+
36
+ const eccomerceSkill = new LuaSkill({
37
+ name: "eccomerce-skill",
38
+ version: "0.0.1",
39
+ description: "A specific Lua skill with eccomerce",
40
+ context: "This skill provides various utilities including eccomerce."
41
+ });
42
+
43
+ eccomerceSkill.addTools([
44
+ new SearchProductsTool(),
45
+ new CreatePaymentLinkTool()
46
+ ]);
47
+
23
48
 
24
49
  // Test cases
25
50
  const testCases = [
@@ -42,8 +67,12 @@ async function runTests() {
42
67
  for (const [index, testCase] of testCases.entries()) {
43
68
  try {
44
69
  console.log(`Test ${index + 1}: ${testCase.tool}`);
45
- const result = await skill.run(testCase);
46
- console.log("✅ Success:", result);
70
+ const resultGeneral = await generalSkill.run(testCase);
71
+ console.log("✅ Success:", resultGeneral);
72
+ const resultUserData = await userDataSkill.run(testCase);
73
+ console.log("✅ Success:", resultUserData);
74
+ const resultEccomerce = await eccomerceSkill.run(testCase);
75
+ console.log("✅ Success:", resultEccomerce);
47
76
  } catch (error: any) {
48
77
  console.log("❌ Error:", error.message);
49
78
  }
@@ -6,8 +6,7 @@ export default class CreatePaymentLinkTool implements LuaTool {
6
6
  description = "Create a Stripe payment link for a one-time payment";
7
7
  inputSchema = z.object({
8
8
  amount: z.number().int().positive(), // in cents
9
- currency: z.string().default("usd"),
10
- quantity: z.number().int().positive().default(1),
9
+ currency: z.string().default("usd")
11
10
  });
12
11
  outputSchema = z.object({
13
12
  url: z.string(),
@@ -32,7 +31,7 @@ export default class CreatePaymentLinkTool implements LuaTool {
32
31
  "line_items[0][price_data][currency]": input.currency,
33
32
  "line_items[0][price_data][product_data][name]": "One-time Payment",
34
33
  "line_items[0][price_data][unit_amount]": input.amount.toString(),
35
- "line_items[0][quantity]": input.quantity.toString(),
34
+ "line_items[0][quantity]": "1",
36
35
  success_url: "https://example.com/success",
37
36
  cancel_url: "https://example.com/cancel",
38
37
  }),
File without changes
@@ -1,130 +0,0 @@
1
- "use strict";
2
- // import fs from 'fs';
3
- // import path from 'path';
4
- // import inquirer from 'inquirer';
5
- // import { loadApiKey, checkApiKey } from '../services/auth.js';
6
- // import { readSkillConfig } from '../utils/files.js';
7
- // export interface VersionInfo {
8
- // version: string;
9
- // createdDate: string;
10
- // createdBy: string;
11
- // isCurrent: boolean;
12
- // createdByEmail: string;
13
- // createdByFullName: string;
14
- // }
15
- // export interface VersionsResponse {
16
- // versions: VersionInfo[];
17
- // }
18
- // export interface PublishResponse {
19
- // message: string;
20
- // skillId: string;
21
- // activeVersionId: string;
22
- // publishedAt: string;
23
- // }
24
- // export async function fetchVersions(apiKey: string, agentId: string, skillId: string): Promise<VersionsResponse> {
25
- // try {
26
- // const response = await fetch(`http://localhost:3022/developer/skills/${agentId}/${skillId}/versions`, {
27
- // method: "GET",
28
- // headers: {
29
- // "accept": "application/json",
30
- // "Authorization": `Bearer ${apiKey}`
31
- // }
32
- // });
33
- // if (!response.ok) {
34
- // throw new Error(`Failed to fetch versions: ${response.status} ${response.statusText}`);
35
- // }
36
- // return await response.json() as VersionsResponse;
37
- // } catch (error) {
38
- // console.error("❌ Error fetching versions:", error);
39
- // throw error;
40
- // }
41
- // }
42
- // export async function publishVersion(apiKey: string, agentId: string, skillId: string, version: string): Promise<PublishResponse> {
43
- // try {
44
- // const response = await fetch(`http://localhost:3022/developer/skills/${agentId}/${skillId}/${version}/publish`, {
45
- // method: "PUT",
46
- // headers: {
47
- // "accept": "application/json",
48
- // "Authorization": `Bearer ${apiKey}`
49
- // }
50
- // });
51
- // if (!response.ok) {
52
- // throw new Error(`Failed to publish version: ${response.status} ${response.statusText}`);
53
- // }
54
- // return await response.json() as PublishResponse;
55
- // } catch (error) {
56
- // console.error("❌ Error publishing version:", error);
57
- // throw error;
58
- // }
59
- // }
60
- // function formatVersionChoice(version: VersionInfo): string {
61
- // const currentIndicator = version.isCurrent ? ' (CURRENT)' : '';
62
- // const date = new Date(version.createdDate).toLocaleDateString();
63
- // return `${version.version}${currentIndicator} - Created: ${date} by ${version.createdByEmail}`;
64
- // }
65
- // export async function deployCommand(): Promise<void> {
66
- // try {
67
- // // Check if we're in a skill directory
68
- // const config = readSkillConfig();
69
- // if (!config || !config.agent?.agentId || !config.skill?.skillId) {
70
- // console.error("❌ No lua.skill.yaml found or missing agentId/skillId. Please run this command from a skill directory.");
71
- // process.exit(1);
72
- // }
73
- // // Load API key
74
- // const apiKey = await loadApiKey();
75
- // if (!apiKey) {
76
- // console.error("❌ No API key found. Please run 'lua configure' to set up your API key.");
77
- // process.exit(1);
78
- // }
79
- // // Validate API key
80
- // const userData = await checkApiKey(apiKey);
81
- // console.log(`✅ Authenticated as ${userData.email}`);
82
- // // Fetch available versions
83
- // console.log("🔄 Fetching available versions...");
84
- // const versionsResponse = await fetchVersions(apiKey, config.agent.agentId, config.skill.skillId);
85
- // if (!versionsResponse.versions || versionsResponse.versions.length === 0) {
86
- // console.log("❌ No versions found for this skill.");
87
- // process.exit(1);
88
- // }
89
- // // Sort versions by creation date (newest first)
90
- // const sortedVersions = versionsResponse.versions.sort((a, b) =>
91
- // new Date(b.createdDate).getTime() - new Date(a.createdDate).getTime()
92
- // );
93
- // // Let user select a version
94
- // const { selectedVersion } = await inquirer.prompt([
95
- // {
96
- // type: "list",
97
- // name: "selectedVersion",
98
- // message: "Select a version to deploy:",
99
- // choices: sortedVersions.map(version => ({
100
- // name: formatVersionChoice(version),
101
- // value: version.version
102
- // }))
103
- // }
104
- // ]);
105
- // // Show warning and confirm deployment
106
- // const { confirmed } = await inquirer.prompt([
107
- // {
108
- // type: "confirm",
109
- // name: "confirmed",
110
- // message: "⚠️ Warning: This version will be deployed to all users. Do you want to proceed?",
111
- // default: false
112
- // }
113
- // ]);
114
- // if (!confirmed) {
115
- // console.log("❌ Deployment cancelled.");
116
- // process.exit(0);
117
- // }
118
- // // Publish the selected version
119
- // console.log(`🔄 Publishing version ${selectedVersion}...`);
120
- // const publishResponse = await publishVersion(apiKey, config.agent.agentId, config.skill.skillId, selectedVersion);
121
- // console.log("✅ Deployment successful!");
122
- // console.log(`📦 Version: ${publishResponse.activeVersionId}`);
123
- // console.log(`🆔 Skill ID: ${publishResponse.skillId}`);
124
- // console.log(`📅 Published at: ${new Date(publishResponse.publishedAt).toLocaleString()}`);
125
- // console.log(`💬 ${publishResponse.message}`);
126
- // } catch (error: any) {
127
- // console.error("❌ Error during deployment:", error.message);
128
- // process.exit(1);
129
- // }
130
- // }
@@ -1,39 +0,0 @@
1
- const fs = require('fs');
2
-
3
- // Read the compiled search_movies.js file
4
- const searchMoviesCode = fs.readFileSync('.lua/search_movies.js', 'utf8');
5
-
6
- // Create a test function with env function
7
- const testFunction = `
8
- // Mock env function
9
- const env = (key) => {
10
- const envVars = {
11
- 'PINECONE_API_KEY': 'test-pinecone-key',
12
- 'OPENAI_API_KEY': 'test-openai-key'
13
- };
14
- return envVars[key];
15
- };
16
-
17
- ${searchMoviesCode}
18
-
19
- // Test the function
20
- (async () => {
21
- try {
22
- console.log('Testing SearchMovies tool...');
23
- const result = await module.exports({ query: 'avatar' });
24
- console.log('✅ Success:', result);
25
- } catch (error) {
26
- console.log('❌ Error:', error.message);
27
- if (error.message.includes('FormData is not defined')) {
28
- console.log('❌ FormData error still exists - recursive bundling not working');
29
- } else {
30
- console.log('✅ FormData error resolved - recursive bundling working');
31
- }
32
- }
33
- })();
34
- `;
35
-
36
- // Write test file
37
- fs.writeFileSync('test-searchmovies.cjs', testFunction);
38
-
39
- console.log('Test file created. Run: node test-searchmovies.cjs');