Skip to content

Latest commit

Β 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Claude CLI Code Generation Analyzer

A comprehensive Java application that analyzes Claude CLI code generation sessions and produces detailed Excel reports. This tool helps developers track their productivity, understand their coding patterns, and generate professional reports from Claude CLI transcript data.

Features

  • Comprehensive Analysis: Analyzes Claude CLI session transcripts (.jsonl files)
  • Multi-format Output: Generates detailed Excel reports with 5 different sheets
  • Language Detection: Supports 40+ programming languages with intelligent detection
  • Flexible Date Filtering: Analyze specific dates, date ranges, or all sessions
  • Professional Console Output: Colored terminal output with progress indicators
  • Code Metrics: Line counting, language distribution, and productivity statistics
  • Standalone JAR: No external dependencies required for execution

Requirements

  • Java 17 or higher
  • Maven 3.6+ (for building from source)

Platform Support

This application is fully cross-platform and supports:

  • Windows (Windows 10/11, Windows Server)
  • macOS (Intel and Apple Silicon)
  • Linux (Ubuntu, Fedora, CentOS, Debian, etc.)

Platform-Specific Features

  • Smart color detection: Automatically detects terminal color support
  • Unicode symbols: Falls back to ASCII symbols on legacy systems
  • Path handling: Uses Java NIO for platform-independent file operations
  • Build scripts: Includes both build.sh (Unix/Linux/macOS) and build.bat (Windows)

Quick Start

Download and Run

  1. Download the latest claude-analyzer-1.0.0.jar from releases
  2. Run with default settings:
    java -jar claude-analyzer-1.0.0.jar

Build from Source

Using Build Scripts (Recommended)

Windows:

build.bat

Unix/Linux/macOS:

./build.sh

Manual Build

# Clone the repository
git clone <repository-url>
cd claude-analyzer

# Build the project
mvn clean package

# Run the application
java -jar target/claude-analyzer-1.0.0.jar

Usage

Command Line Options

Usage: java -jar claude-analyzer.jar [options] [date]

Options:
  --help, -h           Show help message and exit
  --version, -v        Show version information and exit
  --yesterday          Analyze yesterday's sessions
  --week               Analyze this week's sessions (Monday to today)
  --month              Analyze this month's sessions (1st to today)
  --all                Analyze all available sessions
  --projects-dir DIR   Path to Claude projects directory
                       (default: ~/.claude/projects)
  --output FILE, -o    Output Excel file path
                       (default: ~/claude_analysis_report_YYYYMMDD_HHMMSS.xlsx)
  --no-color           Disable colored console output

Arguments:
  [DATE]               Analyze specific date in YYYY-MM-DD format
                       (default: today)

Command Examples

Basic Usage

# Analyze today's sessions (default behavior)
java -jar claude-analyzer.jar

# Show help information
java -jar claude-analyzer.jar --help

# Show version information
java -jar claude-analyzer.jar --version

Date-Based Analysis

# Analyze a specific date
java -jar claude-analyzer.jar 2025-08-18

# Analyze yesterday's sessions
java -jar claude-analyzer.jar --yesterday

# Analyze this week's sessions (Monday to today)
java -jar claude-analyzer.jar --week

# Analyze this month's sessions (1st of month to today)
java -jar claude-analyzer.jar --month

# Analyze all available sessions (complete history)
java -jar claude-analyzer.jar --all

Custom Output Options

# Save report with custom filename
java -jar claude-analyzer.jar --output my_analysis.xlsx

# Weekly report with custom name
java -jar claude-analyzer.jar --week --output weekly_report.xlsx

# All-time analysis with descriptive filename
java -jar claude-analyzer.jar --all --output complete_history_analysis.xlsx

# Daily report in specific directory
java -jar claude-analyzer.jar --output /path/to/reports/daily_$(date +%Y%m%d).xlsx

Custom Projects Directory

# Analyze from custom Claude projects directory
java -jar claude-analyzer.jar --projects-dir /custom/path/to/projects

# Combine with other options
java -jar claude-analyzer.jar --all --projects-dir /backup/claude/projects --output backup_analysis.xlsx

# Analyze different user's projects (if accessible)
java -jar claude-analyzer.jar --projects-dir /Users/otheruser/.claude/projects

Console Output Control

# Disable colored output (for scripts or legacy terminals)
java -jar claude-analyzer.jar --no-color

# Combine with file output
java -jar claude-analyzer.jar --all --no-color --output plain_report.xlsx

# Redirect console output to file
java -jar claude-analyzer.jar --no-color > console_output.txt

Advanced Combinations

# Weekly analysis with custom directory and output
java -jar claude-analyzer.jar --week \
  --projects-dir /path/to/projects \
  --output reports/week_$(date +%Y%U).xlsx \
  --no-color

