pmat 2.93.1

PMAT - Zero-config AI context generation and code quality toolkit (CLI, MCP, HTTP)
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
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
//! CLI enum definitions
//!
//! This module contains all the enum types used by the CLI for command-line parsing
//! and output formatting. Each enum implements Display for testability.

use clap::ValueEnum;
use serde::{Deserialize, Serialize};
use std::fmt;

/// Execution mode for the CLI
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ExecutionMode {
    Cli,
    Mcp,
}

impl fmt::Display for ExecutionMode {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ExecutionMode::Cli => write!(f, "cli"),
            ExecutionMode::Mcp => write!(f, "mcp"),
        }
    }
}

/// Output format for general commands
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum OutputFormat {
    Table,
    Json,
    Yaml,
}

impl fmt::Display for OutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            OutputFormat::Table => write!(f, "table"),
            OutputFormat::Json => write!(f, "json"),
            OutputFormat::Yaml => write!(f, "yaml"),
        }
    }
}

/// Explain level for code explanations
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum ExplainLevel {
    Brief,
    Detailed,
    Verbose,
}

impl fmt::Display for ExplainLevel {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ExplainLevel::Brief => write!(f, "brief"),
            ExplainLevel::Detailed => write!(f, "detailed"),
            ExplainLevel::Verbose => write!(f, "verbose"),
        }
    }
}

/// Enforce output format  
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Serialize, Deserialize)]
pub enum EnforceOutputFormat {
    /// Summary output
    Summary,
    /// JSON output
    Json,
    /// Progress output
    Progress,
    /// SARIF format
    Sarif,
}

impl fmt::Display for EnforceOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            EnforceOutputFormat::Summary => write!(f, "summary"),
            EnforceOutputFormat::Json => write!(f, "json"),
            EnforceOutputFormat::Progress => write!(f, "progress"),
            EnforceOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Refactor output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum RefactorOutputFormat {
    Json,
    Table,
    Summary,
}

impl fmt::Display for RefactorOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            RefactorOutputFormat::Json => write!(f, "json"),
            RefactorOutputFormat::Table => write!(f, "table"),
            RefactorOutputFormat::Summary => write!(f, "summary"),
        }
    }
}

/// Refactor mode
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum RefactorMode {
    Batch,
    Interactive,
}

impl fmt::Display for RefactorMode {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            RefactorMode::Batch => write!(f, "batch"),
            RefactorMode::Interactive => write!(f, "interactive"),
        }
    }
}

/// Refactor auto output format
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Eq)]
pub enum RefactorAutoOutputFormat {
    /// Concise summary of progress
    Summary,
    /// Detailed progress information
    Detailed,
    /// JSON format for automation
    Json,
}

impl fmt::Display for RefactorAutoOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            RefactorAutoOutputFormat::Summary => write!(f, "summary"),
            RefactorAutoOutputFormat::Detailed => write!(f, "detailed"),
            RefactorAutoOutputFormat::Json => write!(f, "json"),
        }
    }
}

/// Refactor docs output format
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Eq)]
pub enum RefactorDocsOutputFormat {
    /// Summary of found issues
    Summary,
    /// Detailed list with explanations
    Detailed,
    /// JSON format for automation
    Json,
    /// Interactive mode for confirmation
    Interactive,
}

impl fmt::Display for RefactorDocsOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            RefactorDocsOutputFormat::Summary => write!(f, "summary"),
            RefactorDocsOutputFormat::Detailed => write!(f, "detailed"),
            RefactorDocsOutputFormat::Json => write!(f, "json"),
            RefactorDocsOutputFormat::Interactive => write!(f, "interactive"),
        }
    }
}

/// Quality profile for refactoring
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq, Eq, Default)]
pub enum QualityProfile {
    /// Standard quality profile
    Standard,
    /// Strict quality profile
    Strict,
    /// Extreme quality profile - RIGID standards
    #[default]
    Extreme,
}

