-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.sh
More file actions
executable file
·205 lines (158 loc) · 7.54 KB
/
Copy pathdemo.sh
File metadata and controls
executable file
·205 lines (158 loc) · 7.54 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
#!/bin/bash
# AgentForge Demo
# Showcases the Recipe system, agent discovery, and prompt building
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
MAGENTA='\033[0;35m'
NC='\033[0m'
echo ""
echo -e "${GREEN}╔════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ AgentForge v2.0 Demo ║${NC}"
echo -e "${GREEN}╚════════════════════════════════════════╝${NC}"
echo ""
# ============================================================================
# Demo 1: List Available Recipes
# ============================================================================
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}📚 Demo 1: Available Recipes${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
source core/recipe-loader.sh 2>/dev/null
recipes=$(load_all_recipes "recipes/official" 2>/dev/null)
recipe_count=$(echo "$recipes" | jq 'length')
echo -e "${YELLOW}Found $recipe_count official Recipes:${NC}"
echo ""
echo "$recipes" | jq -r '.[] | " 📋 " + .name + " (v" + .version + ")\n Category: " + .category + "\n Keywords: " + (.triggers.keywords[0:3] | join(", ")) + "\n"'
echo ""
read -p "Press Enter to continue..."
echo ""
# ============================================================================
# Demo 2: Recipe Matching
# ============================================================================
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}🎯 Demo 2: Recipe Matching${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
source core/recipe-matcher.sh 2>/dev/null
test_tasks=(
"Build a REST API with authentication"
"Deploy my app to Kubernetes with CI/CD"
"Create an iOS app with SwiftUI"
"Build a React dashboard with charts"
)
for task in "${test_tasks[@]}"; do
echo -e "${YELLOW}Task:${NC} \"$task\""
matched=$(match_recipe_for_task "$task" "$recipes" 2>/dev/null)
recipe_name=$(echo "$matched" | jq -r '.name // "General Workflow"')
confidence=$(echo "$matched" | jq -r '.confidence // 0')
echo -e "${GREEN} ✓ Matched:${NC} $recipe_name (confidence: $confidence)"
echo ""
done
echo ""
read -p "Press Enter to continue..."
echo ""
# ============================================================================
# Demo 3: Agent Discovery
# ============================================================================
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}🔍 Demo 3: Agent Discovery (4-Tier)${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
source core/agent-finder.sh 2>/dev/null
test_searches=(
"backend"
"react"
"kubernetes"
"mobile"
)
echo -e "${YELLOW}Searching official agents...${NC}"
echo ""
for search_term in "${test_searches[@]}"; do
echo -e "${CYAN}Search:${NC} \"$search_term\""
results=$(search_official_agents "$search_term" 2>/dev/null)
count=$(echo "$results" | jq 'length')
if [[ "$count" -gt 0 ]]; then
echo "$results" | jq -r '.[] | " 🤖 " + .name + " - " + .description'
else
echo -e " ${YELLOW}No exact matches, would search GitHub/Community${NC}"
fi
echo ""
done
echo ""
read -p "Press Enter to continue..."
echo ""
# ============================================================================
# Demo 4: Prompt Building
# ============================================================================
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}📝 Demo 4: Enhanced Prompt Generation${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
source core/prompt-builder.sh 2>/dev/null
task="Build a REST API for user management with JWT authentication"
matched_recipe=$(match_recipe_for_task "$task" "$recipes" 2>/dev/null)
recipe_name=$(echo "$matched_recipe" | jq -r '.name')
echo -e "${YELLOW}Task:${NC} \"$task\""
echo -e "${GREEN}Matched Recipe:${NC} $recipe_name"
echo ""
agents='[{"name":"backend-developer","priority":1},{"name":"security-auditor","priority":2}]'
prompt=$(build_prompt "$task" "$matched_recipe" "$agents" "en" 2>/dev/null)
echo -e "${YELLOW}Generated Prompt Preview (first 500 chars):${NC}"
echo -e "${BLUE}─────────────────────────────────────────${NC}"
echo "$prompt" | head -c 500
echo "..."
echo -e "${BLUE}─────────────────────────────────────────${NC}"
echo ""
prompt_length=$(echo "$prompt" | wc -c | tr -d ' ')
echo -e "${CYAN}Full prompt length: $prompt_length characters${NC}"
echo ""
echo ""
read -p "Press Enter to continue..."
echo ""
# ============================================================================
# Demo 5: Recipe Statistics
# ============================================================================
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE}📊 Demo 5: Recipe Collection Statistics${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
source core/optimizer.sh 2>/dev/null
stats=$(get_recipe_stats "recipes" 2>/dev/null)
echo "$stats" | jq -r '
"Total Recipes: " + (.total_recipes | tostring) + "\n" +
"\nBy Category:" +
(
.by_category | to_entries | map(
"\n • " + .key + ": " + (.value | tostring)
) | join("")
) +
"\n\nTotal Usage: " + (.total_usage | tostring) + " executions"
'
echo ""
# ============================================================================
# Demo Complete
# ============================================================================
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}✨ Demo Complete!${NC}"
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo -e "${CYAN}Key Features Demonstrated:${NC}"
echo -e " ✅ Recipe YAML loading and parsing"
echo -e " ✅ Intelligent task-to-Recipe matching"
echo -e " ✅ 4-tier agent discovery system"
echo -e " ✅ Enhanced prompt generation with Recipe context"
echo -e " ✅ Recipe collection statistics"
echo ""
echo -e "${YELLOW}Try it yourself:${NC}"
echo -e " ${BLUE}./bin/agentforge \"Build a mobile app with Flutter\"${NC}"
echo ""
echo -e "${CYAN}Documentation:${NC} README.md"
echo -e "${CYAN}Recipes:${NC} recipes/official/"
echo -e "${CYAN}Tests:${NC} bash tests/integration-test.sh"
echo ""