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
/// CUDA-SIMD TDG output format
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, clap::ValueEnum)]
pub enum CudaTdgOutputFormat {
/// Terminal output with colors
#[default]
Terminal,
/// JSON for programmatic consumption
Json,
/// Markdown for documentation
Markdown,
/// SARIF for IDE integration
Sarif,
}
/// CUDA-SIMD TDG subcommands
#[derive(Debug, Clone, Subcommand)]
#[cfg_attr(test, derive(PartialEq))]
pub enum CudaTdgCommand {
/// Analyze a file or directory for CUDA/SIMD defects
Analyze {
/// Path to analyze
path: PathBuf,
},
/// Score codebase with 100-point Popper falsification system
Score {
/// Path to analyze
#[arg(default_value = ".")]
path: PathBuf,
/// Show detailed category breakdown
#[arg(long)]
breakdown: bool,
},
/// Generate detailed defect report
Report {
/// Path to analyze
#[arg(default_value = ".")]
path: PathBuf,
/// Output format (html, json, markdown)
#[arg(long, default_value = "markdown")]
format: String,
/// Output file
#[arg(short, long)]
output: Option<PathBuf>,
},
/// Check barrier safety (PARITY-114 detection)
BarrierCheck {
/// PTX or CUDA file to analyze
path: PathBuf,
},
/// Validate tile dimensions for attention kernels
ValidateTiles {
/// Head dimension
#[arg(long)]
head_dim: usize,
/// Tile KV dimension
#[arg(long)]
tile_kv: usize,
/// Shared memory limit (bytes)
#[arg(long, default_value = "49152")]
shared_memory: usize,
},
/// Quality gate for CI/CD (exits non-zero on failure)
Gate {
/// Path to analyze
#[arg(default_value = ".")]
path: PathBuf,
/// Minimum score to pass (0-100)
#[arg(long, default_value = "85")]
min_score: f64,
/// Fail on P0 defects
#[arg(long)]
fail_on_p0: bool,
},
/// Generate Kaizen continuous improvement report
Kaizen {
/// Path to analyze
#[arg(default_value = ".")]
path: PathBuf,
/// Start date for analysis (YYYY-MM-DD)
#[arg(long)]
since: Option<String>,
},
/// Show Tauranta fault taxonomy
Taxonomy,
}
/// Oracle subcommands for PDCA loop automated quality improvement
#[derive(Debug, Clone, Subcommand)]
#[cfg_attr(test, derive(PartialEq))]
pub enum OracleCommands {
/// Run PDCA fix loop to converge toward perfect project quality
/// Uses CITL (Compiler-In-The-Loop) signals from rustc, clippy, cargo test
#[command(visible_aliases = &["f", "run"])]
Fix {
/// Project path (defaults to current directory)
#[arg(short = 'p', long = "path", default_value = ".")]
path: PathBuf,
/// Maximum iterations (1-100, default 10)
#[arg(short = 'n', long = "max-iterations", default_value = "10")]
max_iterations: usize,
/// Confidence threshold for auto-apply (0.0-1.0)
#[arg(long, default_value = "0.9")]
auto_apply_threshold: f32,
/// Confidence threshold for human review (0.0-1.0)
#[arg(long, default_value = "0.7")]
review_threshold: f32,
/// Dry run (analyze only, don't apply fixes)
#[arg(long)]
dry_run: bool,
/// Output format: text, json, markdown
#[arg(short = 'f', long = "format", default_value = "text")]
format: OracleOutputFormat,
/// Write output to file
#[arg(short = 'o', long = "output")]
output: Option<PathBuf>,
},
/// Show current project quality status against convergence targets
#[command(visible_aliases = &["s"])]
Status {
/// Project path (defaults to current directory)
#[arg(short = 'p', long = "path", default_value = ".")]
path: PathBuf,
/// Output format: text, json, markdown
#[arg(short = 'f', long = "format", default_value = "text")]
format: OracleOutputFormat,
},
/// Run a single PDCA iteration (for CI/CD integration)
Single {
/// Project path (defaults to current directory)
#[arg(short = 'p', long = "path", default_value = ".")]
path: PathBuf,
/// Output format: text, json, markdown
#[arg(short = 'f', long = "format", default_value = "text")]
format: OracleOutputFormat,
/// Write output to file
#[arg(short = 'o', long = "output")]
output: Option<PathBuf>,
},
}
/// Output format for Oracle command
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, clap::ValueEnum)]
pub enum OracleOutputFormat {
/// Human-readable text output
#[default]
Text,
/// JSON for programmatic consumption
Json,
/// Markdown for documentation
Markdown,
}