impl fmt::Display for QualityProfile {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            QualityProfile::Standard => write!(f, "standard"),
            QualityProfile::Strict => write!(f, "strict"),
            QualityProfile::Extreme => write!(f, "extreme"),
        }
    }
}

/// Context format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum ContextFormat {
    Markdown,
    Json,
    Sarif,
    #[value(name = "llm-optimized")]
    LlmOptimized,
}

impl fmt::Display for ContextFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ContextFormat::Markdown => write!(f, "markdown"),
            ContextFormat::Json => write!(f, "json"),
            ContextFormat::Sarif => write!(f, "sarif"),
            ContextFormat::LlmOptimized => write!(f, "llm-optimized"),
        }
    }
}

/// TDG output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum TdgOutputFormat {
    Table,
    Json,
    Markdown,
    Sarif,
}

impl fmt::Display for TdgOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            TdgOutputFormat::Table => write!(f, "table"),
            TdgOutputFormat::Json => write!(f, "json"),
            TdgOutputFormat::Markdown => write!(f, "markdown"),
            TdgOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Makefile output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize, Deserialize)]
pub enum MakefileOutputFormat {
    /// Human-readable output
    Human,
    /// JSON output
    Json,
    /// GCC-style output for editor integration
    Gcc,
    /// SARIF format for CI/CD integration
    Sarif,
}

impl fmt::Display for MakefileOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            MakefileOutputFormat::Human => write!(f, "human"),
            MakefileOutputFormat::Json => write!(f, "json"),
            MakefileOutputFormat::Gcc => write!(f, "gcc"),
            MakefileOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Lint hotspot output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize, Deserialize)]
pub enum LintHotspotOutputFormat {
    /// Summary output
    Summary,
    /// Detailed output
    Detailed,
    /// JSON output
    Json,
    /// Enforcement JSON output
    #[value(name = "enforcement-json")]
    EnforcementJson,
    /// SARIF format for CI/CD integration
    Sarif,
}

impl fmt::Display for LintHotspotOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            LintHotspotOutputFormat::Summary => write!(f, "summary"),
            LintHotspotOutputFormat::Detailed => write!(f, "detailed"),
            LintHotspotOutputFormat::Json => write!(f, "json"),
            LintHotspotOutputFormat::EnforcementJson => write!(f, "enforcement-json"),
            LintHotspotOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Provability output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize, Deserialize)]
pub enum ProvabilityOutputFormat {
    /// Summary statistics only
    Summary,
    /// Full detailed report
    Full,
    /// JSON format for tools
    Json,
    /// SARIF format for CI/CD integration
    Sarif,
    /// Markdown report format
    Markdown,
}

impl fmt::Display for ProvabilityOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ProvabilityOutputFormat::Summary => write!(f, "summary"),
            ProvabilityOutputFormat::Full => write!(f, "full"),
            ProvabilityOutputFormat::Json => write!(f, "json"),
            ProvabilityOutputFormat::Sarif => write!(f, "sarif"),
            ProvabilityOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// Duplicate type
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize)]
pub enum DuplicateType {
    /// Exact duplicates (Type 1 clones)
    Exact,
    /// Renamed duplicates (Type 2 clones)
    Renamed,
    /// Gapped duplicates (Type 3 clones)
    Gapped,
    /// Semantic duplicates using AST similarity
    Semantic,
    /// Fuzzy matching (similar but not exact)
    Fuzzy,
    /// All types of duplicates
    All,
}

impl fmt::Display for DuplicateType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DuplicateType::Exact => write!(f, "exact"),
            DuplicateType::Renamed => write!(f, "renamed"),
            DuplicateType::Gapped => write!(f, "gapped"),
            DuplicateType::Semantic => write!(f, "semantic"),
            DuplicateType::Fuzzy => write!(f, "fuzzy"),
            DuplicateType::All => write!(f, "all"),
        }
    }
}

/// Defect prediction output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize)]
pub enum DefectPredictionOutputFormat {
    /// Summary statistics only
    Summary,
    /// Detailed analysis with recommendations
    Detailed,
    /// JSON format for tooling
    Json,
    /// CSV format for spreadsheet import
    Csv,
    /// SARIF format for IDE integration
    Sarif,
}

