lua-cli 1.1.4-beta.1 → 1.1.4-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lua-cli",
3
- "version": "1.1.4-beta.1",
3
+ "version": "1.1.4-beta.2",
4
4
  "description": "Command-line interface for Lua AI platform - manage agents, organizations, and skills",
5
5
  "readmeFilename": "README.md",
6
6
  "main": "dist/index.js",
@@ -44,6 +44,7 @@
44
44
  },
45
45
  "files": [
46
46
  "dist/**/*",
47
+ "template/**/*",
47
48
  "README.md",
48
49
  "CHANGELOG.md",
49
50
  "LICENSE"
@@ -0,0 +1,95 @@
1
+ {
2
+ "version": "1.0.1-beta.0",
3
+ "skillsName": "lua-skill",
4
+ "tools": [
5
+ {
6
+ "name": "get_weather",
7
+ "description": "Get the weather for a given city",
8
+ "inputSchema": {
9
+ "type": "object",
10
+ "properties": {
11
+ "city": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "required": [
16
+ "city"
17
+ ]
18
+ },
19
+ "outputSchema": {
20
+ "type": "object",
21
+ "properties": {
22
+ "city": {
23
+ "type": "string"
24
+ }
25
+ },
26
+ "required": [
27
+ "city"
28
+ ]
29
+ },
30
+ "execute": "async (input) => {\nconst { z } = require('zod');\nclass GetWeatherMain {\n\n constructor() {\n }\n\n async getWeather(city) {\n return { weather: \"sunny\", city: city };\n }\n\n}\n\n return { weather: \"sunny\", city: input.city \n}"
31
+ },
32
+ {
33
+ "name": "get_user_data",
34
+ "description": "Get the user data for a given user id",
35
+ "inputSchema": {
36
+ "type": "object",
37
+ "properties": {
38
+ "userId": {
39
+ "type": "string"
40
+ }
41
+ },
42
+ "required": [
43
+ "userId"
44
+ ]
45
+ },
46
+ "outputSchema": {
47
+ "type": "object",
48
+ "properties": {
49
+ "userId": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "required": [
54
+ "userId"
55
+ ]
56
+ },
57
+ "execute": "async (input) => {\nconst { z } = require('zod');\nconst axios = require('axios');\nclass ApiService {\n\n baseUrl;\n timeout;\n \n constructor() {\n this.baseUrl = \"https://httpbin.org\";\n this.timeout = 5000;\n }\n\n async fetchUserData(userId) {\n try {\n const response = await axios.get(`${this.baseUrl}/get`, {\n params: { userId },\n timeout: this.timeout,\n headers: {\n 'Content-Type': 'application/json',\n 'User-Agent': 'Lua-Skill/1.0'\n }\n });\n \n return {\n id: userId,\n name: response.data.args.userId || 'Unknown',\n url: response.data.url,\n status: 'success',\n timestamp: new Date().toISOString()\n };\n } catch (error) {\n return {\n id: userId,\n name: 'Unknown',\n url: null,\n status: 'error',\n error: error.message,\n timestamp: new Date().toISOString()\n };\n }\n }\n\n async createPost(title, content) {\n try {\n const response = await axios.post(`${this.baseUrl}/post`, {\n title,\n content,\n publishedAt: new Date().toISOString()\n }, {\n timeout: this.timeout,\n headers: {\n 'Content-Type': 'application/json'\n }\n });\n \n return {\n id: response.data.json.title || 'generated-id',\n title: response.data.json.title,\n status: 'created',\n url: response.data.url\n };\n } catch (error) {\n return {\n id: null,\n title,\n status: 'error',\n error: error.message,\n url: null\n };\n }\n }\n\n}\nconst apiService = new ApiService();\n\n return apiService.fetchUserData(input.userId);\n \n}"
58
+ },
59
+ {
60
+ "name": "create_post",
61
+ "description": "Create a new post",
62
+ "inputSchema": {
63
+ "type": "object",
64
+ "properties": {
65
+ "title": {
66
+ "type": "string"
67
+ },
68
+ "content": {
69
+ "type": "string"
70
+ }
71
+ },
72
+ "required": [
73
+ "title",
74
+ "content"
75
+ ]
76
+ },
77
+ "outputSchema": {
78
+ "type": "object",
79
+ "properties": {
80
+ "title": {
81
+ "type": "string"
82
+ },
83
+ "content": {
84
+ "type": "string"
85
+ }
86
+ },
87
+ "required": [
88
+ "title",
89
+ "content"
90
+ ]
91
+ },
92
+ "execute": "async (input) => {\nconst { z } = require('zod');\nconst axios = require('axios');\nclass ApiService {\n\n baseUrl;\n timeout;\n \n constructor() {\n this.baseUrl = \"https://httpbin.org\";\n this.timeout = 5000;\n }\n\n async fetchUserData(userId) {\n try {\n const response = await axios.get(`${this.baseUrl}/get`, {\n params: { userId },\n timeout: this.timeout,\n headers: {\n 'Content-Type': 'application/json',\n 'User-Agent': 'Lua-Skill/1.0'\n }\n });\n \n return {\n id: userId,\n name: response.data.args.userId || 'Unknown',\n url: response.data.url,\n status: 'success',\n timestamp: new Date().toISOString()\n };\n } catch (error) {\n return {\n id: userId,\n name: 'Unknown',\n url: null,\n status: 'error',\n error: error.message,\n timestamp: new Date().toISOString()\n };\n }\n }\n\n async createPost(title, content) {\n try {\n const response = await axios.post(`${this.baseUrl}/post`, {\n title,\n content,\n publishedAt: new Date().toISOString()\n }, {\n timeout: this.timeout,\n headers: {\n 'Content-Type': 'application/json'\n }\n });\n \n return {\n id: response.data.json.title || 'generated-id',\n title: response.data.json.title,\n status: 'created',\n url: response.data.url\n };\n } catch (error) {\n return {\n id: null,\n title,\n status: 'error',\n error: error.message,\n url: null\n };\n }\n }\n\n}\nconst apiService = new ApiService();\n\n return apiService.createPost(input.title, input.content);\n \n}"
93
+ }
94
+ ]
95
+ }
@@ -0,0 +1,31 @@
1
+ import z from "zod";
2
+ import { LuaSkill, LuaTool } from "lua-cli/skill";
3
+ import GetWeatherTool from "./tools/GetWeatherTool";
4
+ import GetUserDataTool from "./tools/GetUserDataTool";
5
+ import CreatePostTool from "./tools/CreatePostTool";
6
+
7
+ const skill = new LuaSkill("123");
8
+ skill.addTool(new GetWeatherTool());
9
+ skill.addTool(new GetUserDataTool());
10
+ skill.addTool(new CreatePostTool());
11
+
12
+ async function main() {
13
+ try {
14
+ // Test weather tool
15
+ console.log("Weather tool:", await skill.run({ tool: "get_weather", city: "London" }));
16
+
17
+ // Test user data tool with axios
18
+ console.log("User data tool:", await skill.run({ tool: "get_user_data", userId: "user123" }));
19
+
20
+ // Test post creation tool with axios
21
+ console.log("Post creation tool:", await skill.run({ tool: "create_post", title: "Test Post", content: "This is a test post content" }));
22
+
23
+ // This should fail - wrong property name
24
+ console.log("Invalid input:", await skill.run({ tool: "get_weather", cityLong: "London", apiKey: "123" }));
25
+ } catch (error: any) {
26
+ console.error("Validation error:", error.message);
27
+ }
28
+ }
29
+
30
+ main().catch(console.error);
31
+