@@ -517,6 +517,34 @@ def latest(
517
517
print (format_run (run , verbose = verbose , include_logs = logs , server_url = server_config .url ))
518
518
519
519
520
+ @cli .command (help = "Export all run information for the active agent" )
521
+ @pretty_cli
522
+ def export (
523
+ directory : t .Annotated [
524
+ pathlib .Path ,
525
+ typer .Option ("--dir" , "-d" , help = "The export directory" , file_okay = False , resolve_path = True ),
526
+ ] = pathlib .Path ("export" ),
527
+ strike : t .Annotated [str | None , typer .Option ("--strike" , "-s" , help = "Export runs for a specific strike" )] = None ,
528
+ group : t .Annotated [str | None , typer .Option ("--group" , "-g" , help = "Export runs from a specific group" )] = None ,
529
+ ) -> None :
530
+ agent_config = AgentConfig .read ()
531
+ ensure_profile (agent_config )
532
+
533
+ client = api .create_client ()
534
+ run_summaries = client .list_strike_runs (
535
+ strike = strike or agent_config .strike , group = group , agent = agent_config .active_link .id
536
+ )
537
+
538
+ print (f":package: Exporting { len (run_summaries )} runs to [b]{ directory } [/] ..." )
539
+
540
+ directory .mkdir (exist_ok = True )
541
+ for summary in run_summaries :
542
+ print (f" |- { summary .key } ({ summary .id } ) ..." )
543
+ run = client .get_strike_run (summary .id )
544
+ with (directory / f"{ run .key } _{ run .id } .json" ).open ("w" ) as f :
545
+ f .write (run .model_dump_json ())
546
+
547
+
520
548
@cli .command (help = "Show the status of the active agent" )
521
549
@pretty_cli
522
550
def show (
0 commit comments