UNPKG

gitlify

Version:

A powerful CLI tool to analyze uncommitted git changes with detailed reports, function detection, and beautiful terminal output

204 lines (157 loc) โ€ข 5.05 kB
# GitLify ๐Ÿ“ A powerful CLI tool to analyze uncommitted git changes with detailed reports, function detection, and beautiful terminal output. ## โœจ Features - ๐Ÿ” **Git Analysis**: Detect uncommitted changes in your repository - ๐Ÿ“Š **Detailed Reports**: Show additions, deletions, and change statistics - ๐Ÿงฌ **Function Detection**: Identify which functions contain changes - ๐ŸŽจ **Beautiful Output**: Colorful terminal output with emojis and formatting - ๐Ÿ“ˆ **Summary Statistics**: Total files, lines added/removed, and most changed files - ๐Ÿ”ง **Multiple Formats**: JSON, files-only, summary-only, and verbose modes ## ๐Ÿš€ Quick Start ### Installation ```bash npm install gitlify ``` ### Basic Usage ```bash npx gitlify ``` ### Example Output ``` ๐Ÿ“ src/utils/math.ts โž• 12 additions โž– 3 deletions ๐Ÿ“Œ Changed in: calculateSum() ๐Ÿ“ src/index.ts โž• 5 additions ๐Ÿ“Œ Changed in: main() ๐Ÿงพ Summary: - Total files changed: 2 - Total lines added: 17 - Total lines removed: 3 ``` ## ๐Ÿ“‹ CLI Options | Option | Short | Description | |--------|-------|-------------| | `--verbose` | `-v` | Show detailed output with line numbers | | `--json` | `-j` | Output in JSON format | | `--files` | `-f` | Show only file list | | `--summary` | `-s` | Show only summary | | `--help` | `-h` | Show help message | ## ๐ŸŽฏ Usage Examples ### Basic Analysis ```bash npx gitlify ``` ### Verbose Mode (with line numbers) ```bash npx gitlify --verbose ``` ### JSON Output ```bash npx gitlify --json ``` ### Files Only ```bash npx gitlify --files ``` ### Summary Only ```bash npx gitlify --summary ``` ## ๐Ÿ—๏ธ Architecture GitLify is built with a modular architecture: - **GitAnalyzer**: Handles git commands and repository analysis - **DiffParser**: Parses git diff output and extracts file changes - **CodeAnalyzer**: Detects functions and methods in changed code - **Formatter**: Creates beautiful terminal output with colors and formatting - **InputValidator**: Security validation for file paths and inputs - **ErrorHandler**: Custom error handling with security considerations - **Cache**: Performance optimization with TTL-based caching - **ProgressReporter**: Real-time progress reporting with ETA - **Config**: Centralized configuration management ## ๐Ÿ“ฆ Package Structure ``` gitlify/ โ”œโ”€โ”€ bin/ โ”‚ โ””โ”€โ”€ gitlify.js # CLI entry point โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ index.js # Main GitLify class โ”‚ โ”œโ”€โ”€ git-analyzer.js # Git repository analysis โ”‚ โ”œโ”€โ”€ diff-parser.js # Git diff parsing โ”‚ โ”œโ”€โ”€ code-analyzer.js # Function detection โ”‚ โ”œโ”€โ”€ formatter.js # Output formatting โ”‚ โ”œโ”€โ”€ config.js # Configuration management โ”‚ โ””โ”€โ”€ utils/ โ”‚ โ”œโ”€โ”€ validator.js # Input validation โ”‚ โ”œโ”€โ”€ error-handler.js # Error handling โ”‚ โ”œโ”€โ”€ cache.js # Caching system โ”‚ โ””โ”€โ”€ progress.js # Progress reporting โ””โ”€โ”€ package.json ``` ## ๐Ÿ”ง Supported File Types GitDiffers can detect functions in: - JavaScript (`.js`) - TypeScript (`.ts`) - React JSX (`.jsx`) - React TSX (`.tsx`) ## ๐ŸŽจ Output Formats ### Standard Output - File paths with emoji icons - Addition/deletion counts with colored indicators - Function names where changes occurred - Summary statistics ### Verbose Output - All standard output features - Line number ranges for changes - More detailed information ### JSON Output ```json { "files": [ { "filePath": "src/utils/math.ts", "totalAdditions": 12, "totalDeletions": 3, "changedFunctions": ["calculateSum"], "changedLines": 15 } ], "summary": { "totalFiles": 1, "totalAdditions": 12, "totalDeletions": 3 } } ``` ## ๐Ÿš€ Development ### Prerequisites - Node.js 14.0.0 or higher - Git repository ### Setup ```bash git clone <repository> cd gitlify npm install ``` ### Security Features - โœ… Path traversal protection - โœ… Command injection prevention - โœ… Input validation - โœ… Secure error handling - โœ… File size limits - โœ… Concurrent processing limits ## ๐Ÿค Contributing 1. Fork the repository 2. Create your feature branch (`git checkout -b feature/amazing-feature`) 3. Commit your changes (`git commit -m 'Add some amazing feature'`) 4. Push to the branch (`git push origin feature/amazing-feature`) 5. Open a Pull Request ## ๐Ÿ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## ๐Ÿ™ Acknowledgments - Built with [termcolorized](https://www.npmjs.com/package/termcolorized) for beautiful terminal output - Inspired by the need for better git change analysis tools - Designed for developer productivity and code review workflows --- Made with โค๏ธ for the developer community