-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathoma
More file actions
265 lines (227 loc) · 6.65 KB
/
Copy pathoma
File metadata and controls
265 lines (227 loc) · 6.65 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
#!/bin/bash
# Oh My Antigravity (OMA) CLI - Bash Version
# Cross-platform CLI for managing Antigravity plugins, themes, and commands
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
MAGENTA='\033[0;35m'
WHITE='\033[1;37m'
NC='\033[0m' # No Color
# Paths
OMA_HOME="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
ANTIGRAVITY_GLOBAL="$HOME/.gemini/antigravity"
ANTIGRAVITY_PROJECT=".agents"
# State
SCOPE="global"
show_banner() {
echo -e "${MAGENTA}"
echo " ____ __ __ _ "
echo " / __ \| \/ | / \ Oh My Antigravity"
echo " | | | | \ / | / _ \ The Ultimate Antigravity Framework"
echo " | | | | |\/| |/ ___ \ Version 1.0.0"
echo " |_| |_|_| |_/_/ \_\ "
echo -e "${NC}"
}
show_help() {
show_banner
echo -e "${YELLOW}USAGE:${NC}"
echo " oma <command> [target] [options]"
echo ""
echo -e "${YELLOW}COMMANDS:${NC}"
echo " install <plugin> Install a plugin (skill)"
echo " remove <plugin> Remove a plugin"
echo " list List available plugins"
echo " installed List installed plugins"
echo " update Update OMA framework"
echo " help Show this help message"
echo ""
echo -e "${YELLOW}OPTIONS:${NC}"
echo " --project Install to current project only (.agents/skills)"
echo " --global Install globally (~/.gemini/antigravity/skills)"
echo ""
echo -e "${YELLOW}EXAMPLES:${NC}"
echo " oma install python-expert"
echo " oma install react --project"
echo " oma list"
echo ""
}
success() {
echo -e "${GREEN}$1${NC}"
}
error() {
echo -e "${RED}$1${NC}"
}
info() {
echo -e "${CYAN}$1${NC}"
}
warning() {
echo -e "${YELLOW}$1${NC}"
}
get_target_path() {
if [ "$SCOPE" = "project" ]; then
local path="$(pwd)/${ANTIGRAVITY_PROJECT}/skills"
mkdir -p "$path"
echo "$path"
else
local path="${ANTIGRAVITY_GLOBAL}/skills"
mkdir -p "$path"
echo "$path"
fi
}
install_plugin() {
local plugin_name="$1"
if [ -z "$plugin_name" ]; then
error "Error: Plugin name is required."
echo "Usage: oma install <plugin-name>"
return 1
fi
local source_path="${OMA_HOME}/skills/${plugin_name}"
if [ ! -d "$source_path" ]; then
error "Error: Plugin '$plugin_name' not found in OMA repository."
echo "Available plugins:"
list_plugins
return 1
fi
local target_path=$(get_target_path)
local dest_path="${target_path}/${plugin_name}"
info "Installing '$plugin_name' to $SCOPE scope..."
if [ -d "$dest_path" ]; then
warning "Plugin already exists. Updating..."
rm -rf "$dest_path"
fi
cp -r "$source_path" "$dest_path"
success "✓ Successfully installed '$plugin_name' to $target_path"
}
remove_plugin() {
local plugin_name="$1"
if [ -z "$plugin_name" ]; then
error "Error: Plugin name is required."
return 1
fi
local target_path=$(get_target_path)
local plugin_path="${target_path}/${plugin_name}"
if [ ! -d "$plugin_path" ]; then
error "Error: Plugin '$plugin_name' is not installed in $SCOPE scope."
return 1
fi
info "Removing '$plugin_name' from $SCOPE scope..."
rm -rf "$plugin_path"
success "✓ Successfully removed '$plugin_name'"
}
list_plugins() {
local plugins_path="${OMA_HOME}/skills"
if [ ! -d "$plugins_path" ]; then
warning "No plugins directory found."
return
fi
echo ""
echo -e "${YELLOW}Available Plugins:${NC}"
echo "───────────────────────────────────"
for plugin_dir in "$plugins_path"/*/; do
if [ -d "$plugin_dir" ]; then
local plugin_name=$(basename "$plugin_dir")
local description=""
local skill_md="${plugin_dir}SKILL.md"
if [ -f "$skill_md" ]; then
description=$(grep -oP '(?<=description:\s).+' "$skill_md" 2>/dev/null | head -1 || echo "")
fi
echo -e " 📦 ${WHITE}${plugin_name}${NC}${description:+ - }${description}"
fi
done
echo ""
}
list_installed() {
echo ""
echo -e "${YELLOW}Installed Plugins:${NC}"
echo "───────────────────────────────────"
# Global plugins
local global_path="${ANTIGRAVITY_GLOBAL}/skills"
if [ -d "$global_path" ]; then
local has_global=false
for plugin_dir in "$global_path"/*/; do
if [ -d "$plugin_dir" ]; then
if [ "$has_global" = false ]; then
echo -e " ${CYAN}Global (~/.gemini/antigravity/skills):${NC}"
has_global=true
fi
echo " 🌍 $(basename "$plugin_dir")"
fi
done
fi
# Project plugins
local project_path="$(pwd)/${ANTIGRAVITY_PROJECT}/skills"
if [ -d "$project_path" ]; then
local has_project=false
for plugin_dir in "$project_path"/*/; do
if [ -d "$plugin_dir" ]; then
if [ "$has_project" = false ]; then
echo -e " ${CYAN}Project (.agents/skills):${NC}"
has_project=true
fi
echo " 📁 $(basename "$plugin_dir")"
fi
done
fi
echo ""
}
update_oma() {
info "Checking for updates..."
warning "Auto-update feature coming soon!"
echo "For now, please run 'git pull' in the OMA directory."
}
# Parse arguments
COMMAND=""
TARGET=""
while [[ $# -gt 0 ]]; do
case $1 in
--project)
SCOPE="project"
shift
;;
--global)
SCOPE="global"
shift
;;
--help|-h)
show_help
exit 0
;;
*)
if [ -z "$COMMAND" ]; then
COMMAND="$1"
elif [ -z "$TARGET" ]; then
TARGET="$1"
fi
shift
;;
esac
done
# Main execution
case "$COMMAND" in
install)
install_plugin "$TARGET"
;;
remove|uninstall)
remove_plugin "$TARGET"
;;
list)
list_plugins
;;
installed)
list_installed
;;
update)
update_oma
;;
help|"")
show_help
;;
*)
error "Unknown command: $COMMAND"
echo "Run 'oma help' for usage information."
exit 1
;;
esac