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
Markdown
# 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