# Specific date with custom settings
java -jar claude-analyzer.jar 2025-08-15 \
  --output analysis_20250815.xlsx \
  --projects-dir ~/.claude/projects

# All-time analysis for reporting
java -jar claude-analyzer.jar --all \
  --output "Complete_Analysis_$(date +%Y%m%d_%H%M%S).xlsx" \
  --no-color

Automation and Scripting

# Daily automated report (cron job example)
java -jar claude-analyzer.jar --output daily_$(date +%Y%m%d).xlsx

# Weekly report every Monday
java -jar claude-analyzer.jar --week --output weekly_$(date +%Y_W%U).xlsx

# Monthly report on 1st of each month
java -jar claude-analyzer.jar --month --output monthly_$(date +%Y%m).xlsx

# Check specific date with error handling
java -jar claude-analyzer.jar 2025-08-18 || echo "Analysis failed for 2025-08-18"

Cross-Platform Examples

Windows (Command Prompt):

java -jar claude-analyzer.jar --all --output "C:\Reports\analysis.xlsx"
java -jar claude-analyzer.jar --projects-dir "C:\Users\%USERNAME%\.claude\projects"

Windows (PowerShell):

java -jar claude-analyzer.jar --output "analysis_$(Get-Date -Format 'yyyyMMdd').xlsx"
java -jar claude-analyzer.jar --week --no-color | Tee-Object weekly_log.txt

macOS/Linux:

java -jar claude-analyzer.jar --output ~/Desktop/analysis_$(date +%Y%m%d).xlsx
java -jar claude-analyzer.jar --all --projects-dir ~/.claude/projects

Report Output

Console Output

The application provides real-time colored console output showing:

πŸ” Scanning projects directory: ~/.claude/projects
  πŸ“ Scanning project: my-web-app
    βœ… Session abc123: 45 lines, 3 created, 2 modified
  πŸ“ Scanning project: data-analysis
    βœ… Session def456: 23 lines, 1 created, 0 modified

πŸ“Š EXECUTIVE SUMMARY
──────────────────────────────────────────────────
Total Sessions:      2
Total Lines:         68
Total Files:         6
Files Created:       4
Files Modified:      2
Projects Worked On:  2
Avg Session Time:    12.5 minutes
Lines per Session:   34.0
Files per Session:   3.0
Created per Session: 2.0
Modified per Session: 1.0

πŸ”€ LANGUAGE BREAKDOWN
──────────────────────────────────────────────────
Language             Files    % of Total  
────────────────────────────────────────
Python               2        50.0%
JavaScript           1        25.0%
HTML                 1        25.0%

βœ… Analysis complete! Excel report saved to: claude_analysis_report_20250818_143501.xlsx

Excel Report Structure

The generated Excel workbook contains 5 comprehensive sheets with enhanced file operation tracking:

1. Summary Sheet

  • Report Type: Daily Analysis, Weekly Analysis, All-Time Analysis, etc.
  • Date Range: Specific dates or ranges analyzed
  • Executive Metrics:
    • Total Sessions, Lines, Files (Created + Modified)
    • Files Created vs Files Modified breakdown
    • Projects Worked On
    • Average session duration and productivity metrics
    • Per-session averages for all metrics

2. Session Details Sheet

Complete session-by-session breakdown with columns:

  • Date, Project, Session ID, Duration (minutes)
  • Total Lines, Code Lines, Comment Lines, Blank Lines
  • Files Created, Files Modified (separate tracking)
  • Primary Language, All Languages

3. Daily Summary Sheet

Day-by-day activity tracking with columns:

  • Date, Sessions, Lines Generated
  • Files Created, Files Modified (separate tracking)

4. Project Summary Sheet

Project-level aggregated data with columns:

  • Project Name, Sessions, Total Lines, Total Files
  • Files Created, Files Modified (separate tracking)
  • Top Language, All Languages

5. Language Breakdown Sheet

Programming language statistics with columns:

  • Language, Files, Percentage, Estimated Lines

Output File Naming

Default Behavior (Timestamped):

  • claude_analysis_report_20250818_143501.xlsx
  • Format: claude_analysis_report_YYYYMMDD_HHMMSS.xlsx
  • Prevents overwriting previous reports

Custom Output:

  • Use --output filename.xlsx for specific names
  • Supports full paths: --output /path/to/reports/analysis.xlsx

Report Type Examples:

  • Daily: claude_analysis_report_20250818_143501.xlsx
  • Weekly: Custom naming recommended: weekly_2025_W33.xlsx
  • Monthly: Custom naming recommended: monthly_202508.xlsx
  • All-time: Custom naming recommended: complete_history.xlsx

Supported Languages

The analyzer detects 40+ programming languages including:

Web Technologies: JavaScript, TypeScript, React JSX/TSX, Vue.js, Svelte, HTML, CSS, SCSS

Backend Languages: Java, Python, C++, C, C#, PHP, Ruby, Go, Rust, Swift, Kotlin, Scala

