This repository was archived by the owner on Mar 23, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest-plugin-system.sh
More file actions
executable file
·159 lines (133 loc) · 4.02 KB
/
test-plugin-system.sh
File metadata and controls
executable file
·159 lines (133 loc) · 4.02 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
#!/bin/bash
# Plugin System Validation Test
echo "=================================="
echo "Plugin System Validation Test"
echo "=================================="
echo ""
echo "1. Checking file structure..."
echo ""
FILES=(
"lib/ToolRegistry.js"
"lib/PluginLoader.js"
"plugins/README.md"
"plugins/QUICK_START.md"
"plugins/plugin.json.template"
"plugins/example-plugin/plugin.json"
"plugins/example-plugin/index.js"
"PLUGIN_SYSTEM.md"
"PLUGIN_IMPLEMENTATION_SUMMARY.md"
"PLUGIN_ARCHITECTURE.md"
)
for file in "${FILES[@]}"; do
if [ -f "$file" ]; then
echo "✅ $file"
else
echo "❌ $file (MISSING)"
fi
done
echo ""
echo "2. Checking agent.js modifications..."
echo ""
if grep -q "ToolRegistry" agent.js; then
echo "✅ ToolRegistry import found"
else
echo "❌ ToolRegistry import missing"
fi
if grep -q "PluginLoader" agent.js; then
echo "✅ PluginLoader import found"
else
echo "❌ PluginLoader import missing"
fi
if grep -q "registerCoreTools" agent.js; then
echo "✅ registerCoreTools function found"
else
echo "❌ registerCoreTools function missing"
fi
if grep -q "toolRegistry.getTools()" agent.js; then
echo "✅ toolRegistry.getTools() usage found"
else
echo "❌ toolRegistry.getTools() usage missing"
fi
if grep -q "toolRegistry.getHandler" agent.js; then
echo "✅ toolRegistry.getHandler() usage found"
else
echo "❌ toolRegistry.getHandler() usage missing"
fi
echo ""
echo "3. Validating example plugin..."
echo ""
if [ -f "plugins/example-plugin/plugin.json" ]; then
echo "✅ plugin.json exists"
# Check required fields
if grep -q '"name"' plugins/example-plugin/plugin.json; then
echo "✅ Has 'name' field"
fi
if grep -q '"version"' plugins/example-plugin/plugin.json; then
echo "✅ Has 'version' field"
fi
if grep -q '"author"' plugins/example-plugin/plugin.json; then
echo "✅ Has 'author' field"
fi
if grep -q '"tools"' plugins/example-plugin/plugin.json; then
echo "✅ Has 'tools' field"
fi
else
echo "❌ plugin.json missing"
fi
if [ -f "plugins/example-plugin/index.js" ]; then
echo "✅ index.js exists"
if grep -q "export async function init" plugins/example-plugin/index.js; then
echo "✅ Has init() export"
fi
if grep -q "toolRegistry.register" plugins/example-plugin/index.js; then
echo "✅ Calls toolRegistry.register()"
fi
else
echo "❌ index.js missing"
fi
echo ""
echo "4. Testing agent startup..."
echo ""
# Try to start agent for 3 seconds and capture output
AGENT_OUTPUT=$(timeout 3 node agent.js 2>&1 || true)
if echo "$AGENT_OUTPUT" | grep -q "Registering core tools"; then
echo "✅ Core tools registration works"
else
echo "❌ Core tools registration failed"
fi
if echo "$AGENT_OUTPUT" | grep -q "Scanning plugins directory"; then
echo "✅ Plugin scanning works"
else
echo "❌ Plugin scanning failed"
fi
if echo "$AGENT_OUTPUT" | grep -q "Loading plugin: example-plugin"; then
echo "✅ Example plugin loads"
else
echo "❌ Example plugin failed to load"
fi
if echo "$AGENT_OUTPUT" | grep -q "base64_encode"; then
echo "✅ Plugin tools registered (base64_encode)"
else
echo "❌ Plugin tools not registered"
fi
if echo "$AGENT_OUTPUT" | grep -q "Tool Registry:"; then
TOOL_COUNT=$(echo "$AGENT_OUTPUT" | grep "Tool Registry:" | grep -oP '\d+' | head -1)
echo "✅ Tool Registry initialized with $TOOL_COUNT tools"
else
echo "❌ Tool Registry not initialized"
fi
if echo "$AGENT_OUTPUT" | grep -q "Successfully loaded 1 plugin"; then
echo "✅ Plugin successfully loaded"
else
echo "❌ Plugin loading incomplete"
fi
echo ""
echo "=================================="
echo "Validation Complete!"
echo "=================================="
echo ""
# Count successes
SUCCESS_COUNT=$(echo "$AGENT_OUTPUT" | grep -c "✅" || echo "0")
echo "Summary: Check the results above"
echo ""
echo "If all items show ✅, the plugin system is working correctly!"