Skip to content

chann/cli-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CLI Tools Collection

A collection of powerful Rust-based CLI tools for developers.

Tools

code-cost

Analyze code repositories and calculate their monetary value based on development effort, complexity, and various metrics.

Features

  • Comprehensive Code Analysis

    • Lines of code (LOC) with breakdown (code, comments, blanks)
    • Multiple programming languages with weighted difficulty scores
    • Cyclomatic complexity estimation
    • Project maturity scoring (tests, documentation, age)
  • Git Repository Analysis

    • Commit count and history
    • Contributor analysis
    • Repository age tracking
  • Monetary Value Calculation

    • Estimated development hours
    • Customizable hourly rate (default: β‚©10,030 - 2025 South Korea minimum wage)
    • Language difficulty multipliers (Rust: 1.5x, C++: 1.4x, Go: 1.3x, etc.)
    • Complexity and maturity bonuses
    • Learning time estimation
  • Advanced Analysis Features

    • Detailed project metrics (complexity, maturity, code quality)
    • Language breakdown with percentages
    • AI usage estimation and code quality scoring
    • Developer level cost breakdown (Junior to Principal)
    • Test coverage statistics
  • Multiple Output Formats

    • Beautiful colored table output
    • Detailed analysis mode (default) with comprehensive metrics
    • Simple mode (--simple) for basic summary
    • JSON (compact and pretty-printed)
    • CSV export
    • HTML report
    • Markdown documentation

Installation

cargo install --path crates/code-cost

Or build from source:

cargo build --release

Usage

Basic Analysis (detailed mode is default):

code-cost

Simple Mode (table only):

code-cost --simple

Developer Level Breakdown:

code-cost --dev-levels

Analyze Multiple Repositories:

code-cost ~/project1 ~/project2 ~/project3

JSON Output:

code-cost --format json-pretty

Export Results:

# CSV format
code-cost --export report.csv

# HTML format
code-cost --export report.html

# Markdown format
code-cost --export report.md

Custom Hourly Rate:

code-cost --hourly-rate 50000

Example Output

Detailed Mode (default):

πŸ” Code Cost Analyzer

β„Ή Analyzing: .
βœ“ Analysis completed

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Repository ┆ Lines      ┆ Files  ┆ Commits ┆ Est. Hours ┆ Total Cost (KRW) β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•ͺ════════════β•ͺ════════β•ͺ═════════β•ͺ════════════β•ͺ══════════════════║
β”‚ cli-tools  ┆       1658 ┆     20 ┆       4 ┆      237.2 ┆ β‚©   2,379,027    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ cli-tools

β„Ή Languages:
  β€’ Rust - 80.9% (1,342 lines, 15 files)
  β€’ Markdown - 11.9% (198 lines, 1 files)
  β€’ TOML - 6.2% (102 lines, 3 files)
  β€’ JSON - 1.0% (16 lines, 1 files)

β„Ή Project Metrics:
  β€’ Complexity Score: 2.84/5.0
  β€’ Maturity Score: 20.8%
  β€’ Code Quality: 34.1%
  β€’ Test Files: 0 (0.0%)

β„Ή AI Usage Analysis:
  β€’ Estimated AI Usage: 25.0%
  β€’ Indicators:
    - Consistent file size distribution
    - Use of modern programming languages

πŸ“Š Summary
  Total repositories: 1
  Total estimated hours: 237.2 hours
  Total estimated cost: β‚©2,379,027

With Developer Level Breakdown (--dev-levels):

β„Ή Developer Level Breakdown:
  β€’ Junior       β‚©  15,000/hr β†’ β‚©3,557,867
  β€’ Mid-level    β‚©  25,000/hr β†’ β‚©5,929,778
  β€’ Senior       β‚©  40,000/hr β†’ β‚©9,487,646
  β€’ Lead         β‚©  60,000/hr β†’ β‚©14,231,469
  β€’ Principal    β‚© 100,000/hr β†’ β‚©23,719,115

Value Calculation Algorithm

The tool uses a sophisticated algorithm to estimate code value:

  1. Base Calculation: Lines of code Γ· 20 (assumes 20 lines per hour)
  2. Language Weights: Different languages have different complexity multipliers
    • Rust: 1.5x
    • C++/C: 1.4x
    • Go: 1.3x
    • Java/C#/TypeScript: 1.2x
    • Python/Ruby: 1.1x
    • JavaScript: 1.0x
  3. Complexity Multiplier: Based on code complexity (1.0 - 2.0x)
  4. Maturity Bonus: Up to 30% extra for well-maintained projects (tests, docs, multiple contributors)
  5. Learning Time: Estimated time needed to learn the technologies used
  6. AI Usage Estimation: Analyzes code patterns to estimate AI-assisted development
    • Low comment ratio with high code quality
    • Consistent file size distribution
    • High complexity with comprehensive testing
    • Modern language usage (Rust, TypeScript, Go, etc.)
    • Strong test coverage
  7. Developer Level Rates: Market-based hourly rates for South Korea (2025)
    • Junior (1-3 years): β‚©15,000/hr
    • Mid-level (3-5 years): β‚©25,000/hr
    • Senior (5-10 years): β‚©40,000/hr
    • Lead (10+ years, team lead): β‚©60,000/hr
    • Principal (architect, senior engineer): β‚©100,000/hr

