oh-my-ag 1.4.1 → 1.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-ag",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "description": "Professional agent skills for Google Antigravity IDE - PM, Frontend, Backend, Mobile, QA, and Debug specialists that work together seamlessly",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,6 +39,8 @@
39
39
  "scripts": {
40
40
  "build": "bun build src/cli.ts --outfile bin/cli.js --target node --minify",
41
41
  "dev": "bun run src/cli.ts",
42
+ "lint": "biome check --write --unsafe .",
43
+ "test": "vitest run",
42
44
  "prepublishOnly": "bun run build"
43
45
  },
44
46
  "dependencies": {
@@ -50,7 +52,10 @@
50
52
  "ws": "^8.18.0"
51
53
  },
52
54
  "devDependencies": {
53
- "@types/bun": "^1.3.8"
55
+ "@biomejs/biome": "2.3.13",
56
+ "@types/bun": "^1.3.8",
57
+ "@types/ws": "^8.18.1",
58
+ "vitest": "^4.0.18"
54
59
  },
55
60
  "peerDependencies": {
56
61
  "typescript": "^5"
@@ -1,263 +0,0 @@
1
- #!/bin/bash
2
- # spawn-agent.sh - Spawn a sub-agent using configured CLI vendor
3
- # Usage: ./spawn-agent.sh <agent-type> <task-description> [workspace] [--vendor <vendor>]
4
-
5
- set -e
6
-
7
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
- CONFIG_FILE="${SCRIPT_DIR}/../config/cli-config.yaml"
9
- RESULTS_DIR=".agent/results"
10
-
11
- # Colors for output
12
- RED='\033[0;31m'
13
- GREEN='\033[0;32m'
14
- YELLOW='\033[1;33m'
15
- BLUE='\033[0;34m'
16
- NC='\033[0m' # No Color
17
-
18
- # Parse arguments
19
- AGENT_TYPE=""
20
- TASK=""
21
- WORKSPACE="."
22
- VENDOR=""
23
-
24
- while [[ $# -gt 0 ]]; do
25
- case $1 in
26
- --vendor|-v)
27
- VENDOR="$2"
28
- shift 2
29
- ;;
30
- --help|-h)
31
- echo "Usage: spawn-agent.sh <agent-type> <task> [workspace] [--vendor <vendor>]"
32
- echo ""
33
- echo "Arguments:"
34
- echo " agent-type Type of agent (backend, frontend, mobile, qa, debug)"
35
- echo " task Task description or path to task file"
36
- echo " workspace Working directory for the agent (default: current)"
37
- echo ""
38
- echo "Options:"
39
- echo " --vendor, -v CLI vendor (gemini, claude, codex, qwen)"
40
- echo " --help, -h Show this help message"
41
- exit 0
42
- ;;
43
- *)
44
- if [[ -z "$AGENT_TYPE" ]]; then
45
- AGENT_TYPE="$1"
46
- elif [[ -z "$TASK" ]]; then
47
- TASK="$1"
48
- else
49
- WORKSPACE="$1"
50
- fi
51
- shift
52
- ;;
53
- esac
54
- done
55
-
56
- # Validate arguments
57
- if [[ -z "$AGENT_TYPE" ]] || [[ -z "$TASK" ]]; then
58
- echo -e "${RED}Error: agent-type and task are required${NC}"
59
- echo "Usage: spawn-agent.sh <agent-type> <task> [workspace] [--vendor <vendor>]"
60
- exit 1
61
- fi
62
-
63
- # Read config using grep/sed (no yq dependency)
64
- get_config() {
65
- local key="$1"
66
- grep -E "^${key}:" "$CONFIG_FILE" 2>/dev/null | sed 's/^[^:]*: *//' | tr -d '"'
67
- }
68
-
69
- get_vendor_config() {
70
- local vendor="$1"
71
- local key="$2"
72
- # Simple YAML parsing for nested values
73
- awk -v vendor="$vendor" -v key="$key" '
74
- /^ [a-z]+:$/ { current_vendor = $1; gsub(/:/, "", current_vendor) }
75
- current_vendor == vendor && $1 == key":" { gsub(/^[^:]*: */, ""); gsub(/"/, ""); print }
76
- ' "$CONFIG_FILE"
77
- }
78
-
79
- # Get CLI for specific agent type from user-preferences.yaml
80
- get_agent_cli() {
81
- local agent_type="$1"
82
- local prefs="${SCRIPT_DIR}/../../../config/user-preferences.yaml"
83
- if [[ -f "$prefs" ]]; then
84
- grep -A10 "^agent_cli_mapping:" "$prefs" 2>/dev/null | \
85
- grep "^ ${agent_type}:" | \
86
- sed 's/^[^:]*: *//' | tr -d '"' | xargs
87
- fi
88
- }
89
-
90
- # Get default CLI from user-preferences.yaml
91
- get_default_cli() {
92
- local prefs="${SCRIPT_DIR}/../../../config/user-preferences.yaml"
93
- if [[ -f "$prefs" ]]; then
94
- grep "^default_cli:" "$prefs" 2>/dev/null | sed 's/^[^:]*: *//' | tr -d '"' | xargs
95
- fi
96
- }
97
-
98
- # Get vendor from (in priority order):
99
- # 1) command line arg (--vendor)
100
- # 2) agent_cli_mapping from user-preferences.yaml
101
- # 3) default_cli from user-preferences.yaml
102
- # 4) active_vendor from cli-config.yaml (legacy/fallback)
103
- # 5) hardcoded "gemini"
104
- if [[ -z "$VENDOR" ]]; then
105
- VENDOR=$(get_agent_cli "$AGENT_TYPE")
106
- fi
107
-
108
- if [[ -z "$VENDOR" ]]; then
109
- VENDOR=$(get_default_cli)
110
- fi
111
-
112
- if [[ -z "$VENDOR" ]]; then
113
- VENDOR=$(get_config "active_vendor")
114
- fi
115
-
116
- if [[ -z "$VENDOR" ]]; then
117
- VENDOR="gemini"
118
- fi
119
-
120
- echo -e "${BLUE}[SubAgent]${NC} Spawning ${YELLOW}${AGENT_TYPE}${NC} agent with ${GREEN}${VENDOR}${NC} CLI"
121
-
122
- # Get vendor-specific configuration
123
- CLI_CMD=$(get_vendor_config "$VENDOR" "command")
124
- PROMPT_FLAG=$(get_vendor_config "$VENDOR" "prompt_flag")
125
- OUTPUT_FLAG=$(get_vendor_config "$VENDOR" "output_format_flag")
126
- OUTPUT_FORMAT=$(get_vendor_config "$VENDOR" "output_format")
127
- AUTO_FLAG=$(get_vendor_config "$VENDOR" "auto_approve_flag")
128
- RESPONSE_JQ=$(get_vendor_config "$VENDOR" "response_jq")
129
-
130
- # Fallback defaults
131
- CLI_CMD="${CLI_CMD:-$VENDOR}"
132
- PROMPT_FLAG="${PROMPT_FLAG:--p}"
133
- OUTPUT_FORMAT="${OUTPUT_FORMAT:-json}"
134
- RESPONSE_JQ="${RESPONSE_JQ:-.response}"
135
-
136
- # Check if CLI is available
137
- if ! command -v "$CLI_CMD" &> /dev/null; then
138
- echo -e "${RED}Error: ${CLI_CMD} CLI not found in PATH${NC}"
139
- echo "Please install ${VENDOR} CLI and ensure it's authenticated"
140
- exit 1
141
- fi
142
-
143
- # Create results directory
144
- mkdir -p "$RESULTS_DIR"
145
-
146
- # Generate unique result filename
147
- TIMESTAMP=$(date +%Y%m%d-%H%M%S)
148
- RESULT_FILE="${RESULTS_DIR}/${AGENT_TYPE}-${TIMESTAMP}.json"
149
- OUTPUT_FILE="${RESULTS_DIR}/${AGENT_TYPE}-${TIMESTAMP}.md"
150
-
151
- # If task is a file path, read its contents
152
- if [[ -f "$TASK" ]]; then
153
- TASK_CONTENT=$(cat "$TASK")
154
- else
155
- TASK_CONTENT="$TASK"
156
- fi
157
-
158
- # Load agent-specific template if exists
159
- TEMPLATE_FILE="${SCRIPT_DIR}/../templates/${AGENT_TYPE}-task.md"
160
- if [[ -f "$TEMPLATE_FILE" ]]; then
161
- TEMPLATE=$(cat "$TEMPLATE_FILE")
162
- TASK_CONTENT="${TEMPLATE}
163
-
164
- ## Current Task
165
- ${TASK_CONTENT}"
166
- fi
167
-
168
- # Build command based on vendor
169
- build_command() {
170
- local cmd="$CLI_CMD"
171
-
172
- case "$VENDOR" in
173
- gemini)
174
- cmd="$cmd $PROMPT_FLAG \"$TASK_CONTENT\""
175
- [[ -n "$OUTPUT_FLAG" ]] && cmd="$cmd $OUTPUT_FLAG $OUTPUT_FORMAT"
176
- [[ -n "$AUTO_FLAG" ]] && cmd="$cmd $AUTO_FLAG"
177
- ;;
178
- claude)
179
- cmd="$cmd $PROMPT_FLAG \"$TASK_CONTENT\""
180
- [[ -n "$OUTPUT_FLAG" ]] && cmd="$cmd $OUTPUT_FLAG $OUTPUT_FORMAT"
181
- [[ -n "$AUTO_FLAG" ]] && cmd="$cmd $AUTO_FLAG"
182
- # Isolation flags
183
- cmd="$cmd --setting-sources \"\""
184
- ;;
185
- codex)
186
- # Set isolation environment
187
- export CODEX_HOME="/tmp/codex-subagent-$$"
188
- mkdir -p "$CODEX_HOME"
189
- cmd="$cmd $PROMPT_FLAG \"$TASK_CONTENT\""
190
- [[ -n "$AUTO_FLAG" ]] && cmd="$cmd $AUTO_FLAG"
191
- ;;
192
- qwen)
193
- cmd="$cmd $PROMPT_FLAG \"$TASK_CONTENT\""
194
- [[ -n "$OUTPUT_FLAG" ]] && cmd="$cmd $OUTPUT_FLAG $OUTPUT_FORMAT"
195
- [[ -n "$AUTO_FLAG" ]] && cmd="$cmd $AUTO_FLAG"
196
- ;;
197
- *)
198
- # Generic fallback
199
- cmd="$cmd $PROMPT_FLAG \"$TASK_CONTENT\""
200
- ;;
201
- esac
202
-
203
- echo "$cmd"
204
- }
205
-
206
- # Execute in workspace
207
- echo -e "${BLUE}[SubAgent]${NC} Working directory: ${WORKSPACE}"
208
- echo -e "${BLUE}[SubAgent]${NC} Task: ${TASK_CONTENT:0:100}..."
209
-
210
- cd "$WORKSPACE"
211
-
212
- # Build and execute command
213
- CMD=$(build_command)
214
- echo -e "${BLUE}[SubAgent]${NC} Executing: ${CLI_CMD} ..."
215
-
216
- # Execute and capture output
217
- set +e
218
- if [[ "$OUTPUT_FORMAT" == "json" ]]; then
219
- eval "$CMD" > "$RESULT_FILE" 2>&1
220
- EXIT_CODE=$?
221
-
222
- if [[ $EXIT_CODE -eq 0 ]] && [[ -s "$RESULT_FILE" ]]; then
223
- # Extract response from JSON
224
- if command -v jq &> /dev/null; then
225
- jq -r "$RESPONSE_JQ" "$RESULT_FILE" > "$OUTPUT_FILE" 2>/dev/null || \
226
- cat "$RESULT_FILE" > "$OUTPUT_FILE"
227
- else
228
- cat "$RESULT_FILE" > "$OUTPUT_FILE"
229
- fi
230
- echo -e "${GREEN}[SubAgent]${NC} Completed successfully"
231
- echo -e "${GREEN}[SubAgent]${NC} Result: ${OUTPUT_FILE}"
232
- else
233
- echo -e "${RED}[SubAgent]${NC} Failed with exit code: ${EXIT_CODE}"
234
- cat "$RESULT_FILE"
235
- exit $EXIT_CODE
236
- fi
237
- else
238
- eval "$CMD" > "$OUTPUT_FILE" 2>&1
239
- EXIT_CODE=$?
240
-
241
- if [[ $EXIT_CODE -eq 0 ]]; then
242
- echo -e "${GREEN}[SubAgent]${NC} Completed successfully"
243
- echo -e "${GREEN}[SubAgent]${NC} Result: ${OUTPUT_FILE}"
244
- else
245
- echo -e "${RED}[SubAgent]${NC} Failed with exit code: ${EXIT_CODE}"
246
- exit $EXIT_CODE
247
- fi
248
- fi
249
- set -e
250
-
251
- # Output summary
252
- echo ""
253
- echo -e "${BLUE}========================================${NC}"
254
- echo -e "${GREEN}SubAgent Execution Summary${NC}"
255
- echo -e "${BLUE}========================================${NC}"
256
- echo -e "Agent Type: ${YELLOW}${AGENT_TYPE}${NC}"
257
- echo -e "Vendor: ${GREEN}${VENDOR}${NC}"
258
- echo -e "Workspace: ${WORKSPACE}"
259
- echo -e "Result: ${OUTPUT_FILE}"
260
- echo -e "${BLUE}========================================${NC}"
261
-
262
- # Return the output file path
263
- echo "$OUTPUT_FILE"