forked from sundial-org/awesome-openclaw-skills
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate-update.sh
More file actions
179 lines (161 loc) · 5.55 KB
/
Copy pathvalidate-update.sh
File metadata and controls
179 lines (161 loc) · 5.55 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
#!/bin/bash
# validate-update.sh - Verify production update was successful
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE} Validating Production Update${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
CHECKS_PASSED=0
CHECKS_FAILED=0
# Check 1: New config example exists
echo -n "Checking new config example... "
if [[ -f "$SCRIPT_DIR/claude-oauth-refresh-config.example.json" ]]; then
if jq -e '.notifications | type == "object"' "$SCRIPT_DIR/claude-oauth-refresh-config.example.json" &> /dev/null; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${RED}✗${NC} Missing notification structure"
((CHECKS_FAILED++))
fi
else
echo -e "${RED}✗${NC} File not found"
((CHECKS_FAILED++))
fi
# Check 2: Old config example removed
echo -n "Checking old config removed... "
if [[ ! -f "$SCRIPT_DIR/config.example.json" ]]; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${YELLOW}⚠${NC} Old file still exists"
# Not a failure, just a warning
fi
# Check 3: refresh-token.sh uses new config
echo -n "Checking refresh-token.sh config... "
if grep -q "claude-oauth-refresh-config.json" "$SCRIPT_DIR/refresh-token.sh"; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${RED}✗${NC} Still uses old config filename"
((CHECKS_FAILED++))
fi
# Check 4: refresh-token.sh has notification types
echo -n "Checking notification types... "
if grep -q "notifications.on_success" "$SCRIPT_DIR/refresh-token.sh" && \
grep -q "notifications.on_failure" "$SCRIPT_DIR/refresh-token.sh"; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${RED}✗${NC} Missing notification type support"
((CHECKS_FAILED++))
fi
# Check 5: refresh-token.sh has error handling
echo -n "Checking error handling... "
if grep -q "error_exit" "$SCRIPT_DIR/refresh-token.sh"; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${RED}✗${NC} Missing error handling"
((CHECKS_FAILED++))
fi
# Check 6: install.sh has interactive prompts
echo -n "Checking interactive prompts... "
if grep -q "Token refreshed" "$SCRIPT_DIR/install.sh" && grep -q "NOTIFY_SUCCESS_INPUT" "$SCRIPT_DIR/install.sh"; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${RED}✗${NC} Missing interactive notification config"
((CHECKS_FAILED++))
fi
# Check 7: install.sh has migration logic
echo -n "Checking migration logic... "
if grep -q "Migrating config.json" "$SCRIPT_DIR/install.sh"; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${RED}✗${NC} Missing migration logic"
((CHECKS_FAILED++))
fi
# Check 8: SKILL.md exists
echo -n "Checking SKILL.md... "
if [[ -f "$SCRIPT_DIR/SKILL.md" ]]; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${RED}✗${NC} SKILL.md not found"
((CHECKS_FAILED++))
fi
# Check 9: README.md exists
echo -n "Checking README.md... "
if [[ -f "$SCRIPT_DIR/README.md" ]]; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${RED}✗${NC} README.md not found"
((CHECKS_FAILED++))
fi
# Check 10: UPGRADE.md exists
echo -n "Checking upgrade guide... "
if [[ -f "$SCRIPT_DIR/UPGRADE.md" ]]; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${YELLOW}⚠${NC} UPGRADE.md not found"
# Not critical
fi
# Check 11: verify-setup.sh checks both configs
echo -n "Checking verify-setup.sh... "
if grep -q "claude-oauth-refresh-config.json" "$SCRIPT_DIR/verify-setup.sh" && \
grep -q "config.json" "$SCRIPT_DIR/verify-setup.sh"; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${RED}✗${NC} Doesn't check both config filenames"
((CHECKS_FAILED++))
fi
# Check 12: All scripts executable
echo -n "Checking script permissions... "
ALL_EXECUTABLE=true
for script in install.sh refresh-token.sh verify-setup.sh uninstall.sh detect-notification-config.sh test-detection.sh; do
if [[ ! -x "$SCRIPT_DIR/$script" ]]; then
ALL_EXECUTABLE=false
break
fi
done
if $ALL_EXECUTABLE; then
echo -e "${GREEN}✓${NC}"
((CHECKS_PASSED++))
else
echo -e "${RED}✗${NC} Some scripts not executable"
((CHECKS_FAILED++))
fi
# Summary
echo ""
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
if [[ $CHECKS_FAILED -eq 0 ]]; then
echo -e "${GREEN}✓ All validation checks passed! ($CHECKS_PASSED/${CHECKS_PASSED})${NC}"
echo ""
echo -e "${GREEN}Production update is complete and ready to use.${NC}"
echo ""
echo "Next steps:"
echo " 1. Review CHANGES.md for complete change summary"
echo " 2. Review UPGRADE.md for migration guide"
echo " 3. Run ./install.sh to install or migrate"
echo ""
exit 0
else
echo -e "${RED}✗ Validation failed: $CHECKS_FAILED check(s) failed${NC}"
echo -e "${GREEN} Passed: $CHECKS_PASSED${NC}"
echo -e "${RED} Failed: $CHECKS_FAILED${NC}"
echo ""
echo "Please review the failed checks above."
exit 1
fi
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"