codeint-config 0.10.5

Configuration and CLI argument parsing for codeint
Documentation
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
use std::path::PathBuf;

use clap::{Args, Parser, Subcommand};

use crate::PluginKind;
use crate::calendar_day::CalendarDay;
use crate::churn::{ChurnFormat, ChurnSince};
use crate::command::{
    AgentClient, AgentFormat, BaselineFormat, CheckRunConclusionMode, ConfigFormat,
    DEFAULT_CHECK_RUN_MAX_ANNOTATIONS, DEFAULT_CHECK_RUN_NAME, DEFAULT_MAX_TRACE_PATHS,
    DEFAULT_RENAME_THRESHOLD, DoctorFormat, GuardFormat, ImpactFormat, InitFormat,
    MAX_RENAME_THRESHOLD, PluginTestFormat, RatchetFormat, ReportFormat, ReportRenderFormat,
    SchemaFormat, StateCheckFormat, TraceFormat, TrendFormat,
};
use crate::config_file::{
    MAX_PLUGIN_MEMORY_MB, MAX_PLUGIN_TIMEOUT_MS, MIN_PLUGIN_MEMORY_MB, MIN_PLUGIN_TIMEOUT_MS,
};
use crate::coupling::{CouplingRatio, DEFAULT_MAX_COMMIT_FILES, DEFAULT_MIN_CO_CHANGES};
use crate::resolved::{BudgetOverride, SourceSetOverride};

#[derive(Debug, Parser)]
#[command(
    name = "codeint",
    version,
    about = "Measures the Software entropy of a codebase"
)]
pub(crate) struct Arguments {
    #[command(subcommand)]
    pub(super) command: CommandArguments,
}

