summaryrefslogtreecommitdiff
path: root/internal/hexaicli/run.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-13 22:22:38 +0200
committerPaul Buetow <paul@buetow.org>2026-03-13 22:22:38 +0200
commit8ae4be9684a58d44985e5b5ee5e90f74555b2dde (patch)
tree06029d949bdd549c835855d4b158e3234e277094 /internal/hexaicli/run.go
parent4d0f11822c1cdf4c51028bde8881756941314821 (diff)
release: v0.22.0v0.22.0
Diffstat (limited to 'internal/hexaicli/run.go')
-rw-r--r--internal/hexaicli/run.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/hexaicli/run.go b/internal/hexaicli/run.go
index 06ae08a..bc0341d 100644
--- a/internal/hexaicli/run.go
+++ b/internal/hexaicli/run.go
@@ -115,6 +115,18 @@ func canonicalProvider(name string) string {
// Run executes the Hexai CLI behavior given arguments and I/O streams.
// It assumes flags have already been parsed by the caller.
func Run(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) error {
+ if spec, ok, err := tpsSimulationFromContext(ctx); err != nil {
+ _, _ = fmt.Fprintln(stderr, logging.AnsiBase+err.Error()+logging.AnsiReset)
+ return err
+ } else if ok {
+ input, inputErr := readSimulationInput(stdin, args)
+ if inputErr != nil {
+ _, _ = fmt.Fprintln(stderr, logging.AnsiBase+inputErr.Error()+logging.AnsiReset)
+ return inputErr
+ }
+ return runTPSSimulation(ctx, spec, input, stdout)
+ }
+
// Load configuration with a logger so file-based config is respected.
logger := log.New(stderr, "hexai ", log.LstdFlags|log.Lmsgprefix)
configPath := configPathFromContext(ctx)