impl fmt::Display for DefectPredictionOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DefectPredictionOutputFormat::Summary => write!(f, "summary"),
            DefectPredictionOutputFormat::Detailed => write!(f, "detailed"),
            DefectPredictionOutputFormat::Json => write!(f, "json"),
            DefectPredictionOutputFormat::Csv => write!(f, "csv"),
            DefectPredictionOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Comprehensive output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize)]
pub enum ComprehensiveOutputFormat {
    /// Executive summary report
    Summary,
    /// Detailed unified analysis report
    Detailed,
    /// JSON format for tooling integration
    Json,
    /// Markdown report format
    Markdown,
    /// SARIF format for IDE integration
    Sarif,
}

impl fmt::Display for ComprehensiveOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ComprehensiveOutputFormat::Summary => write!(f, "summary"),
            ComprehensiveOutputFormat::Detailed => write!(f, "detailed"),
            ComprehensiveOutputFormat::Json => write!(f, "json"),
            ComprehensiveOutputFormat::Markdown => write!(f, "markdown"),
            ComprehensiveOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Graph metric type
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum GraphMetricType {
    /// Degree centrality
    Centrality,
    /// Betweenness centrality
    Betweenness,
    /// Closeness centrality
    Closeness,
    /// `PageRank` scores
    PageRank,
    /// Clustering coefficient
    Clustering,
    /// Connected components analysis
    Components,
    /// All available metrics
    All,
}

impl GraphMetricType {
    /// Get the string representation of the graph metric type
    fn as_str(&self) -> &'static str {
        match self {
            GraphMetricType::Centrality => "centrality",
            GraphMetricType::Betweenness => "betweenness",
            GraphMetricType::Closeness => "closeness",
            GraphMetricType::PageRank => "pagerank",
            GraphMetricType::Clustering => "clustering",
            GraphMetricType::Components => "components",
            GraphMetricType::All => "all",
        }
    }
}

impl fmt::Display for GraphMetricType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Graph metrics output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum GraphMetricsOutputFormat {
    /// Summary statistics only
    Summary,
    /// Detailed metrics with rankings
    Detailed,
    /// Human-readable format
    Human,
    /// JSON format for tooling integration
    Json,
    /// CSV format for spreadsheet import
    Csv,
    /// `GraphML` export format
    GraphML,
    /// Markdown report format
    Markdown,
}

impl GraphMetricsOutputFormat {
    /// Get the string representation of the output format
    fn as_str(&self) -> &'static str {
        match self {
            GraphMetricsOutputFormat::Summary => "summary",
            GraphMetricsOutputFormat::Detailed => "detailed",
            GraphMetricsOutputFormat::Human => "human",
            GraphMetricsOutputFormat::Json => "json",
            GraphMetricsOutputFormat::Csv => "csv",
            GraphMetricsOutputFormat::GraphML => "graphml",
            GraphMetricsOutputFormat::Markdown => "markdown",
        }
    }
}

impl fmt::Display for GraphMetricsOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Search scope
#[derive(Clone, Copy, Debug, ValueEnum, PartialEq)]
pub enum SearchScope {
    /// Search function names
    Functions,
    /// Search type/class names
    Types,
    /// Search variable names
    Variables,
    /// Search all identifiers
    All,
}

impl fmt::Display for SearchScope {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            SearchScope::Functions => write!(f, "functions"),
            SearchScope::Types => write!(f, "types"),
            SearchScope::Variables => write!(f, "variables"),
            SearchScope::All => write!(f, "all"),
        }
    }
}

/// Name similarity output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum NameSimilarityOutputFormat {
    /// Summary of matches only
    Summary,
    /// Detailed match analysis
    Detailed,
    /// Human-readable format
    Human,
    /// JSON format for tooling integration
    Json,
    /// CSV format for spreadsheet import
    Csv,
    /// Markdown report format
    Markdown,
}

