MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / replay

Function replay

codeclash/cli/replay.py:19–36  ·  view source on GitHub ↗

Serve a tournament folder and lazily watch game replays in the browser. [dim]• codeclash replay logs/ [/dim] [dim]• codeclash replay logs/ -p 9000[/dim]

(
    folder: Path = typer.Argument(..., help="Tournament log folder (contains metadata.json + rounds/)."),
    port: int = typer.Option(8000, "--port", "-p", help="Port to serve on (falls back to a free one if taken)."),
)

Source from the content-addressed store, hash-verified

17
18
19def replay(
20 folder: Path = typer.Argument(..., help="Tournament log folder (contains metadata.json + rounds/)."),
21 port: int = typer.Option(8000, "--port", "-p", help="Port to serve on (falls back to a free one if taken)."),
22):
23 """Serve a tournament folder and lazily watch game replays in the browser.
24
25 [dim]• codeclash replay logs/<tournament-folder>[/dim]
26 [dim]• codeclash replay logs/<folder> -p 9000[/dim]
27 """
28 tour = load_tournament(folder)
29 renderer = get_replayer(tour.arena)
30 if renderer is None:
31 typer.echo(f"No replayer for {tour.arena or 'this arena'} yet.")
32 raise typer.Exit(1)
33 if not tour.games:
34 typer.echo(f"No sim files found under {folder} (looked for {renderer.sim_glob}).")
35 raise typer.Exit(1)
36 run_server(folder, tour, renderer, port=port)

Callers

nothing calls this directly

Calls 3

load_tournamentFunction · 0.90
get_replayerFunction · 0.90
run_serverFunction · 0.90

Tested by

no test coverage detected