lua-cli 2.2.8-alpha.1 → 2.3.0-alpha.1

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.
Files changed (191) hide show
  1. package/API_REFERENCE.md +1408 -0
  2. package/CLI_REFERENCE.md +818 -0
  3. package/GETTING_STARTED.md +1040 -0
  4. package/README.md +738 -424
  5. package/TEMPLATE_GUIDE.md +1398 -0
  6. package/dist/api/agent.api.service.d.ts +45 -0
  7. package/dist/api/agent.api.service.js +57 -0
  8. package/dist/api/auth.api.service.d.ts +48 -0
  9. package/dist/api/auth.api.service.js +54 -0
  10. package/dist/api/basket.api.service.d.ts +85 -0
  11. package/dist/api/basket.api.service.js +164 -0
  12. package/dist/api/chat.api.service.d.ts +21 -0
  13. package/dist/api/chat.api.service.js +24 -0
  14. package/dist/api/credentials.d.ts +24 -0
  15. package/dist/api/credentials.js +46 -0
  16. package/dist/api/custom.data.api.service.d.ts +69 -0
  17. package/dist/api/custom.data.api.service.js +125 -0
  18. package/dist/api/lazy-instances.d.ts +49 -0
  19. package/dist/api/lazy-instances.js +95 -0
  20. package/dist/api/order.api.service.d.ts +53 -0
  21. package/dist/api/order.api.service.js +95 -0
  22. package/dist/api/products.api.service.d.ts +66 -0
  23. package/dist/api/products.api.service.js +112 -0
  24. package/dist/api/skills.api.service.d.ts +77 -0
  25. package/dist/api/skills.api.service.js +88 -0
  26. package/dist/api/tool.api.service.d.ts +52 -0
  27. package/dist/api/tool.api.service.js +73 -0
  28. package/dist/api/user.data.api.service.d.ts +33 -0
  29. package/dist/api/user.data.api.service.js +59 -0
  30. package/dist/api-exports.d.ts +271 -0
  31. package/dist/api-exports.js +372 -0
  32. package/dist/cli/command-definitions.d.ts +30 -0
  33. package/dist/cli/command-definitions.js +71 -0
  34. package/dist/commands/agents.d.ts +20 -0
  35. package/dist/commands/agents.js +24 -2
  36. package/dist/commands/apiKey.d.ts +23 -0
  37. package/dist/commands/apiKey.js +23 -0
  38. package/dist/commands/compile.d.ts +24 -0
  39. package/dist/commands/compile.js +67 -759
  40. package/dist/commands/configure.d.ts +24 -0
  41. package/dist/commands/configure.js +31 -96
  42. package/dist/commands/deploy.d.ts +31 -19
  43. package/dist/commands/deploy.js +45 -74
  44. package/dist/commands/destroy.d.ts +27 -0
  45. package/dist/commands/destroy.js +27 -1
  46. package/dist/commands/dev.d.ts +25 -62
  47. package/dist/commands/dev.js +58 -873
  48. package/dist/commands/init.d.ts +27 -0
  49. package/dist/commands/init.js +98 -260
  50. package/dist/commands/push.d.ts +24 -21
  51. package/dist/commands/push.js +39 -92
  52. package/dist/commands/test.d.ts +26 -0
  53. package/dist/commands/test.js +41 -188
  54. package/dist/common/basket.instance.d.ts +78 -0
  55. package/dist/common/basket.instance.js +132 -0
  56. package/dist/common/data.entry.instance.d.ts +39 -0
  57. package/dist/common/data.entry.instance.js +76 -0
  58. package/dist/common/http.client.d.ts +64 -0
  59. package/dist/common/http.client.js +133 -0
  60. package/dist/common/order.instance.d.ts +40 -0
  61. package/dist/common/order.instance.js +79 -0
  62. package/dist/common/product.instance.d.ts +33 -0
  63. package/dist/common/product.instance.js +63 -0
  64. package/dist/common/product.pagination.instance.d.ts +43 -0
  65. package/dist/common/product.pagination.instance.js +74 -0
  66. package/dist/common/product.search.instance.d.ts +22 -0
  67. package/dist/common/product.search.instance.js +40 -0
  68. package/dist/common/user.instance.d.ts +41 -0
  69. package/dist/common/user.instance.js +84 -0
  70. package/dist/config/auth.constants.d.ts +11 -0
  71. package/dist/config/auth.constants.js +11 -0
  72. package/dist/config/compile.constants.d.ts +67 -0
  73. package/dist/config/compile.constants.js +99 -0
  74. package/dist/config/constants.d.ts +5 -0
  75. package/dist/config/constants.js +5 -0
  76. package/dist/config/dev.constants.d.ts +65 -0
  77. package/dist/config/dev.constants.js +79 -0
  78. package/dist/config/init.constants.d.ts +23 -0
  79. package/dist/config/init.constants.js +41 -0
  80. package/dist/index.d.ts +19 -3
  81. package/dist/index.js +28 -44
  82. package/dist/interfaces/admin.d.ts +101 -0
  83. package/dist/interfaces/admin.js +5 -0
  84. package/dist/interfaces/agent.d.ts +107 -0
  85. package/dist/interfaces/agent.js +5 -0
  86. package/dist/interfaces/baskets.d.ts +135 -0
  87. package/dist/interfaces/baskets.js +19 -0
  88. package/dist/interfaces/chat.d.ts +61 -0
  89. package/dist/interfaces/chat.js +5 -0
  90. package/dist/interfaces/common.d.ts +62 -0
  91. package/dist/interfaces/common.js +8 -0
  92. package/dist/interfaces/compile.d.ts +11 -0
  93. package/dist/interfaces/compile.js +4 -0
  94. package/dist/interfaces/custom.data.d.ts +82 -0
  95. package/dist/interfaces/custom.data.js +5 -0
  96. package/dist/interfaces/deploy.d.ts +29 -0
  97. package/dist/interfaces/deploy.js +4 -0
  98. package/dist/interfaces/dev.d.ts +53 -0
  99. package/dist/interfaces/dev.js +5 -0
  100. package/dist/interfaces/init.d.ts +60 -0
  101. package/dist/interfaces/init.js +4 -0
  102. package/dist/interfaces/orders.d.ts +91 -0
  103. package/dist/interfaces/orders.js +19 -0
  104. package/dist/interfaces/product.d.ts +65 -0
  105. package/dist/interfaces/product.js +5 -0
  106. package/dist/interfaces/push.d.ts +26 -0
  107. package/dist/interfaces/push.js +4 -0
  108. package/dist/interfaces/test.d.ts +36 -0
  109. package/dist/interfaces/test.js +4 -0
  110. package/dist/services/auth.d.ts +54 -99
  111. package/dist/services/auth.js +76 -12
  112. package/dist/types/api-contracts.d.ts +211 -0
  113. package/dist/types/api-contracts.js +8 -0
  114. package/dist/types/compile.types.d.ts +76 -0
  115. package/dist/types/compile.types.js +4 -0
  116. package/dist/types/index.d.ts +23 -85
  117. package/dist/types/index.js +25 -14
  118. package/dist/types/skill.d.ts +142 -0
  119. package/dist/{skill.js → types/skill.js} +66 -19
  120. package/dist/types/tool-validation.d.ts +34 -0
  121. package/dist/types/tool-validation.js +42 -0
  122. package/dist/utils/auth-flows.d.ts +26 -0
  123. package/dist/utils/auth-flows.js +141 -0
  124. package/dist/utils/bundling.d.ts +36 -0
  125. package/dist/utils/bundling.js +137 -0
  126. package/dist/utils/compile.d.ts +37 -0
  127. package/dist/utils/compile.js +242 -0
  128. package/dist/utils/deploy-api.d.ts +26 -0
  129. package/dist/utils/deploy-api.js +53 -0
  130. package/dist/utils/deploy-helpers.d.ts +46 -0
  131. package/dist/utils/deploy-helpers.js +86 -0
  132. package/dist/utils/deployment.d.ts +25 -0
  133. package/dist/utils/deployment.js +161 -0
  134. package/dist/utils/dev-api.d.ts +61 -0
  135. package/dist/utils/dev-api.js +262 -0
  136. package/dist/utils/dev-helpers.d.ts +46 -0
  137. package/dist/utils/dev-helpers.js +83 -0
  138. package/dist/utils/dev-server.d.ts +24 -0
  139. package/dist/utils/dev-server.js +555 -0
  140. package/dist/utils/dev-watcher.d.ts +31 -0
  141. package/dist/utils/dev-watcher.js +110 -0
  142. package/dist/utils/files.js +0 -5
  143. package/dist/utils/init-agent.d.ts +34 -0
  144. package/dist/utils/init-agent.js +129 -0
  145. package/dist/utils/init-helpers.d.ts +41 -0
  146. package/dist/utils/init-helpers.js +73 -0
  147. package/dist/utils/init-prompts.d.ts +47 -0
  148. package/dist/utils/init-prompts.js +168 -0
  149. package/dist/utils/push-api.d.ts +15 -0
  150. package/dist/utils/push-api.js +48 -0
  151. package/dist/utils/push-helpers.d.ts +38 -0
  152. package/dist/utils/push-helpers.js +84 -0
  153. package/dist/utils/sandbox-storage.d.ts +27 -0
  154. package/dist/utils/sandbox-storage.js +71 -0
  155. package/dist/utils/sandbox.js +78 -118
  156. package/dist/utils/skill-management.d.ts +14 -0
  157. package/dist/utils/skill-management.js +148 -0
  158. package/dist/utils/test-helpers.d.ts +40 -0
  159. package/dist/utils/test-helpers.js +92 -0
  160. package/dist/utils/test-prompts.d.ts +23 -0
  161. package/dist/utils/test-prompts.js +186 -0
  162. package/dist/utils/tool-detection.d.ts +18 -0
  163. package/dist/utils/tool-detection.js +110 -0
  164. package/dist/web/app.css +14 -9
  165. package/package.json +11 -12
  166. package/template/QUICKSTART.md +299 -144
  167. package/template/README.md +928 -349
  168. package/template/TOOL_EXAMPLES.md +655 -0
  169. package/template/package-lock.json +3781 -0
  170. package/template/package.json +1 -1
  171. package/template/src/index.ts +81 -40
  172. package/template/src/tools/BasketTool.ts +128 -0
  173. package/template/src/tools/CustomDataTool.ts +7 -13
  174. package/template/src/tools/OrderTool.ts +54 -0
  175. package/template/src/tools/PaymentTool.ts +1 -1
  176. package/template/src/tools/ProductsTool.ts +56 -118
  177. package/template/src/tools/UserDataTool.ts +4 -27
  178. package/dist/custom-data-api.d.ts +0 -72
  179. package/dist/custom-data-api.js +0 -174
  180. package/dist/product-api.d.ts +0 -197
  181. package/dist/product-api.js +0 -152
  182. package/dist/services/api.d.ts +0 -569
  183. package/dist/services/api.js +0 -625
  184. package/dist/skill.d.ts +0 -50
  185. package/dist/types.d.ts +0 -1
  186. package/dist/types.js +0 -2
  187. package/dist/user-data-api.d.ts +0 -39
  188. package/dist/user-data-api.js +0 -50
  189. package/template/API.md +0 -604
  190. package/template/DEVELOPER.md +0 -771
  191. package/template/lua.skill.yaml +0 -16
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Test Command Helper Utilities
3
+ * Handles tool extraction, decompression, and schema processing
4
+ */
5
+ import fs from "fs";
6
+ import path from "path";
7
+ import { gunzipSync } from "zlib";
8
+ import { Buffer } from "buffer";
9
+ /**
10
+ * Decompresses gzip-compressed base64 encoded code.
11
+ *
12
+ * @param compressedCode - Base64 encoded compressed code
13
+ * @returns Decompressed code string
14
+ */
15
+ export function decompressCode(compressedCode) {
16
+ const buffer = Buffer.from(compressedCode, 'base64');
17
+ return gunzipSync(buffer).toString('utf8');
18
+ }
19
+ /**
20
+ * Reads and parses deploy.json file.
21
+ *
22
+ * @returns Parsed deploy data
23
+ * @throws Error if deploy.json is not found
24
+ */
25
+ export function readDeployJson() {
26
+ const luaDir = path.join(process.cwd(), ".lua");
27
+ if (!fs.existsSync(luaDir)) {
28
+ throw new Error(".lua directory not found. Run 'lua compile' first.");
29
+ }
30
+ const deployJsonPath = path.join(luaDir, "deploy.json");
31
+ if (!fs.existsSync(deployJsonPath)) {
32
+ throw new Error("deploy.json not found. Run 'lua compile' first.");
33
+ }
34
+ return JSON.parse(fs.readFileSync(deployJsonPath, "utf8"));
35
+ }
36
+ /**
37
+ * Extracts all tools from deploy.json (handles both new and legacy formats).
38
+ *
39
+ * @param deployData - Parsed deploy.json data
40
+ * @returns Array of tools with their metadata
41
+ * @throws Error if no tools are found
42
+ */
43
+ export function extractToolsFromDeployData(deployData) {
44
+ let allTools = [];
45
+ if (deployData.skills && Array.isArray(deployData.skills)) {
46
+ // New format: extract tools from skills array
47
+ deployData.skills.forEach((skill) => {
48
+ if (skill.tools && Array.isArray(skill.tools)) {
49
+ skill.tools.forEach((tool) => {
50
+ allTools.push({
51
+ ...tool,
52
+ skillName: skill.name // Add skill context
53
+ });
54
+ });
55
+ }
56
+ });
57
+ }
58
+ else if (deployData.tools) {
59
+ // Legacy format: tools as object or array
60
+ if (Array.isArray(deployData.tools)) {
61
+ allTools = deployData.tools;
62
+ }
63
+ else {
64
+ // Convert tools object to array
65
+ allTools = Object.entries(deployData.tools).map(([name, tool]) => ({
66
+ name,
67
+ ...tool
68
+ }));
69
+ }
70
+ }
71
+ if (allTools.length === 0) {
72
+ throw new Error("No tools found in deploy.json");
73
+ }
74
+ return allTools;
75
+ }
76
+ /**
77
+ * Checks if .env file exists.
78
+ *
79
+ * @returns True if .env file exists
80
+ */
81
+ export function hasEnvFile() {
82
+ return fs.existsSync(path.join(process.cwd(), '.env'));
83
+ }
84
+ /**
85
+ * Checks if config has environment variables defined.
86
+ *
87
+ * @param config - Skill configuration
88
+ * @returns True if config has environment variables
89
+ */
90
+ export function hasConfigEnvVars(config) {
91
+ return config?.skill?.env && Object.keys(config.skill.env).length > 0;
92
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Test Command Prompt Utilities
3
+ * Handles interactive prompts for tool selection and input collection
4
+ */
5
+ import { ToolData, InputSchema } from '../interfaces/test.js';
6
+ /**
7
+ * Prompts user to select a tool from the list.
8
+ *
9
+ * @param tools - Array of available tools
10
+ * @returns Selected tool data
11
+ */
12
+ export declare function promptToolSelection(tools: ToolData[]): Promise<ToolData>;
13
+ /**
14
+ * Recursively generates prompts for schema properties and collects input values.
15
+ * Handles nested objects and various property types.
16
+ *
17
+ * @param schema - Input schema to generate prompts from
18
+ * @param prefix - Prefix for nested property names
19
+ * @param required - Array of required property names
20
+ * @param rootSchema - Root schema for nested property lookups
21
+ * @returns Object containing collected input values
22
+ */
23
+ export declare function generatePromptsForObject(schema: InputSchema, prefix?: string, required?: string[], rootSchema?: InputSchema): Promise<any>;
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Test Command Prompt Utilities
3
+ * Handles interactive prompts for tool selection and input collection
4
+ */
5
+ import inquirer from "inquirer";
6
+ import { writeProgress } from './cli.js';
7
+ /**
8
+ * Prompts user to select a tool from the list.
9
+ *
10
+ * @param tools - Array of available tools
11
+ * @returns Selected tool data
12
+ */
13
+ export async function promptToolSelection(tools) {
14
+ const toolChoices = tools.map((tool) => ({
15
+ name: tool.skillName
16
+ ? `${tool.name} (${tool.skillName}) - ${tool.description}`
17
+ : `${tool.name} - ${tool.description}`,
18
+ value: tool
19
+ }));
20
+ const { selectedTool } = await inquirer.prompt([
21
+ {
22
+ type: 'list',
23
+ name: 'selectedTool',
24
+ message: '🔧 Select a tool to test:',
25
+ choices: toolChoices,
26
+ pageSize: 10
27
+ }
28
+ ]);
29
+ return selectedTool;
30
+ }
31
+ /**
32
+ * Recursively generates prompts for schema properties and collects input values.
33
+ * Handles nested objects and various property types.
34
+ *
35
+ * @param schema - Input schema to generate prompts from
36
+ * @param prefix - Prefix for nested property names
37
+ * @param required - Array of required property names
38
+ * @param rootSchema - Root schema for nested property lookups
39
+ * @returns Object containing collected input values
40
+ */
41
+ export async function generatePromptsForObject(schema, prefix = '', required = [], rootSchema) {
42
+ const prompts = [];
43
+ const result = {};
44
+ const inputSchema = rootSchema || schema;
45
+ for (const [key, value] of Object.entries(schema.properties || {})) {
46
+ const property = value;
47
+ const fullKey = prefix ? `${prefix}.${key}` : key;
48
+ const isRequired = required.includes(key);
49
+ if (property.type === "object" && property.properties) {
50
+ // Handle nested object
51
+ writeProgress(`\n📋 Entering values for ${key}:`);
52
+ const nestedResult = await generatePromptsForObject(property, fullKey, property.required || [], inputSchema);
53
+ result[key] = nestedResult[key] || nestedResult;
54
+ }
55
+ else {
56
+ // Handle primitive types
57
+ const prompt = createPromptForProperty(key, property, fullKey, isRequired);
58
+ prompts.push(prompt);
59
+ }
60
+ }
61
+ if (prompts.length > 0) {
62
+ const answers = await inquirer.prompt(prompts);
63
+ processAnswers(answers, result, inputSchema, schema, required);
64
+ }
65
+ return result;
66
+ }
67
+ /**
68
+ * Creates an inquirer prompt for a schema property.
69
+ *
70
+ * @param key - Property name
71
+ * @param property - Property schema
72
+ * @param fullKey - Full property key including nested path
73
+ * @param isRequired - Whether the property is required
74
+ * @returns Inquirer prompt configuration
75
+ */
76
+ function createPromptForProperty(key, property, fullKey, isRequired) {
77
+ let promptType = 'input';
78
+ let validate = undefined;
79
+ switch (property.type) {
80
+ case "string":
81
+ if (isRequired) {
82
+ validate = (input) => input.trim() !== "" || `${key} is required`;
83
+ }
84
+ break;
85
+ case "number":
86
+ promptType = 'number';
87
+ if (isRequired) {
88
+ validate = (input) => !isNaN(input) || `${key} must be a valid number`;
89
+ }
90
+ break;
91
+ case "boolean":
92
+ promptType = 'confirm';
93
+ break;
94
+ default:
95
+ if (isRequired) {
96
+ validate = (input) => input.trim() !== "" || `${key} is required`;
97
+ }
98
+ }
99
+ return {
100
+ type: promptType,
101
+ name: fullKey,
102
+ message: `${key}${isRequired ? " (required)" : " (optional)"}:`,
103
+ validate: validate,
104
+ };
105
+ }
106
+ /**
107
+ * Processes prompt answers and converts them to proper types.
108
+ * Handles nested structures and optional fields.
109
+ *
110
+ * @param answers - Raw answers from inquirer
111
+ * @param result - Result object to populate
112
+ * @param inputSchema - Root input schema
113
+ * @param schema - Current schema level
114
+ * @param required - Required property names at current level
115
+ */
116
+ function processAnswers(answers, result, inputSchema, schema, required) {
117
+ for (const [key, value] of Object.entries(answers)) {
118
+ const keyParts = key.split('.');
119
+ const propertyKey = keyParts[keyParts.length - 1];
120
+ // Navigate through nested schemas to find the property
121
+ let currentSchema = inputSchema;
122
+ let currentProperty = null;
123
+ for (let i = 0; i < keyParts.length; i++) {
124
+ const part = keyParts[i];
125
+ if (currentSchema.properties && currentSchema.properties[part]) {
126
+ currentProperty = currentSchema.properties[part];
127
+ if (i < keyParts.length - 1) {
128
+ currentSchema = currentProperty;
129
+ }
130
+ }
131
+ }
132
+ if (currentProperty) {
133
+ const convertedValue = convertValueByType(value, currentProperty);
134
+ // Check if field is optional and value is empty - skip if so
135
+ const parentSchema = keyParts.length > 1 ? currentSchema : schema;
136
+ const isOptional = !parentSchema.required || !parentSchema.required.includes(propertyKey);
137
+ const isEmpty = convertedValue === '' || convertedValue === null || convertedValue === undefined;
138
+ if (isOptional && isEmpty) {
139
+ continue; // Skip optional empty fields
140
+ }
141
+ // Build nested structure
142
+ if (keyParts.length === 1) {
143
+ result[propertyKey] = convertedValue;
144
+ }
145
+ else {
146
+ buildNestedStructure(result, keyParts, propertyKey, convertedValue);
147
+ }
148
+ }
149
+ }
150
+ }
151
+ /**
152
+ * Converts a value to the appropriate type based on schema property.
153
+ *
154
+ * @param value - Raw value from prompt
155
+ * @param property - Schema property definition
156
+ * @returns Converted value
157
+ */
158
+ function convertValueByType(value, property) {
159
+ switch (property.type) {
160
+ case "number":
161
+ return parseFloat(value);
162
+ case "boolean":
163
+ return value;
164
+ default:
165
+ return value;
166
+ }
167
+ }
168
+ /**
169
+ * Builds nested object structure from key parts and value.
170
+ *
171
+ * @param result - Result object to populate
172
+ * @param keyParts - Array of nested key parts
173
+ * @param propertyKey - Final property key
174
+ * @param value - Value to set
175
+ */
176
+ function buildNestedStructure(result, keyParts, propertyKey, value) {
177
+ let current = result;
178
+ for (let i = 0; i < keyParts.length - 1; i++) {
179
+ const part = keyParts[i];
180
+ if (!current[part]) {
181
+ current[part] = {};
182
+ }
183
+ current = current[part];
184
+ }
185
+ current[propertyKey] = value;
186
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Tool Detection Utilities
3
+ * Handles detection and extraction of tools from TypeScript source code
4
+ */
5
+ import { Project } from "ts-morph";
6
+ import { ToolInfo } from '../interfaces/compile.js';
7
+ import { TypeScriptSourceFile } from '../types/compile.types.js';
8
+ /**
9
+ * Detects all tools in the project by analyzing the index file.
10
+ * Searches for tools in two places:
11
+ * 1. LuaSkill constructor's tools array
12
+ * 2. skill.addTools() or skill.addTool() method calls
13
+ *
14
+ * @param indexFile - The main index TypeScript source file
15
+ * @param project - The ts-morph Project instance
16
+ * @returns Promise resolving to array of detected tool information
17
+ */
18
+ export declare function detectTools(indexFile: TypeScriptSourceFile, project: Project): Promise<ToolInfo[]>;
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Tool Detection Utilities
3
+ * Handles detection and extraction of tools from TypeScript source code
4
+ */
5
+ import { Node } from "ts-morph";
6
+ import { extractToolFromNewExpressionSync, } from './compile.js';
7
+ /**
8
+ * Detects all tools in the project by analyzing the index file.
9
+ * Searches for tools in two places:
10
+ * 1. LuaSkill constructor's tools array
11
+ * 2. skill.addTools() or skill.addTool() method calls
12
+ *
13
+ * @param indexFile - The main index TypeScript source file
14
+ * @param project - The ts-morph Project instance
15
+ * @returns Promise resolving to array of detected tool information
16
+ */
17
+ export async function detectTools(indexFile, project) {
18
+ const tools = [];
19
+ // Search strategy 1: Find tools in LuaSkill constructor's tools array
20
+ detectToolsFromConstructor(indexFile, project, tools);
21
+ // Search strategy 2: Find tools from skill.addTools() or skill.addTool() method calls
22
+ detectToolsFromMethodCalls(indexFile, project, tools);
23
+ return tools;
24
+ }
25
+ /**
26
+ * Detects tools from LuaSkill constructor configuration.
27
+ * Example: new LuaSkill({ tools: [new MyTool(), ...] })
28
+ *
29
+ * @param indexFile - The TypeScript source file to analyze
30
+ * @param project - The ts-morph Project instance
31
+ * @param tools - Array to push detected tools into (mutated)
32
+ */
33
+ function detectToolsFromConstructor(indexFile, project, tools) {
34
+ indexFile.forEachDescendant((node) => {
35
+ if (Node.isNewExpression(node)) {
36
+ const expression = node.getExpression();
37
+ if (expression.getText() === 'LuaSkill') {
38
+ const args = node.getArguments();
39
+ if (args.length > 0 && Node.isObjectLiteralExpression(args[0])) {
40
+ const configObj = args[0];
41
+ // Look for tools property in constructor config
42
+ configObj.getProperties().forEach((prop) => {
43
+ if (Node.isPropertyAssignment(prop) && prop.getName() === 'tools') {
44
+ const value = prop.getInitializer();
45
+ if (value && Node.isArrayLiteralExpression(value)) {
46
+ const toolsArray = value;
47
+ toolsArray.getElements().forEach((element) => {
48
+ if (Node.isNewExpression(element)) {
49
+ const toolInfo = extractToolFromNewExpressionSync(element, project);
50
+ if (toolInfo) {
51
+ tools.push(toolInfo);
52
+ }
53
+ }
54
+ });
55
+ }
56
+ }
57
+ });
58
+ }
59
+ }
60
+ }
61
+ });
62
+ }
63
+ /**
64
+ * Detects tools from skill.addTools() or skill.addTool() method calls.
65
+ * Examples:
66
+ * - skill.addTools([new Tool1(), new Tool2()])
67
+ * - skill.addTool(new MyTool())
68
+ *
69
+ * @param indexFile - The TypeScript source file to analyze
70
+ * @param project - The ts-morph Project instance
71
+ * @param tools - Array to push detected tools into (mutated)
72
+ */
73
+ function detectToolsFromMethodCalls(indexFile, project, tools) {
74
+ indexFile.forEachDescendant((node) => {
75
+ if (Node.isCallExpression(node)) {
76
+ const expression = node.getExpression();
77
+ if (Node.isPropertyAccessExpression(expression)) {
78
+ const property = expression.getName();
79
+ if (property === 'addTools' || property === 'addTool') {
80
+ const args = node.getArguments();
81
+ if (property === 'addTools' && args.length > 0) {
82
+ // Handle skill.addTools([...]) - array of tools
83
+ const arrayArg = args[0];
84
+ if (Node.isArrayLiteralExpression(arrayArg)) {
85
+ const elements = arrayArg.getElements();
86
+ for (const element of elements) {
87
+ if (Node.isNewExpression(element)) {
88
+ const toolInfo = extractToolFromNewExpressionSync(element, project);
89
+ if (toolInfo) {
90
+ tools.push(toolInfo);
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ else if (property === 'addTool' && args.length > 0) {
97
+ // Handle skill.addTool(new ToolClass()) - single tool
98
+ const arg = args[0];
99
+ if (Node.isNewExpression(arg)) {
100
+ const toolInfo = extractToolFromNewExpressionSync(arg, project);
101
+ if (toolInfo) {
102
+ tools.push(toolInfo);
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ });
110
+ }
package/dist/web/app.css CHANGED
@@ -752,7 +752,7 @@ a:focus-visible,
752
752
  }
753
753
 
754
754
  .production-resize-handle::after {
755
- content: '';
755
+ content: "";
756
756
  position: absolute;
757
757
  top: 0;
758
758
  left: -2px;
@@ -810,7 +810,7 @@ a:focus-visible,
810
810
  }
811
811
 
812
812
  .right-panel-tabs .tab-button.active::after {
813
- content: '';
813
+ content: "";
814
814
  position: absolute;
815
815
  bottom: 0;
816
816
  left: 0;
@@ -821,7 +821,7 @@ a:focus-visible,
821
821
 
822
822
  .right-panel-content {
823
823
  flex: 1;
824
- overflow: hidden;
824
+ overflow: auto;
825
825
  }
826
826
 
827
827
  .versions-panel,
@@ -892,7 +892,7 @@ a:focus-visible,
892
892
  }
893
893
 
894
894
  .column-tabs .tab-button.active::after {
895
- content: '';
895
+ content: "";
896
896
  position: absolute;
897
897
  bottom: 0;
898
898
  left: 0;
@@ -4303,6 +4303,7 @@ a:focus-visible,
4303
4303
  flex-direction: column;
4304
4304
  padding: 16px;
4305
4305
  overflow-y: auto;
4306
+ min-height: 0;
4306
4307
  }
4307
4308
 
4308
4309
  .env-loading {
@@ -4391,7 +4392,7 @@ a:focus-visible,
4391
4392
  color: #ffffff;
4392
4393
  padding: 6px 10px;
4393
4394
  font-size: 12px;
4394
- font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
4395
+ font-family: "Monaco", "Menlo", "Consolas", monospace;
4395
4396
  }
4396
4397
 
4397
4398
  .env-input:focus {
@@ -4429,7 +4430,10 @@ a:focus-visible,
4429
4430
 
4430
4431
  /* Environment Variables List */
4431
4432
  .env-variables {
4432
- flex: 1;
4433
+ flex: 0 1 auto;
4434
+ overflow-y: visible;
4435
+ min-height: 0;
4436
+ padding-right: 4px;
4433
4437
  }
4434
4438
 
4435
4439
  .env-list {
@@ -4461,7 +4465,7 @@ a:focus-visible,
4461
4465
  align-items: flex-start;
4462
4466
  gap: 8px;
4463
4467
  flex: 1;
4464
- font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
4468
+ font-family: "Monaco", "Menlo", "Consolas", monospace;
4465
4469
  font-size: 12px;
4466
4470
  min-height: 20px;
4467
4471
  }
@@ -4586,7 +4590,7 @@ a:focus-visible,
4586
4590
  color: #ffffff;
4587
4591
  padding: 6px 8px;
4588
4592
  font-size: 12px;
4589
- font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
4593
+ font-family: "Monaco", "Menlo", "Consolas", monospace;
4590
4594
  line-height: 1.3;
4591
4595
  }
4592
4596
 
@@ -4698,6 +4702,7 @@ a:focus-visible,
4698
4702
 
4699
4703
  /* Help Section */
4700
4704
  .env-help {
4705
+ flex-shrink: 0;
4701
4706
  margin-top: 16px;
4702
4707
  padding: 12px;
4703
4708
  background: rgba(0, 122, 204, 0.1);
@@ -4720,7 +4725,7 @@ a:focus-visible,
4720
4725
  background: rgba(255, 255, 255, 0.1);
4721
4726
  padding: 2px 4px;
4722
4727
  border-radius: 2px;
4723
- font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
4728
+ font-family: "Monaco", "Menlo", "Consolas", monospace;
4724
4729
  font-size: 13px;
4725
4730
  color: #007acc;
4726
4731
  }
package/package.json CHANGED
@@ -1,16 +1,14 @@
1
1
  {
2
2
  "name": "lua-cli",
3
- "version": "2.2.8-alpha.1",
3
+ "version": "2.3.0-alpha.1",
4
4
  "description": "Command-line interface for Lua AI platform - develop, test, and deploy LuaSkills with custom tools",
5
5
  "readmeFilename": "README.md",
6
- "main": "dist/index.js",
6
+ "main": "dist/api-exports.js",
7
+ "bin": {
8
+ "lua": "./dist/index.js"
9
+ },
7
10
  "exports": {
8
- ".": "./dist/index.js",
9
- "./types": "./dist/types.js",
10
- "./skill": "./dist/skill.js",
11
- "./user-data-api": "./dist/user-data-api.js",
12
- "./product-api": "./dist/product-api.js",
13
- "./custom-data-api": "./dist/custom-data-api.js"
11
+ ".": "./dist/api-exports.js"
14
12
  },
15
13
  "scripts": {
16
14
  "clean": "rm -rf dist",
@@ -55,6 +53,10 @@
55
53
  "dist/**/*",
56
54
  "template/**/*",
57
55
  "README.md",
56
+ "GETTING_STARTED.md",
57
+ "CLI_REFERENCE.md",
58
+ "API_REFERENCE.md",
59
+ "TEMPLATE_GUIDE.md",
58
60
  "CHANGELOG.md",
59
61
  "LICENSE"
60
62
  ],
@@ -65,7 +67,7 @@
65
67
  "inquirer": "^12.9.6",
66
68
  "js-yaml": "^4.1.0",
67
69
  "keytar": "^7.9.0",
68
- "lua-cli": "^2.2.8-alpha.1",
70
+ "lua-cli": "^2.3.0-alpha.1",
69
71
  "node-fetch": "^3.3.2",
70
72
  "open": "^10.1.0",
71
73
  "react": "^18.2.0",
@@ -92,8 +94,5 @@
92
94
  "ts-jest": "^29.1.1",
93
95
  "ts-node": "^10.9.2",
94
96
  "typescript": "^5.9.2"
95
- },
96
- "bin": {
97
- "lua": "dist/index.js"
98
97
  }
99
98
  }