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
use clap::Subcommand;
use std::path::PathBuf;
use super::args::{CfgOutputFormat, MutateFormat, PlaybookFormat, SimulateFormat};
#[cfg(feature = "oracle")]
use super::args::ExplainErrorFormat;
use super::args::InstallerCommands;
#[derive(Subcommand)]
pub enum CommandsExt {
/// Benchmark shell script(s) with scientific rigor (NEW in v6.25.0)
Bench {
/// Shell script(s) to benchmark
#[arg(value_name = "SCRIPT", required = true)]
scripts: Vec<PathBuf>,
/// Number of warmup iterations
#[arg(short = 'w', long, default_value = "3")]
warmup: usize,
/// Number of measured iterations
#[arg(short = 'i', long, default_value = "10")]
iterations: usize,
/// Output results to JSON file
#[arg(short = 'o', long)]
output: Option<PathBuf>,
/// Enable quality gates (lint + determinism checks)
#[arg(short = 's', long)]
strict: bool,
/// Verify script produces identical output
#[arg(long)]
verify_determinism: bool,
/// Show raw iteration times
#[arg(long)]
show_raw: bool,
/// Suppress progress output
#[arg(short = 'q', long)]
quiet: bool,
/// Measure memory usage (requires /usr/bin/time)
#[arg(short = 'm', long)]
measure_memory: bool,
/// Output results in CSV format (Issue #77)
#[arg(long)]
csv: bool,
/// Disable ANSI colors in output (Issue #77)
#[arg(long)]
no_color: bool,
},
/// Explain shell error using ML classification (NEW in v6.40.0)
#[cfg(feature = "oracle")]
ExplainError {
/// Error message to classify
#[arg(value_name = "ERROR")]
error: String,
/// Command that produced the error (optional, improves accuracy)
#[arg(short = 'c', long)]
command: Option<String>,
/// Shell type (bash, sh, zsh)
#[arg(long, default_value = "bash")]
shell: String,
/// Output format
#[arg(long, value_enum, default_value = "human")]
format: ExplainErrorFormat,
/// Show confidence scores and related patterns
#[arg(long)]
detailed: bool,
},
/// Execute playbook-driven state machine tests (NEW in v6.46.0 - Probar Integration)
Playbook {
/// Playbook YAML file
#[arg(value_name = "FILE")]
input: PathBuf,
/// Run the playbook (default: validate only)
#[arg(long)]
run: bool,
/// Output format
#[arg(long, value_enum, default_value = "human")]
format: PlaybookFormat,
/// Verbose output showing state transitions
#[arg(long)]
verbose: bool,
/// Dry run (show what would be executed)
#[arg(long)]
dry_run: bool,
},
/// Mutation testing for shell scripts (NEW in v6.46.0 - Probar Integration)
Mutate {
/// Shell script to mutate
#[arg(value_name = "FILE")]
input: PathBuf,
/// Mutation configuration file
#[arg(long)]
config: Option<PathBuf>,
/// Output format
#[arg(long, value_enum, default_value = "human")]
format: MutateFormat,
/// Number of mutants to generate
#[arg(long, default_value = "10")]
count: usize,
/// Show surviving mutants (test quality issues)
#[arg(long)]
show_survivors: bool,
/// Output directory for mutant files
#[arg(short, long)]
output: Option<PathBuf>,
},
/// Deterministic simulation replay (NEW in v6.46.0 - Probar Integration)
Simulate {
/// Shell script to simulate
#[arg(value_name = "FILE")]
input: PathBuf,
/// Random seed for deterministic replay
#[arg(long, default_value = "42")]
seed: u64,
/// Verify determinism (run twice, compare outputs)
#[arg(long)]
verify: bool,
/// Mock external commands
#[arg(long)]
mock_externals: bool,
/// Output format
#[arg(long, value_enum, default_value = "human")]
format: SimulateFormat,
/// Record execution trace
#[arg(long)]
trace: bool,
},
/// TDD-first installer framework (NEW in v7.0 - Issue #104)
Installer {
#[command(subcommand)]
command: InstallerCommands,
},
/// Control flow graph analysis for bash scripts (Sprint 5: Formal CFG)
Cfg {
/// Input bash script
#[arg(value_name = "FILE")]
input: PathBuf,
/// Output format
#[arg(long, value_enum, default_value = "human")]
format: CfgOutputFormat,
/// Show per-function CFG breakdown
#[arg(long)]
per_function: bool,
},
/// Generate adversarial training data for shell safety classifier
GenerateAdversarial {
/// Output JSONL file path (required — prevents accidental CWD file creation)
#[arg(short, long)]
output: PathBuf,
/// RNG seed for reproducible generation
#[arg(long, default_value = "42")]
seed: u64,
/// Number of samples per minority class (classes 2, 3, 4)
#[arg(long, default_value = "2500")]
count_per_class: usize,
/// Extra needs-quoting (class 1) samples
#[arg(long, default_value = "500")]
extra_needs_quoting: usize,
/// Verify each script against derive_safety_label for self-consistency
#[arg(long)]
verify: bool,
/// Show generation statistics
#[arg(long)]
stats: bool,
},
}