Mobile Development: Dart, Objective-C, Swift, Kotlin

Scripting: Shell, Bash, PowerShell, Perl, Lua

Data Formats: JSON, XML, YAML, SQL, CSV

Documentation: Markdown, reStructuredText

Scientific: R, MATLAB

And many more...

Console Output Example

================================================================================
Claude CLI Code Generation Analyzer v1.0.0
================================================================================
πŸ” Scanning projects directory: /Users/user/.claude/projects
  πŸ“ Scanning project: my-web-app
    βœ… Session abc123: 45 lines, 3 files
  πŸ“ Scanning project: data-analysis
    βœ… Session def456: 23 lines, 1 files

================================================================================
Claude CLI Analysis - Today (2025-08-18)
================================================================================

πŸ“Š EXECUTIVE SUMMARY
──────────────────────────────────────────────────
Total Sessions:     2
Total Lines:        68
Total Files:        4
Projects Worked On: 2
Avg Session Time:   12.5 minutes
Lines per Session:  34.0
Files per Session:  2.0

πŸ”€ LANGUAGE BREAKDOWN
──────────────────────────────────────────────────
Language             Files    % of Total
────────────────────────────────────────
Python               2        50.0%
JavaScript           1        25.0%
HTML                 1        25.0%

βœ… Analysis complete! Excel report saved to: ~/claude_analysis_report.xlsx

Project Structure

claude-analyzer/
β”œβ”€β”€ pom.xml                           # Maven configuration
β”œβ”€β”€ README.md                         # This file
β”œβ”€β”€ src/
β”‚   └── main/
β”‚       β”œβ”€β”€ java/
β”‚       β”‚   └── com/claude/analyzer/
β”‚       β”‚       β”œβ”€β”€ ClaudeAnalyzer.java      # Main class
β”‚       β”‚       β”œβ”€β”€ model/                   # Data models
β”‚       β”‚       β”œβ”€β”€ service/                 # Core services
β”‚       β”‚       β”œβ”€β”€ util/                    # Utility classes
β”‚       β”‚       └── export/                  # Excel export
β”‚       └── resources/
β”‚           └── META-INF/
β”‚               └── MANIFEST.MF      # JAR manifest
└── target/
    └── claude-analyzer-1.0.0.jar   # Built executable

Architecture

Core Components

  • ClaudeAnalyzer: Main entry point and CLI argument parsing
  • ClaudeProjectScanner: Scans and parses Claude CLI transcript files
  • LanguageDetector: Intelligent language detection based on file extensions and content
  • CodeAnalyzer: Analyzes code content for line counting and metrics
  • ExcelExporter: Generates comprehensive Excel reports
  • ReportGenerator: Creates formatted console output

Data Flow

  1. Input: Claude CLI transcript files (.jsonl format)
  2. Parsing: Extract Write/Edit operations from JSON transcripts
  3. Analysis: Language detection, line counting, session metrics
  4. Aggregation: Calculate summaries by date, project, and language
  5. Output: Console report + Excel workbook

Configuration

Default Paths

  • Projects Directory: ~/.claude/projects
  • Output File: ~/claude_analysis_report.xlsx

Environment Variables

The application respects standard Java system properties and can be configured using JVM arguments:

java -Duser.home=/custom/path -jar claude-analyzer.jar

Error Handling

The application gracefully handles:

  • Missing or inaccessible project directories
  • Corrupted or malformed JSON transcript files
  • Network or file system permissions issues
  • Invalid command-line arguments

Warning messages are displayed for skipped files, while the analysis continues with available data.

Performance

  • Memory Efficient: Streaming JSON parsing for large transcript files
  • Fast Processing: Optimized for projects with 1000+ session files
  • Large File Support: Handles transcript files up to 100MB+
  • Concurrent Processing: Parallel project scanning where possible

Troubleshooting

Common Issues

Error: "Projects directory does not exist"

  • Verify the path to your Claude projects directory
  • Use --projects-dir to specify a custom path

Error: "No sessions found"

  • Check that .jsonl transcript files exist in the projects directory
  • Verify the date filter matches your session dates

Excel file not generated

  • Ensure write permissions in the output directory
  • Check available disk space

Debugging

Enable verbose output by running with debug flags:

java -Xdebug -jar claude-analyzer.jar

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-feature
  3. Commit changes: git commit -am 'Add new feature'
  4. Push to the branch: git push origin feature/new-feature
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Version History

v1.0.0 (2025-08-18)

  • Initial release
  • Complete Claude CLI transcript analysis
  • Excel report generation with 5 sheets
  • Support for 40+ programming languages
  • Command-line interface with flexible date filtering
  • Colored console output
  • Standalone JAR distribution

Support

For issues, questions, or feature requests, please open an issue on the GitHub repository.


Built with ❀️ for the Claude CLI community

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages