1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
//! CLI argument definitions: structs, enums, and subcommands.
use clap::{Parser, Subcommand};
use crate::config::ExecutionMode;
pub(crate) const DEFAULT_MULTI_CHAT_CONCURRENCY: usize = 4;
#[derive(Parser)]
#[command(name = "selfware")]
#[command(about = "Your personal AI workshop — software you own, software that lasts")]
#[command(version)]
pub(crate) struct Cli {
#[command(subcommand)]
pub(crate) command: Option<Commands>,
/// Headless mode: run prompt directly and exit (like qwen -p)
#[arg(short = 'p', long, value_name = "PROMPT")]
pub(crate) prompt: Option<String>,
/// Config file path
#[arg(short, long, value_name = "FILE", global = true)]
pub(crate) config: Option<String>,
/// Working directory
#[arg(short = 'C', long, value_name = "DIR", global = true)]
pub(crate) workdir: Option<String>,
/// Quiet mode (minimal output)
#[arg(short, long, global = true)]
pub(crate) quiet: bool,
/// Execution mode: normal (ask), auto-edit, yolo, daemon
#[arg(short = 'm', long, value_enum, global = true)]
pub(crate) mode: Option<ExecutionMode>,
/// Shortcut for --mode=yolo
#[arg(short = 'y', long, global = true)]
pub(crate) yolo: bool,
/// Shortcut for --mode=daemon (run forever)
#[arg(long)]
pub(crate) daemon: bool,
/// Disable colored output
#[arg(long)]
pub(crate) no_color: bool,
/// Launch full TUI dashboard mode (requires --features tui)
/// This is the default when no subcommand is specified
#[arg(long)]
pub(crate) tui: bool,
/// Use classic CLI mode instead of TUI (overrides default TUI)
#[arg(long)]
pub(crate) no_tui: bool,
/// Color theme: amber (default), ocean, minimal, high-contrast
#[arg(long, value_enum, default_value = "amber")]
pub(crate) theme: Theme,
/// Compact output mode (less visual chrome, more dense)
#[arg(long)]
pub(crate) compact: bool,
/// Verbose mode (detailed tool output and debug info)
#[arg(short = 'v', long, global = true)]
pub(crate) verbose: bool,
/// Always display token usage after each response
#[arg(long)]
pub(crate) show_tokens: bool,
/// Use ASCII-only output (no emoji or extended Unicode)
#[arg(long)]
pub(crate) ascii: bool,
/// Plan mode: agent proposes tool calls without executing them
#[arg(long)]
pub(crate) plan: bool,
/// Resume a named chat session (alias for `selfware chat --resume <name>`)
#[arg(long, value_name = "NAME")]
pub(crate) resume_session: Option<String>,
/// Multi-chat: assign each task to role-matched idle swarm agents by trust.
///
/// Only meaningful with `multi-chat`. The coordinator's assignment gates
/// execution — a task that cannot be assigned makes no LLM calls — but
/// execution itself is the same single-completion-per-agent fan-out as
/// plain multi-chat; there are no separate worker agents and no
/// restricted tool set. Other subcommands ignore this flag (with a note).
#[arg(long, global = true)]
pub(crate) coordinator: bool,
/// Validate the configuration file and exit without running the agent
#[arg(long)]
pub(crate) validate_config: bool,
/// Enable debug-channel output. With no value, enables every channel
/// (requests, responses, gates, turns). Use `--debug=requests,gates`
/// to enable specific ones. Channels: requests, responses, gates, turns, all.
#[arg(
long,
value_name = "CHANNELS",
num_args = 0..=1,
require_equals = true,
default_missing_value = "",
)]
pub(crate) debug: Option<String>,
/// Output format for headless mode: text, json, or stream-json.
/// `global` so it may follow a subcommand too (e.g. `runs list --output-format json`).
#[arg(long, value_enum, default_value = "text", global = true)]
pub(crate) output_format: HeadlessOutputFormat,
/// Maximum number of agent loop iterations (hard limit)
#[arg(long, global = true)]
pub(crate) max_turns: Option<usize>,
/// Maximum total prompt+completion tokens before stopping
#[arg(long, global = true)]
pub(crate) max_budget_tokens: Option<usize>,
/// Maximum wall-clock seconds before stopping
#[arg(long, global = true)]
pub(crate) max_wall_secs: Option<u64>,
/// Maximum provider-reported USD cost before stopping (e.g. OpenRouter usage.cost)
#[arg(long, global = true)]
pub(crate) max_cost_usd: Option<f64>,
/// Configuration profile to apply (e.g. `architect`, `swarm-8`, `batch-16`,
/// `batch-32`, `visual`, `quick`). Overrides `max_tokens` and
/// `temperature` from the profile's built-in defaults.
#[arg(long, value_name = "NAME", global = true)]
pub(crate) profile: Option<String>,
}
/// Color theme for terminal output
#[derive(Debug, Clone, Copy, Default, clap::ValueEnum)]
pub enum Theme {
/// Warm amber tones (default)
#[default]
Amber,
/// Cool ocean blues and teals
Ocean,
/// Clean grayscale minimal
Minimal,
/// High contrast for accessibility
HighContrast,
}
/// Output format for headless (`-p` / `--run`) mode.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, clap::ValueEnum)]
pub(crate) enum HeadlessOutputFormat {
/// Human-readable text (default)
#[default]
Text,
/// Single JSON object emitted at task completion
Json,
/// Line-delimited JSON stream emitted during the run
#[value(name = "stream-json")]
StreamJson,
}
/// Output format for `selfware graph`
#[derive(Debug, Clone, Copy, Default, clap::ValueEnum)]
pub enum GraphFormat {
#[default]
Ascii,
Mermaid,
Dot,
Json,
Plantuml,
}
/// Demo scenario selection for `selfware demo`
#[cfg(feature = "tui")]
#[derive(Debug, Clone, Copy, clap::ValueEnum)]
pub(crate) enum DemoScenarioKind {
Archaeology,
FeatureFactory,
BugHunt,
TokenChallenge,
}
#[derive(Subcommand, Clone, Debug)]
#[allow(clippy::large_enum_variant)]
pub(crate) enum Commands {
/// Interactive setup wizard for first-time configuration
#[command(display_order = 1)]
Init {
/// Use a specific template (rust, python, node, minimal)
#[arg(long)]
template: Option<String>,
/// Ask what to build, then scaffold it into the current directory
#[arg(long)]
scaffold: bool,
},
/// Start an interactive chat session
#[command(alias = "c", display_order = 2)]
Chat,
/// Run a task headless and exit
#[command(alias = "r", display_order = 3)]
Run {
/// The task to run (omit when --preset is given)
#[arg(required_unless_present = "preset")]
task: Option<String>,
/// Inject a user skill's instructions (from ~/.selfware/skills or ./.selfware/skills)
#[arg(long)]
skill: Option<String>,
/// Run an evolve preset by id (its task + invariants become the prompt)
#[arg(long)]
preset: Option<String>,
},
/// Resume a task from a journal entry
#[command(display_order = 4)]
Resume {
/// Journal entry ID
task_id: String,
},
/// Show model, endpoint, and journal status
#[command(display_order = 5)]
Status,
/// Check system dependencies and tool availability
#[command(display_order = 6)]
Doctor,
/// Diagnose the configured LLM backend and model setup
#[command(display_order = 7)]
LlmDoctor,
/// Trust this repository's checkout-local selfware.toml. Trusting ACTIVATES
/// all of its privileged settings, which are otherwise stripped for an
/// untrusted repo: shell hooks, MCP subprocess servers, wildcard
/// tool-permission grants, the post-edit command, yolo / destructive-shell,
/// and safety-path/confirmation overrides — and it allows a globally-exported
/// SELFWARE_API_KEY to be sent to the endpoint the config selects. Only trust
/// repositories whose selfware.toml you have reviewed. Records the config's
/// canonical path in ~/.selfware/trusted_repos.
#[command(display_order = 10)]
Trust {
/// Path to the config to trust (default: ./selfware.toml).
#[arg(default_value = "selfware.toml")]
path: String,
},
/// Test local development workflow
#[command(alias = "t", hide = true)]
Test {
/// Test pattern to run (all, unit, integration, e2e, workflow)
#[arg(short, long, default_value = "workflow")]
pattern: String,
/// Output format (text, pretty, json)
#[arg(short, long, default_value = "text")]
format: String,
},
/// SWE-bench commands
#[command(alias = "swe", hide = true)]
SWEBench {
#[command(subcommand)]
command: SWEBenchCommands,
},
/// Run comprehensive benchmark suite
///
/// With no subcommand, runs the legacy throughput/e2e suite (back-compat
/// with previous releases). Use a subcommand for newer benchmarks.
#[command(alias = "bm", hide = true)]
Bench {
#[command(subcommand)]
command: Option<BenchCommand>,
/// Endpoint URL to benchmark (legacy mode, defaults to config)
#[arg(short, long)]
endpoint: Option<String>,
/// Benchmark suites to run (legacy mode: throughput,e2e,multilang,all)
#[arg(short, long, default_value = "throughput,e2e")]
suite: String,
/// Number of concurrent tasks (legacy mode)
#[arg(short = 'n', long, default_value_t = 4)]
concurrent: usize,
},
/// Run long-running system test (8+ hours)
#[command(alias = "lt", hide = true)]
LongTest {
/// Duration in hours (default: 8)
#[arg(short = 'H', long, default_value_t = 8)]
hours: u64,
/// Timeout per project in seconds (default: 900)
#[arg(short, long, default_value_t = 900)]
timeout: u64,
/// Maximum iterations per project (default: 80)
#[arg(short = 'i', long, default_value_t = 80)]
max_iters: usize,
/// Maximum concurrent projects (default: 1)
#[arg(short = 'n', long, default_value_t = 1)]
concurrent: usize,
/// Endpoint URL (defaults to config)
#[arg(short, long)]
endpoint: Option<String>,
/// Model name (defaults to config)
#[arg(long)]
model: Option<String>,
/// Templates directory
#[arg(long)]
templates: Option<String>,
/// Output directory for results
#[arg(short, long, default_value = "long_run_results")]
output: String,
},
/// Auto-detect and configure endpoint settings
#[command(alias = "ac", display_order = 10)]
AutoConfig {
/// API endpoint URL to test (e.g., http://127.0.0.1:1234/v1)
#[arg(short, long)]
endpoint: Option<String>,
/// Model name to test (auto-detected if not provided)
#[arg(long)]
model: Option<String>,
/// API key for authenticated endpoints
#[arg(long)]
api_key: Option<String>,
/// Output the detected configuration as TOML
#[arg(long)]
toml: bool,
/// Save configuration to selfware.toml
#[arg(long)]
save: bool,
},
/// Zero-config auto-setup: scan local LLM servers, detect models, generate config
#[command(alias = "up", display_order = 10)]
Unpack {
/// Just scan without writing config
#[arg(long)]
scan: bool,
/// Save generated config to selfware.toml
#[arg(long)]
save: bool,
},
/// Multi-agent chat with concurrent streams.
///
/// Without a TASK, starts an interactive session. With a TASK, runs a
/// single fan-out across the role agents, prints the aggregated results,
/// and exits (headless one-shot); `-p <task> multi-chat` is equivalent.
#[command(alias = "m", display_order = 10)]
MultiChat {
/// Run one fan-out for this task and exit instead of starting an
/// interactive session.
task: Option<String>,
/// Maximum concurrent agents (1-16)
#[arg(short = 'n', long, default_value_t = DEFAULT_MULTI_CHAT_CONCURRENCY)]
concurrency: usize,
},
/// Analyze a codebase
#[command(alias = "a", display_order = 10)]
Analyze {
/// Path to analyze
#[arg(default_value = ".")]
path: String,
},
/// Render the codebase as an ecosystem visualization
#[command(display_order = 10)]
Garden {
/// Path to visualize
#[arg(default_value = ".")]
path: String,
},
/// Explore the workspace as a code knowledge graph
#[command(display_order = 10)]
Graph {
/// Workspace path to index
#[arg(default_value = ".")]
path: String,
/// Focus the graph on a symbol or file path fragment
#[arg(long)]
focus: Option<String>,
/// Neighborhood depth around the focus node
#[arg(long, default_value_t = 2)]
depth: usize,
/// Maximum number of nodes to include in the rendered subgraph
#[arg(long, default_value_t = 48)]
max_nodes: usize,
/// Output format
#[arg(long, value_enum, default_value = "ascii")]
format: GraphFormat,
},
/// Run an animated multi-agent demo scenario
#[cfg(feature = "tui")]
#[command(hide = true)]
Demo {
/// Demo scenario to run
#[arg(value_enum, default_value_t = DemoScenarioKind::FeatureFactory)]
scenario: DemoScenarioKind,
/// Use faster timings for CI/smoke runs
#[arg(long)]
fast: bool,
},
/// Launch dashboard mode explicitly
#[cfg(feature = "tui")]
#[command(display_order = 10)]
Dashboard,
/// List journal entries from past tasks
#[command(alias = "j", display_order = 10)]
Journal,
/// View a specific journal entry
#[command(display_order = 10)]
JournalEntry {
/// Entry ID
task_id: String,
},
/// Remove a journal entry
#[command(display_order = 10)]
JournalDelete {
/// Entry ID
task_id: String,
},
/// Self-improve: analyze and edit the selfware codebase
#[cfg(feature = "self-improvement")]
#[command(hide = true)]
Improve {
/// Analyze and propose improvements without making changes
#[arg(long)]
dry_run: bool,
/// Keep improving until no targets or max cycles reached
#[arg(long)]
continuous: bool,
/// Maximum improvement cycles (default 5)
#[arg(long, default_value_t = 5)]
max_cycles: usize,
},
/// Evolve: run the evolutionary self-improvement daemon
#[cfg(feature = "self-improvement")]
#[command(hide = true)]
Evolve {
/// Number of generations (0 = infinite)
#[arg(short, long, default_value = "10")]
generations: usize,
/// Population size per generation
#[arg(short, long, default_value = "4")]
population: usize,
/// Maximum parallel sandbox evaluations
#[arg(long, default_value = "2")]
parallel: usize,
/// Dry run: show config and exit
#[arg(long)]
dry_run: bool,
/// Workflow to use: "default" for evolution daemon, "rsi" for RSI orchestrator
#[arg(long, default_value = "default")]
workflow: String,
},
/// Run as MCP server (stdio transport) so other AI tools can use Selfware's capabilities
#[command(display_order = 10)]
McpServer,
/// Self-evolve: build the code graph and serve the evolution UI over HTTP
#[command(display_order = 10)]
SelfEvolve {
/// Port for the evolve HTTP server
#[arg(short, long, default_value_t = 7777)]
port: u16,
},
/// Start selfware in LSP server mode (for editor extensions)
#[command(hide = true)]
Lsp,
/// Experimental batch entrypoint — runs tasks from a file sequentially
#[command(alias = "bat", hide = true)]
Batch {
/// File containing tasks (one per line)
#[arg(short, long)]
file: String,
/// Maximum concurrent workers
#[arg(short, long, default_value = "16")]
workers: usize,
/// Timeout per task in seconds
#[arg(short, long, default_value = "300")]
timeout: u64,
/// Output directory for results
#[arg(short, long, default_value = "./batch_results")]
output: String,
/// Aggregate results into single file
#[arg(long)]
aggregate: bool,
},
/// Workflow commands (SWL and YAML)
#[command(alias = "w", display_order = 10)]
Workflow {
#[command(subcommand)]
command: WorkflowCommands,
},
/// Inspect or manipulate selfware configuration
#[command(display_order = 10)]
Config {
#[command(subcommand)]
command: ConfigCommands,
},
/// Inspect workflow state
#[command(alias = "st", display_order = 10)]
State {
#[command(subcommand)]
command: StateCommands,
},
/// Supervised run management (start, list, abort agent runs)
#[command(display_order = 10)]
Runs {
#[command(subcommand)]
command: RunsCommand,
},
}
/// Subcommands of `selfware swebench`.
#[derive(Subcommand, Clone, Debug)]
pub(crate) enum SWEBenchCommands {
/// Diagnose SWE-bench Pro traces
Diagnose {
/// Output directory containing trace.jsonl files
output_dir: String,
},
}
/// Subcommands of `selfware bench` for the modern benchmark surface.
#[derive(Subcommand, Clone, Debug)]
#[allow(clippy::large_enum_variant)]
pub(crate) enum BenchCommand {
/// Run SWE-bench Pro instances against one or more local quants
#[command(name = "swebench-pro")]
SwebenchPro(SwebenchProArgs),
}
/// Flags for `selfware bench swebench-pro`.
#[derive(clap::Args, Clone, Debug, Default)]
pub(crate) struct SwebenchProArgs {
/// Comma-separated quant labels (or 'all' for every catalog entry)
#[arg(
long,
default_value = "Qwen3.6-35B-A3B-Q3_K_XL,Qwen3.6-27B-HauhauCS-Q4_K_P,Qwen3.6-27B-HauhauCS-IQ4_XS,Qwen3.6-27B-HauhauCS-Q2_K_P"
)]
pub quants: String,
/// How many SWE-bench Pro instances to subset (sorted by problem_statement length)
#[arg(long, default_value_t = 3)]
pub instances: usize,
/// Comma-separated instance_ids (overrides --instances)
#[arg(long)]
pub instance_ids: Option<String>,
/// Per-instance agent timeout (seconds)
#[arg(long, default_value_t = 900)]
pub scenario_timeout: u64,
/// llama-server context size
#[arg(long, default_value_t = 262_144)]
pub ctx: u32,
/// llama-server `--parallel` slots
#[arg(long, default_value_t = 2)]
pub parallel: u32,
/// Port the spawned llama-server listens on (default 8000). Selfware
/// sub-runs are pointed at `http://127.0.0.1:<port>/v1`.
#[arg(long, default_value_t = 8000)]
pub port: u16,
/// Directory containing the GGUF quant files (default: built-in models dir).
#[arg(long)]
pub models_dir: Option<String>,
/// Path to the llama-server binary (default: built-in / PATH lookup).
#[arg(long)]
pub llama_server_bin: Option<String>,
/// llama-server --tensor-split, e.g. "24,24". Use "auto" to omit the flag.
#[arg(long)]
pub tensor_split: Option<String>,
/// Host/interface llama-server binds to (default 127.0.0.1).
#[arg(long)]
pub host: Option<String>,
/// Use an already-running OpenAI-compatible endpoint (e.g.
/// http://127.0.0.1:8000/v1) instead of booting a llama-server per quant.
#[arg(long)]
pub endpoint: Option<String>,
/// Load the dataset from a local JSONL file instead of HuggingFace.
#[arg(long)]
pub instances_jsonl: Option<String>,
/// Future-use: bench-side concurrency (currently surfaced in plan.json)
#[arg(long, default_value_t = 1)]
pub concurrency: u32,
/// Number of trials per (quant, instance) pair
#[arg(long, default_value_t = 1)]
pub trials: u32,
/// Number of candidate patches to generate per (quant, instance, trial).
/// Each candidate gets its own subdirectory. The best candidate is
/// selected honestly and promoted to the trial-level patch.
#[arg(long, default_value_t = 1, value_parser = clap::value_parser!(u32).range(1..=4))]
pub candidates: u32,
/// Output directory (default: reports/swebench_pro/<timestamp>)
#[arg(long)]
pub output: Option<String>,
/// Path to the selfware binary used for sub-runs (defaults to current binary)
#[arg(long)]
pub selfware_bin: Option<String>,
/// Skip (quant, instance, trial) triples whose .pred already exists
#[arg(long)]
pub skip_existing: bool,
/// Resume an existing swebench-pro output directory when manifest options match.
#[arg(long)]
pub resume: bool,
/// Re-run trials that are already complete in the manifest.
#[arg(long)]
pub force_rerun: bool,
/// Prompt mode: `official` excludes oracle test fields for valid scoring;
/// `diagnostic` includes fail-to-pass tests for local debugging.
#[arg(long, default_value = "official")]
pub prompt_mode: String,
/// Prompt profile: `default` (legacy) or `swebench_pro` (Qwen3.6-optimized).
#[arg(long, default_value = "swebench_pro")]
pub prompt_profile: String,
/// Run official SWE-bench Pro Docker eval after generating patches.
#[arg(long)]
pub official_eval: bool,
/// Path to the SWE-bench Pro evaluator script (required with --official-eval).
#[arg(long)]
pub official_eval_script: Option<String>,
/// Path to the SWE-bench Pro raw sample CSV/JSONL (required with --official-eval).
#[arg(long)]
pub official_eval_raw_sample_path: Option<String>,
/// Directory containing per-instance run_script.sh/parser.py files (required with --official-eval).
#[arg(long)]
pub official_eval_scripts_dir: Option<String>,
/// Docker Hub user/org that hosts sweap-images.
#[arg(long, default_value = "jefzda")]
pub official_eval_dockerhub_username: String,
/// Parallel workers for official eval.
#[arg(long, default_value_t = 1)]
pub official_eval_num_workers: u32,
/// Use Modal instead of local Docker for official eval.
#[arg(long)]
pub official_eval_modal: bool,
/// Re-run official eval even when per-instance outputs already exist.
#[arg(long)]
pub official_eval_redo: bool,
/// Block network access inside official-eval containers.
#[arg(long)]
pub official_eval_block_network: bool,
}
#[derive(Subcommand, Clone, Debug)]
pub(crate) enum ConfigCommands {
/// Print effective configuration with provenance annotations
Show {
/// Render as JSON instead of the human-readable table
#[arg(long)]
json: bool,
},
/// Store an API key in the OS keyring for the configured endpoint
SetKey {
/// The API key to store (kept out of files; omit to be prompted)
key: Option<String>,
},
}
#[derive(Subcommand, Clone, Debug)]
pub(crate) enum WorkflowCommands {
/// Validate an SWL file
Validate {
/// Path to the SWL file
file: String,
},
/// Run an SWL workflow
Run {
/// Path to the SWL file
file: String,
/// Workflow name to run (defaults to first workflow in file)
#[arg(short, long)]
workflow: Option<String>,
/// Input variables (KEY=VALUE format)
#[arg(short, long)]
input: Vec<String>,
/// Dry-run mode (log but don't execute)
#[arg(long)]
dry_run: bool,
},
/// Generate a Rust stub from an SWL workflow file
Codegen {
/// Path to the .swl file
file: std::path::PathBuf,
},
/// List available workflows in the current directory
List {
/// Directory to search for workflows (default: current directory)
#[arg(short, long, default_value = ".")]
dir: String,
/// Show all workflows including SWL and YAML formats
#[arg(long)]
all: bool,
},
}
#[derive(Subcommand, Clone, Debug)]
pub(crate) enum StateCommands {
/// Show state for a workflow
Show {
/// Workflow name
workflow: String,
/// Output format
#[arg(short, long, value_enum, default_value = "text")]
format: StateOutputFormat,
/// State backend directory (default: ~/.selfware/state)
#[arg(short, long)]
dir: Option<String>,
},
/// List all saved workflow states
List {
/// State backend directory (default: ~/.selfware/state)
#[arg(short, long)]
dir: Option<String>,
},
/// Delete state for a workflow
Delete {
/// Workflow name
workflow: String,
/// State backend directory (default: ~/.selfware/state)
#[arg(short, long)]
dir: Option<String>,
/// Skip confirmation
#[arg(short, long)]
force: bool,
},
/// Export state to JSON file
Export {
/// Workflow name
workflow: String,
/// Output file path
#[arg(short, long)]
output: String,
/// State backend directory (default: ~/.selfware/state)
#[arg(short, long)]
dir: Option<String>,
},
/// Import state from JSON file
Import {
/// Workflow name
workflow: String,
/// Input file path
#[arg(short, long)]
input: String,
/// State backend directory (default: ~/.selfware/state)
#[arg(short, long)]
dir: Option<String>,
/// Skip confirmation if state exists
#[arg(short, long)]
force: bool,
},
}
/// Subcommands of `selfware runs`.
#[derive(Subcommand, Clone, Debug)]
pub(crate) enum RunsCommand {
/// Start a task as a supervised run and stream its events.
Start {
/// The task description to run.
task: String,
},
/// List runs tracked by the current process.
///
/// NOTE: Without a persistent supervisor/daemon, this is empty across
/// separate CLI invocations — only runs started *in this process* are
/// visible.
List,
/// Abort a run by its registry id (e.g. `12345-1`), across processes.
Abort {
/// The run id to abort, as shown by `selfware runs list`.
id: String,
},
}
#[derive(Debug, Clone, Copy, Default, clap::ValueEnum)]
pub(crate) enum StateOutputFormat {
/// Human-readable text (default)
#[default]
Text,
/// JSON output
Json,
/// Table format
Table,
}