feat: add holographic metrics dashboard panel in 3D world (#6)

Create a floating 3D panel in the scene (js/metrics.js) that pulls
live Gitea stats — issues closed, PRs merged, success rate — via the
Gitea REST API. The panel renders via CanvasTexture onto a Three.js
PlaneGeometry, floats gently in world-space, and refreshes every 60 s.

Config exposed via URL params (?gitea=, ?gtoken=, ?grepo=) and Vite
env vars (VITE_GITEA_URL / VITE_GITEA_TOKEN / VITE_GITEA_REPO).

Fixes #6

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alexander Whitestone
2026-03-23 14:06:07 -04:00
parent 840270fe4b
commit a4400093c2
3 changed files with 307 additions and 3 deletions

View File

@@ -5,11 +5,17 @@
* ?ws=ws://tower:8080/ws/world-state — WebSocket endpoint
* ?token=my-secret — Auth token (Phase 1 shared secret)
* ?mock=true — Force mock mode (no real WS)
* ?gitea=http://host:3000/api/v1 — Gitea API base URL (metrics panel)
* ?gtoken=my-gitea-token — Gitea API token (metrics panel)
* ?grepo=owner/repo — Gitea repo slug (metrics panel)
*
* Or via Vite env vars:
* VITE_WS_URL — WebSocket endpoint
* VITE_WS_TOKEN — Auth token
* VITE_MOCK_MODE — 'true' to force mock mode
* VITE_WS_URL — WebSocket endpoint
* VITE_WS_TOKEN — Auth token
* VITE_MOCK_MODE — 'true' to force mock mode
* VITE_GITEA_URL — Gitea API base URL (metrics panel)
* VITE_GITEA_TOKEN — Gitea API token (metrics panel)
* VITE_GITEA_REPO — Gitea repo slug e.g. owner/repo (metrics panel)
*
* Priority: URL params > env vars > defaults.
*
@@ -35,6 +41,15 @@ export const Config = Object.freeze({
/** Force mock mode even if wsUrl is set. Useful for local dev. */
mockMode: param('mock', 'VITE_MOCK_MODE', 'false') === 'true',
/** Gitea API base URL for the metrics dashboard panel (Issue #6). */
giteaUrl: param('gitea', 'VITE_GITEA_URL', ''),
/** Gitea API token for authenticated requests to the metrics API. */
giteaToken: param('gtoken', 'VITE_GITEA_TOKEN', ''),
/** Gitea repository slug, e.g. "owner/repo", for metric queries. */
giteaRepo: param('grepo', 'VITE_GITEA_REPO', ''),
/** Reconnection timing */
reconnectBaseMs: 2000,
reconnectMaxMs: 30000,