From fad69d37104ab6e356c9f28cb68ff460df05ff79 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Thu, 5 Feb 2026 14:40:54 +0000 Subject: [PATCH] Initial upload with CI/CD workflow --- src/cli/mod.rs | 162 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 src/cli/mod.rs diff --git a/src/cli/mod.rs b/src/cli/mod.rs new file mode 100644 index 0000000..d87b6e6 --- /dev/null +++ b/src/cli/mod.rs @@ -0,0 +1,162 @@ +use clap::{Parser, Subcommand, ValueEnum}; +use std::path::PathBuf; + +#[derive(Parser, Debug)] +#[command(name = "techdebt-tracker")] +#[command(author = "TechDebt Tracker Contributors")] +#[command(version = "0.1.0")] +#[command(about = "Track and analyze technical debt in your codebase", long_about = None)] +pub struct Args { + #[arg(short, long, global = true)] + pub config: Option, + #[command(subcommand)] + pub command: Commands, +} + +#[derive(Subcommand, Debug)] +pub enum Commands { + #[command(about = "Analyze codebase and show summary")] + Analyze(AnalyzeArgs), + #[command(about = "Open interactive TUI dashboard")] + Tui(TuiArgs), + #[command(about = "Export analysis to file")] + Export(ExportArgs), + #[command(about = "Initialize default configuration")] + Init(InitArgs), +} + +#[derive(clap::Args, Debug)] +pub struct AnalyzeArgs { + #[arg(short, long, default_value = ".")] + pub path: PathBuf, + #[arg(short, long)] + pub output: Option, + #[arg(short, long, action)] + pub verbose: bool, +} + +#[derive(clap::Args, Debug)] +pub struct TuiArgs { + #[arg(short, long, default_value = ".")] + pub path: PathBuf, + #[arg(short, long, action)] + pub verbose: bool, +} + +#[derive(clap::Args, Debug)] +pub struct ExportArgs { + #[arg(short, long, default_value = ".")] + pub path: PathBuf, + #[arg(short, long)] + pub output: PathBuf, + #[arg(short, long, value_enum)] + pub format: ExportFormat, + #[arg(long)] + pub group_by: Option, +} + +#[derive(Clone, Copy, Debug, ValueEnum)] +pub enum ExportFormat { + Json, + Markdown, +} + +#[derive(Clone, Copy, Debug, ValueEnum)] +pub enum GroupBy { + File, + Priority, + Type, +} + +#[derive(clap::Args, Debug)] +pub struct InitArgs { + #[arg(short, long, default_value = ".")] + pub path: PathBuf, +} + +pub fn init_config(path: &PathBuf) -> anyhow::Result<()> { + let config_content = r#"# TechDebt Tracker Configuration + +# Comment patterns to search for +patterns: + - keyword: "FIXME" + priority: critical + regex: false + - keyword: "TODO" + priority: medium + regex: false + - keyword: "HACK" + priority: low + regex: false + - keyword: "BUG" + priority: high + regex: false + - keyword: "XXX" + priority: high + regex: false + - keyword: "NOTE" + priority: low + regex: false + +# Languages to analyze +languages: + - javascript + - typescript + - python + - rust + - go + - java + - c + - cpp + - ruby + +# Directories and files to ignore +ignore: + - "node_modules/**" + - "target/**" + - ".git/**" + - "vendor/**" + - "dist/**" + - "build/**" + - "*.min.js" + - "*.min.css" + - "*.pyc" + - "__pycache__/**" + +# File extensions to include +extensions: + - ".js" + - ".ts" + - ".jsx" + - ".tsx" + - ".py" + - ".rs" + - ".go" + - ".java" + - ".c" + - ".cpp" + - ".h" + - ".hpp" + - ".rb" + - ".md" + - ".yml" + - ".yaml" + +# Complexity analysis settings +complexity: + enabled: true + max_comment_length: 500 + question_weight: 2 + exclamation_weight: 1 + +# Export settings +export: + include_metadata: true + include_context: true +"#; + + let config_path = path.join("techdebt.yaml"); + std::fs::write(&config_path, config_content)?; + println!("Created configuration file: {}", config_path.display()); + Ok(()) +}