Metadata-Version: 2.4
Name: ailang-cli
Version: 1.0.1
Summary: AI-Native Programming Language - Write code in natural language
Home-page: https://github.com/rulhaq/ailang
Author: AILang Contributors
Maintainer: AILang Contributors
License: MIT
Project-URL: Homepage, https://github.com/rulhaq/ailang
Project-URL: Documentation, https://github.com/rulhaq/ailang#documentation
Project-URL: Repository, https://github.com/rulhaq/ailang
Project-URL: Issues, https://github.com/rulhaq/ailang/issues
Keywords: ai,programming,natural-language,compiler,llm,ollama,iot,multilingual
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Compilers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Natural Language :: English
Classifier: Natural Language :: Spanish
Classifier: Natural Language :: Arabic
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: black>=22.0; extra == "dev"
Requires-Dist: flake8>=4.0; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"
Provides-Extra: iot
Requires-Dist: RPi.GPIO>=0.7.1; extra == "iot"
Requires-Dist: adafruit-circuitpython-dht>=3.7.0; extra == "iot"
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# AILang - AI-Native Programming Language

**Write code in your native language. English, Spanish, Arabic, Chinese - the compiler understands them all.**

[![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://github.com/rulhaq/ailang)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Python](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org)

## 🌟 What is AILang?

AILang is a revolutionary programming language where you write code in plain natural language. No syntax to memorize, no semicolons, no curly braces - just describe what you want in English, Spanish, Arabic, or any other language, and the AI compiler executes it.

**Traditional Programming:**
```javascript
function toggleLight(pin) {
  const GPIO = require('rpi-gpio');
  GPIO.setup(pin, GPIO.DIR_OUT);
  GPIO.write(pin, true);
}
```

**AILang Programming (English):**
```
Turn on the light connected to GPIO pin 17
```

**AILang Programming (Arabic):**
```
شغل الضوء المتصل بمنفذ GPIO رقم ١٧
```

## 🚀 Quick Start

### Installation

**Linux/Mac:**
```bash
curl -fsSL https://raw.githubusercontent.com/rulhaq/ailang/main/install.sh | bash
```

**Windows (PowerShell as Admin):**
```powershell
iwr -useb https://raw.githubusercontent.com/rulhaq/ailang/main/install.ps1 | iex
```

**Or install via pip:**
```bash
pip install ailang-cli
```

### Your First Program

1. **Create a new project:**
```bash
ailang new my-first-app
cd my-first-app
```

2. **Edit `src/main.en`:**
```
Create a button in the center that says "Click Me!". 
When clicked, show an alert saying "Hello from AILang!"
```

3. **Compile and run:**
```bash
ailang compile src/main.en
```

Your browser opens with your running app! 🎉

## 📚 Features

### ✅ Multi-Language Support

Write code in **any natural language** - the file extension determines the language:

- `.en` - English
- `.es` - Spanish (Español)
- `.ar` - Arabic (العربية)
- `.fr` - French (Français)
- `.de` - German (Deutsch)
- `.zh` - Chinese (中文)
- `.ja` - Japanese (日本語)
- `.hi` - Hindi (हिन्दी)
- `.pt` - Portuguese (Português)
- `.ru` - Russian (Русский)

### ✅ Multiple Target Platforms

Compile to different platforms:

```bash
# Web applications (HTML/CSS/JS)
ailang compile app.en --target web

# Python scripts
ailang compile script.en --target python

# IoT/Raspberry Pi
ailang compile iot-device.en --target iot

# Mobile apps (coming soon)
ailang compile mobile.en --target mobile
```

### ✅ Local LLM Support

**No cloud required!** AILang works with local LLMs:

- **Ollama** (Recommended) - Run models locally
- **llama.cpp** - Lightweight C++ inference
- **Cloud APIs** - Claude, GPT-4 (optional)

### ✅ IoT & Hardware Support

Control real hardware with natural language:

```
Read temperature from sensor on pin 4.
If temperature exceeds 30 degrees, turn on fan.
Send notification to my phone.
```

Supports:
- Raspberry Pi GPIO
- Arduino (via serial)
- Sensors (DHT22, BMP280, etc.)
- Actuators, relays, motors
- Network communication

## 🛠️ Installation & Setup

### Prerequisites

- **Python 3.8+** (required)
- **Ollama** (recommended for local LLM) or Cloud API keys

### Detailed Installation

#### 1. Install AILang

**Via curl (Linux/Mac):**
```bash
curl -fsSL https://raw.githubusercontent.com/rulhaq/ailang/main/install.sh | bash
```

**Via PowerShell (Windows):**
```powershell
iwr -useb https://raw.githubusercontent.com/rulhaq/ailang/main/install.ps1 | iex
```

**Via pip:**
```bash
pip install ailang-cli
```

**From source:**
```bash
git clone https://github.com/rulhaq/ailang.git
cd ailang
pip install -e .
```

#### 2. Choose Your LLM Backend

**Option A: Local LLM (Recommended - Free & Private)**

Install Ollama:
```bash
# Mac
brew install ollama

# Linux
curl -fsSL https://ollama.ai/install.sh | sh

# Windows
# Download from https://ollama.ai
```

Pull a model:
```bash
ollama pull llama3.2
# or
ollama pull codellama
```

Configure AILang:
```bash
ailang setup -i
# Select: 1 (Ollama)
# Model: llama3.2
```

**Option B: Cloud APIs**

```bash
ailang config set llm_backend anthropic
ailang config set anthropic_api_key YOUR_API_KEY
```

#### 3. Verify Installation

```bash
ailang --version
# AILang 1.0.0
```

## 📖 Usage Guide

### Command Line Interface

```bash
# Create new project
ailang new <project-name> [-l <language>]

# Compile source file
ailang compile <file> [-o output] [-t target] [--no-open]

# Configuration
ailang config get [key]
ailang config set <key> <value>
ailang config list

# Setup wizard
ailang setup -i
```

### Project Structure

```
myproject/
├── src/
│   ├── main.en          # Main source file
│   ├── components.en    # Reusable components
│   └── utils.es         # Spanish utilities
├── build/               # Compiled output
├── ailang.json          # Project configuration
└── README.md
```

### Configuration File (ailang.json)

```json
{
  "name": "myproject",
  "version": "1.0.0",
  "language": "en",
  "target": "web",
  "entry": "src/main.en",
  "output": "build",
  "llm_backend": "ollama",
  "ollama_model": "llama3.2"
}
```

## 💡 Examples

### Web Application (English)

**calculator.en:**
```
Create a calculator app. Show a display area at the top for numbers.
Add buttons for digits 0-9, operations (+, -, *, /), clear, and equals.
Use a modern blue and white color scheme with rounded corners.
When users click buttons, perform calculations and show results.
```

Compile:
```bash
ailang compile calculator.en
```

### IoT Device (English)

**smart-garden.en:**
```
Read soil moisture from sensor on pin 4 every hour.
If moisture is below 30%, turn on water pump on pin 17 for 10 seconds.
Log all readings with timestamps to a CSV file.
Send me an email if the moisture stays low for more than 6 hours.
```

Compile:
```bash
ailang compile smart-garden.en --target iot
```

### Web App (Spanish)

**todo.es:**
```
Crear una aplicación de lista de tareas pendientes.
Mostrar un campo de entrada en la parte superior.
Agregar botón azul para crear nuevas tareas.
Mostrar tareas en una lista con casillas de verificación.
Usar diseño moderno con gradiente de azul a morado.
```

Compile:
```bash
ailang compile todo.es
```

### IoT (Arabic)

**security.ar:**
```
قراءة حالة مستشعر الحركة على المنفذ ٢٣ كل ثانية.
إذا اكتشف حركة، تشغيل الإنذار على المنفذ ١٧.
التقاط صورة من الكاميرا وإرسالها إلى بريدي الإلكتروني.
تسجيل جميع الأحداث مع التاريخ والوقت.
```

Compile:
```bash
ailang compile security.ar --target iot
```

## 🎯 Advanced Usage

### Multi-File Projects

**main.en:**
```
Load the login form from auth.en.
When user logs in successfully, show the dashboard from dashboard.en.
```

**auth.en:**
```
Create a login form with username and password fields.
Add a blue login button.
Validate credentials and return success or error.
```

### Hot Reload Development

```bash
ailang compile app.en --watch
```

Edit your `.en` file and see changes instantly!

### Custom LLM Endpoints

```bash
ailang config set llm_backend custom
ailang config set custom_endpoint http://localhost:8000/v1/generate
```

### Environment Variables

```bash
export AILANG_BACKEND=ollama
export AILANG_MODEL=llama3.2
export AILANG_OUTPUT_DIR=dist
```

## 🔧 Configuration Reference

### LLM Backends

| Backend | Description | Setup |
|---------|-------------|-------|
| `ollama` | Local Ollama server | Install Ollama + pull model |
| `llamacpp` | llama.cpp server | Run llama.cpp server on :8080 |
| `anthropic` | Claude API | Set API key |
| `openai` | GPT-4 API | Set API key |
| `custom` | Custom endpoint | Configure URL |

### Available Settings

```bash
llm_backend          # ollama, anthropic, openai, llamacpp, custom
ollama_model         # Model name for Ollama
ollama_url           # Ollama server URL
anthropic_api_key    # Claude API key
openai_api_key       # OpenAI API key
custom_endpoint      # Custom LLM endpoint
default_language     # Default source language (en, es, ar, etc.)
output_dir           # Output directory (default: build)
auto_open            # Auto-open after compile (true/false)
```

## 🌍 Supported Languages

| Language | Code | Example Extension |
|----------|------|-------------------|
| English | en | `.en` |
| Spanish | es | `.es` |
| Arabic | ar | `.ar` |
| French | fr | `.fr` |
| German | de | `.de` |
| Chinese | zh | `.zh` |
| Japanese | ja | `.ja` |
| Hindi | hi | `.hi` |
| Portuguese | pt | `.pt` |
| Russian | ru | `.ru` |

Want your language? [Request it here](https://github.com/rulhaq/ailang/issues)

## 🤝 Contributing

We welcome contributions! Here's how:

1. **Add language support** - Submit translations
2. **Improve compilation** - Better prompts, optimizations
3. **New targets** - Mobile, desktop, embedded
4. **Examples** - Share your AILang projects
5. **Documentation** - Tutorials, guides

See [CONTRIBUTING.md](CONTRIBUTING.md)

## 📦 Ecosystem

### IDE Support

- **VS Code Extension** - Syntax highlighting, autocomplete
- **Sublime Text** - Syntax highlighting
- **Vim Plugin** - Syntax, compilation

### Package Registry

Share and install AILang packages:
```bash
ailang install date-utils
ailang publish my-package
```

### Community Examples

Browse examples: https://github.com/ailang-examples

## 🐛 Troubleshooting

### "Compilation failed"

1. Check LLM backend is running:
```bash
# For Ollama
ollama list
curl http://localhost:11434/api/tags
```

2. Verify configuration:
```bash
ailang config get
```

3. Test with simple code:
```bash
echo "Show hello world" > test.en
ailang compile test.en
```

### "Ollama not found"

Install Ollama: https://ollama.ai

Or use cloud API:
```bash
ailang config set llm_backend anthropic
```

### Slow compilation

Use a smaller model:
```bash
ollama pull llama3.2:7b  # Smaller, faster
ailang config set ollama_model llama3.2:7b
```

## 📄 License

MIT License - See [LICENSE](LICENSE)

## 🙏 Credits

- Built with [Anthropic Claude](https://anthropic.com)
- Powered by [Ollama](https://ollama.ai)
- Inspired by natural language programming research

## 🌟 Star Us!

If you like AILang, give us a star on GitHub! ⭐

## 📞 Support

- **Discord**: https://discord.gg/ailang
- **GitHub Issues**: https://github.com/rulhaq/ailang/issues
- **Documentation**: https://github.com/rulhaq/ailang#documentation
- **Twitter**: [@ailang_dev](https://twitter.com/ailang_dev)

---

**Made with ❤️ by the AILang community**

*Programming should be as natural as speaking.*
