
# RARN - Universal Package Manager

> 🚀 A revolutionary package manager that combines the best features of Yarn and Conda

[![npm version](https://img.shields.io/npm/v/rarn.svg)](https://www.npmjs.com/package/rarn)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

RARN is a next-generation package manager designed to handle multi-language projects seamlessly. It brings together the speed and reliability of Yarn with the powerful environment management capabilities of Conda.

## ✨ Features

### From Yarn
- **Lock files** for reproducible installs
- **Workspace/Monorepo support** for large projects
- **Offline mode** with intelligent caching
- **Parallel installation** for blazing fast performance
- **Plugin system** for extensibility
- **Zero-installs** capability

### From Conda
- **Virtual environment management**
- **Cross-platform binary packages**
- **Multi-language support** (JavaScript, Python, C++, R, etc.)
- **Advanced dependency resolver** with SAT solving
- **Binary relocation** for compiled packages
- **Channel/repository management**

## 🚀 Quick Start

### Installation

```bash
npm install -g rarn
# or
yarn global add rarn
```

### Basic Usage

```bash
# Initialize a new project
rarn init

# Install packages
rarn install express pandas numpy
rarn add react@18 tensorflow python:scikit-learn

# Create and activate environments
rarn env create ml-project --language python javascript
rarn env activate ml-project

# Workspace management
rarn workspace init
rarn workspace run build
```

## 📦 Package Specification

RARN supports multiple package formats:

```bash
# JavaScript packages (from npm)
rarn install express react vue

# Python packages (prefix with python:)
rarn install python:numpy python:pandas python:tensorflow

# Language-specific versions
rarn install react@18.0.0 python:numpy@1.24.0

# Git repositories
rarn install git+https://github.com/user/repo.git
```

## 🌍 Environment Management

RARN provides full environment isolation with shell integration, similar to Conda:

```bash
# Create environment with specific languages
rarn env create myapp --language javascript python

# Activate environment (shows activation instructions)
rarn env activate myapp

# Or activate directly in your shell with eval
eval "$(rarn env activate myapp --print)"

# Your prompt will show the active environment
(myapp) $ npm install express  # Installs to myapp environment
(myapp) $ rarn install python:requests  # Uses myapp's Python venv

# Deactivate environment
rarn_deactivate

# List all environments
rarn env list

# Remove environment
rarn env remove myapp
```

### Environment Features (v1.1.0+)
- **Shell Integration**: Full prompt modification and PATH management
- **Package Isolation**: Each environment has its own node_modules and Python site-packages
- **Python Virtual Environments**: Automatic Python venv creation with pip
- **Multi-Shell Support**: Works with bash, zsh, fish, cmd, and PowerShell
- **Auto-detection**: Install commands automatically use the active environment

## 📁 Project Configuration

### package.json

```json
{
  "name": "my-universal-project",
  "version": "1.0.0",
  "dependencies": {
    "express": "^4.18.0",
    "react": "^18.0.0",
    "numpy": "python:^1.24.0",
    "pandas": "python:^2.0.0"
  },
  "rarn": {
    "environments": {
      "production": {
        "languages": ["javascript", "python"],
        "pythonVersion": "3.10"
      }
    }
  }
}
```

### rarn-workspace.json

```json
{
  "version": "1.0.0",
  "packages": [
    "packages/*",
    "apps/*"
  ],
  "nohoist": [
    "**/react-native"
  ]
}
```

## 🔧 Commands

### Package Management
- `rarn install [packages...]` - Install packages
- `rarn add <packages...>` - Add packages to project
- `rarn remove <packages...>` - Remove packages
- `rarn update [packages...]` - Update packages
- `rarn list` - List installed packages
- `rarn info <package>` - Show package information

### Environment Management
- `rarn env create <name>` - Create new environment with language support
- `rarn env activate <name>` - Show activation instructions for environment
- `rarn env activate <name> --print` - Print activation script for eval
- `rarn env list` - List all environments
- `rarn env remove <name>` - Remove environment

### Workspace Management
- `rarn workspace init` - Initialize workspace
- `rarn workspace list` - List workspace packages
- `rarn workspace run <script>` - Run script in all packages

### Other Commands
- `rarn init` - Initialize new project
- `rarn run <script>` - Run project script
- `rarn cache clean` - Clean cache
- `rarn audit` - Security audit
- `rarn why <package>` - Show why a package is installed
- `rarn outdated` - Check for outdated packages
- `rarn doctor` - Check system for potential problems
- `rarn config get/set` - Manage configuration

## 🔌 Plugin System

RARN supports plugins for extended functionality:

```javascript
// my-plugin.js
module.exports = {
  name: 'my-plugin',
  version: '1.0.0',
  hooks: {
    beforeInstall: async (packages, context) => {
      console.log('Installing:', packages);
    }
  },
  commands: [{
    name: 'hello',
    description: 'Say hello',
    handler: async (args, context) => {
      console.log('Hello from plugin!');
    }
  }]
};
```

Install plugins:

```bash
rarn plugin add ./my-plugin.js
rarn plugin list
```

## 🏗️ Architecture

```
rarn/
├── src/
│   ├── core/           # Core package manager logic
│   ├── plugins/        # Plugin system
│   └── cli/            # Command-line interface
├── examples/           # Example configurations
├── bin/                # Executable files
└── package.json
```

## 🤝 Contributing

Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.

## 📄 License

MIT License - see [LICENSE](LICENSE) for details.

## 🙏 Acknowledgments

- Inspired by [Yarn](https://yarnpkg.com/) and [Conda](https://conda.io/)
- Built with TypeScript and Node.js
- Special thanks to all contributors

---

**Note**: This is a conceptual implementation demonstrating the architecture and features of a universal package manager. Full production implementation would require additional work on registry integration, binary package handling, and platform-specific optimizations.