impl fmt::Display for NameSimilarityOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            NameSimilarityOutputFormat::Summary => write!(f, "summary"),
            NameSimilarityOutputFormat::Detailed => write!(f, "detailed"),
            NameSimilarityOutputFormat::Human => write!(f, "human"),
            NameSimilarityOutputFormat::Json => write!(f, "json"),
            NameSimilarityOutputFormat::Csv => write!(f, "csv"),
            NameSimilarityOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// Duplicate output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Serialize)]
pub enum DuplicateOutputFormat {
    /// Summary statistics only
    Summary,
    /// Detailed duplicate listing
    Detailed,
    /// Human-readable format
    Human,
    /// JSON format for tooling
    Json,
    /// CSV format for spreadsheet import
    Csv,
    /// SARIF format for IDE integration
    Sarif,
}

impl fmt::Display for DuplicateOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DuplicateOutputFormat::Summary => write!(f, "summary"),
            DuplicateOutputFormat::Detailed => write!(f, "detailed"),
            DuplicateOutputFormat::Human => write!(f, "human"),
            DuplicateOutputFormat::Json => write!(f, "json"),
            DuplicateOutputFormat::Csv => write!(f, "csv"),
            DuplicateOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Complexity output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum ComplexityOutputFormat {
    /// Summary statistics only
    Summary,
    /// Full report with violations
    Full,
    /// JSON format for tools
    Json,
    /// SARIF format for IDE integration
    Sarif,
}

impl fmt::Display for ComplexityOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ComplexityOutputFormat::Summary => write!(f, "summary"),
            ComplexityOutputFormat::Full => write!(f, "full"),
            ComplexityOutputFormat::Json => write!(f, "json"),
            ComplexityOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Dead code output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeadCodeOutputFormat {
    Summary,
    Json,
    Sarif,
    Markdown,
}

impl fmt::Display for DeadCodeOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeadCodeOutputFormat::Summary => write!(f, "summary"),
            DeadCodeOutputFormat::Json => write!(f, "json"),
            DeadCodeOutputFormat::Sarif => write!(f, "sarif"),
            DeadCodeOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// SATD output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum SatdOutputFormat {
    Summary,
    Json,
    Sarif,
    Markdown,
}

impl fmt::Display for SatdOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            SatdOutputFormat::Summary => write!(f, "summary"),
            SatdOutputFormat::Json => write!(f, "json"),
            SatdOutputFormat::Sarif => write!(f, "sarif"),
            SatdOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// SATD severity levels
#[derive(Clone, Debug, ValueEnum, PartialEq, PartialOrd, Ord, Eq)]
pub enum SatdSeverity {
    Low,
    Medium,
    High,
    Critical,
}

impl fmt::Display for SatdSeverity {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            SatdSeverity::Low => write!(f, "low"),
            SatdSeverity::Medium => write!(f, "medium"),
            SatdSeverity::High => write!(f, "high"),
            SatdSeverity::Critical => write!(f, "critical"),
        }
    }
}

/// Symbol table output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum SymbolTableOutputFormat {
    /// Summary with statistics
    Summary,
    /// Detailed output with all symbols
    Detailed,
    /// Human-readable format
    Human,
    /// JSON format for tools
    Json,
    /// CSV format for spreadsheets
    Csv,
}

impl fmt::Display for SymbolTableOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            SymbolTableOutputFormat::Summary => write!(f, "summary"),
            SymbolTableOutputFormat::Detailed => write!(f, "detailed"),
            SymbolTableOutputFormat::Human => write!(f, "human"),
            SymbolTableOutputFormat::Json => write!(f, "json"),
            SymbolTableOutputFormat::Csv => write!(f, "csv"),
        }
    }
}

/// Big-O output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum BigOOutputFormat {
    /// Summary with complexity distribution
    Summary,
    /// JSON format for tools
    Json,
    /// Markdown report
    Markdown,
    /// Detailed analysis with all functions
    Detailed,
}

