lua-cli 2.0.6 → 2.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/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  export { user, UserDataAPI } from './user-data-api.js';
3
+ export { product, ProductAPI } from './product-api.js';
package/dist/index.js CHANGED
@@ -45,3 +45,4 @@ program
45
45
  program.parse(process.argv);
46
46
  // Export user data API for use in projects
47
47
  export { user, UserDataAPI } from './user-data-api.js';
48
+ export { product, ProductAPI } from './product-api.js';
@@ -0,0 +1,14 @@
1
+ export declare class ProductAPI {
2
+ products: any;
3
+ constructor();
4
+ get(page?: number, limit?: number): Promise<any>;
5
+ create(data: Record<string, any>): Promise<any>;
6
+ update(data: Record<string, any>, productId: string): Promise<any>;
7
+ delete(productId: string): Promise<{
8
+ success: boolean;
9
+ }>;
10
+ search(searchQuery: string): Promise<any>;
11
+ }
12
+ export declare const product: {
13
+ data: ProductAPI;
14
+ };
@@ -0,0 +1,27 @@
1
+ export class ProductAPI {
2
+ constructor() {
3
+ this.products = {};
4
+ }
5
+ async get(page = 1, limit = 10) {
6
+ return { success: true, data: this.products };
7
+ }
8
+ async create(data) {
9
+ this.products = data;
10
+ return { success: true, data: this.products };
11
+ }
12
+ async update(data, productId) {
13
+ // Update is the same as create for this API
14
+ this.products = { ...this.products, ...data };
15
+ return { success: true, data: this.products };
16
+ }
17
+ async delete(productId) {
18
+ this.products = this.products.filter((product) => product.id !== productId);
19
+ return { success: true };
20
+ }
21
+ async search(searchQuery) {
22
+ return { success: true, data: this.products };
23
+ }
24
+ }
25
+ export const product = {
26
+ data: new ProductAPI()
27
+ };
@@ -2,7 +2,7 @@ import { createRequire } from "module";
2
2
  import vm from "vm";
3
3
  import path from "path";
4
4
  import fs from "fs";
5
- import { UserDataApi } from "../services/api.js";
5
+ import { UserDataApi, ProductApi } from "../services/api.js";
6
6
  import { readSkillConfig } from "./files.js";
7
7
  /**
8
8
  * Loads environment variables from multiple sources in priority order:
@@ -66,6 +66,21 @@ export function createSandbox(options) {
66
66
  const linkUserData = async (data) => {
67
67
  return await UserDataApi.createUserData(apiKey, agentId, data);
68
68
  };
69
+ const createProduct = async (data) => {
70
+ return await ProductApi.createProduct(apiKey, agentId, data);
71
+ };
72
+ const getProducts = async (page = 1, limit = 10) => {
73
+ return await ProductApi.getProducts(apiKey, agentId, page, limit);
74
+ };
75
+ const updateProduct = async (data, productId) => {
76
+ return await ProductApi.updateProduct(apiKey, agentId, { ...data, id: productId });
77
+ };
78
+ const deleteProduct = async (productId) => {
79
+ return await ProductApi.deleteProduct(apiKey, agentId, productId);
80
+ };
81
+ const searchProducts = async (searchQuery) => {
82
+ return await ProductApi.searchProducts(apiKey, agentId, searchQuery);
83
+ };
69
84
  // Create console object (use custom console if provided, otherwise default)
70
85
  const consoleObj = customConsole || console;
71
86
  // Create comprehensive polyfills for browser/Node.js APIs
@@ -201,6 +216,13 @@ export function createSandbox(options) {
201
216
  create: linkUserData
202
217
  }
203
218
  },
219
+ product: {
220
+ create: createProduct,
221
+ get: getProducts,
222
+ update: updateProduct,
223
+ delete: deleteProduct,
224
+ search: searchProducts
225
+ },
204
226
  // Environment variables function
205
227
  env: (key) => envVars[key]
206
228
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lua-cli",
3
- "version": "2.0.6",
3
+ "version": "2.1.0-alpha.2",
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",
@@ -15,7 +15,7 @@
15
15
  "axios": "^1.6.0",
16
16
  "inquirer": "^12.9.6",
17
17
  "js-yaml": "^4.1.0",
18
- "lua-cli": "2.0.3",
18
+ "lua-cli": "2.1.0-alpha.1",
19
19
  "openai": "^5.23.0",
20
20
  "zod": "^3.24.1"
21
21
  },
@@ -2045,9 +2045,9 @@
2045
2045
  }
2046
2046
  },
2047
2047
  "node_modules/lua-cli": {
2048
- "version": "2.0.3",
2049
- "resolved": "https://registry.npmjs.org/lua-cli/-/lua-cli-2.0.3.tgz",
2050
- "integrity": "sha512-rAbVDbk116Lz9AYFBMO8z+klnB8JIqJ/bkxtBN3nKG1z7rDxkNzC8i/Ue5h/lNN3l0y4hbJZ9u9K25R5GK45Mw==",
2048
+ "version": "2.1.0-alpha.1",
2049
+ "resolved": "https://registry.npmjs.org/lua-cli/-/lua-cli-2.1.0-alpha.1.tgz",
2050
+ "integrity": "sha512-XJDR1RMOzcobw3NpfR6ZZbV1voBFNh7s9fn6rb5qbpSbxJycOc3OlDqHGMF7MUinoZJUzCRo62W7ceP+TFaKHQ==",
2051
2051
  "license": "MIT",
2052
2052
  "dependencies": {
2053
2053
  "commander": "^14.0.1",
@@ -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": "2.0.6",
22
+ "lua-cli": "2.1.0-alpha.2",
23
23
  "openai": "^5.23.0",
24
24
  "zod": "^3.24.1"
25
25
  },
@@ -1,6 +1,6 @@
1
1
  import { env, LuaTool } from "lua-cli/skill";
2
2
  import { z } from "zod";
3
- import { user } from 'lua-cli/user-data-api';
3
+ import { product } from 'lua-cli/product-api';
4
4
  import { Pinecone, Index } from '@pinecone-database/pinecone';
5
5
  import OpenAI from "openai";
6
6
  export class SearchProductsTool implements LuaTool {