jatin-lean
v1.0.0
Published
Universal System Optimization Platform with native N-API bindings - Enterprise-grade node_modules optimization, system tuning, and hardware-level performance features
Downloads
1,120
Maintainers
Readme
🚀 jatin-lean v1.0.0 - Universal System Optimization Platform
Enterprise-grade optimization platform with native Node.js bindings and professional CLI. Reduce disk footprint by up to 50% while leveraging hardware-level optimizations (io_uring, SIMD, eBPF) for unmatched performance.
🎯 What's New in v1.0.0
🔥 Native N-API Bindings
- Direct Rust ↔ JavaScript integration - No process spawning overhead
- 10-100x faster than CLI wrapper approach
- True async/await with native promises
- Zero-copy data transfer between Rust and Node.js
- Full TypeScript support with complete type definitions
🎨 Professional CLI Interface
- 41 commands organized into 6 categories
- Hierarchical structure -
jatin-lean <category> <command> - JSON output support for all commands
- Comprehensive help system with examples
📥 Installation
npm install -g jatin-leanRequirements:
- Node.js >= 14
- Rust toolchain (for building native bindings)
🚀 Quick Start
As a Node.js Library (NEW!)
const lean = require('jatin-lean');
async function optimize() {
// Scan node_modules
const scan = await lean.scanNodeModules('.');
console.log('Potential savings:', scan.savingsPercentage.toFixed(1), '%');
// Check project health
const health = await lean.checkHealth('.');
console.log('Health status:', health.overallHealth);
// Assess system performance
const system = await lean.assessSystem();
console.log('System score:', system.overallScore);
// Run benchmarks
const benchmarks = await lean.runBenchmarks();
benchmarks.forEach(b => {
console.log(`${b.name}: ${b.opsPerSec.toFixed(0)} ops/sec`);
});
}
optimize();As a CLI Tool
# Scan node_modules
jatin-lean node scan
# Run health check
jatin-lean node health
# System assessment
jatin-lean system assess
# Run benchmarks
jatin-lean bench simd📚 Node.js API Reference
Node Modules Optimization
// Scan for optimization opportunities
const scan = await lean.scanNodeModules(projectPath);
// Returns: { totalPackages, totalSize, potentialSavings, savingsPercentage, ... }
// Health check
const health = await lean.checkHealth(projectPath);
// Returns: { overallHealth, missingDeps, circularDeps, outdatedCount, securityIssues }
// Find duplicate files
const dedup = await lean.findDuplicates(projectPath);
// Returns: { duplicateGroups, totalDuplicates, wastedSpace, potentialSavings }
// Analyze compression potential
const compressionSavings = await lean.analyzeCompression(projectPath);
// Returns: number (percentage)
// Analyze tree-shaking potential
const treeshakeSavings = await lean.analyzeTreeshake(projectPath);
// Returns: number (percentage)
// Get dependency graph size
const depsCount = await lean.getDependencyGraph(projectPath);
// Returns: numberSystem Optimization
// Assess system performance
const assessment = await lean.assessSystem();
// Returns: { overallScore, cpuScore, memoryScore, ioScore, recommendations }
// Detect CPU capabilities
const cpuTier = await lean.detectCpuCapabilities();
// Returns: string (e.g., "AVX2 (256-bit)")
// Run benchmarks
const benchmarks = await lean.runBenchmarks();
// Returns: [{ name, meanNs, medianNs, minNs, maxNs, opsPerSec }, ...]Utility Functions
// Get version
const version = lean.getVersion();
// Returns: string
// Get AI-friendly context
const context = await lean.getAiContext();
// Returns: { tool, version, capabilities, systemInfo }🎨 CLI Command Reference
📦 Node.js Ecosystem (node)
jatin-lean node scan # Scan node_modules
jatin-lean node prune # Prune non-essential files
jatin-lean node health # Health check
jatin-lean node dedup # Find duplicates
jatin-lean node deps # Dependency graph
jatin-lean node compress # Compression analysis
jatin-lean node treeshake # Tree-shaking analysis
jatin-lean node audit # Package audit
jatin-lean node analyze # Project analysis
jatin-lean node watch # Watch for changes
jatin-lean node policy # Enforce policies
jatin-lean node visualize # Visual analysis🖥️ System Optimization (system)
jatin-lean system assess # System assessment
jatin-lean system cpu # CPU cache analysis
jatin-lean system memory # Memory info🛡️ Network Tools (network)
jatin-lean network xdp # XDP middleware
jatin-lean network bpf # BPF verifier
jatin-lean network maglev # Maglev hashing
jatin-lean network gateway # Unified gateway🧠 Memory Tools (memory)
jatin-lean memory ipc # IPC benchmarks
jatin-lean memory mmap # Memory mapping
jatin-lean memory arena # Arena allocator
jatin-lean memory pcie # PCIe profiling⚡ Benchmarks (bench)
jatin-lean bench all # All benchmarks
jatin-lean bench simd # SIMD benchmarks
jatin-lean bench json # JSON parsing
jatin-lean bench io-uring # Async I/O
jatin-lean bench hash # Hashing📊 Analysis (analyze)
jatin-lean analyze all # Full analysis
jatin-lean analyze deps # Dependencies
jatin-lean analyze size # Size analysis
jatin-lean analyze cache # Cache stats
jatin-lean analyze snapshots # Snapshot management✨ Key Features
| Feature | Description | Benefit | |---------|-------------|---------| | ⚡ Native Bindings | N-API integration with Rust | 10-100x faster than CLI wrappers | | 🖥️ io_uring I/O | Zero-syscall async I/O | 10x faster file operations | | 🧠 SIMD Optimization | AVX2/AVX-512 vectorization | 7x faster JSON parsing | | 🛡️ eBPF/XDP | Kernel-bypass networking | Line-rate packet processing | | 🔗 Zero-Copy IPC | mmap-backed shared memory | 102ns latency (490x faster) | | 🗑️ Smart Pruning | Category-based optimization | 30-50% disk space reduction |
🏆 Performance Benchmarks
| Metric | Traditional | jatin-lean | Improvement | |--------|-------------|------------|-------------| | File Stat | 120k/sec | 1.5M/sec | 12.5x | | IPC Latency | 50,000 ns | 102 ns | 490x | | JSON Parsing | 450 MB/s | 3.2 GB/s | 7x | | Memory Access | 250 ns | 1.4 ns | 178x | | API Calls | 5-50ms | <1ms | 50x |
🔧 TypeScript Support
Full TypeScript definitions included:
import * as lean from 'jatin-lean';
interface ScanResult {
totalPackages: number;
totalSize: number;
potentialSavings: number;
savingsPercentage: number;
candidatesCount: number;
}
const scan: ScanResult = await lean.scanNodeModules('.');📖 Use Cases
Build Optimization
// In your build script
const lean = require('jatin-lean');
async function optimizeBuild() {
const scan = await lean.scanNodeModules('.');
if (scan.savingsPercentage > 20) {
console.log(`⚠️ Can save ${scan.savingsPercentage.toFixed(1)}% disk space`);
}
}CI/CD Integration
// In your CI pipeline
const lean = require('jatin-lean');
async function checkHealth() {
const health = await lean.checkHealth('.');
if (health.securityIssues > 0) {
throw new Error(`Found ${health.securityIssues} security issues`);
}
}Performance Monitoring
// Monitor system performance
const lean = require('jatin-lean');
async function monitor() {
const system = await lean.assessSystem();
console.log('System Performance:', system.overallScore);
if (system.overallScore < 70) {
console.log('Recommendations:', system.recommendations);
}
}🛠️ Development
Build from Source
# Clone repository
git clone https://github.com/decodejatin/jatin-lean.git
cd jatin-lean
# Build native bindings
./build.sh
# Run tests
npm test
# Build CLI
cargo build --releaseRun Tests
# Node.js API tests
npm test
# Rust tests
cargo test
# Integration tests
cargo test --features integration📊 System Requirements
- OS: Linux, macOS, Windows
- Node.js: >= 14
- Rust: >= 1.70 (for building)
- CPU: x86_64 or ARM64
- Optional: SIMD support (AVX2/AVX-512) for maximum performance
🤝 Contributing
Contributions welcome! See DEVELOPER.md for guidelines.
📄 License
MIT © Jatin Jalandhra
🔗 Links
- GitHub: https://github.com/decodejatin/jatin-lean
- npm: https://www.npmjs.com/package/jatin-lean
- Issues: https://github.com/decodejatin/jatin-lean/issues
- Documentation: DOCUMENTATION.md
Built with ❤️ using Rust and N-API
