@@ -19,6 +19,8 @@ import { scoreGrid, scoreVisibleCards } from '../GolfScoring';
1919import { AiPlayer , GreedyStrategy , RandomStrategy } from '../AiStrategy' ;
2020import type { AiStrategy } from '../AiStrategy' ;
2121import { TranscriptRecorder } from '../GameTranscript' ;
22+ import type { GameTranscript } from '../GameTranscript' ;
23+ import { TranscriptStore } from '../../../src/core-engine/TranscriptStore' ;
2224import { HelpPanel , HelpButton } from '../../../src/ui' ;
2325import type { HelpSection } from '../../../src/ui' ;
2426import helpContent from '../help-content.json' ;
@@ -59,6 +61,9 @@ type TurnPhase =
5961
6062// ── Scene ───────────────────────────────────────────────────
6163
64+ /** Shared TranscriptStore instance for the Golf game. */
65+ const transcriptStore = new TranscriptStore ( ) ;
66+
6267export class GolfScene extends Phaser . Scene {
6368 // Game state
6469 private session ! : GolfSession ;
@@ -674,6 +679,29 @@ export class GolfScene extends Phaser.Scene {
674679 this . helpButton ?. destroy ( ) ;
675680 }
676681
682+ // ── Transcript persistence ──────────────────────────────
683+
684+ /**
685+ * Auto-save a finalized transcript to browser storage.
686+ * Fires and forgets -- errors are logged but do not disrupt gameplay.
687+ */
688+ private autoSaveTranscript ( transcript : GameTranscript ) : void {
689+ transcriptStore . save ( 'golf' , transcript ) . then (
690+ ( stored ) => {
691+ if ( stored ) {
692+ console . info (
693+ `[GolfScene] Transcript saved (${ stored . id } ) via ${ stored . gameType } ` ,
694+ ) ;
695+ } else {
696+ console . warn ( '[GolfScene] Transcript not saved -- no storage backend available' ) ;
697+ }
698+ } ,
699+ ( err ) => {
700+ console . error ( '[GolfScene] Failed to auto-save transcript:' , err ) ;
701+ } ,
702+ ) ;
703+ }
704+
677705 // ── End screen ──────────────────────────────────────────
678706
679707 private showEndScreen ( ) : void {
@@ -691,6 +719,9 @@ export class GolfScene extends Phaser.Scene {
691719 const transcript = this . recorder . finalize ( ) ;
692720 const results = transcript . results ! ;
693721
722+ // Auto-save transcript to browser storage
723+ this . autoSaveTranscript ( transcript ) ;
724+
694725 // Overlay
695726 // Full-screen input blocker to prevent clicks reaching objects behind
696727 const blocker = this . add . rectangle (
0 commit comments