#[derive(Debug, Subcommand)]
pub(super) enum CommandArguments {
    #[command(about = "Measure the working tree and print the report")]
    Check {
        #[arg(
            help = "A folder inside the Git repository to measure; the current folder by default"
        )]
        path: Option<PathBuf>,
        #[arg(
            long = "coverage-report",
            value_name = "PATH",
            help = "Path to an LCOV or Cobertura XML Coverage report; may repeat, and replaces coverage_reports in the configuration file"
        )]
        coverage_reports: Vec<PathBuf>,
        #[arg(
            long = "ignore-baseline",
            help = "Show every Finding and evaluate Budgets on every Finding, as if .codeint/baseline.json did not exist"
        )]
        ignore_baseline: bool,
        #[command(flatten)]
        report: ReportArguments,
    },
    #[command(
        about = "Compare the working tree, or a head Git ref, with the merge-base of a base Git ref and classify each Finding as new, resolved, or unchanged"
    )]
    Diff {
        #[command(flatten)]
        target: DiffTargetArguments,
        #[command(flatten)]
        report: ReportArguments,
    },
    #[command(
        about = "Measure each commit of the main line of the current branch, oldest first, and print each Metric over time"
    )]
    Trend {
        #[arg(
            long,
            value_name = "YYYY-MM-DD",
            conflicts_with = "commits",
            help = "Measure every main-line commit committed on or after this day, in UTC, instead of the latest 20"
        )]
        since: Option<CalendarDay>,
        #[arg(
            long,
            value_name = "COUNT",
            conflicts_with = "since",
            help = "Measure at most this many latest main-line commits from HEAD instead of the latest 20"
        )]
        commits: Option<std::num::NonZeroUsize>,
        #[command(flatten)]
        output: OutputArgument,
        #[arg(
            long,
            value_enum,
            help = "The format of the report; overrides format in the configuration file (defaults to toon)"
        )]
        format: Option<TrendFormat>,
    },
    #[command(about = "Find the shortest runtime import path between two files in the repository")]
    Trace(TraceArguments),
    #[command(
        about = "Compute the transitive reverse-dependency blast radius of one or more repository files"
    )]
    Impact(ImpactArguments),
    #[command(
        about = "Write a starter configuration file at the root of the Git repository that contains the current folder"
    )]
    Init {
        #[arg(
            long,
            help = "Also enable per-file Regression checks, suggest new-file Budgets, write .codeint/ratchet.json and .codeint/baseline.json from the current state, and print pull-request CI instructions"
        )]
        adopt: bool,
        #[arg(
            long,
            value_enum,
            default_value_t = InitFormat::Jsonc,
            help = "The configuration file format to write"
        )]
        format: InitFormat,
    },
    #[command(about = "Update a standalone codeint binary in place from GitHub Releases")]
    Update {
        #[arg(
            long,
            help = "Check whether a newer release is available without modifying the binary"
        )]
        check: bool,
        #[arg(
            long,
            value_name = "TAG",
            help = "Install this release tag, such as v0.1.0, instead of the latest release"
        )]
        version: Option<String>,
    },
    #[command(
        about = "Run a local stdio Model Context Protocol (MCP) server exposing check, diff, trend, guard, impact, trace, churn, and coupling tools"
    )]
    Mcp,
    #[command(
        about = "Show the architectural boundary zone, allowed and denied target zones, public_files constraints, and allowed importers for a file path"
    )]
    Guard {
        #[arg(
            value_name = "PATH",
            help = "Path to an existing or planned file inside the Git repository"
        )]
        path: PathBuf,
        #[arg(
            long,
            value_enum,
            default_value_t = GuardFormat::Text,
            help = "The format of the output"
        )]
        format: GuardFormat,
    },
    #[command(
        about = "Print a machine-readable capability manifest of CLI commands, flags, built-in Metrics, output formats, MCP tools, and exit codes"
    )]
    Schema {
        #[command(flatten)]
        output: OutputArgument,
        #[arg(
            long,
            value_enum,
            default_value_t = SchemaFormat::Json,
            help = "The format of the schema manifest"
        )]
        format: SchemaFormat,
    },
    #[command(
        about = "Inspect the effective active configuration and where each setting came from"
    )]
    Config {
        #[arg(
            help = "A folder inside the Git repository to inspect; the current folder by default"
        )]
        path: Option<PathBuf>,
        #[arg(
            long,
            required = true,
            help = "Print the effective active configuration and per-field provenance"
        )]
        resolved: bool,
        #[arg(
            long,
            value_enum,
            default_value_t = ConfigFormat::Text,
            help = "The format of the output"
        )]
        format: ConfigFormat,
        #[command(flatten)]
        plugin_limits: PluginLimitArguments,
        #[arg(
            long = "budget",
            value_name = "SPEC",
            help = "Override a Budget ratio as SOURCE_SET.METRIC=RATIO"
        )]
        budgets: Vec<BudgetOverride>,
        #[arg(
            long = "source-set",
            value_name = "SPEC",
            help = "Override a Source set glob as SOURCE_SET=GLOB"
        )]
        source_sets: Vec<SourceSetOverride>,
    },
    #[command(
        about = "Re-render a saved check or diff JSON report into another format or publish a GitHub Checks API check run without re-running analysis"
    )]
    Report {
        #[arg(
            value_name = "INPUT",
            help = "Path to a saved check or diff JSON report, or - to read from standard input"
        )]
        input: PathBuf,
        #[command(flatten)]
        output: OutputArgument,
        #[arg(
            long,
            help = "List every Finding in text output instead of capping at 5 per Metric"
        )]
        all: bool,
        #[arg(
            long,
            value_enum,
            help = "The format of the report; overrides format in the configuration file (defaults to toon)"
        )]
        format: Option<ReportRenderFormat>,
        #[command(flatten)]
        check_run: CheckRunArguments,
    },
    #[command(
        about = "Run read-only diagnostics on the configuration file, Git repository status, detected languages, Workspace packages, and external Wasm Plugins"
    )]
    Doctor {
        #[arg(help = "A folder to inspect; the current folder by default")]
        path: Option<PathBuf>,
        #[arg(
            long,
            value_enum,
            default_value_t = DoctorFormat::Text,
            help = "The format of the output"
        )]
        format: DoctorFormat,
    },
    #[command(about = "Inspect and configure codeint MCP integration for local coding agents")]
    Agent {
        #[command(subcommand)]
        command: AgentSubcommandArguments,
    },
    #[command(about = "Check an external Wasm Plugin against the codeint Plugin contract")]
    Plugin {
        #[command(subcommand)]
        command: PluginSubcommandArguments,
    },
    #[command(about = "Manage the repository Ratchet ceilings in .codeint/ratchet.json")]
    Ratchet {
        #[command(subcommand)]
        command: RatchetSubcommandArguments,
    },
    #[command(
        about = "Manage the repository Baseline of existing Findings in .codeint/baseline.json"
    )]
    Baseline {
        #[command(subcommand)]
        command: BaselineSubcommandArguments,
    },
    #[command(
        about = "Check repository Ratchet and Baseline state files against a base Git ref without weakening"
    )]
    State {
        #[command(subcommand)]
        command: StateSubcommandArguments,
    },
    #[command(
        about = "Rank eroded and duplicated files alongside their Git commit churn independently per Metric"
    )]
    Churn {
        #[command(flatten)]
        history: HistoryReportArguments,
    },
    #[command(
        about = "Detect pairs of files that repeatedly change together in the same commits and flag direct runtime imports"
    )]
    Coupling {
        #[command(flatten)]
        history: HistoryReportArguments,
        #[arg(
            long = "max-commit-files",
            value_name = "COUNT",
            default_value_t = std::num::NonZeroUsize::new(DEFAULT_MAX_COMMIT_FILES).expect("non-zero default"),
            help = "Exclude commits touching more than this many files from co-change pair accumulation"
        )]
        max_commit_files: std::num::NonZeroUsize,
        #[arg(
            long = "min-co-changes",
            value_name = "COUNT",
            default_value_t = std::num::NonZeroUsize::new(DEFAULT_MIN_CO_CHANGES).expect("non-zero default"),
            help = "Report only pairs that changed together in at least this many commits"
        )]
        min_co_changes: std::num::NonZeroUsize,
        #[arg(
            long = "min-ratio",
            value_name = "RATIO",
            default_value_t = CouplingRatio::default(),
            help = "Report only pairs whose coupling ratio is at least this value between 0 and 1"
        )]
        min_ratio: CouplingRatio,
        #[arg(
            long = "include-tests",
            help = "Include Test Source set files alongside Production files"
        )]
        include_tests: bool,
    },
}

#[derive(Debug, clap::Args)]
pub(super) struct CheckRunArguments {
    #[arg(
        long = "check-run",
        group = "check_run_mode",
        conflicts_with_all = ["format", "all", "publish_check_run"],
        help = "Render GitHub Checks API check run requests as JSON without calling the network"
    )]
    pub(super) check_run: bool,
    #[arg(
        long = "publish-check-run",
        group = "check_run_mode",
        conflicts_with_all = ["format", "all", "check_run"],
        help = "Publish a GitHub Checks API check run using GITHUB_TOKEN or GH_TOKEN from the environment"
    )]
    pub(super) publish_check_run: bool,
    #[arg(
        long = "check-run-base",
        value_name = "REF",
        requires = "check_run_mode",
        help = "Base Git ref used to find changed lines for check run annotations"
    )]
    pub(super) base_ref: Option<String>,
    #[arg(
        long = "check-run-head-sha",
        value_name = "SHA",
        requires = "check_run_mode",
        help = "Commit SHA or Git ref to attach the check run to"
    )]
    pub(super) head_sha: Option<String>,
    #[arg(
        long = "check-run-name",
        value_name = "NAME",
        default_value = DEFAULT_CHECK_RUN_NAME,
        requires = "check_run_mode",
        help = "Name of the GitHub check run"
    )]
    pub(super) name: String,
    #[arg(
        long = "check-run-conclusion",
        value_name = "MODE",
        value_enum,
        default_value_t = CheckRunConclusionMode::Auto,
        requires = "check_run_mode",
        help = "Check run conclusion when Findings or gate failures exist"
    )]
    pub(super) conclusion: CheckRunConclusionMode,
    #[arg(
        long = "check-run-limit",
        value_name = "COUNT",
        default_value_t = DEFAULT_CHECK_RUN_MAX_ANNOTATIONS,
        requires = "check_run_mode",
        help = "Maximum total line annotations across all 50-annotation Checks API requests"
    )]
    pub(super) max_annotations: usize,
    #[arg(
        long = "check-run-repo",
        value_name = "REPO",
        requires = "publish_check_run",
        help = "GitHub repository (owner/repo) for --publish-check-run (defaults to GITHUB_REPOSITORY)"
    )]
    pub(super) repository: Option<String>,
}

#[derive(Debug, clap::Args)]
pub(super) struct PluginLimitArguments {
    #[arg(
        long = "plugin-memory-mb",
        value_name = "MB",
        value_parser = clap::value_parser!(u64).range(MIN_PLUGIN_MEMORY_MB..=MAX_PLUGIN_MEMORY_MB),
        help = "Override the memory limit in MiB of each Plugin call, plugin_limits.memory_mb (1 to 4096)"
    )]
    pub(super) memory_mb: Option<u64>,
    #[arg(
        long = "plugin-timeout-ms",
        value_name = "MS",
        value_parser = clap::value_parser!(u64).range(MIN_PLUGIN_TIMEOUT_MS..=MAX_PLUGIN_TIMEOUT_MS),
        help = "Override the time limit in milliseconds of each Plugin call, plugin_limits.timeout_ms (1 to 300000)"
    )]
    pub(super) timeout_ms: Option<u64>,
}

#[derive(Debug, Subcommand)]
pub(super) enum AgentSubcommandArguments {
    #[command(
        about = "Report detected local coding agents and whether codeint mcp is registered for each"
    )]
    Status {
        #[arg(long, value_enum, help = "Inspect only this coding agent")]
        client: Option<AgentClient>,
        #[arg(
            long,
            value_enum,
            default_value_t = AgentFormat::Text,
            help = "The format of the output"
        )]
        format: AgentFormat,
        #[arg(
            long,
            value_name = "DIR",
            help = "Override the home folder containing agent configuration files"
        )]
        config_root: Option<PathBuf>,
    },
    #[command(about = "Register codeint mcp in supported local coding agent configuration files")]
    Install {
        #[arg(
            long,
            help = "Preview exact configuration changes without modifying any files"
        )]
        dry_run: bool,
        #[arg(
            long,
            value_enum,
            help = "Configure only this coding agent instead of all detected ones"
        )]
        client: Option<AgentClient>,
        #[arg(
            long,
            value_enum,
            default_value_t = AgentFormat::Text,
            help = "The format of the output"
        )]
        format: AgentFormat,
        #[arg(
            long,
            value_name = "DIR",
            help = "Override the home folder containing agent configuration files"
        )]
        config_root: Option<PathBuf>,
    },
}

#[derive(Debug, Subcommand)]
pub(super) enum PluginSubcommandArguments {
    #[command(
        about = "Run the Conformance runner against a Wasm Plugin and report each violated rule with a fix hint"
    )]
    Test {
        #[arg(value_name = "WASM", help = "Path to the Wasm Plugin to check")]
        path: PathBuf,
        #[arg(
            long,
            value_enum,
            default_value_t = PluginKind::Language,
            help = "The kind of Plugin to check"
        )]
        kind: PluginKind,
        #[arg(
            long = "source",
            value_name = "FILE",
            help = "A source file for a Language plugin to lower in addition to the built-in probe sources; may repeat"
        )]
        sources: Vec<PathBuf>,
        #[command(flatten)]
        plugin_limits: PluginLimitArguments,
        #[arg(
            long,
            value_enum,
            default_value_t = PluginTestFormat::Text,
            help = "The format of the output"
        )]
        format: PluginTestFormat,
    },
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
pub(super) enum StateUpdateFormat {
    Text,
    Toon,
    Json,
}

impl From<StateUpdateFormat> for RatchetFormat {
    fn from(value: StateUpdateFormat) -> RatchetFormat {
        match value {
            StateUpdateFormat::Text => RatchetFormat::Text,
            StateUpdateFormat::Toon => RatchetFormat::Toon,
            StateUpdateFormat::Json => RatchetFormat::Json,
        }
    }
}

