-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_all_integrations.sh
More file actions
executable file
·165 lines (141 loc) · 4.47 KB
/
test_all_integrations.sh
File metadata and controls
executable file
·165 lines (141 loc) · 4.47 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
#!/bin/bash
# Comprehensive test script for all 4 integrations
set -e
echo "======================================"
echo "Testing All 4 Cortex Code Integrations"
echo "======================================"
echo ""
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Test counter
PASSED=0
FAILED=0
# Helper function
test_result() {
if [ $? -eq 0 ]; then
echo -e "${GREEN}✓ PASSED${NC}: $1"
((PASSED++))
else
echo -e "${RED}✗ FAILED${NC}: $1"
((FAILED++))
fi
}
echo "1. Testing Claude Code Integration"
echo "-----------------------------------"
if [ -d ~/.claude/skills/cortex-code ]; then
echo -e "${GREEN}✓ Directory exists${NC}"
# Check parameterization
if grep -q "cursor\|codex" ~/.claude/skills/cortex-code/scripts/route_request.py; then
echo -e "${RED}✗ Wrong parameterization - found wrong agent name${NC}"
((FAILED++))
else
echo -e "${GREEN}✓ Parameterization correct${NC}"
((PASSED++))
fi
# Check files
[ -f ~/.claude/skills/cortex-code/skill.md ]
test_result "skill.md exists"
[ -f ~/.claude/skills/cortex-code/scripts/route_request.py ]
test_result "route_request.py exists"
# Test routing
cd ~/.claude/skills/cortex-code/scripts
python3 route_request.py --prompt "Show Snowflake databases" > /tmp/claude_test.json 2>&1
if grep -q "cortex" /tmp/claude_test.json; then
echo -e "${GREEN}✓ Routing works${NC}"
((PASSED++))
else
echo -e "${RED}✗ Routing failed${NC}"
((FAILED++))
fi
else
echo -e "${RED}✗ Claude Code not installed${NC}"
((FAILED++))
fi
echo ""
echo "2. Testing Cursor Integration"
echo "------------------------------"
if [ -d ~/.cursor/skills/cortex-code ]; then
echo -e "${GREEN}✓ Directory exists${NC}"
# Check parameterization
if grep -q "claude\|codex" ~/.cursor/skills/cortex-code/scripts/route_request.py; then
echo -e "${RED}✗ Wrong parameterization - found wrong agent name${NC}"
((FAILED++))
else
echo -e "${GREEN}✓ Parameterization correct${NC}"
((PASSED++))
fi
# Check files
[ -f ~/.cursor/skills/cortex-code/SKILL.md ]
test_result "SKILL.md exists"
[ -f ~/.cursor/skills/cortex-code/.cursorrules.template ]
test_result ".cursorrules.template exists"
# Test routing
cd ~/.cursor/skills/cortex-code/scripts
python3 route_request.py --prompt "List warehouses" > /tmp/cursor_test.json 2>&1
if grep -q "cortex" /tmp/cursor_test.json; then
echo -e "${GREEN}✓ Routing works${NC}"
((PASSED++))
else
echo -e "${RED}✗ Routing failed${NC}"
((FAILED++))
fi
else
echo -e "${RED}✗ Cursor not installed${NC}"
((FAILED++))
fi
echo ""
echo "3. Testing Codex Integration"
echo "----------------------------"
if command -v cortexcode-tool &> /dev/null; then
echo -e "${GREEN}✓ cortexcode-tool exists${NC}"
cortexcode-tool --version &> /tmp/codex_tool_version.txt
test_result "cortexcode-tool --version runs"
[ -f ~/.local/lib/cortexcode-tool/config.yaml ]
test_result "Codex config exists"
if grep -q 'approval_mode: "prompt"' ~/.local/lib/cortexcode-tool/config.yaml; then
echo -e "${GREEN}✓ Codex approval mode defaults to prompt${NC}"
((PASSED++))
else
echo -e "${RED}✗ Codex approval mode is not prompt${NC}"
((FAILED++))
fi
else
echo -e "${RED}✗ cortexcode-tool not installed for Codex${NC}"
((FAILED++))
fi
echo ""
echo "4. Testing CLI Tool"
echo "-------------------"
if [ -f ~/.local/bin/cortexcode-tool ]; then
echo -e "${GREEN}✓ CLI tool exists${NC}"
# Check executable
[ -x ~/.local/bin/cortexcode-tool ]
test_result "CLI tool is executable"
# Test execution (if implemented)
if ~/.local/bin/cortexcode-tool --version &> /dev/null; then
echo -e "${GREEN}✓ CLI tool runs${NC}"
((PASSED++))
else
echo -e "${YELLOW}⚠ CLI tool exists but --version not implemented${NC}"
fi
else
echo -e "${RED}✗ CLI tool not installed${NC}"
((FAILED++))
fi
echo ""
echo "======================================"
echo "Test Summary"
echo "======================================"
echo -e "${GREEN}Passed: $PASSED${NC}"
echo -e "${RED}Failed: $FAILED${NC}"
echo ""
if [ $FAILED -eq 0 ]; then
echo -e "${GREEN}All tests passed! ✓${NC}"
exit 0
else
echo -e "${RED}Some tests failed!${NC}"
exit 1
fi