lua-cli 2.5.7 → 2.5.8
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/api/agent.api.service.d.ts +45 -0
- package/dist/api/agent.api.service.js +54 -0
- package/dist/api/user.data.api.service.d.ts +15 -0
- package/dist/api/user.data.api.service.js +31 -0
- package/dist/cli/command-definitions.js +77 -5
- package/dist/commands/completion.d.ts +11 -0
- package/dist/commands/completion.js +209 -0
- package/dist/commands/env.d.ts +3 -2
- package/dist/commands/env.js +42 -17
- package/dist/commands/features.d.ts +16 -0
- package/dist/commands/features.js +352 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.js +3 -0
- package/dist/commands/persona.d.ts +3 -2
- package/dist/commands/persona.js +43 -18
- package/dist/commands/push.d.ts +9 -13
- package/dist/commands/push.js +271 -82
- package/dist/commands/skills.d.ts +16 -0
- package/dist/commands/skills.js +438 -0
- package/dist/common/data.entry.instance.d.ts +7 -0
- package/dist/common/data.entry.instance.js +15 -0
- package/dist/common/order.instance.d.ts +6 -0
- package/dist/common/order.instance.js +14 -0
- package/dist/common/product.instance.d.ts +6 -0
- package/dist/common/product.instance.js +14 -0
- package/dist/common/user.instance.d.ts +14 -0
- package/dist/common/user.instance.js +29 -0
- package/dist/index.js +14 -3
- package/dist/interfaces/agent.d.ts +31 -0
- package/dist/interfaces/message.d.ts +18 -0
- package/dist/interfaces/message.js +1 -0
- package/dist/types/api-contracts.d.ts +9 -0
- package/dist/types/api-contracts.js +0 -7
- package/dist/web/app.css +152 -736
- package/dist/web/app.js +45 -45
- package/package.json +2 -2
- package/template/package.json +1 -1
|
@@ -14,6 +14,9 @@ import { CreateSlackChannelRequest } from "../interfaces/agent.js";
|
|
|
14
14
|
import { CreateSlackChannelResponse } from "../interfaces/agent.js";
|
|
15
15
|
import { CreateEmailChannelRequest } from "../interfaces/agent.js";
|
|
16
16
|
import { CreateEmailChannelResponse } from "../interfaces/agent.js";
|
|
17
|
+
import { GetAgentFeaturesResponse } from "../interfaces/agent.js";
|
|
18
|
+
import { UpdateAgentFeatureRequest } from "../interfaces/agent.js";
|
|
19
|
+
import { UpdateAgentFeatureResponse } from "../interfaces/agent.js";
|
|
17
20
|
/**
|
|
18
21
|
* Agent API calls
|
|
19
22
|
*/
|
|
@@ -94,4 +97,46 @@ export default class AgentApi extends HttpClient {
|
|
|
94
97
|
* @throws Error if the API request fails or the channel creation is unsuccessful
|
|
95
98
|
*/
|
|
96
99
|
createEmailChannel(agentId: string, channelData: CreateEmailChannelRequest): Promise<ApiResponse<CreateEmailChannelResponse>>;
|
|
100
|
+
/**
|
|
101
|
+
* Retrieves all features configured for a specific agent
|
|
102
|
+
* @param agentId - The unique identifier of the agent
|
|
103
|
+
* @returns Promise resolving to an ApiResponse containing an array of agent features
|
|
104
|
+
* @throws Error if the API request fails or the agent is not found
|
|
105
|
+
* @example
|
|
106
|
+
* const features = await agentApi.getAgentFeatures('baseAgent_agent_123');
|
|
107
|
+
* features.data.features.forEach(feature => {
|
|
108
|
+
* console.log(`${feature.title}: ${feature.active ? 'enabled' : 'disabled'}`);
|
|
109
|
+
* });
|
|
110
|
+
*/
|
|
111
|
+
getAgentFeatures(agentId: string): Promise<ApiResponse<GetAgentFeaturesResponse>>;
|
|
112
|
+
/**
|
|
113
|
+
* Updates a specific feature for an agent
|
|
114
|
+
* @param agentId - The unique identifier of the agent
|
|
115
|
+
* @param featureData - The feature update configuration
|
|
116
|
+
* @param featureData.featureName - The name of the feature to update (required)
|
|
117
|
+
* @param featureData.active - Whether the feature should be enabled or disabled (optional)
|
|
118
|
+
* @param featureData.featureContext - Custom context/instructions for the feature (optional)
|
|
119
|
+
* @returns Promise resolving to an ApiResponse with success message
|
|
120
|
+
* @throws Error if the API request fails, the agent/feature is not found, or neither active nor featureContext is provided
|
|
121
|
+
* @example
|
|
122
|
+
* // Enable a feature
|
|
123
|
+
* await agentApi.updateAgentFeature('baseAgent_agent_123', {
|
|
124
|
+
* featureName: 'inquiry',
|
|
125
|
+
* active: true
|
|
126
|
+
* });
|
|
127
|
+
*
|
|
128
|
+
* // Update feature context
|
|
129
|
+
* await agentApi.updateAgentFeature('baseAgent_agent_123', {
|
|
130
|
+
* featureName: 'tickets',
|
|
131
|
+
* featureContext: 'Custom instructions for ticket handling'
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* // Update both
|
|
135
|
+
* await agentApi.updateAgentFeature('baseAgent_agent_123', {
|
|
136
|
+
* featureName: 'rag',
|
|
137
|
+
* active: true,
|
|
138
|
+
* featureContext: 'Enhanced RAG search instructions'
|
|
139
|
+
* });
|
|
140
|
+
*/
|
|
141
|
+
updateAgentFeature(agentId: string, featureData: UpdateAgentFeatureRequest): Promise<ApiResponse<UpdateAgentFeatureResponse>>;
|
|
97
142
|
}
|
|
@@ -117,4 +117,58 @@ export default class AgentApi extends HttpClient {
|
|
|
117
117
|
Authorization: `Bearer ${this.apiKey}`,
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Retrieves all features configured for a specific agent
|
|
122
|
+
* @param agentId - The unique identifier of the agent
|
|
123
|
+
* @returns Promise resolving to an ApiResponse containing an array of agent features
|
|
124
|
+
* @throws Error if the API request fails or the agent is not found
|
|
125
|
+
* @example
|
|
126
|
+
* const features = await agentApi.getAgentFeatures('baseAgent_agent_123');
|
|
127
|
+
* features.data.features.forEach(feature => {
|
|
128
|
+
* console.log(`${feature.title}: ${feature.active ? 'enabled' : 'disabled'}`);
|
|
129
|
+
* });
|
|
130
|
+
*/
|
|
131
|
+
async getAgentFeatures(agentId) {
|
|
132
|
+
return this.httpGet(`/admin/agents/${agentId}/features`, {
|
|
133
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Updates a specific feature for an agent
|
|
138
|
+
* @param agentId - The unique identifier of the agent
|
|
139
|
+
* @param featureData - The feature update configuration
|
|
140
|
+
* @param featureData.featureName - The name of the feature to update (required)
|
|
141
|
+
* @param featureData.active - Whether the feature should be enabled or disabled (optional)
|
|
142
|
+
* @param featureData.featureContext - Custom context/instructions for the feature (optional)
|
|
143
|
+
* @returns Promise resolving to an ApiResponse with success message
|
|
144
|
+
* @throws Error if the API request fails, the agent/feature is not found, or neither active nor featureContext is provided
|
|
145
|
+
* @example
|
|
146
|
+
* // Enable a feature
|
|
147
|
+
* await agentApi.updateAgentFeature('baseAgent_agent_123', {
|
|
148
|
+
* featureName: 'inquiry',
|
|
149
|
+
* active: true
|
|
150
|
+
* });
|
|
151
|
+
*
|
|
152
|
+
* // Update feature context
|
|
153
|
+
* await agentApi.updateAgentFeature('baseAgent_agent_123', {
|
|
154
|
+
* featureName: 'tickets',
|
|
155
|
+
* featureContext: 'Custom instructions for ticket handling'
|
|
156
|
+
* });
|
|
157
|
+
*
|
|
158
|
+
* // Update both
|
|
159
|
+
* await agentApi.updateAgentFeature('baseAgent_agent_123', {
|
|
160
|
+
* featureName: 'rag',
|
|
161
|
+
* active: true,
|
|
162
|
+
* featureContext: 'Enhanced RAG search instructions'
|
|
163
|
+
* });
|
|
164
|
+
*/
|
|
165
|
+
async updateAgentFeature(agentId, featureData) {
|
|
166
|
+
// Validate that at least one optional field is provided
|
|
167
|
+
if (featureData.active === undefined && featureData.featureContext === undefined) {
|
|
168
|
+
throw new Error('At least one of "active" or "featureContext" must be provided');
|
|
169
|
+
}
|
|
170
|
+
return this.httpPut(`/admin/agents/${agentId}/features`, featureData, {
|
|
171
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
120
174
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HttpClient } from "../common/http.client.js";
|
|
2
2
|
import UserDataInstance from "../common/user.instance.js";
|
|
3
|
+
import { Message } from "../interfaces/message.js";
|
|
3
4
|
import { UserDataAPI } from "../types/index.js";
|
|
4
5
|
export default class UserDataApi extends HttpClient implements UserDataAPI {
|
|
5
6
|
private apiKey;
|
|
@@ -30,4 +31,18 @@ export default class UserDataApi extends HttpClient implements UserDataAPI {
|
|
|
30
31
|
* @throws Error if the clear operation fails or the request is unsuccessful
|
|
31
32
|
*/
|
|
32
33
|
clear(): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* Sends a message to a specific user conversation for the agent
|
|
36
|
+
* @param userId - The unique identifier of the user to send the message to
|
|
37
|
+
* @param messages - An array of messages to send (can be text, image, or file types)
|
|
38
|
+
* @returns Promise resolving to the response data from the server
|
|
39
|
+
* @throws Error if the message sending fails or the request is unsuccessful
|
|
40
|
+
*/
|
|
41
|
+
sendMessage(messages: Message[]): Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the admin user for the specific agent
|
|
44
|
+
* @returns Promise resolving to the admin user data
|
|
45
|
+
* @throws Error if the admin user cannot be retrieved or the request is unsuccessful
|
|
46
|
+
*/
|
|
47
|
+
getAdminUser(): Promise<any>;
|
|
33
48
|
}
|
|
@@ -56,4 +56,35 @@ export default class UserDataApi extends HttpClient {
|
|
|
56
56
|
}
|
|
57
57
|
return {};
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Sends a message to a specific user conversation for the agent
|
|
61
|
+
* @param userId - The unique identifier of the user to send the message to
|
|
62
|
+
* @param messages - An array of messages to send (can be text, image, or file types)
|
|
63
|
+
* @returns Promise resolving to the response data from the server
|
|
64
|
+
* @throws Error if the message sending fails or the request is unsuccessful
|
|
65
|
+
*/
|
|
66
|
+
async sendMessage(messages) {
|
|
67
|
+
const user = await this.getAdminUser();
|
|
68
|
+
const response = await this.httpPost(`/admin/agents/${this.agentId}/conversations/${user.uid}`, { messages }, {
|
|
69
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
70
|
+
});
|
|
71
|
+
if (!response.success) {
|
|
72
|
+
throw new Error(response.error?.message || 'Failed to send message');
|
|
73
|
+
}
|
|
74
|
+
return response.data;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Gets the admin user for the specific agent
|
|
78
|
+
* @returns Promise resolving to the admin user data
|
|
79
|
+
* @throws Error if the admin user cannot be retrieved or the request is unsuccessful
|
|
80
|
+
*/
|
|
81
|
+
async getAdminUser() {
|
|
82
|
+
const response = await this.httpGet(`/admin`, {
|
|
83
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
84
|
+
});
|
|
85
|
+
if (!response.success) {
|
|
86
|
+
throw new Error(response.error?.message || 'Failed to get admin user');
|
|
87
|
+
}
|
|
88
|
+
return response.data;
|
|
89
|
+
}
|
|
59
90
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Command Definitions
|
|
3
3
|
* Centralized command structure for the CLI
|
|
4
4
|
*/
|
|
5
|
-
import { configureCommand, initCommand, destroyCommand, apiKeyCommand, compileCommand, testCommand, pushCommand, deployCommand, chatCommand, chatClearCommand, envCommand, personaCommand, productionCommand, resourcesCommand, adminCommand, docsCommand, channelsCommand, logsCommand } from "../commands/index.js";
|
|
5
|
+
import { configureCommand, initCommand, destroyCommand, apiKeyCommand, compileCommand, testCommand, pushCommand, deployCommand, chatCommand, chatClearCommand, envCommand, personaCommand, productionCommand, resourcesCommand, adminCommand, docsCommand, channelsCommand, logsCommand, completionCommand, skillsCommand, featuresCommand } from "../commands/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* Sets up authentication-related commands.
|
|
8
8
|
*
|
|
@@ -58,8 +58,17 @@ export function setupSkillCommands(program) {
|
|
|
58
58
|
.action(testCommand);
|
|
59
59
|
// Deployment Commands
|
|
60
60
|
program
|
|
61
|
-
.command("push")
|
|
62
|
-
.description("☁️ Push skill version to server")
|
|
61
|
+
.command("push [type]")
|
|
62
|
+
.description("☁️ Push skill or persona version to server")
|
|
63
|
+
.addHelpText('after', `
|
|
64
|
+
Arguments:
|
|
65
|
+
type Optional: 'skill' or 'persona' (prompts if not provided)
|
|
66
|
+
|
|
67
|
+
Examples:
|
|
68
|
+
$ lua push Interactive selection
|
|
69
|
+
$ lua push skill Push a skill directly
|
|
70
|
+
$ lua push persona Push a persona directly
|
|
71
|
+
`)
|
|
63
72
|
.action(pushCommand);
|
|
64
73
|
program
|
|
65
74
|
.command("deploy")
|
|
@@ -86,12 +95,32 @@ Examples:
|
|
|
86
95
|
.action(chatClearCommand);
|
|
87
96
|
// Configuration Commands
|
|
88
97
|
program
|
|
89
|
-
.command("env")
|
|
98
|
+
.command("env [environment]")
|
|
90
99
|
.description("⚙️ Manage environment variables")
|
|
100
|
+
.addHelpText('after', `
|
|
101
|
+
Arguments:
|
|
102
|
+
environment Optional: 'sandbox', 'staging', or 'production' (prompts if not provided)
|
|
103
|
+
|
|
104
|
+
Examples:
|
|
105
|
+
$ lua env Interactive selection
|
|
106
|
+
$ lua env sandbox Manage sandbox env vars directly
|
|
107
|
+
$ lua env staging Manage staging env vars (alias for sandbox)
|
|
108
|
+
$ lua env production Manage production env vars directly
|
|
109
|
+
`)
|
|
91
110
|
.action(envCommand);
|
|
92
111
|
program
|
|
93
|
-
.command("persona")
|
|
112
|
+
.command("persona [env]")
|
|
94
113
|
.description("🤖 Manage agent persona")
|
|
114
|
+
.addHelpText('after', `
|
|
115
|
+
Arguments:
|
|
116
|
+
env Optional: 'sandbox', 'staging', or 'production' (prompts if not provided)
|
|
117
|
+
|
|
118
|
+
Examples:
|
|
119
|
+
$ lua persona Interactive selection
|
|
120
|
+
$ lua persona sandbox Manage sandbox persona directly
|
|
121
|
+
$ lua persona staging Manage staging persona (alias for sandbox)
|
|
122
|
+
$ lua persona production Manage production persona directly
|
|
123
|
+
`)
|
|
95
124
|
.action(personaCommand);
|
|
96
125
|
program
|
|
97
126
|
.command("production")
|
|
@@ -117,4 +146,47 @@ Examples:
|
|
|
117
146
|
.command("logs")
|
|
118
147
|
.description("📊 View agent and skill logs")
|
|
119
148
|
.action(logsCommand);
|
|
149
|
+
program
|
|
150
|
+
.command("skills [env]")
|
|
151
|
+
.description("⚙️ Manage and view skills")
|
|
152
|
+
.addHelpText('after', `
|
|
153
|
+
Arguments:
|
|
154
|
+
env Optional: 'sandbox', 'staging', or 'production' (prompts if not provided)
|
|
155
|
+
|
|
156
|
+
Examples:
|
|
157
|
+
$ lua skills Interactive selection
|
|
158
|
+
$ lua skills sandbox View sandbox skills directly
|
|
159
|
+
$ lua skills staging View staging skills (alias for sandbox)
|
|
160
|
+
$ lua skills production Manage production skills directly
|
|
161
|
+
`)
|
|
162
|
+
.action(skillsCommand);
|
|
163
|
+
program
|
|
164
|
+
.command("features")
|
|
165
|
+
.description("🎯 Manage agent features (tickets, RAG, etc.)")
|
|
166
|
+
.addHelpText('after', `
|
|
167
|
+
Features:
|
|
168
|
+
• View all available features
|
|
169
|
+
• Enable/disable features
|
|
170
|
+
• Update feature context and instructions
|
|
171
|
+
• Manage capabilities like tickets, RAG search, web search, and more
|
|
172
|
+
|
|
173
|
+
Examples:
|
|
174
|
+
$ lua features View and manage all agent features
|
|
175
|
+
`)
|
|
176
|
+
.action(featuresCommand);
|
|
177
|
+
program
|
|
178
|
+
.command("completion [shell]")
|
|
179
|
+
.description("🎯 Generate shell completion script")
|
|
180
|
+
.addHelpText('after', `
|
|
181
|
+
Arguments:
|
|
182
|
+
shell Optional: 'bash', 'zsh', or 'fish' (shows instructions if not provided)
|
|
183
|
+
|
|
184
|
+
Examples:
|
|
185
|
+
$ lua completion Show installation instructions
|
|
186
|
+
$ lua completion bash Generate bash completion script
|
|
187
|
+
$ lua completion bash >> ~/.bashrc
|
|
188
|
+
$ lua completion zsh >> ~/.zshrc
|
|
189
|
+
$ lua completion fish > ~/.config/fish/completions/lua.fish
|
|
190
|
+
`)
|
|
191
|
+
.action(completionCommand);
|
|
120
192
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion Command
|
|
3
|
+
* Generates shell completion scripts for the Lua CLI
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Main completion command - generates shell completion scripts
|
|
7
|
+
*
|
|
8
|
+
* @param shell - Shell type (bash, zsh, fish)
|
|
9
|
+
* @returns Promise that resolves when command completes
|
|
10
|
+
*/
|
|
11
|
+
export declare function completionCommand(shell?: string): Promise<void>;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion Command
|
|
3
|
+
* Generates shell completion scripts for the Lua CLI
|
|
4
|
+
*/
|
|
5
|
+
import { withErrorHandling } from '../utils/cli.js';
|
|
6
|
+
/**
|
|
7
|
+
* Bash completion script
|
|
8
|
+
*/
|
|
9
|
+
const BASH_COMPLETION = `# Bash completion for lua CLI
|
|
10
|
+
_lua_completion() {
|
|
11
|
+
local cur prev commands
|
|
12
|
+
COMPREPLY=()
|
|
13
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
14
|
+
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
15
|
+
|
|
16
|
+
# Main commands
|
|
17
|
+
commands="auth init compile test push deploy chat env persona production resources admin docs channels logs skills features completion"
|
|
18
|
+
|
|
19
|
+
# Subcommands
|
|
20
|
+
case "\${prev}" in
|
|
21
|
+
lua)
|
|
22
|
+
COMPREPLY=( $(compgen -W "\${commands}" -- \${cur}) )
|
|
23
|
+
return 0
|
|
24
|
+
;;
|
|
25
|
+
auth)
|
|
26
|
+
COMPREPLY=( $(compgen -W "configure logout key" -- \${cur}) )
|
|
27
|
+
return 0
|
|
28
|
+
;;
|
|
29
|
+
push)
|
|
30
|
+
COMPREPLY=( $(compgen -W "skill persona" -- \${cur}) )
|
|
31
|
+
return 0
|
|
32
|
+
;;
|
|
33
|
+
env)
|
|
34
|
+
COMPREPLY=( $(compgen -W "sandbox staging production" -- \${cur}) )
|
|
35
|
+
return 0
|
|
36
|
+
;;
|
|
37
|
+
persona)
|
|
38
|
+
COMPREPLY=( $(compgen -W "sandbox staging production" -- \${cur}) )
|
|
39
|
+
return 0
|
|
40
|
+
;;
|
|
41
|
+
skills)
|
|
42
|
+
COMPREPLY=( $(compgen -W "sandbox staging production" -- \${cur}) )
|
|
43
|
+
return 0
|
|
44
|
+
;;
|
|
45
|
+
chat)
|
|
46
|
+
COMPREPLY=( $(compgen -W "clear" -- \${cur}) )
|
|
47
|
+
return 0
|
|
48
|
+
;;
|
|
49
|
+
completion)
|
|
50
|
+
COMPREPLY=( $(compgen -W "bash zsh fish" -- \${cur}) )
|
|
51
|
+
return 0
|
|
52
|
+
;;
|
|
53
|
+
esac
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
complete -F _lua_completion lua
|
|
57
|
+
`;
|
|
58
|
+
/**
|
|
59
|
+
* Zsh completion script
|
|
60
|
+
*/
|
|
61
|
+
const ZSH_COMPLETION = `#compdef lua
|
|
62
|
+
|
|
63
|
+
# Zsh completion for lua CLI
|
|
64
|
+
_lua() {
|
|
65
|
+
local line state
|
|
66
|
+
|
|
67
|
+
_arguments -C \\
|
|
68
|
+
"1: :(auth init compile test push deploy chat env persona production resources admin docs channels logs skills features completion)" \\
|
|
69
|
+
"*::arg:->args"
|
|
70
|
+
|
|
71
|
+
case $line[1] in
|
|
72
|
+
auth)
|
|
73
|
+
_arguments "1: :(configure logout key)"
|
|
74
|
+
;;
|
|
75
|
+
push)
|
|
76
|
+
_arguments "1: :(skill persona)"
|
|
77
|
+
;;
|
|
78
|
+
env)
|
|
79
|
+
_arguments "1: :(sandbox staging production)"
|
|
80
|
+
;;
|
|
81
|
+
persona)
|
|
82
|
+
_arguments "1: :(sandbox staging production)"
|
|
83
|
+
;;
|
|
84
|
+
skills)
|
|
85
|
+
_arguments "1: :(sandbox staging production)"
|
|
86
|
+
;;
|
|
87
|
+
chat)
|
|
88
|
+
_arguments "1: :(clear)"
|
|
89
|
+
;;
|
|
90
|
+
completion)
|
|
91
|
+
_arguments "1: :(bash zsh fish)"
|
|
92
|
+
;;
|
|
93
|
+
esac
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
_lua
|
|
97
|
+
`;
|
|
98
|
+
/**
|
|
99
|
+
* Fish completion script
|
|
100
|
+
*/
|
|
101
|
+
const FISH_COMPLETION = `# Fish completion for lua CLI
|
|
102
|
+
|
|
103
|
+
# Main commands
|
|
104
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "auth" -d "Authentication management"
|
|
105
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "init" -d "Initialize a new project"
|
|
106
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "compile" -d "Compile skill"
|
|
107
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "test" -d "Test skill tools"
|
|
108
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "push" -d "Push skill or persona"
|
|
109
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "deploy" -d "Deploy to production"
|
|
110
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "chat" -d "Interactive chat"
|
|
111
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "env" -d "Manage environment"
|
|
112
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "persona" -d "Manage persona"
|
|
113
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "production" -d "View production"
|
|
114
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "resources" -d "Manage resources"
|
|
115
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "admin" -d "Open admin dashboard"
|
|
116
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "docs" -d "Open documentation"
|
|
117
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "channels" -d "Manage channels"
|
|
118
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "logs" -d "View logs"
|
|
119
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "skills" -d "Manage skills"
|
|
120
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "features" -d "Manage agent features"
|
|
121
|
+
complete -c lua -f -n "__fish_use_subcommand" -a "completion" -d "Generate completion script"
|
|
122
|
+
|
|
123
|
+
# Auth subcommands
|
|
124
|
+
complete -c lua -f -n "__fish_seen_subcommand_from auth" -a "configure" -d "Set up API key"
|
|
125
|
+
complete -c lua -f -n "__fish_seen_subcommand_from auth" -a "logout" -d "Delete API key"
|
|
126
|
+
complete -c lua -f -n "__fish_seen_subcommand_from auth" -a "key" -d "Display API key"
|
|
127
|
+
|
|
128
|
+
# Push subcommands
|
|
129
|
+
complete -c lua -f -n "__fish_seen_subcommand_from push" -a "skill" -d "Push a skill"
|
|
130
|
+
complete -c lua -f -n "__fish_seen_subcommand_from push" -a "persona" -d "Push a persona"
|
|
131
|
+
|
|
132
|
+
# Env subcommands
|
|
133
|
+
complete -c lua -f -n "__fish_seen_subcommand_from env" -a "sandbox" -d "Manage sandbox env vars"
|
|
134
|
+
complete -c lua -f -n "__fish_seen_subcommand_from env" -a "staging" -d "Manage staging env vars"
|
|
135
|
+
complete -c lua -f -n "__fish_seen_subcommand_from env" -a "production" -d "Manage production env vars"
|
|
136
|
+
|
|
137
|
+
# Persona subcommands
|
|
138
|
+
complete -c lua -f -n "__fish_seen_subcommand_from persona" -a "sandbox" -d "Manage sandbox persona"
|
|
139
|
+
complete -c lua -f -n "__fish_seen_subcommand_from persona" -a "staging" -d "Manage staging persona"
|
|
140
|
+
complete -c lua -f -n "__fish_seen_subcommand_from persona" -a "production" -d "Manage production persona"
|
|
141
|
+
|
|
142
|
+
# Skills subcommands
|
|
143
|
+
complete -c lua -f -n "__fish_seen_subcommand_from skills" -a "sandbox" -d "View sandbox skills"
|
|
144
|
+
complete -c lua -f -n "__fish_seen_subcommand_from skills" -a "staging" -d "View staging skills"
|
|
145
|
+
complete -c lua -f -n "__fish_seen_subcommand_from skills" -a "production" -d "Manage production skills"
|
|
146
|
+
|
|
147
|
+
# Chat subcommands
|
|
148
|
+
complete -c lua -f -n "__fish_seen_subcommand_from chat" -a "clear" -d "Clear history"
|
|
149
|
+
|
|
150
|
+
# Completion subcommands
|
|
151
|
+
complete -c lua -f -n "__fish_seen_subcommand_from completion" -a "bash" -d "Generate bash completion"
|
|
152
|
+
complete -c lua -f -n "__fish_seen_subcommand_from completion" -a "zsh" -d "Generate zsh completion"
|
|
153
|
+
complete -c lua -f -n "__fish_seen_subcommand_from completion" -a "fish" -d "Generate fish completion"
|
|
154
|
+
`;
|
|
155
|
+
/**
|
|
156
|
+
* Main completion command - generates shell completion scripts
|
|
157
|
+
*
|
|
158
|
+
* @param shell - Shell type (bash, zsh, fish)
|
|
159
|
+
* @returns Promise that resolves when command completes
|
|
160
|
+
*/
|
|
161
|
+
export async function completionCommand(shell) {
|
|
162
|
+
return withErrorHandling(async () => {
|
|
163
|
+
// If no shell specified, show instructions
|
|
164
|
+
if (!shell) {
|
|
165
|
+
console.log(`
|
|
166
|
+
🎯 Lua CLI Shell Completion
|
|
167
|
+
|
|
168
|
+
To enable autocomplete, run one of the following commands based on your shell:
|
|
169
|
+
|
|
170
|
+
Bash:
|
|
171
|
+
$ lua completion bash >> ~/.bashrc
|
|
172
|
+
$ source ~/.bashrc
|
|
173
|
+
|
|
174
|
+
Zsh:
|
|
175
|
+
$ lua completion zsh >> ~/.zshrc
|
|
176
|
+
$ source ~/.zshrc
|
|
177
|
+
|
|
178
|
+
Fish:
|
|
179
|
+
$ lua completion fish > ~/.config/fish/completions/lua.fish
|
|
180
|
+
|
|
181
|
+
Or manually:
|
|
182
|
+
$ lua completion bash # Output bash completion script
|
|
183
|
+
$ lua completion zsh # Output zsh completion script
|
|
184
|
+
$ lua completion fish # Output fish completion script
|
|
185
|
+
|
|
186
|
+
Then follow the instructions above to add it to your shell configuration.
|
|
187
|
+
`);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
// Validate shell type
|
|
191
|
+
const validShells = ['bash', 'zsh', 'fish'];
|
|
192
|
+
if (!validShells.includes(shell.toLowerCase())) {
|
|
193
|
+
console.error(`❌ Invalid shell: "${shell}". Must be one of: ${validShells.join(', ')}`);
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
196
|
+
// Output the appropriate completion script
|
|
197
|
+
switch (shell.toLowerCase()) {
|
|
198
|
+
case 'bash':
|
|
199
|
+
console.log(BASH_COMPLETION);
|
|
200
|
+
break;
|
|
201
|
+
case 'zsh':
|
|
202
|
+
console.log(ZSH_COMPLETION);
|
|
203
|
+
break;
|
|
204
|
+
case 'fish':
|
|
205
|
+
console.log(FISH_COMPLETION);
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}, "completion");
|
|
209
|
+
}
|
package/dist/commands/env.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Main env command - manages environment variables
|
|
7
7
|
*
|
|
8
8
|
* Features:
|
|
9
|
-
* - Environment selection (sandbox or production)
|
|
9
|
+
* - Environment selection (sandbox/staging or production)
|
|
10
10
|
* - List all environment variables
|
|
11
11
|
* - Add new variables
|
|
12
12
|
* - Update existing variables
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* - Sandbox: manages .env file
|
|
15
15
|
* - Production: uses API endpoints
|
|
16
16
|
*
|
|
17
|
+
* @param env - Optional environment argument ('sandbox', 'staging', or 'production')
|
|
17
18
|
* @returns Promise that resolves when command completes
|
|
18
19
|
*/
|
|
19
|
-
export declare function envCommand(): Promise<void>;
|
|
20
|
+
export declare function envCommand(env?: string): Promise<void>;
|
package/dist/commands/env.js
CHANGED
|
@@ -15,7 +15,7 @@ import DeveloperApi from '../api/developer.api.service.js';
|
|
|
15
15
|
* Main env command - manages environment variables
|
|
16
16
|
*
|
|
17
17
|
* Features:
|
|
18
|
-
* - Environment selection (sandbox or production)
|
|
18
|
+
* - Environment selection (sandbox/staging or production)
|
|
19
19
|
* - List all environment variables
|
|
20
20
|
* - Add new variables
|
|
21
21
|
* - Update existing variables
|
|
@@ -23,34 +23,59 @@ import DeveloperApi from '../api/developer.api.service.js';
|
|
|
23
23
|
* - Sandbox: manages .env file
|
|
24
24
|
* - Production: uses API endpoints
|
|
25
25
|
*
|
|
26
|
+
* @param env - Optional environment argument ('sandbox', 'staging', or 'production')
|
|
26
27
|
* @returns Promise that resolves when command completes
|
|
27
28
|
*/
|
|
28
|
-
export async function envCommand() {
|
|
29
|
+
export async function envCommand(env) {
|
|
29
30
|
return withErrorHandling(async () => {
|
|
30
31
|
// Step 1: Load configuration
|
|
31
32
|
const config = readSkillConfig();
|
|
32
33
|
validateConfig(config);
|
|
33
34
|
validateAgentConfig(config);
|
|
34
35
|
const agentId = config.agent.agentId;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{ name: '🔧 Sandbox (.env file)', value: 'sandbox' },
|
|
43
|
-
{ name: '🚀 Production (API)', value: 'production' }
|
|
44
|
-
]
|
|
36
|
+
let selectedEnvironment;
|
|
37
|
+
// Step 2: Check if environment was provided as argument
|
|
38
|
+
if (env) {
|
|
39
|
+
// Normalize the environment (staging is an alias for sandbox)
|
|
40
|
+
const normalizedEnv = env.toLowerCase();
|
|
41
|
+
if (normalizedEnv === 'sandbox' || normalizedEnv === 'staging') {
|
|
42
|
+
selectedEnvironment = 'sandbox';
|
|
45
43
|
}
|
|
46
|
-
|
|
44
|
+
else if (normalizedEnv === 'production') {
|
|
45
|
+
selectedEnvironment = 'production';
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
console.error(`❌ Invalid environment: "${env}". Must be "sandbox", "staging", or "production".`);
|
|
49
|
+
console.log('\nUsage:');
|
|
50
|
+
console.log(' lua env - Interactive selection');
|
|
51
|
+
console.log(' lua env sandbox - Manage sandbox env vars directly');
|
|
52
|
+
console.log(' lua env staging - Manage staging env vars (alias for sandbox)');
|
|
53
|
+
console.log(' lua env production - Manage production env vars directly');
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// Step 3: Prompt for environment selection
|
|
59
|
+
const { environment } = await inquirer.prompt([
|
|
60
|
+
{
|
|
61
|
+
type: 'list',
|
|
62
|
+
name: 'environment',
|
|
63
|
+
message: 'Select environment:',
|
|
64
|
+
choices: [
|
|
65
|
+
{ name: '🔧 Sandbox (.env file)', value: 'sandbox' },
|
|
66
|
+
{ name: '🚀 Production (API)', value: 'production' }
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
]);
|
|
70
|
+
selectedEnvironment = environment;
|
|
71
|
+
}
|
|
47
72
|
let context = {
|
|
48
|
-
environment,
|
|
73
|
+
environment: selectedEnvironment,
|
|
49
74
|
agentId,
|
|
50
75
|
apiKey: '',
|
|
51
76
|
};
|
|
52
|
-
// Step
|
|
53
|
-
if (
|
|
77
|
+
// Step 4: Authenticate (needed for production)
|
|
78
|
+
if (selectedEnvironment === 'production') {
|
|
54
79
|
const apiKey = await loadApiKey();
|
|
55
80
|
if (!apiKey) {
|
|
56
81
|
console.error("❌ No API key found. Please run 'lua auth configure' to set up your API key.");
|
|
@@ -61,7 +86,7 @@ export async function envCommand() {
|
|
|
61
86
|
context.developerApi = new DeveloperApi(BASE_URLS.API, apiKey, agentId);
|
|
62
87
|
writeProgress("✅ Authenticated");
|
|
63
88
|
}
|
|
64
|
-
// Step
|
|
89
|
+
// Step 5: Start management loop
|
|
65
90
|
await manageEnvironmentVariables(context);
|
|
66
91
|
}, "env");
|
|
67
92
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Features Command
|
|
3
|
+
* Manages agent features (tickets, RAG, webSearch, etc.)
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Main features command - manages agent features
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - List all available features
|
|
10
|
+
* - View feature details (active status and context)
|
|
11
|
+
* - Enable/disable features
|
|
12
|
+
* - Update feature context
|
|
13
|
+
*
|
|
14
|
+
* @returns Promise that resolves when command completes
|
|
15
|
+
*/
|
|
16
|
+
export declare function featuresCommand(): Promise<void>;
|