@andikhadian/tanjiro
v1.2.0
Published
π‘οΈ CLI tool yang powerful untuk menganalisis dan membandingkan perubahan code migration antara branch Git dengan output terstruktur dalam format CSV atau Markdown
Maintainers
Readme
π‘οΈ Tanjiro
Tanjiro adalah CLI tool yang powerful untuk menganalisis dan membandingkan perubahan code migration antara branch Git dengan output yang terstruktur dalam format CSV atau Markdown.
π Deskripsi Tools
Apa itu Tanjiro?
Tanjiro adalah tool command-line yang dirancang khusus untuk membantu developer dalam menganalisis perubahan kode antara branch Git. Tool ini menghasilkan laporan migration yang terstruktur, memudahkan tracking perubahan file, dan memberikan insight yang jelas tentang evolusi codebase.
Teknologi Utama
- TypeScript - Bahasa pemrograman utama
- Node.js - Runtime environment
- Commander.js - CLI framework
- Simple-git - Git operations
- Chalk - Terminal styling
- Ora - Loading spinners
- fs-extra - Enhanced file system operations
Fitur Utama
- π Perbandingan Branch: Analisis perubahan antara dua branch Git
- π Multiple Output Format: Mendukung CSV dan Markdown
- π― Format Tabel Terstruktur: Output sesuai standar migration table
- π Universal Compatibility: Dapat digunakan pada berbagai project Git
- π οΈ Easy Installation: Install global via npm atau gunakan npx
- π¨ Beautiful CLI: Interface user-friendly dengan colors dan progress indicators
- π Single Branch Analysis: Analisis perubahan pada branch tertentu
- π Real-time Git Integration: Integrasi langsung dengan Git repository
ποΈ Arsitektur Sistem
Struktur Project
tanjiro/
βββ src/
β βββ index.ts # Entry point aplikasi
β βββ cli.ts # CLI interface dan command handling
β βββ git-service.ts # Git operations dan repository management
β βββ migration-parser.ts # Data parsing dan transformation
β βββ output-formatter.ts # Output generation (CSV/Markdown)
β βββ error-handler.ts # Error handling utilities
β βββ types.ts # Type definitions
βββ dist/ # Compiled JavaScript output
βββ package.json # Package configuration
βββ tsconfig.json # TypeScript configuration
βββ README.md # DokumentasiKomponen Utama
1. CLI Interface (cli.ts)
- Menangani command-line arguments
- Mengatur routing command
- Menampilkan help dan usage information
- Mengelola user interaction
2. Git Service (git-service.ts)
- Validasi Git repository
- Branch operations (list, validate, compare)
- Git diff analysis
- File status tracking
3. Migration Parser (migration-parser.ts)
- Parsing Git diff output
- Transformasi data ke format migration
- File path processing
- Metadata extraction
4. Output Formatter (output-formatter.ts)
- Generate output dalam format CSV/Markdown
- Console table formatting
- File writing operations
- Template rendering
π¦ Dependensi
Production Dependencies
{
"commander": "^11.1.0", // CLI framework
"simple-git": "^3.20.0", // Git operations
"chalk": "^4.1.2", // Terminal colors
"ora": "^5.4.1", // Loading spinners
"fs-extra": "^11.1.1" // File system utilities
}Development Dependencies
{
"@types/node": "^20.8.0",
"@types/fs-extra": "^11.0.4",
"typescript": "^5.2.2",
"ts-node": "^10.9.1"
}System Requirements
- Node.js: >= 16.0.0
- Git: Installed dan accessible via command line
- Operating System: macOS, Linux, Windows
π Instalasi
Global Installation
npm install -g tanjiroMenggunakan npx (Tanpa Instalasi)
npx tanjiro <command>Verifikasi Instalasi
tanjiro --version
tanjiro --helpπ Petunjuk Penggunaan
Command Dasar
1. Membandingkan Branch
# Format dasar
tanjiro compare -f <branch-asal> -t <branch-tujuan>
# Contoh
tanjiro compare -f main -t develop
tanjiro compare -f feature/login -t develop2. Analisis Single Branch
# Melihat perubahan pada branch tertentu
tanjiro changes -b <branch-name>
# Contoh
tanjiro changes -b develop
tanjiro changes -b feature/user-management3. Output ke File
# Output Markdown (default)
tanjiro compare -f main -t develop -o migration-report.md
# Output CSV
tanjiro compare -f main -t develop --format csv -o migration-report.csv
tanjiro changes -b develop --format csv -o changes.csv4. Utility Commands
# Melihat daftar branch
tanjiro branches
# atau
tanjiro br
# Status repository
tanjiro status
# Bantuan
tanjiro help
tanjiro <command> --helpOptions Lengkap
| Option | Alias | Description | Default |
|--------|-------|-------------|---------|
| --from <branch> | -f | Branch asal untuk perbandingan | Required |
| --to <branch> | -t | Branch tujuan untuk perbandingan | Required |
| --branch <branch> | -b | Branch untuk analisis single branch | Required |
| --output <file> | -o | File output untuk menyimpan hasil | Optional |
| --format <format> | | Format output: csv atau markdown | markdown |
| --no-console | | Tidak menampilkan hasil di console | false |
Format Output
Tabel Migration
Output mengikuti format standar migration table:
| No | Library/Object | Type | Compile/Promote Date | Size (KBytes) | No | Library/Object | Type | Compile/Promote Date | Size (KBytes) | Remark | |----|----------------|------|----------------------|---------------|----|--------------------|------|----------------------|---------------|--------| | 1 | src/auth.ts | TS | 2024-01-15 | 2.45 | 1 | src/auth.ts | TS | 2024-01-15 | 2.67 | src |
Keterangan Remark
new: File baru yang ditambahkansrc: File yang dimodifikasiother: File yang dihapus atau status lainnya
π‘ Contoh Penggunaan
Scenario 1: Basic Comparison
# Membandingkan main dengan develop branch
tanjiro compare -f main -t developScenario 2: Export ke CSV untuk Deployment
# Generate CSV report untuk deployment tracking
tanjiro compare -f staging -t production --format csv -o deployment-migration.csvScenario 3: Feature Branch Analysis
# Analisis perubahan feature branch
tanjiro compare -f develop -t feature/user-management -o feature-analysis.mdScenario 4: Silent Mode
# Generate report tanpa output console
tanjiro compare -f main -t develop -o report.md --no-consoleScenario 5: Single Branch Changes
# Melihat semua perubahan pada branch develop
tanjiro changes -b develop --format csv -o develop-changes.csvπ§ Troubleshooting
Error: "Direktori ini bukan repository Git yang valid"
Solusi:
- Pastikan Anda berada di dalam direktori Git repository
- Jalankan
git statusuntuk memverifikasi - Inisialisasi Git repository jika belum ada:
git init
Error: "Branch tidak ditemukan"
Solusi:
- Gunakan
tanjiro branchesuntuk melihat daftar branch yang tersedia - Pastikan nama branch sudah benar (case-sensitive)
- Untuk remote branch, pastikan sudah di-fetch:
git fetch origin
Error: "Permission denied"
Solusi:
- Pastikan Anda memiliki akses read ke repository
- Check file permissions pada direktori project
- Untuk repository private, pastikan authentication sudah benar
Performance Issues
Solusi:
- Untuk repository besar, pertimbangkan untuk menggunakan
--no-consoleuntuk output yang lebih cepat - Pastikan Git repository dalam kondisi clean (tidak ada uncommitted changes yang banyak)
π Output Examples
Console Output
π Migration Report: main β develop
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| No | Library/Object | Type | Date | Size | No | Library/Object | Type | Date | Size | Remark |
|----|--------------------|----- -|------------|-------|----|--------------------|-------|------------|-------|--------|
| 1 | src/auth.service.ts | TS | 2024-01-15 | 2.45 | 1 | src/auth.service.ts | TS | 2024-01-15 | 2.67 | src |
| 2 | src/user.model.ts | TS | 2024-01-15 | 1.23 | 2 | src/user.model.ts | TS | 2024-01-15 | 1.23 | new |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Summary: 2 β 2 files (4 total changes)CSV Output
From: main
To: develop
No,Library / Object,Type,Compile / Promote Date,Size (KBytes),No,Library / Object,Type,Compile / Promote Date,Size (KBytes),Remark
1,"src/auth.service.ts",TS,2024-01-15,2.45,1,"src/auth.service.ts",TS,2024-01-15,2.67,src
2,"src/user.model.ts",TS,2024-01-15,1.23,2,"src/user.model.ts",TS,2024-01-15,1.23,newπ€ Kontribusi
Kami menyambut kontribusi dari komunitas! Silakan baca CONTRIBUTING.md untuk panduan lengkap tentang cara berkontribusi.
Quick Start untuk Kontributor
- Fork repository ini
- Clone fork Anda:
git clone <your-fork-url> - Install dependencies:
npm install - Buat branch feature:
git checkout -b feature/amazing-feature - Develop dan test perubahan Anda
- Commit:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Buat Pull Request
π License
MIT License - lihat file LICENSE untuk detail lengkap.
πββοΈ Support
Jika Anda mengalami masalah atau memiliki pertanyaan:
- Cek Issues yang sudah ada
- Buat issue baru jika diperlukan
- Sertakan informasi:
- Versi Node.js (
node --version) - Versi Tanjiro (
tanjiro --version) - Operating System
- Error message lengkap
- Steps to reproduce
- Versi Node.js (
π Roadmap
- [ ] Support untuk Git hooks integration
- [ ] Export ke format Excel
- [ ] Integration dengan CI/CD pipelines
- [ ] Web dashboard untuk visualisasi
- [ ] Support untuk multiple repository comparison
- [ ] Plugin system untuk custom formatters
- [ ] Configuration file support
- [ ] Advanced filtering options
π Changelog
v1.2.0
- β¨ Renamed from GitFlow Migrator to Tanjiro
- π Fixed file path prefix slash issue
- π Synchronized CLI version with package.json
- π Updated documentation and help text
v1.1.0
- β¨ Added
changescommand for single branch analysis - π Fixed output formatting issues
- π Improved console table display
v1.0.0
- π Initial release
- β¨ Basic branch comparison functionality
- π CSV and Markdown output support
- π¨ Beautiful CLI interface
Made with β€οΈ for developers who love clean migration reports
Tanjiro - Slicing through Git diffs with precision βοΈ
