feat: implement and deploy blind_chess MVP

- pnpm workspace: shared/server/client packages
- Server: Fastify+ws, chess.js, FSM (touch-move + hierarchy),
  per-player view filter, zod validation, rate limiting, grace-window
  disconnect handling
- Client: Svelte 5 + Vite, click-to-move board, moderator panel,
  promotion/draw dialogs
- Shared: protocol types, ModeratorText enum, geometricMoves helper
  (provably zero opponent-info leak)
- 43 tests pass (21 shared, 22 server incl. 4 real-WS integration)
- Deploy: CT 690 on node-241 (192.168.0.245), systemd-managed,
  Caddy block for chess.sethpc.xyz
- Live at https://chess.sethpc.xyz

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
claude (blind_chess)
2026-04-28 11:20:18 -04:00
parent 9a5ad55f30
commit a6de43edc1
53 changed files with 11970 additions and 5 deletions
@@ -0,0 +1,79 @@
<script lang="ts">
import type { Announcement, Color } from '@blind-chess/shared';
import { moderatorText } from './moderator-strings.js';
interface Props {
announcements: Announcement[];
you: Color;
}
let { announcements, you }: Props = $props();
// Show only entries this viewer is allowed to see.
const visible = $derived(
announcements.filter((a) => a.audience === 'both' || a.audience === you),
);
let scrollEl: HTMLDivElement | null = $state(null);
$effect(() => {
void visible.length;
if (scrollEl) scrollEl.scrollTop = scrollEl.scrollHeight;
});
</script>
<div class="panel">
<header>Moderator</header>
<div class="log" bind:this={scrollEl}>
{#each visible as a, i (i)}
<div class="entry" class:err={a.text === 'illegal_move' || a.text === 'no_such_piece' || a.text === 'no_legal_moves' || a.text === 'wont_help'}>
<span class="ply">{a.ply > 0 ? `#${a.ply}` : ''}</span>
<span class="text">{moderatorText(a.text, a.payload)}</span>
</div>
{:else}
<div class="empty muted">The moderator is silent.</div>
{/each}
</div>
</div>
<style>
.panel {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
display: flex;
flex-direction: column;
height: 100%;
min-height: 200px;
}
header {
padding: 10px 14px;
font-size: 13px;
font-weight: 600;
color: var(--text-dim);
text-transform: uppercase;
letter-spacing: 0.08em;
border-bottom: 1px solid var(--border);
}
.log {
padding: 8px 14px;
flex: 1;
overflow-y: auto;
font-size: 14px;
line-height: 1.5;
}
.entry {
padding: 4px 0;
display: flex;
gap: 8px;
border-bottom: 1px dashed rgba(255,255,255,0.05);
}
.entry:last-child { border-bottom: none; }
.entry.err .text { color: #f87171; }
.ply {
color: var(--text-dim);
font-family: ui-monospace, monospace;
font-size: 12px;
flex-shrink: 0;
width: 32px;
}
.empty { padding: 6px 0; font-style: italic; }
</style>