work-summary

Analyze git commit history and generate meaningful work activity summaries with time estimation and value calculation.

Features

  • Git Commit Analysis

    • Complete commit history with diff tracking
    • File change statistics per commit
    • Author and timestamp information
    • Language-specific change tracking
  • Hybrid Time Estimation

    • Time-gap based estimation (between commits)
    • Code change-based estimation (lines added/deleted with complexity)
    • Weighted average of both methods for accuracy
    • Configurable maximum session gap (4 hours default)
  • Work Pattern Analysis

    • Hourly commit distribution
    • Daily commit patterns (weekdays vs weekends)
    • Peak working hours identification
    • Commit frequency and active days tracking
  • Value Calculation

    • Developer level-based estimates (Junior to Principal)
    • Base hourly rate: β‚©10,030 (2025 Korean minimum wage)
    • Level multipliers matching code-cost tool
    • Complexity-adjusted value estimation
  • Contributor Statistics

    • Per-contributor commit counts
    • Lines added/deleted per contributor
    • Contribution percentage breakdown
    • Top contributors ranking
  • Date Filtering

    • Date range filters: --from, --to (YYYY-MM-DD)
    • Quick filters: --today, --week, --month
    • Commit count limit: --limit N
  • Multiple Output Modes

    • Simple mode: Basic summary with key metrics
    • Detail mode: Comprehensive analysis with all statistics
    • JSON export support
    • Multiple repository analysis

Installation

cargo install --path crates/work-summary

Or build from source:

cargo build --release --package work-summary

Usage

Basic Analysis (current directory, detailed mode):

work-summary

Simple Summary:

work-summary --simple

Analyze Recent Commits:

work-summary --limit 10

Date Range Filtering:

# Specific date range
work-summary --from 2025-01-01 --to 2025-01-31

# Quick filters
work-summary --today
work-summary --week
work-summary --month

Multiple Repositories:

work-summary ~/project1 ~/project2 ~/project3

Export Results:

work-summary --export summary.json --format json

Custom Hourly Rate:

work-summary --hourly-rate 15000

Example Output

Simple Mode:

Work Summary
v0.1.0

════════════════════════════════════════════════════════════
Total Summary
════════════════════════════════════════════════════════════

Repository: my-project
  Period: 2025-01-01 ~ 2025-01-31
  Commits: 42
  Estimated Hours: 105.5h
  Value (Mid-level): β‚©1,587,232

Detail Mode:

════════════════════════════════════════════════════════════════════════════════
Repository: my-project
════════════════════════════════════════════════════════════════════════════════

Basic Information
  Period: 2025-01-01 ~ 2025-01-31
  Total Commits: 42
  Contributors: 3
  Files Changed: 127
  Lines: +2,450 / -856
  Estimated Hours: 105.5h

Recent Commits
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Time             ┆ Author ┆ Message                                               ┆ Changes    β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•ͺ════════β•ͺ═══════════════════════════════════════════════════════β•ͺ════════════║
β”‚ 2025-01-31 18:30 ┆ Alice  ┆ feat: add new authentication module                   ┆ +452 / -23 β”‚
β”‚ 2025-01-31 15:20 ┆ Bob    ┆ fix: resolve memory leak in worker pool               ┆ +18 / -34  β”‚
β”‚ 2025-01-30 09:15 ┆ Alice  ┆ refactor: improve error handling                      ┆ +89 / -67  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Language Breakdown
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Language   ┆ Insertions ┆ Deletions ┆ Net Change ┆ %     β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•ͺ════════════β•ͺ═══════════β•ͺ════════════β•ͺ═══════║
β”‚ Rust       ┆ +1,840     ┆ -456      ┆ +1,384     ┆ 69.5% β”‚
β”‚ TypeScript ┆ +445       ┆ -289      ┆ +156       ┆ 22.2% β”‚
β”‚ Markdown   ┆ +165       ┆ -111      ┆ +54        ┆ 8.3%  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”˜