impl From<StateUpdateFormat> for BaselineFormat {
    fn from(value: StateUpdateFormat) -> BaselineFormat {
        match value {
            StateUpdateFormat::Text => BaselineFormat::Text,
            StateUpdateFormat::Toon => BaselineFormat::Toon,
            StateUpdateFormat::Json => BaselineFormat::Json,
        }
    }
}

#[derive(Debug, Args)]
pub(super) struct DiffTargetArguments {
    #[arg(
        value_name = "BASE_REF",
        help = "The base Git ref, such as main or origin/main; codeint measures its merge-base with the head"
    )]
    pub(super) base_ref: String,
    #[arg(
        long = "head",
        value_name = "REF",
        help = "Measure this Git ref from Git objects instead of the working tree; the merge-base is then taken with this ref instead of HEAD"
    )]
    pub(super) head_ref: Option<String>,
    #[command(flatten)]
    pub(super) rename: RenameThresholdArgument,
}

#[derive(Debug, Args)]
pub(super) struct RenameThresholdArgument {
    #[arg(
        long = "rename-threshold",
        value_name = "PERCENT",
        default_value_t = DEFAULT_RENAME_THRESHOLD,
        value_parser = clap::value_parser!(u8).range(0..=i64::from(MAX_RENAME_THRESHOLD)),
        help = "Minimum similarity percentage (0 to 100) to treat a deleted and added file pair as a rename; 0 disables rename detection"
    )]
    pub(super) rename_threshold: u8,
}

#[derive(Debug, Args)]
pub(super) struct StateUpdateTargetArguments {
    #[arg(help = "A folder inside the Git repository to measure; the current folder by default")]
    pub(super) path: Option<PathBuf>,
    #[arg(
        long = "coverage-report",
        value_name = "PATH",
        help = "Path to an LCOV or Cobertura XML Coverage report; may repeat, and replaces coverage_reports in the configuration file"
    )]
    pub(super) coverage_reports: Vec<PathBuf>,
    #[arg(
        long,
        value_enum,
        default_value_t = StateUpdateFormat::Text,
        help = "The format of the output"
    )]
    pub(super) format: StateUpdateFormat,
}

#[derive(Debug, Subcommand)]
pub(super) enum RatchetSubcommandArguments {
    #[command(
        about = "Create or monotonically tighten .codeint/ratchet.json from the current working tree"
    )]
    Update {
        #[command(flatten)]
        target: StateUpdateTargetArguments,
        #[arg(
            long,
            help = "Allow loosening Ratchet ceilings for Metrics whose Metric version has not changed"
        )]
        reset: bool,
    },
}

#[derive(Debug, Subcommand)]
pub(super) enum BaselineSubcommandArguments {
    #[command(
        about = "Create .codeint/baseline.json, or remove fixed Findings from it, from the current working tree"
    )]
    Update {
        #[command(flatten)]
        target: StateUpdateTargetArguments,
        #[arg(
            long,
            help = "Replace every Metric's Findings with the current Findings, including new ones"
        )]
        reset: bool,
    },
}

#[derive(Debug, Subcommand)]
pub(super) enum StateSubcommandArguments {
    #[command(
        about = "Verify that .codeint/ratchet.json and .codeint/baseline.json were not weakened relative to a base Git ref"
    )]
    Check {
        #[arg(
            value_name = "BASE_REF",
            help = "The base Git ref, such as main or origin/main; codeint compares against its merge-base with the head"
        )]
        base_ref: String,
        #[arg(
            help = "A folder inside the Git repository to inspect; the current folder by default"
        )]
        path: Option<PathBuf>,
        #[arg(
            long = "head",
            value_name = "REF",
            help = "Read head state files from this Git ref instead of the working tree; the merge-base is then taken with this ref instead of HEAD"
        )]
        head_ref: Option<String>,
        #[command(flatten)]
        rename: RenameThresholdArgument,
        #[command(flatten)]
        output: OutputArgument,
        #[arg(
            long,
            value_enum,
            default_value_t = StateCheckFormat::Toon,
            help = "The format of the report"
        )]
        format: StateCheckFormat,
    },
}

