#!/bin/bash # Systematically fix ctx.* references in all route files cd /root/.openclaw/agents/main/workspace/dashcaddy-work/dashcaddy-api # Find all route files with ctx errors echo "Finding routes with ctx errors..." for file in $(find routes -name "*.js" -type f | grep -v index.js | grep -v helpers.js); do errors=$(npx eslint "$file" 2>&1 | grep -c "'ctx' is not defined") if [ "$errors" -gt 0 ]; then echo "$errors errors in $file" fi done | sort -rn