organizational_intelligence_plugin/
cli.rs

1// CLI argument parsing for OIP
2// Following EXTREME TDD: Minimal implementation to make tests compile
3
4use clap::{Parser, Subcommand};
5use std::path::PathBuf;
6
7#[derive(Parser, Debug)]
8#[command(name = "oip")]
9#[command(about = "Organizational Intelligence Plugin - Defect Pattern Analysis", long_about = None)]
10#[command(version)]
11pub struct Cli {
12    #[command(subcommand)]
13    pub command: Commands,
14
15    /// Enable verbose logging
16    #[arg(long, global = true)]
17    pub verbose: bool,
18
19    /// Configuration file path
20    #[arg(long, global = true)]
21    pub config: Option<PathBuf>,
22}
23
24#[derive(Subcommand, Debug)]
25pub enum Commands {
26    /// Analyze GitHub organization for defect patterns
27    Analyze {
28        /// Organization name
29        #[arg(long, required = true)]
30        org: String,
31
32        /// Output file path
33        #[arg(long, short, default_value = "defects.yaml")]
34        output: PathBuf,
35
36        /// Maximum concurrent repository analysis
37        #[arg(long, default_value = "10")]
38        max_concurrent: usize,
39    },
40
41    /// Summarize analysis report for AI consumption (Phase 2)
42    Summarize {
43        /// Input YAML report from 'analyze' command
44        #[arg(long, short, required = true)]
45        input: PathBuf,
46
47        /// Output summary file
48        #[arg(long, short, required = true)]
49        output: PathBuf,
50
51        /// Strip PII (author names, commit hashes, email addresses)
52        #[arg(long, default_value = "true")]
53        strip_pii: bool,
54
55        /// Top N defect categories to include
56        #[arg(long, default_value = "10")]
57        top_n: usize,
58
59        /// Minimum frequency to include
60        #[arg(long, default_value = "5")]
61        min_frequency: usize,
62
63        /// Include anonymized examples (with PII redacted if strip-pii is true)
64        #[arg(long, default_value = "false")]
65        include_examples: bool,
66    },
67
68    /// Review PR with organizational context (Phase 3)
69    ReviewPr {
70        /// Baseline summary from weekly analysis
71        #[arg(long, short, required = true)]
72        baseline: PathBuf,
73
74        /// Files changed in PR (comma-separated)
75        #[arg(long, short, required = true)]
76        files: String,
77
78        /// Output format: markdown, json
79        #[arg(long, default_value = "markdown")]
80        format: String,
81
82        /// Output file (stdout if not specified)
83        #[arg(long, short)]
84        output: Option<PathBuf>,
85    },
86}
87
88#[cfg(test)]
89mod tests {
90    use super::*;
91
92    #[test]
93    fn test_cli_structure_exists() {
94        // Verify the CLI structure compiles
95        // This is a sanity check test
96        let _cli_type_check: Option<Cli> = None;
97        let _commands_type_check: Option<Commands> = None;
98    }
99}