blob: 34ed5fa26dede59d3babd4f61bef7a753f81a615 (
plain)
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
|
#!/bin/bash
# Hook script for production safety checks
# Used in Stop hooks to provide reminders and warnings
# Check environment
env_mode="${NODE_ENV:-development}"
debug_mode="${DEBUG:-false}"
chain_id="${EVMAUTH_CHAIN_ID:-not_set}"
# Production safety checks
if [ "$env_mode" = "production" ]; then
echo "đ¨ PRODUCTION ENVIRONMENT DETECTED"
# Check debug mode
if [ "$debug_mode" = "true" ]; then
echo "â CRITICAL: Debug mode is enabled in production!"
echo " Set DEBUG=false immediately"
fi
# Verify mainnet configuration
if [ "$chain_id" = "1223953" ]; then
echo "â ī¸ Using Radius Testnet in production environment"
echo " Switch to mainnet configuration if deploying to production"
fi
# Check for .env file
if [ -f ".env" ] && [ ! -f ".env.production" ]; then
echo "â ī¸ Using .env file - ensure production values are set"
fi
else
# Development environment reminders
echo "âšī¸ Environment: $env_mode"
if [ "$debug_mode" = "true" ]; then
echo "đ Debug mode enabled (OK for development)"
fi
if [ "$chain_id" = "1223953" ]; then
echo "đ Using Radius Testnet (Chain ID: 1223953)"
fi
fi
# Check for uncommitted changes
if command -v git &> /dev/null; then
if [ -d ".git" ]; then
uncommitted=$(git status --porcelain 2>/dev/null | wc -l)
if [ "$uncommitted" -gt 0 ]; then
echo "đ You have $uncommitted uncommitted change(s)"
# Check for changes to sensitive files
if git status --porcelain 2>/dev/null | grep -qE '\.env|private|secret|key'; then
echo "â ī¸ Sensitive files may have been modified - review before committing"
fi
fi
fi
fi
# Token configuration summary
if [ "$EVMAUTH_CONTRACT_ADDRESS" ]; then
echo "đ Token Gate Active:"
echo " Contract: ${EVMAUTH_CONTRACT_ADDRESS:0:10}...${EVMAUTH_CONTRACT_ADDRESS: -8}"
echo " Token ID: ${EVMAUTH_TOKEN_ID:-1}"
fi
# Server status check
if lsof -i :3000 &>/dev/null; then
echo "â
MCP Server running on port 3000"
elif lsof -i :${PORT:-3000} &>/dev/null; then
echo "â
MCP Server running on port ${PORT}"
fi
# Final reminders based on recent activity
if [ -f "$HOME/.claude/logs/token-gate-$(date +%Y%m%d).log" ]; then
recent_fastmcp=$(grep -c "FastMCP" "$HOME/.claude/logs/token-gate-$(date +%Y%m%d).log" 2>/dev/null || echo 0)
recent_ngrok=$(grep -c "ngrok" "$HOME/.claude/logs/token-gate-$(date +%Y%m%d).log" 2>/dev/null || echo 0)
if [ "$recent_fastmcp" -gt 0 ] || [ "$recent_ngrok" -gt 0 ]; then
echo "đ Today's activity: $recent_fastmcp FastMCP commands, $recent_ngrok ngrok sessions"
fi
fi
# Success message if everything looks good
all_good=true
[ "$env_mode" = "production" ] && [ "$debug_mode" = "true" ] && all_good=false
[ "$uncommitted" -gt 0 ] && all_good=false
if [ "$all_good" = true ] && [ "$env_mode" != "production" ]; then
echo "⨠Development environment properly configured!"
fi
exit 0
|