impl fmt::Display for BigOOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            BigOOutputFormat::Summary => write!(f, "summary"),
            BigOOutputFormat::Json => write!(f, "json"),
            BigOOutputFormat::Markdown => write!(f, "markdown"),
            BigOOutputFormat::Detailed => write!(f, "detailed"),
        }
    }
}

/// Symbol type filter
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum SymbolTypeFilter {
    /// Functions and methods
    Functions,
    /// Classes only
    Classes,
    /// Types, structs, and classes
    Types,
    /// Variables and constants
    Variables,
    /// Modules and namespaces
    Modules,
    /// All symbols
    All,
}

impl fmt::Display for SymbolTypeFilter {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            SymbolTypeFilter::Functions => write!(f, "functions"),
            SymbolTypeFilter::Classes => write!(f, "classes"),
            SymbolTypeFilter::Types => write!(f, "types"),
            SymbolTypeFilter::Variables => write!(f, "variables"),
            SymbolTypeFilter::Modules => write!(f, "modules"),
            SymbolTypeFilter::All => write!(f, "all"),
        }
    }
}

/// DAG generation type
#[derive(Clone, Debug, ValueEnum, PartialEq, Eq, Hash)]
pub enum DagType {
    /// Function call graph
    #[value(name = "call-graph")]
    CallGraph,

    /// Import/dependency graph
    #[value(name = "import-graph")]
    ImportGraph,

    /// Class inheritance hierarchy
    #[value(name = "inheritance")]
    Inheritance,

    /// Complete dependency graph
    #[value(name = "full-dependency")]
    FullDependency,
}

impl fmt::Display for DagType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DagType::CallGraph => write!(f, "call-graph"),
            DagType::ImportGraph => write!(f, "import-graph"),
            DagType::Inheritance => write!(f, "inheritance"),
            DagType::FullDependency => write!(f, "full-dependency"),
        }
    }
}

/// Deep context output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeepContextOutputFormat {
    Markdown,
    Json,
    Sarif,
}

impl fmt::Display for DeepContextOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeepContextOutputFormat::Markdown => write!(f, "markdown"),
            DeepContextOutputFormat::Json => write!(f, "json"),
            DeepContextOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Deep context DAG type
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeepContextDagType {
    #[value(name = "call-graph")]
    CallGraph,
    #[value(name = "import-graph")]
    ImportGraph,
    #[value(name = "inheritance")]
    Inheritance,
    #[value(name = "full-dependency")]
    FullDependency,
}

impl fmt::Display for DeepContextDagType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeepContextDagType::CallGraph => write!(f, "call-graph"),
            DeepContextDagType::ImportGraph => write!(f, "import-graph"),
            DeepContextDagType::Inheritance => write!(f, "inheritance"),
            DeepContextDagType::FullDependency => write!(f, "full-dependency"),
        }
    }
}

/// Deep context cache strategy
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DeepContextCacheStrategy {
    Normal,
    #[value(name = "force-refresh")]
    ForceRefresh,
    Offline,
}

impl fmt::Display for DeepContextCacheStrategy {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DeepContextCacheStrategy::Normal => write!(f, "normal"),
            DeepContextCacheStrategy::ForceRefresh => write!(f, "force-refresh"),
            DeepContextCacheStrategy::Offline => write!(f, "offline"),
        }
    }
}

/// Demo protocol selection
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum DemoProtocol {
    Cli,
    Http,
    Mcp,
    #[cfg(feature = "tui")]
    Tui,
    All,
}

impl fmt::Display for DemoProtocol {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            DemoProtocol::Cli => write!(f, "cli"),
            DemoProtocol::Http => write!(f, "http"),
            DemoProtocol::Mcp => write!(f, "mcp"),
            #[cfg(feature = "tui")]
            DemoProtocol::Tui => write!(f, "tui"),
            DemoProtocol::All => write!(f, "all"),
        }
    }
}

/// Proof annotation output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum ProofAnnotationOutputFormat {
    Summary,
    Full,
    Json,
    Markdown,
    Sarif,
}

