From 90431344e8ee4c7a378a3a15cd37fe069d0a0292 Mon Sep 17 00:00:00 2001 From: jedarden Date: Mon, 4 May 2026 03:30:52 -0400 Subject: [PATCH] fix(map-evolver): add missing --once flag parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The --once mode was implemented but the command-line flag was not being parsed. This commit adds the flag parsing and help text for --once, which enables the weekly automated map evolution run from the evolver. The evolver's weekly ticker (run.go) calls acb-map-evolver --once to trigger map evolution on Sundays at 03:00 UTC as specified in plan ยง14.6. --- cmd/acb-map-evolver/main.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cmd/acb-map-evolver/main.go b/cmd/acb-map-evolver/main.go index ad093fd..ff12a6d 100644 --- a/cmd/acb-map-evolver/main.go +++ b/cmd/acb-map-evolver/main.go @@ -28,6 +28,7 @@ type Config struct { ValidateSmoke bool MinSeedCount int EvolutionPeriod time.Duration + Once bool } // Map represents a game map. @@ -92,6 +93,26 @@ func main() { } seedCancel() + if cfg.Once { + // One-shot mode: run evolution once for all player counts and exit + log.Printf("map-evolver: running one-shot evolution for all player counts") + totalCreated := 0 + for _, pc := range allPlayerCounts { + cfg.PlayerCount = pc + iterCtx, iterCancel := context.WithTimeout(context.Background(), 10*time.Minute) + results, err := evolver.Run(iterCtx) + iterCancel() + if err != nil { + log.Printf("evolution error player_count=%d: %v", pc, err) + continue + } + log.Printf("player_count=%d: %d new maps created", pc, len(results)) + totalCreated += len(results) + } + log.Printf("map-evolver: one-shot evolution complete, %d total maps created", totalCreated) + return + } + log.Printf("map-evolver: entering continuous evolution loop (period=%s)", cfg.EvolutionPeriod) for { @@ -160,6 +181,8 @@ func parseConfig() *Config { cfg.DryRun = true case "--no-smoke": cfg.ValidateSmoke = false + case "--once": + cfg.Once = true case "--help", "-h": fmt.Println("Usage: acb-map-evolver [options]") fmt.Println("") @@ -171,6 +194,7 @@ func parseConfig() *Config { fmt.Println(" --evolution-period D Sleep duration between evolution cycles [default: 30m]") fmt.Println(" --dry-run Generate maps but don't save to database") fmt.Println(" --no-smoke Skip smoke-test validation") + fmt.Println(" --once Run evolution once for all player counts and exit") fmt.Println(" --help Show this help") return nil }