--- name: tidy-cre description: Monitor, probe, and manage the TIDY-CRE local gateway service. Use when working with the TIDY-CRE service running on localhost port 18789 for checking status, probing WebSocket endpoints, fetching dashboard info, or diagnosing connectivity issues. Triggers on requests to check TIDY-CRE status, probe the WebSocket, access the dashboard, or troubleshoot the service. --- # TIDY-CRE Service Manager ## Overview TIDY-CRE is a local loopback-only gateway service that provides WebSocket and HTTP endpoints on port 18789. It is accessible only from local clients (127.0.0.1) and provides both a WebSocket probe interface and an HTTP dashboard. **Default endpoints:** - WebSocket: `ws://127.0.0.1:18789` - Dashboard: `http://127.0.0.1:18789/` ## Quick Start ### Check Service Status Use the status script to verify both HTTP and WebSocket endpoints: ```bash ./scripts/check_status.sh ``` With custom host/port: ```bash ./scripts/check_status.sh 127.0.0.1 18789 10 ``` ### Probe WebSocket Endpoint Use the Python probe script for detailed WebSocket connection info: ```bash python3 ./scripts/probe_ws.py ``` With custom parameters: ```bash python3 ./scripts/probe_ws.py 127.0.0.1 18789 5.0 ``` ### Fetch Dashboard Info Retrieve and display dashboard metadata: ```bash python3 ./scripts/fetch_dashboard.py ``` ## Available Scripts ### scripts/check_status.sh Bash script that checks both HTTP and WebSocket connectivity. **Parameters:** 1. `host` (default: 127.0.0.1) - Host to check 2. `port` (default: 18789) - Port to check 3. `timeout` (default: 5) - Timeout in seconds **Exit codes:** - `0` - Service fully up (both HTTP and WebSocket) - `1` - Service down or partially responding **Dependencies:** - `curl` for HTTP checks - `websocat` (preferred) or `nc` for WebSocket checks ### scripts/probe_ws.py Python script for detailed WebSocket probing. **Parameters:** 1. `host` (default: 127.0.0.1) - WebSocket host 2. `port` (default: 18789) - WebSocket port 3. `timeout` (default: 5.0) - Connection timeout in seconds **Exit codes:** - `0` - WebSocket connection successful - `1` - Connection failed **Dependencies:** - Python 3 - `websockets` package (`pip install websockets`) ### scripts/fetch_dashboard.py Python script to fetch dashboard information. **Parameters:** 1. `host` (default: 127.0.0.1) - Dashboard host 2. `port` (default: 18789) - Dashboard port 3. `timeout` (default: 5.0) - Request timeout in seconds **Exit codes:** - `0` - Dashboard fetch successful - `1` - Fetch failed **Output:** - HTTP status code - Content-Type header - Content length - Page title (if extractable) ## Troubleshooting ### Service Not Responding 1. Check if the service is running: ```bash ./scripts/check_status.sh ``` 2. Verify the service is bound to the expected address: ```bash netstat -tlnp | grep 18789 # or ss -tlnp | grep 18789 ``` 3. The service is loopback-only - ensure you're connecting from localhost, not remote hosts. ### WebSocket Connection Fails 1. Check if `websocat` or `nc` is installed 2. Verify the WebSocket URL format: `ws://127.0.0.1:18789` 3. Check firewall rules (though loopback should not be affected) ### Script Dependencies Install missing Python packages: ```bash pip install websockets ``` Install websocat (optional, preferred for WebSocket testing): ```bash # macOS brew install websocat # Ubuntu/Debian sudo apt-get install websocat # Or download binary from: # https://github.com/vi/websocat/releases ```