impl fmt::Display for ProofAnnotationOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ProofAnnotationOutputFormat::Summary => write!(f, "summary"),
            ProofAnnotationOutputFormat::Full => write!(f, "full"),
            ProofAnnotationOutputFormat::Json => write!(f, "json"),
            ProofAnnotationOutputFormat::Markdown => write!(f, "markdown"),
            ProofAnnotationOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

/// Property type filter
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum PropertyTypeFilter {
    MemorySafety,
    ThreadSafety,
    DataRaceFreeze,
    Termination,
    FunctionalCorrectness,
    ResourceBounds,
    All,
}

impl PropertyTypeFilter {
    /// Get the string representation of the property type filter
    fn as_str(&self) -> &'static str {
        match self {
            PropertyTypeFilter::MemorySafety => "memory-safety",
            PropertyTypeFilter::ThreadSafety => "thread-safety",
            PropertyTypeFilter::DataRaceFreeze => "data-race-freeze",
            PropertyTypeFilter::Termination => "termination",
            PropertyTypeFilter::FunctionalCorrectness => "functional-correctness",
            PropertyTypeFilter::ResourceBounds => "resource-bounds",
            PropertyTypeFilter::All => "all",
        }
    }
}

impl fmt::Display for PropertyTypeFilter {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Verification method filter
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum VerificationMethodFilter {
    FormalProof,
    ModelChecking,
    StaticAnalysis,
    AbstractInterpretation,
    BorrowChecker,
    All,
}

impl fmt::Display for VerificationMethodFilter {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            VerificationMethodFilter::FormalProof => write!(f, "formal-proof"),
            VerificationMethodFilter::ModelChecking => write!(f, "model-checking"),
            VerificationMethodFilter::StaticAnalysis => write!(f, "static-analysis"),
            VerificationMethodFilter::AbstractInterpretation => {
                write!(f, "abstract-interpretation")
            }
            VerificationMethodFilter::BorrowChecker => write!(f, "borrow-checker"),
            VerificationMethodFilter::All => write!(f, "all"),
        }
    }
}

/// Incremental coverage output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum IncrementalCoverageOutputFormat {
    Summary,
    Detailed,
    Json,
    Markdown,
    Lcov,
    Delta,
    Sarif,
}

impl IncrementalCoverageOutputFormat {
    /// Get the string representation of the output format
    fn as_str(&self) -> &'static str {
        match self {
            IncrementalCoverageOutputFormat::Summary => "summary",
            IncrementalCoverageOutputFormat::Detailed => "detailed",
            IncrementalCoverageOutputFormat::Json => "json",
            IncrementalCoverageOutputFormat::Markdown => "markdown",
            IncrementalCoverageOutputFormat::Lcov => "lcov",
            IncrementalCoverageOutputFormat::Delta => "delta",
            IncrementalCoverageOutputFormat::Sarif => "sarif",
        }
    }
}

impl fmt::Display for IncrementalCoverageOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Quality gate output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum QualityGateOutputFormat {
    Summary,
    Detailed,
    Human,
    Json,
    Junit,
    Markdown,
}

impl fmt::Display for QualityGateOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            QualityGateOutputFormat::Summary => write!(f, "summary"),
            QualityGateOutputFormat::Detailed => write!(f, "detailed"),
            QualityGateOutputFormat::Human => write!(f, "human"),
            QualityGateOutputFormat::Json => write!(f, "json"),
            QualityGateOutputFormat::Junit => write!(f, "junit"),
            QualityGateOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// Report output format
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum ReportOutputFormat {
    /// JSON format (default)
    Json,
    /// CSV format for spreadsheet analysis
    Csv,
    /// Markdown format with tables and visualizations
    Markdown,
    /// Plain text format
    Text,
    /// HTML format (legacy)
    Html,
    /// PDF format (legacy)
    Pdf,
    /// Dashboard format (legacy)
    Dashboard,
}