Top Contributors
β”Œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Name  ┆ Commits ┆ Insertions ┆ Deletions ┆ %      β”‚
β•žβ•β•β•β•β•β•β•β•ͺ═════════β•ͺ════════════β•ͺ═══════════β•ͺ════════║
β”‚ Alice ┆ 25      ┆ +1,520     ┆ -450      ┆ 59.5%  β”‚
β”‚ Bob   ┆ 12      ┆ +680       ┆ -289      ┆ 28.6%  β”‚
β”‚ Carol ┆ 5       ┆ +250       ┆ -117      ┆ 11.9%  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Work Patterns
  Peak Hours: 14:00, 15:00, 16:00
  Most Active Day: Wednesday
  Avg Commits/Day: 1.4
  Active Days: 30 / 31

Value Estimates
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Level        ┆ Multiplier ┆ Hourly Rate ┆ Total Value β”‚
β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•ͺ════════════β•ͺ═════════════β•ͺ═════════════║
β”‚ Junior       ┆ 1x         ┆ β‚©12,036     ┆ β‚©1,058,155  β”‚
β”‚ Mid-level ⭐ ┆ 1.5x       ┆ β‚©18,054     ┆ β‚©1,587,232  β”‚
β”‚ Senior       ┆ 2x         ┆ β‚©24,072     ┆ β‚©2,116,310  β”‚
β”‚ Lead         ┆ 2.5x       ┆ β‚©30,090     ┆ β‚©2,645,387  β”‚
β”‚ Principal    ┆ 3x         ┆ β‚©36,108     ┆ β‚©3,174,465  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Time Estimation Algorithm

The tool uses a hybrid approach combining two estimation methods:

  1. Time-Gap Method (60% weight)

    • Measures time between consecutive commits
    • Caps at 4 hours to avoid overnight/weekend gaps
    • Assumes continuous work within reasonable timeframes
  2. Code-Change Method (40% weight)

    • Estimates based on lines added/deleted
    • Applies language complexity multipliers (same as code-cost)
    • Adjusts for file change complexity (more files = higher complexity)
    • Base rate: 20 lines of code per hour
  3. Final Estimate

    • Weighted average of both methods
    • Provides balanced estimate considering both time and work volume
    • More accurate than either method alone

Use Cases

  • Freelancer invoicing: Calculate billable hours from git history
  • Project retrospectives: Understand team work patterns
  • Time tracking: Estimate time spent on projects retroactively
  • Team analytics: Analyze contributor activity and patterns
  • Work reports: Generate professional summaries of development work
  • Portfolio documentation: Showcase project effort and value

Project Structure

cli-tools/
β”œβ”€β”€ Cargo.toml              # Workspace configuration
β”œβ”€β”€ crates/
β”‚   β”œβ”€β”€ cli-core/           # Shared library for all tools
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ output/     # Output formatters (table, JSON, CSV, HTML, MD)
β”‚   β”‚   β”‚   β”œβ”€β”€ config/     # Configuration management
β”‚   β”‚   β”‚   └── ui/         # UI theming and colors
β”‚   β”œβ”€β”€ code-cost/          # Code value analyzer tool
β”‚   β”‚   └── src/
β”‚   β”‚       β”œβ”€β”€ analyzer/   # Repository analysis logic
β”‚   β”‚       β”œβ”€β”€ calculator/ # Cost calculation
β”‚   β”‚       β”œβ”€β”€ metrics/    # Code metrics collection
β”‚   β”‚       └── git/        # Git repository analysis
β”‚   └── work-summary/       # Git commit work summarizer
β”‚       └── src/
β”‚           β”œβ”€β”€ git/        # Commit history & diff analysis
β”‚           β”œβ”€β”€ analyzer/   # Work analysis & value calculation
β”‚           β”œβ”€β”€ patterns/   # Work pattern detection
β”‚           └── summary/    # Summary generation
└── README.md

Development

Prerequisites

  • Rust 1.75+ (2021 edition)
  • Cargo

Building

cargo build

Running Tests

cargo test

Adding a New Tool

  1. Create a new crate in crates/:

    cargo new crates/your-tool
  2. Add it to workspace in root Cargo.toml:

    [workspace]
    members = [
        "crates/cli-core",
        "crates/code-cost",
        "crates/your-tool",
    ]
  3. Use cli-core for common functionality:

    [dependencies]
    cli-core = { path = "../cli-core" }

Design Principles

  • Clean Architecture: Separation of concerns with clear module boundaries
  • Extensibility: Easy to add new tools and features
  • Maintainability: Consistent code style and well-documented
  • Performance: Efficient Rust implementation
  • User Experience: Beautiful terminal UI with colored output

License

MIT License - See LICENSE file for details

Author

CHANN

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

Useful enough for work, maybe?

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages