refactor: extract WebSocket setup and legacy handlers from server.js #451
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Fetch npm stats | |
| id: npm-stats | |
| run: | | |
| PKG_NAME=$(jq -r '.name' package.json) | |
| echo "Fetching weekly downloads for $PKG_NAME..." | |
| # Try to fetch stats; if curl fails, use fallback | |
| RESPONSE=$(curl -s "https://api.npmjs.org/downloads/point/last-week/$PKG_NAME" 2>/dev/null || echo '{"downloads":null}') | |
| DOWNLOADS=$(echo "$RESPONSE" | jq -r '.downloads // 0') | |
| # Create stats.json file in docs folder | |
| mkdir -p docs | |
| echo "{\"downloads\":$DOWNLOADS,\"lastUpdated\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\"}" > docs/stats.json | |
| # Create index.html so Pages root doesn't 404 | |
| cat > docs/index.html << 'EOF' | |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>AgentGUI</title> | |
| <style> | |
| body { font-family: system-ui, sans-serif; max-width: 600px; margin: 80px auto; padding: 0 20px; } | |
| a { color: #0366d6; } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>AgentGUI</h1> | |
| <p>Multi-agent GUI client for AI coding agents.</p> | |
| <ul> | |
| <li><a href="https://github.com/AnEntrypoint/agentgui">GitHub Repository</a></li> | |
| <li><a href="https://www.npmjs.com/package/agentgui">npm Package</a></li> | |
| <li><a href="stats.json">npm Download Stats (JSON)</a></li> | |
| </ul> | |
| </body> | |
| </html> | |
| EOF | |
| # Disable Jekyll processing | |
| touch docs/.nojekyll | |
| echo "downloads=$DOWNLOADS" >> $GITHUB_OUTPUT | |
| echo "Weekly downloads: $DOWNLOADS" | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './docs' | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |