-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaistack
More file actions
executable file
·320 lines (304 loc) · 19 KB
/
aistack
File metadata and controls
executable file
·320 lines (304 loc) · 19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
#!/bin/bash
_CURRENT_FILE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
_CURRENT_RUNNING_DIR="$( cd "$( dirname "." )" && pwd )"
STELLA_LOG_STATE="OFF"
. "${_CURRENT_FILE_DIR}/stella-link.sh" include
# NOTE
# From HERE, $STELLA_ORIGINAL_SYSTEM_PATH contains $PATH before stella features are included
. "${_CURRENT_FILE_DIR}/lib/lib.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_json.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_yaml.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_node.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_bun.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_cpa.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_vscode.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_gemini.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_opencode.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_kilo.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_orla.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_bmad.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_adk.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_asm.sh"
. "${_CURRENT_FILE_DIR}/lib/lib_mcp.sh"
# --- USAGE ---
usage() {
cat << EOF
AIStack CLI
Usage: aistack [options]
Options:
init Install/Reinstall dependencies.
uninstall Uninstall aistack, all tools, mcp servers and unregister everything from PATH.
help Display this help message.
info Display various aistack information and configuration.
shell Enter aistack context and path.
----
gc : gemini-cli - https://google-gemini.github.io/gemini-cli
gc install [@version] Install and configure Gemini CLI. (main versions are latest, nightly, preview) (when asked to relaunch gemini cli, use 'aistack gc launch' command)
gc uninstall Uninstalling Gemini CLI and unregister Gemini CLI PATH. (keep all configuration unchanged, to remove configuration use 'aistack gc reset' command)
gc configure Configure Gemini CLI with some default values. But do not fully reset all other existing config values. ('aistack gc install' include configuration)
gc show-config Show current Gemini CLI configuration.
gc reset Reset all Gemini CLI configuration.
gc register <all|shell|vs> Register Gemini CLI PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs").
gc unregister [<all|shell|vs>] Unregister Gemini CLI PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs"). Default value is "all".
gc launch [context folder] -- <gemini cli command>
Launch Gemini CLI. Instead use 'gemini' command if ${AISTACK_GEMINI_LAUNCHER_HOME} is in your PATH.
Use 'aistack gc register <shell>' to set it in your PATH.
gc set <key> <value> Set a Gemini CLI configuration in settings file.
gc del <key> Delete a Gemini CLI configuration in settings file.
gc mcp calculator install|uninstall Add mcp-calculator local server configuration.
gc mcp github install|uninstall Add mcp-github remote server configuration.
gc mcp desktop-commander install|uninstall Add mcp-desktop-commander local server configuration.
gc mcp context7 install|uninstall [CONTEXT7_API_KEY] Add mcp-context7 local server configuration. Provide optional CONTEXT7_API_KEY as environment variable or command argument.
gc mcp data commons install|uninstall [DC_API_KEY] Add mcp-data-commons remote server configuration. Provide mandatory DC_API_KEY from https://apikeys.datacommons.org/ as environment variable or command argument.
----
oc : opencode - https://opencode.ai
oc install Install and configure Opencode.
oc uninstall Uninstall Opencode and unregister Opencode PATH (keep all configuration unchanged, to remove configuration use 'aistack oc reset' command)
oc configure Configure Opencode with some default values. But do not fully reset all other existing config values. ('aistack oc install' include configuration)
oc show-config Show current Opencode configuration.
oc reset Reset all Opencode configuration.
oc register <all|shell|vs> Register Opencode PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs").
oc unregister [<all|shell|vs>] Unregister Opencode PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs"). Default value is "all".
oc launch [context folder] -- <opencode command>
Launch Opencode. Instead use 'opencode' command if ${AISTACK_OPENCODE_LAUNCHER_HOME} is in your PATH.
Use 'aistack oc register <shell>' to set it in your PATH.
oc mcp calculator install|uninstall Add mcp-calculator local server configuration.
oc mcp github install|uninstall Add mcp-github remote server configuration.
oc mcp context7 install|uninstall Add mcp-context7 local server configuration.
----
kc : Kilo Code CLI and VS Code extension - https://kilo.ai/
kc install [cli|extension] Install and configure Kilo Code. By default, installs the CLI.
kc uninstall [cli|extension] Uninstall Kilo Code and unregister Kilo Code PATH. (keep all configuration unchanged, to remove configuration use 'aistack kc reset' command)
kc configure Configure Kilo Code with some default values. But do not fully reset all other existing config values. ('aistack kc install' include configuration)
kc info Print Kilo Code informations.
kc show-config Show current Kilo Code configuration.
kc reset Reset all Kilo Code configuration.
kc register <all|shell|vs> Register Kilo Code PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs").
kc unregister [<all|shell|vs>] Unregister Kilo Code PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs"). Default value is "all".
kc launch [context folder] -- <other kilo code options>
Launch Kilo Code. Instead use 'kilo' command if ${AISTACK_KILO_LAUNCHER_HOME} is in your PATH.
Use 'aistack kc register <shell>' to set it in your PATH.
kc connect cpa Connect Kilo Code CLI and VS Code extension to CLIProxyAPI. Create a CLIProxyAPI provider and register all models into Kilo Code. (require 'aistack cpa install' before connecting)
----
vs info Print VS Code informations.
vs show-config Show current VS Code configuration.
vs install|uninstall <extension id> Install/uninstall a VS Code extension from marketplace into current VS Code session.
vs set <key> <value> Set a VS Code configuration in settings file.
vs del <key> Delete a VS Code configuration in settings file.
----
orla : Orla - https://github.com/dorcha-inc/orla
orla install Install and configure Orla.
orla uninstall Uninstalling Orla and unregister Orla PATH. (keep all configuration unchanged, to remove configuration use 'aistack gc reset' command)
orla configure Configure Orla with some default values. But do not fully reset all other existing config values. ('aistack orla install' include configuration)
orla info Print Orla informations.
orla show-config Show current Orla configuration.
orla reset Reset all Orla configuration.
orla register <all|shell|vs> Register Orla PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs").
orla unregister [<all|shell|vs>] Unregister Orla PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs"). Default value is "all".
orla agent <other orla options> Execute Orla agent command. (i.e: aistack orla agent "Hello world" -m "gemini-2.5-flash")
orla serve <other orla options> Execute Orla serve command - Launch Orla API service.
orla launch [context folder] -- <Orla command>
Launch Orla. Instead use 'orla' command if ${AISTACK_ORLA_LAUNCHER_HOME} is in your PATH.
Use 'aistack orla register <shell>' to set it in your PATH.
orla set <key> <value> ["string"] Set a Orla key in setting file. (i.e: cpa set listen_address localhost:8081) Use optional "string" option if value is a string.
orla get <key> Get a Orla key from setting file. (i.e: cpa get api-key.0)
orla connect agent|serve cpa [<model>] Connect Orla agent or service mode to CLIProxyAPI. By default will set the first model from CLIProxyAPI as the default model. <model> provide a specific model.
----
cpa : CLIProxyAPI - https://github.com/router-for-me/CLIProxyAPI
cpa install Install and configure CLIProxyAPI.
cpa uninstall Uninstall CLIProxyAPI. (keeping all configuration unchanged. to remove configuration use 'aistack cpa reset' command)
cpa configure Configure CLIProxyAPI with some default values. Erase all existing API keys but do not fully reset all other existing config values. ('aistack cpa install' include configuration)
cpa info Print CLIProxyAPI informations.
cpa show-config Show current CLIProxyAPI configuration.
cpa reset Reset all CLIProxyAPI configuration.
cpa launch [context folder] -- <CLIProxyAPI command> Launch CLIProxyAPI.
cpa login gemini-oauth [--project_id <your_project_id>] Login to Gemini OAuth.
cpa login openai-oauth Login to OpenAI OAuth.
cpa login qwen-oauth Login to Qwen OAuth.
cpa set <config key> <value> ["string"] Set a CLIProxyAPI key in setting file. (i.e: cpa set port 8000) Use optional "string" if option value is a string.
cpa get <config key> Get a CLIProxyAPI key from setting file. (i.e: cpa get api-key.0)
cpa key generate Generate a new API key for CLIProxyAPI and add it to the configuration. (cpa must be installed before)
cpa key list List all API keys from CLIProxyAPI configuration.
cpa key get <N> Get API key N. (i.e: cpa key get 0)
cpa key reset Remove all API keys from CLIProxyAPI configuration.
cpa key delete <key> Remove an API key from CLIProxyAPI configuration. (cpa must be installed before)
cpa model list List all available LLM models from CLIProxyAPI endpoint.
----
asm : Agent Skill Manager - https://github.com/luongnv89/asm
asm install [@version] Install and configure asm.
asm uninstall Uninstall asm and unregister asm PATH.
asm configure Configure asm with some default values. But do not fully reset all other existing config values. ('aistack asm install' include configuration)
asm show-config Show current asm configuration.
asm reset Reset asm configuration.
asm register <all|shell|vs> Register asm PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs").
asm unregister [<all|shell|vs>] Unregister asm PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs"). Default value is "all".
asm launch [context folder] -- <asm command>
Launch asm. Instead use 'asm' command if ${AISTACK_ASM_LAUNCHER_HOME} is in your PATH.
Use 'aistack asm register <shell>' to set it in your PATH.
----
nvm|npm|npx|bun|pip|pipx|uv [<command>] Execute nvm, npm, npx, bun, pip, pipx, or uv command using the internal nodejs or python runtime from aistack. (i.e: aistack npm install -g typescript)
----
app killport <port> Kill process running on a specific port.
----
bmad <install|uninstall> Install/Uninstall bmad cli.
bmad register <all|shell|vs> Register bmad cli PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs").
bmad unregister [<all|shell|vs>] Unregister bmad cli PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs"). Default value is "all".
bmad launch -- <bmad command> Launch bmad cli. (i.e: aistack bmad launch -- --help)
Instead use 'bmad' or 'bmad-method' command if ${AISTACK_BMAD_LAUNCHER_HOME} is in your PATH.
Use 'aistack bmad register <shell>' to set it in your PATH.
----
Agent Development Kit (ADK) - (https://adk.dev/)
adk <install|uninstall> Install/Uninstall the adk for python.
adk register <all|shell|vs> Register adk PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs").
adk unregister [<all|shell|vs>] Unregister adk PATH into shell env PATH ("all" supported shells or "bash", "zsh" or "fish") or into VS Code integrated terminal env PATH ("vs"). Default value is "all".
adk launch -- <adk command> Launch adk. (i.e: aistack adk launch -- --help)
Instead use 'adk' command if ${AISTACK_ADK_LAUNCHER_HOME} is in your PATH.
Use 'aistack adk register <shell>' to set it in your PATH.
----
EOF
}
# Main function
main() {
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
usage
exit 0
fi
if [ "$#" -eq 0 ]; then
usage
exit 1
fi
local command="$1"
shift
case "$command" in
help)
usage
exit 0
;;
shell)
$STELLA_API boot_app_shell "local"
;;
info)
aistack_info
;;
init)
aistack_init
;;
uninstall)
aistack_uninstall
;;
bun)
if ! check_requirements "bun"; then echo " -- ERROR : bun missing, launch aistack init"; exit 1; fi;
if [ "$AISTACK_INTERNAL_BUN_RUNTIME_AVAILABLE" = "true" ]; then
PATH="${AISTACK_BUN_BIN_PATH}:${STELLA_ORIGINAL_SYSTEM_PATH}" "$command" "$@"
else
exit 1
fi
;;
npm|npx)
if ! check_requirements "nodejs"; then echo " -- ERROR : nodejs missing, launch aistack init"; exit 1; fi;
if [ "$AISTACK_INTERNAL_NODEJS_RUNTIME_AVAILABLE" = "true" ]; then
PATH="${AISTACK_NODEJS_BIN_PATH}:${STELLA_ORIGINAL_SYSTEM_PATH}" "$command" "$@"
else
exit 1
fi
;;
nvm)
if ! check_requirements "nodejs"; then echo " -- ERROR : nodejs missing, launch aistack init"; exit 1; fi;
if [ "$AISTACK_INTERNAL_NVM_AVAILABLE" = "true" ]; then
"$command" "$@"
else
exit 1
fi
;;
pip|pipx|uv)
if ! check_requirements "python"; then echo " -- ERROR : python missing, launch aistack init"; exit 1; fi;
if [ "$AISTACK_INTERNAL_PYTHON_RUNTIME_AVAILABLE" = "true" ]; then
PATH="${AISTACK_PYTHON_BIN_PATH}:${STELLA_ORIGINAL_SYSTEM_PATH}" "$command" "$@"
else
exit 1
fi
;;
npm-config)
echo "WARN : COMMAND CHANGE : use $0 npm config set <key> <value>"
# if ! check_requirements "nodejs"; then echo " -- ERROR : nodejs missing, launch aistack init"; exit 1; fi;
# local sub_command="$1"
# shift
# case "$sub_command" in
# set)
# local key="$1"
# shift
# local value="$1"
# shift
# if [ -z "$key" ]; then
# echo " -- ERROR : Missing key for npm-config set"
# usage
# exit 1
# fi
# echo "Setting npm config: $key = $value"
# PATH="${AISTACK_NODEJS_BIN_PATH}:${STELLA_ORIGINAL_SYSTEM_PATH}" npm config set "$key" "$value" -g
# ;;
# *)
# echo "Error: Unknown command $sub_command for npm-config"
# usage
# exit 1
# ;;
# esac
;;
app)
local sub_command="$1"
shift
case "$sub_command" in
killport)
local port="$1"
shift
if [ -z "$port" ]; then
echo " -- ERROR : Missing port for app killport"
usage
exit 1
fi
process_kill_by_port "$port"
;;
*)
echo "Error: Unknown command $sub_command for app"
usage
exit 1
;;
esac
;;
oc)
. "${_CURRENT_FILE_DIR}/lib/main_oc.sh"
;;
gc)
. "${_CURRENT_FILE_DIR}/lib/main_gc.sh"
;;
cpa)
. "${_CURRENT_FILE_DIR}/lib/main_cpa.sh"
;;
vs)
. "${_CURRENT_FILE_DIR}/lib/main_vs.sh"
;;
orla)
. "${_CURRENT_FILE_DIR}/lib/main_orla.sh"
;;
bmad)
. "${_CURRENT_FILE_DIR}/lib/main_bmad.sh"
;;
adk)
. "${_CURRENT_FILE_DIR}/lib/main_adk.sh"
;;
kc)
. "${_CURRENT_FILE_DIR}/lib/main_kilo.sh"
;;
asm)
. "${_CURRENT_FILE_DIR}/lib/main_asm.sh"
;;
*)
echo "Error: Unknown command $command"
usage
exit 1
;;
esac
}
aistack_path
runtime_path
main "$@"