#[derive(Debug, clap::Args)]
pub(super) struct HistoryReportArguments {
    #[arg(
        long,
        value_name = "WINDOW",
        conflicts_with = "commits",
        help = "Lookback window in days (such as 90d) or a UTC date (YYYY-MM-DD); defaults to 90d"
    )]
    pub(super) since: Option<ChurnSince>,
    #[arg(
        long,
        value_name = "COUNT",
        conflicts_with = "since",
        help = "Walk at most this many main-line commits from HEAD"
    )]
    pub(super) commits: Option<std::num::NonZeroUsize>,
    #[command(flatten)]
    pub(super) output: OutputArgument,
    #[arg(long, help = "List every Finding instead of the 20 worst per Metric")]
    pub(super) all: bool,
    #[arg(
        long,
        value_enum,
        help = "The format of the report; overrides format in the configuration file (defaults to toon)"
    )]
    pub(super) format: Option<ChurnFormat>,
}

#[derive(Debug, clap::Args)]
pub(super) struct OutputArgument {
    #[arg(
        long,
        value_name = "FILE",
        help = "Write the report to this file instead of standard output"
    )]
    pub(super) output: Option<PathBuf>,
}

#[derive(Debug, clap::Args)]
pub(super) struct ReportArguments {
    #[arg(
        long,
        value_name = "PATH",
        help = "Scope measurement and output to this Workspace package"
    )]
    pub(super) package: Option<String>,
    #[command(flatten)]
    pub(super) output: OutputArgument,
    #[arg(long, help = "List every Finding instead of the 20 worst per Metric")]
    pub(super) all: bool,
    #[arg(
        long,
        value_enum,
        help = "The format of the report; overrides format in the configuration file (defaults to toon)"
    )]
    pub(super) format: Option<ReportFormat>,
    #[arg(
        long,
        value_name = "OWNER",
        help = "Include only Findings whose CODEOWNERS owner matches this pattern"
    )]
    pub(super) owner: Option<String>,
}

#[derive(Debug, clap::Args)]
pub(super) struct TraceArguments {
    #[arg(
        value_name = "FROM",
        help = "Repository-relative path of the starting module"
    )]
    pub(super) from: String,
    #[arg(
        value_name = "TO",
        help = "Repository-relative path of the target module"
    )]
    pub(super) to: String,
    #[arg(
        long,
        help = "List all shortest runtime import paths up to --max-paths"
    )]
    pub(super) all: bool,
    #[arg(
        long = "max-paths",
        value_name = "COUNT",
        default_value_t = DEFAULT_MAX_TRACE_PATHS,
        help = "Maximum number of shortest paths to list when --all is set"
    )]
    pub(super) max_paths: usize,
    #[arg(
        long,
        value_name = "PATH",
        help = "Scope the query to this Workspace package"
    )]
    pub(super) package: Option<String>,
    #[command(flatten)]
    pub(super) output: OutputArgument,
    #[arg(
        long,
        value_enum,
        help = "The format of the report; overrides format in the configuration file (defaults to toon)"
    )]
    pub(super) format: Option<TraceFormat>,
}

#[derive(Debug, clap::Args)]
pub(super) struct ImpactArguments {
    #[arg(
        value_name = "PATH",
        required_unless_present = "changed",
        help = "Repository file paths to analyze"
    )]
    pub(super) paths: Vec<String>,
    #[arg(
        long,
        value_name = "BASE_REF",
        help = "Analyze files changed since the merge-base of this Git ref and HEAD"
    )]
    pub(super) changed: Option<String>,
    #[arg(
        long,
        value_name = "N",
        help = "Maximum reverse-dependency hop distance to traverse"
    )]
    pub(super) depth: Option<usize>,
    #[arg(
        long,
        value_name = "PATH",
        help = "Scope reported dependents to this Workspace package"
    )]
    pub(super) package: Option<String>,
    #[command(flatten)]
    pub(super) output: OutputArgument,
    #[arg(
        long,
        value_enum,
        help = "The format of the report; overrides format in the configuration file (defaults to toon)"
    )]
    pub(super) format: Option<ImpactFormat>,
}