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
//! Corpus analysis subcommands, group 1 of 3 (original variants 1-21:
//! `suspicious` .. `export-dataset`).
//!
//! GH-215: `clap_derive` emits one `let __clap_app = __clap_app.subcommand({..});`
//! binding per variant inside `augment_subcommands`. At opt-level 0 each binding
//! gets its own stack slot (~12KB), so a single 63-variant enum needed ~768KB of
//! frame and overflowed the 2MB stack `cargo test` gives each test thread.
//! `CorpusAnalysisCommands` is now a shell of `#[command(flatten)]` groups; clap
//! calls each group's `augment_subcommands` as a sequential statement, so peak
//! stack is parent + MAX(group) rather than parent + SUM(variants).
//!
//! `#[command(flatten)]` keeps every subcommand at the same CLI level: this is a
//! pure code-organisation change with zero effect on the user-visible surface.
//! Variant order across the groups MUST match the original declaration order so
//! `--help` ordering is unchanged.
use clap::Subcommand;
use super::args_corpus::{CorpusFormatArg, DatasetExportFormat};
/// Corpus analysis subcommands, group 1 of 3 (flattened into `CorpusAnalysisCommands`).
#[derive(Subcommand)]
pub enum CorpusAnalysisDiagCommands {
/// Tarantula suspiciousness ranking across all decisions (§11.10.1)
Suspicious {
/// Maximum entries to show
#[arg(short = 'n', long, default_value = "20")]
limit: usize,
},
/// Decision frequency and pass/fail correlation summary (§11.10.1)
Decisions,
/// Mine CITL fix patterns from corpus failures (§11.10.2)
Patterns,
/// Query CITL patterns for a specific error signal (§11.10.2)
PatternQuery {
/// Error signal to query (e.g. B3_behavioral_fail, D_lint_fail, G_cross_shell_fail)
#[arg(value_name = "SIGNAL")]
signal: String,
},
/// Suggest fixes for a failing corpus entry (§11.10.2)
FixSuggest {
/// Entry ID (e.g. B-143)
#[arg(value_name = "ID")]
id: String,
},
/// Show decision connectivity graph with usage counts (§11.10.3)
Graph,
/// Impact-weighted decision priority (suspiciousness × connectivity) (§11.10.3)
Impact {
/// Maximum entries to show
#[arg(short = 'n', long, default_value = "20")]
limit: usize,
},
/// Show blast radius of fixing a specific decision (§11.10.3)
BlastRadius {
/// Decision key (e.g. assignment_value:bool_literal)
#[arg(value_name = "DECISION")]
decision: String,
},
/// Deduplicated error view with counts and risk classification (§11.10.4)
Dedup,
/// Risk-prioritized fix backlog with weak supervision labels (§11.10.4)
Triage,
/// Show programmatic labeling rules and match counts (§11.10.4)
LabelRules,
/// Full iteration x format convergence table (§11.10.5)
ConvergeTable,
/// Per-format delta between two iterations (§11.10.5)
ConvergeDiff {
/// First iteration number (default: second-to-last)
#[arg(long)]
from: Option<u32>,
/// Second iteration number (default: last)
#[arg(long)]
to: Option<u32>,
},
/// Per-format convergence status with trend (§11.10.5)
ConvergeStatus,
/// Mine fix patterns from git history (§11.9.1)
Mine {
/// Maximum number of commits to analyze
#[arg(short = 'n', long, default_value = "100")]
limit: usize,
},
/// Find fix commits without regression corpus entries (§11.9.3)
FixGaps {
/// Maximum number of commits to analyze
#[arg(short = 'n', long, default_value = "100")]
limit: usize,
},
/// Cross-project defect pattern analysis (§11.9.4)
OrgPatterns,
/// Validate all corpus entries against formal grammar (§11.8)
SchemaValidate,
/// Categorize grammar violations by GRAM-001..GRAM-008 (§11.8.5)
GrammarErrors,
/// Display formal grammar specification for a format (§11.8.1-11.8.3)
FormatGrammar {
/// Target format to show grammar for
#[arg(value_enum)]
format: CorpusFormatArg,
},
/// Export corpus as dataset (JSON/CSV/JSONL) for HF publishing (§10.3)
ExportDataset {
/// Export format
#[arg(long, default_value = "json")]
format: DatasetExportFormat,
/// Output file path (stdout if not specified)
#[arg(short, long)]
output: Option<std::path::PathBuf>,
},
}