impl ReportOutputFormat {
    /// Get the string representation of the report output format
    fn as_str(&self) -> &'static str {
        match self {
            ReportOutputFormat::Json => "json",
            ReportOutputFormat::Csv => "csv",
            ReportOutputFormat::Markdown => "markdown",
            ReportOutputFormat::Text => "text",
            ReportOutputFormat::Html => "html",
            ReportOutputFormat::Pdf => "pdf",
            ReportOutputFormat::Dashboard => "dashboard",
        }
    }
}

impl fmt::Display for ReportOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

/// Analysis type
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum AnalysisType {
    Complexity,
    DeadCode,
    Duplication,
    TechnicalDebt,
    BigO,
    All,
}

impl fmt::Display for AnalysisType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            AnalysisType::Complexity => write!(f, "complexity"),
            AnalysisType::DeadCode => write!(f, "dead-code"),
            AnalysisType::Duplication => write!(f, "duplication"),
            AnalysisType::TechnicalDebt => write!(f, "technical-debt"),
            AnalysisType::BigO => write!(f, "big-o"),
            AnalysisType::All => write!(f, "all"),
        }
    }
}

/// Quality check type
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum QualityCheckType {
    DeadCode,
    Complexity,
    Coverage,
    Sections,
    Provability,
    Satd,
    Entropy,
    Security,
    Duplicates,
    All,
}

impl QualityCheckType {
    /// Returns the default checks to run
    #[must_use] 
    pub fn default_checks() -> Vec<Self> {
        vec![
            QualityCheckType::Complexity,
            QualityCheckType::DeadCode,
            QualityCheckType::Satd,
            QualityCheckType::Entropy,
            QualityCheckType::Security,
            QualityCheckType::Duplicates,
            QualityCheckType::Coverage,
            QualityCheckType::Sections,
            QualityCheckType::Provability,
        ]
    }
}

impl QualityCheckType {
    /// Get the string representation of the quality check type
    fn as_str(&self) -> &'static str {
        match self {
            QualityCheckType::DeadCode => "dead-code",
            QualityCheckType::Complexity => "complexity",
            QualityCheckType::Coverage => "coverage",
            QualityCheckType::Sections => "sections",
            QualityCheckType::Provability => "provability",
            QualityCheckType::Satd => "satd",
            QualityCheckType::Entropy => "entropy",
            QualityCheckType::Security => "security",
            QualityCheckType::Duplicates => "duplicates",
            QualityCheckType::All => "all",
        }
    }
}

impl fmt::Display for QualityCheckType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_execution_mode_display() {
        assert_eq!(ExecutionMode::Cli.to_string(), "cli");
        assert_eq!(ExecutionMode::Mcp.to_string(), "mcp");
    }

    #[test]
    fn test_output_format_display() {
        assert_eq!(OutputFormat::Table.to_string(), "table");
        assert_eq!(OutputFormat::Json.to_string(), "json");
        assert_eq!(OutputFormat::Yaml.to_string(), "yaml");
    }

    #[test]
    fn test_satd_severity_ordering() {
        assert!(SatdSeverity::Low < SatdSeverity::Medium);
        assert!(SatdSeverity::Medium < SatdSeverity::High);
        assert!(SatdSeverity::High < SatdSeverity::Critical);
    }

    #[test]
    fn test_all_enum_displays() {
        // Test a sample from each enum to ensure Display is implemented
        assert_eq!(ExplainLevel::Brief.to_string(), "brief");
        assert_eq!(RefactorOutputFormat::Json.to_string(), "json");
        assert_eq!(RefactorMode::Batch.to_string(), "batch");
        assert_eq!(ContextFormat::Markdown.to_string(), "markdown");
        assert_eq!(TdgOutputFormat::Table.to_string(), "table");
        assert_eq!(MakefileOutputFormat::Human.to_string(), "human");
        assert_eq!(DuplicateType::Exact.to_string(), "exact");
        assert_eq!(GraphMetricType::PageRank.to_string(), "pagerank");
        assert_eq!(SearchScope::Functions.to_string(), "functions");
        assert_eq!(ComplexityOutputFormat::Summary.to_string(), "summary");
        assert_eq!(DeadCodeOutputFormat::Json.to_string(), "json");
        assert_eq!(SatdOutputFormat::Markdown.to_string(), "markdown");
        assert_eq!(SymbolTableOutputFormat::Csv.to_string(), "csv");
        assert_eq!(BigOOutputFormat::Detailed.to_string(), "detailed");
        assert_eq!(SymbolTypeFilter::All.to_string(), "all");
        assert_eq!(DagType::CallGraph.to_string(), "call-graph");
        assert_eq!(DeepContextOutputFormat::Sarif.to_string(), "sarif");
        assert_eq!(DemoProtocol::Http.to_string(), "http");
        assert_eq!(AnalysisType::BigO.to_string(), "big-o");
        assert_eq!(QualityCheckType::Coverage.to_string(), "coverage");
    }

    #[test]
    fn test_enum_equality() {
        assert_eq!(ExecutionMode::Cli, ExecutionMode::Cli);
        assert_ne!(ExecutionMode::Cli, ExecutionMode::Mcp);

        assert_eq!(OutputFormat::Json, OutputFormat::Json);
        assert_ne!(OutputFormat::Json, OutputFormat::Table);

        assert_eq!(SatdSeverity::Low, SatdSeverity::Low);
        assert_ne!(SatdSeverity::Low, SatdSeverity::High);

        assert_eq!(EntropyOutputFormat::Summary, EntropyOutputFormat::Summary);
        assert_ne!(EntropyOutputFormat::Summary, EntropyOutputFormat::Json);

        assert_eq!(EntropySeverity::Low, EntropySeverity::Low);
        assert_ne!(EntropySeverity::Low, EntropySeverity::High);
    }
}

/// Entropy analysis output format
#[derive(Clone, Debug, ValueEnum, PartialEq, Eq, Deserialize, Serialize)]
pub enum EntropyOutputFormat {
    /// Summary with top violations
    Summary,
    /// Detailed violation report
    Detailed,
    /// JSON format for tooling
    Json,
    /// Markdown report
    Markdown,
}

impl fmt::Display for EntropyOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            EntropyOutputFormat::Summary => write!(f, "summary"),
            EntropyOutputFormat::Detailed => write!(f, "detailed"),
            EntropyOutputFormat::Json => write!(f, "json"),
            EntropyOutputFormat::Markdown => write!(f, "markdown"),
        }
    }
}

/// Entropy violation severity levels
#[derive(Clone, Debug, ValueEnum, PartialEq, Eq, Deserialize, Serialize)]
pub enum EntropySeverity {
    /// Low severity violations
    Low,
    /// Medium severity violations
    Medium,
    /// High severity violations
    High,
}

impl fmt::Display for EntropySeverity {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            EntropySeverity::Low => write!(f, "low"),
            EntropySeverity::Medium => write!(f, "medium"),
            EntropySeverity::High => write!(f, "high"),
        }
    }
}

/// Output format for WASM analysis
#[derive(Clone, Debug, ValueEnum, PartialEq)]
pub enum WasmOutputFormat {
    /// Summary output with key metrics
    Summary,
    /// Detailed analysis with all components
    Detailed,
    /// JSON format for programmatic use
    Json,
    /// SARIF format for security results
    Sarif,
}

impl fmt::Display for WasmOutputFormat {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            WasmOutputFormat::Summary => write!(f, "summary"),
            WasmOutputFormat::Detailed => write!(f, "detailed"),
            WasmOutputFormat::Json => write!(f, "json"),
            WasmOutputFormat::Sarif => write!(f, "sarif"),
        }
    }
}

#[cfg(test)]
mod property_tests {
    use proptest::prelude::*;

    proptest! {
        #[test]
        fn basic_property_stability(_input in ".*") {
            // Basic property test for coverage
            prop_assert!(true);
        }

        #[test]
        fn module_consistency_check(_x in 0u32..1000) {
            // Module consistency verification
            prop_assert!(_x < 1001);
        }
    }
}